opencodekit 0.21.9 → 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.
- package/dist/index.js +1 -1
- package/dist/template/.opencode/AGENTS.md +116 -499
- package/dist/template/.opencode/README.md +1 -1
- package/dist/template/.opencode/agent/build.md +56 -396
- package/dist/template/.opencode/agent/explore.md +15 -16
- package/dist/template/.opencode/agent/general.md +2 -2
- package/dist/template/.opencode/agent/plan.md +3 -3
- package/dist/template/.opencode/agent/review.md +2 -3
- package/dist/template/.opencode/agent/scout.md +34 -16
- package/dist/template/.opencode/agent/vision.md +0 -1
- package/dist/template/.opencode/command/clarify.md +48 -0
- package/dist/template/.opencode/command/commit.md +53 -0
- package/dist/template/.opencode/command/design.md +4 -4
- package/dist/template/.opencode/command/fix.md +56 -0
- package/dist/template/.opencode/command/improve-architecture.md +55 -0
- package/dist/template/.opencode/command/init.md +88 -68
- package/dist/template/.opencode/command/refactor.md +66 -0
- package/dist/template/.opencode/command/review-codebase.md +1 -1
- package/dist/template/.opencode/command/ship.md +1 -1
- package/dist/template/.opencode/command/test.md +66 -0
- package/dist/template/.opencode/dcp.jsonc +29 -46
- package/dist/template/.opencode/memory/README.md +3 -5
- package/dist/template/.opencode/memory/_templates/adr.md +45 -0
- package/dist/template/.opencode/memory/project/gotchas.md +1 -1
- package/dist/template/.opencode/memory/project/user.md +1 -2
- package/dist/template/.opencode/memory/session-context.md +1 -1
- package/dist/template/.opencode/opencode.json +10 -332
- package/dist/template/.opencode/plugin/README.md +1 -1
- package/dist/template/.opencode/plugin/guard.ts +62 -0
- package/dist/template/.opencode/plugin/{lib/memory-admin-tools.ts → memory/admin.ts} +4 -4
- package/dist/template/.opencode/plugin/{lib → memory}/capture.ts +1 -1
- package/dist/template/.opencode/plugin/{lib → memory}/compile.ts +2 -2
- package/dist/template/.opencode/plugin/{lib → memory}/context.ts +1 -1
- package/dist/template/.opencode/plugin/{lib → memory}/curator.ts +1 -1
- package/dist/template/.opencode/plugin/{lib → memory}/db/observations.ts +102 -3
- package/dist/template/.opencode/plugin/{lib → memory}/db/schema.ts +43 -1
- package/dist/template/.opencode/plugin/{lib → memory}/db/types.ts +22 -0
- package/dist/template/.opencode/plugin/{lib/memory-db.ts → memory/db.ts} +1 -1
- package/dist/template/.opencode/plugin/{lib → memory}/distill.ts +1 -1
- package/dist/template/.opencode/plugin/{lib/memory-helpers.ts → memory/helpers.ts} +5 -1
- package/dist/template/.opencode/plugin/{lib/memory-hooks.ts → memory/hooks.ts} +1 -1
- package/dist/template/.opencode/plugin/{lib → memory}/index-generator.ts +2 -2
- package/dist/template/.opencode/plugin/{lib → memory}/inject.ts +1 -1
- package/dist/template/.opencode/plugin/{lib → memory}/lint.ts +2 -2
- package/dist/template/.opencode/plugin/memory/tools.ts +322 -0
- package/dist/template/.opencode/plugin/{lib → memory}/validate.ts +2 -2
- package/dist/template/.opencode/plugin/memory.ts +7 -17
- package/dist/template/.opencode/plugin/srcwalk.ts +721 -0
- package/dist/template/.opencode/skill/agent-code-quality-gate/SKILL.md +98 -0
- package/dist/template/.opencode/skill/behavioral-kernel/SKILL.md +52 -0
- package/dist/template/.opencode/skill/browser-testing-with-devtools/SKILL.md +85 -0
- package/dist/template/.opencode/skill/code-cleanup/SKILL.md +114 -0
- package/dist/template/.opencode/skill/code-navigation/SKILL.md +142 -0
- package/dist/template/.opencode/skill/code-review-and-quality/SKILL.md +131 -0
- package/dist/template/.opencode/skill/debugging-and-error-recovery/SKILL.md +109 -0
- package/dist/template/.opencode/skill/deep-module-design/SKILL.md +207 -0
- package/dist/template/.opencode/skill/git-workflow-and-versioning/SKILL.md +77 -0
- package/dist/template/.opencode/skill/grill-me/SKILL.md +140 -0
- package/dist/template/.opencode/skill/memory-system/SKILL.md +9 -10
- package/dist/template/.opencode/skill/planning-and-task-breakdown/SKILL.md +116 -0
- package/dist/template/.opencode/skill/shipping-and-launch/SKILL.md +95 -0
- package/dist/template/.opencode/skill/source-driven-development/SKILL.md +103 -0
- package/dist/template/.opencode/skill/spec-driven-development/SKILL.md +121 -0
- package/dist/template/.opencode/skill/srcwalk/SKILL.md +161 -0
- package/dist/template/.opencode/skill/ubiquitous-language/SKILL.md +184 -0
- package/dist/template/.opencode/tool/context7.ts +1 -1
- package/dist/template/.opencode/tool/grepsearch.ts +1 -1
- package/package.json +1 -1
- package/dist/template/.opencode/AGENT_ALIGNMENT.md +0 -564
- package/dist/template/.opencode/agent/painter.md +0 -83
- package/dist/template/.opencode/command/compound.md +0 -240
- package/dist/template/.opencode/command/curate.md +0 -299
- package/dist/template/.opencode/command/handoff.md +0 -149
- package/dist/template/.opencode/command/health.md +0 -356
- package/dist/template/.opencode/command/init-context.md +0 -297
- package/dist/template/.opencode/command/init-user.md +0 -125
- package/dist/template/.opencode/command/iterate.md +0 -200
- package/dist/template/.opencode/command/lfg.md +0 -173
- package/dist/template/.opencode/command/resume.md +0 -78
- package/dist/template/.opencode/command/status.md +0 -126
- package/dist/template/.opencode/command/ui-slop-check.md +0 -169
- package/dist/template/.opencode/plugin/lib/memory-tools.ts +0 -535
- package/dist/template/.opencode/skill/agent-evals/SKILL.md +0 -208
- package/dist/template/.opencode/skill/anti-ai-slop/SKILL.md +0 -76
- package/dist/template/.opencode/skill/augment-context-engine/SKILL.md +0 -122
- package/dist/template/.opencode/skill/augment-context-engine/mcp.json +0 -6
- package/dist/template/.opencode/skill/brand-asset-protocol/SKILL.md +0 -222
- package/dist/template/.opencode/skill/code-search-patterns/SKILL.md +0 -253
- package/dist/template/.opencode/skill/code-simplification/SKILL.md +0 -211
- package/dist/template/.opencode/skill/context-condensation/SKILL.md +0 -149
- package/dist/template/.opencode/skill/context-initialization/SKILL.md +0 -69
- package/dist/template/.opencode/skill/context-management/SKILL.md +0 -390
- package/dist/template/.opencode/skill/deep-research/SKILL.md +0 -384
- package/dist/template/.opencode/skill/design-direction-advisor/SKILL.md +0 -139
- package/dist/template/.opencode/skill/dispatching-parallel-agents/SKILL.md +0 -191
- package/dist/template/.opencode/skill/executing-plans/SKILL.md +0 -247
- package/dist/template/.opencode/skill/figma-go/SKILL.md +0 -65
- package/dist/template/.opencode/skill/finishing-a-development-branch/SKILL.md +0 -357
- package/dist/template/.opencode/skill/full-output-enforcement/SKILL.md +0 -62
- package/dist/template/.opencode/skill/gh-address-comments/SKILL.md +0 -29
- package/dist/template/.opencode/skill/gh-address-comments/scripts/fetch_comments.py +0 -237
- package/dist/template/.opencode/skill/gh-fix-ci/SKILL.md +0 -38
- package/dist/template/.opencode/skill/gh-fix-ci/scripts/inspect_pr_checks.py +0 -509
- package/dist/template/.opencode/skill/hi-fi-prototype-html/SKILL.md +0 -253
- package/dist/template/.opencode/skill/html-deck-export/SKILL.md +0 -189
- package/dist/template/.opencode/skill/index-knowledge/SKILL.md +0 -413
- package/dist/template/.opencode/skill/memory-grounding/SKILL.md +0 -68
- package/dist/template/.opencode/skill/playwriter/SKILL.md +0 -158
- package/dist/template/.opencode/skill/portless/SKILL.md +0 -109
- package/dist/template/.opencode/skill/prd/SKILL.md +0 -146
- package/dist/template/.opencode/skill/prd-task/SKILL.md +0 -182
- package/dist/template/.opencode/skill/prd-task/references/prd-schema.json +0 -124
- package/dist/template/.opencode/skill/prompt-leverage/SKILL.md +0 -90
- package/dist/template/.opencode/skill/prompt-leverage/references/framework.md +0 -91
- package/dist/template/.opencode/skill/prompt-leverage/scripts/augment_prompt.py +0 -157
- package/dist/template/.opencode/skill/receiving-code-review/SKILL.md +0 -263
- package/dist/template/.opencode/skill/reconcile/SKILL.md +0 -183
- package/dist/template/.opencode/skill/reflection-checkpoints/SKILL.md +0 -183
- package/dist/template/.opencode/skill/requesting-code-review/SKILL.md +0 -443
- package/dist/template/.opencode/skill/requesting-code-review/references/specialist-profiles.md +0 -108
- package/dist/template/.opencode/skill/requesting-code-review/review.md +0 -160
- package/dist/template/.opencode/skill/rtk-command-compression/SKILL.md +0 -134
- package/dist/template/.opencode/skill/screenshot/SKILL.md +0 -48
- package/dist/template/.opencode/skill/screenshot/scripts/ensure_macos_permissions.sh +0 -54
- package/dist/template/.opencode/skill/screenshot/scripts/macos_display_info.swift +0 -22
- package/dist/template/.opencode/skill/screenshot/scripts/macos_permissions.swift +0 -40
- package/dist/template/.opencode/skill/screenshot/scripts/macos_window_info.swift +0 -126
- package/dist/template/.opencode/skill/screenshot/scripts/take_screenshot.ps1 +0 -163
- package/dist/template/.opencode/skill/screenshot/scripts/take_screenshot.py +0 -585
- package/dist/template/.opencode/skill/security-threat-model/SKILL.md +0 -36
- package/dist/template/.opencode/skill/security-threat-model/references/prompt-template.md +0 -255
- package/dist/template/.opencode/skill/security-threat-model/references/security-controls-and-assets.md +0 -32
- package/dist/template/.opencode/skill/sharing-skills/SKILL.md +0 -214
- package/dist/template/.opencode/skill/skill-creator/SKILL.md +0 -181
- package/dist/template/.opencode/skill/skill-installer/SKILL.md +0 -58
- package/dist/template/.opencode/skill/skill-installer/scripts/github_utils.py +0 -21
- package/dist/template/.opencode/skill/skill-installer/scripts/install-skill-from-github.py +0 -313
- package/dist/template/.opencode/skill/skill-installer/scripts/list-skills.py +0 -106
- package/dist/template/.opencode/skill/swarm-coordination/SKILL.md +0 -244
- package/dist/template/.opencode/skill/swarm-coordination/references/architecture.md +0 -39
- package/dist/template/.opencode/skill/swarm-coordination/references/delegation-worker-protocol.md +0 -145
- package/dist/template/.opencode/skill/swarm-coordination/references/dependency-graph.md +0 -50
- package/dist/template/.opencode/skill/swarm-coordination/references/drift-check.md +0 -90
- package/dist/template/.opencode/skill/swarm-coordination/references/integration-beads.md +0 -20
- package/dist/template/.opencode/skill/swarm-coordination/references/launch-flow.md +0 -186
- package/dist/template/.opencode/skill/swarm-coordination/references/reconciler.md +0 -172
- package/dist/template/.opencode/skill/swarm-coordination/references/tier-enforcement.md +0 -78
- package/dist/template/.opencode/skill/swarm-coordination/references/tmux-integration.md +0 -134
- package/dist/template/.opencode/skill/systematic-debugging/SKILL.md +0 -402
- package/dist/template/.opencode/skill/terse-output-mode/SKILL.md +0 -95
- package/dist/template/.opencode/skill/think-in-code/SKILL.md +0 -136
- package/dist/template/.opencode/skill/ux-quality-gates/SKILL.md +0 -137
- package/dist/template/.opencode/skill/v1-run/SKILL.md +0 -175
- package/dist/template/.opencode/skill/v1-run/mcp.json +0 -6
- package/dist/template/.opencode/skill/verification-gates/SKILL.md +0 -63
- package/dist/template/.opencode/skill/visual-analysis/SKILL.md +0 -154
- package/dist/template/.opencode/skill/web-design-guidelines/SKILL.md +0 -46
- package/dist/template/.opencode/skill/workspace-setup/SKILL.md +0 -76
- package/dist/template/.opencode/skill/writing-plans/SKILL.md +0 -320
- /package/dist/template/.opencode/plugin/{lib → memory}/compact.ts +0 -0
- /package/dist/template/.opencode/plugin/{lib → memory}/db/graph.ts +0 -0
- /package/dist/template/.opencode/plugin/{lib → memory}/db/maintenance.ts +0 -0
- /package/dist/template/.opencode/plugin/{lib → memory}/db/pipeline.ts +0 -0
- /package/dist/template/.opencode/plugin/{lib → memory}/notify.ts +0 -0
- /package/dist/template/.opencode/plugin/{lib → memory}/operation-log.ts +0 -0
|
@@ -1,356 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Audit .opencode/ configuration for consistency, stale references, and enforcement gaps
|
|
3
|
-
argument-hint: "[--fix] [--layer <intent|knowledge|control>]"
|
|
4
|
-
agent: review
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Health Check: $ARGUMENTS
|
|
8
|
-
|
|
9
|
-
Self-audit the .opencode/ configuration for drift, inconsistencies, and enforcement gaps.
|
|
10
|
-
|
|
11
|
-
## Load Skills
|
|
12
|
-
|
|
13
|
-
```typescript
|
|
14
|
-
skill({ name: "verification-before-completion" });
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Parse Arguments
|
|
18
|
-
|
|
19
|
-
| Argument | Default | Description |
|
|
20
|
-
| --------- | ------- | --------------------------------------------------- |
|
|
21
|
-
| `--fix` | false | Auto-fix safe issues (stale refs, dead links) |
|
|
22
|
-
| `--layer` | all | Focus on specific layer: intent, knowledge, control |
|
|
23
|
-
|
|
24
|
-
## Overview
|
|
25
|
-
|
|
26
|
-
This command runs a multi-layer health check inspired by three-layer defense:
|
|
27
|
-
|
|
28
|
-
1. **Intent** (AGENTS.md) — policies and rules
|
|
29
|
-
2. **Knowledge** (Skills) — procedures and workflows
|
|
30
|
-
3. **Control** (Agent frontmatter, hooks) — structural enforcement
|
|
31
|
-
|
|
32
|
-
A rule that exists at intent but not control is a gap. This command finds those gaps.
|
|
33
|
-
|
|
34
|
-
## Phase 1: Inventory
|
|
35
|
-
|
|
36
|
-
Build an inventory of all .opencode/ artifacts:
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
# Count artifacts
|
|
40
|
-
echo "=== Skills ==="
|
|
41
|
-
ls .opencode/skill/ | wc -l
|
|
42
|
-
echo "=== Commands ==="
|
|
43
|
-
ls .opencode/command/ | wc -l
|
|
44
|
-
echo "=== Agents ==="
|
|
45
|
-
ls .opencode/agent/ | wc -l
|
|
46
|
-
echo "=== Tools ==="
|
|
47
|
-
ls .opencode/tool/ 2>/dev/null | wc -l
|
|
48
|
-
echo "=== Plugins ==="
|
|
49
|
-
ls .opencode/plugin/ 2>/dev/null | wc -l
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
Report totals as a summary table.
|
|
53
|
-
|
|
54
|
-
## Phase 2: Stale Reference Detection
|
|
55
|
-
|
|
56
|
-
Check for references to skills, commands, or agents that don't exist:
|
|
57
|
-
|
|
58
|
-
### 2a. Skill references in commands and AGENTS.md
|
|
59
|
-
|
|
60
|
-
For every `skill({ name: "X" })` call found in `.opencode/command/*.md` and `AGENTS.md`:
|
|
61
|
-
|
|
62
|
-
- Verify `.opencode/skill/X/SKILL.md` exists
|
|
63
|
-
- Flag any that don't exist as **CRITICAL**
|
|
64
|
-
|
|
65
|
-
### 2b. Command references in skills and AGENTS.md
|
|
66
|
-
|
|
67
|
-
For every `/command-name` reference found in `.opencode/skill/*/SKILL.md` and `AGENTS.md`:
|
|
68
|
-
|
|
69
|
-
- Verify `.opencode/command/command-name.md` exists
|
|
70
|
-
- Flag missing as **IMPORTANT**
|
|
71
|
-
|
|
72
|
-
### 2c. Agent references
|
|
73
|
-
|
|
74
|
-
For every `agent: X` in command frontmatter:
|
|
75
|
-
|
|
76
|
-
- Verify `.opencode/agent/X.md` exists (or is a built-in agent)
|
|
77
|
-
- Flag missing as **CRITICAL**
|
|
78
|
-
|
|
79
|
-
### 2d. Cross-references between skills
|
|
80
|
-
|
|
81
|
-
For every `dependencies: [X, Y]` in skill YAML frontmatter:
|
|
82
|
-
|
|
83
|
-
- Verify each dependency skill exists
|
|
84
|
-
- Flag missing as **IMPORTANT**
|
|
85
|
-
|
|
86
|
-
Report format:
|
|
87
|
-
|
|
88
|
-
```text
|
|
89
|
-
| Reference Type | Source File | Target | Status |
|
|
90
|
-
|---------------------|-----------------------|---------------|---------|
|
|
91
|
-
| skill() | command/ship.md:15 | beads | OK |
|
|
92
|
-
| skill() | command/plan.md:22 | old-skill | MISSING |
|
|
93
|
-
| /command | skill/X/SKILL.md:45 | /deploy | MISSING |
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
## Phase 3: Skill Quality Audit
|
|
97
|
-
|
|
98
|
-
For each skill in `.opencode/skill/*/SKILL.md`:
|
|
99
|
-
|
|
100
|
-
1. **Frontmatter check:**
|
|
101
|
-
- [ ] Has `name:` field
|
|
102
|
-
- [ ] Has `description:` field
|
|
103
|
-
- [ ] `name:` matches directory name
|
|
104
|
-
- [ ] Starts with `---` on line 1
|
|
105
|
-
|
|
106
|
-
2. **Content check:**
|
|
107
|
-
- [ ] Has `## When to Use` section
|
|
108
|
-
- [ ] Has `## When NOT to Use` section
|
|
109
|
-
- [ ] Under 200 lines (warn if over)
|
|
110
|
-
- [ ] Has `## Gotchas` section (advisory — new skills may not have one yet)
|
|
111
|
-
|
|
112
|
-
3. **Description trigger check:**
|
|
113
|
-
- [ ] Description starts with action trigger (Use when, MUST load, Use INSTEAD OF)
|
|
114
|
-
- Flag descriptions that don't specify when to load as **MINOR**
|
|
115
|
-
|
|
116
|
-
Report as a scorecard:
|
|
117
|
-
|
|
118
|
-
```text
|
|
119
|
-
| Skill | Frontmatter | Content | Trigger | Gotchas | Lines | Grade |
|
|
120
|
-
|-------------------------|-------------|---------|---------|---------|-------|-------|
|
|
121
|
-
| verification-before-... | OK | OK | OK | NO | 237 | B+ |
|
|
122
|
-
| skill-creator | OK | OK | OK | NO | 157 | B |
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
Grade scale:
|
|
126
|
-
|
|
127
|
-
- **A** — all checks pass including gotchas
|
|
128
|
-
- **B+** — all required checks pass, missing gotchas (acceptable for newer skills)
|
|
129
|
-
- **B** — missing one optional section
|
|
130
|
-
- **C** — missing required section or over 200 lines
|
|
131
|
-
- **D** — frontmatter issues
|
|
132
|
-
- **F** — broken (missing name, missing description, invalid YAML)
|
|
133
|
-
|
|
134
|
-
## Phase 4: Three-Layer Defense Audit
|
|
135
|
-
|
|
136
|
-
Check the top safety rules from AGENTS.md for three-layer coverage:
|
|
137
|
-
|
|
138
|
-
| Rule | Intent (AGENTS.md) | Knowledge (Skill) | Control (Agent/Hook) |
|
|
139
|
-
| ------------------------------ | ------------------ | ----------------- | -------------------- |
|
|
140
|
-
| Never force push main | ? | ? | ? |
|
|
141
|
-
| Never bypass hooks | ? | ? | ? |
|
|
142
|
-
| Never expose credentials | ? | ? | ? |
|
|
143
|
-
| Read before write/edit | ? | ? | ? |
|
|
144
|
-
| Verify before completion | ? | ? | ? |
|
|
145
|
-
| Never `git add .` | ? | ? | ? |
|
|
146
|
-
| Review agents are read-only | ? | ? | ? |
|
|
147
|
-
| Never fabricate tool output | ? | ? | ? |
|
|
148
|
-
| Ask before destructive actions | ? | ? | ? |
|
|
149
|
-
|
|
150
|
-
For each rule:
|
|
151
|
-
|
|
152
|
-
- **Intent**: grep AGENTS.md for the policy statement
|
|
153
|
-
- **Knowledge**: check if any skill documents the procedure
|
|
154
|
-
- **Control**: check if any agent frontmatter enforces it (tools: false, permission: deny)
|
|
155
|
-
|
|
156
|
-
Flag rules with intent but no control as **IMPORTANT** gaps.
|
|
157
|
-
|
|
158
|
-
## Phase 5: AI Governance Audit
|
|
159
|
-
|
|
160
|
-
Audit AI-facing configuration for token efficiency, rule health, and instruction quality.
|
|
161
|
-
|
|
162
|
-
### 5a. Token Budget Estimation
|
|
163
|
-
|
|
164
|
-
Estimate the total token cost of context injected into each command execution:
|
|
165
|
-
|
|
166
|
-
```bash
|
|
167
|
-
# Base context (always injected)
|
|
168
|
-
echo "=== Base Context ==="
|
|
169
|
-
wc -c AGENTS.md
|
|
170
|
-
wc -c .opencode/memory/project/user.md .opencode/memory/project/tech-stack.md .opencode/memory/project/project.md 2>/dev/null
|
|
171
|
-
echo "=== Agent Prompts ==="
|
|
172
|
-
wc -c .opencode/agent/*.md 2>/dev/null
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
For each command, estimate total context = Base + Agent prompt + Skills loaded:
|
|
176
|
-
|
|
177
|
-
| Command | Base | Agent | Skills Loaded | Est. Tokens | Budget |
|
|
178
|
-
| ------- | ---- | -------- | ------------------------------------------------------ | ----------- | ------------------ |
|
|
179
|
-
| `/ship` | [N] | build.md | beads, memory-grounding, workspace-setup, verification | [total] | [OK/HEAVY/BLOATED] |
|
|
180
|
-
| `/plan` | [N] | plan.md | beads, memory-grounding, writing-plans | [total] | [OK/HEAVY/BLOATED] |
|
|
181
|
-
| ... | ... | ... | ... | ... | ... |
|
|
182
|
-
|
|
183
|
-
**Thresholds:**
|
|
184
|
-
|
|
185
|
-
- **OK**: < 15k tokens total injected context
|
|
186
|
-
- **HEAVY**: 15-30k tokens (warn — leaves less room for codebase context)
|
|
187
|
-
- **BLOATED**: > 30k tokens (flag — likely causing quality degradation)
|
|
188
|
-
|
|
189
|
-
Rough token estimate: `bytes / 4` for English text.
|
|
190
|
-
|
|
191
|
-
### 5b. Rule Echo Detection
|
|
192
|
-
|
|
193
|
-
Find instructions duplicated across layers:
|
|
194
|
-
|
|
195
|
-
```bash
|
|
196
|
-
# Find common instruction phrases across AGENTS.md and agent prompts
|
|
197
|
-
# Look for exact or near-duplicate paragraphs
|
|
198
|
-
grep -hF "Never" AGENTS.md .opencode/agent/*.md | sort | uniq -c | sort -rn | head -20
|
|
199
|
-
grep -hF "Always" AGENTS.md .opencode/agent/*.md | sort | uniq -c | sort -rn | head -20
|
|
200
|
-
grep -hF "MUST" AGENTS.md .opencode/agent/*.md | sort | uniq -c | sort -rn | head -20
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
Also check for:
|
|
204
|
-
|
|
205
|
-
- Rules in AGENTS.md that are repeated verbatim in agent prompts (redundant — AGENTS.md is already injected)
|
|
206
|
-
- Rules in agent prompts that contradict AGENTS.md (dangerous)
|
|
207
|
-
- Rules in skills that duplicate AGENTS.md content (bloat)
|
|
208
|
-
|
|
209
|
-
Report:
|
|
210
|
-
|
|
211
|
-
| Rule Text (truncated) | Found In | Count | Issue |
|
|
212
|
-
| ----------------------- | ------------------- | ----- | --------------------------- |
|
|
213
|
-
| "Never force push main" | AGENTS.md, build.md | 2 | ECHO — remove from build.md |
|
|
214
|
-
| "Stage specific files" | AGENTS.md, ship.md | 2 | ECHO — remove from ship.md |
|
|
215
|
-
|
|
216
|
-
### 5c. Instruction Bloat Detection
|
|
217
|
-
|
|
218
|
-
Flag oversized configuration files:
|
|
219
|
-
|
|
220
|
-
| File | Lines | Tokens (est.) | Status |
|
|
221
|
-
| ---------------- | ----- | ------------- | ----------------- |
|
|
222
|
-
| AGENTS.md | [N] | [N] | [OK/WARN/BLOATED] |
|
|
223
|
-
| [skill]/SKILL.md | [N] | [N] | [OK/WARN/BLOATED] |
|
|
224
|
-
| [command].md | [N] | [N] | [OK/WARN/BLOATED] |
|
|
225
|
-
|
|
226
|
-
**Thresholds:**
|
|
227
|
-
|
|
228
|
-
- Skills: WARN > 200 lines, BLOATED > 400 lines
|
|
229
|
-
- Commands: WARN > 300 lines, BLOATED > 500 lines
|
|
230
|
-
- AGENTS.md: WARN > 500 lines, BLOATED > 800 lines
|
|
231
|
-
|
|
232
|
-
### 5d. Compression Opportunities
|
|
233
|
-
|
|
234
|
-
Identify repeated boilerplate across skills and commands:
|
|
235
|
-
|
|
236
|
-
````bash
|
|
237
|
-
# Find common blocks across skills
|
|
238
|
-
for f in .opencode/skill/*/SKILL.md; do
|
|
239
|
-
grep -c "## When to Use" "$f"
|
|
240
|
-
grep -c "## When NOT to Use" "$f"
|
|
241
|
-
done
|
|
242
|
-
|
|
243
|
-
# Find repeated code blocks
|
|
244
|
-
grep -rh "```typescript" .opencode/command/*.md | wc -l
|
|
245
|
-
grep -rh "skill({ name:" .opencode/command/*.md | sort | uniq -c | sort -rn | head -10
|
|
246
|
-
````
|
|
247
|
-
|
|
248
|
-
Flag opportunities:
|
|
249
|
-
|
|
250
|
-
- Skills that share >50% identical content (candidates for merging or shared base)
|
|
251
|
-
- Commands with identical boilerplate sections (candidates for shared template)
|
|
252
|
-
- Repeated `skill({ name: "X" })` calls across commands (consider making X a dependency)
|
|
253
|
-
|
|
254
|
-
### AI Governance Report
|
|
255
|
-
|
|
256
|
-
```text
|
|
257
|
-
## AI Governance Summary
|
|
258
|
-
|
|
259
|
-
Token Budget:
|
|
260
|
-
- Lightest command: [command] ([N] tokens)
|
|
261
|
-
- Heaviest command: [command] ([N] tokens)
|
|
262
|
-
- Commands over budget: [list]
|
|
263
|
-
|
|
264
|
-
Rule Health:
|
|
265
|
-
- Echo rules found: [N] (wasted tokens on duplicates)
|
|
266
|
-
- Contradictions found: [N] (CRITICAL)
|
|
267
|
-
- Compression opportunities: [N]
|
|
268
|
-
|
|
269
|
-
Instruction Bloat:
|
|
270
|
-
- Oversized skills: [N]
|
|
271
|
-
- Oversized commands: [N]
|
|
272
|
-
- AGENTS.md status: [OK/WARN/BLOATED]
|
|
273
|
-
|
|
274
|
-
Recommendations:
|
|
275
|
-
1. [Most impactful recommendation]
|
|
276
|
-
2. [Second recommendation]
|
|
277
|
-
3. [Third recommendation]
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
## Phase 6: Agent Tool Restriction Audit
|
|
281
|
-
|
|
282
|
-
For each agent in `.opencode/agent/*.md`:
|
|
283
|
-
|
|
284
|
-
1. Read the agent's YAML frontmatter
|
|
285
|
-
2. Check `tools:` restrictions (which tools are disabled)
|
|
286
|
-
3. Check `permission:` restrictions (which commands are denied/asked)
|
|
287
|
-
4. Compare against the agent's stated role
|
|
288
|
-
|
|
289
|
-
Flag:
|
|
290
|
-
|
|
291
|
-
- **CRITICAL**: Write-capable agents that should be read-only (review, explore, scout)
|
|
292
|
-
- **IMPORTANT**: Agents with no tool restrictions at all
|
|
293
|
-
- **MINOR**: Agents with restrictions that could be tighter
|
|
294
|
-
|
|
295
|
-
## Phase 7: Report
|
|
296
|
-
|
|
297
|
-
Output a health report:
|
|
298
|
-
|
|
299
|
-
```markdown
|
|
300
|
-
## Health Report
|
|
301
|
-
|
|
302
|
-
**Date:** [timestamp]
|
|
303
|
-
**Configuration:** [X skills, Y commands, Z agents]
|
|
304
|
-
|
|
305
|
-
### Summary
|
|
306
|
-
|
|
307
|
-
| Layer | Issues Found | Critical | Important | Minor |
|
|
308
|
-
| ------- | ------------ | -------- | --------- | ----- |
|
|
309
|
-
| Refs | N | N | N | N |
|
|
310
|
-
| Skills | N | N | N | N |
|
|
311
|
-
| Defense | N | N | N | N |
|
|
312
|
-
| Agents | N | N | N | N |
|
|
313
|
-
| TOTAL | N | N | N | N |
|
|
314
|
-
|
|
315
|
-
### Critical Issues
|
|
316
|
-
|
|
317
|
-
- [list]
|
|
318
|
-
|
|
319
|
-
### Important Issues
|
|
320
|
-
|
|
321
|
-
- [list]
|
|
322
|
-
|
|
323
|
-
### Minor Issues
|
|
324
|
-
|
|
325
|
-
- [list]
|
|
326
|
-
|
|
327
|
-
### Recommendations
|
|
328
|
-
|
|
329
|
-
- [prioritized list of fixes]
|
|
330
|
-
```
|
|
331
|
-
|
|
332
|
-
If `--fix` flag is provided, auto-fix `safe_auto` issues:
|
|
333
|
-
|
|
334
|
-
- Remove stale skill references from commands (after confirmation)
|
|
335
|
-
- Add missing `## Gotchas` placeholder sections to skills
|
|
336
|
-
- Fix frontmatter formatting issues
|
|
337
|
-
|
|
338
|
-
Record findings:
|
|
339
|
-
|
|
340
|
-
```typescript
|
|
341
|
-
observation({
|
|
342
|
-
type: "discovery",
|
|
343
|
-
title: "Health check: [summary]",
|
|
344
|
-
narrative: "[Key findings and gaps discovered]",
|
|
345
|
-
concepts: "health, audit, configuration",
|
|
346
|
-
confidence: "high",
|
|
347
|
-
});
|
|
348
|
-
```
|
|
349
|
-
|
|
350
|
-
## Related Commands
|
|
351
|
-
|
|
352
|
-
| Need | Command |
|
|
353
|
-
| ------------------- | ------------------ |
|
|
354
|
-
| Review code | `/review-codebase` |
|
|
355
|
-
| Check project state | `/status` |
|
|
356
|
-
| Verify a bead | `/verify <id>` |
|
|
@@ -1,297 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Initialize project planning context (roadmap, state) with optional brownfield analysis
|
|
3
|
-
argument-hint: "[--skip-questions] [--brownfield]"
|
|
4
|
-
agent: build
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Init-Context: $ARGUMENTS
|
|
8
|
-
|
|
9
|
-
Initialize project planning context files from templates.
|
|
10
|
-
|
|
11
|
-
## Architecture
|
|
12
|
-
|
|
13
|
-
**Auto-injected files** (always loaded into every prompt via `instructions[]`):
|
|
14
|
-
- `user.md` — identity, preferences
|
|
15
|
-
- `tech-stack.md` — framework, constraints
|
|
16
|
-
- `project.md` — vision, success criteria, principles
|
|
17
|
-
- `git-context.md` — spatial awareness
|
|
18
|
-
|
|
19
|
-
**On-demand files** (created by this command, loaded via `memory-read` when needed):
|
|
20
|
-
- `roadmap.md` — phases, milestones, bead planning
|
|
21
|
-
- `state.md` — current position, blockers, next actions
|
|
22
|
-
|
|
23
|
-
> **Warning:** Do NOT add roadmap.md or state.md to `instructions[]`. Per-prompt injection of too many files causes session OOM crashes. Use `memory-read({ file: "project/roadmap" })` or `memory-read({ file: "project/state" })` when needed.
|
|
24
|
-
|
|
25
|
-
## Load Skills
|
|
26
|
-
|
|
27
|
-
```typescript
|
|
28
|
-
skill({ name: "context-initialization" });
|
|
29
|
-
skill({ name: "brainstorming" });
|
|
30
|
-
skill({ name: "verification-before-completion" });
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## Parse Arguments
|
|
34
|
-
|
|
35
|
-
```typescript
|
|
36
|
-
const args = {
|
|
37
|
-
skipQuestions: $ARGUMENTS.includes("--skip-questions"),
|
|
38
|
-
brownfield: $ARGUMENTS.includes("--brownfield"),
|
|
39
|
-
focus: $ARGUMENTS.match(/--focus=(\w+)/)?.[1], // Optional: api, ui, db, etc.
|
|
40
|
-
};
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## Phase 1: Discovery
|
|
44
|
-
|
|
45
|
-
### 1.1 Check Existing Context
|
|
46
|
-
|
|
47
|
-
Use tilth or Read to check for existing files:
|
|
48
|
-
|
|
49
|
-
```typescript
|
|
50
|
-
tilth_tilth_files({ pattern: "*.md", scope: ".opencode/memory/project" });
|
|
51
|
-
// Or: Read({ filePath: ".opencode/memory/project/project.md", limit: 20 });
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
**If planning context exists:**
|
|
55
|
-
|
|
56
|
-
```
|
|
57
|
-
Existing planning context found:
|
|
58
|
-
- project.md: [exists/size] (auto-injected)
|
|
59
|
-
- roadmap.md: [exists/size] (on-demand)
|
|
60
|
-
- state.md: [exists/size] (on-demand)
|
|
61
|
-
|
|
62
|
-
Options:
|
|
63
|
-
1. Refresh - Delete and recreate from templates
|
|
64
|
-
2. Update - Keep existing, only update state.md
|
|
65
|
-
3. Skip - Use existing context as-is
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
Wait for user selection.
|
|
69
|
-
|
|
70
|
-
### 1.2 Brownfield Codebase Analysis (if --brownfield)
|
|
71
|
-
|
|
72
|
-
If `--brownfield` flag is set:
|
|
73
|
-
|
|
74
|
-
```typescript
|
|
75
|
-
skill({ name: "swarm-coordination" });
|
|
76
|
-
|
|
77
|
-
// Agent 1: Map tech stack
|
|
78
|
-
task({
|
|
79
|
-
subagent_type: "explore",
|
|
80
|
-
description: "Analyze tech stack",
|
|
81
|
-
prompt:
|
|
82
|
-
"Analyze the codebase technology stack. Write findings to .opencode/memory/project/codebase/tech-analysis.md covering: languages, frameworks, dependencies, build tools. Return file path and line count only.",
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
// Agent 2: Map architecture
|
|
86
|
-
task({
|
|
87
|
-
subagent_type: "explore",
|
|
88
|
-
description: "Analyze architecture",
|
|
89
|
-
prompt:
|
|
90
|
-
"Analyze the codebase architecture. Write findings to .opencode/memory/project/codebase/arch-analysis.md covering: patterns, directory structure, entry points. Return file path and line count only.",
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
// Wait for agents and collect confirmations
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
## Phase 2: Requirements Gathering
|
|
97
|
-
|
|
98
|
-
### 2.1 Brainstorming (if not --skip-questions)
|
|
99
|
-
|
|
100
|
-
```typescript
|
|
101
|
-
if (!args.skipQuestions) {
|
|
102
|
-
// brainstorming skill already loaded in Load Skills phase
|
|
103
|
-
// Follow brainstorming process for project vision
|
|
104
|
-
// Ask questions one at a time (as per brainstorming skill)
|
|
105
|
-
// Output: Refined vision, success criteria, target users
|
|
106
|
-
}
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
### 2.2 Quick Mode (if --skip-questions)
|
|
110
|
-
|
|
111
|
-
Use template defaults with placeholders for:
|
|
112
|
-
|
|
113
|
-
- Project vision
|
|
114
|
-
- Success criteria
|
|
115
|
-
- Target users
|
|
116
|
-
- Phases
|
|
117
|
-
- Current phase
|
|
118
|
-
|
|
119
|
-
## Phase 3: Document Creation
|
|
120
|
-
|
|
121
|
-
### 3.1 Update project.md (auto-injected)
|
|
122
|
-
|
|
123
|
-
This file is auto-injected into every prompt. Keep it concise.
|
|
124
|
-
|
|
125
|
-
**Load template:**
|
|
126
|
-
|
|
127
|
-
```typescript
|
|
128
|
-
Read({ filePath: ".opencode/memory/_templates/project.md" });
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
**Fill with gathered data:**
|
|
132
|
-
|
|
133
|
-
- Vision from brainstorming OR template placeholder
|
|
134
|
-
- Success criteria (3-7 measurable outcomes)
|
|
135
|
-
- Target users (primary/secondary)
|
|
136
|
-
- Core principles (convention over config, minimal, extensible)
|
|
137
|
-
- Current phase (from user input or template default)
|
|
138
|
-
|
|
139
|
-
**Write using memory tools:**
|
|
140
|
-
|
|
141
|
-
```typescript
|
|
142
|
-
memory-update({ file: "project/project", content: filledContent, mode: "replace" });
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
### 3.2 Create roadmap.md (on-demand)
|
|
146
|
-
|
|
147
|
-
This file is NOT auto-injected. Access via `memory-read({ file: "project/roadmap" })`.
|
|
148
|
-
|
|
149
|
-
**Parse phases from input:**
|
|
150
|
-
|
|
151
|
-
```typescript
|
|
152
|
-
// Convert user-provided phases into structured roadmap
|
|
153
|
-
// Example: "Discovery, MVP, Launch, Scale" → table rows
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
**Structure:**
|
|
157
|
-
|
|
158
|
-
```markdown
|
|
159
|
-
| Phase | Goal | Status | Beads |
|
|
160
|
-
| --------- | ------ | -------- | ----- |
|
|
161
|
-
| [Phase 1] | [Goal] | [Status] | [#] |
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
**Write using memory tools:**
|
|
165
|
-
|
|
166
|
-
```typescript
|
|
167
|
-
memory-update({ file: "project/roadmap", content: roadmapContent, mode: "replace" });
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
### 3.3 Create state.md (on-demand)
|
|
171
|
-
|
|
172
|
-
This file is NOT auto-injected. Access via `memory-read({ file: "project/state" })`.
|
|
173
|
-
|
|
174
|
-
**Initialize with:**
|
|
175
|
-
|
|
176
|
-
- Active Bead: (blank or from bead context)
|
|
177
|
-
- Status: In Progress
|
|
178
|
-
- Started: [current date]
|
|
179
|
-
- Phase: [from roadmap]
|
|
180
|
-
- Recent Completed Work: (empty table)
|
|
181
|
-
- Active Decisions: (empty table)
|
|
182
|
-
- Blockers: (empty table)
|
|
183
|
-
- Open Questions: (empty table)
|
|
184
|
-
- Next Actions: (empty list)
|
|
185
|
-
|
|
186
|
-
**Write using memory tools:**
|
|
187
|
-
|
|
188
|
-
```typescript
|
|
189
|
-
memory-update({ file: "project/state", content: stateContent, mode: "replace" });
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
### 3.4 Brownfield Analysis Integration (if applicable)
|
|
193
|
-
|
|
194
|
-
If `--brownfield` analysis was run:
|
|
195
|
-
|
|
196
|
-
```typescript
|
|
197
|
-
// Append tech/arch findings to project.md Context Notes section
|
|
198
|
-
// Or create separate .opencode/memory/project/codebase/ documents
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
## Phase 4: Verification & Security
|
|
202
|
-
|
|
203
|
-
### 4.1 Verify Documents Created
|
|
204
|
-
|
|
205
|
-
```typescript
|
|
206
|
-
tilth_tilth_files({ pattern: "*.md", scope: ".opencode/memory/project" });
|
|
207
|
-
// Verify each file exists and has content
|
|
208
|
-
Read({ filePath: ".opencode/memory/project/project.md", limit: 5 });
|
|
209
|
-
Read({ filePath: ".opencode/memory/project/roadmap.md", limit: 5 });
|
|
210
|
-
Read({ filePath: ".opencode/memory/project/state.md", limit: 5 });
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
**Check:**
|
|
214
|
-
|
|
215
|
-
- [ ] project.md exists and >20 lines
|
|
216
|
-
- [ ] roadmap.md exists and >20 lines
|
|
217
|
-
- [ ] state.md exists and >20 lines
|
|
218
|
-
- [ ] All files are readable
|
|
219
|
-
|
|
220
|
-
### 4.2 Secret Scan
|
|
221
|
-
|
|
222
|
-
```bash
|
|
223
|
-
# Scan for accidentally leaked secrets in generated docs
|
|
224
|
-
grep -rE '(sk-[a-zA-Z0-9]{20,}|sk_live_[a-zA-Z0-9]+|AKIA[A-Z0-9]{16}|ghp_[a-zA-Z0-9]{36}|xoxb-[a-zA-Z0-9-]+|-----BEGIN.*PRIVATE KEY)' .opencode/memory/project/*.md 2>/dev/null && SECRETS_FOUND=true || SECRETS_FOUND=false
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
**If secrets found:** Alert user and pause before proceeding.
|
|
228
|
-
|
|
229
|
-
### 4.3 Run Verification
|
|
230
|
-
|
|
231
|
-
```typescript
|
|
232
|
-
// verification-before-completion skill already loaded
|
|
233
|
-
// Run verification checklist:
|
|
234
|
-
// 1. IDENTIFY: Files created, structure valid
|
|
235
|
-
// 2. RUN: Validation commands
|
|
236
|
-
// 3. READ: Check file contents
|
|
237
|
-
// 4. VERIFY: All success criteria met
|
|
238
|
-
// 5. CLAIM: Context initialization complete
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
## Output
|
|
242
|
-
|
|
243
|
-
Creates planning context in `.opencode/memory/project/`:
|
|
244
|
-
|
|
245
|
-
| File | Purpose | Injection | Access |
|
|
246
|
-
| ------------ | ---------------------------------------- | ----------- | -------------------------------------------- |
|
|
247
|
-
| `project.md` | Vision, success criteria, principles | Auto-injected | Updated in-place (already in `instructions[]`) |
|
|
248
|
-
| `roadmap.md` | Phases, milestones, bead planning | On-demand | `memory-read({ file: "project/roadmap" })` |
|
|
249
|
-
| `state.md` | Current position, blockers, next actions | On-demand | `memory-read({ file: "project/state" })` |
|
|
250
|
-
|
|
251
|
-
**If `--brownfield`:**
|
|
252
|
-
Additional files in `.opencode/memory/project/codebase/`:
|
|
253
|
-
|
|
254
|
-
- `tech-analysis.md` - Stack and dependencies
|
|
255
|
-
- `arch-analysis.md` - Architecture patterns
|
|
256
|
-
|
|
257
|
-
## Success Criteria
|
|
258
|
-
|
|
259
|
-
- [ ] All planning documents created from templates
|
|
260
|
-
- [ ] Documents follow template structure
|
|
261
|
-
- [ ] No secrets leaked in generated files
|
|
262
|
-
- [ ] Files pass basic validation (readable, non-empty)
|
|
263
|
-
- [ ] User informed of next steps and access patterns
|
|
264
|
-
|
|
265
|
-
## Custom Context (Optional)
|
|
266
|
-
|
|
267
|
-
Inform user about `.opencode/context/` for additional project-specific context:
|
|
268
|
-
|
|
269
|
-
```
|
|
270
|
-
Custom context folder available at .opencode/context/
|
|
271
|
-
- Add .md files with architecture decisions, domain knowledge, team agreements
|
|
272
|
-
- This folder is preserved during init --force and upgrade
|
|
273
|
-
|
|
274
|
-
⚠️ Only add files to instructions[] if they are essential for EVERY prompt.
|
|
275
|
-
Per-prompt injection adds ~2-4KB each. Too many files cause session OOM.
|
|
276
|
-
Prefer memory-read() for on-demand access instead.
|
|
277
|
-
```
|
|
278
|
-
|
|
279
|
-
## Next Steps
|
|
280
|
-
|
|
281
|
-
After init-context completes:
|
|
282
|
-
|
|
283
|
-
1. **For new projects:** Use `/plan` to create first implementation plan
|
|
284
|
-
2. **For brownfield:** Review codebase analysis, then `/plan`
|
|
285
|
-
3. **For existing beads:** Use `/resume` to continue tracked work
|
|
286
|
-
4. **For custom context:** Add `.md` files to `.opencode/context/` (on-demand via Read, not auto-injected)
|
|
287
|
-
|
|
288
|
-
---
|
|
289
|
-
|
|
290
|
-
## Skill Integration Summary
|
|
291
|
-
|
|
292
|
-
| Skill | When Used | Purpose |
|
|
293
|
-
| -------------------------------- | --------------------------------- | ------------------------------ |
|
|
294
|
-
| `context-initialization` | Phase 1 | Template verification |
|
|
295
|
-
| `brainstorming` | Phase 2 (if not --skip-questions) | Refine vision and requirements |
|
|
296
|
-
| `swarm-coordination` | Phase 1.2 (if --brownfield) | Parallel codebase analysis |
|
|
297
|
-
| `verification-before-completion` | Phase 4 | Validate created files |
|