cogpit-memory 0.1.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 +147 -0
- package/dist/cli.js +2228 -0
- package/dist/index.js +2175 -0
- package/package.json +27 -0
package/README.md
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# cogpit-memory
|
|
2
|
+
|
|
3
|
+
CLI tool that gives any AI assistant memory of past [Claude Code](https://docs.anthropic.com/en/docs/claude-code) sessions. Retrieve conversation history, tool usage, thinking blocks, sub-agent activity, and full-text search across all sessions.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g cogpit-memory
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or run directly:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx cogpit-memory sessions
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# List recent sessions
|
|
21
|
+
cogpit-memory sessions
|
|
22
|
+
|
|
23
|
+
# Get session overview
|
|
24
|
+
cogpit-memory context <sessionId>
|
|
25
|
+
|
|
26
|
+
# Drill into a specific turn
|
|
27
|
+
cogpit-memory context <sessionId> --turn 3
|
|
28
|
+
|
|
29
|
+
# Search across all sessions
|
|
30
|
+
cogpit-memory search "authentication"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Commands
|
|
34
|
+
|
|
35
|
+
### `sessions` — Discover sessions
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# Recent sessions (last 7 days)
|
|
39
|
+
cogpit-memory sessions
|
|
40
|
+
|
|
41
|
+
# Filter by project directory
|
|
42
|
+
cogpit-memory sessions --cwd /path/to/project
|
|
43
|
+
|
|
44
|
+
# Get most recent session for a directory
|
|
45
|
+
cogpit-memory sessions --current --cwd /path/to/project
|
|
46
|
+
|
|
47
|
+
# Custom time window and limit
|
|
48
|
+
cogpit-memory sessions --max-age 30d --limit 50
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
| Flag | Default | Description |
|
|
52
|
+
|------|---------|-------------|
|
|
53
|
+
| `--cwd` | all | Filter by working directory |
|
|
54
|
+
| `--limit` | `20` | Max results |
|
|
55
|
+
| `--max-age` | `7d` | Time window (`7d`, `12h`, `30d`) |
|
|
56
|
+
| `--current` | — | Most recent session for `--cwd` |
|
|
57
|
+
|
|
58
|
+
### `context` — Browse session content (layered)
|
|
59
|
+
|
|
60
|
+
Three layers of detail — start at L1, drill down as needed.
|
|
61
|
+
|
|
62
|
+
**Layer 1 — Session overview** (always start here):
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
cogpit-memory context <sessionId>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Returns every turn with user prompt, assistant reply, tool usage summary, and sub-agent list.
|
|
69
|
+
|
|
70
|
+
**Layer 2 — Turn detail:**
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
cogpit-memory context <sessionId> --turn 3
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Returns thinking blocks, full tool call inputs/outputs, and sub-agent summaries in chronological order.
|
|
77
|
+
|
|
78
|
+
**Layer 3 — Sub-agent detail:**
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# Sub-agent overview (same shape as L1)
|
|
82
|
+
cogpit-memory context <sessionId> --agent <agentId>
|
|
83
|
+
|
|
84
|
+
# Sub-agent turn detail (same shape as L2)
|
|
85
|
+
cogpit-memory context <sessionId> --agent <agentId> --turn 0
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### `search` — Full-text search with FTS5
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# Search across all recent sessions
|
|
92
|
+
cogpit-memory search "authentication"
|
|
93
|
+
|
|
94
|
+
# Scope to a single session
|
|
95
|
+
cogpit-memory search "auth" --session <sessionId>
|
|
96
|
+
|
|
97
|
+
# Custom time window
|
|
98
|
+
cogpit-memory search "bug" --max-age 30d --limit 50
|
|
99
|
+
|
|
100
|
+
# Case-sensitive
|
|
101
|
+
cogpit-memory search "AuthProvider" --case-sensitive
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
| Flag | Default | Description |
|
|
105
|
+
|------|---------|-------------|
|
|
106
|
+
| `--session` | all | Scope to single session |
|
|
107
|
+
| `--max-age` | `5d` | Time window |
|
|
108
|
+
| `--limit` | `20` | Max returned hits |
|
|
109
|
+
| `--case-sensitive` | `false` | Case sensitivity |
|
|
110
|
+
|
|
111
|
+
Searches everything: user messages, assistant responses, thinking blocks, tool call inputs/outputs, sub-agent content, and compaction summaries.
|
|
112
|
+
|
|
113
|
+
### `index` — Manage the FTS5 search index
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
cogpit-memory index stats # Show index stats
|
|
117
|
+
cogpit-memory index rebuild # Rebuild from scratch
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Output
|
|
121
|
+
|
|
122
|
+
All output is JSON to stdout, designed for programmatic consumption by AI agents.
|
|
123
|
+
|
|
124
|
+
## How It Works
|
|
125
|
+
|
|
126
|
+
cogpit-memory reads Claude Code's JSONL session files from `~/.claude/projects/`. It parses the conversation structure and provides a layered drill-down interface.
|
|
127
|
+
|
|
128
|
+
For search, it maintains an FTS5 trigram index at `~/.claude/cogpit-memory/search-index.db` for fast full-text search across all sessions.
|
|
129
|
+
|
|
130
|
+
## Development
|
|
131
|
+
|
|
132
|
+
Requires [Bun](https://bun.sh) for development (source uses `bun:sqlite`). The npm build uses `better-sqlite3` for Node.js compatibility.
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
# Run tests
|
|
136
|
+
bun test
|
|
137
|
+
|
|
138
|
+
# Build compiled binary (Bun, uses bun:sqlite)
|
|
139
|
+
bun run build
|
|
140
|
+
|
|
141
|
+
# Build for npm (Node.js, uses better-sqlite3)
|
|
142
|
+
bun run build:npm
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## License
|
|
146
|
+
|
|
147
|
+
MIT
|