Files
claude-code/plans/structured-purring-whistle.md
OpenCode Test 7c37e9adb3 Add OpenCode sync enhancement plan and future consideration
- Add fc-047: Consider JSON minification for OpenCode instructions
- Add brainstorming plan for OpenCode Claude sync enhancements
- Add implementation status plan

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 12:15:33 -08:00

3.0 KiB

Implementation Plan: OpenCode Claude Sync Enhancements

Overview

Transpose Claude Code agent/skill setup to OpenCode in parallel, per decisions from brainstorming session (enumerated-giggling-scone.md).

Key Decisions (from brainstorming)

Decision Value
Primary agent Use built-in build (don't port PA)
Agents to skip personal-assistant, master-orchestrator
Other agents All become mode: subagent
Model inheritance Use model: inherit for subagents
State sharing Reference via instructions, don't copy
Source of truth Claude Code (~/.claude/)

Files to Modify

  1. ~/.config/opencode/scripts/claude_sync.py - Main sync script
  2. ~/.config/opencode/opencode.json - Config file

Files to Create

  1. ~/.config/opencode/README.md - Documentation

Implementation Steps

Step 1: Backup (DONE)

Created backups:

  • ~/.config/opencode-backup-20260107_120135.tar.gz
  • ~/opencode-home-backup-20260107_120136.tar.gz

Step 2: Enhance claude_sync.py

Location: ~/.config/opencode/scripts/claude_sync.py

Modifications:

  1. Add constants near top of file:
SKIP_AGENTS = {"personal-assistant", "master-orchestrator"}

MODEL_MAP = {
    "opus": "anthropic/claude-opus-4",
    "sonnet": "anthropic/claude-sonnet-4-5",
    "haiku": "anthropic/claude-haiku-4-5",
}
  1. Modify transform_frontmatter() for agents:

    • Check if agent name in SKIP_AGENTS, return None to signal skip
    • Add frontmatter["mode"] = "subagent"
    • Set frontmatter["model"] = "inherit"
    • Map explicit models using MODEL_MAP
  2. Modify sync_tree() to handle None return from transform (skip file)

  3. Update expected_dest_paths_for_tree() to exclude skipped agents

Step 3: Run Sync

python3 ~/.config/opencode/scripts/claude_sync.py --dry-run
python3 ~/.config/opencode/scripts/claude_sync.py
python3 ~/.config/opencode/scripts/claude_sync.py --clean --apply

Step 4: Update opencode.json

Add to existing config:

{
  "model": "anthropic/claude-sonnet-4-5",
  "small_model": "anthropic/claude-haiku-4-5",
  "instructions": [
    "~/.claude/CLAUDE.md",
    "~/.claude/state/kb.json",
    "~/.claude/state/personal-assistant/memory/facts.json",
    "~/.claude/state/personal-assistant/memory/preferences.json"
  ],
  "permission": {
    "edit": "ask",
    "bash": {
      "*": "ask",
      "pacman -Q*": "allow",
      "systemctl status*": "allow",
      "kubectl get*": "allow"
    }
  }
}

Step 5: Test

  • Run opencode and verify skill discovery
  • Test @linux-sysadmin subagent invocation
  • Verify permissions work

Step 6: Create README.md

Document:

  • Architecture (Claude Code as source of truth)
  • Sync workflow
  • Agent mapping table
  • How to invoke subagents

Step 7: Add Future Consideration

Add entry to ~/.claude/state/future-considerations.json about JSON minification for large instruction files.

Estimated Time

~2 hours total (Step 1 already done)