opencodekit 0.12.7 → 0.13.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/README.md +2 -2
- package/dist/index.js +2753 -508
- package/dist/template/.opencode/AGENTS.md +35 -128
- package/dist/template/.opencode/README.md +4 -3
- package/dist/template/.opencode/command/design.md +1 -0
- package/dist/template/.opencode/command/fix.md +28 -1
- package/dist/template/.opencode/command/implement.md +195 -39
- package/dist/template/.opencode/command/new-feature.md +229 -188
- package/dist/template/.opencode/command/plan.md +354 -82
- package/dist/template/.opencode/command/research.md +29 -6
- package/dist/template/.opencode/command/start.md +227 -0
- package/dist/template/.opencode/command/triage.md +66 -12
- package/dist/template/.opencode/memory/project/beads-workflow.md +510 -0
- package/dist/template/.opencode/memory/session-context.md +40 -0
- package/dist/template/.opencode/opencode.json +20 -5
- package/dist/template/.opencode/package.json +1 -1
- package/dist/template/.opencode/plugin/compaction.ts +62 -18
- package/dist/template/.opencode/plugin/lib/notify.ts +2 -3
- package/dist/template/.opencode/plugin/sessions.ts +1 -1
- package/dist/template/.opencode/plugin/skill-mcp.ts +11 -12
- package/dist/template/.opencode/skill/beads/SKILL.md +44 -0
- package/dist/template/.opencode/skill/source-code-research/SKILL.md +537 -0
- package/dist/template/.opencode/tool/ast-grep.ts +3 -3
- package/dist/template/.opencode/tool/bd-inbox.ts +7 -6
- package/dist/template/.opencode/tool/bd-msg.ts +3 -3
- package/dist/template/.opencode/tool/bd-release.ts +2 -2
- package/dist/template/.opencode/tool/bd-reserve.ts +5 -4
- package/dist/template/.opencode/tool/memory-read.ts +2 -2
- package/dist/template/.opencode/tool/memory-search.ts +2 -2
- package/dist/template/.opencode/tool/memory-update.ts +11 -12
- package/dist/template/.opencode/tool/observation.ts +6 -6
- package/package.json +5 -2
|
@@ -1,152 +1,59 @@
|
|
|
1
1
|
# OpenCode Global Rules
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Complexity is the enemy. Every rule here fights complexity.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
2. Anti-hallucination rule (overrides all except security)
|
|
7
|
-
3. Delegation rules (check before tool calls)
|
|
8
|
-
4. Skills check (native `skill` tool)
|
|
9
|
-
5. User explicit requests
|
|
10
|
-
6. Base prompt behaviors
|
|
11
|
-
7. Global rules (this file)
|
|
12
|
-
8. Project conventions (nested AGENTS.md files)
|
|
5
|
+
## Priority (3 Levels Only)
|
|
13
6
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
**
|
|
17
|
-
|
|
18
|
-
- **@explore** - Code search: find, where is, search, how does X work, locate
|
|
19
|
-
- **@scout** - External research: research, compare, docs for, API for, best practices
|
|
20
|
-
- **@review** - Code review/debug: review, audit, debug, why broken, root cause
|
|
21
|
-
- **@planner** - Architecture: design, architect, plan, structure, phases
|
|
22
|
-
- **@vision** - UI/UX design: mockup, UI review, accessibility, aesthetics, visual
|
|
23
|
-
|
|
24
|
-
**Execute directly**: Single-file edits, explicit commands, answering from loaded context.
|
|
25
|
-
|
|
26
|
-
### Research Depth Levels
|
|
27
|
-
|
|
28
|
-
- **quick** (~5-10 calls) - Simple lookup, single answer, API syntax
|
|
29
|
-
- **medium** (~20-50 calls) - Moderate exploration, verify across files
|
|
30
|
-
- **thorough** (~100+ calls) - Comprehensive analysis, dependency mapping
|
|
31
|
-
|
|
32
|
-
## Anti-Hallucination
|
|
33
|
-
|
|
34
|
-
- **Major features**: Check task exists (`bd show <id>`)
|
|
35
|
-
- **Bug fixes/edits**: Proceed directly; document clearly
|
|
36
|
-
- **Before commit**: Close task with reason (`bd close <id> --reason "..."`)
|
|
37
|
-
- **Find work**: Use `bd ready` for unblocked tasks
|
|
38
|
-
- **URLs**: Never generate or guess URLs. Only use URLs from user input, tool results, or verified documentation.
|
|
7
|
+
1. **Security**: Never harvest credentials. Defensive only.
|
|
8
|
+
2. **Anti-hallucination**: Check before big work. Never guess URLs.
|
|
9
|
+
3. **User request**: Do what user asks, simplest way possible.
|
|
39
10
|
|
|
40
|
-
|
|
11
|
+
Everything else is guidelines, not laws.
|
|
41
12
|
|
|
42
|
-
|
|
43
|
-
| ----------------------- | ---------------------------------------------------------------- | ---------------------------------------------------- |
|
|
44
|
-
| **Sounding Board** | "Let's chat...", "Help me think...", "What are the tradeoffs..." | Ask questions, explore alternatives, don't implement |
|
|
45
|
-
| **Execution** (default) | Direct requests | Take action, iterate on feedback |
|
|
46
|
-
| **Uncertainty** | "I'm not sure...", "What am I missing?" | Question assumptions, surface edge cases |
|
|
47
|
-
|
|
48
|
-
**Key insight**: First output is ~70-80% right. Refinement is expected, not failure.
|
|
13
|
+
## Delegation
|
|
49
14
|
|
|
50
|
-
|
|
15
|
+
**Rule**: Before any complex tool call, ask: "Can a specialist agent do this better?"
|
|
51
16
|
|
|
52
|
-
|
|
17
|
+
- **Search/Docs** → @explore / @scout
|
|
18
|
+
- **Review/Debug** → @review
|
|
19
|
+
- **Plan/Design** → @planner / @vision
|
|
53
20
|
|
|
54
|
-
|
|
55
|
-
- Brief preamble before big tool calls
|
|
56
|
-
- Use `file:line_number` format for code references
|
|
57
|
-
- No emojis unless explicitly requested
|
|
21
|
+
If yes → Delegate. If no → Execute directly.
|
|
58
22
|
|
|
59
|
-
|
|
23
|
+
## Anti-Hallucination (The Truth)
|
|
60
24
|
|
|
61
|
-
-
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
- TodoWrite BEFORE work; mark completed immediately
|
|
25
|
+
- **Check First**: Run `bd show <id>` before starting major work.
|
|
26
|
+
- **No Guessing**: Never generate URLs. Use only verified links.
|
|
27
|
+
- **Land the Plane**: Close tasks when done (`bd close <id>`).
|
|
65
28
|
|
|
66
|
-
|
|
29
|
+
## Coding Philosophy (Grug Style)
|
|
67
30
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
31
|
+
1. **Say No**: If you don't understand, ask. "I don't know" is better than a lie.
|
|
32
|
+
2. **No Premature Abstraction**: Don't abstract until you see the pattern 3 times.
|
|
33
|
+
3. **Break It Down**: Complex `if` conditions are bugs waiting to happen. Use named variables.
|
|
34
|
+
- _Bad_: `if (x && !y && (z || w))`
|
|
35
|
+
- _Good_: `const isValid = x && !y; const hasPermission = z || w; if (isValid && hasPermission)`
|
|
36
|
+
4. **Logs**: Log before and after state changes. Silent failures are the devil.
|
|
71
37
|
|
|
72
38
|
## Tool Priority
|
|
73
39
|
|
|
74
|
-
Load `skill tool-priority` for full LSP, ast-grep, and grep reference.
|
|
75
|
-
|
|
76
|
-
**Quick reference**: LSP tools → ast-grep → grep → glob → read/edit/write
|
|
77
|
-
|
|
78
|
-
| Need | Tool |
|
|
79
|
-
| ------------------------------------------ | ----------------- |
|
|
80
|
-
| Code structure (functions, hooks, imports) | `ast-grep` |
|
|
81
|
-
| Text search (logs, config, TODOs) | `grep` |
|
|
82
|
-
| Type info, definitions, references | `lsp_lsp_*` tools |
|
|
83
|
-
| File discovery | `glob` |
|
|
84
|
-
|
|
85
40
|
**Rule**: Always `read` before `edit`.
|
|
86
41
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
**Quick reference**:
|
|
92
|
-
|
|
93
|
-
- Prefer `lsp_lsp_document_symbols` over reading entire files
|
|
94
|
-
- Navigate AGENTS.md hierarchy (progressive disclosure)
|
|
95
|
-
- Prune context aggressively; completed work doesn't need to stay loaded
|
|
96
|
-
|
|
97
|
-
## Research Tools
|
|
98
|
-
|
|
99
|
-
| Tool | Use When |
|
|
100
|
-
| -------------- | ---------------------------------------- |
|
|
101
|
-
| **context7** | Library docs (try first) |
|
|
102
|
-
| **websearch** | Docs not in Context7, recent releases |
|
|
103
|
-
| **codesearch** | Real implementation patterns from GitHub |
|
|
104
|
-
| **webfetch** | Specific URL user provided |
|
|
105
|
-
|
|
106
|
-
## Error Handling
|
|
107
|
-
|
|
108
|
-
- **Transient** (network, timeout): Retry 2x with backoff
|
|
109
|
-
- **Rate limit**: Stop, report to user
|
|
110
|
-
- **Logic error**: Change strategy, don't repeat
|
|
111
|
-
- **Blocked by hook/CI**: Analyze error, adjust approach, retry once
|
|
112
|
-
|
|
113
|
-
## Memory System
|
|
114
|
-
|
|
115
|
-
Load `skill memory-system` for memory tools and update patterns.
|
|
116
|
-
|
|
117
|
-
**Quick reference**: `memory-read`, `memory-update`, `memory-search`, `observation`
|
|
118
|
-
|
|
119
|
-
## Session Management
|
|
120
|
-
|
|
121
|
-
Load `skill session-management` for session tools and context thresholds.
|
|
122
|
-
|
|
123
|
-
**Philosophy**: Short sessions (<150k tokens) beat long bloated ones.
|
|
124
|
-
|
|
125
|
-
**Quick reference**: `list_sessions`, `read_session`, `search_session`, `summarize_session`
|
|
126
|
-
|
|
127
|
-
## Beads Usage
|
|
128
|
-
|
|
129
|
-
**Leader agents only**: Only `build` and `rush` use beads tools.
|
|
130
|
-
**Subagents** (explore, scout, planner, review, vision): Do NOT touch beads.
|
|
131
|
-
|
|
132
|
-
Load `skill beads` for full workflow, tool reference, and patterns.
|
|
133
|
-
|
|
134
|
-
**Quick reference**:
|
|
42
|
+
1. **LSP (Best)**: `lsp_lsp_document_symbols` (outline), `lsp_lsp_hover` (types), `lsp_lsp_goto_definition`.
|
|
43
|
+
2. **Structure**: `ast-grep` (Find functions/classes patterns)
|
|
44
|
+
3. **Search**: `grep` (Find text/TODOs)
|
|
45
|
+
4. **Files**: `glob` (Find files)
|
|
135
46
|
|
|
136
|
-
|
|
137
|
-
bd_init() → bd_claim() → bd_reserve(paths) → [work] → bd_done(id, msg) → RESTART
|
|
138
|
-
```
|
|
47
|
+
## Beads (Task Tracking)
|
|
139
48
|
|
|
140
|
-
**
|
|
49
|
+
**Leader Only**: `build` and `rush` agents own the DB. Subagents read-only.
|
|
141
50
|
|
|
142
|
-
-
|
|
143
|
-
-
|
|
144
|
-
-
|
|
51
|
+
- **Start**: `bd_init()` → `bd_claim()`
|
|
52
|
+
- **Work**: `bd_reserve()` (Lock files!) → Edit
|
|
53
|
+
- **Finish**: `bd_done()` → **RESTART SESSION**
|
|
145
54
|
|
|
146
55
|
## Core Constraints
|
|
147
56
|
|
|
148
|
-
- No sudo
|
|
149
|
-
- POSIX compatible (macOS/Linux)
|
|
150
|
-
-
|
|
151
|
-
- No auto-documentation without request
|
|
152
|
-
- Use absolute paths
|
|
57
|
+
- No sudo.
|
|
58
|
+
- POSIX compatible (macOS/Linux).
|
|
59
|
+
- Use absolute paths.
|
|
@@ -91,6 +91,7 @@ GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.json
|
|
|
91
91
|
- **@planner** - Architecture, multi-phase coordination
|
|
92
92
|
- **@scout** - External research (library docs + GitHub patterns)
|
|
93
93
|
- **@review** - Code review + debugging + security audit
|
|
94
|
+
- **@vision** - UI/UX design: mockup, UI review, accessibility, aesthetics, visual
|
|
94
95
|
|
|
95
96
|
**Built-in (OpenCode):**
|
|
96
97
|
|
|
@@ -329,8 +330,8 @@ fi
|
|
|
329
330
|
|
|
330
331
|
---
|
|
331
332
|
|
|
332
|
-
**OpenCodeKit v0.
|
|
333
|
+
**OpenCodeKit v0.13.1**
|
|
333
334
|
**Architecture:** Two-Layer (Memory + Beads + Git)
|
|
334
|
-
**New in v0.
|
|
335
|
+
**New in v0.13.1:** Beads worktree integration, Epic→Task→Subtask hierarchy, parallel subagent delegation
|
|
335
336
|
**Package:** `npx opencodekit` to scaffold new projects
|
|
336
|
-
**Last Updated:** January
|
|
337
|
+
**Last Updated:** January 8, 2026
|
|
@@ -105,10 +105,37 @@ observation({
|
|
|
105
105
|
|
|
106
106
|
If it's a gotcha worth remembering, update `project/gotchas.md`.
|
|
107
107
|
|
|
108
|
-
##
|
|
108
|
+
## Complete
|
|
109
|
+
|
|
110
|
+
If all verifications pass:
|
|
109
111
|
|
|
110
112
|
```bash
|
|
111
113
|
git add <files>
|
|
114
|
+
git status
|
|
115
|
+
git diff --cached --stat
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**Present to user:**
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
Fix Complete: $ARGUMENTS
|
|
122
|
+
━━━━━━━━━━━━━━━━━━━━━━━
|
|
123
|
+
|
|
124
|
+
Root cause: [brief]
|
|
125
|
+
Changes: [files]
|
|
126
|
+
Tests: Pass ✓
|
|
127
|
+
|
|
128
|
+
Would you like me to:
|
|
129
|
+
1. Commit these changes
|
|
130
|
+
2. Show full diff first
|
|
131
|
+
3. Skip commit (I'll review manually)
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**Wait for user confirmation before committing.**
|
|
135
|
+
|
|
136
|
+
If user confirms:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
112
139
|
git commit -m "fix: [description]
|
|
113
140
|
|
|
114
141
|
Root cause: [brief]
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Implement a bead - load context, make changes, verify
|
|
3
|
-
argument-hint: "<bead-id>"
|
|
2
|
+
description: Implement a bead - load context, delegate research, make changes, verify
|
|
3
|
+
argument-hint: "<bead-id> [--parallel]"
|
|
4
4
|
agent: build
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Implement: $ARGUMENTS
|
|
8
8
|
|
|
9
|
-
You're implementing a tracked task. Stay focused, verify as you go, hand off if you hit limits.
|
|
9
|
+
You're implementing a tracked task. Stay focused, delegate research, verify as you go, hand off if you hit limits.
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Parse Arguments
|
|
12
|
+
|
|
13
|
+
| Argument | Default | Description |
|
|
14
|
+
| ------------ | -------- | ----------------------------------------- |
|
|
15
|
+
| `<bead-id>` | required | The bead to implement |
|
|
16
|
+
| `--parallel` | false | Run aggressive parallel subagent research |
|
|
17
|
+
|
|
18
|
+
## First: Load Skills & Context
|
|
12
19
|
|
|
13
20
|
```typescript
|
|
14
21
|
skill({ name: "beads" });
|
|
@@ -16,27 +23,54 @@ skill({ name: "test-driven-development" });
|
|
|
16
23
|
skill({ name: "verification-before-completion" });
|
|
17
24
|
```
|
|
18
25
|
|
|
19
|
-
Get the task details and check
|
|
26
|
+
Get the task details and check hierarchy:
|
|
20
27
|
|
|
28
|
+
```bash
|
|
29
|
+
bd show $ARGUMENTS
|
|
30
|
+
bd dep tree $ARGUMENTS 2>/dev/null || echo "No dependencies"
|
|
31
|
+
bd list --status=in_progress # See what else is active
|
|
21
32
|
```
|
|
22
|
-
|
|
23
|
-
|
|
33
|
+
|
|
34
|
+
Check for messages from other agents:
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
bd - inbox({ n: 5, unread: true });
|
|
24
38
|
```
|
|
25
39
|
|
|
26
|
-
Check
|
|
40
|
+
## Check Hierarchy Position
|
|
41
|
+
|
|
42
|
+
Identify where this task sits:
|
|
43
|
+
|
|
44
|
+
| Type | Action |
|
|
45
|
+
| --------- | ------------------------------------------- |
|
|
46
|
+
| `epic` | Don't implement directly - work on subtasks |
|
|
47
|
+
| `task` | May implement or delegate to subtasks |
|
|
48
|
+
| `subtask` | Implement directly - this is leaf work |
|
|
27
49
|
|
|
50
|
+
**If this is an epic with subtasks:**
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
bd ready --json | grep -q "$ARGUMENTS"
|
|
28
54
|
```
|
|
29
|
-
|
|
30
|
-
|
|
55
|
+
|
|
56
|
+
→ Work on ready subtasks instead: `/implement <subtask-id>`
|
|
57
|
+
|
|
58
|
+
## Git State Check
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
git status --porcelain
|
|
62
|
+
git branch --show-current
|
|
31
63
|
```
|
|
32
64
|
|
|
65
|
+
If dirty, ask whether to stash, commit, or continue.
|
|
66
|
+
|
|
33
67
|
Create a branch if not already on one for this task:
|
|
34
68
|
|
|
35
69
|
```bash
|
|
36
|
-
git checkout -b $ARGUMENTS
|
|
70
|
+
git checkout -b $ARGUMENTS 2>/dev/null || echo "Already on branch"
|
|
37
71
|
```
|
|
38
72
|
|
|
39
|
-
Mark the task in progress:
|
|
73
|
+
Mark the task in progress (if not already):
|
|
40
74
|
|
|
41
75
|
```bash
|
|
42
76
|
bd update $ARGUMENTS --status in_progress
|
|
@@ -46,59 +80,163 @@ bd update $ARGUMENTS --status in_progress
|
|
|
46
80
|
|
|
47
81
|
Check what context exists:
|
|
48
82
|
|
|
49
|
-
```
|
|
50
|
-
|
|
83
|
+
```bash
|
|
84
|
+
ls .beads/artifacts/$ARGUMENTS/ 2>/dev/null || echo "No artifacts"
|
|
51
85
|
```
|
|
52
86
|
|
|
53
|
-
|
|
87
|
+
| Found | Action |
|
|
88
|
+
| ------------- | ------------------------------------ |
|
|
89
|
+
| `plan.md` | Follow it step by step |
|
|
90
|
+
| `spec.md` | Implement directly from requirements |
|
|
91
|
+
| `research.md` | Use findings to guide implementation |
|
|
92
|
+
| Nothing | Work from bead description |
|
|
54
93
|
|
|
55
94
|
Check for previous session work:
|
|
56
95
|
|
|
57
96
|
```typescript
|
|
58
|
-
|
|
59
|
-
read_session({ session_reference: "last"
|
|
97
|
+
search_session({ query: "$ARGUMENTS" });
|
|
98
|
+
read_session({ session_reference: "last" });
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Parallel Subagent Research (if --parallel or complex task)
|
|
102
|
+
|
|
103
|
+
**Delegation Pattern: Fire and Continue**
|
|
104
|
+
|
|
105
|
+
For complex tasks, launch research subagents in parallel before diving into code:
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
// Codebase patterns - find similar implementations
|
|
109
|
+
Task({
|
|
110
|
+
subagent_type: "explore",
|
|
111
|
+
prompt: `For implementing $ARGUMENTS, find:
|
|
112
|
+
1. Similar patterns in this codebase (grep/ast-grep)
|
|
113
|
+
2. Related test files and testing patterns
|
|
114
|
+
3. Configuration or setup requirements
|
|
115
|
+
Return: File paths, code patterns, test approach`,
|
|
116
|
+
description: "Explore patterns for implementation",
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
// External best practices - library docs
|
|
120
|
+
Task({
|
|
121
|
+
subagent_type: "scout",
|
|
122
|
+
prompt: `Research best practices for $ARGUMENTS:
|
|
123
|
+
1. Official documentation for libraries involved
|
|
124
|
+
2. Common implementation patterns (Context7, GitHub)
|
|
125
|
+
3. Known pitfalls or gotchas
|
|
126
|
+
Return: Code examples, API usage, warnings`,
|
|
127
|
+
description: "Scout external docs",
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
// Continue working immediately - don't wait for results
|
|
60
131
|
```
|
|
61
132
|
|
|
133
|
+
**Subagent Rules:**
|
|
134
|
+
| Agent | Use For | Can Do | Cannot Do |
|
|
135
|
+
| -------- | ------------------------------ | ---------------- | ---------------- |
|
|
136
|
+
| `explore`| Codebase search, patterns | Read, grep, glob | Edit, bd sync |
|
|
137
|
+
| `scout` | External docs, best practices | Fetch, search | Edit, bd sync |
|
|
138
|
+
| `review` | Code review, debugging | Read, analyze | Edit, bd sync |
|
|
139
|
+
| `planner`| Architecture, decomposition | Read, plan | Edit, bd sync |
|
|
140
|
+
|
|
141
|
+
**You (build agent) are the leader:**
|
|
142
|
+
|
|
143
|
+
- Subagents return results to you
|
|
144
|
+
- Only you modify files and update beads
|
|
145
|
+
- Integrate subagent findings into your implementation
|
|
146
|
+
|
|
62
147
|
## Estimate Your Budget
|
|
63
148
|
|
|
64
149
|
Look at the task complexity and set limits:
|
|
65
150
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
151
|
+
| Size | Tool Calls | Scope |
|
|
152
|
+
| ------ | ---------- | ----------------------------------- |
|
|
153
|
+
| Small | ~10 | Simple change, one file, clear path |
|
|
154
|
+
| Medium | ~30 | Multiple files, some exploration |
|
|
155
|
+
| Large | ~100 | Cross-cutting, needs checkpoints |
|
|
156
|
+
| XL | Stop | Decompose into subtasks first |
|
|
157
|
+
|
|
158
|
+
**If XL detected:**
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
This task is too large for a single session.
|
|
162
|
+
Recommend: /plan $ARGUMENTS --create-beads
|
|
163
|
+
```
|
|
70
164
|
|
|
71
|
-
If you hit 80% of budget without finishing, create a handoff. Don't push past limits
|
|
165
|
+
If you hit 80% of budget without finishing, create a handoff. Don't push past limits.
|
|
166
|
+
|
|
167
|
+
## Lock Files Before Editing
|
|
168
|
+
|
|
169
|
+
For shared files or multi-agent coordination:
|
|
170
|
+
|
|
171
|
+
```typescript
|
|
172
|
+
bd - reserve({ paths: ["src/file-to-edit.ts"], ttl: 600 });
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Release after completing edits:
|
|
176
|
+
|
|
177
|
+
```typescript
|
|
178
|
+
bd - release({ paths: ["src/file-to-edit.ts"] });
|
|
179
|
+
```
|
|
72
180
|
|
|
73
181
|
## Do The Work
|
|
74
182
|
|
|
75
183
|
Detect project type and know your verification commands:
|
|
76
184
|
|
|
77
|
-
```
|
|
78
|
-
|
|
185
|
+
```bash
|
|
186
|
+
ls package.json Cargo.toml pyproject.toml go.mod Makefile 2>/dev/null
|
|
79
187
|
```
|
|
80
188
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
189
|
+
| Project | Test Command | Lint Command |
|
|
190
|
+
| ------- | --------------- | ----------------------------------- |
|
|
191
|
+
| Node/TS | `npm test` | `npm run lint && npm run typecheck` |
|
|
192
|
+
| Rust | `cargo test` | `cargo clippy -- -D warnings` |
|
|
193
|
+
| Python | `pytest` | `ruff check . && mypy .` |
|
|
194
|
+
| Go | `go test ./...` | `golangci-lint run` |
|
|
85
195
|
|
|
86
196
|
**Rules while implementing:**
|
|
87
197
|
|
|
88
|
-
1. Read before edit
|
|
89
|
-
2. Run verification after each logical change
|
|
90
|
-
3.
|
|
91
|
-
4. Checkpoint
|
|
92
|
-
5.
|
|
198
|
+
1. **Read before edit.** Always.
|
|
199
|
+
2. **Run verification** after each logical change
|
|
200
|
+
3. **Delegate when stuck**: If blocked on understanding, launch `@explore` or `@scout`
|
|
201
|
+
4. **Checkpoint** after significant progress: `git commit -m "WIP: $ARGUMENTS - [step]"`
|
|
202
|
+
5. **Create child beads** for discovered subtasks:
|
|
203
|
+
```bash
|
|
204
|
+
bd create "Discovered: [subtask]" -t subtask -p 2
|
|
205
|
+
bd dep add <new-id> $ARGUMENTS --type blocks
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
**Progress tracking** - every 10 tool calls:
|
|
93
209
|
|
|
94
|
-
|
|
210
|
+
- Am I on track?
|
|
211
|
+
- Should I checkpoint?
|
|
212
|
+
- Am I approaching budget?
|
|
213
|
+
- Need to delegate research?
|
|
214
|
+
|
|
215
|
+
## Subtask Coordination (if parent task)
|
|
216
|
+
|
|
217
|
+
If implementing a task with subtasks:
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
# Check which subtasks are ready
|
|
221
|
+
bd ready --json | jq '.[] | select(.parent == "$ARGUMENTS")'
|
|
222
|
+
|
|
223
|
+
# Work on ready subtasks in order
|
|
224
|
+
# When subtask done:
|
|
225
|
+
bd close <subtask-id> --reason "Completed: description"
|
|
226
|
+
|
|
227
|
+
# Check if parent can close
|
|
228
|
+
bd dep tree $ARGUMENTS
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
**Pattern: Complete subtasks before parent**
|
|
95
232
|
|
|
96
233
|
## Before Claiming Done
|
|
97
234
|
|
|
98
235
|
Verify against success criteria in the spec:
|
|
99
236
|
|
|
100
|
-
```
|
|
101
|
-
|
|
237
|
+
```bash
|
|
238
|
+
cat .beads/artifacts/$ARGUMENTS/spec.md | grep -A 20 "Success Criteria" || \
|
|
239
|
+
cat .beads/artifacts/$ARGUMENTS/spec.md | grep -A 20 "Acceptance Criteria"
|
|
102
240
|
```
|
|
103
241
|
|
|
104
242
|
Run each verification command. All must pass. No exceptions.
|
|
@@ -107,7 +245,7 @@ Run the full test suite one more time:
|
|
|
107
245
|
|
|
108
246
|
```bash
|
|
109
247
|
# Whatever your project uses
|
|
110
|
-
npm test && npm run
|
|
248
|
+
npm test && npm run typecheck
|
|
111
249
|
```
|
|
112
250
|
|
|
113
251
|
## Complete
|
|
@@ -126,9 +264,12 @@ git diff --cached --stat
|
|
|
126
264
|
Implementation Complete: $ARGUMENTS
|
|
127
265
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
128
266
|
|
|
267
|
+
Type: [epic/task/subtask]
|
|
129
268
|
Tests: Pass ✓
|
|
130
269
|
Changes: [files modified]
|
|
131
270
|
|
|
271
|
+
Subtasks: [N completed / M total] (if applicable)
|
|
272
|
+
|
|
132
273
|
Would you like me to:
|
|
133
274
|
1. Commit these changes
|
|
134
275
|
2. Show full diff first
|
|
@@ -144,10 +285,17 @@ git commit -m "$ARGUMENTS: [summary]"
|
|
|
144
285
|
bd sync
|
|
145
286
|
```
|
|
146
287
|
|
|
147
|
-
Suggest next step:
|
|
288
|
+
Suggest next step based on hierarchy:
|
|
289
|
+
|
|
290
|
+
| Situation | Next Command |
|
|
291
|
+
| -------------------- | --------------------------- |
|
|
292
|
+
| Subtask done | `/implement <next-subtask>` |
|
|
293
|
+
| All subtasks done | `/finish <parent-task>` |
|
|
294
|
+
| Task done, no parent | `/finish $ARGUMENTS` |
|
|
295
|
+
| Need PR | `/pr $ARGUMENTS` |
|
|
148
296
|
|
|
149
297
|
```
|
|
150
|
-
Next:
|
|
298
|
+
Next: [recommended command]
|
|
151
299
|
```
|
|
152
300
|
|
|
153
301
|
If gates fail, fix them. Don't proceed with broken code.
|
|
@@ -161,3 +309,11 @@ Hit budget limit or context getting too large? Create a handoff:
|
|
|
161
309
|
```
|
|
162
310
|
|
|
163
311
|
Then start a fresh session. Don't grind past diminishing returns.
|
|
312
|
+
|
|
313
|
+
## Release File Locks
|
|
314
|
+
|
|
315
|
+
Before ending session:
|
|
316
|
+
|
|
317
|
+
```typescript
|
|
318
|
+
bd - release({ _: true }); // List and release all locks
|
|
319
|
+
```
|