brainclaw 0.28.0 → 1.5.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 +193 -170
- package/dist/brainclaw-vscode.vsix +0 -0
- package/dist/cli.js +683 -23
- package/dist/commands/accept.js +3 -0
- package/dist/commands/add-step.js +11 -26
- package/dist/commands/agent-board.js +70 -3
- package/dist/commands/audit.js +19 -0
- package/dist/commands/check-policy.js +54 -0
- package/dist/commands/check-security-mcp.js +145 -0
- package/dist/commands/check-security.js +106 -0
- package/dist/commands/claim-resource.js +1 -0
- package/dist/commands/codev.js +672 -0
- package/dist/commands/compact.js +74 -0
- package/dist/commands/complete-step.js +16 -26
- package/dist/commands/constraint.js +8 -20
- package/dist/commands/decision.js +9 -20
- package/dist/commands/delete-plan.js +10 -12
- package/dist/commands/delete-step.js +16 -0
- package/dist/commands/dispatch.js +163 -0
- package/dist/commands/doctor.js +1122 -49
- package/dist/commands/enable-agent.js +1 -0
- package/dist/commands/export.js +280 -22
- package/dist/commands/handoff.js +33 -0
- package/dist/commands/harvest.js +189 -0
- package/dist/commands/hooks.js +82 -25
- package/dist/commands/inbox.js +169 -0
- package/dist/commands/init.js +38 -31
- package/dist/commands/install-hooks.js +71 -44
- package/dist/commands/link.js +89 -0
- package/dist/commands/list-claims.js +48 -3
- package/dist/commands/list-plans.js +129 -25
- package/dist/commands/loops-handlers.js +409 -0
- package/dist/commands/mcp-read-handlers.js +1628 -0
- package/dist/commands/mcp-schemas.generated.js +74 -0
- package/dist/commands/mcp.js +4244 -1475
- package/dist/commands/plan-resource.js +64 -0
- package/dist/commands/plan.js +12 -26
- package/dist/commands/prune.js +37 -2
- package/dist/commands/reflect.js +20 -7
- package/dist/commands/release-claim.js +11 -6
- package/dist/commands/release-notes.js +170 -0
- package/dist/commands/repair.js +210 -0
- package/dist/commands/run-profile.js +57 -0
- package/dist/commands/sequence.js +113 -0
- package/dist/commands/session-end.js +423 -14
- package/dist/commands/session-start.js +214 -41
- package/dist/commands/setup-security.js +103 -0
- package/dist/commands/setup.js +42 -4
- package/dist/commands/stale.js +109 -0
- package/dist/commands/switch.js +131 -10
- package/dist/commands/trap.js +14 -31
- package/dist/commands/update-handoff.js +63 -4
- package/dist/commands/update-plan.js +21 -28
- package/dist/commands/update-step.js +37 -0
- package/dist/commands/upgrade.js +313 -6
- package/dist/commands/usage.js +102 -0
- package/dist/commands/version.js +20 -0
- package/dist/commands/who.js +124 -0
- package/dist/commands/worktree.js +105 -0
- package/dist/core/actions.js +315 -0
- package/dist/core/agent-capability.js +610 -17
- package/dist/core/agent-context.js +7 -1
- package/dist/core/agent-files.js +1169 -85
- package/dist/core/agent-integrations.js +160 -5
- package/dist/core/agent-inventory.js +2 -0
- package/dist/core/agent-profiles.js +93 -0
- package/dist/core/agent-registry.js +162 -30
- package/dist/core/agentrun-reconciler.js +345 -0
- package/dist/core/agentruns.js +424 -0
- package/dist/core/ai-agent-detection.js +31 -10
- package/dist/core/archival.js +77 -0
- package/dist/core/assignment-sweeper.js +82 -0
- package/dist/core/assignments.js +367 -0
- package/dist/core/audit.js +30 -0
- package/dist/core/bootstrap.js +61 -10
- package/dist/core/brainclaw-version.js +94 -2
- package/dist/core/candidates.js +93 -2
- package/dist/core/claims.js +419 -0
- package/dist/core/codev-metrics.js +77 -0
- package/dist/core/codev-personas.js +31 -0
- package/dist/core/codev-plan-gen.js +35 -0
- package/dist/core/codev-prompts.js +74 -0
- package/dist/core/codev-responses.js +62 -0
- package/dist/core/codev-rounds.js +218 -0
- package/dist/core/config.js +4 -0
- package/dist/core/context.js +454 -34
- package/dist/core/coordination.js +201 -6
- package/dist/core/cross-project.js +230 -16
- package/dist/core/default-profiles/doctor.yaml +11 -0
- package/dist/core/default-profiles/janitor.yaml +11 -0
- package/dist/core/default-profiles/onboarder.yaml +11 -0
- package/dist/core/default-profiles/reviewer.yaml +13 -0
- package/dist/core/dispatcher.js +1189 -0
- package/dist/core/duplicates.js +2 -2
- package/dist/core/entity-operations.js +450 -0
- package/dist/core/entity-registry.js +344 -0
- package/dist/core/event-log.js +1 -0
- package/dist/core/events.js +106 -2
- package/dist/core/execution-adapters.js +154 -0
- package/dist/core/execution-context.js +63 -0
- package/dist/core/execution-profile.js +270 -0
- package/dist/core/execution.js +255 -0
- package/dist/core/facade-schema.js +81 -0
- package/dist/core/federation-cloud.js +99 -0
- package/dist/core/federation-message.js +52 -0
- package/dist/core/federation-transport.js +65 -0
- package/dist/core/gc-semantic.js +482 -0
- package/dist/core/governance.js +247 -0
- package/dist/core/guards.js +19 -0
- package/dist/core/ideation.js +72 -0
- package/dist/core/identity.js +252 -28
- package/dist/core/ids.js +6 -0
- package/dist/core/input-validation.js +2 -2
- package/dist/core/instruction-templates.js +344 -136
- package/dist/core/io.js +90 -11
- package/dist/core/lock.js +6 -2
- package/dist/core/loops/brief-assembly.js +213 -0
- package/dist/core/loops/facade-schema.js +148 -0
- package/dist/core/loops/index.js +7 -0
- package/dist/core/loops/iteration-engine.js +139 -0
- package/dist/core/loops/lock.js +385 -0
- package/dist/core/loops/store.js +201 -0
- package/dist/core/loops/types.js +403 -0
- package/dist/core/loops/verbs.js +534 -0
- package/dist/core/markdown.js +15 -3
- package/dist/core/memory-compactor.js +432 -0
- package/dist/core/memory-git.js +152 -8
- package/dist/core/messaging.js +278 -0
- package/dist/core/migration.js +32 -1
- package/dist/core/mutation-pipeline.js +4 -2
- package/dist/core/operations/memory-mutation.js +129 -0
- package/dist/core/operations/memory-write.js +78 -0
- package/dist/core/operations/plan.js +190 -0
- package/dist/core/policy.js +169 -0
- package/dist/core/repo-analysis.js +67 -0
- package/dist/core/reputation.js +9 -3
- package/dist/core/schema.js +546 -21
- package/dist/core/search.js +21 -2
- package/dist/core/security-cache.js +71 -0
- package/dist/core/security-guard.js +152 -0
- package/dist/core/security-scoring.js +86 -0
- package/dist/core/sequence.js +130 -0
- package/dist/core/socket-client.js +113 -0
- package/dist/core/staleness.js +246 -0
- package/dist/core/state.js +98 -22
- package/dist/core/store-resolution.js +54 -12
- package/dist/core/toml-writer.js +76 -0
- package/dist/core/upgrades/backup.js +232 -0
- package/dist/core/upgrades/health-check.js +169 -0
- package/dist/core/upgrades/patches/candidate-archive.js +145 -0
- package/dist/core/upgrades/patches/handoff-review-strip.js +128 -0
- package/dist/core/upgrades/patches/provenance-rollout.js +136 -0
- package/dist/core/upgrades/schema-version.js +97 -0
- package/dist/core/worktree.js +606 -0
- package/dist/facts.js +114 -0
- package/dist/facts.json +111 -0
- package/docs/architecture/project-refs.md +5 -1
- package/docs/cli.md +690 -43
- package/docs/concepts/ideation-loop.md +317 -0
- package/docs/concepts/loop-engine.md +456 -0
- package/docs/concepts/mcp-governance.md +268 -0
- package/docs/concepts/memory-staleness.md +122 -0
- package/docs/concepts/multi-agent-workflows.md +166 -0
- package/docs/concepts/plans-and-claims.md +31 -6
- package/docs/concepts/project-md-convention.md +35 -0
- package/docs/concepts/troubleshooting.md +220 -0
- package/docs/concepts/upgrade-cli.md +202 -0
- package/docs/concepts/upgrade-dogfood-procedure.md +114 -0
- package/docs/context-format-changelog.md +2 -2
- package/docs/context-format.md +2 -2
- package/docs/index.md +68 -0
- package/docs/integrations/agents.md +15 -16
- package/docs/integrations/cline.md +88 -0
- package/docs/integrations/codex.md +75 -23
- package/docs/integrations/continue.md +60 -0
- package/docs/integrations/copilot.md +67 -9
- package/docs/integrations/kilocode.md +72 -0
- package/docs/integrations/mcp.md +304 -21
- package/docs/integrations/mistral-vibe.md +122 -0
- package/docs/integrations/opencode.md +84 -0
- package/docs/integrations/overview.md +23 -8
- package/docs/integrations/roo.md +74 -0
- package/docs/integrations/windsurf.md +83 -0
- package/docs/mcp-schema-changelog.md +191 -1
- package/docs/playbooks/integration/index.md +121 -0
- package/docs/playbooks/productivity/index.md +102 -0
- package/docs/playbooks/team/index.md +122 -0
- package/docs/product/agent-first-model.md +184 -0
- package/docs/product/entity-model-audit.md +462 -0
- package/docs/quickstart-existing-project.md +135 -0
- package/docs/quickstart.md +124 -37
- package/docs/release-maintenance.md +79 -0
- package/docs/review.md +2 -0
- package/docs/server-operations.md +118 -0
- package/package.json +20 -12
- package/dist/commands/claude-desktop-extension.js +0 -18
- package/dist/commands/diff.js +0 -99
- package/dist/core/claude-desktop-extension.js +0 -224
package/docs/quickstart.md
CHANGED
|
@@ -1,87 +1,174 @@
|
|
|
1
1
|
# Quickstart
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Get brainclaw running in your project in under 5 minutes.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
> **Joining a project that already has `.brainclaw/`?** Use [quickstart-existing-project.md](quickstart-existing-project.md) instead — this page is for setting up a new project from scratch.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
If you're about to cut a release that changes the CLI, MCP, or context surface, run the checklist in [release-maintenance.md](release-maintenance.md) before publishing a local pack or npm build.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
If you prefer doing it manually:
|
|
9
|
+
## Step 1: Install
|
|
12
10
|
|
|
13
11
|
```bash
|
|
14
12
|
npm install -g brainclaw
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Requires Node.js 20+. Verify with `brainclaw --version`.
|
|
16
|
+
|
|
17
|
+
## Step 2: Initialize your project
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
cd your-project
|
|
15
21
|
brainclaw init
|
|
16
22
|
```
|
|
17
23
|
|
|
18
|
-
|
|
24
|
+
**What happens:**
|
|
25
|
+
- Creates `.brainclaw/` directory (project memory store)
|
|
26
|
+
- Detects your coding agent (Claude Code, Codex, Cursor, Copilot, Cline, Mistral Vibe, etc.)
|
|
27
|
+
- Writes MCP configuration for the detected agent
|
|
28
|
+
- Writes instruction files (`CLAUDE.md`, `AGENTS.md`, `.cursor/rules/brainclaw.md`, etc.)
|
|
29
|
+
- Installs session hooks (if supported by your agent)
|
|
30
|
+
- Adds `.brainclaw/` to `.gitignore`
|
|
19
31
|
|
|
20
|
-
|
|
32
|
+
If you have multiple repos, use `brainclaw setup --yes` instead — it scans your project directories and initializes everything at once.
|
|
21
33
|
|
|
22
|
-
|
|
34
|
+
## Step 3: Restart your agent
|
|
23
35
|
|
|
24
|
-
|
|
25
|
-
2. **Coordinate with other agents** — claim files before editing, check who's working where
|
|
26
|
-
3. **Build shared memory** — record observations, create plans, track work
|
|
27
|
-
4. **Resume across sessions** — the next agent (or the same one tomorrow) picks up where you left off
|
|
36
|
+
Your coding agent needs to reload to pick up the new MCP configuration.
|
|
28
37
|
|
|
29
|
-
|
|
38
|
+
| Agent | How to reload |
|
|
39
|
+
|-------|---------------|
|
|
40
|
+
| **Claude Code** | Restart the CLI session or VS Code window |
|
|
41
|
+
| **Cursor** | Cmd/Ctrl+Shift+P → "Reload Window" |
|
|
42
|
+
| **Codex** | Start a new `codex` session |
|
|
43
|
+
| **Cline** | Reload VS Code window |
|
|
44
|
+
| **Windsurf** | Reload the editor |
|
|
45
|
+
| **Copilot** | Reload VS Code window (uses instruction file, not MCP) |
|
|
30
46
|
|
|
31
|
-
|
|
47
|
+
## Step 4: Verify it works
|
|
48
|
+
|
|
49
|
+
After reloading, tell your agent:
|
|
32
50
|
|
|
33
51
|
```text
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
52
|
+
Call bclaw_work with intent "resume" to check that brainclaw is connected.
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The agent should respond with session info, project context, and available tools. If it does, brainclaw is connected.
|
|
56
|
+
|
|
57
|
+
From the CLI, you can also verify:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
brainclaw status # active sessions, claims, plans
|
|
61
|
+
brainclaw agent-board # what each agent sees
|
|
62
|
+
brainclaw context # current project memory
|
|
39
63
|
```
|
|
40
64
|
|
|
41
|
-
|
|
65
|
+
## Step 5: Start using brainclaw
|
|
66
|
+
|
|
67
|
+
### For agents with MCP (most agents)
|
|
68
|
+
|
|
69
|
+
This is the primary path. Your agent calls brainclaw tools directly during work:
|
|
42
70
|
|
|
43
|
-
|
|
71
|
+
| Tool | What it does |
|
|
72
|
+
|------|-------------|
|
|
73
|
+
| `bclaw_work(intent)` | Start a session, load context, claim scope — all in one call |
|
|
74
|
+
| `bclaw_coordinate(intent, agents)` | Assign work, consult, request review, open an ideation loop, reroute, or summarize |
|
|
75
|
+
| `bclaw_context(kind, path?)` | Read memory / execution / board / delta — narrow to a path when given |
|
|
76
|
+
| `bclaw_claim(scope)` | Claim a file/directory before editing (prevents conflicts) |
|
|
77
|
+
| `bclaw_write_note(text)` | Record an observation, decision, or trap during work |
|
|
78
|
+
| `bclaw_session_end(narrative)` | Close session, release claims, hand off cleanly |
|
|
44
79
|
|
|
45
|
-
The
|
|
80
|
+
The facades `bclaw_work` and `bclaw_coordinate` are the recommended entry points — they handle session setup, context loading, and claim management automatically. For entity reads and writes (plans, decisions, traps, handoffs, candidates, etc.), use the canonical grammar: `bclaw_find` / `bclaw_get` / `bclaw_create` / `bclaw_update` / `bclaw_remove` / `bclaw_transition`.
|
|
46
81
|
|
|
47
|
-
|
|
82
|
+
### For autonomous agents (no MCP)
|
|
83
|
+
|
|
84
|
+
Autonomous agents (OpenClaw, NanoClaw, NemoClaw, PicoClaw, ZeroClaw) operate from a SKILL.md file generated by brainclaw. For Tier B/C agents that have MCP but no hooks (Cursor, Cline, Windsurf, Copilot, Continue, Kilocode, Mistral Vibe, etc.), an opt-in `.live.md` companion (regenerated on session-end and handoff) carries plans, claims, traps, candidates, and handoffs as a parity backstop.
|
|
85
|
+
|
|
86
|
+
Regenerate when project memory changes:
|
|
48
87
|
|
|
49
88
|
```bash
|
|
50
89
|
brainclaw export --detect --write
|
|
51
90
|
```
|
|
52
91
|
|
|
92
|
+
### Human operators (CLI)
|
|
93
|
+
|
|
94
|
+
The CLI is for inspection, scripting, and fallback:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
brainclaw plan create "Implement auth module" --priority high
|
|
98
|
+
brainclaw plan list
|
|
99
|
+
brainclaw claim list
|
|
100
|
+
brainclaw context --for src/auth/routes.ts
|
|
101
|
+
brainclaw export --detect --write # regenerate all instruction files
|
|
102
|
+
```
|
|
103
|
+
|
|
53
104
|
## Onboarding an existing project
|
|
54
105
|
|
|
55
106
|
If the repo already has code, brainclaw can extract context from it:
|
|
56
107
|
|
|
57
108
|
```bash
|
|
58
|
-
brainclaw bootstrap --json
|
|
59
|
-
brainclaw bootstrap --apply
|
|
109
|
+
brainclaw bootstrap --json # preview: CI patterns, ADRs, Docker, branches, tags
|
|
110
|
+
brainclaw bootstrap --apply # import detected signals into memory
|
|
60
111
|
```
|
|
61
112
|
|
|
62
|
-
Or let your agent drive
|
|
113
|
+
Or let your agent drive it:
|
|
63
114
|
|
|
64
|
-
|
|
115
|
+
```text
|
|
116
|
+
Call bclaw_bootstrap to detect project signals, then review what was found.
|
|
117
|
+
```
|
|
65
118
|
|
|
66
|
-
|
|
119
|
+
## Common scenarios
|
|
67
120
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
121
|
+
The same primitives serve multiple workflows. Pick the one that matches what you're doing — full walkthroughs in [`concepts/multi-agent-workflows.md`](concepts/multi-agent-workflows.md).
|
|
122
|
+
|
|
123
|
+
### Active orchestration — parallel lanes across agent instances
|
|
124
|
+
|
|
125
|
+
```text
|
|
126
|
+
brainclaw sequence create "feature-cycle" --items '[…]' --status active
|
|
127
|
+
bclaw_dispatch(intent="execute", agents=[…])
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
The dispatcher creates one worktree + claim per lane and routes inbox messages by `claim_id`. Lanes with `hard_after` unblock as predecessors finish.
|
|
131
|
+
|
|
132
|
+
### Agent switching — when an agent runs out of credits mid-task
|
|
133
|
+
|
|
134
|
+
```text
|
|
135
|
+
# On the outgoing agent:
|
|
136
|
+
bclaw_session_end(narrative="Did X. Need to finish Y.")
|
|
137
|
+
|
|
138
|
+
# On the next agent (same or different):
|
|
139
|
+
bclaw_work(intent="resume")
|
|
71
140
|
```
|
|
72
141
|
|
|
73
|
-
|
|
142
|
+
The new agent picks up the open plans, the latest handoff narrative, and the unfinished claims it can adopt. No re-explanation needed.
|
|
143
|
+
|
|
144
|
+
### Project recovery — returning after weeks away
|
|
145
|
+
|
|
146
|
+
```text
|
|
147
|
+
bclaw_work(intent="resume")
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Returns active plans, decisions taken since you left, active constraints, known traps, and where the last session stopped. Use `bclaw_context(kind="memory", profile="briefing")` for a narrower scope-focused view.
|
|
151
|
+
|
|
152
|
+
### Team async — humans and agents sharing the same project
|
|
153
|
+
|
|
154
|
+
Capture decisions, constraints, and traps as you discover them — they propagate to every teammate's agent on the next context read:
|
|
155
|
+
|
|
156
|
+
```text
|
|
157
|
+
bclaw_create(entity="decision", data={ text: "…", outcome: "approved" })
|
|
158
|
+
bclaw_create(entity="constraint", data={ text: "…", category: "security" })
|
|
159
|
+
bclaw_create(entity="trap", data={ text: "…", severity: "high" })
|
|
160
|
+
```
|
|
74
161
|
|
|
75
|
-
|
|
162
|
+
Hand off work for review with `bclaw_coordinate(intent="review", scope="…")`. Reviewers pick it up via `bclaw_read_inbox()`.
|
|
76
163
|
|
|
77
|
-
|
|
164
|
+
### One rule across all four
|
|
78
165
|
|
|
79
|
-
|
|
166
|
+
Scope-level claim isolation is strict — only one active claim per scope at a time, regardless of agent type. That's how parallel work stays safe and async handoffs stay clean.
|
|
80
167
|
|
|
81
168
|
## Next reads
|
|
82
169
|
|
|
83
170
|
- [integrations/overview.md](integrations/overview.md) — how brainclaw adapts to each agent
|
|
84
|
-
- [integrations/mcp.md](integrations/mcp.md) — the
|
|
171
|
+
- [integrations/mcp.md](integrations/mcp.md) — the MCP runtime path in detail
|
|
85
172
|
- [concepts/memory.md](concepts/memory.md) — what project memory includes
|
|
86
173
|
- [concepts/plans-and-claims.md](concepts/plans-and-claims.md) — coordination layer
|
|
87
174
|
- [cli.md](cli.md) — full CLI reference
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Release Maintenance
|
|
2
|
+
|
|
3
|
+
Use this guide when a Brainclaw release changes the shipped CLI, MCP surface, context schema, or other operator-facing behavior.
|
|
4
|
+
|
|
5
|
+
The goal is simple: if the product surface changed, the packaged docs and the anti-drift checks must change in the same branch before publishing.
|
|
6
|
+
|
|
7
|
+
## When to run this checklist
|
|
8
|
+
|
|
9
|
+
Run it before:
|
|
10
|
+
|
|
11
|
+
- `brainclaw version --publish-local`
|
|
12
|
+
- a merge that changes operator-visible behavior
|
|
13
|
+
- a release candidate or local tarball build used for real agent testing
|
|
14
|
+
|
|
15
|
+
Run it whenever a change affects one of these surfaces:
|
|
16
|
+
|
|
17
|
+
- CLI commands, aliases, flags, help text, or examples
|
|
18
|
+
- MCP tools, argument semantics, or read/write classification
|
|
19
|
+
- context schema version or documented fields
|
|
20
|
+
- packaged workflows such as worktrees, notes, plans, claims, bootstrap, or upgrade/reconcile flows
|
|
21
|
+
|
|
22
|
+
## Release checklist
|
|
23
|
+
|
|
24
|
+
1. Confirm the runtime surface that changed.
|
|
25
|
+
Check the relevant source files first, typically `src/cli.ts`, `src/commands/mcp.ts`, `src/commands/mcp-read-handlers.ts`, and `src/core/context.ts`.
|
|
26
|
+
2. Update the packaged docs in the same branch.
|
|
27
|
+
At minimum touch the matching reference page in `docs/`, and update `README.md` if the change affects the product story or the primary entry path.
|
|
28
|
+
3. Reconcile CLI and MCP wording.
|
|
29
|
+
If a concept exists on both surfaces, document the mapping explicitly. Example: `bclaw_write_note` ↔ `brainclaw runtime-note` / `brainclaw note create`.
|
|
30
|
+
4. Re-check proposal versus shipped surface.
|
|
31
|
+
If a change is still design-only, keep it out of stable reference pages or mark it clearly as a proposal.
|
|
32
|
+
5. Run the doc/reference verification before publishing.
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm run build:test
|
|
36
|
+
node --test dist-test/tests/unit/docs-reference.test.js
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
6. Run targeted command tests for the changed surface.
|
|
40
|
+
Prefer focused tests over broad slow suites when the behavior is small and operator-facing.
|
|
41
|
+
|
|
42
|
+
Examples from the current repo:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
node --test dist-test/tests/unit/plan-resource-command.test.js
|
|
46
|
+
node --test --test-name-pattern "accepts note create as an alias for runtime-note" dist-test/tests/collaboration.test.js
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
7. Only then publish or pack a local release.
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
brainclaw version --publish-local --release-notes "..."
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Minimum files to review
|
|
56
|
+
|
|
57
|
+
This is the smallest practical review set for release-visible drift:
|
|
58
|
+
|
|
59
|
+
- `README.md`
|
|
60
|
+
- `docs/index.md`
|
|
61
|
+
- `docs/cli.md`
|
|
62
|
+
- `docs/integrations/mcp.md`
|
|
63
|
+
- `docs/context-format.md`
|
|
64
|
+
- `docs/context-format-changelog.md`
|
|
65
|
+
- `tests/unit/docs-reference.test.ts`
|
|
66
|
+
|
|
67
|
+
Add workflow-specific docs when needed, for example:
|
|
68
|
+
|
|
69
|
+
- `docs/server-operations.md`
|
|
70
|
+
- `docs/quickstart.md`
|
|
71
|
+
- `docs/concepts/plans-and-claims.md`
|
|
72
|
+
|
|
73
|
+
## What this checklist is trying to prevent
|
|
74
|
+
|
|
75
|
+
- shipping a command that exists in code but not in `docs/cli.md`
|
|
76
|
+
- claiming a feature is unavailable when the code already ships it
|
|
77
|
+
- documenting a proposal as if it were stable product behavior
|
|
78
|
+
- leaving MCP and CLI with different names for the same operator workflow
|
|
79
|
+
- publishing a local tarball that agents test against while bundled docs still describe the previous surface
|
package/docs/review.md
CHANGED
|
@@ -23,6 +23,8 @@ runtime-note → reflect-runtime-note → review candidate → accept / reject
|
|
|
23
23
|
3. review the candidate (`brainclaw review`)
|
|
24
24
|
4. accept or reject it (`brainclaw accept` / `brainclaw reject`)
|
|
25
25
|
|
|
26
|
+
For MCP-capable agents, `brainclaw runtime-note` maps to `bclaw_write_note`.
|
|
27
|
+
|
|
26
28
|
## Star and use signals
|
|
27
29
|
|
|
28
30
|
Before formal review, candidates can accumulate signals:
|
|
@@ -0,0 +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)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brainclaw",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.5.3",
|
|
4
4
|
"description": "Shared project memory for humans and coding agents.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
11
|
"dist/**/*.js",
|
|
12
|
+
"dist/core/default-profiles/*.yaml",
|
|
13
|
+
"dist/brainclaw-vscode.vsix",
|
|
14
|
+
"dist/facts.json",
|
|
12
15
|
"docs/**/*.md",
|
|
13
16
|
"README.md",
|
|
14
17
|
"LICENSE"
|
|
@@ -17,12 +20,19 @@
|
|
|
17
20
|
"access": "public"
|
|
18
21
|
},
|
|
19
22
|
"engines": {
|
|
20
|
-
"node": ">=
|
|
23
|
+
"node": ">=20.0.0"
|
|
21
24
|
},
|
|
22
25
|
"scripts": {
|
|
23
|
-
"build": "
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
+
"clean:build": "node scripts/clean-build.mjs dist dist-test",
|
|
27
|
+
"clean:dist": "node scripts/clean-build.mjs dist",
|
|
28
|
+
"clean:dist-test": "node scripts/clean-build.mjs dist-test",
|
|
29
|
+
"build": "npm run clean:dist && tsc && node scripts/copy-default-profiles.mjs && node scripts/emit-site-facts.mjs && node scripts/build-vsix.mjs",
|
|
30
|
+
"build:cli": "npm run clean:dist && tsc && node scripts/copy-default-profiles.mjs && node scripts/emit-site-facts.mjs",
|
|
31
|
+
"dev": "npm run clean:dist && tsc && node scripts/copy-default-profiles.mjs && node dist/cli.js",
|
|
32
|
+
"dev:mcp": "tsc && node scripts/copy-default-profiles.mjs",
|
|
33
|
+
"build:mcp-schemas": "npm run clean:dist && tsc && node scripts/build-mcp-schemas.mjs",
|
|
34
|
+
"dev:link": "npm link && echo 'Symlink created: global brainclaw → local repo. MCP agents now use dist/ directly.'",
|
|
35
|
+
"build:test": "npm run build && npm run clean:dist-test && tsc -p tsconfig.test.json",
|
|
26
36
|
"pack:check": "node scripts/check-pack.mjs",
|
|
27
37
|
"test": "npm run build:test && node scripts/run-tests.mjs default",
|
|
28
38
|
"test:unit": "npm run build:test && node scripts/run-tests.mjs unit",
|
|
@@ -44,17 +54,15 @@
|
|
|
44
54
|
],
|
|
45
55
|
"license": "BUSL-1.1",
|
|
46
56
|
"homepage": "https://brainclaw.dev",
|
|
47
|
-
"engines": {
|
|
48
|
-
"node": ">=20"
|
|
49
|
-
},
|
|
50
57
|
"dependencies": {
|
|
51
|
-
"commander": "^
|
|
58
|
+
"commander": "^14.0.3",
|
|
52
59
|
"yaml": "^2.7.1",
|
|
53
|
-
"zod": "^
|
|
60
|
+
"zod": "^4.4.3"
|
|
54
61
|
},
|
|
55
62
|
"devDependencies": {
|
|
56
|
-
"@types/node": "^
|
|
63
|
+
"@types/node": "^24.12.2",
|
|
64
|
+
"ajv": "^8.20.0",
|
|
57
65
|
"c8": "^11.0.0",
|
|
58
|
-
"typescript": "^
|
|
66
|
+
"typescript": "^6.0.3"
|
|
59
67
|
}
|
|
60
68
|
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import { buildClaudeDesktopExtension, renderClaudeDesktopExtensionSummary, } from '../core/claude-desktop-extension.js';
|
|
3
|
-
export function runClaudeDesktopExtension(options = {}) {
|
|
4
|
-
const cwd = options.cwd ?? process.cwd();
|
|
5
|
-
const result = buildClaudeDesktopExtension({
|
|
6
|
-
cwd,
|
|
7
|
-
workspaceDir: options.workspace ? path.resolve(cwd, options.workspace) : undefined,
|
|
8
|
-
outputFile: options.output ? path.resolve(cwd, options.output) : undefined,
|
|
9
|
-
projectRoot: options.projectRoot ? path.resolve(cwd, options.projectRoot) : undefined,
|
|
10
|
-
pack: options.pack,
|
|
11
|
-
});
|
|
12
|
-
if (options.json) {
|
|
13
|
-
console.log(JSON.stringify(result, null, 2));
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
console.log(renderClaudeDesktopExtensionSummary(result));
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=claude-desktop-extension.js.map
|
package/dist/commands/diff.js
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { memoryExists, memoryPath, readFileSync, writeFileAtomic } from '../core/io.js';
|
|
2
|
-
import { loadState } from '../core/state.js';
|
|
3
|
-
import { listCandidates, listArchivedCandidates } from '../core/candidates.js';
|
|
4
|
-
import { nowISO } from '../core/ids.js';
|
|
5
|
-
export function runDiff(options = {}) {
|
|
6
|
-
if (!memoryExists()) {
|
|
7
|
-
console.error('Error: .memory/ not found. Run `team-memory init` first.');
|
|
8
|
-
process.exit(1);
|
|
9
|
-
}
|
|
10
|
-
const markerPath = memoryPath('.last-context');
|
|
11
|
-
const usingMarker = !options.since;
|
|
12
|
-
let since;
|
|
13
|
-
if (options.since) {
|
|
14
|
-
since = new Date(options.since);
|
|
15
|
-
if (isNaN(since.getTime())) {
|
|
16
|
-
console.error(`Error: invalid date '${options.since}'. Use ISO 8601 format, e.g. 2026-03-14T10:00:00Z`);
|
|
17
|
-
process.exit(1);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
try {
|
|
22
|
-
const ts = readFileSync(markerPath).trim();
|
|
23
|
-
since = new Date(ts);
|
|
24
|
-
if (isNaN(since.getTime()))
|
|
25
|
-
throw new Error('invalid date in .last-context');
|
|
26
|
-
}
|
|
27
|
-
catch {
|
|
28
|
-
console.error('Error: no --since date provided and no .last-context marker found.');
|
|
29
|
-
console.error('Hint: run `team-memory context` first to set the marker, or use:');
|
|
30
|
-
console.error(' team-memory diff --since <ISO date>');
|
|
31
|
-
process.exit(1);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
const sinceISO = since.toISOString();
|
|
35
|
-
const state = loadState();
|
|
36
|
-
const makeEntry = (section, type) => (e) => ({
|
|
37
|
-
id: e.id, entry_type: type, section, text: e.text, created_at: e.created_at,
|
|
38
|
-
});
|
|
39
|
-
const stateEntries = [
|
|
40
|
-
...state.active_constraints.filter(e => e.created_at > sinceISO).map(makeEntry('active_constraints', 'constraint')),
|
|
41
|
-
...state.recent_decisions.filter(e => e.created_at > sinceISO).map(makeEntry('recent_decisions', 'decision')),
|
|
42
|
-
...state.known_traps.filter(e => e.created_at > sinceISO).map(makeEntry('known_traps', 'trap')),
|
|
43
|
-
...state.open_handoffs.filter(e => e.created_at > sinceISO).map(makeEntry('open_handoffs', 'handoff')),
|
|
44
|
-
].sort((a, b) => a.created_at.localeCompare(b.created_at));
|
|
45
|
-
const newPending = listCandidates('pending').filter(c => c.created_at > sinceISO);
|
|
46
|
-
const newAccepted = listArchivedCandidates('accepted').filter(c => (c.resolved_at ?? c.created_at) > sinceISO);
|
|
47
|
-
const total = stateEntries.length + newPending.length + newAccepted.length;
|
|
48
|
-
if (options.json) {
|
|
49
|
-
console.log(JSON.stringify({
|
|
50
|
-
since: sinceISO,
|
|
51
|
-
checked_at: new Date().toISOString(),
|
|
52
|
-
total_changes: total,
|
|
53
|
-
state_entries: stateEntries,
|
|
54
|
-
new_candidates: newPending,
|
|
55
|
-
accepted_candidates: newAccepted,
|
|
56
|
-
}, null, 2));
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
if (total === 0) {
|
|
60
|
-
console.log(`No changes in .memory/ since ${sinceISO}`);
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
console.log(`Changes since ${sinceISO}:`);
|
|
64
|
-
console.log('');
|
|
65
|
-
if (stateEntries.length > 0) {
|
|
66
|
-
console.log(`New canonical entries (${stateEntries.length}):`);
|
|
67
|
-
for (const e of stateEntries) {
|
|
68
|
-
console.log(` + [${e.id}] (${e.entry_type}) ${e.text}`);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
if (newPending.length > 0) {
|
|
72
|
-
if (stateEntries.length > 0)
|
|
73
|
-
console.log('');
|
|
74
|
-
console.log(`New candidates pending review (${newPending.length}):`);
|
|
75
|
-
for (const c of newPending) {
|
|
76
|
-
console.log(` ? [${c.id}] (${c.type}) ${c.text}`);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
if (newAccepted.length > 0) {
|
|
80
|
-
console.log('');
|
|
81
|
-
console.log(`Candidates accepted into memory (${newAccepted.length}):`);
|
|
82
|
-
for (const c of newAccepted) {
|
|
83
|
-
console.log(` \u2714 [${c.id}] (${c.type}) ${c.text}`);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
// When called without explicit --since, advance the marker so the next
|
|
89
|
-
// diff (no --since) starts from here — acts as a cursor.
|
|
90
|
-
if (usingMarker) {
|
|
91
|
-
try {
|
|
92
|
-
writeFileAtomic(markerPath, nowISO());
|
|
93
|
-
}
|
|
94
|
-
catch {
|
|
95
|
-
// Non-fatal
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
//# sourceMappingURL=diff.js.map
|