r/opencodeCLI • • 1d ago

Built a local SQLite memory layer for OpenCode CLI (0 MB idle daemon, read_file packs, diff-locked rules)

Post image

When you run OpenCode CLI across multiple providers and repos, flat AGENTS.md files or Obsidian folders start breaking down fast: fixes from one repo bleed into unrelated sessions, models occasionally overwrite rules you already verified by hand, and MCP memory servers add constant schema overhead on every turn.

I built Slipdex (v0.4, MIT) on Node 22+ built-in node:sqlite (or Bun bun:sqlite) with zero external npm dependencies and no background daemon.

How it works inside an OpenCode CLI workflow: - slipdex init --no-mcp wires a compact SKILL.md and AGENTS.md pack index so OpenCode reads only the matching packs/<domain>.md via read_file with zero MCP tool clutter. - Even on a fresh session, a tiny startup radar gives OpenCode your active context and domain pointers without dumping a giant global markdown file, and slipdex recall pulls older slips on demand via FTS5 BM25. - Separate local SQLite WAL vaults isolate engineering, project:<slug>, gated on-demand vaults behind short-lived leases, an optional Identity Card, and an encrypted write-only journal. - Human-verified notes are diff-locked at the SQLite layer: agent edits open reviewable proposals with append-only history instead of silently mutating head. - On-demand local Studio (slipdex ui) gives you a draggable domain graph, token-budget preview, and 1-click import from existing AGENTS.md, CLAUDE.md, Obsidian vaults, and session logs, then shuts down cleanly when idle.

GitHub (MIT): https://github.com/phosphorhouse/slipdex Browser demo (sample data, no install): https://phosphorhouse.github.io/slipdex/demo/

Quick setup: npm install -g git+https://github.com/phosphorhouse/slipdex.git && slipdex init --no-mcp

13 Upvotes

4 comments sorted by

2

u/hieuphung97 1d ago

Diff-locking verified rules at the SQLite layer is the killer feature here. Agents constantly drop negative constraints when allowed direct markdown writes. Having append-only proposals instead of silent head mutations eliminates that entire regression class.

1

u/phosphorhouse 1d ago

Exactly that failure mode. Whenever an agent rewrites a markdown rules file, never do that, constraints quietly get softened or dropped during refactor. Enforcing the lock with sqlite triggers (plus flagging conflicts against pinned rules before write) made it impossible for a session to overwrite them without leaving a reviewable diff.

Next thing I want to add is auto injecting matching locked constraints mid session whenever a long chat drifts into another domain.

2

u/Wylie_Pujole 1d ago

stops the file mutation, sure, though models still ignore negative constraints in the prompt even when the text stays intact

1

u/hieuphung97 23h ago

True, passive prompt prose decays fast. The only reliable fix is pairing the diff lock with deterministic pre-tool assertions—if an edit introduces a forbidden import or removes an invariant, the hook rejects the tool call automatically.