multi-forge 0.2.0__py3-none-any.whl

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 (311) hide show
  1. forge/__init__.py +3 -0
  2. forge/_extensions/agents/.gitkeep +0 -0
  3. forge/_extensions/commands/.gitkeep +0 -0
  4. forge/_extensions/skills/analyze/SKILL.md +87 -0
  5. forge/_extensions/skills/challenge/SKILL.md +91 -0
  6. forge/_extensions/skills/consensus/SKILL.md +120 -0
  7. forge/_extensions/skills/consensus/resources/code_consensus_evaluation.md +94 -0
  8. forge/_extensions/skills/consensus/resources/consensus_evaluation.md +70 -0
  9. forge/_extensions/skills/consensus/resources/synthesis.md +101 -0
  10. forge/_extensions/skills/debate/SKILL.md +116 -0
  11. forge/_extensions/skills/debate/resources/code_debate_evaluation.md +101 -0
  12. forge/_extensions/skills/debate/resources/debate_evaluation.md +90 -0
  13. forge/_extensions/skills/panel/SKILL.md +141 -0
  14. forge/_extensions/skills/panel/resources/synthesis.md +103 -0
  15. forge/_extensions/skills/qa/SKILL.md +704 -0
  16. forge/_extensions/skills/qa/resources/checklist/0-enable.md +78 -0
  17. forge/_extensions/skills/qa/resources/checklist/1-preflight.md +24 -0
  18. forge/_extensions/skills/qa/resources/checklist/10-resume.md +143 -0
  19. forge/_extensions/skills/qa/resources/checklist/11-config.md +150 -0
  20. forge/_extensions/skills/qa/resources/checklist/12-search.md +58 -0
  21. forge/_extensions/skills/qa/resources/checklist/13-guard.md +237 -0
  22. forge/_extensions/skills/qa/resources/checklist/14-workflow.md +305 -0
  23. forge/_extensions/skills/qa/resources/checklist/15-skills.md +155 -0
  24. forge/_extensions/skills/qa/resources/checklist/16-handoff.md +224 -0
  25. forge/_extensions/skills/qa/resources/checklist/17-info.md +50 -0
  26. forge/_extensions/skills/qa/resources/checklist/18-disable.md +84 -0
  27. forge/_extensions/skills/qa/resources/checklist/19-uninstall.md +146 -0
  28. forge/_extensions/skills/qa/resources/checklist/2-extensions.md +188 -0
  29. forge/_extensions/skills/qa/resources/checklist/20-cleanup.md +36 -0
  30. forge/_extensions/skills/qa/resources/checklist/3-auth.md +234 -0
  31. forge/_extensions/skills/qa/resources/checklist/4-proxy.md +481 -0
  32. forge/_extensions/skills/qa/resources/checklist/5-session.md +541 -0
  33. forge/_extensions/skills/qa/resources/checklist/6-hooks.md +275 -0
  34. forge/_extensions/skills/qa/resources/checklist/7-costs.md +309 -0
  35. forge/_extensions/skills/qa/resources/checklist/8-status-line.md +174 -0
  36. forge/_extensions/skills/qa/resources/checklist/9-direct-commands.md +146 -0
  37. forge/_extensions/skills/qa/resources/checklist.md +103 -0
  38. forge/_extensions/skills/qa/resources/report-template.md +62 -0
  39. forge/_extensions/skills/qa/scripts/start-container.sh +529 -0
  40. forge/_extensions/skills/qa/scripts/walkthrough-state.py +1137 -0
  41. forge/_extensions/skills/review/SKILL.md +125 -0
  42. forge/_extensions/skills/review/references/claude-4.6.md +474 -0
  43. forge/_extensions/skills/review/references/claude-4.7.md +710 -0
  44. forge/_extensions/skills/review/references/gemini-3.1.md +546 -0
  45. forge/_extensions/skills/review/references/gpt-5.5.md +490 -0
  46. forge/_extensions/skills/review/references/skills-writing-guide.md +1588 -0
  47. forge/_extensions/skills/review/resources/code-anthropic.md +160 -0
  48. forge/_extensions/skills/review/resources/code-gemini.md +184 -0
  49. forge/_extensions/skills/review/resources/code-openai.md +203 -0
  50. forge/_extensions/skills/review/resources/code.md +160 -0
  51. forge/_extensions/skills/review-docs/SKILL.md +121 -0
  52. forge/_extensions/skills/review-docs/resources/docs-anthropic.md +170 -0
  53. forge/_extensions/skills/review-docs/resources/docs-gemini.md +204 -0
  54. forge/_extensions/skills/review-docs/resources/docs-openai.md +231 -0
  55. forge/_extensions/skills/review-docs/resources/docs.md +170 -0
  56. forge/_extensions/skills/smoke-test/SKILL.md +27 -0
  57. forge/_extensions/skills/smoke-test/scripts/smoke-test.sh +118 -0
  58. forge/_extensions/skills/understand/SKILL.md +148 -0
  59. forge/_extensions/skills/understand/resources/code-anthropic.md +163 -0
  60. forge/_extensions/skills/understand/resources/code-gemini.md +194 -0
  61. forge/_extensions/skills/understand/resources/code-openai.md +181 -0
  62. forge/_extensions/skills/understand/resources/code.md +163 -0
  63. forge/_extensions/skills/understand/resources/docs-anthropic.md +177 -0
  64. forge/_extensions/skills/understand/resources/docs-gemini.md +202 -0
  65. forge/_extensions/skills/understand/resources/docs-openai.md +191 -0
  66. forge/_extensions/skills/understand/resources/docs.md +177 -0
  67. forge/_extensions/skills/walkthrough/SKILL.md +599 -0
  68. forge/_extensions/skills/walkthrough/resources/checklist.md +765 -0
  69. forge/_extensions/skills/walkthrough/scripts/run-in-repo.sh +118 -0
  70. forge/_extensions/skills/walkthrough/scripts/setup-test-repo.sh +198 -0
  71. forge/_extensions/skills/walkthrough/scripts/walkthrough-state.py +1137 -0
  72. forge/backend/__init__.py +174 -0
  73. forge/backend/adapters/__init__.py +38 -0
  74. forge/backend/adapters/litellm.py +158 -0
  75. forge/backend/creation.py +89 -0
  76. forge/backend/registry.py +178 -0
  77. forge/cli/__init__.py +16 -0
  78. forge/cli/auth.py +483 -0
  79. forge/cli/backend.py +298 -0
  80. forge/cli/claude.py +411 -0
  81. forge/cli/config_cmd.py +303 -0
  82. forge/cli/extensions.py +1001 -0
  83. forge/cli/gc.py +165 -0
  84. forge/cli/guard.py +1018 -0
  85. forge/cli/guards.py +106 -0
  86. forge/cli/handoff.py +110 -0
  87. forge/cli/hooks/__init__.py +36 -0
  88. forge/cli/hooks/_group.py +20 -0
  89. forge/cli/hooks/_helpers.py +149 -0
  90. forge/cli/hooks/commands.py +1677 -0
  91. forge/cli/hooks/direct_commands.py +1304 -0
  92. forge/cli/hooks/install.py +232 -0
  93. forge/cli/hooks/policy.py +151 -0
  94. forge/cli/hooks/read_hygiene.py +74 -0
  95. forge/cli/hooks/verification.py +370 -0
  96. forge/cli/logs.py +406 -0
  97. forge/cli/main.py +292 -0
  98. forge/cli/proxy.py +1821 -0
  99. forge/cli/proxy_costs.py +313 -0
  100. forge/cli/search.py +416 -0
  101. forge/cli/session.py +892 -0
  102. forge/cli/session_addendum.py +81 -0
  103. forge/cli/session_fork.py +750 -0
  104. forge/cli/session_handoff.py +141 -0
  105. forge/cli/session_lifecycle.py +2053 -0
  106. forge/cli/session_manage.py +1336 -0
  107. forge/cli/session_memory.py +201 -0
  108. forge/cli/status_line.py +1398 -0
  109. forge/cli/workflow.py +1964 -0
  110. forge/config/__init__.py +110 -0
  111. forge/config/dataclass_utils.py +88 -0
  112. forge/config/defaults/__init__.py +0 -0
  113. forge/config/defaults/backends/__init__.py +0 -0
  114. forge/config/defaults/backends/litellm.yaml +196 -0
  115. forge/config/defaults/templates/__init__.py +0 -0
  116. forge/config/defaults/templates/litellm-anthropic-local.yaml +33 -0
  117. forge/config/defaults/templates/litellm-anthropic.yaml +24 -0
  118. forge/config/defaults/templates/litellm-gemini-flash-local.yaml +37 -0
  119. forge/config/defaults/templates/litellm-gemini-local.yaml +32 -0
  120. forge/config/defaults/templates/litellm-gemini-test.yaml +34 -0
  121. forge/config/defaults/templates/litellm-gemini.yaml +21 -0
  122. forge/config/defaults/templates/litellm-openai-codex-local.yaml +36 -0
  123. forge/config/defaults/templates/litellm-openai-local.yaml +38 -0
  124. forge/config/defaults/templates/litellm-openai.yaml +28 -0
  125. forge/config/defaults/templates/openrouter-anthropic.yaml +23 -0
  126. forge/config/defaults/templates/openrouter-deepseek.yaml +26 -0
  127. forge/config/defaults/templates/openrouter-gemini-flash.yaml +26 -0
  128. forge/config/defaults/templates/openrouter-gemini.yaml +23 -0
  129. forge/config/defaults/templates/openrouter-glm.yaml +23 -0
  130. forge/config/defaults/templates/openrouter-kimi.yaml +30 -0
  131. forge/config/defaults/templates/openrouter-minimax.yaml +26 -0
  132. forge/config/defaults/templates/openrouter-openai-codex.yaml +23 -0
  133. forge/config/defaults/templates/openrouter-openai.yaml +28 -0
  134. forge/config/defaults/templates/openrouter-qwen.yaml +25 -0
  135. forge/config/loader.py +675 -0
  136. forge/config/schema.py +448 -0
  137. forge/core/__init__.py +5 -0
  138. forge/core/auth/__init__.py +67 -0
  139. forge/core/auth/capabilities.py +219 -0
  140. forge/core/auth/credentials_file.py +244 -0
  141. forge/core/auth/protocols.py +18 -0
  142. forge/core/auth/secrets.py +243 -0
  143. forge/core/auth/template_secrets.py +112 -0
  144. forge/core/data/__init__.py +5 -0
  145. forge/core/data/model_catalog.yaml +1522 -0
  146. forge/core/data/pricing.yaml +140 -0
  147. forge/core/data/system_prompt_addendums/__init__.py +0 -0
  148. forge/core/data/system_prompt_addendums/gemini.md +330 -0
  149. forge/core/data/system_prompt_addendums/openai.md +328 -0
  150. forge/core/llm/__init__.py +231 -0
  151. forge/core/llm/clients/__init__.py +14 -0
  152. forge/core/llm/clients/base.py +115 -0
  153. forge/core/llm/clients/litellm.py +619 -0
  154. forge/core/llm/clients/openai_compat.py +244 -0
  155. forge/core/llm/clients/openrouter.py +234 -0
  156. forge/core/llm/credentials.py +439 -0
  157. forge/core/llm/detection.py +86 -0
  158. forge/core/llm/errors.py +44 -0
  159. forge/core/llm/protocols.py +80 -0
  160. forge/core/llm/types.py +176 -0
  161. forge/core/logging.py +146 -0
  162. forge/core/models/__init__.py +91 -0
  163. forge/core/models/catalog.py +467 -0
  164. forge/core/models/pricing.py +165 -0
  165. forge/core/models/types.py +167 -0
  166. forge/core/naming.py +212 -0
  167. forge/core/ops/__init__.py +73 -0
  168. forge/core/ops/context.py +141 -0
  169. forge/core/ops/gc.py +802 -0
  170. forge/core/ops/proxy.py +146 -0
  171. forge/core/ops/resolution.py +135 -0
  172. forge/core/ops/session.py +344 -0
  173. forge/core/ops/session_context.py +548 -0
  174. forge/core/paths.py +38 -0
  175. forge/core/process.py +54 -0
  176. forge/core/reactive/__init__.py +38 -0
  177. forge/core/reactive/cost_tracking.py +300 -0
  178. forge/core/reactive/env.py +180 -0
  179. forge/core/reactive/proxy.py +78 -0
  180. forge/core/reactive/routing.py +622 -0
  181. forge/core/reactive/session_runner.py +185 -0
  182. forge/core/reactive/structured_output.py +62 -0
  183. forge/core/reactive/tagger.py +94 -0
  184. forge/core/reactive/throttle.py +132 -0
  185. forge/core/state/__init__.py +59 -0
  186. forge/core/state/exceptions.py +59 -0
  187. forge/core/state/io.py +140 -0
  188. forge/core/state/lock.py +99 -0
  189. forge/core/state/timestamps.py +60 -0
  190. forge/core/transcript.py +78 -0
  191. forge/core/typing_helpers.py +24 -0
  192. forge/core/workqueue/__init__.py +67 -0
  193. forge/core/workqueue/queue.py +552 -0
  194. forge/core/workqueue/types.py +63 -0
  195. forge/guard/__init__.py +26 -0
  196. forge/guard/deterministic/__init__.py +26 -0
  197. forge/guard/deterministic/base.py +158 -0
  198. forge/guard/deterministic/coding_standards.py +256 -0
  199. forge/guard/deterministic/registry.py +148 -0
  200. forge/guard/deterministic/tdd.py +171 -0
  201. forge/guard/engine.py +216 -0
  202. forge/guard/protocols.py +91 -0
  203. forge/guard/queries.py +96 -0
  204. forge/guard/semantic/__init__.py +34 -0
  205. forge/guard/semantic/promotion.py +18 -0
  206. forge/guard/semantic/supervisor.py +813 -0
  207. forge/guard/semantic/verdict.py +183 -0
  208. forge/guard/store.py +124 -0
  209. forge/guard/team/__init__.py +6 -0
  210. forge/guard/team/config.py +24 -0
  211. forge/guard/team/handlers.py +209 -0
  212. forge/guard/team/prompts.py +41 -0
  213. forge/guard/types.py +125 -0
  214. forge/guard/workflow/__init__.py +17 -0
  215. forge/guard/workflow/branches.py +67 -0
  216. forge/guard/workflow/config.py +63 -0
  217. forge/guard/workflow/divergence.py +113 -0
  218. forge/guard/workflow/policy.py +87 -0
  219. forge/guard/workflow/stages.py +205 -0
  220. forge/install/__init__.py +55 -0
  221. forge/install/cli.py +281 -0
  222. forge/install/exceptions.py +163 -0
  223. forge/install/hooks.py +109 -0
  224. forge/install/installer.py +1037 -0
  225. forge/install/models.py +321 -0
  226. forge/install/preset.py +272 -0
  227. forge/install/settings_merge.py +831 -0
  228. forge/install/tracking.py +238 -0
  229. forge/install/version.py +141 -0
  230. forge/proxy/__init__.py +0 -0
  231. forge/proxy/base_client.py +181 -0
  232. forge/proxy/client_adapter.py +476 -0
  233. forge/proxy/client_factory.py +531 -0
  234. forge/proxy/converters.py +1206 -0
  235. forge/proxy/cost_logger.py +132 -0
  236. forge/proxy/cost_tracker.py +242 -0
  237. forge/proxy/data_models.py +338 -0
  238. forge/proxy/error_hints.py +92 -0
  239. forge/proxy/metrics.py +222 -0
  240. forge/proxy/model_spec.py +158 -0
  241. forge/proxy/proxies.py +333 -0
  242. forge/proxy/proxy_identity.py +134 -0
  243. forge/proxy/proxy_orchestrator.py +1018 -0
  244. forge/proxy/proxy_startup.py +54 -0
  245. forge/proxy/server.py +1561 -0
  246. forge/proxy/utils.py +537 -0
  247. forge/review/__init__.py +6 -0
  248. forge/review/adversarial.py +111 -0
  249. forge/review/consensus.py +236 -0
  250. forge/review/engine.py +356 -0
  251. forge/review/models.py +437 -0
  252. forge/review/resources/__init__.py +5 -0
  253. forge/review/resources/codereview-performance.md +85 -0
  254. forge/review/resources/codereview-quick.md +75 -0
  255. forge/review/resources/codereview-security.md +92 -0
  256. forge/review/resources/codereview.md +85 -0
  257. forge/review/resources/docreview-quick.md +75 -0
  258. forge/review/resources/docreview.md +86 -0
  259. forge/review/resources/thinkdeep.md +89 -0
  260. forge/review/routing.py +368 -0
  261. forge/review/synthesis.py +73 -0
  262. forge/runtime_config.py +438 -0
  263. forge/search/__init__.py +55 -0
  264. forge/search/bm25_store.py +264 -0
  265. forge/search/content_store.py +197 -0
  266. forge/search/engine.py +352 -0
  267. forge/search/exceptions.py +51 -0
  268. forge/search/extractor.py +234 -0
  269. forge/search/index_state.py +295 -0
  270. forge/search/store.py +215 -0
  271. forge/search/tokenizer.py +24 -0
  272. forge/session/__init__.py +130 -0
  273. forge/session/active.py +339 -0
  274. forge/session/artifacts.py +202 -0
  275. forge/session/claude/__init__.py +50 -0
  276. forge/session/claude/cleanup.py +105 -0
  277. forge/session/claude/invoke.py +236 -0
  278. forge/session/claude/paths.py +200 -0
  279. forge/session/cleanup.py +216 -0
  280. forge/session/config.py +34 -0
  281. forge/session/direct_model.py +107 -0
  282. forge/session/effective.py +169 -0
  283. forge/session/exceptions.py +255 -0
  284. forge/session/handoff.py +881 -0
  285. forge/session/handoff_agent.py +544 -0
  286. forge/session/hooks/__init__.py +35 -0
  287. forge/session/hooks/models.py +73 -0
  288. forge/session/hooks/session_start.py +507 -0
  289. forge/session/identity.py +84 -0
  290. forge/session/index.py +553 -0
  291. forge/session/manager.py +1506 -0
  292. forge/session/models.py +572 -0
  293. forge/session/overrides.py +344 -0
  294. forge/session/plan_resolution.py +286 -0
  295. forge/session/prev_sessions.py +128 -0
  296. forge/session/store.py +431 -0
  297. forge/session/validation.py +47 -0
  298. forge/session/worktree/__init__.py +65 -0
  299. forge/session/worktree/cleanup.py +262 -0
  300. forge/session/worktree/config_copy.py +203 -0
  301. forge/session/worktree/create.py +332 -0
  302. forge/sidecar/__init__.py +29 -0
  303. forge/sidecar/container.py +161 -0
  304. forge/sidecar/docker.py +86 -0
  305. forge/sidecar/secrets.py +19 -0
  306. multi_forge-0.2.0.dist-info/METADATA +242 -0
  307. multi_forge-0.2.0.dist-info/RECORD +311 -0
  308. multi_forge-0.2.0.dist-info/WHEEL +4 -0
  309. multi_forge-0.2.0.dist-info/entry_points.txt +2 -0
  310. multi_forge-0.2.0.dist-info/licenses/LICENSE +203 -0
  311. multi_forge-0.2.0.dist-info/licenses/NOTICE +14 -0
