brainclaw 0.19.5 → 0.19.6
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/LICENSE +0 -0
- package/README.md +22 -20
- package/dist/cli.js +0 -0
- package/dist/commands/accept.js +0 -0
- package/dist/commands/adapter-openclaw-import.js +0 -0
- package/dist/commands/add-step.js +0 -0
- package/dist/commands/agent-board.js +0 -0
- package/dist/commands/audit.js +0 -0
- package/dist/commands/bootstrap.js +0 -0
- package/dist/commands/capability.js +0 -0
- package/dist/commands/changes.js +0 -0
- package/dist/commands/check-constraints.js +0 -0
- package/dist/commands/claim-resource.js +0 -0
- package/dist/commands/claim.js +0 -0
- package/dist/commands/complete-step.js +0 -0
- package/dist/commands/constraint.js +0 -0
- package/dist/commands/context-diff.js +0 -0
- package/dist/commands/context.js +0 -0
- package/dist/commands/decision.js +0 -0
- package/dist/commands/delete-plan.js +0 -0
- package/dist/commands/diff.js +0 -0
- package/dist/commands/doctor.js +0 -0
- package/dist/commands/enable-agent.js +0 -0
- package/dist/commands/env.js +0 -0
- package/dist/commands/estimation-report.js +0 -0
- package/dist/commands/explore.js +0 -0
- package/dist/commands/export.js +0 -0
- package/dist/commands/handoff.js +0 -0
- package/dist/commands/history.js +0 -0
- package/dist/commands/hooks.js +0 -0
- package/dist/commands/init.js +0 -0
- package/dist/commands/install-hooks.js +0 -0
- package/dist/commands/instruction.js +0 -0
- package/dist/commands/list-agents.js +0 -0
- package/dist/commands/list-claims.js +0 -0
- package/dist/commands/list-instructions.js +0 -0
- package/dist/commands/list-plans.js +0 -0
- package/dist/commands/mcp-worker.js +0 -0
- package/dist/commands/mcp.js +0 -0
- package/dist/commands/memory.js +0 -0
- package/dist/commands/metrics.js +0 -0
- package/dist/commands/plan-resource.js +0 -0
- package/dist/commands/plan.js +0 -0
- package/dist/commands/prune-candidates.js +0 -0
- package/dist/commands/prune.js +0 -0
- package/dist/commands/pull.js +0 -0
- package/dist/commands/push.js +0 -0
- package/dist/commands/rebuild.js +0 -0
- package/dist/commands/reflect-runtime-note.js +0 -0
- package/dist/commands/reflect.js +0 -0
- package/dist/commands/register-agent.js +0 -0
- package/dist/commands/reject.js +0 -0
- package/dist/commands/release-claim.js +0 -0
- package/dist/commands/release-claims.js +0 -0
- package/dist/commands/review.js +0 -0
- package/dist/commands/rollback.js +0 -0
- package/dist/commands/runtime-note.js +0 -0
- package/dist/commands/runtime-status.js +0 -0
- package/dist/commands/search.js +0 -0
- package/dist/commands/session-end.js +0 -0
- package/dist/commands/session-start.js +0 -0
- package/dist/commands/set-trust.js +0 -0
- package/dist/commands/setup.js +0 -0
- package/dist/commands/show-candidate.js +0 -0
- package/dist/commands/star-candidate.js +0 -0
- package/dist/commands/status.js +0 -0
- package/dist/commands/sync.js +0 -0
- package/dist/commands/tool.js +0 -0
- package/dist/commands/trap.js +0 -0
- package/dist/commands/update-handoff.js +0 -0
- package/dist/commands/update-plan.js +0 -0
- package/dist/commands/upgrade.js +0 -0
- package/dist/commands/use-candidate.js +0 -0
- package/dist/commands/version.js +0 -0
- package/dist/commands/watch.js +0 -0
- package/dist/commands/whoami.js +0 -0
- package/dist/core/agent-context.js +0 -0
- package/dist/core/agent-files.js +0 -0
- package/dist/core/agent-integrations.js +0 -0
- package/dist/core/agent-inventory.js +0 -0
- package/dist/core/agent-registry.js +0 -0
- package/dist/core/ai-agent-detection.js +0 -0
- package/dist/core/audit.js +0 -0
- package/dist/core/bootstrap.js +0 -0
- package/dist/core/brainclaw-version.js +0 -0
- package/dist/core/candidates.js +0 -0
- package/dist/core/circuit-breaker.js +0 -0
- package/dist/core/claims.js +0 -0
- package/dist/core/config.js +0 -0
- package/dist/core/context-diff.js +0 -0
- package/dist/core/context.js +0 -0
- package/dist/core/contradictions.js +0 -0
- package/dist/core/coordination.js +0 -0
- package/dist/core/cross-project.js +0 -0
- package/dist/core/duplicates.js +0 -0
- package/dist/core/event-log.js +0 -0
- package/dist/core/events.js +0 -0
- package/dist/core/execution-context.js +0 -0
- package/dist/core/freshness.js +0 -0
- package/dist/core/global-registry.js +0 -0
- package/dist/core/host.js +0 -0
- package/dist/core/identity.js +0 -0
- package/dist/core/ids.js +0 -0
- package/dist/core/input-validation.js +0 -0
- package/dist/core/instructions.js +0 -0
- package/dist/core/io.js +0 -0
- package/dist/core/json-store.js +0 -0
- package/dist/core/lifecycle.js +0 -0
- package/dist/core/lock.js +0 -0
- package/dist/core/logger.js +0 -0
- package/dist/core/machine-profile.js +0 -0
- package/dist/core/markdown.js +0 -0
- package/dist/core/memory-git.js +0 -0
- package/dist/core/migration.js +0 -0
- package/dist/core/project-registry.js +0 -0
- package/dist/core/reflection-safety.js +0 -0
- package/dist/core/repo-analysis.js +0 -0
- package/dist/core/reputation.js +0 -0
- package/dist/core/runtime.js +0 -0
- package/dist/core/schema.js +0 -0
- package/dist/core/search.js +0 -0
- package/dist/core/security.js +0 -0
- package/dist/core/setup-state.js +0 -0
- package/dist/core/state.js +0 -0
- package/dist/core/store-resolution.js +0 -0
- package/dist/core/sync-remote.js +0 -0
- package/dist/core/traps.js +0 -0
- package/docs/adapters/openclaw.md +43 -0
- package/docs/cli.md +1230 -0
- package/docs/concepts/coordination.md +52 -0
- package/docs/concepts/memory.md +87 -0
- package/docs/concepts/plans-and-claims.md +139 -0
- package/docs/concepts/runtime-notes.md +38 -0
- package/docs/concepts/workspace-bootstrapping.md +40 -0
- package/docs/context-format-changelog.md +35 -0
- package/docs/context-format.md +48 -0
- package/docs/integrations/agents.md +169 -0
- package/docs/integrations/claude-code.md +23 -0
- package/docs/integrations/codex.md +23 -0
- package/docs/integrations/copilot.md +21 -0
- package/docs/integrations/cursor.md +23 -0
- package/docs/integrations/mcp.md +51 -0
- package/docs/integrations/overview.md +61 -0
- package/docs/mcp-schema-changelog.md +108 -0
- package/docs/product/positioning.md +97 -0
- package/docs/quickstart.md +99 -0
- package/docs/reputation.md +52 -0
- package/docs/review.md +43 -0
- package/docs/security.md +53 -0
- package/docs/storage.md +81 -0
- package/package.json +3 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Coordination
|
|
2
|
+
|
|
3
|
+
brainclaw is not only a memory layer.
|
|
4
|
+
It is also a coordination layer.
|
|
5
|
+
|
|
6
|
+
That distinction matters.
|
|
7
|
+
|
|
8
|
+
## Why coordination is needed
|
|
9
|
+
|
|
10
|
+
Multiple humans and coding agents working in the same repo can easily:
|
|
11
|
+
|
|
12
|
+
- duplicate work
|
|
13
|
+
- miss handoffs
|
|
14
|
+
- overwrite each other
|
|
15
|
+
- diverge on plan status
|
|
16
|
+
- act on stale assumptions
|
|
17
|
+
|
|
18
|
+
Traditional instruction files do not solve this well because they describe how to behave, but not what is currently happening.
|
|
19
|
+
|
|
20
|
+
## What brainclaw adds
|
|
21
|
+
|
|
22
|
+
brainclaw introduces shared operational state for a workspace, including:
|
|
23
|
+
|
|
24
|
+
- plans
|
|
25
|
+
- task status
|
|
26
|
+
- file claims
|
|
27
|
+
- handoffs
|
|
28
|
+
- runtime notes
|
|
29
|
+
- board views
|
|
30
|
+
|
|
31
|
+
## The key idea
|
|
32
|
+
|
|
33
|
+
A workspace should expose not only what the project knows, but also what is currently being done.
|
|
34
|
+
|
|
35
|
+
That includes:
|
|
36
|
+
|
|
37
|
+
- what matters
|
|
38
|
+
- what is active
|
|
39
|
+
- who is working where
|
|
40
|
+
- what is blocked
|
|
41
|
+
- what needs review or handoff
|
|
42
|
+
|
|
43
|
+
## Why this is different from another agent
|
|
44
|
+
|
|
45
|
+
brainclaw does not try to become the agent that does everything.
|
|
46
|
+
It helps many tools collaborate against the same workspace state.
|
|
47
|
+
|
|
48
|
+
## Related pages
|
|
49
|
+
|
|
50
|
+
- [plans-and-claims.md](plans-and-claims.md)
|
|
51
|
+
- [runtime-notes.md](runtime-notes.md)
|
|
52
|
+
- [../integrations/overview.md](../integrations/overview.md)
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Memory
|
|
2
|
+
|
|
3
|
+
brainclaw uses the term **memory** in an explicit, workspace-oriented sense.
|
|
4
|
+
|
|
5
|
+
This is not an opaque cloud memory feature.
|
|
6
|
+
It is shared project state stored locally in a structured, inspectable form.
|
|
7
|
+
|
|
8
|
+
## What memory includes
|
|
9
|
+
|
|
10
|
+
Durable memory can include:
|
|
11
|
+
|
|
12
|
+
- **instructions** — agent workflow instructions written to native formats (CLAUDE.md, .cursor/rules/, etc.)
|
|
13
|
+
- **constraints** — active project constraints that agents must respect
|
|
14
|
+
- **decisions** — logged architectural or process decisions
|
|
15
|
+
- **traps** — documented pitfalls to avoid (with severity and remediation)
|
|
16
|
+
- **handoffs** — structured context transfers between agents or sessions
|
|
17
|
+
- **plans** — shared work items with status, priority, and estimation data
|
|
18
|
+
- **claims** — active file/scope ownership signals for collision avoidance
|
|
19
|
+
- **runtime notes** — short-lived observations from the current session
|
|
20
|
+
- **audit log** — timestamped record of all brainclaw operations in the workspace
|
|
21
|
+
|
|
22
|
+
These are the pieces of context that should survive across sessions and be readable by both humans and agents.
|
|
23
|
+
|
|
24
|
+
## Durable vs runtime
|
|
25
|
+
|
|
26
|
+
A useful mental model is to separate:
|
|
27
|
+
|
|
28
|
+
### Durable memory
|
|
29
|
+
Shared project knowledge worth keeping.
|
|
30
|
+
|
|
31
|
+
Examples: constraints, decisions, traps, completed plans, handoffs.
|
|
32
|
+
|
|
33
|
+
Shared traps now have a lifecycle too: `active`, `resolved`, or `expired`. Active views such as generated context, status, and `project.md` prioritize only active traps so old machine-setup issues stop polluting the current working set, while the canonical memory still keeps resolved traps for audit and search.
|
|
34
|
+
|
|
35
|
+
These live in `.brainclaw/store.json` and are shared via Git (or by reading the same file).
|
|
36
|
+
|
|
37
|
+
### Runtime memory
|
|
38
|
+
Operational observations that may be short-lived, host-specific, or private.
|
|
39
|
+
|
|
40
|
+
Examples: "this API key only works in staging", "the test server is slow today", temporary notes during a session.
|
|
41
|
+
|
|
42
|
+
Runtime notes are stored separately and can be given a TTL so they expire automatically.
|
|
43
|
+
|
|
44
|
+
Not everything seen during execution should become canonical memory immediately.
|
|
45
|
+
|
|
46
|
+
## Why explicit memory matters
|
|
47
|
+
|
|
48
|
+
Without explicit memory, project context tends to scatter across:
|
|
49
|
+
|
|
50
|
+
- chat history
|
|
51
|
+
- agent prompts
|
|
52
|
+
- personal notes
|
|
53
|
+
- unstated assumptions
|
|
54
|
+
- hidden tool memory
|
|
55
|
+
|
|
56
|
+
brainclaw makes this context visible and versionable.
|
|
57
|
+
|
|
58
|
+
## Readable vs canonical
|
|
59
|
+
|
|
60
|
+
brainclaw keeps:
|
|
61
|
+
|
|
62
|
+
- canonical structured JSON as the source of truth (`.brainclaw/store.json`)
|
|
63
|
+
- a generated readable view in each agent's native format (`CLAUDE.md`, `.cursor/rules/brainclaw.md`, etc.)
|
|
64
|
+
|
|
65
|
+
This balances machine reliability with human readability.
|
|
66
|
+
|
|
67
|
+
The generated files are **local-only** and should not be committed to Git — each developer regenerates them from their own `.brainclaw/` store. Add them to `.gitignore` (brainclaw does this automatically during `init`).
|
|
68
|
+
|
|
69
|
+
## Accessing memory
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
brainclaw context # full context as text
|
|
73
|
+
brainclaw context --json # full context as JSON (for agents)
|
|
74
|
+
brainclaw agent-board # live plan + claim board
|
|
75
|
+
brainclaw claim list # active claims
|
|
76
|
+
brainclaw plan list # all plans
|
|
77
|
+
brainclaw audit # audit log
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
MCP tools expose the same data to agents that support the Model Context Protocol.
|
|
81
|
+
|
|
82
|
+
## Related pages
|
|
83
|
+
|
|
84
|
+
- [coordination.md](coordination.md)
|
|
85
|
+
- [runtime-notes.md](runtime-notes.md)
|
|
86
|
+
- [workspace-bootstrapping.md](workspace-bootstrapping.md)
|
|
87
|
+
- [plans-and-claims.md](plans-and-claims.md)
|
|
@@ -0,0 +1,139 @@
|
|
|
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-index>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Steps show up in `brainclaw context` and `brainclaw board` so other agents and humans can see granular progress.
|
|
57
|
+
|
|
58
|
+
### Estimation and calibration
|
|
59
|
+
|
|
60
|
+
When both `estimated_effort` and `actual_effort` are present on completed plans, brainclaw can compute an accuracy report:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
brainclaw estimation-report
|
|
64
|
+
brainclaw estimation-report --agent my-agent
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
This shows a ratio chart (actual / estimate) and a calibration hint:
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
task with estimate est:30min actual:45min [ratio:1.5x]
|
|
71
|
+
[0.0x ░░░░░░░░░░│████████████████████░░░░░░░░░░░░░░░░░ 2.0x+]
|
|
72
|
+
OVER +50%
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
A ratio below 1.0 means the task finished faster than expected (early). Above 1.0 means it took longer (over).
|
|
76
|
+
|
|
77
|
+
## Claims
|
|
78
|
+
|
|
79
|
+
Claims make current ownership explicit.
|
|
80
|
+
|
|
81
|
+
A claim can represent:
|
|
82
|
+
|
|
83
|
+
- a file
|
|
84
|
+
- a folder
|
|
85
|
+
- a feature area
|
|
86
|
+
- a work scope linked to a plan item
|
|
87
|
+
|
|
88
|
+
Claims help reduce collisions when multiple humans or agents work in parallel.
|
|
89
|
+
|
|
90
|
+
### Creating claims
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
brainclaw claim create "refactoring auth module" --scope src/auth/
|
|
94
|
+
brainclaw claim create "updating docs" --scope docs/ --ttl 4h
|
|
95
|
+
brainclaw claim create "fixing login bug" --scope src/auth/ --plan <plan-id>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
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`.
|
|
99
|
+
|
|
100
|
+
### Listing and releasing claims
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
brainclaw claim list
|
|
104
|
+
brainclaw claim release <id>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
`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.
|
|
108
|
+
|
|
109
|
+
## Why claims matter
|
|
110
|
+
|
|
111
|
+
Without claims, multiple agents can easily touch the same area at once and generate conflicting changes.
|
|
112
|
+
Claims are not necessarily hard file locks.
|
|
113
|
+
They are a shared coordination signal.
|
|
114
|
+
|
|
115
|
+
## Recommended workflow
|
|
116
|
+
|
|
117
|
+
1. create a plan item
|
|
118
|
+
2. claim the target scope
|
|
119
|
+
3. work on the implementation
|
|
120
|
+
4. update the plan status
|
|
121
|
+
5. release the claim when done or blocked
|
|
122
|
+
6. create a handoff if another actor should continue
|
|
123
|
+
|
|
124
|
+
## Session hygiene
|
|
125
|
+
|
|
126
|
+
Before finishing a session, always:
|
|
127
|
+
|
|
128
|
+
- release active claims: `brainclaw claim release <id>`
|
|
129
|
+
- update plan items: `brainclaw plan update <id> --status done`
|
|
130
|
+
- or use `brainclaw session-end --auto-release` to clean up automatically
|
|
131
|
+
|
|
132
|
+
`session-end --auto-release` releases all claims held by the current agent and marks any `in_progress` plans as needing attention.
|
|
133
|
+
|
|
134
|
+
## Plans + claims together
|
|
135
|
+
|
|
136
|
+
Plans describe what should happen.
|
|
137
|
+
Claims describe who is currently working where.
|
|
138
|
+
|
|
139
|
+
That combination is much more useful than either one alone.
|
|
@@ -0,0 +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.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Workspace Bootstrapping
|
|
2
|
+
|
|
3
|
+
brainclaw is workspace-aware.
|
|
4
|
+
Shared memory is not assumed to exist everywhere by default.
|
|
5
|
+
|
|
6
|
+
## Why bootstrap exists
|
|
7
|
+
|
|
8
|
+
A workspace may be:
|
|
9
|
+
|
|
10
|
+
- already initialized
|
|
11
|
+
- known to the agent integration layer but not initialized locally
|
|
12
|
+
- entirely new
|
|
13
|
+
|
|
14
|
+
Bootstrap is the process that turns a workspace into a brainclaw-aware workspace.
|
|
15
|
+
|
|
16
|
+
## What bootstrap does
|
|
17
|
+
|
|
18
|
+
Bootstrap is more than creating a folder.
|
|
19
|
+
It establishes the first shared memory foundation for the workspace:
|
|
20
|
+
|
|
21
|
+
- inspects the repository structure
|
|
22
|
+
- detects the AI coding agent environment
|
|
23
|
+
- seeds stable workspace identity (`project_id`, `agent_id`)
|
|
24
|
+
- creates the initial storage structure
|
|
25
|
+
- writes to the detected agent's native instruction file (Cursor, Claude Code, Windsurf, etc.)
|
|
26
|
+
- creates `AGENTS.md` and `.github/copilot-instructions.md`
|
|
27
|
+
|
|
28
|
+
## Good integration pattern
|
|
29
|
+
|
|
30
|
+
1. check whether the workspace is initialized
|
|
31
|
+
2. if yes, retrieve fresh memory
|
|
32
|
+
3. if not, bootstrap when allowed
|
|
33
|
+
4. then use shared memory normally
|
|
34
|
+
|
|
35
|
+
## Why this matters for agents
|
|
36
|
+
|
|
37
|
+
If shared memory is absent, that should not always be interpreted as "there is no relevant context".
|
|
38
|
+
It may simply mean the workspace has not been onboarded yet.
|
|
39
|
+
|
|
40
|
+
This lets a single machine support multiple very different workspaces without forcing one static instruction layer to fit all of them equally well.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Context Format Changelog
|
|
2
|
+
|
|
3
|
+
## 1.3
|
|
4
|
+
|
|
5
|
+
- Added `available_capabilities` field to structured context containing registered project capabilities with metadata (id, name, category)
|
|
6
|
+
- Added `available_tools` field to structured context containing registered project tools with metadata (id, name, type)
|
|
7
|
+
- Enhanced text output to include "Available Capabilities" and "Available Tools" sections when metadata is present
|
|
8
|
+
- Added discovery hints pointing users to `bclaw_get_capabilities`, `bclaw_list_tools`, and `bclaw_search_tools` MCP tools
|
|
9
|
+
- Kept the contract additive and backward-compatible with `1.2`
|
|
10
|
+
|
|
11
|
+
## 1.2
|
|
12
|
+
|
|
13
|
+
- Added `context_diff` to expose compact memory deltas since a session started.
|
|
14
|
+
- Clarified the public contract for contradiction-aware session context refreshes.
|
|
15
|
+
- Kept the contract additive and backward-compatible with `1.1`.
|
|
16
|
+
|
|
17
|
+
## 1.1
|
|
18
|
+
|
|
19
|
+
- Added explicit `context_schema` rendering in markdown and template outputs.
|
|
20
|
+
- Added `agent_tooling.agents_rules`.
|
|
21
|
+
- Added skill metadata flags: `scripts_present`, `references_present`, `assets_present`.
|
|
22
|
+
- Added MCP inventory metadata: `availability`, `source`.
|
|
23
|
+
- Kept the contract additive and backward-compatible with `1.0`.
|
|
24
|
+
|
|
25
|
+
## 1.0
|
|
26
|
+
|
|
27
|
+
- Baseline contract introduced with:
|
|
28
|
+
- `digest`
|
|
29
|
+
- `memory_density`
|
|
30
|
+
- `bootstrap_available`
|
|
31
|
+
- `derived_signals`
|
|
32
|
+
- `execution_context`
|
|
33
|
+
- `agent_tooling`
|
|
34
|
+
- `scoped_activity`
|
|
35
|
+
- `selected`
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Context Format
|
|
2
|
+
|
|
3
|
+
`brainclaw context` and `bclaw_get_context` expose a versioned public contract for agent consumers.
|
|
4
|
+
|
|
5
|
+
Current version: `1.2`
|
|
6
|
+
|
|
7
|
+
## Stable top-level fields
|
|
8
|
+
|
|
9
|
+
- `context_schema`
|
|
10
|
+
- `digest`
|
|
11
|
+
- `memory_density`
|
|
12
|
+
- `bootstrap_available`
|
|
13
|
+
- `derived_signals`
|
|
14
|
+
- `execution_context`
|
|
15
|
+
- `agent_tooling`
|
|
16
|
+
- `scoped_activity`
|
|
17
|
+
- `context_diff`
|
|
18
|
+
- `selected`
|
|
19
|
+
|
|
20
|
+
## Compatibility policy
|
|
21
|
+
|
|
22
|
+
- Additive changes bump the minor version.
|
|
23
|
+
- Breaking changes bump the major version.
|
|
24
|
+
- Fields listed above are treated as public and stable for agent consumers.
|
|
25
|
+
- Future enrichments should prefer optional fields over reshaping existing ones.
|
|
26
|
+
|
|
27
|
+
## `1.2` additions over `1.1`
|
|
28
|
+
|
|
29
|
+
- `context_diff` is available for session-aware deltas through `brainclaw context --since-session` and `bclaw_get_context`.
|
|
30
|
+
- `context_schema: 1.2` is emitted across JSON, markdown, template, and MCP structured content.
|
|
31
|
+
|
|
32
|
+
## `1.1` additions over `1.0`
|
|
33
|
+
|
|
34
|
+
- `context_schema` is now explicitly surfaced in markdown and template renders.
|
|
35
|
+
- `agent_tooling` includes `agents_rules`.
|
|
36
|
+
- `agent_tooling.skills[]` includes bounded capability markers:
|
|
37
|
+
- `scripts_present`
|
|
38
|
+
- `references_present`
|
|
39
|
+
- `assets_present`
|
|
40
|
+
- `agent_tooling.mcp_servers[]` includes:
|
|
41
|
+
- `availability`
|
|
42
|
+
- `source`
|
|
43
|
+
|
|
44
|
+
## Semantics
|
|
45
|
+
|
|
46
|
+
- `execution_context` and `agent_tooling` are opportunistic and may be omitted when not useful.
|
|
47
|
+
- `derived_signals` are non-canonical bootstrap hints, not accepted project memory.
|
|
48
|
+
- `agent_tooling` inventories local capabilities and constraints; it does not imply project decisions.
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# Agent Integration Principles
|
|
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
|
|
19
|
+
- prompt-ready generated context
|
|
20
|
+
- MCP tools when available
|
|
21
|
+
- board and status views
|
|
22
|
+
- workflow reminders around plans, claims, and handoffs
|
|
23
|
+
|
|
24
|
+
## System instructions vs project instructions
|
|
25
|
+
|
|
26
|
+
Keep these separate.
|
|
27
|
+
|
|
28
|
+
### System instructions
|
|
29
|
+
How the agent should use brainclaw.
|
|
30
|
+
|
|
31
|
+
Examples:
|
|
32
|
+
|
|
33
|
+
- check workspace memory before significant changes
|
|
34
|
+
- bootstrap if the workspace is not initialized and the workflow allows it
|
|
35
|
+
- respect file claims
|
|
36
|
+
- update shared plan status when appropriate
|
|
37
|
+
|
|
38
|
+
### Project instructions
|
|
39
|
+
What is true for the current workspace.
|
|
40
|
+
|
|
41
|
+
Examples:
|
|
42
|
+
|
|
43
|
+
- active constraints
|
|
44
|
+
- recent decisions
|
|
45
|
+
- known traps
|
|
46
|
+
- current handoffs
|
|
47
|
+
- relevant plan context
|
|
48
|
+
|
|
49
|
+
## Setting up agent integration
|
|
50
|
+
|
|
51
|
+
### Automatic detection
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
brainclaw init
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
`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.
|
|
58
|
+
|
|
59
|
+
### Manual per-agent setup
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
brainclaw enable-agent claude-code
|
|
63
|
+
brainclaw enable-agent cursor
|
|
64
|
+
brainclaw enable-agent windsurf
|
|
65
|
+
brainclaw enable-agent opencode
|
|
66
|
+
brainclaw enable-agent antigravity
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Export to a specific format
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
brainclaw export --format claude-md --write
|
|
73
|
+
brainclaw export --format cursor-rules --write
|
|
74
|
+
brainclaw export --format agents-md --write # Codex, OpenCode
|
|
75
|
+
brainclaw export --format gemini-md --write # Antigravity / Gemini CLI
|
|
76
|
+
brainclaw export --format claude-md --write --shared # only if you want the main instruction file versioned
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
`--detect` auto-selects formats based on files found in the workspace:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
brainclaw export --detect --write
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
By default, `--write` treats generated workspace files as local setup and adds them to `.gitignore`. `--shared` only keeps the main exported instruction file versionable; companion MCP/settings files remain local. OpenCode also gets a workspace MCP config in `opencode.json`. Antigravity/Gemini CLI gets a machine-local MCP config in `.gemini/antigravity/mcp_config.json` when `HOME` is available.
|
|
86
|
+
|
|
87
|
+
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.
|
|
88
|
+
|
|
89
|
+
## MCP server workflow
|
|
90
|
+
|
|
91
|
+
The brainclaw MCP server exposes all memory operations as tools that agents can call directly.
|
|
92
|
+
|
|
93
|
+
### Starting the MCP server
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
brainclaw mcp
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Most agents pick this up via their MCP config file (`.mcp.json`, `~/.cursor/mcp.json`, etc.). brainclaw writes these during `init`.
|
|
100
|
+
|
|
101
|
+
### Available MCP tools
|
|
102
|
+
|
|
103
|
+
| Tool | Description |
|
|
104
|
+
|------|-------------|
|
|
105
|
+
| `bclaw_get_context` | Full workspace context (constraints, decisions, traps, plans, handoffs) |
|
|
106
|
+
| `bclaw_get_agent_board` | Live plan + claim board |
|
|
107
|
+
| `bclaw_session_start` | Start an agent session (registers identity) |
|
|
108
|
+
| `bclaw_session_end` | End session, optionally auto-release claims |
|
|
109
|
+
| `bclaw_claim` | Claim a file scope |
|
|
110
|
+
| `bclaw_release_claim` | Release a claim |
|
|
111
|
+
| `bclaw_create_candidate` | Create a plan item |
|
|
112
|
+
| `bclaw_accept` / `bclaw_reject` | Accept or reject a plan candidate |
|
|
113
|
+
| `bclaw_write_note` | Write a runtime note |
|
|
114
|
+
| `bclaw_search` | Search memory entries |
|
|
115
|
+
| `bclaw_read_handoff` | Read a handoff document |
|
|
116
|
+
| `bclaw_bootstrap` | Initialize the workspace if not already done |
|
|
117
|
+
| `bclaw_get_execution_context` | Get execution context (identity, claims, active plans) |
|
|
118
|
+
|
|
119
|
+
## Session lifecycle
|
|
120
|
+
|
|
121
|
+
### Starting a session
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
brainclaw session-start --agent my-agent --model claude-opus-4-5
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
This registers the agent's identity and optionally records the model being used. Other agents can see active sessions in `list-claims` and `board`.
|
|
128
|
+
|
|
129
|
+
### During the session
|
|
130
|
+
|
|
131
|
+
At each significant step:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
brainclaw context --json # load fresh project state
|
|
135
|
+
brainclaw claim list # check for conflicts
|
|
136
|
+
brainclaw claim create "desc" --scope src/feature/
|
|
137
|
+
brainclaw plan create "implement X" --estimate 60
|
|
138
|
+
brainclaw plan update <id> --status in_progress
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Ending the session
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
brainclaw session-end --auto-release
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
This releases all active claims held by the current agent and updates plan statuses.
|
|
148
|
+
|
|
149
|
+
## Generated files are local-only
|
|
150
|
+
|
|
151
|
+
Agent config files generated by brainclaw — `CLAUDE.md`, `AGENTS.md`, `GEMINI.md`, `.cursor/rules/brainclaw.md`, `.windsurfrules`, `.github/copilot-instructions.md` — are **not committed to Git**.
|
|
152
|
+
|
|
153
|
+
Each developer regenerates them locally from their own `.brainclaw/` store:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
brainclaw export --detect --write
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
This ensures:
|
|
160
|
+
- no private project notes leak into the shared repo
|
|
161
|
+
- each developer's local agent sees the right instructions for their setup
|
|
162
|
+
- instructions stay in sync with the current brainclaw store, not a stale committed version
|
|
163
|
+
|
|
164
|
+
brainclaw adds all generated files to `.gitignore` automatically during `init`.
|
|
165
|
+
|
|
166
|
+
## Goal
|
|
167
|
+
|
|
168
|
+
The goal is not perfect enforcement.
|
|
169
|
+
The goal is to make brainclaw the natural path for fresh workspace context and coordination.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Claude Code Integration
|
|
2
|
+
|
|
3
|
+
brainclaw is a good fit for Claude Code because Claude Code can work with files, instructions, MCP, and hook-like workflow mechanisms.
|
|
4
|
+
|
|
5
|
+
## Auto-setup
|
|
6
|
+
|
|
7
|
+
`brainclaw init` detects Claude Code (`CLAUDE_CODE_VERSION`) and writes `CLAUDE.md` automatically. Or manually:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
brainclaw export --format claude-md --write
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Recommended approach
|
|
14
|
+
|
|
15
|
+
- add lightweight usage instructions for brainclaw in `CLAUDE.md`
|
|
16
|
+
- use `.brainclaw/project.md` as a readable baseline
|
|
17
|
+
- prefer MCP for dynamic retrieval when available
|
|
18
|
+
- use hooks or workflow checks when a stronger reminder is needed
|
|
19
|
+
|
|
20
|
+
## Key idea
|
|
21
|
+
|
|
22
|
+
Claude Code should not carry all workspace state in static instructions.
|
|
23
|
+
brainclaw provides the living workspace layer.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Codex Integration
|
|
2
|
+
|
|
3
|
+
brainclaw fits well with Codex-style workflows because Codex can work with project instructions, files, skills, and MCP.
|
|
4
|
+
|
|
5
|
+
## Auto-setup
|
|
6
|
+
|
|
7
|
+
`brainclaw init` detects Codex (`~/.codex/` directory) and writes `AGENTS.md` automatically. Or manually:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
brainclaw export --format agents-md --write
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Recommended approach
|
|
14
|
+
|
|
15
|
+
- keep a lightweight instruction telling Codex to consult brainclaw
|
|
16
|
+
- let Codex read `.brainclaw/project.md` when simple file context is enough
|
|
17
|
+
- use MCP for fresher scoped context when available
|
|
18
|
+
- encourage use of plans, claims, and handoffs during multi-step work
|
|
19
|
+
|
|
20
|
+
## Good role for brainclaw here
|
|
21
|
+
|
|
22
|
+
Codex stays the coding agent.
|
|
23
|
+
brainclaw provides the shared workspace context and coordination layer.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# GitHub Copilot Integration
|
|
2
|
+
|
|
3
|
+
brainclaw complements Copilot by making shared project context explicit and local.
|
|
4
|
+
|
|
5
|
+
## Auto-setup
|
|
6
|
+
|
|
7
|
+
`brainclaw init` detects Copilot and writes `.github/copilot-instructions.md` automatically. Or manually:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
brainclaw export --format copilot-instructions --write
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Recommended approach
|
|
14
|
+
|
|
15
|
+
- point Copilot to `.brainclaw/project.md` or use fresh context retrieval
|
|
16
|
+
- use plans, claims, and handoffs to reduce ambiguity across sessions
|
|
17
|
+
- use MCP where supported for dynamic collaboration views
|
|
18
|
+
|
|
19
|
+
## Why this matters
|
|
20
|
+
|
|
21
|
+
Copilot benefits from explicit project memory and shared coordination state instead of relying only on implicit memory features.
|