ctxpool 0.1.1 → 0.4.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.
Files changed (58) hide show
  1. package/README.md +94 -103
  2. package/dist/cli.js +328 -184
  3. package/dist/cli.js.map +1 -1
  4. package/dist/clipboard.js +8 -10
  5. package/dist/clipboard.js.map +1 -1
  6. package/dist/format.d.ts +32 -0
  7. package/dist/format.js +110 -0
  8. package/dist/format.js.map +1 -0
  9. package/dist/handoff.d.ts +16 -13
  10. package/dist/handoff.js +441 -706
  11. package/dist/handoff.js.map +1 -1
  12. package/dist/mcp.js +99 -221
  13. package/dist/mcp.js.map +1 -1
  14. package/dist/pack.d.ts +14 -0
  15. package/dist/pack.js +121 -0
  16. package/dist/pack.js.map +1 -0
  17. package/dist/paths.d.ts +15 -0
  18. package/dist/paths.js +35 -5
  19. package/dist/paths.js.map +1 -1
  20. package/dist/redact.d.ts +6 -0
  21. package/dist/redact.js +85 -0
  22. package/dist/redact.js.map +1 -0
  23. package/dist/repo.d.ts +6 -1
  24. package/dist/repo.js +109 -123
  25. package/dist/repo.js.map +1 -1
  26. package/dist/session.d.ts +40 -1
  27. package/dist/session.js +1295 -302
  28. package/dist/session.js.map +1 -1
  29. package/dist/store.d.ts +13 -6
  30. package/dist/store.js +88 -115
  31. package/dist/store.js.map +1 -1
  32. package/dist/text.d.ts +6 -0
  33. package/dist/text.js +25 -0
  34. package/dist/text.js.map +1 -0
  35. package/dist/types.d.ts +44 -7
  36. package/dist/ui.d.ts +10 -1
  37. package/dist/ui.js +329 -383
  38. package/dist/ui.js.map +1 -1
  39. package/dist/util.d.ts +10 -1
  40. package/dist/util.js +40 -10
  41. package/dist/util.js.map +1 -1
  42. package/dist/verify.d.ts +16 -0
  43. package/dist/verify.js +74 -0
  44. package/dist/verify.js.map +1 -0
  45. package/dist/version.d.ts +1 -0
  46. package/dist/version.js +4 -0
  47. package/dist/version.js.map +1 -0
  48. package/dist-web/assets/contextpool-mark-4vSRiUeZ.svg +1 -0
  49. package/dist-web/assets/index-BBjy_S2c.css +2 -0
  50. package/dist-web/assets/index-QwGbBEu2.js +17 -0
  51. package/dist-web/index.html +4 -3
  52. package/package.json +18 -17
  53. package/dist/logs.d.ts +0 -9
  54. package/dist/logs.js +0 -82
  55. package/dist/logs.js.map +0 -1
  56. package/dist-web/assets/contextpool-mark-Bu_00i5t.svg +0 -16
  57. package/dist-web/assets/index-BfHRocKl.js +0 -14
  58. package/dist-web/assets/index-l1QjYqDb.css +0 -2
package/README.md CHANGED
@@ -1,153 +1,144 @@
1
1
  # ContextPool
2
2
 
3
- ContextPool is a local-first context builder for AI-assisted engineering work.
3
+ Hand off AI coding sessions between agents without losing the thread.
4
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`.
5
+ ContextPool reads the Codex, Claude Code, Gemini CLI, or Antigravity CLI session you just worked in, pairs it with the repo's git state, and writes a short handoff the next agent can act on: what was asked, the plan, which checks passed or failed, what changed, and the next action. Everything stays on your machine.
32
6
 
33
7
  ```sh
34
8
  npm install -g ctxpool
