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 Export

ASecurity

Use when the user asks to refresh CLAUDE.local.md, regenerate project context, or after a brain-update session flush. Rewrites only the sentinel-delimited auto-generated section from the brain DB, preserving manual behavior rules.

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

Works with

cli

Security Analysis

A100/100

Scanned 9/23/2026

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

Installs into .claude/skills of the current project.

Are you the author of Brain Export?

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

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

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:export
description: "Use when the user asks to refresh CLAUDE.local.md, regenerate project context, or after a brain-update session flush. Rewrites only the sentinel-delimited auto-generated section from the brain DB, preserving manual behavior rules."
---

# /brain-export — CLAUDE.local.md Auto-Generator

Generates or refreshes the `<!-- AUTO-GENERATED: brain-export -->` section in the project's `CLAUDE.local.md` file from the brain SQLite DB. Protects all manually written content above and below the sentinels.

## Quick Reference

```bash
BRAIN="python3 ~/.claude/skills/brain/scripts/brain/brain_cli.py"

# Basic export (writes CLAUDE.local.md next to project_brain.db)
$BRAIN export <project-slug>

# Export with explicit output path
$BRAIN export <project-slug> --output /path/to/CLAUDE.local.md

# Export with explicit DB path
$BRAIN --db /path/to/project_brain.db export <project-slug>
```

## Procedure

### Step 1 — Verify brain DB exists

```bash
BRAIN="python3 ~/.claude/skills/brain/scripts/brain/brain_cli.py"
$BRAIN info
```

If the DB is missing, tell the user to run `/brain-init` first.

### Step 2 — Run the export

```bash
$BRAIN export <project-slug>
```

The exporter will:
1. Read any existing `CLAUDE.local.md` at the output path
2. Preserve everything above `<!-- AUTO-GENERATED: brain-export -->`
3. Preserve everything below `<!-- END AUTO-GENERATED -->`
4. If no sentinels found, append the auto section at the bottom (safe first run)
5. Regenerate the auto section from brain DB
6. Write atomically (tmp file + rename)

### Step 3 — Show the user what was generated

Parse the JSON output and display:

```
brain:export complete
─────────────────────────────────────────
Output:         /path/to/CLAUDE.local.md
Project slug:   <slug>
Auto section:   ~NNN tokens (within 1,200 token budget: YES/NO)
Total file:     ~NNN tokens
─────────────────────────────────────────
Sections generated:
  - Project Identity  (if ~/.mempalace/identity.txt exists)
  - Last Session      (most recent event + decision)
  - Key People        (up to 8 person entities)
  - Key Systems       (up to 8 system/module entities)
  - Recent Decisions  (last 4 decisions)
  - Project Status    (entity/decision/event counts + last sync date)
```

### Step 4 — First-run: offer to migrate feedback memories

If this is the first export AND the project memory directory contains files with `type: feedback` frontmatter, offer to migrate them into behavior rules:

```
Found N feedback memory files that could become behavior rules in CLAUDE.local.md:
  - feedback_html_docs_with_tailwind.md → "Documents as Tailwind HTML not Markdown"

Add these as a ## Behavior Rules section below the auto-generated block? [y/N]
```

To migrate programmatically:

```python
from brain.exporter import migrate_feedback_memories
from pathlib import Path

memory_dir = Path("~/.claude/projects/<project-slug-hash>/memory").expanduser()
rules = migrate_feedback_memories(memory_dir)
for rule in rules:
    print(rule)
```

Then append the rules as a `## Behavior Rules` section below `<!-- END AUTO-GENERATED -->` in `CLAUDE.local.md`.

## Auto-Section Format

```markdown
<!-- AUTO-GENERATED: brain-export -->
<!-- Generated: 2026-04-09T12:00:00Z | Brain DB: 42 entities | MemPalace: 7 drawers -->

## Project Identity
<contents of ~/.mempalace/identity.txt if it exists>

## Last Session
- Most recent event title (YYYY-MM-DD)
- Most recent decision text (YYYY-MM-DD)

## Key People
| Name | Role | Email |
|------|------|-------|
| Alice Smith | Product Manager | alice@example.com |

## Key Systems
- **SystemA** — Description from metadata
- **ModuleB**

## Recent Decisions
- [2026-04-08] Decision text (truncated to 120 chars)

## Project Status
- Entities: 42 | Decisions: 12 | Events: 8
- Last brain sync: 2026-04-09
- Query: `/coco brain` or `/brain context {slug}` for full context

<!-- END AUTO-GENERATED -->
```

## Sentinel Contract

| Sentinel | Position | Meaning |
|----------|----------|---------|
| `<!-- AUTO-GENERATED: brain-export -->` | Start of auto block | Everything below is managed by exporter |
| `<!-- END AUTO-GENERATED -->` | End of auto block | Everything below is protected manual content |

**Never manually edit between the sentinels** — changes will be overwritten on next export.
**Safe to edit** anything above START or below END at any time.

## Token Budget

The auto section is capped at **1,200 tokens (~4,800 characters)**. If the generated content exceeds this, the body is truncated. The header comment and sentinels are always preserved intact.

## When to Run

- After every `/brain-update` session flush (brain DB has new data)
- After `/brain-init` (first time setup)
- After `/brain-rescan` (bulk entity import)
- When starting work on a project for the first time in a new session (ensure context is fresh)

## Trigger Phrases

- "export brain to CLAUDE.local.md"
- "refresh project context file"
- "generate CLAUDE.local"
- "update auto-generated section"
- "brain export <slug>"

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', ...

698461 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 →