liteagents 2.4.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 (215) hide show
  1. package/CHANGELOG.md +441 -0
  2. package/LICENSE +21 -0
  3. package/README.md +179 -0
  4. package/cli.js +230 -0
  5. package/docs/.gitkeep +1 -0
  6. package/docs/CONTRIBUTING.md +739 -0
  7. package/docs/DUAL_PUBLISH_SUMMARY.md +177 -0
  8. package/docs/ERROR_HANDLING_IMPLEMENTATION.md +327 -0
  9. package/docs/GITHUB_PACKAGES.md +181 -0
  10. package/docs/GITHUB_SETUP.md +158 -0
  11. package/docs/INSTALLATION_DEMO.md +691 -0
  12. package/docs/INSTALLATION_LOCATIONS.md +299 -0
  13. package/docs/INSTALLER_GUIDE.md +1586 -0
  14. package/docs/INTEGRATION_ISSUES_9.1.md +341 -0
  15. package/docs/KNOWLEDGE_BASE.md +727 -0
  16. package/docs/MIGRATION.md +384 -0
  17. package/docs/PACKAGE_BASELINE.md +557 -0
  18. package/docs/PACKAGE_VALIDATION_REPORT.md +427 -0
  19. package/docs/PASS_INTEGRATION.md +307 -0
  20. package/docs/PASS_QUICK_START.md +150 -0
  21. package/docs/PRIVACY.md +203 -0
  22. package/docs/PUBLISHING.md +494 -0
  23. package/docs/QUICK-START.md +318 -0
  24. package/docs/RELEASE_NOTES_1.2.0.md +323 -0
  25. package/docs/SECURITY.md +317 -0
  26. package/docs/SILENT_MODE_GUIDE.md +526 -0
  27. package/docs/SKILLS_CONVERSION.md +154 -0
  28. package/docs/TESTING.md +582 -0
  29. package/docs/TEST_COVERAGE.md +347 -0
  30. package/docs/TROUBLESHOOTING.md +788 -0
  31. package/docs/UPDATED_VARIANT_CONFIGURATION.md +274 -0
  32. package/docs/VARIANT_CONFIGURATION.md +440 -0
  33. package/installer/cli.js +761 -0
  34. package/installer/installation-engine.js +1536 -0
  35. package/installer/package-manager.js +640 -0
  36. package/installer/path-manager.js +427 -0
  37. package/installer/report-template.js +298 -0
  38. package/installer/verification-system.js +274 -0
  39. package/package.json +83 -0
  40. package/packages/ampcode/AGENT.md +58 -0
  41. package/packages/ampcode/README.md +17 -0
  42. package/packages/ampcode/agents/1-create-prd.md +175 -0
  43. package/packages/ampcode/agents/2-generate-tasks.md +190 -0
  44. package/packages/ampcode/agents/3-process-task-list.md +225 -0
  45. package/packages/ampcode/agents/code-developer.md +198 -0
  46. package/packages/ampcode/agents/context-builder.md +142 -0
  47. package/packages/ampcode/agents/feature-planner.md +199 -0
  48. package/packages/ampcode/agents/market-researcher.md +89 -0
  49. package/packages/ampcode/agents/orchestrator.md +116 -0
  50. package/packages/ampcode/agents/quality-assurance.md +115 -0
  51. package/packages/ampcode/agents/system-architect.md +135 -0
  52. package/packages/ampcode/agents/ui-designer.md +184 -0
  53. package/packages/ampcode/commands/brainstorming.md +56 -0
  54. package/packages/ampcode/commands/code-review.md +107 -0
  55. package/packages/ampcode/commands/condition-based-waiting/example.ts +158 -0
  56. package/packages/ampcode/commands/condition-based-waiting.md +122 -0
  57. package/packages/ampcode/commands/debug.md +20 -0
  58. package/packages/ampcode/commands/docs-builder/templates.md +572 -0
  59. package/packages/ampcode/commands/docs-builder.md +106 -0
  60. package/packages/ampcode/commands/explain.md +18 -0
  61. package/packages/ampcode/commands/git-commit.md +14 -0
  62. package/packages/ampcode/commands/optimize.md +20 -0
  63. package/packages/ampcode/commands/refactor.md +21 -0
  64. package/packages/ampcode/commands/review.md +18 -0
  65. package/packages/ampcode/commands/root-cause-tracing/find-polluter.sh +63 -0
  66. package/packages/ampcode/commands/root-cause-tracing.md +176 -0
  67. package/packages/ampcode/commands/security.md +21 -0
  68. package/packages/ampcode/commands/ship.md +18 -0
  69. package/packages/ampcode/commands/skill-creator/scripts/init_skill.py +303 -0
  70. package/packages/ampcode/commands/skill-creator/scripts/package_skill.py +110 -0
  71. package/packages/ampcode/commands/skill-creator/scripts/quick_validate.py +65 -0
  72. package/packages/ampcode/commands/skill-creator.md +211 -0
  73. package/packages/ampcode/commands/stash.md +45 -0
  74. package/packages/ampcode/commands/systematic-debugging.md +297 -0
  75. package/packages/ampcode/commands/test-driven-development.md +390 -0
  76. package/packages/ampcode/commands/test-generate.md +18 -0
  77. package/packages/ampcode/commands/testing-anti-patterns.md +304 -0
  78. package/packages/ampcode/commands/verification-before-completion.md +152 -0
  79. package/packages/ampcode/settings.json +13 -0
  80. package/packages/ampcode/variants.json +8 -0
  81. package/packages/claude/CLAUDE.md +58 -0
  82. package/packages/claude/README.md +23 -0
  83. package/packages/claude/agents/1-create-prd.md +175 -0
  84. package/packages/claude/agents/2-generate-tasks.md +190 -0
  85. package/packages/claude/agents/3-process-task-list.md +225 -0
  86. package/packages/claude/agents/code-developer.md +198 -0
  87. package/packages/claude/agents/context-builder.md +142 -0
  88. package/packages/claude/agents/feature-planner.md +199 -0
  89. package/packages/claude/agents/market-researcher.md +89 -0
  90. package/packages/claude/agents/orchestrator.md +117 -0
  91. package/packages/claude/agents/quality-assurance.md +115 -0
  92. package/packages/claude/agents/system-architect.md +135 -0
  93. package/packages/claude/agents/ui-designer.md +184 -0
  94. package/packages/claude/commands/debug.md +20 -0
  95. package/packages/claude/commands/explain.md +18 -0
  96. package/packages/claude/commands/git-commit.md +14 -0
  97. package/packages/claude/commands/optimize.md +20 -0
  98. package/packages/claude/commands/refactor.md +21 -0
  99. package/packages/claude/commands/review.md +18 -0
  100. package/packages/claude/commands/security.md +21 -0
  101. package/packages/claude/commands/ship.md +18 -0
  102. package/packages/claude/commands/stash.md +45 -0
  103. package/packages/claude/commands/test-generate.md +18 -0
  104. package/packages/claude/skills/brainstorming/SKILL.md +56 -0
  105. package/packages/claude/skills/code-review/SKILL.md +107 -0
  106. package/packages/claude/skills/code-review/code-reviewer.md +146 -0
  107. package/packages/claude/skills/condition-based-waiting/SKILL.md +122 -0
  108. package/packages/claude/skills/condition-based-waiting/example.ts +158 -0
  109. package/packages/claude/skills/docs-builder/SKILL.md +106 -0
  110. package/packages/claude/skills/docs-builder/references/templates.md +572 -0
  111. package/packages/claude/skills/root-cause-tracing/SKILL.md +176 -0
  112. package/packages/claude/skills/root-cause-tracing/find-polluter.sh +63 -0
  113. package/packages/claude/skills/skill-creator/LICENSE.txt +202 -0
  114. package/packages/claude/skills/skill-creator/SKILL.md +211 -0
  115. package/packages/claude/skills/skill-creator/scripts/init_skill.py +303 -0
  116. package/packages/claude/skills/skill-creator/scripts/package_skill.py +110 -0
  117. package/packages/claude/skills/skill-creator/scripts/quick_validate.py +65 -0
  118. package/packages/claude/skills/systematic-debugging/CREATION-LOG.md +119 -0
  119. package/packages/claude/skills/systematic-debugging/SKILL.md +296 -0
  120. package/packages/claude/skills/systematic-debugging/test-academic.md +14 -0
  121. package/packages/claude/skills/systematic-debugging/test-pressure-1.md +58 -0
  122. package/packages/claude/skills/systematic-debugging/test-pressure-2.md +68 -0
  123. package/packages/claude/skills/systematic-debugging/test-pressure-3.md +69 -0
  124. package/packages/claude/skills/test-driven-development/SKILL.md +392 -0
  125. package/packages/claude/skills/testing-anti-patterns/SKILL.md +304 -0
  126. package/packages/claude/skills/verification-before-completion/SKILL.md +152 -0
  127. package/packages/claude/variants.json +9 -0
  128. package/packages/droid/AGENTS.md +52 -0
  129. package/packages/droid/README.md +17 -0
  130. package/packages/droid/change_settings.json +61 -0
  131. package/packages/droid/commands/brainstorming.md +56 -0
  132. package/packages/droid/commands/code-review.md +107 -0
  133. package/packages/droid/commands/condition-based-waiting/example.ts +158 -0
  134. package/packages/droid/commands/condition-based-waiting.md +122 -0
  135. package/packages/droid/commands/debug.md +20 -0
  136. package/packages/droid/commands/docs-builder/templates.md +572 -0
  137. package/packages/droid/commands/docs-builder.md +106 -0
  138. package/packages/droid/commands/explain.md +18 -0
  139. package/packages/droid/commands/git-commit.md +14 -0
  140. package/packages/droid/commands/optimize.md +20 -0
  141. package/packages/droid/commands/refactor.md +21 -0
  142. package/packages/droid/commands/review.md +18 -0
  143. package/packages/droid/commands/root-cause-tracing/find-polluter.sh +63 -0
  144. package/packages/droid/commands/root-cause-tracing.md +176 -0
  145. package/packages/droid/commands/security.md +21 -0
  146. package/packages/droid/commands/ship.md +18 -0
  147. package/packages/droid/commands/skill-creator/scripts/init_skill.py +303 -0
  148. package/packages/droid/commands/skill-creator/scripts/package_skill.py +110 -0
  149. package/packages/droid/commands/skill-creator/scripts/quick_validate.py +65 -0
  150. package/packages/droid/commands/skill-creator.md +211 -0
  151. package/packages/droid/commands/stash.md +45 -0
  152. package/packages/droid/commands/systematic-debugging.md +297 -0
  153. package/packages/droid/commands/test-driven-development.md +390 -0
  154. package/packages/droid/commands/test-generate.md +18 -0
  155. package/packages/droid/commands/testing-anti-patterns.md +304 -0
  156. package/packages/droid/commands/verification-before-completion.md +152 -0
  157. package/packages/droid/droids/1-create-prd.md +170 -0
  158. package/packages/droid/droids/2-generate-tasks.md +190 -0
  159. package/packages/droid/droids/3-process-task-list.md +225 -0
  160. package/packages/droid/droids/code-developer.md +198 -0
  161. package/packages/droid/droids/context-builder.md +142 -0
  162. package/packages/droid/droids/feature-planner.md +199 -0
  163. package/packages/droid/droids/market-researcher.md +89 -0
  164. package/packages/droid/droids/orchestrator.md +116 -0
  165. package/packages/droid/droids/quality-assurance.md +115 -0
  166. package/packages/droid/droids/system-architect.md +135 -0
  167. package/packages/droid/droids/ui-designer.md +184 -0
  168. package/packages/droid/variants.json +8 -0
  169. package/packages/opencode/AGENTS.md +52 -0
  170. package/packages/opencode/README.md +17 -0
  171. package/packages/opencode/agent/1-create-prd.md +179 -0
  172. package/packages/opencode/agent/2-generate-tasks.md +194 -0
  173. package/packages/opencode/agent/3-process-task-list.md +229 -0
  174. package/packages/opencode/agent/code-developer.md +202 -0
  175. package/packages/opencode/agent/context-builder.md +146 -0
  176. package/packages/opencode/agent/feature-planner.md +203 -0
  177. package/packages/opencode/agent/market-researcher.md +93 -0
  178. package/packages/opencode/agent/orchestrator.md +120 -0
  179. package/packages/opencode/agent/quality-assurance.md +119 -0
  180. package/packages/opencode/agent/system-architect.md +139 -0
  181. package/packages/opencode/agent/ui-designer.md +188 -0
  182. package/packages/opencode/command/brainstorming.md +56 -0
  183. package/packages/opencode/command/code-review.md +107 -0
  184. package/packages/opencode/command/condition-based-waiting/example.ts +158 -0
  185. package/packages/opencode/command/condition-based-waiting.md +122 -0
  186. package/packages/opencode/command/debug.md +20 -0
  187. package/packages/opencode/command/docs-builder/templates.md +572 -0
  188. package/packages/opencode/command/docs-builder.md +106 -0
  189. package/packages/opencode/command/explain.md +18 -0
  190. package/packages/opencode/command/git-commit.md +14 -0
  191. package/packages/opencode/command/optimize.md +20 -0
  192. package/packages/opencode/command/refactor.md +21 -0
  193. package/packages/opencode/command/review.md +18 -0
  194. package/packages/opencode/command/root-cause-tracing/find-polluter.sh +63 -0
  195. package/packages/opencode/command/root-cause-tracing.md +176 -0
  196. package/packages/opencode/command/security.md +21 -0
  197. package/packages/opencode/command/ship.md +18 -0
  198. package/packages/opencode/command/skill-creator/scripts/init_skill.py +303 -0
  199. package/packages/opencode/command/skill-creator/scripts/package_skill.py +110 -0
  200. package/packages/opencode/command/skill-creator/scripts/quick_validate.py +65 -0
  201. package/packages/opencode/command/skill-creator.md +211 -0
  202. package/packages/opencode/command/stash.md +45 -0
  203. package/packages/opencode/command/systematic-debugging.md +297 -0
  204. package/packages/opencode/command/test-driven-development.md +390 -0
  205. package/packages/opencode/command/test-generate.md +18 -0
  206. package/packages/opencode/command/testing-anti-patterns.md +304 -0
  207. package/packages/opencode/command/verification-before-completion.md +152 -0
  208. package/packages/opencode/opencode.jsonc +201 -0
  209. package/packages/opencode/variants.json +8 -0
  210. package/packages/subagentic-manual.md +349 -0
  211. package/postinstall.js +21 -0
  212. package/tools/ampcode/manifest-template.json +14 -0
  213. package/tools/claude/manifest-template.json +14 -0
  214. package/tools/droid/manifest-template.json +14 -0
  215. package/tools/opencode/manifest-template.json +14 -0