35
- ctxpool init
9
+ ctxpool handoff
36
10
  ```
37
11
 
38
- For one-off usage without a global install:
39
-
40
- ```sh
41
- npx ctxpool --help
42
12
  ```
13
+ Handoff ready
43
14
 
44
- ## Quick Start
15
+ Task webhook-retries
16
+ Source Claude · Webhook retries · 4m ago
17
+ Repo billing-api · feature/webhook-retries @ 3f2c1a9 · 4 files +182 -37
18
+ Phase debugging
19
+ Checks ✗ npm test
20
+ ✓ npm run typecheck
21
+ Next Fix the failing `npm test` (AssertionError: expected 2 to equal 1), then re-run it.
45
22
 
46
- Capture a handoff from the current workspace:
47
-
48
- ```sh
49
- ctxpool handoff --from codex --no-ollama
23
+ ✓ Copied to clipboard · ~1.4k tokens
50
24
  ```
51
25
 
52
- Open the local context builder UI:
26
+ Paste it into the next agent, or let the agent fetch it over MCP.
53
27
 
54
- ```sh
55
- ctxpool ui
56
- ```
28
+ ## How it works
57
29
 
58
- Then open:
59
-
60
- ```text
61
- http://127.0.0.1:4377
62
- ```
30
+ - **Reads the agent's own records.** Plans come from the agent's to-do tools (`TodoWrite`, `update_plan`, `write_todos`). Check results come from real exit codes. Edits come from the agent's edit tools. Prose heuristics only fill gaps, and they read your messages and the agent's, never tool output.
31
+ - **Knows when checks are stale.** A pass followed by more edits is flagged as unverified. `npm test | tail` hides failures behind a 0 exit code, so piped checks are judged by their output.
32
+ - **Picks the right session.** It uses the most recent primary session started in this repo and skips subagent and reviewer threads. If more than one agent was active in the last 10 minutes, it asks which one to use.
33
+ - **Replays Gemini chats the way Gemini CLI does.** Rewound turns are dropped, and `@file` contents are left out of your prompts.
34
+ - **Redacts secrets at capture.** API keys, tokens, private keys, and credentials in URLs are redacted before anything is saved or copied. `.env` and key files never appear in diffs.
63
35
 
64
- If the default port is busy, `ctxpool ui` tries the next few ports automatically unless a fixed `--port` is provided.
36
+ ## Supported agents
65
37
 
66
- ## Context Packs
38
+ | Agent | Sessions read from |
39
+ | --- | --- |
40
+ | Codex | `~/.codex/sessions` |
41
+ | Claude Code | `~/.claude/projects` |
42
+ | Gemini CLI | `~/.gemini/tmp/<project>/chats` |
43
+ | Antigravity CLI (`agy`) | `~/.gemini/antigravity-cli/conversations` |
67
44
 
68
- 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.
45
+ Antigravity keeps each conversation in a SQLite database. ContextPool opens it without writing anything, and reads steps that `agy` has compacted out of context through the latest checkpoint summary. Older conversations saved as `.pb` files use an opaque format and are skipped. Cursor isn't supported yet.
69
46
 
70
- Raw transcript text is redacted by default in context packs. Enable raw transcript export only when the destination is trusted.
47
+ ## Commands
71
48
 
72
- Saved packs stay local in the ContextPool store.
49
+ | Command | What it does |
50
+ | --- | --- |
51
+ | `ctxpool handoff` | Capture the current session and copy the handoff to the clipboard |
52
+ | `ctxpool capture` | Same, without the clipboard |
53
+ | `ctxpool sessions` | List the sessions ContextPool can read here (`--all` for every folder) |
54
+ | `ctxpool tasks` | List tasks with saved handoffs |
55
+ | `ctxpool show [task]` | Print the latest handoff (for a task) |
56
+ | `ctxpool ui` | Open the context pack builder in your browser |
57
+ | `ctxpool team export` | Write a redacted, sync-ready JSON packet |
58
+ | `ctxpool mcp start` | Serve handoffs to agents over MCP (stdio) |
59
+ | `ctxpool status` | Show where data lives and which agents were found |
73
60
 
74
- ## CLI
61
+ Useful options for `handoff` and `capture`:
75
62
 
76
63
  ```sh
77
- ctxpool init
78
- ctxpool handoff --from codex --no-ollama
79
- ctxpool capture --from claude --task billing-flow
80
- ctxpool ui
81
- ctxpool tasks
82
- ctxpool show latest --task billing-flow
83
- ctxpool team export --task billing-flow
84
- ctxpool mcp start
64
+ ctxpool handoff --from gemini # choose the agent when several were active
65
+ ctxpool handoff --session 01a15320 # a specific session id, or a path to a session file
66
+ ctxpool handoff --task billing-flow # name the task (defaults to the branch or repo)
67
+ ctxpool handoff --budget 1500 # token budget for the transcript excerpt
68
+ ctxpool handoff --no-transcript # leave the transcript out entirely
69
+ ctxpool handoff --json # machine-readable output
85
70
  ```
86
71
 
87
- `ctxpool team export` writes a sync-ready JSON packet under the local ContextPool home directory. Raw transcript entries are excluded by default:
72
+ ## Connect an agent over MCP
88
73
 
89
74
  ```sh
