@glrs-dev/cli 0.0.1 → 0.1.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/CHANGELOG.md +50 -0
- package/README.md +14 -15
- package/dist/chunk-3RG5ZIWI.js +10 -0
- package/dist/chunk-6RHN2EDH.js +93 -0
- package/dist/chunk-DEODG2LC.js +55 -0
- package/dist/chunk-FSAGM22T.js +17 -0
- package/dist/chunk-GQBZREK5.js +136 -0
- package/dist/chunk-HWMRY35D.js +139 -0
- package/dist/chunk-LMRDQ4GW.js +129 -0
- package/dist/chunk-NLPX2KOF.js +149 -0
- package/dist/chunk-P7PRH4I3.js +177 -0
- package/dist/chunk-VCN7RNLU.js +60 -0
- package/dist/chunk-VJFNIKQJ.js +120 -0
- package/dist/chunk-W37UX3U2.js +35 -0
- package/dist/chunk-YBCA3IP6.js +25 -0
- package/dist/chunk-YGNDPKIW.js +99 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +89 -36
- package/dist/commands/cleanup.d.ts +19 -0
- package/dist/commands/cleanup.js +11 -0
- package/dist/commands/create.d.ts +17 -0
- package/dist/commands/create.js +12 -0
- package/dist/commands/delete.d.ts +17 -0
- package/dist/commands/delete.js +12 -0
- package/dist/commands/go.d.ts +4 -0
- package/dist/commands/go.js +11 -0
- package/dist/commands/list.d.ts +15 -0
- package/dist/commands/list.js +12 -0
- package/dist/commands/switch.d.ts +11 -0
- package/dist/commands/switch.js +12 -0
- package/dist/commands/types.d.ts +10 -0
- package/dist/commands/types.js +0 -0
- package/dist/index.d.ts +16 -19
- package/dist/index.js +4 -1
- package/dist/lib/config.d.ts +14 -0
- package/dist/lib/config.js +14 -0
- package/dist/lib/fmt.d.ts +12 -0
- package/dist/lib/fmt.js +25 -0
- package/dist/lib/git.d.ts +26 -0
- package/dist/lib/git.js +25 -0
- package/dist/lib/registry.d.ts +14 -0
- package/dist/lib/registry.js +13 -0
- package/dist/lib/select.d.ts +21 -0
- package/dist/lib/select.js +10 -0
- package/dist/lib/worktree.d.ts +35 -0
- package/dist/lib/worktree.js +17 -0
- package/dist/vendor/harness-opencode/dist/agents/prompts/agents-md-writer.md +89 -0
- package/dist/vendor/harness-opencode/dist/agents/prompts/architecture-advisor.md +46 -0
- package/dist/vendor/harness-opencode/dist/agents/prompts/build.md +93 -0
- package/dist/vendor/harness-opencode/dist/agents/prompts/code-searcher.md +54 -0
- package/dist/vendor/harness-opencode/dist/agents/prompts/docs-maintainer.md +128 -0
- package/dist/vendor/harness-opencode/dist/agents/prompts/gap-analyzer.md +44 -0
- package/dist/vendor/harness-opencode/dist/agents/prompts/lib-reader.md +39 -0
- package/dist/vendor/harness-opencode/dist/agents/prompts/pilot-builder.md +107 -0
- package/dist/vendor/harness-opencode/dist/agents/prompts/pilot-planner.md +153 -0
- package/dist/vendor/harness-opencode/dist/agents/prompts/plan-reviewer.md +49 -0
- package/dist/vendor/harness-opencode/dist/agents/prompts/plan.md +144 -0
- package/dist/vendor/harness-opencode/dist/agents/prompts/prime.md +374 -0
- package/dist/vendor/harness-opencode/dist/agents/prompts/qa-reviewer.md +68 -0
- package/dist/vendor/harness-opencode/dist/agents/prompts/qa-thorough.md +63 -0
- package/dist/vendor/harness-opencode/dist/agents/prompts/research.md +138 -0
- package/dist/vendor/harness-opencode/dist/agents/shared/index.ts +26 -0
- package/dist/vendor/harness-opencode/dist/agents/shared/workflow-mechanics.md +32 -0
- package/dist/vendor/harness-opencode/dist/bin/memory-mcp-launcher.sh +145 -0
- package/dist/vendor/harness-opencode/dist/bin/plan-check.sh +255 -0
- package/dist/vendor/harness-opencode/dist/chunk-VJUETC6A.js +205 -0
- package/dist/vendor/harness-opencode/dist/chunk-VVMP6QWS.js +731 -0
- package/dist/vendor/harness-opencode/dist/chunk-XCZ3NOXR.js +703 -0
- package/dist/vendor/harness-opencode/dist/cli.d.ts +1 -0
- package/dist/vendor/harness-opencode/dist/cli.js +5096 -0
- package/dist/vendor/harness-opencode/dist/commands/prompts/autopilot.md +96 -0
- package/dist/vendor/harness-opencode/dist/commands/prompts/costs.md +94 -0
- package/dist/vendor/harness-opencode/dist/commands/prompts/fresh.md +382 -0
- package/dist/vendor/harness-opencode/dist/commands/prompts/init-deep.md +196 -0
- package/dist/vendor/harness-opencode/dist/commands/prompts/research.md +27 -0
- package/dist/vendor/harness-opencode/dist/commands/prompts/review.md +96 -0
- package/dist/vendor/harness-opencode/dist/commands/prompts/ship.md +104 -0
- package/dist/vendor/harness-opencode/dist/index.d.ts +21 -0
- package/dist/vendor/harness-opencode/dist/index.js +2092 -0
- package/dist/vendor/harness-opencode/dist/install-4EYR56OR.js +9 -0
- package/dist/vendor/harness-opencode/dist/skills/agent-estimation/SKILL.md +159 -0
- package/dist/vendor/harness-opencode/dist/skills/paths.ts +18 -0
- package/dist/vendor/harness-opencode/dist/skills/pilot-planning/SKILL.md +49 -0
- package/dist/vendor/harness-opencode/dist/skills/pilot-planning/rules/dag-shape.md +47 -0
- package/dist/vendor/harness-opencode/dist/skills/pilot-planning/rules/decomposition.md +36 -0
- package/dist/vendor/harness-opencode/dist/skills/pilot-planning/rules/first-principles.md +29 -0
- package/dist/vendor/harness-opencode/dist/skills/pilot-planning/rules/milestones.md +57 -0
- package/dist/vendor/harness-opencode/dist/skills/pilot-planning/rules/self-review.md +46 -0
- package/dist/vendor/harness-opencode/dist/skills/pilot-planning/rules/task-context.md +47 -0
- package/dist/vendor/harness-opencode/dist/skills/pilot-planning/rules/touches-scope.md +47 -0
- package/dist/vendor/harness-opencode/dist/skills/pilot-planning/rules/verify-design.md +53 -0
- package/dist/vendor/harness-opencode/dist/skills/research/SKILL.md +350 -0
- package/dist/vendor/harness-opencode/dist/skills/research-auto/SKILL.md +283 -0
- package/dist/vendor/harness-opencode/dist/skills/research-local/SKILL.md +268 -0
- package/dist/vendor/harness-opencode/dist/skills/research-web/SKILL.md +119 -0
- package/dist/vendor/harness-opencode/dist/skills/review-plan/SKILL.md +32 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-composition-patterns/AGENTS.md +946 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-composition-patterns/README.md +60 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-composition-patterns/SKILL.md +89 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-composition-patterns/rules/architecture-avoid-boolean-props.md +100 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-composition-patterns/rules/architecture-compound-components.md +112 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-composition-patterns/rules/patterns-children-over-render-props.md +87 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-composition-patterns/rules/patterns-explicit-variants.md +100 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-composition-patterns/rules/react19-no-forwardref.md +42 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-composition-patterns/rules/state-context-interface.md +191 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-composition-patterns/rules/state-decouple-implementation.md +113 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-composition-patterns/rules/state-lift-state.md +125 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/AGENTS.md +2975 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/README.md +123 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/SKILL.md +137 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/advanced-event-handler-refs.md +55 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/advanced-init-once.md +42 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/advanced-use-latest.md +39 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/async-api-routes.md +38 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/async-defer-await.md +80 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/async-dependencies.md +51 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/async-parallel.md +28 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/async-suspense-boundaries.md +99 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/bundle-barrel-imports.md +59 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/bundle-conditional.md +31 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/bundle-defer-third-party.md +49 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/bundle-dynamic-imports.md +35 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/bundle-preload.md +50 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/client-event-listeners.md +74 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/client-localstorage-schema.md +71 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/client-passive-event-listeners.md +48 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/client-swr-dedup.md +56 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/js-batch-dom-css.md +107 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/js-cache-function-results.md +80 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/js-cache-property-access.md +28 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/js-cache-storage.md +70 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/js-combine-iterations.md +32 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/js-early-exit.md +50 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/js-hoist-regexp.md +45 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/js-index-maps.md +37 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/js-length-check-first.md +49 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/js-min-max-loop.md +82 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/js-set-map-lookups.md +24 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/js-tosorted-immutable.md +57 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/rendering-activity.md +26 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/rendering-conditional-render.md +40 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/rendering-content-visibility.md +38 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/rendering-hoist-jsx.md +46 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/rendering-hydration-suppress-warning.md +30 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/rendering-svg-precision.md +28 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/rendering-usetransition-loading.md +75 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/rerender-defer-reads.md +39 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/rerender-dependencies.md +45 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/rerender-derived-state-no-effect.md +40 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/rerender-derived-state.md +29 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/rerender-functional-setstate.md +74 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/rerender-lazy-state-init.md +58 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/rerender-memo-with-default-value.md +38 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/rerender-memo.md +44 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/rerender-move-effect-to-event.md +45 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/rerender-simple-expression-in-memo.md +35 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/rerender-transitions.md +40 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/rerender-use-ref-transient-values.md +73 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/server-after-nonblocking.md +73 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/server-auth-actions.md +96 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/server-cache-lru.md +41 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/server-cache-react.md +76 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/server-dedup-props.md +65 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/server-hoist-static-io.md +142 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/server-parallel-fetching.md +83 -0
- package/dist/vendor/harness-opencode/dist/skills/vercel-react-best-practices/rules/server-serialization.md +38 -0
- package/dist/vendor/harness-opencode/dist/skills/web-design-guidelines/SKILL.md +39 -0
- package/dist/vendor/harness-opencode/package.json +11 -0
- package/package.json +20 -15
- package/LICENSE +0 -21
- package/dist/chunk-TU23AE2F.js +0 -69
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agent-estimation
|
|
3
|
+
description: Estimate AI-agent task effort in tool-call rounds first, convert to wallclock only at the end. Use when the user asks 'how long will this take', 'estimate this', 'scope this work', 'round budget', 'effort estimate', or asks for a timeline on agent-executed work. Produces a structured module-breakdown table with risk coefficients and a final wallclock range. Avoids the systematic overestimation that happens when agents anchor to human-developer timelines from training data.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Agent Work Estimation
|
|
7
|
+
|
|
8
|
+
## Why this skill exists
|
|
9
|
+
|
|
10
|
+
AI coding agents systematically overestimate task duration because they anchor to human-developer timelines absorbed from training data. A task you can complete in 30 minutes of agent time gets estimated as "2-3 days" because that's what a StackOverflow answer would say.
|
|
11
|
+
|
|
12
|
+
**The fix:** estimate in your own operational units — tool-call rounds — first. Convert to human wallclock only at the very end, as the last step.
|
|
13
|
+
|
|
14
|
+
This skill is adapted for the harness-opencode environment from the OpenClaw `hjw21century/agent-estimation` skill. Original source: https://openclawlaunch.com/skills/agent-estimation.
|
|
15
|
+
|
|
16
|
+
## Units
|
|
17
|
+
|
|
18
|
+
| Unit | Definition | Scale |
|
|
19
|
+
|------|------------|-------|
|
|
20
|
+
| **Round** | One tool-call cycle: think → write/edit → execute → read output → decide if fix needed | ~2-4 min wallclock |
|
|
21
|
+
| **Module** | A functional unit built from multiple rounds until it's usable on its own | 2-15 rounds |
|
|
22
|
+
| **Project** | Sum of modules + integration rounds | Σ(modules) + integration |
|
|
23
|
+
|
|
24
|
+
A **Round** is the atomic unit. It maps to one iteration of:
|
|
25
|
+
|
|
26
|
+
1. Agent reasons about what to do.
|
|
27
|
+
2. Agent writes or edits code.
|
|
28
|
+
3. Agent runs the code or a test.
|
|
29
|
+
4. Agent reads the output.
|
|
30
|
+
5. Agent decides if it needs to fix something. If yes → next round.
|
|
31
|
+
|
|
32
|
+
## Procedure
|
|
33
|
+
|
|
34
|
+
Follow these five steps in order. Do NOT skip step 5 — premature wallclock conversion is the failure mode.
|
|
35
|
+
|
|
36
|
+
### Step 1: Decompose into modules
|
|
37
|
+
|
|
38
|
+
Break the task into functional modules. Each module should be independently buildable and testable. Ask: "What are the distinct pieces I would build one at a time?"
|
|
39
|
+
|
|
40
|
+
### Step 2: Estimate base rounds per module
|
|
41
|
+
|
|
42
|
+
Use these anchors:
|
|
43
|
+
|
|
44
|
+
| Pattern | Typical rounds | Examples |
|
|
45
|
+
|---------|----------------|----------|
|
|
46
|
+
| **Boilerplate / known pattern** | 1-2 | CRUD endpoint, config file, standard API client, adding a file to match an existing recipe |
|
|
47
|
+
| **Moderate complexity** | 3-5 | Custom UI layout, state management, data pipeline, non-trivial refactor |
|
|
48
|
+
| **Exploratory / under-documented** | 5-10 | Unfamiliar framework, platform-specific APIs, complex integrations |
|
|
49
|
+
| **High uncertainty** | 8-15 | Undocumented behavior, novel algorithms, multi-system debugging |
|
|
50
|
+
|
|
51
|
+
Calibration rules:
|
|
52
|
+
|
|
53
|
+
- If you can generate the code in one shot and it will likely run → **1 round**.
|
|
54
|
+
- If you'll generate, run, see an error, fix → **2-3 rounds**.
|
|
55
|
+
- If the library/framework has sparse docs and you'll be guessing → **5+ rounds**.
|
|
56
|
+
- If it involves platform permissions, OS-level APIs, or environment-specific behavior the user must manually verify → add **2-3 rounds**.
|
|
57
|
+
|
|
58
|
+
### Step 3: Assign risk coefficients
|
|
59
|
+
|
|
60
|
+
Each module gets a coefficient that inflates its round count:
|
|
61
|
+
|
|
62
|
+
| Risk | Coefficient | When to apply |
|
|
63
|
+
|------|-------------|---------------|
|
|
64
|
+
| **Low** | 1.0 | Mature ecosystem, clear docs, strong pattern match |
|
|
65
|
+
| **Medium** | 1.3 | Minor unknowns, may need 1-2 extra debug rounds |
|
|
66
|
+
| **High** | 1.5 | Sparse docs, platform quirks, integration unknowns |
|
|
67
|
+
| **Very High** | 2.0 | Possible dead ends, may need to change approach entirely |
|
|
68
|
+
|
|
69
|
+
### Step 4: Calculate totals
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
module_effective_rounds = base_rounds × risk_coefficient
|
|
73
|
+
project_rounds = Σ(module_effective_rounds) + integration_rounds
|
|
74
|
+
integration_rounds = 10-20% of base total (wiring modules together)
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Step 5: Convert to wallclock — LAST
|
|
78
|
+
|
|
79
|
+
Only after steps 1-4 are complete:
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
wallclock = project_rounds × minutes_per_round
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Default `minutes_per_round = 3` (agent generation + user review).
|
|
86
|
+
|
|
87
|
+
Adjust:
|
|
88
|
+
|
|
89
|
+
- Fast iteration, user barely reviews → **2 min/round**.
|
|
90
|
+
- Complex domain, user carefully reviews each step → **4 min/round**.
|
|
91
|
+
- User needs to manually test (mobile, hardware, permissions) → **5 min/round**.
|
|
92
|
+
|
|
93
|
+
## Output format
|
|
94
|
+
|
|
95
|
+
Always produce the estimation in this exact structure:
|
|
96
|
+
|
|
97
|
+
```markdown
|
|
98
|
+
### Task: <task name>
|
|
99
|
+
|
|
100
|
+
#### Module breakdown
|
|
101
|
+
|
|
102
|
+
| # | Module | Base rounds | Risk | Effective rounds | Notes |
|
|
103
|
+
|---|--------|-------------|------|------------------|-------|
|
|
104
|
+
| 1 | ... | N | 1.x | M | why |
|
|
105
|
+
| 2 | ... | N | 1.x | M | why |
|
|
106
|
+
|
|
107
|
+
#### Summary
|
|
108
|
+
|
|
109
|
+
- **Base rounds:** X
|
|
110
|
+
- **Integration:** +Y rounds
|
|
111
|
+
- **Risk-adjusted total:** Z rounds
|
|
112
|
+
- **Estimated wallclock:** A – B minutes (at N min/round)
|
|
113
|
+
|
|
114
|
+
#### Biggest risks
|
|
115
|
+
|
|
116
|
+
1. <specific risk and what could blow up the estimate>
|
|
117
|
+
2. <…>
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Anti-patterns to avoid
|
|
121
|
+
|
|
122
|
+
These are the exact failure modes this skill exists to prevent:
|
|
123
|
+
|
|
124
|
+
1. **Human-time anchoring:** "A developer would take about 2 weeks…" → NO. Start from rounds.
|
|
125
|
+
2. **Padding by vibes:** Adding time "just to be safe" without a specific risk rationale → NO. Use risk coefficients; each bump must have a reason.
|
|
126
|
+
3. **Confusing complexity with volume:** 500 lines of boilerplate ≠ hard. One line of CGEvent API ≠ easy. Estimate by uncertainty, not line count.
|
|
127
|
+
4. **Forgetting integration cost:** Modules work alone but break together. Always add 10-20% for integration.
|
|
128
|
+
5. **Ignoring user-side bottlenecks:** If the user must grant permissions, restart an app, or test on a device, that's extra round time. Adjust `minutes_per_round` upward, don't add phantom rounds.
|
|
129
|
+
6. **Premature wallclock conversion:** If you computed minutes before finishing step 4, start over. The whole point is to think in rounds first.
|
|
130
|
+
|
|
131
|
+
## Calibration examples
|
|
132
|
+
|
|
133
|
+
These anchor what "N rounds" feels like in this codebase. Use them as reference points when estimating similar work.
|
|
134
|
+
|
|
135
|
+
| Project | Module count | Total rounds | Notes |
|
|
136
|
+
|---------|--------------|--------------|-------|
|
|
137
|
+
| Add a new bundled skill (SKILL.md + test bump + build verify) | 1 | 2-3 | Recipe-driven, mature test suite, no new wiring |
|
|
138
|
+
| Add a new agent with prompt + registration + test | 2 | 4-6 | New prompt file + `createAgents()` entry + test case |
|
|
139
|
+
| Add a new slash command | 2 | 3-5 | Prompt file + `createCommands()` entry |
|
|
140
|
+
| Add a new custom tool with schema + handler + test | 3 | 8-12 | Schema design + handler logic + integration point |
|
|
141
|
+
| Refactor a cross-cutting concern (e.g., permission maps across all agents) | 3-5 | 15-25 | Medium-high risk due to surface area |
|
|
142
|
+
| Add a new sub-plugin (hook + registration + tests) | 3-4 | 12-18 | Plugin API surface, test fixtures |
|
|
143
|
+
| Non-trivial pilot subsystem feature (new verb, new scheduler rule) | 4-6 | 20-40 | Higher risk; SQLite schema + CLI + worker wiring |
|
|
144
|
+
|
|
145
|
+
When in doubt, pick the closest example and adjust the risk coefficient for what makes this specific task different.
|
|
146
|
+
|
|
147
|
+
## When to use this skill
|
|
148
|
+
|
|
149
|
+
- Scoping a coding task before starting implementation.
|
|
150
|
+
- Comparing two implementation approaches by round cost.
|
|
151
|
+
- Setting realistic expectations with the user on agent-executed work.
|
|
152
|
+
- Identifying which modules carry the most schedule risk.
|
|
153
|
+
- Deciding whether a task fits in one session or needs to be split.
|
|
154
|
+
|
|
155
|
+
## When NOT to use this skill
|
|
156
|
+
|
|
157
|
+
- Trivial one-line edits (typo fixes, rename). Just do it; estimating takes longer than the work.
|
|
158
|
+
- Open-ended research tasks where the "module breakdown" is the research itself. Estimate after the first exploratory round, not before.
|
|
159
|
+
- Questions that aren't about effort ("how does X work", "what's the right pattern"). Answer the actual question.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { fileURLToPath } from "node:url";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Returns the absolute path to the bundled dist/skills/ directory.
|
|
6
|
+
*
|
|
7
|
+
* The plugin ships as ESM (tsup default). `import.meta.url` resolves to the
|
|
8
|
+
* plugin's own dist/index.js, which lives alongside dist/skills/ in the
|
|
9
|
+
* tsup-emitted output. Resolving relative to the module URL is both simple
|
|
10
|
+
* and robust against npm-cache path variance.
|
|
11
|
+
*
|
|
12
|
+
* No createRequire / require.resolve needed — verified by Spike 1 against
|
|
13
|
+
* OpenCode 1.14.19 on macOS.
|
|
14
|
+
*/
|
|
15
|
+
export function getSkillsRoot(): string {
|
|
16
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
17
|
+
return join(here, "skills");
|
|
18
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pilot-planning
|
|
3
|
+
description: Methodology for producing a pilot.yaml plan that the pilot-builder agent can execute unattended. Use when the pilot-planner agent receives a feature request — covers task decomposition, verify-command design, scope tightness, DAG shape, and self-review. Auto-loaded by the pilot-planner agent.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Pilot Planning Skill
|
|
7
|
+
|
|
8
|
+
You are producing a `pilot.yaml` plan: a list of tasks the pilot-builder agent can execute one at a time, fully unattended. The cost of a bad plan is high — the builder will fail tasks confusingly, the cascade-fail will block downstream work, and the human pilot operator has to clean up worktrees and re-plan.
|
|
9
|
+
|
|
10
|
+
A good plan trades a planning-session's worth of patient thought for hours of unsupervised builder time. Take the patient thought.
|
|
11
|
+
|
|
12
|
+
## Workflow
|
|
13
|
+
|
|
14
|
+
Apply these eight rules in order. Each rule has its own file in `rules/` for the full text:
|
|
15
|
+
|
|
16
|
+
1. [`first-principles.md`](rules/first-principles.md) — Frame the task FROM the user's intent, not from a templated checklist. Ask "what does the user actually want done?" before "what files might change?"
|
|
17
|
+
|
|
18
|
+
2. [`decomposition.md`](rules/decomposition.md) — Break the work into right-sized tasks (10-30 minutes of agent time, ≤3 attempts). Too big = unbounded work; too small = orchestration overhead drowns the value.
|
|
19
|
+
|
|
20
|
+
3. [`verify-design.md`](rules/verify-design.md) — Each task's `verify:` commands must succeed iff the task is correctly done. No `echo done`. No `test -f file.ts`. Real assertions only.
|
|
21
|
+
|
|
22
|
+
4. [`touches-scope.md`](rules/touches-scope.md) — `touches:` globs must be the tightest set that lets the task succeed. Default to "specific file paths"; `**` is a smell.
|
|
23
|
+
|
|
24
|
+
5. [`dag-shape.md`](rules/dag-shape.md) — Tasks depend on each other only when there's a real semantic dependency (B reads what A produces). False dependencies make the run sequential when it could parallel; missing dependencies cause subtle race-on-state bugs.
|
|
25
|
+
|
|
26
|
+
6. [`milestones.md`](rules/milestones.md) — Optional grouping. Use when several tasks share a "is this batch done?" check (e.g. integration tests after a chunk of unit-test work).
|
|
27
|
+
|
|
28
|
+
7. [`self-review.md`](rules/self-review.md) — Before declaring the plan ready, run through a 7-question checklist. Find the holes yourself; the validator only catches schema errors.
|
|
29
|
+
|
|
30
|
+
8. [`task-context.md`](rules/task-context.md) — Every non-trivial task carries a `context:` block. Thin plans fail because the builder works each task from scratch with no carry-over; rich context pre-loads what the builder needs to work confidently. Cover outcome, rationale, code pointers, acceptance.
|
|
31
|
+
|
|
32
|
+
## After applying the rules
|
|
33
|
+
|
|
34
|
+
1. Save the YAML to the path returned by `bunx @glrs-dev/harness-plugin-opencode pilot plan-dir`.
|
|
35
|
+
2. Run `bunx @glrs-dev/harness-plugin-opencode pilot validate <path>` and fix every error / warning.
|
|
36
|
+
3. Hand off to the user with: `Plan saved to <path>. Next: bunx @glrs-dev/harness-plugin-opencode pilot build`.
|
|
37
|
+
|
|
38
|
+
Do NOT summarize the plan in chat. The user can read the YAML.
|
|
39
|
+
|
|
40
|
+
## When to refuse
|
|
41
|
+
|
|
42
|
+
If, after applying the methodology, you cannot produce a plan with at least:
|
|
43
|
+
|
|
44
|
+
- 2 tasks
|
|
45
|
+
- Each with non-trivial verify
|
|
46
|
+
- Each with tight `touches`
|
|
47
|
+
- A coherent DAG
|
|
48
|
+
|
|
49
|
+
…tell the user the work isn't ready for pilot. Suggest they break it down themselves first, or use the regular `/plan` agent (markdown plans, human-driven execution). It is far better to refuse than to ship a bad plan.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Rule 5 — DAG shape
|
|
2
|
+
|
|
3
|
+
**Tasks depend on each other only when there's a real semantic dependency.**
|
|
4
|
+
|
|
5
|
+
The `depends_on` edges in the plan determine run order. False edges serialize work that could parallelize (v0.3); missing edges let a downstream task run against a state where its prerequisite hasn't committed yet.
|
|
6
|
+
|
|
7
|
+
## What a real dependency looks like
|
|
8
|
+
|
|
9
|
+
- **Reads code that the dep produces.** T2 imports a function T1 introduced.
|
|
10
|
+
- **Reads schema that the dep modifies.** T2 calls an endpoint T1 added.
|
|
11
|
+
- **Tests behavior the dep implements.** T2's verify runs a test T1's code makes pass.
|
|
12
|
+
|
|
13
|
+
## What ISN'T a real dependency
|
|
14
|
+
|
|
15
|
+
- "T1 should run first because it's foundational." If T2 doesn't use T1's output, the order doesn't matter for correctness — and forcing it costs you parallelism.
|
|
16
|
+
- "Both touch `src/api/`." Touch overlap is a worktree-pool concern (v0.3), not a logical dependency. Capture it via `touches:` if at all.
|
|
17
|
+
- "I want T1 to be done before I review T2." That's a human-review concern, not a pilot DAG concern. The pilot run completes; you review afterward.
|
|
18
|
+
|
|
19
|
+
## Common shapes
|
|
20
|
+
|
|
21
|
+
**Linear** — T1 → T2 → T3:
|
|
22
|
+
|
|
23
|
+
Each task is the next layer. Use when each layer literally builds on the previous.
|
|
24
|
+
|
|
25
|
+
**Diamond** — T1 fans out to T2, T3; both reconverge into T4:
|
|
26
|
+
|
|
27
|
+
T1 = "introduce module skeleton"; T2, T3 = "fill in submodule X / Y" (parallelizable on disjoint scopes); T4 = "wire up everything and run integration tests".
|
|
28
|
+
|
|
29
|
+
**Disconnected** — Two independent components in the same plan:
|
|
30
|
+
|
|
31
|
+
`auth-1`, `auth-2` are one chain; `billing-1`, `billing-2` are another. Use when the plan covers multiple unrelated improvements.
|
|
32
|
+
|
|
33
|
+
**Hub-and-spoke** — Many tasks all depend on T1 but not on each other:
|
|
34
|
+
|
|
35
|
+
T1 = "add the typed client"; T2-Tn each = "use the typed client in module M". All Tn parallelize.
|
|
36
|
+
|
|
37
|
+
## Cycle detection
|
|
38
|
+
|
|
39
|
+
The validator catches cycles. If you accidentally write `T1 → T2 → T1`, validate will tell you. Most cycles arise from copy-paste in `depends_on` lists; check yours before saving.
|
|
40
|
+
|
|
41
|
+
## Self-loops
|
|
42
|
+
|
|
43
|
+
`T1: depends_on: [T1]` is a self-loop, also caught by validate. Always a typo.
|
|
44
|
+
|
|
45
|
+
## "I want everything serial"
|
|
46
|
+
|
|
47
|
+
Sometimes the right answer IS a fully linear DAG (e.g., a refactor where each step's diff would conflict with the next). Don't be afraid to chain everything if that's the truth — but don't pretend it's the truth when it isn't.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Rule 2 — Decomposition
|
|
2
|
+
|
|
3
|
+
**Right-sized tasks: 10-30 minutes of agent time, ≤3 attempts to pass verify.**
|
|
4
|
+
|
|
5
|
+
A "right-sized" pilot task is one the pilot-builder can complete in a single session within the default `max_turns: 50` budget. Empirically, that's about 10-30 minutes of agent wall time and 1-3 attempts.
|
|
6
|
+
|
|
7
|
+
## Sizing heuristics
|
|
8
|
+
|
|
9
|
+
**Too big (split it):**
|
|
10
|
+
|
|
11
|
+
- The verify command exercises >3 distinct code paths.
|
|
12
|
+
- The task touches >5 files.
|
|
13
|
+
- The prompt has >10 numbered steps.
|
|
14
|
+
- The task says "and also" / "while you're at it" — a sign of conjoined work.
|
|
15
|
+
|
|
16
|
+
**Too small (merge it):**
|
|
17
|
+
|
|
18
|
+
- The task touches a single file with <30 lines added/changed.
|
|
19
|
+
- The verify command would also pass before the task ran.
|
|
20
|
+
- Splitting added a `depends_on` edge that just moves work around.
|
|
21
|
+
|
|
22
|
+
## Splitting patterns
|
|
23
|
+
|
|
24
|
+
- **Layer-by-layer**: schema → DB accessors → API → wiring. Each layer has its own tests; each is a task.
|
|
25
|
+
- **Read → Write**: T1 = "add a function that returns the data", T2 = "add an endpoint that calls it". T2 depends on T1.
|
|
26
|
+
- **Skeleton → Detail**: T1 = "introduce the module structure with stubs", T2-Tn = "fill in each stub with logic+tests". The stubs let downstream tasks parallelize.
|
|
27
|
+
|
|
28
|
+
## Anti-patterns
|
|
29
|
+
|
|
30
|
+
- **Refactor as one task.** "Refactor X" is a feature, not a task. Decompose into `extract Y`, `inline Z`, `rename W`, each with its own verify.
|
|
31
|
+
- **Setup-only tasks.** "Install lodash" is not a pilot task — the next task can install it as part of its own scope. Avoid tasks that don't deliver an observable check.
|
|
32
|
+
- **Cleanup-only tasks.** "Remove dead code". The verify is "tests still pass" — but tests passing was already the contract on the previous task. If there's nothing new to assert, this isn't a task.
|
|
33
|
+
|
|
34
|
+
## When you can't decompose
|
|
35
|
+
|
|
36
|
+
If the work genuinely doesn't decompose (e.g., a 200-line algorithm that has to land atomically), it might not be a fit for pilot. Tell the user; they may want to run it as a regular `/build` task instead.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Rule 1 — First-principles task framing
|
|
2
|
+
|
|
3
|
+
**Frame from intent, not from a template.**
|
|
4
|
+
|
|
5
|
+
Bad plans start with a checklist ("read AGENTS.md → write tests → write code → run tests"). Good plans start with the question: *what does the user actually want at the end of this?*
|
|
6
|
+
|
|
7
|
+
## What to ask yourself
|
|
8
|
+
|
|
9
|
+
1. **What is the working state at the end of the run?** A passing test suite that previously failed? A new endpoint serving real traffic? A refactor with zero behavior change? Different end-states demand different task shapes.
|
|
10
|
+
|
|
11
|
+
2. **What can fail?** A task that "adds an import" can't really fail. A task that "implements pagination across three layers" can fail in a hundred ways. The latter needs decomposition.
|
|
12
|
+
|
|
13
|
+
3. **What does the verify catch?** If you can't articulate the failure mode each verify command detects, the verify is decoration.
|
|
14
|
+
|
|
15
|
+
4. **What is the smallest change that ships?** Pilot is good at small surgical work. If the user wants a wholesale rewrite, pilot is the wrong tool — say so.
|
|
16
|
+
|
|
17
|
+
## Talk to the user — once
|
|
18
|
+
|
|
19
|
+
Before you spend an hour reading code, take 2 minutes to ask the user 1-3 clarifying questions:
|
|
20
|
+
|
|
21
|
+
- Scope (what's in / out of this plan?)
|
|
22
|
+
- Success criteria (how do we know we're done?)
|
|
23
|
+
- Constraints (deps to use, deps to avoid, tests to preserve)
|
|
24
|
+
|
|
25
|
+
Do this BEFORE applying rules 2-7. The cheapest mistake to fix is the one you avoid by understanding intent up front.
|
|
26
|
+
|
|
27
|
+
## Then read code
|
|
28
|
+
|
|
29
|
+
Don't ask the user things you can answer by reading code. Don't ask "what test framework do you use?" — `package.json` says. Don't ask "where does auth live?" — `grep` it. Use the user's time only for things genuinely unknown to the codebase.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Rule 6 — Milestones (optional)
|
|
2
|
+
|
|
3
|
+
**Use milestones to attach extra verify when a logical batch finishes.**
|
|
4
|
+
|
|
5
|
+
Milestones are an optional grouping. They serve two purposes:
|
|
6
|
+
|
|
7
|
+
1. **Status output** — `pilot status` groups tasks by milestone. Easier to read for big plans.
|
|
8
|
+
2. **Milestone-level verify** — extra verify commands that run when the LAST task in the milestone completes.
|
|
9
|
+
|
|
10
|
+
If neither of those is useful, don't add milestones. Plain task lists are simpler.
|
|
11
|
+
|
|
12
|
+
## Schema
|
|
13
|
+
|
|
14
|
+
```yaml
|
|
15
|
+
milestones:
|
|
16
|
+
- name: M1
|
|
17
|
+
description: Foundation
|
|
18
|
+
verify:
|
|
19
|
+
- bun run integration-test:foundation
|
|
20
|
+
- name: M2
|
|
21
|
+
description: API layer
|
|
22
|
+
verify:
|
|
23
|
+
- bun run integration-test:api
|
|
24
|
+
|
|
25
|
+
tasks:
|
|
26
|
+
- id: T1
|
|
27
|
+
title: schema
|
|
28
|
+
milestone: M1
|
|
29
|
+
- id: T2
|
|
30
|
+
title: db
|
|
31
|
+
milestone: M1
|
|
32
|
+
- id: T3
|
|
33
|
+
title: endpoint
|
|
34
|
+
milestone: M2
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Each task has an optional `milestone:` label. The label must match a `milestones[].name` (the validator catches typos).
|
|
38
|
+
|
|
39
|
+
## When milestone verify fires
|
|
40
|
+
|
|
41
|
+
Milestone-level verify runs **after the last task in that milestone completes successfully**. "Last" = last in topological order among tasks with that label. If any task in the milestone fails or gets blocked, the milestone verify does NOT run (the cascade-fail will block downstream work anyway).
|
|
42
|
+
|
|
43
|
+
## When to use them
|
|
44
|
+
|
|
45
|
+
- **Multi-layer features** where you want an integration test after each layer (schema, API, UI).
|
|
46
|
+
- **Long plans** (8+ tasks) where the user wants visible progress markers.
|
|
47
|
+
- **Mixed-domain plans** where milestones group related work for status readability.
|
|
48
|
+
|
|
49
|
+
## When NOT to use them
|
|
50
|
+
|
|
51
|
+
- Simple plans (≤5 tasks). Just list the tasks; status output is fine without grouping.
|
|
52
|
+
- Plans where every "milestone" has only one task. Use task verify instead.
|
|
53
|
+
- Plans where the milestone verify is "the same as the last task's verify". Redundant.
|
|
54
|
+
|
|
55
|
+
## Don't conflate milestone with dep
|
|
56
|
+
|
|
57
|
+
Milestones are a presentation/verify-grouping concept; they do NOT change scheduling. If T3 needs T2 done before it can start, that's a `depends_on: [T2]`, not a `milestone:` label. The DAG and milestones are independent axes.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Rule 7 — Self-review
|
|
2
|
+
|
|
3
|
+
**Before declaring the plan ready, run through this checklist.**
|
|
4
|
+
|
|
5
|
+
The validator catches schema, DAG, and glob errors. It cannot catch "this verify is too weak" or "this scope is too loose". You can.
|
|
6
|
+
|
|
7
|
+
## The 7 questions
|
|
8
|
+
|
|
9
|
+
1. **Is each task right-sized?** Reread each task's prompt. Could the pilot-builder do it in ~20 minutes with the standard `max_turns: 50`? If a task feels like 2 hours of work, split it. If it feels like 2 minutes, merge it.
|
|
10
|
+
|
|
11
|
+
2. **Does each verify command HAVE to fail before the task runs?** For each task, mentally checkout the pre-task state. Would the verify command fail there? If not, the verify isn't observing the task's effect — fix it.
|
|
12
|
+
|
|
13
|
+
3. **Is each `touches:` glob the tightest fit?** For each task, list the files the agent will need to edit. Are they all matched? Are there ANY paths matched that the agent SHOULDN'T touch? If yes to either, refine.
|
|
14
|
+
|
|
15
|
+
4. **Does the DAG match the actual dependencies?** For each `depends_on:` edge, ask: does the dependent task READ code the dep produces, or assume schema the dep modifies? If "no" to both, the edge is false. Drop it.
|
|
16
|
+
|
|
17
|
+
5. **Are there missing edges?** Look at every pair of tasks that share files in their `touches:`. Do they need an order? If T2's verify exercises code T1 introduces, T2 depends on T1 — even if their `touches:` don't overlap.
|
|
18
|
+
|
|
19
|
+
6. **Can the plan recover from a per-task failure?** If T3 fails, the cascade-fail blocks T4 onward. Is the resulting "failed=T3, blocked=[T4..T7]" state useful for the human operator? Or did you concentrate too much value into T3 such that its failure is catastrophic?
|
|
20
|
+
|
|
21
|
+
7. **Could you read this plan in 6 months and understand it?** Plan names + task titles + prompts should be a self-explanatory summary of the work. If the plan needs a verbal preamble to make sense, rewrite the prompts.
|
|
22
|
+
|
|
23
|
+
## Run validate
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
bunx @glrs-dev/harness-plugin-opencode pilot validate <plan-path>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Fix every error AND warning. The "warnings" tier (e.g., glob conflicts between tasks) is also yours to action — either decide they're OK and document it, or restructure.
|
|
30
|
+
|
|
31
|
+
## When the plan is ready
|
|
32
|
+
|
|
33
|
+
When all seven questions are answered "yes" and `pilot validate` exits 0:
|
|
34
|
+
|
|
35
|
+
- Save the plan.
|
|
36
|
+
- Tell the user: `Plan saved to <path>. Next: bunx @glrs-dev/harness-plugin-opencode pilot build`.
|
|
37
|
+
- Stop. Don't summarize. Don't editorialize. The user can read the YAML.
|
|
38
|
+
|
|
39
|
+
## When the plan is NOT ready
|
|
40
|
+
|
|
41
|
+
If you can't answer "yes" to any of the seven questions and you don't see a way to fix it within the planning session:
|
|
42
|
+
|
|
43
|
+
- Tell the user honestly. "I can't produce a plan that I'd trust the unattended builder to execute, because <specific reason>."
|
|
44
|
+
- Suggest the regular `/plan` agent (markdown plans, human-driven `/build`) or a manual decomposition.
|
|
45
|
+
|
|
46
|
+
It is far better to refuse than to ship a bad plan.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Task context
|
|
2
|
+
|
|
3
|
+
Every non-trivial task in a pilot plan carries a `context:` field — a markdown block that preloads the builder agent with the narrative it needs to work confidently without re-discovering the problem from scratch.
|
|
4
|
+
|
|
5
|
+
The builder gets a fresh opencode session per task. No carry-over from the planning conversation. No memory of which files the planner inspected. Just: title, touches, verify, context (if present), and the prompt directive. If `context:` is empty, the builder starts from the directive alone — fine for a one-line task ("add a CHANGELOG entry for version 1.2.3"), but painful for anything else.
|
|
6
|
+
|
|
7
|
+
## What belongs in context
|
|
8
|
+
|
|
9
|
+
- **The user-facing outcome.** In one sentence, what changes from a user's perspective when this task lands? Why should anyone care it got done?
|
|
10
|
+
- **The rationale / why this task exists.** What problem is this task solving? Why is it broken out as a separate task rather than rolled into a sibling? The planner had reasons; write them down.
|
|
11
|
+
- **Code pointers.** The specific files / functions / types the builder should read BEFORE editing. Name them with paths the builder can `read` directly. E.g., "Start by reading `src/pilot/cli/build.ts:resolvePlanPath` (lines 350-370) — the three-step fallback lives there." Saves 3-10 minutes of the builder re-grepping the repo.
|
|
12
|
+
- **Acceptance shorthand.** What "done" looks like from the human's view — a sentence or two that complements the machine-checkable `verify:` list. Verify says "tests pass"; context says "the user can now type `pilot build plan-name` without the full path."
|
|
13
|
+
- **Gotchas / constraints.** Anything the builder would trip over that `prompt:` shouldn't carry as a directive. "The schema is `.strict()` — don't add unknown keys." "Downstream tools parse stdout; keep streaming logs on stderr."
|
|
14
|
+
|
|
15
|
+
## What does NOT belong in context
|
|
16
|
+
|
|
17
|
+
- **The directive itself.** "Add a function that …" is `prompt:` territory. Keep context for grounding, prompt for the imperative.
|
|
18
|
+
- **Implementation plans.** Don't pre-decide how the builder should write the code. `touches:` constrains the scope; the builder picks the structure within it. If you find yourself writing "first add X, then update Y, then rename Z," either the task is too big (split it) or you're over-specifying (trust the builder).
|
|
19
|
+
- **Copy-pasted architecture diagrams.** If it's longer than ~40 lines, it probably belongs in a doc file the builder can read via `touches`, not inline in the plan.
|
|
20
|
+
- **Tutorials.** The builder already knows how to write TypeScript / run tests / use `edit`. Don't explain the fundamentals; link to the specific non-obvious convention in the repo (AGENTS.md, CLAUDE.md).
|
|
21
|
+
|
|
22
|
+
## Length guidance
|
|
23
|
+
|
|
24
|
+
- **Trivial task** (one-line prompt, ≤1 file, ≤10 LOC): `context:` optional; omit is fine.
|
|
25
|
+
- **Standard task** (3-5 files, non-trivial logic): one paragraph minimum, 3-5 sentences covering outcome, rationale, and the 2-3 most relevant code pointers.
|
|
26
|
+
- **Complex task** (many files, architectural change): several paragraphs, organized under headers (`### Outcome`, `### Rationale`, `### Code pointers`, `### Acceptance`). If you're writing more than ~60 lines of context, reconsider: is this really one task, or should it be split?
|
|
27
|
+
|
|
28
|
+
## Relationship to other fields
|
|
29
|
+
|
|
30
|
+
- **`prompt:`** is the directive. It says "do X." Keep it crisp — one to three short paragraphs max. If you're tempted to put narrative in `prompt:`, move it to `context:`.
|
|
31
|
+
- **`verify:`** is the machine contract. Binary, scripted, precise.
|
|
32
|
+
- **`touches:`** is the scope ceiling. Lists every file the builder is allowed to edit.
|
|
33
|
+
- **`context:`** is the human narrative. Read by the builder once at kickoff; helps the builder understand WHICH files inside `touches:` to read first and WHAT the end user will perceive.
|
|
34
|
+
|
|
35
|
+
The four work together: `context:` orients, `touches:` bounds, `prompt:` directs, `verify:` confirms.
|
|
36
|
+
|
|
37
|
+
## Emission
|
|
38
|
+
|
|
39
|
+
The kickoff prompt sent to the builder renders `context:` as a `## Context` section between the scope/verify block and the final `## Task` directive. Reading order: hard rules → allowed scope → verify commands → **context (grounding)** → task (act). The builder reads context right before the directive so the directive is the last, most salient framing when it starts making edits.
|
|
40
|
+
|
|
41
|
+
Empty `context:` → no `## Context` section emitted. No penalty for omission on trivial tasks.
|
|
42
|
+
|
|
43
|
+
## Anti-pattern: copying the user's original request
|
|
44
|
+
|
|
45
|
+
Don't just paste the Linear ticket description or the user's chat message into `context:`. That defeats the point of planning — you're supposed to have DIGESTED the request into task-shaped outcomes, not forwarded it verbatim. If the context reads like the ticket, the planning didn't do its job.
|
|
46
|
+
|
|
47
|
+
Good context is specific to *this task*, referencing *this task's* files, *this task's* verify commands, *this task's* narrow success criterion. Plan-wide or epic-wide context belongs at the plan level (the top-of-file `name:` and `branch_prefix:`), not duplicated into every task.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Rule 4 — `touches:` scope tightness
|
|
2
|
+
|
|
3
|
+
**Globs must be the tightest set that lets the task succeed. `**` is a smell.**
|
|
4
|
+
|
|
5
|
+
The `touches:` list is the agent's leash. After verify passes, the worker computes `git diff --name-only` against the worktree's pre-task SHA; any path NOT matched by `touches:` is a violation and the task fails.
|
|
6
|
+
|
|
7
|
+
This catches:
|
|
8
|
+
|
|
9
|
+
- Agents that "helpfully" reformat unrelated files.
|
|
10
|
+
- Agents that modify a test in a far-away module to make verify pass.
|
|
11
|
+
- Agents that drift into copilot-style imports of unrelated utils.
|
|
12
|
+
|
|
13
|
+
Tight scopes also let v0.3's parallel scheduler safely run two tasks at once — if their touches don't intersect, they can't conflict.
|
|
14
|
+
|
|
15
|
+
## Heuristics
|
|
16
|
+
|
|
17
|
+
- **One module = one glob.** `src/api/**` and `test/api/**` for an API task. Not `src/**`.
|
|
18
|
+
- **Exact files when you know them.** `src/auth/login.ts` is better than `src/auth/**` if the task is just "edit login.ts".
|
|
19
|
+
- **Test files belong with their source files.** A task that adds source code almost always adds or edits a test. Both go in `touches:`.
|
|
20
|
+
- **Lock files: rarely.** `package.json` / `bun.lock` / `Cargo.lock` should appear ONLY when the task explicitly says "add a dependency". Don't include them speculatively.
|
|
21
|
+
- **Config files: rarely.** `tsconfig.json`, `.eslintrc`, `package.json` scripts — only if the task is about config.
|
|
22
|
+
|
|
23
|
+
## When `**` IS reasonable
|
|
24
|
+
|
|
25
|
+
- The task is a global rename / rewrite (across the whole repo).
|
|
26
|
+
- The task is "fix every TODO in the codebase" — touches everything by intent.
|
|
27
|
+
- The task explicitly says "this is a sweeping change".
|
|
28
|
+
|
|
29
|
+
In these cases, `**` is fine; the AGENT'S diligence becomes the constraint instead of the touches enforcement.
|
|
30
|
+
|
|
31
|
+
## What `touches: []` means
|
|
32
|
+
|
|
33
|
+
An empty `touches` list means the task **must NOT edit any files**. Use this for:
|
|
34
|
+
|
|
35
|
+
- Verify-only tasks (e.g., "confirm the existing tests still pass after a deps update was made by an upstream task").
|
|
36
|
+
- Probing tasks (e.g., "run benchmarks and report results" — though pilot doesn't yet have a "report results" mechanism, so this is rare).
|
|
37
|
+
|
|
38
|
+
If the verify commands would FAIL without edits, an empty `touches` is a STOP — the task is contradictory.
|
|
39
|
+
|
|
40
|
+
## Common mistakes
|
|
41
|
+
|
|
42
|
+
- **`touches: ["**/*.ts"]`** — too loose. Better: list the actual modules.
|
|
43
|
+
- **Forgetting tests.** Source-only `touches:` makes the task fail when the agent (correctly) edits the test file.
|
|
44
|
+
- **Forgetting docs.** If the task explicitly says "update README", README must be in `touches:`.
|
|
45
|
+
- **Including the migrations dir for a non-migration task.** Tight scope.
|
|
46
|
+
|
|
47
|
+
When in doubt, write the tightest possible scope first. If the task fails verify with "touches violation: src/X.ts", the worker shows you which file got touched — broaden then.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Rule 3 — Verify-command design
|
|
2
|
+
|
|
3
|
+
**Each task's `verify:` commands must succeed iff the task is correctly done.**
|
|
4
|
+
|
|
5
|
+
The verify list is the contract between the planner and the builder. It is the ONLY signal pilot uses to decide "did this task work?". A weak verify means you're shipping work the run thinks is fine but really isn't.
|
|
6
|
+
|
|
7
|
+
## What a good verify looks like
|
|
8
|
+
|
|
9
|
+
- `bun test test/api.test.ts` (assertion)
|
|
10
|
+
- `bun run typecheck` (semantic check, catches real failures)
|
|
11
|
+
- `bun run lint` (style, but only when style is the work)
|
|
12
|
+
- `node scripts/check-schema.ts` (your own probe — write it as part of the task)
|
|
13
|
+
- `curl -fsS http://localhost:3000/health | jq .ok` (integration probe)
|
|
14
|
+
|
|
15
|
+
## What's not OK
|
|
16
|
+
|
|
17
|
+
- `echo done` — proves nothing
|
|
18
|
+
- `test -f src/foo.ts` — file existence is necessary but rarely sufficient
|
|
19
|
+
- `bun run build` ALONE — build success without tests means "TypeScript was happy"; insufficient for behavior tasks
|
|
20
|
+
- `grep -q 'newFunction' src/file.ts` — proves text presence, not behavior
|
|
21
|
+
- `git diff --name-only | grep src/api` — proves edits happened, not that they're correct
|
|
22
|
+
|
|
23
|
+
## Two-tier verify
|
|
24
|
+
|
|
25
|
+
Use BOTH a per-task verify and `defaults.verify_after_each`:
|
|
26
|
+
|
|
27
|
+
```yaml
|
|
28
|
+
defaults:
|
|
29
|
+
verify_after_each:
|
|
30
|
+
- bun run typecheck # always must pass
|
|
31
|
+
tasks:
|
|
32
|
+
- id: T1
|
|
33
|
+
verify:
|
|
34
|
+
- bun test test/api/specific.test.ts # task-specific
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
`verify_after_each` catches global breakage (a syntax error in a file the task didn't even touch); per-task verify catches task-specific behavior.
|
|
38
|
+
|
|
39
|
+
## Touches and verify must agree
|
|
40
|
+
|
|
41
|
+
If the task `touches: src/api/**` but the verify command runs `bun test test/web/`, you almost certainly have a wrong scope. The verify that would actually catch task failure must exercise files in the touched scope.
|
|
42
|
+
|
|
43
|
+
## Verify must be deterministic
|
|
44
|
+
|
|
45
|
+
- No `sleep` to wait for a service that may not start in CI.
|
|
46
|
+
- No `docker run` unless the task is explicitly about containers.
|
|
47
|
+
- No external network calls that could flake — mock or skip.
|
|
48
|
+
|
|
49
|
+
If a verify command flakes, three retries will exhaust attempts and the task fails for environmental reasons. Pilot has no way to distinguish "real failure" from "flake".
|
|
50
|
+
|
|
51
|
+
## Always include a "before" check
|
|
52
|
+
|
|
53
|
+
For non-trivial tasks, write a verify that would HAVE FAILED before the task ran. This makes the task's value observable. If the verify passed before AND passes after, the task didn't actually move the system.
|