opencodekit 0.2.3 → 0.2.4
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/README.md +2 -1
- package/dist/index.js +1 -1
- package/dist/template/.opencode/AGENTS.md +43 -3
- package/dist/template/.opencode/command/create.md +21 -2
- package/dist/template/.opencode/command/issue.md +1 -1
- package/dist/template/.opencode/command/plan.md +85 -4
- package/dist/template/.opencode/memory/_templates/observation.md +39 -0
- package/dist/template/.opencode/tool/memory-search.ts +140 -0
- package/dist/template/.opencode/tool/observation.ts +155 -0
- package/package.json +1 -1
- package/dist/template/.opencode/memory/README.md +0 -128
- package/dist/template/.opencode/memory/_templates/handoff.md +0 -33
- package/dist/template/.opencode/memory/_templates/research.md +0 -29
- package/dist/template/.opencode/memory/_templates/task-design.md +0 -59
- package/dist/template/.opencode/memory/_templates/task-review.md +0 -73
- package/dist/template/.opencode/memory/_templates/task-spec.md +0 -71
- package/dist/template/.opencode/memory/design-guidelines.md +0 -281
- /package/dist/template/.opencode/memory/_templates/{task-prd.md → prd.md} +0 -0
package/README.md
CHANGED
|
@@ -247,7 +247,8 @@ You've successfully set up OpenCodeKit when:
|
|
|
247
247
|
- **Custom Commands**: `.opencode/command/` - All 45+ workflow commands
|
|
248
248
|
- **Skills System**: `.opencode/skills/` - 24 skills (8 core, 7 stack, 9 specialized)
|
|
249
249
|
- **Memory System**: `.opencode/memory/` - Persistent cross-session knowledge
|
|
250
|
-
- **Templates**: `.opencode/memory/_templates/` - PRD and
|
|
250
|
+
- **Templates**: `.opencode/memory/_templates/` - PRD, observation, and session-summary templates
|
|
251
|
+
- **Memory Tools**: `.opencode/tool/` - memory-read, memory-update, memory-search, observation
|
|
251
252
|
|
|
252
253
|
---
|
|
253
254
|
|
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.2.
|
|
753
|
+
version: "0.2.4",
|
|
754
754
|
description: "CLI tool for bootstrapping and managing OpenCodeKit projects",
|
|
755
755
|
type: "module",
|
|
756
756
|
repository: {
|
|
@@ -100,13 +100,53 @@
|
|
|
100
100
|
|
|
101
101
|
```
|
|
102
102
|
.opencode/memory/
|
|
103
|
-
_templates/ # Task templates
|
|
103
|
+
_templates/ # Task templates (prd, observation, session-summary)
|
|
104
104
|
handoffs/ # Phase transitions
|
|
105
105
|
research/ # Research findings
|
|
106
|
+
observations/ # Structured observations
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Memory Tools
|
|
110
|
+
|
|
111
|
+
| Tool | Use For |
|
|
112
|
+
| --------------- | -------------------------------- |
|
|
113
|
+
| `memory-read` | Load previous context, templates |
|
|
114
|
+
| `memory-update` | Save learnings, handoffs |
|
|
115
|
+
| `memory-search` | Search across all memory files |
|
|
116
|
+
| `observation` | Create structured observations |
|
|
117
|
+
|
|
118
|
+
### Observations
|
|
119
|
+
|
|
120
|
+
Record important findings with structured metadata:
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
observation(
|
|
124
|
+
type: "decision", # decision, bugfix, feature, pattern, discovery, learning, warning
|
|
125
|
+
title: "Use JWT auth",
|
|
126
|
+
content: "Decided to use JWT because...",
|
|
127
|
+
concepts: "auth, security",
|
|
128
|
+
files: "src/auth.ts",
|
|
129
|
+
bead_id: "bd-abc123"
|
|
130
|
+
)
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**When to create observations:**
|
|
134
|
+
|
|
135
|
+
- Major architectural decisions
|
|
136
|
+
- Bug root causes discovered
|
|
137
|
+
- Patterns worth reusing
|
|
138
|
+
- Gotchas and warnings for future
|
|
139
|
+
|
|
140
|
+
### Memory Search
|
|
141
|
+
|
|
142
|
+
Find past decisions, research, or handoffs:
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
memory-search(query: "authentication")
|
|
146
|
+
memory-search(query: "bugfix", type: "observations")
|
|
147
|
+
memory-search(query: "session", type: "handoffs")
|
|
106
148
|
```
|
|
107
149
|
|
|
108
|
-
- `memory-read` - Load previous context
|
|
109
|
-
- `memory-update` - Save learnings
|
|
110
150
|
- Task tracking uses Beads (`bd` CLI)
|
|
111
151
|
|
|
112
152
|
## Session Management
|
|
@@ -56,7 +56,7 @@ bd create "[title]" -t [type] -p [priority] -d "[description]" --json
|
|
|
56
56
|
mkdir -p .beads/artifacts/<bead-id>
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
Use the PRD template from `.opencode/memory/_templates/
|
|
59
|
+
Use the PRD template from `.opencode/memory/_templates/prd.md` as the base structure.
|
|
60
60
|
|
|
61
61
|
Write `.beads/artifacts/<bead-id>/spec.md`:
|
|
62
62
|
|
|
@@ -116,7 +116,26 @@ For **Deep** mode, add:
|
|
|
116
116
|
[To be filled during /research phase]
|
|
117
117
|
```
|
|
118
118
|
|
|
119
|
-
## Phase 5:
|
|
119
|
+
## Phase 5: Review Spec
|
|
120
|
+
|
|
121
|
+
Present the spec for approval:
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
Spec Preview:
|
|
125
|
+
━━━━━━━━━━━━━
|
|
126
|
+
|
|
127
|
+
[Show full spec.md content]
|
|
128
|
+
|
|
129
|
+
━━━━━━━━━━━━━
|
|
130
|
+
Approve spec? (yes/modify)
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**STOP and wait for human response.**
|
|
134
|
+
|
|
135
|
+
If "modify": Iterate on spec based on feedback until approved.
|
|
136
|
+
If "yes": Proceed to report.
|
|
137
|
+
|
|
138
|
+
## Phase 6: Report
|
|
120
139
|
|
|
121
140
|
```
|
|
122
141
|
Created: <bead-id>
|
|
@@ -35,7 +35,7 @@ bd edit <bead-id> --note "GitHub issue: #$ARGUMENTS"
|
|
|
35
35
|
|
|
36
36
|
## Create Spec from PRD Template
|
|
37
37
|
|
|
38
|
-
Use `.opencode/memory/_templates/
|
|
38
|
+
Use `.opencode/memory/_templates/prd.md` as the base structure.
|
|
39
39
|
|
|
40
40
|
Save to `.beads/artifacts/<bead-id>/spec.md`:
|
|
41
41
|
|
|
@@ -17,9 +17,12 @@ Read artifacts:
|
|
|
17
17
|
```bash
|
|
18
18
|
cat .beads/artifacts/<bead-id>/spec.md
|
|
19
19
|
cat .beads/artifacts/<bead-id>/research.md
|
|
20
|
+
cat .beads/artifacts/<bead-id>/design.md 2>/dev/null
|
|
20
21
|
```
|
|
21
22
|
|
|
22
|
-
If missing: "Run `/
|
|
23
|
+
If spec.md missing: "Run `/create <bead-id>` first."
|
|
24
|
+
If research.md missing: "Run `/research <bead-id>` first."
|
|
25
|
+
If design.md exists: Resume from saved design options.
|
|
23
26
|
|
|
24
27
|
## Phase 2: Generate Design Options
|
|
25
28
|
|
|
@@ -68,7 +71,77 @@ Present 2-3 approaches:
|
|
|
68
71
|
**Recommendation:** Option [A/B] because [reason].
|
|
69
72
|
```
|
|
70
73
|
|
|
71
|
-
## Phase 3:
|
|
74
|
+
## Phase 3: Save Design Document
|
|
75
|
+
|
|
76
|
+
Save design options to `.beads/artifacts/<bead-id>/design.md`:
|
|
77
|
+
|
|
78
|
+
```markdown
|
|
79
|
+
# Design Options: [Title]
|
|
80
|
+
|
|
81
|
+
**Bead:** <bead-id>
|
|
82
|
+
**Date:** <date>
|
|
83
|
+
**Status:** Pending Approval
|
|
84
|
+
|
|
85
|
+
## Problem Statement
|
|
86
|
+
|
|
87
|
+
[What we're solving - from spec.md]
|
|
88
|
+
|
|
89
|
+
## Options Considered
|
|
90
|
+
|
|
91
|
+
### Option A: [Name]
|
|
92
|
+
|
|
93
|
+
**Approach:** [1-2 sentence description]
|
|
94
|
+
|
|
95
|
+
**Changes:**
|
|
96
|
+
|
|
97
|
+
- `src/foo.ts` - [what changes]
|
|
98
|
+
- `src/bar.ts` - [what changes]
|
|
99
|
+
|
|
100
|
+
**Pros:**
|
|
101
|
+
|
|
102
|
+
- [pro 1]
|
|
103
|
+
- [pro 2]
|
|
104
|
+
|
|
105
|
+
**Cons:**
|
|
106
|
+
|
|
107
|
+
- [con 1]
|
|
108
|
+
|
|
109
|
+
**Effort:** [S/M/L]
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
### Option B: [Name]
|
|
114
|
+
|
|
115
|
+
**Approach:** [1-2 sentence description]
|
|
116
|
+
|
|
117
|
+
**Changes:**
|
|
118
|
+
|
|
119
|
+
- `src/baz.ts` - [what changes]
|
|
120
|
+
|
|
121
|
+
**Pros:**
|
|
122
|
+
|
|
123
|
+
- [pro 1]
|
|
124
|
+
|
|
125
|
+
**Cons:**
|
|
126
|
+
|
|
127
|
+
- [con 1]
|
|
128
|
+
- [con 2]
|
|
129
|
+
|
|
130
|
+
**Effort:** [S/M/L]
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Recommendation
|
|
135
|
+
|
|
136
|
+
Option [A/B] because [reason].
|
|
137
|
+
|
|
138
|
+
## Decision
|
|
139
|
+
|
|
140
|
+
**Chosen:** [To be filled after approval]
|
|
141
|
+
**Rationale:** [To be filled after approval]
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Phase 4: Get Approval
|
|
72
145
|
|
|
73
146
|
**STOP and wait for human response.**
|
|
74
147
|
|
|
@@ -78,7 +151,15 @@ Pick an option (A/B/C), modify, or "none" to propose alternatives.
|
|
|
78
151
|
|
|
79
152
|
Do not proceed until user confirms.
|
|
80
153
|
|
|
81
|
-
## Phase
|
|
154
|
+
## Phase 5: Update Design Decision
|
|
155
|
+
|
|
156
|
+
After approval, update `.beads/artifacts/<bead-id>/design.md`:
|
|
157
|
+
|
|
158
|
+
- Change **Status:** to `Approved`
|
|
159
|
+
- Fill in **Chosen:** with selected option
|
|
160
|
+
- Fill in **Rationale:** with user's reasoning
|
|
161
|
+
|
|
162
|
+
## Phase 6: Create Plan
|
|
82
163
|
|
|
83
164
|
After approval, write `.beads/artifacts/<bead-id>/plan.md`:
|
|
84
165
|
|
|
@@ -136,7 +217,7 @@ After approval, write `.beads/artifacts/<bead-id>/plan.md`:
|
|
|
136
217
|
- [Risk 1] - [mitigation]
|
|
137
218
|
```
|
|
138
219
|
|
|
139
|
-
## Phase
|
|
220
|
+
## Phase 7: Update Bead
|
|
140
221
|
|
|
141
222
|
```bash
|
|
142
223
|
bd edit <bead-id> --note "Plan approved: [option name]. [step count] steps."
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Observation Template
|
|
2
|
+
|
|
3
|
+
**Type:** [decision | bugfix | feature | pattern | discovery | learning | warning]
|
|
4
|
+
**Created:** [timestamp]
|
|
5
|
+
**Bead:** [optional bead-id]
|
|
6
|
+
**Concepts:** `tag1`, `tag2`, `tag3`
|
|
7
|
+
**Files:** `path/to/file1.ts`, `path/to/file2.ts`
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Context
|
|
12
|
+
|
|
13
|
+
[What situation prompted this observation? What were you working on?]
|
|
14
|
+
|
|
15
|
+
## Observation
|
|
16
|
+
|
|
17
|
+
[The core insight, decision, or learning. Be specific and actionable.]
|
|
18
|
+
|
|
19
|
+
## Rationale
|
|
20
|
+
|
|
21
|
+
[Why is this important? What alternatives were considered?]
|
|
22
|
+
|
|
23
|
+
## Future Reference
|
|
24
|
+
|
|
25
|
+
[How should this inform future decisions? Any follow-up actions?]
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Type Definitions
|
|
30
|
+
|
|
31
|
+
| Type | Icon | Use For |
|
|
32
|
+
| --------- | ---- | ------------------------------------ |
|
|
33
|
+
| decision | 🎯 | Architectural or design choices made |
|
|
34
|
+
| bugfix | 🐛 | Bug root causes and solutions |
|
|
35
|
+
| feature | ✨ | Feature implementation notes |
|
|
36
|
+
| pattern | 🔄 | Recurring patterns or conventions |
|
|
37
|
+
| discovery | 💡 | Unexpected findings or insights |
|
|
38
|
+
| learning | 📚 | Lessons learned from experience |
|
|
39
|
+
| warning | ⚠️ | Pitfalls to avoid, gotchas |
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import { tool } from "@opencode-ai/plugin";
|
|
3
|
+
import fs from "fs/promises";
|
|
4
|
+
|
|
5
|
+
interface SearchResult {
|
|
6
|
+
file: string;
|
|
7
|
+
matches: { line: number; content: string }[];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
async function searchDirectory(
|
|
11
|
+
dir: string,
|
|
12
|
+
pattern: RegExp,
|
|
13
|
+
results: SearchResult[],
|
|
14
|
+
baseDir: string,
|
|
15
|
+
): Promise<void> {
|
|
16
|
+
try {
|
|
17
|
+
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
18
|
+
|
|
19
|
+
for (const entry of entries) {
|
|
20
|
+
const fullPath = path.join(dir, entry.name);
|
|
21
|
+
|
|
22
|
+
if (entry.isDirectory()) {
|
|
23
|
+
// Skip hidden directories except _templates
|
|
24
|
+
if (entry.name.startsWith(".") && entry.name !== "_templates") {
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
await searchDirectory(fullPath, pattern, results, baseDir);
|
|
28
|
+
} else if (entry.name.endsWith(".md")) {
|
|
29
|
+
const content = await fs.readFile(fullPath, "utf-8");
|
|
30
|
+
const lines = content.split("\n");
|
|
31
|
+
const matches: { line: number; content: string }[] = [];
|
|
32
|
+
|
|
33
|
+
lines.forEach((line, index) => {
|
|
34
|
+
if (pattern.test(line)) {
|
|
35
|
+
matches.push({
|
|
36
|
+
line: index + 1,
|
|
37
|
+
content: line.trim().substring(0, 150),
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
if (matches.length > 0) {
|
|
43
|
+
const relativePath = path.relative(baseDir, fullPath);
|
|
44
|
+
results.push({ file: relativePath, matches });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
} catch {
|
|
49
|
+
// Directory doesn't exist or not readable
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export default tool({
|
|
54
|
+
description:
|
|
55
|
+
"Search across all memory files using keywords or patterns. Returns matching files with line numbers and context. Useful for finding past decisions, research, or handoffs.",
|
|
56
|
+
args: {
|
|
57
|
+
query: tool.schema
|
|
58
|
+
.string()
|
|
59
|
+
.describe(
|
|
60
|
+
"Search query: keywords or regex pattern (e.g., 'authentication', 'bugfix.*session')",
|
|
61
|
+
),
|
|
62
|
+
type: tool.schema
|
|
63
|
+
.string()
|
|
64
|
+
.optional()
|
|
65
|
+
.describe(
|
|
66
|
+
"Filter by type: 'all' (default), 'handoffs', 'research', 'templates', 'observations', 'beads'",
|
|
67
|
+
),
|
|
68
|
+
limit: tool.schema
|
|
69
|
+
.number()
|
|
70
|
+
.optional()
|
|
71
|
+
.describe("Max results per file (default: 5)"),
|
|
72
|
+
},
|
|
73
|
+
execute: async (args: { query: string; type?: string; limit?: number }) => {
|
|
74
|
+
const memoryDir = path.join(process.cwd(), ".opencode/memory");
|
|
75
|
+
const beadsDir = path.join(process.cwd(), ".beads/artifacts");
|
|
76
|
+
const globalMemoryDir = path.join(
|
|
77
|
+
process.env.HOME || "",
|
|
78
|
+
".config/opencode/memory",
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
const limit = args.limit || 5;
|
|
82
|
+
|
|
83
|
+
// Create case-insensitive regex from query
|
|
84
|
+
let pattern: RegExp;
|
|
85
|
+
try {
|
|
86
|
+
pattern = new RegExp(args.query, "i");
|
|
87
|
+
} catch {
|
|
88
|
+
// Escape special chars if not valid regex
|
|
89
|
+
const escaped = args.query.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
90
|
+
pattern = new RegExp(escaped, "i");
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const results: SearchResult[] = [];
|
|
94
|
+
|
|
95
|
+
// Handle type filtering
|
|
96
|
+
if (args.type === "beads") {
|
|
97
|
+
// Search only bead artifacts
|
|
98
|
+
await searchDirectory(beadsDir, pattern, results, beadsDir);
|
|
99
|
+
} else if (args.type && args.type !== "all") {
|
|
100
|
+
const typeMap: Record<string, string> = {
|
|
101
|
+
handoffs: "handoffs",
|
|
102
|
+
research: "research",
|
|
103
|
+
templates: "_templates",
|
|
104
|
+
observations: "observations",
|
|
105
|
+
};
|
|
106
|
+
const subdir = typeMap[args.type];
|
|
107
|
+
if (subdir) {
|
|
108
|
+
const searchDir = path.join(memoryDir, subdir);
|
|
109
|
+
await searchDirectory(searchDir, pattern, results, memoryDir);
|
|
110
|
+
}
|
|
111
|
+
} else {
|
|
112
|
+
// Search all: memory + beads
|
|
113
|
+
await searchDirectory(memoryDir, pattern, results, memoryDir);
|
|
114
|
+
await searchDirectory(beadsDir, pattern, results, beadsDir);
|
|
115
|
+
await searchDirectory(globalMemoryDir, pattern, results, globalMemoryDir);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (results.length === 0) {
|
|
119
|
+
return `No matches found for "${args.query}" in memory files.\n\nTip: Try broader search terms or check available types: handoffs, research, templates, observations, beads`;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Build output
|
|
123
|
+
let output = `# Memory Search: "${args.query}"\n\n`;
|
|
124
|
+
output += `Found ${results.length} file(s) with matches.\n\n`;
|
|
125
|
+
|
|
126
|
+
for (const result of results) {
|
|
127
|
+
output += `## ${result.file}\n\n`;
|
|
128
|
+
const matchesToShow = result.matches.slice(0, limit);
|
|
129
|
+
for (const match of matchesToShow) {
|
|
130
|
+
output += `- **Line ${match.line}:** ${match.content}\n`;
|
|
131
|
+
}
|
|
132
|
+
if (result.matches.length > limit) {
|
|
133
|
+
output += `- ... and ${result.matches.length - limit} more matches\n`;
|
|
134
|
+
}
|
|
135
|
+
output += "\n";
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return output;
|
|
139
|
+
},
|
|
140
|
+
});
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import { tool } from "@opencode-ai/plugin";
|
|
3
|
+
import fs from "fs/promises";
|
|
4
|
+
|
|
5
|
+
// Observation types following claude-mem patterns
|
|
6
|
+
type ObservationType =
|
|
7
|
+
| "decision"
|
|
8
|
+
| "bugfix"
|
|
9
|
+
| "feature"
|
|
10
|
+
| "pattern"
|
|
11
|
+
| "discovery"
|
|
12
|
+
| "learning"
|
|
13
|
+
| "warning";
|
|
14
|
+
|
|
15
|
+
const TYPE_ICONS: Record<ObservationType, string> = {
|
|
16
|
+
decision: "🎯",
|
|
17
|
+
bugfix: "🐛",
|
|
18
|
+
feature: "✨",
|
|
19
|
+
pattern: "🔄",
|
|
20
|
+
discovery: "💡",
|
|
21
|
+
learning: "📚",
|
|
22
|
+
warning: "⚠️",
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default tool({
|
|
26
|
+
description:
|
|
27
|
+
"Create a structured observation for future reference. Observations are categorized by type (decision, bugfix, feature, pattern, discovery, learning, warning) and stored in .opencode/memory/observations/.",
|
|
28
|
+
args: {
|
|
29
|
+
type: tool.schema
|
|
30
|
+
.string()
|
|
31
|
+
.describe(
|
|
32
|
+
"Observation type: decision, bugfix, feature, pattern, discovery, learning, warning",
|
|
33
|
+
),
|
|
34
|
+
title: tool.schema.string().describe("Brief title for the observation"),
|
|
35
|
+
content: tool.schema
|
|
36
|
+
.string()
|
|
37
|
+
.describe("Detailed observation content with context"),
|
|
38
|
+
concepts: tool.schema
|
|
39
|
+
.string()
|
|
40
|
+
.optional()
|
|
41
|
+
.describe(
|
|
42
|
+
"Comma-separated concept tags (e.g., 'authentication, oauth, security')",
|
|
43
|
+
),
|
|
44
|
+
files: tool.schema
|
|
45
|
+
.string()
|
|
46
|
+
.optional()
|
|
47
|
+
.describe(
|
|
48
|
+
"Comma-separated related files (e.g., 'src/auth.ts, src/login.ts')",
|
|
49
|
+
),
|
|
50
|
+
bead_id: tool.schema
|
|
51
|
+
.string()
|
|
52
|
+
.optional()
|
|
53
|
+
.describe("Related bead ID for traceability"),
|
|
54
|
+
},
|
|
55
|
+
execute: async (args: {
|
|
56
|
+
type: string;
|
|
57
|
+
title: string;
|
|
58
|
+
content: string;
|
|
59
|
+
concepts?: string;
|
|
60
|
+
files?: string;
|
|
61
|
+
bead_id?: string;
|
|
62
|
+
}) => {
|
|
63
|
+
const obsDir = path.join(process.cwd(), ".opencode/memory/observations");
|
|
64
|
+
|
|
65
|
+
// Validate type
|
|
66
|
+
const validTypes: ObservationType[] = [
|
|
67
|
+
"decision",
|
|
68
|
+
"bugfix",
|
|
69
|
+
"feature",
|
|
70
|
+
"pattern",
|
|
71
|
+
"discovery",
|
|
72
|
+
"learning",
|
|
73
|
+
"warning",
|
|
74
|
+
];
|
|
75
|
+
const obsType = args.type.toLowerCase() as ObservationType;
|
|
76
|
+
if (!validTypes.includes(obsType)) {
|
|
77
|
+
return `Error: Invalid observation type '${args.type}'.\nValid types: ${validTypes.join(", ")}`;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Generate filename: YYYY-MM-DD-type-slug.md
|
|
81
|
+
const now = new Date();
|
|
82
|
+
const dateStr = now.toISOString().split("T")[0];
|
|
83
|
+
const slug = args.title
|
|
84
|
+
.toLowerCase()
|
|
85
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
86
|
+
.replace(/^-|-$/g, "")
|
|
87
|
+
.substring(0, 40);
|
|
88
|
+
const filename = `${dateStr}-${obsType}-${slug}.md`;
|
|
89
|
+
const filePath = path.join(obsDir, filename);
|
|
90
|
+
|
|
91
|
+
// Parse concepts and files
|
|
92
|
+
const concepts = args.concepts
|
|
93
|
+
? args.concepts.split(",").map((c) => c.trim())
|
|
94
|
+
: [];
|
|
95
|
+
const files = args.files ? args.files.split(",").map((f) => f.trim()) : [];
|
|
96
|
+
|
|
97
|
+
// Build observation content
|
|
98
|
+
const icon = TYPE_ICONS[obsType];
|
|
99
|
+
let observation = `# ${icon} ${args.title}\n\n`;
|
|
100
|
+
observation += `**Type:** ${obsType}\n`;
|
|
101
|
+
observation += `**Created:** ${now.toISOString()}\n`;
|
|
102
|
+
|
|
103
|
+
if (args.bead_id) {
|
|
104
|
+
observation += `**Bead:** ${args.bead_id}\n`;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (concepts.length > 0) {
|
|
108
|
+
observation += `**Concepts:** ${concepts.map((c) => `\`${c}\``).join(", ")}\n`;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (files.length > 0) {
|
|
112
|
+
observation += `**Files:** ${files.map((f) => `\`${f}\``).join(", ")}\n`;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
observation += `\n---\n\n`;
|
|
116
|
+
observation += args.content;
|
|
117
|
+
observation += `\n`;
|
|
118
|
+
|
|
119
|
+
try {
|
|
120
|
+
// Ensure directory exists
|
|
121
|
+
await fs.mkdir(obsDir, { recursive: true });
|
|
122
|
+
|
|
123
|
+
// Write observation
|
|
124
|
+
await fs.writeFile(filePath, observation, "utf-8");
|
|
125
|
+
|
|
126
|
+
let beadUpdate = "";
|
|
127
|
+
|
|
128
|
+
// Update bead notes if bead_id provided
|
|
129
|
+
if (args.bead_id) {
|
|
130
|
+
try {
|
|
131
|
+
const { execSync } = await import("child_process");
|
|
132
|
+
const noteContent = `${icon} ${obsType}: ${args.title}`;
|
|
133
|
+
execSync(
|
|
134
|
+
`bd edit ${args.bead_id} --note "${noteContent.replace(/"/g, '\\"')}"`,
|
|
135
|
+
{
|
|
136
|
+
cwd: process.cwd(),
|
|
137
|
+
encoding: "utf-8",
|
|
138
|
+
timeout: 5000,
|
|
139
|
+
},
|
|
140
|
+
);
|
|
141
|
+
beadUpdate = `\nBead updated: ${args.bead_id}`;
|
|
142
|
+
} catch {
|
|
143
|
+
beadUpdate = `\nWarning: Could not update bead ${args.bead_id}`;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return `✓ Observation saved: ${filename}\n\nType: ${icon} ${obsType}\nTitle: ${args.title}\nConcepts: ${concepts.join(", ") || "none"}\nFiles: ${files.join(", ") || "none"}${beadUpdate}\n\nPath: ${filePath}`;
|
|
148
|
+
} catch (error) {
|
|
149
|
+
if (error instanceof Error) {
|
|
150
|
+
return `Error saving observation: ${error.message}`;
|
|
151
|
+
}
|
|
152
|
+
return `Unknown error saving observation`;
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
});
|
package/package.json
CHANGED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
# Memory System README
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
The memory/ directory provides persistent cross-session context for OpenCode agents. This enables continuity and learning over time.
|
|
6
|
-
|
|
7
|
-
## Structure
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
memory/
|
|
11
|
-
├── _templates/ # Document templates
|
|
12
|
-
│ ├── spec.md # Template for task specifications
|
|
13
|
-
│ ├── research.md # Template for research documents
|
|
14
|
-
│ └── session.md # Template for session memory
|
|
15
|
-
├── memory.md # Current project state and session learnings
|
|
16
|
-
├── todo.md # Task tracking and progress
|
|
17
|
-
├── development-guidelines.md # Code conventions and patterns
|
|
18
|
-
├── architecture-decisions.md # Why we built it this way
|
|
19
|
-
├── blockers.md # Known issues and workarounds
|
|
20
|
-
│
|
|
21
|
-
├── research/ # Research findings and analysis
|
|
22
|
-
│ ├── YYYY-MM-DD-topic.md # Research documents
|
|
23
|
-
│ └── cache-topic.md # Research cache files
|
|
24
|
-
│
|
|
25
|
-
├── design-guidelines.md # Design system and UI standards
|
|
26
|
-
├── decisions/ # Architectural decision records
|
|
27
|
-
│ └── database-choice.md # Example: Why PostgreSQL
|
|
28
|
-
│
|
|
29
|
-
└── plans/ # Strategic planning documents
|
|
30
|
-
└── q4-roadmap.md # Example: Quarterly objectives
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
**Subdirectories:** Use to organize knowledge by category and prevent flat directory bloat.
|
|
34
|
-
|
|
35
|
-
## Usage
|
|
36
|
-
|
|
37
|
-
### For Agents
|
|
38
|
-
|
|
39
|
-
**At Session Start:**
|
|
40
|
-
|
|
41
|
-
1. Read `memory.md` for current project context
|
|
42
|
-
2. Check `todo.md` for active tasks
|
|
43
|
-
3. Review `blockers.md` for known issues
|
|
44
|
-
|
|
45
|
-
**During Session:**
|
|
46
|
-
|
|
47
|
-
- Consult `development-guidelines.md` for coding standards
|
|
48
|
-
- Reference `architecture-decisions.md` for design rationale
|
|
49
|
-
- Reference `design-guidelines.md` for design standards
|
|
50
|
-
- Update progress in `todo.md`
|
|
51
|
-
- Save research to `research/YYYY-MM-DD-topic.md` (auto-created by /research command)
|
|
52
|
-
- Document decisions in `decisions/choice-name.md`
|
|
53
|
-
- Create specs using templates from `_templates/spec.md`
|
|
54
|
-
|
|
55
|
-
**At Session End:**
|
|
56
|
-
|
|
57
|
-
- Update `memory.md` with new learnings
|
|
58
|
-
- Mark completed tasks in `todo.md`
|
|
59
|
-
- Document new blockers or resolve existing ones
|
|
60
|
-
|
|
61
|
-
### For Humans
|
|
62
|
-
|
|
63
|
-
**Quick Status Check:**
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
# See current state
|
|
67
|
-
cat memory/memory.md
|
|
68
|
-
|
|
69
|
-
# Check active tasks
|
|
70
|
-
cat memory/todo.md
|
|
71
|
-
|
|
72
|
-
# Review blockers
|
|
73
|
-
cat memory/blockers.md
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
**Update Memory:**
|
|
77
|
-
Edit files directly or use memory-update tool - agents will read on next session.
|
|
78
|
-
|
|
79
|
-
**Examples:**
|
|
80
|
-
|
|
81
|
-
```bash
|
|
82
|
-
# Read research notes
|
|
83
|
-
memory-read research/opencode-sessions
|
|
84
|
-
|
|
85
|
-
# Create new research note
|
|
86
|
-
memory-update research/new-topic content="# Research Notes\n..."
|
|
87
|
-
|
|
88
|
-
# Add decision record
|
|
89
|
-
memory-update decisions/database-choice content="# Why PostgreSQL\n..."
|
|
90
|
-
|
|
91
|
-
# Tools auto-create subdirectories and strip .md extension
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
## Memory Lifecycle
|
|
95
|
-
|
|
96
|
-
### Compaction (When memory.md > 5000 words)
|
|
97
|
-
|
|
98
|
-
1. Distill to critical facts only
|
|
99
|
-
2. Archive detailed history to dated file: `memory-archive-YYYY-MM-DD.md`
|
|
100
|
-
3. Keep current state lean and focused
|
|
101
|
-
|
|
102
|
-
### Rotation
|
|
103
|
-
|
|
104
|
-
- Archive completed tasks monthly
|
|
105
|
-
- Move resolved blockers to history section
|
|
106
|
-
- Keep active memory under 5000 words
|
|
107
|
-
|
|
108
|
-
## Integration Points
|
|
109
|
-
|
|
110
|
-
- **Plan Agent:** Reads memory.md before creating plans
|
|
111
|
-
- **Build Agent:** Updates memory.md after major completions
|
|
112
|
-
- **All Agents:** Consult development-guidelines.md for standards
|
|
113
|
-
- **Design Agent:** Consults design-guidelines.md for design standards
|
|
114
|
-
|
|
115
|
-
## Best Practices
|
|
116
|
-
|
|
117
|
-
1. **Be Specific:** "Uses React 18 Server Components" vs "Uses React"
|
|
118
|
-
2. **Date Decisions:** Track when and why choices were made
|
|
119
|
-
3. **Keep Current:** Update after significant progress, not every trivial change
|
|
120
|
-
4. **Prune Regularly:** Remove obsolete information
|
|
121
|
-
5. **Link Context:** Reference related files/specs when relevant
|
|
122
|
-
|
|
123
|
-
## Future Enhancements
|
|
124
|
-
|
|
125
|
-
- Automatic memory compaction triggers
|
|
126
|
-
- Memory-read and memory-update tools
|
|
127
|
-
- Integration with task ledgers
|
|
128
|
-
- Progress monitoring and re-planning triggers
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# Handoff: [Phase Name]
|
|
2
|
-
|
|
3
|
-
**Date:** YYYY-MM-DD
|
|
4
|
-
**From:** [Current phase/agent]
|
|
5
|
-
**To:** [Next phase/agent]
|
|
6
|
-
**Task:** [Task ID if applicable]
|
|
7
|
-
|
|
8
|
-
## Summary
|
|
9
|
-
|
|
10
|
-
[1-2 sentences: What was accomplished in this phase]
|
|
11
|
-
|
|
12
|
-
## Relevant Files
|
|
13
|
-
|
|
14
|
-
- `@path/to/file1` - [Why needed]
|
|
15
|
-
- `@path/to/file2` - [Why needed]
|
|
16
|
-
|
|
17
|
-
## Key Decisions
|
|
18
|
-
|
|
19
|
-
- [Decision 1]: [Rationale]
|
|
20
|
-
- [Decision 2]: [Rationale]
|
|
21
|
-
|
|
22
|
-
## Constraints
|
|
23
|
-
|
|
24
|
-
- [Constraint that must be followed]
|
|
25
|
-
- [Limitation to be aware of]
|
|
26
|
-
|
|
27
|
-
## Next Instructions
|
|
28
|
-
|
|
29
|
-
[Clear prompt for the next agent - what exactly to do next]
|
|
30
|
-
|
|
31
|
-
## Open Questions
|
|
32
|
-
|
|
33
|
-
- [Unresolved question for next phase]
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# Research: [Topic]
|
|
2
|
-
|
|
3
|
-
**Date:** YYYY-MM-DD
|
|
4
|
-
**Context:** [Why this research was needed]
|
|
5
|
-
|
|
6
|
-
## Question
|
|
7
|
-
|
|
8
|
-
[The specific question or problem being researched]
|
|
9
|
-
|
|
10
|
-
## Findings
|
|
11
|
-
|
|
12
|
-
### [Finding 1]
|
|
13
|
-
|
|
14
|
-
- [Key insight]
|
|
15
|
-
- Source: [URL or document]
|
|
16
|
-
|
|
17
|
-
### [Finding 2]
|
|
18
|
-
|
|
19
|
-
- [Key insight]
|
|
20
|
-
- Source: [URL or document]
|
|
21
|
-
|
|
22
|
-
## Decision
|
|
23
|
-
|
|
24
|
-
[Clear recommendation based on findings]
|
|
25
|
-
|
|
26
|
-
## Next Steps
|
|
27
|
-
|
|
28
|
-
1. [Action item]
|
|
29
|
-
2. [Action item]
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
# Design Document
|
|
2
|
-
|
|
3
|
-
**Bead ID:** [bead-id]
|
|
4
|
-
**Created:** [date]
|
|
5
|
-
**Status:** Draft | Validated
|
|
6
|
-
|
|
7
|
-
## Problem Statement
|
|
8
|
-
|
|
9
|
-
What we're solving and why it matters:
|
|
10
|
-
|
|
11
|
-
## Approaches Considered
|
|
12
|
-
|
|
13
|
-
### Option A: [Name]
|
|
14
|
-
|
|
15
|
-
- **Pros:** [advantages]
|
|
16
|
-
- **Cons:** [drawbacks]
|
|
17
|
-
|
|
18
|
-
### Option B: [Name]
|
|
19
|
-
|
|
20
|
-
- **Pros:** [advantages]
|
|
21
|
-
- **Cons:** [drawbacks]
|
|
22
|
-
|
|
23
|
-
### Chosen Approach
|
|
24
|
-
|
|
25
|
-
[Which option and why]
|
|
26
|
-
|
|
27
|
-
## Architecture
|
|
28
|
-
|
|
29
|
-
High-level structure and how components fit together:
|
|
30
|
-
|
|
31
|
-
### Components
|
|
32
|
-
|
|
33
|
-
- [Component 1]: [purpose]
|
|
34
|
-
- [Component 2]: [purpose]
|
|
35
|
-
|
|
36
|
-
### Data Flow
|
|
37
|
-
|
|
38
|
-
[How data moves through the system]
|
|
39
|
-
|
|
40
|
-
## Error Handling
|
|
41
|
-
|
|
42
|
-
How the design handles failure cases:
|
|
43
|
-
|
|
44
|
-
- [Error scenario 1]: [handling approach]
|
|
45
|
-
- [Error scenario 2]: [handling approach]
|
|
46
|
-
|
|
47
|
-
## Testing Strategy
|
|
48
|
-
|
|
49
|
-
How we'll validate this design works:
|
|
50
|
-
|
|
51
|
-
- [Testing approach 1]
|
|
52
|
-
- [Testing approach 2]
|
|
53
|
-
|
|
54
|
-
## Open Questions
|
|
55
|
-
|
|
56
|
-
Unresolved items to address during implementation:
|
|
57
|
-
|
|
58
|
-
- [ ] [Question 1]
|
|
59
|
-
- [ ] [Question 2]
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
# Task Review Template
|
|
2
|
-
|
|
3
|
-
**Task ID:** [auto-generated]
|
|
4
|
-
**Completed:** [date]
|
|
5
|
-
**Status:** Done
|
|
6
|
-
|
|
7
|
-
## What Changed
|
|
8
|
-
|
|
9
|
-
### Files Modified:
|
|
10
|
-
|
|
11
|
-
- `src/[file1.js]` - [brief description of changes]
|
|
12
|
-
- `src/[file2.js]` - [brief description of changes]
|
|
13
|
-
- `tests/[test.js]` - [brief description of changes]
|
|
14
|
-
|
|
15
|
-
### Logic Added:
|
|
16
|
-
|
|
17
|
-
- [New functionality implemented]
|
|
18
|
-
- [Key algorithms or business logic]
|
|
19
|
-
- [Data flow changes]
|
|
20
|
-
|
|
21
|
-
### Files Created:
|
|
22
|
-
|
|
23
|
-
- [List any new files created]
|
|
24
|
-
|
|
25
|
-
## What Skipped
|
|
26
|
-
|
|
27
|
-
### Intentionally Not Done:
|
|
28
|
-
|
|
29
|
-
- [Feature X - reason: out of scope for this task]
|
|
30
|
-
- [Optimization Y - reason: will be separate task]
|
|
31
|
-
- [Test case Z - reason: requires additional setup]
|
|
32
|
-
|
|
33
|
-
### Known Limitations:
|
|
34
|
-
|
|
35
|
-
- [Limitation 1 - temporary workaround]
|
|
36
|
-
- [Limitation 2 - technical debt introduced]
|
|
37
|
-
- [Limitation 3 - performance considerations]
|
|
38
|
-
|
|
39
|
-
## Inconsistencies with Architecture
|
|
40
|
-
|
|
41
|
-
### Deviations from Spec:
|
|
42
|
-
|
|
43
|
-
- [What was supposed to happen vs what actually happened]
|
|
44
|
-
- [Why the deviation was necessary]
|
|
45
|
-
- [Impact on overall architecture]
|
|
46
|
-
|
|
47
|
-
### Unexpected Challenges:
|
|
48
|
-
|
|
49
|
-
- [Problem 1 encountered and how solved]
|
|
50
|
-
- [Problem 2 encountered and how solved]
|
|
51
|
-
- [Problem 3 encountered and how solved]
|
|
52
|
-
|
|
53
|
-
## Validation Results
|
|
54
|
-
|
|
55
|
-
### Success Criteria Met:
|
|
56
|
-
|
|
57
|
-
- [x] [Criteria 1 from PRD - how verified]
|
|
58
|
-
- [x] [Criteria 2 from PRD - how verified]
|
|
59
|
-
- [x] [Criteria 3 from PRD - how verified]
|
|
60
|
-
|
|
61
|
-
### Test Results:
|
|
62
|
-
|
|
63
|
-
- [Test suite results summary]
|
|
64
|
-
- [Performance benchmarks]
|
|
65
|
-
- [Security validations]
|
|
66
|
-
|
|
67
|
-
## Next Micro-Task
|
|
68
|
-
|
|
69
|
-
[Immediate next step or follow-up task needed]
|
|
70
|
-
|
|
71
|
-
## Lessons Learned
|
|
72
|
-
|
|
73
|
-
[What worked well, what didn't, what to improve for future tasks]
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
# Task Spec Template
|
|
2
|
-
|
|
3
|
-
**Task ID:** [auto-generated]
|
|
4
|
-
**PRD:** [link to task-XXX-prd.md]
|
|
5
|
-
**Created:** [date]
|
|
6
|
-
|
|
7
|
-
## Architecture Plan
|
|
8
|
-
|
|
9
|
-
Where this feature plugs into the repo, which layers it touches, expected file paths:
|
|
10
|
-
|
|
11
|
-
### Files to Create/Modify:
|
|
12
|
-
|
|
13
|
-
- `src/[path/to/file1.js]` - [purpose]
|
|
14
|
-
- `src/[path/to/file2.js]` - [purpose]
|
|
15
|
-
- `tests/[path/to/test.js]` - [purpose]
|
|
16
|
-
|
|
17
|
-
### Integration Points:
|
|
18
|
-
|
|
19
|
-
- [Existing module/service it connects to]
|
|
20
|
-
- [Database schema changes needed]
|
|
21
|
-
- [API endpoints affected]
|
|
22
|
-
|
|
23
|
-
## Constraints
|
|
24
|
-
|
|
25
|
-
### Naming Conventions:
|
|
26
|
-
|
|
27
|
-
- Functions: [pattern, e.g., camelCase]
|
|
28
|
-
- Files: [pattern, e.g., kebab-case]
|
|
29
|
-
- Variables: [pattern, e.g., descriptive names]
|
|
30
|
-
|
|
31
|
-
### Framework Requirements:
|
|
32
|
-
|
|
33
|
-
- Must use: [required libraries/patterns]
|
|
34
|
-
- Must NOT use: [forbidden libraries/patterns]
|
|
35
|
-
- Must follow: [specific patterns, e.g., controllers → services → repository]
|
|
36
|
-
|
|
37
|
-
### Code Style:
|
|
38
|
-
|
|
39
|
-
- [Linting rules to follow]
|
|
40
|
-
- [Testing patterns required]
|
|
41
|
-
- [Documentation requirements]
|
|
42
|
-
|
|
43
|
-
## Edge Cases
|
|
44
|
-
|
|
45
|
-
Every scenario I know devs forget when in a rush:
|
|
46
|
-
|
|
47
|
-
- [Edge case 1: what happens when X fails]
|
|
48
|
-
- [Edge case 2: handling of invalid input Y]
|
|
49
|
-
- [Edge case 3: performance under load Z]
|
|
50
|
-
- [Edge case 4: error recovery scenarios]
|
|
51
|
-
- [Edge case 5: security considerations]
|
|
52
|
-
|
|
53
|
-
## Testing Notes
|
|
54
|
-
|
|
55
|
-
Expected inputs/outputs, how to validate behavior, what logs/errors should look like:
|
|
56
|
-
|
|
57
|
-
### Test Cases:
|
|
58
|
-
|
|
59
|
-
- [Test case 1: normal flow]
|
|
60
|
-
- [Test case 2: error conditions]
|
|
61
|
-
- [Test case 3: edge cases]
|
|
62
|
-
|
|
63
|
-
### Validation:
|
|
64
|
-
|
|
65
|
-
- [How to verify it works correctly]
|
|
66
|
-
- [Expected logs/messages]
|
|
67
|
-
- [Performance benchmarks]
|
|
68
|
-
|
|
69
|
-
### Rollback Plan:
|
|
70
|
-
|
|
71
|
-
- [How to undo changes if something goes wrong]
|
|
@@ -1,281 +0,0 @@
|
|
|
1
|
-
# Design Guidelines
|
|
2
|
-
|
|
3
|
-
**Project:** [Project Name]
|
|
4
|
-
**Last Updated:** YYYY-MM-DD
|
|
5
|
-
**Version:** 1.0
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Design System Overview
|
|
10
|
-
|
|
11
|
-
[Design system description and philosophy]
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## Typography
|
|
16
|
-
|
|
17
|
-
### Font Guidelines
|
|
18
|
-
|
|
19
|
-
- **Primary Font:** [Font name] (Google Fonts)
|
|
20
|
-
- **Fallback Fonts:** [Font options]
|
|
21
|
-
- **Sizes:**
|
|
22
|
-
- Headings: [Size guidelines]
|
|
23
|
-
- Body: [Size guidelines]
|
|
24
|
-
- Small: [Size guidelines]
|
|
25
|
-
- **Weights:** [Weight guidelines]
|
|
26
|
-
- **Line Height:** [Line height guidelines]
|
|
27
|
-
|
|
28
|
-
### Usage Rules
|
|
29
|
-
|
|
30
|
-
- **IMPORTANT:** Predict font names from screenshots, don't default to Inter/Roboto
|
|
31
|
-
- Use distinctive fonts that match brand identity
|
|
32
|
-
- Ensure readability across all devices
|
|
33
|
-
|
|
34
|
-
---
|
|
35
|
-
|
|
36
|
-
## Color Palette
|
|
37
|
-
|
|
38
|
-
### Primary Colors
|
|
39
|
-
|
|
40
|
-
- **Primary:** [Hex code] - [Usage description]
|
|
41
|
-
- **Secondary:** [Hex code] - [Usage description]
|
|
42
|
-
- **Accent:** [Hex code] - [Usage description]
|
|
43
|
-
|
|
44
|
-
### Neutral Colors
|
|
45
|
-
|
|
46
|
-
- **Background:** [Hex codes]
|
|
47
|
-
- **Text:** [Hex codes]
|
|
48
|
-
- **Borders:** [Hex codes]
|
|
49
|
-
|
|
50
|
-
### Usage Rules
|
|
51
|
-
|
|
52
|
-
- **IMPORTANT:** Avoid purple gradients on white backgrounds
|
|
53
|
-
- Use cohesive color palettes
|
|
54
|
-
- Ensure WCAG 2.1 AA contrast minimum
|
|
55
|
-
|
|
56
|
-
---
|
|
57
|
-
|
|
58
|
-
## Layout & Spacing
|
|
59
|
-
|
|
60
|
-
### Grid System
|
|
61
|
-
|
|
62
|
-
- **Framework:** [Bootstrap 5 / Custom CSS Grid]
|
|
63
|
-
- **Columns:** 12-column responsive grid
|
|
64
|
-
- **Breakpoints:** [Breakpoint values]
|
|
65
|
-
|
|
66
|
-
### Spacing Scale
|
|
67
|
-
|
|
68
|
-
- **Base Unit:** 4px
|
|
69
|
-
- **Scale:** 4, 8, 12, 16, 20, 24, 32, 48, 64px
|
|
70
|
-
- **Usage:** Consistent spacing throughout components
|
|
71
|
-
|
|
72
|
-
---
|
|
73
|
-
|
|
74
|
-
## Components
|
|
75
|
-
|
|
76
|
-
### Buttons
|
|
77
|
-
|
|
78
|
-
- **Primary Style:** [Description]
|
|
79
|
-
- **Secondary Style:** [Description]
|
|
80
|
-
- **States:** Default, Hover, Active, Disabled, Loading
|
|
81
|
-
- **Sizes:** Small, Medium, Large
|
|
82
|
-
|
|
83
|
-
### Forms
|
|
84
|
-
|
|
85
|
-
- **Layout:** Single column stacking on mobile
|
|
86
|
-
- **Validation:** Real-time and on-submit
|
|
87
|
-
- **Required Fields:** Marked with asterisk (\*)
|
|
88
|
-
|
|
89
|
-
### Modals
|
|
90
|
-
|
|
91
|
-
- **Max Width:** 500px
|
|
92
|
-
- **Responsive:** Full-width on mobile
|
|
93
|
-
- **Backdrop:** Semi-transparent overlay
|
|
94
|
-
|
|
95
|
-
---
|
|
96
|
-
|
|
97
|
-
## Motion & Animation
|
|
98
|
-
|
|
99
|
-
### Animation Principles
|
|
100
|
-
|
|
101
|
-
- **Purposeful Motion:** Staggered reveals for page entry
|
|
102
|
-
- **Duration:** 200-300ms for UI transitions
|
|
103
|
-
- **Easing:** Ease-out for natural movement
|
|
104
|
-
- **Avoid:** Scattered micro-interactions
|
|
105
|
-
|
|
106
|
-
### Guidelines
|
|
107
|
-
|
|
108
|
-
- Use staggered animations, not random effects
|
|
109
|
-
- Layer gradients for background depth
|
|
110
|
-
- Respect `prefers-reduced-motion` setting
|
|
111
|
-
|
|
112
|
-
---
|
|
113
|
-
|
|
114
|
-
## Accessibility
|
|
115
|
-
|
|
116
|
-
### Requirements
|
|
117
|
-
|
|
118
|
-
- **Standard:** WCAG 2.1 AA minimum
|
|
119
|
-
- **Contrast:** 4.5:1 ratio for normal text
|
|
120
|
-
- **Keyboard:** Full navigation support
|
|
121
|
-
- **Screen Readers:** Proper semantic HTML structure
|
|
122
|
-
|
|
123
|
-
### Implementation
|
|
124
|
-
|
|
125
|
-
- **ARIA Labels:** Descriptive labels for interactive elements
|
|
126
|
-
- **Focus States:** Visible focus indicators
|
|
127
|
-
- **Alt Text:** Meaningful descriptions for images
|
|
128
|
-
|
|
129
|
-
---
|
|
130
|
-
|
|
131
|
-
## Asset Guidelines
|
|
132
|
-
|
|
133
|
-
### Images
|
|
134
|
-
|
|
135
|
-
- **Format:** WebP for photos, PNG for graphics
|
|
136
|
-
- **Compression:** Optimized for web delivery
|
|
137
|
-
- **Responsive:** Multiple sizes for different screen densities
|
|
138
|
-
|
|
139
|
-
### Icons
|
|
140
|
-
|
|
141
|
-
- **System:** [Icon system name]
|
|
142
|
-
- **Sizes:** 16px, 24px, 32px, 48px
|
|
143
|
-
- **Format:** SVG with fallback PNG
|
|
144
|
-
|
|
145
|
-
---
|
|
146
|
-
|
|
147
|
-
## Code Standards
|
|
148
|
-
|
|
149
|
-
### CSS Architecture
|
|
150
|
-
|
|
151
|
-
- **Methodology:** BEM (Block, Element, Modifier)
|
|
152
|
-
- **Variables:** CSS custom properties for theming
|
|
153
|
-
- **Responsive:** Mobile-first approach
|
|
154
|
-
|
|
155
|
-
### JavaScript
|
|
156
|
-
|
|
157
|
-
- **Framework:** [Framework name]
|
|
158
|
-
- **Pattern:** Component-based architecture
|
|
159
|
-
- **Performance:** Lazy loading for heavy components
|
|
160
|
-
|
|
161
|
-
---
|
|
162
|
-
|
|
163
|
-
## Brand Guidelines
|
|
164
|
-
|
|
165
|
-
### Logo Usage
|
|
166
|
-
|
|
167
|
-
- **Primary Logo:** [Usage guidelines]
|
|
168
|
-
- **Clear Space:** Minimum spacing requirements
|
|
169
|
-
- **Variations:** Color variations for different backgrounds
|
|
170
|
-
|
|
171
|
-
### Voice & Tone
|
|
172
|
-
|
|
173
|
-
- **Personality:** [Brand personality description]
|
|
174
|
-
- **Language:** [Language style guidelines]
|
|
175
|
-
- **Do:** [Action words]
|
|
176
|
-
- **Don't:** [Words to avoid]
|
|
177
|
-
|
|
178
|
-
---
|
|
179
|
-
|
|
180
|
-
## Testing & QA
|
|
181
|
-
|
|
182
|
-
### Cross-Browser
|
|
183
|
-
|
|
184
|
-
- **Target:** [Browser list]
|
|
185
|
-
- **Testing:** Manual testing on each browser
|
|
186
|
-
- **Fallbacks:** Graceful degradation
|
|
187
|
-
|
|
188
|
-
### Device Testing
|
|
189
|
-
|
|
190
|
-
- **Mobile:** iOS Safari, Chrome Mobile
|
|
191
|
-
- **Tablet:** iPad, Android tablets
|
|
192
|
-
- **Desktop:** Chrome, Firefox, Safari, Edge
|
|
193
|
-
|
|
194
|
-
---
|
|
195
|
-
|
|
196
|
-
## File Organization
|
|
197
|
-
|
|
198
|
-
### Template Structure
|
|
199
|
-
|
|
200
|
-
```
|
|
201
|
-
assets/
|
|
202
|
-
├── images/
|
|
203
|
-
│ ├── logos/
|
|
204
|
-
│ ├── icons/
|
|
205
|
-
│ └── photos/
|
|
206
|
-
├── css/
|
|
207
|
-
│ ├── base.css
|
|
208
|
-
│ ├── components.css
|
|
209
|
-
│ └── utilities.css
|
|
210
|
-
└── js/
|
|
211
|
-
├── components/
|
|
212
|
-
└── utils/
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
### Naming Conventions
|
|
216
|
-
|
|
217
|
-
- **Images:** kebab-case with descriptive names
|
|
218
|
-
- **CSS:** BEM methodology with clear purpose
|
|
219
|
-
- **JavaScript:** PascalCase for components, camelCase for utilities
|
|
220
|
-
|
|
221
|
-
---
|
|
222
|
-
|
|
223
|
-
## Common Patterns
|
|
224
|
-
|
|
225
|
-
### Header Pattern
|
|
226
|
-
|
|
227
|
-
[Header component description and usage]
|
|
228
|
-
|
|
229
|
-
### Footer Pattern
|
|
230
|
-
|
|
231
|
-
[Footer component description and usage]
|
|
232
|
-
|
|
233
|
-
### Card Pattern
|
|
234
|
-
|
|
235
|
-
[Card component description and usage]
|
|
236
|
-
|
|
237
|
-
### Form Pattern
|
|
238
|
-
|
|
239
|
-
[Form component description and usage]
|
|
240
|
-
|
|
241
|
-
---
|
|
242
|
-
|
|
243
|
-
## Tools & Resources
|
|
244
|
-
|
|
245
|
-
### Design Tools
|
|
246
|
-
|
|
247
|
-
- **UI Design:** [Tool names]
|
|
248
|
-
- **Prototyping:** [Tool names]
|
|
249
|
-
- **Asset Generation:** AI-multimodal skill
|
|
250
|
-
|
|
251
|
-
### Development Tools
|
|
252
|
-
|
|
253
|
-
- **Code Editor:** [Editor preferences]
|
|
254
|
-
- **Browser DevTools:** Chrome DevTools
|
|
255
|
-
- **Version Control:** Git with feature branches
|
|
256
|
-
|
|
257
|
-
---
|
|
258
|
-
|
|
259
|
-
## Maintenance
|
|
260
|
-
|
|
261
|
-
### Update Process
|
|
262
|
-
|
|
263
|
-
1. Review new components quarterly
|
|
264
|
-
2. Update guidelines based on user feedback
|
|
265
|
-
3. Archive deprecated patterns
|
|
266
|
-
4. Update version number for breaking changes
|
|
267
|
-
|
|
268
|
-
### Documentation
|
|
269
|
-
|
|
270
|
-
- Keep examples up-to-date
|
|
271
|
-
- Document any exceptions to guidelines
|
|
272
|
-
- Maintain changelog for major updates
|
|
273
|
-
|
|
274
|
-
---
|
|
275
|
-
|
|
276
|
-
**Last Review:** YYYY-MM-DD
|
|
277
|
-
**Next Review:** YYYY-MM-DD
|
|
278
|
-
|
|
279
|
-
---
|
|
280
|
-
|
|
281
|
-
_Design-guidelines.md - Living document for project design standards_
|
|
File without changes
|