opencodekit 0.12.7 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/README.md +2 -2
  2. package/dist/index.js +2753 -508
  3. package/dist/template/.opencode/AGENTS.md +35 -128
  4. package/dist/template/.opencode/README.md +4 -3
  5. package/dist/template/.opencode/command/design.md +1 -0
  6. package/dist/template/.opencode/command/fix.md +28 -1
  7. package/dist/template/.opencode/command/research.md +0 -4
  8. package/dist/template/.opencode/command/start.md +106 -0
  9. package/dist/template/.opencode/command/triage.md +66 -12
  10. package/dist/template/.opencode/memory/project/beads-workflow.md +278 -0
  11. package/dist/template/.opencode/memory/session-context.md +40 -0
  12. package/dist/template/.opencode/opencode.json +557 -496
  13. package/dist/template/.opencode/package.json +1 -1
  14. package/dist/template/.opencode/plugin/compaction.ts +62 -18
  15. package/dist/template/.opencode/plugin/lib/notify.ts +2 -3
  16. package/dist/template/.opencode/plugin/sessions.ts +1 -1
  17. package/dist/template/.opencode/plugin/skill-mcp.ts +11 -12
  18. package/dist/template/.opencode/skill/beads/SKILL.md +44 -0
  19. package/dist/template/.opencode/tool/ast-grep.ts +3 -3
  20. package/dist/template/.opencode/tool/bd-inbox.ts +7 -6
  21. package/dist/template/.opencode/tool/bd-msg.ts +3 -3
  22. package/dist/template/.opencode/tool/bd-release.ts +2 -2
  23. package/dist/template/.opencode/tool/bd-reserve.ts +5 -4
  24. package/dist/template/.opencode/tool/memory-read.ts +2 -2
  25. package/dist/template/.opencode/tool/memory-search.ts +2 -2
  26. package/dist/template/.opencode/tool/memory-update.ts +11 -12
  27. package/dist/template/.opencode/tool/observation.ts +6 -6
  28. package/package.json +5 -2
@@ -1,152 +1,59 @@
1
1
  # OpenCode Global Rules
2
2
 
3
- ## Priority Hierarchy
3
+ Complexity is the enemy. Every rule here fights complexity.
4
4
 
5
- 1. Security constraints (always first)
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
- ## Delegation
15
-
16
- **Check before any tool call. Delegate if task involves search or research.**
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
- ## Interaction Modes
11
+ Everything else is guidelines, not laws.
41
12
 
42
- | Mode | Triggers | Response |
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
- ## Universal Standards
15
+ **Rule**: Before any complex tool call, ask: "Can a specialist agent do this better?"
51
16
 
52
- ### Communication
17
+ - **Search/Docs** → @explore / @scout
18
+ - **Review/Debug** → @review
19
+ - **Plan/Design** → @planner / @vision
53
20
 
54
- - Under 4 lines for typical responses
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
- ### Execution
23
+ ## Anti-Hallucination (The Truth)
60
24
 
61
- - Batch independent tool calls (parallel)
62
- - Verify with tools; don't assume
63
- - Obey project AGENTS.md files (nested takes precedence)
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
- ### Security
29
+ ## Coding Philosophy (Grug Style)
67
30
 
68
- - Defensive security only
69
- - Refuse credential harvesting
70
- - Allow security analysis, detection rules, vulnerability explanations
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
- ## Context Engineering
88
-
89
- Load `skill context-engineering` for context management principles.
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
- **Rules**:
49
+ **Leader Only**: `build` and `rush` agents own the DB. Subagents read-only.
141
50
 
142
- - Always `bd_init()` first in any session using beads tools
143
- - Reserve before edit to prevent conflicts
144
- - One task per session - restart after `bd_done()`
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
- - Manual verification for config changes
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.9.2**
333
+ **OpenCodeKit v0.13.0**
333
334
  **Architecture:** Two-Layer (Memory + Beads + Git)
334
- **New in v0.9.2:** 6 new LSP tools, `ock init --beads` flag, improved tool guidance
335
+ **New in v0.13.0:** Codex-inspired session continuity, compaction-safe context, UNCONFIRMED markers
335
336
  **Package:** `npx opencodekit` to scaffold new projects
336
- **Last Updated:** January 2, 2026
337
+ **Last Updated:** January 8, 2026
@@ -2,6 +2,7 @@
2
2
  description: UI/UX visual design with aesthetic direction and code output
3
3
  argument-hint: "<component|page|system|'review'> [topic] [--direction:<aesthetic>] [--quick|--deep]"
4
4
  agent: vision
5
+ subtask: true
5
6
  ---
6
7
 
7
8
  # Design: $ARGUMENTS
