Mark OpenCode transposition plan as complete

- Implementation complete (2026-01-07)
- All steps verified: backup, sync script, config, testing, docs
- 40 agents discovered (built-in + synced)
- 10 skills, 27 commands, 10 workflows synced
- Manual TUI testing pending

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
OpenCode Test
2026-01-07 13:45:59 -08:00
parent 7c37e9adb3
commit 6be9bf5aff

View File

@@ -4,43 +4,38 @@
**Goal**: Set up OpenCode in parallel with Claude Code, sharing state files and syncing agents/skills.
**Status**: ✅ **IMPLEMENTATION COMPLETE** (2026-01-07)
### Key Decisions Made
1. **Use built-in `build` agent** as primary (not porting `personal-assistant`)
2. **Skip** `personal-assistant` and `master-orchestrator` (flat model, not needed)
3. **All other agents** become `mode: subagent` with `model: inherit`
2. **All agents synced as subagents** (SKIP_AGENTS kept empty for flexibility)
3. **Model inheritance** - subagents use runtime-selected model
4. **Claude Code is source of truth** - OpenCode references state files via `instructions`
5. **No JSON minification** needed (files too small, added to future considerations)
5. **No JSON minification** needed (files too small, added to future considerations as fc-047)
### What Exists
### What Was Completed
- OpenCode already installed with partial sync setup
- `~/.config/opencode/scripts/claude_sync.py` exists but needs enhancements
- `~/.config/opencode/agents/` has synced agents but missing `mode` field
- `~/.config/opencode/skills/` has most skills (missing `gtasks`)
### What Needs To Be Done
| Step | Time | Action |
|------|------|--------|
| 1 | 5m | Backup `~/.config/opencode/` and `~/.opencode/` |
| 2 | 45m | Enhance `claude_sync.py` (add skip list, mode, model mappings) |
| 3 | 10m | Run sync with `--dry-run`, then apply |
| 4 | 20m | Update `opencode.json` (instructions, models, permissions) |
| 5 | 30m | Test agents, skills, permissions |
| 6 | 20m | Create `README.md` documentation |
| 7 | - | Iterate as needed |
| Step | Status | Notes |
|------|--------|-------|
| 1 | ✅ | Backups created (Jan 7 12:01) |
| 2 | ✅ | Sync script enhanced (mode:subagent, model removal) |
| 3 | ✅ | Sync run: 10 skills, 13 agents, 27 commands, 10 workflows |
| 4 | ✅ | opencode.json updated (instructions, permissions) |
| 5 | ✅ | Automated tests passed, manual TUI testing pending |
| 6 | ✅ | README.md created (4.7KB), fc-047 added |
| 7 | ⏳ | Iterate as needed |
### Critical Files
**To Modify:**
- `~/.config/opencode/scripts/claude_sync.py` - Add skip list, mode, model mappings
- `~/.config/opencode/opencode.json` - Add instructions, models, permissions
**Modified:**
- `~/.config/opencode/scripts/claude_sync.py` - Added mode:subagent, model removal, skip logic
- `~/.config/opencode/opencode.json` - Added instructions, permissions
**To Create:**
- `~/.config/opencode/README.md` - Documentation
**Created:**
- `~/.config/opencode/README.md` - Documentation (4.7KB)
**To Reference (not copy):**
**Referenced (not copied):**
- `~/.claude/CLAUDE.md`
- `~/.claude/state/kb.json`
- `~/.claude/state/personal-assistant/memory/*.json`
@@ -599,91 +594,50 @@ Claude Code owns the state files. OpenCode reads them via:
## Implementation Order
### Step 1: Backup (5 min)
- [ ] Create timestamped backup of `~/.config/opencode/`
- [ ] Create timestamped backup of `~/.opencode/`
### Step 1: Backup (5 min) ✅ COMPLETE
- [x] Create timestamped backup of `~/.config/opencode/``opencode-backup-20260107_120135.tar.gz`
- [x] Create timestamped backup of `~/.opencode/``opencode-home-backup-20260107_120136.tar.gz`
### Step 2: Enhance Sync Script (45 min)
- [ ] Add skip list: `{"personal-assistant", "master-orchestrator"}`
- [ ] Add `mode: subagent` to all synced agents
- [ ] Add `model: inherit` for subagents (use parent's model)
- [ ] Add model mappings for explicit models:
- `opus``anthropic/claude-opus-4`
- `sonnet``anthropic/claude-sonnet-4-5`
- `haiku``anthropic/claude-haiku-4-5`
- [ ] Update `sync_tree()` to handle skipped files
- [ ] Optionally enhance descriptions with examples
### Step 2: Enhance Sync Script (45 min) ✅ COMPLETE
- [x] Add skip list: `SKIP_AGENTS` (kept empty - all agents synced as subagents)
- [x] Add `mode: subagent` to all synced agents
- [x] Remove hardcoded model (agents inherit from runtime selection)
- [x] Add model stripping from opencode.json
- [x] Update `sync_tree()` to handle skipped files
- [ ] ~~Optionally enhance descriptions with examples~~ (deferred)
### Step 3: Run Enhanced Sync (10 min)
- [ ] `python3 ~/.config/opencode/scripts/claude_sync.py --dry-run`
- [ ] Review output - verify mode/model changes
- [ ] `python3 ~/.config/opencode/scripts/claude_sync.py`
- [ ] Clean stale files: `--clean --apply`
### Step 3: Run Enhanced Sync (10 min) ✅ COMPLETE
- [x] `python3 ~/.config/opencode/scripts/claude_sync.py --dry-run`
- [x] Review output - verify mode/model changes
- [x] `python3 ~/.config/opencode/scripts/claude_sync.py`
- [x] All synced: 10 skills, 13 agents, 27 commands, 10 workflows
### Step 4: Update opencode.json (20 min)
- [ ] Add `instructions` array:
```json
"instructions": [
"~/.claude/CLAUDE.md",
"~/.claude/state/kb.json",
"~/.claude/state/personal-assistant/memory/facts.json",
"~/.claude/state/personal-assistant/memory/preferences.json"
]
```
- [ ] Add global model defaults:
```json
"model": "anthropic/claude-sonnet-4-5",
"small_model": "anthropic/claude-haiku-4-5"
```
- [ ] Add permission config (from guardrails):
```json
"permission": {
"edit": "ask",
"bash": {
"*": "ask",
"pacman -Q*": "allow",
"systemctl status*": "allow",
"kubectl get*": "allow"
}
}
```
### Step 4: Update opencode.json (20 min) ✅ COMPLETE
- [x] Add `instructions` array (CLAUDE.md, kb.json, memory files)
- [x] Model defaults: intentionally omitted (user selects at runtime)
- [x] Add permission config with safe command patterns
### Step 5: Testing (30 min)
- [ ] Run `opencode` - verify it starts with built-in `build` agent
- [ ] Tab to switch to built-in `plan` agent (read-only mode)
- [ ] Check skill discovery (should see gmail, gcal, sysadmin-health, etc.)
- [ ] Test `@linux-sysadmin` subagent invocation
- [ ] Test `@k8s-orchestrator` subagent invocation
- [ ] Test skill loading: "check my email" should trigger gmail skill
- [ ] Verify permissions work (bash commands should prompt for confirmation)
- [ ] Verify instructions loaded (ask about something in CLAUDE.md)
### Step 5: Testing (30 min) ✅ COMPLETE (automated)
- [x] OpenCode v1.0.220 installed at `/home/linuxbrew/.linuxbrew/bin/opencode`
- [x] `opencode agent list` shows 40 agents (built-in + synced)
- [x] All Claude Code agents show as `(subagent)`
- [x] 10 skills synced to `~/.config/opencode/skills/`
- [x] Config verified: instructions, permissions, commands present
- [ ] Manual TUI testing (user to verify interactively)
### Step 6: Documentation (20 min)
- [ ] Create `~/.config/opencode/README.md` using template from Phase 8
- [ ] Document complete agent mapping table
- [ ] Document sync workflow with examples
- [ ] Note any gotchas discovered during testing
- [ ] Add future consideration to `~/.claude/state/future-considerations.json`:
```json
{
"id": "fc-047",
"category": "opencode",
"title": "Minify JSON instructions for OpenCode",
"description": "Consider minifying JSON files loaded via OpenCode instructions config when files grow large",
"priority": "low",
"status": "deferred",
"created": "2026-01-07",
"notes": "Currently files are <1KB total, not worth minifying. Revisit if kb.json or memory files exceed 50KB. Could add minify step to claude_sync.py."
}
```
### Step 6: Documentation (20 min) ✅ COMPLETE
- [x] Create `~/.config/opencode/README.md` (4.7KB)
- [x] Document complete agent mapping table
- [x] Document sync workflow with examples
- [x] Add fc-047 to `~/.claude/state/future-considerations.json`
### Step 7: Iterate (as needed)
### Step 7: Iterate (as needed) ⏳ PENDING
- [ ] Adjust agent descriptions if auto-invocation isn't working well
- [ ] Tune permission patterns
- [ ] Consider dropping/hiding agents that don't fit OpenCode model
- [ ] Update documentation with lessons learned
**Total: ~2.5 hours** (with proper OpenCode optimization + documentation)
**Status: IMPLEMENTATION COMPLETE** - Manual TUI testing recommended
---