Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
fec01d4
docs: promote #83 (brief command) and #71 (type inference) to Tier 0 …
carlos-alm Mar 16, 2026
33aabcc
Merge branch 'main' of https://github.com/optave/codegraph
carlos-alm Mar 16, 2026
41d664f
docs: add Phase 4 (Native Analysis Acceleration) to roadmap
carlos-alm Mar 16, 2026
a16cf19
merge: resolve conflicts with origin/main in ROADMAP.md
carlos-alm Mar 16, 2026
5f82586
Merge branch 'main' into docs/roadmap-phase4-native-acceleration
carlos-alm Mar 16, 2026
fb539be
Merge branch 'main' into docs/roadmap-phase4-native-acceleration
carlos-alm Mar 16, 2026
30fdd26
docs: fix sub-section numbering to match parent phase headings
carlos-alm Mar 16, 2026
5511385
Merge remote-tracking branch 'origin/main' into docs/roadmap-phase4-n…
carlos-alm Mar 17, 2026
2fce690
fix: align version computation between publish.yml and bench-version.js
carlos-alm Mar 17, 2026
3b6dccf
feat: auto-detect semver bump in /release skill when no version provided
carlos-alm Mar 17, 2026
b0e5c30
feat: add /titan-run orchestrator with diff review, semantic assertio…
carlos-alm Mar 21, 2026
bb37b52
Merge remote-tracking branch 'origin/main' into pr-557-merge
carlos-alm Mar 21, 2026
f6a15cf
fix: correct undefined variable in titan-run gauntlet efficiency check
carlos-alm Mar 21, 2026
61035c2
fix: address Greptile review feedback on titan-run skill
carlos-alm Mar 21, 2026
ea192ea
fix: address Greptile review feedback on titan-run skill
carlos-alm Mar 21, 2026
f3d16a1
Merge branch 'main' into feat/release-skill-auto-semver
carlos-alm Mar 21, 2026
af56987
Merge branch 'main' into feat/release-skill-auto-semver
carlos-alm Mar 21, 2026
58f2238
fix: restore FORGE to codegraph exports and fn-impact in tool table
carlos-alm Mar 21, 2026
5168c3d
fix: unstage files before restoring working tree in forge Step 13 rol…
carlos-alm Mar 22, 2026
9c1433a
fix: add GATE to exports/fn-impact and FORGE to context in command table
carlos-alm Mar 22, 2026
1144217
fix: update --yes description to reflect actual orchestrator scope
carlos-alm Mar 22, 2026
a296b58
chore: checkpoint stale working tree changes from prior sessions
carlos-alm Mar 22, 2026
acee01f
Revert "chore: checkpoint stale working tree changes from prior sessi…
carlos-alm Mar 22, 2026
1f74144
Merge branch 'feat/release-skill-auto-semver' of https://github.com/o…
carlos-alm Mar 22, 2026
e5501fc
fix: correct command table and --yes flag documentation
carlos-alm Mar 22, 2026
05a4281
fix: address titan-gate review feedback — Louvain drift, temp paths, …
carlos-alm Mar 22, 2026
5dded2f
fix: address titan-run review feedback — --yes scope and --start-from…
carlos-alm Mar 22, 2026
15c051d
Merge branch 'main' into feat/release-skill-auto-semver
carlos-alm Mar 22, 2026
9274f3f
fix: titan-run review — Rules exceptions, skip-flag validation, test …
carlos-alm Mar 22, 2026
f37ec9e
fix: persist arch temp dir path to file instead of shell variable (#557)
carlos-alm Mar 23, 2026
058f027
fix: capture git SHA in shell before node -e to avoid unevaluated sub…
carlos-alm Mar 23, 2026
9fe3b70
fix: extend no-rollback exception to include semantic failures (Steps…
carlos-alm Mar 23, 2026
e4b6d9f
fix: add explicit DIFF WARN verdicts to D5 leftover check (#557)
carlos-alm Mar 23, 2026
a6bb425
fix: remove duplicate diff-impact call in Step 5c, add before/after c…
carlos-alm Mar 23, 2026
6f25000
Merge branch 'main' into feat/release-skill-auto-semver
carlos-alm Mar 23, 2026
4e8669c
fix: correct stale step reference and use unique temp path in titan-g…
carlos-alm Mar 23, 2026
ed4851c
fix: remove stale --yes from argument-hint and add D5 explicit verdic…
carlos-alm Mar 23, 2026
5d259ac
Merge remote-tracking branch 'origin/feat/release-skill-auto-semver' …
carlos-alm Mar 23, 2026
ce85671
fix: address open review items in titan-gate and titan-forge (#557)
carlos-alm Mar 23, 2026
e5d8901
fix: address round 2 Greptile feedback on titan-gate and titan-forge …
carlos-alm Mar 23, 2026
bef6a03
fix: correct Step 5b reference from Step 2 to Step 1 in titan-gate (#…
carlos-alm Mar 23, 2026
c36861d
fix: replace bash process substitution with temp file in D4 deletion …
carlos-alm Mar 23, 2026
cd51577
fix: clarify A2 boundary check uses diff-impact edges not snapshot (#…
carlos-alm Mar 23, 2026
1f5cc23
fix: restore FORGE to complexity --health command table row (#557)
carlos-alm Mar 23, 2026
512ba3c
fix: add V3 snapshot list to orchestrator Rules exception list (#557)
carlos-alm Mar 23, 2026
cd07a93
fix: replace A4 new-drift-warning check with resolved-drift positive …
carlos-alm Mar 23, 2026
5707a1f
fix: add RUN to communities/structure rows and snapshot list entry in…
carlos-alm Mar 23, 2026
d1d704b
Merge branch 'main' into feat/release-skill-auto-semver
carlos-alm Mar 23, 2026
054030e
fix(skill): distinguish semantic vs test/lint gate failures in forge …
carlos-alm Mar 23, 2026
112c062
fix(skill): add V3 to pre-validation, fix efficiency/stall overlap (#…
carlos-alm Mar 23, 2026
57ea4d7
fix(skill): add FAIL message template to Step 5d barrel export check …
carlos-alm Mar 23, 2026
f3d637a
fix(titan-run): track per-target progress in forge stall detection (#…
carlos-alm Mar 23, 2026
c3ccac8
Merge branch 'main' into feat/release-skill-auto-semver
carlos-alm Mar 23, 2026
095c198
Merge branch 'main' into feat/release-skill-auto-semver
carlos-alm Mar 23, 2026
30328fa
fix: remove duplicate previousCompletedPhases assignment in titan-run…
carlos-alm Mar 23, 2026
e2a1828
fix: scope A2 domain check to new edges only in titan-gate (#557)
carlos-alm Mar 23, 2026
eb28018
fix: guarantee Step 5d barrel cleanup runs on FAIL verdict (#557)
carlos-alm Mar 23, 2026
3f6b519
Merge branch 'main' into feat/release-skill-auto-semver
carlos-alm Mar 23, 2026
b308512
fix(titan-gate): use Step 1 --staged results for boundary check (#557)
carlos-alm Mar 23, 2026
862863d
fix(titan-forge): clarify rollback, document --yes, init diffWarnings…
carlos-alm Mar 23, 2026
d8bc686
Merge branch 'feat/release-skill-auto-semver' of https://github.com/o…
carlos-alm Mar 23, 2026
382fbf6
fix(titan-gate): replace codegraph deps with path-based layer inferen…
carlos-alm Mar 23, 2026
7f45252
fix(titan-forge): handle dead-code targets in D2 intent-match check
carlos-alm Mar 23, 2026
f92521d
fix(titan-run): add try/catch to arch-snapshot builder script
carlos-alm Mar 23, 2026
e6ed6c6
fix(titan-run): document explicit G3 state recovery procedure
carlos-alm Mar 23, 2026
7760313
fix(titan-run): guard NDJSON integrity check against missing file
carlos-alm Mar 23, 2026
27b76d5
fix(docs): remove stale GATE consumer from codegraph deps command table
carlos-alm Mar 24, 2026
b85ba9b
Merge branch 'main' into feat/release-skill-auto-semver
carlos-alm Mar 24, 2026
a3dd667
fix(titan-run): make checkpoint snapshot status conditional on captur…
carlos-alm Mar 24, 2026
eace8d5
fix(titan-forge): add explicit DIFF FAIL rollback commands and diffWa…
carlos-alm Mar 24, 2026
51b6f47
fix(skill): set autoConfirm=true after checkpoint so forge sub-agents…
carlos-alm Mar 24, 2026
7c14915
fix(skill): add --yes to titan-forge argument-hint frontmatter (#557)
carlos-alm Mar 24, 2026
b707c33
Merge branch 'main' into feat/release-skill-auto-semver
carlos-alm Mar 24, 2026
7f4212e
fix(skill): remove D1 from diffWarnings schema — D1 only produces FAI…
carlos-alm Mar 24, 2026
db19f22
fix(skill): clarify unexpected-commits as context-gathering in titan-…
carlos-alm Mar 24, 2026
7ee3970
fix(skill): document A3/A4 committed-state limitation in titan-gate (…
carlos-alm Mar 24, 2026
18371c6
Merge branch 'main' into feat/release-skill-auto-semver
carlos-alm Mar 24, 2026
84c322c
fix: handle arch capture failures and skip V13 when no commits (#557)
carlos-alm Mar 24, 2026
2fa2c3b
fix(skill): preserve file extension in temp files for D4 and barrel v…
carlos-alm Mar 24, 2026
eb6bff3
Merge branch 'main' into feat/release-skill-auto-semver
carlos-alm Mar 24, 2026
382b7ac
fix(skill): surface diffWarnings count in titan-run final report (#557)
carlos-alm Mar 24, 2026
6d16df1
fix(skill): use diff-impact edges for titan-gate Step 5b import check…
carlos-alm Mar 24, 2026
54eac34
Merge branch 'main' into feat/release-skill-auto-semver
carlos-alm Mar 24, 2026
f720620
fix(skill): skip currentPhase check in Step 0.5 pre-validation (#557)
carlos-alm Mar 24, 2026
110ce86
fix(skill): add RUN as reader for gauntlet, sync, and gate-log artifa…
carlos-alm Mar 24, 2026
15cec0e
Merge remote-tracking branch 'origin/feat/release-skill-auto-semver' …
carlos-alm Mar 24, 2026
b747523
fix(skill): add codegraph where to README command table (#557)
carlos-alm Mar 24, 2026
38a7908
fix(skill): add step 3.5 skip condition, move A2 before snapshot gate…
carlos-alm Mar 24, 2026
dcce198
fix(skill): init autoConfirm from --yes at parse time, fix snapshotSt…
carlos-alm Mar 24, 2026
29f4205
fix(skill): add GLOBAL_ARCH.md guard to A2 dependency direction check…
carlos-alm Mar 24, 2026
4b7ed74
Merge branch 'main' into feat/release-skill-auto-semver
carlos-alm Mar 24, 2026
d92797e
fix(skill): clarify diffWarnings append, A3 sources, V13 test detecti…
carlos-alm Mar 24, 2026
98ca369
fix(skill): add explicit test runner detection to forge Step 10 (#557)
carlos-alm Mar 24, 2026
f951c52
fix: increase vitest hookTimeout to 30s for Windows CI (#557)
carlos-alm Mar 24, 2026
028dcad
fix(skill): move V13 failure-stop inside test block, add divergence w…
carlos-alm Mar 24, 2026
7cc0a88
fix(skill): cycle FAIL triggers rollback, Step 13 uses git diff for f…
carlos-alm Mar 24, 2026
876b3c1
Merge branch 'main' into feat/release-skill-auto-semver
carlos-alm Mar 24, 2026
ae221ab
fix(skill): expand --start-from hint, add || true to divergence fetch…
carlos-alm Mar 24, 2026
759f612
fix: align .claude/** glob prefix with existing exclude patterns (#557)
carlos-alm Mar 24, 2026
c553800
fix(skill): separate Step 5c and A2 boundary checks to avoid duplicat…
carlos-alm Mar 24, 2026
d0ebca0
fix(skill): add cycle to forge Step 11 routing and gate rollback labe…
carlos-alm Mar 24, 2026
ce3f36e
Merge branch 'main' into feat/release-skill-auto-semver
carlos-alm Mar 24, 2026
c83683f
fix(skill): clarify FAIL labels, complexity routing, stale fetch (#557)
carlos-alm Mar 24, 2026
09134eb
fix(skill): move divergence check before checkpoint print block (#557)
carlos-alm Mar 24, 2026
a93313e
fix(skill): disambiguate D3|D5 schema notation in diffWarnings (#557)
carlos-alm Mar 24, 2026
dd28638
fix(skill): add new-file guard to Step 5a and explicit dedup tracking…
carlos-alm Mar 24, 2026
e3f3ff5
fix(skill): include failedTargets in forge stall detection to avoid f…
carlos-alm Mar 24, 2026
23de02d
fix(skill): detect yarn/pnpm/bun in test command detection via lock f…
carlos-alm Mar 24, 2026
b7ce806
fix(skill): replace <test-runner> placeholder with lock-file detectio…
carlos-alm Mar 24, 2026
317f79c
fix(skill): use dynamic file discovery in DIFF FAIL rollback instead …
carlos-alm Mar 24, 2026
a5daf34
fix(skill): resolve cycle-rollback ambiguity across gate/forge/run (#…
carlos-alm Mar 24, 2026
841459e
fix(skill): detect yarn/pnpm/bun for lint and build commands in gate …
carlos-alm Mar 24, 2026
713b48d
fix(skill): update forge Rules rollback description to include unstag…
carlos-alm Mar 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 95 additions & 12 deletions .claude/skills/titan-forge/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Your goal: read `sync.json`, find the next incomplete execution phase, make the
- `--phase N` → jump to specific phase
- `--target <name>` → run single target only (for retrying failures)
- `--dry-run` → show what would be done without changing code
- `--yes` → skip confirmation prompt
- `--yes` → skip confirmation prompt (typically passed by `/titan-run` orchestrator)

---

Expand Down Expand Up @@ -55,7 +55,8 @@ Your goal: read `sync.json`, find the next incomplete execution phase, make the
"failedTargets": [],
"commits": [],
"currentSubphase": null,
"completedSubphases": []
"completedSubphases": [],
"diffWarnings": []
}
}
```
Expand Down Expand Up @@ -135,27 +136,109 @@ For each target in the current phase:

7. **Apply the change** based on phase strategy (Step 1) + gauntlet recommendation.

8. **Run tests:**
8. **Stage changed files:**
```bash
npm test 2>&1
git add <specific changed files>
```
If tests fail → go to rollback (step 11).

9. **Run /titan-gate:**
Use the Skill tool to invoke `titan-gate`. If FAIL → go to rollback (step 11).
9. **Diff review (intent verification):**
Before running gate or tests, verify the diff matches the intent. This catches cases where the code change is structurally valid but doesn't match what was planned.

10. **On success:**
Collect the context:
```bash
git diff --cached --stat
git diff --cached
```

Load the gauntlet entry for this target (from `gauntlet.ndjson`) and the sync plan entry (from `sync.json → executionOrder.find(e => e.phase === currentPhase)`).

**Check all of the following:**

**D1. Scope — only planned files touched:**
Compare staged file paths against `sync.json → executionOrder.find(e => e.phase === currentPhase).targets` and their known file paths (from gauntlet entries). Flag any file NOT associated with the current target or phase.
- File in a completely different domain → **DIFF FAIL**
- File is a direct dependency of the target (consumer or import) → **OK** (expected ripple)
- Test file for the target → **OK**

**D2. Intent match — diff aligns with gauntlet recommendation:**
First, check if this target is a dead-code target (present in `titan-state.json → roles.deadSymbols`). If so, the expected recommendation is "remove dead code" — skip gauntlet entry lookup (dead-code targets have no gauntlet.ndjson entry) and verify the diff shows only deletions (no new functions or logic added). If the diff contains non-trivial additions for a dead-code target → **DIFF FAIL**.

Otherwise, read the gauntlet entry's `recommendation` field and `violations` list. Verify the diff addresses them:
- If recommendation says "split" → diff should show new functions extracted, original simplified
- If recommendation says "remove dead code" → diff should show deletions, not additions
- If violation was "complexity > threshold" → diff should reduce complexity, not just move code around
- If the diff does something **entirely different** from the recommendation → **DIFF FAIL**

**D3. Commit message accuracy:**
Compare the planned commit message from `sync.json` against what the diff actually does.
- Message says "remove dead code" but diff adds new functions → **DIFF WARN**
- Message says "extract X from Y" but diff only modifies Y without creating X → **DIFF FAIL**

**D4. Deletion audit:**
If the diff deletes code (lines removed > 10), identify deleted symbols by comparing the pre-change file against removed lines:
```bash
# Get the pre-change version's symbols (temp file for shell portability)
D4_PRE_EXT="${changed_file##*.}"
D4_PRE_TMP=$(mktemp "/tmp/titan-d4-pre-XXXXXX.${D4_PRE_EXT}")
git show HEAD:<changed-file> > "$D4_PRE_TMP"
codegraph where --file "$D4_PRE_TMP" -T --json 2>/dev/null
rm -f "$D4_PRE_TMP"
```
Cross-reference with `git diff --cached -- <changed-file>` to find symbols whose definitions appear only in removed lines (lines starting with `-`). For each deleted symbol:
```bash
codegraph fn-impact <deleted-symbol> -T --json 2>/dev/null
```
If the deleted symbol has active callers not updated in this diff → **DIFF FAIL**: "Deleted <symbol> still has <N> callers not updated in this commit."

**D5. Leftover check:**
If the gauntlet recommendation mentioned specific symbols to remove/refactor, verify they were actually addressed:
- Dead symbols listed for removal but still present in the diff → **DIFF WARN**: "Gauntlet listed `<symbol>` for removal but it was not deleted."
- Functions marked for decomposition but original is unchanged → **DIFF WARN**: "Gauntlet recommended decomposing `<symbol>` but original function was not simplified."
- If all recommended symbols were addressed → **DIFF PASS** (implicit — no warnings emitted)

**On DIFF FAIL:**
```bash
git reset HEAD -- $(git diff --cached --name-only)
git checkout -- $(git diff --name-only)
```
Add to `execution.failedTargets` with reason starting with `"diff-review: "`. Continue to next target.
**On DIFF WARN:** Log the warning but proceed to gate. Include the warning in the gate-log entry.

10. **Run tests** — detect the project's test command from `package.json` (same detection as gate Step 4):
```bash
testCmd=$(node -e "const p=require('./package.json');const s=p.scripts||{};const script=s.test?'test':s['test:ci']?'test:ci':null;if(!script){console.log('NO_TEST_SCRIPT');process.exit(0);}const fs=require('fs');const runner=fs.existsSync('yarn.lock')?'yarn':fs.existsSync('pnpm-lock.yaml')?'pnpm':fs.existsSync('bun.lockb')?'bun':'npm';console.log(runner+(script==='test'?' test':' run '+script));")
```
- If `testCmd == "NO_TEST_SCRIPT"` → skip pre-gate test run (no test script configured).
- Otherwise:
```bash
$testCmd 2>&1
```
If tests fail → go to rollback (step 13).

> **Note:** Gate (Step 11) also runs tests. This pre-gate test is a fast-fail optimization — it catches obvious breakage before running the full gate checks (codegraph analysis, semantic assertions, arch snapshot). For projects with fast test suites the duplication is negligible; for slow suites, the tradeoff is: catch failures ~2x faster at the cost of ~2x test time on passing targets.

11. **Run /titan-gate:**
Use the Skill tool to invoke `titan-gate`.
- If FAIL on **cycle/test/lint/build** (gate auto-rolls back staged changes on Step 2/4 cycle; Step 1 may also report cycle violation via `--cycles` flag — treat that the same as Step 2) → go to rollback (step 13) to also revert working tree.
- If FAIL on **any other check** — complexity (Step 3), semantic (Step 5), structural/arch (Steps 1, 5.5, 6-8) — gate does NOT auto-rollback its staging area; forge must clean up for the next target → unstage with `git reset HEAD -- $(git diff --cached --name-only) && git checkout -- $(git diff --name-only)`, add to `execution.failedTargets` with reason, log the gate report, and continue to the next target. Do NOT go to step 13 — that step is for Step 2/4 failures where gate already unstaged; going there again would attempt a duplicate rollback.

12. **On success:**
```bash
git add <specific changed files>
git commit -m "<commit message from sync.json>"
```
- Record commit SHA in `execution.commits`
- Add target to `execution.completedTargets`
- Record any diff-review warnings by **appending** to `execution.diffWarnings` (if any). Each entry must follow this schema:
```json
{ "target": "<target-name>", "check": "<D3 or D5>", "message": "<warning text>", "phase": N }
```
- Update `titan-state.json`

11. **On failure (test or gate):**
13. **On failure (test or gate):**
```bash
git checkout -- <changed files>
# Discover dirty files at rollback time (don't rely on carried file list)
git reset HEAD -- $(git diff --cached --name-only)
git checkout -- $(git diff --name-only)
```
- Add to `execution.failedTargets` with reason: `{ "target": "<name>", "reason": "<why>", "phase": N }`
- Clear `execution.currentTarget`
Expand Down Expand Up @@ -226,7 +309,7 @@ Run /titan-gate on the full branch to validate.
- **Gate before commit.** Every commit must pass `/titan-gate`. No exceptions.
- **One commit per logical unit.** Use commit messages from `sync.json`.
- **Stage only specific files.** Never `git add .` or `git add -A`.
- **Rollback on failure is gentle** — `git checkout -- <files>`, not `git reset --hard`.
- **Rollback on failure is gentle** — `git reset HEAD -- $(git diff --cached --name-only)` to unstage, then `git checkout -- $(git diff --name-only)` to revert working tree. Never `git reset --hard`.
- **Subphase awareness** — phases 3-6 have subphases. Each subphase = one commit. Track at subphase level.
- **Never skip `/titan-gate`.** Even for "trivial" changes.

Expand Down
Loading
Loading