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
@@ -0,0 +1,56 @@
1
+ ---
2
+ description: Debug and fix a bug or failing test
3
+ argument-hint: "<description of bug or error>"
4
+ agent: build
5
+ ---
6
+
7
+ # Fix: $ARGUMENTS
8
+
9
+ Systematically debug and fix the reported issue.
10
+
11
+ ## Load Skills
12
+
13
+ ```typescript
14
+ skill({ name: "systematic-debugging" });
15
+ skill({ name: "root-cause-tracing" });
16
+ skill({ name: "verification-before-completion" });
17
+ ```
18
+
19
+ ## Process
20
+
21
+ ### Phase 1: Reproduce
22
+
23
+ ```bash
24
+ # Reproduce the issue with the exact steps or command
25
+ ```
26
+
27
+ ### Phase 2: Isolate
28
+
29
+ - Search for the error message or symptom in the codebase
30
+ - Trace the execution path to find the root cause
31
+ - Read the 2-4 most relevant files
32
+ - Distinguish symptom from root cause
33
+
34
+ ### Phase 3: Fix
35
+
36
+ - Apply the minimal fix for the root cause
37
+ - Do not add speculative guards, tolerant readers, or defensive copies
38
+ - Prefer making the bad state impossible over handling all bad states
39
+
40
+ ### Phase 4: Verify
41
+
42
+ ```bash
43
+ npm run typecheck
44
+ npm run lint
45
+ npm test # or vitest relevant test
46
+ ```
47
+
48
+ If verification fails twice on the same approach, escalate with learnings.
49
+
50
+ ## Output
51
+
52
+ Report:
53
+ 1. Root cause (with file:line)
54
+ 2. Fix applied
55
+ 3. Verification results
56
+ 4. What else was considered and rejected
@@ -0,0 +1,55 @@
1
+ ---
2
+ description: Proactive architecture health check — find shallow modules, propose deep-module redesigns
3
+ argument-hint: "[path|module|'all'] [--scope surface|deep]"
4
+ agent: review
5
+ ---
6
+
7
+ # Improve Architecture: $ARGUMENTS
8
+
9
+ Proactive architecture health check. Find shallow modules and propose deep-module redesigns.
10
+
11
+ ## Load Skills
12
+
13
+ ```typescript
14
+ skill({ name: "deep-module-design" });
15
+ skill({ name: "verification-before-completion" });
16
+ ```
17
+
18
+ ## Architecture Check
19
+
20
+ Apply Ousterhout's deep module principles:
21
+ - **Small interface** — does this module expose more than it should?
22
+ - **Information hiding** — are implementation details leaking?
23
+ - **Pull complexity downward** — are callers doing work the module should own?
24
+
25
+ ## Process
26
+
27
+ ### Phase 1: Scan
28
+
29
+ If path given, focus on that directory. If `all`, scan the full project.
30
+
31
+ For each module, assess:
32
+ - Lines of interface vs lines of implementation
33
+ - Number of callers and how they use it
34
+ - What knowledge is embedded but not encapsulated
35
+ - What would break if the module were redesigned
36
+
37
+ ### Phase 2: Propose
38
+
39
+ For each finding:
40
+
41
+ | Module | Issue | Proposed Redesign | Effort | Risk |
42
+ |---|---|---|---|---|
43
+ | path/to/module | Shallow interface exposing internals | Encapsulate behind 3 functions | M | Low |
44
+
45
+ ### Phase 3: Prioritize
46
+
47
+ Rank proposals by impact/effort ratio. Recommend top 1-3 changes worth making.
48
+
49
+ ## Output
50
+
51
+ Report:
52
+ 1. Modules reviewed
53
+ 2. Findings (current issue, proposed redesign, effort, risk)
54
+ 3. Top recommendations
55
+ 4. Quick wins (S-effort changes)
@@ -1,31 +1,49 @@
1
1
  ---
