ctxttools 0.2.1__tar.gz → 0.3.0__tar.gz
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.
- {ctxttools-0.2.1 → ctxttools-0.3.0}/PKG-INFO +58 -44
- {ctxttools-0.2.1 → ctxttools-0.3.0}/README.md +57 -42
- {ctxttools-0.2.1 → ctxttools-0.3.0}/ctools/agents.py +424 -21
- ctxttools-0.3.0/ctools/backup.py +454 -0
- {ctxttools-0.2.1 → ctxttools-0.3.0}/ctools/ccat.py +74 -47
- {ctxttools-0.2.1 → ctxttools-0.3.0}/ctools/cconnect.py +55 -32
- ctxttools-0.3.0/ctools/ccopy.py +652 -0
- {ctxttools-0.2.1 → ctxttools-0.3.0}/ctools/cdir.py +277 -74
- {ctxttools-0.2.1 → ctxttools-0.3.0}/ctools/cdu.py +35 -21
- {ctxttools-0.2.1 → ctxttools-0.3.0}/ctools/cextract.py +111 -41
- {ctxttools-0.2.1 → ctxttools-0.3.0}/ctools/cgrep.py +176 -57
- {ctxttools-0.2.1 → ctxttools-0.3.0}/ctools/cli.py +34 -22
- ctxttools-0.3.0/ctools/crecover.py +234 -0
- {ctxttools-0.2.1 → ctxttools-0.3.0}/ctools/crm.py +58 -38
- ctxttools-0.3.0/ctools/filterlib.py +432 -0
- ctxttools-0.3.0/ctools/testing.py +61 -0
- ctxttools-0.3.0/ctools/webui.py +1811 -0
- {ctxttools-0.2.1 → ctxttools-0.3.0}/ctxttools.egg-info/PKG-INFO +58 -44
- {ctxttools-0.2.1 → ctxttools-0.3.0}/ctxttools.egg-info/SOURCES.txt +4 -0
- {ctxttools-0.2.1 → ctxttools-0.3.0}/ctxttools.egg-info/entry_points.txt +2 -0
- {ctxttools-0.2.1 → ctxttools-0.3.0}/ctxttools.egg-info/requires.txt +0 -1
- {ctxttools-0.2.1 → ctxttools-0.3.0}/pyproject.toml +3 -2
- ctxttools-0.2.1/ctools/ccopy.py +0 -478
- ctxttools-0.2.1/ctools/filterlib.py +0 -116
- {ctxttools-0.2.1 → ctxttools-0.3.0}/LICENSE.MIT +0 -0
- {ctxttools-0.2.1 → ctxttools-0.3.0}/ctools/__init__.py +0 -0
- {ctxttools-0.2.1 → ctxttools-0.3.0}/ctools/ctools_mcp.py +0 -0
- {ctxttools-0.2.1 → ctxttools-0.3.0}/ctools/lib.py +0 -0
- {ctxttools-0.2.1 → ctxttools-0.3.0}/ctools/log.py +0 -0
- {ctxttools-0.2.1 → ctxttools-0.3.0}/ctools/strategy.py +0 -0
- {ctxttools-0.2.1 → ctxttools-0.3.0}/ctxttools.egg-info/dependency_links.txt +0 -0
- {ctxttools-0.2.1 → ctxttools-0.3.0}/ctxttools.egg-info/top_level.txt +0 -0
- {ctxttools-0.2.1 → ctxttools-0.3.0}/setup.cfg +0 -0
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ctxttools
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: CLI tools for LLM conversations
|
|
5
5
|
Requires-Python: >=3.10
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
7
7
|
License-File: LICENSE.MIT
|
|
8
|
-
Requires-Dist: typer>=0.9.0
|
|
9
8
|
Requires-Dist: rich>=13.0.0
|
|
10
9
|
Requires-Dist: tiktoken>=0.5.0
|
|
11
10
|
Requires-Dist: structlog>=24.0
|
|
@@ -25,9 +24,9 @@ Dynamic: license-file
|
|
|
25
24
|
</p>
|
|
26
25
|
|
|
27
26
|
------
|
|
28
|
-
**ctools** is a suite of simple tools for navigating through the sessions
|
|
27
|
+
**ctools** is a suite of simple tools for navigating through the sessions of the most popular LLM agents and coding tools. It allows you to search your history, transfer conversations, filter them, and even share them among machines and users.
|
|
29
28
|
|
|
30
|
-
It supports [Claude Desktop](https://claude.com/download), [Claude Code](https://github.com/anthropics/claude-code), [Codex](https://github.com/openai/codex), [Pi](https://github.com/earendil-works/pi), [Hermes](https://github.com/NousResearch/hermes-agent), [Goose](https://github.com/aaif-goose/goose), [Kilo](https://github.com/Kilo-Org/kilocode), [
|
|
29
|
+
It supports [Claude Desktop](https://claude.com/download), [Claude Code](https://github.com/anthropics/claude-code), [Codex](https://github.com/openai/codex), [Pi](https://github.com/earendil-works/pi), [Hermes](https://github.com/NousResearch/hermes-agent), [Goose](https://github.com/aaif-goose/goose), [Kilo](https://github.com/Kilo-Org/kilocode), [FreeBuff](https://github.com/CodebuffAI/freebuff), [Cline](https://github.com/cline/cline), [omp](https://github.com/can1357/oh-my-pi), and [OpenClaw](https://openclaw.ai/).
|
|
31
30
|
|
|
32
31
|
Here's an example:
|
|
33
32
|
|
|
@@ -58,38 +57,6 @@ Resume it with:
|
|
|
58
57
|
|
|
59
58
|
As you can see, these are unix-friendly tools using simple paradigms that you are already familiar with.
|
|
60
59
|
|
|
61
|
-
----
|
|
62
|
-
|
|
63
|
-
### 1. `cgrep` — find it in your past conversations
|
|
64
|
-
|
|
65
|
-
You already know the answer is in a session you had months ago. You just don't remember which one. `cgrep` searches **every session you ever had, across every agent you use**, with a plain regex:
|
|
66
|
-
|
|
67
|
-
```shell
|
|
68
|
-
$ cgrep -i "ssl"
|
|
69
|
-
claude-code/a351eedf:142:assistant: … the TLS handshake fails with SSL wrong version number …
|
|
70
|
-
opencode/ses_000d460f:16:user: ok graflex has an erorr in the check. i see this: … [[SSL: WRONG_VERSION_NUMBER] …
|
|
71
|
-
opencode/ses_000d460f:34:assistant: Found it. Root cause: `_check_host` (graflex/__init__.py:128) tries `http`, and …
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
No agent argument? It searches **every installed agent at once** — Claude Code, Opencode, Kilo, Codex, Pi, Goose, Hermes, Cline, omp, and Freebuff, all in one pass. That last line is the root-cause analysis you wrote six months ago and would never have found again.
|
|
75
|
-
|
|
76
|
-
### 2. `ccopy` — move your project from one tool to another
|
|
77
|
-
|
|
78
|
-
Switched from opencode to Claude Code mid-project? You don't have to start from zero. Copy the whole conversation — context, decisions, the lot — into a fresh session in the other tool:
|
|
79
|
-
|
|
80
|
-
```shell
|
|
81
|
-
$ ccopy opencode/ses_abc123 claude-code
|
|
82
|
-
Copied 128 message(s) from opencode/ses_abc123 to a new claude-code session: 1a2b3c
|
|
83
|
-
Resume it with:
|
|
84
|
-
claude-code --resume 1a2b3c
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
Your work travels with you. The source is never touched, so it's a true copy. And when the destination is on another machine, it's just `ccopy opencode/ses_abc123 ssh://chris@remote/codex` — it pulls the agent's storage over your normal ssh (the remote only needs `sshd` and `tar`, not ctools).
|
|
88
|
-
|
|
89
|
-
ctools is a set of GNU-style tools for the history your coding agents leave behind. These two are the headline; the rest (`cdir` to list sessions, `ccat` to read them, `cextract` to move concepts, `cconnect` to pipe them live, `cdu` to count tokens, `crm` to prune) are in service of them.
|
|
90
|
-
|
|
91
|
-
**Works with the agents you already use:** Claude Desktop, Claude Code, Opencode, Kilo, Codex, Pi, Goose, Hermes, Cline, omp (oh-my-pi), and Freebuff (Codebuff).
|
|
92
|
-
|
|
93
60
|
## Tools
|
|
94
61
|
|
|
95
62
|
| Tool | What it does | Docs |
|
|
@@ -102,9 +69,16 @@ ctools is a set of GNU-style tools for the history your coding agents leave behi
|
|
|
102
69
|
| `cconnect` | Live concept pipelines between sessions | [docs/cconnect.md](docs/cconnect.md) |
|
|
103
70
|
| `cdu` | Token usage per session (du for context windows) | [docs/cdu.md](docs/cdu.md) |
|
|
104
71
|
| `crm` | Remove concepts from a session (mdel) | [docs/crm.md](docs/crm.md) |
|
|
72
|
+
| `ctools-web` | Browser dashboard for all of the above | [Web dashboard](#web-dashboard) |
|
|
105
73
|
|
|
106
74
|
Every tool takes `--version`. The session-mover tools (`ccopy`, `cextract`, `cconnect`, `crm`) also take `--verbose` for structured logging. Each tool's full flag reference, output formats, and examples live in its `docs/` page — the table above is just the 30-second version.
|
|
107
75
|
|
|
76
|
+
## The problem
|
|
77
|
+
|
|
78
|
+
You talk to LLMs all day. Over weeks, you build up a set of constraints, preferences, and goals. These live in your conversations as system messages. They are valuable. They are also trapped.
|
|
79
|
+
|
|
80
|
+
Say you have been working with opencode for a month. You have refined your coding style through dozens of sessions. Now you start a new Claude Code project and you want those same preferences. You could copy them by hand. Or you could `cextract` them out and `cextract` them back in, or copy the whole conversation across with `ccopy`. Either way, your memory travels with you.
|
|
81
|
+
|
|
108
82
|
## How it works
|
|
109
83
|
|
|
110
84
|
ctools is a substrate for moving memory between context windows. Cross-platform, agent-agnostic, designed like a bus.
|
|
@@ -114,6 +88,8 @@ Two stages: **extraction** and **filtering**.
|
|
|
114
88
|
- A **strategy** extracts concepts from a conversation. It defines what counts as a concept and how to find it: regex patterns, LLM extraction, whatever. Different strategies produce different ontologies from the same conversation, because context is contestable.
|
|
115
89
|
- A **filter** selects which extracted concepts reach a destination. It's a binary classifier: pass through or filter out. One concept list can fan out to many destinations, each with its own filter. A coding agent gets coding preferences, a security agent gets security constraints, a PM agent gets goals, all from the same source.
|
|
116
90
|
|
|
91
|
+
A filter can be as simple as a type or substring match, or as smart as a **decision model** — a small local classifier that scores each concept and lets it through only when confident. Point a filter at a model and you get *semantic* filtering with no free text to parse: ask "is this concept about security?" and gate on the answer. The model is asked either through Ollama's typed `/v1/systemone` endpoint (calibrated probabilities, the home of decision-dedicated models) or through any OpenAI-compatible `/v1/chat/completions` server (portable, lettered decision-task prompt) — one `endpoint` field decides. See [cextract](docs/cextract.md) for the decision-model and JSON-RPC filter configs.
|
|
92
|
+
|
|
117
93
|
```mermaid
|
|
118
94
|
graph LR
|
|
119
95
|
SRC["source session"] --> STRAT["strategy<br/>(extraction)"]
|
|
@@ -126,13 +102,7 @@ graph LR
|
|
|
126
102
|
FC --> DEST_C["destination C"]
|
|
127
103
|
```
|
|
128
104
|
|
|
129
|
-
Context windows are endpoints: opencode, Claude Code, Codex, Pi. They all speak different protocols, but they all consume the same packets. See [cextract](docs/cextract.md) for the concept packet format, strategies, and the filter (JSON-RPC)
|
|
130
|
-
|
|
131
|
-
## The problem
|
|
132
|
-
|
|
133
|
-
You talk to LLMs all day. Over weeks, you build up a set of constraints, preferences, and goals. These live in your conversations as system messages. They are valuable. They are also trapped.
|
|
134
|
-
|
|
135
|
-
Say you have been working with opencode for a month. You have refined your coding style through dozens of sessions. Now you start a new Claude Code project and you want those same preferences. You could copy them by hand. Or you could `cextract` them out and `cextract` them back in, or copy the whole conversation across with `ccopy`. Either way, your memory travels with you.
|
|
105
|
+
Context windows are endpoints: opencode, Claude Code, Codex, Pi. They all speak different protocols, but they all consume the same packets. See [cextract](docs/cextract.md) for the concept packet format, strategies, and the filter configs (decision model and JSON-RPC).
|
|
136
106
|
|
|
137
107
|
## Supported endpoints
|
|
138
108
|
|
|
@@ -149,6 +119,12 @@ Say you have been working with opencode for a month. You have refined your codin
|
|
|
149
119
|
| cline | JSON (`~/.cline/data/tasks/`) |
|
|
150
120
|
| omp | JSONL (`~/.omp/agent/sessions/`, tree journal) |
|
|
151
121
|
| freebuff | JSON (`~/.config/<codebuff>/projects/`) |
|
|
122
|
+
| openclaw | SQLite (per-agent, `~/.openclaw/agents/`, `OPENCLAW_STATE_DIR`) |
|
|
123
|
+
|
|
124
|
+
OpenClaw is a **personal assistant** rather than a terminal coding agent, so it
|
|
125
|
+
runs in a local Gateway that owns its store; ctools reads and exports its
|
|
126
|
+
sessions but does not seed new ones (the store has canonical-index and integrity
|
|
127
|
+
checks that a raw insert cannot satisfy).
|
|
152
128
|
|
|
153
129
|
Run `cdir` to see which endpoints are found on your system and where they store data.
|
|
154
130
|
|
|
@@ -191,6 +167,37 @@ Add to your MCP config:
|
|
|
191
167
|
}
|
|
192
168
|
```
|
|
193
169
|
|
|
170
|
+
## Web dashboard
|
|
171
|
+
|
|
172
|
+
Prefer a mouse to a man page? ctools ships a browser dashboard — a small local
|
|
173
|
+
web server (Python stdlib only, no web dependencies) with the same library
|
|
174
|
+
underneath. Same on macOS, Windows, and Linux:
|
|
175
|
+
|
|
176
|
+
```sh
|
|
177
|
+
$ ctools-web # or: python -m ctools.webui
|
|
178
|
+
ctools 0.2.1 dashboard: http://127.0.0.1:8765
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Open the URL. You get four views:
|
|
182
|
+
|
|
183
|
+
- **Overview** — every supported agent, installed or not, with session counts
|
|
184
|
+
and total tokens, and a jump into each agent's sessions.
|
|
185
|
+
- **Search** — `cgrep` in the browser: one regex box, per-agent chips, live
|
|
186
|
+
matches; click any match to open that conversation.
|
|
187
|
+
- **Sessions** — `cdir` for one agent: newest, largest, or by token usage.
|
|
188
|
+
- **Conversation** — `ccat` with the source session's messages, token usage,
|
|
189
|
+
the resume command, concept extraction (`cextract`), a markdown export,
|
|
190
|
+
and **Copy** — `ccopy` to any other installed agent, which creates a fresh
|
|
191
|
+
session there (source untouched) and tells you how to resume it.
|
|
192
|
+
|
|
193
|
+
The server binds to `127.0.0.1` by default, so nothing is exposed to your
|
|
194
|
+
network unless you pass `--host 0.0.0.0`. There is one write operation:
|
|
195
|
+
Copy. Everything else is read-only against the agents' storage.
|
|
196
|
+
|
|
197
|
+
```sh
|
|
198
|
+
ctools-web --port 9000
|
|
199
|
+
```
|
|
200
|
+
|
|
194
201
|
## Installation
|
|
195
202
|
|
|
196
203
|
```sh
|
|
@@ -213,7 +220,7 @@ from ctools.lib import get_formatter
|
|
|
213
220
|
from ctools.cgrep import grep_session
|
|
214
221
|
from ctools.cextract import extract_concepts_from_messages
|
|
215
222
|
from ctools.cdu import count_tokens, get_session_tokens
|
|
216
|
-
from ctools.filterlib import JSONRPCFilter, load_filter
|
|
223
|
+
from ctools.filterlib import JSONRPCFilter, SystemOneFilter, load_filter
|
|
217
224
|
from ctools.log import configure_logging, get_logger
|
|
218
225
|
```
|
|
219
226
|
|
|
@@ -238,6 +245,13 @@ from ctools.agents import OpencodeAgent
|
|
|
238
245
|
agent = OpencodeAgent('/backup/opencode')
|
|
239
246
|
```
|
|
240
247
|
|
|
248
|
+
## Where to go next
|
|
249
|
+
|
|
250
|
+
- **Per-tool reference** — the [Tools](#tools) table above links to a `docs/` page for each command: every flag, output format, and a worked example.
|
|
251
|
+
- **The interchange format** — how a conversation becomes a portable, lossless envelope and back, and why 2N agents compose into N² transfers. See [interchange](docs/interchange.md).
|
|
252
|
+
- **Filtering with decision models** — the full decision-model and JSON-RPC filter configs, with live examples. See [cextract](docs/cextract.md#filters) and [cconnect](docs/cconnect.md#filter-configuration).
|
|
253
|
+
- **Adding an endpoint** — one `Agent` subclass plus a line in `AGENT_CLASSES`. See [Supported endpoints](#supported-endpoints).
|
|
254
|
+
|
|
241
255
|
## Credits
|
|
242
256
|
|
|
243
257
|
ctools was extracted from [Gab n' Go](https://github.com/day50-dev/gabngo). It's named after [GNU mtools](https://www.gnu.org/software/mtools/), which does the same thing for DOS floppies — because your context window is about the size of a DOS-floppy. The flag habits are GNU's too: `--version`, `-1`, `-S`, `-u`, and the rest behave the way you'd expect.
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
</p>
|
|
9
9
|
|
|
10
10
|
------
|
|
11
|
-
**ctools** is a suite of simple tools for navigating through the sessions
|
|
11
|
+
**ctools** is a suite of simple tools for navigating through the sessions of the most popular LLM agents and coding tools. It allows you to search your history, transfer conversations, filter them, and even share them among machines and users.
|
|
12
12
|
|
|
13
|
-
It supports [Claude Desktop](https://claude.com/download), [Claude Code](https://github.com/anthropics/claude-code), [Codex](https://github.com/openai/codex), [Pi](https://github.com/earendil-works/pi), [Hermes](https://github.com/NousResearch/hermes-agent), [Goose](https://github.com/aaif-goose/goose), [Kilo](https://github.com/Kilo-Org/kilocode), [
|
|
13
|
+
It supports [Claude Desktop](https://claude.com/download), [Claude Code](https://github.com/anthropics/claude-code), [Codex](https://github.com/openai/codex), [Pi](https://github.com/earendil-works/pi), [Hermes](https://github.com/NousResearch/hermes-agent), [Goose](https://github.com/aaif-goose/goose), [Kilo](https://github.com/Kilo-Org/kilocode), [FreeBuff](https://github.com/CodebuffAI/freebuff), [Cline](https://github.com/cline/cline), [omp](https://github.com/can1357/oh-my-pi), and [OpenClaw](https://openclaw.ai/).
|
|
14
14
|
|
|
15
15
|
Here's an example:
|
|
16
16
|
|
|
@@ -41,38 +41,6 @@ Resume it with:
|
|
|
41
41
|
|
|
42
42
|
As you can see, these are unix-friendly tools using simple paradigms that you are already familiar with.
|
|
43
43
|
|
|
44
|
-
----
|
|
45
|
-
|
|
46
|
-
### 1. `cgrep` — find it in your past conversations
|
|
47
|
-
|
|
48
|
-
You already know the answer is in a session you had months ago. You just don't remember which one. `cgrep` searches **every session you ever had, across every agent you use**, with a plain regex:
|
|
49
|
-
|
|
50
|
-
```shell
|
|
51
|
-
$ cgrep -i "ssl"
|
|
52
|
-
claude-code/a351eedf:142:assistant: … the TLS handshake fails with SSL wrong version number …
|
|
53
|
-
opencode/ses_000d460f:16:user: ok graflex has an erorr in the check. i see this: … [[SSL: WRONG_VERSION_NUMBER] …
|
|
54
|
-
opencode/ses_000d460f:34:assistant: Found it. Root cause: `_check_host` (graflex/__init__.py:128) tries `http`, and …
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
No agent argument? It searches **every installed agent at once** — Claude Code, Opencode, Kilo, Codex, Pi, Goose, Hermes, Cline, omp, and Freebuff, all in one pass. That last line is the root-cause analysis you wrote six months ago and would never have found again.
|
|
58
|
-
|
|
59
|
-
### 2. `ccopy` — move your project from one tool to another
|
|
60
|
-
|
|
61
|
-
Switched from opencode to Claude Code mid-project? You don't have to start from zero. Copy the whole conversation — context, decisions, the lot — into a fresh session in the other tool:
|
|
62
|
-
|
|
63
|
-
```shell
|
|
64
|
-
$ ccopy opencode/ses_abc123 claude-code
|
|
65
|
-
Copied 128 message(s) from opencode/ses_abc123 to a new claude-code session: 1a2b3c
|
|
66
|
-
Resume it with:
|
|
67
|
-
claude-code --resume 1a2b3c
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
Your work travels with you. The source is never touched, so it's a true copy. And when the destination is on another machine, it's just `ccopy opencode/ses_abc123 ssh://chris@remote/codex` — it pulls the agent's storage over your normal ssh (the remote only needs `sshd` and `tar`, not ctools).
|
|
71
|
-
|
|
72
|
-
ctools is a set of GNU-style tools for the history your coding agents leave behind. These two are the headline; the rest (`cdir` to list sessions, `ccat` to read them, `cextract` to move concepts, `cconnect` to pipe them live, `cdu` to count tokens, `crm` to prune) are in service of them.
|
|
73
|
-
|
|
74
|
-
**Works with the agents you already use:** Claude Desktop, Claude Code, Opencode, Kilo, Codex, Pi, Goose, Hermes, Cline, omp (oh-my-pi), and Freebuff (Codebuff).
|
|
75
|
-
|
|
76
44
|
## Tools
|
|
77
45
|
|
|
78
46
|
| Tool | What it does | Docs |
|
|
@@ -85,9 +53,16 @@ ctools is a set of GNU-style tools for the history your coding agents leave behi
|
|
|
85
53
|
| `cconnect` | Live concept pipelines between sessions | [docs/cconnect.md](docs/cconnect.md) |
|
|
86
54
|
| `cdu` | Token usage per session (du for context windows) | [docs/cdu.md](docs/cdu.md) |
|
|
87
55
|
| `crm` | Remove concepts from a session (mdel) | [docs/crm.md](docs/crm.md) |
|
|
56
|
+
| `ctools-web` | Browser dashboard for all of the above | [Web dashboard](#web-dashboard) |
|
|
88
57
|
|
|
89
58
|
Every tool takes `--version`. The session-mover tools (`ccopy`, `cextract`, `cconnect`, `crm`) also take `--verbose` for structured logging. Each tool's full flag reference, output formats, and examples live in its `docs/` page — the table above is just the 30-second version.
|
|
90
59
|
|
|
60
|
+
## The problem
|
|
61
|
+
|
|
62
|
+
You talk to LLMs all day. Over weeks, you build up a set of constraints, preferences, and goals. These live in your conversations as system messages. They are valuable. They are also trapped.
|
|
63
|
+
|
|
64
|
+
Say you have been working with opencode for a month. You have refined your coding style through dozens of sessions. Now you start a new Claude Code project and you want those same preferences. You could copy them by hand. Or you could `cextract` them out and `cextract` them back in, or copy the whole conversation across with `ccopy`. Either way, your memory travels with you.
|
|
65
|
+
|
|
91
66
|
## How it works
|
|
92
67
|
|
|
93
68
|
ctools is a substrate for moving memory between context windows. Cross-platform, agent-agnostic, designed like a bus.
|
|
@@ -97,6 +72,8 @@ Two stages: **extraction** and **filtering**.
|
|
|
97
72
|
- A **strategy** extracts concepts from a conversation. It defines what counts as a concept and how to find it: regex patterns, LLM extraction, whatever. Different strategies produce different ontologies from the same conversation, because context is contestable.
|
|
98
73
|
- A **filter** selects which extracted concepts reach a destination. It's a binary classifier: pass through or filter out. One concept list can fan out to many destinations, each with its own filter. A coding agent gets coding preferences, a security agent gets security constraints, a PM agent gets goals, all from the same source.
|
|
99
74
|
|
|
75
|
+
A filter can be as simple as a type or substring match, or as smart as a **decision model** — a small local classifier that scores each concept and lets it through only when confident. Point a filter at a model and you get *semantic* filtering with no free text to parse: ask "is this concept about security?" and gate on the answer. The model is asked either through Ollama's typed `/v1/systemone` endpoint (calibrated probabilities, the home of decision-dedicated models) or through any OpenAI-compatible `/v1/chat/completions` server (portable, lettered decision-task prompt) — one `endpoint` field decides. See [cextract](docs/cextract.md) for the decision-model and JSON-RPC filter configs.
|
|
76
|
+
|
|
100
77
|
```mermaid
|
|
101
78
|
graph LR
|
|
102
79
|
SRC["source session"] --> STRAT["strategy<br/>(extraction)"]
|
|
@@ -109,13 +86,7 @@ graph LR
|
|
|
109
86
|
FC --> DEST_C["destination C"]
|
|
110
87
|
```
|
|
111
88
|
|
|
112
|
-
Context windows are endpoints: opencode, Claude Code, Codex, Pi. They all speak different protocols, but they all consume the same packets. See [cextract](docs/cextract.md) for the concept packet format, strategies, and the filter (JSON-RPC)
|
|
113
|
-
|
|
114
|
-
## The problem
|
|
115
|
-
|
|
116
|
-
You talk to LLMs all day. Over weeks, you build up a set of constraints, preferences, and goals. These live in your conversations as system messages. They are valuable. They are also trapped.
|
|
117
|
-
|
|
118
|
-
Say you have been working with opencode for a month. You have refined your coding style through dozens of sessions. Now you start a new Claude Code project and you want those same preferences. You could copy them by hand. Or you could `cextract` them out and `cextract` them back in, or copy the whole conversation across with `ccopy`. Either way, your memory travels with you.
|
|
89
|
+
Context windows are endpoints: opencode, Claude Code, Codex, Pi. They all speak different protocols, but they all consume the same packets. See [cextract](docs/cextract.md) for the concept packet format, strategies, and the filter configs (decision model and JSON-RPC).
|
|
119
90
|
|
|
120
91
|
## Supported endpoints
|
|
121
92
|
|
|
@@ -132,6 +103,12 @@ Say you have been working with opencode for a month. You have refined your codin
|
|
|
132
103
|
| cline | JSON (`~/.cline/data/tasks/`) |
|
|
133
104
|
| omp | JSONL (`~/.omp/agent/sessions/`, tree journal) |
|
|
134
105
|
| freebuff | JSON (`~/.config/<codebuff>/projects/`) |
|
|
106
|
+
| openclaw | SQLite (per-agent, `~/.openclaw/agents/`, `OPENCLAW_STATE_DIR`) |
|
|
107
|
+
|
|
108
|
+
OpenClaw is a **personal assistant** rather than a terminal coding agent, so it
|
|
109
|
+
runs in a local Gateway that owns its store; ctools reads and exports its
|
|
110
|
+
sessions but does not seed new ones (the store has canonical-index and integrity
|
|
111
|
+
checks that a raw insert cannot satisfy).
|
|
135
112
|
|
|
136
113
|
Run `cdir` to see which endpoints are found on your system and where they store data.
|
|
137
114
|
|
|
@@ -174,6 +151,37 @@ Add to your MCP config:
|
|
|
174
151
|
}
|
|
175
152
|
```
|
|
176
153
|
|
|
154
|
+
## Web dashboard
|
|
155
|
+
|
|
156
|
+
Prefer a mouse to a man page? ctools ships a browser dashboard — a small local
|
|
157
|
+
web server (Python stdlib only, no web dependencies) with the same library
|
|
158
|
+
underneath. Same on macOS, Windows, and Linux:
|
|
159
|
+
|
|
160
|
+
```sh
|
|
161
|
+
$ ctools-web # or: python -m ctools.webui
|
|
162
|
+
ctools 0.2.1 dashboard: http://127.0.0.1:8765
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Open the URL. You get four views:
|
|
166
|
+
|
|
167
|
+
- **Overview** — every supported agent, installed or not, with session counts
|
|
168
|
+
and total tokens, and a jump into each agent's sessions.
|
|
169
|
+
- **Search** — `cgrep` in the browser: one regex box, per-agent chips, live
|
|
170
|
+
matches; click any match to open that conversation.
|
|
171
|
+
- **Sessions** — `cdir` for one agent: newest, largest, or by token usage.
|
|
172
|
+
- **Conversation** — `ccat` with the source session's messages, token usage,
|
|
173
|
+
the resume command, concept extraction (`cextract`), a markdown export,
|
|
174
|
+
and **Copy** — `ccopy` to any other installed agent, which creates a fresh
|
|
175
|
+
session there (source untouched) and tells you how to resume it.
|
|
176
|
+
|
|
177
|
+
The server binds to `127.0.0.1` by default, so nothing is exposed to your
|
|
178
|
+
network unless you pass `--host 0.0.0.0`. There is one write operation:
|
|
179
|
+
Copy. Everything else is read-only against the agents' storage.
|
|
180
|
+
|
|
181
|
+
```sh
|
|
182
|
+
ctools-web --port 9000
|
|
183
|
+
```
|
|
184
|
+
|
|
177
185
|
## Installation
|
|
178
186
|
|
|
179
187
|
```sh
|
|
@@ -196,7 +204,7 @@ from ctools.lib import get_formatter
|
|
|
196
204
|
from ctools.cgrep import grep_session
|
|
197
205
|
from ctools.cextract import extract_concepts_from_messages
|
|
198
206
|
from ctools.cdu import count_tokens, get_session_tokens
|
|
199
|
-
from ctools.filterlib import JSONRPCFilter, load_filter
|
|
207
|
+
from ctools.filterlib import JSONRPCFilter, SystemOneFilter, load_filter
|
|
200
208
|
from ctools.log import configure_logging, get_logger
|
|
201
209
|
```
|
|
202
210
|
|
|
@@ -221,6 +229,13 @@ from ctools.agents import OpencodeAgent
|
|
|
221
229
|
agent = OpencodeAgent('/backup/opencode')
|
|
222
230
|
```
|
|
223
231
|
|
|
232
|
+
## Where to go next
|
|
233
|
+
|
|
234
|
+
- **Per-tool reference** — the [Tools](#tools) table above links to a `docs/` page for each command: every flag, output format, and a worked example.
|
|
235
|
+
- **The interchange format** — how a conversation becomes a portable, lossless envelope and back, and why 2N agents compose into N² transfers. See [interchange](docs/interchange.md).
|
|
236
|
+
- **Filtering with decision models** — the full decision-model and JSON-RPC filter configs, with live examples. See [cextract](docs/cextract.md#filters) and [cconnect](docs/cconnect.md#filter-configuration).
|
|
237
|
+
- **Adding an endpoint** — one `Agent` subclass plus a line in `AGENT_CLASSES`. See [Supported endpoints](#supported-endpoints).
|
|
238
|
+
|
|
224
239
|
## Credits
|
|
225
240
|
|
|
226
241
|
ctools was extracted from [Gab n' Go](https://github.com/day50-dev/gabngo). It's named after [GNU mtools](https://www.gnu.org/software/mtools/), which does the same thing for DOS floppies — because your context window is about the size of a DOS-floppy. The flag habits are GNU's too: `--version`, `-1`, `-S`, `-u`, and the rest behave the way you'd expect.
|