Skip to content

docs: OpenCode integration design#42

Open
JayantDevkar wants to merge 3 commits intomainfrom
worktree-opencode-integration-design
Open

docs: OpenCode integration design#42
JayantDevkar wants to merge 3 commits intomainfrom
worktree-opencode-integration-design

Conversation

@JayantDevkar
Copy link
Owner

Summary

  • Adds a design document for integrating OpenCode session monitoring into claude-karma
  • Researched OpenCode's data storage: SQLite database (opencode.db) with 4 core tables (Session, Message, Part, Project) vs Claude Code's JSONL files
  • Proposes a SessionSource abstraction layer so both Claude Code and OpenCode parsers conform to a common protocol
  • Covers data model mapping, new module structure, router merge pattern, and frontend source filter/badge components

Key Design Decisions

  • Read OpenCode's SQLite DB directly using Python stdlib sqlite3 (read-only)
  • Graceful degradation — if opencode.db doesn't exist, OpenCode features silently disabled
  • Unified views with source badges (blue = Claude Code, green = OpenCode) and filter toggles
  • Backward compatible — existing models default to source="claude_code"

References

Test plan

  • Review design doc for completeness and accuracy
  • Validate OpenCode SQLite schema against actual opencode.db on a machine with OpenCode installed
  • Confirm data model mapping covers all session/message/tool types

🤖 Generated with Claude Code

JayantDevkar and others added 3 commits March 3, 2026 01:37
Research and design for adding OpenCode session support to claude-karma.
Covers data model mapping (SQLite → Pydantic), SessionSource abstraction
layer, module structure, and frontend source filter/badge components.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Rewrote the design document based on actual OpenCode database analysis:
- Corrected schema from 4 tables to 8 (added todo, permission, session_share, control_account)
- Documented JSON blob architecture (message.data, part.data) with real examples
- Expanded part types from 7 to 11 (added step-start/finish, patch, compaction, agent, retry)
- Added feature parity matrix: 13 full, 7 partial, 10 Claude-Code-only, 6 OpenCode-only
- Added field-level data mappings for all models
- Added timeline event mapping for all 11 part types
- Added SQLite metadata DB integration strategy
- Resolved data_source vs session_source naming conflict
- Added 5-phase implementation plan with acceptance criteria

Passed Critic re-review (all 12 original gaps addressed).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add complete Router Classification table (17/17 routers classified)
- Add Verified Data Gaps section with real DB findings (git branches,
  cost always $0, 6/12 part types exist, plan mode is message-level)
- Expand Feature Parity Matrix with 7 new rows (plans, agent analytics,
  subagent detail, archived prompts, skills browser, live sub-statuses)
- Add Derived Metrics with verified SQL formulas and NULLIF guards
- Correct Timeline Event Mapping with verification status column
- Update Module Structure with all 17 routers
- Fix part type count (11 → 12), reconcile plans.py terminology,
  note SCHEMA_VERSION bump for metadata DB migration

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant