Back to Guides & Cookbooks
Cookbook

How to share memory across opencode, dashboard, and scripts

One workspace, five surfaces, zero sync code. A fact stored in opencode appears in the dashboard, the SDK, the CLI, and your embedded SaaS — immediately.

1

Memory is centralized, access is distributed

Memory is stored once per workspace. Every surface that uses the same API key shares the same memory pool. No syncing, no replication.

opencodeDashboardSDKCLISaaS widgetShared Memory

Five surfaces, one memory pool, zero sync code

2

A day in the life

Morning — opencode
> Our refund policy is 30 days, not 60. Update the docs.

Got it. I'll remember that our refund policy is 30 days.
[Memory: stored as knowledge atom]
Afternoon — dashboard
Visit /infra/dashboard/memory
Search: "refund policy"
Result: "Refund policy is 30 days" — stored this morning via opencode
Evening — Python script
import asyncio
from cadreen import Cadreen

async def main():
cadreen = Cadreen()
results = await cadreen.memory.search("refund policy")
print(results[0].content) # "Refund policy is 30 days"
print(results[0].source) # "opencode"

asyncio.run(main())
Next day — CLI
$ cadreen memory list --limit 5

Recent memories:

Refund policy is 30 days
Source: opencode
Stored: 2026-06-21 09:15 UTC
Type: knowledge_atom
Note
Memory is per-workspace, not per-surface. Source tags ("opencode", "sdk", "cli") let you filter by origin, but knowledge flows freely.
3

Write memory from any surface

SDK — remember a fact
await cadreen.memory.remember({
content: "Our Stripe account ID is acct_12345",
type: "fact",
});
CLI — add to memory
cadreen memory add "Our Stripe account ID is acct_12345"

Both of these write to the same memory pool. The fact is immediately available on all surfaces.

Note