agent-blackboard 0.3.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -2
- package/dist/cli/snapshot-partition-options.d.mts +9 -0
- package/dist/cli/snapshot-partition-options.mjs +22 -0
- package/dist/cli/snapshot.mjs +93 -6
- package/dist/cli/usage.d.mts +1 -1
- package/dist/cli/usage.mjs +3 -0
- package/dist/client/snapshot-artifact-ownership.d.mts +13 -0
- package/dist/client/snapshot-artifact-ownership.mjs +140 -0
- package/dist/client/snapshot-artifact-removal.d.mts +14 -0
- package/dist/client/snapshot-artifact-removal.mjs +125 -0
- package/dist/client/snapshot-partition-cleanup.d.mts +3 -0
- package/dist/client/snapshot-partition-cleanup.mjs +125 -0
- package/dist/client/snapshot-partition-copy.d.mts +18 -0
- package/dist/client/snapshot-partition-copy.mjs +55 -0
- package/dist/client/snapshot-partition-format.d.mts +36 -0
- package/dist/client/snapshot-partition-format.mjs +133 -0
- package/dist/client/snapshot-partition-io.d.mts +4 -0
- package/dist/client/snapshot-partition-io.mjs +52 -0
- package/dist/client/snapshot-partition-read.d.mts +15 -0
- package/dist/client/snapshot-partition-read.mjs +98 -0
- package/dist/client/snapshot-partition-write.d.mts +18 -0
- package/dist/client/snapshot-partition-write.mjs +148 -0
- package/dist/client/snapshot-partitions.d.mts +3 -0
- package/dist/client/snapshot-partitions.mjs +100 -0
- package/dist/client/snapshots.d.mts +5 -1
- package/dist/client/snapshots.mjs +61 -6
- package/dist/client/types.d.mts +42 -4
- package/dist/index.d.mts +3 -1
- package/dist/index.mjs +2 -0
- package/dist/plugin/.claude-mcp.json +12 -0
- package/dist/plugin/.codex-plugin/plugin.json +33 -0
- package/dist/plugin/.mcp.json +7 -0
- package/dist/plugin/skills/agent-blackboard/SKILL.md +79 -0
- package/package.json +1 -1
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { constants } from 'node:fs';
|
|
2
|
+
import { chmod, lstat, mkdtemp, open } from 'node:fs/promises';
|
|
3
|
+
import { tmpdir } from 'node:os';
|
|
4
|
+
import { isAbsolute, resolve } from 'node:path';
|
|
5
|
+
import { stageSnapshot } from './snapshot-partition-read.mjs';
|
|
6
|
+
import { writePartitions } from './snapshot-partition-write.mjs';
|
|
7
|
+
import { cleanupSnapshotPartitions } from './snapshot-partition-cleanup.mjs';
|
|
8
|
+
import { removeOwnedDirectory } from './snapshot-artifact-removal.mjs';
|
|
9
|
+
import { assertCleanupToken, assertGeneratedPath, assertSnapshotMarker, knownCleanupToken, SOURCE_NAME, writePartitionMarker, } from './snapshot-artifact-ownership.mjs';
|
|
10
|
+
const MAX_SESSIONS = 25;
|
|
11
|
+
const MAX_BYTES = 1024 * 1024;
|
|
12
|
+
function assertLimit(value, fallback, label) {
|
|
13
|
+
const limit = value ?? fallback;
|
|
14
|
+
if (!Number.isSafeInteger(limit) || limit < 1)
|
|
15
|
+
throw new Error(`${label} must be a positive integer`);
|
|
16
|
+
return limit;
|
|
17
|
+
}
|
|
18
|
+
function assertVerification(bytes, checksum, manifest, options) {
|
|
19
|
+
if (options.checksum &&
|
|
20
|
+
(options.checksum.algorithm !== 'sha256' || options.checksum.value !== checksum))
|
|
21
|
+
throw new Error('snapshot checksum does not match');
|
|
22
|
+
if (options.counts &&
|
|
23
|
+
(options.counts.bytes !== bytes ||
|
|
24
|
+
options.counts.sessions !== manifest.counts.sessions ||
|
|
25
|
+
options.counts.entries !== manifest.counts.entries ||
|
|
26
|
+
options.counts.records !== manifest.counts.records)) {
|
|
27
|
+
throw new Error('snapshot counts do not match');
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/** Splits a generated snapshot into bounded, whole-session, read-only JSONL files. */
|
|
31
|
+
export async function partitionSnapshot(options) {
|
|
32
|
+
if (!isAbsolute(options.path))
|
|
33
|
+
throw new Error('snapshot path must be absolute');
|
|
34
|
+
assertGeneratedPath(options.path, SOURCE_NAME, 'snapshot path');
|
|
35
|
+
const cleanupToken = options.cleanupToken ?? knownCleanupToken(options.path);
|
|
36
|
+
assertCleanupToken(cleanupToken);
|
|
37
|
+
const before = await lstat(options.path, { bigint: true });
|
|
38
|
+
if (!before.isFile() || before.isSymbolicLink() || before.nlink !== 1n)
|
|
39
|
+
throw new Error('snapshot path must be an unlinked generated regular file');
|
|
40
|
+
let source;
|
|
41
|
+
let stage;
|
|
42
|
+
let stageIdentity;
|
|
43
|
+
let directory;
|
|
44
|
+
let directoryIdentity;
|
|
45
|
+
let directoryMarked = false;
|
|
46
|
+
try {
|
|
47
|
+
source = await open(options.path, constants.O_RDONLY | constants.O_NOFOLLOW);
|
|
48
|
+
stage = await mkdtemp(resolve(tmpdir(), 'agent-blackboard-partition-stage-'));
|
|
49
|
+
await chmod(stage, 0o700);
|
|
50
|
+
const stageStats = await lstat(stage, { bigint: true });
|
|
51
|
+
stageIdentity = { dev: stageStats.dev, ino: stageStats.ino };
|
|
52
|
+
directory = await mkdtemp(resolve(tmpdir(), 'agent-blackboard-partitions-'));
|
|
53
|
+
await chmod(directory, 0o700);
|
|
54
|
+
const directoryStats = await lstat(directory, { bigint: true });
|
|
55
|
+
directoryIdentity = { dev: directoryStats.dev, ino: directoryStats.ino };
|
|
56
|
+
await writePartitionMarker(directory, cleanupToken);
|
|
57
|
+
directoryMarked = true;
|
|
58
|
+
const opened = await source.stat({ bigint: true });
|
|
59
|
+
/* v8 ignore next -- a replacement between lstat and O_NOFOLLOW open is race-only */
|
|
60
|
+
if (!opened.isFile() ||
|
|
61
|
+
opened.nlink !== 1n ||
|
|
62
|
+
opened.dev !== before.dev ||
|
|
63
|
+
opened.ino !== before.ino)
|
|
64
|
+
throw new Error('snapshot path changed while it was being opened');
|
|
65
|
+
await assertSnapshotMarker(options.path, source, cleanupToken);
|
|
66
|
+
const staged = await stageSnapshot(source, stage);
|
|
67
|
+
const after = await source.stat({ bigint: true });
|
|
68
|
+
/* v8 ignore next -- source mutation during an owned read-only descriptor is race-only */
|
|
69
|
+
if (after.dev !== opened.dev ||
|
|
70
|
+
after.ino !== opened.ino ||
|
|
71
|
+
after.nlink !== 1n ||
|
|
72
|
+
opened.size !== BigInt(staged.bytes) ||
|
|
73
|
+
after.size !== BigInt(staged.bytes) ||
|
|
74
|
+
after.mtimeNs !== opened.mtimeNs ||
|
|
75
|
+
after.ctimeNs !== opened.ctimeNs)
|
|
76
|
+
throw new Error('snapshot path changed while it was being read');
|
|
77
|
+
await source.close();
|
|
78
|
+
source = undefined;
|
|
79
|
+
assertVerification(staged.bytes, staged.checksum, staged.manifest, options);
|
|
80
|
+
const partitions = await writePartitions(staged.index, staged.indexIdentity, staged.manifest, directory, assertLimit(options.maxSessions, MAX_SESSIONS, 'maxSessions'), assertLimit(options.maxBytes, MAX_BYTES, 'maxBytes'));
|
|
81
|
+
return { directory, partitions, cleanupToken };
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
/* v8 ignore next -- allocation failures before a directory exists are not deterministic in tests */
|
|
85
|
+
if (directoryMarked && directory) {
|
|
86
|
+
await cleanupSnapshotPartitions({ directory, cleanupToken }).catch(() => undefined);
|
|
87
|
+
}
|
|
88
|
+
else if (directory && directoryIdentity) {
|
|
89
|
+
await removeOwnedDirectory(directory, 'partition directory', directoryIdentity).catch(() => undefined);
|
|
90
|
+
}
|
|
91
|
+
throw error;
|
|
92
|
+
}
|
|
93
|
+
finally {
|
|
94
|
+
/* v8 ignore next -- best-effort descriptor closure must not mask the original failure */
|
|
95
|
+
await source?.close().catch(() => undefined);
|
|
96
|
+
/* v8 ignore next -- allocation failures before staging are not deterministic in tests */
|
|
97
|
+
if (stage && stageIdentity)
|
|
98
|
+
await removeOwnedDirectory(stage, 'partition staging directory', stageIdentity).catch(() => undefined);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import type { ClientConfig, SnapshotExportOptions, SnapshotExportResult } from './types.mjs';
|
|
1
|
+
import type { ClientConfig, SnapshotExportOptions, SnapshotExportResult, SnapshotCleanupOptions, SnapshotPartitionOptions, SnapshotPartitionResult } from './types.mjs';
|
|
2
2
|
/** Streams an immutable server snapshot directly into a private local JSONL file. */
|
|
3
3
|
export declare class Snapshots {
|
|
4
4
|
#private;
|
|
5
5
|
constructor(config: ClientConfig);
|
|
6
6
|
export(options?: SnapshotExportOptions): Promise<SnapshotExportResult>;
|
|
7
|
+
/** Splits a generated export into bounded session-preserving files. */
|
|
8
|
+
partition(options: SnapshotPartitionOptions): Promise<SnapshotPartitionResult>;
|
|
9
|
+
/** Removes a generated partition directory. */
|
|
10
|
+
cleanup(options: SnapshotCleanupOptions): Promise<void>;
|
|
7
11
|
}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { createHash, randomUUID } from 'node:crypto';
|
|
2
|
-
import {
|
|
2
|
+
import { lstat, open } from 'node:fs/promises';
|
|
3
3
|
import { tmpdir } from 'node:os';
|
|
4
4
|
import { isAbsolute, join } from 'node:path';
|
|
5
5
|
import { rawRequest } from './http.mjs';
|
|
6
6
|
import { readSnapshot } from './snapshot-response.mjs';
|
|
7
|
+
import { cleanupSnapshotPartitions } from './snapshot-partition-cleanup.mjs';
|
|
8
|
+
import { partitionSnapshot } from './snapshot-partitions.mjs';
|
|
9
|
+
import { removeOwnedFile } from './snapshot-artifact-removal.mjs';
|
|
10
|
+
import { createCleanupToken, snapshotMarkerPath, writeSnapshotMarker, } from './snapshot-artifact-ownership.mjs';
|
|
7
11
|
function queryFor(selection = {}) {
|
|
8
12
|
const query = {};
|
|
9
13
|
if (selection.agent !== undefined)
|
|
@@ -23,7 +27,9 @@ async function createDestination(path) {
|
|
|
23
27
|
if (!isAbsolute(path))
|
|
24
28
|
throw new Error('snapshot path must be absolute');
|
|
25
29
|
try {
|
|
26
|
-
|
|
30
|
+
const file = await open(path, 'wx', 0o600);
|
|
31
|
+
const identity = await file.stat({ bigint: true });
|
|
32
|
+
return { path, file, identity: { dev: identity.dev, ino: identity.ino } };
|
|
27
33
|
}
|
|
28
34
|
catch (error) {
|
|
29
35
|
if (error.code === 'EEXIST') {
|
|
@@ -33,7 +39,36 @@ async function createDestination(path) {
|
|
|
33
39
|
}
|
|
34
40
|
}
|
|
35
41
|
const generated = join(tmpdir(), `agent-blackboard-snapshot-${randomUUID()}.jsonl`);
|
|
36
|
-
|
|
42
|
+
const cleanupToken = createCleanupToken();
|
|
43
|
+
const file = await open(generated, 'wx', 0o600);
|
|
44
|
+
const identity = await file.stat({ bigint: true });
|
|
45
|
+
try {
|
|
46
|
+
await writeSnapshotMarker(generated, file, cleanupToken);
|
|
47
|
+
return {
|
|
48
|
+
path: generated,
|
|
49
|
+
file,
|
|
50
|
+
identity: { dev: identity.dev, ino: identity.ino },
|
|
51
|
+
cleanupToken,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
/* v8 ignore start -- ownership-marker creation can fail only through an OS-level collision or fault */
|
|
56
|
+
await file.close().catch(() => undefined);
|
|
57
|
+
await removeOwnedFile(generated, 'snapshot path', {
|
|
58
|
+
dev: identity.dev,
|
|
59
|
+
ino: identity.ino,
|
|
60
|
+
}).catch(() => undefined);
|
|
61
|
+
const marker = await lstat(snapshotMarkerPath(generated), { bigint: true }).catch(() => undefined);
|
|
62
|
+
if (marker) {
|
|
63
|
+
await removeOwnedFile(snapshotMarkerPath(generated), 'snapshot ownership marker', {
|
|
64
|
+
dev: marker.dev,
|
|
65
|
+
ino: marker.ino,
|
|
66
|
+
}).catch(() => undefined);
|
|
67
|
+
}
|
|
68
|
+
/* v8 ignore stop */
|
|
69
|
+
/* v8 ignore next -- preserve the primary marker-creation failure */
|
|
70
|
+
throw error;
|
|
71
|
+
}
|
|
37
72
|
}
|
|
38
73
|
/** Streams an immutable server snapshot directly into a private local JSONL file. */
|
|
39
74
|
export class Snapshots {
|
|
@@ -55,9 +90,9 @@ export class Snapshots {
|
|
|
55
90
|
const { state, manifest } = await readSnapshot(response, file, hash, options.selection);
|
|
56
91
|
const info = await file.stat();
|
|
57
92
|
await file.sync();
|
|
93
|
+
await file.chmod(0o400);
|
|
58
94
|
await file.close();
|
|
59
95
|
file = undefined;
|
|
60
|
-
await chmod(target.path, 0o400);
|
|
61
96
|
complete = true;
|
|
62
97
|
return {
|
|
63
98
|
path: target.path,
|
|
@@ -69,14 +104,34 @@ export class Snapshots {
|
|
|
69
104
|
},
|
|
70
105
|
checksum: { algorithm: 'sha256', value: hash.digest('hex') },
|
|
71
106
|
manifest,
|
|
107
|
+
...(target.cleanupToken === undefined ? {} : { cleanupToken: target.cleanupToken }),
|
|
72
108
|
};
|
|
73
109
|
}
|
|
74
110
|
finally {
|
|
75
111
|
/* v8 ignore next -- cleanup must still remove partial output if close itself fails */
|
|
76
112
|
if (file)
|
|
77
113
|
await file.close().catch(() => undefined);
|
|
78
|
-
if (!complete)
|
|
79
|
-
|
|
114
|
+
if (!complete) {
|
|
115
|
+
/* v8 ignore next -- best-effort cleanup must not mask the original export failure */
|
|
116
|
+
await removeOwnedFile(target.path, 'snapshot path', target.identity).catch(() => undefined);
|
|
117
|
+
/* v8 ignore next -- best-effort marker cleanup must not mask the original export failure */
|
|
118
|
+
if (target.cleanupToken !== undefined) {
|
|
119
|
+
const marker = await lstat(snapshotMarkerPath(target.path), { bigint: true }).catch(() => undefined);
|
|
120
|
+
if (marker)
|
|
121
|
+
await removeOwnedFile(snapshotMarkerPath(target.path), 'snapshot ownership marker', {
|
|
122
|
+
dev: marker.dev,
|
|
123
|
+
ino: marker.ino,
|
|
124
|
+
}).catch(() => undefined);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
80
127
|
}
|
|
81
128
|
}
|
|
129
|
+
/** Splits a generated export into bounded session-preserving files. */
|
|
130
|
+
partition(options) {
|
|
131
|
+
return partitionSnapshot(options);
|
|
132
|
+
}
|
|
133
|
+
/** Removes a generated partition directory. */
|
|
134
|
+
cleanup(options) {
|
|
135
|
+
return cleanupSnapshotPartitions(options);
|
|
136
|
+
}
|
|
82
137
|
}
|
package/dist/client/types.d.mts
CHANGED
|
@@ -120,9 +120,47 @@ export interface SnapshotExportOptions {
|
|
|
120
120
|
export interface SnapshotExportResult {
|
|
121
121
|
path: string;
|
|
122
122
|
counts: SnapshotCounts;
|
|
123
|
-
checksum:
|
|
124
|
-
algorithm: 'sha256';
|
|
125
|
-
value: string;
|
|
126
|
-
};
|
|
123
|
+
checksum: SnapshotChecksum;
|
|
127
124
|
manifest: SnapshotManifest;
|
|
125
|
+
/** Capability required to partition or clean up an export created by the client. */
|
|
126
|
+
cleanupToken?: string | undefined;
|
|
127
|
+
}
|
|
128
|
+
export interface SnapshotChecksum {
|
|
129
|
+
algorithm: 'sha256';
|
|
130
|
+
value: string;
|
|
131
|
+
}
|
|
132
|
+
/** Verification metadata returned by `Snapshots.export` and accepted by `partition`. */
|
|
133
|
+
export interface SnapshotVerification {
|
|
134
|
+
checksum?: SnapshotChecksum;
|
|
135
|
+
counts?: SnapshotCounts;
|
|
136
|
+
}
|
|
137
|
+
export interface SnapshotPartitionOptions extends SnapshotVerification {
|
|
138
|
+
/** A generated temporary snapshot returned by `Snapshots.export` without `path`. */
|
|
139
|
+
path: string;
|
|
140
|
+
/** Capability returned by the generated snapshot export. */
|
|
141
|
+
cleanupToken?: string | undefined;
|
|
142
|
+
/** Maximum whole sessions in one partition. Defaults to 25. */
|
|
143
|
+
maxSessions?: number;
|
|
144
|
+
/** Maximum bytes in one partition. Defaults to 1 MiB. */
|
|
145
|
+
maxBytes?: number;
|
|
146
|
+
}
|
|
147
|
+
export interface SnapshotPartition {
|
|
148
|
+
path: string;
|
|
149
|
+
counts: SnapshotCounts;
|
|
150
|
+
checksum: SnapshotChecksum;
|
|
151
|
+
manifest: SnapshotManifest;
|
|
152
|
+
}
|
|
153
|
+
export interface SnapshotPartitionResult {
|
|
154
|
+
directory: string;
|
|
155
|
+
partitions: SnapshotPartition[];
|
|
156
|
+
/** Capability required to clean up this generated partition directory. */
|
|
157
|
+
cleanupToken: string;
|
|
158
|
+
}
|
|
159
|
+
export interface SnapshotCleanupOptions {
|
|
160
|
+
/** A generated temporary snapshot returned by `Snapshots.export` without `path`. */
|
|
161
|
+
path?: string;
|
|
162
|
+
/** A generated temporary partition directory returned by `Snapshots.partition`. */
|
|
163
|
+
directory?: string;
|
|
164
|
+
/** Capability returned by the generated snapshot export/partition. */
|
|
165
|
+
cleanupToken?: string | undefined;
|
|
128
166
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -17,4 +17,6 @@ export { Entries } from './client/entries.mjs';
|
|
|
17
17
|
export { formatError } from './format-error.mjs';
|
|
18
18
|
export { Sessions } from './client/sessions.mjs';
|
|
19
19
|
export { Snapshots } from './client/snapshots.mjs';
|
|
20
|
-
export
|
|
20
|
+
export { cleanupSnapshotPartitions } from './client/snapshot-partition-cleanup.mjs';
|
|
21
|
+
export { partitionSnapshot } from './client/snapshot-partitions.mjs';
|
|
22
|
+
export type { AppendEntryInput, ClientConfig, CreateSessionInput, CredentialCreated, CredentialSummary, EntryWireFormat, GetEntriesQuery, GetRawEntriesQuery, ListSessionsQuery, PatchSessionInput, ReadRetryOptions, Session, SessionEntry, StructuredEntryFormat, SnapshotCounts, SnapshotExportOptions, SnapshotExportResult, SnapshotChecksum, SnapshotCleanupOptions, SnapshotManifest, SnapshotPartition, SnapshotPartitionOptions, SnapshotPartitionResult, SnapshotSelection, SnapshotVerification, } from './client/types.mjs';
|
package/dist/index.mjs
CHANGED
|
@@ -16,3 +16,5 @@ export { Entries } from './client/entries.mjs';
|
|
|
16
16
|
export { formatError } from './format-error.mjs';
|
|
17
17
|
export { Sessions } from './client/sessions.mjs';
|
|
18
18
|
export { Snapshots } from './client/snapshots.mjs';
|
|
19
|
+
export { cleanupSnapshotPartitions } from './client/snapshot-partition-cleanup.mjs';
|
|
20
|
+
export { partitionSnapshot } from './client/snapshot-partitions.mjs';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "agent-blackboard",
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"description": "A session-scoped entry stream for autonomous agents working unmonitored, for Codex.",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Jonathan Ong",
|
|
7
|
+
"email": "jonathanrichardong@gmail.com",
|
|
8
|
+
"url": "https://github.com/jonathanong"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/jonathanong/agent-blackboard",
|
|
11
|
+
"repository": "https://github.com/jonathanong/agent-blackboard",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"keywords": ["entries", "agent", "mcp", "retrospective", "codex"],
|
|
14
|
+
"skills": "./skills/",
|
|
15
|
+
"interface": {
|
|
16
|
+
"displayName": "agent-blackboard",
|
|
17
|
+
"shortDescription": "Session entries for autonomous agents",
|
|
18
|
+
"longDescription": "Use agent-blackboard from Codex to create explicit root and subagent sessions, record entries while working, and review them later.",
|
|
19
|
+
"developerName": "Jonathan Ong",
|
|
20
|
+
"category": "Coding",
|
|
21
|
+
"capabilities": ["Interactive", "Write"],
|
|
22
|
+
"websiteURL": "https://github.com/jonathanong/agent-blackboard",
|
|
23
|
+
"privacyPolicyURL": "https://github.com/jonathanong/agent-blackboard",
|
|
24
|
+
"termsOfServiceURL": "https://github.com/jonathanong/agent-blackboard",
|
|
25
|
+
"defaultPrompt": [
|
|
26
|
+
"Record a note about what I just did",
|
|
27
|
+
"Get my entries for this session",
|
|
28
|
+
"Patch my entries with the PR number"
|
|
29
|
+
],
|
|
30
|
+
"brandColor": "#2563EB",
|
|
31
|
+
"screenshots": []
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agent-blackboard
|
|
3
|
+
description: Create sessions and record entries in agent-blackboard, an append-only stream for autonomous agent work. Use when recording progress, decisions, or findings, or reviewing a known session later.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# agent-blackboard
|
|
7
|
+
|
|
8
|
+
`agent-blackboard` is an append-only, session-scoped entry stream, not a knowledge base. This
|
|
9
|
+
skill explains how to use it; project instructions decide what is worth recording.
|
|
10
|
+
|
|
11
|
+
## How it works
|
|
12
|
+
|
|
13
|
+
- **Session ids are explicit.** The caller must choose an id and create the session before writing.
|
|
14
|
+
The service never infers or generates one.
|
|
15
|
+
- **Subagents get their own sessions.** Create each subagent session with its direct parent's id in
|
|
16
|
+
`parentSessionId`. Root sessions use `parentSessionId: null`.
|
|
17
|
+
- **Agent identity is explicit.** Every session creation includes the actual agent name and version.
|
|
18
|
+
- **Sessions can carry data.** Session patches shallow-merge a free-form `data` object.
|
|
19
|
+
- **`data` is unstructured.** Every entry carries a free-form `data` object. Attach whatever is
|
|
20
|
+
useful — a note, a branch name, a PR number, a decision and its rationale. There is no schema.
|
|
21
|
+
- **Entries are strictly append-only.** An entry's `data` cannot be changed after it is written; to
|
|
22
|
+
enrich or correct an earlier observation, append a new entry rather than editing the original.
|
|
23
|
+
Archival applies to the whole session.
|
|
24
|
+
|
|
25
|
+
## Using it via MCP
|
|
26
|
+
|
|
27
|
+
If the `agent-blackboard` MCP server is connected, use its tools directly:
|
|
28
|
+
|
|
29
|
+
- `session_create` — create a root or subagent session with explicit `sessionId` and
|
|
30
|
+
`parentSessionId` (use `null` for a root), plus `agent` and `version`.
|
|
31
|
+
- `session_search` — find undistilled or archived sessions with exact metadata, data, and optional
|
|
32
|
+
`inactiveForHours` filters.
|
|
33
|
+
- `session_patch` — shallow-merge `data` into an unarchived session.
|
|
34
|
+
- `session_archive` — mark a session as distilled; archival is one-time and metadata becomes
|
|
35
|
+
immutable.
|
|
36
|
+
- `entry_append` — append `data` to any existing session, including an archived one.
|
|
37
|
+
- `entry_get` — read entries from one explicit session.
|
|
38
|
+
- `snapshot_export` — stream all selected active sessions and entries to a private read-only JSONL
|
|
39
|
+
file, returning only its path, counts, checksum, and manifest.
|
|
40
|
+
|
|
41
|
+
## Using it via the CLI
|
|
42
|
+
|
|
43
|
+
Without MCP, or from a shell/script, run the published CLI through `npx`. This does not require a
|
|
44
|
+
local clone of the agent-blackboard repository:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npx -y agent-blackboard@0.5.0 sessions create root-123 --agent claude-code --version 1.0.13
|
|
48
|
+
npx -y agent-blackboard@0.5.0 sessions create worker-456 --parent-session-id root-123 \
|
|
49
|
+
--agent claude-code --version 1.0.13
|
|
50
|
+
npx -y agent-blackboard@0.5.0 sessions patch worker-456 --data '{"branch":"fix/retry"}'
|
|
51
|
+
npx -y agent-blackboard@0.5.0 append --session-id worker-456 '{"note":"found the failing edge case"}'
|
|
52
|
+
npx -y agent-blackboard@0.5.0 get --session-id worker-456 --format markdown
|
|
53
|
+
npx -y agent-blackboard@0.5.0 snapshot export --root-only --inactive-for-hours 8
|
|
54
|
+
npx -y agent-blackboard@0.5.0 snapshot partition --path /tmp/agent-blackboard-snapshot-<uuid>.jsonl \
|
|
55
|
+
--cleanup-token <cleanup-token>
|
|
56
|
+
npx -y agent-blackboard@0.5.0 snapshot cleanup --path /tmp/agent-blackboard-snapshot-<uuid>.jsonl \
|
|
57
|
+
--directory /tmp/agent-blackboard-partitions-<suffix> --cleanup-token <cleanup-token>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Output defaults to JSON; pass `--format jsonl` or `--format markdown` for streaming or
|
|
61
|
+
human-readable reads.
|
|
62
|
+
|
|
63
|
+
`snapshot partition` accepts only a generated temporary export path plus the cleanup token printed by
|
|
64
|
+
export, preserves whole sessions and their entry order, and creates private read-only partition
|
|
65
|
+
files. It defaults to 25 sessions or 1 MiB per partition. `snapshot cleanup` requires the same token
|
|
66
|
+
and accepts either generated artifact or both; use it when the bounded evidence is no longer needed.
|
|
67
|
+
Explicit `snapshot export --path` destinations remain available for caller-controlled export, but
|
|
68
|
+
cannot be partitioned or cleaned up by these commands.
|
|
69
|
+
|
|
70
|
+
Generated names, private modes, capabilities, and identity checks reject substitutions visible at
|
|
71
|
+
operation boundaries. Do not place snapshot artifacts where a malicious concurrent process with the
|
|
72
|
+
same operating-system user identity can swap pathnames between those checks; that race is outside
|
|
73
|
+
the pure-Node package boundary.
|
|
74
|
+
|
|
75
|
+
## What this skill does not do
|
|
76
|
+
|
|
77
|
+
This skill only covers **how** to create sessions and append and get entries. It does not prescribe
|
|
78
|
+
**what** to record — write, or look for, a project-specific skill that layers that guidance on top
|
|
79
|
+
of this one.
|
package/package.json
CHANGED