From claude-brain
Set up brain hooks and vault structure for a new project. Use when the user says "настрой brain", "setup brain", "подключи brain к проекту", "initialize brain", or when brain.conf is missing and the project needs session continuity configured.
How this skill is triggered — by the user, by Claude, or both
Slash command
/claude-brain:brain-setupThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Set up the full brain infrastructure in the current project. This creates hooks, config, vault folders, and SESSION_STATE.md.
Set up the full brain infrastructure in the current project. This creates hooks, config, vault folders, and SESSION_STATE.md.
Ask the user for:
~/Documents/Obsidian Vault)Write .claude/brain.conf in the project root:
vault_name=<VaultName>
vault_base=<VaultBasePath>
Create these folders in the vault if they don't exist:
$VAULT_BASE/$VAULT_NAME/
├── 1. Проект/ # Overview, tech stack, architecture
├── 2. Модули/ # One file per module (with YAML properties)
├── 3. Журнал/ # Change log entries
│ └── YYYY-MM/
├── 4. Активная работа/ # SESSION_STATE.md + WIP
│ └── _state_backups/
├── 5. Планы/ # Roadmap, bugs, tech debt, ideas
└── 6. Справочник/ # Design system, core functions, patterns, TEMPLATES.md
Write initial STATE at $VAULT/4. Активная работа/SESSION_STATE.md:
---
last_updated: <current datetime>
task_id: "setup-001"
compression_count: 0
session_label: ""
---
# SESSION_STATE — <ProjectName>
## Сейчас
Initial brain setup.
→ Следующий шаг: project CLAUDE.md — добавить Continuity-блок + критичные правила проекта
## Очередь
- [ ] заполнить критичные правила проекта
## Решения (свежие)
## Заметки / контекст
[начальная настройка]
Create .claude/hooks/ directory with three scripts. Use templates from templates/ in this skill directory.
Read each template, replace __VAULT_BASE__ and __VAULT_NAME__ with actual values, and write to:
.claude/hooks/session-start.sh.claude/hooks/pre-compact.sh.claude/hooks/post-compact.shMake all scripts executable: chmod +x .claude/hooks/*.sh
Read existing .claude/settings.json (or create if missing). Merge hook configuration:
{
"compactPrompt": "При сжатии контекста ОБЯЗАТЕЛЬНО сохрани в summary:\n1. Путь к SESSION_STATE.md\n2. Текущий шаг — строка '→ Следующий шаг:' из SESSION_STATE\n3. Все имена изменённых файлов этой сессии\n4. Все принятые решения с обоснованием\n5. Дословные требования пользователя по текущей задаче\n6. task_id текущей задачи\n7. Инструкция: ПОСЛЕ СЖАТИЯ сначала прочитать SESSION_STATE.md и Continuity-блок в CLAUDE.md, затем продолжить со строки '→ Следующий шаг:'",
"hooks": {
"SessionStart": [
{
"hooks": [
{
"type": "command",
"command": "bash <PROJECT_ROOT>/.claude/hooks/session-start.sh"
}
]
}
],
"PreCompact": [
{
"hooks": [
{
"type": "command",
"command": "bash <PROJECT_ROOT>/.claude/hooks/pre-compact.sh"
}
]
}
],
"PostCompact": [
{
"hooks": [
{
"type": "command",
"command": "bash <PROJECT_ROOT>/.claude/hooks/post-compact.sh"
}
]
}
]
}
}
Replace <PROJECT_ROOT> with the actual project path, escaping spaces with \\ .
Preserve any existing settings (permissions, other hooks) — merge, don't overwrite.
The session-start / post-compact hooks reference a «🧠 Continuity» block in the project CLAUDE.md. Add it idempotently — insert only if missing, NEVER overwrite an existing one:
CLAUDE.md (create if absent).templates/CLAUDE.cli.md.template in shared templates — sections «🧭 Матрица-роутер» + «🧠 Continuity»), with {{VAULT}} / {{PROJECT_NAME}} substituted.Rule: insert-if-missing, never overwrite. Same principle as «один SESSION_STATE — mv, не copy».
→ Следующий шаг: extracted).compression_count bumps after a pre-compact run.Tell the user:
→ Следующий шаг: anchor)references/project-rules.md in brain-protocol skill)npx claudepluginhub bogdan-cool-coder/claude-brain --plugin claude-brainCreates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.