Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Brain Update

ASecurity

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.

477 stars
0 votes
0 copies
0 views
Added 9/23/2026
ai-agentspythongobash

Works with

terminalcli

Security Analysis

A100/100

Scanned 9/23/2026

$npx -y skills add coco-research/coco --skill brain-update --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Brain Update?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Brain Update
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/coco-research-brain-update/badge)](https://www.skillsdirectory.com/skills/coco-research-brain-update)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
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:

```bash
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:

```python
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:

```python
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:

```python
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):

```bash
python3 ~/.coco/knowledge/cron.py --run --project {slug} --phases 2,3,5
```

Only 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 (total: 4)
Events:        +1 (total: 3)
Threads:       1 updated (total: 1)
Synced to:     MemPalace (N drawers), brain.json (N people)
Knowledge:     N articles refreshed  (N new entities, N updated)
```

**Skip silently if:**
- `~/.coco/knowledge/` does not exist (knowledge engine not installed)
- `cron.py` is unavailable or returns a non-zero exit code
- The knowledge engine step takes more than 60 seconds (non-blocking)

---

## Important Rules

- **Be thorough.** Scan EVERY message. If someone was mentioned by name, they should be an entity. If something was decided, it should be a decision. If there's a next step, it should be a task.
- **Deduplicate.** Check what already exists in the DB before proposing new writes. Use `upsert_entity` which matches on (project_id, type, name) or (project_id, type, external_id).
- **Date everything.** Decisions and events need dates. Use today's date if the exact date isn't clear.
- **Attribute decisions.** Record who decided, not just what was decided.
- **Link to threads.** If a task, decision, or event belongs to an existing thread, link it.

Attribution

coco-researchcoco-research
View sourceSee grades on GitHubMore from coco-research →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Terse caveman voice: answer first, fluff gone, every technical fact kept. Use for /caveman, "caveman mode", "talk like caveman", "be brief", "less tokens". Stays on until "stop caveman" or "normal mode".

1100021 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

698621 votes

Writing Skills

Create and manage Claude Code skills in HASH repository following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns), UserPromptSubmit hook, and the 500-line rule. Includes validation and debugging with SKILL_DEBUG. Examples include rust-error-stack, cargo-dep...

3931 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3421 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Amp, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Grok Build, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

741 votes
View all in ai-agents →