@c3-oss/prosa 0.7.0 → 0.8.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/package.json CHANGED
@@ -1,106 +1,77 @@
1
1
  {
2
2
  "name": "@c3-oss/prosa",
3
- "version": "0.7.0",
4
- "description": "Compile, search, and export local agent session histories (Cursor, Codex, Claude Code, Gemini CLI) into a single canonical store.",
3
+ "version": "0.8.0",
4
+ "description": "Compile, search, and export local agent session histories (Cursor, Codex, Claude Code, Gemini CLI, Hermes) into a single canonical store.",
5
5
  "author": "Caian Ertl <hi@caian.org>",
6
6
  "license": "MIT",
7
+ "type": "module",
7
8
  "homepage": "https://github.com/c3-oss/prosa#readme",
8
9
  "bugs": {
9
10
  "url": "https://github.com/c3-oss/prosa/issues"
10
11
  },
11
12
  "repository": {
12
13
  "type": "git",
13
- "url": "git+https://github.com/c3-oss/prosa.git"
14
+ "url": "git+https://github.com/c3-oss/prosa.git",
15
+ "directory": "apps/cli"
14
16
  },
15
- "type": "module",
17
+ "files": [
18
+ "dist"
19
+ ],
20
+ "main": "./dist/index.js",
21
+ "types": "./dist/index.d.ts",
16
22
  "exports": {
17
23
  ".": {
18
24
  "import": "./dist/index.js",
19
25
  "types": "./dist/index.d.ts"
20
26
  }
21
27
  },
22
- "main": "./dist/index.js",
23
- "types": "./dist/index.d.ts",
24
28
  "bin": {
25
29
  "prosa": "./dist/bin/prosa.js"
26
30
  },
27
- "files": [
28
- "dist"
29
- ],
31
+ "typedocOptions": {
32
+ "entryPoints": [
33
+ "src/index.ts"
34
+ ],
35
+ "tsconfig": "tsconfig.json"
36
+ },
30
37
  "publishConfig": {
31
38
  "access": "public",
32
39
  "registry": "https://registry.npmjs.org/"
33
40
  },
34
- "engines": {
35
- "node": ">=22.15.1 <27"
36
- },
37
41
  "dependencies": {
38
- "@duckdb/node-api": "1.5.2-r.1",
39
- "@modelcontextprotocol/sdk": "^1.29.0",
40
- "@noble/hashes": "^1.7.0",
41
- "@oxdev03/node-tantivy-binding": "0.2.0",
42
- "better-sqlite3": "^12.10.0",
42
+ "@inkjs/ui": "^2.0.0",
43
43
  "commander": "^12.1.0",
44
- "filtrex": "^3.1.0",
45
44
  "ink": "^7.0.1",
46
45
  "pino": "^10.3.1",
47
46
  "pino-pretty": "^13.1.3",
48
47
  "react": "^19.2.5",
49
- "zod": "^3.23.8",
50
- "zstd-napi": "^0.0.10"
48
+ "@c3-oss/prosa-core": "^0.8.0",
49
+ "@c3-oss/prosa-sync": "^0.0.0"
51
50
  },
52
51
  "devDependencies": {
53
- "@biomejs/biome": "^1.9.4",
54
52
  "@c3-oss/config-biome": "^0.3.1",
55
53
  "@c3-oss/config-tsup": "^0.2.0",
56
54
  "@c3-oss/config-typescript": "^0.1.0",
57
55
  "@c3-oss/config-vitest": "^0.3.0",
58
- "@changesets/cli": "^2.29.7",
59
- "@commitlint/cli": "^20.5.3",
60
- "@commitlint/config-conventional": "^20.5.3",
61
- "@commitlint/cz-commitlint": "^20.5.3",
62
- "@swc-node/register": "^1.10.10",
63
- "@swc/core": "^1.13.5",
56
+ "@aws-sdk/client-s3": "^3.700.0",
57
+ "@electric-sql/pglite": "^0.4.5",
58
+ "postgres": "^3.4.9",
64
59
  "@types/better-sqlite3": "^7.6.12",
65
- "@types/node": "^22.10.0",
66
60
  "@types/react": "^19.2.14",
67
- "@vitest/coverage-v8": "2.1.9",
68
- "commitizen": "^4.3.1",
69
- "husky": "^9.1.7",
70
- "inquirer": "^9.3.8",
71
- "lint-staged": "^17.0.2",
72
- "tsup": "^8.5.0",
73
- "typescript": "^5.7.0",
74
- "vitest": "^2.1.0"
75
- },
76
- "optionalDependencies": {
77
- "@oxdev03/node-tantivy-binding-darwin-arm64": "0.2.0",
78
- "@oxdev03/node-tantivy-binding-darwin-x64": "0.2.0",
79
- "@oxdev03/node-tantivy-binding-linux-x64-gnu": "0.2.0",
80
- "@oxdev03/node-tantivy-binding-win32-x64-msvc": "0.2.0"
81
- },
82
- "config": {
83
- "commitizen": {
84
- "path": "@commitlint/cz-commitlint"
85
- }
86
- },
87
- "lint-staged": {
88
- "*.{ts,tsx,js,jsx,json,jsonc}": "biome check --write"
61
+ "better-sqlite3": "^12.10.0",
62
+ "@c3-oss/prosa-db": "^0.0.0",
63
+ "@c3-oss/prosa-api": "^0.0.0",
64
+ "@c3-oss/prosa-storage": "^0.0.0"
89
65
  },
90
66
  "scripts": {
91
- "dev": "node --import @swc-node/register/esm-register src/bin/prosa.ts",
67
+ "dev": "node --conditions=prosa-dev --import @swc-node/register/esm-register src/bin/prosa.ts",
92
68
  "build": "tsup",
93
- "lint": "biome check .",
94
- "lint:fix": "biome check --fix .",
95
- "format": "biome format --write .",
69
+ "typecheck": "tsc --noEmit",
96
70
  "test": "vitest run",
97
71
  "test:watch": "vitest",
98
72
  "test:coverage": "vitest run --coverage",
99
- "typecheck": "tsc --noEmit",
100
- "clean": "rm -rf coverage dist .turbo",
101
- "changeset": "changeset",
102
- "version-packages": "changeset version",
103
- "release": "pnpm build && changeset publish",
104
- "commit": "cz"
73
+ "lint": "biome check .",
74
+ "lint:fix": "biome check --fix .",
75
+ "clean": "rm -rf dist coverage .turbo"
105
76
  }
106
77
  }
