@zigrivers/scaffold 3.1.0 → 3.4.1

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 (198) hide show
  1. package/README.md +366 -40
  2. package/content/knowledge/core/test-skeleton-generation.md +313 -0
  3. package/{knowledge → content/knowledge}/execution/enhancement-workflow.md +1 -1
  4. package/content/knowledge/product/vision-innovation.md +273 -0
  5. package/{knowledge → content/knowledge}/tools/post-implementation-review-methodology.md +1 -1
  6. package/{pipeline → content/pipeline}/consolidation/workflow-audit.md +1 -1
  7. package/{pipeline → content/pipeline}/decisions/review-adrs.md +1 -1
  8. package/{pipeline → content/pipeline}/environment/design-system.md +1 -1
  9. package/{pipeline → content/pipeline}/finalization/implementation-playbook.md +2 -2
  10. package/{pipeline → content/pipeline}/foundation/tech-stack.md +1 -1
  11. package/{pipeline → content/pipeline}/modeling/review-domain-modeling.md +1 -1
  12. package/{pipeline → content/pipeline}/planning/implementation-plan-review.md +2 -1
  13. package/{pipeline → content/pipeline}/quality/review-testing.md +1 -1
  14. package/{pipeline → content/pipeline}/quality/story-tests.md +2 -2
  15. package/{pipeline → content/pipeline}/vision/innovate-vision.md +1 -1
  16. package/content/skills/mmr/SKILL.md +65 -0
  17. package/content/skills/multi-model-dispatch/SKILL.md +327 -0
  18. package/{agent-skills → content/skills}/scaffold-pipeline/SKILL.md +14 -8
  19. package/{agent-skills → content/skills}/scaffold-runner/SKILL.md +64 -19
  20. package/{tools → content/tools}/post-implementation-review.md +2 -2
  21. package/{tools → content/tools}/prompt-pipeline.md +7 -0
  22. package/dist/cli/commands/build.d.ts.map +1 -1
  23. package/dist/cli/commands/build.js +17 -1
  24. package/dist/cli/commands/build.js.map +1 -1
  25. package/dist/cli/commands/build.test.js +6 -5
  26. package/dist/cli/commands/build.test.js.map +1 -1
  27. package/dist/cli/commands/info.test.js +2 -2
  28. package/dist/cli/commands/info.test.js.map +1 -1
  29. package/dist/cli/commands/init.d.ts.map +1 -1
  30. package/dist/cli/commands/init.js +9 -0
  31. package/dist/cli/commands/init.js.map +1 -1
  32. package/dist/cli/commands/init.test.js +6 -0
  33. package/dist/cli/commands/init.test.js.map +1 -1
  34. package/dist/cli/commands/list.test.js +8 -8
  35. package/dist/cli/commands/list.test.js.map +1 -1
  36. package/dist/cli/commands/run.test.js +4 -4
  37. package/dist/cli/commands/run.test.js.map +1 -1
  38. package/dist/cli/commands/skill.d.ts.map +1 -1
  39. package/dist/cli/commands/skill.js +16 -86
  40. package/dist/cli/commands/skill.js.map +1 -1
  41. package/dist/cli/commands/skill.test.js +27 -46
  42. package/dist/cli/commands/skill.test.js.map +1 -1
  43. package/dist/cli/middleware/project-root.d.ts.map +1 -1
  44. package/dist/cli/middleware/project-root.js +16 -0
  45. package/dist/cli/middleware/project-root.js.map +1 -1
  46. package/dist/cli/middleware/project-root.test.js +20 -0
  47. package/dist/cli/middleware/project-root.test.js.map +1 -1
  48. package/dist/core/adapters/gemini.js +2 -2
  49. package/dist/core/adapters/gemini.js.map +1 -1
  50. package/dist/core/adapters/gemini.test.js +1 -1
  51. package/dist/core/adapters/gemini.test.js.map +1 -1
  52. package/dist/core/skills/sync.d.ts +36 -0
  53. package/dist/core/skills/sync.d.ts.map +1 -0
  54. package/dist/core/skills/sync.js +119 -0
  55. package/dist/core/skills/sync.js.map +1 -0
  56. package/dist/core/skills/sync.test.d.ts +2 -0
  57. package/dist/core/skills/sync.test.d.ts.map +1 -0
  58. package/dist/core/skills/sync.test.js +166 -0
  59. package/dist/core/skills/sync.test.js.map +1 -0
  60. package/dist/e2e/commands.test.js +10 -10
  61. package/dist/e2e/commands.test.js.map +1 -1
  62. package/dist/e2e/knowledge.test.js +5 -4
  63. package/dist/e2e/knowledge.test.js.map +1 -1
  64. package/dist/index.js +0 -0
  65. package/dist/project/adopt.test.js +8 -8
  66. package/dist/project/adopt.test.js.map +1 -1
  67. package/dist/utils/fs.d.ts +5 -5
  68. package/dist/utils/fs.d.ts.map +1 -1
  69. package/dist/utils/fs.js +15 -15
  70. package/dist/utils/fs.js.map +1 -1
  71. package/dist/utils/fs.test.js +9 -9
  72. package/dist/utils/fs.test.js.map +1 -1
  73. package/dist/validation/index.test.js +2 -2
  74. package/dist/validation/index.test.js.map +1 -1
  75. package/package.json +3 -6
  76. package/skills/mmr/SKILL.md +65 -0
  77. package/skills/scaffold-pipeline/SKILL.md +3 -3
  78. /package/{knowledge → content/knowledge}/core/adr-craft.md +0 -0
  79. /package/{knowledge → content/knowledge}/core/ai-memory-management.md +0 -0
  80. /package/{knowledge → content/knowledge}/core/api-design.md +0 -0
  81. /package/{knowledge → content/knowledge}/core/automated-review-tooling.md +0 -0
  82. /package/{knowledge → content/knowledge}/core/claude-md-patterns.md +0 -0
  83. /package/{knowledge → content/knowledge}/core/coding-conventions.md +0 -0
  84. /package/{knowledge → content/knowledge}/core/database-design.md +0 -0
  85. /package/{knowledge → content/knowledge}/core/design-system-tokens.md +0 -0
  86. /package/{knowledge → content/knowledge}/core/dev-environment.md +0 -0
  87. /package/{knowledge → content/knowledge}/core/domain-modeling.md +0 -0
  88. /package/{knowledge → content/knowledge}/core/eval-craft.md +0 -0
  89. /package/{knowledge → content/knowledge}/core/git-workflow-patterns.md +0 -0
  90. /package/{knowledge → content/knowledge}/core/multi-model-review-dispatch.md +0 -0
  91. /package/{knowledge → content/knowledge}/core/operations-runbook.md +0 -0
  92. /package/{knowledge → content/knowledge}/core/project-structure-patterns.md +0 -0
  93. /package/{knowledge → content/knowledge}/core/review-step-template.md +0 -0
  94. /package/{knowledge → content/knowledge}/core/security-best-practices.md +0 -0
  95. /package/{knowledge → content/knowledge}/core/system-architecture.md +0 -0
  96. /package/{knowledge → content/knowledge}/core/task-decomposition.md +0 -0
  97. /package/{knowledge → content/knowledge}/core/task-tracking.md +0 -0
  98. /package/{knowledge → content/knowledge}/core/tech-stack-selection.md +0 -0
  99. /package/{knowledge → content/knowledge}/core/testing-strategy.md +0 -0
  100. /package/{knowledge → content/knowledge}/core/user-stories.md +0 -0
  101. /package/{knowledge → content/knowledge}/core/user-story-innovation.md +0 -0
  102. /package/{knowledge → content/knowledge}/core/ux-specification.md +0 -0
  103. /package/{knowledge → content/knowledge}/execution/task-claiming-strategy.md +0 -0
  104. /package/{knowledge → content/knowledge}/execution/tdd-execution-loop.md +0 -0
  105. /package/{knowledge → content/knowledge}/execution/worktree-management.md +0 -0
  106. /package/{knowledge → content/knowledge}/finalization/apply-fixes-and-freeze.md +0 -0
  107. /package/{knowledge → content/knowledge}/finalization/developer-onboarding.md +0 -0
  108. /package/{knowledge → content/knowledge}/finalization/implementation-playbook.md +0 -0
  109. /package/{knowledge → content/knowledge}/product/gap-analysis.md +0 -0
  110. /package/{knowledge → content/knowledge}/product/prd-craft.md +0 -0
  111. /package/{knowledge → content/knowledge}/product/prd-innovation.md +0 -0
  112. /package/{knowledge → content/knowledge}/product/vision-craft.md +0 -0
  113. /package/{knowledge → content/knowledge}/review/review-adr.md +0 -0
  114. /package/{knowledge → content/knowledge}/review/review-api-design.md +0 -0
  115. /package/{knowledge → content/knowledge}/review/review-database-design.md +0 -0
  116. /package/{knowledge → content/knowledge}/review/review-domain-modeling.md +0 -0
  117. /package/{knowledge → content/knowledge}/review/review-implementation-tasks.md +0 -0
  118. /package/{knowledge → content/knowledge}/review/review-methodology.md +0 -0
  119. /package/{knowledge → content/knowledge}/review/review-operations.md +0 -0
  120. /package/{knowledge → content/knowledge}/review/review-prd.md +0 -0
  121. /package/{knowledge → content/knowledge}/review/review-security.md +0 -0
  122. /package/{knowledge → content/knowledge}/review/review-system-architecture.md +0 -0
  123. /package/{knowledge → content/knowledge}/review/review-testing-strategy.md +0 -0
  124. /package/{knowledge → content/knowledge}/review/review-user-stories.md +0 -0
  125. /package/{knowledge → content/knowledge}/review/review-ux-specification.md +0 -0
  126. /package/{knowledge → content/knowledge}/review/review-vision.md +0 -0
  127. /package/{knowledge → content/knowledge}/tools/release-management.md +0 -0
  128. /package/{knowledge → content/knowledge}/tools/session-analysis.md +0 -0
  129. /package/{knowledge → content/knowledge}/tools/version-strategy.md +0 -0
  130. /package/{knowledge → content/knowledge}/validation/critical-path-analysis.md +0 -0
  131. /package/{knowledge → content/knowledge}/validation/cross-phase-consistency.md +0 -0
  132. /package/{knowledge → content/knowledge}/validation/decision-completeness.md +0 -0
  133. /package/{knowledge → content/knowledge}/validation/dependency-validation.md +0 -0
  134. /package/{knowledge → content/knowledge}/validation/implementability-review.md +0 -0
  135. /package/{knowledge → content/knowledge}/validation/scope-management.md +0 -0
  136. /package/{knowledge → content/knowledge}/validation/traceability.md +0 -0
  137. /package/{methodology → content/methodology}/README.md +0 -0
  138. /package/{methodology → content/methodology}/custom-defaults.yml +0 -0
  139. /package/{methodology → content/methodology}/deep.yml +0 -0
  140. /package/{methodology → content/methodology}/mvp.yml +0 -0
  141. /package/{pipeline → content/pipeline}/architecture/review-architecture.md +0 -0
  142. /package/{pipeline → content/pipeline}/architecture/system-architecture.md +0 -0
  143. /package/{pipeline → content/pipeline}/build/multi-agent-resume.md +0 -0
  144. /package/{pipeline → content/pipeline}/build/multi-agent-start.md +0 -0
  145. /package/{pipeline → content/pipeline}/build/new-enhancement.md +0 -0
  146. /package/{pipeline → content/pipeline}/build/quick-task.md +0 -0
  147. /package/{pipeline → content/pipeline}/build/single-agent-resume.md +0 -0
  148. /package/{pipeline → content/pipeline}/build/single-agent-start.md +0 -0
  149. /package/{pipeline → content/pipeline}/consolidation/claude-md-optimization.md +0 -0
  150. /package/{pipeline → content/pipeline}/decisions/adrs.md +0 -0
  151. /package/{pipeline → content/pipeline}/environment/ai-memory-setup.md +0 -0
  152. /package/{pipeline → content/pipeline}/environment/automated-pr-review.md +0 -0
  153. /package/{pipeline → content/pipeline}/environment/dev-env-setup.md +0 -0
  154. /package/{pipeline → content/pipeline}/environment/git-workflow.md +0 -0
  155. /package/{pipeline → content/pipeline}/finalization/apply-fixes-and-freeze.md +0 -0
  156. /package/{pipeline → content/pipeline}/finalization/developer-onboarding-guide.md +0 -0
  157. /package/{pipeline → content/pipeline}/foundation/beads.md +0 -0
  158. /package/{pipeline → content/pipeline}/foundation/coding-standards.md +0 -0
  159. /package/{pipeline → content/pipeline}/foundation/project-structure.md +0 -0
  160. /package/{pipeline → content/pipeline}/foundation/tdd.md +0 -0
  161. /package/{pipeline → content/pipeline}/integration/add-e2e-testing.md +0 -0
  162. /package/{pipeline → content/pipeline}/modeling/domain-modeling.md +0 -0
  163. /package/{pipeline → content/pipeline}/parity/platform-parity-review.md +0 -0
  164. /package/{pipeline → content/pipeline}/planning/implementation-plan.md +0 -0
  165. /package/{pipeline → content/pipeline}/pre/create-prd.md +0 -0
  166. /package/{pipeline → content/pipeline}/pre/innovate-prd.md +0 -0
  167. /package/{pipeline → content/pipeline}/pre/innovate-user-stories.md +0 -0
  168. /package/{pipeline → content/pipeline}/pre/review-prd.md +0 -0
  169. /package/{pipeline → content/pipeline}/pre/review-user-stories.md +0 -0
  170. /package/{pipeline → content/pipeline}/pre/user-stories.md +0 -0
  171. /package/{pipeline → content/pipeline}/quality/create-evals.md +0 -0
  172. /package/{pipeline → content/pipeline}/quality/operations.md +0 -0
  173. /package/{pipeline → content/pipeline}/quality/review-operations.md +0 -0
  174. /package/{pipeline → content/pipeline}/quality/review-security.md +0 -0
  175. /package/{pipeline → content/pipeline}/quality/security.md +0 -0
  176. /package/{pipeline → content/pipeline}/specification/api-contracts.md +0 -0
  177. /package/{pipeline → content/pipeline}/specification/database-schema.md +0 -0
  178. /package/{pipeline → content/pipeline}/specification/review-api.md +0 -0
  179. /package/{pipeline → content/pipeline}/specification/review-database.md +0 -0
  180. /package/{pipeline → content/pipeline}/specification/review-ux.md +0 -0
  181. /package/{pipeline → content/pipeline}/specification/ux-spec.md +0 -0
  182. /package/{pipeline → content/pipeline}/validation/critical-path-walkthrough.md +0 -0
  183. /package/{pipeline → content/pipeline}/validation/cross-phase-consistency.md +0 -0
  184. /package/{pipeline → content/pipeline}/validation/decision-completeness.md +0 -0
  185. /package/{pipeline → content/pipeline}/validation/dependency-graph-validation.md +0 -0
  186. /package/{pipeline → content/pipeline}/validation/implementability-dry-run.md +0 -0
  187. /package/{pipeline → content/pipeline}/validation/scope-creep-check.md +0 -0
  188. /package/{pipeline → content/pipeline}/validation/traceability-matrix.md +0 -0
  189. /package/{pipeline → content/pipeline}/vision/create-vision.md +0 -0
  190. /package/{pipeline → content/pipeline}/vision/review-vision.md +0 -0
  191. /package/{tools → content/tools}/dashboard.md +0 -0
  192. /package/{tools → content/tools}/release.md +0 -0
  193. /package/{tools → content/tools}/review-code.md +0 -0
  194. /package/{tools → content/tools}/review-pr.md +0 -0
  195. /package/{tools → content/tools}/session-analyzer.md +0 -0
  196. /package/{tools → content/tools}/update.md +0 -0
  197. /package/{tools → content/tools}/version-bump.md +0 -0
  198. /package/{tools → content/tools}/version.md +0 -0
