liteagents 3.0.0 → 3.5.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 (154) hide show
  1. package/CHANGELOG.md +122 -1
  2. package/README.md +113 -169
  3. package/installer/cli.js +4 -2
  4. package/package.json +4 -3
  5. package/packages/ampcode/AGENT.md +10 -18
  6. package/packages/ampcode/agents/code-developer.md +11 -17
  7. package/packages/ampcode/agents/orchestrator.md +1 -1
  8. package/packages/ampcode/agents/quality-assurance.md +3 -1
  9. package/packages/ampcode/{commands/brainstorming.md → skills/brainstorming/SKILL.md} +2 -3
  10. package/packages/ampcode/{commands/branch-review.md → skills/branch-review/SKILL.md} +13 -13
  11. package/packages/{claude/commands/docs-builder.md → ampcode/skills/docs-builder/SKILL.md} +1 -1
  12. package/packages/ampcode/{commands/live-canvas.md → skills/live-canvas/SKILL.md} +8 -4
  13. package/packages/ampcode/{commands/refactor.md → skills/refactor/SKILL.md} +49 -7
  14. package/packages/ampcode/{commands/release.md → skills/release/SKILL.md} +4 -4
  15. package/packages/{claude/commands → ampcode/skills}/remember/AGENT_RULES.md +44 -84
  16. package/packages/ampcode/{commands/remember.md → skills/remember/SKILL.md} +11 -6
  17. package/packages/ampcode/{commands → skills}/remember/friction.cjs +0 -0
  18. package/packages/ampcode/{commands → skills}/remember/stub-check.cjs +28 -19
  19. package/packages/ampcode/{commands → skills}/remember/sync-rules.cjs +28 -19
  20. package/packages/{claude/commands → ampcode/skills}/remember/version-check.cjs +1 -1
  21. package/packages/ampcode/skills/root-cause/SKILL.md +220 -0
  22. package/packages/ampcode/{commands/trace-back → skills/root-cause}/find-polluter.sh +0 -0
  23. package/packages/{claude/commands/security.md → ampcode/skills/security/SKILL.md} +1 -1
  24. package/packages/{claude/commands/ship.md → ampcode/skills/ship/SKILL.md} +1 -1
  25. package/packages/ampcode/skills/skill-creator/LICENSE.txt +202 -0
  26. package/packages/ampcode/{commands/skill-creator.md → skills/skill-creator/SKILL.md} +1 -2
  27. package/packages/ampcode/{commands → skills}/skill-creator/scripts/init_skill.py +0 -0
  28. package/packages/ampcode/{commands → skills}/skill-creator/scripts/package_skill.py +0 -0
  29. package/packages/ampcode/{commands → skills}/skill-creator/scripts/quick_validate.py +0 -0
  30. package/packages/ampcode/{commands/stash.md → skills/stash/SKILL.md} +2 -1
  31. package/packages/{claude/commands/test-generate.md → ampcode/skills/test-generate/SKILL.md} +2 -2
  32. package/packages/ampcode/variants.json +2 -2
  33. package/packages/claude/CLAUDE.md +10 -17
  34. package/packages/claude/agents/code-developer.md +11 -17
  35. package/packages/claude/agents/orchestrator.md +2 -3
  36. package/packages/claude/agents/quality-assurance.md +3 -1
  37. package/packages/claude/skills/brainstorming/SKILL.md +1 -2
  38. package/packages/claude/{commands/branch-review.md → skills/branch-review/SKILL.md} +1 -1
  39. package/packages/{ampcode/commands/docs-builder.md → claude/skills/docs-builder/SKILL.md} +7 -7
  40. package/packages/claude/skills/live-canvas/SKILL.md +5 -1
  41. package/packages/claude/{commands/refactor.md → skills/refactor/SKILL.md} +45 -3
  42. package/packages/claude/{commands/release.md → skills/release/SKILL.md} +1 -1
  43. package/packages/{ampcode/commands → claude/skills}/remember/AGENT_RULES.md +38 -78
  44. package/packages/claude/{commands/remember.md → skills/remember/SKILL.md} +11 -6
  45. package/packages/claude/{commands → skills}/remember/friction.cjs +0 -0
  46. package/packages/claude/{commands → skills}/remember/stub-check.cjs +28 -19
  47. package/packages/claude/{commands → skills}/remember/sync-rules.cjs +28 -19
  48. package/packages/{ampcode/commands → claude/skills}/remember/version-check.cjs +3 -3
  49. package/packages/claude/skills/root-cause/SKILL.md +220 -0
  50. package/packages/{ampcode/commands/security.md → claude/skills/security/SKILL.md} +2 -2
  51. package/packages/{ampcode/commands/ship.md → claude/skills/ship/SKILL.md} +2 -2
  52. package/packages/claude/skills/skill-creator/SKILL.md +1 -2
  53. package/packages/claude/{commands/stash.md → skills/stash/SKILL.md} +2 -1
  54. package/packages/{ampcode/commands/test-generate.md → claude/skills/test-generate/SKILL.md} +3 -3
  55. package/packages/claude/variants.json +1 -2
  56. package/packages/droid/AGENTS.md +10 -15
  57. package/packages/droid/commands/brainstorming.md +1 -4
  58. package/packages/droid/commands/branch-review.md +11 -14
  59. package/packages/droid/commands/docs-builder.md +0 -3
  60. package/packages/droid/commands/live-canvas.md +7 -5
  61. package/packages/droid/commands/refactor.md +47 -8
  62. package/packages/droid/commands/release.md +2 -5
  63. package/packages/droid/commands/remember/AGENT_RULES.md +38 -78
  64. package/packages/droid/commands/remember/stub-check.cjs +28 -19
  65. package/packages/droid/commands/remember/sync-rules.cjs +28 -19
  66. package/packages/droid/commands/remember/version-check.cjs +1 -1
  67. package/packages/droid/commands/remember.md +6 -4
  68. package/packages/droid/commands/root-cause.md +218 -0
  69. package/packages/droid/commands/security.md +0 -3
  70. package/packages/droid/commands/ship.md +0 -3
  71. package/packages/droid/commands/skill-creator/LICENSE.txt +202 -0
  72. package/packages/droid/commands/skill-creator.md +0 -4
  73. package/packages/droid/commands/stash.md +0 -2
  74. package/packages/droid/commands/test-generate.md +1 -4
  75. package/packages/droid/droids/1-create-prd.md +6 -2
  76. package/packages/droid/droids/2-generate-tasks.md +1 -2
  77. package/packages/droid/droids/3-process-task-list.md +1 -2
  78. package/packages/droid/droids/code-developer.md +12 -19
  79. package/packages/droid/droids/feature-planner.md +1 -2
  80. package/packages/droid/droids/market-researcher.md +1 -2
  81. package/packages/droid/droids/orchestrator.md +1 -2
  82. package/packages/droid/droids/quality-assurance.md +4 -3
  83. package/packages/droid/droids/system-architect.md +1 -2
  84. package/packages/droid/droids/ui-designer.md +1 -2
  85. package/packages/opencode/AGENTS.md +10 -15
  86. package/packages/opencode/agent/code-developer.md +11 -17
  87. package/packages/opencode/agent/quality-assurance.md +3 -1
  88. package/packages/opencode/command/brainstorming.md +1 -4
  89. package/packages/opencode/command/branch-review.md +11 -15
  90. package/packages/opencode/command/docs-builder.md +0 -4
  91. package/packages/opencode/command/live-canvas.md +7 -5
  92. package/packages/opencode/command/refactor.md +47 -9
  93. package/packages/opencode/command/release.md +2 -5
  94. package/packages/opencode/command/remember/AGENT_RULES.md +38 -78
  95. package/packages/opencode/command/remember/stub-check.cjs +28 -19
  96. package/packages/opencode/command/remember/sync-rules.cjs +28 -19
  97. package/packages/opencode/command/remember/version-check.cjs +1 -1
  98. package/packages/opencode/command/remember.md +6 -4
  99. package/packages/opencode/command/root-cause.md +218 -0
  100. package/packages/opencode/command/security.md +0 -4
  101. package/packages/opencode/command/ship.md +0 -3
  102. package/packages/opencode/command/skill-creator/LICENSE.txt +202 -0
  103. package/packages/opencode/command/skill-creator.md +0 -4
  104. package/packages/opencode/command/stash.md +0 -3
  105. package/packages/opencode/command/test-generate.md +1 -5
  106. package/packages/opencode/opencode.jsonc +4 -24
  107. package/packages/subagentic-manual.md +147 -314
  108. package/packages/ampcode/commands/debug-method.md +0 -297
  109. package/packages/ampcode/commands/live-canvas/README.md +0 -264
  110. package/packages/ampcode/commands/optimize.md +0 -61
  111. package/packages/ampcode/commands/tdd-flow.md +0 -390
  112. package/packages/ampcode/commands/test-traps/example.ts +0 -158
  113. package/packages/ampcode/commands/test-traps.md +0 -378
  114. package/packages/ampcode/commands/trace-back.md +0 -176
  115. package/packages/ampcode/commands/verify-done.md +0 -152
  116. package/packages/claude/commands/optimize.md +0 -61
  117. package/packages/claude/plugins/live-canvas-marketplace/plugins/live-canvas-channel/README.md +0 -89
  118. package/packages/claude/skills/debug-method/CREATION-LOG.md +0 -119
  119. package/packages/claude/skills/debug-method/SKILL.md +0 -296
  120. package/packages/claude/skills/debug-method/test-academic.md +0 -14
  121. package/packages/claude/skills/debug-method/test-pressure-1.md +0 -58
  122. package/packages/claude/skills/debug-method/test-pressure-2.md +0 -68
  123. package/packages/claude/skills/debug-method/test-pressure-3.md +0 -69
  124. package/packages/claude/skills/live-canvas/README.md +0 -269
  125. package/packages/claude/skills/tdd-flow/SKILL.md +0 -392
  126. package/packages/claude/skills/test-traps/SKILL.md +0 -378
  127. package/packages/claude/skills/test-traps/example.ts +0 -158
  128. package/packages/claude/skills/trace-back/SKILL.md +0 -176
  129. package/packages/claude/skills/verify-done/SKILL.md +0 -152
  130. package/packages/droid/commands/debug-method.md +0 -297
  131. package/packages/droid/commands/live-canvas/README.md +0 -264
  132. package/packages/droid/commands/optimize.md +0 -61
  133. package/packages/droid/commands/tdd-flow.md +0 -390
  134. package/packages/droid/commands/test-traps/example.ts +0 -158
  135. package/packages/droid/commands/test-traps.md +0 -378
  136. package/packages/droid/commands/trace-back.md +0 -176
  137. package/packages/droid/commands/verify-done.md +0 -152
  138. package/packages/opencode/command/debug-method.md +0 -297
  139. package/packages/opencode/command/live-canvas/README.md +0 -264
  140. package/packages/opencode/command/optimize.md +0 -61
  141. package/packages/opencode/command/tdd-flow.md +0 -390
  142. package/packages/opencode/command/test-traps/example.ts +0 -158
  143. package/packages/opencode/command/test-traps.md +0 -378
  144. package/packages/opencode/command/trace-back.md +0 -176
  145. package/packages/opencode/command/verify-done.md +0 -152
  146. /package/packages/ampcode/{commands → skills}/docs-builder/docs-builder.cjs +0 -0
  147. /package/packages/ampcode/{commands → skills}/live-canvas/DESIGN_PRINCIPLES.md +0 -0
  148. /package/packages/ampcode/{commands → skills}/live-canvas/dev/post-variants.html +0 -0
  149. /package/packages/ampcode/{commands → skills}/live-canvas/templates/lab-banner.html +0 -0
  150. /package/packages/ampcode/{commands → skills}/live-canvas/templates/overlay-vanilla.js +0 -0
  151. /package/packages/claude/{commands → skills}/docs-builder/docs-builder.cjs +0 -0
  152. /package/packages/claude/skills/{trace-back → root-cause}/find-polluter.sh +0 -0
  153. /package/packages/droid/commands/{trace-back → root-cause}/find-polluter.sh +0 -0
  154. /package/packages/opencode/command/{trace-back → root-cause}/find-polluter.sh +0 -0
