brainclaw 1.9.0 → 1.9.1
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 +585 -499
- package/dist/brainclaw-vscode.vsix +0 -0
- package/dist/commands/harvest.js +1 -1
- package/dist/commands/hooks.js +73 -73
- package/dist/commands/init.js +1 -1
- package/dist/commands/install-hooks.js +78 -78
- package/dist/commands/mcp-read-handlers.js +57 -14
- package/dist/commands/mcp.js +79 -13
- package/dist/commands/switch.js +26 -5
- package/dist/commands/version.js +1 -1
- package/dist/core/agent-capability.js +19 -4
- package/dist/core/agent-files.js +119 -119
- package/dist/core/codev-prompts.js +38 -38
- package/dist/core/default-profiles/doctor.yaml +11 -11
- package/dist/core/default-profiles/janitor.yaml +11 -11
- package/dist/core/default-profiles/onboarder.yaml +11 -11
- package/dist/core/default-profiles/reviewer.yaml +13 -13
- package/dist/core/dispatcher.js +1 -1
- package/dist/core/entity-operations.js +29 -3
- package/dist/core/execution.js +1 -1
- package/dist/core/loops/verbs.js +0 -1
- package/dist/core/messaging.js +2 -2
- package/dist/core/protocol-skills.js +164 -164
- package/dist/core/runtime-signals.js +1 -1
- package/dist/core/search.js +19 -2
- package/dist/core/security-guard.js +207 -207
- package/dist/core/spawn-check.js +16 -2
- package/dist/core/staleness.js +1 -1
- package/dist/core/store-resolution.js +26 -7
- package/dist/core/worktree.js +18 -18
- package/dist/facts.js +3 -3
- package/dist/facts.json +2 -2
- package/docs/PROTOCOL.md +1 -1
- package/docs/adapters/openclaw.md +43 -43
- package/docs/architecture/project-refs.md +328 -328
- package/docs/cli.md +2093 -2093
- package/docs/concepts/coordination.md +52 -52
- package/docs/concepts/coordinator-runbook.md +129 -129
- package/docs/concepts/dispatch-lifecycle.md +245 -245
- package/docs/concepts/event-log-store.md +928 -928
- package/docs/concepts/ideation-loop.md +317 -317
- package/docs/concepts/loop-engine.md +520 -511
- package/docs/concepts/mcp-governance.md +268 -268
- package/docs/concepts/memory.md +84 -84
- package/docs/concepts/multi-agent-workflows.md +167 -167
- package/docs/concepts/observer-protocol.md +361 -361
- package/docs/concepts/plans-and-claims.md +217 -217
- package/docs/concepts/project-md-convention.md +35 -35
- package/docs/concepts/runtime-notes.md +38 -38
- package/docs/concepts/troubleshooting.md +254 -254
- package/docs/concepts/workspace-bootstrapping.md +142 -142
- package/docs/context-format-changelog.md +35 -35
- package/docs/context-format.md +48 -48
- package/docs/index.md +65 -65
- package/docs/integrations/agents.md +158 -158
- package/docs/integrations/claude-code.md +23 -23
- package/docs/integrations/cline.md +77 -77
- package/docs/integrations/continue.md +55 -55
- package/docs/integrations/copilot.md +68 -68
- package/docs/integrations/cursor.md +23 -23
- package/docs/integrations/kilocode.md +72 -72
- package/docs/integrations/mcp.md +377 -377
- package/docs/integrations/mistral-vibe.md +122 -122
- package/docs/integrations/openclaw.md +92 -92
- package/docs/integrations/opencode.md +84 -84
- package/docs/integrations/overview.md +115 -115
- package/docs/integrations/roo.md +71 -71
- package/docs/integrations/windsurf.md +77 -77
- package/docs/mcp-schema-changelog.md +360 -356
- package/docs/playbooks/integration/index.md +121 -121
- package/docs/playbooks/orchestration.md +37 -0
- package/docs/playbooks/productivity/index.md +99 -99
- package/docs/playbooks/team/index.md +117 -117
- package/docs/product/agent-first-model.md +184 -184
- package/docs/product/entity-model-audit.md +462 -462
- package/docs/product/positioning.md +86 -86
- package/docs/quickstart-existing-project.md +107 -107
- package/docs/quickstart.md +183 -183
- package/docs/release-maintenance.md +79 -79
- package/docs/reputation.md +52 -52
- package/docs/review.md +45 -45
- package/docs/security.md +212 -212
- package/docs/server-operations.md +118 -118
- package/docs/storage.md +106 -106
- package/package.json +80 -65
- package/docs/concepts/event-log-store-critique-A.md +0 -333
- package/docs/concepts/event-log-store-critique-B.md +0 -353
- package/docs/concepts/event-log-store-phase0-measurements.md +0 -58
- package/docs/concepts/event-log-store-proposal-A.md +0 -365
- package/docs/concepts/event-log-store-proposal-B.md +0 -404
- package/docs/concepts/identity-model-proposal.md +0 -371
|
@@ -1,118 +1,118 @@
|
|
|
1
|
-
# Server And Remote Operations
|
|
2
|
-
|
|
3
|
-
This guide is for complex operator environments such as DGX hosts, remote Linux servers, SSH-driven workflows, and multi-project workspaces where Brainclaw is not being used from a single local IDE.
|
|
4
|
-
|
|
5
|
-
## When this guide matters
|
|
6
|
-
|
|
7
|
-
Use this path when one or more of these are true:
|
|
8
|
-
|
|
9
|
-
- Brainclaw runs on a remote machine over SSH
|
|
10
|
-
- multiple repos or child projects live under one server workspace
|
|
11
|
-
- different agents resume each other over time on the same host
|
|
12
|
-
- the operator sometimes uses CLI directly instead of MCP
|
|
13
|
-
|
|
14
|
-
## Recommended baseline
|
|
15
|
-
|
|
16
|
-
Prefer a disciplined single-environment workflow on the server:
|
|
17
|
-
|
|
18
|
-
1. choose one canonical checkout per active task
|
|
19
|
-
2. initialize Brainclaw in the target project before starting coordination work
|
|
20
|
-
3. avoid mixing multiple shells, PATH setups, or Node installations during the same session
|
|
21
|
-
4. treat shared-checkout parallel editing as risky unless each session gets a dedicated worktree
|
|
22
|
-
|
|
23
|
-
## Multi-project targeting
|
|
24
|
-
|
|
25
|
-
If the server workspace contains several Brainclaw projects, resolve the target project first.
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
brainclaw switch --list
|
|
29
|
-
brainclaw switch apps/trainer
|
|
30
|
-
brainclaw status
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
You can also use:
|
|
34
|
-
|
|
35
|
-
- `BRAINCLAW_PROJECT` for a shell-scoped default
|
|
36
|
-
- `brainclaw --cwd <path> ...` for a one-off override
|
|
37
|
-
|
|
38
|
-
The goal is to avoid writing memory into the wrong store when the operator is launched from a workspace root.
|
|
39
|
-
|
|
40
|
-
## Recommended session flow
|
|
41
|
-
|
|
42
|
-
For MCP-capable agents:
|
|
43
|
-
|
|
44
|
-
1. `bclaw_work(intent="execute", scope=...)` — opens a session, loads context, and claims the scope (with a per-claim git worktree) in a single call. Returns a compact payload by default; pass `compact: false` for the full memory dump or call `bclaw_context(kind="memory")` after.
|
|
45
|
-
2. `bclaw_context(kind="execution")` — when local tooling / brainclaw version visibility is needed (already loaded implicitly by `bclaw_work`).
|
|
46
|
-
3. `bclaw_write_note` / `bclaw_create(entity=...)` / `bclaw_update(entity=...)` — record observations, plans, decisions, or traps via the canonical grammar.
|
|
47
|
-
4. `bclaw_session_end(narrative=..., auto_release: true)` — close cleanly; releases active claims and hands off the session record.
|
|
48
|
-
|
|
49
|
-
For direct CLI operation:
|
|
50
|
-
|
|
51
|
-
```bash
|
|
52
|
-
brainclaw session-start --agent codex
|
|
53
|
-
brainclaw plan list --all
|
|
54
|
-
brainclaw claim create "Investigate training config drift" --scope configs/training/
|
|
55
|
-
brainclaw runtime-note "Observed host-specific CUDA mismatch on dgx-a"
|
|
56
|
-
brainclaw session-end --auto-release
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
`brainclaw runtime-note` is the CLI equivalent of `bclaw_write_note`.
|
|
60
|
-
`brainclaw note create "..."` is accepted as a resource-style alias if that fits the operator workflow better.
|
|
61
|
-
|
|
62
|
-
## Isolation and worktrees
|
|
63
|
-
|
|
64
|
-
The safest default remains sequential collaboration: one active agent per checkout, then handoff.
|
|
65
|
-
|
|
66
|
-
If you need stronger isolation:
|
|
67
|
-
|
|
68
|
-
```bash
|
|
69
|
-
brainclaw worktree create feat/dgx-audit
|
|
70
|
-
brainclaw worktree list
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
In MCP flows, `bclaw_claim` can also create a dedicated worktree automatically when supported by the current Brainclaw version and configuration.
|
|
74
|
-
|
|
75
|
-
Use dedicated worktrees when:
|
|
76
|
-
|
|
77
|
-
- two sessions need to touch the same repo without sharing a checkout
|
|
78
|
-
- an operator wants to preserve a clean main checkout while an agent runs elsewhere
|
|
79
|
-
- a remote machine hosts long-lived or resumable agent sessions
|
|
80
|
-
|
|
81
|
-
## Plan and step semantics
|
|
82
|
-
|
|
83
|
-
Be explicit about the difference between plan items and plan steps:
|
|
84
|
-
|
|
85
|
-
- `brainclaw plan show <id>` reads a single plan item
|
|
86
|
-
- `brainclaw plan get <id>` is accepted as a read alias, but `brainclaw plan show <id>` remains the canonical form
|
|
87
|
-
- `brainclaw plan update <id>` expects a `pln_*` plan ID
|
|
88
|
-
- `brainclaw complete-step <planId> <stepId>` is the canonical way to complete a step
|
|
89
|
-
|
|
90
|
-
If you only have a step ID, inspect the parent plan first with `plan show` or `plan list --json`.
|
|
91
|
-
|
|
92
|
-
## Notes, decisions, and traps
|
|
93
|
-
|
|
94
|
-
Do not use `decision` as a workaround for a session observation.
|
|
95
|
-
|
|
96
|
-
Use:
|
|
97
|
-
|
|
98
|
-
- `brainclaw runtime-note` for in-session observations
|
|
99
|
-
- `brainclaw reflect-runtime-note` when the note may deserve promotion
|
|
100
|
-
- `brainclaw decision` only for a durable decision
|
|
101
|
-
- `brainclaw trap` only for a reusable pitfall
|
|
102
|
-
|
|
103
|
-
This keeps canonical memory cleaner on long-lived server projects.
|
|
104
|
-
|
|
105
|
-
## Common failure modes
|
|
106
|
-
|
|
107
|
-
- Wrong project selected: use `brainclaw switch --list` and verify `brainclaw status`
|
|
108
|
-
- Shared-checkout collisions: prefer a worktree per session when parallel activity is unavoidable
|
|
109
|
-
- Confusion between plan IDs and step IDs: use `plan show` before `plan update`
|
|
110
|
-
- Lost operator observations: record them with `runtime-note` instead of temporary shell notes
|
|
111
|
-
|
|
112
|
-
## Recommended reading
|
|
113
|
-
|
|
114
|
-
- [quickstart.md](quickstart.md)
|
|
115
|
-
- [cli.md](cli.md)
|
|
116
|
-
- [integrations/mcp.md](integrations/mcp.md)
|
|
117
|
-
- [concepts/plans-and-claims.md](concepts/plans-and-claims.md)
|
|
118
|
-
- [concepts/runtime-notes.md](concepts/runtime-notes.md)
|
|
1
|
+
# Server And Remote Operations
|
|
2
|
+
|
|
3
|
+
This guide is for complex operator environments such as DGX hosts, remote Linux servers, SSH-driven workflows, and multi-project workspaces where Brainclaw is not being used from a single local IDE.
|
|
4
|
+
|
|
5
|
+
## When this guide matters
|
|
6
|
+
|
|
7
|
+
Use this path when one or more of these are true:
|
|
8
|
+
|
|
9
|
+
- Brainclaw runs on a remote machine over SSH
|
|
10
|
+
- multiple repos or child projects live under one server workspace
|
|
11
|
+
- different agents resume each other over time on the same host
|
|
12
|
+
- the operator sometimes uses CLI directly instead of MCP
|
|
13
|
+
|
|
14
|
+
## Recommended baseline
|
|
15
|
+
|
|
16
|
+
Prefer a disciplined single-environment workflow on the server:
|
|
17
|
+
|
|
18
|
+
1. choose one canonical checkout per active task
|
|
19
|
+
2. initialize Brainclaw in the target project before starting coordination work
|
|
20
|
+
3. avoid mixing multiple shells, PATH setups, or Node installations during the same session
|
|
21
|
+
4. treat shared-checkout parallel editing as risky unless each session gets a dedicated worktree
|
|
22
|
+
|
|
23
|
+
## Multi-project targeting
|
|
24
|
+
|
|
25
|
+
If the server workspace contains several Brainclaw projects, resolve the target project first.
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
brainclaw switch --list
|
|
29
|
+
brainclaw switch apps/trainer
|
|
30
|
+
brainclaw status
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
You can also use:
|
|
34
|
+
|
|
35
|
+
- `BRAINCLAW_PROJECT` for a shell-scoped default
|
|
36
|
+
- `brainclaw --cwd <path> ...` for a one-off override
|
|
37
|
+
|
|
38
|
+
The goal is to avoid writing memory into the wrong store when the operator is launched from a workspace root.
|
|
39
|
+
|
|
40
|
+
## Recommended session flow
|
|
41
|
+
|
|
42
|
+
For MCP-capable agents:
|
|
43
|
+
|
|
44
|
+
1. `bclaw_work(intent="execute", scope=...)` — opens a session, loads context, and claims the scope (with a per-claim git worktree) in a single call. Returns a compact payload by default; pass `compact: false` for the full memory dump or call `bclaw_context(kind="memory")` after.
|
|
45
|
+
2. `bclaw_context(kind="execution")` — when local tooling / brainclaw version visibility is needed (already loaded implicitly by `bclaw_work`).
|
|
46
|
+
3. `bclaw_write_note` / `bclaw_create(entity=...)` / `bclaw_update(entity=...)` — record observations, plans, decisions, or traps via the canonical grammar.
|
|
47
|
+
4. `bclaw_session_end(narrative=..., auto_release: true)` — close cleanly; releases active claims and hands off the session record.
|
|
48
|
+
|
|
49
|
+
For direct CLI operation:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
brainclaw session-start --agent codex
|
|
53
|
+
brainclaw plan list --all
|
|
54
|
+
brainclaw claim create "Investigate training config drift" --scope configs/training/
|
|
55
|
+
brainclaw runtime-note "Observed host-specific CUDA mismatch on dgx-a"
|
|
56
|
+
brainclaw session-end --auto-release
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
`brainclaw runtime-note` is the CLI equivalent of `bclaw_write_note`.
|
|
60
|
+
`brainclaw note create "..."` is accepted as a resource-style alias if that fits the operator workflow better.
|
|
61
|
+
|
|
62
|
+
## Isolation and worktrees
|
|
63
|
+
|
|
64
|
+
The safest default remains sequential collaboration: one active agent per checkout, then handoff.
|
|
65
|
+
|
|
66
|
+
If you need stronger isolation:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
brainclaw worktree create feat/dgx-audit
|
|
70
|
+
brainclaw worktree list
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
In MCP flows, `bclaw_claim` can also create a dedicated worktree automatically when supported by the current Brainclaw version and configuration.
|
|
74
|
+
|
|
75
|
+
Use dedicated worktrees when:
|
|
76
|
+
|
|
77
|
+
- two sessions need to touch the same repo without sharing a checkout
|
|
78
|
+
- an operator wants to preserve a clean main checkout while an agent runs elsewhere
|
|
79
|
+
- a remote machine hosts long-lived or resumable agent sessions
|
|
80
|
+
|
|
81
|
+
## Plan and step semantics
|
|
82
|
+
|
|
83
|
+
Be explicit about the difference between plan items and plan steps:
|
|
84
|
+
|
|
85
|
+
- `brainclaw plan show <id>` reads a single plan item
|
|
86
|
+
- `brainclaw plan get <id>` is accepted as a read alias, but `brainclaw plan show <id>` remains the canonical form
|
|
87
|
+
- `brainclaw plan update <id>` expects a `pln_*` plan ID
|
|
88
|
+
- `brainclaw complete-step <planId> <stepId>` is the canonical way to complete a step
|
|
89
|
+
|
|
90
|
+
If you only have a step ID, inspect the parent plan first with `plan show` or `plan list --json`.
|
|
91
|
+
|
|
92
|
+
## Notes, decisions, and traps
|
|
93
|
+
|
|
94
|
+
Do not use `decision` as a workaround for a session observation.
|
|
95
|
+
|
|
96
|
+
Use:
|
|
97
|
+
|
|
98
|
+
- `brainclaw runtime-note` for in-session observations
|
|
99
|
+
- `brainclaw reflect-runtime-note` when the note may deserve promotion
|
|
100
|
+
- `brainclaw decision` only for a durable decision
|
|
101
|
+
- `brainclaw trap` only for a reusable pitfall
|
|
102
|
+
|
|
103
|
+
This keeps canonical memory cleaner on long-lived server projects.
|
|
104
|
+
|
|
105
|
+
## Common failure modes
|
|
106
|
+
|
|
107
|
+
- Wrong project selected: use `brainclaw switch --list` and verify `brainclaw status`
|
|
108
|
+
- Shared-checkout collisions: prefer a worktree per session when parallel activity is unavoidable
|
|
109
|
+
- Confusion between plan IDs and step IDs: use `plan show` before `plan update`
|
|
110
|
+
- Lost operator observations: record them with `runtime-note` instead of temporary shell notes
|
|
111
|
+
|
|
112
|
+
## Recommended reading
|
|
113
|
+
|
|
114
|
+
- [quickstart.md](quickstart.md)
|
|
115
|
+
- [cli.md](cli.md)
|
|
116
|
+
- [integrations/mcp.md](integrations/mcp.md)
|
|
117
|
+
- [concepts/plans-and-claims.md](concepts/plans-and-claims.md)
|
|
118
|
+
- [concepts/runtime-notes.md](concepts/runtime-notes.md)
|
package/docs/storage.md
CHANGED
|
@@ -1,110 +1,110 @@
|
|
|
1
|
-
# Storage Model
|
|
2
|
-
|
|
3
|
-
brainclaw is local-first and workspace-centric.
|
|
4
|
-
|
|
5
|
-
## Default structure
|
|
6
|
-
|
|
7
|
-
```text
|
|
8
|
-
.brainclaw/
|
|
9
|
-
config.yaml ← Project configuration
|
|
1
|
+
# Storage Model
|
|
2
|
+
|
|
3
|
+
brainclaw is local-first and workspace-centric.
|
|
4
|
+
|
|
5
|
+
## Default structure
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
.brainclaw/
|
|
9
|
+
config.yaml ← Project configuration
|
|
10
10
|
project.md ← Legacy derived readable view (best-effort, regenerable)
|
|
11
|
-
events.jsonl ← Append-only event log (agent notifications)
|
|
12
|
-
audit.log ← Append-only audit trail (before/after snapshots)
|
|
13
|
-
memory/
|
|
14
|
-
constraints/ ← Canonical constraint entries (one JSON per entity)
|
|
15
|
-
decisions/ ← Canonical decision entries
|
|
16
|
-
traps/ ← Canonical trap entries
|
|
17
|
-
instructions/ ← Layered shared instructions
|
|
18
|
-
coordination/
|
|
19
|
-
plans/ ← Shared plan items
|
|
20
|
-
claims/ ← Active scope claims
|
|
21
|
-
handoffs/ ← Handoff records
|
|
22
|
-
sessions/ ← Session state
|
|
23
|
-
runtime/ ← Runtime notes (shared, machine, private)
|
|
24
|
-
inbox/ ← Candidate review queue
|
|
25
|
-
discovery/
|
|
26
|
-
bootstrap/ ← Bootstrap profiles and seeds
|
|
27
|
-
agents/ ← Agent registration and identity
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## Design principles
|
|
31
|
-
|
|
32
|
-
### Canonical state is split
|
|
33
|
-
Each entity is stored as its own JSON file (e.g. `memory/decisions/dec_abc123.json`).
|
|
34
|
-
|
|
35
|
-
Benefits:
|
|
36
|
-
|
|
37
|
-
- readable diffs in `.brainclaw/.git`
|
|
38
|
-
- easier merges
|
|
39
|
-
- clear provenance per entity
|
|
40
|
-
- O(1) lookup by ID (direct file access)
|
|
41
|
-
- no giant monolithic memory blob
|
|
42
|
-
- isolated corruption (one bad file does not affect others)
|
|
43
|
-
|
|
44
|
-
### Derived views are best-effort
|
|
11
|
+
events.jsonl ← Append-only event log (agent notifications)
|
|
12
|
+
audit.log ← Append-only audit trail (before/after snapshots)
|
|
13
|
+
memory/
|
|
14
|
+
constraints/ ← Canonical constraint entries (one JSON per entity)
|
|
15
|
+
decisions/ ← Canonical decision entries
|
|
16
|
+
traps/ ← Canonical trap entries
|
|
17
|
+
instructions/ ← Layered shared instructions
|
|
18
|
+
coordination/
|
|
19
|
+
plans/ ← Shared plan items
|
|
20
|
+
claims/ ← Active scope claims
|
|
21
|
+
handoffs/ ← Handoff records
|
|
22
|
+
sessions/ ← Session state
|
|
23
|
+
runtime/ ← Runtime notes (shared, machine, private)
|
|
24
|
+
inbox/ ← Candidate review queue
|
|
25
|
+
discovery/
|
|
26
|
+
bootstrap/ ← Bootstrap profiles and seeds
|
|
27
|
+
agents/ ← Agent registration and identity
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Design principles
|
|
31
|
+
|
|
32
|
+
### Canonical state is split
|
|
33
|
+
Each entity is stored as its own JSON file (e.g. `memory/decisions/dec_abc123.json`).
|
|
34
|
+
|
|
35
|
+
Benefits:
|
|
36
|
+
|
|
37
|
+
- readable diffs in `.brainclaw/.git`
|
|
38
|
+
- easier merges
|
|
39
|
+
- clear provenance per entity
|
|
40
|
+
- O(1) lookup by ID (direct file access)
|
|
41
|
+
- no giant monolithic memory blob
|
|
42
|
+
- isolated corruption (one bad file does not affect others)
|
|
43
|
+
|
|
44
|
+
### Derived views are best-effort
|
|
45
45
|
`.brainclaw/project.md` is a **legacy derived view** regenerated from canonical state via `rebuildProjectMd()`. It is not a write target and no longer carries live claims, plans, handoffs, or runtime state — use `brainclaw agent-board`, `brainclaw context`, or MCP board/context tools for that operational data.
|
|
46
46
|
|
|
47
47
|
Root `PROJECT.md` is different: it is the durable project vision and should contain stable product, architecture, and contribution guidance that does not expire every session.
|
|
48
|
-
|
|
49
|
-
Failures to regenerate `project.md` are logged but never block mutations. If it gets stale, `brainclaw doctor` detects the drift.
|
|
50
|
-
|
|
51
|
-
### All mutations go through a single pipeline
|
|
52
|
-
Every write to `.brainclaw/` is serialized through `mutate()` (`src/core/mutation-pipeline.ts`):
|
|
53
|
-
|
|
54
|
-
1. **Store-wide lock** — advisory file lock at `.brainclaw/.store-mutation` (5s timeout, 10s expiry)
|
|
55
|
-
2. **Reentrant** — nested mutations within the same process are safe
|
|
56
|
-
3. **Atomic writes** — individual files use temp-file + rename pattern
|
|
57
|
-
4. **Git versioned** — `.brainclaw/.git` tracks all changes for rollback
|
|
58
|
-
|
|
59
|
-
For agents using MCP (the recommended path), mutations are additionally serialized by the MCP server's `McpTaskRunner` — a FIFO queue that runs one task at a time. This provides two layers of write safety:
|
|
60
|
-
|
|
61
|
-
| Layer | Scope | Mechanism |
|
|
62
|
-
|---|---|---|
|
|
63
|
-
| **McpTaskRunner** | Single MCP server process | FIFO queue, one active Worker thread |
|
|
64
|
-
| **mutate() file lock** | Cross-process (CLI + MCP) | Advisory `.store-mutation` lock file |
|
|
65
|
-
|
|
66
|
-
Agents should always use MCP tools for mutations. The CLI is for human operators, scripting, and fallback workflows.
|
|
67
|
-
|
|
68
|
-
### Topology can vary
|
|
69
|
-
|
|
70
|
-
Depending on configuration, storage may be:
|
|
71
|
-
|
|
72
|
-
| Topology | Behavior |
|
|
73
|
-
|---|---|
|
|
74
|
-
| `embedded` (default) | `.brainclaw/` inside the repo, tracked by Git |
|
|
75
|
-
| `sidecar` | `.brainclaw/` inside the repo but gitignored |
|
|
76
|
-
| `local-only` | Outside the repo, never tracked |
|
|
77
|
-
|
|
78
|
-
## What belongs in canonical memory
|
|
79
|
-
|
|
80
|
-
- decisions
|
|
81
|
-
- constraints
|
|
82
|
-
- traps
|
|
83
|
-
- layered instructions
|
|
84
|
-
- handoffs
|
|
85
|
-
- plans
|
|
86
|
-
|
|
87
|
-
## What stays operational
|
|
88
|
-
|
|
89
|
-
- machine-local runtime notes
|
|
90
|
-
- private notes
|
|
91
|
-
- short-lived observations (with optional TTL)
|
|
92
|
-
- reflective candidates awaiting review
|
|
93
|
-
- event log and audit trail
|
|
94
|
-
|
|
95
|
-
## Why this model matters
|
|
96
|
-
|
|
97
|
-
The storage model is part of the product value:
|
|
98
|
-
|
|
99
|
-
- local-first — no cloud dependency
|
|
100
|
-
- inspectable — plain text + JSON
|
|
101
|
-
- Git-friendly — entity-per-file, readable diffs
|
|
102
|
-
- reversible — `.brainclaw/.git` history + rollback
|
|
103
|
-
- mutation-safe — serialized writes, atomic file operations
|
|
104
|
-
- suitable for both humans and agents
|
|
105
|
-
|
|
106
|
-
## Related pages
|
|
107
|
-
|
|
108
|
-
- [concepts/memory.md](concepts/memory.md)
|
|
109
|
-
- [concepts/runtime-notes.md](concepts/runtime-notes.md)
|
|
110
|
-
- [security.md](security.md)
|
|
48
|
+
|
|
49
|
+
Failures to regenerate `project.md` are logged but never block mutations. If it gets stale, `brainclaw doctor` detects the drift.
|
|
50
|
+
|
|
51
|
+
### All mutations go through a single pipeline
|
|
52
|
+
Every write to `.brainclaw/` is serialized through `mutate()` (`src/core/mutation-pipeline.ts`):
|
|
53
|
+
|
|
54
|
+
1. **Store-wide lock** — advisory file lock at `.brainclaw/.store-mutation` (5s timeout, 10s expiry)
|
|
55
|
+
2. **Reentrant** — nested mutations within the same process are safe
|
|
56
|
+
3. **Atomic writes** — individual files use temp-file + rename pattern
|
|
57
|
+
4. **Git versioned** — `.brainclaw/.git` tracks all changes for rollback
|
|
58
|
+
|
|
59
|
+
For agents using MCP (the recommended path), mutations are additionally serialized by the MCP server's `McpTaskRunner` — a FIFO queue that runs one task at a time. This provides two layers of write safety:
|
|
60
|
+
|
|
61
|
+
| Layer | Scope | Mechanism |
|
|
62
|
+
|---|---|---|
|
|
63
|
+
| **McpTaskRunner** | Single MCP server process | FIFO queue, one active Worker thread |
|
|
64
|
+
| **mutate() file lock** | Cross-process (CLI + MCP) | Advisory `.store-mutation` lock file |
|
|
65
|
+
|
|
66
|
+
Agents should always use MCP tools for mutations. The CLI is for human operators, scripting, and fallback workflows.
|
|
67
|
+
|
|
68
|
+
### Topology can vary
|
|
69
|
+
|
|
70
|
+
Depending on configuration, storage may be:
|
|
71
|
+
|
|
72
|
+
| Topology | Behavior |
|
|
73
|
+
|---|---|
|
|
74
|
+
| `embedded` (default) | `.brainclaw/` inside the repo, tracked by Git |
|
|
75
|
+
| `sidecar` | `.brainclaw/` inside the repo but gitignored |
|
|
76
|
+
| `local-only` | Outside the repo, never tracked |
|
|
77
|
+
|
|
78
|
+
## What belongs in canonical memory
|
|
79
|
+
|
|
80
|
+
- decisions
|
|
81
|
+
- constraints
|
|
82
|
+
- traps
|
|
83
|
+
- layered instructions
|
|
84
|
+
- handoffs
|
|
85
|
+
- plans
|
|
86
|
+
|
|
87
|
+
## What stays operational
|
|
88
|
+
|
|
89
|
+
- machine-local runtime notes
|
|
90
|
+
- private notes
|
|
91
|
+
- short-lived observations (with optional TTL)
|
|
92
|
+
- reflective candidates awaiting review
|
|
93
|
+
- event log and audit trail
|
|
94
|
+
|
|
95
|
+
## Why this model matters
|
|
96
|
+
|
|
97
|
+
The storage model is part of the product value:
|
|
98
|
+
|
|
99
|
+
- local-first — no cloud dependency
|
|
100
|
+
- inspectable — plain text + JSON
|
|
101
|
+
- Git-friendly — entity-per-file, readable diffs
|
|
102
|
+
- reversible — `.brainclaw/.git` history + rollback
|
|
103
|
+
- mutation-safe — serialized writes, atomic file operations
|
|
104
|
+
- suitable for both humans and agents
|
|
105
|
+
|
|
106
|
+
## Related pages
|
|
107
|
+
|
|
108
|
+
- [concepts/memory.md](concepts/memory.md)
|
|
109
|
+
- [concepts/runtime-notes.md](concepts/runtime-notes.md)
|
|
110
|
+
- [security.md](security.md)
|
package/package.json
CHANGED
|
@@ -1,71 +1,86 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "brainclaw",
|
|
3
|
-
"version": "1.9.
|
|
4
|
-
"description": "Shared project memory for humans and coding agents.",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
},
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
1
|
+
{
|
|
2
|
+
"name": "brainclaw",
|
|
3
|
+
"version": "1.9.1",
|
|
4
|
+
"description": "Shared project memory for humans and coding agents.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/jberdah/brainclaw.git"
|
|
9
|
+
},
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/jberdah/brainclaw/issues"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://brainclaw.dev",
|
|
14
|
+
"bin": {
|
|
15
|
+
"brainclaw": "dist/cli.js",
|
|
16
|
+
"bclaw": "dist/cli.js"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist/**/*.js",
|
|
20
|
+
"dist/core/default-profiles/*.yaml",
|
|
21
|
+
"dist/brainclaw-vscode.vsix",
|
|
22
|
+
"dist/facts.json",
|
|
23
|
+
"docs/**/*.md",
|
|
24
|
+
"!docs/concepts/*proposal*.md",
|
|
25
|
+
"!docs/concepts/*critique*.md",
|
|
26
|
+
"!docs/concepts/*phase0-measurements*.md",
|
|
27
|
+
"README.md",
|
|
28
|
+
"LICENSE"
|
|
29
|
+
],
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=20.0.0"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"clean:build": "node scripts/clean-build.mjs dist dist-test",
|
|
38
|
+
"clean:dist": "node scripts/clean-build.mjs dist",
|
|
39
|
+
"clean:dist-test": "node scripts/clean-build.mjs dist-test",
|
|
29
40
|
"build": "npm run build:cli && node scripts/build-vsix.mjs --optional",
|
|
30
41
|
"build:cli": "npm run clean:dist && tsc && node scripts/copy-default-profiles.mjs",
|
|
31
42
|
"build:release": "npm run build:cli && node scripts/emit-site-facts.mjs && node scripts/build-vsix.mjs",
|
|
32
43
|
"emit:facts": "npm run build:cli && node scripts/emit-site-facts.mjs",
|
|
33
|
-
"dev": "npm run clean:dist && tsc && node scripts/copy-default-profiles.mjs && node dist/cli.js",
|
|
34
|
-
"dev:mcp": "tsc && node scripts/copy-default-profiles.mjs",
|
|
35
|
-
"build:mcp-schemas": "npm run clean:dist && tsc && node scripts/build-mcp-schemas.mjs",
|
|
36
|
-
"dev:link": "npm link && echo 'Symlink created: global brainclaw → local repo. MCP agents now use dist/ directly.'",
|
|
44
|
+
"dev": "npm run clean:dist && tsc && node scripts/copy-default-profiles.mjs && node dist/cli.js",
|
|
45
|
+
"dev:mcp": "tsc && node scripts/copy-default-profiles.mjs",
|
|
46
|
+
"build:mcp-schemas": "npm run clean:dist && tsc && node scripts/build-mcp-schemas.mjs",
|
|
47
|
+
"dev:link": "npm link && echo 'Symlink created: global brainclaw → local repo. MCP agents now use dist/ directly.'",
|
|
37
48
|
"build:test": "npm run build:cli && npm run clean:dist-test && tsc -p tsconfig.test.json",
|
|
38
|
-
"pack:check": "node scripts/check-pack.mjs",
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"test
|
|
42
|
-
"test:
|
|
43
|
-
"test:
|
|
44
|
-
"test:
|
|
45
|
-
"test:
|
|
46
|
-
"test:
|
|
49
|
+
"pack:check": "node scripts/check-pack.mjs",
|
|
50
|
+
"lint": "eslint .",
|
|
51
|
+
"lint:fix": "eslint . --fix",
|
|
52
|
+
"test": "npm run build:test && node scripts/run-tests.mjs default",
|
|
53
|
+
"test:unit": "npm run build:test && node scripts/run-tests.mjs unit",
|
|
54
|
+
"test:smoke": "npm run build:test && node scripts/run-tests.mjs smoke",
|
|
55
|
+
"test:e2e": "npm run build:test && node scripts/run-tests.mjs e2e",
|
|
56
|
+
"test:all": "npm run build:test && node scripts/run-tests.mjs all",
|
|
57
|
+
"test:cross": "npm run build:test && node scripts/test-cross.mjs default",
|
|
58
|
+
"test:coverage": "npm run build:test && c8 --all --src dist-test/src --reporter=text-summary --reporter=lcov --exclude=dist-test/tests/** --exclude=dist-test/scripts/** node scripts/run-tests.mjs default",
|
|
59
|
+
"test:coverage:check": "npm run build:test && c8 --all --check-coverage --lines 55 --functions 60 --branches 65 --statements 55 --src dist-test/src --reporter=text-summary --exclude=dist-test/tests/** --exclude=dist-test/scripts/** node scripts/run-tests.mjs default",
|
|
47
60
|
"prepublishOnly": "npm run build:release && npm run pack:check"
|
|
48
|
-
},
|
|
49
|
-
"keywords": [
|
|
50
|
-
"cli",
|
|
51
|
-
"memory",
|
|
52
|
-
"agents",
|
|
53
|
-
"coding-agents",
|
|
54
|
-
"project-context",
|
|
55
|
-
"handoff",
|
|
56
|
-
"local-first"
|
|
57
|
-
],
|
|
58
|
-
"license": "MIT",
|
|
59
|
-
"
|
|
60
|
-
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
"@types/node": "^24.12.2",
|
|
67
|
-
"ajv": "^8.20.0",
|
|
68
|
-
"c8": "^11.0.0",
|
|
69
|
-
"
|
|
70
|
-
|
|
71
|
-
|
|
61
|
+
},
|
|
62
|
+
"keywords": [
|
|
63
|
+
"cli",
|
|
64
|
+
"memory",
|
|
65
|
+
"agents",
|
|
66
|
+
"coding-agents",
|
|
67
|
+
"project-context",
|
|
68
|
+
"handoff",
|
|
69
|
+
"local-first"
|
|
70
|
+
],
|
|
71
|
+
"license": "MIT",
|
|
72
|
+
"dependencies": {
|
|
73
|
+
"commander": "^14.0.3",
|
|
74
|
+
"yaml": "^2.7.1",
|
|
75
|
+
"zod": "^4.4.3"
|
|
76
|
+
},
|
|
77
|
+
"devDependencies": {
|
|
78
|
+
"@eslint/js": "^10.0.1",
|
|
79
|
+
"@types/node": "^24.12.2",
|
|
80
|
+
"ajv": "^8.20.0",
|
|
81
|
+
"c8": "^11.0.0",
|
|
82
|
+
"eslint": "^10.5.0",
|
|
83
|
+
"typescript": "^6.0.3",
|
|
84
|
+
"typescript-eslint": "^8.61.1"
|
|
85
|
+
}
|
|
86
|
+
}
|