Pre-existing rustfmt drift across the workspace was blocking CI's
`Rustfmt` check on PR #373 + PR #377. Running plain `cargo fmt`
reformats 427 files; no semantic changes, no logic changes, no
behavior changes — just what rustfmt already wanted.
None of the touched files are in ruvector-rabitq, ruvector-rulake,
or the new mirror-rulake workflow — those were already fmt-clean
per the per-crate checks on commits 5a4b0d782, 5f32fd450, f5003bc7b.
Drift is in cognitum-gate-kernel, mcp-brain, nervous-system,
prime-radiant, ruqu-core, ruvector-attention, ruvector-mincut,
ruvix/* and sub-crates, plus several examples.
Verified post-fmt:
cargo check -p ruvector-rabitq -p ruvector-rulake → clean
cargo clippy -p ... -p ... --all-targets -- -D warnings → clean
cargo test -p ... -p ... --release → 82/82 pass
Intentionally does NOT touch clippy drift — many more warnings
(missing docs, precision-loss casts, too-many-args, unsafe-safety-
docs) spread across unrelated crates, each category a cross-cutting
design decision that deserves its own review.
With this commit Rustfmt CI goes green on PR #373 and PR #377.
Clippy will still fail — that's honest pre-existing state for a
separate dedicated PR.
Co-Authored-By: claude-flow <ruv@ruv.net>
run_on_cli.rs: --output-dir now writes all modules as .js files
- 1,029 Louvain-detected modules written to source/ directory
- Auto-balances braces, parens, brackets on each module
- Auto-fixes try-without-catch patterns
- Writes witness.json and metrics.json
- Writes tree hierarchy to tree/ subdirectory
Claude Code results: 722/863 modules parse (83.6%)
Remaining 141 failures mostly from paren imbalance in string edge cases.
Co-Authored-By: claude-flow <ruv@ruv.net>
Folder structure emerges from the dependency graph — not hardcoded keywords.
tree.rs (362 lines):
- Agglomerative clustering on inter-module edge weights
- TF-IDF naming: most discriminative strings name each folder
- Recursive depth control (configurable max_depth, min_folder_size)
inferrer.rs: infer_folder_name() with TF-IDF scoring
types.rs: ModuleTree struct, hierarchical config options
run_on_cli.rs: --output-dir prints folder tree to disk
module-splitter.js: JS-side tree builder with same approach
Key principle: tightly-coupled code shares a folder,
MinCut boundaries become folder boundaries, names from context.
59 tests passing, zero warnings.
Co-Authored-By: claude-flow <ruv@ruv.net>
Bottleneck 1 - Parser: 18.3s → 4.5s (4x faster)
- Single-pass body scanner replaces 3 regex passes per declaration
- scan_body_single_pass() collects strings, props, idents in one traversal
Bottleneck 2 - Partitioning: skipped → 33s (now works on 27K nodes)
- Louvain community detection for graphs ≥5K nodes
- Detects 1,029 modules in Claude Code (was 1 or skipped)
- Falls back to exact MinCut for <5K nodes
Bottleneck 3 - Memory: 592MB → 568MB (incremental, more needed)
- Pre-allocated output buffers in beautifier
- Direct write via format_declaration_into() / indent_braces_into()
Bottleneck 4 - Name inference: 5.2% → 5.2% HIGH (training data loaded)
- 50 domain-specific patterns in data/claude-code-patterns.json
- TrainingCorpus with compile-time embedding via include_str!()
- Runtime corpus loading via TrainingCorpus::from_json()
51 tests passing, zero warnings.
Co-Authored-By: claude-flow <ruv@ruv.net>