cogpit-memory 0.1.9 → 0.2.1
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/LICENSE +21 -0
- package/README.md +26 -5
- package/dist/cli.d.ts +30 -0
- package/dist/cli.js +1618 -338
- 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 +38 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +1659 -386
- package/dist/lib/agentEnvelope.d.ts +24 -0
- package/dist/lib/codex-exec.d.ts +27 -0
- package/dist/lib/codex-patches.d.ts +9 -0
- package/dist/lib/codex-tool-normalization.d.ts +14 -0
- package/dist/lib/codex.d.ts +30 -0
- package/dist/lib/dirs.d.ts +8 -0
- package/dist/lib/helpers.d.ts +25 -0
- package/dist/lib/interactiveState.d.ts +40 -0
- package/dist/lib/messageTypeGuards.d.ts +26 -0
- package/dist/lib/metadata.d.ts +31 -0
- package/dist/lib/parser.d.ts +14 -0
- package/dist/lib/response.d.ts +2 -0
- package/dist/lib/search-index.d.ts +154 -0
- package/dist/lib/sessionStats.d.ts +10 -0
- package/dist/lib/sessionStatus.d.ts +42 -0
- package/dist/lib/token-costs.d.ts +27 -0
- package/dist/lib/turnBuilder.d.ts +38 -0
- package/dist/lib/types.d.ts +553 -0
- package/package.json +32 -8
- package/skill/SKILL.md +4 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Gentrit Biba
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
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;
|