@@ -1,264 +0,0 @@
1
- # Live Canvas
2
-
3
- Click-to-annotate UI design tool for Claude Code. Renders N variants of a component or page in your browser, you click an element and type what to change, and Claude edits the variant file while you watch in the browser. No window switching, no pasted JSON.
4
-
5
- Ships as a Claude Code skill plus an MCP channel plugin. Works in every tool liteagents supports (Claude, Droid, Amp, Opencode), but **Live mode only works in Claude Code** — other tools run in JSON mode only (see modes below).
6
-
7
- ---
8
-
9
- ## How it works
10
-
11
- ```
12
- ┌──────────────────────┐ POST /feedback ┌─────────────────────┐
13
- │ Overlay in browser │ ─────────────────────────► │ live-canvas-channel │
14
- │ (vanilla JS, ~500 lines)│ │ (Node MCP server) │
15
- └──────────────────────┘ └──────────┬──────────┘
16
- ▲ │
17
- │ dev server hot-reloads the page │ notifications/
18
- │ after Claude edits the variant │ claude/channel
19
- │ ▼
20
- ┌──────────────────────┐ ┌─────────────────────┐
21
- │ Dev server (yours) │ ◄──── Claude edits ─────── │ Claude Code session │
22
- │ e.g. pnpm dev :3000 │ variant file │ (with --dangerously-│
23
- └──────────────────────┘ │ load-development- │
24
- │ channels flag) │
25
- └─────────────────────┘
26
- ```
27
-
28
- Each Save in the overlay streams into the Claude session as a `<channel>` tag with the variant, element selector, and user comment. Claude edits the corresponding `.claude-design/lab/variants/Variant<X>.tsx` file. Your dev server hot-reloads. You never leave the browser.
29
-
30
- ---
31
-
32
- ## Modes
33
-
34
- The skill asks you which mode you want every time `/live-canvas` runs.
35
-
36
- | Mode | Use when | What happens per Save |
37
- |---|---|---|
38
- | **Live** | You launched the session with `live-claude` and the channel is up | Comment streams into Claude's context; Claude edits the file; dev server hot-reloads. Toast: "Pushed to Claude ✨". |
39
- | **JSON** | Any session, any tool (Claude, Droid, Amp, Opencode) | Comment stays local. On Finish/Submit it writes JSONL (or downloads the file if no endpoint). User pastes or says "check" in the CLI to have the assistant act on the whole batch. |
40
-
41
- If you pick Live but the channel doesn't answer, the skill stops and tells you to relaunch with `live-claude` (or fall back to JSON). It doesn't silently downgrade — the user always gets to choose.
42
-
43
- ---
44
-
45
- ## One-time setup (Live mode, Claude Code only)
46
-
47
- Run this once per machine. Without it, the skill still works in JSON mode.
48
-
49
- ### 1. Run the installer
50
-
51
- ```bash
52
- bash packages/claude/plugins/live-canvas-marketplace/setup.sh
53
- ```
54
-
55
- The installer:
56
- - copies the marketplace into `~/.claude/plugins/live-canvas-marketplace/` (overwrites any prior install)
57
- - runs `npm install` inside the channel plugin
58
- - adds a `live-claude` shell function to `~/.zshrc` and `~/.bashrc` (idempotent — re-runs replace in place)
59
-
60
- ### 2. Register the marketplace in Claude Code
61
-
62
- ```
63
- /plugin marketplace add ~/.claude/plugins/live-canvas-marketplace
64
- ```
65
-
66
- ### 3. Install the plugin
67
-
68
- ```
69
- /plugin install live-canvas-channel@live-canvas-marketplace
70
- ```
71
-
72
- ### 4. Open a fresh shell
73
-
74
- `live-claude` is now available. Use plain `claude` for everything else; use `live-claude` when you want Live mode for this skill.
75
-
76
- ---
77
-
78
- ## Everyday use
79
-
80
- ### Start a session
81
-
82
- Either `claude` (JSON only) or `live-claude` (Live available).
83
-
84
- ### Invoke the skill in a project
85
-
86
- ```
87
- /live-canvas
88
- ```
89
-
90
- Phase 0 always asks which mode you want — Live channel or JSON file — then probes the channel if you picked Live:
91
-
92
- | Choice | Channel up? | Skill behavior |
93
- |---|---|---|
94
- | Live | yes | Announces Live mode, starts the interview |
95
- | Live | no | Tells you to relaunch with `live-claude` (or fall back to JSON) |
96
- | JSON | n/a | Announces JSON mode, starts the interview |
97
-
98
- ### Interview & generation
99
-
100
- Skill asks 5 short questions (scope, pain points, inspiration, persona, constraints). Then generates 5 variants in `.claude-design/lab/variants/` and wires a route at `/__live_canvas` in your app.
101
-
102
- ### Iterate in the browser
103
-
104
- Open `http://localhost:<dev-port>/__live_canvas`. Click **Add Feedback** (bottom right), click any element in any variant, type a one-liner, Save.
105
-
106
- - Live mode: toast says "Pushed to Claude ✨", Claude acknowledges and edits the file, dev server hot-reloads.
107
- - JSON mode: toast says "Saved — submit when ready", pin stays on the element, counter in the Submit button ticks up.
108
-
109
- Need the page back? The overlay has a "−" button next to **Add Feedback** that collapses everything to a small circle in the corner — tap to expand again. Useful on mobile where the bar can cover what's underneath.
110
-
111
- Keep clicking until a winner emerges.
112
-
113
- ### Finish
114
-
115
- Click the pink **Finish** (Live) or **Submit** (JSON) button:
116
-
117
- 1. Type the overall direction: e.g. *"Go with B's layout, A's button styling"*
118
- 2. Click Finish
119
-
120
- Skill then:
121
- - Generates `DESIGN_PLAN.md` in project root (winner, files to change, component API, states, a11y checklist)
122
- - Updates or creates `DESIGN_MEMORY.md` with the patterns it learned
123
- - Deletes `.claude-design/` and the `/__live_canvas` route
124
-
125
- Done.
126
-
127
- ---
128
-
129
- ## Files and where they live
130
-
131
- ### In this repo (source)
132
-
133
- ```
134
- packages/claude/
135
- ├── skills/live-canvas/
136
- │ ├── SKILL.md # Skill instructions (phases, flow)
137
- │ ├── DESIGN_PRINCIPLES.md # UX/a11y/motion reference
138
- │ ├── README.md # This file
139
- │ ├── dev/post-variants.html # Standalone demo for local QA of the overlay
140
- │ └── templates/
141
- │ ├── overlay-vanilla.js # Framework-agnostic overlay (~500 lines)
142
- │ └── lab-banner.html # "This is a temp lab" notice snippet
143
- └── plugins/
144
- └── live-canvas-marketplace/
145
- ├── .claude-plugin/marketplace.json
146
- ├── setup.sh # Runs npm install and prints manual steps
147
- └── plugins/live-canvas-channel/
148
- ├── .claude-plugin/plugin.json
149
- ├── server.js # MCP server + HTTP listener on :8788
150
- ├── schema.json # Feedback payload schema (v1.0)
151
- ├── package.json # @modelcontextprotocol/sdk dep
152
- └── README.md # Plugin-specific docs (protocol, debug)
153
- ```
154
-
155
- ### On the user's disk after liteagents install
156
-
157
- ```
158
- ~/.claude/
159
- ├── skills/live-canvas/ # Copied from packages/claude/skills/
160
- └── plugins/live-canvas-marketplace/ # Copied from packages/claude/plugins/
161
- ```
162
-
163
- `node_modules/` is NOT copied — `setup.sh` creates it locally via `npm install`.
164
-
165
- ### After `/plugin install` (Claude Code's own register step)
166
-
167
- ```
168
- ~/.claude/plugins/cache/live-canvas-marketplace/ # Claude Code's registered copy
169
- ```
170
-
171
- Two different dirs:
172
- - `~/.claude/plugins/live-canvas-marketplace/` — where liteagents puts the source
173
- - `~/.claude/plugins/cache/live-canvas-marketplace/` — where Claude Code puts its own registered copy after `/plugin install`
174
-
175
- The skill checks the cache dir to tell first-time vs returning users apart.
176
-
177
- ### Per-project, during a session
178
-
179
- ```
180
- <project-root>/
181
- └── .claude-design/
182
- ├── lab/variants/VariantA.tsx … VariantE.tsx
183
- ├── overlay-vanilla.js (copied into the project's public/static dir)
184
- ├── design-brief.json # Structured output from the interview
185
- └── feedback.jsonl # JSON mode only; deleted on Finish
186
- ```
187
-
188
- Plus a temporary route (e.g. `app/__live_canvas/page.tsx` for Next.js App Router). Everything under `.claude-design/` and the temporary route is deleted on Finish or Abort.
189
-
190
- ### What survives after Finish
191
-
192
- ```
193
- <project-root>/
194
- ├── DESIGN_PLAN.md # Winner + implementation steps
195
- └── DESIGN_MEMORY.md # Accumulated design-system patterns
196
- ```
197
-
198
- ---
199
-
200
- ## The install pipeline, end to end
201
-
202
- 1. **Liteagents installer** copies the skill:
203
- - `packages/claude/skills/live-canvas/` → `~/.claude/skills/live-canvas/`
204
- 2. **User, once:** runs `bash packages/claude/plugins/live-canvas-marketplace/setup.sh` → copies marketplace to `~/.claude/plugins/`, runs `npm install`, adds `live-claude` function to `~/.zshrc` and `~/.bashrc`
205
- 3. **User, once:** in a Claude session, runs `/plugin marketplace add ~/.claude/plugins/live-canvas-marketplace` + `/plugin install live-canvas-channel@live-canvas-marketplace`
206
- 4. **User, every session that wants Live mode:** runs `live-claude` (function installed by step 2)
207
- 5. **User, whenever:** `/live-canvas` in any project
208
-
209
- Steps 1, 2, 3 are truly one-time. Step 4 is per-session. Step 5 is per-project-use.
210
-
211
- ---
212
-
213
- ## Troubleshooting
214
-
215
- ### Channel server starts but skill still routes to JSON
216
-
217
- Port 8788 is stuck from an earlier session's server process. Kill it:
218
-
219
- ```bash
220
- lsof -i :8788
221
- kill <pid>
222
- ```
223
-
224
- Then `/reload-plugins` in the new session.
225
-
226
- ### Skill says "No response on :8788" even though I set everything up
227
-
228
- Three common causes, in order of likelihood:
229
-
230
- 1. You didn't start this session with the dev flag. Close it, reopen with `live-claude`.
231
- 2. The plugin subprocess died on startup. In the session, run `/mcp` — look for `live-canvas` with its status. "Failed to connect" means a node/dep error: check `~/.claude/debug/<session-id>.txt` for the stderr.
232
- 3. You never ran step 2 of setup. Re-run `bash ~/.claude/plugins/live-canvas-marketplace/setup.sh`.
233
-
234
- ### Overlay loads in the browser but no pills appear
235
-
236
- The overlay script didn't load. Most common cause: you started the Python server inside the wrong directory so the relative `../templates/overlay-vanilla.js` path couldn't resolve. Start the server one level up and navigate with the `/dev/` prefix.
237
-
238
- ### "Pushed to Claude ✨" toast appears but nothing happens in the terminal
239
-
240
- Either (a) you're not in a dev-flag session, or (b) an older channel server process is answering on 8788 and is stdio-connected to a dead session. See the two troubleshooting items above.
241
-
242
- ### I want to uninstall
243
-
244
- 1. Remove the plugin from Claude Code: `/plugin uninstall live-canvas-channel`
245
- 2. Delete the marketplace: `/plugin marketplace remove live-canvas-marketplace`
246
- 3. Remove the dev flag from your alias/shortcut
247
- 4. Rerun liteagents installer in remove mode (or delete `~/.claude/skills/live-canvas/` and `~/.claude/plugins/live-canvas-marketplace/` by hand)
248
-
249
- ---
250
-
251
- ## Why the multi-step setup can't be hidden
252
-
253
- The `--dangerously-load-development-channels` flag is a per-session startup argument of Claude Code itself. A running session can't promote itself to channel-enabled mid-flight; only the next session launched with the flag gets it. Same reason a skill can't silently do `/plugin install` on your behalf — the plugin system needs explicit user consent for research-preview plugins.
254
-
255
- Until channels leave research preview and custom channels are allowlisted, step 4 is the irreducible friction. The alias removes the retyping cost.
256
-
257
- ---
258
-
259
- ## Pointers
260
-
261
- - Plugin details: [`~/.claude/plugins/live-canvas-marketplace/plugins/live-canvas-channel/README.md`](../../plugins/live-canvas-marketplace/plugins/live-canvas-channel/README.md)
262
- - Skill flow: [`SKILL.md`](./SKILL.md)
263
- - Design principles reference: [`DESIGN_PRINCIPLES.md`](./DESIGN_PRINCIPLES.md)
264
- - Channels reference (upstream): <https://code.claude.com/docs/en/channels-reference>
@@ -1,61 +0,0 @@
1
- ---
2
- name: optimize
3
- description: Optimize performance [target]
4
- usage: /optimize <target-area>
5
- argument-hint: [file-or-function]
6
- allowed-tools: Read, Edit, Grep, Glob, Bash(git diff *), Bash(git log *), Bash(git grep *), Bash(rg *)
7
- ---
8
- Analyze $ARGUMENTS for performance.
9
-
10
- ## Examine
11
- - Time complexity (Big O)
12
- - Space complexity
13
- - I/O operations
14
- - Database queries (N+1?)
15
- - Unnecessary allocations
16
-
17
- ## Output
18
- Per bottleneck:
19
- - **Location** (`file:line`)
20
- - **Cost** — what's slow and by how much. Concrete ("N+1 over ~1k rows on
21
- every page load"), not vague ("could be faster").
22
- - **Optimization** — specific change.
23
- - **Expected improvement** — order-of-magnitude estimate.
24
- - **Trade-offs** — readability / memory / consistency cost.
25
-
26
- ## After the analysis — verify, then fix
27
-
28
- Performance claims are easy to invent. Validate before acting.
29
-
30
- **Verify each bottleneck.** Re-read the cited `file:line` in context.
31
- Confirm the path is **actually hot** — look for at least one of:
32
- - a profile / benchmark / log line showing call frequency or duration,
33
- - the path sits on an obvious hot loop / per-request handler with real
34
- volume,
35
- - the user provided evidence in the request.
36
-
37
- Without one of those, the claim is **uncertain — don't optimize on
38
- speculation.** Mark each finding **confirmed**, **false positive** (with
39
- reason), or **uncertain (needs profiling data)**.
40
-
41
- **Fix what's confirmed and unambiguous** — minimal change, one obvious
42
- shape, **no behavior change**, no API change. Apply directly. After
43
- each edit, re-read the changed region and confirm it still computes the
44
- same answer (perf optimizations that quietly change semantics are the
45
- worst kind).
46
-
47
- **Stop and ask** when (HITL gates — not all the time, only here):
48
- - the bottleneck is **uncertain** after grounding (no profile / log and
49
- not obviously hot),
50
- - the fix has **multiple reasonable shapes** (cache vs precompute vs
51
- batch vs paginate vs index) — present options with tradeoffs, not a
52
- chosen path,
53
- - it changes **public API / response shape / DB schema / caller contract**,
54
- - it trades **correctness for speed** (lossy approximation, weaker
55
- consistency, eventual-vs-strict) — even when "obviously" faster, or
56
- - it touches **concurrency primitives** (locks, atomics, ordering) —
57
- easy to introduce races.
58
-
59
- Final report: **confirmed-and-fixed** · **confirmed-but-asking** (why +
60
- options) · **false-positive** (why) · **uncertain** (what profiling /
61
- data is needed to decide).