brainclaw 1.9.0 → 1.10.0
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 +631 -499
- package/dist/brainclaw-vscode.vsix +0 -0
- package/dist/cli.js +18 -1
- package/dist/commands/code-map.js +129 -0
- package/dist/commands/codev.js +7 -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 +200 -13
- package/dist/commands/run-profile.js +3 -2
- package/dist/commands/switch.js +125 -93
- package/dist/commands/version.js +1 -1
- package/dist/core/agent-capability.js +19 -4
- package/dist/core/agent-files.js +131 -119
- package/dist/core/code-map/backend.js +123 -0
- package/dist/core/code-map/core.js +81 -0
- package/dist/core/code-map/drafts.js +2 -0
- package/dist/core/code-map/extractor.js +29 -0
- package/dist/core/code-map/finalizer.js +191 -0
- package/dist/core/code-map/freshness.js +108 -0
- package/dist/core/code-map/ids.js +0 -0
- package/dist/core/code-map/importable.js +35 -0
- package/dist/core/code-map/indexes.js +197 -0
- package/dist/core/code-map/lang/java/imports.scm +17 -0
- package/dist/core/code-map/lang/java/index.js +254 -0
- package/dist/core/code-map/lang/java/tags.scm +48 -0
- package/dist/core/code-map/lang/php/imports.scm +21 -0
- package/dist/core/code-map/lang/php/index.js +251 -0
- package/dist/core/code-map/lang/php/tags.scm +44 -0
- package/dist/core/code-map/lang/provider.js +9 -0
- package/dist/core/code-map/lang/providers.js +24 -0
- package/dist/core/code-map/lang/python/imports.scm +90 -0
- package/dist/core/code-map/lang/python/index.js +364 -0
- package/dist/core/code-map/lang/python/tags.scm +81 -0
- package/dist/core/code-map/lang/query-runtime.js +374 -0
- package/dist/core/code-map/lang/registry.js +125 -0
- package/dist/core/code-map/lang/typescript/imports.scm +90 -0
- package/dist/core/code-map/lang/typescript/index.js +306 -0
- package/dist/core/code-map/lang/typescript/tags.js.scm +106 -0
- package/dist/core/code-map/lang/typescript/tags.scm +151 -0
- package/dist/core/code-map/lock.js +210 -0
- package/dist/core/code-map/materialized.js +51 -0
- package/dist/core/code-map/memory-reader.js +59 -0
- package/dist/core/code-map/paths.js +53 -0
- package/dist/core/code-map/query.js +568 -0
- package/dist/core/code-map/refresh.js +0 -0
- package/dist/core/code-map/resolve.js +177 -0
- package/dist/core/code-map/store.js +206 -0
- package/dist/core/code-map/types.js +288 -0
- package/dist/core/code-map/vocabulary.js +57 -0
- package/dist/core/code-map/wasm-loader.js +294 -0
- package/dist/core/code-map/work-section.js +206 -0
- package/dist/core/codev-prompts.js +38 -38
- package/dist/core/codev-rounds.js +4 -0
- 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-adapters.js +11 -10
- package/dist/core/execution-profile.js +58 -0
- package/dist/core/execution.js +1 -1
- package/dist/core/facade-schema.js +9 -0
- package/dist/core/instruction-templates.js +2 -0
- package/dist/core/loops/verbs.js +0 -1
- package/dist/core/mcp-command-resolution.js +3 -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 +67 -11
- package/dist/core/worktree.js +18 -18
- package/dist/facts.js +9 -5
- package/dist/facts.json +8 -4
- package/dist/vendor/web-tree-sitter/tree-sitter.js +3980 -0
- package/dist/vendor/web-tree-sitter/tree-sitter.wasm +0 -0
- package/dist/wasm/tree-sitter-java.wasm +0 -0
- package/dist/wasm/tree-sitter-javascript.wasm +0 -0
- package/dist/wasm/tree-sitter-php.wasm +0 -0
- package/dist/wasm/tree-sitter-python.wasm +0 -0
- package/dist/wasm/tree-sitter-tsx.wasm +0 -0
- package/dist/wasm/tree-sitter-typescript.wasm +0 -0
- package/dist/wasm/tree-sitter.wasm +0 -0
- 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 +2131 -2093
- package/docs/code-map.md +198 -0
- 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 +385 -378
- 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 +364 -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 +86 -66
- 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,217 +1,217 @@
|
|
|
1
|
-
# Plans and Claims
|
|
2
|
-
|
|
3
|
-
Plans and claims are where brainclaw starts to feel less like a note system and more like a coordination layer.
|
|
4
|
-
|
|
5
|
-
## Plans
|
|
6
|
-
|
|
7
|
-
Plans provide a shared view of intended work.
|
|
8
|
-
|
|
9
|
-
They help teams and agents answer questions like:
|
|
10
|
-
|
|
11
|
-
- what are we trying to ship?
|
|
12
|
-
- what is in progress?
|
|
13
|
-
- what is blocked?
|
|
14
|
-
- what is done?
|
|
15
|
-
- who is responsible right now?
|
|
16
|
-
|
|
17
|
-
### Plan statuses
|
|
18
|
-
|
|
19
|
-
| Status | Meaning |
|
|
20
|
-
|--------|---------|
|
|
21
|
-
| `todo` | Not started yet |
|
|
22
|
-
| `in_progress` | Actively being worked on |
|
|
23
|
-
| `done` | Completed |
|
|
24
|
-
| `blocked` | Waiting on something external |
|
|
25
|
-
| `dropped` | Dropped |
|
|
26
|
-
|
|
27
|
-
### Creating plans
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
brainclaw plan create "implement login flow"
|
|
31
|
-
brainclaw plan create "refactor auth module" --priority high --estimate 120
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
The `--estimate` flag accepts a **positive integer in minutes**. Example: `--estimate 30` means 30 minutes, `--estimate 120` means 2 hours.
|
|
35
|
-
|
|
36
|
-
### Updating plans
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
brainclaw plan update <id> --status in_progress
|
|
40
|
-
brainclaw plan update <id> --status done --actual-effort 45min
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
When marking a plan `in_progress` for the first time, `started_at` is automatically recorded.
|
|
44
|
-
When marking a plan `done`, `completed_at` is automatically recorded.
|
|
45
|
-
|
|
46
|
-
### Plan steps
|
|
47
|
-
|
|
48
|
-
Plans can have sub-steps for multi-phase work:
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
brainclaw add-step <plan-id> "write unit tests"
|
|
52
|
-
brainclaw add-step <plan-id> "update docs"
|
|
53
|
-
brainclaw complete-step <plan-id> <step-id>
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
Steps show up in `brainclaw context` and `brainclaw board` so other agents and humans can see granular progress.
|
|
57
|
-
`brainclaw plan update` changes the parent plan item only; step completion is handled through `complete-step`.
|
|
58
|
-
|
|
59
|
-
### Estimation and calibration
|
|
60
|
-
|
|
61
|
-
When both `estimated_effort` and `actual_effort` are present on completed plans, brainclaw can compute an accuracy report:
|
|
62
|
-
|
|
63
|
-
```bash
|
|
64
|
-
brainclaw estimation-report
|
|
65
|
-
brainclaw estimation-report --agent my-agent
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
This shows a ratio chart (actual / estimate) and a calibration hint:
|
|
69
|
-
|
|
70
|
-
```
|
|
71
|
-
task with estimate est:30min actual:45min [ratio:1.5x]
|
|
72
|
-
[0.0x ░░░░░░░░░░│████████████████████░░░░░░░░░░░░░░░░░ 2.0x+]
|
|
73
|
-
OVER +50%
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
A ratio below 1.0 means the task finished faster than expected (early). Above 1.0 means it took longer (over).
|
|
77
|
-
|
|
78
|
-
### Step-level estimation (pln#495)
|
|
79
|
-
|
|
80
|
-
Estimation can be captured per **step**, not just per plan — which removes a real
|
|
81
|
-
source of noise. A plan's wall-clock span (`created_at`→`completed_at`) counts
|
|
82
|
-
the idle time *between* steps as if it were work: if steps 1–5 finish in a
|
|
83
|
-
morning and step 6 lands the next day, the plan-level elapsed smears an 18h gap
|
|
84
|
-
that was never effort. Summing per-step durations excludes those gaps.
|
|
85
|
-
|
|
86
|
-
Set step estimates and actuals via `add-step` / `update-step`:
|
|
87
|
-
|
|
88
|
-
```bash
|
|
89
|
-
brainclaw add-step <plan-id> "write unit tests" --estimate 30
|
|
90
|
-
brainclaw update-step <plan-id> <step-id> --status in_progress # stamps started_at
|
|
91
|
-
brainclaw update-step <plan-id> <step-id> --status done # stamps completed_at
|
|
92
|
-
# or record an explicit actual:
|
|
93
|
-
brainclaw update-step <plan-id> <step-id> --actual-effort 45m
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
`estimated_effort` accepts the same forms as the plan-level `--estimate` (an
|
|
97
|
-
integer of minutes, or a legacy duration string like `2h` / `30m`).
|
|
98
|
-
|
|
99
|
-
`estimation-report` then prefers step-level data and tags each plan with its
|
|
100
|
-
**measurement source**:
|
|
101
|
-
|
|
102
|
-
- **`step`** — the highest quality: `estimated_minutes` is the sum of step
|
|
103
|
-
estimates (used only when *every* step has one), and `elapsed_minutes` is the
|
|
104
|
-
sum of per-step durations (used only when *every* step is measurable, via an
|
|
105
|
-
explicit `actual_effort` or both `started_at`+`completed_at`). Idle gaps
|
|
106
|
-
between steps are excluded.
|
|
107
|
-
- **`plan_string`** — fell back to the plan-level `actual_effort` string.
|
|
108
|
-
- **`plan_wallclock`** — fell back to the plan's `created_at`→`completed_at`
|
|
109
|
-
span (the noisiest; what older plans use).
|
|
110
|
-
|
|
111
|
-
The report's summary breaks the median ratio down per source
|
|
112
|
-
(`step-derived: 1.0x · plan-wallclock: 0.4x …`) so you can see how much
|
|
113
|
-
calibration error was wall-clock contamination vs real estimation drift, and the
|
|
114
|
-
chart tags each line (`✓step` / `~wall`).
|
|
115
|
-
|
|
116
|
-
**Migration:** none required. A plan whose steps carry no estimation data — or a
|
|
117
|
-
plan with no steps at all — keeps working exactly as before via the fallback
|
|
118
|
-
chain. Mixed plans (some steps estimated, some not) fall back to plan-level
|
|
119
|
-
entirely rather than reporting a misleading partial sum.
|
|
120
|
-
|
|
121
|
-
## Claims
|
|
122
|
-
|
|
123
|
-
Claims make current ownership explicit.
|
|
124
|
-
|
|
125
|
-
A claim can represent:
|
|
126
|
-
|
|
127
|
-
- a file
|
|
128
|
-
- a folder
|
|
129
|
-
- a feature area
|
|
130
|
-
- a work scope linked to a plan item
|
|
131
|
-
|
|
132
|
-
Claims help reduce collisions when multiple humans or agents work in parallel.
|
|
133
|
-
|
|
134
|
-
### Creating claims
|
|
135
|
-
|
|
136
|
-
```bash
|
|
137
|
-
brainclaw claim create "refactoring auth module" --scope src/auth/
|
|
138
|
-
brainclaw claim create "updating docs" --scope docs/ --ttl 4h
|
|
139
|
-
brainclaw claim create "fixing login bug" --scope src/auth/ --plan <plan-id>
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
The `--ttl` flag sets a time-to-live for the claim. After expiry, the claim is no longer considered active by other agents. Valid formats: `30min`, `2h`, `1d`.
|
|
143
|
-
|
|
144
|
-
### Listing and releasing claims
|
|
145
|
-
|
|
146
|
-
```bash
|
|
147
|
-
brainclaw claim list
|
|
148
|
-
brainclaw claim release <id>
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
`claim list` shows who holds each claim and whether it is still active. If a claim has a `session_id`, the last 8 characters are shown so you can correlate with the agent session that created it.
|
|
152
|
-
|
|
153
|
-
### Automatic claim release
|
|
154
|
-
|
|
155
|
-
Claims are automatically released after a `git merge` if the post-merge hook is installed (installed by default by `brainclaw init`). The hook matches merged file paths against active claim scopes and releases overlapping claims.
|
|
156
|
-
|
|
157
|
-
You can also install or reinstall the hook manually:
|
|
158
|
-
|
|
159
|
-
```bash
|
|
160
|
-
brainclaw install-hooks
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
## Why claims matter
|
|
164
|
-
|
|
165
|
-
Without claims, multiple agents can easily touch the same area at once and generate conflicting changes.
|
|
166
|
-
Claims are not necessarily hard file locks.
|
|
167
|
-
They are a shared coordination signal.
|
|
168
|
-
|
|
169
|
-
## Policy checks
|
|
170
|
-
|
|
171
|
-
Before editing a scope, agents can verify governance compliance using `check-policy`:
|
|
172
|
-
|
|
173
|
-
```bash
|
|
174
|
-
brainclaw check-policy --scope src/core/auth.ts --agent claude-code
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
Or via MCP:
|
|
178
|
-
|
|
179
|
-
```
|
|
180
|
-
bclaw_check_policy(scope: "src/core/auth.ts", agent: "claude-code")
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
The check is fully **deterministic** (no AI involved) and verifies:
|
|
184
|
-
|
|
185
|
-
- **Claim active** — Does the agent have a claim on this scope? (BLOCK if not)
|
|
186
|
-
- **Claim conflict** — Is another agent claiming this scope? (BLOCK)
|
|
187
|
-
- **Constraints** — Do any active constraints with matching `related_paths` apply? (WARN)
|
|
188
|
-
- **Traps** — Are there known pitfalls for this scope? (WARN)
|
|
189
|
-
- **Governance context** — Active global instructions are surfaced for reference.
|
|
190
|
-
|
|
191
|
-
Policy warnings are also **automatically included** in the `bclaw_claim` response — agents get constraint and trap alerts at claim time without an extra call.
|
|
192
|
-
|
|
193
|
-
## Recommended workflow
|
|
194
|
-
|
|
195
|
-
1. create a plan item
|
|
196
|
-
2. claim the target scope — `bclaw_claim` (or `bclaw_work(intent="execute", scope=…, planId=…)`) creates an isolated git worktree under `~/.brainclaw/worktrees/<project-hash>/` automatically; policy warnings are surfaced as part of the response
|
|
197
|
-
3. work on the implementation inside the worktree
|
|
198
|
-
4. update the plan status (`bclaw_transition(entity="plan", id, to="in_progress" | "done")`)
|
|
199
|
-
5. commit and merge back; release the claim when done or blocked
|
|
200
|
-
6. create a handoff if another actor should continue
|
|
201
|
-
|
|
202
|
-
## Session hygiene
|
|
203
|
-
|
|
204
|
-
Before finishing a session, always:
|
|
205
|
-
|
|
206
|
-
- release active claims: `brainclaw claim release <id>`
|
|
207
|
-
- update plan items: `brainclaw plan update <id> --status done`
|
|
208
|
-
- or use `brainclaw session-end --auto-release` to clean up automatically
|
|
209
|
-
|
|
210
|
-
`session-end --auto-release` releases all claims held by the current agent and marks any `in_progress` plans as needing attention.
|
|
211
|
-
|
|
212
|
-
## Plans + claims together
|
|
213
|
-
|
|
214
|
-
Plans describe what should happen.
|
|
215
|
-
Claims describe who is currently working where.
|
|
216
|
-
|
|
217
|
-
That combination is much more useful than either one alone.
|
|
1
|
+
# Plans and Claims
|
|
2
|
+
|
|
3
|
+
Plans and claims are where brainclaw starts to feel less like a note system and more like a coordination layer.
|
|
4
|
+
|
|
5
|
+
## Plans
|
|
6
|
+
|
|
7
|
+
Plans provide a shared view of intended work.
|
|
8
|
+
|
|
9
|
+
They help teams and agents answer questions like:
|
|
10
|
+
|
|
11
|
+
- what are we trying to ship?
|
|
12
|
+
- what is in progress?
|
|
13
|
+
- what is blocked?
|
|
14
|
+
- what is done?
|
|
15
|
+
- who is responsible right now?
|
|
16
|
+
|
|
17
|
+
### Plan statuses
|
|
18
|
+
|
|
19
|
+
| Status | Meaning |
|
|
20
|
+
|--------|---------|
|
|
21
|
+
| `todo` | Not started yet |
|
|
22
|
+
| `in_progress` | Actively being worked on |
|
|
23
|
+
| `done` | Completed |
|
|
24
|
+
| `blocked` | Waiting on something external |
|
|
25
|
+
| `dropped` | Dropped |
|
|
26
|
+
|
|
27
|
+
### Creating plans
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
brainclaw plan create "implement login flow"
|
|
31
|
+
brainclaw plan create "refactor auth module" --priority high --estimate 120
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The `--estimate` flag accepts a **positive integer in minutes**. Example: `--estimate 30` means 30 minutes, `--estimate 120` means 2 hours.
|
|
35
|
+
|
|
36
|
+
### Updating plans
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
brainclaw plan update <id> --status in_progress
|
|
40
|
+
brainclaw plan update <id> --status done --actual-effort 45min
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
When marking a plan `in_progress` for the first time, `started_at` is automatically recorded.
|
|
44
|
+
When marking a plan `done`, `completed_at` is automatically recorded.
|
|
45
|
+
|
|
46
|
+
### Plan steps
|
|
47
|
+
|
|
48
|
+
Plans can have sub-steps for multi-phase work:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
brainclaw add-step <plan-id> "write unit tests"
|
|
52
|
+
brainclaw add-step <plan-id> "update docs"
|
|
53
|
+
brainclaw complete-step <plan-id> <step-id>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Steps show up in `brainclaw context` and `brainclaw board` so other agents and humans can see granular progress.
|
|
57
|
+
`brainclaw plan update` changes the parent plan item only; step completion is handled through `complete-step`.
|
|
58
|
+
|
|
59
|
+
### Estimation and calibration
|
|
60
|
+
|
|
61
|
+
When both `estimated_effort` and `actual_effort` are present on completed plans, brainclaw can compute an accuracy report:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
brainclaw estimation-report
|
|
65
|
+
brainclaw estimation-report --agent my-agent
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
This shows a ratio chart (actual / estimate) and a calibration hint:
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
task with estimate est:30min actual:45min [ratio:1.5x]
|
|
72
|
+
[0.0x ░░░░░░░░░░│████████████████████░░░░░░░░░░░░░░░░░ 2.0x+]
|
|
73
|
+
OVER +50%
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
A ratio below 1.0 means the task finished faster than expected (early). Above 1.0 means it took longer (over).
|
|
77
|
+
|
|
78
|
+
### Step-level estimation (pln#495)
|
|
79
|
+
|
|
80
|
+
Estimation can be captured per **step**, not just per plan — which removes a real
|
|
81
|
+
source of noise. A plan's wall-clock span (`created_at`→`completed_at`) counts
|
|
82
|
+
the idle time *between* steps as if it were work: if steps 1–5 finish in a
|
|
83
|
+
morning and step 6 lands the next day, the plan-level elapsed smears an 18h gap
|
|
84
|
+
that was never effort. Summing per-step durations excludes those gaps.
|
|
85
|
+
|
|
86
|
+
Set step estimates and actuals via `add-step` / `update-step`:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
brainclaw add-step <plan-id> "write unit tests" --estimate 30
|
|
90
|
+
brainclaw update-step <plan-id> <step-id> --status in_progress # stamps started_at
|
|
91
|
+
brainclaw update-step <plan-id> <step-id> --status done # stamps completed_at
|
|
92
|
+
# or record an explicit actual:
|
|
93
|
+
brainclaw update-step <plan-id> <step-id> --actual-effort 45m
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
`estimated_effort` accepts the same forms as the plan-level `--estimate` (an
|
|
97
|
+
integer of minutes, or a legacy duration string like `2h` / `30m`).
|
|
98
|
+
|
|
99
|
+
`estimation-report` then prefers step-level data and tags each plan with its
|
|
100
|
+
**measurement source**:
|
|
101
|
+
|
|
102
|
+
- **`step`** — the highest quality: `estimated_minutes` is the sum of step
|
|
103
|
+
estimates (used only when *every* step has one), and `elapsed_minutes` is the
|
|
104
|
+
sum of per-step durations (used only when *every* step is measurable, via an
|
|
105
|
+
explicit `actual_effort` or both `started_at`+`completed_at`). Idle gaps
|
|
106
|
+
between steps are excluded.
|
|
107
|
+
- **`plan_string`** — fell back to the plan-level `actual_effort` string.
|
|
108
|
+
- **`plan_wallclock`** — fell back to the plan's `created_at`→`completed_at`
|
|
109
|
+
span (the noisiest; what older plans use).
|
|
110
|
+
|
|
111
|
+
The report's summary breaks the median ratio down per source
|
|
112
|
+
(`step-derived: 1.0x · plan-wallclock: 0.4x …`) so you can see how much
|
|
113
|
+
calibration error was wall-clock contamination vs real estimation drift, and the
|
|
114
|
+
chart tags each line (`✓step` / `~wall`).
|
|
115
|
+
|
|
116
|
+
**Migration:** none required. A plan whose steps carry no estimation data — or a
|
|
117
|
+
plan with no steps at all — keeps working exactly as before via the fallback
|
|
118
|
+
chain. Mixed plans (some steps estimated, some not) fall back to plan-level
|
|
119
|
+
entirely rather than reporting a misleading partial sum.
|
|
120
|
+
|
|
121
|
+
## Claims
|
|
122
|
+
|
|
123
|
+
Claims make current ownership explicit.
|
|
124
|
+
|
|
125
|
+
A claim can represent:
|
|
126
|
+
|
|
127
|
+
- a file
|
|
128
|
+
- a folder
|
|
129
|
+
- a feature area
|
|
130
|
+
- a work scope linked to a plan item
|
|
131
|
+
|
|
132
|
+
Claims help reduce collisions when multiple humans or agents work in parallel.
|
|
133
|
+
|
|
134
|
+
### Creating claims
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
brainclaw claim create "refactoring auth module" --scope src/auth/
|
|
138
|
+
brainclaw claim create "updating docs" --scope docs/ --ttl 4h
|
|
139
|
+
brainclaw claim create "fixing login bug" --scope src/auth/ --plan <plan-id>
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
The `--ttl` flag sets a time-to-live for the claim. After expiry, the claim is no longer considered active by other agents. Valid formats: `30min`, `2h`, `1d`.
|
|
143
|
+
|
|
144
|
+
### Listing and releasing claims
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
brainclaw claim list
|
|
148
|
+
brainclaw claim release <id>
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
`claim list` shows who holds each claim and whether it is still active. If a claim has a `session_id`, the last 8 characters are shown so you can correlate with the agent session that created it.
|
|
152
|
+
|
|
153
|
+
### Automatic claim release
|
|
154
|
+
|
|
155
|
+
Claims are automatically released after a `git merge` if the post-merge hook is installed (installed by default by `brainclaw init`). The hook matches merged file paths against active claim scopes and releases overlapping claims.
|
|
156
|
+
|
|
157
|
+
You can also install or reinstall the hook manually:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
brainclaw install-hooks
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Why claims matter
|
|
164
|
+
|
|
165
|
+
Without claims, multiple agents can easily touch the same area at once and generate conflicting changes.
|
|
166
|
+
Claims are not necessarily hard file locks.
|
|
167
|
+
They are a shared coordination signal.
|
|
168
|
+
|
|
169
|
+
## Policy checks
|
|
170
|
+
|
|
171
|
+
Before editing a scope, agents can verify governance compliance using `check-policy`:
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
brainclaw check-policy --scope src/core/auth.ts --agent claude-code
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Or via MCP:
|
|
178
|
+
|
|
179
|
+
```
|
|
180
|
+
bclaw_check_policy(scope: "src/core/auth.ts", agent: "claude-code")
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
The check is fully **deterministic** (no AI involved) and verifies:
|
|
184
|
+
|
|
185
|
+
- **Claim active** — Does the agent have a claim on this scope? (BLOCK if not)
|
|
186
|
+
- **Claim conflict** — Is another agent claiming this scope? (BLOCK)
|
|
187
|
+
- **Constraints** — Do any active constraints with matching `related_paths` apply? (WARN)
|
|
188
|
+
- **Traps** — Are there known pitfalls for this scope? (WARN)
|
|
189
|
+
- **Governance context** — Active global instructions are surfaced for reference.
|
|
190
|
+
|
|
191
|
+
Policy warnings are also **automatically included** in the `bclaw_claim` response — agents get constraint and trap alerts at claim time without an extra call.
|
|
192
|
+
|
|
193
|
+
## Recommended workflow
|
|
194
|
+
|
|
195
|
+
1. create a plan item
|
|
196
|
+
2. claim the target scope — `bclaw_claim` (or `bclaw_work(intent="execute", scope=…, planId=…)`) creates an isolated git worktree under `~/.brainclaw/worktrees/<project-hash>/` automatically; policy warnings are surfaced as part of the response
|
|
197
|
+
3. work on the implementation inside the worktree
|
|
198
|
+
4. update the plan status (`bclaw_transition(entity="plan", id, to="in_progress" | "done")`)
|
|
199
|
+
5. commit and merge back; release the claim when done or blocked
|
|
200
|
+
6. create a handoff if another actor should continue
|
|
201
|
+
|
|
202
|
+
## Session hygiene
|
|
203
|
+
|
|
204
|
+
Before finishing a session, always:
|
|
205
|
+
|
|
206
|
+
- release active claims: `brainclaw claim release <id>`
|
|
207
|
+
- update plan items: `brainclaw plan update <id> --status done`
|
|
208
|
+
- or use `brainclaw session-end --auto-release` to clean up automatically
|
|
209
|
+
|
|
210
|
+
`session-end --auto-release` releases all claims held by the current agent and marks any `in_progress` plans as needing attention.
|
|
211
|
+
|
|
212
|
+
## Plans + claims together
|
|
213
|
+
|
|
214
|
+
Plans describe what should happen.
|
|
215
|
+
Claims describe who is currently working where.
|
|
216
|
+
|
|
217
|
+
That combination is much more useful than either one alone.
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
# The PROJECT.md Convention (Instruction Layering)
|
|
2
|
-
|
|
3
|
-
When working with AI agents, balancing **context freshness** against **context bloat** is an ongoing challenge. If you feed an agent too many rules, it consumes tokens and increases the risk of "lazy" behavior or hallucinated context loss.
|
|
4
|
-
|
|
5
|
-
Brainclaw enforces a strict separation of concerns via "Instruction Layering":
|
|
6
|
-
|
|
7
|
-
1. **Coordination Rules (The `brainclaw` context):** Managed completely by Brainclaw. This covers memory synchronization, plans, handoffs, and team coordination.
|
|
8
|
-
2. **Domain Rules (The Project context):** Managed entirely by you. This covers tech stack features, architecture standards, UI guidelines, and test instructions.
|
|
9
|
-
|
|
10
|
-
To link these two seamlessly, Brainclaw introduces the canonical **`PROJECT.md` Convention**.
|
|
11
|
-
|
|
12
|
-
## The Mechanism
|
|
13
|
-
|
|
14
|
-
Brainclaw treats the `PROJECT.md` file at the root of a workspace as the definitive source of truth for your domain rules.
|
|
15
|
-
|
|
16
|
-
When Brainclaw updates the surface instruction files for agents (`CLAUDE.md`, `copilot-instructions.md`, `.cursor/rules`, etc.), it automatically extracts and routes your project vision using a **hybrid injection technique**.
|
|
17
|
-
|
|
18
|
-
### 1. The "Inject Content" Mode (Short Files, <=20 lines)
|
|
19
|
-
If your `PROJECT.md` is concise and serves as a simple "pitch" for the project (under 20 lines), Brainclaw will literally copy its content into the agent surface files under the `## brainclaw — this project` header.
|
|
20
|
-
- **Benefit:** Zero tool calls required by the agent. It gets the pitch instantly on session start.
|
|
21
|
-
|
|
22
|
-
### 2. The "Inject Pointer" Mode (Detailed Files, >20 lines)
|
|
23
|
-
For larger, production-grade projects, your domain rules will easily exceed 20 lines. If Brainclaw injected 300 lines of coding guidelines into every agent prompt file, it would destroy your context window.
|
|
24
|
-
Instead, when your `PROJECT.md` exceeds 20 lines, Brainclaw injects a rigid pointer:
|
|
25
|
-
|
|
26
|
-
> **Project Domain Rules**
|
|
27
|
-
> This project maintains detailed domain rules and architecture externally to avoid context bloat.
|
|
28
|
-
> You MUST read `PROJECT.md` in the workspace root to understand the project constraints, tech stack, and conventions before coding.
|
|
29
|
-
|
|
30
|
-
- **Benefit:** Prevents context bloat. The agent uses a targeted file read (`read_file`) only when necessary to acquire deep codebase context.
|
|
31
|
-
|
|
32
|
-
## Best Practices
|
|
33
|
-
|
|
34
|
-
- Always keep architecture guidelines, testing boundaries, and specific rules in `PROJECT.md` (or link out to other docs from it).
|
|
35
|
-
- Never edit the `<!-- brainclaw:start -->` wrapped contents in surface files manually. They will be overwritten during the next `brainclaw export` cycle.
|
|
1
|
+
# The PROJECT.md Convention (Instruction Layering)
|
|
2
|
+
|
|
3
|
+
When working with AI agents, balancing **context freshness** against **context bloat** is an ongoing challenge. If you feed an agent too many rules, it consumes tokens and increases the risk of "lazy" behavior or hallucinated context loss.
|
|
4
|
+
|
|
5
|
+
Brainclaw enforces a strict separation of concerns via "Instruction Layering":
|
|
6
|
+
|
|
7
|
+
1. **Coordination Rules (The `brainclaw` context):** Managed completely by Brainclaw. This covers memory synchronization, plans, handoffs, and team coordination.
|
|
8
|
+
2. **Domain Rules (The Project context):** Managed entirely by you. This covers tech stack features, architecture standards, UI guidelines, and test instructions.
|
|
9
|
+
|
|
10
|
+
To link these two seamlessly, Brainclaw introduces the canonical **`PROJECT.md` Convention**.
|
|
11
|
+
|
|
12
|
+
## The Mechanism
|
|
13
|
+
|
|
14
|
+
Brainclaw treats the `PROJECT.md` file at the root of a workspace as the definitive source of truth for your domain rules.
|
|
15
|
+
|
|
16
|
+
When Brainclaw updates the surface instruction files for agents (`CLAUDE.md`, `copilot-instructions.md`, `.cursor/rules`, etc.), it automatically extracts and routes your project vision using a **hybrid injection technique**.
|
|
17
|
+
|
|
18
|
+
### 1. The "Inject Content" Mode (Short Files, <=20 lines)
|
|
19
|
+
If your `PROJECT.md` is concise and serves as a simple "pitch" for the project (under 20 lines), Brainclaw will literally copy its content into the agent surface files under the `## brainclaw — this project` header.
|
|
20
|
+
- **Benefit:** Zero tool calls required by the agent. It gets the pitch instantly on session start.
|
|
21
|
+
|
|
22
|
+
### 2. The "Inject Pointer" Mode (Detailed Files, >20 lines)
|
|
23
|
+
For larger, production-grade projects, your domain rules will easily exceed 20 lines. If Brainclaw injected 300 lines of coding guidelines into every agent prompt file, it would destroy your context window.
|
|
24
|
+
Instead, when your `PROJECT.md` exceeds 20 lines, Brainclaw injects a rigid pointer:
|
|
25
|
+
|
|
26
|
+
> **Project Domain Rules**
|
|
27
|
+
> This project maintains detailed domain rules and architecture externally to avoid context bloat.
|
|
28
|
+
> You MUST read `PROJECT.md` in the workspace root to understand the project constraints, tech stack, and conventions before coding.
|
|
29
|
+
|
|
30
|
+
- **Benefit:** Prevents context bloat. The agent uses a targeted file read (`read_file`) only when necessary to acquire deep codebase context.
|
|
31
|
+
|
|
32
|
+
## Best Practices
|
|
33
|
+
|
|
34
|
+
- Always keep architecture guidelines, testing boundaries, and specific rules in `PROJECT.md` (or link out to other docs from it).
|
|
35
|
+
- Never edit the `<!-- brainclaw:start -->` wrapped contents in surface files manually. They will be overwritten during the next `brainclaw export` cycle.
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
# Runtime Notes
|
|
2
|
-
|
|
3
|
-
Runtime notes capture operational observations made during work.
|
|
4
|
-
|
|
5
|
-
They help bridge the gap between live execution and durable project memory.
|
|
6
|
-
|
|
7
|
-
## Examples
|
|
8
|
-
|
|
9
|
-
- a local environment quirk
|
|
10
|
-
- a host-specific issue
|
|
11
|
-
- a temporary blocker
|
|
12
|
-
- a short-lived implementation observation
|
|
13
|
-
- a note worth later reflection
|
|
14
|
-
|
|
15
|
-
## Visibility modes
|
|
16
|
-
|
|
17
|
-
Depending on configuration and use, runtime notes may be:
|
|
18
|
-
|
|
19
|
-
- shared
|
|
20
|
-
- machine-local
|
|
21
|
-
- private
|
|
22
|
-
|
|
23
|
-
This lets teams keep transient or host-specific context available without polluting canonical project memory too early.
|
|
24
|
-
|
|
25
|
-
## Reflection workflow
|
|
26
|
-
|
|
27
|
-
A runtime note does not have to become durable memory immediately.
|
|
28
|
-
A useful pattern is:
|
|
29
|
-
|
|
30
|
-
1. capture the observation quickly
|
|
31
|
-
2. keep it visible in runtime state
|
|
32
|
-
3. reflect it into a candidate if it seems reusable
|
|
33
|
-
4. accept or reject it later through review
|
|
34
|
-
|
|
35
|
-
## Why this matters
|
|
36
|
-
|
|
37
|
-
This creates a safer bridge from ephemeral facts to durable memory.
|
|
38
|
-
Not every operational observation deserves instant promotion.
|
|
1
|
+
# Runtime Notes
|
|
2
|
+
|
|
3
|
+
Runtime notes capture operational observations made during work.
|
|
4
|
+
|
|
5
|
+
They help bridge the gap between live execution and durable project memory.
|
|
6
|
+
|
|
7
|
+
## Examples
|
|
8
|
+
|
|
9
|
+
- a local environment quirk
|
|
10
|
+
- a host-specific issue
|
|
11
|
+
- a temporary blocker
|
|
12
|
+
- a short-lived implementation observation
|
|
13
|
+
- a note worth later reflection
|
|
14
|
+
|
|
15
|
+
## Visibility modes
|
|
16
|
+
|
|
17
|
+
Depending on configuration and use, runtime notes may be:
|
|
18
|
+
|
|
19
|
+
- shared
|
|
20
|
+
- machine-local
|
|
21
|
+
- private
|
|
22
|
+
|
|
23
|
+
This lets teams keep transient or host-specific context available without polluting canonical project memory too early.
|
|
24
|
+
|
|
25
|
+
## Reflection workflow
|
|
26
|
+
|
|
27
|
+
A runtime note does not have to become durable memory immediately.
|
|
28
|
+
A useful pattern is:
|
|
29
|
+
|
|
30
|
+
1. capture the observation quickly
|
|
31
|
+
2. keep it visible in runtime state
|
|
32
|
+
3. reflect it into a candidate if it seems reusable
|
|
33
|
+
4. accept or reject it later through review
|
|
34
|
+
|
|
35
|
+
## Why this matters
|
|
36
|
+
|
|
37
|
+
This creates a safer bridge from ephemeral facts to durable memory.
|
|
38
|
+
Not every operational observation deserves instant promotion.
|