cogpit-memory 0.1.9 → 0.1.10
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 +26 -5
- package/dist/cli.d.ts +30 -0
- package/dist/cli.js +1114 -178
- package/dist/commands/context.d.ts +20 -0
- package/dist/commands/index-cmd.d.ts +15 -0
- package/dist/commands/install-skill.d.ts +4 -0
- package/dist/commands/search.d.ts +39 -0
- package/dist/commands/sessions.d.ts +41 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +1117 -180
- package/dist/lib/codex-patches.d.ts +9 -0
- package/dist/lib/codex-tool-normalization.d.ts +8 -0
- package/dist/lib/codex.d.ts +30 -0
- package/dist/lib/dirs.d.ts +8 -0
- package/dist/lib/helpers.d.ts +11 -0
- package/dist/lib/interactiveState.d.ts +35 -0
- package/dist/lib/messageTypeGuards.d.ts +17 -0
- package/dist/lib/metadata.d.ts +31 -0
- package/dist/lib/parser.d.ts +14 -0
- package/dist/lib/pricingTiers.d.ts +30 -0
- package/dist/lib/response.d.ts +2 -0
- package/dist/lib/search-index.d.ts +154 -0
- package/dist/lib/sessionStats.d.ts +6 -0
- package/dist/lib/sessionStatus.d.ts +36 -0
- package/dist/lib/token-costs.d.ts +48 -0
- package/dist/lib/turnBuilder.d.ts +5 -0
- package/dist/lib/types.d.ts +401 -0
- package/package.json +13 -7
- package/skill/SKILL.md +4 -4
package/README.md
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
# cogpit-memory
|
|
2
2
|
|
|
3
|
-
CLI tool that gives any AI assistant memory of past
|
|
3
|
+
CLI tool that gives any AI assistant memory of past Claude Code and Codex
|
|
4
|
+
sessions. Browse either provider's conversation history, tool usage, thinking
|
|
5
|
+
blocks, and sub-agent activity. Cross-session FTS search currently indexes
|
|
6
|
+
Claude Code history.
|
|
4
7
|
|
|
5
8
|
All output is JSON to stdout — designed for programmatic consumption by AI agents.
|
|
6
9
|
|
|
10
|
+
Session compatibility is validated against Claude Code 2.1.217 and Codex CLI
|
|
11
|
+
0.145.0. The parser also retains backward compatibility with older rollout
|
|
12
|
+
formats covered by the test suite.
|
|
13
|
+
|
|
7
14
|
## Install
|
|
8
15
|
|
|
9
16
|
```bash
|
|
@@ -120,16 +127,27 @@ FTS5 trigram search is sublinear — doubling the index size does not double que
|
|
|
120
127
|
|
|
121
128
|
## How It Works
|
|
122
129
|
|
|
123
|
-
|
|
130
|
+
Session discovery and context commands read Claude Code JSONL history from
|
|
131
|
+
`~/.claude/projects/` and Codex JSONL history from `~/.codex/sessions/`. The
|
|
132
|
+
shared parser normalizes each provider into the same conversation structure
|
|
133
|
+
(turns, tool calls, thinking blocks, and sub-agents) for layered drill-down.
|
|
124
134
|
|
|
125
|
-
|
|
135
|
+
Cross-session search currently builds its FTS5 trigram index from the Claude
|
|
136
|
+
project tree and stores it at `~/.claude/cogpit-memory/search-index.db`. The
|
|
137
|
+
trigram tokenizer enables substring matching (not just whole-word) — searching
|
|
138
|
+
for `"auth"` matches `"authentication"`, `"OAuth"`, and `"AuthProvider"`.
|
|
126
139
|
|
|
127
140
|
## Development
|
|
128
141
|
|
|
129
|
-
|
|
142
|
+
The npm package requires Node.js 20 or newer. Development requires [Bun](https://bun.sh) because the source uses `bun:sqlite`; the npm build substitutes `better-sqlite3` through an esbuild alias.
|
|
143
|
+
|
|
144
|
+
The session parser under `src/lib/` is generated from Cogpit's canonical
|
|
145
|
+
`shared/session/` implementation. Edit the shared copy, then run
|
|
146
|
+
`bun run sync-cogpit-memory` from the Cogpit repository root. CI runs
|
|
147
|
+
`bun run check:cogpit-memory-sync` and rejects drift.
|
|
130
148
|
|
|
131
149
|
```bash
|
|
132
|
-
# Run tests
|
|
150
|
+
# Run tests
|
|
133
151
|
bun test
|
|
134
152
|
|
|
135
153
|
# Build compiled binary (Bun, uses bun:sqlite)
|
|
@@ -137,6 +155,9 @@ bun run build
|
|
|
137
155
|
|
|
138
156
|
# Build for npm (Node.js, uses better-sqlite3)
|
|
139
157
|
bun run build:npm
|
|
158
|
+
|
|
159
|
+
# Verify built CommonJS, declarations, public exports, CLI, and npm tarball
|
|
160
|
+
bun run test:contracts
|
|
140
161
|
```
|
|
141
162
|
|
|
142
163
|
## Agent Skill
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* cogpit-memory CLI — query Claude Code session history.
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* cogpit-memory search <query> [options]
|
|
6
|
+
* cogpit-memory context <sessionId> [--turn N] [--agent ID]
|
|
7
|
+
* cogpit-memory sessions [--cwd path] [--current] [--limit N] [--max-age 7d]
|
|
8
|
+
* cogpit-memory index stats|rebuild
|
|
9
|
+
*/
|
|
10
|
+
export interface CLICommand {
|
|
11
|
+
command: string;
|
|
12
|
+
args: CLIArguments;
|
|
13
|
+
}
|
|
14
|
+
export interface CLIArguments {
|
|
15
|
+
query?: string;
|
|
16
|
+
session?: string;
|
|
17
|
+
maxAge?: string;
|
|
18
|
+
limit?: number;
|
|
19
|
+
sessionLimit?: number;
|
|
20
|
+
hitsPerSession?: number;
|
|
21
|
+
caseSensitive?: boolean;
|
|
22
|
+
sessionId?: string;
|
|
23
|
+
turnIndex?: number;
|
|
24
|
+
agentId?: string;
|
|
25
|
+
cwd?: string;
|
|
26
|
+
current?: boolean;
|
|
27
|
+
subcommand?: string;
|
|
28
|
+
global?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export declare function parseArgs(argv: string[]): CLICommand;
|