brainclaw 0.19.14 → 0.20.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 +26 -11
- package/dist/cli.js +11 -0
- package/dist/commands/context.js +3 -1
- package/dist/commands/export.js +44 -0
- package/dist/commands/init.js +7 -6
- package/dist/commands/mcp.js +86 -5
- package/dist/commands/uninstall.js +145 -0
- package/dist/core/agent-capability.js +184 -0
- package/dist/core/agent-context.js +24 -6
- package/dist/core/bootstrap.js +177 -0
- package/dist/core/context.js +47 -24
- package/dist/core/instruction-templates.js +308 -0
- package/dist/core/schema.js +9 -0
- package/dist/core/setup-flow.js +191 -0
- package/dist/core/setup-state.js +30 -1
- package/dist/core/store-resolution.js +58 -0
- package/docs/architecture/project-refs.md +305 -0
- package/docs/cli.md +2 -1
- package/docs/integrations/agents.md +102 -150
- package/docs/integrations/overview.md +71 -45
- package/docs/quickstart.md +43 -147
- package/package.json +1 -1
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
# Project Refs for Multi-Project Navigation
|
|
2
|
+
|
|
3
|
+
## Goal
|
|
4
|
+
|
|
5
|
+
In a multi-project workspace, agents should be able to address any known project from anywhere in the workspace without depending on the current working directory.
|
|
6
|
+
|
|
7
|
+
The core primitive for this is a stable `project_ref`.
|
|
8
|
+
|
|
9
|
+
Examples:
|
|
10
|
+
|
|
11
|
+
- `dev/repos/global`
|
|
12
|
+
- `applications/lodestar`
|
|
13
|
+
- `core_services/postgres`
|
|
14
|
+
|
|
15
|
+
This lets Brainclaw support direct project navigation commands such as:
|
|
16
|
+
|
|
17
|
+
- `brainclaw projects`
|
|
18
|
+
- `brainclaw project applications/lodestar`
|
|
19
|
+
- `brainclaw context --project applications/lodestar`
|
|
20
|
+
- `brainclaw children dev/repos/global`
|
|
21
|
+
- `brainclaw ancestors applications/lodestar`
|
|
22
|
+
- `brainclaw dependencies applications/lodestar`
|
|
23
|
+
- `brainclaw locate dev/repos/global/applications/lodestar/src/app.ts`
|
|
24
|
+
|
|
25
|
+
The same addressing model must exist over MCP.
|
|
26
|
+
|
|
27
|
+
## Why
|
|
28
|
+
|
|
29
|
+
Current workspace-centric behavior is still too dependent on `cwd` and path heuristics:
|
|
30
|
+
|
|
31
|
+
- `brainclaw context --for <path>` can help rerank context
|
|
32
|
+
- in folder-mode workspaces it can now resolve a child store for some path-shaped targets
|
|
33
|
+
- but the mental model is still "where am I on disk?"
|
|
34
|
+
|
|
35
|
+
For agents, this is weaker than "which project am I addressing?"
|
|
36
|
+
|
|
37
|
+
`project_ref` should become the natural addressing unit for:
|
|
38
|
+
|
|
39
|
+
- context lookup
|
|
40
|
+
- workspace navigation
|
|
41
|
+
- parent/child traversal
|
|
42
|
+
- dependency traversal
|
|
43
|
+
- future project-scoped MCP tools
|
|
44
|
+
|
|
45
|
+
## Core Model
|
|
46
|
+
|
|
47
|
+
Each known project keeps its internal `project_id`.
|
|
48
|
+
|
|
49
|
+
Each project also gets a stable human-readable `project_ref`:
|
|
50
|
+
|
|
51
|
+
- derived from the workspace-relative path
|
|
52
|
+
- normalized with forward slashes
|
|
53
|
+
- unique within the workspace
|
|
54
|
+
|
|
55
|
+
Examples:
|
|
56
|
+
|
|
57
|
+
- workspace root: `.`
|
|
58
|
+
- child repo: `dev/repos/global`
|
|
59
|
+
- nested project: `dev/repos/global/applications/lodestar`
|
|
60
|
+
|
|
61
|
+
The registry for a workspace project should expose at least:
|
|
62
|
+
|
|
63
|
+
- `project_id`
|
|
64
|
+
- `project_ref`
|
|
65
|
+
- `project_name`
|
|
66
|
+
- `relative_path`
|
|
67
|
+
- `absolute_path`
|
|
68
|
+
- `workspace_root`
|
|
69
|
+
- `parent_ref`
|
|
70
|
+
- `aliases`
|
|
71
|
+
- `store_present`
|
|
72
|
+
- `source`
|
|
73
|
+
- `dependencies`
|
|
74
|
+
|
|
75
|
+
## Naming Rules
|
|
76
|
+
|
|
77
|
+
Canonical rule:
|
|
78
|
+
|
|
79
|
+
- `project_ref` is the workspace-relative path to the project root
|
|
80
|
+
|
|
81
|
+
Short aliases:
|
|
82
|
+
|
|
83
|
+
- the final path segment may be used as an alias
|
|
84
|
+
- only when unique within the workspace
|
|
85
|
+
- ambiguous aliases must fail with a disambiguation error
|
|
86
|
+
|
|
87
|
+
Examples:
|
|
88
|
+
|
|
89
|
+
- `applications/lodestar` may have alias `lodestar`
|
|
90
|
+
- if two projects end with `api`, `brainclaw project api` must fail and suggest full refs
|
|
91
|
+
|
|
92
|
+
This keeps the model simple:
|
|
93
|
+
|
|
94
|
+
- canonical ref is always deterministic
|
|
95
|
+
- short names are optional ergonomics, not identity
|
|
96
|
+
|
|
97
|
+
## Project Resolution
|
|
98
|
+
|
|
99
|
+
Resolution should work from anywhere in the workspace.
|
|
100
|
+
|
|
101
|
+
The resolver accepts:
|
|
102
|
+
|
|
103
|
+
- exact `project_ref`
|
|
104
|
+
- exact `project_id`
|
|
105
|
+
- unique short alias
|
|
106
|
+
- absolute path to a project root
|
|
107
|
+
- absolute or relative path inside a project
|
|
108
|
+
|
|
109
|
+
The resolver returns:
|
|
110
|
+
|
|
111
|
+
- the matched project record
|
|
112
|
+
- the resolved project root
|
|
113
|
+
- the matched method: `ref`, `id`, `alias`, or `path`
|
|
114
|
+
|
|
115
|
+
Resolution priority:
|
|
116
|
+
|
|
117
|
+
1. exact `project_ref`
|
|
118
|
+
2. exact `project_id`
|
|
119
|
+
3. unique alias
|
|
120
|
+
4. path-to-project containment
|
|
121
|
+
|
|
122
|
+
If multiple matches remain, Brainclaw must stop and return a clear ambiguity error.
|
|
123
|
+
|
|
124
|
+
## CLI Surface
|
|
125
|
+
|
|
126
|
+
The minimal agent-first CLI surface should be:
|
|
127
|
+
|
|
128
|
+
### `brainclaw projects`
|
|
129
|
+
|
|
130
|
+
List known projects in the current workspace.
|
|
131
|
+
|
|
132
|
+
Fields:
|
|
133
|
+
|
|
134
|
+
- `project_ref`
|
|
135
|
+
- `project_name`
|
|
136
|
+
- `relative_path`
|
|
137
|
+
- `parent_ref`
|
|
138
|
+
- `store_present`
|
|
139
|
+
|
|
140
|
+
### `brainclaw project <ref>`
|
|
141
|
+
|
|
142
|
+
Show a compact project card.
|
|
143
|
+
|
|
144
|
+
Fields:
|
|
145
|
+
|
|
146
|
+
- `project_id`
|
|
147
|
+
- `project_ref`
|
|
148
|
+
- `aliases`
|
|
149
|
+
- `absolute_path`
|
|
150
|
+
- `parent_ref`
|
|
151
|
+
- `children`
|
|
152
|
+
- `dependencies`
|
|
153
|
+
- store health summary
|
|
154
|
+
|
|
155
|
+
### `brainclaw context --project <ref>`
|
|
156
|
+
|
|
157
|
+
Resolve the target project first, then build context from that store.
|
|
158
|
+
|
|
159
|
+
Notes:
|
|
160
|
+
|
|
161
|
+
- this is stronger than `context --for`
|
|
162
|
+
- `--for` still helps ranking within the resolved project
|
|
163
|
+
|
|
164
|
+
Example:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
brainclaw context --project applications/lodestar --for src/app.ts
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### `brainclaw children <ref>`
|
|
171
|
+
|
|
172
|
+
Return direct child projects.
|
|
173
|
+
|
|
174
|
+
### `brainclaw ancestors <ref>`
|
|
175
|
+
|
|
176
|
+
Return the project chain from parent to workspace root.
|
|
177
|
+
|
|
178
|
+
### `brainclaw dependencies <ref>`
|
|
179
|
+
|
|
180
|
+
Return declared or detected project dependencies.
|
|
181
|
+
|
|
182
|
+
### `brainclaw locate <path>`
|
|
183
|
+
|
|
184
|
+
Resolve any path to the owning project.
|
|
185
|
+
|
|
186
|
+
This is especially useful for agents:
|
|
187
|
+
|
|
188
|
+
- start from a changed file
|
|
189
|
+
- ask Brainclaw which project owns it
|
|
190
|
+
- then request context for that project
|
|
191
|
+
|
|
192
|
+
## MCP Surface
|
|
193
|
+
|
|
194
|
+
The MCP equivalents should mirror the CLI rather than invent a second addressing model.
|
|
195
|
+
|
|
196
|
+
Suggested tools:
|
|
197
|
+
|
|
198
|
+
- `bclaw_list_projects`
|
|
199
|
+
- `bclaw_get_project`
|
|
200
|
+
- `bclaw_get_project_context`
|
|
201
|
+
- `bclaw_list_project_children`
|
|
202
|
+
- `bclaw_list_project_ancestors`
|
|
203
|
+
- `bclaw_list_project_dependencies`
|
|
204
|
+
- `bclaw_locate_project`
|
|
205
|
+
|
|
206
|
+
All of them should accept `project_ref` as the primary selector.
|
|
207
|
+
|
|
208
|
+
`bclaw_get_context` may continue to exist, but multi-project agents should prefer `bclaw_get_project_context`.
|
|
209
|
+
|
|
210
|
+
## Hierarchy Semantics
|
|
211
|
+
|
|
212
|
+
Hierarchy comes from project roots on disk.
|
|
213
|
+
|
|
214
|
+
Definitions:
|
|
215
|
+
|
|
216
|
+
- parent: nearest known project root above the current project
|
|
217
|
+
- child: known project whose nearest known parent is the current project
|
|
218
|
+
- ancestor: repeated parent chain
|
|
219
|
+
|
|
220
|
+
This is path-derived and deterministic.
|
|
221
|
+
|
|
222
|
+
## Dependency Semantics
|
|
223
|
+
|
|
224
|
+
Dependencies are different from hierarchy.
|
|
225
|
+
|
|
226
|
+
Dependencies should support two sources:
|
|
227
|
+
|
|
228
|
+
- declared links in Brainclaw metadata
|
|
229
|
+
- detected links from repo/workspace tooling when reliable
|
|
230
|
+
|
|
231
|
+
Examples:
|
|
232
|
+
|
|
233
|
+
- monorepo package dependencies
|
|
234
|
+
- service depends on shared database project
|
|
235
|
+
- app depends on auth service
|
|
236
|
+
|
|
237
|
+
The first iteration should allow declared dependencies first.
|
|
238
|
+
|
|
239
|
+
Auto-detection can remain additive.
|
|
240
|
+
|
|
241
|
+
## Storage Direction
|
|
242
|
+
|
|
243
|
+
This does not require replacing current project ids or store layout.
|
|
244
|
+
|
|
245
|
+
It requires a workspace project registry that can be rebuilt or refreshed non-destructively.
|
|
246
|
+
|
|
247
|
+
Likely location:
|
|
248
|
+
|
|
249
|
+
- workspace-level discovery inventory
|
|
250
|
+
|
|
251
|
+
Likely persisted fields:
|
|
252
|
+
|
|
253
|
+
- stable `project_ref`
|
|
254
|
+
- alias set
|
|
255
|
+
- hierarchy links
|
|
256
|
+
- declared dependency links
|
|
257
|
+
|
|
258
|
+
This should stay clearly separate from canonical memory items such as decisions and constraints.
|
|
259
|
+
|
|
260
|
+
## Migration Strategy
|
|
261
|
+
|
|
262
|
+
The migration should be low-risk and incremental.
|
|
263
|
+
|
|
264
|
+
Phase 1:
|
|
265
|
+
|
|
266
|
+
- introduce `project_ref` in workspace discovery/registry
|
|
267
|
+
- expose `brainclaw projects`
|
|
268
|
+
- expose `brainclaw locate`
|
|
269
|
+
|
|
270
|
+
Phase 2:
|
|
271
|
+
|
|
272
|
+
- add `context --project <ref>`
|
|
273
|
+
- keep current `context --for <path>` behavior
|
|
274
|
+
- when `--project` is present, it wins over cwd heuristics
|
|
275
|
+
|
|
276
|
+
Phase 3:
|
|
277
|
+
|
|
278
|
+
- add `children` and `ancestors`
|
|
279
|
+
- add MCP equivalents
|
|
280
|
+
|
|
281
|
+
Phase 4:
|
|
282
|
+
|
|
283
|
+
- add declared dependencies
|
|
284
|
+
- optionally add auto-detection
|
|
285
|
+
|
|
286
|
+
## Non-Goals
|
|
287
|
+
|
|
288
|
+
This design does not require:
|
|
289
|
+
|
|
290
|
+
- replacing `project_id`
|
|
291
|
+
- removing cwd-based commands
|
|
292
|
+
- making aliases mandatory
|
|
293
|
+
- making dependency inference perfect in the first release
|
|
294
|
+
|
|
295
|
+
## Recommendation
|
|
296
|
+
|
|
297
|
+
The first implementation slice should be:
|
|
298
|
+
|
|
299
|
+
1. add `project_ref` to workspace project discovery
|
|
300
|
+
2. add a project resolver shared by CLI and MCP
|
|
301
|
+
3. add `brainclaw projects`
|
|
302
|
+
4. add `brainclaw context --project <ref>`
|
|
303
|
+
5. add `brainclaw locate <path>`
|
|
304
|
+
|
|
305
|
+
That is enough to give agents a stable and simple project-addressing model without a risky refactor.
|
package/docs/cli.md
CHANGED
|
@@ -918,7 +918,7 @@ Generate compact, prompt-ready context for agents.
|
|
|
918
918
|
|
|
919
919
|
| Option | Description |
|
|
920
920
|
|---|---|
|
|
921
|
-
| `--for <path>` | Scope context to a file or path |
|
|
921
|
+
| `--for <path>` | Scope context to a file or path; in folder-mode workspaces, child project paths resolve the matching nested store automatically |
|
|
922
922
|
| `--project <name>` | Filter by project |
|
|
923
923
|
| `--agent <name>` | Filter by agent |
|
|
924
924
|
| `--host <name>` | Filter by host |
|
|
@@ -938,6 +938,7 @@ Generate compact, prompt-ready context for agents.
|
|
|
938
938
|
|
|
939
939
|
```bash
|
|
940
940
|
brainclaw context --for src/auth/routes.ts --digest
|
|
941
|
+
brainclaw context --for applications/lodestar/src/app.ts --json
|
|
941
942
|
brainclaw context --json --max-chars 1200
|
|
942
943
|
brainclaw context --explain
|
|
943
944
|
brainclaw context --since-session --max-items 20
|
|
@@ -1,182 +1,134 @@
|
|
|
1
|
-
# Agent Integration
|
|
2
|
-
|
|
3
|
-
## Core reality
|
|
4
|
-
|
|
5
|
-
No agent should be assumed to obey a single instruction perfectly every time.
|
|
6
|
-
|
|
7
|
-
That means brainclaw integration should not rely on only one mechanism such as:
|
|
8
|
-
|
|
9
|
-
- a single instruction file
|
|
10
|
-
- a single skill
|
|
11
|
-
- a single startup command
|
|
12
|
-
|
|
13
|
-
## Better approach
|
|
14
|
-
|
|
15
|
-
Use multiple points of contact:
|
|
16
|
-
|
|
17
|
-
- lightweight system instructions
|
|
18
|
-
- project-specific context retrieval through MCP when available
|
|
19
|
-
- prompt-ready generated context
|
|
20
|
-
- native agent files for local reminders
|
|
21
|
-
- MCP tools for dynamic state
|
|
22
|
-
- board and status views
|
|
23
|
-
- workflow reminders around plans, claims, and handoffs
|
|
24
|
-
|
|
25
|
-
## Surface hierarchy
|
|
26
|
-
|
|
27
|
-
The default order is:
|
|
28
|
-
|
|
29
|
-
1. MCP for live state
|
|
30
|
-
2. native agent files for local workflow guidance
|
|
31
|
-
3. readable files as fallback
|
|
32
|
-
4. CLI for setup, operator tasks, scripting, and fallback workflows
|
|
33
|
-
|
|
34
|
-
This keeps dynamic state dynamic instead of trying to encode it permanently into static instructions.
|
|
35
|
-
|
|
36
|
-
## System instructions vs project instructions
|
|
37
|
-
|
|
38
|
-
Keep these separate.
|
|
39
|
-
|
|
40
|
-
### System instructions
|
|
41
|
-
How the agent should use brainclaw.
|
|
42
|
-
|
|
43
|
-
Examples:
|
|
44
|
-
|
|
45
|
-
- check workspace memory before significant changes
|
|
46
|
-
- prefer MCP over manual CLI calls when MCP is available
|
|
47
|
-
- bootstrap if the workspace is not initialized and the workflow allows it
|
|
48
|
-
- respect file claims
|
|
49
|
-
- update shared plan status when appropriate
|
|
50
|
-
|
|
51
|
-
### Project instructions
|
|
52
|
-
What is true for the current workspace.
|
|
53
|
-
|
|
54
|
-
Examples:
|
|
55
|
-
|
|
56
|
-
- active constraints
|
|
57
|
-
- recent decisions
|
|
58
|
-
- known traps
|
|
59
|
-
- current handoffs
|
|
60
|
-
- relevant plan context
|
|
1
|
+
# Agent Integration
|
|
61
2
|
|
|
62
|
-
##
|
|
3
|
+
## The problem brainclaw solves for agents
|
|
63
4
|
|
|
64
|
-
|
|
5
|
+
Coding agents are stateless. Each session starts from zero. They don't know:
|
|
65
6
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
`setup` and `init` write the appropriate local agent config files for the detected integrations. Workspace-local generated files are also added to `.gitignore` automatically so agent-specific config does not pollute Git status.
|
|
7
|
+
- what other agents have been working on
|
|
8
|
+
- what files are being actively edited by someone else
|
|
9
|
+
- what decisions were made last week and why
|
|
10
|
+
- what traps to avoid in a specific part of the codebase
|
|
71
11
|
|
|
72
|
-
|
|
12
|
+
Brainclaw gives every agent access to this shared context through a combination of surfaces adapted to what each agent can handle.
|
|
73
13
|
|
|
74
|
-
|
|
75
|
-
brainclaw enable-agent claude-code
|
|
76
|
-
brainclaw enable-agent cursor
|
|
77
|
-
brainclaw enable-agent windsurf
|
|
78
|
-
brainclaw enable-agent opencode
|
|
79
|
-
brainclaw enable-agent antigravity
|
|
80
|
-
```
|
|
14
|
+
## Multiple points of contact
|
|
81
15
|
|
|
82
|
-
|
|
16
|
+
No single mechanism is enough. Agents don't always obey a single instruction file. They sometimes skip MCP calls. They forget between prompts.
|
|
83
17
|
|
|
84
|
-
|
|
85
|
-
brainclaw export --format claude-md --write
|
|
86
|
-
brainclaw export --format cursor-rules --write
|
|
87
|
-
brainclaw export --format agents-md --write # Codex, OpenCode
|
|
88
|
-
brainclaw export --format gemini-md --write # Antigravity / Gemini CLI
|
|
89
|
-
brainclaw export --format claude-md --write --shared # only if you want the main instruction file versioned
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
`--detect` auto-selects formats based on files found in the workspace:
|
|
18
|
+
That's why brainclaw uses every available surface:
|
|
93
19
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
If a repo already contains tracked local agent files from an older setup, `brainclaw session-start` warns at the beginning of work and `brainclaw doctor --fix-agent-ignore` can repair the missing `.gitignore` entries. Tracked files still need to be untracked manually with Git after the ignore rules are in place.
|
|
20
|
+
1. **Instruction files** set the frame — "this project uses brainclaw, here's how"
|
|
21
|
+
2. **Hooks** inject context automatically — the agent sees plans and claims without asking
|
|
22
|
+
3. **MCP tools** provide on-demand access — the agent calls brainclaw when it needs more detail
|
|
23
|
+
4. **Auto-approve** removes friction — no popup confirmation for each tool call
|
|
24
|
+
5. **Skills/commands** give the developer a manual override — force a context refresh when needed
|
|
101
25
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
The brainclaw MCP server exposes the dynamic Brainclaw workflow directly. For capable agents, this is the nominal runtime path.
|
|
26
|
+
The more surfaces are active, the more reliably the agent uses brainclaw.
|
|
105
27
|
|
|
106
|
-
|
|
28
|
+
## What the instruction file contains
|
|
107
29
|
|
|
108
|
-
|
|
109
|
-
brainclaw mcp
|
|
110
|
-
```
|
|
30
|
+
The instruction file (CLAUDE.md, .cursor/rules/, AGENTS.md, etc.) is the agent's first contact with brainclaw. Its content depends on the agent's capabilities:
|
|
111
31
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
### Available MCP tools
|
|
115
|
-
|
|
116
|
-
| Tool | Description |
|
|
117
|
-
|------|-------------|
|
|
118
|
-
| `bclaw_get_context` | Full workspace context (constraints, decisions, traps, plans, handoffs) |
|
|
119
|
-
| `bclaw_get_agent_board` | Live plan + claim board |
|
|
120
|
-
| `bclaw_session_start` | Start an agent session (registers identity) |
|
|
121
|
-
| `bclaw_session_end` | End session, optionally auto-release claims |
|
|
122
|
-
| `bclaw_claim` | Claim a file scope |
|
|
123
|
-
| `bclaw_release_claim` | Release a claim |
|
|
124
|
-
| `bclaw_create_candidate` | Create a plan item |
|
|
125
|
-
| `bclaw_accept` / `bclaw_reject` | Accept or reject a plan candidate |
|
|
126
|
-
| `bclaw_write_note` | Write a runtime note |
|
|
127
|
-
| `bclaw_search` | Search memory entries |
|
|
128
|
-
| `bclaw_read_handoff` | Read a handoff document |
|
|
129
|
-
| `bclaw_bootstrap` | Initialize the workspace if not already done |
|
|
130
|
-
| `bclaw_get_execution_context` | Get execution context (identity, claims, active plans) |
|
|
131
|
-
|
|
132
|
-
## Session lifecycle
|
|
133
|
-
|
|
134
|
-
### Starting a session
|
|
135
|
-
|
|
136
|
-
```bash
|
|
137
|
-
brainclaw session-start --agent my-agent --model claude-opus-4-5
|
|
138
|
-
```
|
|
32
|
+
### For agents with MCP and hooks (Claude Code)
|
|
139
33
|
|
|
140
|
-
|
|
34
|
+
Short and focused:
|
|
35
|
+
- Why brainclaw matters for this project
|
|
36
|
+
- The session protocol (hooks handle the rest)
|
|
37
|
+
- Active constraints and instructions
|
|
38
|
+
- Version check reminder
|
|
141
39
|
|
|
142
|
-
###
|
|
143
|
-
|
|
144
|
-
For MCP-capable agents, prefer the MCP equivalents of these actions. The CLI examples below are the operator and fallback form of the same lifecycle.
|
|
40
|
+
### For agents with MCP but no hooks (Cursor, Codex, OpenCode, etc.)
|
|
145
41
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
42
|
+
More directive:
|
|
43
|
+
- Same core sections as above, with stronger language ("REQUIRED", "MUST")
|
|
44
|
+
- The top 5 most critical traps (the agent won't see them otherwise)
|
|
45
|
+
- Explicit step-by-step protocol with all MCP calls listed
|
|
46
|
+
|
|
47
|
+
### For agents without MCP (Copilot)
|
|
48
|
+
|
|
49
|
+
Full static context:
|
|
50
|
+
- All of the above
|
|
51
|
+
- Active plans with status and assignees
|
|
52
|
+
- All shared traps
|
|
53
|
+
- Recent architectural decisions
|
|
54
|
+
|
|
55
|
+
## Setting up agent integration
|
|
153
56
|
|
|
154
|
-
###
|
|
57
|
+
### Automatic (recommended)
|
|
155
58
|
|
|
156
59
|
```bash
|
|
157
|
-
brainclaw
|
|
60
|
+
brainclaw setup # machine-level: detects agents, creates global configs
|
|
61
|
+
brainclaw init # project-level: creates .brainclaw/, writes agent files
|
|
158
62
|
```
|
|
159
63
|
|
|
160
|
-
|
|
64
|
+
Or ask your coding agent to do it:
|
|
161
65
|
|
|
162
|
-
|
|
66
|
+
```
|
|
67
|
+
"Install and initialize brainclaw in this project"
|
|
68
|
+
```
|
|
163
69
|
|
|
164
|
-
|
|
70
|
+
The agent can use `bclaw_setup` to walk through the process interactively.
|
|
165
71
|
|
|
166
|
-
|
|
72
|
+
### Per-agent manual setup
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
brainclaw enable-agent claude-code
|
|
76
|
+
brainclaw enable-agent cursor
|
|
77
|
+
brainclaw export --format claude-md --write
|
|
78
|
+
brainclaw export --detect --write # auto-detect and write all formats
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Regenerating after changes
|
|
82
|
+
|
|
83
|
+
When brainclaw memory changes (new constraints, resolved traps, updated plans), regenerate instruction files:
|
|
167
84
|
|
|
168
85
|
```bash
|
|
169
86
|
brainclaw export --detect --write
|
|
170
87
|
```
|
|
171
88
|
|
|
89
|
+
For agents without MCP (Copilot), this is especially important — the instruction file is their only source of project context.
|
|
90
|
+
|
|
91
|
+
## Generated files are local
|
|
92
|
+
|
|
93
|
+
Agent config files generated by brainclaw are **not committed to Git**. Each developer regenerates them locally from the shared `.brainclaw/` store.
|
|
94
|
+
|
|
172
95
|
This ensures:
|
|
173
|
-
-
|
|
174
|
-
-
|
|
175
|
-
-
|
|
96
|
+
- No machine-specific traps leak into the shared repo
|
|
97
|
+
- Each developer's agent sees instructions tailored to their setup
|
|
98
|
+
- Instructions stay in sync with current memory, not a stale committed version
|
|
99
|
+
|
|
100
|
+
brainclaw adds all generated files to `.gitignore` automatically during init.
|
|
101
|
+
|
|
102
|
+
Exception: use `--shared` if you intentionally want the main instruction file (e.g., CLAUDE.md) versioned for the whole team.
|
|
103
|
+
|
|
104
|
+
## Session lifecycle
|
|
105
|
+
|
|
106
|
+
### Starting work
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
bclaw_session_start → identify yourself, see the board
|
|
110
|
+
bclaw_get_context(target: "src/auth/") → load relevant memory
|
|
111
|
+
bclaw_get_execution_context → check for brainclaw updates
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### During work
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
bclaw_claim(scope: "src/auth/") → signal what you're editing
|
|
118
|
+
bclaw_write_note("Found a race condition in AuthService") → record observations
|
|
119
|
+
bclaw_create_plan("Fix race condition", estimate: 30) → track work
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Finishing work
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
bclaw_session_end(auto_release: true) → release claims, update plans
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Plans and estimation
|
|
176
129
|
|
|
177
|
-
|
|
130
|
+
Always estimate duration in minutes when creating a plan or step. When completing, report actual effort. This builds a calibration history that helps improve future estimates — agents are typically poor at estimation, and this feedback loop helps.
|
|
178
131
|
|
|
179
|
-
##
|
|
132
|
+
## Version awareness
|
|
180
133
|
|
|
181
|
-
|
|
182
|
-
The goal is to make brainclaw the natural path for fresh workspace context and coordination.
|
|
134
|
+
Agents should call `bclaw_get_execution_context` at session start. If a newer brainclaw version is available, it tells the agent, who can then inform the developer and suggest updating. Updates may include new features, new MCP tools, and improved coordination.
|