@brainjar/cli 0.2.1 → 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.
- package/README.md +9 -296
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/brainjar-sh/brainjar-cli/actions/workflows/ci.yml)
|
|
4
4
|
[](https://www.npmjs.com/package/@brainjar/cli)
|
|
5
|
+
[](https://www.npmjs.com/package/@brainjar/cli)
|
|
5
6
|
[](LICENSE)
|
|
6
7
|
|
|
7
8
|
Shape how your AI thinks — identity, soul, persona, rules.
|
|
8
9
|
|
|
9
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.
|
|
10
11
|
|
|
12
|
+
**[Documentation](https://brainjar.sh)** · **[Getting Started](https://brainjar.sh/getting-started/)**
|
|
13
|
+
|
|
11
14
|
## Quick start
|
|
12
15
|
|
|
13
16
|
```bash
|
|
@@ -21,272 +24,14 @@ brainjar init --default
|
|
|
21
24
|
brainjar status
|
|
22
25
|
```
|
|
23
26
|
|
|
24
|
-
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.
|
|
25
|
-
|
|
26
27
|
## Concepts
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
### Soul — who the agent is
|
|
31
|
-
|
|
32
|
-
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.
|
|
33
|
-
|
|
34
|
-
### Persona — how the agent works
|
|
35
|
-
|
|
36
|
-
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.
|
|
37
|
-
|
|
38
|
-
Personas bundle their own rules via frontmatter:
|
|
39
|
-
|
|
40
|
-
```yaml
|
|
41
|
-
---
|
|
42
|
-
rules:
|
|
43
|
-
- default
|
|
44
|
-
- security
|
|
45
|
-
---
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
### Rules — what the agent must follow
|
|
49
|
-
|
|
50
|
-
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.
|
|
51
|
-
|
|
52
|
-
### Brain — a saved configuration
|
|
53
|
-
|
|
54
|
-
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."
|
|
55
|
-
|
|
56
|
-
### How they compose
|
|
57
|
-
|
|
58
|
-
```
|
|
59
|
-
soul + persona + rules = full agent behavior
|
|
60
|
-
│ │
|
|
61
|
-
└── bundled rules ───┘ (from persona frontmatter)
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
A brain captures all three layers. `compose` assembles them into a single prompt for subagent dispatch.
|
|
65
|
-
|
|
66
|
-
## State cascade
|
|
67
|
-
|
|
68
|
-
State merges in three tiers. Each tier overrides the previous:
|
|
69
|
-
|
|
70
|
-
```
|
|
71
|
-
global → local → env
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
| Tier | Storage | When to use |
|
|
75
|
-
|------|---------|-------------|
|
|
76
|
-
| **Global** | `~/.brainjar/state.yaml` | Default behavior across all projects |
|
|
77
|
-
| **Local** | `.brainjar/state.yaml` (in project) | Per-project overrides |
|
|
78
|
-
| **Env** | `BRAINJAR_*` environment variables | Per-session or CI overrides |
|
|
79
|
-
|
|
80
|
-
```bash
|
|
81
|
-
# Global (default for all projects)
|
|
82
|
-
brainjar persona use engineer
|
|
83
|
-
|
|
84
|
-
# Local (this project only)
|
|
85
|
-
brainjar persona use planner --local
|
|
86
|
-
|
|
87
|
-
# Env (this session only)
|
|
88
|
-
BRAINJAR_PERSONA=reviewer claude
|
|
89
|
-
|
|
90
|
-
# Or use a subshell for scoped sessions
|
|
91
|
-
brainjar shell --persona reviewer --rules-add security
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
`brainjar status` shows where each setting comes from:
|
|
95
|
-
|
|
96
|
-
```
|
|
97
|
-
soul craftsman (global)
|
|
98
|
-
persona planner (local)
|
|
99
|
-
rules default (global), security (+local)
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
### Scope annotations
|
|
103
|
-
|
|
104
|
-
When you see scope labels in `status` and `rules list` output:
|
|
105
|
-
|
|
106
|
-
| Label | Meaning |
|
|
29
|
+
| Layer | Purpose |
|
|
107
30
|
|-------|---------|
|
|
108
|
-
|
|
|
109
|
-
|
|
|
110
|
-
|
|
|
111
|
-
|
|
|
112
|
-
| `(env)` | Overridden by `BRAINJAR_*` env var |
|
|
113
|
-
| `(+env)` | Added by env var |
|
|
114
|
-
| `(-env)` | Removed by env var |
|
|
115
|
-
|
|
116
|
-
### Environment variables
|
|
117
|
-
|
|
118
|
-
These env vars override all other state when set:
|
|
119
|
-
|
|
120
|
-
| Variable | Effect |
|
|
121
|
-
|----------|--------|
|
|
122
|
-
| `BRAINJAR_HOME` | Override `~/.brainjar/` location |
|
|
123
|
-
| `BRAINJAR_SOUL` | Override active soul |
|
|
124
|
-
| `BRAINJAR_PERSONA` | Override active persona |
|
|
125
|
-
| `BRAINJAR_IDENTITY` | Override active identity |
|
|
126
|
-
| `BRAINJAR_RULES_ADD` | Comma-separated rules to add |
|
|
127
|
-
| `BRAINJAR_RULES_REMOVE` | Comma-separated rules to remove |
|
|
128
|
-
|
|
129
|
-
Set to empty string to explicitly unset (e.g., `BRAINJAR_SOUL=""` removes the soul for that session).
|
|
130
|
-
|
|
131
|
-
## What it does
|
|
132
|
-
|
|
133
|
-
```
|
|
134
|
-
~/.brainjar/
|
|
135
|
-
souls/ # Voice and character — who the agent is
|
|
136
|
-
craftsman.md
|
|
137
|
-
personas/ # Role and workflow — how the agent works
|
|
138
|
-
engineer.md
|
|
139
|
-
planner.md
|
|
140
|
-
reviewer.md
|
|
141
|
-
rules/ # Constraints — what the agent must follow
|
|
142
|
-
default/ # Boundaries, context recovery, task completion
|
|
143
|
-
git-discipline.md
|
|
144
|
-
security.md
|
|
145
|
-
brains/ # Full-stack snapshots — soul + persona + rules
|
|
146
|
-
review.yaml
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
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.
|
|
150
|
-
|
|
151
|
-
## Layers
|
|
152
|
-
|
|
153
|
-
### Soul
|
|
154
|
-
|
|
155
|
-
```bash
|
|
156
|
-
brainjar soul create mysoul --description "Direct and rigorous"
|
|
157
|
-
brainjar soul use mysoul
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
### Persona
|
|
161
|
-
|
|
162
|
-
```bash
|
|
163
|
-
brainjar persona use planner # Design session
|
|
164
|
-
brainjar persona use engineer # Build session
|
|
165
|
-
brainjar persona use reviewer # Review session
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
### Rules
|
|
169
|
-
|
|
170
|
-
```bash
|
|
171
|
-
brainjar rules create no-delete --description "Never delete files without asking"
|
|
172
|
-
brainjar rules add no-delete
|
|
173
|
-
brainjar rules remove no-delete
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
### Brain
|
|
177
|
-
|
|
178
|
-
```bash
|
|
179
|
-
brainjar brain save review # Snapshot current state as a brain
|
|
180
|
-
brainjar brain use review # Activate soul + persona + rules in one shot
|
|
181
|
-
brainjar brain list # See available brains
|
|
182
|
-
brainjar brain show review # Inspect a brain's config
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
When to use a brain vs. switching layers individually:
|
|
186
|
-
- **Brain:** Repeatable workflow you do often (code review, design, debugging). Save once, activate in one command.
|
|
187
|
-
- **Individual layers:** Exploratory work, one-off overrides, or when you only need to change one thing.
|
|
188
|
-
|
|
189
|
-
## Subagent orchestration
|
|
190
|
-
|
|
191
|
-
Personas can spawn other personas as subagents. For example, a tech-lead persona can:
|
|
192
|
-
|
|
193
|
-
1. Spawn an **architect** subagent for design — produces a design doc
|
|
194
|
-
2. Get user approval
|
|
195
|
-
3. Implement the design itself
|
|
196
|
-
4. Spawn a **reviewer** subagent to verify — compares code against the spec
|
|
197
|
-
|
|
198
|
-
Each subagent gets the full brain context: soul + persona + rules. The `compose` command assembles the full prompt in a single call:
|
|
199
|
-
|
|
200
|
-
```bash
|
|
201
|
-
# Primary path — brain drives everything
|
|
202
|
-
brainjar compose review --task "Review the changes in src/sync.ts"
|
|
203
|
-
|
|
204
|
-
# Ad-hoc — no saved brain, specify persona directly
|
|
205
|
-
brainjar compose --persona reviewer --task "Review the changes in src/sync.ts"
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
For more granular control, use `brainjar persona show <name>` and `brainjar rules show <name>` to retrieve individual layers.
|
|
209
|
-
|
|
210
|
-
## Recipes
|
|
211
|
-
|
|
212
|
-
### Code review session
|
|
213
|
-
|
|
214
|
-
```bash
|
|
215
|
-
# Save a review brain once
|
|
216
|
-
brainjar soul use craftsman
|
|
217
|
-
brainjar persona use reviewer
|
|
218
|
-
brainjar rules add default
|
|
219
|
-
brainjar rules add security
|
|
220
|
-
brainjar brain save review
|
|
221
|
-
|
|
222
|
-
# Then activate it anytime
|
|
223
|
-
brainjar brain use review
|
|
224
|
-
|
|
225
|
-
# Or scope it to a single session
|
|
226
|
-
brainjar shell --brain review
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
### CI pipeline — enforce rules without a persona
|
|
230
|
-
|
|
231
|
-
```bash
|
|
232
|
-
# In CI, use env vars to override behavior
|
|
233
|
-
BRAINJAR_PERSONA=auditor BRAINJAR_RULES_ADD=security,compliance brainjar status --sync
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
### Project-specific persona
|
|
237
|
-
|
|
238
|
-
```bash
|
|
239
|
-
# In your project directory
|
|
240
|
-
brainjar persona use planner --local
|
|
241
|
-
brainjar rules add no-delete --local
|
|
242
|
-
|
|
243
|
-
# Global settings still apply — local just overrides what you specify
|
|
244
|
-
brainjar status
|
|
245
|
-
# soul craftsman (global)
|
|
246
|
-
# persona planner (local)
|
|
247
|
-
# rules default (global), no-delete (+local)
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
## Pack
|
|
251
|
-
|
|
252
|
-
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.
|
|
253
|
-
|
|
254
|
-
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`.
|
|
255
|
-
|
|
256
|
-
```bash
|
|
257
|
-
# Export a brain as a pack
|
|
258
|
-
brainjar pack export review # creates ./review/
|
|
259
|
-
brainjar pack export review --out /tmp # creates /tmp/review/
|
|
260
|
-
brainjar pack export review --name my-review # override pack name
|
|
261
|
-
brainjar pack export review --version 1.0.0 # set version (default: 0.1.0)
|
|
262
|
-
brainjar pack export review --author frank # set author field
|
|
263
|
-
|
|
264
|
-
# Import a pack
|
|
265
|
-
brainjar pack import ./review # import into ~/.brainjar/
|
|
266
|
-
brainjar pack import ./review --force # overwrite conflicts
|
|
267
|
-
brainjar pack import ./review --merge # rename conflicts as <name>-from-<packname>
|
|
268
|
-
brainjar pack import ./review --activate # activate the brain after import
|
|
269
|
-
```
|
|
270
|
-
|
|
271
|
-
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.
|
|
272
|
-
|
|
273
|
-
## Hooks
|
|
274
|
-
|
|
275
|
-
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.
|
|
276
|
-
|
|
277
|
-
```bash
|
|
278
|
-
# Install hooks (writes to ~/.claude/settings.json)
|
|
279
|
-
brainjar hooks install
|
|
280
|
-
|
|
281
|
-
# Install for this project only
|
|
282
|
-
brainjar hooks install --local
|
|
283
|
-
|
|
284
|
-
# Check hook status
|
|
285
|
-
brainjar hooks status
|
|
286
|
-
|
|
287
|
-
# Remove hooks
|
|
288
|
-
brainjar hooks remove
|
|
289
|
-
```
|
|
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 |
|
|
290
35
|
|
|
291
36
|
## Commands
|
|
292
37
|
|
|
@@ -295,7 +40,6 @@ brainjar init [--default] [--obsidian] [--backend claude|codex]
|
|
|
295
40
|
brainjar status [--sync] [--global|--local] [--short]
|
|
296
41
|
brainjar sync [--quiet]
|
|
297
42
|
brainjar compose <brain> [--task <text>]
|
|
298
|
-
brainjar compose --persona <name> [--task <text>]
|
|
299
43
|
|
|
300
44
|
brainjar brain save|use|list|show|drop
|
|
301
45
|
brainjar soul create|list|show|use|drop
|
|
@@ -309,38 +53,7 @@ brainjar shell [--brain|--soul|--persona|--identity|--rules-add|--rules-remove]
|
|
|
309
53
|
brainjar reset [--backend claude|codex]
|
|
310
54
|
```
|
|
311
55
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
```bash
|
|
315
|
-
brainjar persona show reviewer # View a specific persona
|
|
316
|
-
brainjar soul show # View the active soul
|
|
317
|
-
brainjar rules show security # View a rule's content
|
|
318
|
-
brainjar status --short # One-liner: soul | persona | identity
|
|
319
|
-
brainjar soul show --short # Just the active soul name
|
|
320
|
-
```
|
|
321
|
-
|
|
322
|
-
## Obsidian support
|
|
323
|
-
|
|
324
|
-
`~/.brainjar/` is a folder of markdown files — it's already almost an Obsidian vault.
|
|
325
|
-
|
|
326
|
-
```bash
|
|
327
|
-
brainjar init --obsidian
|
|
328
|
-
```
|
|
329
|
-
|
|
330
|
-
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.
|
|
331
|
-
|
|
332
|
-
## Backends
|
|
333
|
-
|
|
334
|
-
```bash
|
|
335
|
-
brainjar init --backend codex # writes ~/.codex/AGENTS.md
|
|
336
|
-
brainjar reset --backend codex
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
Supported: `claude` (default), `codex`
|
|
340
|
-
|
|
341
|
-
## Backup & restore
|
|
342
|
-
|
|
343
|
-
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.
|
|
344
57
|
|
|
345
58
|
## Development
|
|
346
59
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brainjar/cli",
|
|
3
|
-
"version": "0.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://
|
|
11
|
+
"homepage": "https://brainjar.sh",
|
|
12
12
|
"bugs": "https://github.com/brainjar-sh/brainjar-cli/issues",
|
|
13
13
|
"keywords": [
|
|
14
14
|
"ai",
|