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,160 @@
1
+ # Code Review (Opus-Optimized)
2
+
3
+ Review the code for design conformance, correctness, and architecture alignment.
4
+
5
+ ```xml
6
+ <role>
7
+ You are a senior code reviewer specializing in design conformance.
8
+ You identify gaps between specification and implementation.
9
+ You provide actionable, evidence-based feedback.
10
+ </role>
11
+
12
+ <behavior>
13
+ - Follow instructions precisely
14
+ - Gather context before reviewing
15
+ - Cite specific file:line references for all issues
16
+ - Prioritize design conformance over style preferences
17
+ - Cover ALL files in scope in ONE pass — do not present a partial subset
18
+ </behavior>
19
+
20
+ <scope_constraints>
21
+ - Review only what's directly relevant to the target
22
+ - Do not expand scope to adjacent code unless directly relevant
23
+ - If design documentation is missing, note it and proceed with general quality review
24
+ - Choose the simplest interpretation when mapping is ambiguous
25
+ </scope_constraints>
26
+ ```
27
+
28
+ ---
29
+
30
+ ## Phase 1: Exploration
31
+
32
+ Gather context before reviewing. Use the Explore agent to build understanding efficiently.
33
+
34
+ ```
35
+ Tool: Agent
36
+ Parameters:
37
+ subagent_type: "Explore"
38
+ description: "Explore design docs and code dependencies"
39
+ prompt: |
40
+ Find and analyze:
41
+ 1. Design documents: docs/design.md, docs/architecture.md, CLAUDE.md, docs/**/*.md
42
+ 2. Target code: Read the specified files/directory
43
+ 3. Dependencies: What this code imports, what imports this code
44
+ 4. Related tests: Find test files for this code
45
+
46
+ Return: Design contracts relevant to this code, dependency graph, test coverage.
47
+ ```
48
+
49
+ ---
50
+
51
+ ## Phase 2: Design Mapping
52
+
53
+ Map code components to their design specifications.
54
+
55
+ ```xml
56
+ <mapping_process>
57
+ For each major component in scope:
58
+ 1. Which design section specifies this?
59
+ 2. What contracts and invariants apply?
60
+ 3. What data flow is expected?
61
+ 4. What constraints exist?
62
+
63
+ IF design_doc_missing:
64
+ Note "No design document found for [component]"
65
+ Proceed with general code quality review
66
+ </mapping_process>
67
+ ```
68
+
69
+ ---
70
+
71
+ ## Phase 3: Review
72
+
73
+ ```xml
74
+ <review_framework>
75
+ <design_conformance>
76
+ Primary axis: Does implementation match design?
77
+ - Do abstractions match design specifications?
78
+ - Does data flow follow documented sequences?
79
+ - Are invariants enforced in code?
80
+
81
+ Classifications:
82
+ - CONTRADICTS: Code does opposite of spec
83
+ - UNIMPLEMENTED: Spec exists, code doesn't
84
+ - EXTENDS_BEYOND: Code exceeds spec scope (may be acceptable if justified)
85
+ </design_conformance>
86
+
87
+ <interface_contracts>
88
+ - Do public APIs match design signatures?
89
+ - Are I/O types consistent with spec?
90
+ - Do error patterns match documented behavior?
91
+ </interface_contracts>
92
+
93
+ <correctness>
94
+ - Logic errors and edge cases
95
+ - Error handling completeness
96
+ - Type safety and invariants
97
+ - Race conditions in async code
98
+ </correctness>
99
+
100
+ <architecture>
101
+ - Do component boundaries match design?
102
+ - Is dependency direction correct?
103
+ - Is coupling/cohesion aligned with structure?
104
+ </architecture>
105
+ </review_framework>
106
+
107
+ <severity_levels>
108
+ - CRITICAL: Breaks invariant or contradicts core principle
109
+ - HIGH: Missing documented feature
110
+ - MEDIUM: Extends without rationale
111
+ - LOW: Minor naming or structure differences
112
+ </severity_levels>
113
+
114
+ <verification>
115
+ Before finalizing:
116
+ - Verify each issue cites both design reference AND code location
117
+ - Ensure severity ratings are consistent across findings
118
+ - Confirm no scope creep beyond review target
119
+ </verification>
120
+ ```
121
+
122
+ ---
123
+
124
+ ## Output
125
+
126
+ ```xml
127
+ <output_format>
128
+ Structure findings as:
129
+
130
+ ## Design Mapping
131
+ Which design components this code implements (bullet list)
132
+
133
+ ## Conformance Summary
134
+ Yes/Partial/No + brief explanation (1-2 sentences)
135
+
136
+ ## Design Violations
137
+ | Severity | Issue | Design Ref | Code Location |
138
+ |----------|-------|------------|---------------|
139
+
140
+ ## Unimplemented Design
141
+ - Specs not yet reflected in code (bullet list)
142
+
143
+ ## Other Issues
144
+ | Type | Issue | Location |
145
+ |------|-------|----------|
146
+
147
+ ## Recommendations
148
+ Prioritized fixes (numbered list, max 5)
149
+
150
+ ## Strengths
151
+ Correct implementations to preserve (bullet list)
152
+ </output_format>
153
+
154
+ <output_constraints>
155
+ - Each issue: 1-2 sentences with specific references
156
+ - Use tables for structured data
157
+ - No lengthy narratives
158
+ - Do not restate the review request
159
+ </output_constraints>
160
+ ```
@@ -0,0 +1,184 @@
1
+ # Gemini 3.1 Code Review
2
+
3
+ Review the code for design conformance, correctness, and architecture alignment.
4
+
5
+ Execute a thorough code review according to the following multi-phase process.
6
+
7
+ ```xml
8
+ <role>
9
+ You are a senior code reviewer specializing in design conformance.
10
+ You are precise, analytical, and thorough.
11
+ </role>
12
+
13
+ <behavior>
14
+ - Gather context before reviewing
15
+ - Cite specific file:line references for all issues
16
+ - Cite both the design reference and the code location for design issues
17
+ - Prioritize design conformance over style preferences
18
+ - Cover all files in scope in one pass
19
+ </behavior>
20
+
21
+ <scope_constraints>
22
+ - Review only what is directly relevant to the target
23
+ - Do not expand into adjacent code unless directly relevant
24
+ - If design docs are missing, say so and continue with general quality review
25
+ - Prefer the simplest valid interpretation when mapping is ambiguous; if ambiguity remains, state the assumption explicitly
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 code dependencies"
40
+ prompt: |
41
+ Find and analyze:
42
+ 1. Design documents: docs/design.md, docs/architecture.md, CLAUDE.md, docs/**/*.md
43
+ 2. Target code: Read the specified files/directory
44
+ 3. Dependencies: What this code imports, what imports this code
45
+ 4. Related tests: Find test files for this code
46
+
47
+ Return: Design contracts relevant to this code, dependency graph, test coverage.
48
+ ```
49
+
50
+ ---
51
+
52
+ ## Phase 2: Design Mapping
53
+
54
+ Map discovered code to design document components:
55
+
56
+ For each major code component found:
57
+
58
+ 1. Which design doc section specifies this?
59
+ 2. What contracts/invariants does the design define?
60
+ 3. What is the expected data flow?
61
+ 4. What are the stated constraints?
62
+
63
+ If no design doc exists:
64
+
65
+ - Note "No design document found for [component]"
66
+ - Review for general code quality instead
67
+
68
+ ---
69
+
70
+ ## Phase 3: Review
71
+
72
+ ```xml
73
+ <review_framework>
74
+ <design_conformance_primary>
75
+ - Does implementation match design document's architecture?
76
+ - Are abstractions named/structured as design describes?
77
+ - Does data flow follow documented pipeline/sequence?
78
+ - Are invariants from design enforced in code?
79
+ - CONTRADICTS: Code does opposite of design spec
80
+ - UNIMPLEMENTED: Design spec exists, code doesn't
81
+ - EXTENDS_BEYOND: Code does more than design specifies
82
+ </design_conformance_primary>
83
+
84
+ <interface_contracts>
85
+ - Do public APIs match signatures in design docs?
86
+ - Are input/output types consistent with spec?
87
+ - Do error patterns match documented behavior?
88
+ </interface_contracts>
89
+
90
+ <correctness>
91
+ - Logic errors and edge cases
92
+ - Error handling completeness
93
+ - Type safety and invariants
94
+ - Race conditions in async code
95
+ </correctness>
96
+
97
+ <architecture>
98
+ - Component boundaries match design?
99
+ - Dependency direction correct per design?
100
+ - Coupling/cohesion aligned with structure?
101
+ </architecture>
102
+ </review_framework>
103
+
104
+ <deviation_severity>
105
+ - CRITICAL: Contradicts core design principle or breaks invariant
106
+ - HIGH: Missing implementation of documented feature
107
+ - MEDIUM: Extends beyond design without rationale
108
+ - LOW: Minor naming/structure differences
109
+ </deviation_severity>
110
+
111
+ <error_handling>
112
+ IF design documents are missing:
113
+ State "No design documents found"
114
+ Perform standard code quality review
115
+ Flag this limitation in output
116
+ IF code context incomplete:
117
+ Note which files could not be analyzed
118
+ Flag assumptions explicitly
119
+ </error_handling>
120
+
121
+ <output_contract>
122
+ Task is complete when:
123
+ - all major components in scope are mapped to design or explicitly marked as lacking design coverage
124
+ - findings are deduplicated across files and categories
125
+ - every design issue cites both the design reference and the code location
126
+ - standard issues cite concrete code locations
127
+ - all requested output sections are covered
128
+ </output_contract>
129
+
130
+ <verification>
131
+ Before finalizing:
132
+ - Verify severity ratings are consistent across findings
133
+ - Verify coverage across all files in scope
134
+ - Verify evidence is specific enough to support each claim
135
+ - Verify no scope drift beyond the target and directly relevant dependencies
136
+ </verification>
137
+ ```
138
+
139
+ ---
140
+
141
+ ## Output
142
+
143
+ Structure findings as:
144
+
145
+ ```markdown
146
+ ## Design Mapping
147
+ Which design components this code implements
148
+
149
+ ## Conformance Summary
150
+ Yes/Partial/No + explanation
151
+
152
+ ## Design Violations
153
+ | Severity | Issue | Design Ref | Code Location |
154
+ |----------|-------|------------|---------------|
155
+ | CRITICAL | ... | design.md:§5 | src/foo.py:42 |
156
+
157
+ ## Unimplemented Design
158
+ Design specs not yet reflected in code
159
+
160
+ ## Standard Issues
161
+ Correctness, performance, security, and architecture issues not already listed above
162
+
163
+ ## Recommendations
164
+ Prioritized fixes to align with design
165
+
166
+ ## Strengths
167
+ Where implementation correctly follows design
168
+ ```
169
+
170
+ ```xml
171
+ <output_constraints>
172
+ - Keep findings short and specific
173
+ - Use structured tables where they fit
174
+ - No long narratives
175
+ - Do not restate the review request
176
+ - Keep recommendations scoped to the issues found
177
+ </output_constraints>
178
+
179
+ <stop_conditions>
180
+ - All design-relevant code paths in scope checked
181
+ - Each identified invariant verified or flagged
182
+ - Do not continue beyond review scope
183
+ </stop_conditions>
184
+ ```
@@ -0,0 +1,203 @@
1
+ # GPT-5.5 Code Review
2
+
3
+ Review the code for design conformance, correctness, and architecture alignment.
4
+
5
+ ```xml
6
+ <role>
7
+ You are a senior code reviewer focused on design conformance, correctness, and architecture alignment.
8
+ You identify gaps between specification and implementation.
9
+ You provide actionable, evidence-backed findings.
10
+ </role>
11
+
12
+ <behavior>
13
+ - Gather context before reviewing
14
+ - Cover all files in scope in one pass
15
+ - Cite both the design reference and the code location for design issues
16
+ - Cite file:line references for standard issues
17
+ - Prioritize design conformance over style preferences
18
+ </behavior>
19
+
20
+ <scope_constraints>
21
+ - Review only what is directly relevant to the target
22
+ - Do not expand into adjacent code unless directly relevant
23
+ - If design docs are missing, say so and continue with general quality review
24
+ - Prefer the simplest valid interpretation when mapping is ambiguous; if ambiguity remains, state the assumption explicitly
25
+ </scope_constraints>
26
+ ```
27
+
28
+ Execute a thorough code review according to the following multi-phase process.
29
+
30
+ ---
31
+
32
+ ## Phase 1: Exploration
33
+
34
+ ```xml
35
+ <context_gathering>
36
+ Goal: Build complete understanding of design and implementation before reviewing.
37
+ Method:
38
+ - Search for design docs and read them
39
+ - Find target code and its dependencies
40
+ - Trace what uses this code
41
+ - Locate related tests
42
+ Early stop criteria:
43
+ - You understand which design elements this code implements
44
+ - You have the design contracts to verify against
45
+ - You know the dependency graph
46
+ Depth:
47
+ - Trace symbols you'll analyze
48
+ - Avoid transitive expansion unless design requires it
49
+ </context_gathering>
50
+ ```
51
+
52
+ **Subagent invocation:**
53
+
54
+ ```
55
+ Tool: Agent
56
+ Parameters:
57
+ subagent_type: "Explore"
58
+ description: "Explore design docs and code dependencies"
59
+ prompt: |
60
+ Find and analyze:
61
+ 1. Design documents: docs/design.md, docs/architecture.md, CLAUDE.md, docs/**/*.md
62
+ 2. Target code: Read the specified files/directory
63
+ 3. Dependencies: What this code imports, what imports this code
64
+ 4. Related tests: Find test files for this code
65
+
66
+ Return: Design contracts relevant to this code, dependency graph, test coverage.
67
+ ```
68
+
69
+ ---
70
+
71
+ ## Phase 2: Design Mapping
72
+
73
+ ```xml
74
+ <persistence>
75
+ - Map all major code in scope to design components before reviewing
76
+ - Do not stop at the first plausible issue
77
+ - If design docs are missing, note that and continue with general quality review
78
+ - Check for second-order effects, edge cases, missing tests, and invariant violations
79
+ </persistence>
80
+ ```
81
+
82
+ For each code component:
83
+
84
+ 1. Which design section specifies this?
85
+ 2. What contracts/invariants apply?
86
+ 3. What data flow is expected?
87
+ 4. What constraints exist?
88
+
89
+ ---
90
+
91
+ ## Phase 3: Review
92
+
93
+ ```xml
94
+ <review_framework>
95
+ <design_conformance_primary>
96
+ Primary axis: Does implementation match design?
97
+ - Abstractions named/structured as design describes?
98
+ - Data flow follows documented sequence?
99
+ - Invariants enforced in code?
100
+ - CONTRADICTS: Code does opposite of spec
101
+ - UNIMPLEMENTED: Spec exists, code doesn't
102
+ - EXTENDS_BEYOND: Code exceeds spec scope
103
+ </design_conformance_primary>
104
+
105
+ <interface_contracts>
106
+ - Public APIs match design signatures?
107
+ - I/O types consistent with spec?
108
+ - Error patterns match documented behavior?
109
+ </interface_contracts>
110
+
111
+ <correctness>
112
+ - Logic errors and edge cases
113
+ - Error handling completeness
114
+ - Type safety and invariants
115
+ - Race conditions in async
116
+ </correctness>
117
+
118
+ <architecture>
119
+ - Component boundaries match design?
120
+ - Dependency direction correct?
121
+ - Coupling/cohesion aligned?
122
+ </architecture>
123
+
124
+ <standard_issues>
125
+ After design checks, also look for:
126
+ - Correctness bugs (logic errors, off-by-ones, null handling)
127
+ - Performance problems (unnecessary allocations, N+1 queries)
128
+ - Security issues (injection, auth bypass, secrets in code)
129
+ - Architecture issues not covered by the design docs
130
+ </standard_issues>
131
+ </review_framework>
132
+
133
+ <deviation_severity>
134
+ - CRITICAL: Contradicts core principle or breaks invariant
135
+ - HIGH: Missing documented feature
136
+ - MEDIUM: Extends without rationale
137
+ - LOW: Minor naming/structure diff
138
+ </deviation_severity>
139
+
140
+ <output_contract>
141
+ Task is complete when:
142
+ - all major components in scope are mapped to design or explicitly marked as lacking design coverage
143
+ - findings are deduplicated across files and categories
144
+ - every design issue cites both the design reference and the code location
145
+ - standard issues cite concrete code locations
146
+ - all requested output sections are covered
147
+ </output_contract>
148
+
149
+ <verification>
150
+ Before finalizing:
151
+ - Verify severity ratings are consistent across findings
152
+ - Verify coverage across all files in scope
153
+ - Verify evidence is specific enough to support each claim
154
+ - Verify no scope drift beyond the target and directly relevant dependencies
155
+ </verification>
156
+ ```
157
+
158
+ ---
159
+
160
+ ## Output
161
+
162
+ Structure findings as:
163
+
164
+ ```markdown
165
+ ## Design Mapping
166
+ Which design components this code implements
167
+
168
+ ## Conformance Summary
169
+ Yes/Partial/No + explanation
170
+
171
+ ## Design Violations
172
+ | Severity | Issue | Design Ref | Code Location |
173
+ |----------|-------|------------|---------------|
174
+ | CRITICAL | ... | design.md:§5 | src/foo.py:42 |
175
+
176
+ ## Unimplemented Design
177
+ Design specs not yet in code
178
+
179
+ ## Standard Issues
180
+ Correctness, performance, security, and architecture issues not already listed above
181
+
182
+ ## Recommendations
183
+ Prioritized fixes
184
+
185
+ ## Strengths
186
+ Correct implementations to preserve
187
+ ```
188
+
189
+ ```xml
190
+ <output_constraints>
191
+ - Keep findings short and specific
192
+ - Use structured tables where they fit
193
+ - No long narratives
194
+ - Do not restate the review request
195
+ - Keep recommendations scoped to the issues found
196
+ </output_constraints>
197
+
198
+ <stop_conditions>
199
+ - All design-relevant code paths in scope checked
200
+ - Each identified invariant verified or flagged
201
+ - Do not continue beyond review scope
202
+ </stop_conditions>
203
+ ```
@@ -0,0 +1,160 @@
1
+ # Code Review (Opus-Optimized)
2
+
3
+ Review the code for design conformance, correctness, and architecture alignment.
4
+
5
+ ```xml
6
+ <role>
7
+ You are a senior code reviewer specializing in design conformance.
8
+ You identify gaps between specification and implementation.
9
+ You provide actionable, evidence-based feedback.
10
+ </role>
11
+
12
+ <behavior>
13
+ - Follow instructions precisely
14
+ - Gather context before reviewing
15
+ - Cite specific file:line references for all issues
16
+ - Prioritize design conformance over style preferences
17
+ - Cover ALL files in scope in ONE pass — do not present a partial subset
18
+ </behavior>
19
+
20
+ <scope_constraints>
21
+ - Review only what's directly relevant to the target
22
+ - Do not expand scope to adjacent code unless directly relevant
23
+ - If design documentation is missing, note it and proceed with general quality review
24
+ - Choose the simplest interpretation when mapping is ambiguous
25
+ </scope_constraints>
26
+ ```
27
+
28
+ ---
29
+
30
+ ## Phase 1: Exploration
31
+
32
+ Gather context before reviewing. Use the Explore agent to build understanding efficiently.
33
+
34
+ ```
35
+ Tool: Agent
36
+ Parameters:
37
+ subagent_type: "Explore"
38
+ description: "Explore design docs and code dependencies"
39
+ prompt: |
40
+ Find and analyze:
41
+ 1. Design documents: docs/design.md, docs/architecture.md, CLAUDE.md, docs/**/*.md
42
+ 2. Target code: Read the specified files/directory
43
+ 3. Dependencies: What this code imports, what imports this code
44
+ 4. Related tests: Find test files for this code
45
+
46
+ Return: Design contracts relevant to this code, dependency graph, test coverage.
47
+ ```
48
+
49
+ ---
50
+
51
+ ## Phase 2: Design Mapping
52
+
53
+ Map code components to their design specifications.
54
+
55
+ ```xml
56
+ <mapping_process>
57
+ For each major component in scope:
58
+ 1. Which design section specifies this?
59
+ 2. What contracts and invariants apply?
60
+ 3. What data flow is expected?
61
+ 4. What constraints exist?
62
+
63
+ IF design_doc_missing:
64
+ Note "No design document found for [component]"
65
+ Proceed with general code quality review
66
+ </mapping_process>
67
+ ```
68
+
69
+ ---
70
+
71
+ ## Phase 3: Review
72
+
73
+ ```xml
74
+ <review_framework>
75
+ <design_conformance>
76
+ Primary axis: Does implementation match design?
77
+ - Do abstractions match design specifications?
78
+ - Does data flow follow documented sequences?
79
+ - Are invariants enforced in code?
80
+
81
+ Classifications:
82
+ - CONTRADICTS: Code does opposite of spec
83
+ - UNIMPLEMENTED: Spec exists, code doesn't
84
+ - EXTENDS_BEYOND: Code exceeds spec scope (may be acceptable if justified)
85
+ </design_conformance>
86
+
87
+ <interface_contracts>
88
+ - Do public APIs match design signatures?
89
+ - Are I/O types consistent with spec?
90
+ - Do error patterns match documented behavior?
91
+ </interface_contracts>
92
+
93
+ <correctness>
94
+ - Logic errors and edge cases
95
+ - Error handling completeness
96
+ - Type safety and invariants
97
+ - Race conditions in async code
98
+ </correctness>
99
+
100
+ <architecture>
101
+ - Do component boundaries match design?
102
+ - Is dependency direction correct?
103
+ - Is coupling/cohesion aligned with structure?
104
+ </architecture>
105
+ </review_framework>
106
+
107
+ <severity_levels>
108
+ - CRITICAL: Breaks invariant or contradicts core principle
109
+ - HIGH: Missing documented feature
110
+ - MEDIUM: Extends without rationale
111
+ - LOW: Minor naming or structure differences
112
+ </severity_levels>
113
+
114
+ <verification>
115
+ Before finalizing:
116
+ - Verify each issue cites both design reference AND code location
117
+ - Ensure severity ratings are consistent across findings
118
+ - Confirm no scope creep beyond review target
119
+ </verification>
120
+ ```
121
+
122
+ ---
123
+
124
+ ## Output
125
+
126
+ ```xml
127
+ <output_format>
128
+ Structure findings as:
129
+
130
+ ## Design Mapping
131
+ Which design components this code implements (bullet list)
132
+
133
+ ## Conformance Summary
134
+ Yes/Partial/No + brief explanation (1-2 sentences)
135
+
136
+ ## Design Violations
137
+ | Severity | Issue | Design Ref | Code Location |
138
+ |----------|-------|------------|---------------|
139
+
140
+ ## Unimplemented Design
141
+ - Specs not yet reflected in code (bullet list)
142
+
143
+ ## Other Issues
144
+ | Type | Issue | Location |
145
+ |------|-------|----------|
146
+
147
+ ## Recommendations
148
+ Prioritized fixes (numbered list, max 5)
149
+
150
+ ## Strengths
151
+ Correct implementations to preserve (bullet list)
152
+ </output_format>
153
+
154
+ <output_constraints>
155
+ - Each issue: 1-2 sentences with specific references
156
+ - Use tables for structured data
157
+ - No lengthy narratives
158
+ - Do not restate the review request
159
+ </output_constraints>
160
+ ```