/brain-update
End-of-session brain flush. Scans the full conversation, extracts all new entities, decisions, tasks, events, relationships, and updates, presents a summary, and writes to project_brain.db after confirmation. Use at end of every session or when you want to capture everything
$ npx -y skills add coco-research/coco --skill brain-update --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/brain-update
Context preview
The summary Claude sees to decide when to auto-load this skill.
End-of-session brain flush. Scans the full conversation, extracts all new entities, decisions, tasks, events, relationships, and updates, presents a summary, and writes to project_brain.db after confirmation. Use at end of every session or when you want to capture everything
SKILL.md
brain-update.SKILL.mdname: brain:update
description: "End-of-session brain flush. Scans the full conversation, extracts all new entities, decisions, tasks, events, relationships, and updates, presents a summary, and writes to project_brain.db after confirmation. Use at end of every session or when you want to capture everything discussed."
/brain:update --- End-of-Session Brain Flush
**This is a forcing function.** When invoked, Claude MUST thoroughly review the entire conversation and write everything learned to the brain DB. No shortcuts, no skipping.
Procedure
Step 1: Detect brain DB
Look for `project_brain.db` in the current working directory or parent dirs. If not found, error: "No brain DB found. Run `/brain init` first."
Step 2: Read current DB state (cross-session awareness)
**CRITICAL --- the user runs multiple terminal sessions in parallel.** Another session may have already written to the brain since this conversation started. Before extracting, read the current DB state:
python3 ~/.claude/skills/brain/scripts/brain/brain_cli.py context {slug}For each project, note:
- **Existing entities** (names and types) --- so you don't propose adding what's already there
- **Existing decisions** (decision text) --- so you don't duplicate
- **Existing events** (title + date) --- so you don't duplicate
- **Current task statuses** --- so you don't regress a task that another session already advanced (e.g., don't set to "open" if another session set it to "done")
**Conflict rules:**
- **Entity already exists with newer metadata** --- skip your update. The other session's data is fresher.
- **Decision already recorded** --- skip. Match on first 40 chars of decision text.
- **Event already recorded** --- skip. Match on title + date.
- **Task status conflict** --- the MORE ADVANCED status wins. Status order: open < in_progress < blocked < waiting < done < cancelled. Never regress.
- **Task notes** --- if brain has notes that your session doesn't know about, MERGE (append), don't overwrite.
- **New data from this session not in DB** --- these are the writes to propose.
Show any conflicts detected:
CROSS-SESSION CONFLICTS
=======================
Task "Get sandbox access" --- brain says "done" (updated by another session),
this session would set "open". KEEPING "done".
Decision "Use Stakeholder role..." --- already in brain. SKIPPING.
Step 3: Scan the full conversation
Go through every message from top to bottom. For EACH project in the brain DB, extract:
| Category | What to look for | |----------|-----------------| | **New entities** | Any person, team, role, system, module, or org mentioned for the first time | | **New relationships** | Connections discovered: X owns Y, A reports to B, team scoped to module | | **New decisions** | Anything decided, agreed, confirmed, resolved, or ruled out | | **New events** | Meetings, calls, emails read, milestones, deployments | | **New tasks** | Action items, to-dos, next steps, follow-ups, blockers identified | | **Task updates** | Existing tasks that changed status (started, completed, blocked, cancelled) | | **Entity updates** | New info about existing entities (role change, new metadata, correction) | | **Thread updates** | New items to link to existing threads, or new threads to create |
Step 3: Execute writes immediately
**The user invoked `/brain-update` --- that IS the confirmation. Do NOT ask "Write all to brain?" or wait for approval. Just do it.**
Use Python to write all items via the brain operations module:
import sys
sys.path.insert(0, '$HOME/.claude/skills/brain/scripts')
from brain.schema import get_db
from brain.operations import *
Write in this order: 1. Entities (upsert --- safe to run repeatedly) 2. Relationships 3. Tasks (new + updates) 4. Threads + thread_items 5. Decisions 6. Events
Step 6: Report
BRAIN UPDATED
=============
Entities: +3 (total: 47)
Relationships: +1 (total: 37)
Tasks: +2, ~3 updated (total: 8)
Decisions: +1 (total: 4)
Events: +1 (total: 3)
Threads: 1 updated (total: 1)
Synced to: MemPalace (N drawers), brain.json (N people)
Step 6b: Sync to MemPalace and brain.json
After all brain DB writes complete, run the memory bridge to sync new knowledge to the other memory stores:
from brain.memory_bridge import full_sync
full_sync(db_path, project_slug)
This: 1. Copies new entities, decisions, and events to MemPalace as searchable drawers (wing = project slug, room = entity type) 2. Rebuilds brain.json people section from all brain DB person entities across all projects 3. Is best-effort — if MemPalace or brain.json sync fails, brain DB data is still safe
The sync is automatic. No user confirmation needed for this step.
Step 7: Update knowledge articles
After brain DB writes complete and `full_sync` runs (Step 6b), incrementally update knowledge articles for entities whose evidence has changed in this session.
**Collect changed entity IDs** from the writes performed in Step 3 (entities upserted, decisions/events written). Pass these to the knowledge engine for targeted refresh:
import sys, os
sys.path.insert(0, os.path.expanduser("~/.coco/knowledge"))
from engine import KnowledgeEngine
engine = KnowledgeEngine()
# changed_entity_ids = list of brain DB entity IDs written in this session
engine.incremental_update(project_slug, changed_entity_ids)Or equivalently via CLI (re-harvests all entities but only regenerates stale ones):
python3 ~/.coco/knowledge/cron.py --run --project {slug} --phases 2,3,5Only articles whose `source_hash` changed are regenerated. Expected: 1–5 article regenerations per typical session. Estimated cost: ~$0.01.
Show result **inline in the existing brain-update summary block**:
BRAIN UPDATED
=============
Entities: +3 (total: 47)
Relationships: +1 (total: 37)
Tasks: +2, ~3 updated (total: 8)
Decisions: +1
Read more
name: brain:update description: "End-of-session brain flush. Scans the full conversation, extracts all new entities, decisions, tasks, events, relationships, and updates, presents a summary, and writes to project_brain.db after confirmation. Use at end of every session or when you want to capture everything discussed."
/brain:update --- End-of-Session Brain Flush
**This is a forcing function.** When invoked, Claude MUST thoroughly review the entire conversation and write everything learned to the brain DB. No shortcuts, no skipping.
Procedure
Step 1: Detect brain DB
Look for `project_brain.db` in the current working directory or parent dirs. If not found, error: "No brain DB found. Run `/brain init` first."
Step 2: Read current DB state (cross-session awareness)
**CRITICAL --- the user runs multiple terminal sessions in parallel.** Another session may have already written to the brain since this conversation started. Before extracting, read the current DB state:
python3 ~/.claude/skills/brain/scripts/brain/brain_cli.py context {slug}For each project, note:
- **Existing entities** (names and types) --- so you don't propose adding what's already there
- **Existing decisions** (decision text) --- so you don't duplicate
- **Existing events** (title + date) --- so you don't duplicate
- **Current task statuses** --- so you don't regress a task that another session already advanced (e.g., don't set to "open" if another session set it to "done")
**Conflict rules:**
- **Entity already exists with newer metadata** --- skip your update. The other session's data is fresher.
- **Decision already recorded** --- skip. Match on first 40 chars of decision text.
- **Event already recorded** --- skip. Match on title + date.
- **Task status conflict** --- the MORE ADVANCED status wins. Status order: open < in_progress < blocked < waiting < done < cancelled. Never regress.
- **Task notes** --- if brain has notes that your session doesn't know about, MERGE (append), don't overwrite.
- **New data from this session not in DB** --- these are the writes to propose.
Show any conflicts detected:
CROSS-SESSION CONFLICTS ======================= Task "Get sandbox access" --- brain says "done" (updated by another session), this session would set "open". KEEPING "done". Decision "Use Stakeholder role..." --- already in brain. SKIPPING.
Step 3: Scan the full conversation
Go through every message from top to bottom. For EACH project in the brain DB, extract:
| Category | What to look for | |----------|-----------------| | **New entities** | Any person, team, role, system, module, or org mentioned for the first time | | **New relationships** | Connections discovered: X owns Y, A reports to B, team scoped to module | | **New decisions** | Anything decided, agreed, confirmed, resolved, or ruled out | | **New events** | Meetings, calls, emails read, milestones, deployments | | **New tasks** | Action items, to-dos, next steps, follow-ups, blockers identified | | **Task updates** | Existing tasks that changed status (started, completed, blocked, cancelled) | | **Entity updates** | New info about existing entities (role change, new metadata, correction) | | **Thread updates** | New items to link to existing threads, or new threads to create |
Step 3: Execute writes immediately
**The user invoked `/brain-update` --- that IS the confirmation. Do NOT ask "Write all to brain?" or wait for approval. Just do it.**
Use Python to write all items via the brain operations module:
import sys sys.path.insert(0, '$HOME/.claude/skills/brain/scripts') from brain.schema import get_db from brain.operations import *
Write in this order: 1. Entities (upsert --- safe to run repeatedly) 2. Relationships 3. Tasks (new + updates) 4. Threads + thread_items 5. Decisions 6. Events
Step 6: Report
BRAIN UPDATED ============= Entities: +3 (total: 47) Relationships: +1 (total: 37) Tasks: +2, ~3 updated (total: 8) Decisions: +1 (total: 4) Events: +1 (total: 3) Threads: 1 updated (total: 1) Synced to: MemPalace (N drawers), brain.json (N people)
Step 6b: Sync to MemPalace and brain.json
After all brain DB writes complete, run the memory bridge to sync new knowledge to the other memory stores:
from brain.memory_bridge import full_sync full_sync(db_path, project_slug)
This: 1. Copies new entities, decisions, and events to MemPalace as searchable drawers (wing = project slug, room = entity type) 2. Rebuilds brain.json people section from all brain DB person entities across all projects 3. Is best-effort — if MemPalace or brain.json sync fails, brain DB data is still safe
The sync is automatic. No user confirmation needed for this step.
Step 7: Update knowledge articles
After brain DB writes complete and `full_sync` runs (Step 6b), incrementally update knowledge articles for entities whose evidence has changed in this session.
**Collect changed entity IDs** from the writes performed in Step 3 (entities upserted, decisions/events written). Pass these to the knowledge engine for targeted refresh:
import sys, os
sys.path.insert(0, os.path.expanduser("~/.coco/knowledge"))
from engine import KnowledgeEngine
engine = KnowledgeEngine()
# changed_entity_ids = list of brain DB entity IDs written in this session
engine.incremental_update(project_slug, changed_entity_ids)Or equivalently via CLI (re-harvests all entities but only regenerates stale ones):
python3 ~/.coco/knowledge/cron.py --run --project {slug} --phases 2,3,5Only articles whose `source_hash` changed are regenerated. Expected: 1–5 article regenerations per typical session. Estimated cost: ~$0.01.
Show result **inline in the existing brain-update summary block**:
BRAIN UPDATED ============= Entities: +3 (total: 47) Relationships: +1 (total: 37) Tasks: +2, ~3 updated (total: 8) Decisions: +1
Meet Coco. A superintelligent agent framework powered by an advisory board of 389 world-class minds. Scale your AI assistant into a complete engineering department with 142 skills, 277 commands, and persistent state. Universal compatibility. Local privacy. Free and open source.
Repo: coco-research/coco
Other skills on coco.
- /create-rule
Create Cursor rules for persistent AI guidance. Use when the user wants to create a rule, add coding standards, set up project conventions, configure file-specific patterns, create RULE.md files, or asks about .cursor/rules/ or AGENTS.md.
Open skill - /create-skill
Guides users through creating effective Agent Skills for Cursor. Use when the user wants to create, write, or author a new skill, or asks about skill structure, best practices, or SKILL.md format.
Open skill - /create-subagent
Create custom subagents for specialized AI tasks. Use when the user wants to create a new type of subagent, set up task-specific agents, configure code reviewers, debuggers, or domain-specific assistants with custom prompts.
Open skill - /migrate-to-skills
Convert 'Applied intelligently' Cursor rules (.cursor/rules/*.mdc) and slash commands (.cursor/commands/*.md) to Agent Skills format (.cursor/skills/). Use when the user wants to migrate rules or commands to skills, convert .mdc rules to SKILL.md format, or consolidate commands
Open skill - /update-cursor-settings
Modify Cursor/VSCode user settings in settings.json. Use when the user wants to change editor settings, preferences, configuration, themes, font size, tab size, format on save, auto save, keybindings, or any settings.json values.
Open skill - /agent-lightning
Train and optimize AI agents using Microsoft's Agent Lightning framework with reinforcement learning. Use when setting up agent training, instrumenting agents with tracing, configuring LightningStore, implementing reward functions, or optimizing prompts with RL/APO algorithms.
Open skill

