End-to-end walkthrough: from zero to shared AI memory.
Time: 15–20 minutes
Prerequisites: terminal, curl, jq, and either Docker (local) or a free Supabase account (hosted)
| Path | Who | Time | Requirements |
|---|---|---|---|
| A. Admin (owner) | Setting up a new crew | 10 min | Supabase account or Docker |
| B. Joiner (CLI) | Joining an existing crew | 5 min | Invite from admin |
| C. MCP-only | AI-first workflow | 5 min | MCP client (Cursor, Claude Code) |
Pick one path and follow it through. The walkthrough uses a demo Jira key DEMO-1.
Option 1: Local Docker (fastest for trying out)
cd /path/to/brainstack
# Start local Supabase
supabase start
# Bootstrap with local mode
bash core/scripts/team-brain-api.sh bootstrap \
--team "Tutorial Crew" --admin "Alice" \
--local --jira DEMO-1
Option 2: Hosted Supabase (production-like)
cd /path/to/brainstack
bash core/scripts/team-brain-api.sh bootstrap \
--team "Tutorial Crew" --admin "Alice" \
--url "https://YOUR_REF.supabase.co" \
--anon "eyJ..." \
--db-url "postgresql://postgres:YOUR_DB_PASSWORD@db.YOUR_REF.supabase.co:5432/postgres" \
--jira DEMO-1 \
--write-env
bash core/scripts/team-brain-api.sh whoami
Expected output:
{
"display_name": "Alice",
"role": "admin",
"team_name": "Tutorial Crew",
"invite_code": "ABC123..."
}
Bootstrap prints a share bundle. Copy it:
=== SHARE BUNDLE (copy to Slack/chat) ===
Team: Tutorial Crew
Invite: ABC123DEF456GH78
URL: https://....supabase.co
Anon: eyJ...
Jira: DEMO-1
Keep this safe — teammates need the invite + URL + anon to join.
bash core/scripts/team-brain-api.sh pin set --jira DEMO-1 --team-name "Tutorial Crew"
cat .team-brain/project.json
This file is safe to commit (no secrets). Teammates can pull it for the Jira key.
bash core/scripts/team-brain-api.sh start DEMO-1
bash core/scripts/team-brain-api.sh sync-status DEMO-1
Now save your first memory:
bash core/scripts/team-brain-api.sh remember DEMO-1 research \
--source-ref "DEMO-1#setup" \
"Tutorial Crew is using Team Brain for DEMO-1. Alice is admin."
Expected: "result": "inserted" or "result": "deduped" if you run it again.
bash core/scripts/team-brain-api.sh recall DEMO-1
You should see your memory in the list.
Checkpoint A complete. Skip to Verification Checklist.
Your admin shared: invite code, Supabase URL + anon key, and Jira key.
cd /path/to/brainstack
# Option 1: Environment variables
export TEAM_BRAIN_SUPABASE_URL="https://....supabase.co"
export TEAM_BRAIN_SUPABASE_ANON_KEY="eyJ..."
# Option 2: Edit project.public.env
# nano supabase/project.public.env
# → Replace placeholders with URL + anon from admin
# Replace with your invite and name
bash core/scripts/team-brain-api.sh onboard ABC123DEF456GH78 "Bob" DEMO-1 --role member
Expected output includes:
{
"display_name": "Bob",
"role": "member",
"team_name": "Tutorial Crew"
}
bash core/scripts/team-brain-api.sh whoami
bash core/scripts/team-brain-api.sh status
bash core/scripts/team-brain-api.sh start DEMO-1
bash core/scripts/team-brain-api.sh recall DEMO-1
You should see memories from your admin (Alice).
bash core/scripts/team-brain-api.sh remember DEMO-1 research \
--source-ref "DEMO-1#bob-joined" \
"Bob joined and confirmed Team Brain is working."
bash core/scripts/team-brain-api.sh breakdown DEMO-1
This generates a draft epic breakdown from all shared memories.
Checkpoint B complete. Skip to Verification Checklist.
For Cursor, Claude Code, or other MCP-compatible clients.
In Cursor, check your MCP settings (.cursor/mcp.json or global):
{
"servers": {
"team-brain": {
"command": "python",
"args": ["/path/to/brainstack/mcp/team-brain/server.py"],
"env": {
"TEAM_BRAIN_SUPABASE_URL": "https://....supabase.co",
"TEAM_BRAIN_SUPABASE_ANON_KEY": "eyJ..."
}
}
}
}
In chat, say:
Use Team Brain MCP to onboard me with invite ABC123DEF456GH78, name "Carol", on DEMO-1.
Or if already onboarded:
Use Team Brain MCP to attach DEMO-1.
I'm starting on DEMO-1 — start Team Brain sync.
The AI should:
start MCP toolWork naturally. When the AI finds something useful, it should call remember:
Found: the API uses JWT tokens from /auth/login endpoint.
AI response:
I'll save this to Team Brain.
[Calls remember MCP tool with source_ref "DEMO-1#auth-api"]
What does Team Brain know about DEMO-1?
AI calls recall and summarizes.
Generate a breakdown for DEMO-1 from Team Brain memory.
Checkpoint C complete. Continue to Verification Checklist.
Run through this checklist to confirm everything works.
whoami returns your display name and rolestatus shows CREDENTIALS=... OKbash core/scripts/team-brain-api.sh whoami
bash core/scripts/team-brain-api.sh status
start DEMO-1 succeedssync-status DEMO-1 shows mode: active.team-brain/cache/DEMO-1.jsonbash core/scripts/team-brain-api.sh start DEMO-1
bash core/scripts/team-brain-api.sh sync-status DEMO-1
ls -la .team-brain/cache/
remember inserts a new memoryremember with same content returns dedupedremember with same source_ref but new content returns updatedrecall returns memories# Insert
bash core/scripts/team-brain-api.sh remember DEMO-1 note \
--source-ref "DEMO-1#test1" "Test memory 1"
# Dedupe (same content)
bash core/scripts/team-brain-api.sh remember DEMO-1 note \
--source-ref "DEMO-1#test1" "Test memory 1"
# Update (same source_ref, new content)
bash core/scripts/team-brain-api.sh remember DEMO-1 note \
--source-ref "DEMO-1#test1" "Updated test memory 1"
# Recall
bash core/scripts/team-brain-api.sh recall DEMO-1 "test"
remember shows up in your recallremember shows up in teammate’s recallcorrect updates a memoryhistory shows prior versionsrestore recovers an old versionbash core/scripts/team-brain-api.sh correct DEMO-1 \
--source-ref "DEMO-1#test1" \
--was "Old understanding" \
"Corrected understanding"
bash core/scripts/team-brain-api.sh history DEMO-1 --source-ref "DEMO-1#test1"
breakdown DEMO-1 generates markdown.team-brain/initiatives/DEMO-1-breakdown.mdbash core/scripts/team-brain-api.sh breakdown DEMO-1
cat .team-brain/initiatives/DEMO-1-breakdown.md
remember returns redundant_candidate (not stored)remember --queue returns pending_submittedpending list shows the submissionpending approve <pending-id> promotes to live memory# After a memory exists, try overlapping content
bash core/scripts/team-brain-api.sh remember DEMO-1 research \
"Same finding as an existing memory body."
# Queue override (member)
bash core/scripts/team-brain-api.sh remember DEMO-1 research \
--source-ref "DEMO-1#slug" --queue "Improved finding for admin."
# Admin inbox
bash core/scripts/team-brain-api.sh pending list DEMO-1
bash core/scripts/team-brain-api.sh pending approve <pending-id>
stop DEMO-1 stops sync modebash core/scripts/team-brain-api.sh stop DEMO-1
bash core/scripts/team-brain-api.sh sync-status DEMO-1
# → mode: stopped
During long sessions, keep sync fresh (same guidance as onboarding + Cursor skill #37):
# Background watch (poll mode) — once per long spike, not every command
bash core/scripts/team-brain-api.sh watch DEMO-1 &
# Or with push (requires Realtime migration)
bash core/scripts/team-brain-api.sh watch DEMO-1 --push &
When teammates remember, your cache updates. Agents should also recall after long research blocks / ~every 8–10 turns — without nagging every turn. If sync slept, wake (or start); watch is not a substitute.
bash core/scripts/team-brain-api.sh list-members
# → display_name + role only (never api_key)
bash core/scripts/team-brain-api.sh rotate-invite
# → New invite code printed
bash core/scripts/team-brain-api.sh set-role "Bob" --role viewer
# Bob can now only recall, not remember
# As a viewer:
bash core/scripts/team-brain-api.sh remember DEMO-1 note "Test"
# → Error: forbidden: viewer role is read-only
# Member removes bad context (tombstone — audit preserved):
bash core/scripts/team-brain-api.sh delete DEMO-1 --source-ref "DEMO-1#bad-claim"
# Viewer cannot delete:
# → Error: forbidden: delete requires member role
# Peer cache: Engineer B deletes → Engineer A's sync loop / realtime push
# evicts the tombstoned row from .team-brain/cache/DEMO-1.json automatically.
# Confirm gone:
bash core/scripts/team-brain-api.sh recall DEMO-1 "bad-claim"
# → memory no longer in results
# Restore content at same source_ref (undelete via remember):
bash core/scripts/team-brain-api.sh remember DEMO-1 research \
--source-ref "DEMO-1#bad-claim" "Corrected finding after delete."
# → undeleted: true in RPC response
# Member: near-duplicate blocked (not stored)
bash core/scripts/team-brain-api.sh remember DEMO-1 research \
"API uses bearer tokens from /auth/token endpoint."
# → redundant_candidate: true, matches[] shows DEMO-1#api-auth
# Member: queue override for admin review
bash core/scripts/team-brain-api.sh remember DEMO-1 research \
--source-ref "DEMO-1#api-auth" --queue \
"API uses OAuth2 device flow (preferred for CLI)."
# Admin: review inbox
bash core/scripts/team-brain-api.sh pending list DEMO-1
bash core/scripts/team-brain-api.sh pending approve <pending-id> --note "Better finding"
# → live memory updated; recall shows new body
# Admin: reject duplicate
bash core/scripts/team-brain-api.sh pending reject <pending-id> --note "Duplicate of Alice"
| Problem | Solution |
|---|---|
unauthorized |
Re-run whoami. If broken, re-onboard with new display name |
initiative not found |
Run attach DEMO-1 first, or include key in onboard |
member already exists |
Choose a different display name |
Empty recall |
Nobody has remembered yet — add the first memory |
redundant_candidate on remember |
Similar memory exists — recall matches, reuse source_ref, or remember --queue |
list_pending_memories unavailable |
Admin: apply 20260908120001_team_brain_pending_review.sql |
rate limit exceeded |
Wait 1 hour or ask admin to check rate limit settings |
# Join
bash core/scripts/team-brain-api.sh onboard <INVITE> "Name" <JIRA-KEY> --role member|viewer
# Work session
bash core/scripts/team-brain-api.sh start <JIRA-KEY>
bash core/scripts/team-brain-api.sh remember <JIRA-KEY> research --source-ref "<KEY>#slug" "Finding"
bash core/scripts/team-brain-api.sh remember <JIRA-KEY> research --queue "Override proposal" # admin reviews
bash core/scripts/team-brain-api.sh recall <JIRA-KEY> "search term"
bash core/scripts/team-brain-api.sh pending list <JIRA-KEY> # admin
bash core/scripts/team-brain-api.sh pending approve <pending-id> # admin
bash core/scripts/team-brain-api.sh breakdown <JIRA-KEY>
bash core/scripts/team-brain-api.sh stop <JIRA-KEY>
# Check state
bash core/scripts/team-brain-api.sh whoami
bash core/scripts/team-brain-api.sh sync-status <JIRA-KEY>
bash core/scripts/team-brain-api.sh metrics <JIRA-KEY>
# Cursor chat
"I'm starting on YOU_JIRA_TICKET_HERE — start Team Brain sync."
"Remember: CLI entrypoint is in pkg/scaffold."
"What does Team Brain know about scaffold?"
"Breakdown YOU_JIRA_TICKET_HERE from Team Brain memory."
Tutorial complete. You’re ready to use Team Brain with your crew.