2
- description: Initialize core project setup (AGENTS.md + tech-stack detection only)
3
- argument-hint: "[--deep]"
2
+ description: Initialize project setup AGENTS.md, planning context, user profile, and tech stack
3
+ argument-hint: "[--deep] [--context|--user|--all]"
4
4
  agent: build
5
5
  ---
6
6
 
7
7
  # Init: $ARGUMENTS
8
8
 
9
- Core project setup. Creates AGENTS.md and detects tech stack. Run once per project.
9
+ Initialize project setup. Run once per project. Supports three modes via argument flags.
10
10
 
11
- > **Next steps:** `/init-user` for personalization, `/init-context` for GSD planning workflow
11
+ > **Next step for fresh projects:** `/plan` to create first implementation plan.
12
+ > **Next step for brownfield:** `/review-codebase` for deep codebase analysis.
12
13
 
13
14
  ## Load Skills
14
15
 
15
16
  ```typescript
16
17
  skill({ name: "index-knowledge" });
18
+ skill({ name: "context-initialization" });
19
+ skill({ name: "brainstorming" });
20
+ skill({ name: "verification-before-completion" });
21
+ skill({ name: "swarm-coordination" }); // For --brownfield analysis
17
22
  ```
18
23
 
19
- ## Options
24
+ ## Parse Arguments
20
25
 
21
- | Argument | Default | Description |
22
- | -------- | ------- | ----------------------------------------- |
23
- | `--deep` | false | Comprehensive research (~100+ tool calls) |
26
+ | Argument | Default | Description |
27
+ |---|---|---|
28
+ | `--deep` | false | Comprehensive research for AGENTS.md (~100+ tool calls) |
29
+ | `--context` | false | Init planning context (roadmap, state) |
30
+ | `--user` | false | Init user profile |
31
+ | `--all` | false | Full init: AGENTS.md + context + user profile |
24
32
 
25
- ## Phase 1: Detect Project
33
+ **Mode rules:**
34
+ - No flags (default): Core project setup — AGENTS.md + tech stack only
35
+ - `--context`: Planning context (roadmap.md, state.md)
36
+ - `--user`: User profile (user.md)
37
+ - `--all`: Everything
38
+ - `--deep` applies to AGENTS.md generation only
26
39
 
27
- Detect and validate:
40
+ ---
41
+
42
+ ## Mode 1: Core Setup (Default)
28
43
 
44
+ ### Phase 1: Detect Project
45
+
46
+ Detect and validate:
29
47
  - Package manager and dependencies (with versions)
30
48
  - Build, test, lint, dev commands — **validate each actually works**
31
49
  - CI/CD configuration
@@ -34,82 +52,84 @@ Detect and validate:
34
52
 
35
53
  With `--deep`: Also analyze git history, source patterns, subsystem candidates.
36
54
 
37
- ## Phase 2: Preview Detection
55
+ ### Phase 2: Preview Detection
38
56
 
39
- After detecting project, show summary and ask for confirmation:
57
+ Show detected summary and ask for confirmation before writing.
40
58
 
41
- ```typescript
42
- question({
43
- questions: [
44
- {
45
- header: "Preview",
46
- question: `Detected: ${detectedTechStack}. Create AGENTS.md?`,
47
- options: [
48
- { label: "Yes, create it (Recommended)" },
49
- { label: "Show me what you'll write first" },
50
- { label: "Cancel" },
51
- ],
52
- },
53
- ],
54
- });
55
- ```
59
+ ### Phase 3: Create AGENTS.md
60
+
61
+ Create `./AGENTS.md` — target <60 lines (max 150). Follow `index-knowledge` format:
62
+ - Tech stack with versions, file structure, validated commands
63
+ - Code example from actual codebase
64
+ - Testing conventions, boundaries, gotchas
65
+
66
+ **Principles:** Examples > explanations. Pointers > copies. If AGENTS.md exists, improve it don't overwrite blindly.
56
67
 
57
- **If "Show me":** Display detected values without writing files, then ask again.
68
+ ### Phase 4: Create tech-stack.md
58
69
 
59
- ## Phase 3: Create AGENTS.md
70
+ Write detected values to `.opencode/memory/project/tech-stack.md`. Persist with memory update.
60
71
 
