Skip to content

daxiangzi166/opencode-webmem

Repository files navigation

OpenCode Memory Plugin

A persistent memory system for OpenCode with SQLite storage and a Web UI.

Features

Feature Description
Persistence SQLite-backed storage (project + global scopes)
Web UI Dark/Light theme, bilingual (EN/ZH), tag filtering
Export Single or bulk memory export as Markdown
Plugin Integrates with OpenCode's memory tool

Tools

  • memory_save — Save a memory with tags and scope
  • memory_search — Search memories by content and tags
  • memory_delete — Delete a memory by ID
  • memory_list — List memories with optional scope/tag filters

Quick Start

Prerequisites

  • Go 1.21+
  • Bun 1.1+

Install

git clone <repo-url>
cd opencode-webmem
bun run build

Configure

Add to your ~/.config/opencode/opencode.json:

{
  "plugins": [
    {
      "name": "memory-server",
      "type": "plugin",
      "path": "path/to/plugin/dist/index.js",
      "command": "path/to/bin/memory-server"
    }
  ]
}

The executable name will be memory-server.exe on Windows.

Run the server manually:

bin/memory-server

Open http://localhost:3847

Build Options

bun run build              # Full build (Go + Plugin)
bun run build --ci         # CI mode (minimal output)
bun run build --go-only    # Go backend only
bun run build --plugin-only  # Plugin only
bun run build --verify     # Check environment without building
bun run build --clean      # Remove build artifacts

Architecture

graph TD
    A[OpenCode CLI] --> B[Plugin TS]
    B --> C[Memory Server Go]
    C --> D[(SQLite Project)]
    C --> E[(SQLite Global)]
    C --> F[Web UI]
    F --> C
Loading

Project Structure

opencode-webmem/
├── backend/           Go backend (Gin + SQLite)
│   ├── main.go
│   ├── handlers/      HTTP handlers
│   └── storage/       SQLite storage layer
├── web/               Web UI
│   ├── index.html
│   ├── style.css
│   ├── app.js
│   └── locales/       Translation files
├── plugin/            OpenCode plugin (TypeScript)
│   └── src/index.ts
├── docs/              Screenshots and docs
├── bin/               Build output
├── build.ts           Unified build script (Bun)
├── package.json       Build entry
└── opencode.json      Plugin config template

Configuration

Setting Default Description
--port 3847 Server port
--static web Static files directory
--db ~/.config/opencode/memories/project.db Project DB path
--global-db ~/.config/opencode/memories/global.db Global DB path
--auth-token "" Bearer token for API authentication (empty = disabled)
--rate-limit 60 Max API requests per minute per IP (0 = disabled)
--backup-dir <db-dir>/backups/ Backup directory
--backup-interval 168h Backup interval (e.g. 168h for weekly)

API Endpoints

Method Path Description
GET /health Health check (DB ping)
POST /api/memories Create memory
GET /api/memories List memories
GET /api/memories/:id Get memory
PUT /api/memories/:id Update memory
DELETE /api/memories/:id Delete memory
GET /api/export/:id Export single memory
GET /api/export Export all memories

License

MIT

About

OpenCode persistent memory plugin with SQLite storage + Web UI management

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors