brainclaw 0.19.5 → 0.19.7
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 +102 -104
- package/dist/commands/adapter-openclaw-import.js +0 -0
- package/dist/commands/add-step.js +3 -5
- 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 +3 -5
- 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 +14 -12
- package/dist/commands/complete-step.js +3 -5
- package/dist/commands/constraint.js +3 -5
- package/dist/commands/context-diff.js +0 -0
- package/dist/commands/context.js +0 -0
- package/dist/commands/decision.js +3 -6
- package/dist/commands/delete-plan.js +3 -5
- 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 +3 -5
- 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 +16 -9
- 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 +11 -21
- package/dist/commands/memory.js +4 -7
- package/dist/commands/metrics.js +0 -0
- package/dist/commands/plan-resource.js +0 -0
- package/dist/commands/plan.js +3 -5
- package/dist/commands/prune-candidates.js +0 -0
- package/dist/commands/prune.js +27 -25
- 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 +3 -5
- package/dist/commands/register-agent.js +0 -0
- package/dist/commands/reject.js +0 -0
- package/dist/commands/release-claim.js +23 -20
- package/dist/commands/release-claims.js +22 -21
- package/dist/commands/review.js +0 -0
- package/dist/commands/rollback.js +2 -2
- 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 +3 -5
- package/dist/commands/trap.js +3 -5
- package/dist/commands/update-handoff.js +3 -5
- package/dist/commands/update-plan.js +3 -5
- package/dist/commands/upgrade.js +2 -2
- 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 +25 -25
- package/dist/core/bootstrap.js +0 -0
- package/dist/core/brainclaw-version.js +0 -0
- package/dist/core/candidates.js +10 -6
- package/dist/core/circuit-breaker.js +0 -0
- package/dist/core/claims.js +10 -8
- 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 +2 -2
- 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 +4 -2
- package/dist/core/io.js +8 -0
- package/dist/core/json-store.js +0 -0
- package/dist/core/lifecycle.js +0 -0
- package/dist/core/lock.js +18 -2
- 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 +18 -14
- 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 +21 -4
- 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 +7 -6
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
@@ -118,7 +118,7 @@ brainclaw plan create "Coordinate auth rollout" --priority high
|
|
|
118
118
|
brainclaw context --json
|
|
119
119
|
```
|
|
120
120
|
|
|
121
|
-
|
|
121
|
+
Detailed Markdown guides are bundled in the npm package under `docs/`.
|
|
122
122
|
|
|
123
123
|
---
|
|
124
124
|
|
|
@@ -154,25 +154,27 @@ brainclaw can also expose collaboration views through MCP-readable tools, includ
|
|
|
154
154
|
|
|
155
155
|
---
|
|
156
156
|
|
|
157
|
-
## Documentation
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
|
162
|
-
|
|
163
|
-
|
|
|
164
|
-
|
|
|
165
|
-
|
|
|
166
|
-
|
|
|
167
|
-
|
|
|
168
|
-
|
|
|
169
|
-
|
|
|
170
|
-
|
|
|
171
|
-
|
|
|
172
|
-
|
|
|
173
|
-
|
|
|
174
|
-
|
|
|
175
|
-
|
|
|
157
|
+
## Documentation
|
|
158
|
+
|
|
159
|
+
The npm package includes the Markdown docs below under `docs/`. Public web docs on `brainclaw.dev` are still being rolled out, so the npm README does not depend on private GitHub links.
|
|
160
|
+
|
|
161
|
+
| | |
|
|
162
|
+
|---|---|
|
|
163
|
+
| `docs/quickstart.md` | Get started in 5 minutes |
|
|
164
|
+
| `docs/cli.md` | Full command reference |
|
|
165
|
+
| `docs/concepts/memory.md` | What "memory" means in brainclaw |
|
|
166
|
+
| `docs/concepts/plans-and-claims.md` | Coordination layer |
|
|
167
|
+
| `docs/concepts/runtime-notes.md` | Ephemeral observations |
|
|
168
|
+
| `docs/integrations/overview.md` | How to integrate with any agent |
|
|
169
|
+
| `docs/integrations/cursor.md` | Cursor |
|
|
170
|
+
| `docs/integrations/claude-code.md` | Claude Code |
|
|
171
|
+
| `docs/integrations/copilot.md` | GitHub Copilot |
|
|
172
|
+
| `docs/integrations/codex.md` | Codex |
|
|
173
|
+
| `docs/integrations/mcp.md` | MCP tools |
|
|
174
|
+
| `docs/storage.md` | Storage model |
|
|
175
|
+
| `docs/security.md` | Security model |
|
|
176
|
+
| `docs/review.md` | Reflective review |
|
|
177
|
+
| `docs/reputation.md` | Reputation signals |
|
|
176
178
|
|
|
177
179
|
---
|
|
178
180
|
|
package/dist/cli.js
CHANGED
|
File without changes
|
package/dist/commands/accept.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { memoryExists,
|
|
1
|
+
import { memoryExists, withStoreLock } from '../core/io.js';
|
|
2
2
|
import { loadCandidate, archiveCandidate, resolveIdOrAlias } from '../core/candidates.js';
|
|
3
|
-
import { loadState,
|
|
4
|
-
import { generateMarkdown } from '../core/markdown.js';
|
|
3
|
+
import { loadState, persistState } from '../core/state.js';
|
|
5
4
|
import { generateIdWithLabel, nowISO } from '../core/ids.js';
|
|
6
5
|
import { generateTrapIdWithLabel } from '../core/traps.js';
|
|
7
6
|
import { requireMinimumTrustLevel, requireRegisteredAgentIdentity } from '../core/agent-registry.js';
|
|
@@ -36,109 +35,108 @@ export function acceptCandidate(id, by, cwd, byId) {
|
|
|
36
35
|
});
|
|
37
36
|
requireMinimumTrustLevel(actorIdentity, 'trusted');
|
|
38
37
|
const actor = actorIdentity.agent_name;
|
|
39
|
-
const state = loadState(cwd);
|
|
40
38
|
let promotedItemId = '';
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
39
|
+
withStoreLock(cwd, () => {
|
|
40
|
+
const state = loadState(cwd);
|
|
41
|
+
switch (candidate.type) {
|
|
42
|
+
case 'constraint': {
|
|
43
|
+
const { id: entryId, short_label } = generateIdWithLabel('active_constraints', cwd);
|
|
44
|
+
const entry = {
|
|
45
|
+
id: entryId,
|
|
46
|
+
short_label,
|
|
47
|
+
text: candidate.text,
|
|
48
|
+
created_at: candidate.created_at,
|
|
49
|
+
author: candidate.author,
|
|
50
|
+
author_id: candidate.author_id,
|
|
51
|
+
project_id: candidate.project_id,
|
|
52
|
+
host_id: candidate.host_id,
|
|
53
|
+
session_id: candidate.session_id,
|
|
54
|
+
status: 'active',
|
|
55
|
+
tags: candidate.tags,
|
|
56
|
+
};
|
|
57
|
+
state.active_constraints.push(entry);
|
|
58
|
+
promotedItemId = entryId;
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
case 'decision': {
|
|
62
|
+
const { id: entryId, short_label } = generateIdWithLabel('recent_decisions', cwd);
|
|
63
|
+
const entry = {
|
|
64
|
+
id: entryId,
|
|
65
|
+
short_label,
|
|
66
|
+
text: candidate.text,
|
|
67
|
+
created_at: candidate.created_at,
|
|
68
|
+
author: candidate.author,
|
|
69
|
+
author_id: candidate.author_id,
|
|
70
|
+
project_id: candidate.project_id,
|
|
71
|
+
host_id: candidate.host_id,
|
|
72
|
+
session_id: candidate.session_id,
|
|
73
|
+
related_paths: candidate.related_paths,
|
|
74
|
+
plan_id: candidate.plan_id,
|
|
75
|
+
tags: candidate.tags,
|
|
76
|
+
};
|
|
77
|
+
state.recent_decisions.push(entry);
|
|
78
|
+
promotedItemId = entryId;
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
case 'trap': {
|
|
82
|
+
const { id: entryId, short_label } = generateTrapIdWithLabel(cwd);
|
|
83
|
+
const entry = {
|
|
84
|
+
id: entryId,
|
|
85
|
+
short_label,
|
|
86
|
+
text: candidate.text,
|
|
87
|
+
created_at: candidate.created_at,
|
|
88
|
+
author: candidate.author,
|
|
89
|
+
author_id: candidate.author_id,
|
|
90
|
+
project_id: candidate.project_id,
|
|
91
|
+
host_id: candidate.host_id,
|
|
92
|
+
session_id: candidate.session_id,
|
|
93
|
+
status: 'active',
|
|
94
|
+
severity: candidate.severity ?? 'medium',
|
|
95
|
+
tags: candidate.tags,
|
|
96
|
+
plan_id: candidate.plan_id,
|
|
97
|
+
visibility: 'shared',
|
|
98
|
+
};
|
|
99
|
+
state.known_traps.push(entry);
|
|
100
|
+
promotedItemId = entryId;
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
case 'handoff': {
|
|
104
|
+
const { id: entryId, short_label } = generateIdWithLabel('open_handoffs', cwd);
|
|
105
|
+
const entry = {
|
|
106
|
+
id: entryId,
|
|
107
|
+
short_label,
|
|
108
|
+
from: candidate.from ?? 'unknown',
|
|
109
|
+
to: candidate.to ?? 'unknown',
|
|
110
|
+
text: candidate.text,
|
|
111
|
+
created_at: candidate.created_at,
|
|
112
|
+
author: candidate.author,
|
|
113
|
+
author_id: candidate.author_id,
|
|
114
|
+
project_id: candidate.project_id,
|
|
115
|
+
host_id: candidate.host_id,
|
|
116
|
+
session_id: candidate.session_id,
|
|
117
|
+
status: 'open',
|
|
118
|
+
tags: candidate.tags,
|
|
119
|
+
};
|
|
120
|
+
state.open_handoffs.push(entry);
|
|
121
|
+
promotedItemId = entryId;
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
61
124
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
};
|
|
78
|
-
state.recent_decisions.push(entry);
|
|
79
|
-
promotedItemId = entryId;
|
|
80
|
-
break;
|
|
81
|
-
}
|
|
82
|
-
case 'trap': {
|
|
83
|
-
const { id: entryId, short_label } = generateTrapIdWithLabel(cwd);
|
|
84
|
-
const entry = {
|
|
85
|
-
id: entryId,
|
|
86
|
-
short_label,
|
|
87
|
-
text: candidate.text,
|
|
88
|
-
created_at: candidate.created_at,
|
|
89
|
-
author: candidate.author,
|
|
90
|
-
author_id: candidate.author_id,
|
|
91
|
-
project_id: candidate.project_id,
|
|
92
|
-
host_id: candidate.host_id,
|
|
93
|
-
session_id: candidate.session_id,
|
|
94
|
-
status: 'active',
|
|
95
|
-
severity: candidate.severity ?? 'medium',
|
|
96
|
-
tags: candidate.tags,
|
|
97
|
-
plan_id: candidate.plan_id,
|
|
98
|
-
visibility: 'shared',
|
|
99
|
-
};
|
|
100
|
-
state.known_traps.push(entry);
|
|
101
|
-
promotedItemId = entryId;
|
|
102
|
-
break;
|
|
103
|
-
}
|
|
104
|
-
case 'handoff': {
|
|
105
|
-
const { id: entryId, short_label } = generateIdWithLabel('open_handoffs', cwd);
|
|
106
|
-
const entry = {
|
|
107
|
-
id: entryId,
|
|
108
|
-
short_label,
|
|
109
|
-
from: candidate.from ?? 'unknown',
|
|
110
|
-
to: candidate.to ?? 'unknown',
|
|
111
|
-
text: candidate.text,
|
|
112
|
-
created_at: candidate.created_at,
|
|
113
|
-
author: candidate.author,
|
|
114
|
-
author_id: candidate.author_id,
|
|
115
|
-
project_id: candidate.project_id,
|
|
116
|
-
host_id: candidate.host_id,
|
|
117
|
-
session_id: candidate.session_id,
|
|
118
|
-
status: 'open',
|
|
119
|
-
tags: candidate.tags,
|
|
120
|
-
};
|
|
121
|
-
state.open_handoffs.push(entry);
|
|
122
|
-
promotedItemId = entryId;
|
|
123
|
-
break;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
saveState(state, cwd);
|
|
127
|
-
writeFileAtomic(memoryPath('project.md', cwd), generateMarkdown(state, cwd));
|
|
128
|
-
// Archive candidate (use resolved hash ID)
|
|
129
|
-
candidate.status = 'accepted';
|
|
130
|
-
candidate.resolved_at = nowISO();
|
|
131
|
-
candidate.resolved_by = actor;
|
|
132
|
-
archiveCandidate(candidate, 'accepted', cwd);
|
|
133
|
-
appendAuditEntry({
|
|
134
|
-
actor,
|
|
135
|
-
actor_id: actorIdentity.agent_id,
|
|
136
|
-
action: 'accept',
|
|
137
|
-
item_id: resolvedId,
|
|
138
|
-
item_type: candidate.type,
|
|
139
|
-
after: { type: candidate.type, text: candidate.text },
|
|
140
|
-
reason: 'trusted-agent',
|
|
141
|
-
}, cwd);
|
|
125
|
+
persistState(state, cwd);
|
|
126
|
+
candidate.status = 'accepted';
|
|
127
|
+
candidate.resolved_at = nowISO();
|
|
128
|
+
candidate.resolved_by = actor;
|
|
129
|
+
archiveCandidate(candidate, 'accepted', cwd);
|
|
130
|
+
appendAuditEntry({
|
|
131
|
+
actor,
|
|
132
|
+
actor_id: actorIdentity.agent_id,
|
|
133
|
+
action: 'accept',
|
|
134
|
+
item_id: resolvedId,
|
|
135
|
+
item_type: candidate.type,
|
|
136
|
+
after: { type: candidate.type, text: candidate.text },
|
|
137
|
+
reason: 'trusted-agent',
|
|
138
|
+
}, cwd);
|
|
139
|
+
});
|
|
142
140
|
return {
|
|
143
141
|
candidate_id: resolvedId,
|
|
144
142
|
candidate_type: candidate.type,
|
|
File without changes
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { loadState,
|
|
2
|
-
import { memoryExists
|
|
1
|
+
import { loadState, persistState } from '../core/state.js';
|
|
2
|
+
import { memoryExists } from '../core/io.js';
|
|
3
3
|
import { generateId, nowISO } from '../core/ids.js';
|
|
4
|
-
import { generateMarkdown } from '../core/markdown.js';
|
|
5
4
|
import { validateCliInput } from '../core/input-validation.js';
|
|
6
5
|
export function runAddStep(planId, text, options = {}) {
|
|
7
6
|
if (!memoryExists()) {
|
|
@@ -25,8 +24,7 @@ export function runAddStep(planId, text, options = {}) {
|
|
|
25
24
|
};
|
|
26
25
|
plan.steps = [...(plan.steps ?? []), step];
|
|
27
26
|
plan.updated_at = nowISO();
|
|
28
|
-
|
|
29
|
-
writeFileAtomic(memoryPath('project.md'), generateMarkdown(state));
|
|
27
|
+
persistState(state);
|
|
30
28
|
const total = plan.steps.length;
|
|
31
29
|
const done = plan.steps.filter((s) => s.status === 'done').length;
|
|
32
30
|
console.log(`✔ Step added: [${step.id}] ${text}`);
|
|
File without changes
|
package/dist/commands/audit.js
CHANGED
|
File without changes
|
|
File without changes
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { loadState,
|
|
1
|
+
import { loadState, persistState } from '../core/state.js';
|
|
2
2
|
import { resolveCurrentAgentName } from '../core/agent-registry.js';
|
|
3
|
-
import { memoryExists
|
|
4
|
-
import { generateMarkdown } from '../core/markdown.js';
|
|
3
|
+
import { memoryExists } from '../core/io.js';
|
|
5
4
|
import { generateIdWithLabel, nowISO } from '../core/ids.js';
|
|
6
5
|
import { loadConfig } from '../core/config.js';
|
|
7
6
|
import { scanText } from '../core/security.js';
|
|
@@ -80,8 +79,7 @@ function runCapabilityAdd(name, description, options, cwd) {
|
|
|
80
79
|
// For now, store as decision to avoid schema migration
|
|
81
80
|
// Will migrate to separate capability storage in v0.16
|
|
82
81
|
state.recent_decisions.push(entry);
|
|
83
|
-
|
|
84
|
-
writeFileAtomic(memoryPath('project.md', cwd), generateMarkdown(state));
|
|
82
|
+
persistState(state, cwd);
|
|
85
83
|
console.log(`✔ Capability added: [${id}] ${name}`);
|
|
86
84
|
console.log(' (Stored in decisions for now; will move to dedicated registry in v0.16)');
|
|
87
85
|
}
|
package/dist/commands/changes.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/commands/claim.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { buildOperationalIdentity } from '../core/identity.js';
|
|
2
|
-
import { memoryExists, memoryPath, writeFileAtomic } from '../core/io.js';
|
|
2
|
+
import { memoryExists, memoryPath, withStoreLock, writeFileAtomic } from '../core/io.js';
|
|
3
3
|
import { saveClaim, generateClaimId, listClaims } from '../core/claims.js';
|
|
4
4
|
import { generateMarkdown } from '../core/markdown.js';
|
|
5
5
|
import { loadState, saveState } from '../core/state.js';
|
|
@@ -72,18 +72,20 @@ export function runClaim(description, options) {
|
|
|
72
72
|
status: 'active',
|
|
73
73
|
expires_at: options.ttl ? parseTtl(options.ttl) : undefined,
|
|
74
74
|
};
|
|
75
|
-
|
|
76
|
-
if (
|
|
77
|
-
plan.assignee
|
|
75
|
+
withStoreLock(options.cwd, () => {
|
|
76
|
+
if (plan) {
|
|
77
|
+
if (!plan.assignee) {
|
|
78
|
+
plan.assignee = actor.agent;
|
|
79
|
+
}
|
|
80
|
+
if (plan.status === 'todo') {
|
|
81
|
+
plan.status = 'in_progress';
|
|
82
|
+
}
|
|
83
|
+
plan.updated_at = nowISO();
|
|
84
|
+
saveState(state, options.cwd);
|
|
78
85
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
plan.updated_at = nowISO();
|
|
83
|
-
saveState(state, options.cwd);
|
|
84
|
-
}
|
|
85
|
-
saveClaim(claim, options.cwd);
|
|
86
|
-
writeFileAtomic(memoryPath('project.md', options.cwd), generateMarkdown(plan ? state : loadState(options.cwd), options.cwd));
|
|
86
|
+
saveClaim(claim, options.cwd);
|
|
87
|
+
writeFileAtomic(memoryPath('project.md', options.cwd), generateMarkdown(plan ? state : loadState(options.cwd), options.cwd));
|
|
88
|
+
});
|
|
87
89
|
const planInfo = claim.plan_id ? ` [plan ${claim.plan_id}]` : '';
|
|
88
90
|
const ttlInfo = claim.expires_at ? ` (expires ${claim.expires_at.slice(0, 16).replace('T', ' ')})` : '';
|
|
89
91
|
const storeLabel = options.store && options.store !== 'local' ? ` [store:${options.store}]` : '';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { loadState,
|
|
2
|
-
import { memoryExists
|
|
1
|
+
import { loadState, persistState } from '../core/state.js';
|
|
2
|
+
import { memoryExists } from '../core/io.js';
|
|
3
3
|
import { nowISO } from '../core/ids.js';
|
|
4
|
-
import { generateMarkdown } from '../core/markdown.js';
|
|
5
4
|
export function runCompleteStep(planId, stepId) {
|
|
6
5
|
if (!memoryExists()) {
|
|
7
6
|
console.error('Error: .brainclaw/ not found. Run `brainclaw init` first.');
|
|
@@ -21,8 +20,7 @@ export function runCompleteStep(planId, stepId) {
|
|
|
21
20
|
step.status = 'done';
|
|
22
21
|
step.updated_at = nowISO();
|
|
23
22
|
plan.updated_at = nowISO();
|
|
24
|
-
|
|
25
|
-
writeFileAtomic(memoryPath('project.md'), generateMarkdown(state));
|
|
23
|
+
persistState(state);
|
|
26
24
|
const total = plan.steps.length;
|
|
27
25
|
const done = plan.steps.filter((s) => s.status === 'done').length;
|
|
28
26
|
console.log(`✔ Step completed: [${step.id}] ${step.text}`);
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { loadState,
|
|
1
|
+
import { loadState, persistState } from '../core/state.js';
|
|
2
2
|
import { resolveCurrentAgentName } from '../core/agent-registry.js';
|
|
3
3
|
import { loadConfig } from '../core/config.js';
|
|
4
|
-
import { generateMarkdown } from '../core/markdown.js';
|
|
5
4
|
import { generateIdWithLabel, nowISO } from '../core/ids.js';
|
|
6
5
|
import { scanText } from '../core/security.js';
|
|
7
|
-
import { memoryExists
|
|
6
|
+
import { memoryExists } from '../core/io.js';
|
|
8
7
|
import { validateCliInput } from '../core/input-validation.js';
|
|
9
8
|
import { resolveTargetStore } from '../core/store-resolution.js';
|
|
10
9
|
export function runConstraint(text, options = {}) {
|
|
@@ -37,8 +36,7 @@ export function runConstraint(text, options = {}) {
|
|
|
37
36
|
related_paths: options.path,
|
|
38
37
|
};
|
|
39
38
|
state.active_constraints.push(entry);
|
|
40
|
-
|
|
41
|
-
writeFileAtomic(memoryPath('project.md', cwd), generateMarkdown(state));
|
|
39
|
+
persistState(state, cwd);
|
|
42
40
|
console.log(`✔ Constraint added: [${id}] ${text}`);
|
|
43
41
|
}
|
|
44
42
|
//# sourceMappingURL=constraint.js.map
|
|
File without changes
|
package/dist/commands/context.js
CHANGED
|
File without changes
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { loadState,
|
|
1
|
+
import { loadState, persistState } from '../core/state.js';
|
|
2
2
|
import { resolveCurrentAgentName } from '../core/agent-registry.js';
|
|
3
3
|
import { loadConfig } from '../core/config.js';
|
|
4
|
-
import { generateMarkdown } from '../core/markdown.js';
|
|
5
4
|
import { generateIdWithLabel, nowISO } from '../core/ids.js';
|
|
6
5
|
import { scanText } from '../core/security.js';
|
|
7
|
-
import { memoryExists
|
|
6
|
+
import { memoryExists } from '../core/io.js';
|
|
8
7
|
import { validateCliInput } from '../core/input-validation.js';
|
|
9
8
|
import { resolveTargetStore } from '../core/store-resolution.js';
|
|
10
9
|
export function runDecision(text, options = {}) {
|
|
@@ -37,9 +36,7 @@ export function runDecision(text, options = {}) {
|
|
|
37
36
|
plan_id: options.plan,
|
|
38
37
|
};
|
|
39
38
|
state.recent_decisions.push(entry);
|
|
40
|
-
|
|
41
|
-
// Rebuild markdown
|
|
42
|
-
writeFileAtomic(memoryPath('project.md', cwd), generateMarkdown(state));
|
|
39
|
+
persistState(state, cwd);
|
|
43
40
|
console.log(`✔ Decision added: [${id}] ${text}`);
|
|
44
41
|
}
|
|
45
42
|
//# sourceMappingURL=decision.js.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { loadState,
|
|
2
|
-
import { memoryExists
|
|
3
|
-
import { generateMarkdown } from '../core/markdown.js';
|
|
1
|
+
import { loadState, persistState } from '../core/state.js';
|
|
2
|
+
import { memoryExists } from '../core/io.js';
|
|
4
3
|
export function runDeletePlan(id, options = {}) {
|
|
5
4
|
if (!memoryExists(options.cwd)) {
|
|
6
5
|
console.error('Error: .brainclaw/ not found. Run `brainclaw init` first.');
|
|
@@ -13,8 +12,7 @@ export function runDeletePlan(id, options = {}) {
|
|
|
13
12
|
process.exit(1);
|
|
14
13
|
}
|
|
15
14
|
const [plan] = state.plan_items.splice(index, 1);
|
|
16
|
-
|
|
17
|
-
writeFileAtomic(memoryPath('project.md', options.cwd), generateMarkdown(state, options.cwd));
|
|
15
|
+
persistState(state, options.cwd);
|
|
18
16
|
console.log(`✔ Plan item deleted: [${plan.id}] ${plan.text}`);
|
|
19
17
|
}
|
|
20
18
|
//# sourceMappingURL=delete-plan.js.map
|
package/dist/commands/diff.js
CHANGED
|
File without changes
|
package/dist/commands/doctor.js
CHANGED
|
File without changes
|
|
File without changes
|
package/dist/commands/env.js
CHANGED
|
File without changes
|
|
File without changes
|
package/dist/commands/explore.js
CHANGED
|
File without changes
|
package/dist/commands/export.js
CHANGED
|
File without changes
|
package/dist/commands/handoff.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { execSync } from 'node:child_process';
|
|
2
|
-
import { loadState,
|
|
2
|
+
import { loadState, persistState } from '../core/state.js';
|
|
3
3
|
import { resolveCurrentAgentName } from '../core/agent-registry.js';
|
|
4
4
|
import { loadConfig } from '../core/config.js';
|
|
5
|
-
import { generateMarkdown } from '../core/markdown.js';
|
|
6
5
|
import { generateIdWithLabel, nowISO } from '../core/ids.js';
|
|
7
6
|
import { scanText } from '../core/security.js';
|
|
8
|
-
import { memoryExists
|
|
7
|
+
import { memoryExists } from '../core/io.js';
|
|
9
8
|
import { validateCliInput } from '../core/input-validation.js';
|
|
10
9
|
import { resolveTargetStore } from '../core/store-resolution.js';
|
|
11
10
|
export function runHandoff(text, options) {
|
|
@@ -56,8 +55,7 @@ export function runHandoff(text, options) {
|
|
|
56
55
|
snapshot: diff ? { diff } : undefined,
|
|
57
56
|
};
|
|
58
57
|
state.open_handoffs.push(entry);
|
|
59
|
-
|
|
60
|
-
writeFileAtomic(memoryPath('project.md', cwd), generateMarkdown(state, cwd));
|
|
58
|
+
persistState(state, cwd);
|
|
61
59
|
console.log(`✔ Handoff added: [${id}] ${options.from} → ${options.to}: ${text}`);
|
|
62
60
|
}
|
|
63
61
|
//# sourceMappingURL=handoff.js.map
|
package/dist/commands/history.js
CHANGED
|
File without changes
|
package/dist/commands/hooks.js
CHANGED
|
File without changes
|
package/dist/commands/init.js
CHANGED
|
File without changes
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { resolveAgentScope, resolveCurrentAgentName } from '../core/agent-registry.js';
|
|
2
2
|
import { loadConfig } from '../core/config.js';
|
|
3
3
|
import { createInstruction } from '../core/instructions.js';
|
|
4
|
-
import { memoryExists, memoryPath, writeFileAtomic } from '../core/io.js';
|
|
4
|
+
import { memoryExists, memoryPath, withStoreLock, writeFileAtomic } from '../core/io.js';
|
|
5
5
|
import { generateMarkdown } from '../core/markdown.js';
|
|
6
6
|
import { loadState } from '../core/state.js';
|
|
7
7
|
import { scanText } from '../core/security.js';
|
|
@@ -25,14 +25,21 @@ export function runInstruction(text, options = {}) {
|
|
|
25
25
|
process.exit(1);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
let entry;
|
|
29
|
+
withStoreLock(cwd, () => {
|
|
30
|
+
entry = createInstruction(text, {
|
|
31
|
+
layer,
|
|
32
|
+
scope,
|
|
33
|
+
tags: options.tag,
|
|
34
|
+
author: options.author ?? resolveCurrentAgentName(cwd),
|
|
35
|
+
supersedes: options.supersedes,
|
|
36
|
+
}, cwd);
|
|
37
|
+
writeFileAtomic(memoryPath('project.md', cwd), generateMarkdown(loadState(cwd)));
|
|
38
|
+
});
|
|
39
|
+
if (!entry) {
|
|
40
|
+
console.error('Error: failed to persist instruction.');
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
36
43
|
console.log(`✔ Instruction added: [${entry.id}] <${entry.layer}${entry.scope ? `:${entry.scope}` : ''}> ${entry.text}`);
|
|
37
44
|
}
|
|
38
45
|
function resolveScope(layer, options, cwd) {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|