agent-blackboard 0.9.1 → 0.10.1

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 CHANGED
@@ -3,7 +3,7 @@
3
3
  Client library, CLI, and MCP server for [agent-blackboard](https://github.com/jongleberry/agent-blackboard).
4
4
  Requires Node 24+ and talks to a separately deployed HTTP service over `fetch`.
5
5
 
6
- See the complete [TypeScript API reference](https://github.com/jongleberry/agent-blackboard/blob/master/docs/typescript-api.md)
6
+ See the complete [TypeScript API reference](https://github.com/jongleberry/agent-blackboard/blob/main/docs/typescript-api.md)
7
7
  for the supported public surface and tooling integration details.
8
8
 
9
9
  ```sh
@@ -18,6 +18,10 @@ export interface PartitionFormat {
18
18
  trailer(counts: {
19
19
  sessions: number;
20
20
  entries: number;
21
+ chunk?: {
22
+ index: number;
23
+ total: number;
24
+ };
21
25
  }, manifestLine: string): string;
22
26
  }
23
27
  type Obj = Record<string, unknown>;
@@ -97,7 +97,7 @@ export function formatFor(filter) {
97
97
  since: filter.since?.raw ?? null,
98
98
  repository: filter.repository?.raw ?? null,
99
99
  }),
100
- trailer: ({ sessions, entries }) => snapshotLine({ type: 'digest-summary', sessions, entries }),
100
+ trailer: ({ sessions, entries, chunk }) => snapshotLine({ type: 'digest-summary', sessions, entries, ...(chunk ? { chunk } : {}) }),
101
101
  };
102
102
  }
103
103
  /** Bytes the digest lines of a parsed snapshot JSONL would occupy, before partition framing. */
@@ -0,0 +1,13 @@
1
+ import type { PartitionFormat } from './snapshot-digest.mjs';
2
+ import { type SnapshotBlock } from './snapshot-partition-format.mjs';
3
+ import type { SnapshotManifest, SnapshotOversizedSession } from './snapshot-types.mjs';
4
+ export interface ChunkContext {
5
+ manifest: SnapshotManifest;
6
+ directory: string;
7
+ maxBytes: number;
8
+ format: PartitionFormat;
9
+ assertOutput(): Promise<void>;
10
+ }
11
+ /** Writes one oversized session as byte-bounded chunk files, all or none: when a single entry
12
+ * cannot fit, no file is written and the session is reported unchunked. */
13
+ export declare function writeChunks(context: ChunkContext, block: SnapshotBlock, ordinal: number): Promise<SnapshotOversizedSession>;
@@ -0,0 +1,129 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { constants } from 'node:fs';
3
+ import { lstat, open, rename } from 'node:fs/promises';
4
+ import { join } from 'node:path';
5
+ import { assertExactFile, assertPartitionFile } from './snapshot-partition-copy.mjs';
6
+ import { countsFor, manifestFor, snapshotLine, } from './snapshot-partition-format.mjs';
7
+ import { readLines, writeAll } from './snapshot-partition-io.mjs';
8
+ async function* blockLines(block) {
9
+ const file = await open(block.path, constants.O_RDONLY | constants.O_NOFOLLOW);
10
+ try {
11
+ const size = BigInt(block.bytes);
12
+ const expected = { dev: BigInt(block.identity.dev), ino: BigInt(block.identity.ino), size };
13
+ const message = 'staged snapshot block changed before publication';
14
+ assertExactFile(await file.stat({ bigint: true }), expected, message);
15
+ yield* readLines(file, undefined, undefined, size, 'staged snapshot block');
16
+ assertExactFile(await file.stat({ bigint: true }), expected, message);
17
+ }
18
+ finally {
19
+ await file.close();
20
+ }
21
+ }
22
+ function chunkManifest(context, entries, chunk) {
23
+ return { ...manifestFor(context.manifest, { sessions: 1, entries }), chunk };
24
+ }
25
+ function terminalFor(context, entries, chunk) {
26
+ const manifest = chunkManifest(context, entries, chunk);
27
+ const block = { sessions: 1, entries, chunk };
28
+ return context.format.trailer(block, snapshotLine({ type: 'manifest', manifest }));
29
+ }
30
+ /** Entries per chunk, or undefined when any single entry cannot fit a chunk by itself. The
31
+ * trailer is sized with the widest chunk numbers, so the real trailer never exceeds it. */
32
+ async function planChunks(context, block) {
33
+ const widest = { index: block.entries, total: block.entries };
34
+ const fits = (entries, size) => size + Buffer.byteLength(terminalFor(context, entries, widest)) <= context.maxBytes;
35
+ const plan = [];
36
+ let base = 0;
37
+ let entries = 0;
38
+ let size = 0;
39
+ let first = true;
40
+ for await (const line of blockLines(block)) {
41
+ const bytes = Buffer.byteLength(line) + 1;
42
+ if (first) {
43
+ first = false;
44
+ base = Buffer.byteLength(context.format.header) + bytes;
45
+ size = base;
46
+ continue;
47
+ }
48
+ if (fits(entries + 1, size + bytes)) {
49
+ entries += 1;
50
+ size += bytes;
51
+ continue;
52
+ }
53
+ if (entries === 0)
54
+ return undefined;
55
+ plan.push(entries);
56
+ entries = 1;
57
+ size = base + bytes;
58
+ if (!fits(1, size))
59
+ return undefined;
60
+ }
61
+ if (entries === 0)
62
+ return undefined;
63
+ plan.push(entries);
64
+ return plan;
65
+ }
66
+ async function publishChunk(context, lines, chunk, ordinal) {
67
+ const { directory, format } = context;
68
+ const entries = lines.length - 1;
69
+ const body = Buffer.from(format.header +
70
+ lines.map((line) => `${line}\n`).join('') +
71
+ terminalFor(context, entries, chunk));
72
+ const temporary = join(directory, `.oversized-${ordinal}-${chunk.index}.tmp`);
73
+ await context.assertOutput();
74
+ const file = await open(temporary, 'wx', 0o600);
75
+ let identity;
76
+ try {
77
+ await context.assertOutput();
78
+ await writeAll(file, body);
79
+ await file.sync();
80
+ await file.chmod(0o400);
81
+ await context.assertOutput();
82
+ identity = await file.stat({ bigint: true });
83
+ }
84
+ finally {
85
+ await file.close();
86
+ }
87
+ const staged = await lstat(temporary, { bigint: true });
88
+ assertPartitionFile(staged, identity, 'staged partition changed before publication');
89
+ const path = join(directory, `${format.prefix}-oversized-${ordinal}-${chunk.index}.jsonl`);
90
+ await context.assertOutput();
91
+ await rename(temporary, path);
92
+ const published = await lstat(path, { bigint: true });
93
+ assertPartitionFile(published, identity, 'partition changed during publication');
94
+ await context.assertOutput();
95
+ return {
96
+ path,
97
+ counts: countsFor({ sessions: 1, entries }, body.byteLength),
98
+ checksum: { algorithm: 'sha256', value: createHash('sha256').update(body).digest('hex') },
99
+ manifest: chunkManifest(context, entries, chunk),
100
+ ...chunk,
101
+ };
102
+ }
103
+ /** Writes one oversized session as byte-bounded chunk files, all or none: when a single entry
104
+ * cannot fit, no file is written and the session is reported unchunked. */
105
+ export async function writeChunks(context, block, ordinal) {
106
+ const summary = { sessionId: block.sessionId, entries: block.entries, bytes: block.bytes };
107
+ const plan = await planChunks(context, block);
108
+ if (!plan)
109
+ return { ...summary, chunked: false, chunks: [] };
110
+ const chunks = [];
111
+ let session = '';
112
+ let lines = [];
113
+ let first = true;
114
+ for await (const line of blockLines(block)) {
115
+ if (first) {
116
+ first = false;
117
+ session = line;
118
+ lines = [session];
119
+ continue;
120
+ }
121
+ lines.push(line);
122
+ if (lines.length - 1 === plan[chunks.length]) {
123
+ const index = chunks.length + 1;
124
+ chunks.push(await publishChunk(context, lines, { index, total: plan.length }, ordinal));
125
+ lines = [session];
126
+ }
127
+ }
128
+ return { ...summary, chunked: true, chunks };
129
+ }
@@ -14,6 +14,16 @@ export type ExactFileIdentity = {
14
14
  size: bigint;
15
15
  };
16
16
  export declare function assertExactFile(stats: ExactFileStats, expected: ExactFileIdentity, message: string): void;
17
+ type PartitionFileStats = {
18
+ isFile(): boolean;
19
+ nlink: bigint;
20
+ dev: bigint;
21
+ ino: bigint;
22
+ };
23
+ export declare function assertPartitionFile(stats: PartitionFileStats, expected: {
24
+ dev: bigint;
25
+ ino: bigint;
26
+ }, message: string): void;
17
27
  export declare function assertStagedBlockPath(block: SnapshotBlock, index: string): void;
18
28
  export declare function copyBlock(block: SnapshotBlock, output: FileHandle, hash: ReturnType<typeof createHash>): Promise<void>;
19
29
  export {};
@@ -11,6 +11,13 @@ export function assertExactFile(stats, expected, message) {
11
11
  stats.size !== expected.size)
12
12
  throw new Error(message);
13
13
  }
14
+ export function assertPartitionFile(stats, expected, message) {
15
+ if (!stats.isFile() ||
16
+ stats.nlink !== 1n ||
17
+ stats.dev !== expected.dev ||
18
+ stats.ino !== expected.ino)
19
+ throw new Error(message);
20
+ }
14
21
  const STAGED_BLOCK_NAME = /^session-[1-9][0-9]*\.jsonl$/;
15
22
  export function assertStagedBlockPath(block, index) {
16
23
  if (!isAbsolute(block.path) ||
@@ -1,17 +1,8 @@
1
1
  import { type PartitionFormat } from './snapshot-digest.mjs';
2
2
  import type { SnapshotManifest, SnapshotOversizedSession, SnapshotPartition } from './snapshot-types.mjs';
3
- type PartitionFileStats = {
4
- isFile(): boolean;
5
- nlink: bigint;
6
- dev: bigint;
7
- ino: bigint;
8
- };
9
- export declare function assertPartitionFile(stats: PartitionFileStats, expected: {
10
- dev: bigint;
11
- ino: bigint;
12
- }, message: string): void;
13
3
  /** Replays staged groups into bounded, immutable partition files. A session too large for one
14
- * partition is never split: it is left out and listed in `oversized`. */
4
+ * partition is never split across partitions: it is written alone as byte-bounded chunk files
5
+ * and listed in `oversized` (with no chunks when one entry alone cannot fit). */
15
6
  export declare function writePartitions(index: string, indexIdentity: {
16
7
  dev: string;
17
8
  ino: string;
@@ -20,4 +11,3 @@ export declare function writePartitions(index: string, indexIdentity: {
20
11
  partitions: SnapshotPartition[];
21
12
  oversized: SnapshotOversizedSession[];
22
13
  }>;
23
- export {};
@@ -6,16 +6,11 @@ import { countsFor, manifestFor, snapshotLine, } from './snapshot-partition-form
6
6
  import { readLines, writeAll } from './snapshot-partition-io.mjs';
7
7
  import { assertDirectoryIdentity, captureDirectoryIdentity } from './snapshot-artifact-removal.mjs';
8
8
  import { formatFor } from './snapshot-digest.mjs';
9
- import { assertExactFile, assertStagedBlockPath, copyBlock } from './snapshot-partition-copy.mjs';
10
- export function assertPartitionFile(stats, expected, message) {
11
- if (!stats.isFile() ||
12
- stats.nlink !== 1n ||
13
- stats.dev !== expected.dev ||
14
- stats.ino !== expected.ino)
15
- throw new Error(message);
16
- }
9
+ import { assertExactFile, assertPartitionFile, assertStagedBlockPath, copyBlock, } from './snapshot-partition-copy.mjs';
10
+ import { writeChunks } from './snapshot-partition-chunks.mjs';
17
11
  /** Replays staged groups into bounded, immutable partition files. A session too large for one
18
- * partition is never split: it is left out and listed in `oversized`. */
12
+ * partition is never split across partitions: it is written alone as byte-bounded chunk files
13
+ * and listed in `oversized` (with no chunks when one entry alone cannot fit). */
19
14
  export async function writePartitions(index, indexIdentity, manifest, directory, maxSessions, maxBytes, format = formatFor(undefined)) {
20
15
  const partitions = [];
21
16
  const oversized = [];
@@ -115,7 +110,7 @@ export async function writePartitions(index, indexIdentity, manifest, directory,
115
110
  const block = JSON.parse(sourceLine);
116
111
  assertStagedBlockPath(block, index);
117
112
  if (headerBytes.byteLength + block.bytes + Buffer.byteLength(terminalFor(block)) > maxBytes) {
118
- oversized.push({ sessionId: block.sessionId, entries: block.entries, bytes: block.bytes });
113
+ oversized.push(await writeChunks({ manifest, directory, maxBytes, format, assertOutput }, block, oversized.length + 1));
119
114
  continue;
120
115
  }
121
116
  if (active && active.block.sessions + block.sessions > maxSessions)
@@ -88,17 +88,35 @@ export interface SnapshotPartition {
88
88
  checksum: SnapshotChecksum;
89
89
  manifest: SnapshotManifest;
90
90
  }
91
+ /** One byte-bounded file holding a contiguous run of one oversized session's entries. */
92
+ export interface SnapshotChunk extends SnapshotPartition {
93
+ /** The chunk file's own manifest record, including its position. */
94
+ manifest: SnapshotManifest & {
95
+ chunk: {
96
+ index: number;
97
+ total: number;
98
+ };
99
+ };
100
+ /** 1-based position of this chunk within its session. */
101
+ index: number;
102
+ /** Number of chunk files the session was split into. */
103
+ total: number;
104
+ }
91
105
  /** A session left out of every partition because it alone exceeds `maxBytes`. */
92
106
  export interface SnapshotOversizedSession {
93
107
  sessionId: string;
94
108
  entries: number;
95
109
  /** The session's size in the partition format, without the partition header and trailer. */
96
110
  bytes: number;
111
+ /** True when the session was written as `chunks`; false when one entry cannot fit in `maxBytes`. */
112
+ chunked: boolean;
113
+ /** Files holding the session's entries in order, each with the session line; empty unless chunked. */
114
+ chunks: SnapshotChunk[];
97
115
  }
98
116
  export interface SnapshotPartitionResult {
99
117
  directory: string;
100
118
  partitions: SnapshotPartition[];
101
- /** Sessions too large for one partition, never split; read one alone with `entry_get`. */
119
+ /** Sessions too large for one partition, written alone as chunk files; when `chunked` is false read the session with `entry_get`. */
102
120
  oversized: SnapshotOversizedSession[];
103
121
  /** Capability required to clean up this generated partition directory. */
104
122
  cleanupToken: string;
@@ -27,7 +27,7 @@ export const SNAPSHOT_TOOLS = [
27
27
  },
28
28
  {
29
29
  name: 'snapshot_partition',
30
- description: 'Splits a generated temporary snapshot JSONL file into bounded session-preserving read-only partitions using the cleanupToken from snapshot_export. A session larger than maxBytes is never split: it is left out and listed in oversized (sessionId, entries, bytes); read it alone with entry_get.',
30
+ description: 'Splits a generated temporary snapshot JSONL file into bounded session-preserving read-only partitions using the cleanupToken from snapshot_export. A session larger than maxBytes never splits across partitions: it is left out and listed in oversized (sessionId, entries, bytes, chunked, chunks), and written alone as chunk files (each with the session line, a contiguous run of its entries and a chunk index/total trailer, none above maxBytes). When one entry cannot fit a chunk, chunked is false with no chunks; read that session alone with entry_get.',
31
31
  inputSchema: {
32
32
  type: 'object',
33
33
  properties: {
@@ -45,7 +45,7 @@ export const ENTRY_TOOLS = [
45
45
  name: 'session_search',
46
46
  description: 'Searches undistilled or archived sessions using exact metadata, data, and inactivity filters. Returns ' +
47
47
  'one page at a time via limit/cursor; page until nextCursor is null for the complete ' +
48
- 'result set.',
48
+ 'result set. A page may be empty while nextCursor is set, so an empty page is not the end.',
49
49
  inputSchema: {
50
50
  type: 'object',
51
51
  properties: {
@@ -2,7 +2,7 @@
2
2
  "mcpServers": {
3
3
  "agent-blackboard": {
4
4
  "command": "npx",
5
- "args": ["-y", "agent-blackboard@0.9.1", "mcp"],
5
+ "args": ["-y", "agent-blackboard@0.10.1", "mcp"],
6
6
  "env": {
7
7
  "AGENT_BLACKBOARD_URL": "${AGENT_BLACKBOARD_URL}",
8
8
  "AGENT_BLACKBOARD_TOKEN": "${AGENT_BLACKBOARD_TOKEN}"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-blackboard",
3
- "version": "0.9.1",
3
+ "version": "0.10.1",
4
4
  "description": "A session-scoped entry stream for autonomous agents working unmonitored, for Codex.",
5
5
  "author": {
6
6
  "name": "Jonathan Ong",
@@ -2,7 +2,7 @@
2
2
  "mcpServers": {
3
3
  "agent-blackboard": {
4
4
  "command": "npx",
5
- "args": ["-y", "agent-blackboard@0.9.1", "mcp"],
5
+ "args": ["-y", "agent-blackboard@0.10.1", "mcp"],
6
6
  "env_vars": ["AGENT_BLACKBOARD_URL", "AGENT_BLACKBOARD_TOKEN", "CODEX_THREAD_ID"]
7
7
  }
8
8
  }
@@ -70,17 +70,17 @@ Without MCP, or from a shell/script, run the published CLI through `npx`. This d
70
70
  local clone of the agent-blackboard repository:
71
71
 
72
72
  ```bash
73
- npx -y agent-blackboard@0.9.1 sessions create root-123 --agent claude-code --version 1.0.13
74
- npx -y agent-blackboard@0.9.1 sessions create worker-456 --parent-session-id root-123 \
73
+ npx -y agent-blackboard@0.10.1 sessions create root-123 --agent claude-code --version 1.0.13
74
+ npx -y agent-blackboard@0.10.1 sessions create worker-456 --parent-session-id root-123 \
75
75
  --agent claude-code --version 1.0.13
76
- npx -y agent-blackboard@0.9.1 sessions patch worker-456 --data '{"branch":"fix/retry"}'
77
- npx -y agent-blackboard@0.9.1 sessions patch worker-456 --data '{"repositories":["owner/name"]}'
78
- npx -y agent-blackboard@0.9.1 append --session-id worker-456 '{"repositories":["owner/name"],"note":"found the failing edge case"}'
79
- npx -y agent-blackboard@0.9.1 get --session-id worker-456 --format markdown
80
- npx -y agent-blackboard@0.9.1 snapshot export --root-only --inactive-for-hours 8
81
- npx -y agent-blackboard@0.9.1 snapshot partition --path /tmp/agent-blackboard-snapshot-<uuid>.jsonl \
76
+ npx -y agent-blackboard@0.10.1 sessions patch worker-456 --data '{"branch":"fix/retry"}'
77
+ npx -y agent-blackboard@0.10.1 sessions patch worker-456 --data '{"repositories":["owner/name"]}'
78
+ npx -y agent-blackboard@0.10.1 append --session-id worker-456 '{"repositories":["owner/name"],"note":"found the failing edge case"}'
79
+ npx -y agent-blackboard@0.10.1 get --session-id worker-456 --format markdown
80
+ npx -y agent-blackboard@0.10.1 snapshot export --root-only --inactive-for-hours 8
81
+ npx -y agent-blackboard@0.10.1 snapshot partition --path /tmp/agent-blackboard-snapshot-<uuid>.jsonl \
82
82
  --cleanup-token <cleanup-token>
83
- npx -y agent-blackboard@0.9.1 snapshot cleanup --path /tmp/agent-blackboard-snapshot-<uuid>.jsonl \
83
+ npx -y agent-blackboard@0.10.1 snapshot cleanup --path /tmp/agent-blackboard-snapshot-<uuid>.jsonl \
84
84
  --directory /tmp/agent-blackboard-partitions-<suffix> --cleanup-token <cleanup-token>
85
85
  ```
86
86
 
@@ -59,20 +59,27 @@ Run cleanup in a `finally`-style step regardless of success, empty results, or e
59
59
  `repositories`) each followed
60
60
  by that session's entries (`createdAt`, `data`). Cite an entry by its session line's `sessionId`
61
61
  plus the entry's `createdAt`.
62
- A session too large for one partition is never split or included: the response lists it in
63
- `oversized` (`sessionId`, `entries`, `bytes`) and partitions the rest. Do not raise `maxBytes`
64
- past what a small model can read. For each oversized session, dispatch one more small-model
65
- reader with the oversized-session prompt in the
66
- [output schema reference](references/output-schema.md): it reads the session once with
62
+ A session too large for one partition is left out of the partitions and listed in `oversized`
63
+ (`sessionId`, `entries`, `bytes`, `chunked`, `chunks`). When `chunked` is true its entries are
64
+ written, in order, as byte-bounded chunk files in `chunks` (`path`, `index`, `total`). Do not
65
+ raise `maxBytes` past what a small model can read. For each chunk, dispatch one small-model
66
+ reader with the partition prompt plus the chunk note in the
67
+ [output schema reference](references/output-schema.md). A chunk counts as read only when the
68
+ entry count its reader read and the count its file's last line names both equal the item's
69
+ `counts.entries`, which the reader is not told. Hold each session's chunk observations until every chunk is read, then merge them. A
70
+ session whose chunks were all read counts as distilled, like a partitioned one. When any chunk
71
+ fails or does not match, discard all of that session's chunk observations. When `chunked` is
72
+ false, or a chunk failed, dispatch one more small-model
73
+ reader with the oversized-session prompt in that reference: it reads the session once with
67
74
  `entry_get`, applies the sweep's repository filter itself, and reports `read: false` if the read
68
- fails or the session does not fit. List every oversized session in `oversizedSessions`, and
69
- never archive one in this run.
75
+ fails or the session does not fit. List each such session in `oversizedSessions`, and never
76
+ archive one in this run.
70
77
  Untagged entries are dropped for a repository sweep (tags are never inferred). Nothing matched
71
78
  only when both `partitions` and `oversized` are empty. Record `directory` from the response so cleanup removes
72
79
  both the snapshot and the partition directory.
73
80
 
74
81
  3. **Read partitions with small models, then group by root cause.**
75
- Dispatch one subagent per partition file, using a small, inexpensive model (such as Haiku) with
82
+ Dispatch one subagent per partition file (and per chunk file, above), using a small, inexpensive model (such as Haiku) with
76
83
  the prompt in the [output schema reference](references/output-schema.md). Do not read or filter
77
84
  partitions in the coordinating model. Then, as the coordinator:
78
85
  - Merge candidate observations across partitions. Entries may carry a short friction name
@@ -101,7 +108,7 @@ Run cleanup in a `finally`-style step regardless of success, empty results, or e
101
108
  and leave it out of `archivedSessions`. Record `archivedAt` for each archived session.
102
109
  - In a repository-scoped sweep, do **not** archive a session whose `data.repositories` lists
103
110
  other repositories that were not part of this sweep.
104
- - Never archive an oversized session: it was read live, not from the export.
111
+ - Never archive a session left in `oversizedSessions`: it was read live or not at all.
105
112
 
106
113
  6. **Always clean up snapshot artifacts.**
107
114
  Call `snapshot_cleanup` before returning, even if zero sessions matched or an earlier step
@@ -121,7 +128,7 @@ Run cleanup in a `finally`-style step regardless of success, empty results, or e
121
128
 
122
129
  When MCP is unavailable, run the identical sequence through the published CLI:
123
130
 
124
- - `npx -y agent-blackboard@0.9.1 snapshot export [filters...]`
125
- - `npx -y agent-blackboard@0.9.1 snapshot partition --path <path> --cleanup-token <token> --max-bytes <caller's maxBytes, or 262144> [--max-sessions <n>] --digest [--since <iso>] [--repository <owner/name>]`
126
- - `npx -y agent-blackboard@0.9.1 sessions get <id>` and `npx -y agent-blackboard@0.9.1 sessions archive <id>` (only when explicitly asked and `lastEntryAt` still matches the export)
127
- - `npx -y agent-blackboard@0.9.1 snapshot cleanup --path <path> [--directory <dir>] --cleanup-token <token>`
131
+ - `npx -y agent-blackboard@0.10.1 snapshot export [filters...]`
132
+ - `npx -y agent-blackboard@0.10.1 snapshot partition --path <path> --cleanup-token <token> --max-bytes <caller's maxBytes, or 262144> [--max-sessions <n>] --digest [--since <iso>] [--repository <owner/name>]`
133
+ - `npx -y agent-blackboard@0.10.1 sessions get <id>` and `npx -y agent-blackboard@0.10.1 sessions archive <id>` (only when explicitly asked and `lastEntryAt` still matches the export)
134
+ - `npx -y agent-blackboard@0.10.1 snapshot cleanup --path <path> [--directory <dir>] --cleanup-token <token>`
@@ -38,8 +38,10 @@ Return one JSON object to the caller:
38
38
  - `followUps`: sorted with recurring and high-severity items first. Reject vague titles like
39
39
  "improve reliability".
40
40
  - `archivedSessions`: always `[]` unless the caller explicitly requested archival.
41
- - `oversizedSessions`: every session `snapshot_partition` listed in `oversized`, with `read`
42
- `false` when its reader reported `read: false`. Never archived. `[]` when there were none.
41
+ - `oversizedSessions`: every session `snapshot_partition` listed in `oversized` that was not fully
42
+ read from its chunks (`chunked: false`, or a chunk read failed), with `read` `false` when its
43
+ `entry_get` reader reported `read: false`. Never archived. `[]` when there were none. A session
44
+ whose chunks were all read goes in `distilledSessions` instead.
43
45
  - `cleanedUp`: `true` once `snapshot_cleanup` succeeds.
44
46
 
45
47
  ## Parallel partition inspection prompt
@@ -62,10 +64,29 @@ Use null for any missing field; never invent values.
62
64
  Do not call session_archive, snapshot_cleanup, file tickets, or edit repository files.
63
65
  ```
64
66
 
67
+ ## Chunk reader prompt
68
+
69
+ A chunk file of an `oversized` session (`chunks[]`) has the same layout as a partition file: a
70
+ digest header (raw chunks have none), one session line, a run of that session's entries, and a
71
+ summary or manifest line naming `chunk: { index, total }`. Give each chunk to its own small-model
72
+ reader with the partition prompt above, with these lines added:
73
+
74
+ ```text
75
+ This file is chunk <index>/<total> of the single session <id>; other chunks hold its other entries.
76
+ Read every line. Add "entriesRead" (the number of entry lines you read) and "trailerEntries" (the
77
+ entry count the file's last line names) to your JSON object. If you cannot reach the last line,
78
+ return { "entriesRead": null, "trailerEntries": null, "observations": [] }.
79
+ ```
80
+
81
+ Do not put the chunk's entry count in the prompt. A chunk counts as read only when both
82
+ `entriesRead` and `trailerEntries` equal the `chunks[]` item's `counts.entries`. Hold the session's chunk observations until every chunk is read, then merge them. If any
83
+ chunk fails or does not match, discard all of that session's chunk observations, so none reach a
84
+ follow-up or count twice, and fall back to the oversized-session prompt below.
85
+
65
86
  ## Oversized-session prompt
66
87
 
67
- A session listed in `oversized` has no partition file. Give it its own small-model reader, once
68
- per session, with this prompt. Fill in `<repository>` for a repository sweep, or write "none":
88
+ A session listed in `oversized` with `chunked: false`, or one whose chunk read failed, has no
89
+ usable file. Give it its own small-model reader, once per session, with this prompt. Fill in `<repository>` for a repository sweep, or write "none":
69
90
 
70
91
  ```text
71
92
  Call entry_get once: { "sessionId": "<id>", "format": "jsonl" }. Do not call it again or page it.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-blackboard",
3
- "version": "0.9.1",
3
+ "version": "0.10.1",
4
4
  "description": "Client library, CLI, and MCP server for Agent Blackboard session entries.",
5
5
  "homepage": "https://github.com/jongleberry/agent-blackboard#readme",
6
6
  "bugs": {