brainclaw 0.19.7 → 0.19.11
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 +225 -126
- package/dist/cli.js +9 -3
- package/dist/commands/bootstrap.js +88 -3
- package/dist/commands/init.js +21 -0
- package/dist/commands/mcp.js +76 -3
- package/dist/core/bootstrap.js +945 -6
- package/dist/core/migration.js +6 -2
- package/dist/core/schema.js +97 -0
- package/docs/cli.md +26 -1
- package/docs/integrations/agents.md +42 -29
- package/docs/integrations/claude-code.md +4 -4
- package/docs/integrations/codex.md +5 -5
- package/docs/integrations/copilot.md +3 -2
- package/docs/integrations/cursor.md +4 -4
- package/docs/integrations/mcp.md +70 -24
- package/docs/integrations/overview.md +53 -40
- package/docs/mcp-schema-changelog.md +9 -0
- package/docs/product/positioning.md +17 -18
- package/docs/quickstart.md +102 -52
- package/package.json +7 -7
package/dist/core/migration.js
CHANGED
|
@@ -2,7 +2,7 @@ import fs from 'node:fs';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import YAML from 'yaml';
|
|
4
4
|
import { memoryDir, memoryPath, readFileSync, writeFileAtomic, resolveEntityDir } from './io.js';
|
|
5
|
-
import { AgentIdentityDocumentSchema, BootstrapProfileDocumentSchema, CandidateSchema, ClaimSchema, ConfigSchema, MemorySeedDocumentSchema, ConstraintSchema, CurrentSessionStateSchema, DecisionSchema, HandoffSchema, InstructionEntrySchema, PlanItemSchema, ProjectIdentityDocumentSchema, RuntimeNoteSchema, SessionSnapshotSchema, TrapSchema, } from './schema.js';
|
|
5
|
+
import { BootstrapApplicationReceiptSchema, BootstrapImportPlanDocumentSchema, AgentIdentityDocumentSchema, BootstrapProfileDocumentSchema, CandidateSchema, ClaimSchema, ConfigSchema, MemorySeedDocumentSchema, ConstraintSchema, CurrentSessionStateSchema, DecisionSchema, HandoffSchema, InstructionEntrySchema, PlanItemSchema, ProjectIdentityDocumentSchema, RuntimeNoteSchema, SessionSnapshotSchema, TrapSchema, } from './schema.js';
|
|
6
6
|
export class MigrationError extends Error {
|
|
7
7
|
kind;
|
|
8
8
|
documentType;
|
|
@@ -16,6 +16,8 @@ export class MigrationError extends Error {
|
|
|
16
16
|
const CURRENT_SCHEMA_VERSION = 2;
|
|
17
17
|
const registry = {
|
|
18
18
|
agent_identity: createRegistryEntry(AgentIdentityDocumentSchema),
|
|
19
|
+
bootstrap_application: createRegistryEntry(BootstrapApplicationReceiptSchema),
|
|
20
|
+
bootstrap_import_plan: createRegistryEntry(BootstrapImportPlanDocumentSchema),
|
|
19
21
|
bootstrap_profile: createRegistryEntry(BootstrapProfileDocumentSchema),
|
|
20
22
|
candidate: createRegistryEntry(CandidateSchema),
|
|
21
23
|
claim: createRegistryEntry(ClaimSchema),
|
|
@@ -145,6 +147,8 @@ export function scanMigrationStatus(cwd) {
|
|
|
145
147
|
collectSingle(entries, memoryPath('project.identity.json', cwd), 'project_identity');
|
|
146
148
|
collectSingle(entries, memoryPath('.current-session', cwd), 'current_session');
|
|
147
149
|
collectSingle(entries, memoryPath(path.join('bootstrap', 'profile.json'), cwd), 'bootstrap_profile');
|
|
150
|
+
collectSingle(entries, memoryPath(path.join('bootstrap', 'import-plan.json'), cwd), 'bootstrap_import_plan');
|
|
151
|
+
collectSingle(entries, memoryPath(path.join('bootstrap', 'last-application.json'), cwd), 'bootstrap_application');
|
|
148
152
|
const effectiveCwd = cwd ?? process.cwd();
|
|
149
153
|
collectDirectory(entries, resolveEntityDir('constraints', effectiveCwd, 'read'), 'constraint');
|
|
150
154
|
collectDirectory(entries, resolveEntityDir('decisions', effectiveCwd, 'read'), 'decision');
|
|
@@ -161,7 +165,7 @@ export function scanMigrationStatus(cwd) {
|
|
|
161
165
|
collectDirectory(entries, resolveEntityDir('runtime-hosts', effectiveCwd, 'read'), 'runtime_note', true);
|
|
162
166
|
collectDirectory(entries, resolveEntityDir('runtime-private', effectiveCwd, 'read'), 'runtime_note', true);
|
|
163
167
|
collectDirectory(entries, resolveEntityDir('instructions', effectiveCwd, 'read'), 'instruction');
|
|
164
|
-
collectDirectory(entries, resolveEntityDir('bootstrap', effectiveCwd, 'read'), 'memory_seed');
|
|
168
|
+
collectDirectory(entries, path.join(resolveEntityDir('bootstrap', effectiveCwd, 'read'), 'seeds'), 'memory_seed');
|
|
165
169
|
collectDirectory(entries, resolveEntityDir('agents', effectiveCwd, 'read'), 'agent_identity');
|
|
166
170
|
collectDirectory(entries, resolveEntityDir('sessions', effectiveCwd, 'read'), 'session_snapshot');
|
|
167
171
|
return entries.sort((a, b) => a.path.localeCompare(b.path));
|
package/dist/core/schema.js
CHANGED
|
@@ -451,6 +451,7 @@ export const MemorySeedKindSchema = z.enum([
|
|
|
451
451
|
export const MemorySeedSourceKindSchema = z.enum([
|
|
452
452
|
'readme',
|
|
453
453
|
'agents_md',
|
|
454
|
+
'native_instruction',
|
|
454
455
|
'manifest',
|
|
455
456
|
'repo_analysis',
|
|
456
457
|
'git',
|
|
@@ -483,6 +484,102 @@ export const BootstrapProfileDocumentSchema = z.object({
|
|
|
483
484
|
agents_md_present: z.boolean().default(false),
|
|
484
485
|
seed_count: z.number().int().nonnegative(),
|
|
485
486
|
target: z.string().optional(),
|
|
487
|
+
workspace_kind: z.enum(['empty', 'existing']).optional(),
|
|
488
|
+
onboarding_mode: z.enum(['empty_workspace', 'existing_documented', 'existing_sparse']).optional(),
|
|
489
|
+
confidence: MemorySeedConfidenceSchema.optional(),
|
|
490
|
+
native_instruction_files: z.array(z.string()).default([]),
|
|
491
|
+
gaps: z.array(z.string()).default([]),
|
|
492
|
+
});
|
|
493
|
+
export const BootstrapSuggestionTargetSchema = z.enum(['instruction', 'decision', 'constraint', 'trap']);
|
|
494
|
+
export const BootstrapSuggestionDocumentSchema = z.object({
|
|
495
|
+
schema_version: z.number().int().positive().optional(),
|
|
496
|
+
id: z.string(),
|
|
497
|
+
target: BootstrapSuggestionTargetSchema,
|
|
498
|
+
text: z.string(),
|
|
499
|
+
rationale: z.string(),
|
|
500
|
+
confidence: MemorySeedConfidenceSchema,
|
|
501
|
+
source_seed_ids: z.array(z.string()).default([]),
|
|
502
|
+
source_refs: z.array(z.string()).default([]),
|
|
503
|
+
layer: z.enum(['global', 'project', 'agent']).optional(),
|
|
504
|
+
scope: z.string().optional(),
|
|
505
|
+
tags: z.array(z.string()).default([]),
|
|
506
|
+
related_paths: z.array(z.string()).optional(),
|
|
507
|
+
category: ConstraintCategorySchema.optional(),
|
|
508
|
+
outcome: DecisionOutcomeSchema.optional(),
|
|
509
|
+
severity: SeveritySchema.optional(),
|
|
510
|
+
reversible: z.boolean().default(true),
|
|
511
|
+
});
|
|
512
|
+
export const BootstrapInterviewAudienceSchema = z.enum(['cli', 'ide_chat', 'any']);
|
|
513
|
+
export const BootstrapInterviewQuestionSchema = z.object({
|
|
514
|
+
id: z.string(),
|
|
515
|
+
prompt: z.string(),
|
|
516
|
+
rationale: z.string(),
|
|
517
|
+
priority: z.enum(['high', 'medium', 'low']),
|
|
518
|
+
audience: BootstrapInterviewAudienceSchema.default('any'),
|
|
519
|
+
response_kind: z.enum(['short_text', 'long_text', 'boolean', 'list']).default('short_text'),
|
|
520
|
+
gap_keys: z.array(z.string()).default([]),
|
|
521
|
+
target_hints: z.array(BootstrapSuggestionTargetSchema).default([]),
|
|
522
|
+
});
|
|
523
|
+
export const BootstrapInterviewPlanSchema = z.object({
|
|
524
|
+
schema_version: z.number().int().positive().optional(),
|
|
525
|
+
derived_at: z.string(),
|
|
526
|
+
workspace_kind: z.enum(['empty', 'existing']).optional(),
|
|
527
|
+
audience: BootstrapInterviewAudienceSchema.default('any'),
|
|
528
|
+
summary: z.string(),
|
|
529
|
+
question_count: z.number().int().nonnegative(),
|
|
530
|
+
questions: z.array(BootstrapInterviewQuestionSchema).default([]),
|
|
531
|
+
});
|
|
532
|
+
export const BootstrapInterviewAnswerSuggestionSchema = z.object({
|
|
533
|
+
target: BootstrapSuggestionTargetSchema,
|
|
534
|
+
text: z.string(),
|
|
535
|
+
rationale: z.string().optional(),
|
|
536
|
+
confidence: MemorySeedConfidenceSchema.optional(),
|
|
537
|
+
layer: z.enum(['global', 'project', 'agent']).optional(),
|
|
538
|
+
scope: z.string().optional(),
|
|
539
|
+
tags: z.array(z.string()).default([]),
|
|
540
|
+
related_paths: z.array(z.string()).optional(),
|
|
541
|
+
category: ConstraintCategorySchema.optional(),
|
|
542
|
+
outcome: DecisionOutcomeSchema.optional(),
|
|
543
|
+
severity: SeveritySchema.optional(),
|
|
544
|
+
});
|
|
545
|
+
export const BootstrapInterviewAnswerSchema = z.object({
|
|
546
|
+
question_id: z.string(),
|
|
547
|
+
response_text: z.string().optional(),
|
|
548
|
+
response_items: z.array(z.string()).default([]),
|
|
549
|
+
response_boolean: z.boolean().optional(),
|
|
550
|
+
suggestions: z.array(BootstrapInterviewAnswerSuggestionSchema).default([]),
|
|
551
|
+
});
|
|
552
|
+
export const BootstrapImportPlanDocumentSchema = z.object({
|
|
553
|
+
schema_version: z.number().int().positive().optional(),
|
|
554
|
+
derived_at: z.string(),
|
|
555
|
+
target: z.string().optional(),
|
|
556
|
+
workspace_kind: z.enum(['empty', 'existing']).optional(),
|
|
557
|
+
onboarding_mode: z.enum(['empty_workspace', 'existing_documented', 'existing_sparse']).optional(),
|
|
558
|
+
confidence: MemorySeedConfidenceSchema.optional(),
|
|
559
|
+
summary: z.string(),
|
|
560
|
+
requires_confirmation: z.boolean().default(true),
|
|
561
|
+
gaps: z.array(z.string()).default([]),
|
|
562
|
+
confirmed_suggestion_count: z.number().int().nonnegative().default(0),
|
|
563
|
+
interview_answer_count: z.number().int().nonnegative().default(0),
|
|
564
|
+
suggestion_count: z.number().int().nonnegative(),
|
|
565
|
+
suggestions: z.array(BootstrapSuggestionDocumentSchema).default([]),
|
|
566
|
+
interview: BootstrapInterviewPlanSchema.optional(),
|
|
567
|
+
});
|
|
568
|
+
export const BootstrapManagedArtifactSchema = z.object({
|
|
569
|
+
kind: z.enum(['instruction', 'decision', 'constraint', 'trap']),
|
|
570
|
+
id: z.string(),
|
|
571
|
+
suggestion_id: z.string(),
|
|
572
|
+
rollback_action: z.enum(['deactivate', 'delete']).default('delete'),
|
|
573
|
+
});
|
|
574
|
+
export const BootstrapApplicationReceiptSchema = z.object({
|
|
575
|
+
schema_version: z.number().int().positive().optional(),
|
|
576
|
+
applied_at: z.string(),
|
|
577
|
+
proposal_derived_at: z.string(),
|
|
578
|
+
target: z.string().optional(),
|
|
579
|
+
workspace_kind: z.enum(['empty', 'existing']).optional(),
|
|
580
|
+
managed_artifacts: z.array(BootstrapManagedArtifactSchema).default([]),
|
|
581
|
+
suggestion_ids: z.array(z.string()).default([]),
|
|
582
|
+
uninstalled_at: z.string().optional(),
|
|
486
583
|
});
|
|
487
584
|
export const AgentIntegrationNameSchema = z.enum([
|
|
488
585
|
'github-copilot',
|
package/docs/cli.md
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
# CLI Reference
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The CLI is Brainclaw's explicit operator, scripting, release, and fallback surface. All commands are available as `brainclaw` or its alias `bclaw`.
|
|
4
|
+
|
|
5
|
+
For capable coding agents, prefer MCP for dynamic runtime state:
|
|
6
|
+
|
|
7
|
+
- `bclaw_bootstrap` instead of manual bootstrap polling
|
|
8
|
+
- `bclaw_get_context` instead of repeated raw CLI context calls
|
|
9
|
+
- `bclaw_list_plans` / `bclaw_list_claims` / `bclaw_get_agent_board` for live coordination views
|
|
10
|
+
- `bclaw_claim`, `bclaw_write_note`, and `bclaw_session_end` for session continuity
|
|
11
|
+
|
|
12
|
+
Use the CLI when a human operator is driving the workflow, when you are scripting setup or release operations, or when MCP is not the integration path.
|
|
4
13
|
|
|
5
14
|
---
|
|
6
15
|
|
|
@@ -97,17 +106,31 @@ brainclaw rebuild
|
|
|
97
106
|
|
|
98
107
|
Bootstrap shared memory for a new agent or project context.
|
|
99
108
|
|
|
109
|
+
For capable agents, the MCP equivalent is `bclaw_bootstrap`. Use the CLI when a human is driving onboarding, reviewing the import proposal, or operating in fallback mode.
|
|
110
|
+
|
|
100
111
|
| Option | Description |
|
|
101
112
|
|---|---|
|
|
102
113
|
| `--for <agent>` | Target agent name |
|
|
103
114
|
| `--json` | Output as JSON |
|
|
104
115
|
| `--refresh` | Force refresh even if bootstrap data is recent |
|
|
116
|
+
| `--interview` | Render adaptive interview prompts instead of the bootstrap summary |
|
|
117
|
+
| `--audience <audience>` | Filter interview prompts for `cli`, `ide_chat`, or `any` |
|
|
118
|
+
| `--answers-file <path>` | Load structured interview answers from JSON and enrich the import proposal before preview/apply |
|
|
119
|
+
| `--apply` | Import the current bootstrap proposal into canonical memory |
|
|
120
|
+
| `--uninstall` | Deactivate the last bootstrap-managed import |
|
|
121
|
+
| `-y, --yes` | Skip confirmation prompts for apply/uninstall |
|
|
105
122
|
|
|
106
123
|
```bash
|
|
107
124
|
brainclaw bootstrap --for copilot
|
|
108
125
|
brainclaw bootstrap --for claude --refresh --json
|
|
126
|
+
brainclaw bootstrap --interview --audience cli
|
|
127
|
+
brainclaw bootstrap --answers-file ./bootstrap-answers.json --json
|
|
128
|
+
brainclaw bootstrap --answers-file ./bootstrap-answers.json --apply -y
|
|
129
|
+
brainclaw bootstrap --apply -y
|
|
109
130
|
```
|
|
110
131
|
|
|
132
|
+
`--answers-file` expects a JSON array keyed by interview question IDs. Each entry can provide free-form answers (`response_text`, `response_items`, `response_boolean`) and optional explicit `suggestions` to confirm durable imports such as `decision`, `constraint`, `instruction`, or `trap`.
|
|
133
|
+
|
|
111
134
|
### `brainclaw env`
|
|
112
135
|
|
|
113
136
|
Display environment and tooling detection information.
|
|
@@ -574,6 +597,8 @@ brainclaw search "rollout" --since 2026-01-01 --json
|
|
|
574
597
|
|
|
575
598
|
## Planning and Coordination
|
|
576
599
|
|
|
600
|
+
For capable agents, prefer the MCP plan and claim tools for live runtime interactions. The CLI remains the operator and scripting form of the same coordination model.
|
|
601
|
+
|
|
577
602
|
### `brainclaw plan create <text>`
|
|
578
603
|
|
|
579
604
|
Create a shared work item.
|
|
@@ -10,30 +10,43 @@ That means brainclaw integration should not rely on only one mechanism such as:
|
|
|
10
10
|
- a single skill
|
|
11
11
|
- a single startup command
|
|
12
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
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
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.
|
|
23
35
|
|
|
24
36
|
## System instructions vs project instructions
|
|
25
37
|
|
|
26
38
|
Keep these separate.
|
|
27
39
|
|
|
28
|
-
### System instructions
|
|
29
|
-
How the agent should use brainclaw.
|
|
40
|
+
### System instructions
|
|
41
|
+
How the agent should use brainclaw.
|
|
30
42
|
|
|
31
43
|
Examples:
|
|
32
44
|
|
|
33
|
-
- check workspace memory before significant changes
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
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
|
|
37
50
|
|
|
38
51
|
### Project instructions
|
|
39
52
|
What is true for the current workspace.
|
|
@@ -86,9 +99,9 @@ By default, `--write` treats generated workspace files as local setup and adds t
|
|
|
86
99
|
|
|
87
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.
|
|
88
101
|
|
|
89
|
-
## MCP server workflow
|
|
90
|
-
|
|
91
|
-
The brainclaw MCP server exposes
|
|
102
|
+
## MCP server workflow
|
|
103
|
+
|
|
104
|
+
The brainclaw MCP server exposes the dynamic Brainclaw workflow directly. For capable agents, this is the nominal runtime path.
|
|
92
105
|
|
|
93
106
|
### Starting the MCP server
|
|
94
107
|
|
|
@@ -116,19 +129,19 @@ Most agents pick this up via their MCP config file (`.mcp.json`, `~/.cursor/mcp.
|
|
|
116
129
|
| `bclaw_bootstrap` | Initialize the workspace if not already done |
|
|
117
130
|
| `bclaw_get_execution_context` | Get execution context (identity, claims, active plans) |
|
|
118
131
|
|
|
119
|
-
## Session lifecycle
|
|
120
|
-
|
|
121
|
-
### Starting a session
|
|
122
|
-
|
|
123
|
-
```bash
|
|
124
|
-
brainclaw session-start --agent my-agent --model claude-opus-4-5
|
|
132
|
+
## Session lifecycle
|
|
133
|
+
|
|
134
|
+
### Starting a session
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
brainclaw session-start --agent my-agent --model claude-opus-4-5
|
|
125
138
|
```
|
|
126
139
|
|
|
127
140
|
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
141
|
|
|
129
|
-
### During the session
|
|
130
|
-
|
|
131
|
-
|
|
142
|
+
### During the session
|
|
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.
|
|
132
145
|
|
|
133
146
|
```bash
|
|
134
147
|
brainclaw context --json # load fresh project state
|
|
@@ -146,7 +159,7 @@ brainclaw session-end --auto-release
|
|
|
146
159
|
|
|
147
160
|
This releases all active claims held by the current agent and updates plan statuses.
|
|
148
161
|
|
|
149
|
-
## Generated files are local-only
|
|
162
|
+
## Generated files are local-only
|
|
150
163
|
|
|
151
164
|
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
165
|
|
|
@@ -12,12 +12,12 @@ brainclaw export --format claude-md --write
|
|
|
12
12
|
|
|
13
13
|
## Recommended approach
|
|
14
14
|
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
15
|
+
- use MCP as the default runtime path for dynamic retrieval and writes
|
|
16
|
+
- keep `CLAUDE.md` lightweight and behavioral: it should tell Claude Code when to call Brainclaw, not carry all mutable workspace state
|
|
17
|
+
- use `.brainclaw/project.md` as a readable fallback baseline, not as the primary live source of truth
|
|
18
18
|
- use hooks or workflow checks when a stronger reminder is needed
|
|
19
19
|
|
|
20
20
|
## Key idea
|
|
21
21
|
|
|
22
22
|
Claude Code should not carry all workspace state in static instructions.
|
|
23
|
-
brainclaw provides the living workspace layer.
|
|
23
|
+
brainclaw provides the living workspace layer through MCP plus local workflow guidance.
|
|
@@ -12,12 +12,12 @@ brainclaw export --format agents-md --write
|
|
|
12
12
|
|
|
13
13
|
## Recommended approach
|
|
14
14
|
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
- use
|
|
18
|
-
- encourage
|
|
15
|
+
- use MCP as the default runtime path for fresh context, plans, claims, and runtime notes
|
|
16
|
+
- keep `AGENTS.md` lightweight and behavioral: it should remind Codex how to use Brainclaw, not duplicate live state
|
|
17
|
+
- use `.brainclaw/project.md` only as a readable fallback when MCP is unavailable or when a human wants a simple snapshot
|
|
18
|
+
- encourage plans, claims, and handoffs during multi-step work
|
|
19
19
|
|
|
20
20
|
## Good role for brainclaw here
|
|
21
21
|
|
|
22
22
|
Codex stays the coding agent.
|
|
23
|
-
brainclaw provides the
|
|
23
|
+
brainclaw provides the live workspace context and coordination layer.
|
|
@@ -12,9 +12,10 @@ brainclaw export --format copilot-instructions --write
|
|
|
12
12
|
|
|
13
13
|
## Recommended approach
|
|
14
14
|
|
|
15
|
-
-
|
|
15
|
+
- use MCP whenever the Copilot surface supports it for fresh context and coordination views
|
|
16
|
+
- keep `.github/copilot-instructions.md` lightweight and behavioral
|
|
17
|
+
- use `.brainclaw/project.md` as readable fallback, not as the only live context source
|
|
16
18
|
- use plans, claims, and handoffs to reduce ambiguity across sessions
|
|
17
|
-
- use MCP where supported for dynamic collaboration views
|
|
18
19
|
|
|
19
20
|
## Why this matters
|
|
20
21
|
|
|
@@ -12,12 +12,12 @@ brainclaw export --format cursor-rules --write
|
|
|
12
12
|
|
|
13
13
|
## Recommended approach
|
|
14
14
|
|
|
15
|
-
- the
|
|
16
|
-
-
|
|
17
|
-
- use
|
|
15
|
+
- use MCP as the default dynamic path for context, board state, plans, and claims
|
|
16
|
+
- let the generated `.cursor/rules/brainclaw.md` tell Cursor when to consult Brainclaw and how to stay inside the workflow
|
|
17
|
+
- use `.brainclaw/project.md` only as readable fallback shared state
|
|
18
18
|
- rely on claims and plans when multiple agents or humans are active in the same repo
|
|
19
19
|
|
|
20
20
|
## Key point
|
|
21
21
|
|
|
22
22
|
Cursor rules describe behavior.
|
|
23
|
-
brainclaw provides the living shared state those rules should point to.
|
|
23
|
+
brainclaw provides the living shared state those rules should point to through MCP.
|
package/docs/integrations/mcp.md
CHANGED
|
@@ -1,24 +1,40 @@
|
|
|
1
1
|
# MCP Integration
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
MCP is the primary Brainclaw integration path for capable coding agents.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Use it whenever the agent can retrieve or mutate shared state directly instead of relying only on static files.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Why MCP Is The Nominal Path
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
MCP matters because Brainclaw's value is mostly in dynamic state:
|
|
10
10
|
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
11
|
+
- fresh context for the exact path being edited
|
|
12
|
+
- current board state
|
|
13
|
+
- active plans and claims
|
|
14
|
+
- runtime observations
|
|
15
|
+
- handoffs and review queues
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
Static files still help, but they age immediately. MCP is the stronger path for live coordination.
|
|
18
|
+
|
|
19
|
+
## Recommended Agent Pattern
|
|
20
|
+
|
|
21
|
+
The default dynamic workflow is:
|
|
22
|
+
|
|
23
|
+
1. `bclaw_session_start` to open work and get the current board/context
|
|
24
|
+
2. `bclaw_get_context` when the target path or task changes
|
|
25
|
+
3. `bclaw_list_plans` and `bclaw_list_claims` to inspect active work
|
|
26
|
+
4. `bclaw_claim` before editing
|
|
27
|
+
5. `bclaw_write_note` for runtime observations
|
|
28
|
+
6. `bclaw_session_end` to close cleanly and hand work off
|
|
29
|
+
|
|
30
|
+
This keeps session continuity inside Brainclaw instead of pushing the agent back to manual CLI usage.
|
|
31
|
+
|
|
32
|
+
## Available Tools
|
|
17
33
|
|
|
18
34
|
| Tool | Purpose |
|
|
19
35
|
|---|---|
|
|
20
36
|
| `bclaw_get_context` | Ranked prompt-ready context, supports `digest: true` |
|
|
21
|
-
| `bclaw_bootstrap` | Derive brownfield bootstrap signals
|
|
37
|
+
| `bclaw_bootstrap` | Derive brownfield bootstrap signals, return adaptive interview prompts, accept structured interview answers, and preview/apply a selective import proposal |
|
|
22
38
|
| `bclaw_get_execution_context` | Inspect local execution context and agent tooling |
|
|
23
39
|
| `bclaw_write_note` | Record a runtime note, supports `autoReflect: true` |
|
|
24
40
|
| `bclaw_read_handoff` | Read active handoffs |
|
|
@@ -30,22 +46,52 @@ That is valuable for:
|
|
|
30
46
|
| `bclaw_list_candidates` | Pending or archived review queue listing |
|
|
31
47
|
| `bclaw_search` | Full-text search across memory |
|
|
32
48
|
|
|
33
|
-
##
|
|
49
|
+
## When To Use MCP Versus Other Surfaces
|
|
50
|
+
|
|
51
|
+
| Need | Best surface |
|
|
52
|
+
|---|---|
|
|
53
|
+
| Fresh path-scoped context | MCP |
|
|
54
|
+
| Current plans, claims, board state | MCP |
|
|
55
|
+
| Runtime writes with session continuity | MCP |
|
|
56
|
+
| Local behavioral reminders inside the agent UI | native agent files |
|
|
57
|
+
| Human inspection or scripting | CLI |
|
|
58
|
+
| Simple readable fallback | `.brainclaw/project.md` |
|
|
34
59
|
|
|
35
|
-
|
|
60
|
+
## Starting The Server
|
|
36
61
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
- shared board state
|
|
41
|
-
- write operations that should preserve session continuity
|
|
62
|
+
```bash
|
|
63
|
+
brainclaw mcp
|
|
64
|
+
```
|
|
42
65
|
|
|
43
|
-
|
|
66
|
+
In practice, most agents pick this up through generated MCP config such as `.mcp.json`, `~/.cursor/mcp.json`, or other agent-specific config files written by `brainclaw setup`, `brainclaw init`, or `brainclaw export`.
|
|
44
67
|
|
|
45
|
-
##
|
|
68
|
+
## Bootstrap Through MCP
|
|
46
69
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
70
|
+
For agent-first onboarding, `bclaw_bootstrap` is the nominal path:
|
|
71
|
+
|
|
72
|
+
1. call `bclaw_bootstrap` to get the current `import_plan` and adaptive interview questions
|
|
73
|
+
2. collect answers in the agent surface
|
|
74
|
+
3. call `bclaw_bootstrap` again with `interviewAnswers` to preview confirmed `decision`, `constraint`, `instruction`, or `trap` suggestions
|
|
75
|
+
4. call `bclaw_bootstrap` with `apply: true` to create canonical memory
|
|
76
|
+
5. call `bclaw_bootstrap` with `uninstall: true` to revert the last bootstrap-managed import
|
|
77
|
+
|
|
78
|
+
Interview answers are keyed by question ID and may contain:
|
|
79
|
+
|
|
80
|
+
- `response_text`
|
|
81
|
+
- `response_items`
|
|
82
|
+
- `response_boolean`
|
|
83
|
+
- optional explicit `suggestions` when the agent wants to confirm exact canonical memory items
|
|
84
|
+
|
|
85
|
+
## Important Rule
|
|
86
|
+
|
|
87
|
+
If the agent has MCP available, do not treat the CLI as the primary runtime interface.
|
|
88
|
+
|
|
89
|
+
The CLI remains valuable for:
|
|
90
|
+
|
|
91
|
+
- setup
|
|
92
|
+
- bootstrap by a human operator
|
|
93
|
+
- scripting
|
|
94
|
+
- release and packaging
|
|
95
|
+
- debugging and fallback access
|
|
96
|
+
|
|
97
|
+
But for capable agents, MCP should be the first-class path for dynamic state.
|
|
@@ -1,61 +1,74 @@
|
|
|
1
1
|
# Integration Overview
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
##
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
3
|
+
Brainclaw is designed to work with existing coding agents, not replace them.
|
|
4
|
+
|
|
5
|
+
The key integration rule is simple:
|
|
6
|
+
|
|
7
|
+
1. use MCP for dynamic shared state when the agent supports it
|
|
8
|
+
2. use native agent files for local behavioral guidance
|
|
9
|
+
3. use the CLI for setup, operator workflows, scripting, and fallback access
|
|
10
|
+
|
|
11
|
+
## Current Limitation
|
|
12
|
+
|
|
13
|
+
For now, Brainclaw should be used for sequential multi-agent collaboration, not true parallel editing in the same checkout.
|
|
14
|
+
|
|
15
|
+
One agent can hand work to another, and the next agent can recover good project context through shared memory, plans, claims, and handoffs. But without dedicated Git worktrees per agent/session, running several coding agents concurrently on the same project checkout is still risky and can create conflicts or unstable local state.
|
|
16
|
+
|
|
17
|
+
## Integration Surfaces
|
|
18
|
+
|
|
19
|
+
brainclaw can integrate through several surfaces, but they do not have the same role.
|
|
20
|
+
|
|
21
|
+
| Surface | Role |
|
|
22
|
+
|---|---|
|
|
23
|
+
| **MCP tools** | primary dynamic access path for context, plans, claims, board views, and runtime writes |
|
|
24
|
+
| **Native agent files** | local guidance in the agent's own surface: `CLAUDE.md`, `AGENTS.md`, `GEMINI.md`, `.cursor/rules/brainclaw.md`, `.windsurfrules`, etc. |
|
|
25
|
+
| **Readable files** | fallback readable state such as `.brainclaw/project.md` |
|
|
26
|
+
| **CLI commands** | setup, scripting, release, inspection, and fallback workflows |
|
|
27
|
+
| **System/project instructions** | static reminders about how Brainclaw should be used in this workspace |
|
|
28
|
+
|
|
29
|
+
## Recommended Pattern
|
|
22
30
|
|
|
23
31
|
A good default pattern is:
|
|
24
32
|
|
|
25
|
-
1.
|
|
26
|
-
2. retrieve fresh workspace
|
|
27
|
-
3.
|
|
28
|
-
4.
|
|
33
|
+
1. give the agent lightweight static instructions about how to use Brainclaw
|
|
34
|
+
2. let it retrieve fresh workspace state through MCP before significant edits
|
|
35
|
+
3. rely on plans, claims, and handoffs during execution
|
|
36
|
+
4. keep native files and readable project state available as fallback context
|
|
37
|
+
5. use hooks or repeated reminders where the host surface supports them
|
|
38
|
+
|
|
39
|
+
## Native Files Are Support, Not The Live Source Of Truth
|
|
29
40
|
|
|
30
|
-
|
|
41
|
+
Generated files such as `CLAUDE.md` or `.cursor/rules/brainclaw.md` are useful because they keep Brainclaw visible inside the agent surface already in use.
|
|
31
42
|
|
|
32
|
-
|
|
43
|
+
They are not meant to replace:
|
|
33
44
|
|
|
34
|
-
|
|
35
|
-
|
|
45
|
+
- fresh context retrieval
|
|
46
|
+
- live board state
|
|
47
|
+
- current claims
|
|
48
|
+
- recent runtime notes
|
|
49
|
+
- current handoffs
|
|
36
50
|
|
|
37
|
-
|
|
38
|
-
- readable workspace state (file)
|
|
39
|
-
- MCP or CLI access (dynamic)
|
|
40
|
-
- repeated reminders in the workflow
|
|
41
|
-
- optional hooks where supported
|
|
51
|
+
For those, use MCP when available.
|
|
42
52
|
|
|
43
|
-
## Getting
|
|
53
|
+
## Getting The Native File Written Automatically
|
|
54
|
+
|
|
55
|
+
Run `brainclaw init` and Brainclaw will detect the current agent surface and write the appropriate local file automatically.
|
|
44
56
|
|
|
45
|
-
Run `brainclaw init` — it detects the running agent and writes to its native file automatically.
|
|
46
57
|
That includes OpenCode (`AGENTS.md` + `opencode.json`) and Antigravity/Gemini CLI (`GEMINI.md` + machine-local MCP config) when those environments are present.
|
|
47
58
|
|
|
48
59
|
Or at any time:
|
|
49
60
|
|
|
50
61
|
```bash
|
|
51
|
-
brainclaw export --detect
|
|
62
|
+
brainclaw export --detect --write
|
|
52
63
|
```
|
|
53
64
|
|
|
54
|
-
|
|
65
|
+
By default, generated workspace files are treated as local setup and added to `.gitignore`. `--shared` should only be used when you intentionally want the main exported instruction file to be versioned.
|
|
55
66
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
- [
|
|
59
|
-
- [
|
|
67
|
+
## Choose Your Next Page
|
|
68
|
+
|
|
69
|
+
- [mcp.md](mcp.md) — the nominal path for capable agents
|
|
70
|
+
- [agents.md](agents.md) — integration principles that apply to every agent
|
|
60
71
|
- [claude-code.md](claude-code.md)
|
|
61
72
|
- [codex.md](codex.md)
|
|
73
|
+
- [cursor.md](cursor.md)
|
|
74
|
+
- [copilot.md](copilot.md)
|
|
@@ -24,6 +24,15 @@ This document tracks all breaking and notable changes to the brainclaw MCP serve
|
|
|
24
24
|
- Constraints can now have a category: architecture, performance, security, reliability, compatibility, process, other
|
|
25
25
|
- Decisions can now have an outcome: approved, rejected, deferred, pending
|
|
26
26
|
- Doctor check `metadata_consistency` — validates capability and tool completeness
|
|
27
|
+
- `bclaw_bootstrap` now returns adaptive interview prompts alongside the import proposal when bootstrap confidence is incomplete
|
|
28
|
+
- `structuredContent.import_plan.interview` exposes `summary`, `question_count`, and audience-tagged questions
|
|
29
|
+
- Questions can be targeted to `cli`, `ide_chat`, or `any`
|
|
30
|
+
- Interview questions now expose stable IDs and `target_hints`
|
|
31
|
+
- `structuredContent.onboarding_mode` distinguishes `empty_workspace`, `existing_documented`, and `existing_sparse`
|
|
32
|
+
- `structuredContent.import_plan.confirmed_suggestion_count` reports how many suggestions were confirmed by interview answers
|
|
33
|
+
- `bclaw_bootstrap` now accepts `interviewAnswers`, `apply`, `uninstall`, `audience`, and `interview`
|
|
34
|
+
- capable agents can preview confirmed selective imports through MCP before applying them
|
|
35
|
+
- bootstrap apply/uninstall now covers selective canonical memory imports beyond instructions
|
|
27
36
|
|
|
28
37
|
**Changed**
|
|
29
38
|
- MCP schema version bumped to 0.6.0 to reflect new metadata discovery capabilities
|