61
- Create `./AGENTS.md` — **target <60 lines** (max 150). Follow the `index-knowledge` skill format:
72
+ ---
73
+
74
+ ## Mode 2: Planning Context (`--context`)
75
+
76
+ Initialize project planning context with roadmap and state files.
62
77
 
63
- - Tech stack with versions
64
- - File structure
65
- - Commands (validated)
66
- - Code example from actual codebase (5-10 lines)
67
- - Testing conventions
68
- - Boundaries (always/ask-first/never)
69
- - Gotchas
78
+ ### Phase 1: Discovery
70
79
 
71
- **Principles**: Examples > explanations. Pointers > copies. If AGENTS.md exists, improve it don't overwrite blindly.
80
+ If `--brownfield` (detected from existing codebase), run parallel codebase analysis:
81
+ - `explore` for architecture patterns
82
+ - `explore` for data flow
83
+ - `explore` for domain boundaries
72
84
 
73
- ## Phase 4: Create tech-stack.md
85
+ If greenfield, skip to requirements gathering.
74
86
 
75
- From template `.opencode/memory/_templates/tech-stack.md`:
87
+ ### Phase 2: Requirements Gathering
76
88
 
77
- Read the template from `.opencode/memory/_templates/tech-stack.md` and write it to `.opencode/memory/project/tech-stack.md`.
89
+ Ask questions to define:
90
+ - Project vision and goals (1-2 sentences each)
91
+ - Target users and their needs
92
+ - Core features (what must exist)
93
+ - Technical constraints
94
+ - Success criteria
78
95
 
79
- Fill detected values:
96
+ ### Phase 3: Create Files
80
97
 
81
- - Framework, language, runtime
82
- - Styling, components, design system
83
- - Database, ORM, state management
84
- - Testing tools
85
- - Verification commands
98
+ - `.opencode/memory/project/roadmap.md` — vision, goals, user personas, feature roadmap, constraints, success criteria
99
+ - `.opencode/memory/project/state.md` — current status, active decisions, known issues, next priorities
100
+ - Update `.opencode/opencode.json` instructions to include roadmap.md and state.md
101
+
102
+ ---
86
103
 
87
- ## Phase 5: Subsystems (--deep only)
104
+ ## Mode 3: User Profile (`--user`)
88
105
 
89
- Identify candidates for nested AGENTS.md:
106
+ Create personalized user profile at `.opencode/memory/project/user.md`.
90
107
 
91
- - `packages/*/` in monorepos
92
- - `frontend/` vs `backend/` directories
93
- - Significantly different subsystem patterns
108
+ ### Phase 1: Gather Preferences
94
109
 
95
- Ask user before creating nested files.
110
+ Ask questions about:
111
+ - **Identity**: Name, role, experience level
112
+ - **Communication**: Verbosity preference, feedback style, update frequency
113
+ - **Workflow**: Branch strategy, commit style, review expectations, test expectations
114
+ - **Technical**: Preferred tools, avoided patterns, dev environment
96
115
 
97
- ## Phase 6: Verify and Report
116
+ ### Phase 2: Create user.md
98
117
 
99
- Verify:
118
+ Write to `.opencode/memory/project/user.md` with the captured preferences.
100
119
 
101
- - [ ] AGENTS.md is <60 lines (or justified)
102
- - [ ] Commands validated and work
103
- - [ ] Boundaries include Never rules
104
- - [ ] Code example from actual codebase
105
- - [ ] tech-stack.md created
120
+ ### Phase 3: Update opencode.json
121
+
122
+ Ensure user.md is in `instructions[]` as one of the 4 auto-injected files (user.md, tech-stack.md, project.md, git-context.md).
123
+
124
+ > **Warning:** Do not add more files to `instructions[]` unless essential. Per-prompt injection of too many files causes session OOM. Use `memory-search({ file: "..." })` for on-demand access.
125
+
126
+ ---
106
127
 
107
- Output:
128
+ ## Output
108
129
 
