spooling 0.2.5__tar.gz → 0.2.7__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.
- {spooling-0.2.5/spooling.egg-info → spooling-0.2.7}/PKG-INFO +64 -18
- {spooling-0.2.5 → spooling-0.2.7}/README.md +63 -17
- {spooling-0.2.5 → spooling-0.2.7}/pyproject.toml +1 -1
- {spooling-0.2.5 → spooling-0.2.7}/spooling/cli.py +66 -23
- {spooling-0.2.5 → spooling-0.2.7}/spooling/cloud.py +36 -2
- {spooling-0.2.5 → spooling-0.2.7}/spooling/ingest.py +101 -7
- {spooling-0.2.5 → spooling-0.2.7}/spooling/mcp_server.py +52 -0
- spooling-0.2.7/spooling/optimize.py +159 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/parser.py +7 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/providers/base.py +7 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/providers/opencode.py +36 -1
- {spooling-0.2.5 → spooling-0.2.7}/spooling/schema.py +1 -0
- spooling-0.2.7/spooling/search.py +169 -0
- spooling-0.2.7/spooling/sessions.py +63 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/watcher.py +11 -2
- {spooling-0.2.5 → spooling-0.2.7/spooling.egg-info}/PKG-INFO +64 -18
- {spooling-0.2.5 → spooling-0.2.7}/spooling.egg-info/SOURCES.txt +4 -0
- spooling-0.2.7/tests/test_session_ids.py +135 -0
- spooling-0.2.7/tests/test_storage_optimizations.py +281 -0
- spooling-0.2.5/spooling/search.py +0 -86
- {spooling-0.2.5 → spooling-0.2.7}/LICENSE +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/setup.cfg +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/__init__.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/agent.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/classifiers.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/config.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/connectors/__init__.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/connectors/base.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/connectors/bigquery.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/connectors/clickhouse.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/connectors/factory.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/connectors/mongodb.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/connectors/mysql.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/connectors/postgresql.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/connectors/rest/__init__.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/connectors/rest/base.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/connectors/rest/shopify_connectors.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/connectors/snowflake.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/connectors/types.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/db.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/embeddings.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/evals.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/experiments.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/pricing.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/providers/__init__.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/providers/antigravity.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/providers/codex.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/providers/copilot.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/providers/cortex_code.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/providers/cursor.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/providers/gemini.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/providers/github.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/providers/gitlab.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/providers/kiro.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/providers/session_file.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/providers/windsurf.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/redact.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/remote_otel.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/sdk.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/server.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/stats.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/subscription_pricing.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/tracing.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/tunnel.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling/tunnel_auth.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling.egg-info/dependency_links.txt +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling.egg-info/entry_points.txt +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling.egg-info/requires.txt +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/spooling.egg-info/top_level.txt +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/tests/test_mcp_auth_middleware.py +0 -0
- {spooling-0.2.5 → spooling-0.2.7}/tests/test_tunnel_auth.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: spooling
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.7
|
|
4
4
|
Summary: Local session tracker and semantic search for AI coding assistants
|
|
5
5
|
Author: Parsed Analytics, Inc.
|
|
6
6
|
License: MIT
|
|
@@ -56,7 +56,7 @@ No Docker, no PostgreSQL, no Node.js required.
|
|
|
56
56
|
|
|
57
57
|
## How it works
|
|
58
58
|
|
|
59
|
-
**
|
|
59
|
+
**Three steps. Local by default.**
|
|
60
60
|
|
|
61
61
|
### 01 Install
|
|
62
62
|
|
|
@@ -82,6 +82,8 @@ spooling sync # embed every session for semantic search
|
|
|
82
82
|
|
|
83
83
|
```bash
|
|
84
84
|
spooling search "that redis race condition"
|
|
85
|
+
spooling session list # find a session and its id
|
|
86
|
+
spooling session show ses_e6310bd1 -m # read that session's full text
|
|
85
87
|
spooling stats
|
|
86
88
|
spooling mcp # MCP server at http://127.0.0.1:3004/mcp
|
|
87
89
|
```
|
|
@@ -90,7 +92,7 @@ spooling mcp # MCP server at http://127.0.0.1:3004/mcp
|
|
|
90
92
|
|
|
91
93
|
## Connect Spooling to your AI coding agent
|
|
92
94
|
|
|
93
|
-
`spooling mcp` exposes an MCP server at `http://127.0.0.1:3004/mcp` (HTTP streamable transport). Any MCP-speaking agent can connect to it and pull context from your local KB mid-conversation. The agent gets tools like `
|
|
95
|
+
`spooling mcp` exposes an MCP server at `http://127.0.0.1:3004/mcp` (HTTP streamable transport). Any MCP-speaking agent can connect to it and pull context from your local KB mid-conversation. The agent gets tools like `search_sessions` (find a session), `get_session` (read its full conversation by id), `get_stats`, and `list_traces`. See [Tools exposed](#tools-exposed) for the full list.
|
|
94
96
|
|
|
95
97
|
### Cursor / Windsurf / Codex / Antigravity
|
|
96
98
|
|
|
@@ -117,7 +119,7 @@ curl -s http://127.0.0.1:3004/mcp \
|
|
|
117
119
|
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | jq
|
|
118
120
|
```
|
|
119
121
|
|
|
120
|
-
Should return the
|
|
122
|
+
Should return the tools listed under [Tools exposed](#tools-exposed). If you get "connection refused", `spooling mcp` (or `spooling ui`) is not running, or something else is using port 3004. Find it with `lsof -i :3004`.
|
|
121
123
|
|
|
122
124
|
---
|
|
123
125
|
|
|
@@ -125,7 +127,7 @@ Should return the five `spool_*` tools. If you get "connection refused", `spooli
|
|
|
125
127
|
|
|
126
128
|
### `spooling init`
|
|
127
129
|
|
|
128
|
-
Check database
|
|
130
|
+
Check that the local database opens and show which AI coding tool providers are detected on your system. This scans the default paths for every supported provider (see [Supported Providers](#supported-providers)).
|
|
129
131
|
|
|
130
132
|
```bash
|
|
131
133
|
spooling init
|
|
@@ -154,17 +156,48 @@ spooling stats --days 30 # Last 30 days
|
|
|
154
156
|
|
|
155
157
|
### `spooling search <query>`
|
|
156
158
|
|
|
157
|
-
Semantic search across all your session history using natural language.
|
|
159
|
+
Semantic search across all your session history using natural language. Each result shows the session title **and its session id**, so you can open it with `spooling session show`.
|
|
158
160
|
|
|
159
161
|
```bash
|
|
160
162
|
spooling search "snowflake connector"
|
|
161
163
|
spooling search "authentication bug" -n 5
|
|
162
|
-
spooling search "database migration" -p
|
|
164
|
+
spooling search "database migration" -p myproject
|
|
165
|
+
spooling search ses_e6310bd1 # a session id (or prefix) matches that session first
|
|
166
|
+
spooling search "login issue" --cloud # search your cloud workspace instead
|
|
163
167
|
```
|
|
164
168
|
|
|
169
|
+
Session ids work in the query: a full id, a prefix such as `ses_e6310bd1`, or a UUID/hex prefix of 8+ characters. The matching session is ranked first and labelled `(id match)`. `--cloud` search is matched by the server, so ids are shown but not ranked first.
|
|
170
|
+
|
|
165
171
|
Options:
|
|
166
172
|
- `-n, --limit` - Number of results (default: 10)
|
|
167
|
-
- `-p, --project` - Filter by project name
|
|
173
|
+
- `-p, --project` - Filter by exact project name (see `spooling session list`)
|
|
174
|
+
- `--cloud` - Search the cloud workspace instead of the local database
|
|
175
|
+
|
|
176
|
+
### `spooling session`
|
|
177
|
+
|
|
178
|
+
List sessions and read one back by id.
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
spooling session list # newest first, with full session ids
|
|
182
|
+
spooling session list --title login -n 10 # filter by title substring
|
|
183
|
+
spooling session list --id e6310bd1 # filter by id substring
|
|
184
|
+
spooling session list --project myproject --cwd ~/code
|
|
185
|
+
|
|
186
|
+
spooling session show ses_e6310bd1 # summary: model, tokens, cost, tools used
|
|
187
|
+
spooling session show ses_e6310bd1 -m # plus the full conversation text
|
|
188
|
+
spooling session show ses_e6310bd1 -m --max-chars 300 # truncate each message
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
`session show` accepts a full session id or any unique prefix. If a prefix matches several sessions, it lists them and exits so you can pick one.
|
|
192
|
+
|
|
193
|
+
### `spooling optimize`
|
|
194
|
+
|
|
195
|
+
Compact the local database. Removes duplicated tool-call rows left by older versions (before 0.2.6), truncates oversized previews, embeds any messages missing from search, and runs `VACUUM`. A backup is written next to the database first, and it is safe to re-run. `spooling sync` prints a hint when it finds duplicates.
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
spooling optimize
|
|
199
|
+
spooling optimize --no-backup --no-vacuum --no-embed # skip individual steps
|
|
200
|
+
```
|
|
168
201
|
|
|
169
202
|
### `spooling watch`
|
|
170
203
|
|
|
@@ -336,11 +369,15 @@ the CLI ships with a `spooling cloud` subcommand.
|
|
|
336
369
|
Send the most recent local sessions up to the cloud:
|
|
337
370
|
|
|
338
371
|
```bash
|
|
339
|
-
spooling push #
|
|
372
|
+
spooling push # syncs local sessions first, then pushes 100 in batches of 20
|
|
340
373
|
spooling push --limit 500 # bigger backfill
|
|
374
|
+
spooling push --no-sync # push only what is already in the local database
|
|
375
|
+
spooling push --dry-run # show what would be pushed
|
|
341
376
|
```
|
|
342
377
|
|
|
343
|
-
The server upserts by session id, so re-running is safe.
|
|
378
|
+
`push` ingests new provider sessions into the local database before uploading, so you don't need to run `spooling sync` first. The server upserts by session id, so re-running is safe.
|
|
379
|
+
|
|
380
|
+
To bring sessions from the cloud back down, use `spooling cloud pull`, or `spooling cloud sync` for both directions.
|
|
344
381
|
|
|
345
382
|
### Watch (continuous push)
|
|
346
383
|
|
|
@@ -374,8 +411,8 @@ The cloud API at `api.spooling.ai` uses `/v1/` endpoints. Requests require a Bea
|
|
|
374
411
|
curl -s "https://api.spooling.ai/v1/stats" \
|
|
375
412
|
-H "Authorization: Bearer $SPOOLING_KEY"
|
|
376
413
|
|
|
377
|
-
# Search (
|
|
378
|
-
curl -s "https://api.spooling.ai/
|
|
414
|
+
# Search (matches session titles and ids)
|
|
415
|
+
curl -s "https://api.spooling.ai/v1/search?q=migration&limit=10" \
|
|
379
416
|
-H "Authorization: Bearer $SPOOLING_KEY"
|
|
380
417
|
```
|
|
381
418
|
|
|
@@ -450,7 +487,8 @@ the full config snippet so you don't have to remember it.
|
|
|
450
487
|
|------|---------|
|
|
451
488
|
| `list_traces` | Recent Spooling traces, filterable by provider/project |
|
|
452
489
|
| `get_trace` | Full detail for one trace: header, spans, eval scores |
|
|
453
|
-
| `search_sessions` | Semantic search over embedded session chunks |
|
|
490
|
+
| `search_sessions` | Semantic search over embedded session chunks. Results include `session_id`; a session id in the query matches that session first |
|
|
491
|
+
| `get_session` | Full detail for one session by id or unique prefix, including the conversation text (`include_messages`, `max_messages`, `max_chars`) |
|
|
454
492
|
| `get_stats` | Top-line stats: traces, tokens, cost, errors |
|
|
455
493
|
| `get_top_vendors` | Most-used external vendors by tool-call count |
|
|
456
494
|
| `list_evals` | Recent eval runs, optionally filtered by rubric |
|
|
@@ -462,8 +500,15 @@ the full config snippet so you don't have to remember it.
|
|
|
462
500
|
For MCP clients that only speak stdio, run `spooling mcp --stdio` and register
|
|
463
501
|
it with the command-based form:
|
|
464
502
|
|
|
465
|
-
```
|
|
466
|
-
|
|
503
|
+
```json
|
|
504
|
+
{
|
|
505
|
+
"mcpServers": {
|
|
506
|
+
"spooling": {
|
|
507
|
+
"command": "spooling",
|
|
508
|
+
"args": ["mcp", "--stdio"]
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
}
|
|
467
512
|
```
|
|
468
513
|
|
|
469
514
|
---
|
|
@@ -539,7 +584,9 @@ spooling/
|
|
|
539
584
|
│ ├── parser.py # Session JSONL parser
|
|
540
585
|
│ ├── embeddings.py # sentence-transformers (all-MiniLM-L6-v2)
|
|
541
586
|
│ ├── ingest.py # Sync pipeline
|
|
542
|
-
│ ├── search.py # Numpy cosine similarity search
|
|
587
|
+
│ ├── search.py # Numpy cosine similarity search (+ session-id matching)
|
|
588
|
+
│ ├── sessions.py # Session id lookup helpers
|
|
589
|
+
│ ├── optimize.py # Database dedupe / compaction
|
|
543
590
|
│ ├── stats.py # Usage statistics
|
|
544
591
|
│ ├── watcher.py # File watcher (watchdog)
|
|
545
592
|
│ ├── agent.py # Chat agent (Ollama + Anthropic)
|
|
@@ -583,7 +630,6 @@ All optional — defaults work out of the box.
|
|
|
583
630
|
| `SPOOLING_DB` | `~/.local/share/spooling/spooling.db` | Path to the SQLite database file (`%APPDATA%\spooling\spooling.db` on Windows) |
|
|
584
631
|
| `SPOOLING_EMBEDDING_MODEL` | `all-MiniLM-L6-v2` | Sentence transformer model |
|
|
585
632
|
| `SPOOLING_UI_HOST` | `127.0.0.1` | API server host |
|
|
586
|
-
| `SPOOLING_UI_PORT` | `3001` | API server port (used by `spooling serve`) |
|
|
587
633
|
| `SPOOLING_UI_DIR` | *(auto-detected)* | Path to the Next.js `ui/` directory (required for `spooling ui`) |
|
|
588
634
|
| `ANTHROPIC_API_KEY` | - | Anthropic API key (alternative to setting in the GUI) |
|
|
589
635
|
|
|
@@ -604,5 +650,5 @@ All optional — defaults work out of the box.
|
|
|
604
650
|
|
|
605
651
|
Run `spooling init` to see which providers are detected on your system.
|
|
606
652
|
|
|
607
|
-
|
|
653
|
+
Nothing leaves your machine unless you opt in: Spooling Cloud (`spooling push`), a tunnel (`spooling tunnel`), or the Anthropic chat provider. `spooling pricing refresh` downloads public model prices but sends none of your data.
|
|
608
654
|
|
|
@@ -20,7 +20,7 @@ No Docker, no PostgreSQL, no Node.js required.
|
|
|
20
20
|
|
|
21
21
|
## How it works
|
|
22
22
|
|
|
23
|
-
**
|
|
23
|
+
**Three steps. Local by default.**
|
|
24
24
|
|
|
25
25
|
### 01 Install
|
|
26
26
|
|
|
@@ -46,6 +46,8 @@ spooling sync # embed every session for semantic search
|
|
|
46
46
|
|
|
47
47
|
```bash
|
|
48
48
|
spooling search "that redis race condition"
|
|
49
|
+
spooling session list # find a session and its id
|
|
50
|
+
spooling session show ses_e6310bd1 -m # read that session's full text
|
|
49
51
|
spooling stats
|
|
50
52
|
spooling mcp # MCP server at http://127.0.0.1:3004/mcp
|
|
51
53
|
```
|
|
@@ -54,7 +56,7 @@ spooling mcp # MCP server at http://127.0.0.1:3004/mcp
|
|
|
54
56
|
|
|
55
57
|
## Connect Spooling to your AI coding agent
|
|
56
58
|
|
|
57
|
-
`spooling mcp` exposes an MCP server at `http://127.0.0.1:3004/mcp` (HTTP streamable transport). Any MCP-speaking agent can connect to it and pull context from your local KB mid-conversation. The agent gets tools like `
|
|
59
|
+
`spooling mcp` exposes an MCP server at `http://127.0.0.1:3004/mcp` (HTTP streamable transport). Any MCP-speaking agent can connect to it and pull context from your local KB mid-conversation. The agent gets tools like `search_sessions` (find a session), `get_session` (read its full conversation by id), `get_stats`, and `list_traces`. See [Tools exposed](#tools-exposed) for the full list.
|
|
58
60
|
|
|
59
61
|
### Cursor / Windsurf / Codex / Antigravity
|
|
60
62
|
|
|
@@ -81,7 +83,7 @@ curl -s http://127.0.0.1:3004/mcp \
|
|
|
81
83
|
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | jq
|
|
82
84
|
```
|
|
83
85
|
|
|
84
|
-
Should return the
|
|
86
|
+
Should return the tools listed under [Tools exposed](#tools-exposed). If you get "connection refused", `spooling mcp` (or `spooling ui`) is not running, or something else is using port 3004. Find it with `lsof -i :3004`.
|
|
85
87
|
|
|
86
88
|
---
|
|
87
89
|
|
|
@@ -89,7 +91,7 @@ Should return the five `spool_*` tools. If you get "connection refused", `spooli
|
|
|
89
91
|
|
|
90
92
|
### `spooling init`
|
|
91
93
|
|
|
92
|
-
Check database
|
|
94
|
+
Check that the local database opens and show which AI coding tool providers are detected on your system. This scans the default paths for every supported provider (see [Supported Providers](#supported-providers)).
|
|
93
95
|
|
|
94
96
|
```bash
|
|
95
97
|
spooling init
|
|
@@ -118,17 +120,48 @@ spooling stats --days 30 # Last 30 days
|
|
|
118
120
|
|
|
119
121
|
### `spooling search <query>`
|
|
120
122
|
|
|
121
|
-
Semantic search across all your session history using natural language.
|
|
123
|
+
Semantic search across all your session history using natural language. Each result shows the session title **and its session id**, so you can open it with `spooling session show`.
|
|
122
124
|
|
|
123
125
|
```bash
|
|
124
126
|
spooling search "snowflake connector"
|
|
125
127
|
spooling search "authentication bug" -n 5
|
|
126
|
-
spooling search "database migration" -p
|
|
128
|
+
spooling search "database migration" -p myproject
|
|
129
|
+
spooling search ses_e6310bd1 # a session id (or prefix) matches that session first
|
|
130
|
+
spooling search "login issue" --cloud # search your cloud workspace instead
|
|
127
131
|
```
|
|
128
132
|
|
|
133
|
+
Session ids work in the query: a full id, a prefix such as `ses_e6310bd1`, or a UUID/hex prefix of 8+ characters. The matching session is ranked first and labelled `(id match)`. `--cloud` search is matched by the server, so ids are shown but not ranked first.
|
|
134
|
+
|
|
129
135
|
Options:
|
|
130
136
|
- `-n, --limit` - Number of results (default: 10)
|
|
131
|
-
- `-p, --project` - Filter by project name
|
|
137
|
+
- `-p, --project` - Filter by exact project name (see `spooling session list`)
|
|
138
|
+
- `--cloud` - Search the cloud workspace instead of the local database
|
|
139
|
+
|
|
140
|
+
### `spooling session`
|
|
141
|
+
|
|
142
|
+
List sessions and read one back by id.
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
spooling session list # newest first, with full session ids
|
|
146
|
+
spooling session list --title login -n 10 # filter by title substring
|
|
147
|
+
spooling session list --id e6310bd1 # filter by id substring
|
|
148
|
+
spooling session list --project myproject --cwd ~/code
|
|
149
|
+
|
|
150
|
+
spooling session show ses_e6310bd1 # summary: model, tokens, cost, tools used
|
|
151
|
+
spooling session show ses_e6310bd1 -m # plus the full conversation text
|
|
152
|
+
spooling session show ses_e6310bd1 -m --max-chars 300 # truncate each message
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
`session show` accepts a full session id or any unique prefix. If a prefix matches several sessions, it lists them and exits so you can pick one.
|
|
156
|
+
|
|
157
|
+
### `spooling optimize`
|
|
158
|
+
|
|
159
|
+
Compact the local database. Removes duplicated tool-call rows left by older versions (before 0.2.6), truncates oversized previews, embeds any messages missing from search, and runs `VACUUM`. A backup is written next to the database first, and it is safe to re-run. `spooling sync` prints a hint when it finds duplicates.
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
spooling optimize
|
|
163
|
+
spooling optimize --no-backup --no-vacuum --no-embed # skip individual steps
|
|
164
|
+
```
|
|
132
165
|
|
|
133
166
|
### `spooling watch`
|
|
134
167
|
|
|
@@ -300,11 +333,15 @@ the CLI ships with a `spooling cloud` subcommand.
|
|
|
300
333
|
Send the most recent local sessions up to the cloud:
|
|
301
334
|
|
|
302
335
|
```bash
|
|
303
|
-
spooling push #
|
|
336
|
+
spooling push # syncs local sessions first, then pushes 100 in batches of 20
|
|
304
337
|
spooling push --limit 500 # bigger backfill
|
|
338
|
+
spooling push --no-sync # push only what is already in the local database
|
|
339
|
+
spooling push --dry-run # show what would be pushed
|
|
305
340
|
```
|
|
306
341
|
|
|
307
|
-
The server upserts by session id, so re-running is safe.
|
|
342
|
+
`push` ingests new provider sessions into the local database before uploading, so you don't need to run `spooling sync` first. The server upserts by session id, so re-running is safe.
|
|
343
|
+
|
|
344
|
+
To bring sessions from the cloud back down, use `spooling cloud pull`, or `spooling cloud sync` for both directions.
|
|
308
345
|
|
|
309
346
|
### Watch (continuous push)
|
|
310
347
|
|
|
@@ -338,8 +375,8 @@ The cloud API at `api.spooling.ai` uses `/v1/` endpoints. Requests require a Bea
|
|
|
338
375
|
curl -s "https://api.spooling.ai/v1/stats" \
|
|
339
376
|
-H "Authorization: Bearer $SPOOLING_KEY"
|
|
340
377
|
|
|
341
|
-
# Search (
|
|
342
|
-
curl -s "https://api.spooling.ai/
|
|
378
|
+
# Search (matches session titles and ids)
|
|
379
|
+
curl -s "https://api.spooling.ai/v1/search?q=migration&limit=10" \
|
|
343
380
|
-H "Authorization: Bearer $SPOOLING_KEY"
|
|
344
381
|
```
|
|
345
382
|
|
|
@@ -414,7 +451,8 @@ the full config snippet so you don't have to remember it.
|
|
|
414
451
|
|------|---------|
|
|
415
452
|
| `list_traces` | Recent Spooling traces, filterable by provider/project |
|
|
416
453
|
| `get_trace` | Full detail for one trace: header, spans, eval scores |
|
|
417
|
-
| `search_sessions` | Semantic search over embedded session chunks |
|
|
454
|
+
| `search_sessions` | Semantic search over embedded session chunks. Results include `session_id`; a session id in the query matches that session first |
|
|
455
|
+
| `get_session` | Full detail for one session by id or unique prefix, including the conversation text (`include_messages`, `max_messages`, `max_chars`) |
|
|
418
456
|
| `get_stats` | Top-line stats: traces, tokens, cost, errors |
|
|
419
457
|
| `get_top_vendors` | Most-used external vendors by tool-call count |
|
|
420
458
|
| `list_evals` | Recent eval runs, optionally filtered by rubric |
|
|
@@ -426,8 +464,15 @@ the full config snippet so you don't have to remember it.
|
|
|
426
464
|
For MCP clients that only speak stdio, run `spooling mcp --stdio` and register
|
|
427
465
|
it with the command-based form:
|
|
428
466
|
|
|
429
|
-
```
|
|
430
|
-
|
|
467
|
+
```json
|
|
468
|
+
{
|
|
469
|
+
"mcpServers": {
|
|
470
|
+
"spooling": {
|
|
471
|
+
"command": "spooling",
|
|
472
|
+
"args": ["mcp", "--stdio"]
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
}
|
|
431
476
|
```
|
|
432
477
|
|
|
433
478
|
---
|
|
@@ -503,7 +548,9 @@ spooling/
|
|
|
503
548
|
│ ├── parser.py # Session JSONL parser
|
|
504
549
|
│ ├── embeddings.py # sentence-transformers (all-MiniLM-L6-v2)
|
|
505
550
|
│ ├── ingest.py # Sync pipeline
|
|
506
|
-
│ ├── search.py # Numpy cosine similarity search
|
|
551
|
+
│ ├── search.py # Numpy cosine similarity search (+ session-id matching)
|
|
552
|
+
│ ├── sessions.py # Session id lookup helpers
|
|
553
|
+
│ ├── optimize.py # Database dedupe / compaction
|
|
507
554
|
│ ├── stats.py # Usage statistics
|
|
508
555
|
│ ├── watcher.py # File watcher (watchdog)
|
|
509
556
|
│ ├── agent.py # Chat agent (Ollama + Anthropic)
|
|
@@ -547,7 +594,6 @@ All optional — defaults work out of the box.
|
|
|
547
594
|
| `SPOOLING_DB` | `~/.local/share/spooling/spooling.db` | Path to the SQLite database file (`%APPDATA%\spooling\spooling.db` on Windows) |
|
|
548
595
|
| `SPOOLING_EMBEDDING_MODEL` | `all-MiniLM-L6-v2` | Sentence transformer model |
|
|
549
596
|
| `SPOOLING_UI_HOST` | `127.0.0.1` | API server host |
|
|
550
|
-
| `SPOOLING_UI_PORT` | `3001` | API server port (used by `spooling serve`) |
|
|
551
597
|
| `SPOOLING_UI_DIR` | *(auto-detected)* | Path to the Next.js `ui/` directory (required for `spooling ui`) |
|
|
552
598
|
| `ANTHROPIC_API_KEY` | - | Anthropic API key (alternative to setting in the GUI) |
|
|
553
599
|
|
|
@@ -568,5 +614,5 @@ All optional — defaults work out of the box.
|
|
|
568
614
|
|
|
569
615
|
Run `spooling init` to see which providers are detected on your system.
|
|
570
616
|
|
|
571
|
-
|
|
617
|
+
Nothing leaves your machine unless you opt in: Spooling Cloud (`spooling push`), a tunnel (`spooling tunnel`), or the Anthropic chat provider. `spooling pricing refresh` downloads public model prices but sends none of your data.
|
|
572
618
|
|
|
@@ -71,6 +71,34 @@ def sync(no_embed, provider):
|
|
|
71
71
|
do_sync(embed=not no_embed, provider_filter=provider)
|
|
72
72
|
|
|
73
73
|
|
|
74
|
+
@cli.command()
|
|
75
|
+
@click.option("--no-backup", is_flag=True, help="Skip the pre-optimize database backup")
|
|
76
|
+
@click.option("--no-vacuum", is_flag=True, help="Skip VACUUM (faster, but doesn't reclaim disk space)")
|
|
77
|
+
@click.option("--no-embed", is_flag=True, help="Skip embedding messages that are missing chunks")
|
|
78
|
+
def optimize(no_backup, no_vacuum, no_embed):
|
|
79
|
+
"""Deduplicate and compact the local database.
|
|
80
|
+
|
|
81
|
+
Removes duplicated tool-call rows left by older versions, truncates
|
|
82
|
+
oversized previews, embeds any messages missing chunks, and VACUUMs.
|
|
83
|
+
A backup is written next to the database first.
|
|
84
|
+
"""
|
|
85
|
+
from spooling.optimize import optimize as run_optimize
|
|
86
|
+
|
|
87
|
+
try:
|
|
88
|
+
s = run_optimize(
|
|
89
|
+
backup=not no_backup, vacuum=not no_vacuum, embed=not no_embed,
|
|
90
|
+
log=lambda m: console.print(m),
|
|
91
|
+
)
|
|
92
|
+
except RuntimeError as e:
|
|
93
|
+
console.print(f"[red]{e}[/red]")
|
|
94
|
+
raise SystemExit(1)
|
|
95
|
+
mb = lambda b: f"{b / 2**20:,.0f} MB"
|
|
96
|
+
console.print(
|
|
97
|
+
f"[green]Done.[/green] {mb(s['before_bytes'])} -> {mb(s['after_bytes'])} "
|
|
98
|
+
f"({mb(s['before_bytes'] - s['after_bytes'])} reclaimed)"
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
|
|
74
102
|
@cli.command()
|
|
75
103
|
def watch():
|
|
76
104
|
"""Watch for new session data and auto-sync."""
|
|
@@ -110,9 +138,13 @@ def search(query, limit, project, cloud_mode):
|
|
|
110
138
|
f"[dim]{ts[:19]}[/dim]"
|
|
111
139
|
+ (f" [cyan](cloud)[/cyan]" if source == "cloud" else "")
|
|
112
140
|
)
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
141
|
+
console.print(
|
|
142
|
+
f" [dim]Session:[/dim] {r['title'] or '(untitled)'} "
|
|
143
|
+
f"[cyan]{r['session_id']}[/cyan]"
|
|
144
|
+
+ (" [yellow](id match)[/yellow]" if r.get("match") == "session_id" else "")
|
|
145
|
+
)
|
|
146
|
+
if r.get("match") != "session_id":
|
|
147
|
+
console.print(f" {r['content']}")
|
|
116
148
|
|
|
117
149
|
|
|
118
150
|
@cli.command()
|
|
@@ -1113,8 +1145,9 @@ def session():
|
|
|
1113
1145
|
@click.option("--project", "-p", default=None, help="Filter by exact project name")
|
|
1114
1146
|
@click.option("--cwd", default=None, help="Filter by cwd substring")
|
|
1115
1147
|
@click.option("--title", default=None, help="Filter by title substring")
|
|
1148
|
+
@click.option("--id", "id_part", default=None, help="Filter by session id substring")
|
|
1116
1149
|
@click.option("--limit", "-n", default=20, help="Max sessions to return (default: 20)")
|
|
1117
|
-
def session_list(project, cwd, title, limit):
|
|
1150
|
+
def session_list(project, cwd, title, id_part, limit):
|
|
1118
1151
|
"""List local sessions with optional filters."""
|
|
1119
1152
|
from spooling.db import get_connection
|
|
1120
1153
|
from datetime import datetime as _dt
|
|
@@ -1131,6 +1164,9 @@ def session_list(project, cwd, title, limit):
|
|
|
1131
1164
|
if title:
|
|
1132
1165
|
wheres.append("title LIKE ?")
|
|
1133
1166
|
params.append(f"%{title}%")
|
|
1167
|
+
if id_part:
|
|
1168
|
+
wheres.append("id LIKE ?")
|
|
1169
|
+
params.append(f"%{id_part}%")
|
|
1134
1170
|
where_clause = ("WHERE " + " AND ".join(wheres)) if wheres else ""
|
|
1135
1171
|
params.append(limit)
|
|
1136
1172
|
|
|
@@ -1148,8 +1184,8 @@ def session_list(project, cwd, title, limit):
|
|
|
1148
1184
|
return
|
|
1149
1185
|
|
|
1150
1186
|
table = Table(title=f"Sessions ({len(rows)})", show_lines=False)
|
|
1151
|
-
table.add_column("ID", style="
|
|
1152
|
-
table.add_column("Provider"
|
|
1187
|
+
table.add_column("Session ID", style="cyan", no_wrap=True)
|
|
1188
|
+
table.add_column("Provider")
|
|
1153
1189
|
table.add_column("Project")
|
|
1154
1190
|
table.add_column("Title")
|
|
1155
1191
|
table.add_column("Started", style="dim")
|
|
@@ -1166,7 +1202,7 @@ def session_list(project, cwd, title, limit):
|
|
|
1166
1202
|
raw_ts = None
|
|
1167
1203
|
ts = raw_ts.strftime("%m/%d %H:%M") if raw_ts else ""
|
|
1168
1204
|
table.add_row(
|
|
1169
|
-
|
|
1205
|
+
r["id"] or "",
|
|
1170
1206
|
r["provider_id"] or "",
|
|
1171
1207
|
_clean_project(r["project"] or ""),
|
|
1172
1208
|
(r["title"] or "")[:45],
|
|
@@ -1180,10 +1216,21 @@ def session_list(project, cwd, title, limit):
|
|
|
1180
1216
|
|
|
1181
1217
|
@session.command("show")
|
|
1182
1218
|
@click.argument("session_id")
|
|
1183
|
-
@click.option("--messages", "-m", is_flag=True, help="
|
|
1184
|
-
|
|
1185
|
-
|
|
1219
|
+
@click.option("--messages", "-m", is_flag=True, help="Print the full session text (all messages)")
|
|
1220
|
+
@click.option("--max-chars", default=0, type=int, help="Truncate each message to N chars (0 = no limit)")
|
|
1221
|
+
def session_show(session_id, messages, max_chars):
|
|
1222
|
+
"""Show a session by id (full id or unique prefix), optionally with its full text."""
|
|
1186
1223
|
from spooling.stats import get_session_detail
|
|
1224
|
+
from spooling.sessions import resolve_session_ids
|
|
1225
|
+
|
|
1226
|
+
matches = resolve_session_ids(session_id)
|
|
1227
|
+
if len(matches) > 1:
|
|
1228
|
+
console.print(f"[yellow]'{session_id}' is ambiguous; matches:[/yellow]")
|
|
1229
|
+
for m in matches:
|
|
1230
|
+
console.print(f" {m}")
|
|
1231
|
+
raise SystemExit(1)
|
|
1232
|
+
if matches:
|
|
1233
|
+
session_id = matches[0]
|
|
1187
1234
|
|
|
1188
1235
|
detail = get_session_detail(session_id)
|
|
1189
1236
|
if not detail:
|
|
@@ -1216,23 +1263,19 @@ def session_show(session_id, messages):
|
|
|
1216
1263
|
console.print(table)
|
|
1217
1264
|
|
|
1218
1265
|
if messages and detail["messages"]:
|
|
1219
|
-
table = Table(title="Messages", show_lines=True)
|
|
1220
|
-
table.add_column("Role", style="cyan", width=10)
|
|
1221
|
-
table.add_column("Timestamp", style="dim", width=18)
|
|
1222
|
-
table.add_column("Content")
|
|
1223
1266
|
for m in detail["messages"]:
|
|
1224
|
-
|
|
1267
|
+
role = m.get("role") or ""
|
|
1268
|
+
color = "green" if role == "user" else "blue"
|
|
1269
|
+
console.print(f"\n[{color}]{role}[/{color}] [dim]{str(m.get('timestamp') or '')[:19]}[/dim]")
|
|
1270
|
+
content = m.get("content") or ""
|
|
1271
|
+
if max_chars and len(content) > max_chars:
|
|
1272
|
+
content = content[:max_chars] + "..."
|
|
1273
|
+
console.print(content, markup=False, highlight=False)
|
|
1225
1274
|
if m.get("tool_calls"):
|
|
1226
1275
|
tools = ", ".join(tc["name"] for tc in m["tool_calls"])
|
|
1227
|
-
|
|
1228
|
-
table.add_row(
|
|
1229
|
-
m.get("role", ""),
|
|
1230
|
-
str(m.get("timestamp") or "")[:18],
|
|
1231
|
-
content,
|
|
1232
|
-
)
|
|
1233
|
-
console.print(table)
|
|
1276
|
+
console.print(f"Tools: {tools}", style="dim", markup=False)
|
|
1234
1277
|
elif not messages and detail["messages"]:
|
|
1235
|
-
console.print(f"[dim]{len(detail['messages'])} messages — pass --messages to
|
|
1278
|
+
console.print(f"[dim]{len(detail['messages'])} messages — pass --messages to print the session text[/dim]")
|
|
1236
1279
|
|
|
1237
1280
|
|
|
1238
1281
|
# ---------------------------------------------------------------------------
|
|
@@ -454,6 +454,33 @@ def _push_batches(
|
|
|
454
454
|
return total, rejected, None
|
|
455
455
|
|
|
456
456
|
|
|
457
|
+
def _sync_local(log=console.print) -> None:
|
|
458
|
+
"""Ingest new/updated provider sessions into the local DB before pushing.
|
|
459
|
+
|
|
460
|
+
`push` only reads the local DB, so without this step sessions created since
|
|
461
|
+
the last `spooling sync` (or `spooling watch`) would be silently skipped.
|
|
462
|
+
Embeddings are skipped (push doesn't use them and they dominate runtime);
|
|
463
|
+
run `spooling sync` or `spooling watch` for local semantic search.
|
|
464
|
+
A failure here is non-fatal: we warn and push whatever is already local.
|
|
465
|
+
"""
|
|
466
|
+
from spooling.ingest import sync as do_sync
|
|
467
|
+
|
|
468
|
+
log("[dim]Syncing local sessions before push…[/dim]")
|
|
469
|
+
try:
|
|
470
|
+
do_sync(embed=False)
|
|
471
|
+
except Exception as e: # noqa: BLE001
|
|
472
|
+
log(f"[yellow]Local sync failed ({e}); pushing what's already in the local DB.[/yellow]")
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
_SYNC_OPTION = click.option(
|
|
476
|
+
"--sync/--no-sync",
|
|
477
|
+
"do_sync",
|
|
478
|
+
default=True,
|
|
479
|
+
show_default=True,
|
|
480
|
+
help="Ingest new provider sessions into the local DB before pushing. Use --no-sync to push only what is already local.",
|
|
481
|
+
)
|
|
482
|
+
|
|
483
|
+
|
|
457
484
|
@click.command()
|
|
458
485
|
@click.option("--limit", default=100, help="Max sessions to push per run")
|
|
459
486
|
@click.option("--batch", default=20, help="Sessions per request")
|
|
@@ -496,7 +523,8 @@ def _push_batches(
|
|
|
496
523
|
is_flag=True,
|
|
497
524
|
help="Skip the client-side secret redactor. By default spool scrubs secrets (Snowflake/AWS/GitHub/OpenAI/Anthropic/Stripe tokens, PEM private keys, KEY=VALUE lines whose key looks sensitive) before pushing. Use this only if you're sure the content is clean and you need raw values.",
|
|
498
525
|
)
|
|
499
|
-
|
|
526
|
+
@_SYNC_OPTION
|
|
527
|
+
def push(limit: int, batch: int, project: str | None, cwd_substr: str | None, title_substr: str | None, dry_run: bool, copy: bool, with_spans: bool, no_redact: bool, do_sync: bool):
|
|
500
528
|
"""Push local sessions up to Spooling Cloud.
|
|
501
529
|
|
|
502
530
|
Without filters, this pushes the most recent ``--limit`` sessions from
|
|
@@ -531,6 +559,8 @@ def push(limit: int, batch: int, project: str | None, cwd_substr: str | None, ti
|
|
|
531
559
|
return
|
|
532
560
|
headers = _auth_headers()
|
|
533
561
|
base = _api_base()
|
|
562
|
+
if do_sync:
|
|
563
|
+
_sync_local()
|
|
534
564
|
sessions = _collect_sessions(
|
|
535
565
|
limit=limit,
|
|
536
566
|
since=None,
|
|
@@ -638,7 +668,8 @@ def push(limit: int, batch: int, project: str | None, cwd_substr: str | None, ti
|
|
|
638
668
|
is_flag=True,
|
|
639
669
|
help="Skip the client-side secret redactor (see `spooling push --help`).",
|
|
640
670
|
)
|
|
641
|
-
|
|
671
|
+
@_SYNC_OPTION
|
|
672
|
+
def cloud_watch(interval: int, limit: int, batch: int, lookback: int, no_redact: bool, do_sync: bool):
|
|
642
673
|
"""Continuously push new local sessions to Spooling Cloud (Ctrl+C to stop)."""
|
|
643
674
|
headers = _auth_headers()
|
|
644
675
|
base = _api_base()
|
|
@@ -663,6 +694,9 @@ def cloud_watch(interval: int, limit: int, batch: int, lookback: int, no_redact:
|
|
|
663
694
|
headers = _auth_headers()
|
|
664
695
|
since = (watermark - timedelta(minutes=lookback)) if watermark else None
|
|
665
696
|
|
|
697
|
+
if do_sync:
|
|
698
|
+
_sync_local(log=lambda *_a, **_k: None)
|
|
699
|
+
|
|
666
700
|
try:
|
|
667
701
|
sessions = _collect_sessions(limit=limit, since=since)
|
|
668
702
|
except Exception as e:
|