You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: adopt dead helpers across codebase (#895)
* refactor: adopt dead helpers across codebase
Wire up extracted helpers from Titan runs that existed but were never
consumed, reducing boilerplate and improving error specificity.
- Adopt named_child_text across 27 sites in 11 Rust extractors
- Migrate cpp.rs from hand-rolled find_cpp_parent_class to find_enclosing_type_name
- Add toSymbolRef helper in shared/normalize.ts, adopt at 15 mapping sites
- Wire ParseError in parser.ts for structured PARSE_FAILED error codes
- Wire BoundaryError in boundaries.ts to distinguish config/DB failures from clean results
- Add --modules/--threshold flags to codegraph structure command
- Wire batchQuery in CLI batch command, removing duplicated routing logic
- Route detect-changes pending analysis through unified runAnalyses engine
* fix: address review feedback on dead helper adoption (#895)
- manifesto.ts: report 'warn' instead of 'pass' when boundary check throws
- structure.ts: validate --threshold flag rejects non-numeric input
- dependencies.ts: clarify intentional skip of toSymbolRef for callers
* feat(skill): add /titan-grind phase and wire into /titan-run pipeline
Forge extracts helpers but never completes the adoption loop — dead
symbol count inflates with every run. Grind closes the gap by finding
dead helpers from forge, classifying them (adopt/re-export/promote/
false-positive/remove), wiring them into consumers, and gating on a
non-positive dead-symbol delta.
Pipeline is now: recon → gauntlet → sync → forge → grind → close
* fix(skill): add resilience and codegraph usage to /titan-grind
- Track currentTarget, processedTargets, failedTargets in state for
mid-run resume after interruption
- Persist grind classifications to grind-targets.ndjson (append-only)
so re-runs skip already-analyzed targets
- Write titan-state.json after every target, not just at phase end
- Add interrupted-mid-target recovery logic in edge cases
- Use codegraph audit/context/fn-impact/where/query/ast before edits
- Add codegraph diff-impact --staged before commits
- Add codegraph build after edits to keep graph current
- Add --target flag for retrying individual failures
Copy file name to clipboardExpand all lines: .claude/skills/titan-run/SKILL.md
+117-8Lines changed: 117 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
name: titan-run
3
-
description: Run the full Titan Paradigm pipeline end-to-end by dispatching each phase to sub-agents with fresh context windows. Orchestrates recon → gauntlet → sync → forge automatically.
description: Run the full Titan Paradigm pipeline end-to-end by dispatching each phase to sub-agents with fresh context windows. Orchestrates recon → gauntlet → sync → forge → grind automatically.
-`--gauntlet-batch-size <N>` → batch size for gauntlet (default: 5)
21
21
-`--yes` → skip all confirmation prompts in the orchestrator (pre-pipeline, forge checkpoint, and resume prompts) and in forge (per-phase confirmation)
22
22
@@ -62,11 +62,11 @@ You are the **orchestrator** for the full Titan Paradigm pipeline. Your job is t
62
62
```bash
63
63
npm install -g @optave/codegraph@latest
64
64
```
65
-
Log the installed version (skip if codegraph is not available):
65
+
Log the installed version:
66
66
```bash
67
-
codegraph --version||true
67
+
codegraph --version
68
68
```
69
-
If the install fails or `codegraph` is not found, warn the user but continue — the sub-agents may still work if a project-local version is available.
69
+
If the install fails, warn the user but continue with whichever version is currently available.
70
70
71
71
5.**Sync with main** (once, before any sub-agent runs):
72
72
```bash
@@ -81,9 +81,10 @@ You are the **orchestrator** for the full Titan Paradigm pipeline. Your job is t
Each phase runs in a sub-agent with a fresh context window.
86
86
Forge requires explicit confirmation (analysis phases are safe to automate).
87
+
Grind runs after forge to adopt extracted helpers into consumers.
87
88
```
88
89
89
90
Start immediately — do NOT ask for confirmation before analysis phases. The user invoked `/titan-run`; that is the confirmation. Analysis phases (recon, gauntlet, sync) are read-only and safe to automate. The forge checkpoint (Step 3.5b) still applies unless `--yes` is set.
@@ -141,6 +142,7 @@ For each phase BEFORE `startPhase`, run the corresponding V-checks:
141
142
|`recon`| V1 structural fields only (domains, batches, priorityQueue, stats — skip `currentPhase == "recon"` check since later phases advance it), V2 (GLOBAL_ARCH.md), V3 (snapshot exists — WARN if missing), V4 (cross-check counts) |
142
143
|`gauntlet`| V5 (coverage ≥ 50%), V6 (entry completeness sample), V7 (summary consistency); also run NDJSON integrity check (2c) |
|`forge`| V14 (final state consistency), V15 (gate log consistency); execution block must exist in titan-state.json |
144
146
145
147
If ANY required artifact is **missing** → stop: "Cannot start from `<phase>` — `<artifact>` is missing. Run the full pipeline or start from an earlier phase."
146
148
@@ -632,6 +634,113 @@ Record `phaseTimestamps.forge.completedAt`.
632
634
633
635
---
634
636
637
+
## Step 4.5 — GRIND (loop)
638
+
639
+
Grind runs after forge to close the adoption loop. Forge extracts helpers; grind wires them into consumers and removes dead code. Without grind, the dead symbol count inflates with every forge phase.
640
+
641
+
**Skip if:**`--start-from` is `close`, or `titan-state.json → grind.completedPhases` already covers all forge phases.
642
+
643
+
### 4.5a. Pre-loop check
644
+
645
+
Record `phaseTimestamps.grind.startedAt` (only if not already set — grind may be resuming).
646
+
647
+
Read `.codegraph/titan/sync.json` → count total phases in`executionOrder`.
648
+
Read `.codegraph/titan/titan-state.json` → check `grind.completedPhases` (may not exist yet if grind hasn't started).
649
+
650
+
### 4.5b. Grind loop
651
+
652
+
Set `maxIterations = 20` (safety limit — same as forge).
After forge completes, dispatch `/titan-close` to produce the final report with before/after metrics and split commits into focused PRs.
@@ -676,7 +785,7 @@ Record `phaseTimestamps.close.completedAt`.
676
785
677
786
- **You are the orchestrator, not the executor.** Never run codegraph commands, edit source files, or make commits yourself. Only spawn sub-agents and read state files. Exceptions (pure validation/snapshot, no code changes): the post-forge test run (V13), NDJSON integrity checks, the V3 baseline snapshot check (`codegraph snapshot list`), and the pre-forge architectural snapshot capture (Step 3.5a) are run directly by the orchestrator.
678
787
- **Run the Pre-Agent Gate (G1-G4) before EVERY sub-agent.** No exceptions.
679
-
- **One sub-agent at a time.** Phases are sequential — recon before gauntlet, gauntlet before sync, sync before forge.
788
+
- **One sub-agent at a time.** Phases are sequential — recon before gauntlet, gauntlet before sync, sync before forge, forge before grind, grind before close.
680
789
- **Fresh context per sub-agent.** This is the whole point — each sub-agent gets a clean context window.
681
790
- **Read AND validate state files after every sub-agent.** Trust the on-disk state, not the sub-agent's text output — but verify the state is structurally sound.
682
791
- **Back up state before every sub-agent.** The `.bak` file is your safety net against mid-write crashes.
0 commit comments