codeforge-dev 1.7.0 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/.devcontainer/.env +4 -6
  2. package/.devcontainer/.env.example +29 -0
  3. package/.devcontainer/.gitignore +8 -0
  4. package/.devcontainer/.secrets.example +12 -0
  5. package/.devcontainer/CHANGELOG.md +130 -0
  6. package/.devcontainer/CLAUDE.md +56 -19
  7. package/.devcontainer/README.md +111 -56
  8. package/.devcontainer/config/{main-system-prompt.md → defaults/main-system-prompt.md} +72 -0
  9. package/.devcontainer/config/file-manifest.json +20 -0
  10. package/.devcontainer/devcontainer.json +20 -0
  11. package/.devcontainer/docs/configuration-reference.md +90 -0
  12. package/.devcontainer/docs/keybindings.md +100 -0
  13. package/.devcontainer/docs/optional-features.md +129 -0
  14. package/.devcontainer/docs/plugins.md +154 -0
  15. package/.devcontainer/docs/troubleshooting.md +128 -0
  16. package/.devcontainer/features/agent-browser/install.sh +6 -0
  17. package/.devcontainer/features/ast-grep/install.sh +6 -0
  18. package/.devcontainer/features/biome/README.md +27 -0
  19. package/.devcontainer/features/biome/install.sh +6 -0
  20. package/.devcontainer/features/ccburn/install.sh +6 -0
  21. package/.devcontainer/features/ccstatusline/devcontainer-feature.json +5 -0
  22. package/.devcontainer/features/ccstatusline/install.sh +7 -0
  23. package/.devcontainer/features/ccusage/install.sh +6 -0
  24. package/.devcontainer/features/claude-monitor/install.sh +6 -0
  25. package/.devcontainer/features/dprint/README.md +30 -0
  26. package/.devcontainer/features/dprint/devcontainer-feature.json +18 -0
  27. package/.devcontainer/features/dprint/install.sh +131 -0
  28. package/.devcontainer/features/hadolint/README.md +35 -0
  29. package/.devcontainer/features/hadolint/devcontainer-feature.json +13 -0
  30. package/.devcontainer/features/hadolint/install.sh +86 -0
  31. package/.devcontainer/features/lsp-servers/devcontainer-feature.json +5 -0
  32. package/.devcontainer/features/lsp-servers/install.sh +7 -0
  33. package/.devcontainer/features/mcp-qdrant/devcontainer-feature.json +5 -0
  34. package/.devcontainer/features/mcp-qdrant/install.sh +13 -6
  35. package/.devcontainer/features/mcp-reasoner/devcontainer-feature.json +5 -0
  36. package/.devcontainer/features/mcp-reasoner/install.sh +8 -1
  37. package/.devcontainer/features/notify-hook/devcontainer-feature.json +5 -0
  38. package/.devcontainer/features/notify-hook/install.sh +7 -0
  39. package/.devcontainer/features/ruff/README.md +26 -0
  40. package/.devcontainer/features/ruff/devcontainer-feature.json +21 -0
  41. package/.devcontainer/features/ruff/install.sh +74 -0
  42. package/.devcontainer/features/shellcheck/README.md +38 -0
  43. package/.devcontainer/features/shellcheck/devcontainer-feature.json +13 -0
  44. package/.devcontainer/features/shellcheck/install.sh +24 -0
  45. package/.devcontainer/features/shfmt/README.md +37 -0
  46. package/.devcontainer/features/shfmt/devcontainer-feature.json +13 -0
  47. package/.devcontainer/features/shfmt/install.sh +85 -0
  48. package/.devcontainer/features/splitrail/devcontainer-feature.json +5 -0
  49. package/.devcontainer/features/splitrail/install.sh +7 -0
  50. package/.devcontainer/features/tmux/install.sh +8 -0
  51. package/.devcontainer/features/tree-sitter/install.sh +6 -0
  52. package/.devcontainer/plugins/devs-marketplace/.claude-plugin/marketplace.json +3 -10
  53. package/.devcontainer/plugins/devs-marketplace/plugins/auto-formatter/.claude-plugin/plugin.json +1 -1
  54. package/.devcontainer/plugins/devs-marketplace/plugins/auto-formatter/scripts/__pycache__/format-on-stop.cpython-314.pyc +0 -0
  55. package/.devcontainer/plugins/devs-marketplace/plugins/auto-formatter/scripts/format-on-stop.py +114 -9
  56. package/.devcontainer/plugins/devs-marketplace/plugins/auto-linter/.claude-plugin/plugin.json +1 -1
  57. package/.devcontainer/plugins/devs-marketplace/plugins/auto-linter/hooks/hooks.json +4 -5
  58. package/.devcontainer/plugins/devs-marketplace/plugins/auto-linter/scripts/__pycache__/lint-file.cpython-314.pyc +0 -0
  59. package/.devcontainer/plugins/devs-marketplace/plugins/auto-linter/scripts/lint-file.py +478 -76
  60. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/.claude-plugin/plugin.json +1 -1
  61. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/AGENT-REDIRECTION.md +226 -0
  62. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/architect.md +17 -0
  63. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/bash-exec.md +4 -4
  64. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/claude-guide.md +14 -23
  65. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/debug-logs.md +2 -0
  66. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/dependency-analyst.md +2 -0
  67. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/doc-writer.md +13 -0
  68. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/explorer.md +2 -0
  69. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/generalist.md +10 -1
  70. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/migrator.md +6 -0
  71. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/refactorer.md +4 -0
  72. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/spec-writer.md +36 -23
  73. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/statusline-config.md +3 -3
  74. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/test-writer.md +3 -0
  75. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/hooks/hooks.json +39 -0
  76. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/advisory-test-runner.cpython-314.pyc +0 -0
  77. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/collect-edited-files.cpython-314.pyc +0 -0
  78. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/commit-reminder.cpython-314.pyc +0 -0
  79. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/git-state-injector.cpython-314.pyc +0 -0
  80. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/redirect-builtin-agents.cpython-314.pyc +0 -0
  81. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/ticket-linker.cpython-314.pyc +0 -0
  82. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/todo-harvester.cpython-314.pyc +0 -0
  83. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/advisory-test-runner.py +174 -0
  84. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/collect-edited-files.py +8 -6
  85. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/commit-reminder.py +90 -0
  86. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/git-state-injector.py +114 -0
  87. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/skill-suggester.py +61 -0
  88. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/ticket-linker.py +137 -0
  89. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/todo-harvester.py +130 -0
  90. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/api-design/SKILL.md +224 -0
  91. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/api-design/references/error-handling.md +166 -0
  92. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/api-design/references/rest-conventions.md +215 -0
  93. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/ast-grep-patterns/SKILL.md +211 -0
  94. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/ast-grep-patterns/references/language-patterns.md +327 -0
  95. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/dependency-management/SKILL.md +134 -0
  96. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/dependency-management/references/ecosystem-commands.md +264 -0
  97. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/dependency-management/references/license-compliance.md +80 -0
  98. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/documentation-patterns/SKILL.md +153 -0
  99. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/documentation-patterns/references/api-doc-templates.md +221 -0
  100. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/documentation-patterns/references/docstring-formats.md +296 -0
  101. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/migration-patterns/SKILL.md +150 -0
  102. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/migration-patterns/references/javascript-migrations.md +179 -0
  103. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/migration-patterns/references/python-migrations.md +141 -0
  104. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/specification-writing/SKILL.md +32 -0
  105. package/.devcontainer/plugins/devs-marketplace/plugins/dangerous-command-blocker/scripts/__pycache__/block-dangerous.cpython-314.pyc +0 -0
  106. package/.devcontainer/plugins/devs-marketplace/plugins/notify-hook/hooks/hooks.json +1 -1
  107. package/.devcontainer/plugins/devs-marketplace/plugins/protected-files-guard/scripts/__pycache__/guard-protected.cpython-314.pyc +0 -0
  108. package/.devcontainer/scripts/check-setup.sh +72 -0
  109. package/.devcontainer/scripts/setup-aliases.sh +43 -3
  110. package/.devcontainer/scripts/setup-auth.sh +74 -0
  111. package/.devcontainer/scripts/setup-config.sh +112 -22
  112. package/.devcontainer/scripts/setup-update-claude.sh +8 -0
  113. package/.devcontainer/scripts/setup.sh +46 -13
  114. package/README.md +23 -190
  115. package/package.json +1 -1
  116. package/setup.js +245 -71
  117. package/.devcontainer/features/claude-code/README.md +0 -498
  118. package/.devcontainer/features/claude-code/config/settings.json +0 -72
  119. package/.devcontainer/features/claude-code/config/system-prompt.md +0 -118
  120. package/.devcontainer/features/claude-code/config/world-building-sp.md +0 -1432
  121. package/.devcontainer/features/claude-code/devcontainer-feature.json +0 -42
  122. package/.devcontainer/features/claude-code/install.sh +0 -466
  123. package/.devcontainer/plugins/devs-marketplace/plugins/planning-reminder/.claude-plugin/plugin.json +0 -7
  124. package/.devcontainer/plugins/devs-marketplace/plugins/planning-reminder/hooks/hooks.json +0 -17
  125. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/.claude-plugin/plugin.json +0 -6
  126. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/config/planning-instructions.md +0 -14
  127. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/functional-conjuring-map.md +0 -989
  128. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/hooks/hooks.json +0 -33
  129. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/__pycache__/post-enhance-task.cpython-314.pyc +0 -0
  130. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/enhance-planning.py +0 -71
  131. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/enhancers/enhance-plan.sh +0 -68
  132. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/enhancers/enhance-task.sh +0 -120
  133. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/post-enhance-plan.py +0 -133
  134. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/post-enhance-task.py +0 -253
  135. /package/.devcontainer/config/{keybindings.json → defaults/keybindings.json} +0 -0
  136. /package/.devcontainer/config/{settings.json → defaults/settings.json} +0 -0
