# Repository Briefing: tickernelz/opencode-mem
> Source: https://repoforai.com/repo/tickernelz/opencode-mem (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/tickernelz/opencode-mem
- **Official Docs / Website**: https://opencode-mem.zhafron.my.id
- **Category**: Coding, Skills & MCP (AI 编程 / Skills / MCP)
- **Primary Language**: TypeScript
- **License**: MIT
- **Engineering Health**: A+ (92/100 · Maintenance 35/35 · Adoption 17/25 · Releases 20/20 · License 20/20)
- **Latest Release**: v2.44.0 (2026-11-24) — https://github.com/tickernelz/opencode-mem/releases
- **Review Snapshot**: 2026-12-02
- **Deployment / Stack Signals**: Local AI, Self-Hosted
- **Momentum**: 1,917 ★ total (+5 24h / +27 7d) · 199 forks
- **Topics**: `ai`, `libsql`, `memory`, `opencode`, `opencode-plugin`, `turso`, `vector-database`
- **When to Use**: Best for: OpenCode users who repeatedly revisit the same projects and want selective recall of decisions, debugging history and working preferences without operating a separate vector database. Skip if: You mainly need always-on instructions, need a shared store across multiple OpenCode processes on Windows, run on Alpine or an Intel Mac, or cannot approve the data paths required by your chosen providers.

## Overview
```text
### Architecture & Core Mechanics
opencode-mem is a TypeScript extension loaded by OpenCode itself. When a session goes idle, a background model request extracts durable project memories from the technical work. The plugin embeds and stores those memories under `storagePath`; at recall time it can supply relevant records and the cross-project user profile as model context. In OpenCode v2, that context goes into the system layer rather than the authored prompt or chat transcript. The default `chatMessage.injectOn: "first"` retains the initial context across turns; `"always"` refreshes it on each authored user turn. After a restart, a resumed session rebuilds context from the current store, so it may not see exactly what it saw before.

The manifest includes `@opencode-ai/plugin`, `@opencode-ai/sdk`, `@libsql/client` and `@tursodatabase/database`. The current embedded Turso path stores vectors as `F32_BLOB` and uses `vector_distance_cos` for exact ranking; an optional hybrid ranking path adds keyword signals without FTS5. Session lookups use an indexed `session_id`, while `src/services/turso/schema-migrations.ts` applies pending `PRAGMA user_version` migrations to memory shards and auxiliary databases. For source checkouts, the root `index.js` and `tui.js` bridge OpenCode to the built plugin and its TUI companion.

### Key Capabilities & Differentiators
Automatic capture and user-profile learning need a provider capable of structured or tool-call output. You can reuse an OpenCode-configured provider and model, or configure a separate API such as OpenAI Chat Completions, OpenAI Responses or Anthropic. Embedding is independent of that choice: the plugin offers more than a dozen CPU-capable local models, with `Xenova/nomic-embed-text-v1` as the default, or an OpenAI-compatible embedding endpoint. Manual `memory` add, search and list still work without a capture provider, provided embeddings are available.

Memory maintenance includes deduplication, optional updates during capture and optional consolidation with recoverable trash. An optional Markdown vault and export, import and migrate operations support project portability. The web UI brings together a memory–prompt timeline, profile, skill library, vault and health statistics. Before capture requests, the plugin redacts recognizable credentials from the context sent to the configured provider, including a fallback; it sanitizes generated summaries and tags again before embedding and storage. Explicit adds use the same write boundary. Optional AES-256-GCM encryption protects local Turso shards at rest, but the key must be backed up separately to keep encrypted data recoverable.

### Trade-offs & Limitations
Compared with `AGENTS.md`, vector recall is better suited to accumulated decisions, failed approaches and bug patterns, but it is not a reliable place for mandatory instructions: retrieval is selective, and default first-turn context is not refreshed on every user turn. Skills are the better fit for procedures loaded on demand. Compared with a separate vector service, embedding Turso removes a deployment dependency. Its exact cosine search has no approximate vector index, though, so check recall cost against the size of your actual shards rather than assuming it stays flat as history grows.

Local embeddings trade provider dependency for CPU, RAM and cache use. A remote embedding or capture provider reduces local processing for that task but sends the corresponding text outside the host; best-effort redaction can miss custom or split credentials and does not cover OpenCode’s main-model or tool traffic. Shared storage also has limits: Linux and macOS use experimental multiprocess WAL for concurrent OpenCode processes, while Windows supports one database owner at a time. Avoid a separate SQLite writer against the same store; it can invalidate Turso’s WAL index and cause a write to be silently lost. Use single-owner mode when other tools touch the database files.

### Hardware & Deployment Guide
Use a standard OpenCode environment; Bun is the recommended runtime. OpenCode v2 registers `opencode-mem@latest` in `plugins`, while v1 uses `plugin`. For a local v2 checkout, run `bun install && bun run build` and point the plugin list at the package root, not `dist/` or an individual file. The default embedding model needs internet access for the initial download and then runs on the CPU. Whether capture can stay offline is a separate provider decision. Native Turso bindings cover glibc Linux x64 and arm64, Apple Silicon macOS, and x64 Windows. Alpine/musl and Intel Macs lack compatible bindings; selecting remote embeddings does not remove that requirement.

Test upgrades against a backed-up store: startup converts legacy libSQL DiskANN storage and applies shard migrations, backing up databases and preserving vectors during engine conversion without re-embedding. Keep all processes sharing a store on the same WAL mode and restart them together after an upgrade. For controlled rollouts, pin the npm version; with an eligible version range and `autoUpdate` enabled, the plugin can clear the cached package and prompt a restart. Recent changes include a Standard Compute provider preset in v2.42.0, French web UI and documentation in v2.43.0, and a v2.44.0 fix that keeps the configured provider connected when a directory becomes unavailable.
```

## Key Capabilities
```text
- Storage: Embedded Turso stores `F32_BLOB` vectors and ranks them with `vector_distance_cos`; no separate vector service is required.
- Capture: Idle-session extraction uses a structured-output provider; manual add, search and list do not require a capture provider.
- Recall: OpenCode v2 supplies memory through system context, with first-turn injection by default or refresh on every authored user turn.
- Embeddings: CPU inference uses Transformers and ONNX, with OpenAI-compatible embedding endpoints as an alternative.
- Portability: An optional Markdown vault and `memory` export, import and migrate operations support moved or copied projects.
- Operations: The web UI combines the memory–prompt timeline, profile, skills and health views; HTTP Basic Auth is optional.
```

## Quick Start / Clone
```bash
memory({ mode: "add", content: "Project uses microservices architecture" });
memory({ mode: "search", query: "architecture decisions" });
memory({ mode: "search", query: "architecture decisions", scope: "all-projects" });
memory({ mode: "profile" });
memory({ mode: "list", limit: 10 });
memory({ mode: "list-shards" });
memory({ mode: "migrate", fromPath: "/old/path/to/project" });
memory({ mode: "export", outputPath: "./memories.json" });
memory({ mode: "import", inputPath: "./memories.json" });
```
