cogpit-memory 0.2.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.
- package/README.md +36 -27
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +3669 -1929
- package/dist/commands/search.d.ts +1 -1
- package/dist/commands/sessions.d.ts +2 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +3247 -1579
- package/dist/lib/agent-descriptors.d.ts +425 -0
- package/dist/lib/agents.d.ts +123 -0
- package/dist/lib/claude.d.ts +49 -0
- package/dist/lib/codex-exec.d.ts +12 -0
- package/dist/lib/codex-tool-normalization.d.ts +25 -4
- package/dist/lib/codex.d.ts +40 -1
- package/dist/lib/copilot.d.ts +51 -0
- package/dist/lib/dirs.d.ts +10 -0
- package/dist/lib/helpers.d.ts +0 -20
- package/dist/lib/instances.d.ts +12 -0
- package/dist/lib/interactiveState.d.ts +9 -0
- package/dist/lib/metadata.d.ts +16 -14
- package/dist/lib/parser.d.ts +6 -4
- package/dist/lib/read-session.d.ts +1 -0
- package/dist/lib/search-index.d.ts +7 -67
- package/dist/lib/sessionStats.d.ts +2 -1
- package/dist/lib/sessionStatus.d.ts +11 -32
- package/dist/lib/stores.d.ts +48 -0
- package/dist/lib/toolResults.d.ts +12 -0
- package/dist/lib/turnBuilder.d.ts +22 -0
- package/dist/lib/turnContent.d.ts +2 -0
- package/dist/lib/types.d.ts +85 -7
- package/package.json +3 -2
- package/skill/SKILL.md +67 -49
- package/dist/lib/token-costs.d.ts +0 -27
package/README.md
CHANGED
|
@@ -1,27 +1,24 @@
|
|
|
1
1
|
# cogpit-memory
|
|
2
2
|
|
|
3
|
-
CLI tool that gives any AI assistant memory of past Claude Code and
|
|
4
|
-
sessions. Browse
|
|
5
|
-
blocks, and sub-agent activity. Cross-session FTS search
|
|
6
|
-
Claude Code history.
|
|
3
|
+
CLI tool that gives any AI assistant memory of past Claude Code, Codex, and
|
|
4
|
+
GitHub Copilot CLI sessions. Browse normalized conversation history, tool
|
|
5
|
+
usage, thinking blocks, and inline sub-agent activity. Cross-session FTS search
|
|
6
|
+
indexes Claude Code, Codex, and GitHub Copilot CLI history.
|
|
7
7
|
|
|
8
8
|
All output is JSON to stdout — designed for programmatic consumption by AI agents.
|
|
9
9
|
|
|
10
|
-
Session compatibility is validated against Claude Code 2.1.
|
|
11
|
-
0.
|
|
12
|
-
formats covered by the test suite.
|
|
10
|
+
Session compatibility is validated against Claude Code 2.1.287 and Codex CLI
|
|
11
|
+
0.159.3. The parser also retains backward compatibility with older rollout
|
|
12
|
+
formats covered by the test suite. Copilot support follows the documented SDK
|
|
13
|
+
event schema and `~/.copilot/session-state/` layout.
|
|
13
14
|
|
|
14
15
|
## Install
|
|
15
16
|
|
|
16
17
|
```bash
|
|
17
|
-
|
|
18
|
+
bun install --global cogpit-memory
|
|
18
19
|
```
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
npx cogpit-memory sessions
|
|
24
|
-
```
|
|
21
|
+
Use the installed `cogpit-memory` command for repeated or concurrent work. Installing once avoids races between transient `bunx` installs of the native SQLite dependency. Keep stderr separate from stdout when parsing JSON.
|
|
25
22
|
|
|
26
23
|
## Quick Start
|
|
27
24
|
|
|
@@ -35,7 +32,7 @@ cogpit-memory context <sessionId>
|
|
|
35
32
|
# Drill into a specific turn
|
|
36
33
|
cogpit-memory context <sessionId> --turn 3
|
|
37
34
|
|
|
38
|
-
# Search
|
|
35
|
+
# Search indexed sessions from all supported CLIs
|
|
39
36
|
cogpit-memory search "authentication"
|
|
40
37
|
```
|
|
41
38
|
|
|
@@ -68,14 +65,22 @@ Three layers of detail. Start at L1, drill down only as needed.
|
|
|
68
65
|
| **L3** — Sub-agent | `cogpit-memory context <sessionId> --agent <agentId>` | Full sub-agent conversation (same shape as L1) |
|
|
69
66
|
| **L3** — Sub-agent turn | `cogpit-memory context <sessionId> --agent <agentId> --turn 0` | Sub-agent turn detail (same shape as L2) |
|
|
70
67
|
|
|
71
|
-
**Discovery flow:** L1 gives you `turnIndex` and `agentId` values
|
|
68
|
+
**Discovery flow:** L1 gives you `turnIndex` and `agentId` values. Use those to
|
|
69
|
+
drill into L2 and, when a separate sub-agent transcript exists, L3.
|
|
70
|
+
|
|
71
|
+
Copilot CLI keeps nested agent events in the root `events.jsonl`, so L1 and L2
|
|
72
|
+
include that activity inline. L3 needs a separate sub-agent transcript file and
|
|
73
|
+
is not available for Copilot sessions.
|
|
72
74
|
|
|
73
75
|
### `search` — Full-text search with FTS5
|
|
74
76
|
|
|
75
|
-
|
|
77
|
+
Cross-session search indexes Claude Code, Codex, and Copilot CLI history. With
|
|
78
|
+
`--session`, all three are supported too,
|
|
79
|
+
including user and assistant messages, thinking, tool I/O, inline sub-agent
|
|
80
|
+
content, and compaction summaries when the provider records them.
|
|
76
81
|
|
|
77
82
|
```bash
|
|
78
|
-
cogpit-memory search "authentication" # Cross-session
|
|
83
|
+
cogpit-memory search "authentication" # Cross-session index, every agent
|
|
79
84
|
cogpit-memory search "auth" --session <sessionId> # Single session
|
|
80
85
|
cogpit-memory search "bug" --max-age 30d --limit 50 # Custom window
|
|
81
86
|
cogpit-memory search "AuthProvider" --case-sensitive # Case-sensitive
|
|
@@ -86,12 +91,15 @@ cogpit-memory search "bug" --session-limit 20 --hits-per-session 2 # Compact re
|
|
|
86
91
|
| Flag | Default | Description |
|
|
87
92
|
|------|---------|-------------|
|
|
88
93
|
| `--session` | all | Scope to single session |
|
|
94
|
+
| `--exclude-session` | none | Exclude one session and its subagents |
|
|
89
95
|
| `--max-age` | `5d` | Time window — any duration (`5d`, `30d`, `365d`) |
|
|
90
96
|
| `--limit` | `20` | Max total hits returned |
|
|
91
97
|
| `--session-limit` | all | Cap unique sessions in results |
|
|
92
98
|
| `--hits-per-session` | all | Max hits kept per session |
|
|
93
99
|
| `--case-sensitive` | `false` | Case sensitivity |
|
|
94
100
|
|
|
101
|
+
Use `--exclude-session <current-session-id>` when recalling earlier work to omit your own search commands and results. Missing transcript files are removed from the index before searching. If a transcript is deleted between search and drill-down, `context` returns a JSON error and exits nonzero.
|
|
102
|
+
|
|
95
103
|
Each result includes the `cwd` (working directory where the session ran) and an array of hits. Each hit includes a `location` string (e.g. `turn/3/assistantMessage`, `agent/a7f3bc2/toolCall/tc1/result`) that maps directly to L2/L3 drill-down commands.
|
|
96
104
|
|
|
97
105
|
### `index` — Manage the FTS5 search index
|
|
@@ -110,7 +118,7 @@ Benchmarked against a real Claude Code history: **765 sessions, 1,745 sub-agents
|
|
|
110
118
|
| `sessions --limit 20` | **38ms** | File-system scan, no DB needed |
|
|
111
119
|
| `context <sessionId>` (L1) | **34ms** | Single JSONL file parse |
|
|
112
120
|
| `context <sessionId> --turn N` (L2) | **35ms** | Same file, filtered to one turn |
|
|
113
|
-
| `search "keyword"` (cross-session) | **56–200ms** | FTS5
|
|
121
|
+
| `search "keyword"` (cross-session) | **56–200ms** | FTS5 across 210K rows |
|
|
114
122
|
| `search "keyword" --session <id>` | **30ms** | Scoped to single session |
|
|
115
123
|
| `index stats` | **50ms** | Single DB query |
|
|
116
124
|
|
|
@@ -123,19 +131,20 @@ Benchmarked against a real Claude Code history: **765 sessions, 1,745 sub-agents
|
|
|
123
131
|
| Heavy (1 year) | ~2,000 | ~500K | ~3.5 GB | 100–400ms |
|
|
124
132
|
| Power user (2+ years) | ~5,000 | ~1.2M | ~8 GB | 200–800ms |
|
|
125
133
|
|
|
126
|
-
FTS5
|
|
134
|
+
FTS5 search is sublinear — doubling the index size does not double query time. The index uses SQLite WAL mode for concurrent reads and is incrementally updated.
|
|
127
135
|
|
|
128
136
|
## How It Works
|
|
129
137
|
|
|
130
138
|
Session discovery and context commands read Claude Code JSONL history from
|
|
131
|
-
`~/.claude/projects
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
+
`~/.claude/projects/`, Codex history from `~/.codex/sessions/`, and GitHub
|
|
140
|
+
Copilot CLI history from `~/.copilot/session-state/`. The shared parser
|
|
141
|
+
normalizes each provider into the same conversation structure for layered
|
|
142
|
+
drill-down.
|
|
143
|
+
|
|
144
|
+
Cross-session search builds its FTS5 index from every agent's history root, then
|
|
145
|
+
stores it at `~/.claude/cogpit-memory/search-index.db`. It uses SQLite's
|
|
146
|
+
`unicode61` tokenizer, so a query matches whole tokens: searching for `"auth"`
|
|
147
|
+
finds `"auth"`, not `"authentication"`.
|
|
139
148
|
|
|
140
149
|
## Development
|
|
141
150
|
|