Skip to content

Core Concepts

brainjar manages AI agent behavior through composable layers. Each layer is a markdown document stored on the brainjar server. They compose together to form the agent’s full behavior. For the full rationale behind this approach, see Why Composable Prompts.

LayerPurposeChanges how often
SoulWho the agent is — voice, characterRarely. You probably have 1–2.
PersonaHow the agent works — role, workflowPer task or session
RulesWhat constraints apply — guardrailsPer project or persona
BrainSaved snapshot of all threeWhen you want a repeatable setup

At sync time, brainjar merges the active soul, persona, and rules into a single config block. Rules come from two sources:

  1. Explicitly activated via brainjar rules add
  2. Bundled with a persona via its frontmatter

Both sources merge. Deduplication is automatic.

InputSource
SoulExplicitly activated
PersonaExplicitly activated
RulesExplicitly activated + bundled in persona frontmatter

State merges in three tiers. Each tier overrides the previous:

workspace → project → env
TierStorageWhen to use
WorkspaceServer (default scope)Default behavior across all projects
ProjectServer (per-project scope)Per-project overrides
EnvBRAINJAR_* environment variablesPer-session or CI overrides

Project scope is auto-detected when your working directory contains a .brainjar/ directory. No --project flag needed.

See Configuration for details on each tier.

All content (souls, personas, rules, brains) and state lives on the brainjar server. The CLI is a thin client that talks to the server via HTTP. See Architecture for details on the server, local files, and deployment modes.