@@ -0,0 +1,226 @@
1
+ # Agent Redirection Guide
2
+
3
+ How Claude Code's hook system lets you replace, reroute, or transform any tool call — including swapping built-in subagents for custom ones.
4
+
5
+ ## How It Works
6
+
7
+ Claude Code plugins can register **PreToolUse hooks** that intercept tool calls before they execute. The hook receives the full tool input as JSON on stdin and can return modified input on stdout. This is the mechanism behind agent redirection: when Claude spawns a subagent via the `Task` tool, a hook intercepts the call and rewrites `subagent_type` to point at a custom agent definition.
8
+
9
+ ### The Hook Contract
10
+
11
+ ```
12
+ stdin → { "tool_name": "Task", "tool_input": { "subagent_type": "Explore", "prompt": "...", ... } }
13
+ stdout ← { "hookSpecificOutput": { "hookEventName": "PreToolUse", "permissionDecision": "allow", "updatedInput": { ...modified tool_input... } } }
14
+ ```
15
+
16
+ The hook script receives the tool call context on stdin, and can return:
17
+
18
+ | Field | Effect |
19
+ |-------|--------|
20
+ | `permissionDecision: "allow"` | Let the call proceed (with optional modifications) |
21
+ | `permissionDecision: "deny"` | Block the call entirely (with a reason) |
22
+ | `updatedInput: {...}` | Replace the tool input — Claude Code uses the new values instead of the originals |
23
+
24
+ **Critical detail**: `updatedInput` **replaces** the original input (it does not merge). Always spread the original fields and override only what you need:
25
+
26
+ ```python
27
+ updated = {**tool_input, "subagent_type": "my-custom-agent"}
28
+ ```
29
+
30
+ ### Hook Registration
31
+
32
+ In your plugin's `hooks/hooks.json`:
33
+
34
+ ```json
35
+ {
36
+ "hooks": {
37
+ "PreToolUse": [
38
+ {
39
+ "matcher": "Task",
40
+ "hooks": [{
41
+ "type": "command",
42
+ "command": "python3 ${CLAUDE_PLUGIN_ROOT}/scripts/my-hook.py",
43
+ "timeout": 5
44
+ }]
45
+ }
46
+ ]
47
+ }
48
+ }
49
+ ```
50
+
51
+ The `matcher` field controls which tool triggers the hook. Use `"Task"` to intercept subagent spawning, `"Bash"` for command execution, `"Edit|Write"` for file modifications, etc.
52
+
53
+ ## What We Do: Built-in → Custom Agent Swap
54
+
55
+ The `redirect-builtin-agents.py` hook maps Claude Code's built-in agent types to our custom agents:
56
+
57
+ ```python
58
+ REDIRECT_MAP = {
59
+ "Explore": "explorer", # Fast codebase search
60
+ "Plan": "architect", # Implementation planning
61
+ "general-purpose": "generalist", # Multi-step tasks
62
+ "Bash": "bash-exec", # Command execution
63
+ "claude-code-guide": "claude-guide",
64
+ "statusline-setup": "statusline-config",
65
+ }
66
+ ```
67
+
68
+ When Claude decides to spawn an `Explore` agent, the hook rewrites it to `code-directive:explorer` — a custom agent with tailored instructions, tool restrictions, and model selection. The original prompt passes through unchanged.
69
+
70
+ ### Custom Agent Definitions
71
+
72
+ Agents are Markdown files with YAML frontmatter in the `agents/` directory:
73
+
74
+ ```yaml
75
+ ---
76
+ name: explorer
77
+ description: >-
78
+ Fast codebase search. Use when you need to find files,
79
+ search code, or answer structural questions.
80
+ tools: Read, Glob, Grep, Bash # Restrict available tools
81
+ model: sonnet # Or: opus, haiku, inherit
82
+ color: cyan
83
+ memory:
84
+ scope: project # Or: user, global
85
+ skills:
86
+ - debugging # Inject skill knowledge
87
+ ---
88
+
89
+ # Explorer Agent
90
+
91
+ You are a codebase navigation specialist...
92
+ ```
93
+
94
+ Key frontmatter fields:
95
+
96
+ | Field | What it controls |
97
+ |-------|-----------------|
98
+ | `tools` | Which tools the agent can use (`"*"` for all, or comma-separated list) |
99
+ | `model` | Which model runs the agent (`sonnet`, `opus`, `haiku`, `inherit`) |
100
+ | `skills` | Skills injected into the agent's context |
101
+ | `memory.scope` | Memory persistence level |
102
+
103
+ The Markdown body below the frontmatter becomes the agent's system prompt.
104
+
105
+ ## What Else You Can Do
106
+
107
+ The same hook mechanism supports far more than agent swapping. Here are patterns that work today:
108
+
109
+ ### Modify the Prompt
110
+
111
+ Inject additional context, constraints, or instructions into any subagent's prompt:
112
+
113
+ ```python
114
+ updated = {
115
+ **tool_input,
116
+ "prompt": tool_input["prompt"] + "\n\nALWAYS check for security issues.",
117
+ }
118
+ ```
119
+
120
+ ### Change the Model
121
+
122
+ Force a specific model for certain agent types or tasks:
123
+
124
+ ```python
125
+ if "security" in tool_input.get("prompt", "").lower():
126
+ updated = {**tool_input, "model": "opus"} # Use strongest model for security tasks
127
+ ```
128
+
129
+ ### Conditional Routing
130
+
131
+ Route to different agents based on prompt content, file patterns, or environment:
132
+
133
+ ```python
134
+ prompt = tool_input.get("prompt", "")
135
+ if "test" in prompt.lower():
136
+ target = "test-writer"
137
+ elif "refactor" in prompt.lower():
138
+ target = "refactorer"
139
+ else:
140
+ target = "generalist"
141
+ updated = {**tool_input, "subagent_type": f"code-directive:{target}"}
142
+ ```
143
+
144
+ ### Block Certain Operations
145
+
146
+ Deny tool calls that match dangerous patterns:
147
+
148
+ ```python
149
+ # This is exactly how dangerous-command-blocker works for Bash
150
+ response = {
151
+ "hookSpecificOutput": {
152
+ "hookEventName": "PreToolUse",
153
+ "permissionDecision": "deny",
154
+ "permissionDecisionReason": "This operation is not allowed.",
155
+ }
156
+ }
157
+ ```
158
+
159
+ ### Intercept Any Tool (Not Just Task)
160
+
161
+ Hooks aren't limited to subagent spawning. You can intercept `Bash`, `Edit`, `Write`, `WebFetch` — any tool:
162
+
163
+ ```json
164
+ { "matcher": "Bash", "hooks": [{ "type": "command", "command": "python3 my-script.py" }] }
165
+ ```
166
+
167
+ The `dangerous-command-blocker` plugin uses this to inspect Bash commands before execution. The `protected-files-guard` does the same for Edit/Write to block modifications to sensitive files.
168
+
169
+ ### Chain with External Services
170
+
171
+ Since hooks are just scripts that read stdin and write stdout, you can call anything:
172
+
173
+ ```python
174
+ # Forward the prompt to an external API for analysis
175
+ import requests
176
+ result = requests.post("https://my-api.example.com/analyze", json=tool_input)
177
+ # Use the response to modify the tool call
178
+ ```
179
+
180
+ This opens up patterns like:
181
+ - **External LLM routing** — send the prompt to a classifier that picks the best model/agent
182
+ - **Audit logging** — POST every tool call to an external logging service
183
+ - **Cost control** — check a budget API before allowing expensive operations
184
+ - **RAG injection** — query a vector DB and inject relevant context into the prompt
185
+
186
+ ### PostToolUse: React After Execution
187
+
188
+ `PostToolUse` hooks run after a tool completes and can inject context back to Claude:
189
+
190
+ ```python
191
+ # Return diagnostic information that Claude will see
192
+ print(json.dumps({"additionalContext": "Lint warning: unused import on line 12"}))
193
+ ```
194
+
195
+ This is how the auto-linter and syntax validator work — they inspect the result of Edit/Write operations and feed findings back into the conversation.
196
+
197
+ ## File Layout
198
+
199
+ ```
200
+ code-directive/
201
+ ├── agents/ # Agent definitions (17 .md files)
202
+ │ ├── explorer.md
203
+ │ ├── architect.md
204
+ │ ├── generalist.md
205
+ │ └── ...
206
+ ├── hooks/
207
+ │ └── hooks.json # Hook registrations
208
+ ├── scripts/
209
+ │ ├── redirect-builtin-agents.py # The redirection hook
210
+ │ ├── collect-edited-files.py # Collects paths for Stop hooks
211
+ │ ├── syntax-validator.py # PostToolUse syntax checks
212
+ │ └── skill-suggester.py # Suggests skills on prompt
213
+ └── skills/ # Skill definitions (16 directories)
214
+ ├── fastapi/
215
+ ├── svelte5/
216
+ └── ...
217
+ ```
218
+
219
+ ## Writing Your Own
220
+
221
+ 1. **Create the agent** — add a `.md` file to `agents/` with YAML frontmatter
222
+ 2. **Add the redirect** — add an entry to `REDIRECT_MAP` in `redirect-builtin-agents.py`, or write a new hook script
223
+ 3. **Register the hook** — add it to `hooks/hooks.json` under the appropriate event type
224
+ 4. **Test** — spawn the agent via Claude and check `/tmp/agent-redirect.log` for redirect entries
225
+
226
+ The hook always exits 0. If it crashes or times out, Claude Code falls back to the original tool call — so a broken hook never blocks work.
@@ -13,6 +13,8 @@ model: opus
13
13
  color: magenta
