opencodekit 0.4.0 → 0.6.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 CHANGED
@@ -750,7 +750,7 @@ var cac = (name = "") => new CAC(name);
750
750
  // package.json
751
751
  var package_default = {
752
752
  name: "opencodekit",
753
- version: "0.4.0",
753
+ version: "0.6.0",
754
754
  description: "CLI tool for bootstrapping and managing OpenCodeKit projects",
755
755
  type: "module",
756
756
  repository: {
@@ -2605,6 +2605,15 @@ async function editMCP(configPath) {
2605
2605
  await addMCPServer(configPath, config);
2606
2606
  return;
2607
2607
  }
2608
+ console.log();
2609
+ console.log(import_picocolors7.default.bold(" MCP Servers"));
2610
+ for (const [name, server] of Object.entries(config.mcp)) {
2611
+ const status = server.enabled === false ? import_picocolors7.default.red("off") : import_picocolors7.default.green("on");
2612
+ const type = server.type === "remote" ? import_picocolors7.default.dim("remote") : import_picocolors7.default.dim("local");
2613
+ const endpoint = server.type === "remote" ? import_picocolors7.default.dim(` → ${server.url}`) : import_picocolors7.default.dim(` → ${(server.command || []).join(" ")}`);
2614
+ console.log(` ${status} ${name} ${type}${endpoint}`);
2615
+ }
2616
+ console.log();
2608
2617
  const action = await ie({
2609
2618
  message: "MCP Servers",
2610
2619
  options: [
@@ -15,22 +15,38 @@
15
15
 
16
16
  **Check before any tool call. Delegate if task involves search or research.**
17
17
 
18
- | Task Type | Delegate To | Trigger Words |
19
- | ----------------- | ----------- | ---------------------------------------------------- |
20
- | Code search | @explore | find, where is, search, how does X work, locate |
21
- | External research | @scout | research, compare, docs for, API for, best practices |
22
- | Code review/debug | @review | review, audit, debug, why broken, root cause |
23
- | Architecture | @planner | design, architect, plan, structure, phases |
24
- | UI/UX design | @vision | mockup, UI review, accessibility, aesthetics, visual |
18
+ - **@explore** - Code search: find, where is, search, how does X work, locate
19
+ - **@scout** - External research: research, compare, docs for, API for, best practices
20
+ - **@review** - Code review/debug: review, audit, debug, why broken, root cause
21
+ - **@planner** - Architecture: design, architect, plan, structure, phases
22
+ - **@vision** - UI/UX design: mockup, UI review, accessibility, aesthetics, visual
25
23
 
26
24
  **Execute directly**: Single-file edits, explicit commands, answering from loaded context.
27
25
 
26
+ ### Research Depth Levels
27
+
28
+ Specify depth when delegating to control tool call budget:
29
+
30
+ - **quick** (~5-10 calls) - Simple lookup, single answer, API syntax
31
+ - **medium** (~20-50 calls) - Moderate exploration, verify across files
32
+ - **thorough** (~100+ calls) - Comprehensive analysis, dependency mapping
33
+
34
+ **Examples**:
35
+
36
+ ```
37
+ @explore (quick): Where is the auth middleware?
38
+ @explore (thorough): How does the entire auth system work?
39
+ @scout (quick): Syntax for React useEffect cleanup
40
+ @scout (thorough): How do production apps handle auth refresh tokens?
41
+ ```
42
+
28
43
  ## Anti-Hallucination
29
44
 
30
45
  - **Major features**: Check task exists (`bd show <id>`)
31
46
  - **Bug fixes/edits**: Proceed directly; document clearly
32
47
  - **Before commit**: Close task with reason (`bd close <id> --reason "..."`)
33
48
  - **Find work**: Use `bd ready` for unblocked tasks
49
+ - **URLs**: Never generate or guess URLs. Only use URLs from user input, tool results, or verified documentation.
34
50
 
35
51
  ## Universal Standards
36
52
 
@@ -65,14 +81,10 @@
65
81
 
66
82
  **GKG tools → AST tools → Built-in tools**
67
83
 
68
- | Priority | Tools | Use For |
69
- | -------- | --------------------------------- | ---------------------------------- |
70
- | 1 | `gkg_search_codebase_definitions` | Find symbols by name |
71
- | 1 | `gkg_get_references` | Find all usages |
72
- | 1 | `gkg_repo_map` | API-level overview |
73
- | 2 | `ast-grep` | Semantic code search/replace (AST) |
74
- | 3 | `grep`, `glob` | Pattern matching, file discovery |
75
- | 3 | `read`, `edit`, `write` | File operations |
84
+ 1. `gkg_search_codebase_definitions`, `gkg_get_references`, `gkg_repo_map` - Find symbols, usages, API overview
85
+ 2. `ast-grep` - Semantic code search/replace (AST-based)
86
+ 3. `grep`, `glob` - Pattern matching, file discovery
87
+ 4. `read`, `edit`, `write` - File operations
76
88
 
77
89
  **Rule**: Always `read` before `edit` to verify content.
78
90
 
@@ -95,18 +107,17 @@ ast-grep pattern="fetch($URL)" rewrite="await fetch($URL)" dryRun=false
95
107
 
96
108
  ## Research Tools
97
109
 
98
- | Tool | Use For | Performance Notes |
99
- | ------------ | ------------------------------------------------------ | -------------------- |
100
- | `context7` | Library docs (try first) | Fast, external APIs |
101
- | `websearch` | Docs not in Context7, recent releases, troubleshooting | General web search |
102
- | `codesearch` | Real implementation patterns from GitHub | Public repo examples |
103
- | `webfetch` | Specific URL user provided | Direct URL fetch |
110
+ - **context7** - Library docs (try first). Fast, external APIs.
111
+ - **websearch** - Docs not in Context7, recent releases, troubleshooting.
112
+ - **codesearch** - Real implementation patterns from GitHub.
113
+ - **webfetch** - Specific URL user provided.
104
114
 
105
115
  ## Error Handling
106
116
 
107
117
  - **Transient** (network, timeout): Retry 2x with backoff
108
118
  - **Rate limit**: Stop, report to user
109
119
  - **Logic error**: Change strategy, don't repeat
120
+ - **Blocked by hook/CI**: Analyze error message, adjust approach, retry once. If still blocked, ask user to check hooks/config.
110
121
 
111
122
  ## Memory System
112
123
 
@@ -116,16 +127,37 @@ ast-grep pattern="fetch($URL)" rewrite="await fetch($URL)" dryRun=false
116
127
  handoffs/ # Phase transitions
117
128
  research/ # Research findings
118
129
  observations/ # Structured observations
130
+ project/ # Persistent project knowledge
131
+ commands.md # Build, test, lint, deploy commands
132
+ conventions.md # Code patterns, commit style, PR process
133
+ gotchas.md # Footguns, edge cases, "don't forget this"
134
+ architecture.md # Key modules, directory structure
135
+ user.md # Identity, preferences, communication style
119
136
  ```
120
137
 
138
+ ### Standard Memory Blocks
139
+
140
+ - **project/commands.md** - Build/test/lint commands. Update when discovering new command.
141
+ - **project/conventions.md** - Code patterns, style. Update when learning team pattern.
142
+ - **project/gotchas.md** - Footguns, warnings. Update when hitting unexpected behavior.
143
+ - **project/architecture.md** - Key modules, structure. Update when mapping new area.
144
+ - **user.md** - Preferences, workflow. Update when learning user preference.
145
+
146
+ ### Explicit Memory Updates
147
+
148
+ Don't rely on implicit learning. Explicitly persist:
149
+
150
+ - Non-obvious project behavior → `project/gotchas.md`
151
+ - User preferences discovered → `user.md`
152
+ - New build/test commands → `project/commands.md`
153
+ - Code patterns to follow → `project/conventions.md`
154
+
121
155
  ### Memory Tools
122
156
 
123
- | Tool | Use For |
124
- | --------------- | -------------------------------- |
125
- | `memory-read` | Load previous context, templates |
126
- | `memory-update` | Save learnings, handoffs |
127
- | `memory-search` | Search across all memory files |
128
- | `observation` | Create structured observations |
157
+ - **memory-read** - Load previous context, templates
158
+ - **memory-update** - Save learnings, handoffs
159
+ - **memory-search** - Search across all memory files
160
+ - **observation** - Create structured observations
129
161
 
130
162
  ### Observations
131
163
 
@@ -165,11 +197,9 @@ memory-search(query: "session", type: "handoffs")
165
197
 
166
198
  Plugins run automatically in the background:
167
199
 
168
- | Plugin | What it does |
169
- | ------------- | ----------------------------------------------------------- |
170
- | **enforcer** | OS notification when session idles with incomplete TODOs |
171
- | **compactor** | Warns at 70%, 85%, 95% context usage - prevents rushed work |
172
- | **truncator** | Dynamic output truncation based on context remaining |
200
+ - **enforcer** - OS notification when session idles with incomplete TODOs
201
+ - **compactor** - Warns at 70%, 85%, 95% context usage - prevents rushed work
202
+ - **truncator** - Dynamic output truncation based on context remaining
173
203
 
174
204
  **Compactor thresholds**:
175
205
 
@@ -200,6 +230,14 @@ read_session("today") # Today's first session
200
230
  read_session("ses_abc123", focus="file changes") # Specific aspect
201
231
  ```
202
232
 
233
+ **`summarize_session`** - Generate AI summary of a session
234
+
235
+ ```
236
+ summarize_session("ses_abc123") # Trigger AI summarization
237
+ ```
238
+
239
+ Use before `read_session` to get a quick overview of what happened in a past session without loading full context.
240
+
203
241
  ### When to Start New Session
204
242
 
205
243
  - Completing distinct task from `bd ready`
@@ -244,35 +282,28 @@ Use all three:
244
282
 
245
283
  Use `find_skills` → `use_skill` when:
246
284
 
247
- | Situation | Skill |
248
- | -------------------------- | ----------------------------------- |
249
- | Creating something new | `brainstorming` |
250
- | Bug or unexpected behavior | `systematic-debugging` |
251
- | Implementing feature | `test-driven-development` |
252
- | Before commit/done | `verification-before-completion` |
253
- | Complex multi-step work | `writing-plans` → `executing-plans` |
254
- | Finished implementation | `requesting-code-review` |
255
- | Building UI | `frontend-aesthetics` |
256
- | UI/UX with images | `ui-ux-research` |
257
- | Large codebase research | `gemini-large-context` |
285
+ - Creating something new → `brainstorming`
286
+ - Bug or unexpected behavior → `systematic-debugging`
287
+ - Implementing feature `test-driven-development`
288
+ - Before commit/done `verification-before-completion`
289
+ - Complex multi-step work → `writing-plans` → `executing-plans`
290
+ - Finished implementation `requesting-code-review`
291
+ - Building UI → `frontend-aesthetics`
292
+ - UI/UX with images → `ui-ux-research`
293
+ - Large codebase research → `gemini-large-context`
258
294
 
259
295
  Skip for simple questions, quick edits, or conversations.
260
296
 
261
- ## Gemini CLI (Large Context)
297
+ ### Progressive Skill Loading
262
298
 
263
- Use when analysis needs >100KB context or image analysis.
299
+ Skills consume context. Manage them actively:
264
300
 
265
- ```bash
266
- # Codebase analysis
267
- gemini -p "@src/ [your question]"
268
-
269
- # Image analysis (interactive)
270
- gemini
271
- @mockup.png Analyze this UI design
272
- ```
301
+ 1. **Load on-demand**: Only load skills when starting relevant work
302
+ 2. **Read linked files lazily**: Don't load all skill references immediately—read only when needed
303
+ 3. **Unload after completion**: When task completes, skill context is no longer needed
304
+ 4. **One skill at a time**: Avoid loading multiple skills unless task requires it
273
305
 
274
- **Default**: `gemini-2.5-pro` (1M tokens)
275
- **Fast**: `gemini-2.5-flash` with `-m gemini-2.5-flash`
306
+ **IMPORTANT**: Always unload irrelevant skills to free context space. Loaded skills that aren't actively needed are context debt.
276
307
 
277
308
  ## Core Constraints
278
309
 
@@ -78,3 +78,23 @@ Before claiming completion:
78
78
  - Code review/debugging → @review
79
79
  - Architecture planning → @planner
80
80
  - UI/UX analysis, mockups → @vision
81
+
82
+ ### Delegation Prompt Structure
83
+
84
+ When delegating, include ALL 7 sections:
85
+
86
+ 1. **TASK**: Atomic, specific goal (one action per delegation)
87
+ 2. **EXPECTED OUTCOME**: Concrete deliverables with success criteria
88
+ 3. **REQUIRED SKILLS**: Which skill to invoke (if any)
89
+ 4. **REQUIRED TOOLS**: Explicit tool whitelist (prevents sprawl)
90
+ 5. **MUST DO**: Exhaustive requirements - leave NOTHING implicit
91
+ 6. **MUST NOT DO**: Forbidden actions - anticipate rogue behavior
92
+ 7. **CONTEXT**: File paths, existing patterns, constraints
93
+
94
+ After delegation completes, VERIFY:
95
+
96
+ - Did result match expected outcome?
97
+ - Were MUST DO / MUST NOT DO followed?
98
+ - Evidence provided (not just "done")?
99
+
100
+ Vague prompts = wasted tokens. Be exhaustive.
@@ -47,13 +47,9 @@ Fast execute-first agent. Speed over depth. Delegate anything complex.
47
47
 
48
48
  **GKG tools FIRST, then AST-Grep, then built-in tools.**
49
49
 
50
- | Tool | Use For |
51
- | --------------------------------- | ---------------------------- |
52
- | `gkg_search_codebase_definitions` | Find symbols by name |
53
- | `gkg_get_references` | Find all usages |
54
- | `ast-grep` | Semantic code search/replace |
55
- | `grep` | Text strings, config values |
56
- | `glob` | Find files by pattern |
50
+ 1. `gkg_search_codebase_definitions`, `gkg_get_references` - Find symbols, usages
51
+ 2. `ast-grep` - Semantic code search/replace
52
+ 3. `grep`, `glob` - Text search, file patterns
57
53
 
58
54
  ## Pre-Action Checks
59
55
 
@@ -69,15 +65,31 @@ Before mutations (edit, write, delete):
69
65
  - **Rate limits**: Stop, report to user
70
66
  - **Logic errors**: Change strategy, don't repeat
71
67
 
72
- ## Delegation Rules
68
+ ## Delegation
73
69
 
74
- | Task Type | Delegate To |
75
- | ----------------------- | ----------- |
76
- | Codebase search | @explore |
77
- | Library docs, patterns | @scout |
78
- | Code review, debugging | @review |
79
- | Architecture, 3+ phases | @planner |
80
- | UI/UX, mockups, visuals | @vision |
70
+ - Codebase search @explore
71
+ - Library docs, patterns → @scout
72
+ - Code review, debugging → @review
73
+ - Architecture, 3+ phases → @planner
74
+ - UI/UX, mockups, visuals @vision
75
+
76
+ ### Delegation Prompt Structure
77
+
78
+ When delegating, include ALL 7 sections:
79
+
80
+ 1. **TASK**: Atomic, specific goal (one action per delegation)
81
+ 2. **EXPECTED OUTCOME**: Concrete deliverables with success criteria
82
+ 3. **REQUIRED SKILLS**: Which skill to invoke (if any)
83
+ 4. **REQUIRED TOOLS**: Explicit tool whitelist (prevents sprawl)
84
+ 5. **MUST DO**: Exhaustive requirements - leave NOTHING implicit
85
+ 6. **MUST NOT DO**: Forbidden actions - anticipate rogue behavior
86
+ 7. **CONTEXT**: File paths, existing patterns, constraints
87
+
88
+ After delegation completes, VERIFY:
89
+
90
+ - Did result match expected outcome?
91
+ - Were MUST DO / MUST NOT DO followed?
92
+ - Evidence provided (not just "done")?
81
93
 
82
94
  ## Execute Directly
83
95
 
@@ -0,0 +1,176 @@
1
+ ---
2
+ description: Initialize project for AI-assisted development (creates AGENTS.md + memory files)
3
+ argument-hint: "[--deep] [--skip-questions]"
4
+ agent: planner
5
+ ---
6
+
7
+ # Init: $ARGUMENTS
8
+
9
+ One command to onboard a project. Creates project-root AGENTS.md and populates memory files.
10
+
11
+ ## Options
12
+
13
+ - `--deep`: Comprehensive research (~100+ tool calls). Git history, patterns, contributors.
14
+ - `--skip-questions`: Skip upfront questions, infer from git config.
15
+
16
+ Default: Standard research (~20-50 tool calls).
17
+
18
+ ## Phase 1: Upfront Questions
19
+
20
+ Unless `--skip-questions`, ask in one message:
21
+
22
+ 1. **Identity**: "Which git contributor are you?" (show top 5 from `git shortlog -sn --all | head -5`)
23
+ 2. **Communication**: "Terse or detailed responses?"
24
+ 3. **Workflow**: "Auto-commit or ask-first?"
25
+ 4. **Rules**: "Any rules I should always follow?"
26
+
27
+ If skipped, infer identity from `git config user.name` and `git config user.email`.
28
+
29
+ ## Phase 2: Detect Project
30
+
31
+ ### Always Check
32
+
33
+ - `package.json`, `go.mod`, `pyproject.toml`, `Cargo.toml` - tech stack
34
+ - `README.md` - project description
35
+ - `.github/workflows/`, `.gitlab-ci.yml` - CI/CD
36
+ - `Makefile`, `justfile` - build commands
37
+ - Existing rules: `.cursor/rules/`, `.cursorrules`, `.github/copilot-instructions.md`
38
+
39
+ ### With --deep
40
+
41
+ - `git shortlog -sn --all | head -10` - contributors
42
+ - `git log --format="%s" -50` - commit conventions
43
+ - `git branch -a` - branching strategy
44
+ - Source file analysis for patterns
45
+
46
+ ## Phase 3: Create Project-Root AGENTS.md
47
+
48
+ Create `./AGENTS.md` (project root, ~20-30 lines):
49
+
50
+ ```markdown
51
+ ## Build/Lint/Test Commands
52
+
53
+ **Build**: [detected command]
54
+ **Test**: [detected command, include single-test syntax]
55
+ **Lint**: [detected command]
56
+
57
+ ## Code Style
58
+
59
+ **Imports**: [detected pattern]
60
+ **Formatting**: [tool used, e.g., prettier, black]
61
+ **Types**: [strict, optional, none]
62
+ **Naming**: [conventions detected]
63
+ **Error Handling**: [pattern detected]
64
+
65
+ ## Project-Specific Rules
66
+
67
+ [Include any rules from .cursorrules, copilot-instructions, or user-provided]
68
+ ```
69
+
70
+ If AGENTS.md exists, improve it - don't overwrite blindly.
71
+
72
+ ## Phase 4: Populate Memory Files
73
+
74
+ ### .opencode/memory/user.md
75
+
76
+ ```markdown
77
+ ---
78
+ purpose: User identity, preferences, communication style
79
+ updated: [today]
80
+ ---
81
+
82
+ # User Profile
83
+
84
+ ## Identity
85
+
86
+ - Name: [from git/questions]
87
+ - Git contributor: [email/username]
88
+
89
+ ## Preferences
90
+
91
+ - Communication: [terse/detailed]
92
+ - Workflow: [auto-commit/ask-first]
93
+
94
+ ## Rules
95
+
96
+ [from Phase 1]
97
+ ```
98
+
99
+ ### .opencode/memory/project/commands.md
100
+
101
+ ```markdown
102
+ ---
103
+ purpose: Build, test, lint, deploy commands
104
+ updated: [today]
105
+ ---
106
+
107
+ # Commands
108
+
109
+ ## Build
110
+
111
+ [detected]
112
+
113
+ ## Test
114
+
115
+ [detected, include single-test example]
116
+
117
+ ## Lint
118
+
119
+ [detected]
120
+ ```
121
+
122
+ ### .opencode/memory/project/architecture.md
123
+
124
+ ```markdown
125
+ ---
126
+ purpose: Key modules, directory structure
127
+ updated: [today]
128
+ ---
129
+
130
+ # Architecture
131
+
132
+ ## Structure
133
+
134
+ [detected directory layout]
135
+
136
+ ## Key Modules
137
+
138
+ [identified entry points, core modules]
139
+ ```
140
+
141
+ ### With --deep, also create:
142
+
143
+ - `project/conventions.md` - from git log analysis
144
+ - `project/gotchas.md` - from bug-fix patterns in history
145
+
146
+ ## Phase 5: Reflection
147
+
148
+ Before finishing:
149
+
150
+ 1. Did you create both AGENTS.md AND memory files?
151
+ 2. Are commands accurate and tested?
152
+ 3. Any typos or unclear descriptions?
153
+ 4. Would this help your future self?
154
+
155
+ Fix issues found.
156
+
157
+ ## Phase 6: Summary
158
+
159
+ Report:
160
+
161
+ - Files created/updated
162
+ - Tech stack detected
163
+ - Key findings
164
+ - Suggested next steps (e.g., "Run /review-codebase to check conventions")
165
+
166
+ ## File Locations
167
+
168
+ ```
169
+ ./AGENTS.md # Project-specific rules (created)
170
+ .opencode/AGENTS.md # Global rules (untouched)
171
+ .opencode/memory/user.md # User preferences (created)
172
+ .opencode/memory/project/commands.md # Build commands (created)
173
+ .opencode/memory/project/architecture.md # Structure (created)
174
+ .opencode/memory/project/conventions.md # Patterns (--deep only)
175
+ .opencode/memory/project/gotchas.md # Warnings (--deep only)
176
+ ```
@@ -0,0 +1,71 @@
1
+ ---
2
+ description: Generate AI summary of a previous session for quick context
3
+ argument-hint: "[session_reference]"
4
+ agent: build
5
+ ---
6
+
7
+ # Summarize
8
+
9
+ Generate an AI summary of a previous session to quickly understand what happened without loading full context.
10
+
11
+ ## Phase 1: Resolve Session
12
+
13
+ If no argument provided, list recent sessions:
14
+
15
+ ```
16
+ list_sessions(limit=5, project="current")
17
+ ```
18
+
19
+ Parse the session reference:
20
+
21
+ - Empty or "last" resolves to most recent session
22
+ - "2 ago" or "3 ago" resolves to nth most recent
23
+ - "today" resolves to first session today
24
+ - "ses\_..." uses the session ID directly
25
+
26
+ ## Phase 2: Generate Summary
27
+
28
+ Trigger AI summarization using the configured compaction model:
29
+
30
+ ```
31
+ summarize_session(session_id)
32
+ ```
33
+
34
+ The summary is generated asynchronously and stored with the session.
35
+
36
+ ## Phase 3: Display Result
37
+
38
+ Read the session with focus on the generated summary:
39
+
40
+ ```
41
+ read_session(session_id, focus="summary")
42
+ ```
43
+
44
+ Present the summary in a clear, scannable format showing what was accomplished, key decisions made, and any blockers encountered.
45
+
46
+ ## Output
47
+
48
+ Report the session metadata (ID, timestamp, message count, token usage) followed by the AI-generated summary. Highlight key actions taken during the session.
49
+
50
+ End with actionable next steps:
51
+
52
+ - How to load full context if needed
53
+ - How to resume associated work
54
+
55
+ ## Examples
56
+
57
+ ```
58
+ /summarize # Summarize most recent session
59
+ /summarize last # Same as above
60
+ /summarize ses_abc123 # Summarize specific session
61
+ /summarize 2 ago # Summarize 2nd most recent
62
+ /summarize today # First session today
63
+ ```
64
+
65
+ ## When to Use
66
+
67
+ Use this command before resuming work to get a quick overview without loading full context. Helpful during handoffs to understand previous session state, for context triage to decide if a session is worth loading, or when researching across multiple past sessions to find relevant work.
68
+
69
+ ## Integration
70
+
71
+ This command works alongside other session tools. Start with `list_sessions` to discover available sessions, use `/summarize` to quickly understand promising candidates, then load full context with `read_session` only for the most relevant session. This workflow saves context space by avoiding unnecessary full session loads.
@@ -1,28 +1,59 @@
1
- # Project Context Template
1
+ ---
2
+ purpose: Persistent project knowledge that survives across sessions
3
+ updated: 2024-12-21
4
+ ---
2
5
 
3
- Use `/setup-project` command to initialize these files.
6
+ # Project Memory
4
7
 
5
- ## Files Created
8
+ This directory stores persistent project knowledge that agents use across sessions.
6
9
 
7
- | File | Purpose |
8
- | ---------------- | ----------------------------------- |
9
- | `product.md` | Product vision, users, features |
10
- | `tech-stack.md` | Languages, frameworks, dependencies |
11
- | `workflow.md` | Branch strategy, review, deployment |
12
- | `conventions.md` | Coding standards, patterns |
10
+ ## Standard Files
13
11
 
14
- ## Integration with Beads
12
+ | File | Purpose | Update When |
13
+ | ----------------- | --------------------------------------- | ----------------------- |
14
+ | `commands.md` | Build, test, lint, deploy commands | Discover new command |
15
+ | `conventions.md` | Code patterns, commit style, PR process | Learn team pattern |
16
+ | `gotchas.md` | Footguns, edge cases, warnings | Hit unexpected behavior |
17
+ | `architecture.md` | Key modules, directory structure | Map new area |
15
18
 
16
- Beads can reference project context:
19
+ ## File Format
20
+
21
+ Each file uses YAML frontmatter:
22
+
23
+ ```yaml
24
+ ---
25
+ purpose: How this memory should influence agent behavior
26
+ updated: YYYY-MM-DD
27
+ ---
28
+ ```
29
+
30
+ ## How Agents Use This
31
+
32
+ - **Session start**: Agents read relevant memory files for context
33
+ - **During work**: Agents update files when learning new information
34
+ - **Session end**: Critical learnings persisted here survive context reset
35
+
36
+ ## Integration
37
+
38
+ ### With Commands
39
+
40
+ - `/implement` - Reads conventions for code style
41
+ - `/setup-project` - Populates these files initially
42
+ - `/review-codebase` - Checks against conventions
43
+
44
+ ### With Beads
17
45
 
18
46
  ```bash
19
47
  bd new feature "Add auth" --context .opencode/memory/project/
20
48
  ```
21
49
 
22
- ## Integration with Commands
50
+ ## Philosophy
51
+
52
+ **Don't rely on implicit learning.** When agents discover:
23
53
 
24
- Commands automatically check:
54
+ - Non-obvious behavior → Update `gotchas.md`
55
+ - New commands → Update `commands.md`
56
+ - Code patterns → Update `conventions.md`
57
+ - Architecture insights → Update `architecture.md`
25
58
 
26
- - `/implement` - Reads tech-stack for implementation guidance
27
- - `/plan` - Reads product for feature alignment
28
- - `/review-codebase` - Reads conventions for compliance
59
+ Explicit memory beats hoping the agent remembers.
@@ -0,0 +1,26 @@
1
+ ---
2
+ purpose: Key modules, directory structure, architectural decisions
3
+ updated: 2024-12-21
4
+ ---
5
+
6
+ # Project Architecture
7
+
8
+ ## Directory Structure
9
+
10
+ <!-- Key directories and their purpose -->
11
+
12
+ ## Key Modules
13
+
14
+ <!-- Core files/modules and what they do -->
15
+
16
+ ## Data Flow
17
+
18
+ <!-- How data moves through the system -->
19
+
20
+ ## External Dependencies
21
+
22
+ <!-- Critical third-party services, APIs -->
23
+
24
+ ## Architectural Decisions
25
+
26
+ <!-- Why things are structured this way -->