109
- 1. Files created (with line counts)
110
- 2. Tech stack detected
111
- 3. Commands validated (yes/no)
112
- 4. Suggested next steps:
113
- - `/init-user` Create user profile
114
- - `/init-context` Set up GSD planning workflow
115
- - `/review-codebase` — Deep codebase analysis
130
+ Report what was created:
131
+ 1. AGENTS.md (if core setup ran)
132
+ 2. tech-stack.md (if core setup ran)
133
+ 3. roadmap.md + state.md (if `--context`)
134
+ 4. user.md (if `--user`)
135
+ 5. Recommended next command: `/plan`, `/review-codebase`, or `/resume`
@@ -0,0 +1,66 @@
1
+ ---
2
+ description: Refactor code for clarity, performance, or maintainability
3
+ argument-hint: "<file or path> [--scope minimal|moderate|aggressive]"
4
+ agent: build
5
+ ---
6
+
7
+ # Refactor: $ARGUMENTS
8
+
9
+ Improve code quality without changing external behavior.
10
+
11
+ ## Load Skills
12
+
13
+ ```typescript
14
+ skill({ name: "code-simplification" });
15
+ skill({ name: "verification-before-completion" });
16
+ ```
17
+
18
+ ## Parse Arguments
19
+
20
+ | Argument | Default | Description |
21
+ |---|---|---|
22
+ | `<file or path>` | required | File or directory to refactor |
23
+ | `--scope` | minimal | `minimal` (rename/restructure), `moderate` (extract modules), `aggressive` (redesign) |
24
+
25
+ ## When to Refactor
26
+
27
+ - Module has grown beyond its original purpose
28
+ - Tests are hard to write because of tight coupling
29
+ - Similar logic appears in multiple places
30
+ - Files have crossed 300+ lines with unclear boundaries
31
+
32
+ ## Process
33
+
34
+ ### Phase 1: Assess
35
+
36
+ 1. Read all files in scope
37
+ 2. Identify: duplication, shallow interfaces, unclear naming, mixed concerns
38
+ 3. Plan the refactor — show plan if >3 files would change
39
+
40
+ ### Phase 2: Lock Behavior
41
+
42
+ - If the module has tests, they must still pass after refactor
43
+ - If no tests exist, run existing verification (typecheck, lint)
44
+ - No behavior changes in a refactor — external API must be preserved
45
+
46
+ ### Phase 3: Execute
47
+
48
+ - One change at a time, verify after each
49
+ - Prefer small commits with clear messages
50
+ - `refactor(scope): what changed`
51
+
52
+ ### Phase 4: Verify
53
+
54
+ ```bash
55
+ npm run typecheck
56
+ npm run lint
57
+ npm test
58
+ ```
59
+
60
+ ## Output
61
+
62
+ Report:
63
+ 1. What changed and why
64
+ 2. Files modified
65
+ 3. Verification results
66
+ 4. What was left for future refactors
@@ -0,0 +1,66 @@
1
+ ---
2
+ description: Write or generate tests for code
3
+ argument-hint: "<file or function> [--unit|--integration|--e2e]"
4
+ agent: build
5
+ ---
6
+
7
+ # Test: $ARGUMENTS
8
+
9
+ Write or generate tests for the specified code.
10
+
11
+ ## Load Skills
12
+
13
+ ```typescript
14
+ skill({ name: "test-driven-development" });
15
+ skill({ name: "testing-anti-patterns" });
16
+ skill({ name: "verification-before-completion" });
17
+ ```
18
+
19
+ ## Parse Arguments
20
+
21
+ | Argument | Default | Description |
22
+ |---|---|---|
23
+ | `<file or function>` | required | File path or function name to test |
24
+ | `--unit` | auto | Unit test (default for utils, helpers) |
25
+ | `--integration` | false | Integration test (default for API, DB) |
26
+ | `--e2e` | false | End-to-end test (requires full setup) |
27
+
28
+ ## Process
29
+
30
+ ### Phase 1: Understand
31
+
32
+ 1. Read the file and understand the function/module contract
33
+ 2. Identify: inputs, outputs, side effects, error states, edge cases
34
+ 3. Check existing tests for patterns and structure
35
+
36
+ ### Phase 2: Write Tests
37
+
38
+ Cover:
39
+ - Happy path (expected input → expected output)
40
+ - Edge cases (empty, null, boundary values)
41
+ - Error states (invalid input, missing dependencies)
42
+ - Contract invariants (what must always be true)
43
+
44
+ Follow the existing test patterns in the project. If none exist, check `vitest.config.ts`.
45
+
46
+ ### Phase 3: Run and Verify
47
+
48
+ ```bash
49
+ vitest <path> # or npm test
50
+ ```
51
+
52
+ TDD if writing implementation simultaneously: RED → GREEN → REFACTOR.
53
+
54
+ ## Anti-Patterns
55
+
56
+ - Testing implementation details instead of behavior
57
+ - Mocking without understanding the real dependency
58
+ - Test-only code in production files (exporting internals just for tests)
59
+ - Brittle assertions (matching full objects when partial match suffices)
60
+
61
+ ## Output
62
+
63
+ Report:
64
+ 1. Tests written
65
+ 2. Coverage summary
66
+ 3. Verification results
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/Opencode-DCP/opencode-dynamic-context-pruning/master/dcp.schema.json",
3
3
  "enabled": true,