14
14
  memory:
15
15
  scope: project
16
+ skills:
17
+ - api-design
16
18
  hooks:
17
19
  PreToolUse:
18
20
  - matcher: Bash
@@ -89,6 +91,16 @@ Based on your exploration:
89
91
  6. **Flag performance-sensitive paths** — Even for non-performance requests, surface changes that touch hot paths, introduce N+1 queries, add blocking I/O, or change algorithmic complexity. Note measurement strategy if relevant.
90
92
  7. **Assess risks** — What could go wrong? What are the edge cases? What dependencies could break?
91
93
  8. **Define verification** — How will we know each step worked?
94
+ 9. **Specify documentation outputs** — Identify which docs this work should produce
95
+ or update. Distinguish:
96
+ - **Roadmap entry**: one-line description of what the version delivers (no
97
+ implementation detail — that belongs in specs)
98
+ - **Feature spec**: ≤200 line file following the standard template (Version,
99
+ Status, Intent, Acceptance Criteria, Key Files, Schema, API, Dependencies)
100
+ - **As-built update**: if modifying an existing feature, identify which spec
101
+ to update post-implementation
102
+ Plans that mix roadmap-level and spec-level detail produce artifacts too
103
+ detailed for strategy and too shallow for implementation.
92
104
 
93
105
  ### Phase 4: Structure the Plan
