Skip to content

Core Concepts

brainjar manages AI agent behavior through composable layers. Each layer is a markdown document held in your local SQLite store (or a brainjar serve instance). 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.
PersonaThe role the agent playsPer task or session
RulesWhat constraints apply — guardrailsPer project or persona
ProcedureThe step-by-step playbook the agent followsPer workflow (delivery, incident, migration)
SkillOn-demand capabilities the platform loads — runbooks, tools, glossariesPer task or contextual need
BrainSaved bundle of the five aboveWhen you want a repeatable setup

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

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

Both sources merge. Deduplication is automatic.

InputSource
SoulExplicitly activated
PersonaExplicitly activated
ProcedureExplicitly activated (or bundled with a brain)
RulesExplicitly activated + bundled in persona frontmatter

State merges in two tiers. The project layer overrides the workspace layer:

workspace → project
TierStorageWhen to use
WorkspaceDefault scopeDefault behavior across all projects
ProjectPer-project scopePer-project overrides

Project scope is auto-detected from the basename of the nearest .git root walking up from your working directory (must be a valid slug — lowercase, hyphen-separated). Pass --project <slug> to override or to force a specific project. If the basename isn’t a valid slug, the CLI falls back to workspace scope and warns on stderr.

See Configuration for details on each tier and the status and sync commands.

The CLI talks to a local SQLite store under ~/.brainjar by default. Add a remote context (brainjar context add … --url …) to point it at a brainjar serve instance instead. See Architecture for the components, files on disk, and how contexts and platforms fit together.