
If you're building a founder copilot or any AI agent that needs to remember things across sessions, this gives Claude direct access to Butterbase's per-user memory backend. It's got four stores: entities (people, companies), business state (MRR, headcount), institutional memory (decisions, learnings), and an append-only action ledger. Every write goes through a propose, policy check, execute loop so agents can't quietly trash your data. The anti-patterns section is worth reading closely: the action ledger is truly append-only, update_entity replaces the whole attrs object instead of patching, and you need canonical_keys or primary_email for dedup to work. Not for plain CRUD apps, but if you want a single source of truth that an agent operates on, this is the primitive.
$ npx -y skills add butterbase-ai/butterbase-skills --skill substrate --agent claude-codeInstalls into .claude/skills of the current project.
Substrate is an optional, per-user add-on backend. One substrate per Butterbase account, lazily provisioned on first use, queryable from local Claude Code (via MCP), from any opted-in Butterbase app (via ctx.substrate inside functions), and from external systems (via HTTP).
| Store | What lives there | Tools |
|---|---|---|
| Entities | People, companies, projects you transact with | get_entity, find_entities |
| Business state | Numeric facts that change over time (MRR, headcount) | find_entities with type filter |
| Institutional memory | Decisions, commitments, learnings | search_memory |
| Action ledger | Append-only log of every proposed/executed action | list_outbox, propose_action history |
Every write goes through this loop. Agents NEVER touch the substrate database directly.
propose_action with capability + args. Returns an action ID.auto_execute, require_approval, deny.approve_action(action_id) or reject_action(action_id). If yolo_mode=true for this user, approvals are auto-granted for capabilities marked yolo-safe.For external side effects (sending email, calling an API), substrate writes to the outbox instead of executing inline. The cron-scheduler drains it. Use list_outbox, retry_outbox, cancel_outbox to manage it.
get_entity(id) — fetch by ID.find_entities(type, query, limit) — typed search; query is full-text + structured.search_memory(query, kind?) — semantic + keyword search across decisions/commitments/learnings.When apps.substrate_user_id is set to the app owner's platform_user.id, functions in that app get ctx.substrate injected at cold start, with reader and proposer methods. Use /butterbase-skills:journey-substrate to enable this for an app.
For agent access from local Claude Code, generate a scope='both' API key via manage_auth_config action: "generate_service_key" with substrate_access: true. The same bb_sk_ key works on both app and substrate endpoints.
find_entities returns 401 if there's no substrate — handle gracefully and suggest provisioning.upsert_entity without canonical_keys or primary_email and expecting dedup. Provide one or the other so substrate can match an existing row. Without them, every call mints a new entity.update_entity for a partial update. It replaces attrs wholesale and will drop every key you didn't include. Use patch_entity (RFC 7396 merge-patch) instead.merge_entities. The merged-away ID stops resolving to an entity; look up substrate.entity_aliases to find the survivor.Sponsors