94
106
 
@@ -150,6 +162,11 @@ List the 3-7 files most critical for implementing this plan:
150
162
  - `/path/to/models.py` — Brief reason (e.g., "Data model to extend")
151
163
  - `/path/to/test_file.py` — Brief reason (e.g., "Test patterns to follow")
152
164
 
165
+ ### Documentation Outputs
166
+ - New spec: `.specs/vX.Y.0/feature-name.md` (≤200 lines)
167
+ - Updated spec: `.specs/vX.Y.0/existing-feature.md` — changes: [list]
168
+ - Roadmap update: `.specs/roadmap.md` — add `[ ] feature` to vX.Y.0
169
+
153
170
  ### Risks & Mitigations
154
171
 
155
172
  | Risk | Likelihood | Impact | Mitigation |
@@ -29,10 +29,10 @@ You are a **command execution specialist** for terminal operations. You run bash
29
29
  - **NEVER** amend commits unless the caller explicitly says "amend." Always create new commits by default — amending the previous commit risks destroying work, especially after a pre-commit hook failure.
30
30
  - **NEVER** update git config (`git config user.name`, `git config user.email`, etc.).
31
31
  - **NEVER** run commands that could expose secrets or credentials to stdout without redaction.
32
- - **NEVER** run `rm -rf /` or any command that deletes system directories. Block recursive deletion outside of `/workspaces/`.
32
+ - **NEVER** run `rm -rf /` or any command that deletes system directories. Block recursive deletion outside of the workspace root.
33
33
  - **NEVER** run commands that risk runaway execution: `while true` loops without exit conditions, fork bombs (`: | : &`), commands that generate unbounded output (`yes`, `cat /dev/urandom`), or commands likely to fill disk (`dd if=/dev/zero`).
34
34
  - Always **quote file paths** that contain spaces with double quotes.
35
- - Prefer **absolute paths** within `/workspaces/` to avoid working directory confusion.
35
+ - Prefer **absolute paths** within the workspace root to avoid working directory confusion.
36
36
 
37
37
  ## Git Safety Protocols
38
38
 
@@ -117,7 +117,7 @@ When a command is complex (piped chains, obscure flags) or potentially destructi
117
117
  ```
118
118
  # Example: explain before running
119
119
  "This will find all .log files older than 7 days and delete them:"
120
- find /workspaces/project/logs -name "*.log" -mtime +7 -delete
120
+ find ./logs -name "*.log" -mtime +7 -delete
121
121
  ```
122
122
  For straightforward commands (`git status`, `ls`, `npm test`), execute directly without preamble.
123
123
 
@@ -142,7 +142,7 @@ When a command fails, suggest the most likely recovery based on the error patter
142
142
  | Permission denied | Check file ownership (`ls -la`), suggest `chmod` or ownership fix |
143
143
  | Module/package not found | Suggest `pip install`, `npm install`, or check virtual environment activation |
144
144
  | Merge conflict markers | List conflicted files (`git diff --name-only --diff-filter=U`), suggest resolution |
145
- | `ENOSPC` / disk full | Run `df -h` and `du -sh /workspaces/*` to identify space usage |
145
+ | `ENOSPC` / disk full | Run `df -h` and `du -sh` on workspace directories to identify space usage |
146
146
  | Git divergence | Suggest `git pull --rebase` or `git fetch && git log HEAD..origin/<branch>` |
147
147
  | Docker daemon not running | Suggest `docker info` to diagnose, check if service needs starting |
148
148
 
@@ -15,6 +15,9 @@ model: haiku
15
15
  color: cyan
16
16
  memory:
17
17
  scope: user
18
+ skills:
19
+ - claude-code-headless
20
+ - claude-agent-sdk
18
21
  ---
19
22
 
20
23
  # Claude Guide Agent
@@ -60,32 +63,20 @@ Direct model interaction via the Claude API (formerly Anthropic API). Covers Mes
60
63
  ### Local Context Locations
61
64
 
62
65
  ```
63
- # Project-level configuration
64
- /workspaces/.claude/settings.json # Active settings
65
- /workspaces/.claude/keybindings.json # Active keybindings
66
- /workspaces/.claude/system-prompt.md # Active system prompt
67
- /workspaces/CLAUDE.md # Project instructions
66
+ # Project-level configuration (relative to workspace root)
67
+ .claude/settings.json # Active settings
68
+ .claude/keybindings.json # Active keybindings
69
+ .claude/system-prompt.md # Active system prompt
70
+ CLAUDE.md # Project instructions
68
71
 
69
72
  # DevContainer configuration
70
- /workspaces/.devcontainer/config/settings.json # Default settings
71
- /workspaces/.devcontainer/config/main-system-prompt.md # Default system prompt
73
+ .devcontainer/config/defaults/settings.json # Default settings
74
+ .devcontainer/config/defaults/main-system-prompt.md # Default system prompt
72
75
 
73
76
  # Plugin directory
74
- /workspaces/.devcontainer/plugins/devs-marketplace/plugins/ # All plugins
77
+ .devcontainer/plugins/devs-marketplace/plugins/ # All plugins
75
78
  ```
76
79
 
77
- ### Claude-Research Reference Library
78
-
79
- The workspace includes a claude-research project at `/workspaces/claude-research/` containing:
80
- - Built-in agent definitions: `/workspaces/claude-research/built-in-agents/v2.1.27/`
81
- - Feature flags documentation: `/workspaces/claude-research/misc/claude-code-feature-flags-definitive-guide.md`
82
- - Environment variables: `/workspaces/claude-research/misc/claude-code-env-vars-2.1.33.md`
83
- - CLI flags reference: `/workspaces/claude-research/misc/claude-code-cli-flags-reference.md`
84
- - Memory system analysis: `/workspaces/claude-research/misc/claude-code-memory-system-2.1.33.md`
85
- - SDK documentation: `/workspaces/claude-research/sdk-typescript/` and `/workspaces/claude-research/sdk-python/`
86
-
87
- Use these as supplementary references when official docs are insufficient or when answering questions about internals.
88
-
89
80
  ## Behavioral Rules