@@ -105,10 +105,37 @@ observation({
105
105
 
106
106
  If it's a gotcha worth remembering, update `project/gotchas.md`.
107
107
 
108
- ## Commit & Sync
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]
@@ -142,10 +142,6 @@ Write `.beads/artifacts/$ARGUMENTS/research.md`:
142
142
  - [Remaining question] - needs: [what would resolve it]
143
143
  ```
144
144
 
145
- ## Sync
146
-
147
- !`bd sync`
148
-
149
145
  ## Output
150
146
 
151
147
  ```
@@ -0,0 +1,106 @@
1
+ ---
2
+ description: Start working on a bead - claim it and prepare context
3
+ argument-hint: "<bead-id>"
4
+ agent: build
5
+ ---
6
+
7
+ # Start: $ARGUMENTS
8
+
9
+ You're claiming a task and preparing to work on it. This is the entry point before implementation.
10
+
11
+ ## Load Skills
12
+
13
+ ```typescript
14
+ skill({ name: "beads" });
15
+ ```
16
+
17
+ ## Ensure Git Hooks Installed
18
+
19
+ First-time setup per repo (prevents stale JSONL issues):
20
+
21
+ ```bash
22
+ bd hooks install 2>/dev/null || echo "Hooks already installed"
23
+ ```
24
+
25
+ ## Current State
26
+
27
+ ### Git Status
28
+
29
+ !`git status --porcelain`
30
+ !`git branch --show-current`
31
+
32
+ ### Active Tasks
33
+
34
+ !`bd list --status=in_progress`
35
+
36
+ If you have uncommitted changes, ask the user:
37
+
38
+ 1. Stash them (`git stash`)
39
+ 2. Commit them first
40
+ 3. Continue anyway (risky)
41
+
42
+ If you already have tasks in_progress, warn the user before claiming another.
43
+
44
+ ## Task Details
45
+
46
+ !`bd show $ARGUMENTS`
47
+
48
+ ## Claim The Task
49
+
50
+ ```bash
51
+ bd update $ARGUMENTS --status in_progress
52
+ ```
53
+
54
+ ## Create Branch
55
+
56
+ If not already on a feature branch:
57
+
58
+ ```bash
59
+ git checkout -b $ARGUMENTS
60
+ ```
61
+
62
+ ## Existing Artifacts
63
+
64
+ !`ls .beads/artifacts/$ARGUMENTS/ 2>/dev/null || echo "No artifacts yet"`
65
+
66
+ Look for:
67
+
68
+ - `spec.md` - Requirements and constraints
69
+ - `research.md` - Previous research
70
+ - `plan.md` - Implementation plan
71
+
72
+ ## Determine Next Step
73
+
74
+ Based on what exists:
75
+
76
+ | Artifacts Found | Next Command |
77
+ | --------------------- | ----------------------- |
78
+ | Nothing | `/research $ARGUMENTS` |
79
+ | Only spec.md | `/plan $ARGUMENTS` |
80
+ | spec.md + research.md | `/plan $ARGUMENTS` |
81
+ | plan.md exists | `/implement $ARGUMENTS` |
82
+
83
+ ## Output
84
+
85
+ ```
86
+ Started: $ARGUMENTS
87
+ ━━━━━━━━━━━━━━━━━━━
88
+
89
+ Branch: $ARGUMENTS
90
+ Status: in_progress
91
+
92
+ Artifacts:
93
+ • spec.md: [exists/missing]
94
+ • research.md: [exists/missing]
95
+ • plan.md: [exists/missing]
96
+
97
+ Next: [recommended command based on artifacts]
98
+ ```
99
+
100
+ ## Quick Start
101
+
102
+ If `--quick` flag is passed and plan.md exists, skip directly to:
103
+
104
+ ```
105
+ /implement $ARGUMENTS
106
+ ```
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  description: AI-powered task triage, prioritization, and workload analysis
3
- argument-hint: "[--auto-assign] [--sla] [--bottleneck]"
3
+ argument-hint: "[--quick] [--auto-assign] [--sla] [--bottleneck]"
4
4
  agent: build
5
5
  ---
6
6
 
@@ -14,11 +14,54 @@ skill({ name: "beads" });
14
14
 
15
15
  Analyze open tasks and optimize prioritization using dependency graph analysis, SLA tracking, and multi-agent coordination.
16
16
 
17
- ## Phase 1: Initialize Beads Connection
17
+ ## Quick Mode
18
+
19
+ If `--quick` flag is passed, skip deep analysis and provide immediate actionable output:
20
+
21
+ ```bash
22
+ bd ready --json
23
+ bd list --status=in_progress --json
24
+ ```
25
+
26
+ **Quick Output:**
27
+
28
+ ```
29
+ Quick Triage
30
+ ━━━━━━━━━━━━
31
+
32
+ Ready to start:
33
+ • bd-abc12: "Task title" (P1)
34
+ • bd-def34: "Task title" (P2)
35
+
36
+ In progress:
37
+ • bd-ghi56: "Task title" - claimed by [agent]
38
+
39
+ Next: /start <bead-id>
40
+ ```
41
+
42
+ Then stop. Don't run full analysis phases.
43
+
44
+ ## Full Triage (Default)
45
+
46
+ ## Phase 1: Health Check
47
+
48
+ Run `bd doctor` to ensure database integrity (recommended weekly):
49
+
50
+ ```bash
51
+ bd doctor --fix 2>/dev/null || bd doctor
52
+ ```
53
+
54
+ This detects and auto-fixes:
55
+
56
+ - Orphaned issues (work committed but issue not closed)
57
+ - Database/JSONL sync issues
58
+ - Migration updates
59
+
60
+ ## Phase 2: Initialize Beads Connection
18
61
 
19
62
  !`bd status`
20
63
 
21
- ## Phase 2: Gather Workspace State
64
+ ## Phase 3: Gather Workspace State
22
65
 
23
66
  Run in parallel:
24
67
 
@@ -27,8 +70,8 @@ Run in parallel:
27
70
 
28
71
  ```typescript
29
72
  // Custom tools (not shell commands)
30
- bd-release(); // Lists active locks when called with no args
31
- bd-inbox({ n: 10, unread: true, to: "all" });
73
+ bd - release(); // Lists active locks when called with no args
74
+ bd - inbox({ n: 10, unread: true, to: "all" });
32
75
 
33
76
  // Search for past discussions on recurring issues
34
77
  search_session({ query: "blocked OR regression OR urgent", limit: 10 });
@@ -43,7 +86,7 @@ Capture:
43
86
  - Pending messages
44
87
  - Past context on recurring issues
45
88
 
46
- ## Phase 3: Analyze Dependencies
89
+ ## Phase 4: Analyze Dependencies
47
90
 
48
91
  Use `bd dep tree` to understand blocking relationships:
49
92
 
@@ -55,7 +98,7 @@ This provides:
55
98
  - **Keystones**: High-impact tasks that unlock multiple paths
56
99
  - **Cycles**: Circular dependencies (must break)
57
100
 
58
- ## Phase 4: Priority Classification
101
+ ## Phase 5: Priority Classification
59
102
 
60
103
  ### Priority Matrix
61
104
 
@@ -112,7 +155,7 @@ const slaStatus =
112
155
  : "OK";
113
156
  ```
114
157
 
115
- ## Phase 5: Bottleneck Analysis
158
+ ## Phase 6: Bottleneck Analysis
116
159
 
117
160
  Identify blocking patterns:
118
161
 
@@ -154,7 +197,7 @@ Resolution Options:
154
197
  Run: bd update <id> --remove-dep <dep-id>
155
198
  ```
156
199
 
157
- ## Phase 6: Generate Triage Report
200
+ ## Phase 7: Generate Triage Report
158
201
 
159
202
  ```
160
203
  ╔══════════════════════════════════════════════════════════════════════════╗
@@ -210,7 +253,7 @@ RECOMMENDATIONS
210
253
  ╚══════════════════════════════════════════════════════════════════════════╝
211
254
  ```
212
255
 
213
- ## Phase 7: Auto-Assignment (Optional)
256
+ ## Phase 8: Auto-Assignment (Optional)
214
257
 
215
258
  If `--auto-assign` flag:
216
259
 
@@ -261,7 +304,7 @@ Skipped:
261
304
  - bd-old88: No matching role detected (manual assignment needed)
262
305
  ```
263
306
 
264
- ## Phase 8: Batch Operations
307
+ ## Phase 9: Batch Operations
265
308
 
266
309
  ### Bulk Priority Update
267
310
 
@@ -286,7 +329,18 @@ console.log("2. Move to P4 backlog");
286
329
  console.log("3. Review individually");
287
330
  ```
288
331
 
289
- ## Phase 9: Sync and Notify
332
+ ### Database Cleanup (Weekly Maintenance)
333
+
334
+ Keep database small for performance (target: under 200-500 issues):
335
+
336
+ ```bash
337
+ bd cleanup --days 7 # Remove closed issues older than 7 days
338
+ bd list --status=closed --json | wc -l # Check closed count
339
+ ```
340
+
341
+ **Best Practice (from Steve Yegge):** Run `bd cleanup` every few days to prevent database bloat.
342
+
343
+ ## Phase 10: Sync and Notify
290
344
 
291
345
  ```typescript
292
346