@lvlup-sw/exarchos 2.0.1
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.
- package/.claude-plugin/marketplace.json +22 -0
- package/.claude-plugin/plugin.json +17 -0
- package/.mcp.json +17 -0
- package/AGENTS.md +59 -0
- package/CLAUDE.md.template +62 -0
- package/LICENSE +202 -0
- package/README.md +258 -0
- package/commands/autocompact.md +37 -0
- package/commands/checkpoint.md +85 -0
- package/commands/cleanup.md +99 -0
- package/commands/debug.md +145 -0
- package/commands/delegate.md +56 -0
- package/commands/ideate.md +82 -0
- package/commands/plan.md +150 -0
- package/commands/refactor.md +139 -0
- package/commands/reload.md +37 -0
- package/commands/resume.md +130 -0
- package/commands/review.md +51 -0
- package/commands/sync-schemas.md +74 -0
- package/commands/synthesize.md +122 -0
- package/commands/tdd.md +58 -0
- package/dist/exarchos-cli.js +8828 -0
- package/dist/exarchos-mcp.js +50 -0
- package/hooks/hooks.json +53 -0
- package/package.json +59 -0
- package/rules/coding-standards.md +46 -0
- package/rules/mcp-tool-guidance.md +26 -0
- package/rules/pr-descriptions.md +12 -0
- package/rules/rm-safety.md +9 -0
- package/rules/skill-path-resolution.md +10 -0
- package/rules/tdd.md +41 -0
- package/rules/telemetry-awareness.md +9 -0
- package/scripts/assess-refactor-scope.sh +239 -0
- package/scripts/check-benchmark-regression.sh +229 -0
- package/scripts/check-coderabbit.sh +288 -0
- package/scripts/check-coverage-thresholds.sh +194 -0
- package/scripts/check-polish-scope.sh +245 -0
- package/scripts/check-property-tests.sh +167 -0
- package/scripts/check-tdd-compliance.sh +265 -0
- package/scripts/coderabbit-review-gate.sh +518 -0
- package/scripts/debug-review-gate.sh +201 -0
- package/scripts/extract-fix-tasks.sh +179 -0
- package/scripts/extract-task.sh +67 -0
- package/scripts/generate-traceability.sh +209 -0
- package/scripts/investigation-timer.sh +171 -0
- package/scripts/needs-schema-sync.sh +174 -0
- package/scripts/new-project.sh +103 -0
- package/scripts/post-delegation-check.sh +317 -0
- package/scripts/pre-synthesis-check.sh +440 -0
- package/scripts/reconcile-state.sh +346 -0
- package/scripts/reconstruct-stack.sh +432 -0
- package/scripts/review-diff.sh +63 -0
- package/scripts/review-verdict.sh +169 -0
- package/scripts/security-scan.sh +248 -0
- package/scripts/select-debug-track.sh +186 -0
- package/scripts/setup-worktree.sh +323 -0
- package/scripts/spec-coverage-check.sh +230 -0
- package/scripts/static-analysis-gate.sh +236 -0
- package/scripts/sync-labels.sh +122 -0
- package/scripts/validate-companion.sh +161 -0
- package/scripts/validate-dotnet-standards.sh +267 -0
- package/scripts/validate-installation.sh +101 -0
- package/scripts/validate-plugin.sh +223 -0
- package/scripts/validate-refactor.sh +234 -0
- package/scripts/validate-rm.sh +93 -0
- package/scripts/verify-delegation-saga.sh +240 -0
- package/scripts/verify-doc-links.sh +211 -0
- package/scripts/verify-ideate-artifacts.sh +296 -0
- package/scripts/verify-plan-coverage.sh +228 -0
- package/scripts/verify-review-triage.sh +219 -0
- package/scripts/verify-worktree-baseline.sh +159 -0
- package/scripts/verify-worktree.sh +84 -0
- package/settings.json +47 -0
- package/skills/brainstorming/SKILL.md +127 -0
- package/skills/brainstorming/references/design-template.md +65 -0
- package/skills/cleanup/SKILL.md +147 -0
- package/skills/cleanup/references/merge-verification.md +40 -0
- package/skills/debug/SKILL.md +204 -0
- package/skills/debug/references/hotfix-track.md +134 -0
- package/skills/debug/references/investigation-checklist.md +217 -0
- package/skills/debug/references/rca-template.md +150 -0
- package/skills/debug/references/state-schema.md +294 -0
- package/skills/debug/references/thorough-track.md +194 -0
- package/skills/debug/references/triage-questions.md +155 -0
- package/skills/debug/references/troubleshooting.md +47 -0
- package/skills/delegation/SKILL.md +150 -0
- package/skills/delegation/references/adaptive-orchestration.md +31 -0
- package/skills/delegation/references/agent-teams-saga.md +248 -0
- package/skills/delegation/references/fix-mode.md +74 -0
- package/skills/delegation/references/fixer-prompt.md +162 -0
- package/skills/delegation/references/implementer-prompt.md +322 -0
- package/skills/delegation/references/parallel-strategy.md +124 -0
- package/skills/delegation/references/pbt-patterns.md +172 -0
- package/skills/delegation/references/pr-fixes-mode.md +154 -0
- package/skills/delegation/references/state-management.md +51 -0
- package/skills/delegation/references/testing-patterns.md +129 -0
- package/skills/delegation/references/troubleshooting.md +33 -0
- package/skills/delegation/references/workflow-steps.md +127 -0
- package/skills/delegation/references/worktree-enforcement.md +64 -0
- package/skills/dotnet-standards/SKILL.md +269 -0
- package/skills/dotnet-standards/references/csharp-standards.md +120 -0
- package/skills/dotnet-standards/templates/.editorconfig +366 -0
- package/skills/dotnet-standards/templates/Directory.Build.props +56 -0
- package/skills/dotnet-standards/templates/Directory.Packages.props +69 -0
- package/skills/dotnet-standards/templates/global.json +6 -0
- package/skills/dotnet-standards/templates/nuget.config +9 -0
- package/skills/dotnet-standards/templates/stylecop.json +37 -0
- package/skills/git-worktrees/SKILL.md +255 -0
- package/skills/implementation-planning/SKILL.md +233 -0
- package/skills/implementation-planning/references/plan-document-template.md +42 -0
- package/skills/implementation-planning/references/spec-tracing-guide.md +51 -0
- package/skills/implementation-planning/references/task-template.md +43 -0
- package/skills/implementation-planning/references/testing-strategy-guide.md +88 -0
- package/skills/quality-review/SKILL.md +278 -0
- package/skills/quality-review/references/code-quality-checklist.md +159 -0
- package/skills/quality-review/references/review-report-template.md +65 -0
- package/skills/quality-review/references/security-checklist.md +79 -0
- package/skills/quality-review/references/typescript-standards.md +24 -0
- package/skills/refactor/COMMAND.md +67 -0
- package/skills/refactor/SKILL.md +198 -0
- package/skills/refactor/phases/auto-chain.md +262 -0
- package/skills/refactor/phases/brief.md +176 -0
- package/skills/refactor/phases/explore.md +132 -0
- package/skills/refactor/phases/overhaul-delegate.md +136 -0
- package/skills/refactor/phases/overhaul-plan.md +312 -0
- package/skills/refactor/phases/overhaul-review.md +304 -0
- package/skills/refactor/phases/polish-implement.md +349 -0
- package/skills/refactor/phases/polish-validate.md +218 -0
- package/skills/refactor/phases/update-docs.md +234 -0
- package/skills/refactor/references/brief-template.md +81 -0
- package/skills/refactor/references/doc-update-checklist.md +110 -0
- package/skills/refactor/references/explore-checklist.md +73 -0
- package/skills/refactor/references/overhaul-track.md +215 -0
- package/skills/refactor/references/polish-track.md +170 -0
- package/skills/shared/prompts/context-reading.md +58 -0
- package/skills/shared/prompts/report-format.md +54 -0
- package/skills/shared/prompts/tdd-requirements.md +39 -0
- package/skills/shepherd/SKILL.md +264 -0
- package/skills/shepherd/references/assess-checklist.md +124 -0
- package/skills/shepherd/references/fix-strategies.md +191 -0
- package/skills/spec-review/SKILL.md +229 -0
- package/skills/spec-review/references/review-checklist.md +60 -0
- package/skills/sync-schemas/SKILL.md +114 -0
- package/skills/sync-schemas/references/configuration.md +73 -0
- package/skills/synthesis/SKILL.md +129 -0
- package/skills/synthesis/references/pr-descriptions.md +87 -0
- package/skills/synthesis/references/synthesis-steps.md +109 -0
- package/skills/synthesis/references/troubleshooting.md +115 -0
- package/skills/validate-all-skills.sh +57 -0
- package/skills/validate-frontmatter.sh +237 -0
- package/skills/workflow-state/SKILL.md +210 -0
- package/skills/workflow-state/references/mcp-tool-reference.md +111 -0
- package/skills/workflow-state/references/phase-transitions.md +141 -0
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
# Implementer Prompt Template
|
|
2
|
+
|
|
3
|
+
Use this template when dispatching tasks via the Task tool.
|
|
4
|
+
|
|
5
|
+
## Quality Hints Integration
|
|
6
|
+
|
|
7
|
+
Before dispatch, query `exarchos_view` with `action: 'quality_hints'` and `skill: '<skill-name>'` to retrieve quality signals for the target skill. If the returned `hints` array is non-empty, include the **Quality Signals** section in the prompt. If empty, omit it entirely.
|
|
8
|
+
|
|
9
|
+
## Template
|
|
10
|
+
|
|
11
|
+
```markdown
|
|
12
|
+
# Task: [Task Title]
|
|
13
|
+
|
|
14
|
+
## Working Directory
|
|
15
|
+
[Absolute path to worktree or project root]
|
|
16
|
+
|
|
17
|
+
## CRITICAL: Worktree Verification (MANDATORY)
|
|
18
|
+
|
|
19
|
+
Before making ANY file changes, you MUST verify you are in a worktree:
|
|
20
|
+
|
|
21
|
+
1. Run: `pwd`
|
|
22
|
+
2. Verify the path contains `.worktrees/`
|
|
23
|
+
3. If NOT in a worktree directory:
|
|
24
|
+
- STOP immediately
|
|
25
|
+
- Report: "ERROR: Working directory is not a worktree. Aborting task."
|
|
26
|
+
- DO NOT proceed with any file modifications
|
|
27
|
+
|
|
28
|
+
**Example verification:**
|
|
29
|
+
```bash
|
|
30
|
+
pwd | grep -q "\.worktrees" || { echo "ERROR: Not in worktree!"; exit 1; }
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
This check prevents accidental modifications to the main project root, which would cause merge conflicts with other parallel tasks.
|
|
34
|
+
|
|
35
|
+
## Task Description
|
|
36
|
+
[Full task description from implementation plan - never reference external files]
|
|
37
|
+
|
|
38
|
+
## Files to Modify
|
|
39
|
+
|
|
40
|
+
### Create/Modify:
|
|
41
|
+
- `[path/to/file.ts]` - [Brief description of changes]
|
|
42
|
+
|
|
43
|
+
### Test Files:
|
|
44
|
+
- `[path/to/file.test.ts]` - [Test file to create/modify]
|
|
45
|
+
|
|
46
|
+
## TDD Requirements (MANDATORY)
|
|
47
|
+
|
|
48
|
+
You MUST follow strict Test-Driven Development:
|
|
49
|
+
|
|
50
|
+
### Phase 1: RED - Write Failing Test
|
|
51
|
+
|
|
52
|
+
1. Create test file at the specified path
|
|
53
|
+
2. Write test with name: `[MethodName]_[Scenario]_[ExpectedOutcome]`
|
|
54
|
+
3. Run tests: `npm run test:run`
|
|
55
|
+
4. **VERIFY test fails for the expected reason**
|
|
56
|
+
5. Do NOT proceed until you've witnessed the failure
|
|
57
|
+
|
|
58
|
+
### Phase 2: GREEN - Minimum Implementation
|
|
59
|
+
|
|
60
|
+
1. Write the minimum code to make the test pass
|
|
61
|
+
2. No additional features or optimizations
|
|
62
|
+
3. Run tests: `npm run test:run`
|
|
63
|
+
4. **VERIFY test passes**
|
|
64
|
+
|
|
65
|
+
### Phase 3: REFACTOR - Clean Up
|
|
66
|
+
|
|
67
|
+
1. Apply SOLID principles if applicable
|
|
68
|
+
2. Extract helpers for clarity
|
|
69
|
+
3. Run tests after each change
|
|
70
|
+
4. **VERIFY tests stay green**
|
|
71
|
+
|
|
72
|
+
## Property-Based Testing Patterns
|
|
73
|
+
|
|
74
|
+
When this task has `testingStrategy.propertyTests: true`, write property tests alongside example tests during the RED phase. Use the patterns from `@skills/delegation/references/pbt-patterns.md`:
|
|
75
|
+
|
|
76
|
+
- **Roundtrip:** For encode/decode pairs, verify `decode(encode(x)) === x` for all inputs
|
|
77
|
+
- **Invariant:** For operations with business rules, verify bounds/constraints hold for all inputs
|
|
78
|
+
- **Idempotence:** For normalization/formatting, verify `f(f(x)) === f(x)` for all inputs
|
|
79
|
+
- **Commutativity:** For order-independent operations, verify `f(a, b) === f(b, a)` for all inputs
|
|
80
|
+
|
|
81
|
+
**TypeScript:** Use `fast-check` with `fc.property`, `fc.assert`, or `it.prop`
|
|
82
|
+
**C#:** Use `FsCheck` with `Prop.ForAll` or `[Property]` attribute
|
|
83
|
+
|
|
84
|
+
Property tests complement example tests -- write both in the RED phase.
|
|
85
|
+
|
|
86
|
+
## Expected Test
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
describe('[ComponentName]', () => {
|
|
90
|
+
it('should [expected behavior] when [condition]', async () => {
|
|
91
|
+
// Arrange
|
|
92
|
+
[Setup code]
|
|
93
|
+
|
|
94
|
+
// Act
|
|
95
|
+
[Execution code]
|
|
96
|
+
|
|
97
|
+
// Assert
|
|
98
|
+
expect(result).[matcher](expected);
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Success Criteria
|
|
104
|
+
|
|
105
|
+
- [ ] Test written BEFORE implementation
|
|
106
|
+
- [ ] Test fails for the right reason
|
|
107
|
+
- [ ] Implementation passes test
|
|
108
|
+
- [ ] No extra code beyond requirements
|
|
109
|
+
- [ ] All tests in worktree pass
|
|
110
|
+
|
|
111
|
+
## Coordination (Native APIs)
|
|
112
|
+
<!-- Agent Teams mode only. Remove this section for subagent mode. -->
|
|
113
|
+
- Use `TaskList` to see available tasks and their statuses
|
|
114
|
+
- Use `TaskUpdate` to mark tasks `in_progress` when you start and `completed` when done
|
|
115
|
+
- Use `SendMessage` to communicate findings to teammates or the lead
|
|
116
|
+
|
|
117
|
+
## Workflow Intelligence (Exarchos MCP)
|
|
118
|
+
<!-- Agent Teams mode only. Remove this section for subagent mode. -->
|
|
119
|
+
- Use `exarchos_workflow get` to query current workflow state
|
|
120
|
+
- Use `exarchos_view tasks` to see task details across the team
|
|
121
|
+
- Use `exarchos_event append` to report TDD phase transitions:
|
|
122
|
+
stream: "{featureId}"
|
|
123
|
+
event: { type: "task.progress", taskId: "{taskId}", tddPhase: "red|green|refactor" }
|
|
124
|
+
|
|
125
|
+
## Team Context
|
|
126
|
+
<!-- Agent Teams mode only. Populated at spawn time by orchestrator. -->
|
|
127
|
+
{teamComposition}
|
|
128
|
+
|
|
129
|
+
> This data is injected at spawn time. The SubagentStart hook provides only live coordination updates (task status changes, newly unblocked tasks).
|
|
130
|
+
|
|
131
|
+
## Historical Context
|
|
132
|
+
<!-- Agent Teams mode only. Populated at spawn time by orchestrator. -->
|
|
133
|
+
{historicalIntelligence}
|
|
134
|
+
|
|
135
|
+
> This data is injected at spawn time. The SubagentStart hook provides only live coordination updates.
|
|
136
|
+
|
|
137
|
+
## Quality Signals
|
|
138
|
+
<!-- Populated at dispatch time by orchestrator when quality hints are available. -->
|
|
139
|
+
<!-- Query: exarchos_view with action: 'quality_hints' and skill: '<skill-name>' -->
|
|
140
|
+
<!-- If hints array is non-empty, include this section. If empty, omit entirely. -->
|
|
141
|
+
|
|
142
|
+
Based on historical quality data for this skill:
|
|
143
|
+
|
|
144
|
+
{{#each hints}}
|
|
145
|
+
- **{{category}}** ({{severity}}): {{hint}}
|
|
146
|
+
{{/each}}
|
|
147
|
+
|
|
148
|
+
Use these signals to guide your implementation. Address warnings proactively.
|
|
149
|
+
|
|
150
|
+
## Code Exploration Tools
|
|
151
|
+
|
|
152
|
+
For navigating and understanding code:
|
|
153
|
+
- `Grep` — Search for patterns across the codebase
|
|
154
|
+
- `Glob` — Find files by name pattern
|
|
155
|
+
- `Read` — Read file contents (prefer targeted reads over full-file reads)
|
|
156
|
+
|
|
157
|
+
When Serena MCP is available, prefer semantic tools for precision:
|
|
158
|
+
- `mcp__plugin_serena_serena__find_symbol` — Locate classes, functions, methods by name
|
|
159
|
+
- `mcp__plugin_serena_serena__get_symbols_overview` — Understand file structure without reading entire files
|
|
160
|
+
- `mcp__plugin_serena_serena__search_for_pattern` — Regex search across the codebase
|
|
161
|
+
- `mcp__plugin_serena_serena__find_referencing_symbols` — Find all callers/users of a symbol
|
|
162
|
+
|
|
163
|
+
## Schema Sync (If Modifying API Files)
|
|
164
|
+
|
|
165
|
+
If this task modifies any of these file patterns, run schema sync after implementation:
|
|
166
|
+
- `*Endpoints.cs` - API endpoint definitions
|
|
167
|
+
- `Models/*.cs`, `Requests/*.cs`, `Responses/*.cs`, `Dtos/*.cs` - DTOs
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
# From worktree root
|
|
171
|
+
npm run sync:schemas
|
|
172
|
+
npm run typecheck
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
This regenerates TypeScript types from the OpenAPI spec. Include generated files in your commit.
|
|
176
|
+
|
|
177
|
+
## Commit Strategy
|
|
178
|
+
|
|
179
|
+
After completing each logical task within your assignment:
|
|
180
|
+
|
|
181
|
+
1. Stage the relevant files: `git add <files>`
|
|
182
|
+
2. Create a stacked branch: `gt create <task-branch-name> -m "feat: <task summary>"`
|
|
183
|
+
3. Continue to the next task (you are now on a new branch stacked on the previous)
|
|
184
|
+
|
|
185
|
+
After all tasks are complete:
|
|
186
|
+
4. Submit the full stack: `gt submit --no-interactive --publish --stack`
|
|
187
|
+
|
|
188
|
+
**IMPORTANT:** When using Graphite, never use `git commit` or `git push`. Always use `gt create` and `gt submit`.
|
|
189
|
+
|
|
190
|
+
### Grouping Guidance
|
|
191
|
+
|
|
192
|
+
Stack branches should match logical review units, not individual TDD test cycles. Group related changes that form a coherent feature into one stack layer. For example, if you implement types + config + tests for a module, that's one `gt create`, not three.
|
|
193
|
+
|
|
194
|
+
## Completion
|
|
195
|
+
|
|
196
|
+
When done, report:
|
|
197
|
+
1. Test file path and test name
|
|
198
|
+
2. Implementation file path
|
|
199
|
+
3. Test results (pass/fail)
|
|
200
|
+
4. Any issues encountered
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## Usage Example
|
|
204
|
+
|
|
205
|
+
```typescript
|
|
206
|
+
Task({
|
|
207
|
+
subagent_type: "general-purpose",
|
|
208
|
+
model: "opus",
|
|
209
|
+
description: "Implement user validation",
|
|
210
|
+
prompt: `
|
|
211
|
+
# Task: Implement User Email Validation
|
|
212
|
+
|
|
213
|
+
## Working Directory
|
|
214
|
+
/home/user/project/.worktrees/task-003
|
|
215
|
+
|
|
216
|
+
## CRITICAL: Worktree Verification (MANDATORY)
|
|
217
|
+
|
|
218
|
+
Before making ANY file changes, you MUST verify you are in a worktree:
|
|
219
|
+
|
|
220
|
+
1. Run: \`pwd\`
|
|
221
|
+
2. Verify the path contains \`.worktrees/\`
|
|
222
|
+
3. If NOT in a worktree directory:
|
|
223
|
+
- STOP immediately
|
|
224
|
+
- Report: "ERROR: Working directory is not a worktree. Aborting task."
|
|
225
|
+
- DO NOT proceed with any file modifications
|
|
226
|
+
|
|
227
|
+
**Example verification:**
|
|
228
|
+
\`\`\`bash
|
|
229
|
+
pwd | grep -q "\\.worktrees" || { echo "ERROR: Not in worktree!"; exit 1; }
|
|
230
|
+
\`\`\`
|
|
231
|
+
|
|
232
|
+
This check prevents accidental modifications to the main project root, which would cause merge conflicts with other parallel tasks.
|
|
233
|
+
|
|
234
|
+
## Task Description
|
|
235
|
+
Implement email validation for user registration. The validator should:
|
|
236
|
+
- Check email format using regex
|
|
237
|
+
- Verify domain has MX record (mock in tests)
|
|
238
|
+
- Return validation result with error messages
|
|
239
|
+
|
|
240
|
+
## Files to Modify
|
|
241
|
+
|
|
242
|
+
### Create/Modify:
|
|
243
|
+
- \`src/validators/email.ts\` - Email validation function
|
|
244
|
+
|
|
245
|
+
### Test Files:
|
|
246
|
+
- \`src/validators/email.test.ts\` - Validation tests
|
|
247
|
+
|
|
248
|
+
## TDD Requirements (MANDATORY)
|
|
249
|
+
|
|
250
|
+
You MUST follow strict Test-Driven Development:
|
|
251
|
+
|
|
252
|
+
### Phase 1: RED - Write Failing Test
|
|
253
|
+
|
|
254
|
+
1. Create test file at src/validators/email.test.ts
|
|
255
|
+
2. Write test: \`validateEmail_InvalidFormat_ReturnsError\`
|
|
256
|
+
3. Run tests: \`npm run test:run\`
|
|
257
|
+
4. VERIFY test fails for the expected reason
|
|
258
|
+
|
|
259
|
+
### Phase 2: GREEN - Minimum Implementation
|
|
260
|
+
|
|
261
|
+
1. Write minimum code in src/validators/email.ts
|
|
262
|
+
2. Run tests: \`npm run test:run\`
|
|
263
|
+
3. VERIFY test passes
|
|
264
|
+
|
|
265
|
+
### Phase 3: REFACTOR - Clean Up
|
|
266
|
+
|
|
267
|
+
1. Extract regex to constant
|
|
268
|
+
2. Run tests after change
|
|
269
|
+
3. VERIFY tests stay green
|
|
270
|
+
|
|
271
|
+
## Expected Test
|
|
272
|
+
|
|
273
|
+
\`\`\`typescript
|
|
274
|
+
describe('validateEmail', () => {
|
|
275
|
+
it('should return error when email format is invalid', async () => {
|
|
276
|
+
// Arrange
|
|
277
|
+
const invalidEmail = 'not-an-email';
|
|
278
|
+
|
|
279
|
+
// Act
|
|
280
|
+
const result = validateEmail(invalidEmail);
|
|
281
|
+
|
|
282
|
+
// Assert
|
|
283
|
+
expect(result.valid).toBe(false);
|
|
284
|
+
expect(result.error).toContain('format');
|
|
285
|
+
});
|
|
286
|
+
});
|
|
287
|
+
\`\`\`
|
|
288
|
+
|
|
289
|
+
## Success Criteria
|
|
290
|
+
|
|
291
|
+
- [ ] Test written BEFORE implementation
|
|
292
|
+
- [ ] Test fails for the right reason
|
|
293
|
+
- [ ] Implementation passes test
|
|
294
|
+
- [ ] No extra code beyond requirements
|
|
295
|
+
- [ ] All tests in worktree pass
|
|
296
|
+
`
|
|
297
|
+
})
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
## Key Principles
|
|
301
|
+
|
|
302
|
+
1. **Full Context** - Include everything the implementer needs
|
|
303
|
+
2. **No File References** - Don't say "see plan.md" - paste content
|
|
304
|
+
3. **Explicit Paths** - Absolute paths to working directory and files
|
|
305
|
+
4. **TDD Mandatory** - Always include TDD requirements
|
|
306
|
+
5. **Graphite-First** - Include commit strategy section; always use `gt create` and `gt submit`
|
|
307
|
+
6. **Clear Success Criteria** - Checkboxes for completion
|
|
308
|
+
|
|
309
|
+
## Agent Teams vs Subagent Mode
|
|
310
|
+
|
|
311
|
+
The template sections marked "Agent Teams mode only" (Coordination, Workflow Intelligence, Team Context, Historical Context) should be **included only when dispatching via Agent Teams mode** (`Task` with `team_name`). When dispatching via subagent mode (`Task` with `run_in_background`), omit these sections -- the SubagentStart hook handles context injection for subagents.
|
|
312
|
+
|
|
313
|
+
| Section | Agent Teams Mode | Subagent Mode |
|
|
314
|
+
|---------|-----------------|---------------|
|
|
315
|
+
| Coordination (Native APIs) | Include in spawn prompt | Omit (not applicable) |
|
|
316
|
+
| Workflow Intelligence (Exarchos MCP) | Include in spawn prompt | Omit (hook injects) |
|
|
317
|
+
| Team Context | Include -- populated at spawn time | Omit (hook injects) |
|
|
318
|
+
| Historical Context | Include -- populated at spawn time | Omit (hook injects) |
|
|
319
|
+
|
|
320
|
+
## MCP Auto-Loading
|
|
321
|
+
|
|
322
|
+
Teammates automatically load project MCP servers (including Exarchos). The Coordination and Workflow Intelligence sections guide WHICH tools to use, not HOW to access them. Do not include MCP connection instructions or tool registration details in the spawn prompt.
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Parallel Execution Strategy
|
|
2
|
+
|
|
3
|
+
## Identifying Parallel Groups
|
|
4
|
+
|
|
5
|
+
From implementation plan:
|
|
6
|
+
```markdown
|
|
7
|
+
## Parallel Groups
|
|
8
|
+
|
|
9
|
+
Group A (can run simultaneously):
|
|
10
|
+
- Task 001: Types
|
|
11
|
+
- Task 002: Interfaces
|
|
12
|
+
|
|
13
|
+
Group B (depends on Group A):
|
|
14
|
+
- Task 003: Implementation
|
|
15
|
+
- Task 004: API handlers
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Dispatching Parallel Tasks
|
|
19
|
+
|
|
20
|
+
**Critical:** Use single message with multiple Task calls:
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
// CORRECT: Single message, parallel execution
|
|
24
|
+
Task({ model: "opus", description: "Task 001", prompt: "..." })
|
|
25
|
+
Task({ model: "opus", description: "Task 002", prompt: "..." })
|
|
26
|
+
|
|
27
|
+
// WRONG: Separate messages = sequential
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Agent Teams Dispatch
|
|
31
|
+
|
|
32
|
+
When using `--mode agent-team`, parallel execution uses named teammates instead of Task tool calls:
|
|
33
|
+
|
|
34
|
+
### Creating the Team
|
|
35
|
+
|
|
36
|
+
Orchestrator activates delegate mode and describes the parallel work:
|
|
37
|
+
|
|
38
|
+
```text
|
|
39
|
+
"Create a team with 3 teammates:
|
|
40
|
+
- teammate-1: Work in /path/.worktrees/group-a on tasks 1-2 (settings)
|
|
41
|
+
- teammate-2: Work in /path/.worktrees/group-b on tasks 3-5 (gate bridge)
|
|
42
|
+
- teammate-3: Work in /path/.worktrees/group-c on tasks 6-8 (content)"
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Each teammate receives the full implementer prompt content as context.
|
|
46
|
+
|
|
47
|
+
### Self-Coordination
|
|
48
|
+
|
|
49
|
+
Teammates use Claude Code's native shared task list for claim/complete tracking. When a teammate becomes idle after completing its tasks, the `TeammateIdle` quality gate hook fires automatically, running quality checks and updating Exarchos workflow state (see SKILL.md State Bridge section).
|
|
50
|
+
|
|
51
|
+
### One Team Per Session
|
|
52
|
+
|
|
53
|
+
Agent Teams supports one team per session. If you need more parallel groups than teammates, assign multiple tasks per teammate (sequential within the group).
|
|
54
|
+
|
|
55
|
+
## Dispatch Mode Comparison
|
|
56
|
+
|
|
57
|
+
| Aspect | Task Tool (Subagent) | Agent Teams (Teammate) |
|
|
58
|
+
|--------|---------------------|----------------------|
|
|
59
|
+
| Parallel dispatch | Multiple `Task()` in one message | Named teammates in agent team |
|
|
60
|
+
| Waiting | `TaskOutput({ block: true })` | `TeammateIdle` hook (fires when teammate idle) |
|
|
61
|
+
| Visibility | None (background) | tmux split panes |
|
|
62
|
+
| Model control | `model: "opus"` per task | Session model for all |
|
|
63
|
+
| Max parallelism | Unlimited | One team, N teammates |
|
|
64
|
+
| Resume on crash | Task results preserved | Teammates lost (worktrees survive) |
|
|
65
|
+
|
|
66
|
+
## Waiting for Parallel Completion
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
// Wait for all background tasks
|
|
70
|
+
TaskOutput({ task_id: "task-001-id" })
|
|
71
|
+
TaskOutput({ task_id: "task-002-id" })
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Model Selection Guide
|
|
75
|
+
|
|
76
|
+
| Task Type | Model | Reason |
|
|
77
|
+
|-----------|-------|--------|
|
|
78
|
+
| Code implementation | `opus` | Best quality for coding |
|
|
79
|
+
| Code review | `opus` | Thorough analysis |
|
|
80
|
+
| File search/exploration | (default) | Speed over quality |
|
|
81
|
+
| Simple queries | `haiku` | Fast, low cost |
|
|
82
|
+
|
|
83
|
+
**Note:** When using Agent Teams, all teammates inherit the session's model. Use Task tool dispatch if you need per-task model selection (e.g., `haiku` for simple queries, `opus` for implementation).
|
|
84
|
+
|
|
85
|
+
## Agent Teams Dispatch Pattern
|
|
86
|
+
|
|
87
|
+
When using `--mode agent-team`, the orchestrator creates named teammates and delegates via natural language:
|
|
88
|
+
|
|
89
|
+
### Dispatch Example
|
|
90
|
+
|
|
91
|
+
```text
|
|
92
|
+
"Create a team with 4 teammates:
|
|
93
|
+
- wt1-schemas-views: Work in .worktrees/group-ab-schemas-views on Tasks 1-5 (event schemas + CQRS views)
|
|
94
|
+
- wt2-subagent: Work in .worktrees/group-c-subagent-context on Tasks 6-7 (SubagentStart enrichment)
|
|
95
|
+
- wt3-gates: Work in .worktrees/group-de-gates-lifecycle on Tasks 8-11 (TeammateIdle + lifecycle hooks)
|
|
96
|
+
- wt4-content: Work in .worktrees/group-f-skill-content on Tasks 12-13 (documentation updates)"
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Each teammate receives the full implementer prompt including TDD requirements, file paths, and commit strategy.
|
|
100
|
+
|
|
101
|
+
### Subagent vs Agent Teams Parallelism
|
|
102
|
+
|
|
103
|
+
| Aspect | Task Tool (Subagent) | Agent Teams (Teammate) |
|
|
104
|
+
|--------|---------------------|----------------------|
|
|
105
|
+
| Parallelism | Multiple `Task()` calls in one message | Named teammates in one team |
|
|
106
|
+
| Cross-task deps | Orchestrator manages phases | Shared task list + unblocked task detection |
|
|
107
|
+
| Monitoring | `TaskOutput` polling | tmux panes + `TeammateIdle` hook |
|
|
108
|
+
| State updates | Orchestrator updates state | Hook auto-updates via state bridge |
|
|
109
|
+
| Model per task | Yes (`model: "opus"` per Task) | No (session model for all) |
|
|
110
|
+
| Quality gates | Manual via `post-delegation-check.sh` | Automatic via `TeammateIdle` hook |
|
|
111
|
+
| Recovery | Task results preserved | Worktrees survive, teammates lost |
|
|
112
|
+
|
|
113
|
+
### Shared Task List Coordination
|
|
114
|
+
|
|
115
|
+
In Agent Teams mode, teammates coordinate via Claude Code's native shared task list:
|
|
116
|
+
1. Orchestrator creates tasks with dependencies
|
|
117
|
+
2. Teammates claim available (unblocked) tasks
|
|
118
|
+
3. On task completion, `TeammateIdle` hook runs quality gates
|
|
119
|
+
4. Hook scans task graph for newly unblocked work (dependencies all completed)
|
|
120
|
+
5. Teammate picks up next task or goes idle
|
|
121
|
+
|
|
122
|
+
### One Team Per Session
|
|
123
|
+
|
|
124
|
+
Agent Teams supports one team per session. For more parallel groups than teammates, assign sequential task chains to each teammate (e.g., "Do Task 1, then Task 2, then Task 3").
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# Property-Based Testing Patterns
|
|
2
|
+
|
|
3
|
+
When a task has `testingStrategy.propertyTests: true`, write property tests alongside example tests during the TDD RED phase. Property tests use generators to produce random inputs and invariant assertions to verify that properties hold across the entire input space.
|
|
4
|
+
|
|
5
|
+
## Roundtrip Pattern
|
|
6
|
+
|
|
7
|
+
For any encode/decode, serialize/deserialize, or transform/inverse-transform pair, the roundtrip property ensures no data is lost.
|
|
8
|
+
|
|
9
|
+
**TypeScript (fast-check):**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
import { fc } from '@fast-check/vitest';
|
|
13
|
+
|
|
14
|
+
describe('codec', () => {
|
|
15
|
+
it.prop([fc.anything()], (input) => {
|
|
16
|
+
expect(decode(encode(input))).toEqual(input);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
// Or with fc.assert:
|
|
20
|
+
it('roundtrip for strings', () => {
|
|
21
|
+
fc.assert(
|
|
22
|
+
fc.property(fc.string(), (s) => {
|
|
23
|
+
expect(decode(encode(s))).toBe(s);
|
|
24
|
+
})
|
|
25
|
+
);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**C# (FsCheck):**
|
|
31
|
+
|
|
32
|
+
```csharp
|
|
33
|
+
using FsCheck;
|
|
34
|
+
|
|
35
|
+
[Property]
|
|
36
|
+
public void Roundtrip_EncodeDecode(string input)
|
|
37
|
+
{
|
|
38
|
+
var encoded = Encode(input);
|
|
39
|
+
var decoded = Decode(encoded);
|
|
40
|
+
Assert.Equal(input, decoded);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Or with Prop.ForAll:
|
|
44
|
+
[Test]
|
|
45
|
+
public void Roundtrip_SerializeDeserialize()
|
|
46
|
+
{
|
|
47
|
+
Prop.ForAll<MyRecord>(record =>
|
|
48
|
+
{
|
|
49
|
+
var json = Serialize(record);
|
|
50
|
+
var result = Deserialize(json);
|
|
51
|
+
return result.Equals(record);
|
|
52
|
+
}).QuickCheck();
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Invariant Pattern
|
|
57
|
+
|
|
58
|
+
For operations with mathematical or business invariants that must hold for all inputs.
|
|
59
|
+
|
|
60
|
+
**TypeScript (fast-check):**
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
describe('scoring', () => {
|
|
64
|
+
it.prop([fc.integer(), fc.integer()], (a, b) => {
|
|
65
|
+
const result = calculateScore(a, b);
|
|
66
|
+
expect(result).toBeGreaterThanOrEqual(0);
|
|
67
|
+
expect(result).toBeLessThanOrEqual(1);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it.prop([fc.array(fc.integer())], (items) => {
|
|
71
|
+
const result = computeTotal(items);
|
|
72
|
+
expect(result).toBeGreaterThanOrEqual(0);
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**C# (FsCheck):**
|
|
78
|
+
|
|
79
|
+
```csharp
|
|
80
|
+
[Property]
|
|
81
|
+
public void Score_AlwaysInRange(int a, int b)
|
|
82
|
+
{
|
|
83
|
+
var score = CalculateScore(a, b);
|
|
84
|
+
Assert.InRange(score, 0.0, 1.0);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
[Property]
|
|
88
|
+
public void Collection_SizeNeverNegative(List<int> items)
|
|
89
|
+
{
|
|
90
|
+
var result = ProcessItems(items);
|
|
91
|
+
Assert.True(result.Count >= 0);
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Idempotence Pattern
|
|
96
|
+
|
|
97
|
+
For operations where applying the function twice produces the same result as applying it once: `f(f(x)) === f(x)`.
|
|
98
|
+
|
|
99
|
+
**TypeScript (fast-check):**
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
describe('normalization', () => {
|
|
103
|
+
it.prop([fc.array(fc.integer())], (arr) => {
|
|
104
|
+
expect(sort(sort(arr))).toEqual(sort(arr));
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it.prop([fc.string()], (input) => {
|
|
108
|
+
expect(normalize(normalize(input))).toBe(normalize(input));
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**C# (FsCheck):**
|
|
114
|
+
|
|
115
|
+
```csharp
|
|
116
|
+
[Property]
|
|
117
|
+
public void Sort_Idempotent(List<int> items)
|
|
118
|
+
{
|
|
119
|
+
var once = Sort(items);
|
|
120
|
+
var twice = Sort(once);
|
|
121
|
+
Assert.Equal(once, twice);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
[Property]
|
|
125
|
+
public void Normalize_Idempotent(string input)
|
|
126
|
+
{
|
|
127
|
+
var once = Normalize(input);
|
|
128
|
+
var twice = Normalize(once);
|
|
129
|
+
Assert.Equal(once, twice);
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Commutativity Pattern
|
|
134
|
+
|
|
135
|
+
For operations where order should not affect the result.
|
|
136
|
+
|
|
137
|
+
**TypeScript (fast-check):**
|
|
138
|
+
|
|
139
|
+
```typescript
|
|
140
|
+
describe('event materialization', () => {
|
|
141
|
+
it.prop(
|
|
142
|
+
[fc.array(eventArb()), fc.array(eventArb())],
|
|
143
|
+
(eventsA, eventsB) => {
|
|
144
|
+
const resultAB = materialize([...eventsA, ...eventsB]);
|
|
145
|
+
const resultBA = materialize([...eventsB, ...eventsA]);
|
|
146
|
+
expect(resultAB).toEqual(resultBA);
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
});
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**C# (FsCheck):**
|
|
153
|
+
|
|
154
|
+
```csharp
|
|
155
|
+
[Property]
|
|
156
|
+
public void Merge_Commutative(List<int> a, List<int> b)
|
|
157
|
+
{
|
|
158
|
+
var resultAB = Merge(a, b);
|
|
159
|
+
var resultBA = Merge(b, a);
|
|
160
|
+
Assert.Equal(resultAB, resultBA);
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Integration with TDD RED Phase
|
|
165
|
+
|
|
166
|
+
Property tests are written as part of the TDD RED phase, alongside example tests:
|
|
167
|
+
|
|
168
|
+
1. **RED:** Write example test (specific case) AND property test (general invariant)
|
|
169
|
+
2. **GREEN:** Implement minimum code to pass both
|
|
170
|
+
3. **REFACTOR:** Extract generators, improve property descriptions
|
|
171
|
+
|
|
172
|
+
Property tests complement example tests -- they do not replace them. Example tests document specific behaviors; property tests verify invariants across the input domain.
|