@brainjar/cli 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +8 -296
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -9,6 +9,8 @@ Shape how your AI thinks — identity, soul, persona, rules.
9
9
 
10
10
  brainjar manages AI agent behavior through composable layers. Instead of one monolithic config file, you separate **what the agent sounds like** (soul), **how it works** (persona), and **what constraints it follows** (rules). Each layer is a markdown file. Mix and match them per project, per task, or per session.
11
11
 
12
+ **[Documentation](https://brainjar.sh)** · **[Getting Started](https://brainjar.sh/getting-started/)**
13
+
12
14
  ## Quick start
13
15
 
14
16
  ```bash
@@ -22,272 +24,14 @@ brainjar init --default
22
24
  brainjar status
23
25
  ```
24
26
 
25
- That gives you a soul (craftsman), a persona (engineer), and rules (boundaries, git discipline, security) — all wired into your `CLAUDE.md` and ready to go.
26
-
27
27
  ## Concepts
28
28
 
29
- brainjar has four core concepts. Understanding these makes everything else click.
30
-
31
- ### Soul — who the agent is
32
-
33
- The soul defines personality: tone, character, standards. It's the constant across all tasks. You probably only have one or two. Think of it as the agent's voice.
34
-
35
- ### Persona — how the agent works
36
-
37
- Personas define role and workflow. An engineer persona works differently than a reviewer or an architect. Switch personas based on what you're doing — they're the agent's job description.
38
-
39
- Personas bundle their own rules via frontmatter:
40
-
41
- ```yaml
42
- ---
43
- rules:
44
- - default
45
- - security
46
- ---
47
- ```
48
-
49
- ### Rules — what the agent must follow
50
-
51
- Rules are behavioral constraints — guardrails that apply regardless of persona. Single files or multi-file packs (directories). Rules from a persona's frontmatter activate automatically when that persona is active.
52
-
53
- ### Brain — a saved configuration
54
-
55
- A brain is a named snapshot of soul + persona + rules. Instead of switching three things separately, save your setup once and activate it in one shot. Useful for repeatable workflows like "code review" or "design session."
56
-
57
- ### How they compose
58
-
59
- ```
60
- soul + persona + rules = full agent behavior
61
- │ │
62
- └── bundled rules ───┘ (from persona frontmatter)
63
- ```
64
-
65
- A brain captures all three layers. `compose` assembles them into a single prompt for subagent dispatch.
66
-
67
- ## State cascade
68
-
69
- State merges in three tiers. Each tier overrides the previous:
70
-
71
- ```
72
- global → local → env
73
- ```
74
-
75
- | Tier | Storage | When to use |
76
- |------|---------|-------------|
77
- | **Global** | `~/.brainjar/state.yaml` | Default behavior across all projects |
78
- | **Local** | `.brainjar/state.yaml` (in project) | Per-project overrides |
79
- | **Env** | `BRAINJAR_*` environment variables | Per-session or CI overrides |
80
-
81
- ```bash
82
- # Global (default for all projects)
83
- brainjar persona use engineer
84
-
85
- # Local (this project only)
86
- brainjar persona use planner --local
87
-
88
- # Env (this session only)
89
- BRAINJAR_PERSONA=reviewer claude
90
-
91
- # Or use a subshell for scoped sessions
92
- brainjar shell --persona reviewer --rules-add security
93
- ```
94
-
95
- `brainjar status` shows where each setting comes from:
96
-
97
- ```
98
- soul craftsman (global)
99
- persona planner (local)
100
- rules default (global), security (+local)
101
- ```
102
-
103
- ### Scope annotations
104
-
105
- When you see scope labels in `status` and `rules list` output:
106
-
107
- | Label | Meaning |
29
+ | Layer | Purpose |
108
30
  |-------|---------|
109
- | `(global)` | Set in `~/.brainjar/state.yaml` |
110
- | `(local)` | Overridden in `.brainjar/state.yaml` |
111
- | `(+local)` | Added by local override (not in global) |
112
- | `(-local)` | Removed by local override (active globally, suppressed here) |
113
- | `(env)` | Overridden by `BRAINJAR_*` env var |
114
- | `(+env)` | Added by env var |
115
- | `(-env)` | Removed by env var |
116
-
117
- ### Environment variables
118
-
119
- These env vars override all other state when set:
120
-
121
- | Variable | Effect |
122
- |----------|--------|
123
- | `BRAINJAR_HOME` | Override `~/.brainjar/` location |
124
- | `BRAINJAR_SOUL` | Override active soul |
125
- | `BRAINJAR_PERSONA` | Override active persona |
126
- | `BRAINJAR_IDENTITY` | Override active identity |
127
- | `BRAINJAR_RULES_ADD` | Comma-separated rules to add |
128
- | `BRAINJAR_RULES_REMOVE` | Comma-separated rules to remove |
129
-
130
- Set to empty string to explicitly unset (e.g., `BRAINJAR_SOUL=""` removes the soul for that session).
131
-
132
- ## What it does
133
-
134
- ```
135
- ~/.brainjar/
136
- souls/ # Voice and character — who the agent is
137
- craftsman.md
138
- personas/ # Role and workflow — how the agent works
139
- engineer.md
140
- planner.md
141
- reviewer.md
142
- rules/ # Constraints — what the agent must follow
143
- default/ # Boundaries, context recovery, task completion
144
- git-discipline.md
145
- security.md
146
- brains/ # Full-stack snapshots — soul + persona + rules
147
- review.yaml
148
- ```
149
-
150
- brainjar reads these markdown files, merges the active layers, and inlines them into your agent's config (`~/.claude/CLAUDE.md` or `.codex/AGENTS.md`) between `<!-- brainjar:start -->` / `<!-- brainjar:end -->` markers. Everything outside the markers is yours. Change a layer, and the agent's behavior changes on next sync.
151
-
152
- ## Layers
153
-
154
- ### Soul
155
-
156
- ```bash
157
- brainjar soul create mysoul --description "Direct and rigorous"
158
- brainjar soul use mysoul
159
- ```
160
-
161
- ### Persona
162
-
163
- ```bash
164
- brainjar persona use planner # Design session
165
- brainjar persona use engineer # Build session
166
- brainjar persona use reviewer # Review session
167
- ```
168
-
169
- ### Rules
170
-
171
- ```bash
172
- brainjar rules create no-delete --description "Never delete files without asking"
173
- brainjar rules add no-delete
174
- brainjar rules remove no-delete
175
- ```
176
-
177
- ### Brain
178
-
179
- ```bash
180
- brainjar brain save review # Snapshot current state as a brain
181
- brainjar brain use review # Activate soul + persona + rules in one shot
182
- brainjar brain list # See available brains
183
- brainjar brain show review # Inspect a brain's config
184
- ```
185
-
186
- When to use a brain vs. switching layers individually:
187
- - **Brain:** Repeatable workflow you do often (code review, design, debugging). Save once, activate in one command.
188
- - **Individual layers:** Exploratory work, one-off overrides, or when you only need to change one thing.
189
-
190
- ## Subagent orchestration
191
-
192
- Personas can spawn other personas as subagents. For example, a tech-lead persona can:
193
-
194
- 1. Spawn an **architect** subagent for design — produces a design doc
195
- 2. Get user approval
196
- 3. Implement the design itself
197
- 4. Spawn a **reviewer** subagent to verify — compares code against the spec
198
-
199
- Each subagent gets the full brain context: soul + persona + rules. The `compose` command assembles the full prompt in a single call:
200
-
201
- ```bash
202
- # Primary path — brain drives everything
203
- brainjar compose review --task "Review the changes in src/sync.ts"
204
-
205
- # Ad-hoc — no saved brain, specify persona directly
206
- brainjar compose --persona reviewer --task "Review the changes in src/sync.ts"
207
- ```
208
-
209
- For more granular control, use `brainjar persona show <name>` and `brainjar rules show <name>` to retrieve individual layers.
210
-
211
- ## Recipes
212
-
213
- ### Code review session
214
-
215
- ```bash
216
- # Save a review brain once
217
- brainjar soul use craftsman
218
- brainjar persona use reviewer
219
- brainjar rules add default
220
- brainjar rules add security
221
- brainjar brain save review
222
-
223
- # Then activate it anytime
224
- brainjar brain use review
225
-
226
- # Or scope it to a single session
227
- brainjar shell --brain review
228
- ```
229
-
230
- ### CI pipeline — enforce rules without a persona
231
-
232
- ```bash
233
- # In CI, use env vars to override behavior
234
- BRAINJAR_PERSONA=auditor BRAINJAR_RULES_ADD=security,compliance brainjar status --sync
235
- ```
236
-
237
- ### Project-specific persona
238
-
239
- ```bash
240
- # In your project directory
241
- brainjar persona use planner --local
242
- brainjar rules add no-delete --local
243
-
244
- # Global settings still apply — local just overrides what you specify
245
- brainjar status
246
- # soul craftsman (global)
247
- # persona planner (local)
248
- # rules default (global), no-delete (+local)
249
- ```
250
-
251
- ## Pack
252
-
253
- Packs are self-contained, shareable bundles of a brain and all its layers — soul, persona, and rules. Export a brain as a pack directory, hand it to a teammate, and they import it in one command.
254
-
255
- A pack mirrors the `~/.brainjar/` structure with a `pack.yaml` manifest at the root. No tarballs, no magic — just files you can inspect with `ls` and `cat`.
256
-
257
- ```bash
258
- # Export a brain as a pack
259
- brainjar pack export review # creates ./review/
260
- brainjar pack export review --out /tmp # creates /tmp/review/
261
- brainjar pack export review --name my-review # override pack name
262
- brainjar pack export review --version 1.0.0 # set version (default: 0.1.0)
263
- brainjar pack export review --author frank # set author field
264
-
265
- # Import a pack
266
- brainjar pack import ./review # import into ~/.brainjar/
267
- brainjar pack import ./review --force # overwrite conflicts
268
- brainjar pack import ./review --merge # rename conflicts as <name>-from-<packname>
269
- brainjar pack import ./review --activate # activate the brain after import
270
- ```
271
-
272
- On conflict (a file already exists with different content), import fails by default and lists the conflicts. Use `--force` to overwrite or `--merge` to keep both versions. Identical files are silently skipped.
273
-
274
- ## Hooks
275
-
276
- brainjar integrates with Claude Code's hook system for automatic context injection. When hooks are installed, brainjar syncs your config on every session start — no manual `brainjar sync` needed.
277
-
278
- ```bash
279
- # Install hooks (writes to ~/.claude/settings.json)
280
- brainjar hooks install
281
-
282
- # Install for this project only
283
- brainjar hooks install --local
284
-
285
- # Check hook status
286
- brainjar hooks status
287
-
288
- # Remove hooks
289
- brainjar hooks remove
290
- ```
31
+ | **Soul** | Who the agent is — voice, character, standards |
32
+ | **Persona** | How the agent works — role, workflow, bundled rules |
33
+ | **Rules** | Behavioral constraints guardrails that apply regardless of persona |
34
+ | **Brain** | Saved snapshot of soul + persona + rules — activate in one shot |
291
35
 
292
36
  ## Commands
293
37
 
@@ -296,7 +40,6 @@ brainjar init [--default] [--obsidian] [--backend claude|codex]
296
40
  brainjar status [--sync] [--global|--local] [--short]
297
41
  brainjar sync [--quiet]
298
42
  brainjar compose <brain> [--task <text>]
299
- brainjar compose --persona <name> [--task <text>]
300
43
 
301
44
  brainjar brain save|use|list|show|drop
302
45
  brainjar soul create|list|show|use|drop
@@ -310,38 +53,7 @@ brainjar shell [--brain|--soul|--persona|--identity|--rules-add|--rules-remove]
310
53
  brainjar reset [--backend claude|codex]
311
54
  ```
312
55
 
313
- `show` accepts an optional name to view any item, not just the active one. Use `--short` to get just the active name (useful in scripts and statuslines):
314
-
315
- ```bash
316
- brainjar persona show reviewer # View a specific persona
317
- brainjar soul show # View the active soul
318
- brainjar rules show security # View a rule's content
319
- brainjar status --short # One-liner: soul | persona | identity
320
- brainjar soul show --short # Just the active soul name
321
- ```
322
-
323
- ## Obsidian support
324
-
325
- `~/.brainjar/` is a folder of markdown files — it's already almost an Obsidian vault.
326
-
327
- ```bash
328
- brainjar init --obsidian
329
- ```
330
-
331
- Adds `.obsidian/` config that hides private files (state, identities) from the file explorer and includes templates for creating new souls, personas, and rules from within Obsidian.
332
-
333
- ## Backends
334
-
335
- ```bash
336
- brainjar init --backend codex # writes ~/.codex/AGENTS.md
337
- brainjar reset --backend codex
338
- ```
339
-
340
- Supported: `claude` (default), `codex`
341
-
342
- ## Backup & restore
343
-
344
- On first sync, brainjar backs up any existing config file to `CLAUDE.md.pre-brainjar`. Running `brainjar reset` removes brainjar-managed config and restores the backup.
56
+ See the [CLI reference](https://brainjar.sh/reference/cli/) for full details.
345
57
 
346
58
  ## Development
347
59
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainjar/cli",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Shape how your AI thinks — composable identity, soul, persona, and rules for AI agents",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -8,7 +8,7 @@
8
8
  "type": "git",
9
9
  "url": "https://github.com/brainjar-sh/brainjar-cli.git"
10
10
  },
11
- "homepage": "https://github.com/brainjar-sh/brainjar-cli",
11
+ "homepage": "https://brainjar.sh",
12
12
  "bugs": "https://github.com/brainjar-sh/brainjar-cli/issues",
13
13
  "keywords": [
14
14
  "ai",