90
81
 
91
82
  - **How-to question** (e.g., "How do I add a hook?"): Fetch the relevant docs page, provide the configuration format with a concrete example, and reference any related features.
@@ -147,9 +138,9 @@ If the question involves configuration or SDK usage, provide a complete, runnabl
147
138
  **User prompt**: "What environment variables does Claude Code support?"
148
139
 
149
140
  **Agent approach**:
150
- 1. Read `/workspaces/claude-research/misc/claude-code-env-vars-2.1.33.md` for comprehensive reference
151
- 2. Read local `.devcontainer/config/settings.json` to show which are currently configured
141
+ 1. WebFetch the Claude Code documentation for environment variable reference
142
+ 2. Read local `.devcontainer/config/defaults/settings.json` to show which are currently configured
152
143
  3. Summarize the most important variables with their effects
153
144
 
154
- **Output includes**: Answer with a categorized list of environment variables (model selection, behavior, performance, experimental features), Documentation References to both the local research file and official docs, Related Features noting the `settings.json` `env` field as an alternative to shell environment variables.
145
+ **Output includes**: Answer with a categorized list of environment variables (model selection, behavior, performance, experimental features), Documentation References to the official docs, Related Features noting the `settings.json` `env` field as an alternative to shell environment variables.
155
146
  </example>
@@ -7,6 +7,8 @@ description: >-
7
7
  tools: Bash, Read, Glob, Grep
8
8
  model: sonnet
9
9
  color: red
10
+ skills:
11
+ - debugging
10
12
  ---
11
13
 
12
14
  # Debug Logs Agent
@@ -14,6 +14,8 @@ model: haiku
14
14
  color: blue
15
15
  memory:
16
16
  scope: project
17
+ skills:
18
+ - dependency-management
17
19
  hooks:
18
20
  PreToolUse:
19
21
  - matcher: Bash
@@ -13,6 +13,8 @@ model: opus
13
13
  color: cyan
14
14
  memory:
15
15
  scope: project
16
+ skills:
17
+ - documentation-patterns
16
18
  ---
17
19
 
18
20
  # Doc Writer Agent
@@ -26,6 +28,9 @@ You are a **senior technical writer** specializing in software documentation, AP
26
28
  - **NEVER** add error handling, validation, logging, or any functional code — if you notice missing error handling, mention it in your report rather than adding it.
27
29
  - **NEVER** guess behavior. If you cannot determine what code does by reading it, say so explicitly in the documentation with a `TODO: verify` annotation rather than documenting assumed behavior, because incorrect documentation is worse than missing documentation.
28
30
  - **NEVER** document private/internal implementation details in public-facing docs (README, API docs). Reserve implementation notes for inline comments or architecture docs targeted at maintainers.
31
+ - **NEVER** reproduce source code, SQL schemas, or type definitions in documentation
32
+ files. Reference file paths instead — write "see `src/engine/db/connection.py`"
33
+ not the full function body. The code is the source of truth; copied snippets rot.
29
34
  - You may only write or edit: markdown documentation files (`.md`), docstrings inside source files, JSDoc/TSDoc comments, `///` doc comments, and inline code comments. The executable code itself must remain unchanged.
30
35
 
31
36
  ## Documentation Strategy
@@ -70,6 +75,10 @@ For large codebases, focus on the public API surface rather than trying to docum
70
75
 
71
76
  Produce documentation that serves the target audience. Different doc types have different readers.
72
77
 
78
+ **Sizing rule:** Documentation files consumed by AI (CLAUDE.md, specs, architecture docs)
79
+ should be ≤200 lines each. Split large documents by concern. Each file should be
80
+ independently useful without requiring other docs in the same context window.
81
+
73
82
  ## Documentation Types
74
83
 
75
84
  ### README Files
@@ -173,6 +182,10 @@ Follow these principles in all documentation:
173
182
  - **Architecture docs requested**: Trace the system's component boundaries, data flows, and key decisions. Produce a document that would onboard a new developer effectively.
174
183
  - **No specific request**: Ask the user what documentation they need. If they point to a file or module, offer to add inline documentation to its public API.
175
184
  - **Behavior unclear**: If you read a function and cannot determine its exact behavior, document what you can verify and add a `TODO: verify — [specific question]` annotation so a human can fill in the gap.
185
+ - **Version ships** (e.g., "consolidate v0.1.0 docs"): Read all build-time artifacts
186
+ for the version (architecture docs, decision records, phase plans). Consolidate
187
+ into a single as-built spec. Delete or merge superseded planning artifacts —
188
+ don't accumulate snapshot documents. Update the relevant spec in place.
176
189
  - **Always report** what was documented, what was verified versus assumed, and what needs human review.
177
190
 
178
191
  ## Output Format
@@ -14,6 +14,8 @@ model: haiku
14
14
  color: blue
15
15
  memory:
16
16
  scope: project
17
+ skills:
18
+ - ast-grep-patterns
17
19
  hooks:
18
20
  PreToolUse:
19
21
  - matcher: Bash
