ctxpool 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ContextPool contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,154 @@
1
+ # ContextPool
2
+
3
+ ContextPool is a local-first context builder for AI-assisted engineering work.
4
+
5
+ It captures handoff packets from Codex and Claude sessions, preserves repo state and provenance, then lets you drag reusable context blocks into agent-ready prompt packs for Codex, Claude, Cursor, or any MCP-capable tool.
6
+
7
+ ## Why
8
+
9
+ AI coding sessions often lose the useful parts of prior work: task intent, decisions, constraints, files changed, verification state, blockers, and the next best action. ContextPool keeps that engineering memory local, structured, and reusable.
10
+
11
+ The wedge is not generic long-term memory. It is provenance-backed engineering continuity:
12
+
13
+ - Capture what changed, why it changed, what was verified, what failed, and what should happen next.
14
+ - Preserve local-first trust by default.
15
+ - Let users curate exactly which context goes into the next agent prompt.
16
+ - Export sync-ready packets only when the user chooses.
17
+
18
+ ## Features
19
+
20
+ - Local handoff capture from Codex and Claude JSONL sessions.
21
+ - Git snapshot capture: branch, commit, dirty files, diff stats, patches, and recent commits.
22
+ - Drag-and-drop context pack builder UI.
23
+ - Reusable context blocks for intent, instructions, decisions, constraints, verification, risks, next actions, files, and transcript snippets.
24
+ - Markdown and JSON prompt-pack export.
25
+ - Local SQL.js storage under `~/.ctxpool` by default.
26
+ - MCP tools for agents to read handoffs and curated context packs.
27
+ - Redacted team timeline export with raw transcripts excluded by default.
28
+
29
+ ## Install
30
+
31
+ Requires Node.js `>=22.5.0`.
32
+
33
+ ```sh
34
+ npm install
35
+ npm run build
36
+ node dist/cli.js init
37
+ ```
38
+
39
+ For a global npm install after publishing:
40
+
41
+ ```sh
42
+ npm install -g ctxpool
43
+ ctxpool init
44
+ ```
45
+
46
+ ## Quick Start
47
+
48
+ Capture a handoff from the current workspace:
49
+
50
+ ```sh
51
+ node dist/cli.js handoff --from codex --no-ollama
52
+ ```
53
+
54
+ Open the local context builder UI:
55
+
56
+ ```sh
57
+ node dist/cli.js ui
58
+ ```
59
+
60
+ Then open:
61
+
62
+ ```text
63
+ http://127.0.0.1:4377
64
+ ```
65
+
66
+ If the default port is busy, `ctxpool ui` tries the next few ports automatically unless a fixed `--port` is provided.
67
+
68
+ ## Context Packs
69
+
70
+ The UI turns saved handoffs into draggable context blocks. Add the useful blocks to a context pack, reorder them, disable noisy entries, and copy the generated markdown or JSON into another agent.
71
+
72
+ Raw transcript text is redacted by default in context packs. Enable raw transcript export only when the destination is trusted.
73
+
74
+ Saved packs stay local in the ContextPool store.
75
+
76
+ ## CLI
77
+
78
+ ```sh
79
+ node dist/cli.js init
80
+ node dist/cli.js handoff --from codex --no-ollama
81
+ node dist/cli.js capture --from claude --task billing-flow
82
+ node dist/cli.js ui
83
+ node dist/cli.js tasks
84
+ node dist/cli.js show latest --task billing-flow
85
+ node dist/cli.js team export --task billing-flow
86
+ node dist/cli.js mcp start
87
+ ```
88
+
89
+ `ctxpool team export` writes a sync-ready JSON packet under the local ContextPool home directory. Raw transcript entries are excluded by default:
90
+
91
+ ```sh
92
+ ctxpool team export --task my-task
93
+ ctxpool team export --task my-task --include-transcript
94
+ ```
95
+
96
+ ## MCP Tools
97
+
98
+ ContextPool exposes local MCP tools for agents:
99
+
100
+ - `get_latest_handoff`
101
+ - `get_handoff_by_task`
102
+ - `list_tasks`
103
+ - `get_task_status`
104
+ - `get_latest_agent_context`
105
+ - `get_handoff_files`
106
+ - `get_team_timeline_packet`
107
+ - `list_context_packs`
108
+ - `get_context_pack`
109
+
110
+ `get_team_timeline_packet` returns a sync-ready packet with raw transcripts excluded unless explicitly requested. `get_context_pack` returns a curated prompt pack as markdown by default or JSON when requested.
111
+
112
+ ## Privacy and Security
113
+
114
+ - ContextPool is local-first. It stores data under `~/.ctxpool` unless `CTXPOOL_HOME` is set.
115
+ - Handoff packets can include repo paths, diffs, transcript excerpts, and command output. Review exports before sharing.
116
+ - Raw transcripts are excluded from team exports by default.
117
+ - Context pack transcript blocks are redacted by default.
118
+ - The UI binds to `127.0.0.1` by default. Avoid binding to public interfaces unless you understand the local-file exposure risk.
119
+ - File preview/open APIs are restricted to repositories already captured in saved handoffs.
120
+
121
+ Security issues should be reported privately; see `SECURITY.md`.
122
+
123
+ ## Development
124
+
125
+ ```sh
126
+ npm install
127
+ npm run typecheck
128
+ npm test
129
+ npm run build
130
+ ```
131
+
132
+ Use fixture data for local UI testing:
133
+
134
+ ```sh
135
+ CTXPOOL_HOME=.ctxpool-test node dist/cli.js ui
136
+ ```
137
+
138
+ ## Release Checks
139
+
140
+ Before publishing:
141
+
142
+ ```sh
143
+ npm test
144
+ npm run typecheck
145
+ npm run build
146
+ npm audit --omit=dev
147
+ npm pack --dry-run
148
+ ```
149
+
150
+ Confirm the package contents include only intentional release files and no local stores, databases, logs, transcripts, or secrets.
151
+
152
+ ## License
153
+
154
+ MIT
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/cli.js ADDED
@@ -0,0 +1,217 @@
1
+ #!/usr/bin/env node
2
+ import { existsSync, mkdirSync, writeFileSync } from "node:fs";
3
+ import { dirname, join } from "node:path";
4
+ import { Command } from "commander";
5
+ import { copyToClipboard } from "./clipboard.js";
6
+ import { buildTeamTimelineExport, createHandoff } from "./handoff.js";
7
+ import { discoverAgentSignals } from "./logs.js";
8
+ import { ensureCtxDirs } from "./paths.js";
9
+ import { startMcpServer } from "./mcp.js";
10
+ import { openStore } from "./store.js";
11
+ import { startUi } from "./ui.js";
12
+ const program = new Command();
13
+ program
14
+ .name("ctxpool")
15
+ .description("Local-first handoff packets for AI coding agents.")
16
+ .version("0.1.0");
17
+ program.command("init").description("Create the local ContextPool store.").action(async () => {
18
+ const paths = ensureCtxDirs();
19
+ if (!existsSync(paths.configPath)) {
20
+ writeFileSync(paths.configPath, JSON.stringify({
21
+ version: 1,
22
+ ui: { host: "127.0.0.1", port: 4377 },
23
+ ollama: { model: process.env.CTXPOOL_OLLAMA_MODEL || "llama3.1" }
24
+ }, null, 2));
25
+ }
26
+ const store = await openStore();
27
+ store.close();
28
+ console.log(`ContextPool initialized at ${paths.home}`);
29
+ });
30
+ program
31
+ .command("handoff")
32
+ .description("Capture repo/task state and create a handoff packet.")
33
+ .option("--task <task>", "Task name. Defaults to git branch or repo name.")
34
+ .option("--from <agent>", "Source agent to export from: auto, codex, claude.", "auto")
35
+ .option("--session <id-or-path>", "Specific source session id or JSONL path.")
36
+ .option("--no-transcript", "Do not include the transcript excerpt in the markdown.")
37
+ .option("--to <agent>", "Target agent label, e.g. claude, codex, cursor.")
38
+ .option("--budget <tokens>", "Reserved for future token budgeting.", parseInt)
39
+ .option("--open", "Start the local observability UI after creating the handoff.")
40
+ .option("--no-ollama", "Skip optional Ollama enhancement.")
41
+ .action(async (options) => {
42
+ ensureCtxDirs();
43
+ const packet = await createHandoff({
44
+ task: options.task,
45
+ from: options.from,
46
+ session: options.session,
47
+ includeTranscript: options.transcript,
48
+ to: options.to,
49
+ budget: options.budget,
50
+ useOllama: options.ollama
51
+ });
52
+ const store = await openStore();
53
+ store.saveHandoff(packet);
54
+ store.close();
55
+ const copied = copyToClipboard(packet.markdown);
56
+ printHandoffResult(packet.task, packet.markdownPath, copied, packet.sections.nextBestAction);
57
+ if (options.open) {
58
+ await startUi();
59
+ }
60
+ });
61
+ program
62
+ .command("ui")
63
+ .description("Start the local context builder UI.")
64
+ .option("--host <host>", "Host to bind.", "127.0.0.1")
65
+ .option("--port <port>", "Port to bind.", (value) => parseInt(value, 10))
66
+ .action(async (options) => {
67
+ await startUi(options);
68
+ });
69
+ program
70
+ .command("capture")
71
+ .description("Capture current repo/task state without copying to clipboard.")
72
+ .option("--task <task>", "Task name. Defaults to git branch or repo name.")
73
+ .option("--from <agent>", "Source agent to export from: auto, codex, claude.", "auto")
74
+ .option("--session <id-or-path>", "Specific source session id or JSONL path.")
75
+ .option("--no-transcript", "Do not include the transcript excerpt in the markdown.")
76
+ .option("--no-ollama", "Skip optional Ollama enhancement.")
77
+ .action(async (options) => {
78
+ const packet = await createHandoff({
79
+ task: options.task,
80
+ from: options.from,
81
+ session: options.session,
82
+ includeTranscript: options.transcript,
83
+ useOllama: options.ollama
84
+ });
85
+ const store = await openStore();
86
+ store.saveHandoff(packet);
87
+ store.close();
88
+ console.log(`Captured ${packet.task}`);
89
+ console.log(`Saved: ${packet.markdownPath}`);
90
+ });
91
+ const importCommand = program.command("import").description("Inspect local agent logs.");
92
+ importCommand
93
+ .command("codex")
94
+ .description("Inspect recent Codex logs.")
95
+ .option("--path <path>", "Codex sessions directory.")
96
+ .option("--latest", "Only inspect the latest files.", true)
97
+ .action((options) => {
98
+ const signals = discoverAgentSignals({ codexPath: options.path, claudePath: "/__ctxpool_skip_claude__", latest: options.latest });
99
+ printSignals(signals);
100
+ });
101
+ importCommand
102
+ .command("claude")
103
+ .description("Inspect recent Claude Code logs.")
104
+ .option("--path <path>", "Claude projects directory.")
105
+ .option("--latest", "Only inspect the latest files.", true)
106
+ .action((options) => {
107
+ const signals = discoverAgentSignals({ codexPath: "/__ctxpool_skip_codex__", claudePath: options.path, latest: options.latest });
108
+ printSignals(signals);
109
+ });
110
+ program.command("tasks").description("List known handoff tasks.").action(async () => {
111
+ const store = await openStore();
112
+ try {
113
+ const tasks = store.listTasks();
114
+ if (tasks.length === 0) {
115
+ console.log("No handoff tasks found. Run `ctxpool handoff` first.");
116
+ return;
117
+ }
118
+ for (const task of tasks) {
119
+ console.log(`${task.task}\t${task.handoffCount} handoff(s)\tlatest ${task.latestAt}`);
120
+ }
121
+ }
122
+ finally {
123
+ store.close();
124
+ }
125
+ });
126
+ program.command("status").description("Show local ContextPool status.").action(async () => {
127
+ const store = await openStore();
128
+ try {
129
+ const status = store.getStatus();
130
+ console.log(`Home: ${status.home}`);
131
+ console.log(`Database: ${status.dbPath}`);
132
+ console.log(`Team exports: ${status.teamExportsDir}`);
133
+ console.log(`Tasks: ${status.taskCount}`);
134
+ console.log(`Handoffs: ${status.handoffCount}`);
135
+ }
136
+ finally {
137
+ store.close();
138
+ }
139
+ });
140
+ const show = program.command("show").description("Show saved handoffs.");
141
+ show.command("latest").description("Print the latest handoff packet.").option("--task <task>", "Task name.").action(async (options) => {
142
+ const store = await openStore();
143
+ try {
144
+ const handoff = store.getLatestHandoff(options.task);
145
+ if (!handoff) {
146
+ console.error("No handoff found. Run `ctxpool handoff` first.");
147
+ process.exitCode = 1;
148
+ return;
149
+ }
150
+ console.log(handoff.markdown);
151
+ }
152
+ finally {
153
+ store.close();
154
+ }
155
+ });
156
+ const team = program.command("team").description("Prepare local handoffs for a future ContextPool Team Timeline.");
157
+ team
158
+ .command("export")
159
+ .description("Export the latest handoff as a redacted, sync-ready team timeline packet.")
160
+ .option("--task <task>", "Task name.")
161
+ .option("--out <path>", "Output JSON path.")
162
+ .option("--include-transcript", "Include raw transcript entries in the export.", false)
163
+ .action(async (options) => {
164
+ const paths = ensureCtxDirs();
165
+ const store = await openStore();
166
+ try {
167
+ const handoff = store.getLatestHandoff(options.task);
168
+ if (!handoff) {
169
+ console.error("No handoff found. Run `ctxpool handoff` first.");
170
+ process.exitCode = 1;
171
+ return;
172
+ }
173
+ const exported = buildTeamTimelineExport(handoff, { includeRawTranscript: options.includeTranscript });
174
+ const outPath = options.out || join(paths.teamExportsDir, exported.task, `${exported.id}.json`);
175
+ mkdirSync(dirname(outPath), { recursive: true });
176
+ writeFileSync(outPath, JSON.stringify(exported, null, 2), "utf8");
177
+ console.log("ContextPool team timeline export created");
178
+ console.log("");
179
+ console.log(`Task: ${exported.task}`);
180
+ console.log(`Saved: ${outPath}`);
181
+ console.log(`Raw transcript: ${exported.engineeringMemory?.teamSync.rawTranscript || "excluded"}`);
182
+ console.log(`Sync mode: ${exported.engineeringMemory?.teamSync.mode || "sync-ready"}`);
183
+ }
184
+ finally {
185
+ store.close();
186
+ }
187
+ });
188
+ const mcp = program.command("mcp").description("Run the ContextPool MCP server.");
189
+ mcp.command("start").description("Start the stdio MCP server.").action(async () => {
190
+ await startMcpServer();
191
+ });
192
+ program.parseAsync(process.argv).catch((error) => {
193
+ console.error(error instanceof Error ? error.message : String(error));
194
+ process.exit(1);
195
+ });
196
+ function printHandoffResult(task, markdownPath, copied, nextBestAction) {
197
+ console.log("ContextPool handoff created");
198
+ console.log("");
199
+ console.log(`Task: ${task}`);
200
+ console.log(`Copied: ${copied ? "yes" : "no"}`);
201
+ console.log(`Saved: ${markdownPath}`);
202
+ console.log("");
203
+ console.log("Next best action:");
204
+ console.log(nextBestAction);
205
+ }
206
+ function printSignals(signals) {
207
+ if (signals.length === 0) {
208
+ console.log("No relevant agent log signals found.");
209
+ return;
210
+ }
211
+ for (const signal of signals) {
212
+ console.log(`${signal.source}: ${signal.path}`);
213
+ for (const snippet of signal.snippets.slice(0, 8))
214
+ console.log(` - ${sn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C,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IACjC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;AAC9B,CAAC;AAED,SAAS,YAAY,CAAC,OAAgD;IACpE,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;QACpD,OAAO;IACT,CAAC;IACD,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;QAChD,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;YAAE,OAAO,CAAC,GAAG,CAAC,OAAO,OAAO,EAAE,CAAC,CAAC;IACnF,CAAC;AACH,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function copyToClipboard(text: string): boolean;
@@ -0,0 +1,18 @@
1
+ import { spawnSync } from "node:child_process";
2
+ export function copyToClipboard(text) {
3
+ const platform = process.platform;
4
+ if (platform === "darwin")
5
+ return pipe("pbcopy", [], text);
6
+ if (platform === "win32")
7
+ return pipe("clip", [], text);
8
+ return pipe("wl-copy", [], text) || pipe("xclip", ["-selection", "clipboard"], text) || pipe("xsel", ["--clipboard", "--input"], text);
9
+ }
10
+ function pipe(command, args, input) {
11
+ const result = spawnSync(command, args, {
12
+ input,
13
+ encoding: "utf8",
14
+ stdio: ["pipe", "ignore", "ignore"]
15
+ });
16
+ return result.status === 0;
17
+ }
18
+ //# sourceMappingURL=clipboard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clipboard.js","sourceRoot":"","sources":["../src/clipboard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAClC,IAAI,QAAQ,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC,QAAQ,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;IAC3D,IAAI,QAAQ,KAAK,OAAO;QAAE,OAAO,IAAI,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;IACxD,OAAO,IAAI,CAAC,SAAS,EAAE,EAAE,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC,YAAY,EAAE,WAAW,CAAC,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,aAAa,EAAE,SAAS,CAAC,EAAE,IAAI,CAAC,CAAC;AACzI,CAAC;AAED,SAAS,IAAI,CAAC,OAAe,EAAE,IAAc,EAAE,KAAa;IAC1D,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE;QACtC,KAAK;QACL,QAAQ,EAAE,MAAM;QAChB,KAAK,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC;KACpC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,36 @@
1
+ import type { AgentSignal, ContextBlock, ContextPack, ContextPackOutput, EngineeringMemory, GitSnapshot, HandoffContinuitySummary, HandoffPacket, HandoffSections, SourceSession } from "./types.js";
2
+ import { type SessionFrom } from "./session.js";
3
+ export type CreateHandoffOptions = {
4
+ cwd?: string;
5
+ task?: string;
6
+ to?: string;
7
+ from?: SessionFrom;
8
+ session?: string;
9
+ includeTranscript?: boolean;
10
+ budget?: number;
11
+ useOllama?: boolean;
12
+ };
13
+ export declare function createHandoff(options?: CreateHandoffOptions): Promise<HandoffPacket>;
14
+ export declare function buildSections(task: string, filesTouched: string[], diffStat: string, sourceSessionOrSources: SourceSession | AgentSignal[]): HandoffSections;
15
+ export declare function renderHandoffMarkdown(packet: Omit<HandoffPacket, "markdownPath"> & {
16
+ markdownPath: string;
17
+ }, includeTranscript?: boolean): string;
18
+ export declare function normalizeHandoffPacket(packet: HandoffPacket): HandoffPacket;
19
+ export declare function buildHandoffSummary(task: string, repo: GitSnapshot, sourceSession: SourceSession | undefined, sections: HandoffSections): HandoffContinuitySummary;
20
+ export declare function renderAgentContextMarkdown(packet: HandoffPacket): string;
21
+ export declare function buildAgentContext(packet: HandoffPacket): {
22
+ markdown: string;
23
+ summary: HandoffContinuitySummary;
24
+ engineeringMemory: EngineeringMemory;
25
+ packet: HandoffPacket;
26
+ };
27
+ export declare function deriveContextBlocks(packet: HandoffPacket): ContextBlock[];
28
+ export declare function createContextPack(name: string, blocks?: ContextBlock[], options?: {
29
+ includeRawTranscript?: boolean;
30
+ }): ContextPack;
31
+ export declare function renderContextPackOutput(pack: ContextPack): ContextPackOutput;
32
+ export declare function normalizeContextPack(pack: ContextPack): ContextPack;
33
+ export declare function buildTeamTimelineExport(packet: HandoffPacket, options?: {
34
+ includeRawTranscript?: boolean;
35
+ }): HandoffPacket;
36
+ export declare function buildEngineeringMemory(task: string, repo: GitSnapshot, sourceSession: SourceSession | undefined, handoffId: string, summary: HandoffContinuitySummary): EngineeringMemory;