substrate
Skill535 starsChanged 5 months agoMITView on GitHub
Use when the user wants to read/write their Butterbase substrate — the per-user agent-memory backend that holds entities, business state, institutional memory, and an append-only action ledger. Use for: founder copilots, AI agents that need memory across sessions, anything that proposes actions on the user's behalf.
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 21
Every write goes through this loop.
- Very specific: line 46
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, …
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Butterbase Substrate
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).
Four stores
| 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 |
The propose → policy → execute → log loop
Every write goes through this loop. Agents NEVER touch the substrate database directly.
- Propose —
propose_actionwithcapability+args. Returns an action ID. - Policy — substrate-core evaluates per-capability rules. Verdicts:
auto_execute,require_approval,deny. - Approval (if needed) — human calls
approve_action(action_id)orreject_action(action_id). Ifyolo_mode=truefor this user, approvals are auto-granted for capabilities marked yolo-safe. - Execute + log — substrate-core runs the action in a transaction and appends to the ledger.
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.
Reads
get_entity(id)— fetch by ID.find_entities(type, query, limit)— typed search;queryis full-text + structured.search_memory(query, kind?)— semantic + keyword search across decisions/commitments/learnings.
When to use
- ✅ Founder copilot ("what did I decide about pricing last quarter?")
- ✅ AI agent that should remember a customer across conversations
- ✅ Any app where you want a single source of truth for entities the agent operates on
- ❌ Plain CRUD app (use regular Butterbase tables)
- ❌ Pure analytics / read-only dashboard (substrate is action-oriented)
Linking an app
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.
API keys
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.
Anti-patterns
- ❌ Calling substrate MCP tools without first checking whether the user has substrate provisioned.
find_entitiesreturns 401 if there's no substrate — handle gracefully and suggest provisioning. - ❌ Treating the action ledger as mutable. It's append-only; "undo" is a new compensating action, not a delete.
- ❌ Storing transient state in entities. Entities are durable nouns; use the app's runtime tables for ephemeral state.
- ❌ Calling
upsert_entitywithoutcanonical_keysorprimary_emailand expecting dedup. Provide one or the other so substrate can match an existing row. Without them, every call mints a new entity. - ❌ Calling
update_entityfor a partial update. It replacesattrswholesale and will drop every key you didn't include. Usepatch_entity(RFC 7396 merge-patch) instead. - ❌ Storing entity IDs in app data and skipping alias resolution after
merge_entities. The merged-away ID stops resolving to an entity; look upsubstrate.entity_aliasesto find the survivor.
Other versions2 projects use a version of this.
Word for word · 1
- butterbase-ai/butterbase-plugin★ 534100% same
Edited · 0
None found.
Wrote their own version · 1
- google/ax★ 14ksame name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository40 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- butterbase-skillsSkill
- agentsSkill
- aiSkill
- auth-setupSkill
- build-appSkill
- contributingSkill
- debug-rlsSkill
- deploy-frontendSkill
- durable-objectsSkill
- function-devSkill
- integrationsSkill
- journey-agentsSkill
- journey-aiSkill
- journey-authSkill
- journey-deploySkill
- journey-docsSkill
- journey-durableSkill
- journey-frontendSkill
- journey-functionsSkill
- journey-ideaSkill
- journey-planSkill
- journey-preflightSkill
- journey-ragSkill
- journey-realtimeSkill
- journey-rlsSkill
- journey-schemaSkill
- journeySkill
- journey-storageSkill
- journey-submitSkill
- journey-substrateSkill
- journey-templatesSkill
- meetingsSkill
- migrationsSkill
- paymentsSkill
- rag-devSkill
- realtimeSkill
- schema-designSkill
- storageSkill
- templatesSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

