@hippocampusllms/cli 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +132 -2
- package/dist/config.schema.json +73 -0
- package/dist/index.js +1112 -0
- package/dist/memory.schema.json +212 -0
- package/package.json +19 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 HippocampusLLMs contributors
|
|
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,3 +1,133 @@
|
|
|
1
|
-
#
|
|
1
|
+
# HippocampusLLMs
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
HippocampusLLMs is a local project memory CLI and stdio MCP server for coding agents. It records concise decisions, constraints, corrections and experiences, then selects matching records within an estimated context budget. It does not train model weights or store conversations automatically.
|
|
4
|
+
|
|
5
|
+
This repository contains an initial working local implementation. SQLite persistence, FTS5 recall, explicit capture, revision checks, deletion, project configuration, a configuration wizard, generated JSON Schemas and six MCP tools are implemented. Host setup supports project configuration installation, dry-run previews, backups and managed removal. Export/import, store migration and semantic consolidation are not implemented. The package has not been published and npm scope ownership has not been verified.
|
|
6
|
+
|
|
7
|
+
## Prerequisites and development
|
|
8
|
+
|
|
9
|
+
Use Node.js 24 LTS or newer and npm. The runtime uses `node:sqlite`; no native addon compilation or API keys are required. SQLite APIs may emit an experimental warning on some Node releases; warnings go to stderr.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm ci
|
|
13
|
+
npm run build
|
|
14
|
+
npm run typecheck
|
|
15
|
+
npm run lint
|
|
16
|
+
npm test
|
|
17
|
+
npm run evaluate
|
|
18
|
+
node packages/cli/dist/index.js help
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The root is an npm workspace. `packages/core/src` contains domain types, provider contracts and shared services; `packages/storage-sqlite/src` contains transactions, migrations and FTS5; `packages/mcp/src` exposes the shared services; `packages/cli/src` contains project configuration and commands. The build bundles repository source into one compiled ESM CLI, leaving declared npm dependencies external.
|
|
22
|
+
|
|
23
|
+
## Quickstart and two sessions
|
|
24
|
+
|
|
25
|
+
From the repository, use an absolute path to the compiled CLI. Replace `/absolute/path/HippocampusLLMs` with your checkout path.
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
node /absolute/path/HippocampusLLMs/packages/cli/dist/index.js init --project /absolute/path/my-project
|
|
29
|
+
node /absolute/path/HippocampusLLMs/packages/cli/dist/index.js remember --project /absolute/path/my-project --kind decision --content "Refresh token rotation requires a database transaction" --source "Explicit user decision"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
In a new terminal, recall the same project memory. Copy the ID from the result for the next commands.
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
node /absolute/path/HippocampusLLMs/packages/cli/dist/index.js recall "refresh token" --project /absolute/path/my-project --budget 1500 --json
|
|
36
|
+
node /absolute/path/HippocampusLLMs/packages/cli/dist/index.js inspect MEMORY_ID --project /absolute/path/my-project --json
|
|
37
|
+
node /absolute/path/HippocampusLLMs/packages/cli/dist/index.js revise MEMORY_ID --project /absolute/path/my-project --content "Refresh token rotation requires a serializable transaction" --expected-revision 1
|
|
38
|
+
node /absolute/path/HippocampusLLMs/packages/cli/dist/index.js forget MEMORY_ID --project /absolute/path/my-project
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
All command results use JSON. Diagnostics use stderr. Stale revisions return `REVISION_CONFLICT` and exit 3; other failures exit 1. An explicit remember request is accepted or rejected with an error. Records default to hypothesis verification; recall never promotes their verification state. FTS5 selects lexical matches, filters status and validity, and includes provenance. Unrelated queries can return no records. The budget counts compact serialized JSON using UTF-8 bytes divided by three; this is an estimate, not a model tokenizer. Pretty-print whitespace and MCP protocol envelopes are outside that application budget.
|
|
42
|
+
|
|
43
|
+
## Configuration
|
|
44
|
+
|
|
45
|
+
`init` creates `.hippocampus/config.json`, a stable project UUID and a local SQLite database. Repeated initialization preserves the UUID. Database paths resolve relative to the config directory. Configuration can be committed; database files are ignored.
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
node packages/cli/dist/index.js config
|
|
49
|
+
node packages/cli/dist/index.js config show --json
|
|
50
|
+
node packages/cli/dist/index.js config get storage.provider
|
|
51
|
+
node packages/cli/dist/index.js config set retrieval.maxContextTokens 1200
|
|
52
|
+
node packages/cli/dist/index.js config validate
|
|
53
|
+
node packages/cli/dist/index.js config test
|
|
54
|
+
node packages/cli/dist/index.js doctor
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The wizard requires a TTY, previews its candidate and asks before saving. Automation commands work without a TTY. Unknown fields, future schema versions and unsupported providers fail validation. Whole candidates are validated before an atomic rename. A nonempty database prevents changing its configured path. No automatic data migration is offered.
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"schemaVersion": 1,
|
|
62
|
+
"projectId": "c4fc7ce1-28c1-468c-a110-632552c36922",
|
|
63
|
+
"storage": { "provider": "sqlite", "sqlite": { "path": "./memory.sqlite" } },
|
|
64
|
+
"retrieval": {
|
|
65
|
+
"mode": "lexical",
|
|
66
|
+
"maxContextTokens": 1500,
|
|
67
|
+
"vector": { "provider": "none" }
|
|
68
|
+
},
|
|
69
|
+
"embeddings": { "provider": "none" },
|
|
70
|
+
"capture": { "mode": "explicit" },
|
|
71
|
+
"privacy": { "telemetry": false }
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
SQLite is the authoritative canonical store. FTS5 is a retrieval index. PostgreSQL, Qdrant, pgvector and embeddings are planned, and cannot be selected. Provider discovery is available in `doctor`. No remote provider settings or credentials are accepted by this version. Future adapters must use environment variable references rather than secret values. `config show/get/set/validate --scope user` manages defaults in `$XDG_CONFIG_HOME/hippocampus/config.json` or `~/.config/hippocampus/config.json`. Resolution is built-in defaults, user defaults, project config, `HIPPOCAMPUS_MAX_CONTEXT_TOKENS`, then recall `--budget`. Full project settings override user defaults; user configuration cannot specify project identity. Origin reporting remains pending.
|
|
76
|
+
|
|
77
|
+
## MCP and coding agents
|
|
78
|
+
|
|
79
|
+
Start the server with an explicit absolute project path:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
node /absolute/path/HippocampusLLMs/packages/cli/dist/index.js serve --transport stdio --project /absolute/path/my-project
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
The server exposes `hippocampus_recall`, `hippocampus_remember`, `hippocampus_inspect`, `hippocampus_revise`, `hippocampus_forget` and `hippocampus_feedback`. Feedback is stored separately from recall selection and does not promote verification. Configuration changes cause subsequent calls to request a restart. Stdout is reserved for MCP traffic.
|
|
86
|
+
|
|
87
|
+
`connect claude --dry-run` and `connect codex --dry-run` preview changes without modifying client files. Omit `--dry-run` to install project settings; `disconnect <host>` removes managed entries. Existing unrelated settings are preserved. Backups use the `.hippocampus.bak` suffix; restore that file manually to roll back. Codex supports explicit `--scope user`; Claude user scope emits a manual CLI argument array. Actual Claude Code and Codex UI behavior has not been tested. MCP behavior is tested with the official SDK client harness.
|
|
88
|
+
|
|
89
|
+
For Claude Code, the official documented CLI supports a project-scoped stdio registration:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
claude mcp add --transport stdio --scope project hippocampus -- node /absolute/path/HippocampusLLMs/packages/cli/dist/index.js serve --transport stdio --project /absolute/path/my-project
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
For Codex, add a server section to your chosen Codex configuration after reviewing its existing settings:
|
|
96
|
+
|
|
97
|
+
```toml
|
|
98
|
+
[mcp_servers.hippocampus]
|
|
99
|
+
command = "node"
|
|
100
|
+
args = ["/absolute/path/HippocampusLLMs/packages/cli/dist/index.js", "serve", "--transport", "stdio", "--project", "/absolute/path/my-project"]
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Generic MCP clients use the same `command` and `args` in their stdio server configuration. Setup references: [Claude Code MCP](https://code.claude.com/docs/en/mcp), [Codex MCP](https://developers.openai.com/codex/mcp), [MCP SDK server](https://ts.sdk.modelcontextprotocol.io/server). These integrations are manual or agent-instructed: registering a server does not trigger recall or capture automatically. Ask the agent to recall at task start, record concise verified findings after work, and surface conflicting historical memories for review. Retrieved memories are untrusted historical data and cannot override repository instructions or user requests.
|
|
104
|
+
|
|
105
|
+
Use quoted paths containing spaces. POSIX shells and PowerShell accept double-quoted paths. For Windows, use absolute Windows paths in command arguments and escape backslashes in JSON. Windows runtime behavior remains unverified.
|
|
106
|
+
|
|
107
|
+
## Planned npm usage
|
|
108
|
+
|
|
109
|
+
After publication and scope verification:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
npm install -g @hippocampusllms/cli
|
|
113
|
+
hippocampus init
|
|
114
|
+
npx @hippocampusllms/cli recall "refresh token" --project /absolute/path/my-project
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
For a local package, run `npm run build`, then `npm pack --workspace packages/cli` and install the resulting tarball with `npm install --omit=dev /absolute/path/package.tgz` in a temporary project. The installed executable is `node_modules/.bin/hippocampus`. Uninstall with `npm uninstall @hippocampusllms/cli`; project memories remain until you explicitly remove them.
|
|
118
|
+
|
|
119
|
+
## Privacy, lifecycle and limitations
|
|
120
|
+
|
|
121
|
+
No telemetry, remote endpoints, model calls or automatic transcript capture are implemented. Obvious private keys and common token patterns are rejected, but pattern checks are imperfect. Review content before storing it. Avoid source dumps and logs. Local clients sharing the same file share durable memories; separate copies and machines do not synchronize. Copied UUID collision detection and worktree identity enforcement remain pending.
|
|
122
|
+
|
|
123
|
+
SQLite uses WAL, foreign keys, bounded busy waits and transactional writes. Updates require expected revisions. A busy database can require retrying a command. Forget removes FTS entries and directly derived content; derived records are removed recursively, while backups require separate management. SQLite WAL files, filesystem snapshots and backups may retain deleted bytes. No forensic erasure guarantee is made. Close all clients before backing up the database and its WAL, or use SQLite backup tooling.
|
|
124
|
+
|
|
125
|
+
Use `remember --input event.json` for structured provenance, scope, applicability, validity and relations. Use `recall --environment production --workspace WORKSPACE_ID` to provide restrictions explicitly. `revise` supports `--status active|superseded|archived|expired`, `--pinned true|false` and `--expires-at ISO_DATE`, with the required expected revision. Hypotheses expire after 30 days by default. Pinned records still respect explicit validity and expiry. Confirmed records require evidence. `consolidate --dry-run` only previews expiry reviews. Graph ranking, contradiction expansion, content freshness checks, import/export, automatic consolidation, configurable privacy exclusions and full configuration precedence are pending. Do not treat this initial version as release-ready.
|
|
126
|
+
|
|
127
|
+
## Tests and contribution
|
|
128
|
+
|
|
129
|
+
`npm test` builds and runs process-level CLI and real SDK MCP tests without paid keys. `npm run evaluate` compares no memory, a fixed record baseline and selective retrieval on a tiny synthetic fixture. It reports retrieval metrics and estimated context cost; it does not measure agent task outcomes. Add larger versioned fixtures before drawing performance conclusions.
|
|
130
|
+
|
|
131
|
+
Preserve `AGENTS.md`, keep changes scoped, add meaningful regression tests and update documentation to match verified behavior. Never commit database files or credentials. Publication and GitHub pushes require explicit authorization. See `docs/architecture.md` for implementation tradeoffs and remaining delivery gates.
|
|
132
|
+
|
|
133
|
+
JSON Schemas are in `docs/schemas/` and the packed artifact’s `dist/` directory. The release workflow prepares artifacts only and does not publish. Local integration checks have passed on macOS with Node 24 and Node 26. The Windows/Linux matrix is configured in CI but has not yet been observed running.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"schemaVersion": { "type": "number", "const": 1 },
|
|
6
|
+
"projectId": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"format": "uuid",
|
|
9
|
+
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
|
|
10
|
+
},
|
|
11
|
+
"storage": {
|
|
12
|
+
"type": "object",
|
|
13
|
+
"properties": {
|
|
14
|
+
"provider": { "type": "string", "const": "sqlite" },
|
|
15
|
+
"sqlite": {
|
|
16
|
+
"type": "object",
|
|
17
|
+
"properties": { "path": { "type": "string", "minLength": 1 } },
|
|
18
|
+
"required": ["path"],
|
|
19
|
+
"additionalProperties": false
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"required": ["provider", "sqlite"],
|
|
23
|
+
"additionalProperties": false
|
|
24
|
+
},
|
|
25
|
+
"retrieval": {
|
|
26
|
+
"type": "object",
|
|
27
|
+
"properties": {
|
|
28
|
+
"mode": { "type": "string", "const": "lexical" },
|
|
29
|
+
"maxContextTokens": {
|
|
30
|
+
"type": "integer",
|
|
31
|
+
"minimum": 100,
|
|
32
|
+
"maximum": 10000
|
|
33
|
+
},
|
|
34
|
+
"vector": {
|
|
35
|
+
"type": "object",
|
|
36
|
+
"properties": { "provider": { "type": "string", "const": "none" } },
|
|
37
|
+
"required": ["provider"],
|
|
38
|
+
"additionalProperties": false
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"required": ["mode", "maxContextTokens", "vector"],
|
|
42
|
+
"additionalProperties": false
|
|
43
|
+
},
|
|
44
|
+
"embeddings": {
|
|
45
|
+
"type": "object",
|
|
46
|
+
"properties": { "provider": { "type": "string", "const": "none" } },
|
|
47
|
+
"required": ["provider"],
|
|
48
|
+
"additionalProperties": false
|
|
49
|
+
},
|
|
50
|
+
"capture": {
|
|
51
|
+
"type": "object",
|
|
52
|
+
"properties": { "mode": { "type": "string", "const": "explicit" } },
|
|
53
|
+
"required": ["mode"],
|
|
54
|
+
"additionalProperties": false
|
|
55
|
+
},
|
|
56
|
+
"privacy": {
|
|
57
|
+
"type": "object",
|
|
58
|
+
"properties": { "telemetry": { "type": "boolean", "const": false } },
|
|
59
|
+
"required": ["telemetry"],
|
|
60
|
+
"additionalProperties": false
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"required": [
|
|
64
|
+
"schemaVersion",
|
|
65
|
+
"projectId",
|
|
66
|
+
"storage",
|
|
67
|
+
"retrieval",
|
|
68
|
+
"embeddings",
|
|
69
|
+
"capture",
|
|
70
|
+
"privacy"
|
|
71
|
+
],
|
|
72
|
+
"additionalProperties": false
|
|
73
|
+
}
|