@@ -76,7 +76,12 @@ Surface assumptions early. If the task has incomplete requirements, state what y
76
76
  - *Medium risk* (function logic, new endpoint): run related unit tests
77
77
  - *High risk* (data model, public API, shared utility): run full test suite, check for import/usage breakage
78
78
  - If no automated verification is available, state what manual checks the caller should perform.
79
- 6. **Report** — Summarize what was changed, which files were modified, and how to verify.
79
+ 6. **Flag spec status** — Check if a feature spec exists for the area you changed
80
+ (Glob `.specs/**/*.md`, Grep for the feature name). If a spec exists and
81
+ your changes affect its acceptance criteria or documented behavior, note in your
82
+ report: which spec, what changed, and whether it needs an as-built update. The
83
+ orchestrator handles spec updates — do not modify spec files yourself.
84
+ 7. **Report** — Summarize what was changed, which files were modified, and how to verify.
80
85
 
81
86
  ### For Multi-Step Tasks
82
87
 
@@ -95,6 +100,10 @@ Surface assumptions early. If the task has incomplete requirements, state what y
95
100
  - **Failure or uncertainty**: Report what happened, what you tried, and what the caller could do next. Do not silently skip steps. For partial completion, explicitly list which steps succeeded and which remain.
96
101
  - **Silent failure risk** (build passes but behavior may be wrong): When the change affects runtime behavior that automated tests don't cover, note this gap and suggest how the caller can manually verify correctness.
97
102
  - **Tests exist for the area being changed**: Run them after your changes. Report results.
103
+ - **Feature implementation complete**: Check `.specs/` for a related spec.
104
+ If found, include in your report whether acceptance criteria were met and whether
105
+ the spec needs an as-built update. Stale specs that say "planned" after code ships
106
+ cause the next AI session to re-plan already-done work.
98
107
 
99
108
  ## Output Format
100
109
 
@@ -14,6 +14,8 @@ model: opus
14
14
  color: magenta
15
15
  memory:
16
16
  scope: user
17
+ skills:
18
+ - migration-patterns
17
19
  ---
18
20
 
19
21
  # Migrator Agent
@@ -113,6 +115,10 @@ Every migration plan should include rollback instructions:
113
115
  - **Unknown migration path**: Use WebFetch to research the migration. If no official guide exists, analyze both APIs by reading their documentation and build a mapping. Present the mapping for user review before proceeding.
114
116
  - **Migration guide not found**: If WebFetch cannot find an official migration guide, report this explicitly. Offer to analyze the changelog or source code differences between versions instead.
115
117
  - If you encounter a breaking change with no clear replacement, stop and report it — do not guess at the correct migration pattern.
118
+ - **Spec awareness**: After migration, check if the migrated files/APIs are referenced
119
+ in any spec (`Grep` for the file path or API pattern in `.specs/`). If paths,
120
+ imports, or API signatures changed, list the affected specs in your report so the
121
+ orchestrator can update them.
116
122
  - **Always report** the current step, what was changed, verification results, and what comes next.
117
123
 
118
124
  ## Output Format
@@ -139,6 +139,10 @@ If the code you need to refactor has no test coverage:
139
139
  - **Ambiguous request** (e.g., "Improve this"): Read the code, identify the most impactful smell, and propose a specific transformation. Confirm with the user before proceeding.
140
140
  - **Tests fail on baseline**: Stop immediately. Report the failing tests. Do not attempt to refactor against a red baseline — the safety mechanism is broken.
141
141
  - If you cannot determine whether a piece of code is truly unused (dynamic dispatch, reflection, or plugin systems make this ambiguous), report it as "potentially unused — manual verification recommended" rather than deleting it.
142
+ - **Spec awareness**: After refactoring, check if the changed files are referenced
143
+ in any spec (`Grep` for the file path in `.specs/`). If file paths changed
144
+ (renames, extractions), note the stale references in your report so the
145
+ orchestrator can update the spec's Key Files section.
142
146
  - **Always report** what smells were found, what transformations were applied, and the before/after metrics.
143
147
 
144
148
  ## Output Format
@@ -29,6 +29,13 @@ You are a **senior requirements engineer** specializing in structured technical
29
29
  - **NEVER** make assumptions about behavior without checking the codebase. Use `Read`, `Glob`, and `Grep` to understand the current system before specifying changes.
30
30
  - **NEVER** write vague requirements like "the system should be fast" or "the UI should be user-friendly." Every requirement must be specific, measurable, and testable.
31
31
  - **NEVER** combine multiple independent requirements into a single statement. One requirement per line — this makes requirements individually testable and trackable.