4
- // Disable auto-update for config stability — update explicitly when pinning new versions
5
- // (v3.1.10+: auto-update is supported; set true if you want rolling bug fixes)
4
+ // Disable auto-update for config stability — update explicitly when pinning new versions.
5
+ // v3.1.10+ auto-update is mature; set true if you want rolling bug fixes.
6
6
  "autoUpdate": false,
7
7
  "debug": false,
8
8
  // "off" | "minimal" | "detailed" — keep minimal for low-noise dev flow
@@ -31,6 +31,7 @@
31
31
  "protectedFilePatterns": [
32
32
  "**/.env*",
33
33
  "**/AGENTS.md",
34
+ "**/opencode.json*",
34
35
  "**/package.json",
35
36
  "**/tsconfig.json"
36
37
  ],
@@ -59,6 +60,16 @@
59
60
  "protectUserMessages": false,
60
61
  // v3.1.11+: preserve text wrapped in <protect>...</protect> during compression
61
62
  "protectTags": false,
63
+ // Optional per-model max context limits — only if you need different thresholds
64
+ // per model. Uncomment and adjust for your models:
65
+ // "modelMaxLimits": {
66
+ // "anthropic/claude-sonnet-4.6": "80%",
67
+ // "openai/gpt-5.3-codex": "80%",
68
+ // "github/github-copilot": "65%"
69
+ // },
70
+ // "modelMinLimits": {
71
+ // "anthropic/claude-sonnet-4.6": "30%"
72
+ // },
62
73
  // Auto-protected by DCP: task, skill, todowrite, todoread, compress, batch,
63
74
  // plan_enter, plan_exit, write, edit
64
75
  // Only list ADDITIONAL tools whose outputs should be appended to compression summaries
@@ -38,11 +38,9 @@ memory/
38
38
 
39
39
  | Tool | Purpose |
40
40
  | ------------------- | --------------------------------------------- |
41
- | `observation()` | Write structured observations to SQLite |
42
- | `memory-search()` | FTS5 full-text search (returns compact index) |
43
- | `memory-get()` | Fetch full observation details by ID |
44
- | `memory-timeline()` | Get chronological context around anchor |
45
- | `memory-update()` | Update markdown files in memory |
41
+ | `observation()` | Write structured observations to SQLite or give feedback on existing ones |
42
+ | `memory-search()` | FTS5 full-text search (returns compact index) or read memory files by path |
43
+ | `memory-admin()` | Memory system administration: maintenance, migration, lint, compile, index |
46
44
 
47
45
  ## PARA Categories
48
46
 
