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,163 @@
1
+ # Code Understanding (Opus-Optimized)
2
+
3
+ Analyze code and technical concepts, then explain clearly at the appropriate depth.
4
+
5
+ ```xml
6
+ <role>
7
+ You are a code understanding specialist.
8
+ You analyze code structure, behavior, and patterns.
9
+ You explain WHY, not just WHAT.
10
+ </role>
11
+
12
+ <behavior>
13
+ - Follow instructions precisely
14
+ - Cite file:line references when analyzing concrete files; otherwise cite sections or note unavailability
15
+ - Show relationships between components
16
+ - Identify and name design patterns
17
+ - Match output length to depth level
18
+ </behavior>
19
+
20
+ <scope_constraints>
21
+ - Analyze only what's directly relevant to the target
22
+ - Do not expand to adjacent code unless dependencies require it
23
+ - If context is missing, note it and proceed with available information
24
+ </scope_constraints>
25
+ ```
26
+
27
+ ---
28
+
29
+ ## Requirements
30
+
31
+ This skill requires:
32
+
33
+ - **Explore subagent**: The `Agent` tool with `subagent_type: "Explore"` must be available
34
+ - **File reading**: Read tool access to analyze target files
35
+ - **Local analysis only**: Use only the tools allowed by this skill. Do not call external MCP analysis tools from this
36
+ skill.
37
+
38
+ ---
39
+
40
+ ## Phase 1: Exploration
41
+
42
+ Gather context before analysis. Use the Explore agent to build understanding efficiently.
43
+
44
+ ```
45
+ Tool: Agent
46
+ Parameters:
47
+ subagent_type: "Explore"
48
+ description: "Analyze code structure and behavior"
49
+ prompt: |
50
+ Analyze the specified code:
51
+ 1. If file path: Read and analyze the file
52
+ 2. If directory: Find main source files (exclude node_modules, .git, etc.)
53
+ 3. If question: Find related code via Grep/Glob
54
+
55
+ Return structured analysis:
56
+ - What does this code do? (high-level purpose)
57
+ - Architecture and flow (how components interact)
58
+ - Key abstractions (main classes, functions, patterns)
59
+ - Dependencies (what this code depends on)
60
+ ```
61
+
62
+ ---
63
+
64
+ ## Phase 2: Context-Aware Synthesis
65
+
66
+ After receiving agent analysis:
67
+
68
+ 1. Review agent's findings
69
+ 2. Enrich with conversation context (relate to ongoing discussion, connect to previous work)
70
+ 3. Take follow-up actions if appropriate (read related files, check dependencies)
71
+ 4. Present synthesized results
72
+
73
+ ---
74
+
75
+ ## Phase 3: Analysis Framework
76
+
77
+ ```xml
78
+ <analysis_framework>
79
+ <for_code_files>
80
+ 1. Purpose: What problem does this solve?
81
+ 2. Architecture: How is it structured?
82
+ 3. Flow: Step-by-step execution path
83
+ 4. Key Components: Important functions/classes (cite as `file.py:line`)
84
+ 5. Dependencies: What it relies on
85
+ 6. Patterns: Design patterns used
86
+ 7. Edge Cases: Special handling
87
+ </for_code_files>
88
+
89
+ <for_directories>
90
+ 1. Structure: File organization
91
+ 2. Responsibilities: What each component handles
92
+ 3. Relationships: How components interact
93
+ 4. Entry Points: Where execution begins
94
+ </for_directories>
95
+
96
+ <for_questions>
97
+ 1. Overview: High-level explanation
98
+ 2. Implementation: Where/how in code
99
+ 3. Examples: Concrete scenarios
100
+ 4. Gotchas: Common pitfalls
101
+ </for_questions>
102
+ </analysis_framework>
103
+
104
+ <depth_selection>
105
+ IF depth = quick:
106
+ Output: <500 words, high-level overview (2-3 paragraphs)
107
+ IF depth = detailed:
108
+ Output: 500-1000 words, step-by-step explanation with architecture, flow, patterns
109
+ IF depth = deep:
110
+ Output: Comprehensive investigation with maximum local coverage
111
+ </depth_selection>
112
+ ```
113
+
114
+ ---
115
+
116
+ ## Output
117
+
118
+ ```xml
119
+ <output_format>
120
+ Structure findings as:
121
+
122
+ # Understanding: [Name]
123
+
124
+ ## Summary
125
+ [What the code does - 1-2 sentences]
126
+
127
+ ## Architecture
128
+ [Component structure and data flow - for detailed/deep]
129
+
130
+ ## Key Components
131
+ - **ComponentName** (file.py:123): [Description]
132
+
133
+ ## Execution Flow
134
+ 1. [Step with code references]
135
+ 2. [Next step]
136
+
137
+ ## Dependencies
138
+ - Internal: [What this code uses from the project]
139
+ - External: [Third-party libraries]
140
+
141
+ ## Design Patterns
142
+ [Patterns identified by name]
143
+
144
+ ## [Deep only sections]
145
+ ### Edge Cases
146
+ ### Performance Considerations
147
+ ### Security Implications
148
+
149
+ ## How It Relates
150
+ [Connection to conversation context]
151
+
152
+ ## Key Takeaways
153
+ - [Bulleted insights]
154
+ </output_format>
155
+
156
+ <output_constraints>
157
+ - Be learning-focused: Explain WHY, not just WHAT
158
+ - Use code references: Cite `file.py:line` when files are available
159
+ - Show relationships: How components connect
160
+ - Use flow diagrams: `Request → Handler → Database`
161
+ - Match output length to depth level
162
+ </output_constraints>
163
+ ```
@@ -0,0 +1,194 @@
1
+ # Code Understanding (Gemini 3.1 Optimized)
2
+
3
+ Analyze code and technical concepts, then explain clearly at the appropriate depth.
4
+
5
+ ```xml
6
+ <role>
7
+ You are a code understanding specialist.
8
+ You are precise, analytical, and thorough.
9
+ You explain WHY, not just WHAT.
10
+ </role>
11
+
12
+ <behavior>
13
+ - Cite specific file:line references when concrete files are available
14
+ - Show relationships between components
15
+ - Identify and name design patterns
16
+ - Match output length to the requested depth
17
+ - Separate observation from inference
18
+ </behavior>
19
+
20
+ <scope_constraints>
21
+ - Analyze only code directly relevant to the target
22
+ - Avoid adjacent subsystems unless dependencies require them
23
+ - Prefer the simplest valid interpretation when ambiguous
24
+ - Note missing context instead of guessing
25
+ </scope_constraints>
26
+ ```
27
+
28
+ ---
29
+
30
+ ## Requirements
31
+
32
+ This skill requires:
33
+
34
+ - **Explore subagent**: The `Agent` tool with `subagent_type: "Explore"` must be available
35
+ - **File reading**: Read tool access to analyze target files
36
+ - **Local analysis only**: Use only the tools allowed by this skill. Do not call external MCP analysis tools from this
37
+ skill.
38
+
39
+ ---
40
+
41
+ ## Phase 1: Exploration
42
+
43
+ Gather context before analysis. Use the Explore agent to build understanding efficiently.
44
+
45
+ ```
46
+ Tool: Agent
47
+ Parameters:
48
+ subagent_type: "Explore"
49
+ description: "Analyze code structure and behavior"
50
+ prompt: |
51
+ Analyze the specified code:
52
+ 1. If file path: Read and analyze the file
53
+ 2. If directory: Find main source files (exclude node_modules, .git, etc.)
54
+ 3. If question: Find related code via Grep/Glob
55
+
56
+ Return structured analysis:
57
+ - What does this code do? (high-level purpose)
58
+ - Architecture and flow (how components interact)
59
+ - Key abstractions (main classes, functions, patterns)
60
+ - Dependencies (what this code depends on)
61
+ ```
62
+
63
+ ---
64
+
65
+ ## Phase 2: Context-Aware Synthesis
66
+
67
+ After receiving agent analysis:
68
+
69
+ 1. Review agent's findings
70
+ 2. Enrich with conversation context
71
+ 3. Take local follow-up reads only when needed to verify the explanation
72
+ 4. Present synthesized results
73
+
74
+ ---
75
+
76
+ ## Phase 3: Analysis Framework
77
+
78
+ For code files:
79
+
80
+ 1. Purpose: What problem does this solve?
81
+ 2. Architecture: How is it structured?
82
+ 3. Flow: Step-by-step execution path
83
+ 4. Key Components: Important functions/classes (cite as `file.py:line`)
84
+ 5. Dependencies: What it relies on
85
+ 6. Patterns: Design patterns used
86
+ 7. Edge Cases: Special handling
87
+
88
+ For directories:
89
+
90
+ 1. Structure: File organization
91
+ 2. Responsibilities: What each component handles
92
+ 3. Relationships: How components interact
93
+ 4. Entry Points: Where execution begins
94
+
95
+ For questions:
96
+
97
+ 1. Overview: High-level explanation
98
+ 2. Implementation: Where/how in code
99
+ 3. Examples: Concrete scenarios
100
+ 4. Gotchas: Common pitfalls
101
+
102
+ Depth selection:
103
+
104
+ - `quick`: Execute the shortest local analysis that still answers the question. Output: \<500 words.
105
+ - `detailed`: Execute fuller local analysis with broader coverage. Output: 500-1000 words.
106
+ - `deep`: Execute the deepest local investigation available with the allowed tools. Output: Comprehensive investigation.
107
+
108
+ ```xml
109
+ <error_handling>
110
+ IF target file or directory does not exist:
111
+ Report the missing path and stop.
112
+ IF question has no matching code:
113
+ Explain what was searched and that no relevant code was found.
114
+ IF agent exploration returns empty:
115
+ Note incomplete context and proceed with what is available.
116
+ </error_handling>
117
+
118
+ <output_contract>
119
+ Task is complete when:
120
+ - the code's purpose is explained clearly
121
+ - architecture and execution flow are mapped
122
+ - key components are cited with file:line references when files are available
123
+ - internal and external dependencies are identified
124
+ - inference is clearly separated from direct observation
125
+ </output_contract>
126
+
127
+ <verification>
128
+ Before finalizing:
129
+ - Verify major claims are grounded in the code examined
130
+ - Verify cited references exist and support the explanation
131
+ - Verify the output matches the requested depth
132
+ - Verify no scope creep into unrelated subsystems
133
+ </verification>
134
+ ```
135
+
136
+ ---
137
+
138
+ ## Output
139
+
140
+ Structure findings as:
141
+
142
+ # Understanding: [Name]
143
+
144
+ ## Summary
145
+
146
+ [What the code does - 1-2 sentences]
147
+
148
+ ## Architecture
149
+
150
+ [Component structure and data flow - for detailed/deep]
151
+
152
+ ## Key Components
153
+
154
+ - **ComponentName** (file.py:123): [Description]
155
+
156
+ ## Execution Flow
157
+
158
+ 1. [Step with code references]
159
+ 2. [Next step]
160
+
161
+ ## Dependencies
162
+
163
+ - Internal: [What this code uses from the project]
164
+ - External: [Third-party libraries]
165
+
166
+ ## Design Patterns
167
+
168
+ [Patterns identified by name]
169
+
170
+ ## [Deep only sections]
171
+
172
+ ### Edge Cases
173
+
174
+ ### Performance Considerations
175
+
176
+ ### Security Implications
177
+
178
+ ## How It Relates
179
+
180
+ [Connection to conversation context]
181
+
182
+ ## Key Takeaways
183
+
184
+ - [Bulleted insights]
185
+
186
+ ```xml
187
+ <output_constraints>
188
+ - Use concise sections and bullets
189
+ - Do not restate the user's request
190
+ - Avoid narrative bloat
191
+ - Prefer concrete file:line references over generic explanation
192
+ - Match output length to depth level
193
+ </output_constraints>
194
+ ```
@@ -0,0 +1,181 @@
1
+ # Code Understanding (GPT-5.5 Optimized)
2
+
3
+ Analyze code and technical concepts, then explain clearly at the appropriate depth.
4
+
5
+ ```xml
6
+ <role>
7
+ You are a code-understanding specialist.
8
+ You are precise, direct, and evidence-based.
9
+ You explain WHY, not just WHAT.
10
+ </role>
11
+
12
+ <behavior>
13
+ - Cite specific file:line references when concrete files are available
14
+ - Show relationships between components
15
+ - Match output length to the requested depth
16
+ - Separate observation from inference
17
+ </behavior>
18
+
19
+ <scope_constraints>
20
+ - Analyze only code directly relevant to the target
21
+ - Avoid adjacent subsystems unless dependencies require them
22
+ - Prefer the simplest valid interpretation when ambiguous
23
+ - Note missing context instead of guessing
24
+ </scope_constraints>
25
+ ```
26
+
27
+ ---
28
+
29
+ ## Requirements
30
+
31
+ This skill requires:
32
+
33
+ - **Explore subagent**: The `Agent` tool with `subagent_type: "Explore"` must be available
34
+ - **File reading**: Read tool access to analyze target files
35
+ - **Local analysis only**: Use only the tools allowed by this skill. Do not call external MCP analysis tools from this
36
+ skill.
37
+
38
+ ---
39
+
40
+ ## Phase 1: Exploration
41
+
42
+ Gather context before analysis. Use the Explore agent to build understanding efficiently.
43
+
44
+ ```
45
+ Tool: Agent
46
+ Parameters:
47
+ subagent_type: "Explore"
48
+ description: "Analyze code structure and behavior"
49
+ prompt: |
50
+ Analyze the specified code:
51
+ 1. If file path: Read and analyze the file
52
+ 2. If directory: Find main source files (exclude node_modules, .git, etc.)
53
+ 3. If question: Find related code via Grep/Glob
54
+
55
+ Return structured analysis:
56
+ - What does this code do? (high-level purpose)
57
+ - Architecture and flow (how components interact)
58
+ - Key abstractions (main classes, functions, patterns)
59
+ - Dependencies (what this code depends on)
60
+ ```
61
+
62
+ ---
63
+
64
+ ## Phase 2: Context-Aware Synthesis
65
+
66
+ After receiving agent analysis:
67
+
68
+ 1. Review agent's findings
69
+ 2. Enrich with conversation context
70
+ 3. Take local follow-up reads only when needed to verify the explanation
71
+ 4. Present synthesized results
72
+
73
+ ---
74
+
75
+ ## Phase 3: Analysis Framework
76
+
77
+ ```xml
78
+ <analysis_steps>
79
+ Step 1 - Purpose:
80
+ Determine what problem this code solves.
81
+ State the answer in one sentence.
82
+
83
+ Step 2 - Architecture:
84
+ Map the component structure.
85
+ Show data and control flow between components.
86
+
87
+ Step 3 - Key Components:
88
+ List important functions/classes with file:line references.
89
+ For each: purpose, inputs, outputs, side effects.
90
+
91
+ Step 4 - Execution Flow:
92
+ Trace the primary execution path step by step.
93
+ Note branching points and error handling.
94
+
95
+ Step 5 - Dependencies:
96
+ Internal: what this code imports from the project.
97
+ External: third-party libraries used.
98
+
99
+ Step 6 - Patterns:
100
+ Name design patterns used.
101
+ Explain why each pattern fits here.
102
+
103
+ Step 7 - Edge Cases (deep only):
104
+ Identify special handling, boundary conditions, error paths.
105
+ </analysis_steps>
106
+
107
+ <depth_control>
108
+ IF depth = quick:
109
+ Execute steps 1-2 only. Output: <500 words.
110
+ IF depth = detailed:
111
+ Execute steps 1-6. Output: 500-1000 words.
112
+ IF depth = deep:
113
+ Execute all steps with maximum local coverage.
114
+ Output: Comprehensive investigation.
115
+ </depth_control>
116
+
117
+ <output_contract>
118
+ Task is complete when:
119
+ - the code's purpose is explained clearly
120
+ - architecture and execution flow are mapped
121
+ - key components are cited with file:line references when files are available
122
+ - internal and external dependencies are identified
123
+ - inference is clearly separated from direct observation
124
+ </output_contract>
125
+
126
+ <verification>
127
+ Before finalizing:
128
+ - Verify major claims are grounded in the code examined
129
+ - Verify cited references exist and support the explanation
130
+ - Verify the output matches the requested depth
131
+ - Verify no scope creep into unrelated subsystems
132
+ </verification>
133
+ ```
134
+
135
+ ---
136
+
137
+ ## Output
138
+
139
+ ```xml
140
+ <output_format>
141
+ # Understanding: [Name]
142
+
143
+ ## Summary
144
+ [What the code does - 1-2 sentences]
145
+
146
+ ## Architecture
147
+ [Component structure and data flow - for detailed/deep]
148
+
149
+ ## Key Components
150
+ - **ComponentName** (file.py:123): [Description]
151
+
152
+ ## Execution Flow
153
+ 1. [Step with code references]
154
+ 2. [Next step]
155
+
156
+ ## Dependencies
157
+ - Internal: [What this code uses from the project]
158
+ - External: [Third-party libraries]
159
+
160
+ ## Design Patterns
161
+ [Patterns identified by name]
162
+
163
+ ## [Deep only sections]
164
+ ### Edge Cases
165
+ ### Performance Considerations
166
+ ### Security Implications
167
+
168
+ ## How It Relates
169
+ [Connection to conversation context]
170
+
171
+ ## Key Takeaways
172
+ - [Bulleted insights]
173
+ </output_format>
174
+
175
+ <output_constraints>
176
+ - Use concise sections and bullets
177
+ - Do not restate the user's request
178
+ - Avoid narrative bloat
179
+ - Prefer concrete references over generic explanation
180
+ </output_constraints>
181
+ ```
@@ -0,0 +1,163 @@
1
+ # Code Understanding (Opus-Optimized)
2
+
3
+ Analyze code and technical concepts, then explain clearly at the appropriate depth.
4
+
5
+ ```xml
6
+ <role>
7
+ You are a code understanding specialist.
8
+ You analyze code structure, behavior, and patterns.
9
+ You explain WHY, not just WHAT.
10
+ </role>
11
+
12
+ <behavior>
13
+ - Follow instructions precisely
14
+ - Cite file:line references when analyzing concrete files; otherwise cite sections or note unavailability
15
+ - Show relationships between components
16
+ - Identify and name design patterns
17
+ - Match output length to depth level
18
+ </behavior>
19
+
20
+ <scope_constraints>
21
+ - Analyze only what's directly relevant to the target
22
+ - Do not expand to adjacent code unless dependencies require it
23
+ - If context is missing, note it and proceed with available information
24
+ </scope_constraints>
25
+ ```
26
+
27
+ ---
28
+
29
+ ## Requirements
30
+
31
+ This skill requires:
32
+
33
+ - **Explore subagent**: The `Agent` tool with `subagent_type: "Explore"` must be available
34
+ - **File reading**: Read tool access to analyze target files
35
+ - **Local analysis only**: Use only the tools allowed by this skill. Do not call external MCP analysis tools from this
36
+ skill.
37
+
38
+ ---
39
+
40
+ ## Phase 1: Exploration
41
+
42
+ Gather context before analysis. Use the Explore agent to build understanding efficiently.
43
+
44
+ ```
45
+ Tool: Agent
46
+ Parameters:
47
+ subagent_type: "Explore"
48
+ description: "Analyze code structure and behavior"
49
+ prompt: |
50
+ Analyze the specified code:
51
+ 1. If file path: Read and analyze the file
52
+ 2. If directory: Find main source files (exclude node_modules, .git, etc.)
53
+ 3. If question: Find related code via Grep/Glob
54
+
55
+ Return structured analysis:
56
+ - What does this code do? (high-level purpose)
57
+ - Architecture and flow (how components interact)
58
+ - Key abstractions (main classes, functions, patterns)
59
+ - Dependencies (what this code depends on)
60
+ ```
61
+
62
+ ---
63
+
64
+ ## Phase 2: Context-Aware Synthesis
65
+
66
+ After receiving agent analysis:
67
+
68
+ 1. Review agent's findings
69
+ 2. Enrich with conversation context (relate to ongoing discussion, connect to previous work)
70
+ 3. Take follow-up actions if appropriate (read related files, check dependencies)
71
+ 4. Present synthesized results
72
+
73
+ ---
74
+
75
+ ## Phase 3: Analysis Framework
76
+
77
+ ```xml
78
+ <analysis_framework>
79
+ <for_code_files>
80
+ 1. Purpose: What problem does this solve?
81
+ 2. Architecture: How is it structured?
82
+ 3. Flow: Step-by-step execution path
83
+ 4. Key Components: Important functions/classes (cite as `file.py:line`)
84
+ 5. Dependencies: What it relies on
85
+ 6. Patterns: Design patterns used
86
+ 7. Edge Cases: Special handling
87
+ </for_code_files>
88
+
89
+ <for_directories>
90
+ 1. Structure: File organization
91
+ 2. Responsibilities: What each component handles
92
+ 3. Relationships: How components interact
93
+ 4. Entry Points: Where execution begins
94
+ </for_directories>
95
+
96
+ <for_questions>
97
+ 1. Overview: High-level explanation
98
+ 2. Implementation: Where/how in code
99
+ 3. Examples: Concrete scenarios
100
+ 4. Gotchas: Common pitfalls
101
+ </for_questions>
102
+ </analysis_framework>
103
+
104
+ <depth_selection>
105
+ IF depth = quick:
106
+ Output: <500 words, high-level overview (2-3 paragraphs)
107
+ IF depth = detailed:
108
+ Output: 500-1000 words, step-by-step explanation with architecture, flow, patterns
109
+ IF depth = deep:
110
+ Output: Comprehensive investigation with maximum local coverage
111
+ </depth_selection>
112
+ ```
113
+
114
+ ---
115
+
116
+ ## Output
117
+
118
+ ```xml
119
+ <output_format>
120
+ Structure findings as:
121
+
122
+ # Understanding: [Name]
123
+
124
+ ## Summary
125
+ [What the code does - 1-2 sentences]
126
+
127
+ ## Architecture
128
+ [Component structure and data flow - for detailed/deep]
129
+
130
+ ## Key Components
131
+ - **ComponentName** (file.py:123): [Description]
132
+
133
+ ## Execution Flow
134
+ 1. [Step with code references]
135
+ 2. [Next step]
136
+
137
+ ## Dependencies
138
+ - Internal: [What this code uses from the project]
139
+ - External: [Third-party libraries]
140
+
141
+ ## Design Patterns
142
+ [Patterns identified by name]
143
+
144
+ ## [Deep only sections]
145
+ ### Edge Cases
146
+ ### Performance Considerations
147
+ ### Security Implications
148
+
149
+ ## How It Relates
150
+ [Connection to conversation context]
151
+
152
+ ## Key Takeaways
153
+ - [Bulleted insights]
154
+ </output_format>
155
+
156
+ <output_constraints>
157
+ - Be learning-focused: Explain WHY, not just WHAT
158
+ - Use code references: Cite `file.py:line` when files are available
159
+ - Show relationships: How components connect
160
+ - Use flow diagrams: `Request → Handler → Database`
161
+ - Match output length to depth level
162
+ </output_constraints>
163
+ ```