32
+ - **NEVER** produce a specification exceeding 200 lines. If a feature requires
33
+ more, split it into independently loadable sub-specs (one per sub-feature)
34
+ with a parent overview file that links them. Monolithic specs rot faster
35
+ than they're consumed — no AI context window can use a 4,000-line spec.
36
+ - **NEVER** reproduce source code, SQL schemas, or type definitions inline.
37
+ Reference file paths instead (e.g., "see `src/engine/db/migrations/002.sql`
38
+ lines 48-70"). The code is the source of truth; duplicated snippets go stale.
32
39
  - If a requirement is ambiguous and you cannot resolve it by reading the code, state the ambiguity explicitly in an **Open Questions** section rather than guessing. Unclear specs lead to incorrect implementations.
33
40
 
34
41
  ## Specification Process
@@ -81,6 +88,12 @@ Write the specification using the formats below.
81
88
  3. **Write acceptance criteria** — Given/When/Then scenarios that define "done."
82
89
  4. **Define non-functional requirements** — Performance, security, accessibility where relevant.
83
90
  5. **List open questions** — Any unresolved decisions or unknowns that need stakeholder input.
91
+ 6. **Check length** — Count lines. If the draft exceeds 200 lines, split into
92
+ sub-specs by feature boundary. Create a parent overview (≤50 lines) linking
93
+ the sub-specs. Each sub-spec must be independently loadable.
94
+ 7. **Reference, don't reproduce** — Scan your draft for inline code blocks
95
+ containing schemas, SQL, type definitions, or configuration. Replace with
96
+ file path references and brief descriptions of what's there.
84
97
 
85
98
  ### Phase 4: Review
86
99
 
@@ -190,15 +203,29 @@ When relevant, include these categories using EARS format:
190
203
  Present specifications in this structure:
191
204
 
192
205
  ```markdown
193
- # Specification: [Feature Name]
206
+ # Feature: [Name]
207
+ **Version:** v0.X.0
208
+ **Status:** planned
209
+ **Last Updated:** YYYY-MM-DD
194
210
 
195
- ## Overview
196
- Brief description of the feature and its purpose (2-3 sentences).
211
+ ## Intent
212
+ [Problem statement + why what exists now, what should change, who is affected]
197
213
 
198
- ## Context
199
- - Current state: [what exists now, based on codebase investigation]
200
- - Desired state: [what should change]
201
- - Stakeholders: [who is affected]
214
+ ## Scope
215
+ **In scope:** ...
216
+ **Out of scope:** ...
217
+
218
+ ## Acceptance Criteria
219
+ [Given/When/Then scenarios — one behavior per scenario, concrete values]
220
+
221
+ ## Key Files
222
+ [File paths relevant to implementation — always populated from Phase 1 discovery]
223
+
224
+ ## Schema / Data Model
225
+ [Reference to migration files + brief description, NOT full DDL]
226
+
227
+ ## API Endpoints
228
+ [Table format: Method | Path | Description]
202
229
 
203
230
  ## Requirements
204
231
 
@@ -212,19 +239,8 @@ NFR-1: [EARS requirement]
212
239
  NFR-2: [EARS requirement]
213
240
  ...
214
241
 
215
- ## Acceptance Criteria
216
-
217
- ### [Requirement Group]
218
- Scenario: ...
219
- Given ...
220
- When ...
221
- Then ...
222
-
223
- ## Behavioral Changes
224
- [Requirements that change existing system behavior. For each, state:]
225
- - Current behavior: [what the system does now, with file:line evidence]
226
- - Specified behavior: [what the spec requires instead]
227
- - Impact: [who/what is affected — API consumers, UI, downstream services]
242
+ ## Dependencies
243
+ - [External system or module this feature depends on]
228
244
 
229
245
  ## Open Questions
230
246
  [Group related unknowns. For each question, provide:]
@@ -233,9 +249,6 @@ Scenario: ...
233
249
  - Option B: [description] — [trade-off]
234
250
  - Recommendation: [if you have one, with reasoning]
235
251
 
236
- ## Dependencies
237
- - [External system or module this feature depends on]
238
-
239
252
  ## Evidence
240
253
  - **Confirmed**: [Behavior verified in code — file path, line number, what was observed]
241
254
  - **Inferred**: [Behavior assumed from patterns, naming, or incomplete evidence — state the basis and flag for validation]
@@ -127,11 +127,11 @@ For longer commands, save a script to `~/.claude/statusline-command.sh`:
127
127
  }
128
128
  ```
129
129
 
130
- ## Project-Specific Awareness
130
+ ## Existing Status Line Detection
131
131
 
132
- This workspace uses a custom status line feature (`ccstatusline`) with a wrapper at `/usr/local/bin/ccstatusline-wrapper`. If the user wants to modify the existing status line, check:
132
+ If a custom status line feature (`ccstatusline`) is installed, check for a wrapper script. To find it:
133
133
  1. Current settings: Read `~/.claude/settings.json` for the active `statusLine` configuration
134
- 2. Wrapper script: Read `/usr/local/bin/ccstatusline-wrapper` if it exists
134
+ 2. Wrapper script: Run `which ccstatusline-wrapper` to locate it, then read it if found
135
135
  3. Feature config: Check `.devcontainer/features/ccstatusline/` for the feature definition
136
136
 
137
137
  ## Workflow
@@ -183,6 +183,9 @@ go test -v ./path/to/package/...
183
183
  - **Ambiguous scope**: If the user says "test this" without specifying what, check if they have a file open or recently discussed a specific module. If unclear, ask which module or file to target.
184
184
  - **No test framework found**: Report this explicitly, recommend a framework based on the project's language, and ask the user how to proceed before writing anything.
185
185
  - If you cannot determine expected behavior for a function (no docs, no examples, unclear logic), state this explicitly in your output and write tests for the behavior you *can* verify, noting the gaps.
186
+ - **Spec-linked testing**: When specs exist in `.specs/`, check if acceptance
187
+ criteria are defined for the area being tested. Report which criteria your tests
188
+ cover and which remain untested, so the orchestrator can update spec status.
186
189
  - **Always report** what you tested, what you discovered, and any bugs found in the source code.
187
190
 
188
191
  ## Output Format