@@ -0,0 +1,45 @@
1
+ # ADR: [short title of decision]
2
+
3
+ **Status:** [proposed | accepted | deprecated | superseded]
4
+ **Date:** [YYYY-MM-DD]
5
+ **Context:** [bead-id, issue/Linear ticket, or session reference]
6
+
7
+ ## Context
8
+
9
+ What is the problem we are solving? What forces are at play? What constraints do we have?
10
+
11
+ ## Decision
12
+
13
+ What did we decide to do? Be specific. This is the answer to the problem stated above.
14
+
15
+ ## Rationale
16
+
17
+ Why this approach over the alternatives? What evidence or reasoning supports this decision?
18
+
19
+ ## Consequences
20
+
21
+ What becomes easier or harder because of this decision? What tradeoffs did we accept?
22
+
23
+ ### Positive
24
+
25
+ - [benefit 1]
26
+ - [benefit 2]
27
+
28
+ ### Negative
29
+
30
+ - [cost / risk 1]
31
+ - [cost / risk 2]
32
+
33
+ ## Alternatives Considered
34
+
35
+ ### Alternative 1: [name]
36
+
37
+ Pros/cons and why it was rejected.
38
+
39
+ ### Alternative 2: [name]
40
+
41
+ Pros/cons and why it was rejected.
42
+
43
+ ## Notes
44
+
45
+ - [Anything else? Links to related ADRs, PRDs, specs?]
@@ -53,7 +53,7 @@ The edit tool (`str_replace`) is the #1 source of failures in LLM coding. Models
53
53
  ## Memory System
54
54
 
55
55
  - Subagents (explore, scout, review) should NOT write to memory - only leader agents
56
- - Use `observation: false` and `memory-update: false` in agent configs to enforce
56
+ - Use `observation: false` in agent configs to enforce
57
57
 
58
58
  ## Build System
59
59
 
@@ -6,7 +6,7 @@ updated: 2025-01-08
6
6
  # Session Context
7
7
 
8
8
  <!--
9
- Agent-maintained via memory-update tool.
9
+ Agent-maintained via observation tool.
10
10
  Update when: goal changes, key decision made, state shifts, uncertainty discovered.
11
11
  After compaction: read this file, ask 1-3 targeted questions if gaps exist.
12
12
  -->
@@ -42,7 +42,7 @@ plugin/
42
42
  - Injects relevant knowledge into system prompt (BM25 _ recency _ confidence scoring)
43
43
  - Manages context window via messages.transform (token budget enforcement)
44
44
  - Merges compaction logic (beads, handoffs, project memory, knowledge)
45
- - Provides 11 tools: observation, memory-search, memory-get, memory-read, memory-update, memory-timeline, memory-graph-add, memory-graph-query, memory-graph-invalidate, memory-compact, memory-admin
45
+ - Provides 3 tools: observation, memory-search, memory-admin
46
46
 
47
47
  - `sessions.ts`