package/README.md DELETED
@@ -1,363 +0,0 @@
1
- # prosa - Query your agent history. Keep the raw trail.
2
-
3
- [![npm version](https://img.shields.io/npm/v/@c3-oss/prosa.svg)](https://www.npmjs.com/package/@c3-oss/prosa)
4
- [![Node version](https://img.shields.io/node/v/@c3-oss/prosa.svg)](https://www.npmjs.com/package/@c3-oss/prosa)
5
- [![License](https://img.shields.io/npm/l/@c3-oss/prosa.svg)](https://www.npmjs.com/package/@c3-oss/prosa)
6
-
7
- `prosa` imports local AI agent session histories into one durable, searchable
8
- bundle on your machine.
9
-
10
- It understands Codex CLI, Claude Code, Gemini CLI, and Cursor. It preserves the
11
- original raw files, normalizes sessions into SQLite, builds search indexes,
12
- exports readable transcripts, writes Parquet for DuckDB, opens a terminal UI,
13
- and serves the same local memory over MCP.
14
-
15
- Use it when you want to know what your agents already did, which files or
16
- commands they touched, where a failure happened, or how to reuse prior work
17
- without reading provider-specific JSONL and SQLite files by hand.
18
-
19
- Package: [`@c3-oss/prosa`](https://www.npmjs.com/package/@c3-oss/prosa)
20
-
21
- ## Installation
22
-
23
- Install the published package globally:
24
-
25
- ```bash
26
- npm install -g @c3-oss/prosa
27
- ```
28
-
29
- Or run it without a global install:
30
-
31
- ```bash
32
- npx --package @c3-oss/prosa prosa --help
33
- ```
34
-
35
- The package provides the `prosa` binary and requires Node.js 22.15.1 through
36
- 26.x.
37
-
38
- ## Quickstart
39
-
40
- Build a local bundle from every supported default history location:
41
-
42
- ```bash
43
- prosa init
44
- prosa compile-all
45
- prosa sessions
46
- prosa search "package.json"
47
- ```
48
-
49
- Export a transcript and run analytics:
50
-
51
- ```bash
52
- prosa export session <session-id> --format markdown --out session.md
53
- prosa export parquet
54
- prosa query duckdb "select source_tool, count(*) from sessions group by 1"
55
- prosa analytics tools --refresh
56
- ```
57
-
58
- Open the terminal UI or serve the bundle through MCP:
59
-
60
- ```bash
61
- prosa tui
62
- prosa mcp serve
63
- ```
64
-
65
- By default, the bundle lives at `~/.prosa`. Override it with `--store` or
66
- `PROSA_STORE`:
67
-
68
- ```bash
69
- PROSA_STORE=/tmp/prosa-demo prosa init
70
- prosa compile codex --store /tmp/prosa-demo
71
- prosa search "migration" --store /tmp/prosa-demo
72
- ```
73
-
74
- ## Why prosa
75
-
76
- Agent tools store useful work in different formats and directories. That makes
77
- history hard to search, audit, export, or share with another agent.
78
-
79
- `prosa` turns those histories into a local-first data layer:
80
-
81
- - raw source files and raw records stay available for audit and re-processing;
82
- - canonical SQLite tables make sessions, messages, tool calls, artifacts, and
83
- graph edges queryable;
84
- - search surfaces cover messages, commands, paths, diffs, and result previews;
85
- - derived exports give humans Markdown and analytics tools Parquet;
86
- - MCP exposes the same bundle to agents as reusable local memory.
87
-
88
- ## Features
89
-
90
- - Import Codex CLI, Claude Code, Gemini CLI, and Cursor session histories.
91
- - Preserve raw bytes alongside normalized records.
92
- - Search with SQLite FTS5 by default, or build an optional Tantivy sidecar.
93
- - List sessions with filters for source, time range, columns, and output format.
94
- - Export individual sessions as readable Markdown transcripts.
95
- - Export canonical tables to Parquet and query them with DuckDB.
96
- - Run built-in analytics reports for sessions, tools, errors, models, and
97
- projects.
98
- - Browse sessions and search results in an Ink-based terminal UI.
99
- - Serve MCP tools and prompts over stdio or HTTP Streamable transport.
100
- - Run bundle health checks with `prosa doctor`.
101
-
102
- ## Supported sources
103
-
104
- `prosa compile` imports one source at a time. `prosa compile-all` imports every
105
- supported source from its default location.
106
-
107
- | Source | Default path | Imported files |
108
- |---|---|---|
109
- | Codex CLI | `~/.codex/sessions` | Recursive `.jsonl` session files |
110
- | Claude Code | `~/.claude/projects` | Project JSONL files and subagent JSONL files |
111
- | Gemini CLI | `~/.gemini/tmp` | `chats/session-*.json` snapshots |
112
- | Cursor | `~/.cursor/chats` | `store.db` SQLite agent stores |
113
-
114
- Examples:
115
-
116
- ```bash
117
- prosa compile codex
118
- prosa compile claude --sessions-path ~/custom/claude/projects
119
- prosa compile gemini
120
- prosa compile cursor
121
- prosa compile-all --verbose
122
- ```
123
-
124
- Imports are idempotent for already-seen source files. Each import reports counts
125
- for source files, sessions, messages, tool calls, tool results, artifacts,
126
- edges, and errors.
127
-
128
- ## Common workflows
129
-
130
- Import everything local:
131
-
132
- ```bash
133
- prosa init --force-existing
134
- prosa compile-all
135
- prosa index status
136
- ```
137
-
138
- Find prior work on a topic or file:
139
-
140
- ```bash
141
- prosa search "auth middleware"
142
- prosa search "src/server/routes.ts" --limit 20
143
- prosa sessions --source codex --since 2026-01-01
144
- ```
145
-
146
- Export a useful transcript:
147
-
148
- ```bash
149
- prosa sessions --limit 20
150
- prosa export session <session-id> --format markdown --out transcript.md
151
- ```
152
-
153
- Audit failed tool usage:
154
-
155
- ```bash
156
- prosa analytics tools --refresh --errors-only
157
- prosa analytics errors --output-format json
158
- ```
159
-
160
- Run custom SQL over Parquet:
161
-
162
- ```bash
163
- prosa export parquet
164
- prosa query duckdb "
165
- select tool_name, status, count(*) as n
166
- from tool_calls
167
- group by 1, 2
168
- order by n desc
169
- "
170
- ```
171
-
172
- Use a faster sidecar search index:
173
-
174
- ```bash
175
- prosa index tantivy
176
- prosa search "slow test" --engine tantivy
177
- prosa index status
178
- ```
179
-
180
- ## Command map
181
-
182
- | Command | Purpose |
183
- |---|---|
184
- | `prosa init` | Create a bundle directory with manifest, SQLite, lock file, and object store. |
185
- | `prosa compile <source>` | Import one source: `codex`, `claude`, `gemini`, or `cursor`. |
186
- | `prosa compile-all` | Import every supported source from default paths. |
187
- | `prosa sessions` | List or count sessions with filters and table, JSON, or CSV output. |
188
- | `prosa search <query>` | Full-text search across messages, tool calls, paths, commands, and previews. |
189
- | `prosa index` | Inspect or rebuild FTS5 and Tantivy search indexes. |
190
- | `prosa export session` | Export one session as Markdown. |
191
- | `prosa export parquet` | Export canonical tables to Parquet for analytics. |
192
- | `prosa query duckdb` | Run DuckDB SQL over exported Parquet tables and derived views. |
193
- | `prosa analytics` | Run built-in reports for sessions, tools, errors, models, and projects. |
194
- | `prosa tui` | Open the interactive terminal explorer. |
195
- | `prosa mcp serve` | Serve the bundle through MCP over stdio or HTTP. |
196
- | `prosa doctor` | Run bundle health checks. |
197
-
198
- Most commands accept `--store <path>`. `PROSA_STORE` sets the default bundle
199
- path for a shell session.
200
-
201
- Useful output flags:
202
-
203
- ```bash
204
- prosa sessions --output-format json
205
- prosa sessions --columns start_ts,session_id,title
206
- prosa search "schema update" --output-format json
207
- prosa analytics sessions --columns all
208
- ```
209
-
210
- ## MCP
211
-
212
- Start a local MCP server over the bundle:
213
-
214
- ```bash
215
- prosa mcp serve
216
- npx --package @c3-oss/prosa prosa mcp serve
217
- prosa mcp serve --transport http --host 127.0.0.1 --port 7331 --path /mcp
218
- ```
219
-
220
- Example stdio client config:
221
-
222
- ```json
223
- {
224
- "command": "npx",
225
- "args": ["--package", "@c3-oss/prosa", "prosa", "mcp", "serve"]
226
- }
227
- ```
228
-
229
- MCP tools include:
230
-
231
- | Tool | Purpose |
232
- |---|---|
233
- | `search` | Search messages, commands, paths, diffs, and previews. |
234
- | `sessions` | List sessions or open a session as detail, summary, or Markdown. |
235
- | `tool_calls` | Audit tool usage, errors, commands, and path-related artifacts. |
236
- | `analytics` | Run aggregate reports over SQLite-backed views. |
237
- | `artifact` | Fetch full stored text for an artifact. |
238
- | `compile` | Return compile/index status, or import a source when args are provided. |
239
-
240
- MCP prompts include `investigate_prior_work`, `find_file_history`, and
241
- `audit_tool_failures`.
242
-
243
- In stdio mode, stdout is reserved for MCP JSON-RPC frames.
244
-
245
- ## Bundle layout
246
-
247
- A bundle is a local directory, defaulting to `~/.prosa`:
248
-
249
- ```text
250
- ~/.prosa/
251
- manifest.json
252
- prosa.sqlite
253
- prosa.lock
254
- objects/
255
- blake3/...
256
- raw/
257
- sources/
258
- search/
259
- tantivy/
260
- exports/
261
- parquet/
262
- ```
263
-
264
- The layers are:
265
-
266
- | Layer | Contents |
267
- |---|---|
268
- | Raw immutable layer | Source files, raw records, import batches, and import errors. |
269
- | Canonical projection | Projects, sessions, turns, events, messages, tool calls, artifacts, and edges. |
270
- | Derived read surfaces | `search_docs`, SQLite FTS5, Tantivy, Markdown, and Parquet. |
271
-
272
- SQLite is the canonical catalog. Large payloads such as raw records, tool
273
- outputs, diffs, and JSON payloads are stored in the content-addressed object
274
- store. Object IDs use BLAKE3 and object bytes are compressed with zstd.
275
-
276
- Search indexes, Markdown exports, and Parquet files are derived. Do not treat
277
- them as the source of truth.
278
-
279
- ## Development
280
-
281
- Requirements:
282
-
283
- - Node.js 22.15.1 through 26.x
284
- - pnpm
285
- - devbox, recommended for the local shell
286
-
287
- From this repository:
288
-
289
- ```bash
290
- devbox shell
291
- pnpm install
292
- pnpm build
293
- pnpm test
294
- pnpm typecheck
295
- pnpm lint
296
- ```
297
-
298
- Run the CLI through SWC while developing:
299
-
300
- ```bash
301
- pnpm dev -- init --store /tmp/prosa-dev
302
- pnpm dev -- compile codex --store /tmp/prosa-dev
303
- pnpm dev -- sessions --store /tmp/prosa-dev --output-format json
304
- ```
305
-
306
- Project layout:
307
-
308
- | Path | Purpose |
309
- |---|---|
310
- | `src/cli/commands/` | CLI command implementations |
311
- | `src/core/` | Bundle, schema, CAS, domain IDs, and ingest helpers |
312
- | `src/importers/` | Codex, Claude, Gemini, and Cursor importers |
313
- | `src/services/` | Sessions, search, indexing, exports, and analytics |
314
- | `src/mcp/` | MCP server, tools, and prompts |
315
- | `src/tui/` | Ink terminal UI |
316
- | `test/` | Vitest tests and fixtures |
317
- | `docs/` | Architecture and source-format references |
318
-
319
- ## Documentation
320
-
321
- Start with [`docs/README.md`](./docs/README.md) for the full documentation
322
- index.
323
-
324
- | Doc | Purpose |
325
- |---|---|
326
- | [`docs/architecture/bundle-format.md`](./docs/architecture/bundle-format.md) | Bundle layout, SQLite schema, CAS, and idempotency keys |
327
- | [`docs/architecture/import-pipeline.md`](./docs/architecture/import-pipeline.md) | How imports walk sources, stage CAS, commit, and rebuild indexes |
328
- | [`docs/architecture/search-engines.md`](./docs/architecture/search-engines.md) | FTS5 default search vs. Tantivy sidecar search |
329
- | [`docs/recipes/duckdb.md`](./docs/recipes/duckdb.md) | Copy-pasteable DuckDB analytics queries |
330
- | [`docs/sources/codex.md`](./docs/sources/codex.md) | Codex CLI source format |
331
- | [`docs/sources/claude-code.md`](./docs/sources/claude-code.md) | Claude Code source format |
332
- | [`docs/sources/cursor.md`](./docs/sources/cursor.md) | Cursor source format |
333
- | [`docs/sources/gemini.md`](./docs/sources/gemini.md) | Gemini CLI source format |
334
-
335
- ## Releasing
336
-
337
- `prosa` uses Changesets for npm releases to the official npm registry. The
338
- package is published publicly as `@c3-oss/prosa`.
339
-
340
- ```bash
341
- just changeset
342
- just version-packages
343
- just release
344
- ```
345
-
346
- Publishing requires an npm account authenticated locally with permission to
347
- publish public packages under the `@c3-oss` scope. Do not run `just release`
348
- unless you intend to publish to `https://registry.npmjs.org/`.
349
-
350
- ## Status and limitations
351
-
352
- - `prosa` is early software. The main CLI surfaces documented here are
353
- implemented, but source formats and importer coverage will continue to evolve.
354
- - Agent tools can change their on-disk formats; importers preserve raw bytes so
355
- projections can be improved later.
356
- - FTS5 is available by default; Tantivy search requires `prosa index tantivy`
357
- before use.
358
- - `prosa query duckdb` requires Parquet exports. Run `prosa export parquet`
359
- after importing or re-importing data.
360
- - Markdown export is optimized for readable transcripts and previews, not for
361
- dumping every stored byte inline.
362
- - The default store may contain private local history. Be careful before
363
- sharing exports, Parquet snapshots, or the bundle itself.