90
- ctxpool team export --task my-task
91
- ctxpool team export --task my-task --include-transcript
75
+ claude mcp add contextpool -- npx -y ctxpool mcp start
76
+ codex mcp add contextpool -- npx -y ctxpool mcp start
77
+ gemini mcp add -s user contextpool npx -y ctxpool mcp start
92
78
  ```
93
79
 
94
- ## MCP Tools
80
+ All tools are read-only.
95
81
 
96
- ContextPool exposes local MCP tools for agents:
82
+ | Tool | Returns |
83
+ | --- | --- |
84
+ | `get_latest_agent_context` | The latest handoff as markdown plus a structured summary. Start here. |
85
+ | `get_latest_handoff` | The latest handoff as markdown, optionally for a task |
86
+ | `get_handoff_by_task` | The latest handoff for a task |
87
+ | `get_task_status` | Next action, blockers, and touched files for a task |
88
+ | `get_handoff_files` | Structured file changes from a handoff |
89
+ | `list_tasks` | Tasks with handoffs, newest first |
90
+ | `get_team_timeline_packet` | A redacted, sync-ready packet. The raw transcript is excluded by default. |
91
+ | `list_context_packs` | Saved context packs |
92
+ | `get_context_pack` | A context pack as markdown or JSON |
97
93
 
98
- - `get_latest_handoff`
99
- - `get_handoff_by_task`
100
- - `list_tasks`
101
- - `get_task_status`
102
- - `get_latest_agent_context`
103
- - `get_handoff_files`
104
- - `get_team_timeline_packet`
105
- - `list_context_packs`
106
- - `get_context_pack`
94
+ ## Context packs
107
95
 
108
- `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.
96
+ `ctxpool ui` turns saved handoffs into blocks (objectives, decisions, constraints, checks, changed files) that you can arrange into a reusable prompt. Transcript blocks are left out of exports unless you turn on **Include transcript** for that pack.
109
97
 
110
- ## Privacy and Security
98
+ ## Configuration
111
99
 
112
- - ContextPool is local-first. It stores data under `~/.ctxpool` unless `CTXPOOL_HOME` is set.
113
- - Handoff packets can include repo paths, diffs, transcript excerpts, and command output. Review exports before sharing.
114
- - Raw transcripts are excluded from team exports by default.
115
- - Context pack transcript blocks are redacted by default.
116
- - The UI binds to `127.0.0.1` by default. Avoid binding to public interfaces unless you understand the local-file exposure risk.
117
- - File preview/open APIs are restricted to repositories already captured in saved handoffs.
100
+ `ctxpool init` writes `~/.ctxpool/config.json`:
118
101
 
119
- Security issues should be reported privately; see `SECURITY.md`.
102
+ ```json
103
+ {
104
+ "version": 1,
105
+ "ui": { "host": "127.0.0.1", "port": 4377 },
106
+ "ollama": { "enabled": false }
107
+ }
108
+ ```
120
109
 
121
- ## Development
110
+ Set `ollama.enabled` (or pass `--ollama`) to have a local Ollama model phrase the next action. It uses `ollama.model` if set, otherwise the first installed model.
122
111
 
123
- ```sh
124
- npm install
125
- npm run typecheck
126
- npm test
127
- npm run build
128
- ```
112
+ | Variable | Purpose |
113
+ | --- | --- |
114
+ | `CTXPOOL_HOME` | Store location (default `~/.ctxpool`) |
115
+ | `CODEX_HOME` | Codex data (default `~/.codex`) |
116
+ | `CLAUDE_CONFIG_DIR` | Claude Code data (default `~/.claude`) |
117
+ | `GEMINI_CLI_HOME` | Folder that holds Gemini CLI's `.gemini` directory (default your home folder) |
118
+ | `CTXPOOL_ANTIGRAVITY_DIR` | Antigravity CLI data for ContextPool to read (default `~/.gemini/antigravity-cli`). `agy` itself ignores it. |
119
+ | `CTXPOOL_EDITOR` | Editor command for "open file" in the UI |
120
+ | `NO_COLOR` | Plain terminal output |
129
121
 
130
- When working from source, run CLI commands through the development entrypoint:
122
+ ## Privacy and security
131
123
 
132
- ```sh
133
- CTXPOOL_HOME=.ctxpool-test npm run dev -- ui
134
- npm run dev -- --version
135
- ```
124
+ - Data lives in `~/.ctxpool` with owner-only permissions. Nothing is sent anywhere.
125
+ - Secrets are redacted at capture, and again on team export for packets saved by older versions.
126
+ - The UI binds to `127.0.0.1`. It rejects requests addressed to other hostnames (DNS rebinding), cross-origin writes, and non-JSON writes. File previews are limited to repositories in saved handoffs and do not follow symlinks out of them.
136
127
 
137
- ## Release Checks
128
+ Report security issues privately; see [SECURITY.md](SECURITY.md).
129
+
130
+ ## Development
138
131
 
139
- Before publishing:
132
+ Requires Node.js 22.13 or later. The store uses the built-in `node:sqlite`.
140
133
 
141
134
  ```sh
142
- npm test
135
+ npm install
143
136
  npm run typecheck
137
+ npm test
144
138
  npm run build
145
- npm audit --omit=dev
146
- npm pack --dry-run
139
+ CTXPOOL_HOME=.ctxpool-test npm run dev -- handoff
147
140
  ```
148
141
 
149
- Confirm the package contents include only intentional release files and no local stores, databases, logs, transcripts, or secrets.
150
-
151
142
  ## License
152
143
 
153
144
  MIT