Please look at our adapter implementation.
Soon, opencode is moving to a sqlite based storage model. The sqlite branch is here: https://github.com/anomalyco/opencode/tree/sqlite2
In a new worktree and project, create an adapter for the new sqlite based adapter, provide a plan for local testing with the new opencode nightly builds.
Planning adapter inspection and setup
Searching for adapter implementations
Inspecting CLI agents
Checking docs for agents
Inspecting existing adapter files
Listing adapters directory contents
Reviewing TypeScript file
Searching tests for adapter
Planning new SQLite adapter
Inspecting tests and fixtures related to opencode
Identifying additional test sections
Inspecting fixture directory
Considering recursive fixture loading
Reviewing schema-related files
Inspecting cursor adapter usage
Planning reuse of readonly SQLite adapter
Planning remote branch inspection
Preparing separate git worktree
Reviewing worktree creation script
>git worktree list>git status --short --branchPlanning new worktree branch
>lsPlanning worktree creation
>scripts/new-worktree.sh feat/opencode-sqlite-adapter --newPlanning new project clone
>lsPreparing clone with depth and branch
>git clone --depth 1 --branch beta https://github.com/anomalyco/opencode.git opencode-beta-projectSearching opencode-beta for schema
Inspecting key schema and query files
Planning data shape inspection
Exploring global storage path
Identifying cross-platform data dir path
Inspecting migration for storage paths
Planning dual-format adapter support
Defining sourcePath for sqlite traces
Inspecting config update feasibility
Reviewing dependencies and tests
Designing adapter for dual storage modes
Designing SQLite fixture and detection
>git status --short --branchEvaluating bun.lock modifications
Planning extensive adapter refactor
Planning SQLite fixture setup
Reviewing test coverage and fixtures
Designing comprehensive SQLite adapter rewrite
Refining constructor logic and SQLite JSON parsing
Updating config path comment
Adding SQLite database import
Adding opencode fixture and cleanup
Adding SQLite fixture function
Fixing patch insertion approach
Adding SQLite precedence tests
Preparing targeted adapter tests
>bun test test/core/adapters.test.tsRunning full CLI tests
>bun testInspecting lockfile changes
>git status --shortDeciding to revert bun.lock changes
>git checkout -- bun.lock>git status --short