Skip to content

How Bonsai Works

Bonsai is a CLI generator, not a runtime. It runs once to write a workspace under station/ plus per-agent workspaces, then Claude Code agents read those files via hooks at session start and during tool use.

Generated artifactWhat it does
agent/Core/identity.md + agent/Core/memory.mdWho the agent is and what it carries forward between sessions
agent/Protocols/ (security.md, scope-boundaries.md, session-start.md)Hard rules read at the top of every session
agent/Workflows/Step-by-step procedures (planning, code review, PR review, audits) loaded on demand
agent/Skills/Domain knowledge (standards, checklists, templates) referenced during work
agent/Sensors/*.shShell scripts wired into Claude Code hooks (SessionStart, PreToolUse, Stop)
agent/Routines/ + agent/Core/routines.mdPeriodic maintenance procedures with a tracked dashboard (Tech Lead only)
station/Playbook/, station/Logs/, station/Reports/Shared scaffolding — status, roadmap, plans, decisions, reports — referenced by every agent

station/ is the Tech Lead’s workspace and the shared scaffolding every code agent’s plans, status, and decisions reference. Code agents (backend, frontend, devops, security) get their own <agent>/ workspaces, but they all link back to station/Playbook/Status.md, station/Playbook/Plans/Active/, and station/Logs/KeyDecisionLog.md so coordination lives in one place under version control.

Each agent’s instructions are layered, from foundational to automated:

Layer 6 │ Sensors │ Automated enforcement (hook scripts)
Layer 5 │ Routines │ Periodic maintenance procedures (Tech Lead)
Layer 4 │ Skills │ Domain knowledge and standards
Layer 3 │ Workflows │ Step-by-step task procedures
Layer 2 │ Protocols │ Hard rules (security, scope, startup)
Layer 1 │ Core │ Identity + memory + self-awareness

bonsai init sets up the station with the Tech Lead. You talk to the Tech Lead; it plans, dispatches, and reviews. Code agents execute.

You (human)
└── Tech Lead (station/) plans, reviews, orchestrates, runs routines
├── Backend (backend/) API, database, server logic
├── Frontend (frontend/) UI, components, styling
├── DevOps (devops/) infrastructure, CI/CD
└── Security (security/) audits, scanning

After bonsai init followed by bonsai add backend:

  • Directoryyour-project/
    • .bonsai.yaml — project config
    • .bonsai-lock.yaml — file tracking (hashes for conflict detection)
    • .claude/settings.json — auto-wired sensor hooks
    • CLAUDE.md — root navigation
    • Directorystation/ — Tech Lead workspace + project scaffolding
      • CLAUDE.md — navigation (cross-linked)
      • INDEX.md — project snapshot
      • Directoryagent/
        • DirectoryCore/ — identity, memory, self-awareness
        • DirectoryProtocols/ — security, scope, startup sequence
        • DirectoryWorkflows/ — planning, code-review, audit, etc.
        • DirectorySkills/ — standards, patterns, checklists
        • DirectorySensors/ — hook scripts (.sh)
        • DirectoryRoutines/ — maintenance procedures
      • DirectoryPlaybook/ — status, roadmap, plans, standards
      • DirectoryLogs/ — field notes, decisions, routine log
      • DirectoryReports/ — completion reports
    • Directorybackend/ — code agent workspace
      • CLAUDE.md — agent-specific navigation
      • Directoryagent/
        • DirectoryCore/ — identity, memory, self-awareness
        • DirectoryProtocols/ — hard rules
        • DirectoryWorkflows/ — task procedures
        • DirectorySkills/ — domain knowledge
        • DirectorySensors/ — hook scripts

Every file reference is a clickable markdown link — open the workspace in Obsidian to see the full knowledge graph, or browse it on GitHub.