@@ -36,7 +36,8 @@ and produce a structured coverage matrix and review summary.
36
36
  - docs/reviews/implementation-plan/gemini-review.json — raw Gemini findings (depth 4+, if available)
37
37
 
38
38
  ## Quality Criteria
39
- - (mvp) Architecture coverage verified (every component has tasks)
39
+ - (deep) Architecture coverage verified (every component has tasks)
40
+ - (mvp) Every user story maps to at least one implementation task
40
41
  - (mvp) Dependency graph is valid DAG
41
42
  - (mvp) No task is too large for a single agent session
42
43
  - (deep) Critical path is accurate
@@ -6,7 +6,7 @@ phase: "quality"
6
6
  order: 910
7
7
  dependencies: [tdd, system-architecture]
8
8
  outputs: [docs/reviews/review-testing.md, docs/reviews/testing/review-summary.md, docs/reviews/testing/codex-review.json, docs/reviews/testing/gemini-review.json]
9
- reads: [domain-modeling, system-architecture]
9
+ reads: [domain-modeling]
10
10
  conditional: null
11
11
  knowledge-base: [review-methodology, review-testing-strategy, multi-model-review-dispatch, review-step-template]
12
12
  ---
@@ -6,9 +6,9 @@ phase: "quality"
6
6
  order: 915