48
48
  - Provides tools: `find_sessions`, `read_session`
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Guard Plugin — Agent Safety & Convention Enforcement
3
+ *
4
+ * Ported from pikit's extensions/guard.ts.
5
+ *
6
+ * 1. Pipe-to-shell blocker: rejects `curl … | bash` / `wget … | bash` patterns.
7
+ * 2. Conventional Commits: rejects `git commit` with non-compliant messages.
8
+ */
9
+
10
+ import type { Plugin } from "@opencode-ai/plugin";
11
+
12
+ const CONVENTIONAL_RE =
13
+ /^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\([a-z0-9._/-]+\))?!?: .+/;
14
+
15
+ export const GuardPlugin: Plugin = async () => {
16
+ return {
17
+ "tool.execute.before": async (input, output) => {
18
+ if (input.tool !== "bash") return;
19
+
20
+ const cmd: string = (output.args as Record<string, unknown>)?.command ?? "";
21
+
22
+ // --- curl/wget | bash blocker ---
23
+ // Only match when curl/wget starts a command segment to avoid false positives
24
+ // on quoted text (e.g. commit messages) mentioning the pattern.
25
+ if (/(?:^|[;&|])\s*(?:curl|wget)\s.*\|\s*(?:ba)?sh/i.test(cmd)) {
26
+ throw new Error(
27
+ "Blocked: detected pipe-to-shell pattern (curl/wget | bash). Download first, inspect, then run.",
28
+ );
29
+ }
30
+
31
+ // --- conventional commit enforcer ---
32
+ const commitMatch = cmd.match(/git\s+commit\s/);
33
+ if (!commitMatch) return;
34
+
35
+ const msgMatch =
36
+ cmd.match(/(?:-m|--message=?)\s*"([^"]*)"/) ??
37
+ cmd.match(/(?:-m|--message=?)\s*'([^']*)'/) ??
38
+ cmd.match(/(?:-m|--message=?)\s+(\S+)/);
39
+
40
+ const msg = msgMatch?.[1];
41
+
42
+ if (!msg) {
43
+ throw new Error(
44
+ 'Blocked: git commit missing -m message. Use: git commit -m "type(scope): subject"',
45
+ );
46
+ }
47
+
48
+ if (!CONVENTIONAL_RE.test(msg)) {
49
+ throw new Error(
50
+ [
51
+ "Blocked: commit message is not Conventional Commits compliant.",
52
+ `Got: ${msg}`,
53
+ "Expected: <type>(scope): <subject>",
54
+ "Types: feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert",
55
+ ].join("\n"),
56
+ );
57
+ }
58
+ },
59
+ };
60
+ };
61
+
62
+ export default GuardPlugin;
@@ -33,7 +33,7 @@ import {
33
33
  runFullMaintenance,
34
34
  storeObservation,
35
35
  vacuumDatabase,
36
- } from "./memory-db.js";
36
+ } from "./db.js";
37
37
 
38
38
  interface AdminToolDeps {
39
39
  directory: string;
@@ -157,7 +157,7 @@ export function createAdminTools(deps: AdminToolDeps) {
157
157
  severity: "medium" as const,
158
158
  title: `Graph contradiction: ${t.subject} ↔ ${t.object}`,
159
159
  detail: `Active triple "${t.subject} —[${t.predicate}]→ ${t.object}" has ${contradictions.length} conflicting predicate(s): ${contradictions.map(c => c.predicate).join(", ")}`,
160
- suggestion: `Use memory-graph-invalidate to close outdated triples`,
160
+ suggestion: `Use observation to update or supersede outdated observations`,
161
161
  type: "contradiction" as const,
162
162
  observation_ids: contradictions.map(c => c.source_observation_id).filter((id): id is number => id != null),
163
163
  });
@@ -187,7 +187,7 @@ export function createAdminTools(deps: AdminToolDeps) {
187
187
  }
188
188
  case "index": {
189
189
  const result = generateMemoryIndex();
190
- return `Index generated: ${result.entryCount} observations, ${result.conceptCount} concepts. Read with \`memory-read({ file: "index" })\`.`;
190
+ return `Index generated: ${result.entryCount} observations, ${result.conceptCount} concepts. Read with \`memory-search({ file: "index" })\`.`;
191
191
  }
192
192
  case "compile": {
193
193
  const result = compileObservations();
@@ -195,7 +195,7 @@ export function createAdminTools(deps: AdminToolDeps) {
195
195
  return `No concept clusters with 3+ observations found. Nothing to compile.`;
196
196
  }
197
197
  const articleList = result.articles.map(a => ` - ${a.concept} (${a.observationCount} obs)`).join("\n");
198
- return `Compiled ${result.articles.length} articles from ${result.totalObservations} observations (${result.skippedClusters} skipped).\n\nArticles:\n${articleList}\n\nRead with \`memory-read({ file: "compiled/<concept>" })\`.`;
198
+ return `Compiled ${result.articles.length} articles from ${result.totalObservations} observations (${result.skippedClusters} skipped).\n\nArticles:\n${articleList}\n\nRead with \`memory-search({ file: "compiled/<concept>" })\`.`;
199
199
  }
200
200
  case "log": {
201
201
  return getLogContent();