@@ -0,0 +1,121 @@
1
+ ---
2
+ name: forge:review-docs
3
+ description: Review design documents, specs, and technical writing for completeness and consistency.
4
+ disable-model-invocation: false
5
+ argument-hint: '[target: path or instruction] [--output path]'
6
+ allowed-tools: Read, Grep, Glob, Bash, Agent
7
+ ---
8
+
9
+ # Document Review
10
+
11
+ Review design documents, specs, and technical writing for completeness, consistency, clarity, and implementability.
12
+
13
+ ## Usage
14
+
15
+ ```
16
+ /forge:review-docs [target]
17
+ ```
18
+
19
+ ## Arguments
20
+
21
+ | Argument | Required | Description |
22
+ | ---------- | -------- | ------------------------------------------------------------------- |
23
+ | `target` | Optional | File, directory, or instruction on what to review (defaults to cwd) |
24
+ | `--output` | Optional | Write result to file instead of conversation (e.g., `review.md`) |
25
+
26
+ ## Execution
27
+
28
+ Follow these steps in order. Do not skip steps.
29
+
30
+ ### Step 1: Resolve Target
31
+
32
+ `$ARGUMENTS` is the target. It may be a file path, directory, or free-form instruction. If it starts with `@`, strip the
33
+ prefix (Claude Code file reference syntax). If `$ARGUMENTS` is empty, default to the current working directory.
34
+
35
+ Recognized flags (extract from `$ARGUMENTS` if present):
36
+
37
+ - `--output <path>` — write result to file instead of conversation
38
+
39
+ Never ask the user to clarify. If `$ARGUMENTS` contains anything, proceed immediately.
40
+
41
+ ### Step 2: Load Instruction File
42
+
43
+ **Do NOT start the review until this step is complete.**
44
+
45
+ Model family: !`forge session context --field model_family 2>/dev/null || true` Main model:
46
+ !`forge session context --field main_model 2>/dev/null || true`
47
+
48
+ Resolve session context from `$FORGE_SESSION` or the local environment. Do not force `$CLAUDE_SESSION_ID`: unmanaged
49
+ direct Claude sessions are not in Forge's session index, but may still expose direct-model environment metadata.
50
+
51
+ Pick **one** instruction file (first match wins, read only one):
52
+
53
+ 1. If model family is `openai` or `gemini`: `${CLAUDE_SKILL_DIR}/resources/docs-{family}.md`
54
+ 2. Otherwise: `${CLAUDE_SKILL_DIR}/resources/docs.md`
55
+
56
+ If model family lookup returns empty output, `anthropic`, or errors, treat it as the default family and immediately
57
+ select `${CLAUDE_SKILL_DIR}/resources/docs.md`. Do not probe multiple variants.
58
+
59
+ ### Tool-call hygiene (normative)
60
+
61
+ When reading the selected instruction file, call `Read` with exactly one argument:
62
+
63
+ ```json
64
+ {"file_path":"/absolute/path/to/instruction-file.md"}
65
+ ```
66
+
67
+ Rules:
68
+
69
+ - Do NOT send empty-string values for optional fields
70
+ - Do NOT include assistant-generated commentary or repair text in tool arguments
71
+
72
+ A PreToolUse hook may strip extra Read parameters (`offset`, `limit`, `pages`) for skill instruction files, but callers
73
+ must still send `Read` with only `file_path`.
74
+
75
+ Read that one file using the Read tool with just the file_path parameter. Do not read both. If the chosen file is
76
+ missing, report the path and stop.
77
+
78
+ **After loading, tell the user in one message:**
79
+
80
+ ```
81
+ Reviewing {target} in docs mode.
82
+ model_family: {family or "anthropic"}
83
+ model: {main_model or "Claude Code default (exact model not exposed to Forge)"}
84
+ instruction: {instruction_file_name}
85
+ ```
86
+
87
+ Do not read target files or begin review until after you have:
88
+
89
+ 1. Resolved the target
90
+ 2. Resolved the instruction file
91
+ 3. Emitted the preflight summary message
92
+
93
+ ### Step 3: Execute Review
94
+
95
+ If the selected instruction file refers to an Explore subagent, use the `Agent` tool with `subagent_type: "Explore"`. Do
96
+ not interpret `Task` in resource files as a separate tool.
97
+
98
+ If the selected instruction file mentions disallowed or unavailable tools, stop and report the mismatch instead of
99
+ substituting another tool.
100
+
101
+ Execute the review following the loaded instructions. The instruction file defines the rubric, structure, and output
102
+ format. Do not invent your own review format -- follow what the instruction file says.
103
+
104
+ Do not call `mcp__zen__*` tools from this skill.
105
+
106
+ When a resource file contains tool guidance that conflicts with this SKILL.md file, this SKILL.md file wins. Do not
107
+ improvise around the conflict.
108
+
109
+ **Output routing:** If `--output` was specified, write the complete review to that path using the Write tool (create
110
+ parent directories if needed). Print a one-line confirmation: `Wrote review to {path}`. Do not also print the full
111
+ result in the conversation. If `--output` was not specified, print the result in the conversation as usual.
112
+
113
+ ## Multi-Model Mode (optional)
114
+
115
+ For a multi-model perspective, use `forge workflow panel` to get independent document reviews from multiple backends:
116
+
117
+ ```bash
118
+ forge workflow panel [target] --json
119
+ ```
120
+
121
+ Or invoke `/forge:panel` for the full multi-model document review workflow.
@@ -0,0 +1,170 @@
1
+ # Design Document Review (Opus-Optimized)
2
+
3
+ Review the design document for completeness, consistency, and implementability.
4
+
5
+ ```xml
6
+ <role>
7
+ You are a senior technical architect reviewing design documents.
8
+ You identify gaps before engineers start building.
9
+ You focus on "Can this be implemented unambiguously?" as the key question.
10
+ </role>
11
+
12
+ <behavior>
13
+ - Follow instructions precisely
14
+ - Gather context before reviewing
15
+ - Cite specific section references for all issues
16
+ - Distinguish ambiguity vs incompleteness vs contradiction
17
+ </behavior>
18
+
19
+ <scope_constraints>
20
+ - Review only documents directly relevant to the target
21
+ - Do not expand to unrelated documents
22
+ - Note unresolved references and proceed—do not fabricate missing content
23
+ - Choose the simplest interpretation when ambiguous
24
+ </scope_constraints>
25
+ ```
26
+
27
+ ---
28
+
29
+ ## Phase 1: Exploration
30
+
31
+ Gather context before reviewing. Use the Explore agent to build understanding efficiently.
32
+
33
+ ```
34
+ Tool: Agent
35
+ Parameters:
36
+ subagent_type: "Explore"
37
+ description: "Explore design docs and related code"
38
+ prompt: |
39
+ Find and analyze:
40
+ 1. Design documents: docs/**/*.md, **/design.md, **/architecture.md, **/ADR*.md
41
+ 2. Existing implementation: grep for key abstractions, glob for component names
42
+ 3. Cross-references: parse for links to other docs, resolve references
43
+
44
+ Return: List of relevant files with brief descriptions of their content.
45
+ ```
46
+
47
+ ---
48
+
49
+ ## Phase 2: Cross-Reference Analysis
50
+
51
+ Map the design's relationships.
52
+
53
+ ```xml
54
+ <mapping_process>
55
+ Determine:
56
+ 1. What other docs reference this design?
57
+ 2. What does this design reference?
58
+ 3. Is there existing code that should conform?
59
+ 4. Are there conflicting designs for the same area?
60
+
61
+ IF referenced_doc_missing:
62
+ Note "Referenced document not found: [name]"
63
+ Continue with available content
64
+ </mapping_process>
65
+ ```
66
+
67
+ ---
68
+
69
+ ## Phase 3: Review
70
+
71
+ ```xml
72
+ <review_framework>
73
+ <completeness>
74
+ - Are all referenced components defined?
75
+ - Do abstractions have clear boundaries?
76
+ - Are edge cases and errors specified?
77
+ - Are happy AND failure paths documented?
78
+ - Do APIs have complete I/O/error specs?
79
+ </completeness>
80
+
81
+ <consistency>
82
+ - Same terms for same concepts throughout?
83
+ - Data types consistent across components?
84
+ - Do invariants hold everywhere referenced?
85
+ - Any contradictory requirements?
86
+ </consistency>
87
+
88
+ <clarity>
89
+ - Can each requirement be interpreted one way?
90
+ - Are conditional behaviors explicit?
91
+ - Are quantities specific (not "fast", "large")?
92
+ - Would two engineers implement identically?
93
+ </clarity>
94
+
95
+ <implementability>
96
+ - Can components be built independently?
97
+ - Are dependencies explicit?
98
+ - Any circular dependencies?
99
+ - Is implementation order clear?
100
+ </implementability>
101
+ </review_framework>
102
+
103
+ <issue_classification>
104
+ - CONTRADICTION: Two sections conflict (cite both)
105
+ - INCOMPLETE: Required information missing
106
+ - AMBIGUOUS: Multiple valid interpretations
107
+ - UNDEFINED_REFERENCE: Uses undefined concept
108
+ - CIRCULAR_DEPENDENCY: A needs B needs A
109
+ - IMPLICIT_ASSUMPTION: Assumes unstated thing
110
+ </issue_classification>
111
+
112
+ <verification>
113
+ Before finalizing:
114
+ - Verify each contradiction cites both conflicting sections
115
+ - Ensure ambiguity vs incompleteness vs contradiction are correctly distinguished
116
+ - Confirm no scope creep beyond target documents
117
+ </verification>
118
+ ```
119
+
120
+ ---
121
+
122
+ ## Output
123
+
124
+ ```xml
125
+ <output_format>
126
+ Structure findings as:
127
+
128
+ ## Document Structure
129
+ Brief overview (2-3 sentences)
130
+
131
+ ## Key Abstractions
132
+ - Main components defined (bullet list)
133
+
134
+ ## Completeness Assessment
135
+ | Component | Status | Notes |
136
+ |-----------|--------|-------|
137
+
138
+ ## Contradictions
139
+ | Severity | Issue | Section A | Section B |
140
+ |----------|-------|-----------|-----------|
141
+
142
+ ## Ambiguities
143
+ - Issues with multiple interpretations (bullet list with section refs)
144
+
145
+ ## Missing Specifications
146
+ - Gaps an implementer would need filled (bullet list)
147
+
148
+ ## Dependency Issues
149
+ - Circular deps, undefined refs (bullet list)
150
+
151
+ ## Implementer Questions
152
+ 1. [Question] (blocks: [component])
153
+
154
+ ## Existing Implementation
155
+ - What's already built (from exploration)
156
+
157
+ ## Recommendations
158
+ Prioritized fixes (numbered list, max 5)
159
+
160
+ ## Strengths
161
+ Well-specified areas to preserve (bullet list)
162
+ </output_format>
163
+
164
+ <output_constraints>
165
+ - Each issue: 1-2 sentences with specific section references
166
+ - Use tables for structured data
167
+ - No lengthy narratives
168
+ - Do not restate the review request
169
+ </output_constraints>
170
+ ```
@@ -0,0 +1,204 @@
1
+ # Gemini 3.1 Design Document Review
2
+
3
+ Review the design document for completeness, consistency, and implementability.
4
+
5
+ Execute a thorough design review according to the following multi-phase process.
6
+
7
+ ```xml
8
+ <role>
9
+ You are a senior technical architect reviewing design documents.
10
+ You are precise, thorough, and focused on implementability.
11
+ You identify gaps before engineers start building.
12
+ </role>
13
+
14
+ <behavior>
15
+ - Cite specific section references for all issues
16
+ - Distinguish ambiguity vs incompleteness vs contradiction
17
+ - Review the full document set in scope before reporting
18
+ - Stay in the document-review lane
19
+ </behavior>
20
+
21
+ <scope_constraints>
22
+ - Review only documents directly relevant to the target
23
+ - Resolve or flag references as far as evidence allows
24
+ - Do not fabricate missing content
25
+ - Prefer the simplest valid interpretation when ambiguous
26
+ </scope_constraints>
27
+ ```
28
+
29
+ ---
30
+
31
+ ## Phase 1: Exploration
32
+
33
+ **Subagent invocation:**
34
+
35
+ ```
36
+ Tool: Agent
37
+ Parameters:
38
+ subagent_type: "Explore"
39
+ description: "Explore design docs and related code"
40
+ prompt: |
41
+ Find and analyze:
42
+ 1. Design documents: docs/**/*.md, **/design.md, **/architecture.md, **/ADR*.md
43
+ 2. Existing implementation: grep for key abstractions, glob for component names
44
+ 3. Cross-references: parse for links to other docs, resolve references
45
+
46
+ Return: List of relevant files with brief descriptions of their content.
47
+ ```
48
+
49
+ ---
50
+
51
+ ## Phase 2: Cross-Reference Analysis
52
+
53
+ Build understanding of design in context:
54
+
55
+ 1. What other docs reference this design?
56
+ 2. What does this design reference?
57
+ 3. Is there existing code that should conform to this?
58
+ 4. Are there conflicting designs for the same area?
59
+
60
+ ---
61
+
62
+ ## Phase 3: Review
63
+
64
+ ```xml
65
+ <review_framework>
66
+ <completeness>
67
+ - Are all referenced components defined?
68
+ - Do abstractions have clear boundaries?
69
+ - Are edge cases and errors specified?
70
+ - Is happy path AND failure path documented?
71
+ - Are all state transitions enumerated?
72
+ - Do APIs have complete I/O/error specs?
73
+ </completeness>
74
+
75
+ <consistency>
76
+ - Same terms for same concepts throughout?
77
+ - Data types consistent across components?
78
+ - Invariants hold in all referenced places?
79
+ - Contradictory requirements between sections?
80
+ - Glossary matches actual usage?
81
+ </consistency>
82
+
83
+ <clarity>
84
+ - Can each requirement be interpreted ONE way?
85
+ - Conditional behaviors explicit (if X then Y)?
86
+ - Quantities specific (not "fast", "large")?
87
+ - Responsibilities unambiguous (who does what)?
88
+ - Would two engineers implement identically?
89
+ </clarity>
90
+
91
+ <implementability>
92
+ - Can each component be built independently?
93
+ - Dependencies between components explicit?
94
+ - Any circular dependencies?
95
+ - Order of implementation clear?
96
+ - External dependencies stated?
97
+ </implementability>
98
+
99
+ <gap_analysis>
100
+ - What questions would implementer ask?
101
+ - What decisions deferred without markers?
102
+ - What edge cases not addressed?
103
+ - What failure modes not specified?
104
+ </gap_analysis>
105
+ </review_framework>
106
+
107
+ <issue_classification>
108
+ - CONTRADICTION: Two parts conflict (cite both sections)
109
+ - INCOMPLETE: Required info missing
110
+ - AMBIGUOUS: Multiple valid interpretations
111
+ - UNDEFINED_REFERENCE: Uses undefined concept
112
+ - CIRCULAR_DEPENDENCY: A needs B needs A
113
+ - IMPLICIT_ASSUMPTION: Assumes unstated thing
114
+ </issue_classification>
115
+
116
+ <error_handling>
117
+ IF design document empty or unreadable:
118
+ State "Document could not be analyzed"
119
+ Explain why
120
+ IF referenced documents missing:
121
+ Note which references could not be resolved
122
+ Continue with available content, flagging gaps
123
+ </error_handling>
124
+
125
+ <output_contract>
126
+ Task is complete when:
127
+ - all sections in scope are analyzed
128
+ - cross-references are traced or explicitly flagged unresolved
129
+ - contradictions cite both conflicting sections
130
+ - findings are deduplicated across categories
131
+ - implementer questions reflect real blockers to execution
132
+ </output_contract>
133
+
134
+ <verification>
135
+ Before finalizing:
136
+ - Verify issue classification is correct
137
+ - Verify contradictions cite both sections
138
+ - Verify no missing content was invented
139
+ - Verify no implementation proposals are included unless explicitly requested
140
+ </verification>
141
+ ```
142
+
143
+ ---
144
+
145
+ ## Output
146
+
147
+ Structure findings as:
148
+
149
+ ```markdown
150
+ ## Document Structure
151
+ Overview of design doc organization
152
+
153
+ ## Key Abstractions
154
+ Main components/concepts defined
155
+
156
+ ## Completeness Assessment
157
+ | Component | Status | Notes |
158
+ |-----------|--------|-------|
159
+ | Auth module | Fully specified | |
160
+ | Cache layer | Partial | Missing eviction policy |
161
+ | API routes | Missing | Referenced but not defined |
162
+
163
+ ## Contradictions
164
+ | Severity | Issue | Section A | Section B |
165
+ |----------|-------|-----------|-----------|
166
+ | CRITICAL | "Immutable" vs "can update" | §5.2 | §7.1 |
167
+
168
+ ## Ambiguities
169
+ Issues that could be interpreted multiple ways
170
+
171
+ ## Missing Specifications
172
+ Gaps an implementer would need filled
173
+
174
+ ## Dependency Issues
175
+ Circular deps, undefined refs, ordering problems
176
+
177
+ ## Implementer Questions
178
+ Questions the design doesn't answer
179
+
180
+ ## Existing Implementation Status
181
+ What's already built (from exploration)
182
+
183
+ ## Recommendations
184
+ Prioritized fixes to improve the design
185
+
186
+ ## Strengths
187
+ Well-specified areas to preserve
188
+ ```
189
+
190
+ ```xml
191
+ <output_constraints>
192
+ - Be concise and structured
193
+ - Do not restate the review request
194
+ - Keep recommendations in the design-document lane: clarify, define, specify, resolve, document
195
+ - Use tables where they improve scanability
196
+ </output_constraints>
197
+
198
+ <stop_conditions>
199
+ - All sections in scope analyzed
200
+ - All cross-references traced or flagged
201
+ - Do not speculate on implementation
202
+ - Do not suggest implementation approaches
203
+ </stop_conditions>
204
+ ```