brain

Obsidian-style knowledge vault — store, search, and retrieve agent knowledge across sessions via notesmd-cli.

272 stars

Best use case

brain is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Obsidian-style knowledge vault — store, search, and retrieve agent knowledge across sessions via notesmd-cli.

Teams using brain should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/brain/SKILL.md --create-dirs "https://raw.githubusercontent.com/automagik-dev/genie/main/skills/brain/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/brain/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How brain Compares

Feature / AgentbrainStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Obsidian-style knowledge vault — store, search, and retrieve agent knowledge across sessions via notesmd-cli.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# /brain — Agent Knowledge Vault

Persistent long-term memory for agents. Knowledge is stored in `brain/`, searched before answering, and written back every session.

## Brain vs Memory

These are **different tools for different purposes**:

| | **Brain** (this skill) | **Memory** (Claude native) |
|---|---|---|
| **What** | Context graph — entities, relationships, domain knowledge | Behavioral learnings — feedback, decisions, user preferences |
| **Tool** | `notesmd-cli` (Obsidian-style vault) | `.claude/memory/` files with YAML frontmatter |
| **When** | Domain intel, playbooks, company/person context, session logs | Corrections, conventions, project rules, user profile |
| **Updated by** | `/brain` (this skill) | `/learn` skill, auto memory system |
| **Format** | Markdown notes in `brain/` directory | Typed memory files (user, feedback, project, reference) |

**Rule of thumb:** If it's *knowledge about the world* → brain. If it's *how the agent should behave* → memory.

## When to Use
- Agent needs to recall prior session context, decisions, or intel
- New intel (person, company, deal) is discovered mid-session
- A playbook pattern is confirmed or updated
- Provisioning a new agent with a knowledge vault

## Flow

### Session Start (mandatory)

1. Read the conversation opener. Derive 2-3 search terms from the topic.
2. `notesmd-cli search-content "<term>"` for each term.
3. `notesmd-cli print "<note-name>"` for relevant hits.
4. Only then begin forming a response.
5. Fall back to external research (web search, browser) only if brain is insufficient.

On topic shift mid-conversation: re-run `notesmd-cli search-content "<new-topic>"` before answering.

### Write-Back (3 mandatory triggers)

### Trigger 1: Session End (always)

```bash
notesmd-cli daily
# Write: discussion summary, decisions, intel discovered, actions taken
```

### Trigger 2: New Intel Discovered (immediately)

```bash
notesmd-cli create "Intelligence/<person-or-company-name>"
# Write now — do not wait until session end
```

### Trigger 3: Playbook Pattern Updated (immediately)

```bash
notesmd-cli print "Playbooks/<playbook-name>"
# Edit: add confirmed pattern, new rule, exception, or example
```

## Commands

| Command | Purpose |
|---------|---------|
| `notesmd-cli search-content "<keyword>"` | Search vault content (use BEFORE answering domain questions) |
| `notesmd-cli print "<note-name>"` | Read a specific note |
| `notesmd-cli daily` | Open/create today's session log in `Daily/` |
| `notesmd-cli create "<name>"` | Create a note (use folder prefix: `"Intelligence/Name"`) |
| `notesmd-cli list` | Browse full vault structure |
| `notesmd-cli set-default --vault <path>` | Configure vault path (one-time setup) |

## Installation (Auto-Detect)

On first use, check if `notesmd-cli` is available:

```bash
command -v notesmd-cli >/dev/null 2>&1 && echo "installed" || echo "missing"
```

**If missing**, offer to install from https://github.com/Yakitrak/notesmd-cli:

```bash
# macOS (Homebrew)
brew install yakitrak/yakitrak/notesmd-cli

# Linux / manual
# Download the latest release binary from:
# https://github.com/Yakitrak/notesmd-cli/releases
# Place in /usr/local/bin/notesmd-cli and chmod +x

# Or use the bundled install script (if available)
bash skills/brain/scripts/install-notesmd.sh --vault ./brain
```

After install, configure the vault:

```bash
notesmd-cli set-default --vault ./brain/
```

If the user declines installation, skip brain operations gracefully and note that `/brain` requires `notesmd-cli`.

## Provisioning a New Agent Brain

```bash
mkdir -p brain/{_Templates,Company,Daily,Domains,Intelligence,Playbooks}
notesmd-cli set-default --vault ./brain/
cp skills/brain/templates/*.md brain/_Templates/
notesmd-cli list
```

Then add the protocol snippets below to the agent's config files.

### CLAUDE.md Template Block

```markdown
## FIRST THING YOU DO (every session)

1. Read the conversation opener to understand the topic
2. Derive 2-3 search terms
3. Run: `notesmd-cli search-content "<term>"` for each
4. If results found: `notesmd-cli print "<note-name>"`
5. Only THEN begin forming your response
6. If brain is insufficient: use web search as fallback

## WHEN TOPIC SHIFTS

Re-run `notesmd-cli search-content "<new-topic>"` before answering.

## AT SESSION END (mandatory)

Run `notesmd-cli daily`. Log: discussion, decisions, intel, actions.

## WRITE IMMEDIATELY WHEN

- New intel discovered -> `notesmd-cli create "Intelligence/<name>"`
- Playbook updated -> edit relevant `Playbooks/` note
- Domain insight validated -> update relevant `Domains/` note
```

### AGENTS.md Protocol Snippet

```markdown
## Brain Protocol

### Session Start
- Derive 2-3 keywords from topic
- `notesmd-cli search-content "<keyword>"` for each
- `notesmd-cli print "<note-name>"` for relevant results
- External research only when brain is insufficient

### Mid-Conversation
- Re-scan on topic shift: `notesmd-cli search-content "<new-topic>"`

### Session End (mandatory)
- `notesmd-cli daily` — log: discussion, decisions, intel, actions

### Write Immediately When
- New intel -> `notesmd-cli create "Intelligence/<name>"`
- Playbook updated -> edit `Playbooks/` note now
```

## Auto-Sync (optional)

Push brain changes to GitHub via inotifywait + cron:

```bash
# Watcher (scripts/brain-sync.sh)
while inotifywait -r -e modify,create,delete ./brain/ 2>/dev/null; do
  cd brain && git add -A && \
  git commit -m "brain: auto-sync $(date +%Y-%m-%d_%H:%M)" && \
  git push && cd ..
done

# Cron fallback (every 30 min)
# */30 * * * * cd /path/to/workspace && bash scripts/brain-sync.sh >> logs/brain-sync.log 2>&1
```

## Rules

- Local knowledge first. External research is fallback, never default.
- Run startup search every session, no exceptions.
- Write back on all 3 triggers. The brain goes stale if agents only read.
- Never skip the daily log at session end.
- Write intel immediately when discovered — do not batch until session end.
- Templates live in `skills/brain/templates/`. Copy to `brain/_Templates/` during provisioning.

Related Skills

brainstorm

272
from automagik-dev/genie

Explore ambiguous or early-stage ideas interactively — tracks wish-readiness and crystallizes into a design for /wish.

work

272
from automagik-dev/genie

Execute an approved wish plan — orchestrate subagents per task group with fix loops, validation, and review handoff.

wish

272
from automagik-dev/genie

Convert an idea into a structured wish plan with scope, acceptance criteria, and execution groups for /work.

trace

272
from automagik-dev/genie

Dispatch trace subagent to investigate unknown issues — reproduces, traces, and reports root cause for /fix handoff.

review

272
from automagik-dev/genie

Validate plans, execution, or PRs against wish criteria — returns SHIP / FIX-FIRST / BLOCKED with severity-tagged gaps.

report

272
from automagik-dev/genie

Investigate bugs comprehensively — cascade through /trace, capture browser evidence, extract observability data, and auto-create a GitHub issue with all findings.

refine

272
from automagik-dev/genie

Transform a brief or prompt into a structured, production-ready prompt via prompt-optimizer. File or text mode.

learn

272
from automagik-dev/genie

Diagnose and fix agent behavioral surfaces when the user corrects a mistake — connects to Claude native memory.

genie

272
from automagik-dev/genie

Transform any Claude Code session into an Automagik Genie orchestrator — guide users through brainstorm, wish, team, and PR lifecycle.

fix

272
from automagik-dev/genie

Dispatch fix subagent for FIX-FIRST gaps from /review, re-review, and escalate after 2 failed loops.

dream

272
from automagik-dev/genie

Batch-execute SHIP-ready wishes overnight — pick wishes, orchestrate workers, review PRs, wake up to results.

docs

272
from automagik-dev/genie

Dispatch docs subagent to audit, generate, and validate documentation against the codebase.