Research-Stack/audit/consistency_audit.md
Allaun Silverfox 8e51acad08 audit: full codebase inspection — 6 auditors, 9,606 objects, 2,068 lines of findings
CRITICAL (7):
- C1: Hardcoded Wolfram Alpha API key (revoke immediately)
- C2: Q16_16 rounding diverges Lean↔Python↔C (data corruption)
- C3: Receipts describe non-existent files (fabrication)
- C4: '3,500+ proofs' = compilation units, not theorems
- C5: NaN sentinel collision Lean↔C (silent corruption)
- C6: eigensolid_convergence theorem is a tautology
- C7: 74% CI failure rate

HIGH (12): duplicate definitions, SQL injection, command injection,
  1,029 duplicate files, 66 large files in git, AGENTS.md drift

MEDIUM (23): stale docs, broken cross-refs, unhandled errors
LOW (31): naming violations, misplaced files, cleanup

Master synthesis: audit/MASTER_AUDIT_SYNTHESIS.md
Per-dimension reports: audit/*_audit.md
2026-06-21 02:07:35 -05:00

271 lines
12 KiB
Markdown

# Consistency Audit: Research-Stack Repository
**Repository:** https://github.com/allaunthefox/Research-Stack
**Branch:** main
**Audit Date:** 2025-06-21
**Scope:** ALL 8,449 tracked files across entire repository
---
## Summary
| Category | Count | Severity |
|----------|-------|----------|
| Naming convention violations | **220** | Medium |
| Misplaced files | **111** | High |
| Version skew issues | **5** | Medium |
| Dead symlinks | **2** | Low |
| Duplicate content sets | **441** | High |
| Removed feature references | **4** | Low |
| Gitignore gaps | **179** | Medium |
**Total issues:** 962
**Critical:** 0 blocking
**High:** 2 categories (misplaced files, duplicates)
---
## Critical Issues
None identified. No blocking inconsistencies that prevent builds or cause data loss.
---
## High Severity Issues
### H1: NoDupeLabs Code Duplication Across Layers (530 + 499 files)
The NoDupeLabs project exists as near-identical copies in **both** `4-Infrastructure/NoDupeLabs/` (530 files) and `5-Applications/nodupe/` (499 files). This is the single largest source of repository bloat from iteration drift.
**Evidence (git blob hashes match):**
- `4-Infrastructure/NoDupeLabs/tests/core/test_database_comprehensive.py` == `5-Applications/nodupe/tests/core/test_database_comprehensive.py` (109KB each)
- `4-Infrastructure/NoDupeLabs/.integrity/SHA512SUMS.txt` == `5-Applications/nodupe/.integrity/SHA512SUMS.txt` (101KB each)
- `4-Infrastructure/NoDupeLabs/tests/core/test_coverage_100_percent.py` == `5-Applications/nodupe/tests/core/test_coverage_100_percent.py` (84KB each)
- 100+ more files with identical SHA hashes
**Recommended action:** Determine which is canonical (likely `4-Infrastructure/NoDupeLabs/` per ARCHITECTURE.md) and remove the `5-Applications/nodupe/` copy. Add a README explaining the canonical location.
### H2: 26MB GIF Duplicated in text-to-cad
`5-Applications/text-to-cad/skills/cad/assets/text-to-cad-demo.gif` (25.1MB) and `5-Applications/text-to-cad/skills/urdf/assets/text-to-cad-demo.gif` (25.1MB) are identical content. Total waste: **26MB**.
**Recommended action:** Symlink or reference a single canonical asset location.
### H3: 111 Misplaced Files Across Layers
Files are located in directories that do not match their layer's architectural purpose per ARCHITECTURE.md. The largest category is documentation markdown files (99 files) misplaced in `0-Core-Formalism/` (24 files) and `5-Applications/` (75 files).
---
## Medium Severity Issues
### M1: Naming Convention Violations (220 files)
**AGENTS.md convention:** PascalCase types, camelCase functions. Lean modules should use PascalCase.
**Lean files with lowercase_snake names (213 files):**
- Test/debug files: `debug_eval.lean`, `test_native_decide.lean`, `braided_field_sim.lean`
- AlphaProofNexus adapters: 100+ files like `erdos_12.parts.i.lean`, `erdos_125.variants.positive_lower_density.lean`, `graph_conjecture2.lean`, `green_57.lean`
- Extension scaffold files: `bipartite_reconstruction.lean`, `green_tao_5_4.lean`, etc.
**Python files with PascalCase names (7 files):**
- `1-Distributed-Systems/agents/claw/src/QueryEngine.py`
- `1-Distributed-Systems/agents/claw/src/Tool.py`
- `2-Search-Space/search/whoogle-search/misc/update-translations.py`
- `2-Search-Space/simulations/Newtonian-Superfluid-Simulation/AtomSim.py`
- `2-Search-Space/simulations/Newtonian-Superfluid-Simulation/Galaxy.py`
- `2-Search-Space/simulations/Newtonian-Superfluid-Simulation/GalaxyRing.py`
- `2-Search-Space/simulations/Newtonian-Superfluid-Simulation/Universe.py`
**Recommended action:** Rename Lean modules to PascalCase. Rename Python modules to snake_case per PEP 8.
### M2: Gitignore Gaps (179 files)
The `.gitignore` file is comprehensive (260+ patterns) but **179 files** that match gitignore patterns are still committed:
| Category | Count | Examples |
|----------|-------|----------|
| AI tool configs | 11 | `.vscode/`, `.cursor/`, `.devin/`, `.roo/`, `.windsurf/` files |
| `shared-data/` directory | 164 | Receipts, benchmarks, blockchain corpus |
| Root symlinks | 1 | `result-devcontainer` |
| Quarantine files | 3 | `.quarantine` files |
**Recommended action:** These files were likely force-added via `git add -f` or added before patterns were created. Run `git rm --cached` for truly generated files. For `shared-data/`, either remove from git (if truly generated) or remove from `.gitignore`.
### M3: Version Skew - Multiple lakefile Formats (5 files)
Five `lakefile.*` files exist with **different formats**, suggesting version drift:
| File | Format | Status |
|------|--------|--------|
| `0-Core-Formalism/lean/Semantics/lakefile.toml` | TOML | **Canonical** - main workspace |
| `0-Core-Formalism/otom/tools/lean/Semantics/lakefile.lean` | Lean | **Legacy format** - should migrate to TOML |
| `0-Core-Formalism/lean/external/OTOM/lakefile.toml` | TOML | External dependency |
| `0-Core-Formalism/lean/singer-theorem-lean/lakefile.toml` | TOML | Separate project |
| `lean_binned/lakefile.toml` | TOML | Separate project |
**Recommended action:** Migrate `lakefile.lean` to `lakefile.toml` format for consistency.
### M4: Duplicate Semantics Module Names (32 pairs)
32 Lean modules have **duplicate filenames** in different directories within `0-Core-Formalism/lean/Semantics/`. These may have diverged or be stale copies:
| Filename | Locations |
|----------|-----------|
| `Bind.lean` | `Semantics/` and `Semantics/Components/` |
| `Core.lean` | `ExtensionScaffold/Compression/` and `Semantics/Components/` and `Semantics/HCMMR/` and `Semantics/InvariantReceipt/` and `Semantics/TMMCP/` |
| `Bridge.lean` | `Semantics/Adapters/AlphaProofNexus/` and `Semantics/HCMMR/` |
| `ReceiptCore.lean` | `Semantics/` and `otom/tools/lean/Semantics/Semantics/` |
| `Constitution.lean` | `Semantics/` and `otom/tools/lean/Semantics/Semantics/` |
| `FAMM.lean` | `Semantics/` and `otom/tools/lean/Semantics/Semantics/` |
**Recommended action:** Audit each pair to determine which is canonical. Remove or rename stale copies.
---
## Low Severity Issues
### L1: Dead Symlinks (2)
| Symlink | Target | Issue |
|---------|--------|-------|
| `4-Infrastructure/bin/share` | `/home/allaun/Research Stack/tools/bin/nextpnr-himbaechel-share` | Absolute path to author's local machine |
| `result-devcontainer` | `/nix/store/iajh1kzizdnb8ih88wd0rczdqmyg456v-research-stack-otom.tar.gz` | Absolute nix store path (GC may delete) |
**Recommended action:** Replace absolute symlinks with relative paths or add a setup script.
### L2: Legacy Directory Content (4 files)
`0-Core-Formalism/lean/Semantics/legacy/` contains 4 files that reference deprecated concepts. The `.gitignore` explicitly excludes `0-Core-Formalism/lean/Semantics/Ancillary/LegacyQuarantine/` but these are in a different `legacy/` directory.
Files:
- `0-Core-Formalism/lean/Semantics/legacy/6point5sigma/HamiltonianMechanics.lean`
- `0-Core-Formalism/lean/Semantics/legacy/6point5sigma/plan.md`
- `0-Core-Formalism/lean/Semantics/legacy/6point5sigma/HamiltonianMechanics.graphml`
- `0-Core-Formalism/lean/Semantics/legacy/RealityContractMassNumber.lean`
### L3: OpenClaw References
OpenClaw was decommissioned per AGENTS.md (2026-06-20). No references found in code. The `.gitignore` correctly excludes `5-Applications/tools-scripts/external/openclaw/`. Clean removal verified.
### L4: Large Files in Repository (67 files > 1MB)
The repository contains 67 files larger than 1MB (total: ~370MB). Git does not handle large files well. Consider using Git LFS for:
- `shared-data/papers/2026-05/2511.21459.pdf` (44.9MB)
- `5-Applications/text-to-cad/skills/*/assets/text-to-cad-demo.gif` (25.1MB each)
- `3-Mathematical-Models/equations_compressed/*.compressed` (24.2MB)
- `4-Infrastructure/hardware/cff_accelerator.json` (13.8MB)
- 11 WAV audio files in `2-Search-Space/simulations/matter-frequencies/` (11MB each)
---
## Per-Directory Breakdown
### `0-Core-Formalism/` (1,602 files) - Core Formalism Layer
**Issues found:**
- 24 markdown docs that should be in `6-Documentation/`
- 213 Lean files with lowercase_snake names (should be PascalCase)
- 1 AGENTS.md that belongs at repo root
- 4 legacy files referencing deprecated concepts
- 32 duplicate module names (same filename in different subdirs)
- 2 lakefiles with potential version skew
- 1 Rust project (`ftdi_gimbal/`) in formalism layer
- Quarantine files: `Q064Experimental.lean`, 3 `.quarantine` files
### `1-Distributed-Systems/` (207 files)
**Issues found:**
- 2 Python files with PascalCase names (`QueryEngine.py`, `Tool.py`)
- Cargo.toml workspace nesting is normal (workspace with member crates)
### `2-Search-Space/` (1,627 files)
**Issues found:**
- 4 Python files with PascalCase names in `Newtonian-Superfluid-Simulation/`
- 1 Python file with hyphens (`update-translations.py`)
- Large WAV files (11MB each) should use Git LFS
- Duplicate SVG assets (big-logo.svg / biglogo-with-text.svg)
### `3-Mathematical-Models/` (171 files)
**Issues found:**
- 1 large compressed file (24.2MB) should use Git LFS
### `4-Infrastructure/` (1,419 files)
**Issues found:**
- 1 dead symlink (`bin/share` -> absolute path)
- 530 NoDupeLabs files duplicated in `5-Applications/nodupe/`
- 1 large JSON file (`hardware/cff_accelerator.json`, 13.8MB)
### `5-Applications/` (1,281 files)
**Issues found:**
- 1 Python script at root (`fix_offloat.py`) should be here
- 75 markdown docs (hutter_prize docs) that should be in `6-Documentation/`
- 499 NoDupeLabs files duplicated from `4-Infrastructure/NoDupeLabs/`
- 1 dead symlink (`result-devcontainer`)
- 26MB GIF duplicated in text-to-cad
- Verilog files (`out/verilog/*.v`) should be in `4-Infrastructure/hardware/`
### `6-Documentation/` (1,586 files)
**Issues found:**
- 6 Lean files in `docs/geoweird/` that should be in `0-Core-Formalism/lean/`
- 2 Lean files in `invention_record/` that should be in `0-Core-Formalism/lean/`
- 1 quarantine file (`DRIFT_QUARANTINE_YANG_MILLS_SPEC.md`)
### `6-Kernel-Shim/` (not in main tree count)
**Issues found:**
- 2 C kernel modules (`pist_compress.c`, `pist_neuromorphic.c`) should be in `4-Infrastructure/`
### Root Level (96 files)
**Issues found:**
- 1 Python script (`fix_offloat.py`) at root
- 1 dead symlink (`result-devcontainer`)
- 1 data symlink (`data`)
- 2 duplicate README.md entries at root (git artifact)
### Dot-Directories (88 files)
**Issues found:**
- 11 AI tool config files committed despite being in `.gitignore`
- `.devin/skills/lean-proof/SKILL.md` is intentionally committed (skill for agents) but parent `.devin/` is gitignored -- this creates confusion
---
## Recommendations by Priority
### Immediate (this week)
1. **Remove NoDupeLabs duplicate** from `5-Applications/nodupe/` (499 files, ~2MB)
2. **Deduplicate text-to-cad GIF** (save 26MB)
3. **Fix dead symlinks** - make relative or document
### Short-term (this month)
4. **Move markdown docs** from `0-Core-Formalism/` and `5-Applications/` to `6-Documentation/`
5. **Move C kernel modules** from `6-Kernel-Shim/` to `4-Infrastructure/`
6. **Clean up `.quarantine` files** (3 files)
7. **Migrate `lakefile.lean`** to `lakefile.toml`
### Medium-term (next quarter)
8. **Audit 32 duplicate Semantics modules** - determine canonical versions
9. **Rename Lean files** to PascalCase (213 files)
10. **Rename Python files** to snake_case (7 files)
11. **Set up Git LFS** for large files (>1MB)
12. **Clean up `shared-data/`** - either remove from git or remove from `.gitignore`
---
## Appendix: Methodology
1. Read AGENTS.md for naming conventions
2. Read ARCHITECTURE.md for layer structure
3. Parsed `audit_file_tree.json` (8,449 files)
4. Queried GitHub API for git tree blob hashes (9,661 objects)
5. Queried GitHub API for symlink targets
6. Checked `.gitignore` against committed files
7. Cross-referenced file paths against layer architecture