Skip to content

Usage Examples

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" });

Access the web interface at http://127.0.0.1:4747 for visual memory browsing and management.

Network binding security: Keep webServerHost on 127.0.0.1 unless you intentionally expose the UI. Binding to 0.0.0.0 (or any non-loopback host) requires webServerApiToken; all /api/* requests must then send Authorization: Bearer <token> or X-Opencode-Mem-Token. Open the UI with ?apiToken=<token> so the browser stores and sends it.

Dimension migrations generate every new embedding first, import them into a temporary indexed shard, verify the row count, and only then replace the original file. Failed migrations leave the source shard untouched.