Skip to content

docs(rewrite): spec and implementation plan for M1, Go session store over the existing SQLite - #1132

Closed
ElioNeto wants to merge 2 commits into
developfrom
docs/m1-go-session-store-spec
Closed

docs(rewrite): spec and implementation plan for M1, Go session store over the existing SQLite#1132
ElioNeto wants to merge 2 commits into
developfrom
docs/m1-go-session-store-spec

Conversation

@ElioNeto

@ElioNeto ElioNeto commented Sep 9, 2026

Copy link
Copy Markdown
Owner

What

Design spec and implementation plan for M1, the first of four milestones towards reading and continuing Claude Code and Codex sessions from teamcode. M1 makes go-core able to own session persistence on the same opencode.db and drizzle schema the TypeScript side uses today, without changing TypeScript behavior.

Files:

  • docs/rewrite/spec-m1-go-session-store.md
  • docs/rewrite/plan-m1-go-session-store.md (14 tasks, tests first, full code per step)

Decisions recorded

  • SQLite in Go (modernc.org/sqlite, no cgo) over the existing file and schema; ApexStore stays on the roadmap phase.
  • Schema ownership stays with the TS drizzle migrations; go-core verifies __drizzle_migrations (max(created_at) = 1781910501000) and runs degraded (503 schema_outdated) when behind.
  • message.data and part.data are opaque JSON in Go; only step-finish cost and tokens are read, for session usage counters.
  • /v1/session/* mirrors Session.Service method by method with the TS wire shapes; existing /session/* stays until M2.
  • Event log rewritten with per-session seq, replay ring and no silent drops (internal/eventlog); legacy internal/eventbus stays for /session/events until M2.
  • Test plan: Go unit tests over a DB built by replaying the TS migrations, cross-language id fixture generated from id.ts, TS-vs-Go parity by table dump, concurrency on one file, 50k-message read budget, CI job for go-core/.

Follow-ups (not in this PR)

Execution of the plan (separate PRs per task group), then M2 (TS talks to go-core, dual write), M3 (Claude Code and Codex converters in Go), M4 (TUI list, import --from, external_session tool).

🤖 Generated with Claude Code

elio-neto and others added 2 commits September 9, 2026 11:26
…g SQLite

First of four milestones towards reading and continuing Claude Code and
Codex sessions from teamcode. M1 makes go-core able to own session
persistence on the same opencode.db and drizzle schema the TypeScript
side uses today, without changing TypeScript behavior.

Covers file opening rules, schema ownership and the degraded mode when
the schema is outdated, the data model with opaque JSON for message and
part payloads, the id scheme, the write rules copied from the TS
projectors, the /v1/session HTTP surface, the rewritten event bus with
per-session sequence and replay, TS and Go coexistence on one file, and
the test plan including TS-vs-Go parity and a concurrency test.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Fourteen tasks with tests first: SQLite opening and schema check,
TS-compatible ids with a cross-language fixture, session, message,
part, todo and fork persistence, sequenced event log, /v1/session and
/v1/events handlers with degraded mode, TS-versus-Go parity by table
dump, single-file concurrency, read budget, CI job and cleanup of the
unused JSON session store.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@ElioNeto ElioNeto changed the title docs(rewrite): spec M1, Go session and message store over the existing SQLite docs(rewrite): spec and implementation plan for M1, Go session store over the existing SQLite Sep 9, 2026
@sonarqubecloud

sonarqubecloud Bot commented Sep 9, 2026

Copy link
Copy Markdown

@ElioNeto

ElioNeto commented Sep 9, 2026

Copy link
Copy Markdown
Owner Author

Superseded by #1133, which carries the same spec and plan plus the edits made during implementation (§3.2 column-shape check, §4.2 fork body and list rules, §7.5 no-race budget). Branch deleted.

@ElioNeto ElioNeto closed this Sep 9, 2026
@ElioNeto
ElioNeto deleted the docs/m1-go-session-store-spec branch September 9, 2026 21:25
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.

2 participants