@jamie-tam/forge 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +389 -0
  3. package/agents/architect.md +92 -0
  4. package/agents/builder.md +122 -0
  5. package/agents/code-reviewer.md +107 -0
  6. package/agents/concept-designer.md +207 -0
  7. package/agents/craft-reviewer.md +132 -0
  8. package/agents/critic.md +130 -0
  9. package/agents/doc-writer.md +85 -0
  10. package/agents/dreamer.md +129 -0
  11. package/agents/e2e-runner.md +89 -0
  12. package/agents/gotcha-hunter.md +127 -0
  13. package/agents/prototype-builder.md +193 -0
  14. package/agents/prototype-codifier.md +204 -0
  15. package/agents/prototype-reviewer.md +163 -0
  16. package/agents/security-reviewer.md +108 -0
  17. package/agents/spec-reviewer.md +94 -0
  18. package/agents/tracer.md +98 -0
  19. package/agents/wireframer.md +109 -0
  20. package/commands/abort.md +25 -0
  21. package/commands/bugfix.md +151 -0
  22. package/commands/evolve.md +118 -0
  23. package/commands/feature.md +236 -0
  24. package/commands/forge.md +100 -0
  25. package/commands/greenfield.md +185 -0
  26. package/commands/hotfix.md +98 -0
  27. package/commands/refactor.md +147 -0
  28. package/commands/resume.md +25 -0
  29. package/commands/setup.md +201 -0
  30. package/commands/status.md +27 -0
  31. package/commands/task-force.md +110 -0
  32. package/commands/validate.md +12 -0
  33. package/dist/__tests__/active-manifest.test.js +272 -0
  34. package/dist/__tests__/copy.test.js +96 -0
  35. package/dist/__tests__/gate-check.test.js +384 -0
  36. package/dist/__tests__/wiki.test.js +472 -0
  37. package/dist/__tests__/work-manifest.test.js +304 -0
  38. package/dist/active-manifest.js +229 -0
  39. package/dist/cli.js +158 -0
  40. package/dist/copy.js +124 -0
  41. package/dist/gate-check.js +326 -0
  42. package/dist/hooks.js +60 -0
  43. package/dist/init.js +140 -0
  44. package/dist/manifest.js +90 -0
  45. package/dist/merge.js +77 -0
  46. package/dist/paths.js +36 -0
  47. package/dist/uninstall.js +216 -0
  48. package/dist/update.js +158 -0
  49. package/dist/verify-manifest.js +65 -0
  50. package/dist/verify.js +98 -0
  51. package/dist/wiki-ui.js +310 -0
  52. package/dist/wiki.js +364 -0
  53. package/dist/work-manifest.js +798 -0
  54. package/hooks/config/gate-requirements.json +79 -0
  55. package/hooks/hooks.json +143 -0
  56. package/hooks/scripts/analyze-telemetry.sh +114 -0
  57. package/hooks/scripts/gate-enforcer.sh +164 -0
  58. package/hooks/scripts/pre-compact.sh +90 -0
  59. package/hooks/scripts/session-start.sh +81 -0
  60. package/hooks/scripts/telemetry.sh +41 -0
  61. package/hooks/scripts/wiki-lint.sh +87 -0
  62. package/hooks/templates/AGENTS.md.template +48 -0
  63. package/hooks/templates/CLAUDE.md.template +45 -0
  64. package/package.json +55 -0
  65. package/protocols/README.md +40 -0
  66. package/protocols/codex.md +151 -0
  67. package/protocols/graphify.md +156 -0
  68. package/references/common/agent-coordination.md +65 -0
  69. package/references/common/coding-standards.md +54 -0
  70. package/references/common/feature-tracking.md +21 -0
  71. package/references/common/io-protocol.md +36 -0
  72. package/references/common/phases.md +57 -0
  73. package/references/common/quality-gates.md +130 -0
  74. package/references/common/skill-authoring.md +154 -0
  75. package/references/common/skill-compliance.md +30 -0
  76. package/references/python/standards.md +44 -0
  77. package/references/react/standards.md +61 -0
  78. package/references/typescript/standards.md +42 -0
  79. package/rules/common/forge-system.md +59 -0
  80. package/rules/common/git-workflow.md +40 -0
  81. package/rules/common/guardrails.md +37 -0
  82. package/rules/common/quality-gates.md +18 -0
  83. package/rules/common/security.md +50 -0
  84. package/rules/common/skill-selection.md +78 -0
  85. package/rules/common/testing.md +58 -0
  86. package/rules/common/verification.md +39 -0
  87. package/skills/build-pr-workflow/SKILL.md +301 -0
  88. package/skills/build-pr-workflow/references/pr-template.md +62 -0
  89. package/skills/build-pr-workflow/references/subagent-merge.md +47 -0
  90. package/skills/build-pr-workflow/references/worktree-setup.md +125 -0
  91. package/skills/build-prototype/SKILL.md +264 -0
  92. package/skills/build-scaffold/SKILL.md +340 -0
  93. package/skills/build-tdd/SKILL.md +89 -0
  94. package/skills/build-wireframe/SKILL.md +110 -0
  95. package/skills/build-wireframe/assets/baseline-template.html +486 -0
  96. package/skills/build-wireframe/references/demo-walkthroughs.md +170 -0
  97. package/skills/build-wireframe/references/gotchas.md +188 -0
  98. package/skills/build-wireframe/references/legend-lines.md +141 -0
  99. package/skills/concept-slides/SKILL.md +192 -0
  100. package/skills/deliver-db-migration/SKILL.md +466 -0
  101. package/skills/deliver-deploy/SKILL.md +407 -0
  102. package/skills/deliver-onboarding/SKILL.md +198 -0
  103. package/skills/deliver-onboarding/references/document-templates.md +393 -0
  104. package/skills/deliver-onboarding/templates/getting-started.md +122 -0
  105. package/skills/discover-codebase-analysis/SKILL.md +448 -0
  106. package/skills/discover-requirements/SKILL.md +418 -0
  107. package/skills/discover-requirements/templates/prd.md +99 -0
  108. package/skills/discover-requirements/templates/technical-spec.md +123 -0
  109. package/skills/discover-requirements/templates/user-stories.md +76 -0
  110. package/skills/harden/SKILL.md +214 -0
  111. package/skills/iterate-prototype/SKILL.md +241 -0
  112. package/skills/plan-architecture/SKILL.md +457 -0
  113. package/skills/plan-architecture/templates/adr-template.md +52 -0
  114. package/skills/plan-architecture/templates/api-contract.md +99 -0
  115. package/skills/plan-architecture/templates/db-schema.md +81 -0
  116. package/skills/plan-architecture/templates/system-design.md +111 -0
  117. package/skills/plan-brainstorm/SKILL.md +433 -0
  118. package/skills/plan-design-system/SKILL.md +279 -0
  119. package/skills/plan-task-decompose/SKILL.md +454 -0
  120. package/skills/quality-code-review/SKILL.md +286 -0
  121. package/skills/quality-security-audit/SKILL.md +292 -0
  122. package/skills/quality-security-audit/references/audit-report-template.md +89 -0
  123. package/skills/quality-security-audit/references/owasp-checks.md +178 -0
  124. package/skills/quality-test-execution/SKILL.md +435 -0
  125. package/skills/quality-test-plan/SKILL.md +297 -0
  126. package/skills/quality-test-plan/references/test-type-guide.md +263 -0
  127. package/skills/quality-test-plan/templates/e2e-test-plan.md +72 -0
  128. package/skills/quality-test-plan/templates/integration-test-plan.md +74 -0
  129. package/skills/quality-test-plan/templates/load-test-plan.md +111 -0
  130. package/skills/quality-test-plan/templates/smoke-test-plan.md +68 -0
  131. package/skills/quality-test-plan/templates/unit-test-plan.md +56 -0
  132. package/skills/quality-uiux/SKILL.md +481 -0
  133. package/skills/support-debug/SKILL.md +464 -0
  134. package/skills/support-dream/SKILL.md +213 -0
  135. package/skills/support-gotcha/SKILL.md +249 -0
  136. package/skills/support-runtime-reachability/SKILL.md +190 -0
  137. package/skills/support-runtime-reachability/scripts/__fixtures__/case-01-passes-app-use/src/app.ts +7 -0
  138. package/skills/support-runtime-reachability/scripts/__fixtures__/case-01-passes-app-use/src/handlers/cases.ts +7 -0
  139. package/skills/support-runtime-reachability/scripts/__fixtures__/case-02-orphan-no-app-use/src/app.ts +8 -0
  140. package/skills/support-runtime-reachability/scripts/__fixtures__/case-02-orphan-no-app-use/src/handlers/cases.ts +7 -0
  141. package/skills/support-runtime-reachability/scripts/__fixtures__/case-03-orphan-import-only/src/App.tsx +5 -0
  142. package/skills/support-runtime-reachability/scripts/__fixtures__/case-03-orphan-import-only/src/components/RingingBanner.tsx +7 -0
  143. package/skills/support-runtime-reachability/scripts/__fixtures__/case-03-orphan-import-only/src/hooks/useTwilio.ts +6 -0
  144. package/skills/support-runtime-reachability/scripts/__fixtures__/case-04-jsx-component-rendered/src/App.tsx +5 -0
  145. package/skills/support-runtime-reachability/scripts/__fixtures__/case-04-jsx-component-rendered/src/components/MyComp.tsx +3 -0
  146. package/skills/support-runtime-reachability/scripts/__fixtures__/case-05-jsx-component-not-rendered/src/App.tsx +3 -0
  147. package/skills/support-runtime-reachability/scripts/__fixtures__/case-05-jsx-component-not-rendered/src/components/Orphan.tsx +3 -0
  148. package/skills/support-runtime-reachability/scripts/__fixtures__/case-06-class-instantiated/src/lib/Service.ts +6 -0
  149. package/skills/support-runtime-reachability/scripts/__fixtures__/case-06-class-instantiated/src/main.ts +4 -0
  150. package/skills/support-runtime-reachability/scripts/__fixtures__/case-07-class-not-instantiated/src/lib/Lonely.ts +5 -0
  151. package/skills/support-runtime-reachability/scripts/__fixtures__/case-07-class-not-instantiated/src/main.ts +2 -0
  152. package/skills/support-runtime-reachability/scripts/__fixtures__/case-08-default-export-imported-and-called/src/handler.ts +3 -0
  153. package/skills/support-runtime-reachability/scripts/__fixtures__/case-08-default-export-imported-and-called/src/main.ts +3 -0
  154. package/skills/support-runtime-reachability/scripts/__fixtures__/case-09-default-export-orphan/src/handler.ts +3 -0
  155. package/skills/support-runtime-reachability/scripts/__fixtures__/case-09-default-export-orphan/src/main.ts +2 -0
  156. package/skills/support-runtime-reachability/scripts/__fixtures__/case-10-aliased-named-export/src/lib.ts +5 -0
  157. package/skills/support-runtime-reachability/scripts/__fixtures__/case-10-aliased-named-export/src/main.ts +3 -0
  158. package/skills/support-runtime-reachability/scripts/__fixtures__/case-11-re-export-chain/src/lib/index.ts +1 -0
  159. package/skills/support-runtime-reachability/scripts/__fixtures__/case-11-re-export-chain/src/lib/internal.ts +3 -0
  160. package/skills/support-runtime-reachability/scripts/__fixtures__/case-11-re-export-chain/src/main.ts +3 -0
  161. package/skills/support-runtime-reachability/scripts/__fixtures__/case-12-test-only-caller/src/util.test.ts +5 -0
  162. package/skills/support-runtime-reachability/scripts/__fixtures__/case-12-test-only-caller/src/util.ts +3 -0
  163. package/skills/support-runtime-reachability/scripts/__fixtures__/case-13-gated-pending-annotation/src/future.ts +4 -0
  164. package/skills/support-runtime-reachability/scripts/__fixtures__/case-14-untraceable-annotation/src/decorated.ts +4 -0
  165. package/skills/support-runtime-reachability/scripts/__fixtures__/case-15-untraceable-empty/src/lazy.ts +4 -0
  166. package/skills/support-runtime-reachability/scripts/__fixtures__/case-16-python-module/src/lib.py +15 -0
  167. package/skills/support-runtime-reachability/scripts/__fixtures__/case-16-python-module/src/main.py +5 -0
  168. package/skills/support-runtime-reachability/scripts/__fixtures__/case-17-router-use/src/parent.ts +5 -0
  169. package/skills/support-runtime-reachability/scripts/__fixtures__/case-17-router-use/src/routes/cases.ts +5 -0
  170. package/skills/support-runtime-reachability/scripts/__fixtures__/case-18-shadowed-name-fp/src/lib/foo.ts +3 -0
  171. package/skills/support-runtime-reachability/scripts/__fixtures__/case-18-shadowed-name-fp/src/other.ts +8 -0
  172. package/skills/support-runtime-reachability/scripts/__fixtures__/case-19-same-name-different-module/src/handlers/cases.ts +4 -0
  173. package/skills/support-runtime-reachability/scripts/__fixtures__/case-19-same-name-different-module/src/handlers/users.ts +4 -0
  174. package/skills/support-runtime-reachability/scripts/__fixtures__/case-19-same-name-different-module/src/main.ts +5 -0
  175. package/skills/support-runtime-reachability/scripts/__fixtures__/case-20-aliased-import-usage/src/handlers/cases.ts +3 -0
  176. package/skills/support-runtime-reachability/scripts/__fixtures__/case-20-aliased-import-usage/src/main.ts +4 -0
  177. package/skills/support-runtime-reachability/scripts/__fixtures__/case-21-mixed-default-and-named/src/lib.ts +5 -0
  178. package/skills/support-runtime-reachability/scripts/__fixtures__/case-21-mixed-default-and-named/src/main.ts +5 -0
  179. package/skills/support-runtime-reachability/scripts/__fixtures__/case-22-dynamic-import-then-caller/src/lib.ts +3 -0
  180. package/skills/support-runtime-reachability/scripts/__fixtures__/case-22-dynamic-import-then-caller/src/main.ts +8 -0
  181. package/skills/support-runtime-reachability/scripts/__fixtures__/case-23-dynamic-import-with-space/src/lib.ts +3 -0
  182. package/skills/support-runtime-reachability/scripts/__fixtures__/case-23-dynamic-import-with-space/src/main.ts +7 -0
  183. package/skills/support-runtime-reachability/scripts/check.mjs +638 -0
  184. package/skills/support-runtime-reachability/scripts/check.test.mjs +244 -0
  185. package/skills/support-skill-validator/SKILL.md +194 -0
  186. package/skills/support-skill-validator/references/false-positives.md +59 -0
  187. package/skills/support-skill-validator/references/validation-checks.md +280 -0
  188. package/skills/support-system-guide/SKILL.md +311 -0
  189. package/skills/support-task-force/SKILL.md +265 -0
  190. package/skills/support-task-force/references/dispatch-pattern.md +178 -0
  191. package/skills/support-task-force/references/synthesis-template.md +126 -0
  192. package/skills/support-wiki-bootstrap/SKILL.md +37 -0
  193. package/skills/support-wiki-lint/SKILL.md +196 -0
  194. package/skills/support-wiki-lint/scripts/lint.mjs +488 -0
  195. package/skills/support-wiki-lint/scripts/lint.test.mjs +196 -0
  196. package/templates/README.md +23 -0
  197. package/templates/aiwiki/CLAUDE.md.template +78 -0
  198. package/templates/aiwiki/schemas/architecture.md +118 -0
  199. package/templates/aiwiki/schemas/convention.md +112 -0
  200. package/templates/aiwiki/schemas/decision.md +144 -0
  201. package/templates/aiwiki/schemas/gotcha.md +118 -0
  202. package/templates/aiwiki/schemas/oracle.md +105 -0
  203. package/templates/aiwiki/schemas/session.md +125 -0
  204. package/templates/manifests/bugfix.yaml +41 -0
  205. package/templates/manifests/feature.yaml +69 -0
  206. package/templates/manifests/greenfield.yaml +61 -0
  207. package/templates/manifests/hotfix.yaml +45 -0
  208. package/templates/manifests/refactor.yaml +44 -0
  209. package/templates/manifests/v5/SCHEMA.md +327 -0
  210. package/templates/manifests/v5/feature.yaml +77 -0
  211. package/templates/manifests/v6/SCHEMA.md +199 -0
  212. package/templates/wiki-html/dream-detail.html +378 -0
  213. package/templates/wiki-html/dreams-list.html +155 -0
@@ -0,0 +1,41 @@
1
+ #!/bin/bash
2
+ # PostToolUse telemetry hook: logs every Skill and Task (subagent-dispatch) call.
3
+ # Captures which skills were loaded and which agents were dispatched
4
+ # for benchmarking harness compliance.
5
+ #
6
+ # Output: .forge/state/telemetry.jsonl (one JSON object per line)
7
+ #
8
+ # Note: the subagent-dispatch tool was renamed `Agent` → `Task` (canonical name
9
+ # in current Claude Code releases). Both names are accepted here for backward
10
+ # compatibility with existing telemetry written before the rename; `Task` is
11
+ # the dispatch path going forward and the matcher in hooks.json fires on it.
12
+
13
+ set -euo pipefail
14
+
15
+ PROJECT_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
16
+ STATE_DIR="$PROJECT_ROOT/.forge/state"
17
+ TELEMETRY_FILE="$STATE_DIR/telemetry.jsonl"
18
+
19
+ mkdir -p "$STATE_DIR"
20
+
21
+ # Read hook input from stdin
22
+ INPUT=$(cat)
23
+
24
+ TOOL_NAME=$(echo "$INPUT" | jq -r '.tool_name // "unknown"')
25
+ TIMESTAMP=$(date -u '+%Y-%m-%dT%H:%M:%SZ')
26
+
27
+ # Extract relevant fields based on tool type.
28
+ # Task and Agent share input shape (subagent_type + description); accept either.
29
+ case "$TOOL_NAME" in
30
+ Skill)
31
+ SKILL_NAME=$(echo "$INPUT" | jq -r '.tool_input.skill // "unknown"')
32
+ echo "{\"timestamp\":\"$TIMESTAMP\",\"type\":\"skill\",\"name\":\"$SKILL_NAME\"}" >> "$TELEMETRY_FILE"
33
+ ;;
34
+ Task|Agent)
35
+ AGENT_TYPE=$(echo "$INPUT" | jq -r '.tool_input.subagent_type // "unknown"')
36
+ DESCRIPTION=$(echo "$INPUT" | jq -r '.tool_input.description // ""')
37
+ echo "{\"timestamp\":\"$TIMESTAMP\",\"type\":\"agent\",\"name\":\"$AGENT_TYPE\",\"description\":\"$DESCRIPTION\"}" >> "$TELEMETRY_FILE"
38
+ ;;
39
+ esac
40
+
41
+ exit 0
@@ -0,0 +1,87 @@
1
+ #!/bin/bash
2
+ # PostToolUse hook: validates aiwiki/** markdown writes against their declared
3
+ # schemas. Reads the file path from hook input, invokes the lint script if the
4
+ # write targets a typed wiki page, surfaces findings to stderr.
5
+ #
6
+ # Cannot block the write (it already happened); informs the AI/user via stderr
7
+ # so the next edit corrects the issue. Returns continue:true unconditionally.
8
+ #
9
+ # Skipped for: non-markdown files, files outside aiwiki/, schema files
10
+ # themselves (they describe other pages), and fresh projects before aiwiki/
11
+ # is scaffolded by /setup.
12
+
13
+ set -uo pipefail
14
+
15
+ INPUT=$(cat)
16
+ TOOL_NAME=$(echo "$INPUT" | jq -r '.tool_name // ""')
17
+
18
+ # Only Edit, Write, and MultiEdit can modify files. MultiEdit shares Edit's
19
+ # top-level file_path shape (one file, multiple edits) — the edit deltas live
20
+ # in tool_input.edits[*] but we only need the path here (the linter re-reads
21
+ # the file from disk, so it sees the final post-write content regardless of
22
+ # whether the change was one Edit or many).
23
+ case "$TOOL_NAME" in
24
+ Edit|Write|MultiEdit) ;;
25
+ *)
26
+ echo '{"continue":true}'
27
+ exit 0
28
+ ;;
29
+ esac
30
+
31
+ FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // ""')
32
+
33
+ # Only check aiwiki/ writes
34
+ case "$FILE_PATH" in
35
+ *aiwiki/*) ;;
36
+ *) echo '{"continue":true}'; exit 0 ;;
37
+ esac
38
+
39
+ # Skip non-markdown files
40
+ case "$FILE_PATH" in
41
+ *.md) ;;
42
+ *) echo '{"continue":true}'; exit 0 ;;
43
+ esac
44
+
45
+ # Skip schema files themselves (they describe other pages; aren't validated against schemas)
46
+ case "$FILE_PATH" in
47
+ *aiwiki/schemas/*) echo '{"continue":true}'; exit 0 ;;
48
+ esac
49
+
50
+ # Skip aiwiki/proposed/ writes during dream output; dream's lint runs separately at completion
51
+ case "$FILE_PATH" in
52
+ *aiwiki/proposed/*) echo '{"continue":true}'; exit 0 ;;
53
+ esac
54
+
55
+ # Skip the wiki's own meta files (CLAUDE.md, INDEX.md, projectbrief.md)
56
+ case "$(basename "$FILE_PATH")" in
57
+ CLAUDE.md|INDEX.md|projectbrief.md) echo '{"continue":true}'; exit 0 ;;
58
+ esac
59
+
60
+ # Locate inputs
61
+ PROJECT_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
62
+ SCHEMAS_DIR="$PROJECT_ROOT/aiwiki/schemas"
63
+ SCRIPT_PATH="$PROJECT_ROOT/.claude/skills/support-wiki-lint/scripts/lint.mjs"
64
+
65
+ # Skip if scaffolded path missing (fresh project before /setup, or installation gap)
66
+ if [ ! -d "$SCHEMAS_DIR" ] || [ ! -f "$SCRIPT_PATH" ]; then
67
+ echo '{"continue":true}'
68
+ exit 0
69
+ fi
70
+
71
+ # Resolve the file path relative to repo root for the script
72
+ case "$FILE_PATH" in
73
+ /*) REL_PATH="${FILE_PATH#$PROJECT_ROOT/}" ;;
74
+ *) REL_PATH="$FILE_PATH" ;;
75
+ esac
76
+
77
+ # Run lint (don't let non-zero exit kill us — we surface findings, not block)
78
+ LINT_OUTPUT=$(node "$SCRIPT_PATH" --file "$REL_PATH" --schemas "$SCHEMAS_DIR" --root "$PROJECT_ROOT" 2>&1)
79
+ LINT_EXIT=$?
80
+
81
+ if [ $LINT_EXIT -ne 0 ]; then
82
+ echo "wiki-lint findings on $REL_PATH:" >&2
83
+ echo "$LINT_OUTPUT" >&2
84
+ fi
85
+
86
+ echo '{"continue":true}'
87
+ exit 0
@@ -0,0 +1,48 @@
1
+ # AGENTS.md
2
+
3
+ > Auto-generated by `npx @jamie-tam/forge init`. Run `/setup` in Claude Code to detect your stack and fill in the project profile.
4
+
5
+ ## Project
6
+
7
+ <!-- Filled by /setup after stack detection -->
8
+ - **Name:** (run /setup)
9
+ - **Stack:** (run /setup)
10
+ - **Test runner:** (run /setup)
11
+ - **Package manager:** (run /setup)
12
+
13
+ <!-- FORGE:START — do not edit between markers; updated by forge -->
14
+
15
+ > This file is imported by `.claude/CLAUDE.md` via `@AGENTS.md` so Claude Code reads it. It also serves as the ecosystem-standard agent-context file (read by Cursor, Codex, and other tools). For the forge command catalog, skill prefix groups, and `.forge/` directory layout, see `.claude/CLAUDE.md`.
16
+
17
+ ## Required Checks
18
+
19
+ - Run tests before committing
20
+ - Every commit must leave the project buildable
21
+ - No `--no-verify` on git commands
22
+ - No hardcoded secrets
23
+
24
+ ## Commit Conventions
25
+
26
+ Format: `type(scope): description` — lowercase, imperative mood.
27
+ Types: `feat`, `fix`, `refactor`, `test`, `docs`, `chore`.
28
+
29
+ ## Key Constraints
30
+
31
+ - Quality gates block phase transitions until criteria are met (see `.claude/references/common/quality-gates.md`)
32
+ - Test-driven development is mandatory for production code (RED → GREEN → REFACTOR)
33
+ - Code review is a chain of focused subagents: safety → craft → runtime reachability → gotcha-hunter (→ optional Codex adversarial)
34
+ - Work state lives in `.forge/work/{type}/{name}/manifest.yaml` (type: feature|bugfix|refactor|hotfix|greenfield)
35
+
36
+ ## Deeper Docs
37
+
38
+ | File | Contents |
39
+ |------|----------|
40
+ | `.claude/CLAUDE.md` | Claude Code project configuration, command catalog, First Prompts |
41
+ | `.claude/references/common/quality-gates.md` | Gate definitions and pass/fail criteria |
42
+ | `.claude/rules/common/` | Always-loaded coding standards (security, verification, guardrails, skill-selection) |
43
+
44
+ <!-- FORGE:END -->
45
+
46
+ ## Project-Specific Notes
47
+
48
+ <!-- Add project-specific context: key decisions, architecture notes, known issues -->
@@ -0,0 +1,45 @@
1
+ # CLAUDE.md — Project Configuration
2
+
3
+ > Auto-generated by `npx @jamie-tam/forge init`. Run `/setup` to detect your stack and fill the project profile, then customize as needed.
4
+
5
+ @AGENTS.md
6
+
7
+ ## Project Profile
8
+
9
+ ```yaml
10
+ project:
11
+ name: "{detected name}"
12
+ stack: "{detected stack}"
13
+ database: "{detected database}"
14
+ test_runner: "{detected test_runner}"
15
+ package_manager: "{detected package_manager}"
16
+ ```
17
+
18
+ ## First Prompts
19
+
20
+ New to this project? Describe your goal in plain English — forge auto-routes via skills, OR invoke a command directly:
21
+
22
+ - `/forge` — one-screen orientation: what's installed, what's in flight, what to run next
23
+ - `/setup` — detect your stack and install matching language rules (run this first)
24
+ - `/feature <name>` — develop a feature end-to-end with quality gates
25
+ - `/bugfix <name>` — systematic debugging with root-cause analysis
26
+ - `/refactor <name>` — restructure code without new functionality
27
+ - `/task-force <list>` — parallel agents for a punch list of ad-hoc tasks
28
+ - `/validate` — check skill/rule/command consistency
29
+
30
+ Operational state lives in `.forge/state/`; project knowledge in `aiwiki/`.
31
+ Claude Code's auto-memory (v2.1.59+) lives in `~/.claude/projects/<project>/memory/` — separate from `.forge/state/notepad.md`.
32
+
33
+ <!-- FORGE:START — do not edit between markers; updated by forge -->
34
+
35
+ ## Development Workflow
36
+
37
+ This project uses **forge** as its development workflow. Every session should follow it: route via skills, use the `/feature`, `/bugfix`, `/refactor` etc. commands, and keep work artifacts in `.forge/`.
38
+
39
+ System structure — skills (prefix-grouped), commands, `.forge/` layout, context recovery — lives in **`.claude/rules/common/forge-system.md`** (always-on rule, auto-loaded every session).
40
+
41
+ <!-- FORGE:END -->
42
+
43
+ ## Project-Specific Notes
44
+
45
+ <!-- Add project-specific context below: key decisions, architecture notes, known issues -->
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@jamie-tam/forge",
3
+ "version": "6.0.0",
4
+ "description": "AI Development Life Cycle — structured AI-assisted development with quality gates, feature manifests, and agent coordination",
5
+ "type": "module",
6
+ "bin": {
7
+ "forge": "./dist/cli.js"
8
+ },
9
+ "scripts": {
10
+ "build": "tsc",
11
+ "pretest": "tsc",
12
+ "test": "node --test dist/__tests__/*.test.js",
13
+ "prepublishOnly": "tsc"
14
+ },
15
+ "files": [
16
+ "dist/",
17
+ "agents/",
18
+ "commands/",
19
+ "skills/",
20
+ "hooks/",
21
+ "rules/",
22
+ "references/",
23
+ "protocols/",
24
+ "templates/"
25
+ ],
26
+ "keywords": [
27
+ "claude-code",
28
+ "sdlc",
29
+ "tdd",
30
+ "code-review",
31
+ "quality-gates",
32
+ "ai-agents",
33
+ "feature-tracking"
34
+ ],
35
+ "author": "aideas-jamie-tam",
36
+ "license": "MIT",
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "https://github.com/lps-ai/forge"
40
+ },
41
+ "publishConfig": {
42
+ "access": "public"
43
+ },
44
+ "engines": {
45
+ "node": ">=18.0.0"
46
+ },
47
+ "devDependencies": {
48
+ "@types/js-yaml": "^4.0.9",
49
+ "@types/node": "^20.0.0",
50
+ "typescript": "^5.0.0"
51
+ },
52
+ "dependencies": {
53
+ "js-yaml": "^4.1.1"
54
+ }
55
+ }
@@ -0,0 +1,40 @@
1
+ # Protocols
2
+
3
+ A **protocol** in this repo is a reusable consent + invocation + error-handling contract for an external CLI tool consumed by two or more skills. Protocols centralize the "how do we talk to this tool?" surface so each consuming skill only has to handle the tool-specific call site, not the cross-cutting concerns of detection, consent, error handling, and version compatibility.
4
+
5
+ ## Required Sections
6
+
7
+ Every protocol file MUST include the following sections:
8
+
9
+ - **Detection** — how a skill checks whether the tool is available (subshell command, exit code).
10
+ - **Consent** — the user-visible consent surface, including the `.forge/local.yaml` keys this protocol owns, the prompt copy, and the first-use setup behavior.
11
+ - **Invocation** — the command(s) used to call the tool, prompt/template structure, file-vs-inline rules, and timeouts.
12
+ - **Presentation / Error Handling** — how results are surfaced back to the user, and what happens when the tool fails, returns empty output, times out, or has corrupted config.
13
+ - **Constraints** — what the protocol does NOT do (lifecycle management, auto-suggestion, etc.).
14
+ - **Version Compatibility** — minimum tool version, pinned install source (commit SHA / release tag), and any breaking-change notes.
15
+
16
+ ## Current Protocols
17
+
18
+ - **[codex.md](codex.md)** — Codex CLI integration (Verify / Takeover / Delegate modes) for review and build skills.
19
+ - **[graphify.md](graphify.md)** — Knowledge graph enrichment via the `/graphify` skill and `graphify` CLI for skills that benefit from architectural context.
20
+
21
+ ## Intake Criteria
22
+
23
+ A new protocol file is justified only when ALL of the following hold:
24
+
25
+ 1. The tool is **external** — invoked via subshell, not a forge-internal skill.
26
+ 2. The tool is consumed by **two or more skills** — a single-skill caller belongs inline in that skill.
27
+ 3. The tool has a **user-visible consent surface** — installation prompts, mode selection, or preference storage.
28
+
29
+ If any criterion fails, the integration belongs inline in the consuming skill, not as a shared protocol.
30
+
31
+ ## `.forge/local.yaml` Merge Contract
32
+
33
+ Each protocol owns its own top-level namespace in `.forge/local.yaml`:
34
+
35
+ - `codex.md` owns the `codex:` namespace.
36
+ - `graphify.md` owns the `graphify:` namespace.
37
+
38
+ Writers MUST preserve other namespaces when writing to their own. Read-modify-write the whole file; do not truncate.
39
+
40
+ When a single namespace is corrupted (malformed YAML, unexpected types), the owning protocol resets only that namespace to its defaults and warns the user. Other namespaces are left untouched. If the whole file is unparseable, the protocol that detects it first resets the file to a minimal default with all known namespaces and warns the user.
@@ -0,0 +1,151 @@
1
+ # Codex Integration
2
+
3
+ Protocol for Codex integration across forge skills. Skills that support Codex add a `### Codex Integration` block to their SKILL.md and follow this protocol for detection, consent, invocation, and presentation. Skills without a Codex block are unaffected. Users without Codex installed never see any Codex-related prompts. The consent flow handles user choice — skills always route to it.
4
+
5
+ ## Modes
6
+
7
+ | Mode | Purpose | Who does the work | Risk |
8
+ |------|---------|-------------------|------|
9
+ | **Verify** | Codex reviews Claude's work | Claude works, Codex checks | Low — additive |
10
+ | **Takeover** | Codex does the work, Claude reviews | Codex works, Claude checks | Medium — saves tokens |
11
+ | **Delegate** | Codex executes the work independently — no Claude execution. Codex's output then enters the normal review pipeline (quality-code-review on the PR). | Codex works alone, then artifacts go through Claude review | Higher — build skills only (scaffold, tdd) |
12
+
13
+ 13 skills support both **Verify** and **Takeover**. 2 build skills use **Delegate**. The consent flow lets the user choose between Verify and Takeover per invocation, or save a preference.
14
+
15
+ ## Detection
16
+
17
+ Run `codex --version` in a subshell. If exit code is 0, Codex is available. If non-zero, skip all Codex steps silently.
18
+
19
+ - Detection runs at the point where a skill would invoke Codex, not at session start.
20
+ - Do not cache the result across skill invocations.
21
+ - Do not warn about Codex not being installed. Users who don't have it never see it.
22
+
23
+ ## Consent
24
+
25
+ User preferences stored in `.forge/local.yaml` (gitignored, per-user):
26
+
27
+ ```yaml
28
+ codex:
29
+ mode: ask # verify | takeover | ask | never (default: ask) — applies to Verify/Takeover skills
30
+ delegate: ask # always | ask | never (default: ask) — applies to Delegate build skills only
31
+ ```
32
+
33
+ `codex.mode` is the shared key for Verify/Takeover skills (13 skills). `codex.delegate` is a separate key used only by build-tdd and build-scaffold. Keeping them separate prevents a `delegate` value from leaking into non-build skills whose mode check only handles Verify/Takeover/Skip.
34
+
35
+ **Consent flow:**
36
+
37
+ **Run consent ONCE per skill invocation**, at the Codex Mode Check step. Record the resulting mode (verify / takeover / skip) in skill-local state. Later inline Codex steps in the same skill MUST reuse that decision — do not re-prompt or re-run the consent flow.
38
+
39
+ 1. Detect Codex (`codex --version`). If unavailable, record `skip` and proceed without Codex.
40
+ 2. Read `.forge/local.yaml` for the `codex.mode` preference.
41
+ 3. If `verify` or `takeover` — record that mode and proceed.
42
+ 4. If `never` — record `skip` and proceed silently.
43
+ 5. If `ask` or file/key is absent — prompt the user:
44
+
45
+ ```
46
+ Codex is available for [skill description].
47
+ (a) Claude does the work, Codex verifies
48
+ (b) Codex does the work, Claude reviews (saves tokens)
49
+ (c) Skip Codex
50
+ (d) Save my preference — always use [a|b|c]
51
+ ```
52
+
53
+ Option (a) = Verify mode. Option (b) = Takeover mode. Option (c) = skip.
54
+
55
+ 6. If user picks (d), write the choice to `.forge/local.yaml`.
56
+ 7. For **Delegate** mode (build-tdd, build-scaffold only): the skill reads `codex.delegate` (not `codex.mode`) and handles its own consent flow — see the skill's Codex Integration section. If a non-build skill ever reads `codex.mode` and finds an unexpected value (e.g., `delegate`), treat it as `ask` and re-prompt.
57
+
58
+ **First-use setup:**
59
+
60
+ - If `.forge/local.yaml` does not exist, create it with `codex.mode: ask`.
61
+ - If `.gitignore` does not contain `.forge/local.yaml`, append it.
62
+
63
+ ## Invocation
64
+
65
+ Codex is invoked via the existing Codex plugin runtime. Three commands are available — use the one that fits the skill's needs:
66
+
67
+ | Command | When to Use | Supports |
68
+ |---------|-------------|----------|
69
+ | `adversarial-review` | Reviewing **code in git** — challenges approach, finds gaps | `--scope`, `--base`, custom focus text |
70
+ | `review` | Reviewing **code in git** — standard defect finding | `--scope`, `--base`, no custom focus |
71
+ | `task` | Reviewing **documents/artifacts** or **building code** | Arbitrary prompt, any files |
72
+
73
+ **Command selection per skill type:**
74
+ - **Quality skills reviewing code diffs** (code-review, security-audit): Use `adversarial-review --scope branch` with focus text. Auto-scopes to git state — no need to manually point at files.
75
+ - **Plan/discover skills reviewing documents**: Use `task` with a custom prompt. Design artifacts and analyses aren't in git state.
76
+ - **Build skills delegating work**: Use `task` with the skill's SKILL.md path as methodology.
77
+ - **Debug/support skills**: Use `task` with custom prompt for hypothesis generation.
78
+
79
+ **Verify template (for `task` command):**
80
+ ```
81
+ Context: [artifact file paths — Codex reads files, not inline content]
82
+ Task: [what Codex should do — review, critique, analyze]
83
+ Focus: [specific concerns — gaps, security, feasibility, coverage]
84
+ Output format: [structured findings with severity, location, and reasoning]
85
+ ```
86
+
87
+ **Adversarial review invocation (for code-reviewing skills):**
88
+ ```bash
89
+ node "${CLAUDE_PLUGIN_ROOT}/scripts/codex-companion.mjs" adversarial-review --scope branch [focus text]
90
+ ```
91
+
92
+ **Delegate template (for `task` command):**
93
+ ```
94
+ Context: [artifact file paths — task spec, architecture artifacts]
95
+ Task: [what Codex should build]
96
+ Methodology: [path to the skill's SKILL.md file — Codex reads and follows it]
97
+ Output format: [implementation code following the skill's methodology]
98
+ ```
99
+
100
+ **Rules:**
101
+
102
+ - Pass file paths, not inline content. Codex reads current files.
103
+ - Exception: skills at pre-artifact stages (e.g., brainstorming before a spec is written) may write a temp draft file for Codex context. Delete the temp file after the step completes.
104
+ - Each skill defines its own prompt specifics. This section defines the template structure only.
105
+ - Timeout: 5 minutes for verify mode, 10 minutes for delegate mode.
106
+
107
+ ## Presentation
108
+
109
+ **Verify mode** — present a unified view:
110
+
111
+ ```markdown
112
+ ## Claude's Analysis
113
+ [Claude's existing findings from the skill's normal process]
114
+
115
+ ## Codex's Analysis
116
+ [Codex findings, structured with severity and location]
117
+
118
+ ## Disagreements
119
+ [Where they differ, with reasoning from each side]
120
+ [If no disagreements: "Claude and Codex agree on all findings."]
121
+
122
+ ## Resolution
123
+ User decides. The existing quality gate makes the final call.
124
+ ```
125
+
126
+ **Delegate mode** — no dual presentation. Codex produced the artifact. It goes through forge's standard quality gates (tests pass, coverage meets threshold, code review by Claude).
127
+
128
+ ## Error Handling
129
+
130
+ - **Codex invocation fails** (timeout, auth error, runtime crash): Log the error. Present Claude's findings only. Note: "Codex was unavailable for this step."
131
+ - **Codex returns empty or malformed output:** Treat as unavailable. Present Claude's findings only.
132
+ - **`.forge/local.yaml` is corrupted:** Reset to `codex.mode: ask`. Warn user.
133
+ - **Codex failure NEVER blocks the workflow.** Every Codex step is optional. The skill's normal process completes regardless.
134
+
135
+ ## Model Selection
136
+
137
+ This protocol does not specify which Codex model to use. The Codex plugin handles model selection via its own configuration. Forge defers to the plugin's defaults.
138
+
139
+ ## Constraints
140
+
141
+ 1. This protocol does NOT manage Codex installation, authentication, or updates. The Codex plugin owns its own lifecycle.
142
+ 2. This protocol does NOT auto-suggest switching to Codex based on token usage or session length. The user initiates Codex usage.
143
+ 3. This protocol works unchanged if more skills opt in later. Skill names that appear above (build-tdd, build-scaffold, code-review, security-audit) are illustrative — they show how the protocol is currently consumed, not a closed set.
144
+
145
+ ## Version Compatibility
146
+
147
+ Tested with: Codex CLI v?.? (commit pinned). Update this section when bumping CLI version.
148
+
149
+ - Minimum Codex CLI: unpinned for now — relies on whatever ships in the Codex plugin currently installed in the user's harness.
150
+ - Pinned commit: TODO — record the Codex CLI commit SHA the protocol was validated against once the Codex plugin is versioned in this repo.
151
+ - Breaking-change notes: when Codex CLI changes the `adversarial-review` / `review` / `task` command surface or output structure, update this protocol's Invocation section and bump the recorded commit.
@@ -0,0 +1,156 @@
1
+ # Graphify Integration (Optional)
2
+
3
+ Protocol for optional knowledge graph enrichment across forge skills and commands. Graphify is a skill — graph building is handled by invoking `/graphify`. This protocol defines the reusable guard (install/build/update check) and the query interface skills use to consume graph data.
4
+
5
+ ## How It Works
6
+
7
+ 1. **`/graphify` skill** builds the graph — AST extraction (tree-sitter, free) + semantic extraction (LLM subagents) + Leiden clustering. Outputs `graphify-out/graph.json`, `graphify-out/GRAPH_REPORT.md`, and `graphify-out/graph.html`.
8
+ 2. **Skills and commands** consume the graph — read static files and run CLI queries. They do not build or manage the graph.
9
+ 3. **The guard** (below) is a reusable check any skill or command can run at its start to ensure graphify is available and the graph is current.
10
+
11
+ The graphify CLI provides queries (`query`, `path`, `explain`), platform installers, hooks, and benchmarking — but has no `build` subcommand. Graph construction is orchestrated by the `/graphify` skill, which calls graphify's Python library functions (`detect`, `extract`, `build`, `cluster`, `export`, `report`) and dispatches Claude subagents for semantic extraction. This system intentionally does not use graphify's installer or hook-writing commands (`graphify install`, `graphify hook install`) — it manages its own files.
12
+
13
+ ## Guard: Graphify Status Check
14
+
15
+ Any skill or command that benefits from graph data can run this check at its start. The guard handles install, build, and update — so the skill's own methodology only needs to focus on querying.
16
+
17
+ **Step 1 — Check status:**
18
+
19
+ Three independent checks:
20
+ - **Graph file:** `test -f graphify-out/graph.json`
21
+ - **CLI installed:** `graphify --version` (exit 0 = installed)
22
+ - **`/graphify` skill installed:** `test -f ~/.claude/skills/graphify/SKILL.md`
23
+
24
+ Combine the results:
25
+
26
+ ```
27
+ graphify-out/graph.json exists? → CLI installed? → /graphify skill installed? → Action
28
+ ──────────────────────────────────────────────────────────────────────────────────
29
+ No No No Offer full install (CLI + skill)
30
+ No Yes No Offer skill install only
31
+ No Yes Yes Offer build via /graphify
32
+ Yes No (don't care) Use static files only
33
+ Yes Yes No Use static files + CLI queries; offer skill install for /graphify --update
34
+ Yes Yes Yes Offer update via /graphify --update (or use as-is)
35
+ ```
36
+
37
+ **Step 2 — Prompt the user:**
38
+
39
+ For skills where graphify enriches but isn't essential:
40
+
41
+ ```
42
+ This skill works great with graphify (knowledge graph).
43
+
44
+ Current status: {not installed | installed, no graph | graph exists (N nodes, M communities)}
45
+
46
+ {(a) Install now — runs these commands (skill-only, no project file changes):
47
+ # Note: the PyPI package is `graphifyy` (double-y) — `graphify` on PyPI
48
+ # is a different unrelated package. The CLI binary it installs is
49
+ # still `graphify` (single-y). Do NOT "fix" this to `pip install graphify`.
50
+ pip install graphifyy
51
+ mkdir -p ~/.claude/skills/graphify
52
+ # TODO pin version — replace `v1` with a commit SHA or release tag once one is published.
53
+ curl -fsSL https://raw.githubusercontent.com/safishamsi/graphify/v1/skills/graphify/skill.md \
54
+ > ~/.claude/skills/graphify/SKILL.md
55
+ Then add this line to ~/.claude/CLAUDE.md (your global file):
56
+ - **graphify** (`~/.claude/skills/graphify/SKILL.md`) - any input to knowledge graph. Trigger: `/graphify`} ← only if not installed
57
+ {(b) Build graph now — /graphify} ← only if installed but no graph
58
+ {(c) Update graph — /graphify --update} ← only if graph exists
59
+ {(d) Skip — proceed without graph}
60
+ ```
61
+
62
+ If the user picks install → run the manual-install commands above, then re-check. This path avoids modifying project files. Graphify's native `graphify install` is also available but NOT recommended here — it writes a graphify section to the project's CLAUDE.md and a PreToolUse hook to `.claude/settings.json`, which conflict with files this system manages. If a user wants those features, they can run `graphify install` themselves outside the guard. If they pick build/update → invoke the `/graphify` skill (or `/graphify --update`). If they skip → proceed without graph data.
63
+
64
+ **Step 3 — Save preference (optional):**
65
+
66
+ If `.forge/local.yaml` exists, respect stored preferences:
67
+
68
+ ```yaml
69
+ graphify:
70
+ build: ask # always | ask | never (default: ask)
71
+ query: ask # always | ask | never (default: ask)
72
+ install_hint: ask # ask | never (default: ask)
73
+ ```
74
+
75
+ - `build: always` → invoke `/graphify` or `/graphify --update` without prompting.
76
+ - `build: never` → skip build/update silently, still use existing graph if present.
77
+ - `query: always` → run CLI queries without prompting.
78
+ - `query: never` → skip CLI queries, use static files only.
79
+ - `query: ask` → prompt on first CLI query per skill invocation.
80
+ - `install_hint: never` → don't suggest installation.
81
+
82
+ **First-use setup:**
83
+
84
+ - If `.forge/local.yaml` does not exist, create it with defaults (`ask` for all keys).
85
+ - If `.gitignore` does not contain `.forge/local.yaml`, append it.
86
+
87
+ ### Query-only skills
88
+
89
+ Skills that only use CLI queries on an existing graph (e.g., `support-debug` using `graphify path`) do not need the full guard. They just check:
90
+
91
+ 1. Does `graphify-out/graph.json` exist? → if no, skip graphify entirely.
92
+ 2. Is the `graphify` CLI available? → if yes, run queries. If no, read static files only.
93
+ 3. Check `query` preference in `.forge/local.yaml` before first CLI query.
94
+
95
+ No install/build prompts. The graph either exists (from a prior `/graphify` or `/setup` run) or it doesn't.
96
+
97
+ ### Staleness
98
+
99
+ Graphify manages freshness internally. The `--update` flag re-extracts only new/changed files (using content hashes and file mtimes). There is no standalone staleness check command — `--update` IS the staleness check and is cheap if nothing changed.
100
+
101
+ Skills should not implement their own staleness heuristics (no mtime-vs-git-commit checks). Either offer `--update` via the guard, or use the graph as-is.
102
+
103
+ ## Querying the Graph
104
+
105
+ ### Static files
106
+
107
+ Skills can read these directly — no consent needed:
108
+
109
+ - **`graphify-out/graph.json`** — full graph with nodes, edges, communities
110
+ - **`graphify-out/GRAPH_REPORT.md`** — compact summary with god nodes, community labels
111
+ - **`graphify-out/graph.html`** — interactive visualization (reference in onboarding docs)
112
+
113
+ Key structures in `graphify-out/graph.json`:
114
+
115
+ - **God nodes** — highest-degree nodes (critical components, architectural hubs)
116
+ - **Communities** — Leiden-clustered subsystems with labels and cohesion scores. Use top 20 by cohesion; beyond that is typically noise (singletons).
117
+ - **Edge confidence** — `EXTRACTED` (trusted, from AST/source), `INFERRED` (hypothesis, verify before acting), `AMBIGUOUS` (investigation target). These labels come from semantic extraction via the `/graphify` skill.
118
+ - **Node metadata** — `source_file`, `source_location`, `file_type`, `community`
119
+
120
+ **Team-safe:** If a teammate committed `graphify-out/`, everyone benefits without needing graphify installed.
121
+
122
+ ### CLI commands
123
+
124
+ Require the `graphify` CLI to be installed. Check `query` preference in `.forge/local.yaml` before first use.
125
+
126
+ | Command | Purpose | Token Cost |
127
+ |---------|---------|-----------|
128
+ | `graphify query "<question>" --budget N --graph graphify-out/graph.json` | BFS traversal, token-capped answer | ~345 tokens avg |
129
+ | `graphify query "<question>" --dfs --graph graphify-out/graph.json` | DFS traversal, trace dependency paths | ~345 tokens avg |
130
+ | `graphify path "NodeA" "NodeB" --graph graphify-out/graph.json` | Shortest path between two concepts | Minimal |
131
+ | `graphify explain "NodeName" --graph graphify-out/graph.json` | Plain-language node explanation | ~200 tokens |
132
+
133
+ Always use `--budget` with `query` to cap token usage. Default budget: 1500 tokens.
134
+
135
+ ## Error Handling
136
+
137
+ - CLI query fails → log error, continue with static file data only.
138
+ - CLI query returns empty → treat as no result, do not retry.
139
+ - `graphify-out/graph.json` is malformed → skip graph context, note "`graphify-out/graph.json` could not be parsed."
140
+ - `pip install graphifyy` fails → note the error, proceed without graphify.
141
+ - **Graphify failure NEVER blocks the workflow.** Every graphify step is optional enrichment.
142
+
143
+ ## Constraints
144
+
145
+ 1. Do NOT manage graph rebuilds or freshness. The user invokes `/graphify --update` themselves (or accepts the guard's offer).
146
+ 2. Do NOT invoke `graphify install` or `graphify hook install`. These commands modify CLAUDE.md and settings.json, which this system manages — the guard's install prompt uses the manual curl-based path instead. Users who want graphify's hook/CLAUDE.md integration can run `graphify install` themselves outside this workflow.
147
+ 3. Treat `graphify-out/` as read-only input (except when building via the `/graphify` skill).
148
+ 4. Always run CLI commands from the repo root, or use `--graph graphify-out/graph.json` explicitly to avoid path issues.
149
+
150
+ ## Version Compatibility
151
+
152
+ Tested with: graphify v1 (TODO pin commit). Update when v2 lands.
153
+
154
+ - Minimum graphify CLI: v1 (PyPI package `graphifyy`).
155
+ - Pinned commit: TODO — replace the `v1` reference in the install snippet (Step 2 install URL) with a commit SHA or release tag once one is published.
156
+ - Breaking-change notes: when graphify v2 lands or the `graphify-out/graph.json` schema changes (god-node fields, community labels, edge-confidence enum), update the "Outputs" section and the BFS/DFS query examples, then bump the recorded version here.