Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 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
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
98 changes: 87 additions & 11 deletions .claude/skills/titan-forge/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: titan-forge
description: Execute the sync.json plan — refactor code, validate with /titan-gate, commit, and advance state (Titan Paradigm Phase 4)
argument-hint: <--phase N> <--target name> <--dry-run> <--yes>
argument-hint: <--phase N> <--target name> <--dry-run>
allowed-tools: Bash, Read, Write, Edit, Glob, Grep, Skill, Agent
---

Expand All @@ -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,26 +136,101 @@ 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[currentPhase]`).

**Check all of the following:**

**D1. Scope — only planned files touched:**
Compare staged file paths against `sync.json → executionOrder[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)
Comment on lines +157 to +160
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 D2 intent-match check fails silently for dead-code targets

D2 reads "the gauntlet entry's recommendation field" for the current target. However, dead-code targets (deletions of unreferenced symbols) come from titan-state.json → roles.deadSymbols identified during RECON — they have no gauntlet.ndjson entry. When forge processes one of these dead-code targets, D2 would find no matching entry and either skip the intent check or hallucinate the recommendation field, letting any diff pass without verification.

V9 in titan-run already acknowledges this: "OR in titan-state.json → roles.deadSymbols". D2 should have a corresponding guard:

**D2. Intent match:**
- If this is a dead-code target (in `titan-state.json → roles.deadSymbols`), expected recommendation is "remove dead code / delete symbol" — skip gauntlet entry lookup and verify the diff shows only deletions.
- Otherwise, read the gauntlet entry's `recommendation` field...

The same fix is needed in docs/examples/claude-code-skills/titan-forge/SKILL.md.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed — D2 now checks if the target is in titan-state.json deadSymbols first. For dead-code targets, it skips gauntlet entry lookup and verifies the diff shows only deletions. Applied to both copies.

- 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_TMP=$(mktemp /tmp/titan-d4-pre-XXXXXX)
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 <changed files>
git checkout -- <changed files>
```
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 scripts — `npm test`, `yarn test`, `pnpm test`, etc.):
```bash
<detected-test-command> 2>&1
```
If tests fail → go to rollback (step 13).
Comment on lines +206 to +210
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Tests run twice per target — in Step 10 and again inside gate (Step 4)

Step 10 runs the test suite:

<detected-test-command> 2>&1

Then Step 11 invokes /titan-gate, which also runs tests in its Step 4. For projects with even moderately long test suites, this doubles execution time on every target — a 30-second test run becomes 60 seconds per target, multiplied across all forge targets.

The Step 10 pre-gate test run makes sense as a fast-fail optimization (failing before triggering all gate codegraph checks), but this tradeoff should be documented. Consider noting the rationale inline, or providing a way to skip the Step 10 test if the user prefers the gate to handle all checks (e.g., an environment variable or a --no-pre-gate-test flag).

The same applies to docs/examples/claude-code-skills/titan-forge/SKILL.md.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documented — added a Note block after Step 10 explaining the pre-gate test is a fast-fail optimization with the tradeoff: catches failures faster at the cost of 2x test time on passing targets. Applied to both copies.


> **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 **test/lint/build** (gate auto-rolls back staged changes) → go to rollback (step 13) to also revert working tree.
- If FAIL on **semantic/structural** (gate does not auto-rollback its staging area, but forge must clean up for the next target) → unstage with `git reset HEAD <files> && git checkout -- <files>`, 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 test/gate 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 in `execution.diffWarnings` (if any). Each entry must follow this schema:
```json
{ "target": "<target-name>", "check": "D1|D3|D5", "message": "<warning text>", "phase": N }
```
- Update `titan-state.json`

11. **On failure (test or gate):**
13. **On failure (test or gate):**
```bash
git reset HEAD <changed files>
git checkout -- <changed files>
```
- Add to `execution.failedTargets` with reason: `{ "target": "<name>", "reason": "<why>", "phase": N }`
Expand Down
Loading
Loading