hippo-memory 3.5.1 → 3.7.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 +37 -25
- package/dist/api/context/context-pools.js +2 -2
- package/dist/api/context/context.d.ts +1 -1
- package/dist/api/context/context.js +13 -9
- package/dist/api/ledger-db.d.ts +4 -2
- package/dist/api/ledger-db.js +11 -1
- package/dist/api/pilot-arm.js +4 -1
- package/dist/api/recall/finish.js +3 -2
- package/dist/api/recall/recall.js +3 -1
- package/dist/api/recall/request.d.ts +1 -1
- package/dist/api/recall/request.js +3 -1
- package/dist/api/tokens.d.ts +1 -1
- package/dist/api/tokens.js +3 -0
- package/dist/api/types.d.ts +2 -0
- package/dist/api/types.js +4 -0
- package/dist/base/config/config-keys.js +2 -1
- package/dist/base/config/config.d.ts +5 -1
- package/dist/base/config/config.js +1 -0
- package/dist/base/errors/read-only.d.ts +3 -0
- package/dist/base/errors/read-only.js +4 -0
- package/dist/base/memory/entry.d.ts +10 -2
- package/dist/base/memory/entry.js +12 -4
- package/dist/base/scope/read-admission.js +2 -2
- package/dist/base/util/env.d.ts +1 -0
- package/dist/base/util/env.js +3 -0
- package/dist/base/util/version.d.ts +1 -1
- package/dist/base/util/version.js +1 -1
- package/dist/cli.js +14 -1
- package/dist/db/connect.d.ts +4 -0
- package/dist/db/connect.js +79 -1
- package/dist/db/grant.js +1 -1
- package/dist/db/migrate.d.ts +3 -0
- package/dist/db/migrate.js +1 -1
- package/dist/db/store-runtime.d.ts +7 -0
- package/dist/db/store-runtime.js +4 -0
- package/dist/domain/consolidate/conflicts.js +3 -1
- package/dist/domain/context/select-policy.d.ts +1 -1
- package/dist/domain/context/select-policy.js +3 -3
- package/dist/domain/sharing/share.js +3 -1
- package/dist/store/sqlite/capture/captures.js +19 -6
- package/dist/store/sqlite/index.d.ts +1 -1
- package/dist/store/sqlite/learning/prediction-baserate.js +4 -2
- package/dist/store/sqlite/recall/candidates.js +3 -2
- package/dist/store/sqlite/recall/search-rows.js +5 -2
- package/dist/store/sqlite/runtime/handles.js +3 -0
- package/dist/surface/capture/capture-error.d.ts +4 -1
- package/dist/surface/capture/capture-error.js +2 -1
- package/dist/surface/capture/command.d.ts +8 -3
- package/dist/surface/capture/command.js +61 -11
- package/dist/surface/capture/extract.d.ts +2 -0
- package/dist/surface/capture/extract.js +7 -0
- package/dist/surface/capture/failure-caller.js +1 -0
- package/dist/surface/capture/user-messages.d.ts +9 -0
- package/dist/surface/capture/user-messages.js +42 -0
- package/dist/surface/cli/api-context.js +1 -0
- package/dist/surface/cli/cli-runtime.js +2 -1
- package/dist/surface/cli/hooks/capture-error.js +7 -1
- package/dist/surface/cli/hooks/codex-session-end-worker.js +1 -0
- package/dist/surface/cli/hooks/session-end-worker.js +14 -2
- package/dist/surface/cli/serve.js +4 -1
- package/dist/surface/cli/verb-row.d.ts +2 -0
- package/dist/surface/cli/verbs/health.js +3 -0
- package/dist/surface/cli/verbs/memory.js +5 -0
- package/dist/surface/cli/verbs/objects.js +2 -0
- package/dist/surface/cli/verbs/sessions.js +11 -0
- package/dist/surface/mcp/request.js +6 -2
- package/dist/surface/mcp/tools.d.ts +2 -0
- package/dist/surface/mcp/tools.js +8 -0
- package/dist/surface/open-store.d.ts +2 -2
- package/dist/surface/open-store.js +2 -2
- package/extensions/openclaw-plugin/openclaw.plugin.json +1 -1
- package/extensions/openclaw-plugin/package.json +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# 🦛 Hippo
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
**Your corrections, remembered by Claude Code, Codex and Cursor.**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Hippo is open-source memory that runs on your machine and gives the rules it captured back to the agent when a new session starts. In our Claude Code test on 29 repositories, adding it to built-in memory cut repeat mistakes from 21 in 100 to 11, at the same cost.
|
|
6
6
|
|
|
7
7
|
[](https://npmjs.com/package/hippo-memory)
|
|
8
8
|
[](https://npmjs.com/package/hippo-memory)
|
|
@@ -24,7 +24,7 @@ npm install -g hippo-memory && hippo init
|
|
|
24
24
|
|
|
25
25
|
Setting up every git repo under a folder in one go is a second step. The [Quick start](#quick-start) says what it changes, then gives the command.
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
Installing the package alone captures nothing, and what runs after init depends on the agent.
|
|
28
28
|
|
|
29
29
|
Having an AI agent install it? Point it at [llms-install.md](llms-install.md): it installs, wires hippo into the agents it finds, and verifies with `hippo doctor`.
|
|
30
30
|
|
|
@@ -88,7 +88,7 @@ npm install -g hippo-memory
|
|
|
88
88
|
hippo init
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
-
**Optional: many repos at once.** Read what it changes first. `hippo init --scan <folder>` looks for git repos in the folder and up to three levels below it, skipping dot-folders and `node_modules`. Each repo gets a `.hippo/` store, seeded with lessons from the last 365 days of its commits and with its [agent memories](#agent-memories), and is added to the daily run's list. For the agents it finds, it installs the same user-level hooks as `hippo init`:
|
|
91
|
+
**Optional: many repos at once.** Read what it changes first. `hippo init --scan <folder>` looks for git repos in the folder and up to three levels below it, skipping dot-folders and `node_modules`. Each repo gets a `.hippo/` store, seeded with lessons from the last 365 days of its commits and with its [agent memories](#agent-memories), and is added to the daily run's list. For the agents it finds, it installs the same user-level hooks as `hippo init`: 8 Claude Code hook entries in `~/.claude/settings.json` and the OpenCode plugin. It also sets up the daily 6:15am run, a crontab line on Linux and macOS or a scheduled task on Windows. It adds no block to any repo's `CLAUDE.md` or `AGENTS.md`. `--no-hooks`, `--no-schedule` and `--no-learn` leave out the hooks, the daily run and the history import.
|
|
92
92
|
|
|
93
93
|
```bash
|
|
94
94
|
hippo init --scan ~
|
|
@@ -119,7 +119,7 @@ Run `hippo init` inside one project. This is everything it writes, in the projec
|
|
|
119
119
|
|
|
120
120
|
- **The project's store.** A `.hippo/` folder: SQLite plus markdown mirrors. On the first run in a git repo it learns lessons from the last 30 days of commits.
|
|
121
121
|
- **Instruction files.** A block between `<!-- hippo:start -->` and `<!-- hippo:end -->` in the project's `CLAUDE.md` or `AGENTS.md`, only if that file already exists. Codex, Cursor, OpenClaw, OpenCode and Pi read `AGENTS.md`.
|
|
122
|
-
- **Claude Code,** when the project has `CLAUDE.md` or `.claude/settings.json`:
|
|
122
|
+
- **Claude Code,** when the project has `CLAUDE.md` or `.claude/settings.json`: 8 hook entries in `~/.claude/settings.json`, one each on SessionEnd, UserPromptSubmit, PreCompact, PostCompact and PostToolUseFailure and three on SessionStart. [Framework Integrations](#framework-integrations) says what each one runs.
|
|
123
123
|
- **OpenCode,** when the project has `.opencode/` or `opencode.json`: a plugin at `~/.config/opencode/plugins/hippo.ts`.
|
|
124
124
|
- **Codex,** when the project has `AGENTS.md` or `.codex` and Codex is installed (`$CODEX_HOME`, else `~/.codex`, exists): 2 hook entries in Codex's `hooks.json`, one on UserPromptSubmit that sends your pinned memories plus up to 5 that match the prompt with every prompt and one on SessionStart after a compaction. **Codex runs them only after you trust them once in `/hooks`.** Init also prints `hippo hook install codex`, the opt-in that wraps the Codex launcher to capture sessions; `hippo hook uninstall codex` removes hippo's hooks and the wrapper.
|
|
125
125
|
- **A daily run at 6:15am,** one per machine: a crontab line on Linux and macOS, a scheduled task named `hippo-daily-runner` on Windows. It runs `hippo learn --git --days 1` and then `hippo sleep` in every project listed in `~/.hippo/workspaces.json`, and init adds this project to that list.
|
|
@@ -208,6 +208,15 @@ Word patterns pin a later turn only when it holds a rule word (never, always, mu
|
|
|
208
208
|
- **What it sends:** your turns after the first one in the session, the last 20, each cut to 1,000 characters. Pasted blocks, fenced code and log lines are removed first, and secrets, email addresses and home paths are masked. The assistant's replies are never sent.
|
|
209
209
|
- **To whom:** Anthropic, with your `ANTHROPIC_API_KEY`, in one call per session capture. A failed call logs one line and capture keeps its pattern rules. A session with no project never makes the call.
|
|
210
210
|
- **On and off:** the default is `"off"`. Set `"model"` to turn it on; set `"off"` again, or unset the key, to turn it off.
|
|
211
|
+
|
|
212
|
+
#### What you type
|
|
213
|
+
|
|
214
|
+
The session-end hook also saves each message you type of 3 or more words, as you typed it. A fact you tell the agent in chat, such as a name or a date, then comes back in a later session. Hippo never saves the agent's replies.
|
|
215
|
+
|
|
216
|
+
- **How it is stored:** one `kind='raw'` row per message, with the tag `user-message`, the owner `user:<you>` and a `session:<id>/<hash>` reference. Secrets and email addresses are masked first. A message over 2,000 characters keeps your own words without the pasted code, then is cut.
|
|
217
|
+
- **Where:** only the project's own store. The global store, `hippo capture --stdin` and `--file` never save messages.
|
|
218
|
+
- **When it comes back:** a prompt that shares words with it, or `hippo recall`. It never fills the prompt hook's recent list, has no markdown mirror, and is never shared to the global store or merged.
|
|
219
|
+
- **On and off:** the default is on. Set `{"capture": {"userMessages": false}}` in `.hippo/config.json` to turn it off. To remove one message, run `hippo forget <id> --archive --reason <why>`.
|
|
211
220
|
- A capture after each reply (`--turn`, as VS Code's agent mode runs) never calls the model, so those runtimes gain little.
|
|
212
221
|
|
|
213
222
|
### Slack ingestion (E1.3)
|
|
@@ -773,7 +782,7 @@ The command runs with no shell, so each argument reaches the program as written.
|
|
|
773
782
|
| `hippo decide "<decision>" --context "<why>"` | Include reasoning |
|
|
774
783
|
| `hippo decide "<decision>" --supersedes <id>` | Supersede a previous decision |
|
|
775
784
|
| `hippo hook list` | Show available framework hooks |
|
|
776
|
-
| `hippo hook install <target>` | Install hook (claude-code also adds its
|
|
785
|
+
| `hippo hook install <target>` | Install hook (claude-code also adds its 8 settings.json hook entries: session start and end, each prompt, compaction, failed tool calls) |
|
|
777
786
|
| `hippo hook uninstall <target>` | Remove hook |
|
|
778
787
|
| `hippo handoff create --summary "..."` | Create a session handoff |
|
|
779
788
|
| `hippo handoff latest` | Show the most recent handoff |
|
|
@@ -803,6 +812,8 @@ The command runs with no shell, so each argument reaches the program as written.
|
|
|
803
812
|
|
|
804
813
|
On `heartbeat`, `block`, `review` and `complete`, a given `--run` is checked against the card's live run and the command is refused, unchanged, if the two do not match.
|
|
805
814
|
|
|
815
|
+
`HIPPO_READ_ONLY=1` uses a store without changing it, for example in the test phase of a benchmark. `hippo recall`, `hippo context`, the prompt hook and the MCP read tools give the same answers and write nothing: no recall counts, token-ledger rows, audit rows or mirror files, and a store with a WAL keeps its WAL. `remember`, `supersede`, `refine`, `outcome`, `resolve`, `decide`, `invalidate`, `forget`, `learn`, `promote`, `share` and `import`, and the MCP tools `hippo_remember`, `hippo_outcome`, `hippo_learn`, `hippo_resolve` and `hippo_share`, answer `read-only: not saved (HIPPO_READ_ONLY=1)` and save nothing (the CLI exits 1). `capture`, `capture-error`, `sleep`, `pre-compact`, `post-compact` and `session-end` log one line and do nothing, `hippo serve` does not start, and any other command that writes to the store fails with the store's own read-only error.
|
|
816
|
+
|
|
806
817
|
---
|
|
807
818
|
|
|
808
819
|
## Framework Integrations
|
|
@@ -813,7 +824,7 @@ On `heartbeat`, `block`, `review` and `complete`, a given `--run` is checked aga
|
|
|
813
824
|
|
|
814
825
|
| Framework | Detected by | Patches |
|
|
815
826
|
|-----------|------------|---------|
|
|
816
|
-
| Claude Code | `CLAUDE.md` or `.claude/settings.json` | `CLAUDE.md` +
|
|
827
|
+
| Claude Code | `CLAUDE.md` or `.claude/settings.json` | `CLAUDE.md` + 8 hook entries in `~/.claude/settings.json` (listed below) |
|
|
817
828
|
| Codex | `AGENTS.md` or `.codex` | `AGENTS.md` + `UserPromptSubmit`/`SessionStart(compact)` hooks in Codex's `hooks.json` when Codex is installed (trust them once in `/hooks`); session capture is opt-in with `hippo hook install codex`, which wraps the Codex launcher |
|
|
818
829
|
| Cursor | `AGENTS.md` | `AGENTS.md`, which Cursor reads from the project root |
|
|
819
830
|
| OpenClaw | `.openclaw` or `AGENTS.md` | `AGENTS.md`; the native plugin is a separate install: `openclaw plugins install hippo-memory` |
|
|
@@ -829,7 +840,7 @@ Setup guides on the website: [Claude Code](https://hippo-memory.com/claude-code/
|
|
|
829
840
|
If you prefer explicit control:
|
|
830
841
|
|
|
831
842
|
```bash
|
|
832
|
-
hippo hook install claude-code # patches CLAUDE.md + adds the
|
|
843
|
+
hippo hook install claude-code # patches CLAUDE.md + adds the 8 settings.json hook entries listed below
|
|
833
844
|
hippo hook install codex # patches AGENTS.md + adds hooks to Codex's hooks.json + wraps the detected Codex launcher
|
|
834
845
|
hippo hook install cursor # patches AGENTS.md
|
|
835
846
|
hippo hook install openclaw # patches AGENTS.md
|
|
@@ -844,9 +855,10 @@ This adds a `<!-- hippo:start -->` ... `<!-- hippo:end -->` block that tells the
|
|
|
844
855
|
|
|
845
856
|
The block asks for nothing a hook already does, because each extra tool call re-reads the whole context. Re-running `hippo init` swaps a block an older hippo wrote for the current one, as long as nobody edited it. It leaves an edited block alone and says so, and never touches text outside the markers.
|
|
846
857
|
|
|
847
|
-
For Claude Code, it also adds
|
|
848
|
-
- a `SessionEnd` hook that runs `hippo sleep` and then `hippo capture` when the session exits. Capture matches the last 20 user and 10 assistant messages of the transcript against word patterns for decisions, rules, errors and preferences. It uses no model unless you turn on `capture.followUpRules` (see Conversation Capture)
|
|
858
|
+
For Claude Code, it also adds 8 hook entries to `~/.claude/settings.json`:
|
|
859
|
+
- a `SessionEnd` hook that runs `hippo sleep` and then `hippo capture` when the session exits. Capture matches the last 20 user and 10 assistant messages of the transcript against word patterns for decisions, rules, errors and preferences. It uses no model unless you turn on `capture.followUpRules` (see Conversation Capture). The patterns do not read earlier turns, so a correction older than that window becomes a pinned rule only with `hippo remember --pin` by hand. Capture also saves each message you typed whole, so recall still finds the older correction (see What you type).
|
|
849
860
|
- a `SessionStart` hook that prints the previous session's consolidation log on stderr, where `claude --debug` shows it. When the last sleep failed or a compaction summary was set aside, it shows you one line that points to `hippo doctor`.
|
|
861
|
+
- a second `SessionStart` hook that runs `hippo session-rules`, which prints the rules you taught under `## Rules from the user` and nothing else. It has no matcher, so a resumed or cleared session and a compaction get the rules again.
|
|
850
862
|
- a `UserPromptSubmit` hook that runs `hippo context --pinned-only --include-recent 5 --format additional-context` every turn. It re-injects pinned memories (`hippo remember <text> --pin`) plus up to 5 memories that share words with your prompt. When nothing matches, it adds only the pinned ones. Since 1.55.0 this replaces the 5 newest memories, which cut the median block from 847 to 533 tokens in our eval. `{"pinnedInject":{"promptRecall":false}}` brings back the 5 newest, so fresh same-session lessons appear on the next prompt whatever you ask. The block is rendered without live strength percentages, so it stays byte-identical while its memories do not change, and it is sent only when it changed since the session's last prompt: an unchanged block is skipped, resent every 10 skips (`pinnedInject.refreshTurns`, `0` never resends) and resent after compaction. The prompt-matched memories go in a separate block that is never skipped, so they are sent on every prompt they match. `{"pinnedInject":{"skipUnchanged":false}}` sends the pinned block every turn as before. `{"pinnedInject":{"excludeTags":["session-digest"]}}` leaves out every memory that carries a listed tag, whether it is pinned, recent or matched to the prompt; the list is empty by default. Opt out entirely with `{"pinnedInject":{"enabled":false}}` in `.hippo/config.json`.
|
|
851
863
|
- a `PreCompact` hook that runs `hippo pre-compact` before the transcript gets summarized. It records the compaction in the store, saves a working-state snapshot (task/summary/next step) so mid-session compaction can't drop it, and asks the summariser to end its summary with a "Memories for hippo" list: the lessons, decisions and corrections from the session that should outlive it. The `SessionEnd` hook still owns extracting durable memories from the transcript.
|
|
852
864
|
- a second `SessionStart` hook (matcher `compact`) that runs `hippo compact-resume`, printing that snapshot back into context right after compaction, if it is under 15 minutes old.
|
|
@@ -934,7 +946,7 @@ Plugin docs: [extensions/openclaw-plugin/](extensions/openclaw-plugin/). Integra
|
|
|
934
946
|
|
|
935
947
|
### Claude Code Plugin
|
|
936
948
|
|
|
937
|
-
Plugin with session, prompt and compaction hooks
|
|
949
|
+
Plugin with session, prompt and compaction hooks, error auto-capture, and the `hippo-memory` MCP server (`hippo mcp`). See [extensions/claude-code-plugin/](extensions/claude-code-plugin/).
|
|
938
950
|
|
|
939
951
|
Full integration details: [integrations/](integrations/)
|
|
940
952
|
|
|
@@ -1107,59 +1119,59 @@ node run.mjs --adapter all
|
|
|
1107
1119
|
|
|
1108
1120
|
### How do I give Claude Code memory between sessions?
|
|
1109
1121
|
|
|
1110
|
-
Run `npm install -g hippo-memory`, then `hippo init` in the project.
|
|
1122
|
+
Run `npm install -g hippo-memory`, then `hippo init` in the project. Init adds a short block to an existing `CLAUDE.md` and installs hooks that keep pinned memories in context, save your task before compaction, store failed tool calls and run `hippo sleep` when the session ends.
|
|
1111
1123
|
|
|
1112
1124
|
### How do I give Cursor memory between sessions?
|
|
1113
1125
|
|
|
1114
|
-
`hippo init` adds its instructions to `AGENTS.md` if the project has one,
|
|
1126
|
+
`hippo init` adds its instructions to `AGENTS.md` if the project has one, which Cursor reads. Add `hippo mcp` to `.cursor/mcp.json` and Cursor's agent gets tools to recall and store memories. `hippo import --cursor .cursor/rules` turns your existing rules into memories.
|
|
1115
1127
|
|
|
1116
1128
|
### How do I give Codex memory across sessions?
|
|
1117
1129
|
|
|
1118
|
-
`hippo init` adds its instructions to your `AGENTS.md`, which Codex reads before it starts work. Capturing Codex sessions is opt-in
|
|
1130
|
+
`hippo init` adds its instructions to your `AGENTS.md`, which Codex reads before it starts work. Capturing Codex sessions is opt-in, with `hippo hook install codex`.
|
|
1119
1131
|
|
|
1120
1132
|
### Which agents does hippo work with?
|
|
1121
1133
|
|
|
1122
|
-
`hippo init` detects Claude Code, Codex, Cursor, OpenClaw, OpenCode and Pi, and wires itself into each one's instruction file, hooks or plugin.
|
|
1134
|
+
`hippo init` detects Claude Code, Codex, Cursor, OpenClaw, OpenCode and Pi, and wires itself into each one's instruction file, hooks or plugin. What runs automatically differs by agent. Any MCP client can use the [MCP server](#mcp-server), and anything else can call the CLI.
|
|
1123
1135
|
|
|
1124
1136
|
### Can I use hippo as an MCP memory server?
|
|
1125
1137
|
|
|
1126
|
-
Yes. `hippo mcp` runs the server over stdio
|
|
1138
|
+
Yes. `hippo mcp` runs the server over stdio. Add it to the MCP config of Cursor, Claude Desktop, Windsurf (now Devin Desktop), Cline or any other client, or in Claude Code run `claude mcp add hippo-memory -- hippo mcp`.
|
|
1127
1139
|
|
|
1128
1140
|
### How is hippo different from mem0?
|
|
1129
1141
|
|
|
1130
|
-
mem0 uses a language model to extract memories,
|
|
1142
|
+
mem0 uses a language model to extract memories, and its hosted MCP server keeps them in your Mem0 account ([mem0 docs](https://docs.mem0.ai/platform/mem0-mcp), checked 2026-09-28). Hippo stores memories in SQLite on your machine and needs no account and no model. On LoCoMo, a public test of questions about long conversations, Mem0 scored 94.9 and hippo 89.4 when we ran both.
|
|
1131
1143
|
|
|
1132
1144
|
### Is this just RAG?
|
|
1133
1145
|
|
|
1134
|
-
|
|
1146
|
+
Partly. Recall is search, BM25 plus embeddings if you install them. The difference is that the store changes as your agent works. A memory you mark wrong drops down the results, a newer fact replaces an old one, and unused memories fade.
|
|
1135
1147
|
|
|
1136
1148
|
### Does it need embeddings?
|
|
1137
1149
|
|
|
1138
|
-
No. Recall runs on BM25 out of the box, with no model and no network call
|
|
1150
|
+
No. Recall runs on BM25 out of the box, with no model and no network call. With the optional free local embedder on, hippo scored higher than without it on two of five public answer tests, by 3.4 and 11.9 points, with no clear difference on the other three.
|
|
1139
1151
|
|
|
1140
1152
|
### Do I still need CLAUDE.md?
|
|
1141
1153
|
|
|
1142
|
-
Yes, for short standing rules such as build commands
|
|
1154
|
+
Yes, for short standing rules such as build commands and code style. Claude Code's [memory docs](https://code.claude.com/docs/en/memory) say that when two rules contradict each other, Claude may pick one arbitrarily. Hippo holds the lessons that pile up and recalls the ones that match the task.
|
|
1143
1155
|
|
|
1144
1156
|
### What happens when a memory turns out to be wrong?
|
|
1145
1157
|
|
|
1146
|
-
|
|
1158
|
+
`hippo outcome --bad` weakens the memories from the last recall, and `hippo supersede <id> "<new fact>"` replaces one. On a synthetic test where every mark was correct, a bad mark cut how often a wrong memory stayed in the top five from 71.9% to 0.0%. Real marks are noisier.
|
|
1147
1159
|
|
|
1148
1160
|
### Where does hippo keep my data?
|
|
1149
1161
|
|
|
1150
|
-
On your machine, in SQLite
|
|
1162
|
+
On your machine, in SQLite, as `.hippo/hippo.db` in each project and a global store in `~/.hippo/`, with markdown mirrors you can read and commit. Recall makes no network call by default. Text leaves your machine only through an API embedder, a reranker, model-read rule capture (`capture.followUpRules`), `hippo refine`, or `hippo sleep` when `ANTHROPIC_API_KEY` is set. `{"extraction":{"enabled":false}}` in `.hippo/config.json` turns that last one off.
|
|
1151
1163
|
|
|
1152
1164
|
### What does hippo cost?
|
|
1153
1165
|
|
|
1154
|
-
Nothing. Hippo is MIT-licensed and needs no account or API key. Optional features that call an outside provider bill through it
|
|
1166
|
+
Nothing. Hippo is MIT-licensed and needs no account or API key. Optional features that call an outside provider bill through it. The Jev reranker costs about 0.0004 USD a recall, and API embedders and sleep's fact extraction use your own keys.
|
|
1155
1167
|
|
|
1156
1168
|
### Is it production-ready?
|
|
1157
1169
|
|
|
1158
|
-
Judge it by what is tested. 3,500+ tests run against a real database, with no module mocks and no mocked store
|
|
1170
|
+
Judge it by what is tested. 3,500+ tests run against a real database, with no module mocks and no mocked store. It has zero runtime dependencies. The next question covers what it does to an agent's work.
|
|
1159
1171
|
|
|
1160
1172
|
### Has hippo been shown to make agents better at their work?
|
|
1161
1173
|
|
|
1162
|
-
On repeat mistakes, yes
|
|
1174
|
+
On repeat mistakes, yes, in [one test of our own](https://github.com/kitfunso/hippo-memory/blob/master/docs/evals/2026-11-08-z0-round3-result.md). We corrected Claude Code once on 29 repositories and counted repeats 2 to 4 tasks later, finding 11 in 100 with hippo added, against 21 with built-in memory alone, at the same cost. We can't yet say why, because the gain was the same with lesson capture switched off. Failed runs are in [docs/evals](https://github.com/kitfunso/hippo-memory/blob/master/docs/evals/README.md) too.
|
|
1163
1175
|
|
|
1164
1176
|
---
|
|
1165
1177
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Which rows a context call loads.
|
|
2
|
-
import {
|
|
2
|
+
import { isRecallOnly } from '../../base/memory/entry.js';
|
|
3
3
|
import { DEFAULT_SEARCH_CANDIDATE_LIMIT } from '../../base/rank/search-types.js';
|
|
4
4
|
import { projectNames } from '../../base/scope/project-identity.js';
|
|
5
5
|
import { ambientAdmits, ambientEnvelopeAdmits, } from '../../base/scope/read-admission.js';
|
|
@@ -40,7 +40,7 @@ async function loadAmbientEntries(source, tenantId, options) {
|
|
|
40
40
|
// SHORTCUT: a search filters notes after its limit, so a query matching 200 notes returns fewer rows or none;
|
|
41
41
|
// push it into the search SQL if a store gets there.
|
|
42
42
|
return {
|
|
43
|
-
entries: rows.filter((e) => ownTenant(e) && admit(e) && (e.pinned || !
|
|
43
|
+
entries: rows.filter((e) => ownTenant(e) && admit(e) && (e.pinned || !isRecallOnly(e))),
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
46
|
// The store applies the quality floor too, or its recent-N load stops short of a store whose
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ContextOptions, ContextResult } from './context-types.js';
|
|
2
|
-
import type
|
|
2
|
+
import { type Context } from '../types.js';
|
|
3
3
|
/** Tokens a context block may use when the caller sets no budget; the hook command and the CLI
|
|
4
4
|
* default match it. */
|
|
5
5
|
export declare const DEFAULT_CONTEXT_BUDGET = 1500;
|
|
@@ -9,6 +9,7 @@ import { selectPinned, selectStrongest } from './context-select.js';
|
|
|
9
9
|
import { selectBySearch } from './context-search.js';
|
|
10
10
|
import { strengthenOf } from '../recall/finish.js';
|
|
11
11
|
import { keepShownIds } from '../recall/last-recalled.js';
|
|
12
|
+
import { readOnlyOf } from '../types.js';
|
|
12
13
|
import { NO_QUERY, sourceOf, globalSource, planContext, promptRecallRequest, openBlockBudget, } from './context-plan.js';
|
|
13
14
|
import { ambientAdmission, loadPools, userRuleReserve } from './context-pools.js';
|
|
14
15
|
import { loadTaskSections, pointerModes } from './context-task-state.js';
|
|
@@ -51,7 +52,7 @@ export async function assembleContext(ctx, opts) {
|
|
|
51
52
|
if (items.length === 0 && noSections) {
|
|
52
53
|
// A query that found nothing is the coverage-gap signal, so it still gets a trace; pinned-only
|
|
53
54
|
// stays read-only.
|
|
54
|
-
if (!plan.pinnedOnly)
|
|
55
|
+
if (!plan.pinnedOnly && !readOnlyOf(ctx))
|
|
55
56
|
await traceEmptyContext(ctx, opts, plan);
|
|
56
57
|
return { entries: [], tokens: 0 };
|
|
57
58
|
}
|
|
@@ -156,14 +157,17 @@ async function recordRetrieval(ctx, { opts, plan, selected, activeSnapshot }) {
|
|
|
156
157
|
})),
|
|
157
158
|
};
|
|
158
159
|
const writes = { goalLog: [], audit: [], trace, strengthen: strengthenOf(ctx, retrievedIds) };
|
|
159
|
-
//
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
160
|
+
// A read-only store keeps its rows; the reply still shows them as this retrieval left them.
|
|
161
|
+
if (!readOnlyOf(ctx)) {
|
|
162
|
+
// The last recall feeds only outcomeForLastRecall, so a store that keeps none still finishes the
|
|
163
|
+
// recall without one.
|
|
164
|
+
const store = ctx.store;
|
|
165
|
+
const traceId = store.lastRecall
|
|
166
|
+
? await store.lastRecall.finishRecall(writes, plan.hasGlobal ? plan.globalRoot : undefined)
|
|
167
|
+
: await store.finishRecall(writes).then(() => null);
|
|
168
|
+
plan.obs?.traced(traceId);
|
|
169
|
+
await store.bumpRecallStats(selected.length);
|
|
170
|
+
}
|
|
167
171
|
// Replace selectedItems entries with markRetrieved-updated copies so the returned ContextResult
|
|
168
172
|
// reflects post-recall state.
|
|
169
173
|
const items = selected.map((s) => ({
|
package/dist/api/ledger-db.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { LedgerTurn } from '../base/ports/store.js';
|
|
2
2
|
import type { TokenSurface, TokenUse } from '../base/ports/store/ledger.js';
|
|
3
3
|
import type { LastSent } from '../base/session/skip-unchanged.js';
|
|
4
|
-
import type
|
|
4
|
+
import { type Context, type GlobalInReach, type LedgerHome } from './types.js';
|
|
5
5
|
import { type DeliveryFault, type DeliveryRecorder } from './delivery/delivery-recorder.js';
|
|
6
6
|
import type { DeliveryEventInput, DeliveryEventType } from '../base/session/delivery.js';
|
|
7
7
|
import type { HookRuntime } from '../base/session/capture-contract.js';
|
|
@@ -10,10 +10,12 @@ import type { HookRuntime } from '../base/session/capture-contract.js';
|
|
|
10
10
|
export interface LedgerReach {
|
|
11
11
|
readonly local?: LedgerHome;
|
|
12
12
|
readonly global?: GlobalInReach;
|
|
13
|
+
/** Under HIPPO_READ_ONLY=1 the rows are still read, so a skip decision holds, and never booked. */
|
|
14
|
+
readonly readOnly?: true;
|
|
13
15
|
}
|
|
14
16
|
/** Only a store that keeps a ledger has one, and a local one needs a reach that says the caller
|
|
15
17
|
* has a store. */
|
|
16
|
-
export declare function ledgerReachOf(ctx: Pick<Context, 'reach'>, shared?: boolean): LedgerReach;
|
|
18
|
+
export declare function ledgerReachOf(ctx: Pick<Context, 'reach' | 'config'>, shared?: boolean): LedgerReach;
|
|
17
19
|
/** The call's own store, else the global store (the prompt hook fires where none is); null with
|
|
18
20
|
* neither. */
|
|
19
21
|
export declare function ledgerHome(reach: LedgerReach): LedgerHome | null;
|
package/dist/api/ledger-db.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { readOnlyOf } from './types.js';
|
|
1
2
|
import { createDeliveryRecorder, } from './delivery/delivery-recorder.js';
|
|
2
3
|
import { errorMessage, log, errorFields } from '../base/util/log.js';
|
|
3
4
|
function homeOf(global) {
|
|
@@ -11,7 +12,8 @@ function homeOf(global) {
|
|
|
11
12
|
* has a store. */
|
|
12
13
|
export function ledgerReachOf(ctx, shared) {
|
|
13
14
|
const local = ctx.reach?.hasLocal === true ? ctx.reach.ledger : undefined;
|
|
14
|
-
|
|
15
|
+
const reach = shared === true ? { local } : { local, global: ctx.reach?.global };
|
|
16
|
+
return readOnlyOf(ctx) ? { ...reach, readOnly: true } : reach;
|
|
15
17
|
}
|
|
16
18
|
/** The call's own store, else the global store (the prompt hook fires where none is); null with
|
|
17
19
|
* neither. */
|
|
@@ -23,16 +25,22 @@ export function ledgerHome(reach) {
|
|
|
23
25
|
}
|
|
24
26
|
/** Books one row in ledgerHome's store, best-effort. */
|
|
25
27
|
export async function bookTokenUse(use, reach) {
|
|
28
|
+
if (reach.readOnly === true)
|
|
29
|
+
return;
|
|
26
30
|
await ledgerHome(reach)?.ledger.recordTurn({ uses: [use] });
|
|
27
31
|
}
|
|
28
32
|
/** Books a turn's rows and then its delivery event on one connection of ledgerHome's store,
|
|
29
33
|
* best-effort. */
|
|
30
34
|
export async function bookLedgerTurn(turn, reach) {
|
|
35
|
+
if (reach.readOnly === true)
|
|
36
|
+
return;
|
|
31
37
|
await ledgerHome(reach)?.ledger.recordTurn(turn);
|
|
32
38
|
}
|
|
33
39
|
/** bookLedgerTurn where each row is its own attempt: a row that fails is noted and the rest
|
|
34
40
|
* still land. */
|
|
35
41
|
export async function bookLedgerTurnPerRow(turn, reach) {
|
|
42
|
+
if (reach.readOnly === true)
|
|
43
|
+
return;
|
|
36
44
|
await ledgerHome(reach)?.ledger.recordTurn({ ...turn, perRow: true });
|
|
37
45
|
}
|
|
38
46
|
/** What the session last sent on `surface` in ledgerHome's store; null with no ledger, no row or
|
|
@@ -43,6 +51,8 @@ export async function ledgerLastSent(tenantId, sessionId, surface, reach) {
|
|
|
43
51
|
/** A delivery recorder for a hook on `ctx`'s store when the ledger store enables one, else null;
|
|
44
52
|
* never throws. */
|
|
45
53
|
export async function startDeliveryRecorder(ctx, start) {
|
|
54
|
+
if (readOnlyOf(ctx))
|
|
55
|
+
return null;
|
|
46
56
|
try {
|
|
47
57
|
// The same store the token ledger writes to, so its config governs both.
|
|
48
58
|
const reach = ledgerReachOf(ctx);
|
package/dist/api/pilot-arm.js
CHANGED
|
@@ -13,6 +13,9 @@ export async function sessionPilotArm(tenantId, sessionId, write, opts) {
|
|
|
13
13
|
if (rate <= 0)
|
|
14
14
|
return null;
|
|
15
15
|
const { ownTenantOnly } = opts;
|
|
16
|
-
return home.ledger.pilotArm(tenantId, sessionId, rate, {
|
|
16
|
+
return home.ledger.pilotArm(tenantId, sessionId, rate, {
|
|
17
|
+
write: write && opts.reach.readOnly !== true,
|
|
18
|
+
ownTenantOnly,
|
|
19
|
+
});
|
|
17
20
|
}
|
|
18
21
|
//# sourceMappingURL=pilot-arm.js.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// counter, token ledger row and the client's shown list).
|
|
3
3
|
import { auditQueryFields } from '../../base/records/audit-report.js';
|
|
4
4
|
import { recordTokens } from '../tokens.js';
|
|
5
|
-
import { strengthOf } from '../types.js';
|
|
5
|
+
import { readOnlyOf, strengthOf } from '../types.js';
|
|
6
6
|
import { keepShownIds } from './last-recalled.js';
|
|
7
7
|
import { biasHintEnabled, } from './anchoring.js';
|
|
8
8
|
import { sessionRing, peekSessionRing, noteRecall } from './session-rings.js';
|
|
@@ -116,7 +116,8 @@ export async function recordShownRecall(ctx, store, how, shown) {
|
|
|
116
116
|
}
|
|
117
117
|
const items = how.counts === 'none' ? 0 : shown.ids.length;
|
|
118
118
|
// A recall with no audit row counts nothing, as it strengthens and traces nothing.
|
|
119
|
-
|
|
119
|
+
const counted = shown.written && !readOnlyOf(ctx) && (how.counts === 'every' || items > 0);
|
|
120
|
+
if (counted)
|
|
120
121
|
await store.bumpRecallStats(items);
|
|
121
122
|
// The ledger books text that was sent, so its row does not wait on the audit write.
|
|
122
123
|
await recordTokens(ctx, how.ledger, {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// request.ts.
|
|
4
4
|
import { DEFAULT_SEARCH_CANDIDATE_LIMIT } from '../../base/rank/search-types.js';
|
|
5
5
|
import { assertScopeRequestAllowed, personalScopeOf } from '../../base/scope/recall-scope.js';
|
|
6
|
-
import { ownerOrSubject, RecallContractError, sharedStoreOf } from '../types.js';
|
|
6
|
+
import { ownerOrSubject, readOnlyOf, RecallContractError, sharedStoreOf, } from '../types.js';
|
|
7
7
|
import { callerOf, recallAuditMetadata, recallAuditRow, recallLead, recordShownRecall, shownRecallRows, strengthenOf, } from './finish.js';
|
|
8
8
|
import { composeRecall, planRecall, recallOrigin, } from './compose.js';
|
|
9
9
|
import { rankCtxOf, rankRecall, } from './pipeline.js';
|
|
@@ -125,6 +125,8 @@ function rankRequestOf(ctx, opts, windowSize, personalScope) {
|
|
|
125
125
|
/** The one recall write: the caller's leading audit rows go first, and the ids shown are the
|
|
126
126
|
* ones strengthened. */
|
|
127
127
|
async function finishRecall(ctx, opts, writes, shownIds) {
|
|
128
|
+
if (readOnlyOf(ctx))
|
|
129
|
+
return;
|
|
128
130
|
await ctx.store.finishRecall({
|
|
129
131
|
...writes,
|
|
130
132
|
audit: [...(opts.trace?.leadingAudit ?? []), ...writes.audit],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BadRequestError } from '../../base/errors/api-errors.js';
|
|
2
2
|
import { type JsonValue } from '../../base/util/json.js';
|
|
3
3
|
import type { ContextOptions } from '../context/context-types.js';
|
|
4
|
-
import type
|
|
4
|
+
import { type Context } from '../types.js';
|
|
5
5
|
import type { CliCoreRanker, RecallBoostOptions, RecallFilterOptions, CliCoreQuery, RecallOptions, RecallResult, RecallWindowOptions } from './types.js';
|
|
6
6
|
/** A recall or context input the caller must fix; MCP answers it with an isError result, HTTP
|
|
7
7
|
* with a 400. */
|
|
@@ -7,6 +7,7 @@ import { reportAuditWriteFailure } from '../../base/records/audit-report.js';
|
|
|
7
7
|
import { isJsonString } from '../../base/util/json.js';
|
|
8
8
|
import { MAX_ID_LEN } from '../../base/util/limits.js';
|
|
9
9
|
import { estimateTokens } from '../../base/util/token-text.js';
|
|
10
|
+
import { readOnlyOf } from '../types.js';
|
|
10
11
|
import { rankCtxOf, rankRecall } from './pipeline.js';
|
|
11
12
|
import { BUDGET_RANKED } from './profiles.js';
|
|
12
13
|
import { callerOf, heldIds, RECALL_RECORDING, recallAuditMetadata, recallAuditRow, recordShownRecall, shownRecallRows, strengthenOf, } from './finish.js';
|
|
@@ -210,7 +211,8 @@ async function recordShown(ctx, { store, opts, core, done }) {
|
|
|
210
211
|
strengthen: strengthenOf(ctx, ids),
|
|
211
212
|
trace: traceOf(ctx, opts, core, shown.results),
|
|
212
213
|
};
|
|
213
|
-
const audited =
|
|
214
|
+
const audited = !readOnlyOf(ctx) &&
|
|
215
|
+
(await finishOrReport(() => finishShown(store, core.lastRecall, writes, ids.length > 0)));
|
|
214
216
|
if (audited && second !== undefined)
|
|
215
217
|
await finishSecond(ctx, second, recallRow, heldElsewhere);
|
|
216
218
|
// The caller prints whether or not the record was written, so the ring and the ledger still take
|
package/dist/api/tokens.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TokenSummary, TokenSurface } from '../base/ports/store/ledger.js';
|
|
2
2
|
import type { FailureSummary } from '../base/ports/store/rejections.js';
|
|
3
|
-
import type
|
|
3
|
+
import { type Context, type ContextWith } from './types.js';
|
|
4
4
|
/** Records memory text handed to an agent in the token ledger. Best-effort: never throws, since
|
|
5
5
|
* a ledger failure must not fail the recall or context call. */
|
|
6
6
|
export declare function recordTokens(ctx: Context, surface: TokenSurface, use: {
|
package/dist/api/tokens.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
// Token-use and failure reports.
|
|
2
2
|
import { rethrowIfStoreBlocked } from '../base/util/store-blocked.js';
|
|
3
3
|
import { errorMessage, log, errorFields } from '../base/util/log.js';
|
|
4
|
+
import { readOnlyOf } from './types.js';
|
|
4
5
|
import { DAY_MS } from '../base/util/time.js';
|
|
5
6
|
/** Records memory text handed to an agent in the token ledger. Best-effort: never throws, since
|
|
6
7
|
* a ledger failure must not fail the recall or context call. */
|
|
7
8
|
export async function recordTokens(ctx, surface, use) {
|
|
9
|
+
if (readOnlyOf(ctx))
|
|
10
|
+
return;
|
|
8
11
|
try {
|
|
9
12
|
await ctx.store.recordTokens({
|
|
10
13
|
tenantId: ctx.tenantId,
|
package/dist/api/types.d.ts
CHANGED
|
@@ -94,6 +94,8 @@ export type EntryInfraPorts = Omit<InfraPorts, 'failureNotices'> & {
|
|
|
94
94
|
/** A root's reach with the global store's config loaded beside it; `configAt` is the root's own
|
|
95
95
|
* loader, and a promote embeds its copy with `embedderFor`. */
|
|
96
96
|
export declare function contextReach(reach: StoreReach, configAt: (root: string) => HippoConfig, embedderFor: EmbedderFor, ledger?: LedgerHome): ContextReach;
|
|
97
|
+
/** Whether the root runs under HIPPO_READ_ONLY=1, where a read skips the writes it would make. */
|
|
98
|
+
export declare function readOnlyOf(ctx: Pick<Context, 'config'>): boolean;
|
|
97
99
|
/** Whether the store serves many people: the root's reach says, else the store's config for an
|
|
98
100
|
* integrator's store. */
|
|
99
101
|
export declare function sharedStoreOf(ctx: Pick<Context, 'reach' | 'config'>): boolean;
|
package/dist/api/types.js
CHANGED
|
@@ -30,6 +30,10 @@ export function contextReach(reach, configAt, embedderFor, ledger) {
|
|
|
30
30
|
}
|
|
31
31
|
return withConfig;
|
|
32
32
|
}
|
|
33
|
+
/** Whether the root runs under HIPPO_READ_ONLY=1, where a read skips the writes it would make. */
|
|
34
|
+
export function readOnlyOf(ctx) {
|
|
35
|
+
return ctx.config.runtime?.readOnly === true;
|
|
36
|
+
}
|
|
33
37
|
/** Whether the store serves many people: the root's reach says, else the store's config for an
|
|
34
38
|
* integrator's store. */
|
|
35
39
|
export function sharedStoreOf(ctx) {
|
|
@@ -129,8 +129,9 @@ const CONFIG_TABLE = [
|
|
|
129
129
|
configKey('vectorGraph', block('an object like {"maxVectors": 200000}', D.vectorGraph, (read) => ({
|
|
130
130
|
maxVectors: read('maxVectors', count(D.vectorGraph.maxVectors)),
|
|
131
131
|
}))),
|
|
132
|
-
configKey('capture', block('an object like {"followUpRules": "model"}', D.capture, (read) => ({
|
|
132
|
+
configKey('capture', block('an object like {"followUpRules": "model", "userMessages": false}', D.capture, (read) => ({
|
|
133
133
|
followUpRules: read('followUpRules', choice(D.capture.followUpRules, 'off', 'model')),
|
|
134
|
+
userMessages: read('userMessages', flag(D.capture.userMessages)),
|
|
134
135
|
}))),
|
|
135
136
|
];
|
|
136
137
|
/** The config a parsed config.json gives: each key it sets over the defaults;
|
|
@@ -153,9 +153,11 @@ export interface HippoConfig {
|
|
|
153
153
|
maxVectors: number;
|
|
154
154
|
};
|
|
155
155
|
/** Session capture. `followUpRules: 'model'` sends the person's scrubbed turns after the first to
|
|
156
|
-
* Anthropic (ANTHROPIC_API_KEY), which picks the sentences that state a lasting rule. Default 'off'.
|
|
156
|
+
* Anthropic (ANTHROPIC_API_KEY), which picks the sentences that state a lasting rule. Default 'off'.
|
|
157
|
+
* `userMessages` saves each message the person types as a raw row. Default true. */
|
|
157
158
|
capture: {
|
|
158
159
|
followUpRules: 'off' | 'model';
|
|
160
|
+
userMessages: boolean;
|
|
159
161
|
};
|
|
160
162
|
/** What the composition root read from the environment for this command or request;
|
|
161
163
|
* config.json never sets it. */
|
|
@@ -183,6 +185,8 @@ export interface RuntimeSettings {
|
|
|
183
185
|
/** HIPPO_LOSS_AVERSION_RATIO, which scales an error memory's strength; strength scoring
|
|
184
186
|
* applies its floor. */
|
|
185
187
|
readonly lossAversionRatio?: number;
|
|
188
|
+
/** HIPPO_READ_ONLY=1: the store refuses every write, so a read skips its own bookkeeping. */
|
|
189
|
+
readonly readOnly?: boolean;
|
|
186
190
|
/** Where the CLEF rerankers send a request; without it they keep the native order. */
|
|
187
191
|
readonly clef?: ClefSettings;
|
|
188
192
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// What every surface answers a write with under HIPPO_READ_ONLY=1, so a caller matches one text.
|
|
2
|
+
/** The refusal a write verb prints and a write MCP tool returns, word for word. */
|
|
3
|
+
export const READ_ONLY_REFUSAL = 'read-only: not saved (HIPPO_READ_ONLY=1)';
|
|
4
|
+
//# sourceMappingURL=read-only.js.map
|
|
@@ -85,8 +85,16 @@ export declare const COMPACTION_SOURCE_PREFIX = "compaction:";
|
|
|
85
85
|
export declare const USER_RULE_TAG = "from-user";
|
|
86
86
|
/** Tag and category of a later statement capture keeps with no rule word. */
|
|
87
87
|
export declare const CAPTURED_NOTE_TAG = "captured-note";
|
|
88
|
-
/**
|
|
89
|
-
export declare
|
|
88
|
+
/** Tag and source of a message the person typed, which session capture saves whole. */
|
|
89
|
+
export declare const USER_MESSAGE_TAG = "user-message";
|
|
90
|
+
export declare function isUserMessage(entry: {
|
|
91
|
+
readonly tags?: readonly string[];
|
|
92
|
+
}): boolean;
|
|
93
|
+
/** The tags that keep an unpinned row out of ambient context. */
|
|
94
|
+
export declare const RECALL_ONLY_TAGS: readonly ["captured-note", "user-message"];
|
|
95
|
+
/** A note can be a one-off order and a message is chat, so only a matching prompt or an explicit
|
|
96
|
+
* recall may bring either back. */
|
|
97
|
+
export declare function isRecallOnly(entry: {
|
|
90
98
|
readonly tags: readonly string[];
|
|
91
99
|
}): boolean;
|
|
92
100
|
/** `tags` without the tags only capture may set, for every tag a person types or vouches for: a
|
|
@@ -36,14 +36,22 @@ export const COMPACTION_SOURCE_PREFIX = 'compaction:';
|
|
|
36
36
|
export const USER_RULE_TAG = 'from-user';
|
|
37
37
|
/** Tag and category of a later statement capture keeps with no rule word. */
|
|
38
38
|
export const CAPTURED_NOTE_TAG = 'captured-note';
|
|
39
|
-
/**
|
|
40
|
-
export
|
|
41
|
-
|
|
39
|
+
/** Tag and source of a message the person typed, which session capture saves whole. */
|
|
40
|
+
export const USER_MESSAGE_TAG = 'user-message';
|
|
41
|
+
export function isUserMessage(entry) {
|
|
42
|
+
return entry.tags?.includes(USER_MESSAGE_TAG) === true;
|
|
43
|
+
}
|
|
44
|
+
/** The tags that keep an unpinned row out of ambient context. */
|
|
45
|
+
export const RECALL_ONLY_TAGS = [CAPTURED_NOTE_TAG, USER_MESSAGE_TAG];
|
|
46
|
+
/** A note can be a one-off order and a message is chat, so only a matching prompt or an explicit
|
|
47
|
+
* recall may bring either back. */
|
|
48
|
+
export function isRecallOnly(entry) {
|
|
49
|
+
return RECALL_ONLY_TAGS.some((tag) => entry.tags.includes(tag));
|
|
42
50
|
}
|
|
43
51
|
/** `tags` without the tags only capture may set, for every tag a person types or vouches for: a
|
|
44
52
|
* typed tag must not make a row print as the person's rule, and a corrected note is no longer a note. */
|
|
45
53
|
export function withoutCaptureTags(tags) {
|
|
46
|
-
return tags.filter((t) => t !== USER_RULE_TAG && t !== CAPTURED_NOTE_TAG);
|
|
54
|
+
return tags.filter((t) => t !== USER_RULE_TAG && t !== CAPTURED_NOTE_TAG && t !== USER_MESSAGE_TAG);
|
|
47
55
|
}
|
|
48
56
|
/** A memory counts as high schema fit strictly above this. */
|
|
49
57
|
export const HIGH_SCHEMA_FIT = 0.7;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Which rows an ambient load and a summary drill-down admit, as plain data: a store on a worker
|
|
2
2
|
// thread applies the same rule the caller would, since a function cannot cross a thread.
|
|
3
|
-
import { COMPACTION_MEMORY_TAG,
|
|
3
|
+
import { COMPACTION_MEMORY_TAG, isRecallOnly } from '../memory/entry.js';
|
|
4
4
|
import { isWorthSurfacing } from '../memory/memory-quality.js';
|
|
5
5
|
import { classifyOriginProject, projectNames } from './project-identity.js';
|
|
6
6
|
import { passesScopeFilterForRecall } from './recall-scope.js';
|
|
@@ -44,7 +44,7 @@ export function ambientAdmits(e, a) {
|
|
|
44
44
|
export function ambientRefusal(e, a) {
|
|
45
45
|
if (!ambientAdmits(e, a))
|
|
46
46
|
return 'admission';
|
|
47
|
-
return e.pinned || (isWorthSurfacing(e) && !
|
|
47
|
+
return e.pinned || (isWorthSurfacing(e) && !isRecallOnly(e)) ? null : 'quality';
|
|
48
48
|
}
|
|
49
49
|
export function descendantAdmits(row, a) {
|
|
50
50
|
return (passesScopeFilterForRecall(row.scope ?? null, undefined, a.ownScope) &&
|