Skip to content

Commit 2763990

Browse files
committed
feat: refactor wrapper repository with templates directory
1 parent 3f388b1 commit 2763990

File tree

13 files changed

+452
-94
lines changed

13 files changed

+452
-94
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.opencode/
2+
node_modules/
13
*.log
24
*.env
35
__pycache__

.knowledge/drafts/.gitkeep

Whitespace-only changes.

.knowledge/log/.gitkeep

Whitespace-only changes.

.knowledge/notes/.gitkeep

Whitespace-only changes.
Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
---
2+
id: audit-full-2026-03-27
3+
created: 2026-03-27
4+
modified: 2026-03-27
5+
type: audit
6+
scope: full codebase
7+
status: active
8+
---
9+
10+
# Audit: Full Codebase — 2026-03-27
11+
12+
## Executive Summary
13+
14+
The opencode framework is a well-architected AI-assisted development system with a clear vision and solid fundamentals. However, it suffers from **moderate documentation drift** and **several critical configuration bugs** that could impair functionality. The core agent/command architecture is sound, but inconsistencies between documented intent and actual implementation create confusion risks.
15+
16+
**Overall Health: 68/100** — Good foundation, needs cleanup
17+
18+
---
19+
20+
## Architecture Overview
21+
22+
### Technology Stack
23+
| Layer | Technology |
24+
| ------------- | ---------------------------------------------------------- |
25+
| AI Runtime | Opencode.ai (Gemini CLI) with `@opencode-ai/plugin: 1.3.3` |
26+
| Build/CI | Makefile, GitHub Actions |
27+
| Documentation | MkDocs with Material theme |
28+
| Scripts | Python 3.10+ (typer, pyyaml) |
29+
| Node | npm/yarn for plugin dependencies |
30+
31+
### Directory Organization
32+
```
33+
.opencode/ → Core framework (agents, commands, bin scripts, node deps)
34+
.knowledge/ → Generated artifacts (notes/, plans/, log/, drafts/)
35+
docs/ → User-facing MkDocs documentation
36+
site/ → Built documentation (gitignored)
37+
.github/ → GitHub workflows
38+
.experiments/ → Subagent scratch space (gitignored)
39+
tests/ → Test suite (placeholder)
40+
```
41+
42+
### Entry Points
43+
- **Primary Agents**: `analyze`, `build`, `plan`, `release` (defined in `.opencode/agents/`)
44+
- **Commands**: 13 commands with slash syntax (defined in `.opencode/commands/`)
45+
- **CLI Tool**: `.opencode/bin/note.py` — creates YAML-frontmatter notes
46+
- **Documentation**: `docs/` with MkDocs material theme
47+
48+
### Core Pattern: Mode → Command → Subagent Hierarchy
49+
The framework enforces a disciplined workflow: agents provide context modes, commands provide structured workflows, and subagents handle specialized tasks.
50+
51+
---
52+
53+
## Findings
54+
55+
### Strengths
56+
57+
1. **Consistent YAML Frontmatter Standard** — Agent and command definitions follow a well-structured frontmatter pattern with consistent fields (`description`, `mode`, `permission`)
58+
59+
2. **Phase-Based Workflows** — Commands like `research.md`, `plan.md`, and `audit.md` define clear phase-based workflows with explicit constraints
60+
61+
3. **Excellent Output Templates**`investigator.md` and `audit.md` provide comprehensive output templates with examples
62+
63+
4. **Structured Knowledge Storage** — The `.knowledge/` directory with `notes/`, `plans/`, `log/`, `drafts/` separation is well-designed
64+
65+
5. **No Cyclomatic Complexity Issues** — All files are appropriately sized; no hotspots detected
66+
67+
6. **Modern Python Script**`note.py` uses type hints, pathlib, and modern patterns (inline deps)
68+
69+
7. **Clear Separation of Concerns** — Agents, commands, and subagents have distinct responsibilities
70+
71+
8. **Test-Commit-Revert Discipline** — The framework enforces TCR for build operations with clear guidance
72+
73+
### Concerns
74+
75+
| Area | Severity | Description | Location | Recommendation |
76+
| --------------------------- | ------------ | ----------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- | ------------------------------------------------------------ |
77+
| Permission Bug | **Critical** | Typo in `plan.md`: `.knowledege/plans/*` instead of `.knowledge/plans/*` | `.opencode/agents/plan.md:8` | Fix typo immediately |
78+
| Missing Subagent Permission | **High** | `investigator` subagent used in plan.md content but not declared in frontmatter `task:` permissions | `.opencode/agents/plan.md` | Add `investigator` to task permissions |
79+
| Documentation Drift | **High** | 8+ documented commands not implemented; 5+ agent names in docs don't exist | `docs/design.md`, `docs/user-guide.md`, `README.md` | Audit and align docs with actual implementations |
80+
| YAML Frontmatter Violation | **High** | 4 of 7 checked knowledge files don't follow the standard format (missing `id`, `created`, `type`, `status`) | `.knowledge/notes/*.md`, `.knowledge/plans/*.md`, `.knowledge/drafts/*.md` | Add frontmatter to all knowledge files |
81+
| Makefile Incomplete | **High** | `lint` target is empty but `all` depends on it; `format` target declared but undefined | `makefile` | Implement or remove dependencies |
82+
| Gitignore Incomplete | **Medium** | `.opencode/node_modules/` and `.opencode/bun.lock` not gitignored | `.gitignore` | Add these patterns |
83+
| Missing `mode` Field | **Medium** | `build.md` missing `mode: primary` in frontmatter unlike other agents | `.opencode/agents/build.md` | Add consistent frontmatter |
84+
| Unregistered Subagent | **Medium** | `general` subagent referenced in `build.md` but not in AGENTS.md registry | `.opencode/agents/build.md:25` | Register or remove `general` |
85+
| Empty Test Suite | **Medium** | `make test` does nothing; placeholder test always passes | `tests/test_placeholder.py` | Implement actual tests or document TCR as primary validation |
86+
| Race Condition | **Low** | `note.py` checks file existence then writes without atomic operation | `.opencode/bin/note.py:71-78` | Use `Path.write_text` directly with error handling |
87+
88+
### Technical Debt
89+
90+
| Item | Severity | Location | Description |
91+
| ---------------------- | -------- | ------------------------------ | ------------------------------------------------------------------------------------ |
92+
| Permission typo | High | `.opencode/agents/plan.md:8` | `.knowledege/plans/*` → should be `.knowledge/plans/*` |
93+
| Documentation drift | High | `docs/design.md:8-28` | References non-existent agents: `query`, `research`, `brainstorm`, `write`, `review` |
94+
| Missing commands | Medium | `README.md`, `docs/*.md` | `/brainstorm`, `/document`, `/cron`, `/learn` documented but not implemented |
95+
| Frontmatter violations | Medium | `.knowledge/drafts/*.md` | 4+ knowledge files lack required YAML frontmatter |
96+
| Gitignore gaps | Medium | `.gitignore` | `node_modules/`, `bun.lock`, `*.pyc` not ignored |
97+
| Unregistered subagent | Low | `.opencode/agents/build.md:25` | `general` subagent used but not in AGENTS.md registry |
98+
| Typo in README | Low | `README.md:49` | "oppinionanted" → "opinionated" |
99+
| Typo in note.py | Low | `.opencode/bin/note.py:81` | "NOT being saved" → "NOT been saved" |
100+
101+
### Minor Issues (Actionable but Low Priority)
102+
103+
1. **Outdated path references** in `docs/develop.md` (lines 117, 130) — references old paths like `plans/`, `research/` instead of `.knowledge/plans/`, etc.
104+
2. **Commit scope confusion**`docs(research)` scope unclear; should align with directory structure
105+
3. **README references old commands** — Still mentions `gemini /onboard` instead of `opencode /onboard`
106+
4. **MkDocs serve dependencies**`makefile` doesn't declare `mkdocs` as a dependency
107+
108+
---
109+
110+
## Recommendations
111+
112+
### Priority 1: Fix Critical Bugs
113+
1. Fix typo in `.opencode/agents/plan.md` line 8: `.knowledege/plans/*``.knowledge/plans/*`
114+
2. Add `investigator` to `plan.md`'s `task:` permissions block
115+
116+
### Priority 2: Align Documentation with Implementation
117+
1. Audit `README.md` and remove references to unimplemented commands (`/brainstorm`, `/document`, `/cron`, `/learn`)
118+
2. Update `docs/design.md` and `docs/user-guide.md` to reference actual agent names (`analyze`, `build`, `plan`, `release` instead of `query`, `research`, `brainstorm`)
119+
3. Update `docs/develop.md` path references to use `.knowledge/` prefixes
120+
121+
### Priority 3: Enforce YAML Frontmatter Standard
122+
1. Add frontmatter to all files in `.knowledge/drafts/` and any `.knowledge/plans/` files missing it
123+
2. Standardize on the format: `id`, `created`, `modified`, `type`, `status` (plus optional fields)
124+
125+
### Priority 4: Complete Makefile Implementation
126+
1. Either implement `lint` target (e.g., markdown lint, Python lint) or remove it from `all` dependencies
127+
2. Either implement `format` target or remove from `.PHONY`
128+
3. Add `install-hooks` target referenced in `docs/develop.md`
129+
4. Add standard `help` target for self-documenting makefile
130+
131+
### Priority 5: Improve Git Hygiene
132+
1. Add to `.gitignore`:
133+
```
134+
.opencode/node_modules/
135+
.opencode/bun.lock
136+
*.pyc
137+
.pytest_cache/
138+
```
139+
2. Consider adding a `.gitignore` entry for IDE files (`.idea/`, `*.swp`)
140+
141+
### Priority 6: Registry Alignment
142+
1. Register `general` subagent in AGENTS.md's Subagent Registry if it's intentionally used
143+
2. Audit command files vs AGENTS.md command registry listing
144+
3. Add `mode: primary` to `build.md` frontmatter for consistency
145+
146+
### Priority 7: Test Coverage
147+
1. Document that TCR is the primary validation mechanism (already in `docs/develop.md`)
148+
2. If keeping unit tests, implement actual test cases in `tests/test_placeholder.py`
149+
3. Consider adding integration tests for `note.py`
150+
151+
---
152+
153+
## Compliance Scores
154+
155+
| Category | Score | Notes |
156+
| --------------------- | ----- | ------------------------------------------------ |
157+
| Architecture Patterns | 75% | Core patterns solid; permission system has bugs |
158+
| Code Quality | 85% | No complexity hotspots; minor issues in note.py |
159+
| Standards Compliance | 65% | YAML frontmatter violations; incomplete makefile |
160+
| Technical Debt | 60% | Critical bugs + documentation drift |
161+
162+
**Overall: 68%** — Solid foundation with significant cleanup needed
163+
164+
---
165+
166+
## Appendix: Files Analyzed
167+
168+
### Agents (9 files)
169+
- `.opencode/agents/analyze.md`
170+
- `.opencode/agents/build.md`
171+
- `.opencode/agents/plan.md`
172+
- `.opencode/agents/release.md`
173+
- `.opencode/agents/scout.md`
174+
- `.opencode/agents/investigator.md`
175+
- `.opencode/agents/critic.md`
176+
- `.opencode/agents/tester.md`
177+
- `.opencode/agents/drafter.md`
178+
179+
### Commands (13 files)
180+
- `.opencode/commands/research.md`
181+
- `.opencode/commands/plan.md`
182+
- `.opencode/commands/onboard.md`
183+
- `.opencode/commands/audit.md`
184+
- `.opencode/commands/build.md`
185+
- `.opencode/commands/fix.md`
186+
- `.opencode/commands/draft.md`
187+
- `.opencode/commands/commit.md`
188+
- `.opencode/commands/publish.md`
189+
- `.opencode/commands/investigate.md`
190+
- `.opencode/commands/note.md`
191+
- `.opencode/commands/todo.md`
192+
- `.opencode/commands/todowrite.md`
193+
194+
### Scripts & Config
195+
- `.opencode/bin/note.py`
196+
- `opencode.json`
197+
- `.opencode/package.json`
198+
- `makefile`
199+
- `mkdocs.yml`
200+
- `.gitignore`
201+
202+
### Documentation
203+
- `README.md`
204+
- `docs/develop.md`
205+
- `docs/design.md`
206+
- `docs/user-guide.md`
207+
- `AGENTS.md`
208+
209+
### Knowledge Files
210+
- `.knowledge/notes/*.md` (3 files)
211+
- `.knowledge/plans/*.md` (4 files)
212+
- `.knowledge/drafts/*.md` (2 files)
213+
- `.knowledge/log/*.md` (1 file)

.knowledge/plans/refactor-framework-submodule-architecture.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ status: active
77
expires: 2026-04-03
88
phases:
99
- name: Create opencode-core Repository
10-
done: false
10+
done: true
1111
goal: Extract framework components into standalone repository
1212
- name: Rename Current Repository
13-
done: false
13+
done: true
1414
goal: Rename starter to opencode for clarity
1515
- name: Implement Dual-Mode Installer
1616
done: false
@@ -270,9 +270,8 @@ cd project && git submodule update --init --recursive
270270

271271
## Related
272272

273-
- **Current Repository:** `https://github.com/apiad/starter.git`
274-
- **New Framework Repository:** `https://github.com/apiad/opencode-core.git` (to be created)
275-
- **Renamed Repository:** `https://github.com/apiad/opencode.git` (after rename)
273+
- **Framework Repository:** `https://github.com/apiad/opencode-core.git`
274+
- **Wrapper Repository:** `https://github.com/apiad/opencode.git` ✓ (renamed from starter)
276275

277276
---
278277

0 commit comments

Comments
 (0)