Skip to content

Commit 425d9a5

Browse files
committed
Add /note command with self-contained note_tool
- Tool handles all structuring: YAML frontmatter, sections, tags, [[links]] - Model just orchestrates: calls tool, presents result, handles iteration - Actions: create (draft/finalize), save, list, search - Outputs Obsidian-compatible .md to .knowledge/notes/ - Stateless - each call is independent
1 parent 74e6d90 commit 425d9a5

61 files changed

Lines changed: 1488 additions & 836 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
File renamed without changes.
File renamed without changes.
Lines changed: 290 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,290 @@
1+
---
2+
id: framework-analysis-2026-03-27
3+
created: 2026-03-27
4+
modified: 2026-03-27
5+
type: audit
6+
status: active
7+
sources:
8+
- AGENTS.md
9+
- .opencode/agents/*.md
10+
- .opencode/commands/*.md
11+
- .opencode/tools/*.ts
12+
- todo.yaml
13+
- README.md
14+
tags:
15+
- framework
16+
- architecture
17+
- improvements
18+
---
19+
20+
# OpenCode Framework Analysis & Improvement Suggestions
21+
22+
## Executive Summary
23+
24+
After analyzing the repository structure, agent configurations, tools, and current implementation, I've identified several areas for improvement ranging from architectural inconsistencies to tool reliability issues.
25+
26+
---
27+
28+
## Current Architecture Overview
29+
30+
### Directory Structure
31+
```
32+
/
33+
├── AGENTS.md # Core constitution (universal mandates)
34+
├── README.md # User-facing documentation
35+
├── todo.yaml # Task storage
36+
├── .opencode/
37+
│ ├── agents/ # Mode definitions (analyze, plan, build, release, etc.)
38+
│ ├── commands/ # Command specifications
39+
│ ├── tools/ # TypeScript tool implementations (journal.ts, todo.ts)
40+
│ ├── style-guide.md
41+
│ └── node_modules/
42+
├── .knowledge/
43+
│ ├── notes/ # Analysis outputs
44+
│ └── plans/ # Action plans
45+
├── plans/ # Duplicated plans directory (confusion point)
46+
├── journal/ # Daily journal entries
47+
├── research/ # Research outputs
48+
├── drafts/ # Draft content
49+
└── docs/ # Project documentation
50+
```
51+
52+
### Core Components
53+
1. **4 Primary Modes**: analyze, plan, build, release
54+
2. **5 Subagents**: scout, investigator, critic, tester, drafter
55+
3. **14+ Commands**: research, audit, plan, build, commit, etc.
56+
4. **2 Tools**: todo.ts, journal.ts (TypeScript/Bun-based)
57+
58+
---
59+
60+
## Issues & Improvement Suggestions
61+
62+
### 1. **Critical: Permission System Not Enforced**
63+
64+
**Problem**: Agents have YAML frontmatter defining permissions, but there's no enforcement mechanism.
65+
66+
**Evidence**:
67+
- `analyze.md` defines: `edit: .knowledge/notes*: allow`
68+
- `plan.md` has a typo: `.knowledege/plans` (line 8)
69+
- No validation that agents actually respect these constraints
70+
71+
**Impact**: The entire security model is declarative but not enforced, relying on agent "good behavior" which could fail.
72+
73+
**Suggestion**:
74+
- Implement a permission validation layer in the tool system
75+
- Add tests that verify agents can't exceed their permissions
76+
- Fix the typo in plan.md (`.knowledege``.knowledge`)
77+
78+
---
79+
80+
### 2. **Major: Tool Implementation is Brittle**
81+
82+
**Problem**: Custom YAML parsing in todo.ts and journal.ts using regex-based parsing.
83+
84+
**Evidence** (from todo.ts lines 34-91):
85+
```typescript
86+
function parseYaml(content: string): TasksData {
87+
const lines = content.split("\n");
88+
// ... 60 lines of regex-based YAML parsing
89+
}
90+
```
91+
92+
**Issues**:
93+
- Doesn't handle multi-line strings
94+
- No YAML spec compliance
95+
- Fragile to formatting changes
96+
- No schema validation
97+
- Will break on edge cases (special characters in descriptions, etc.)
98+
99+
**Suggestion**:
100+
- Use a proper YAML library (like js-yaml)
101+
- Add JSON Schema validation
102+
- Consider JSON for machine-readable files instead of YAML
103+
- Add comprehensive tests for edge cases
104+
105+
---
106+
107+
### 3. **Major: Command/Tool Mismatch**
108+
109+
**Problem**: Two different task management systems with different purposes but similar names.
110+
111+
**Evidence**:
112+
- `todo` tool: Manages `todo.yaml` - persistent project tasks
113+
- `/todo` command: Lists GitHub issues (from `.opencode/commands/todo.md`)
114+
- `todowrite` tool: Session-level task tracking
115+
116+
**User Confusion**:
117+
- "Should I use the todo tool or the todo command?"
118+
- "What's the difference between todo.yaml and session todos?"
119+
120+
**Suggestion**:
121+
- Rename for clarity:
122+
- `todo` tool → `task` or `backlog` (project tasks)
123+
- `/todo` command → `/issues` or `/github-tasks`
124+
- `todowrite` → keep as is (session tasks are different)
125+
- Add clear documentation explaining when to use each
126+
127+
---
128+
129+
### 4. **Medium: Directory Structure Inconsistency**
130+
131+
**Problem**: Plans exist in two places with no clear ownership.
132+
133+
**Evidence**:
134+
- `AGENTS.md` line 26: `.knowledge/plans/` - created by plan agent
135+
- Root `/plans/` directory exists with 15+ plan files
136+
- No clear migration or organization strategy
137+
138+
**Suggestion**:
139+
- Consolidate to single location
140+
- Update AGENTS.md to reflect actual practice
141+
- Add a symlink or README explaining the structure
142+
- Consider: Are root `/plans/` user-facing? Are `.knowledge/plans/` agent-facing?
143+
144+
---
145+
146+
### 5. **Medium: Agent/Command Documentation Drift**
147+
148+
**Problem**: README.md describes many commands that don't exist in `.opencode/commands/`.
149+
150+
**Evidence** (commands in README but missing from .opencode/commands/):
151+
- `/brainstorm` - mentioned in README line 61
152+
- `/issues` - mentioned in README line 70
153+
- `/debug` - mentioned in README line 71
154+
- `/task` - mentioned in README line 72 (but there's a todo tool)
155+
- `/document` - mentioned in README line 79
156+
- `/cron` - mentioned in README line 80
157+
- `/release` - mentioned in README line 84 (but has `/publish`)
158+
- `/learn` - mentioned in README line 60
159+
160+
**Suggestion**:
161+
- Audit all commands mentioned in README
162+
- Either implement missing commands or remove from README
163+
- Add CI check to prevent drift (e.g., verify all `/command` references have corresponding .md files)
164+
165+
---
166+
167+
### 6. **Medium: Subagent Rules Not Enforced**
168+
169+
**Problem**: Subagent rules in AGENTS.md lines 81-88 are guidelines, not enforced constraints.
170+
171+
**Evidence**:
172+
- Rules listed: "Never write to project files", "Never write to .knowledge/"
173+
- No technical enforcement mechanism
174+
- Subagents use `task` tool which has no permission system
175+
176+
**Suggestion**:
177+
- Add sandboxing or chroot for subagent file access
178+
- Implement file system permissions in the tool layer
179+
- Log and audit subagent file operations
180+
181+
---
182+
183+
### 7. **Low: Missing Error Handling**
184+
185+
**Problem**: Tools assume success and don't handle common error cases.
186+
187+
**Evidence** (from todo.ts):
188+
- Line 23-24: `if (!await file.exists())` - good
189+
- Line 31: `return parseYaml(content)` - no try/catch for malformed YAML
190+
- No validation that task IDs are unique before adding
191+
- No handling for circular dependencies
192+
193+
**Suggestion**:
194+
- Add comprehensive error handling
195+
- Validate task ID uniqueness
196+
- Detect and prevent circular dependencies
197+
- Add user-friendly error messages
198+
199+
---
200+
201+
### 8. **Low: No Migration Strategy**
202+
203+
**Problem**: Framework version 2.0 declared in AGENTS.md but no migration path from v1.
204+
205+
**Evidence**:
206+
- Line 168: `*Framework Version: 2.0*`
207+
- No CHANGELOG.md section for breaking changes
208+
- No migration guide
209+
210+
**Suggestion**:
211+
- Document breaking changes from v1 to v2
212+
- Add migration scripts if needed
213+
- Version the configuration files (e.g., `.opencode/config-v2.yaml`)
214+
215+
---
216+
217+
### 9. **Low: Style Guide Isolated**
218+
219+
**Problem**: `.opencode/style-guide.md` exists but isn't referenced in agent configs.
220+
221+
**Evidence**:
222+
- No agent includes "read style-guide" in their setup
223+
- Not mentioned in any command workflows
224+
- drafter.md (content creation) doesn't reference it
225+
226+
**Suggestion**:
227+
- Add style-guide to agent context where relevant
228+
- Reference in `/draft` and `/review` commands
229+
- Consider making it part of the system prompt for content agents
230+
231+
---
232+
233+
### 10. **Architectural: No Plugin System**
234+
235+
**Problem**: Tools are hardcoded TypeScript files; no extensibility.
236+
237+
**Evidence**:
238+
- All tools in `.opencode/tools/*.ts`
239+
- No dynamic loading mechanism
240+
- Users can't add custom tools without modifying core
241+
242+
**Suggestion**:
243+
- Design a plugin interface (JSON-based tool definitions?)
244+
- Allow custom tools in `.opencode/custom-tools/`
245+
- Document the tool API for extension
246+
247+
---
248+
249+
## Priority Matrix
250+
251+
| Issue | Priority | Effort | Impact |
252+
|-------|----------|--------|--------|
253+
| Permission system not enforced | Critical | High | Security |
254+
| Brittle YAML parsing | Major | Medium | Reliability |
255+
| Command/tool name confusion | Major | Low | Usability |
256+
| Documentation drift | Medium | Low | Maintenance |
257+
| Directory inconsistency | Medium | Low | Organization |
258+
| Subagent rules not enforced | Medium | High | Security |
259+
| Missing error handling | Low | Low | Reliability |
260+
| No migration strategy | Low | Low | Maintenance |
261+
| Style guide isolated | Low | Low | Quality |
262+
| No plugin system | Low | High | Extensibility |
263+
264+
---
265+
266+
## Recommended Immediate Actions
267+
268+
1. **Fix the typo** in `.opencode/agents/plan.md` line 8: `.knowledege``.knowledge`
269+
270+
2. **Clarify naming**: Decide on final names for task management concepts and update all references
271+
272+
3. **Audit commands**: Create missing command files or remove from README
273+
274+
4. **Add YAML validation**: At minimum, add try/catch around parsing
275+
276+
5. **Document the dual plans directories**: Add README explaining `.knowledge/plans/` vs `/plans/`
277+
278+
---
279+
280+
## Questions for Framework Maintainers
281+
282+
1. Is the permission system in agent frontmatter aspirational or intended to be enforced?
283+
2. What's the difference between root `/plans/` and `.knowledge/plans/`?
284+
3. Are the README commands (brainstorm, issues, debug, etc.) planned or deprecated?
285+
4. Should we migrate from YAML to JSON for machine-readable files?
286+
5. Is there a roadmap for plugin/custom tool support?
287+
288+
---
289+
290+
*Analysis conducted on 2026-03-27 based on Framework Version 2.0*
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)