@@ -125,6 +125,28 @@ agent — only the convenience changes, never the rules above.
125125The non-negotiables (independent per-module audit, deterministic scripts, the four-role
126126fix gate) hold on every platform; the table only changes * how* you spawn the work.
127127
128+ ## Token efficiency
129+
130+ Almost all the cost is the per-module audit sub-tasks reading code — the scripts are
131+ nearly free. Levers, biggest first:
132+
133+ 1 . ** Audit on the cheapest capable model.** The audit is read-code + apply-fixed-rubric +
134+ emit-JSON; a small/fast model does it well, and ` apply_audit.py ` rejects bad output.
135+ Keep the top model for decomposition, theme synthesis, and fixes only.
136+ 2 . ** Read targeted, not whole.** The audit prompt (STANDARDS.md) greps markers and reads
137+ only the flagged regions; a huge file is scored from its size + a few excerpts, not a
138+ full read. Use ` query.py --format paths ` so a sub-task opens only its module's files.
139+ 3 . ** Batch the small modules.** Group tiny / low-coupling leaves (≤ ~ 150 LoC) into one
140+ sub-task that audits each independently (see STANDARDS.md). Core / large / high-coupling
141+ modules stay solo. This cuts the * number* of spawns (each spawn re-pays system-prompt +
142+ rubric overhead). ` query.py --max-score 100 --format json ` then group by loc/coupling.
143+ 4 . ** ` update ` , not ` init ` .** After the first build, only ever run ` update ` — it re-audits
144+ just the git-changed modules (` needs_audit ` ), so steady-state cost is tiny.
145+ 5 . ** Structure-first for big repos.** Run ` init ` in ** structure-only** mode (decompose +
146+ ` scan --write ` + render, * no audits* ) to get the map and LoC instantly and cheaply; the
147+ HTML renders unscored modules fine. Then fill scores over time with ` update ` / on-demand
148+ audits, cheapest-first or worst-suspected-first.
149+
128150---
129151
130152## Command: ` init ` (first build)
@@ -157,12 +179,14 @@ Use when no `modules.json` exists yet. (Also accepts `generate` as an alias.)
157179 yet). Coupling = structural centrality (low/med/high/core); core = the spine hubs.
1581802 . ** Compute size:** ` python3 scripts/scan.py --root <proj> --state <state> --write ` .
159181 It reports every module as ` unaudited ` .
160- 3 . ** Audit — one independent subagent per module, in parallel.** For each id in
161- ` needs_audit ` , spawn a subagent with the ` reference/STANDARDS.md ` prompt (filled with
182+ 3 . ** Audit — one independent sub-task per module, in parallel.** For each id in
183+ ` needs_audit ` , spawn a sub-task with the ` reference/STANDARDS.md ` prompt (filled with
162184 the module's label/paths). Collect each JSON result and apply it:
163185 ` python3 scripts/apply_audit.py --state <state> --id <id> --json '<result>' [--rev <git rev>] ` .
164- Batch the audits (dozens of modules → many parallel agents, but stay within sane
165- concurrency; chunk if needed).
186+ Run on the cheapest capable model, read targeted excerpts, and batch the small/leaf
187+ modules per * Token efficiency* + STANDARDS.md. ** Structure-only mode:** for a huge repo
188+ (or a fast/cheap first pass) you may SKIP this step entirely — render the map with no
189+ scores (it renders unscored modules fine), then fill scores later with ` update ` .
1661904 . ** Synthesize ` reportThemes ` ** (4–7 cross-cutting patterns) from the collected findings
167191 and write them into ` modules.json ` .
1681925 . ** Render:** run the render command. Then ** stamp the git baseline** so future updates
0 commit comments