diff --git a/.claude/skills/titan-gauntlet/SKILL.md b/.claude/skills/titan-gauntlet/SKILL.md index d6ae1050..15b41c22 100644 --- a/.claude/skills/titan-gauntlet/SKILL.md +++ b/.claude/skills/titan-gauntlet/SKILL.md @@ -29,6 +29,7 @@ Your goal: audit every high-priority target from the RECON phase against 4 pilla ```bash git fetch origin main && git merge origin/main --no-edit ``` + If there are merge conflicts, stop: "Merge conflict detected. Resolve conflicts and re-run `/titan-gauntlet`." 3. **Load state.** Read `.codegraph/titan/titan-state.json`. If missing: - Warn: "No RECON artifacts. Run `/titan-recon` first for best results." @@ -276,7 +277,7 @@ codegraph fn-impact -T --json Append to `.codegraph/titan/gauntlet.ndjson` (one line per target): ```json -{"target": "", "file": "", "verdict": "FAIL", "pillarVerdicts": {"I": "fail", "II": "warn", "III": "pass", "IV": "pass"}, "metrics": {"cognitive": 28, "cyclomatic": 15, "maxNesting": 4, "mi": 32, "halsteadEffort": 12000, "halsteadBugs": 1.2, "sloc": 85}, "violations": [{"rule": 1, "pillar": "I", "metric": "cognitive", "detail": "28 > 30 threshold", "level": "fail"}], "blastRadius": {"direct": 5, "transitive": 18}, "recommendation": "Split: halstead.bugs 1.2 suggests ~1 defect. Separate validation from I/O."} +{"target": "", "file": "", "verdict": "FAIL", "pillarVerdicts": {"I": "fail", "II": "warn", "III": "pass", "IV": "pass"}, "metrics": {"cognitive": 35, "cyclomatic": 15, "maxNesting": 4, "mi": 32, "halsteadEffort": 12000, "halsteadBugs": 1.2, "sloc": 85}, "violations": [{"rule": 1, "pillar": "I", "metric": "cognitive", "detail": "35 > 30 threshold", "level": "fail"}], "blastRadius": {"direct": 5, "transitive": 18}, "recommendation": "Split: halstead.bugs 1.2 suggests ~1 defect. Separate validation from I/O."} ``` ### 2i. Update state machine diff --git a/.claude/skills/titan-reset/SKILL.md b/.claude/skills/titan-reset/SKILL.md index 2c99704d..f7ea1004 100644 --- a/.claude/skills/titan-reset/SKILL.md +++ b/.claude/skills/titan-reset/SKILL.md @@ -27,23 +27,14 @@ This restores the graph database to its pre-GAUNTLET state. codegraph snapshot delete titan-baseline 2>/dev/null ``` -Also delete any batch snapshots: +Also delete any batch snapshots dynamically: ```bash -codegraph snapshot delete titan-batch-1 2>/dev/null -codegraph snapshot delete titan-batch-2 2>/dev/null -codegraph snapshot delete titan-batch-3 2>/dev/null -codegraph snapshot delete titan-batch-4 2>/dev/null -codegraph snapshot delete titan-batch-5 2>/dev/null -codegraph snapshot delete titan-batch-6 2>/dev/null -codegraph snapshot delete titan-batch-7 2>/dev/null -codegraph snapshot delete titan-batch-8 2>/dev/null -codegraph snapshot delete titan-batch-9 2>/dev/null -codegraph snapshot delete titan-batch-10 2>/dev/null +for name in $(codegraph snapshot list --json 2>/dev/null | node -e "let d='';process.stdin.on('data',c=>d+=c).on('end',()=>{try{JSON.parse(d).filter(s=>s.name.startsWith('titan-batch-')).forEach(s=>console.log(s.name))}catch(e){}})"); do + codegraph snapshot delete "$name" 2>/dev/null +done ``` -(Errors are expected for snapshots that don't exist — ignore them.) - --- ## Step 3 — Remove all Titan artifacts diff --git a/.claude/skills/titan-sync/SKILL.md b/.claude/skills/titan-sync/SKILL.md index 6b93e0e4..259204c3 100644 --- a/.claude/skills/titan-sync/SKILL.md +++ b/.claude/skills/titan-sync/SKILL.md @@ -27,6 +27,7 @@ Your goal: analyze GAUNTLET results to find overlapping problems, identify share ```bash git fetch origin main && git merge origin/main --no-edit ``` + If there are merge conflicts, stop: "Merge conflict detected. Resolve conflicts and re-run `/titan-sync`." 3. **Load artifacts.** Read: - `.codegraph/titan/titan-state.json` — state, domains, batches, file audits diff --git a/docs/examples/claude-code-skills/README.md b/docs/examples/claude-code-skills/README.md index bd1398e4..1c38adb2 100644 --- a/docs/examples/claude-code-skills/README.md +++ b/docs/examples/claude-code-skills/README.md @@ -1,5 +1,7 @@ # Claude Code Skills for Codegraph +> **Experimental — agent-oriented extensions.** These skills are outside codegraph's core scope as a code intelligence engine. They orchestrate multi-step workflows that make decisions, modify code, and run automated pipelines — capabilities that go beyond codegraph's primary role of exposing dependency data to AI agents via MCP. Use them as reference implementations and starting points, not as production-grade automation. They may produce incorrect changes, miss edge cases, or behave unexpectedly on codebases with unusual structures. Always review their output before committing. + This directory contains example [Claude Code skills](https://docs.anthropic.com/en/docs/claude-code/skills) that use codegraph to power autonomous codebase cleanup — based on the [Titan Paradigm](../../use-cases/titan-paradigm.md). ## The Problem: Context Window Explosion @@ -40,9 +42,9 @@ A single AI agent cannot hold an entire large codebase in context. The Titan Par Copy the skill directories into your project's `.claude/skills/` directory: ```bash -# From your project root +# From your project root (assuming codegraph is installed) mkdir -p .claude/skills -cp -r titan-recon titan-gauntlet titan-sync titan-gate titan-reset .claude/skills/ +cp -r node_modules/@optave/codegraph/docs/examples/claude-code-skills/titan-* .claude/skills/ ``` Then install codegraph if you haven't: diff --git a/docs/examples/claude-code-skills/titan-gauntlet/SKILL.md b/docs/examples/claude-code-skills/titan-gauntlet/SKILL.md index d6ae1050..15b41c22 100644 --- a/docs/examples/claude-code-skills/titan-gauntlet/SKILL.md +++ b/docs/examples/claude-code-skills/titan-gauntlet/SKILL.md @@ -29,6 +29,7 @@ Your goal: audit every high-priority target from the RECON phase against 4 pilla ```bash git fetch origin main && git merge origin/main --no-edit ``` + If there are merge conflicts, stop: "Merge conflict detected. Resolve conflicts and re-run `/titan-gauntlet`." 3. **Load state.** Read `.codegraph/titan/titan-state.json`. If missing: - Warn: "No RECON artifacts. Run `/titan-recon` first for best results." @@ -276,7 +277,7 @@ codegraph fn-impact -T --json Append to `.codegraph/titan/gauntlet.ndjson` (one line per target): ```json -{"target": "", "file": "", "verdict": "FAIL", "pillarVerdicts": {"I": "fail", "II": "warn", "III": "pass", "IV": "pass"}, "metrics": {"cognitive": 28, "cyclomatic": 15, "maxNesting": 4, "mi": 32, "halsteadEffort": 12000, "halsteadBugs": 1.2, "sloc": 85}, "violations": [{"rule": 1, "pillar": "I", "metric": "cognitive", "detail": "28 > 30 threshold", "level": "fail"}], "blastRadius": {"direct": 5, "transitive": 18}, "recommendation": "Split: halstead.bugs 1.2 suggests ~1 defect. Separate validation from I/O."} +{"target": "", "file": "", "verdict": "FAIL", "pillarVerdicts": {"I": "fail", "II": "warn", "III": "pass", "IV": "pass"}, "metrics": {"cognitive": 35, "cyclomatic": 15, "maxNesting": 4, "mi": 32, "halsteadEffort": 12000, "halsteadBugs": 1.2, "sloc": 85}, "violations": [{"rule": 1, "pillar": "I", "metric": "cognitive", "detail": "35 > 30 threshold", "level": "fail"}], "blastRadius": {"direct": 5, "transitive": 18}, "recommendation": "Split: halstead.bugs 1.2 suggests ~1 defect. Separate validation from I/O."} ``` ### 2i. Update state machine diff --git a/docs/examples/claude-code-skills/titan-reset/SKILL.md b/docs/examples/claude-code-skills/titan-reset/SKILL.md index 2c99704d..f7ea1004 100644 --- a/docs/examples/claude-code-skills/titan-reset/SKILL.md +++ b/docs/examples/claude-code-skills/titan-reset/SKILL.md @@ -27,23 +27,14 @@ This restores the graph database to its pre-GAUNTLET state. codegraph snapshot delete titan-baseline 2>/dev/null ``` -Also delete any batch snapshots: +Also delete any batch snapshots dynamically: ```bash -codegraph snapshot delete titan-batch-1 2>/dev/null -codegraph snapshot delete titan-batch-2 2>/dev/null -codegraph snapshot delete titan-batch-3 2>/dev/null -codegraph snapshot delete titan-batch-4 2>/dev/null -codegraph snapshot delete titan-batch-5 2>/dev/null -codegraph snapshot delete titan-batch-6 2>/dev/null -codegraph snapshot delete titan-batch-7 2>/dev/null -codegraph snapshot delete titan-batch-8 2>/dev/null -codegraph snapshot delete titan-batch-9 2>/dev/null -codegraph snapshot delete titan-batch-10 2>/dev/null +for name in $(codegraph snapshot list --json 2>/dev/null | node -e "let d='';process.stdin.on('data',c=>d+=c).on('end',()=>{try{JSON.parse(d).filter(s=>s.name.startsWith('titan-batch-')).forEach(s=>console.log(s.name))}catch(e){}})"); do + codegraph snapshot delete "$name" 2>/dev/null +done ``` -(Errors are expected for snapshots that don't exist — ignore them.) - --- ## Step 3 — Remove all Titan artifacts diff --git a/docs/examples/claude-code-skills/titan-sync/SKILL.md b/docs/examples/claude-code-skills/titan-sync/SKILL.md index 6b93e0e4..259204c3 100644 --- a/docs/examples/claude-code-skills/titan-sync/SKILL.md +++ b/docs/examples/claude-code-skills/titan-sync/SKILL.md @@ -27,6 +27,7 @@ Your goal: analyze GAUNTLET results to find overlapping problems, identify share ```bash git fetch origin main && git merge origin/main --no-edit ``` + If there are merge conflicts, stop: "Merge conflict detected. Resolve conflicts and re-run `/titan-sync`." 3. **Load artifacts.** Read: - `.codegraph/titan/titan-state.json` — state, domains, batches, file audits