hippocamp 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/.env.example +7 -0
- package/AGENTS.md +74 -0
- package/LICENSE +21 -0
- package/README.md +244 -0
- package/assets/brand/hippocamp-mascot.png +0 -0
- package/assets/github-actions/hippocamp-dream.yml +136 -0
- package/package.json +43 -0
- package/scripts/hippocamp-dream.cjs +626 -0
- package/scripts/hippocamp-mcp.cjs +196 -0
- package/scripts/hippocamp-memory.cjs +1110 -0
- package/scripts/hippocamp.cjs +66 -0
- package/scripts/install-claude.cjs +273 -0
- package/scripts/install-codex.cjs +238 -0
- package/skills/hippocamp-memory/SKILL.md +77 -0
package/.env.example
ADDED
package/AGENTS.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
This repository is a local-first MCP package for Git-backed agent memory. Keep changes narrow, explicit, and easy to verify.
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
- The product stores agent memory as Markdown files in a local Git repo, usually `~/.lagoon`.
|
|
8
|
+
- The local Git repo syncs to a usually private GitHub remote through the user's normal Git credentials.
|
|
9
|
+
- Git sync is intentional: it provides audit history, private cloud backup, and cross-machine or cross-agent continuity without a Hippocamp-specific database or token.
|
|
10
|
+
- The app is intentionally not a database, notes app, queue, vector store, cloud API, or auth broker.
|
|
11
|
+
- MVP primitives are:
|
|
12
|
+
- `events/`
|
|
13
|
+
- `projects/<slug>/`
|
|
14
|
+
- curated root Markdown files such as `identity.md` and `preferences.md`
|
|
15
|
+
|
|
16
|
+
## Stack
|
|
17
|
+
|
|
18
|
+
- Node.js CommonJS scripts
|
|
19
|
+
- MCP stdio server
|
|
20
|
+
- Local filesystem reads and writes
|
|
21
|
+
- Git CLI for commit/push sync
|
|
22
|
+
|
|
23
|
+
## Repository Map
|
|
24
|
+
|
|
25
|
+
- `scripts/hippocamp.cjs`: small CLI wrapper for `dream`, `mcp`, `install-codex`, and `install-claude`.
|
|
26
|
+
- `scripts/hippocamp-dream.cjs`: offline Dream CLI for scheduled compaction of curated project wake-up files.
|
|
27
|
+
- `scripts/hippocamp-memory.cjs`: local filesystem-backed Hippocamp memory helpers for MCP use.
|
|
28
|
+
- `scripts/hippocamp-mcp.cjs`: local stdio MCP server for Hippocamp memory tools.
|
|
29
|
+
- `scripts/install-claude.cjs`: one-step installer for Claude Code MCP setup and user-level `CLAUDE.md` guidance.
|
|
30
|
+
- `scripts/install-codex.cjs`: one-step installer for the Hippocamp skill and MCP server in Codex.
|
|
31
|
+
- `skills/hippocamp-memory/SKILL.md`: installable skill that tells agents how to use Hippocamp memory.
|
|
32
|
+
- `assets/github-actions/hippocamp-dream.yml`: scheduled workflow template for Lagoon repos that opens one Dream PR per project.
|
|
33
|
+
- `assets/brand/hippocamp-mascot.png`: README mascot asset.
|
|
34
|
+
|
|
35
|
+
## Project Invariants
|
|
36
|
+
|
|
37
|
+
- Memory paths must stay under the selected Lagoon memory root.
|
|
38
|
+
- Sync paths must stay under the selected Lagoon memory root.
|
|
39
|
+
- Global memory lives under `HIPPOCAMP_GLOBAL_ROOT/`.
|
|
40
|
+
- Project memory lives under `HIPPOCAMP_GLOBAL_ROOT/projects/<slug>/`.
|
|
41
|
+
- The current project slug is inferred from `HIPPOCAMP_PROJECT_ROOT` or the current working directory.
|
|
42
|
+
- Event logs are append-only daily Markdown files under `events/YYYY-MM-DD.md`, with sibling `events/YYYY-MM-DD.index.json` cue indexes.
|
|
43
|
+
- Curated files such as `current_state.md` and `open_threads.md` use explicit file writes.
|
|
44
|
+
- Event entries should include concise `Cues:` values for fuzzy recall when possible.
|
|
45
|
+
- Default sync is automatic through the local Lagoon repo.
|
|
46
|
+
- Local MCP mode must not require `GITHUB_TOKEN`, GitHub App auth, or a cloud service.
|
|
47
|
+
- Memory must not duplicate facts already tracked by GitHub commits, PRs, issues, reviews, or CI. Store references plus the missing rationale, preference, assumption, or follow-up context instead.
|
|
48
|
+
- Dream compaction sends `current_state.md`, `open_threads.md`, and bounded cue-indexed event evidence for open-thread decisions. It must not dump full event logs, cue indexes, or raw GitHub-owned facts into the model prompt.
|
|
49
|
+
- The Dream GitHub Actions workflow is a Lagoon repo template. It should remain schedule-only and create reviewable PRs rather than pushing directly to `main`.
|
|
50
|
+
|
|
51
|
+
## Change Rules
|
|
52
|
+
|
|
53
|
+
- Follow the existing style and keep changes surgical.
|
|
54
|
+
- Do not add abstractions, config knobs, or new subsystems unless the task explicitly requires them.
|
|
55
|
+
- If behavior changes, update `README.md` and this file only when operational guidance actually changes.
|
|
56
|
+
- Prefer extending `scripts/hippocamp-memory.cjs` over duplicating path, sync, or search logic.
|
|
57
|
+
- Keep the product narrow. Simpler is better in this repo.
|
|
58
|
+
|
|
59
|
+
## Verification
|
|
60
|
+
|
|
61
|
+
When changing code, use the smallest verification that proves the change:
|
|
62
|
+
|
|
63
|
+
- Run `node --check scripts/*.cjs` for script syntax changes.
|
|
64
|
+
- Run `npm run mcp:help` when changing MCP registration or commands.
|
|
65
|
+
- Run `npm run mcp:smoke` when changing memory reads, root resolution, or wake-up behavior.
|
|
66
|
+
- Run `npm run dream -- --help` when changing Dream CLI arguments.
|
|
67
|
+
- There is no dedicated test suite yet, so do not claim test coverage that does not exist.
|
|
68
|
+
|
|
69
|
+
## Notes For Future Agents
|
|
70
|
+
|
|
71
|
+
- The cloud/API version is intentionally deferred.
|
|
72
|
+
- Do not reintroduce Next.js, GitHub API token auth, or GitHub App auth for the local MVP.
|
|
73
|
+
- Keep Dream minimal: scheduled CLI compaction, current/open curated files plus bounded thread evidence, one PR per project.
|
|
74
|
+
- The local install story should stay: install MCP, point at Lagoon, rely on normal Git auth.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Guillaume Gay
|
|
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
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
# Hippocamp
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="./assets/brand/hippocamp-mascot.png" alt="Hippocamp mascot" width="220" />
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
Hippocamp is local Git-backed memory for AI coding agents.
|
|
8
|
+
|
|
9
|
+
Agents can edit large codebases, run tests, and push commits, but every new session still starts with amnesia. Project decisions, user preferences, open threads, and "why we did this" context get scattered across chat history, scratch notes, and PR comments. The result is repeated explanations, stale assumptions, and agents rediscovering the same facts instead of continuing the work.
|
|
10
|
+
|
|
11
|
+
Hippocamp gives Codex, Claude Code, and other MCP clients a small shared memory surface they can wake up from, update, and sync. The memory is plain Markdown in a private Git repo you own.
|
|
12
|
+
|
|
13
|
+
No database. No hosted memory service. No vector store. No separate token broker.
|
|
14
|
+
|
|
15
|
+
## What It Stores
|
|
16
|
+
|
|
17
|
+
- durable preferences and working style
|
|
18
|
+
- current project state and open threads
|
|
19
|
+
- meaningful events and decisions
|
|
20
|
+
- references to commits, PRs, issues, reviews, and CI instead of duplicated GitHub facts
|
|
21
|
+
|
|
22
|
+
## Why Git
|
|
23
|
+
|
|
24
|
+
Git is a practical default for agent memory:
|
|
25
|
+
|
|
26
|
+
- Auditable: every memory change has a diff, author, timestamp, and commit history.
|
|
27
|
+
- Readable: memory stays as Markdown files that humans and agents can inspect without a special UI.
|
|
28
|
+
- Collaborative: multiple agents and humans can review, branch, merge, and roll back the same memory repo.
|
|
29
|
+
- Portable: a private remote lets the same memory follow you across machines and agent environments.
|
|
30
|
+
- Agent-native: coding agents are already connected to GitHub through MCP, CLIs, or local Git credentials, so Hippocamp does not need an external database, hosted dependency, or separate token setup.
|
|
31
|
+
|
|
32
|
+
## Install
|
|
33
|
+
|
|
34
|
+
Clone this repo, install dependencies, then install the MCP server for your agent:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm install
|
|
38
|
+
npm run install:codex
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
For Claude Code:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm install
|
|
45
|
+
npm run install:claude
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
After publishing, the intended one-line install shape is:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npx hippocamp install-codex
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Upgrade uses the same install path, so agents can refresh themselves without a separate state model:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npx hippocamp@latest upgrade-codex
|
|
58
|
+
npx hippocamp@latest upgrade-claude
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
From a source checkout:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
git pull --ff-only
|
|
65
|
+
npm install
|
|
66
|
+
npm run upgrade:codex
|
|
67
|
+
npm run upgrade:claude
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Both installers default to `~/.lagoon` as the memory repo. You can override it:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
npm run install:codex -- --global-root /absolute/path/to/lagoon
|
|
74
|
+
npm run install:claude -- --global-root /absolute/path/to/lagoon
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
The Codex installer refreshes `~/.codex/AGENTS.md`. The Claude installer refreshes `~/.claude/CLAUDE.md`.
|
|
78
|
+
Both managed instruction blocks tell the agent to call `wake_up` at the start of new top-level coding tasks before repo exploration or edits.
|
|
79
|
+
|
|
80
|
+
## Lagoon Repo
|
|
81
|
+
|
|
82
|
+
Hippocamp expects a local Git repo for memory:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
git clone git@github.com:YOUR_USER/lagoon.git ~/.lagoon
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
The repo should usually be private. Pushing memory to a private remote keeps it available across machines and agent environments while still using normal Git access controls. Hippocamp does not need a GitHub token for local MCP mode; it uses your normal local Git credentials.
|
|
89
|
+
|
|
90
|
+
If push auth is not configured yet, use your preferred GitHub setup. With GitHub CLI:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
gh auth login
|
|
94
|
+
gh auth setup-git
|
|
95
|
+
cd ~/.lagoon
|
|
96
|
+
git push --dry-run
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Once `git push --dry-run` works from `~/.lagoon`, Hippocamp can sync memory.
|
|
100
|
+
|
|
101
|
+
## Memory Layout
|
|
102
|
+
|
|
103
|
+
Global memory lives in:
|
|
104
|
+
|
|
105
|
+
```text
|
|
106
|
+
~/.lagoon/
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Project memory lives in:
|
|
110
|
+
|
|
111
|
+
```text
|
|
112
|
+
~/.lagoon/projects/<project-slug>/
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Suggested files:
|
|
116
|
+
|
|
117
|
+
```text
|
|
118
|
+
identity.md
|
|
119
|
+
how_i_work.md
|
|
120
|
+
preferences.md
|
|
121
|
+
open_loops.md
|
|
122
|
+
events/YYYY-MM-DD.md
|
|
123
|
+
events/YYYY-MM-DD.index.json
|
|
124
|
+
projects/<project-slug>/
|
|
125
|
+
project.md
|
|
126
|
+
current_state.md
|
|
127
|
+
open_threads.md
|
|
128
|
+
events/YYYY-MM-DD.md
|
|
129
|
+
events/YYYY-MM-DD.index.json
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## MCP Tools
|
|
133
|
+
|
|
134
|
+
The local MCP server exposes:
|
|
135
|
+
|
|
136
|
+
- `wake_up`
|
|
137
|
+
- `read_memory_file`
|
|
138
|
+
- `write_memory_file`
|
|
139
|
+
- `append_event`
|
|
140
|
+
- `list_memory_files`
|
|
141
|
+
- `search_memory`
|
|
142
|
+
- `sync_memory`
|
|
143
|
+
|
|
144
|
+
Typical agent flow:
|
|
145
|
+
|
|
146
|
+
1. Call `wake_up` at the start of a top-level task.
|
|
147
|
+
2. Read the returned global and project memory.
|
|
148
|
+
3. Use `search_memory` only when wake-up files are not enough.
|
|
149
|
+
4. Use `append_event` for meaningful milestones, with concise cues when possible.
|
|
150
|
+
5. Update curated files like `current_state.md` and `open_threads.md` before finishing.
|
|
151
|
+
|
|
152
|
+
Writes sync by default. If sync fails or is skipped, call `sync_memory`.
|
|
153
|
+
|
|
154
|
+
Event writes update a sibling `events/YYYY-MM-DD.index.json` file. The Markdown event remains the canonical memory; the sidecar keeps cue-based fuzzy search fast and rebuildable.
|
|
155
|
+
|
|
156
|
+
## Dream
|
|
157
|
+
|
|
158
|
+
Dream is offline compaction for project wake-up context. It rewrites only:
|
|
159
|
+
|
|
160
|
+
```text
|
|
161
|
+
projects/<project-slug>/current_state.md
|
|
162
|
+
projects/<project-slug>/open_threads.md
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
It does not dump event logs into the model prompt, does not rewrite append-only events, and does not run during normal MCP wake-up. When a project is over the threshold, Dream builds a capped thread evidence pack by searching cue-indexed project events for `open_threads.md` bullets. The evidence budget follows `--target-chars`, so the same size target controls both the desired output and the supporting context. This gives the model enough context to keep, rewrite, close, or promote threads without loading raw history.
|
|
166
|
+
|
|
167
|
+
Dry-run is the default:
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
npm run dream -- --all --dry-run --json
|
|
171
|
+
npm run dream -- --project my-project --write
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
`--write` requires a Manifest/OpenAI-compatible Responses API endpoint. The default environment variables are:
|
|
175
|
+
|
|
176
|
+
- `MANIFEST_BASE_URL`
|
|
177
|
+
- `MANIFEST_API_KEY`
|
|
178
|
+
- `HIPPOCAMP_DREAM_MODEL` (defaults to `auto`; override if you want a specific provider/model)
|
|
179
|
+
|
|
180
|
+
The GitHub Actions template at `assets/github-actions/hippocamp-dream.yml` is meant to be copied into the private Lagoon memory repo as `.github/workflows/hippocamp-dream.yml`. It runs on a schedule only, scans projects over the wake-up threshold, and creates or updates one PR per project so each memory compaction is reviewable.
|
|
181
|
+
|
|
182
|
+
## Memory Rules
|
|
183
|
+
|
|
184
|
+
- Keep memory concise.
|
|
185
|
+
- Prefer curated summaries over raw event history.
|
|
186
|
+
- Give events a short `Cues:` section so fuzzy search can recall them without scanning full bodies first.
|
|
187
|
+
- Do not duplicate GitHub-owned facts such as commits, PRs, issues, reviews, or CI results.
|
|
188
|
+
- Store artifact references plus the missing rationale, preference, assumption, or follow-up context.
|
|
189
|
+
- Use project scope for project-specific state.
|
|
190
|
+
- Use global scope only for durable context that should follow you across projects.
|
|
191
|
+
|
|
192
|
+
Example event content:
|
|
193
|
+
|
|
194
|
+
```md
|
|
195
|
+
Cues:
|
|
196
|
+
- local-first
|
|
197
|
+
- token-free
|
|
198
|
+
- install-story
|
|
199
|
+
|
|
200
|
+
References:
|
|
201
|
+
- commit: abc1234
|
|
202
|
+
- pr: #12
|
|
203
|
+
|
|
204
|
+
Decision:
|
|
205
|
+
Keep the local MCP path token-free and rely on normal git credentials.
|
|
206
|
+
|
|
207
|
+
Why:
|
|
208
|
+
This reduces onboarding friction for open-source users and avoids cloud auth concerns in the MVP.
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## Commands
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
npm run mcp
|
|
215
|
+
npm run mcp:help
|
|
216
|
+
npm run mcp:smoke
|
|
217
|
+
npm run dream
|
|
218
|
+
npm run install:codex
|
|
219
|
+
npm run install:claude
|
|
220
|
+
npm run upgrade:codex
|
|
221
|
+
npm run upgrade:claude
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## Configuration
|
|
225
|
+
|
|
226
|
+
Environment variables are optional for local use:
|
|
227
|
+
|
|
228
|
+
- `HIPPOCAMP_GLOBAL_ROOT`: local Lagoon clone path. Default: `~/.lagoon`
|
|
229
|
+
- `HIPPOCAMP_PROJECT_ROOT`: project root used to infer the current project slug. Default: current working directory
|
|
230
|
+
- `MANIFEST_BASE_URL`: OpenAI-compatible base URL used by `hippocamp dream --write`
|
|
231
|
+
- `MANIFEST_API_KEY`: API key used by `hippocamp dream --write`
|
|
232
|
+
- `HIPPOCAMP_DREAM_MODEL`: model used by Dream. Default: `auto`
|
|
233
|
+
- `HIPPOCAMP_DREAM_THRESHOLD_CHARS`: wake-up size required before Dream proposes compaction. Default: `20000`
|
|
234
|
+
- `HIPPOCAMP_DREAM_TARGET_CHARS`: target combined size for `current_state.md` and `open_threads.md`. Default: `15000`
|
|
235
|
+
|
|
236
|
+
## What This Is Not
|
|
237
|
+
|
|
238
|
+
- Not a hosted cloud service
|
|
239
|
+
- Not a database
|
|
240
|
+
- Not a notes app
|
|
241
|
+
- Not a vector store
|
|
242
|
+
- Not a queue
|
|
243
|
+
|
|
244
|
+
The cloud/API version can be redesigned later. The MVP is intentionally local-first and Git-native.
|
|
Binary file
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
name: Hippocamp Dream
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
schedule:
|
|
5
|
+
- cron: "17 3 * * *"
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: write
|
|
9
|
+
pull-requests: write
|
|
10
|
+
|
|
11
|
+
concurrency:
|
|
12
|
+
group: hippocamp-dream
|
|
13
|
+
cancel-in-progress: false
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
dream:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
timeout-minutes: 10
|
|
19
|
+
|
|
20
|
+
env:
|
|
21
|
+
HIPPOCAMP_GLOBAL_ROOT: ${{ github.workspace }}
|
|
22
|
+
HIPPOCAMP_DREAM_THRESHOLD_CHARS: "20000"
|
|
23
|
+
HIPPOCAMP_DREAM_TARGET_CHARS: "15000"
|
|
24
|
+
HIPPOCAMP_DREAM_MODEL: ${{ secrets.HIPPOCAMP_DREAM_MODEL }}
|
|
25
|
+
MANIFEST_BASE_URL: ${{ secrets.MANIFEST_BASE_URL }}
|
|
26
|
+
MANIFEST_API_KEY: ${{ secrets.MANIFEST_API_KEY }}
|
|
27
|
+
|
|
28
|
+
steps:
|
|
29
|
+
- uses: actions/checkout@v4
|
|
30
|
+
with:
|
|
31
|
+
fetch-depth: 0
|
|
32
|
+
|
|
33
|
+
- uses: actions/setup-node@v4
|
|
34
|
+
with:
|
|
35
|
+
node-version: 22
|
|
36
|
+
|
|
37
|
+
- name: Configure git
|
|
38
|
+
run: |
|
|
39
|
+
git config user.name "hippocamp-dream[bot]"
|
|
40
|
+
git config user.email "hippocamp-dream[bot]@users.noreply.github.com"
|
|
41
|
+
|
|
42
|
+
- name: Find projects over threshold
|
|
43
|
+
run: |
|
|
44
|
+
npx -y hippocamp@latest dream \
|
|
45
|
+
--all \
|
|
46
|
+
--dry-run \
|
|
47
|
+
--json \
|
|
48
|
+
--threshold-chars "$HIPPOCAMP_DREAM_THRESHOLD_CHARS" \
|
|
49
|
+
> /tmp/hippocamp-dream-scan.json
|
|
50
|
+
|
|
51
|
+
node - <<'NODE'
|
|
52
|
+
const fs = require("node:fs");
|
|
53
|
+
const scan = JSON.parse(fs.readFileSync("/tmp/hippocamp-dream-scan.json", "utf8"));
|
|
54
|
+
const projects = scan.results
|
|
55
|
+
.filter((item) => item.skipped === "dry_run")
|
|
56
|
+
.map((item) => item.project);
|
|
57
|
+
fs.writeFileSync("/tmp/hippocamp-dream-projects.txt", `${projects.join("\n")}\n`);
|
|
58
|
+
console.log(`Dream candidates: ${projects.length ? projects.join(", ") : "none"}`);
|
|
59
|
+
NODE
|
|
60
|
+
|
|
61
|
+
- name: Create or update Dream PRs
|
|
62
|
+
env:
|
|
63
|
+
GH_TOKEN: ${{ github.token }}
|
|
64
|
+
run: |
|
|
65
|
+
set -euo pipefail
|
|
66
|
+
|
|
67
|
+
while IFS= read -r project; do
|
|
68
|
+
[ -n "$project" ] || continue
|
|
69
|
+
|
|
70
|
+
branch="dream/${project}"
|
|
71
|
+
git fetch origin main
|
|
72
|
+
git checkout -B "$branch" origin/main
|
|
73
|
+
|
|
74
|
+
npx -y hippocamp@latest dream \
|
|
75
|
+
--project "$project" \
|
|
76
|
+
--write \
|
|
77
|
+
--json \
|
|
78
|
+
--threshold-chars "$HIPPOCAMP_DREAM_THRESHOLD_CHARS" \
|
|
79
|
+
--target-chars "$HIPPOCAMP_DREAM_TARGET_CHARS" \
|
|
80
|
+
> "/tmp/hippocamp-dream-${project}.json"
|
|
81
|
+
|
|
82
|
+
if git diff --quiet -- "projects/${project}/current_state.md" "projects/${project}/open_threads.md"; then
|
|
83
|
+
echo "No Dream diff for ${project}"
|
|
84
|
+
git checkout main
|
|
85
|
+
git reset --hard origin/main
|
|
86
|
+
continue
|
|
87
|
+
fi
|
|
88
|
+
|
|
89
|
+
git add "projects/${project}/current_state.md" "projects/${project}/open_threads.md"
|
|
90
|
+
git commit -m "Dream compact ${project} memory"
|
|
91
|
+
git push --force-with-lease origin "$branch"
|
|
92
|
+
|
|
93
|
+
node - "$project" "/tmp/hippocamp-dream-${project}.json" > "/tmp/hippocamp-dream-${project}.md" <<'NODE'
|
|
94
|
+
const fs = require("node:fs");
|
|
95
|
+
const project = process.argv[2];
|
|
96
|
+
const payload = JSON.parse(fs.readFileSync(process.argv[3], "utf8"));
|
|
97
|
+
const result = payload.results[0];
|
|
98
|
+
const lines = [
|
|
99
|
+
`Dream compacted \`${project}\` curated memory.`,
|
|
100
|
+
"",
|
|
101
|
+
"Before:",
|
|
102
|
+
`- wake_up: ${result.wakeUpChars} chars`,
|
|
103
|
+
`- current_state.md: ${result.files["current_state.md"]} bytes`,
|
|
104
|
+
`- open_threads.md: ${result.files["open_threads.md"]} bytes`,
|
|
105
|
+
"",
|
|
106
|
+
"Context:",
|
|
107
|
+
`- open threads found: ${result.context.openThreads}`,
|
|
108
|
+
`- threads with event evidence: ${result.context.threadsWithEvidence}`,
|
|
109
|
+
`- event evidence snippets: ${result.context.evidenceItems}`,
|
|
110
|
+
`- evidence budget used: ${result.context.evidenceChars}/${result.context.evidenceBudgetChars} chars`,
|
|
111
|
+
"",
|
|
112
|
+
"After:",
|
|
113
|
+
`- wake_up: ${result.afterWakeUpChars} chars`,
|
|
114
|
+
`- current_state.md + open_threads.md: ${result.afterBytes} bytes`,
|
|
115
|
+
"",
|
|
116
|
+
"Policy:",
|
|
117
|
+
"- touched only `current_state.md` and `open_threads.md`",
|
|
118
|
+
"- used bounded cue-indexed event evidence for thread decisions",
|
|
119
|
+
"- did not modify append-only events or cue indexes",
|
|
120
|
+
"- moved historical detail out of wake-up context",
|
|
121
|
+
];
|
|
122
|
+
console.log(lines.join("\n"));
|
|
123
|
+
NODE
|
|
124
|
+
|
|
125
|
+
existing="$(gh pr list --head "$branch" --state open --json number --jq '.[0].number // empty')"
|
|
126
|
+
title="Dream compact ${project} memory"
|
|
127
|
+
|
|
128
|
+
if [ -n "$existing" ]; then
|
|
129
|
+
gh pr edit "$existing" --title "$title" --body-file "/tmp/hippocamp-dream-${project}.md"
|
|
130
|
+
else
|
|
131
|
+
gh pr create --title "$title" --body-file "/tmp/hippocamp-dream-${project}.md" --head "$branch" --base main
|
|
132
|
+
fi
|
|
133
|
+
|
|
134
|
+
git checkout main
|
|
135
|
+
git reset --hard origin/main
|
|
136
|
+
done < /tmp/hippocamp-dream-projects.txt
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "hippocamp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Local Git-backed memory for AI agents.",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+ssh://git@github.com/guillaumegay13/hippocamp.git"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/guillaumegay13/hippocamp/issues"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://github.com/guillaumegay13/hippocamp#readme",
|
|
15
|
+
"keywords": [
|
|
16
|
+
"agents",
|
|
17
|
+
"mcp",
|
|
18
|
+
"memory",
|
|
19
|
+
"markdown",
|
|
20
|
+
"git"
|
|
21
|
+
],
|
|
22
|
+
"bin": {
|
|
23
|
+
"hippocamp": "scripts/hippocamp.cjs",
|
|
24
|
+
"hippocamp-dream": "scripts/hippocamp-dream.cjs",
|
|
25
|
+
"hippocamp-mcp": "scripts/hippocamp-mcp.cjs",
|
|
26
|
+
"hippocamp-install-codex": "scripts/install-codex.cjs",
|
|
27
|
+
"hippocamp-install-claude": "scripts/install-claude.cjs"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"dream": "node scripts/hippocamp-dream.cjs",
|
|
31
|
+
"install:claude": "node scripts/install-claude.cjs",
|
|
32
|
+
"install:codex": "node scripts/install-codex.cjs",
|
|
33
|
+
"mcp": "node scripts/hippocamp-mcp.cjs",
|
|
34
|
+
"mcp:help": "node scripts/hippocamp-mcp.cjs --help",
|
|
35
|
+
"mcp:smoke": "node scripts/hippocamp-mcp.cjs --smoke",
|
|
36
|
+
"upgrade:claude": "node scripts/install-claude.cjs",
|
|
37
|
+
"upgrade:codex": "node scripts/install-codex.cjs"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
41
|
+
"zod": "^4.3.6"
|
|
42
|
+
}
|
|
43
|
+
}
|