@@ -0,0 +1,188 @@
1
+ ---
2
+ name: ui-designer
3
+ description: Design lightweight, functional UI with simplified flows
4
+ when_to_use: Use for UI/UX design, user journeys, low-fidelity mockups, flow simplification, and framework selection
5
+ mode: subagent
6
+ temperature: 0.4
7
+ tools:
8
+ write: true
9
+ edit: true
10
+ bash: true
11
+ ---
12
+
13
+ You are a Senior UI Designer who favors lightweight, functional, pragmatic designs. You challenge complexity, simplify flows, and always question users who aren't clear on their UI stack. You think in steps-to-goal and minimize them.
14
+
15
+ # On First Interaction
16
+
17
+ Present options and establish intent:
18
+
19
+ ```
20
+ I'm your UI Designer. How can I help?
21
+
22
+ 1. *assess {input} - Review UI/flow from image, website, or description
23
+ 2. *journey {goal} - Design user journey (one per prompt)
24
+ 3. *mockup {screen} - Create ASCII low-fidelity wireframe
25
+ 4. *simplify {flow} - Challenge and reduce flow complexity
26
+ 5. *framework - Recommend UI framework based on needs
27
+
28
+ What are you building, and what's the user's main goal?
29
+ ```
30
+
31
+ **Intent shapes design** - match UI complexity to project stage:
32
+
33
+ | Intent | Design Approach |
34
+ |--------|-----------------|
35
+ | MVP/Prototype | Functional, minimal, fast to build (HTML/CSS, Tailwind, Alpine) |
36
+ | Production | Polished but pragmatic (React, Vue, Svelte + component library) |
37
+ | Enterprise | Design system, accessibility-first (established frameworks) |
38
+
39
+ # Core Principles
40
+
41
+ 1. **Lightweight First** - Simple HTML/CSS > Alpine/htmx > React/Vue. Challenge heavy frameworks.
42
+ 2. **Fewer Steps to Goal** - Count user steps. Reduce them. Every click costs.
43
+ 3. **Functional Over Fancy** - Works well > looks impressive. Pragmatic wins.
44
+ 4. **Challenge Complexity** - Question multi-step flows. Propose simpler alternatives.
45
+ 5. **Fit Purpose** - Match UI weight to problem size. Don't over-engineer.
46
+ 6. **Nice Defaults** - Good colors, readable typography, sensible spacing. No fuss.
47
+
48
+ Mobile-first and responsive design are assumed by default.
49
+
50
+ **When uncertain**: Use web search to research UI patterns, framework comparisons, or best practices.
51
+
52
+ # UI Framework Hierarchy
53
+
54
+ When user has no preference, recommend in this order:
55
+
56
+ ```
57
+ 1. Static/Simple → HTML + CSS + minimal JS
58
+ 2. Light Interactivity → Alpine.js, htmx, vanilla JS
59
+ 3. Component-Based → Svelte, Vue, Preact
60
+ 4. Full SPA → React, Angular (only when justified)
61
+ ```
62
+
63
+ **CSS**: Tailwind (utility-first) or simple CSS. Avoid heavy UI libraries unless needed.
64
+
65
+ **Colors**: Stick to 2-3 colors max. Use established palettes (Tailwind defaults, Open Color). Ensure contrast.
66
+
67
+ **Challenge if**: User wants React for a contact form, or Next.js for a static site.
68
+
69
+ # Accepted Inputs
70
+
71
+ This agent can assess and design from:
72
+ - **Images** - Screenshots, mockups, photos of sketches
73
+ - **Websites** - URLs to imitate or improve
74
+ - **Descriptions** - Written requirements or user stories
75
+ - **Existing Flows** - Current UI to simplify
76
+
77
+ # Design Workflow
78
+
79
+ ```
80
+ digraph UIDesignFlow {
81
+ rankdir=LR
82
+ node [shape=box style=rounded]
83
+
84
+ Intent [label="Intent\n(goal, stage)"]
85
+ Assess [label="Assess\n(inputs, constraints)"]
86
+ Simplify [label="Simplify\n(reduce steps)"]
87
+ Mockup [label="Mockup\n(ASCII/low-fi)"]
88
+ Framework [label="Framework\n(lightest fit)"]
89
+ Deliver [label="Deliver\n(one journey)"]
90
+
91
+ Intent -> Assess -> Simplify -> Mockup -> Framework -> Deliver
92
+ Simplify -> Assess [label="challenge" style=dashed]
93
+ }
94
+ ```
95
+
96
+ | Phase | Actions |
97
+ |-------|---------|
98
+ | **Intent** | Understand goal and project stage. Sets design weight. |
99
+ | **Assess** | Review inputs (image/website/description), identify user goal, count current steps. |
100
+ | **Simplify** | Challenge complexity. Can this be fewer steps? Fewer screens? |
101
+ | **Mockup** | Produce ASCII low-fidelity wireframe. One journey per prompt. |
102
+ | **Framework** | Recommend lightest framework that fits. Challenge heavy choices. |
103
+ | **Deliver** | Provide journey, mockup, and framework recommendation with rationale. |
104
+
105
+ # ASCII Mockup Format
106
+
107
+ Output low-fidelity wireframes as ASCII art:
108
+
109
+ ```
110
+ ┌─────────────────────────────────┐
111
+ │ Logo [Login] [Sign Up]│
112
+ ├─────────────────────────────────┤
113
+ │ │
114
+ │ Welcome to AppName │
115
+ │ │
116
+ │ ┌───────────────────────────┐ │
117
+ │ │ Email │ │
118
+ │ └───────────────────────────┘ │
119
+ │ ┌───────────────────────────┐ │
120
+ │ │ Password │ │
121
+ │ └───────────────────────────┘ │
122
+ │ │
123
+ │ [ Continue → ] │
124
+ │ │
125
+ │ Forgot password? | Sign up │
126
+ │ │
127
+ └─────────────────────────────────┘
128
+
129
+ Steps to goal: 3 (email → password → submit)
130
+ ```
131
+
132
+ # User Journey Format
133
+
134
+ Present journeys as numbered steps with step count:
135
+
136
+ ```
137
+ Journey: User signs up for newsletter
138
+
139
+ 1. User lands on homepage
140
+ 2. Sees newsletter CTA in footer
141
+ 3. Enters email
142
+ 4. Clicks subscribe
143
+ 5. Sees confirmation
144
+
145
+ Total: 5 steps | Can we reduce? → Inline form on landing = 3 steps
146
+ ```
147
+
148
+ Always question: **Can this be fewer steps?**
149
+
150
+ # Commands Reference
151
+
152
+ All commands prefixed with `*`. Use `*help` to show options.
153
+
154
+ | Command | Description |
155
+ |---------|-------------|
156
+ | `*assess {input}` | Review UI from image, URL, or description |
157
+ | `*journey {goal}` | Design user journey for specific goal |
158
+ | `*mockup {screen}` | Create ASCII low-fidelity wireframe |
159
+ | `*simplify {flow}` | Analyze and reduce flow complexity |
160
+ | `*framework` | Recommend UI framework based on needs |
161
+ | `*research {topic}` | Web search for UI patterns, best practices |
162
+ | `*exit` | Conclude engagement |
163
+
164
+ # Design Checklist
165
+
166
+ Before finalizing, verify:
167
+
168
+ **Flow**: [ ] Steps counted [ ] Unnecessary steps removed [ ] Goal achievable quickly
169
+
170
+ **UI**: [ ] Lightweight framework chosen [ ] Functional over fancy [ ] Good defaults (color, type, spacing)
171
+
172
+ **Accessibility**: [ ] Keyboard navigable [ ] Readable contrast [ ] Touch targets sized
173
+
174
+ **Fit**: [ ] Matches project stage (MVP vs production) [ ] Not over-engineered [ ] User challenged if complex
175
+
176
+ # Challenge Patterns
177
+
178
+ Always challenge these anti-patterns:
179
+
180
+ | Anti-Pattern | Challenge With |
181
+ |--------------|----------------|
182
+ | Multi-page wizard for simple task | Single page with sections |
183
+ | Login required before value shown | Let users explore first |
184
+ | Heavy SPA for static content | Static HTML + sprinkles of JS |
185
+ | Modal inside modal | Flatten to single context |
186
+ | 5+ step forms | Progressive disclosure or split |
187
+
188
+ **Default stance**: "Can this be simpler?"
@@ -0,0 +1,56 @@
1
+ ---
2
+ name: brainstorming
3
+ description: Use when creating or developing, before writing code or implementation plans - refines rough ideas into fully-formed designs through collaborative questioning, alternative exploration, and incremental validation. Don't use during clear 'mechanical' processes
4
+ usage: /brainstorming <session-type> <topic>
5
+ auto_trigger: false
6
+ ---
7
+
8
+ # Brainstorming Ideas Into Designs
9
+
10
+ ## Overview
11
+
12
+ Help turn ideas into fully formed designs and specs through natural collaborative dialogue.
13
+
14
+ Start by understanding the current project context, then ask questions one at a time to refine the idea. Once you understand what you're building, present the design in small sections (200-300 words), checking after each section whether it looks right so far.
15
+
16
+ ## The Process
17
+
18
+ **Understanding the idea:**
19
+ - Check out the current project state first (files, docs, recent commits)
20
+ - Ask questions one at a time to refine the idea
21
+ - Prefer multiple choice questions when possible, but open-ended is fine too
22
+ - Only one question per message - if a topic needs more exploration, break it into multiple questions
23
+ - Focus on understanding: purpose, constraints, success criteria
24
+
25
+ **Exploring approaches:**
26
+ - Propose 2-3 different approaches with trade-offs
27
+ - Present options conversationally with your recommendation and reasoning
28
+ - Lead with your recommended option and explain why
29
+
30
+ **Presenting the design:**
31
+ - Once you believe you understand what you're building, present the design
32
+ - Break it into sections of 200-300 words
33
+ - Ask after each section whether it looks right so far
34
+ - Cover: architecture, components, data flow, error handling, testing
35
+ - Be ready to go back and clarify if something doesn't make sense
36
+
37
+ ## After the Design
38
+
39
+ **Documentation:**
40
+ - Write the validated design to `docs/plans/YYYY-MM-DD-<topic>-design.md`
41
+ - Use elements-of-style:writing-clearly-and-concisely skill if available
42
+ - Commit the design document to git
43
+
44
+ **Implementation (if continuing):**
45
+ - Ask: "Ready to set up for implementation?"
46
+ - Create isolated workspace (use git worktrees if needed)
47
+ - Create detailed implementation plan
48
+
49
+ ## Key Principles
50
+
51
+ - **One question at a time** - Don't overwhelm with multiple questions
52
+ - **Multiple choice preferred** - Easier to answer than open-ended when possible
53
+ - **YAGNI ruthlessly** - Remove unnecessary features from all designs
54
+ - **Explore alternatives** - Always propose 2-3 approaches before settling
55
+ - **Incremental validation** - Present design in sections, validate each
56
+ - **Be flexible** - Go back and clarify when something doesn't make sense
@@ -0,0 +1,107 @@
1
+ ---
2
+ name: code-review
3
+ description: Use when completing tasks, implementing major features, or before merging to verify work meets requirements - reviews implementation against plan or requirements before proceeding
4
+ usage: /code-review <review-scope> <focus-areas>
5
+ auto_trigger: false
6
+ ---
7
+
8
+ # Requesting Code Review
9
+
10
+ Review code thoroughly to catch issues before they cascade.
11
+
12
+ **Core principle:** Review early, review often.
13
+
14
+ ## When to Request Review
15
+
16
+ **Mandatory:**
17
+ - After each task in subagent-driven development
18
+ - After completing major feature
19
+ - Before merge to main
20
+
21
+ **Optional but valuable:**
22
+ - When stuck (fresh perspective)
23
+ - Before refactoring (baseline check)
24
+ - After fixing complex bug
25
+
26
+ ## How to Request
27
+
28
+ **1. Get git SHAs:**
29
+ ```bash
30
+ BASE_SHA=$(git rev-parse HEAD~1) # or origin/main
31
+ HEAD_SHA=$(git rev-parse HEAD)
32
+ ```
33
+
34
+ **2. Conduct code review:**
35
+
36
+ Review implementation against requirements and plan
37
+
38
+ **Placeholders:**
39
+ - `{WHAT_WAS_IMPLEMENTED}` - What you just built
40
+ - `{PLAN_OR_REQUIREMENTS}` - What it should do
41
+ - `{BASE_SHA}` - Starting commit
42
+ - `{HEAD_SHA}` - Ending commit
43
+ - `{DESCRIPTION}` - Brief summary
44
+
45
+ **3. Act on feedback:**
46
+ - Fix Critical issues immediately
47
+ - Fix Important issues before proceeding
48
+ - Note Minor issues for later
49
+ - Push back if reviewer is wrong (with reasoning)
50
+
51
+ ## Example
52
+
53
+ ```
54
+ [Just completed Task 2: Add verification function]
55
+
56
+ You: Let me request code review before proceeding.
57
+
58
+ BASE_SHA=$(git log --oneline | grep "Task 1" | head -1 | awk '{print $1}')
59
+ HEAD_SHA=$(git rev-parse HEAD)
60
+
61
+ [Conduct code review]
62
+ WHAT_WAS_IMPLEMENTED: Verification and repair functions for conversation index
63
+ PLAN_OR_REQUIREMENTS: Task 2 from docs/plans/deployment-plan.md
64
+ BASE_SHA: a7981ec
65
+ HEAD_SHA: 3df7661
66
+ DESCRIPTION: Added verifyIndex() and repairIndex() with 4 issue types
67
+
68
+ [Subagent returns]:
69
+ Strengths: Clean architecture, real tests
70
+ Issues:
71
+ Important: Missing progress indicators
72
+ Minor: Magic number (100) for reporting interval
73
+ Assessment: Ready to proceed
74
+
75
+ You: [Fix progress indicators]
76
+ [Continue to Task 3]
77
+ ```
78
+
79
+ ## Integration with Workflows
80
+
81
+ **Subagent-Driven Development:**
82
+ - Review after EACH task
83
+ - Catch issues before they compound
84
+ - Fix before moving to next task
85
+
86
+ **Executing Plans:**
87
+ - Review after each batch (3 tasks)
88
+ - Get feedback, apply, continue
89
+
90
+ **Ad-Hoc Development:**
91
+ - Review before merge
92
+ - Review when stuck
93
+
94
+ ## Red Flags
95
+
96
+ **Never:**
97
+ - Skip review because "it's simple"
98
+ - Ignore Critical issues
99
+ - Proceed with unfixed Important issues
100
+ - Argue with valid technical feedback
101
+
102
+ **If reviewer wrong:**
103
+ - Push back with technical reasoning
104
+ - Show code/tests that prove it works
105
+ - Request clarification
106
+
107
+ See template at: requesting-code-review/code-reviewer.md
@@ -0,0 +1,158 @@
1
+ // Complete implementation of condition-based waiting utilities
2
+ // From: Lace test infrastructure improvements (2025-10-03)
3
+ // Context: Fixed 15 flaky tests by replacing arbitrary timeouts
4
+
5
+ import type { ThreadManager } from '~/threads/thread-manager';
6
+ import type { LaceEvent, LaceEventType } from '~/threads/types';
7
+
8
+ /**
9
+ * Wait for a specific event type to appear in thread
10
+ *
11
+ * @param threadManager - The thread manager to query
12
+ * @param threadId - Thread to check for events
13
+ * @param eventType - Type of event to wait for
14
+ * @param timeoutMs - Maximum time to wait (default 5000ms)
15
+ * @returns Promise resolving to the first matching event
16
+ *
17
+ * Example:
18
+ * await waitForEvent(threadManager, agentThreadId, 'TOOL_RESULT');
19
+ */
20
+ export function waitForEvent(
21
+ threadManager: ThreadManager,
22
+ threadId: string,
23
+ eventType: LaceEventType,
24
+ timeoutMs = 5000
25
+ ): Promise<LaceEvent> {
26
+ return new Promise((resolve, reject) => {
27
+ const startTime = Date.now();
28
+
29
+ const check = () => {
30
+ const events = threadManager.getEvents(threadId);
31
+ const event = events.find((e) => e.type === eventType);
32
+
33
+ if (event) {
34
+ resolve(event);
35
+ } else if (Date.now() - startTime > timeoutMs) {
36
+ reject(new Error(`Timeout waiting for ${eventType} event after ${timeoutMs}ms`));
37
+ } else {
38
+ setTimeout(check, 10); // Poll every 10ms for efficiency
39
+ }
40
+ };
41
+
42
+ check();
43
+ });
44
+ }
45
+
46
+ /**
47
+ * Wait for a specific number of events of a given type
48
+ *
49
+ * @param threadManager - The thread manager to query
50
+ * @param threadId - Thread to check for events
51
+ * @param eventType - Type of event to wait for
52
+ * @param count - Number of events to wait for
53
+ * @param timeoutMs - Maximum time to wait (default 5000ms)
54
+ * @returns Promise resolving to all matching events once count is reached
55
+ *
56
+ * Example:
57
+ * // Wait for 2 AGENT_MESSAGE events (initial response + continuation)
58
+ * await waitForEventCount(threadManager, agentThreadId, 'AGENT_MESSAGE', 2);
59
+ */
60
+ export function waitForEventCount(
61
+ threadManager: ThreadManager,
62
+ threadId: string,
63
+ eventType: LaceEventType,
64
+ count: number,
65
+ timeoutMs = 5000
66
+ ): Promise<LaceEvent[]> {
67
+ return new Promise((resolve, reject) => {
68
+ const startTime = Date.now();
69
+
70
+ const check = () => {
71
+ const events = threadManager.getEvents(threadId);
72
+ const matchingEvents = events.filter((e) => e.type === eventType);
73
+
74
+ if (matchingEvents.length >= count) {
75
+ resolve(matchingEvents);
76
+ } else if (Date.now() - startTime > timeoutMs) {
77
+ reject(
78
+ new Error(
79
+ `Timeout waiting for ${count} ${eventType} events after ${timeoutMs}ms (got ${matchingEvents.length})`
80
+ )
81
+ );
82
+ } else {
83
+ setTimeout(check, 10);
84
+ }
85
+ };
86
+
87
+ check();
88
+ });
89
+ }
90
+
91
+ /**
92
+ * Wait for an event matching a custom predicate
93
+ * Useful when you need to check event data, not just type
94
+ *
95
+ * @param threadManager - The thread manager to query
96
+ * @param threadId - Thread to check for events
97
+ * @param predicate - Function that returns true when event matches
98
+ * @param description - Human-readable description for error messages
99
+ * @param timeoutMs - Maximum time to wait (default 5000ms)
100
+ * @returns Promise resolving to the first matching event
101
+ *
102
+ * Example:
103
+ * // Wait for TOOL_RESULT with specific ID
104
+ * await waitForEventMatch(
105
+ * threadManager,
106
+ * agentThreadId,
107
+ * (e) => e.type === 'TOOL_RESULT' && e.data.id === 'call_123',
108
+ * 'TOOL_RESULT with id=call_123'
109
+ * );
110
+ */
111
+ export function waitForEventMatch(
112
+ threadManager: ThreadManager,
113
+ threadId: string,
114
+ predicate: (event: LaceEvent) => boolean,
115
+ description: string,
116
+ timeoutMs = 5000
117
+ ): Promise<LaceEvent> {
118
+ return new Promise((resolve, reject) => {
119
+ const startTime = Date.now();
120
+
121
+ const check = () => {
122
+ const events = threadManager.getEvents(threadId);
123
+ const event = events.find(predicate);
124
+
125
+ if (event) {
126
+ resolve(event);
127
+ } else if (Date.now() - startTime > timeoutMs) {
128
+ reject(new Error(`Timeout waiting for ${description} after ${timeoutMs}ms`));
129
+ } else {
130
+ setTimeout(check, 10);
131
+ }
132
+ };
133
+
134
+ check();
135
+ });
136
+ }
137
+
138
+ // Usage example from actual debugging session:
139
+ //
140
+ // BEFORE (flaky):
141
+ // ---------------
142
+ // const messagePromise = agent.sendMessage('Execute tools');
143
+ // await new Promise(r => setTimeout(r, 300)); // Hope tools start in 300ms
144
+ // agent.abort();
145
+ // await messagePromise;
146
+ // await new Promise(r => setTimeout(r, 50)); // Hope results arrive in 50ms
147
+ // expect(toolResults.length).toBe(2); // Fails randomly
148
+ //
149
+ // AFTER (reliable):
150
+ // ----------------
151
+ // const messagePromise = agent.sendMessage('Execute tools');
152
+ // await waitForEventCount(threadManager, threadId, 'TOOL_CALL', 2); // Wait for tools to start
153
+ // agent.abort();
154
+ // await messagePromise;
155
+ // await waitForEventCount(threadManager, threadId, 'TOOL_RESULT', 2); // Wait for results
156
+ // expect(toolResults.length).toBe(2); // Always succeeds
157
+ //
158
+ // Result: 60% pass rate → 100%, 40% faster execution
@@ -0,0 +1,122 @@
1
+ ---
2
+ name: condition-based-waiting
3
+ description: Use when tests have race conditions, timing dependencies, or inconsistent pass/fail behavior - replaces arbitrary timeouts with condition polling to wait for actual state changes, eliminating flaky tests from timing guesses
4
+ usage: /condition-based-waiting <condition-type> <timeout-specs>
5
+ auto_trigger: false
6
+ ---
7
+
8
+ # Condition-Based Waiting
9
+
10
+ ## Overview
11
+
12
+ Flaky tests often guess at timing with arbitrary delays. This creates race conditions where tests pass on fast machines but fail under load or in CI.
13
+
14
+ **Core principle:** Wait for the actual condition you care about, not a guess about how long it takes.
15
+
16
+ ## When to Use
17
+
18
+ ```dot
19
+ digraph when_to_use {
20
+ "Test uses setTimeout/sleep?" [shape=diamond];
21
+ "Testing timing behavior?" [shape=diamond];
22
+ "Document WHY timeout needed" [shape=box];
23
+ "Use condition-based waiting" [shape=box];
24
+
25
+ "Test uses setTimeout/sleep?" -> "Testing timing behavior?" [label="yes"];
26
+ "Testing timing behavior?" -> "Document WHY timeout needed" [label="yes"];
27
+ "Testing timing behavior?" -> "Use condition-based waiting" [label="no"];
28
+ }
29
+ ```
30
+
31
+ **Use when:**
32
+ - Tests have arbitrary delays (`setTimeout`, `sleep`, `time.sleep()`)
33
+ - Tests are flaky (pass sometimes, fail under load)
34
+ - Tests timeout when run in parallel
35
+ - Waiting for async operations to complete
36
+
37
+ **Don't use when:**
38
+ - Testing actual timing behavior (debounce, throttle intervals)
39
+ - Always document WHY if using arbitrary timeout
40
+
41
+ ## Core Pattern
42
+
43
+ ```typescript
44
+ // ❌ BEFORE: Guessing at timing
45
+ await new Promise(r => setTimeout(r, 50));
46
+ const result = getResult();
47
+ expect(result).toBeDefined();
48
+
49
+ // ✅ AFTER: Waiting for condition
50
+ await waitFor(() => getResult() !== undefined);
51
+ const result = getResult();
52
+ expect(result).toBeDefined();
53
+ ```
54
+
55
+ ## Quick Patterns
56
+
57
+ | Scenario | Pattern |
58
+ |----------|---------|
59
+ | Wait for event | `waitFor(() => events.find(e => e.type === 'DONE'))` |
60
+ | Wait for state | `waitFor(() => machine.state === 'ready')` |
61
+ | Wait for count | `waitFor(() => items.length >= 5)` |
62
+ | Wait for file | `waitFor(() => fs.existsSync(path))` |
63
+ | Complex condition | `waitFor(() => obj.ready && obj.value > 10)` |
64
+
65
+ ## Implementation
66
+
67
+ Generic polling function:
68
+ ```typescript
69
+ async function waitFor<T>(
70
+ condition: () => T | undefined | null | false,
71
+ description: string,
72
+ timeoutMs = 5000
73
+ ): Promise<T> {
74
+ const startTime = Date.now();
75
+
76
+ while (true) {
77
+ const result = condition();
78
+ if (result) return result;
79
+
80
+ if (Date.now() - startTime > timeoutMs) {
81
+ throw new Error(`Timeout waiting for ${description} after ${timeoutMs}ms`);
82
+ }
83
+
84
+ await new Promise(r => setTimeout(r, 10)); // Poll every 10ms
85
+ }
86
+ }
87
+ ```
88
+
89
+ See @example.ts for complete implementation with domain-specific helpers (`waitForEvent`, `waitForEventCount`, `waitForEventMatch`) from actual debugging session.
90
+
91
+ ## Common Mistakes
92
+
93
+ **❌ Polling too fast:** `setTimeout(check, 1)` - wastes CPU
94
+ **✅ Fix:** Poll every 10ms
95
+
96
+ **❌ No timeout:** Loop forever if condition never met
97
+ **✅ Fix:** Always include timeout with clear error
98
+
99
+ **❌ Stale data:** Cache state before loop
100
+ **✅ Fix:** Call getter inside loop for fresh data
101
+
102
+ ## When Arbitrary Timeout IS Correct
103
+
104
+ ```typescript
105
+ // Tool ticks every 100ms - need 2 ticks to verify partial output
106
+ await waitForEvent(manager, 'TOOL_STARTED'); // First: wait for condition
107
+ await new Promise(r => setTimeout(r, 200)); // Then: wait for timed behavior
108
+ // 200ms = 2 ticks at 100ms intervals - documented and justified
109
+ ```
110
+
111
+ **Requirements:**
112
+ 1. First wait for triggering condition
113
+ 2. Based on known timing (not guessing)
114
+ 3. Comment explaining WHY
115
+
116
+ ## Real-World Impact
117
+
118
+ From debugging session (2025-10-03):
119
+ - Fixed 15 flaky tests across 3 files
120
+ - Pass rate: 60% → 100%
121
+ - Execution time: 40% faster
122
+ - No more race conditions
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: debug
3
+ description: Debug issue [issue]
4
+ usage: /debug <issue-description>
5
+ argument-hint: [description of the problem]
6
+ ---
7
+ Debug: $ARGUMENTS
8
+
9
+ ## Process
10
+ 1. Clarify: What's expected vs actual behavior?
11
+ 2. Reproduce: What triggers the issue?
12
+ 3. Isolate: Which component/function is responsible?
13
+ 4. Trace: Follow the data flow
14
+ 5. Fix: Implement and verify the solution
15
+
16
+ ## Output
17
+ - Root cause
18
+ - Affected code paths
19
+ - Fix with explanation
20
+ - Prevention strategy