opencodekit 0.21.10 → 0.22.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 (156) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/template/.opencode/AGENTS.md +116 -487
  3. package/dist/template/.opencode/README.md +1 -1
  4. package/dist/template/.opencode/agent/build.md +56 -396
  5. package/dist/template/.opencode/agent/explore.md +0 -1
  6. package/dist/template/.opencode/agent/review.md +0 -1
  7. package/dist/template/.opencode/agent/scout.md +0 -1
  8. package/dist/template/.opencode/agent/vision.md +0 -1
  9. package/dist/template/.opencode/command/clarify.md +48 -0
  10. package/dist/template/.opencode/command/commit.md +53 -0
  11. package/dist/template/.opencode/command/fix.md +56 -0
  12. package/dist/template/.opencode/command/improve-architecture.md +55 -0
  13. package/dist/template/.opencode/command/init.md +88 -68
  14. package/dist/template/.opencode/command/refactor.md +66 -0
  15. package/dist/template/.opencode/command/test.md +66 -0
  16. package/dist/template/.opencode/dcp.jsonc +13 -2
  17. package/dist/template/.opencode/memory/README.md +3 -5
  18. package/dist/template/.opencode/memory/_templates/adr.md +45 -0
  19. package/dist/template/.opencode/memory/project/gotchas.md +1 -1
  20. package/dist/template/.opencode/memory/session-context.md +1 -1
  21. package/dist/template/.opencode/plugin/README.md +1 -1
  22. package/dist/template/.opencode/plugin/guard.ts +62 -0
  23. package/dist/template/.opencode/plugin/{lib/memory-admin-tools.ts → memory/admin.ts} +4 -4
  24. package/dist/template/.opencode/plugin/{lib → memory}/capture.ts +1 -1
  25. package/dist/template/.opencode/plugin/{lib → memory}/compile.ts +2 -2
  26. package/dist/template/.opencode/plugin/{lib → memory}/context.ts +1 -1
  27. package/dist/template/.opencode/plugin/{lib → memory}/curator.ts +1 -1
  28. package/dist/template/.opencode/plugin/{lib → memory}/db/observations.ts +102 -3
  29. package/dist/template/.opencode/plugin/{lib → memory}/db/schema.ts +43 -1
  30. package/dist/template/.opencode/plugin/{lib → memory}/db/types.ts +22 -0
  31. package/dist/template/.opencode/plugin/{lib/memory-db.ts → memory/db.ts} +1 -1
  32. package/dist/template/.opencode/plugin/{lib → memory}/distill.ts +1 -1
  33. package/dist/template/.opencode/plugin/{lib/memory-helpers.ts → memory/helpers.ts} +5 -1
  34. package/dist/template/.opencode/plugin/{lib/memory-hooks.ts → memory/hooks.ts} +1 -1
  35. package/dist/template/.opencode/plugin/{lib → memory}/index-generator.ts +2 -2
  36. package/dist/template/.opencode/plugin/{lib → memory}/inject.ts +1 -1
  37. package/dist/template/.opencode/plugin/{lib → memory}/lint.ts +2 -2
  38. package/dist/template/.opencode/plugin/memory/tools.ts +322 -0
  39. package/dist/template/.opencode/plugin/{lib → memory}/validate.ts +2 -2
  40. package/dist/template/.opencode/plugin/memory.ts +7 -17
  41. package/dist/template/.opencode/plugin/srcwalk.ts +721 -0
  42. package/dist/template/.opencode/skill/agent-code-quality-gate/SKILL.md +98 -0
  43. package/dist/template/.opencode/skill/behavioral-kernel/SKILL.md +52 -0
  44. package/dist/template/.opencode/skill/browser-testing-with-devtools/SKILL.md +85 -0
  45. package/dist/template/.opencode/skill/code-cleanup/SKILL.md +114 -0
  46. package/dist/template/.opencode/skill/code-navigation/SKILL.md +142 -0
  47. package/dist/template/.opencode/skill/code-review-and-quality/SKILL.md +131 -0
  48. package/dist/template/.opencode/skill/debugging-and-error-recovery/SKILL.md +109 -0
  49. package/dist/template/.opencode/skill/deep-module-design/SKILL.md +207 -0
  50. package/dist/template/.opencode/skill/git-workflow-and-versioning/SKILL.md +77 -0
  51. package/dist/template/.opencode/skill/grill-me/SKILL.md +140 -0
  52. package/dist/template/.opencode/skill/memory-system/SKILL.md +9 -10
  53. package/dist/template/.opencode/skill/planning-and-task-breakdown/SKILL.md +116 -0
  54. package/dist/template/.opencode/skill/shipping-and-launch/SKILL.md +95 -0
  55. package/dist/template/.opencode/skill/source-driven-development/SKILL.md +103 -0
  56. package/dist/template/.opencode/skill/spec-driven-development/SKILL.md +121 -0
  57. package/dist/template/.opencode/skill/srcwalk/SKILL.md +161 -0
  58. package/dist/template/.opencode/skill/ubiquitous-language/SKILL.md +184 -0
  59. package/package.json +1 -1
  60. package/dist/template/.opencode/AGENT_ALIGNMENT.md +0 -564
  61. package/dist/template/.opencode/agent/painter.md +0 -83
  62. package/dist/template/.opencode/command/compound.md +0 -240
  63. package/dist/template/.opencode/command/curate.md +0 -299
  64. package/dist/template/.opencode/command/handoff.md +0 -149
  65. package/dist/template/.opencode/command/health.md +0 -356
  66. package/dist/template/.opencode/command/init-context.md +0 -297
  67. package/dist/template/.opencode/command/init-user.md +0 -125
  68. package/dist/template/.opencode/command/iterate.md +0 -200
  69. package/dist/template/.opencode/command/lfg.md +0 -173
  70. package/dist/template/.opencode/command/resume.md +0 -78
  71. package/dist/template/.opencode/command/status.md +0 -126
  72. package/dist/template/.opencode/command/ui-slop-check.md +0 -169
  73. package/dist/template/.opencode/plugin/lib/memory-tools.ts +0 -535
  74. package/dist/template/.opencode/skill/agent-evals/SKILL.md +0 -208
  75. package/dist/template/.opencode/skill/anti-ai-slop/SKILL.md +0 -76
  76. package/dist/template/.opencode/skill/augment-context-engine/SKILL.md +0 -122
  77. package/dist/template/.opencode/skill/augment-context-engine/mcp.json +0 -6
  78. package/dist/template/.opencode/skill/brand-asset-protocol/SKILL.md +0 -222
  79. package/dist/template/.opencode/skill/code-search-patterns/SKILL.md +0 -224
  80. package/dist/template/.opencode/skill/code-simplification/SKILL.md +0 -211
  81. package/dist/template/.opencode/skill/context-condensation/SKILL.md +0 -149
  82. package/dist/template/.opencode/skill/context-initialization/SKILL.md +0 -69
  83. package/dist/template/.opencode/skill/context-management/SKILL.md +0 -390
  84. package/dist/template/.opencode/skill/deep-research/SKILL.md +0 -384
  85. package/dist/template/.opencode/skill/design-direction-advisor/SKILL.md +0 -139
  86. package/dist/template/.opencode/skill/dispatching-parallel-agents/SKILL.md +0 -191
  87. package/dist/template/.opencode/skill/executing-plans/SKILL.md +0 -247
  88. package/dist/template/.opencode/skill/figma-go/SKILL.md +0 -65
  89. package/dist/template/.opencode/skill/finishing-a-development-branch/SKILL.md +0 -357
  90. package/dist/template/.opencode/skill/full-output-enforcement/SKILL.md +0 -62
  91. package/dist/template/.opencode/skill/gh-address-comments/SKILL.md +0 -29
  92. package/dist/template/.opencode/skill/gh-address-comments/scripts/fetch_comments.py +0 -237
  93. package/dist/template/.opencode/skill/gh-fix-ci/SKILL.md +0 -38
  94. package/dist/template/.opencode/skill/gh-fix-ci/scripts/inspect_pr_checks.py +0 -509
  95. package/dist/template/.opencode/skill/hi-fi-prototype-html/SKILL.md +0 -253
  96. package/dist/template/.opencode/skill/html-deck-export/SKILL.md +0 -189
  97. package/dist/template/.opencode/skill/index-knowledge/SKILL.md +0 -413
  98. package/dist/template/.opencode/skill/memory-grounding/SKILL.md +0 -68
  99. package/dist/template/.opencode/skill/playwriter/SKILL.md +0 -158
  100. package/dist/template/.opencode/skill/portless/SKILL.md +0 -109
  101. package/dist/template/.opencode/skill/prd/SKILL.md +0 -146
  102. package/dist/template/.opencode/skill/prd-task/SKILL.md +0 -182
  103. package/dist/template/.opencode/skill/prd-task/references/prd-schema.json +0 -124
  104. package/dist/template/.opencode/skill/prompt-leverage/SKILL.md +0 -90
  105. package/dist/template/.opencode/skill/prompt-leverage/references/framework.md +0 -91
  106. package/dist/template/.opencode/skill/prompt-leverage/scripts/augment_prompt.py +0 -157
  107. package/dist/template/.opencode/skill/receiving-code-review/SKILL.md +0 -263
  108. package/dist/template/.opencode/skill/reconcile/SKILL.md +0 -183
  109. package/dist/template/.opencode/skill/reflection-checkpoints/SKILL.md +0 -183
  110. package/dist/template/.opencode/skill/requesting-code-review/SKILL.md +0 -443
  111. package/dist/template/.opencode/skill/requesting-code-review/references/specialist-profiles.md +0 -108
  112. package/dist/template/.opencode/skill/requesting-code-review/review.md +0 -160
  113. package/dist/template/.opencode/skill/rtk-command-compression/SKILL.md +0 -134
  114. package/dist/template/.opencode/skill/screenshot/SKILL.md +0 -48
  115. package/dist/template/.opencode/skill/screenshot/scripts/ensure_macos_permissions.sh +0 -54
  116. package/dist/template/.opencode/skill/screenshot/scripts/macos_display_info.swift +0 -22
  117. package/dist/template/.opencode/skill/screenshot/scripts/macos_permissions.swift +0 -40
  118. package/dist/template/.opencode/skill/screenshot/scripts/macos_window_info.swift +0 -126
  119. package/dist/template/.opencode/skill/screenshot/scripts/take_screenshot.ps1 +0 -163
  120. package/dist/template/.opencode/skill/screenshot/scripts/take_screenshot.py +0 -585
  121. package/dist/template/.opencode/skill/security-threat-model/SKILL.md +0 -36
  122. package/dist/template/.opencode/skill/security-threat-model/references/prompt-template.md +0 -255
  123. package/dist/template/.opencode/skill/security-threat-model/references/security-controls-and-assets.md +0 -32
  124. package/dist/template/.opencode/skill/sharing-skills/SKILL.md +0 -214
  125. package/dist/template/.opencode/skill/skill-creator/SKILL.md +0 -181
  126. package/dist/template/.opencode/skill/skill-installer/SKILL.md +0 -58
  127. package/dist/template/.opencode/skill/skill-installer/scripts/github_utils.py +0 -21
  128. package/dist/template/.opencode/skill/skill-installer/scripts/install-skill-from-github.py +0 -313
  129. package/dist/template/.opencode/skill/skill-installer/scripts/list-skills.py +0 -106
  130. package/dist/template/.opencode/skill/swarm-coordination/SKILL.md +0 -244
  131. package/dist/template/.opencode/skill/swarm-coordination/references/architecture.md +0 -39
  132. package/dist/template/.opencode/skill/swarm-coordination/references/delegation-worker-protocol.md +0 -145
  133. package/dist/template/.opencode/skill/swarm-coordination/references/dependency-graph.md +0 -50
  134. package/dist/template/.opencode/skill/swarm-coordination/references/drift-check.md +0 -90
  135. package/dist/template/.opencode/skill/swarm-coordination/references/integration-beads.md +0 -20
  136. package/dist/template/.opencode/skill/swarm-coordination/references/launch-flow.md +0 -186
  137. package/dist/template/.opencode/skill/swarm-coordination/references/reconciler.md +0 -172
  138. package/dist/template/.opencode/skill/swarm-coordination/references/tier-enforcement.md +0 -78
  139. package/dist/template/.opencode/skill/swarm-coordination/references/tmux-integration.md +0 -134
  140. package/dist/template/.opencode/skill/systematic-debugging/SKILL.md +0 -402
  141. package/dist/template/.opencode/skill/terse-output-mode/SKILL.md +0 -95
  142. package/dist/template/.opencode/skill/think-in-code/SKILL.md +0 -136
  143. package/dist/template/.opencode/skill/ux-quality-gates/SKILL.md +0 -137
  144. package/dist/template/.opencode/skill/v1-run/SKILL.md +0 -175
  145. package/dist/template/.opencode/skill/v1-run/mcp.json +0 -6
  146. package/dist/template/.opencode/skill/verification-gates/SKILL.md +0 -63
  147. package/dist/template/.opencode/skill/visual-analysis/SKILL.md +0 -154
  148. package/dist/template/.opencode/skill/web-design-guidelines/SKILL.md +0 -46
  149. package/dist/template/.opencode/skill/workspace-setup/SKILL.md +0 -76
  150. package/dist/template/.opencode/skill/writing-plans/SKILL.md +0 -320
  151. /package/dist/template/.opencode/plugin/{lib → memory}/compact.ts +0 -0
  152. /package/dist/template/.opencode/plugin/{lib → memory}/db/graph.ts +0 -0
  153. /package/dist/template/.opencode/plugin/{lib → memory}/db/maintenance.ts +0 -0
  154. /package/dist/template/.opencode/plugin/{lib → memory}/db/pipeline.ts +0 -0
  155. /package/dist/template/.opencode/plugin/{lib → memory}/notify.ts +0 -0
  156. /package/dist/template/.opencode/plugin/{lib → memory}/operation-log.ts +0 -0