7
7
  dependencies: [tdd, review-user-stories, review-architecture]
8
8
  outputs: [tests/acceptance/, docs/story-tests-map.md]
9
- reads: [tech-stack, coding-standards, project-structure, api-contracts, database-schema, ux-spec]
9
+ reads: [tech-stack, coding-standards, project-structure, system-architecture, api-contracts, database-schema, ux-spec]
10
10
  conditional: null
11
- knowledge-base: [testing-strategy, user-stories]
11
+ knowledge-base: [testing-strategy, user-stories, test-skeleton-generation]
12
12
  ---
13
13
 
14
14
  ## Purpose
@@ -7,7 +7,7 @@ order: 030
7
7
  dependencies: [review-vision]
8
8
  outputs: [docs/vision.md]
9
9
  conditional: "if-needed"
10
- knowledge-base: [vision-craft, prd-innovation]
10
+ knowledge-base: [vision-craft, vision-innovation]
11
11
  ---
12
12
 
13
13
  ## Purpose
@@ -0,0 +1,65 @@
1
+ ---
2
+ name: mmr
3
+ description: Multi-model code review — dispatch, poll, and collect results from multiple AI model CLIs
4
+ topics:
5
+ - code review
6
+ - multi-model review
7
+ - review gate
8
+ - mmr
9
+ ---
10
+
11
+ # mmr — Multi-Model Review
12
+
13
+ Dispatch code reviews to multiple AI model CLIs, poll for results, and collect reconciled findings with severity gating.
14
+
15
+ ## Quick Reference
16
+
17
+ ```bash
18
+ # Dispatch a review for a PR
19
+ mmr review --pr <number> --focus "description of what to focus on"
20
+
21
+ # Check progress
22
+ mmr status <job-id>
23
+
24
+ # Collect reconciled results
25
+ mmr results <job-id>
26
+
27
+ # Pre-flight: verify all channels are authenticated
28
+ mmr config test
29
+ ```
30
+
31
+ ## After Creating a PR
32
+
33
+ 1. Run `mmr review --pr <number>`
34
+ 2. Note the job ID from the output
35
+ 3. Continue working on other tasks
36
+ 4. Periodically run `mmr status <job-id>` until all channels complete
37
+ 5. Run `mmr results <job-id>` to get reconciled findings
38
+ 6. If gate failed: fix findings at or above the threshold severity
39
+ 7. If gate passed: proceed to merge
40
+
41
+ ## Auth Failures
42
+
43
+ If `mmr review` reports auth failures, follow the recovery instructions in the output:
44
+ - **Claude:** `claude login`
45
+ - **Gemini:** `gemini -p 'hello'` (interactive, opens browser)
46
+ - **Codex:** `codex login`
47
+
48
+ Re-run `mmr config test` after re-authenticating to verify.
49
+
50
+ ## Severity Gate
51
+
52
+ Default threshold is P2 (fix P0/P1/P2, skip P3). Override per-review:
53
+
54
+ ```bash
55
+ mmr review --pr 47 --fix-threshold P1 # Only fix P0 and P1
56
+ mmr review --pr 47 --fix-threshold P0 # Only fix critical issues
57
+ ```
58
+
59
+ ## Output Formats
60
+
61
+ ```bash
62
+ mmr results <job-id> # JSON (default)
63
+ mmr results <job-id> --format text # Human-readable terminal output
64
+ mmr results <job-id> --format markdown # For PR comments
65
+ ```
@@ -0,0 +1,327 @@
1
+ ---
2
+ name: multi-model-dispatch
3
+ description: Correct patterns for invoking Codex CLI and Gemini CLI as independent reviewers from Claude Code. Covers headless invocation, context bundling, output parsing, dual-model reconciliation, and fallback handling.
4
+ ---
5
+
6
+ # Multi-Model Dispatch
7
+
8
+ This skill teaches Claude Code how to correctly invoke Codex and Gemini CLIs for independent review of artifacts. Use this whenever a pipeline step needs multi-model validation at depth 4-5.
9
+
10
+ ## When This Skill Activates
11
+
12
+ - A review or validation step is running at depth 4+ and wants independent model validation
13
+ - User asks to "run multi-model review" or "get a second opinion from Codex/Gemini"
14
+ - The `automated-pr-review` step is using local CLI review mode
15
+ - The `implementation-plan-review` step dispatches to external CLIs at depth 4+
16
+
17
+ ## CLI Detection & Auth Verification
18
+
19
+ Before attempting any dispatch, detect what's available AND verify authentication. A CLI that's installed but not authenticated is useless in headless mode — it will hang on an interactive auth prompt or fail silently.
20
+
21
+ ### Step 1: Check CLI Installation
22
+
23
+ ```bash
24
+ command -v codex && echo "codex installed" || echo "codex not found"
25
+ command -v gemini && echo "gemini installed" || echo "gemini not found"
26
+ ```
27
+
28
+ ### Step 2: Verify Authentication
29
+
30
+ **CRITICAL: Do not skip this step.** Auth tokens expire mid-session. A CLI that worked 30 minutes ago may fail now.
31
+
32
+ **CRITICAL: Previous auth failures do NOT exempt subsequent dispatches.** Auth tokens refresh — a CLI that failed auth during user story review may work fine for domain modeling review. Always re-check auth before EACH review step, not once per session.
33
+
34
+ **Codex auth check** (has a built-in status command):
35
+ ```bash
36
+ codex login status 2>/dev/null && echo "codex authenticated" || echo "codex NOT authenticated"
37
+ ```
38
+
39
+ **Gemini auth check** (no built-in status command — use a minimal prompt):
40
+ ```bash
41
+ GEMINI_AUTH_CHECK=$(NO_BROWSER=true gemini -p "respond with ok" -o json 2>&1)
42
+ GEMINI_EXIT=$?
43
+ if [ "$GEMINI_EXIT" -eq 0 ]; then
44
+ echo "gemini authenticated"
45
+ elif [ "$GEMINI_EXIT" -eq 41 ]; then
46
+ echo "gemini NOT authenticated (exit 41: auth error)"
47
+ else
48
+ echo "gemini auth unknown (exit $GEMINI_EXIT)"
49
+ fi
50
+ ```
51
+
52
+ **Why `NO_BROWSER=true`?** Gemini CLI relaunches itself as a child process for memory management. During the relaunch, it shows a "Do you want to continue? [Y/n]" consent prompt that hangs when stdin is not a TTY (as in Claude Code's Bash tool). `NO_BROWSER=true` suppresses this prompt and uses cached credentials directly.
53
+
54
+ ### Step 3: Handle Auth Failures
55
+
56
+ **If a CLI fails auth, do NOT silently fall back.** Instead:
57
+
58
+ 1. **Tell the user** which CLI failed auth and why
59
+ 2. **Offer interactive recovery**: Ask the user to run the auth command in their terminal:
60
+ - **Codex**: `! codex login` (opens browser for OAuth) or set `CODEX_API_KEY` env var
61
+ - **Gemini**: `! gemini -p "hello"` (triggers OAuth flow) or set `GEMINI_API_KEY` env var
62
+ 3. **After recovery**: Re-run the auth check. If it passes, proceed with dispatch.
63
+ 4. **If user declines**: Fall back to the other CLI or Claude-only review, but **document the auth failure** in the review summary.
64
+
65
+ The `!` prefix runs the command in the user's terminal session, allowing interactive auth flows (browser OAuth, Y/n prompts) that can't work in headless mode.
66
+
67
+ **If neither CLI is available or authenticated**: Fall back to structured Claude-only self-review. Re-read the artifact with an adversarial lens — actively try to find issues the initial review missed. Document this as "single-model review (no external CLIs available)."
68
+
69
+ ## Correct Invocation Patterns
70
+
71
+ ### Codex CLI (`codex exec`)
72
+
73
+ **CRITICAL: Use `codex exec`, NOT `codex` directly.** The bare `codex` command launches an interactive TUI that requires a TTY and will fail with "stdin is not a terminal" when run from Claude Code.
74
+
75
+ **CRITICAL: Always include `--skip-git-repo-check`.** Without this flag, Codex fails with "Not inside a trusted directory" when the project hasn't initialized git yet (common early in the pipeline).
76
+
77
+ ```bash
78
+ # Basic review dispatch
79
+ codex exec --skip-git-repo-check -s read-only --ephemeral "REVIEW_PROMPT_HERE" 2>/dev/null
80
+
81
+ # With specific model and reasoning effort
82
+ codex exec --skip-git-repo-check -m o4-mini -s read-only -c model_reasoning_effort=high --ephemeral "REVIEW_PROMPT_HERE" 2>/dev/null
83
+
84
+ # Reading prompt from stdin (use - flag)
85
+ echo "$REVIEW_PROMPT" | codex exec --skip-git-repo-check -s read-only --ephemeral - 2>/dev/null
86
+
87
+ # With JSON schema enforcement
88
+ codex exec --skip-git-repo-check -s read-only --ephemeral --output-schema schema.json "REVIEW_PROMPT_HERE" 2>/dev/null
89
+ ```
90
+
91
+ **Key flags:**
92
+ | Flag | Purpose |
93
+ |------|---------|
94
+ | `exec` | **Required** — headless mode, no TUI, no TTY needed |
95
+ | `--skip-git-repo-check` | **Required** — allows running outside a git repo or untrusted directory |
96
+ | `-s read-only` | Sandbox: reviewer cannot write files (read-only analysis) |
97
+ | `--ephemeral` | Don't persist session (one-shot review) |
98
+ | `2>/dev/null` | Suppress thinking tokens on stderr (keeps Claude Code context clean) |
99
+ | `--output-schema` | Enforce structured JSON output against a schema file |
100
+ | `-c model_reasoning_effort=high` | Increase reasoning depth for complex reviews |
101
+
102
+ **Output**: Progress streams to stderr (suppressed by `2>/dev/null`). Final answer prints to stdout.
103
+
104
+ ### Gemini CLI (`gemini -p`)
105
+
106
+ **Use `-p` / `--prompt` for headless mode.** Without this flag, Gemini launches interactive mode.
107
+
108
+ **CRITICAL: Always prepend `NO_BROWSER=true`.** Without this, Gemini's child process relaunch shows a consent prompt ("Do you want to continue? [Y/n]") that hangs when stdin is not a TTY. This affects ALL non-interactive contexts including Claude Code's Bash tool.
109
+
110
+ ```bash
111
+ # Basic review dispatch
112
+ NO_BROWSER=true gemini -p "REVIEW_PROMPT_HERE" --output-format json --approval-mode yolo 2>/dev/null
113
+
114
+ # With specific model
115
+ NO_BROWSER=true gemini -p "REVIEW_PROMPT_HERE" -m pro --output-format json --approval-mode yolo 2>/dev/null
116
+
117
+ # Reading context from stdin
118
+ cat artifact.md | NO_BROWSER=true gemini -p "Review this artifact for issues" --output-format json --approval-mode yolo 2>/dev/null
119
+
120
+ # With sandbox (no file writes)
121
+ NO_BROWSER=true gemini -p "REVIEW_PROMPT_HERE" --output-format json -s --approval-mode yolo 2>/dev/null
122
+ ```
123
+
124
+ **Key flags:**
125
+ | Flag | Purpose |
126
+ |------|---------|
127
+ | `NO_BROWSER=true` | **Required** — suppresses consent prompt that hangs in non-TTY shells |
128
+ | `-p "prompt"` | **Required** — headless mode, no interactive UI |
129
+ | `--output-format json` | Structured JSON output for parsing |
130
+ | `--approval-mode yolo` | Auto-approve all tool calls (reviewer doesn't need to write) |
131
+ | `-s` | Sandbox mode (extra safety for read-only review) |
132
+ | `-m pro` | Use Gemini Pro model (default is auto) |
133
+ | `2>/dev/null` | Suppress progress output |
134
+
135
+ **Output**: JSON on stdout with `{ response, stats, error }` structure.
136
+
137
+ ## Context Bundling
138
+
139
+ When dispatching a review, bundle all relevant context into the prompt. Each CLI gets the same bundle — do NOT share one model's review with the other.
140
+
141
+ ### Template for Artifact Review
142
+
143
+ ```
144
+ You are reviewing a project artifact for quality issues. Report P0 (critical), P1 (high), and P2 (medium) issues.
145
+
146
+ ## Severity Definitions
147
+ - P0: Will cause implementation failure, data loss, security vulnerability, or fundamental architectural flaw
148
+ - P1: Will cause bugs in normal usage, inconsistency across documents, or blocks downstream work
149
+ - P2: Improvement opportunity — style, naming, documentation, minor optimization
150
+ - Do NOT report P3 issues (personal preference, trivial nits)
151
+
152
+ ## Review Standards
153
+ [paste contents of docs/review-standards.md if it exists, otherwise use severity definitions above]
154
+
155
+ ## Artifact to Review
156
+ [paste full artifact content]
157
+
158
+ ## Upstream References
159
+ [paste relevant upstream docs: PRD, tech-stack, coding-standards, etc.]
160
+
161
+ ## Output Format
162
+ Respond with a JSON object:
163
+ {
164
+ "approved": true/false,
165
+ "findings": [
166
+ {
167
+ "severity": "P0" or "P1" or "P2",
168
+ "location": "section or line reference",
169
+ "description": "what's wrong",
170
+ "suggestion": "specific fix"
171
+ }
172
+ ],
173
+ "summary": "one-line assessment"
174
+ }
175
+
176
+ If no P0/P1/P2 issues found, respond with: { "approved": true, "findings": [], "summary": "No issues found." }
177
+ ```
178
+
179
+ ### Template for PR Diff Review
180
+
181
+ ```
182
+ You are reviewing a pull request diff. Report P0, P1, and P2 issues.
183
+
184
+ ## Review Standards
185
+ [paste docs/review-standards.md]
186
+
187
+ ## Project Coding Standards
188
+ [paste docs/coding-standards.md]
189
+
190
+ ## Test Standards
191
+ [paste docs/tdd-standards.md]
192
+
193
+ ## PR Diff
194
+ [paste output of gh pr diff <number> or git diff origin/main...HEAD]
195
+
196
+ ## Output Format
197
+ [same JSON format as above, but location = file:line]
198
+ ```
199
+
200
+ ### Context Size Guidelines
201
+
202
+ | Artifact Type | Max Context | Strategy |
203
+ |--------------|------------|----------|
204
+ | PRD | Full document | Include entirely |
205
+ | User stories | Full document | Include entirely |
206
+ | Architecture | Full document | Include entirely |
207
+ | Domain models | Directory listing + key files | Summarize index, include 2-3 representative files |
208
+ | PR diff | Full diff | If >2000 lines, split into file groups |
209
+ | Implementation plan | Task list + representative tasks | Include full task list, detail for flagged tasks |
210
+
211
+ ## Dual-Model Reconciliation
212
+
213
+ When both CLIs produce results, reconcile findings using these rules:
214
+
215
+ | Scenario | Confidence | Action |
216
+ |----------|-----------|--------|
217
+ | Both flag same issue | **High** | Fix immediately — two independent models agree |
218
+ | Both approve (no findings) | **High** | Proceed confidently |
219
+ | One flags P0, other approves | **High** | Fix it — P0 is critical enough from a single source |
220
+ | One flags P1, other approves | **Medium** | Review the finding carefully before fixing. If the finding is specific and actionable, fix it. If vague, skip. |
221
+ | Models contradict each other | **Low** | Present both findings to the user for adjudication |
222
+
223
+ **Independence rule**: Never share one model's review output with the other. Each model must review the artifact independently to avoid confirmation bias.
224
+
225
+ **Round tracking**: For iterative reviews (like PR review loops), track the round number. After 3 fix rounds, merge with a warning and create a follow-up issue for remaining findings.
226
+
227
+ ## Fallback Behavior
228
+
229
+ | Situation | Fallback |
230
+ |-----------|----------|
231
+ | Neither CLI available | Structured Claude-only adversarial self-review |
232
+ | Codex only | Single-model review with Codex |
233
+ | Gemini only | Single-model review with Gemini |
234
+ | **CLI auth expired** | **Surface to user with recovery command — do NOT silently fall back** |
235
+ | One CLI fails mid-review (non-auth) | Continue with the other; note the failure in summary |
236
+ | Both CLIs fail (non-auth) | Fall back to Claude-only self-review; warn user |
237
+ | CLI output not parseable as JSON | Treat as text, extract findings manually |
238
+
239
+ **Auth failures are NOT silent fallbacks.** The difference between "CLI not installed" (fall back quietly) and "CLI auth expired" (user action required) is critical. Auth can be fixed in 30 seconds with an interactive command — silently skipping wastes the user's review infrastructure.
240
+
241
+ ## Integration with Review Steps
242
+
243
+ All review steps can reference this skill at depth 4-5. The pattern is:
244
+
245
+ 1. **Depth 1-3**: Claude-only multi-pass review (step's existing logic)
246
+ 2. **Depth 4**: Claude review + single external CLI review (if available)
247
+ 3. **Depth 5**: Claude review + dual-model CLI review with reconciliation
248
+
249
+ Each review step adds a "Multi-Model Validation" section at the end that:
250
+ 1. Detects available CLIs
251
+ 2. Bundles the artifact + upstream references into a review prompt
252
+ 3. Dispatches to available CLIs using the patterns above
253
+ 4. Reconciles findings using the dual-model rules
254
+ 5. Applies fixes for high-confidence findings
255
+ 6. Presents medium/low-confidence findings to the user
256
+
257
+ ## Error Handling
258
+
259
+ ```bash
260
+ # Capture exit code AND stderr separately (don't suppress stderr for error detection)
261
+ CODEX_STDERR=$(mktemp)
262
+ OUTPUT=$(codex exec --skip-git-repo-check -s read-only --ephemeral "prompt" 2>"$CODEX_STDERR") || {
263
+ EXIT_CODE=$?
264
+ STDERR_CONTENT=$(cat "$CODEX_STDERR")
265
+ if echo "$STDERR_CONTENT" | grep -qi "refresh token\|please re-run.*login\|sign in again\|auth"; then
266
+ echo "Codex auth expired. Ask user to run: ! codex login"
267
+ # DO NOT silently fall back — surface to user
268
+ else
269
+ echo "Codex CLI failed with exit code $EXIT_CODE"
270
+ # Fall back to Gemini or Claude-only
271
+ fi
272
+ rm -f "$CODEX_STDERR"
273
+ }
274
+
275
+ GEMINI_STDERR=$(mktemp)
276
+ OUTPUT=$(NO_BROWSER=true gemini -p "prompt" --output-format json --approval-mode yolo 2>"$GEMINI_STDERR") || {
277
+ EXIT_CODE=$?
278
+ if [ "$EXIT_CODE" -eq 41 ]; then
279
+ echo "Gemini auth failed (exit 41). Ask user to run: ! gemini -p \"hello\""
280
+ # DO NOT silently fall back — surface to user
281
+ else
282
+ echo "Gemini CLI failed with exit code $EXIT_CODE"
283
+ # Fall back to Codex or Claude-only
284
+ fi
285
+ rm -f "$GEMINI_STDERR"
286
+ }
287
+ ```
288
+
289
+ ### Exit Codes
290
+
291
+ **Gemini exit codes:**
292
+
293
+ | Code | Meaning | Action |
294
+ |------|---------|--------|
295
+ | 0 | Success | Parse output |
296
+ | 1 | General error | Fall back to other CLI |
297
+ | **41** | **Auth failure** | **Surface to user — offer `! gemini -p "hello"` recovery** |
298
+ | 42 | Input error | Check prompt format |
299
+ | 52 | Config error | Check `~/.gemini/settings.json` |
300
+ | 53 | Turn limit exceeded | Retry with shorter prompt |
301
+
302
+ **Codex exit codes:**
303
+
304
+ | Code | Meaning | Action |
305
+ |------|---------|--------|
306
+ | 0 | Success | Parse output |
307
+ | 1 | General failure | Check stderr for auth messages |
308
+
309
+ Codex uses exit code 1 for all failures. **Check stderr** for auth-specific messages: "refresh token", "please re-run", "sign in again", "ChatGPT account ID not available".
310
+
311
+ ### Auth Recovery Flow
312
+
313
+ When an auth failure is detected during dispatch (not during pre-flight):
314
+
315
+ 1. Stop the review dispatch immediately
316
+ 2. Tell the user: "Gemini/Codex auth has expired. To re-authenticate, run:"
317
+ 3. Suggest: `! codex login` or `! gemini -p "hello"` (the `!` prefix runs it interactively)
318
+ 4. After the user re-authenticates, re-run the auth check
319
+ 5. If auth succeeds, resume the review dispatch from where it stopped
320
+ 6. If the user declines, fall back to the other CLI or Claude-only review
321
+
322
+ ## What This Skill Does NOT Do
323
+
324
+ - Does not install CLIs (user must install `codex` and `gemini` separately)
325
+ - Does not authenticate CLIs — but it **detects auth failures** and guides the user through interactive recovery via `!` prefix commands
326
+ - Does not replace Claude's own review passes — it adds independent validation on top
327
+ - Does not work as an MCP server — it uses Bash tool invocations directly
@@ -31,7 +31,7 @@ Use this skill ONLY when the user asks about:
31
31
  | 8 | `specification` | Specifications | Creates interface specs: database schema with constraints, API contracts with error codes, UX flows with accessibility. Each conditional. |
32
32
  | 9 | `quality` | Quality Gates | Reviews testing, generates test skeletons, creates eval checks, designs deployment pipeline, and conducts security review. |
33
33
  | 10 | `parity` | Platform Parity | Audits documentation for platform-specific gaps. Skips for single-platform projects. |
34
- | 11 | `consolidation` | Consolidation | Optimizes AGENTS.md under 200 lines and audits all workflow docs for consistency. |
34
+ | 11 | `consolidation` | Consolidation | Optimizes {{INSTRUCTIONS_FILE}} under 200 lines and audits all workflow docs for consistency. |
35
35
  | 12 | `planning` | Planning | Decomposes stories into concrete tasks scoped to ~150 lines and 3 files max, with clear acceptance criteria. |
36
36
  | 13 | `validation` | Validation | Seven cross-cutting audits: scope creep, dependency cycles, implementability, traceability, naming drift, broken handoffs, decision completeness. |
37
37
  | 14 | `finalization` | Finalization | Applies validation findings, freezes docs, creates onboarding guide, and writes the implementation playbook. |
@@ -41,13 +41,16 @@ Use this skill ONLY when the user asks about:
41
41
 
42
42
  | # | Phase | Command | Notes |
43
43
  |---|-------|---------|-------|
44
+ | 0.1 | Product Vision | `/scaffold:create-vision` | Interactive — requires user input |
45
+ | 0.2 | Product Vision | `/scaffold:review-vision` | Multi-pass vision review |
46
+ | 0.3 | Product Vision | `/scaffold:innovate-vision` | **(optional)** Strategic innovation |
44
47
  | 1 | Product Definition | `/scaffold:create-prd` | Interactive — requires user input |
45
48
  | 2 | Product Definition | `/scaffold:review-prd` | Multi-pass PRD review |
46
49
  | 2.5 | Product Definition | `/scaffold:innovate-prd` | **(optional)** Feature-level innovation |
47
50
  | 3 | Product Definition | `/scaffold:user-stories` | Covers every PRD feature |
48
51
  | 4 | Product Definition | `/scaffold:review-user-stories` | Multi-pass story review; depth 4+ adds requirements index |
49
52
  | 4.5 | Product Definition | `/scaffold:innovate-user-stories` | **(optional)** UX-level enhancements |
50
- | 5 | Project Foundation | `/scaffold:beads` | **(optional)** Creates AGENTS.md + task tracking |
53
+ | 5 | Project Foundation | `/scaffold:beads` | **(optional)** Creates {{INSTRUCTIONS_FILE}} + task tracking |
51
54
  | 6 | Project Foundation | `/scaffold:tech-stack` | Drives all technical decisions |
52
55
  | 7 | Project Foundation | `/scaffold:coding-standards` | References tech-stack.md |
53
56
  | 8 | Project Foundation | `/scaffold:tdd` | References tech-stack.md + coding-standards.md |
@@ -78,8 +81,8 @@ Use this skill ONLY when the user asks about:
78
81
  | 31 | Quality Gates | `/scaffold:security` | Threat model, auth, data protection |
79
82
  | 32 | Quality Gates | `/scaffold:review-security` | Reviews security posture |
80
83
  | 33 | Platform Parity | `/scaffold:platform-parity-review` | **(optional)** Multi-platform projects |
81
- | 34 | Consolidation | `/scaffold:Codex-md-optimization` | Run BEFORE workflow-audit |
82
- | 35 | Consolidation | `/scaffold:workflow-audit` | Run AFTER Codex-md-optimization |
84
+ | 34 | Consolidation | `/scaffold:claude-md-optimization` | Run BEFORE workflow-audit |
85
+ | 35 | Consolidation | `/scaffold:workflow-audit` | Run AFTER claude-md-optimization |
83
86
  | 36 | Planning | `/scaffold:implementation-plan` | Creates full task graph |
84
87
  | 37 | Planning | `/scaffold:implementation-plan-review` | Second pass for quality + multi-model validation (depth 4+) |
85
88
  | 38 | Validation | `/scaffold:cross-phase-consistency` | Naming, assumptions, interfaces |
@@ -117,7 +120,7 @@ Use this skill ONLY when the user asks about:
117
120
  | `/scaffold:new-enhancement` | Add a feature to an existing project |
118
121
  | `/scaffold:quick-task` | Create a focused task for a bug fix, refactor, or small improvement |
119
122
  | `/scaffold:version-bump` | Bump version and update changelog without tagging or releasing |
120
- | `/scaffold:release` | Create a versioned release with changelog and GitHub release |
123
+ | `/scaffold:release` | Run the target project's release ceremony with changelog generation and project-specific release artifacts |
121
124
  | `/scaffold:prompt-pipeline` | Show the full pipeline reference |
122
125
  | `/scaffold:dashboard` | Open visual pipeline dashboard in browser |
123
126
 
@@ -135,7 +138,7 @@ create-prd ─→ review-prd │ tech-stack → coding-standards → tdd
135
138
  ↓ │ ↓ │
136
139
  user-stories │ project-structure → dev-env-setup │
137
140
  ↓ │ ↓ │
138
- review-user-stories ──┐ │ git-workflow → Codex-md-optimization │
141
+ review-user-stories ──┐ │ git-workflow → claude-md-optimization │
139
142
  │ │ ↓ ↓ │
140
143
  │ │ ai-memory-setup workflow-audit │
141
144
  │ │ │
@@ -189,8 +192,11 @@ Steps within the same track that don't depend on each other can run in parallel
189
192
  6. **Architecture before Specification** — DB, API, UX specs derive from architecture (can parallelize)
190
193
  7. **TDD → Review Testing → Operations → Security** — quality gate chain
191
194
  8. **Both tracks converge at Implementation Plan** — depends on tdd, operations, security, AND review-architecture
192
- 9. **All 7 Validation checks before Apply Fixes & Freeze** — freeze requires all findings
193
- 10. **Finalization before Execution** — agents need frozen docs and playbook
195
+ 9. **Quality Gates before Consolidation** — consolidation verifies all docs including operations/security
196
+ 10. **Claude.md Optimization before Workflow Audit** — optimize first, verify second
197
+ 11. **Implementation Plan Review before Validation** — 7 checks run after plan review
198
+ 12. **All 7 Validation checks before Apply Fixes & Freeze** — freeze requires all findings
199
+ 13. **Finalization before Execution** — agents need frozen docs and playbook
194
200
 
195
201
  ## Status & Navigation
196
202