@@ -1,240 +0,0 @@
1
- ---
2
- description: Extract and persist learnings from completed work into institutional memory
3
- argument-hint: "[bead-id]"
4
- agent: build
5
- ---
6
-
7
- # Compound: $ARGUMENTS
8
-
9
- Capture what was learned. This is the flywheel step — each cycle makes the next cycle faster.
10
-
11
- > **Workflow:** `/plan` → `/ship` → **`/compound`** → `/pr`
12
- >
13
- > Run after every completed task, review, or PR merge. The value compounds over time.
14
-
15
- ## Load Skills
16
-
17
- ```typescript
18
- skill({ name: "memory-system" });
19
- skill({ name: "verification-before-completion" });
20
- ```
21
-
22
- ## What This Does
23
-
24
- Extracts learnings from the just-completed work and stores them as structured observations in memory,
25
- so future Plan and Ship cycles start with institutional knowledge instead of blank slates.
26
-
27
- ## Phase 1: Gather Evidence
28
-
29
- ```bash
30
- # Get what changed (falls back gracefully if no remote)
31
- git diff origin/main..HEAD --stat 2>/dev/null || git diff HEAD~5..HEAD --stat
32
- git log origin/main..HEAD --oneline 2>/dev/null || git log --oneline -10
33
-
34
- # Get review comments if any
35
- br comments list $ARGUMENTS 2>/dev/null || echo "No bead"
36
-
37
- # Get bead context if provided
38
- br show $ARGUMENTS 2>/dev/null || echo "No bead specified"
39
- ```
40
-
41
- Collect from all available sources:
42
-
43
- - Git diff (what files changed, what patterns were used)
44
- - Bead comments (review findings, decisions made)
45
- - Current session context (what was discovered, what was hard)
46
- - Any error messages that were solved
47
-
48
- ## Phase 2: Classify Learnings
49
-
50
- For each finding, assign a type:
51
-
52
- | Type | When to Use | Example |
53
- | ----------- | ---------------------------------------------------------- | ----------------------------------------------- |
54
- | `pattern` | A reusable approach confirmed to work in this codebase | "Always use X pattern for Y type of component" |
55
- | `bugfix` | A non-obvious bug and its root cause | "Bun doesn't support X, use Y instead" |
56
- | `decision` | An architectural or design choice with rationale | "Chose JWT over sessions because..." |
57
- | `warning` | A footgun, constraint, or thing that looks wrong but isn't | "Don't modify dist/ directly, build overwrites" |
58
- | `discovery` | A non-obvious fact about the codebase or its dependencies | "Build copies .opencode/ to dist/template/" |
59
- | `warning` | Something that will break if not followed | "Always run lint:fix before commit" |
60
-
61
- **Quality bar:** Only record learnings that would save future-you 15+ minutes.
62
- Skip obvious things. Skip things already in AGENTS.md.
63
-
64
- ## Phase 3: Store Observations
65
-
66
- For each learning worth keeping, create an observation:
67
-
68
- ```typescript
69
- observation({
70
- type: "pattern", // or bugfix, decision, discovery, warning, learning
71
- title: "[Concise, searchable title — what someone would search for]",
72
- narrative: "[What happened, why it matters, how to apply it]",
73
- facts: "[comma, separated, key, facts]",
74
- concepts: "[searchable, keywords, for, future, retrieval]",
75
- files_modified: "[relevant/file.ts if applicable]",
76
- confidence: "high", // high=verified, medium=likely, low=speculative
77
- // ByteRover-inspired quality fields:
78
- subtitle: "[One-line semantic summary — WHY this matters for future work]",
79
- });
80
- ```
81
-
82
- **Minimum viable:** title + narrative. Everything else is bonus.
83
-
84
- **Quality enrichment:** Add `subtitle` (WHY it matters) for high-impact observations. Skip for routine findings.
85
-
86
- ## Phase 4: Structural Loss Prevention
87
-
88
- When superseding an older observation, prevent accidental knowledge loss.
89
-
90
- **Trigger:** Only runs when `supersedes: "ID"` is set on a new observation.
91
-
92
- ### Step 1: Read the old observation
93
-
94
- ```typescript
95
- const old = memory_get({ ids: "<superseded-id>" });
96
- ```
97
-
98
- ### Step 2: Detect structural loss
99
-
100
- Compare the new observation against the old one:
101
-
102
- | Field | Loss Detection |
103
- | ---------------- | --------------------------------------------------------------- |
104
- | `facts` | Old facts not present in new facts (comma-separated comparison) |
105
- | `concepts` | Old concepts not present in new concepts |
106
- | `narrative` | New narrative significantly shorter than old (< 50% length) |
107
- | `files_modified` | Old file paths not present in new list |
108
-
109
- ### Step 3: Auto-merge if loss detected
110
-
111
- - **Array fields** (facts, concepts): Union merge — keep all old items, add new items, deduplicate
112
- - **Scalar fields** (narrative): If new is shorter, append `\n\n[Preserved from superseded observation #ID:]\n` + old narrative section
113
- - **File paths**: Union merge all paths
114
-
115
- ### Step 4: Flag for review if high-impact
116
-
117
- If the old observation had `confidence: "high"` and the new one has `confidence: "medium"` or `confidence: "low"`, flag with a warning:
118
-
119
- > ⚠️ Confidence downgrade detected: superseding a high-confidence observation (#ID) with lower confidence. Verify this is intentional.
120
-
121
- **Principle:** Knowledge should accumulate, not be replaced. Merging is safer than overwriting.
122
-
123
- ## Phase 5: Check AGENTS.md / Skill Updates
124
-
125
- Ask: does this learning belong as a permanent rule?
126
-
127
- If YES (it's a codebase-level constraint everyone must follow):
128
-
129
- - Suggest updating `.opencode/memory/project/gotchas.md`
130
- - Or the relevant skill file if it's procedure-level
131
-
132
- If MAYBE (it's a pattern, not a rule):
133
-
134
- - The observation is sufficient
135
- - Don't pollute AGENTS.md with every finding
136
-
137
- **Rule:** AGENTS.md changes require user confirmation. Observations are automatic.
138
-
139
- ## Phase 6: Update Living Documentation
140
-
141
- Check if the shipped work changed architecture, APIs, conventions, or tech stack. If so, update the relevant project docs.
142
-
143
- **Check each:**
144
-
145
- | Doc | Update When | What to Update |
146
- | --------------------- | --------------------------------------------------------- | --------------------------------------------------- |
147
- | `tech-stack.md` | New dependency added, build tool changed, runtime updated | Dependencies list, build tools, constraints |
148
- | `project.md` | Architecture changed, new key files, success criteria met | Architecture section, key files table, phase status |
149
- | `gotchas.md` | New footgun discovered, constraint found | Add the gotcha with context |
150
- | `AGENTS.md` (project) | New convention established, boundary rule needed | Boundaries, gotchas, code example sections |
151
-
152
- ```typescript
153
- // Check what changed
154
- // If tech stack changed:
155
- memory_update({ file: "project/tech-stack", content: "...", mode: "append" });
156
- // If new gotcha:
157
- memory_update({ file: "project/gotchas", content: "...", mode: "append" });
158
- ```
159
-
160
- **Rule:** Only update docs when the change is structural (new pattern, new dep, new constraint). Don't update for routine bug fixes or small features. Ask user before modifying `AGENTS.md`.
161
-
162
- ## Phase 7: Search for Related Past Observations
163
-
164
- ```typescript
165
- // Check if this updates or supersedes an older observation
166
- memory_search({ query: "[key concept from the finding]", limit: 3 });
167
- ```
168
-
169
- If a newer finding contradicts or updates an older one, note it:
170
-
171
- ```typescript
172
- observation({
173
- type: "decision",
174
- title: "...",
175
- narrative: "...",
176
- supersedes: "42", // ID of the older observation
177
- });
178
- ```
179
-
180
- ## Phase 8: Output Summary
181
-
182
- Present extracted learnings for user review before finalizing:
183
-
184
- ```
185
- ## Compound Review
186
-
187
- **Work reviewed:** [brief description]
188
- **Learnings extracted:** [N] observations
189
-
190
- | # | Type | Title | Impact | Action |
191
- |---|------|-------|--------|--------|
192
- | 1 | pattern | ... | high | ✅ Store |
193
- | 2 | warning | ... | medium | ✅ Store |
194
- | 3 | bugfix | ... | low | ⏭️ Skip (routine) |
195
- ```
196
-
197
- ```typescript
198
- question({
199
- questions: [
200
- {
201
- header: "Approve Learnings",
202
- question: "Review extracted learnings. Store all approved observations?",
203
- options: [
204
- { label: "Store all (Recommended)", description: "Persist all marked ✅" },
205
- { label: "Let me adjust", description: "I'll modify before storing" },
206
- { label: "Skip compound", description: "Nothing worth persisting" },
207
- ],
208
- },
209
- ],
210
- });
211
- ```
212
-
213
- **After approval:** Store observations and report final summary:
214
-
215
- ```
216
- ## Compound Summary
217
-
218
- **Observations stored:** [N]
219
- **Superseded:** [N] older observations updated
220
- **AGENTS.md updates suggested:** [yes/no - describe if yes]
221
- **Next recommended:** /pr (or /plan <next-bead-id>)
222
- ```
223
-
224
- ## When Nothing to Compound
225
-
226
- If the work was trivial (a config change, 1-line fix with no surprises):
227
-
228
- > "Nothing worth compounding. Work was straightforward — no non-obvious patterns, bugs, or decisions encountered."
229
-
230
- Don't force observations. Quality over quantity.
231
-
232
- ## Related Commands
233
-
234
- | Need | Command |
235
- | --------------- | ------------------ |
236
- | Full chain | `/lfg` |
237
- | Review codebase | `/review-codebase` |
238
- | Ship the work | `/ship` |
239
- | Curate memory | `/curate` |
240
- | Create PR | `/pr` |
@@ -1,299 +0,0 @@
1
- ---
2
- description: Organize, deduplicate, and curate knowledge in project memory
3
- argument-hint: "[--scope recent|all] [--auto-merge]"
4
- agent: build
5
- ---
6
-
7
- # Curate: $ARGUMENTS
8
-
9
- Organize accumulated knowledge. Surface conflicts, merge duplicates, archive stale observations.
10
-
11
- > **Workflow:** `/ship` → `/compound` → **`/curate`** → `/pr`
12
- >
13
- > Run periodically (weekly or after major work) to keep memory sharp. Inspired by ByteRover's structured curation pipeline.
14
-
15
- ## Load Skills
16
-
17
- ```typescript
18
- skill({ name: "memory-system" });
19
- skill({ name: "verification-before-completion" });
20
- ```
21
-
22
- ## Parse Arguments
23
-
24
- | Argument | Default | Description |
25
- | -------------- | -------- | ------------------------------------------------ |
26
- | `--scope` | `recent` | `recent` = last 30 days, `all` = entire memory |
27
- | `--auto-merge` | false | Auto-merge exact duplicates without confirmation |
28
-
29
- ## Phase 1: Inventory
30
-
31
- Take stock of current memory state:
32
-
33
- ```typescript
34
- memory_admin({ operation: "status" });
35
- memory_admin({ operation: "capture-stats" });
36
- ```
37
-
38
- Report:
39
-
40
- ```
41
- ## Memory Inventory
42
-
43
- | Metric | Count |
44
- |--------|-------|
45
- | Total observations | [N] |
46
- | Recent (30 days) | [N] |
47
- | By type | pattern: N, decision: N, bugfix: N, ... |
48
- | Confidence distribution | high: N, medium: N, low: N |
49
- ```
50
-
51
- ## Phase 2: Domain Detection
52
-
53
- Analyze observations to extract semantic domains — groups of related knowledge.
54
-
55
- ```typescript
56
- // Get memory status for inventory
57
- memory_admin({ operation: "status" });
58
-
59
- // Search by common concept categories to build domain map
60
- const domains = [];
61
- for (const concept of ["build", "test", "memory", "git", "agent", "auth", "ui", "config"]) {
62
- const results = memory_search({ query: concept, limit: 20 });
63
- // Group results by concept affinity
64
- }
65
- ```
66
-
67
- Categorize observations into domains based on their `concepts` and `title` fields:
68
-
69
- | Domain | Example Concepts | Observation Count |
70
- | -------------- | ---------------------------------- | ----------------- |
71
- | `build_system` | build, tsdown, rsync, dist | [N] |
72
- | `testing` | vitest, test, TDD, coverage | [N] |
73
- | `memory` | observation, FTS5, sqlite, handoff | [N] |
74
- | `git_workflow` | commit, branch, push, PR | [N] |
75
- | `agent_system` | subagent, delegation, skills | [N] |
76
-
77
- **Domain naming rules:**
78
-
79
- - snake_case, 1-3 words
80
- - Semantically meaningful (not just "misc")
81
- - Maximum 10 domains (merge small groups)
82
-
83
- ## Phase 3: Conflict & Duplicate Detection
84
-
85
- ### 3a. Exact Duplicates
86
-
87
- ```typescript
88
- memory_admin({ operation: "lint" });
89
- ```
90
-
91
- Flag observations with identical or near-identical titles and narratives. Present for merge:
92
-
93
- ```
94
- ### Duplicates Found
95
-
96
- | Obs A | Obs B | Similarity | Recommended Action |
97
- |-------|-------|------------|-------------------|
98
- | #12 "Use JWT for auth" | #45 "JWT chosen for auth" | 95% title match | MERGE → keep #45 (newer) |
99
- | #8 "Build copies .opencode/" | #33 "Build copies .opencode/" | 100% title match | MERGE → keep #33 (newer) |
100
- ```
101
-
102
- ### 3b. Contradictions
103
-
104
- Search for observations where:
105
-
106
- - Same concepts but different decisions
107
- - Same file paths but conflicting patterns
108
- - Confidence downgrade without supersedes link
109
-
110
- ```
111
- ### Contradictions Found
112
-
113
- | Obs A | Obs B | Conflict | Recommended Action |
114
- |-------|-------|----------|-------------------|
115
- | #5 "Always use X pattern" | #29 "Avoid X pattern" | Opposite recommendations | RESOLVE — ask user which is current |
116
- ```
117
-
118
- ### 3c. Stale Observations
119
-
120
- Flag observations where:
121
-
122
- - Referenced files no longer exist
123
- - Referenced patterns no longer appear in codebase
124
- - Over 90 days old with no related recent activity
125
-
126
- ```
127
- ### Stale Observations
128
-
129
- | Obs | Age | Reason | Recommended Action |
130
- |-----|-----|--------|-------------------|
131
- | #3 "src/old-file.ts pattern" | 120 days | File deleted | ARCHIVE |
132
- | #7 "Use moment.js for dates" | 95 days | Dependency removed | ARCHIVE |
133
- ```
134
-
135
- ## Phase 4: Present Curation Plan
136
-
137
- Compile all findings into a review table:
138
-
139
- ```
140
- ## Curation Plan
141
-
142
- ### Actions Required
143
-
144
- | # | Observation | Action | Reason |
145
- |---|------------|--------|--------|
146
- | 1 | #12 + #45 | MERGE | Duplicate — keep newer |
147
- | 2 | #5 vs #29 | RESOLVE | Contradicting patterns |
148
- | 3 | #3 | ARCHIVE | Referenced file deleted |
149
- | 4 | #7 | ARCHIVE | Dependency removed |
150
- | 5 | #18 | UPDATE | Low confidence → verify |
151
- ```
152
-
153
- ```typescript
154
- question({
155
- questions: [
156
- {
157
- header: "Curation Plan",
158
- question: "Review the curation plan. Proceed with all actions?",
159
- options: [
160
- { label: "Execute all (Recommended)", description: "Apply all actions above" },
161
- { label: "Let me cherry-pick", description: "I'll approve individually" },
162
- { label: "Skip curation", description: "No changes to memory" },
163
- ],
164
- },
165
- ],
166
- });
167
- ```
168
-
169
- ## Phase 5: Execute Curation
170
-
171
- For each approved action:
172
-
173
- ### MERGE (duplicates)
174
-
175
- ```typescript
176
- // Read both observations
177
- const older = memory_get({ ids: "<older-id>" });
178
- const newer = memory_get({ ids: "<newer-id>" });
179
-
180
- // Union-merge: combine comma-separated lists, deduplicate (case-insensitive), existing items first
181
- // Example: older.facts="auth, jwt" + newer.facts="jwt, session" → "auth, jwt, session"
182
-
183
- // Create merged observation (newer as base, merge fields from older)
184
- observation({
185
- type: newer.type,
186
- title: newer.title,
187
- narrative: newer.narrative,
188
- // Manually combine comma-separated fields: keep all unique items from both
189
- facts: "[combined unique facts from older + newer]",
190
- concepts: "[combined unique concepts from older + newer]",
191
- files_modified: "[combined unique file paths from older + newer]",
192
- confidence: newer.confidence, // Newer confidence wins
193
- supersedes: "<older-id>",
194
- subtitle: "Merged from #<older-id> + #<newer-id>",
195
- });
196
- ```
197
-
198
- **Union merge rule:** Combine comma-separated lists, deduplicate (case-insensitive), existing items first.
199
-
200
- ### RESOLVE (contradictions)
201
-
202
- Present the conflicting observations side-by-side:
203
-
204
- ```
205
- ### Contradiction: #5 vs #29
206
-
207
- **#5 (older, high confidence):**
208
- > Always use X pattern for Y components
209
-
210
- **#29 (newer, medium confidence):**
211
- > Avoid X pattern — causes Z issues
212
-
213
- Which is the current truth?
214
- ```
215
-
216
- ```typescript
217
- question({
218
- questions: [
219
- {
220
- header: "Resolve Conflict",
221
- question: "Which observation reflects the current codebase reality?",
222
- options: [
223
- { label: "#5 (older) is correct", description: "Archive #29, keep #5" },
224
- { label: "#29 (newer) is correct", description: "Supersede #5 with #29" },
225
- { label: "Both partially correct", description: "I'll write a reconciled version" },
226
- ],
227
- },
228
- ],
229
- });
230
- ```
231
-
232
- ### ARCHIVE (stale)
233
-
234
- ```typescript
235
- // Verify staleness by checking codebase
236
- // If file doesn't exist or pattern not found:
237
- observation({
238
- type: "warning",
239
- title: "Archived: [original title]",
240
- narrative: "Archived during curation — [reason]. Original observation #<id>.",
241
- supersedes: "<stale-id>",
242
- confidence: "low",
243
- });
244
- ```
245
-
246
- ### UPDATE (low confidence → verify)
247
-
248
- ```typescript
249
- // Search codebase for evidence
250
- // If evidence found → upgrade confidence
251
- // If evidence not found → archive
252
- ```
253
-
254
- ## Phase 6: Compile Knowledge Index
255
-
256
- After curation, regenerate the knowledge index:
257
-
258
- ```typescript
259
- memory_admin({ operation: "compile" });
260
- memory_admin({ operation: "index" });
261
- ```
262
-
263
- ## Phase 7: Report
264
-
265
- ```
266
- ## Curation Summary
267
-
268
- **Scope:** [recent / all]
269
- **Observations reviewed:** [N]
270
- **Domains identified:** [N]
271
-
272
- | Action | Count | Details |
273
- |--------|-------|---------|
274
- | Merged | [N] | [list merged pairs] |
275
- | Resolved | [N] | [list resolved conflicts] |
276
- | Archived | [N] | [list archived observations] |
277
- | Updated | [N] | [list confidence changes] |
278
- | No change | [N] | |
279
-
280
- **Memory health:** [Healthy / Needs attention: describe]
281
- **Next recommended:** /pr or continue work
282
- ```
283
-
284
- ## When Nothing to Curate
285
-
286
- If all observations are clean, well-organized, and non-conflicting:
287
-
288
- > "Memory is clean. No duplicates, contradictions, or stale observations found. [N] observations across [M] domains."
289
-
290
- Don't force curation. Quality memory means less curation needed.
291
-
292
- ## Related Commands
293
-
294
- | Need | Command |
295
- | ----------------------- | ------------------------------ |
296
- | Extract learnings first | `/compound` |
297
- | Full chain | `/lfg` |
298
- | Check memory health | `/health` |
299
- | Search memory | Use `memory-search()` directly |
@@ -1,149 +0,0 @@
1
- ---
2
- description: Save progress and context for next session
3
- argument-hint: "<bead-id> [instructions]"
4
- agent: build
5
- ---
6
-
7
- # Handoff: $ARGUMENTS
8
-
9
- Save state so the next session can pick up cleanly.
10
-
11
- > **Workflow:** Run this when pausing work. Resume with `/resume $ARGUMENTS`.
12
-
13
- ## Parse Arguments
14
-
15
- | Argument | Default | Description |
16
- | ---------------- | -------- | ---------------------------------- |
17
- | `<bead-id>` | required | The bead to hand off |
18
- | `[instructions]` | none | Extra context for the next session |
19
-
20
- ## Load Skills
21
-
22
- ```typescript
23
- skill({ name: "beads" });
24
- skill({ name: "memory-system" });
25
- ```
26
-
27
- ---
28
-
29
- ## Phase 1: Gather State (Parallel)
30
-
31
- ```bash
32
- br show $ARGUMENTS
33
- git status --porcelain
34
- git branch --show-current
35
- git rev-parse --short HEAD
36
- Read `.beads/artifacts/$ARGUMENTS/` to check existing artifacts.
37
- ```
38
-
39
- ---
40
-
41
- ## Phase 2: Handle Uncommitted Changes
42
-
43
- If `git status` shows uncommitted changes, ask the user:
44
-
45
- ```typescript
46
- question({
47
- questions: [
48
- {
49
- header: "Uncommitted work",
50
- question: "You have uncommitted changes. What should we do?",
51
- options: [
52
- { label: "Commit as WIP (Recommended)", description: "git commit -m 'WIP: $ARGUMENTS'" },
53
- { label: "Leave uncommitted", description: "Skip commit, just write handoff" },
54
- ],
55
- },
56
- ],
57
- });
58
- ```
59
-
60
- If user chooses commit:
61
-
62
- ```bash
63
- git add <specific-files-you-modified>
64
- git commit -m "WIP: $ARGUMENTS - [brief description of where you stopped]"
65
- ```
66
-
67
- **Never use `git add -A` or `git add .`** — stage only the files you modified.
68
-
69
- ---
70
-
71
- ## Phase 3: Write Handoff
72
-
73
- Write the handoff to the memory system:
74
-
75
- ```typescript
76
- memory_update({
77
- file: "handoffs/$ARGUMENTS",
78
- content: `# Handoff: $ARGUMENTS
79
-
80
- **Date:** [timestamp]
81
- **Branch:** [from git branch]
82
- **Commit:** [from git rev-parse]
83
-
84
- ## Done
85
- - [completed work]
86
-
87
- ## In Progress
88
- - [current step] — stopped because [reason]
89
-
90
- ## Remaining
91
- - [next steps]
92
-
93
- ## Files Touched
94
- - \`path/to/file.ts\` — [what changed]
95
-
96
- ## Decisions
97
- - [decision]: [why]
98
-
99
- ## Blockers
100
- [any blockers, or "None"]
101
-
102
- ## Resume Instructions
103
- 1. [first thing to do]
104
- 2. [second thing to do]
105
-
106
- Resume with: \`/resume $ARGUMENTS\`
107
- `,
108
- mode: "replace",
109
- });
110
- ```
111
-
112
- ---
113
-
114
- ## Phase 4: Record Learnings (If Any)
115
-
116
- If you discovered patterns or gotchas worth remembering:
117
-
118
- ```typescript
119
- observation({
120
- type: "learning",
121
- title: "[concise, searchable title]",
122
- narrative: "[what you learned — specific and actionable]",
123
- bead_id: "$ARGUMENTS",
124
- concepts: "[keywords for search]",
125
- });
126
- ```
127
-
128
- ---
129
-
130
- ## Phase 5: Sync
131
-
132
- ```bash
133
- br sync --flush-only
134
- ```
135
-
136
- ---
137
-
138
- ## Output
139
-
140
- ```
141
- Handoff: $ARGUMENTS
142
- ━━━━━━━━━━━━━━━━━━━
143
-
144
- Branch: [branch]
145
- Commit: [hash]
146
- Saved: handoffs/$ARGUMENTS (memory system)
147
-
148
- Next session: /resume $ARGUMENTS
149
- ```