@vectorize-io/hindsight-coding-agents 0.6.1 → 0.8.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.
Files changed (56) hide show
  1. package/README.md +314 -51
  2. package/dist/antigravity-hook.js +1039 -198
  3. package/dist/antigravity-statusline.js +185 -11
  4. package/dist/antigravity-stop-hook.js +1026 -163
  5. package/dist/claude-hook.js +1039 -198
  6. package/dist/claude-sessionstart-hook.js +1123 -190
  7. package/dist/claude-stop-hook.js +1026 -163
  8. package/dist/cline.js +749 -209
  9. package/dist/codex-hook.js +1039 -198
  10. package/dist/codex-sessionstart-hook.js +1123 -190
  11. package/dist/codex-stop-hook.js +1026 -163
  12. package/dist/copilot-hook.js +1039 -198
  13. package/dist/copilot-sessionstart-hook.js +1123 -190
  14. package/dist/copilot-stop-hook.js +1026 -163
  15. package/dist/cursor-hook.js +1039 -198
  16. package/dist/cursor-sessionstart-hook.js +1123 -190
  17. package/dist/cursor-stop-hook.js +1026 -163
  18. package/dist/daemon-start.js +154 -5
  19. package/dist/dcode-hook.js +1039 -198
  20. package/dist/dcode-sessionstart-hook.js +1123 -190
  21. package/dist/dcode-stop-hook.js +1026 -163
  22. package/dist/deepen.js +437 -105
  23. package/dist/devin-hook.js +1039 -198
  24. package/dist/devin-sessionstart-hook.js +1123 -190
  25. package/dist/devin-stop-hook.js +1026 -163
  26. package/dist/droid-hook.js +1039 -198
  27. package/dist/droid-sessionstart-hook.js +1123 -190
  28. package/dist/droid-stop-hook.js +1026 -163
  29. package/dist/dsh.js +750 -210
  30. package/dist/grok-hook.js +1039 -198
  31. package/dist/grok-sessionstart-hook.js +1123 -190
  32. package/dist/grok-stop-hook.js +1026 -163
  33. package/dist/hindsight-seed.js +157 -8
  34. package/dist/index.js +749 -209
  35. package/dist/installer.js +1233 -366
  36. package/dist/kilo.js +749 -209
  37. package/dist/kimi-hook.js +3909 -0
  38. package/dist/kimi-sessionstart-hook.js +4650 -0
  39. package/dist/kimi-stop-hook.js +4218 -0
  40. package/dist/mcp-server.js +373 -71
  41. package/dist/opencode2.js +778 -209
  42. package/dist/pi.js +754 -211
  43. package/dist/prime-agent.js +754 -211
  44. package/dist/qwen-hook.js +1039 -198
  45. package/dist/qwen-sessionstart-hook.js +1123 -190
  46. package/dist/qwen-stop-hook.js +1026 -163
  47. package/dist/status.js +333 -59
  48. package/dist/traecode-hook.js +3909 -0
  49. package/dist/traecode-sessionstart-hook.js +4650 -0
  50. package/dist/traecode-stop-hook.js +4218 -0
  51. package/dist/zcode-hook.js +1039 -198
  52. package/dist/zcode-sessionstart-hook.js +1123 -190
  53. package/dist/zcode-stop-hook.js +1026 -163
  54. package/package.json +15 -11
  55. package/plugin.json +1 -1
  56. package/skill/SKILL.md +241 -48
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vectorize-io/hindsight-coding-agents",
3
- "version": "0.6.1",
3
+ "version": "0.8.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/vectorize-io/hindsight.git",
@@ -35,9 +35,15 @@
35
35
  "hindsight-zcode-hook": "dist/zcode-hook.js",
36
36
  "hindsight-zcode-sessionstart-hook": "dist/zcode-sessionstart-hook.js",
37
37
  "hindsight-zcode-stop-hook": "dist/zcode-stop-hook.js",
38
+ "hindsight-traecode-hook": "dist/traecode-hook.js",
39
+ "hindsight-traecode-sessionstart-hook": "dist/traecode-sessionstart-hook.js",
40
+ "hindsight-traecode-stop-hook": "dist/traecode-stop-hook.js",
38
41
  "hindsight-droid-hook": "dist/droid-hook.js",
39
42
  "hindsight-droid-sessionstart-hook": "dist/droid-sessionstart-hook.js",
40
- "hindsight-droid-stop-hook": "dist/droid-stop-hook.js"
43
+ "hindsight-droid-stop-hook": "dist/droid-stop-hook.js",
44
+ "hindsight-kimi-hook": "dist/kimi-hook.js",
45
+ "hindsight-kimi-sessionstart-hook": "dist/kimi-sessionstart-hook.js",
46
+ "hindsight-kimi-stop-hook": "dist/kimi-stop-hook.js"
41
47
  },
42
48
  "exports": {
43
49
  ".": {
@@ -83,21 +89,19 @@
83
89
  "test:dcode-e2e": "npm run build && HINDSIGHT_DCODE_E2E=1 vitest run src/dcode-plugin.e2e.test.ts",
84
90
  "test:harness-e2e": "npm run build && HINDSIGHT_HARNESS_E2E=1 vitest run src/harness.e2e.test.ts"
85
91
  },
86
- "dependencies": {
87
- "@modelcontextprotocol/sdk": "^1.29.0",
88
- "@vectorize-io/hindsight-all": "^0.8.6",
89
- "jsonc-parser": "^3.3.1",
90
- "smol-toml": "^1.8.0",
91
- "zod": "^4.4.3"
92
- },
93
92
  "devDependencies": {
93
+ "@modelcontextprotocol/sdk": "^1.29.0",
94
94
  "@opencode-ai/plugin": "^1.18.9",
95
- "@opencode-ai/plugin-v2": "npm:@opencode-ai/plugin@0.0.0-beta-18743",
96
95
  "@opencode-ai/sdk": "^1.18.9",
96
+ "@opencode/plugin": "^2.0.3",
97
97
  "@types/node": "^26.1.0",
98
+ "@vectorize-io/hindsight-all": "^0.8.6",
99
+ "jsonc-parser": "^3.3.1",
100
+ "smol-toml": "^1.8.0",
98
101
  "tsup": "^8.3.0",
99
102
  "typescript": "^5.6.0",
100
- "vitest": "^4.1.11"
103
+ "vitest": "^4.1.11",
104
+ "zod": "^4.4.3"
101
105
  },
102
106
  "overrides": {
103
107
  "esbuild": ">=0.25.0 <1.0.0",
package/plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hindsight-coding-agents",
3
- "version": "0.6.1",
3
+ "version": "0.8.0",
4
4
  "description": "Long-term project memory for coding agents",
5
5
  "skills": "./skill",
6
6
  "hooks": "./hooks/hooks.json",
package/skill/SKILL.md CHANGED
@@ -20,8 +20,9 @@ explains what happens automatically, which tools you have, and how to configure
20
20
  read-only codebase survey; every session start, a background engine tops it up (new commits, new
21
21
  conversations) and keeps 5 knowledge pages current. There is NO ingest command to run.
22
22
  - **Session synthesis**: by default, the first prompt of a session triggers one deep memory
23
- synthesis (`reflect`) injected into context. With `autoReflect=false`, the agent searches the
24
- knowledge pages first and reflects only when they are too shallow.
23
+ synthesis (`reflect`) injected into context. `autoInject` switches the source: `pages` (knowledge
24
+ page search hits), `recall` (recalled observations), or `none` (nothing injected; the agent
25
+ searches the knowledge pages first and reflects only when they are too shallow).
25
26
  - **Write-back**: the session transcript is retained into the bank automatically at session end
26
27
  (per-turn on opencode). The user never needs to "save" a conversation.
27
28
 
@@ -109,14 +110,16 @@ Configuration is **one JSON file**: `~/.hindsight/coding-agent.json`. Layering,
109
110
  (`HINDSIGHT_<FIELD_IN_CAPS>`), for containers and CI that inject config rather than write a file
110
111
  3. the file's top level
111
112
  4. its `harnesses.<name>` section — per-agent override
112
- 5. its `banks.<resolvedBankId>` section — per-repo override, applied after the bank is resolved
113
+ 5. its `paths.<prefix>` section — per-directory override, applied after the bank is resolved
114
+ (see [Per-directory overrides](#per-directory-overrides--pathsprefix))
115
+ 6. its `banks.<resolvedBankId>` section — per-repo override, applied after the bank is resolved
113
116
  (see [Per-repo opt-in/out](#per-repo-opt-inout--banksbankid))
114
117
 
115
118
  Environment variables are a **fallback**: the file wins wherever it sets a value, so adding env to
116
119
  an existing setup changes nothing. The two list-valued settings, `retainTags` and `optInPaths`, take
117
120
  a comma-separated value (`HINDSIGHT_RETAIN_TAGS="project:{gitProject},env:work"`); entries are
118
121
  trimmed and blanks dropped.
119
- The map-valued settings (`mapPathToBank`, `harnesses`, `banks`, `retainMetadata`) are file-only —
122
+ The map-valued settings (`mapPathToBank`, `harnesses`, `paths`, `banks`, `retainMetadata`) are file-only —
120
123
  per-key branching doesn't survive flattening into one variable. `maxParallelRetains` is available
121
124
  as `HINDSIGHT_MAX_PARALLEL_RETAINS` for containers and CI.
122
125
 
@@ -189,42 +192,52 @@ hook by Codex...), so one shared config serves several agents side by side:
189
192
 
190
193
  ### Reference
191
194
 
192
- | field | default | meaning |
193
- | ----------------------- | ------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
194
- | `apiUrl` | `https://api.hindsight.vectorize.io` | Hindsight API base URL (set to `http://localhost:8888` for a local server) |
195
- | `apiToken` | — | bearer token (Hindsight Cloud). Picked up without restarting the agent: a long-lived host re-reads it after a rejected request, so enabling auth or rotating the key mid-session recovers on the next call |
196
- | `bankId` | — | **explicit static bank**; unset ⇒ per-repo dynamic resolution (below) |
197
- | `dynamicBankId` | dynamic iff no `bankId` | force dynamic (`true`) or static (`false`) resolution |
198
- | `bankIdTemplate` | `"coding-agent::{gitProject}"` | dynamic bank id format; the default makes every agent share one bank per repo |
199
- | `mapPathToBank` | — | absolute path → bank; **longest prefix wins**; linked worktrees inherit their main checkout's mapping; overrides everything |
200
- | `optInOnly` | `false` | run memory ONLY in opted-in projects — everything else is inert, with no bank created; see [Opt-in only](#opt-in-only) |
201
- | `optInPaths` | — | directories opted in, matched as prefixes with `~` expanded; each repo beneath and its linked worktrees are approved while keeping their own dynamic bank |
202
- | `resolveWorktrees` | `true` | linked worktrees inherit the main checkout's bank identity, path approval, and mapping |
203
- | `retainTags` | — | extra tags on every document written by the integration, e.g. `["project:{gitProject}"]` — see **Recording where a memory came from** below |
204
- | `retainMetadata` | — | extra metadata on every document written by the integration, e.g. `{"repo": "{gitProject}"}` |
205
- | `manageBankConfig` | `true` | let the plugin shape the bank's own configuration — the retain strategies it writes under, the `knowledge` entity-label group, and, on a bank that has none, the missions. Writing is strictly **additive**: it adds what the bank does not define and never overwrites what is there, so your control-plane edits survive. Set `false` to keep it out of the bank config entirely — see **A bank you shape yourself** below |
206
- | `observationScopes` | `"shared"` | how consolidation groups observations: `"shared"` (default) = ONE global scope per bank, so every agent on a repo builds one set of beliefs; also `"combined"` (the server default), `"per_tag"`, `"all_combinations"`, `[["t"]]`; `"per_source"` adds a scope per `source:` kind alongside the global one, so commit knowledge and conversation knowledge consolidate apart |
207
- | `disabled` | `false` | hard off-switch (inert plugin/hook — a no-memory baseline) |
208
- | `reflectTimeoutMs` | `120000` | **automatic** session-reflect timeout (hook harnesses additionally cap it at 20s to fit the host's hook window); on timeout or a 5xx the hook falls back to knowledge-page search, then to a raw recall of observations (recorded) |
209
- | `reflectToolTimeoutMs` | `330000` | timeout for the agent-invoked `hindsight_reflect` tool — a call the agent waits on, whose high-budget synthesis on a populated bank runs for minutes. Defaults above the server's own reflect wall timeout (`HINDSIGHT_API_REFLECT_WALL_TIMEOUT`, 300s) so the server decides when to give up. Unset, it inherits an explicitly raised `reflectTimeoutMs`, but a short one never lowers it |
210
- | `reflectBudget` | `"high"` | reflect budget for the `hindsight_reflect` tool: `"low"`, `"mid"` or `"high"`. Drop it on a large bank where high-budget synthesis exceeds the server's wall timeout. The automatic session-start reflect always uses `"low"` to fit its hook window and is unaffected |
211
- | `autoReflect` | `true` | inject a one-time reflect synthesis on the session's **first prompt**. `false` = tool-only reflect: nothing is injected; the agent searches knowledge pages first and reflects only when they are too shallow |
212
- | `pageRefreshEveryTurns` | `10` | refetch the knowledge pages and re-inject the page roster + tool guide every N user turns |
213
- | `pageTriggerType` | `"cron"` | when NEW knowledge pages refresh, i.e. what keeping them current costs — `"cron"` (default) on `pageTriggerCron` only and only when actually stale, `"auto-refresh"` after every consolidation that produced new material, `"manual"` never on their own. Auto-refresh is the most current and by far the most expensive: one synthesis per page per consolidation. Maps to the page's `trigger.refresh_cron`, or `trigger.refresh_after_consolidation` in the Hindsight API (`true` for auto-refresh, `false` for manual) |
214
- | `pageTriggerCron` | `"H * * * *"` | schedule for `pageTriggerType: "cron"` — UTC, standard 5-field cron, e.g. `"0 3 * * *"`. The default is hourly, each page on its own hashed minute. Sets the page's `trigger.refresh_cron`, which the API treats as mutually exclusive with `refresh_after_consolidation`; a scheduled refresh is skipped when nothing changed. Write a field as `H` to give each page its own value there — see **Spreading refreshes with `H`** below |
215
- | `autoSeed` | `true` | SessionStart: auto-seed a cold repo's bank from git history |
216
- | `seedLimit` | `300` | auto-seed: most-recent-N-commits cap |
217
- | `codebaseSurvey` | `true` | SessionStart: headless survey of a cold repo's structure, run under the current harness's own CLI (claude/codex/antigravity/opencode), falling back to any available agent |
218
- | `surveyModel` | `haiku` | model for the survey — Claude recipe only (`claude -p --model`); other agents use their configured default |
219
- | `surveyBudgetUsd` | `2` | survey spend cap — Claude recipe only (`claude -p --max-budget-usd`); other agents rely on their read-only sandbox |
220
- | `surveyRefreshCommits` | `20` | re-run the survey at SessionStart once this many commits have accrued since the last one, so the structural pages track an architecture that keeps moving (`0` = survey a cold repo only, never again) |
221
- | `retainSessions` | `true` | session write-back, honored by every harness: hook harnesses write the transcript on Stop, Factory Droid also writes on its cancellation notification, and plugin harnesses (opencode, opencode 2, Kilo) upsert it every turn plus an idle flush that captures the reply the per-turn pass can't see. Set `false` - globally, per harness, or per bank - to stop writing transcripts (the background history import stops with it) while recall, git ingest and the memory tools keep working |
222
- | `maxParallelRetains` | `10` | cap on concurrent retain-related requests: drain()'s per-op polls plus deepen's chat/git retain pools. The API rate-limits bursts, not single requests — if you see 429s, lower this rather than raising it |
223
- | `logLevel` | `"info"` | plugin-log verbosity (`"debug"` \| `"info"` \| `"warn"` \| `"error"`); `HINDSIGHT_LOG_LEVEL` env overrides |
224
- | `autoUpdate` | `true` | keep the installed runtime current by itself: once a day a session start asks npm for the published version and, when it is newer, re-stages `~/.hindsight/coding-agents` in the background. It rewires no host config, so a release adding a **new** hook entry point still needs a manual `install`. Set `false` to pin the installed version; `disabled` stops it too, since an inert plugin should stay inert. Only ever replaces a runtime installed the documented way, via `npx` — a copy installed with `npm i -g`, vendored as a project dependency, or built from a checkout is left to whoever manages it (update those the way you installed them), and it needs `npx` on `PATH` |
225
- | `gitIngest` | `"message"` | git depth for seeding AND staying current (same engine): `"message"` = commit messages only (one doc, re-upserted when HEAD moves); `"full"` = messages + per-commit full diffs (progressive, newest first); `"none"` = git off |
226
- | `harnesses.<name>` | — | per-harness override of any field above |
227
- | `harness` | `opencode` | **deepen engine only**: which session format `--conversations` is read as |
195
+ | field | default | meaning |
196
+ | ----------------------- | ------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
197
+ | `apiUrl` | `https://api.hindsight.vectorize.io` | Hindsight API base URL (set to `http://localhost:8888` for a local server) |
198
+ | `apiToken` | — | bearer token (Hindsight Cloud). Picked up without restarting the agent: a long-lived host re-reads it after a rejected request, so enabling auth or rotating the key mid-session recovers on the next call |
199
+ | `bankId` | — | **explicit static bank**; unset ⇒ per-repo dynamic resolution (below) |
200
+ | `dynamicBankId` | dynamic iff no `bankId` | force dynamic (`true`) or static (`false`) resolution |
201
+ | `bankIdTemplate` | `"coding-agent::{gitProject}"` | dynamic bank id format; the default makes every agent share one bank per repo |
202
+ | `mapPathToBank` | — | absolute path → bank; **longest prefix wins**; linked worktrees inherit their main checkout's mapping; overrides everything |
203
+ | `optInOnly` | `false` | run memory ONLY in opted-in projects — everything else is inert, with no bank created; see [Opt-in only](#opt-in-only) |
204
+ | `optInPaths` | — | directories opted in, matched as prefixes with `~` expanded; each repo beneath and its linked worktrees are approved while keeping their own dynamic bank |
205
+ | `resolveWorktrees` | `true` | linked worktrees inherit the main checkout's bank identity, path approval, and mapping |
206
+ | `retainTags` | — | extra tags on every document written by the integration, e.g. `["project:{gitProject}"]` — see **Recording where a memory came from** below |
207
+ | `retainMetadata` | — | extra metadata on every document written by the integration, e.g. `{"repo": "{gitProject}"}` |
208
+ | `retainContext` | see description | the `context` sent with every session write-back. Extraction reads it to decide whose claim a sentence is, so the default names both speakers, and asks for an agent's own "fixed" or "passes" to be stored as its claim rather than as fact. Accepts the same `{placeholder}` templates as `retainTags` |
209
+ | `manageBankConfig` | `true` | let the plugin shape the bank's own configuration — the retain strategies it writes under, the `knowledge` entity-label group, and, on a bank that has none, the missions. Writing is **additive**: it adds what the bank does not define and never overwrites what is there, so your control-plane edits survive — the one exception is the extraction mode of its own strategies, which follows `retainExtractionMode`. Set `false` to keep it out of the bank config entirely — see **A bank you shape yourself** below |
210
+ | `retainExtractionMode` | `"concise"` | how the server extracts memories from sessions, commits and documents: `"concise"`, `"verbose"`, `"verbatim"` or `"chunks"` (store the text, no extraction). Every Stop writes the session back, so this is what each turn costs — `"verbose"` pulls more detail for several times the tokens. Kept in sync on the plugin's own retain strategies every session, so a change reaches existing banks too (not with `manageBankConfig: false`) |
211
+ | `defaultBankConfig` | — | bank-config fields of your own for the banks the plugin shapes, e.g. `{"enable_observations": false, "enable_auto_consolidation": false, "mental_model_min_refresh_interval_seconds": 21600}`. Keys are the bank-config API's own field names. Written under the same additive rule as the rest: only where the bank does not define the field, so a bank the plugin creates is born with these instead of the server's defaults and a value you set in the control plane is never overwritten. Wins over the template on a key both name (`enable_observations`); `retain_strategies`, `entity_labels` and `retain_extraction_mode` are refused, since the plugin governs them itself. Ignored with `manageBankConfig: false` — see **A bank you shape yourself** below. File-only, like `recallOptions`; in a `banks.<id>` section it replaces the global map rather than merging into it |
212
+ | `observationScopes` | `"shared"` | how consolidation groups observations: `"shared"` (default) = ONE global scope per bank, so every agent on a repo builds one set of beliefs; also `"combined"` (the server default), `"per_tag"`, `"all_combinations"`, `[["t"]]`; `"per_source"` adds a scope per `source:` kind alongside the global one, so commit knowledge and conversation knowledge consolidate apart |
213
+ | `disabled` | `false` | hard off-switch (inert plugin/hook — a no-memory baseline) |
214
+ | `reflectTimeoutMs` | `20000` | **automatic** session-reflect timeout; on hook harnesses the installer registers a 30s prompt-hook timeout, so going above ~20s also means raising that hook's `timeout` in the host's config, or the host kills the hook mid-reflect; on timeout or a 5xx the hook falls back to knowledge-page search, then to a raw recall of observations (recorded) |
215
+ | `reflectToolTimeoutMs` | `330000` | timeout for the agent-invoked `hindsight_reflect` tool — a call the agent waits on, whose high-budget synthesis on a populated bank runs for minutes. Defaults above the server's own reflect wall timeout (`HINDSIGHT_API_REFLECT_WALL_TIMEOUT`, 300s) so the server decides when to give up. Unset, it inherits an explicitly raised `reflectTimeoutMs`, but a short one never lowers it |
216
+ | `injectTimeoutMs` | `7000` | retrieval timeout in milliseconds for `autoInject: "pages"` and `autoInject: "recall"`; also the **shared** budget for page search then recall after a reflect timeout/5xx (recall gets only the time left after page search). Set e.g. `2000` to limit turn latency or `15000` for a slower self-hosted bank. Environment fallback: `HINDSIGHT_INJECT_TIMEOUT_MS`. On hook harnesses, injection must fit the host's prompt-hook timeout (30s by default); for reflect with fallback, allow for **`reflectTimeoutMs` + `injectTimeoutMs`**, and raise the host hook's `timeout` when needed |
217
+ | `reflectBudget` | `"high"` | reflect budget for the `hindsight_reflect` tool: `"low"`, `"mid"` or `"high"`. Drop it on a large bank where high-budget synthesis exceeds the server's wall timeout. The automatic session-start reflect always uses `"low"` to fit its hook window and is unaffected |
218
+ | `autoInject` | `"reflect"` | what to inject once, on the session's **first prompt**: `"reflect"` = a low-budget reflect synthesis (on timeout/5xx it falls back to page search, then recall); `"pages"` = the knowledge pages matching the prompt by search; `"recall"` = the bank's memories recalled for the prompt (what it asks for is `recallOptions`, observations by default); `"none"` = nothing — the agent searches knowledge pages first and reflects only when they are too shallow. `"pages"` and `"recall"` are retrieval only (no LLM), their time budget is `injectTimeoutMs` |
219
+ | `autoReflect` | `true` | **deprecated** — use `autoInject`. Still honoured (`false` = `autoInject: "none"`), ignored when `autoInject` is set, and logs a deprecation warning |
220
+ | `pageSearchLimit` | `3` | knowledge pages ONE search returns. Applies to every search of the bank — the `autoInject: "pages"` injection, the reflect fallback, and the agent's own `hindsight_search_knowledge_pages` tool — because the limit lives on the client they all share |
221
+ | `recallOptions` | see description | overrides merged key-by-key into the body of every recall — the `autoInject: "recall"` source and the reflect fallback. Keys are the API's own recall parameters, passed straight through, so anything recall accepts is settable without a new option here; `query` is the one field it cannot replace. The default body is `{"types": ["observation"], "budget": "low", "max_tokens": 2000, "include": {"entities": null}}`, and what you set is merged over it one key at a time — `{"max_tokens": 4000}` changes the budget and leaves the rest alone. Observations are the consolidated layer, so they answer best per token, but a bank with **consolidation disabled never grows any** and the default recall comes back empty on it: set `{"types": ["world", "experience"]}` there, or `{"types": null}` for every type. File-only, like `retainMetadata` — an object does not flatten into an env var |
222
+ | `toolGuideExtra` | — | your own guidance on how the agent should treat memory, added **after** the built-in tool guide (at session start and on every refresh) and after the crediting note returned with `hindsight_search_knowledge_pages` results. It adds to the built-in text, never replaces it. Set it per harness or per bank like any other key, e.g. `"Memory is a past record, not current state: verify any claim against the code before acting on it."` |
223
+ | `pageRefreshEveryTurns` | `10` | refetch the knowledge pages and re-inject the page roster + tool guide every N user turns |
224
+ | `pageTriggerType` | `"cron"` | when NEW knowledge pages refresh, i.e. what keeping them current costs — `"cron"` (default) on `pageTriggerCron` only and only when actually stale, `"auto-refresh"` after every consolidation that produced new material, `"manual"` never on their own. Auto-refresh is the most current and by far the most expensive: one synthesis per page per consolidation. Maps to the page's `trigger.refresh_cron`, or `trigger.refresh_after_consolidation` in the Hindsight API (`true` for auto-refresh, `false` for manual) |
225
+ | `pageTriggerCron` | `"H * * * *"` | schedule for `pageTriggerType: "cron"` — UTC, standard 5-field cron, e.g. `"0 3 * * *"`. The default is hourly, each page on its own hashed minute. Sets the page's `trigger.refresh_cron`, which the API treats as mutually exclusive with `refresh_after_consolidation`; a scheduled refresh is skipped when nothing changed. Write a field as `H` to give each page its own value there — see **Spreading refreshes with `H`** below |
226
+ | `pages` | every page | per-page configuration for the seeded knowledge pages, keyed by page name (case-insensitive): `false` skips a page entirely, `{"source_query": "..."}` seeds it with your question instead of the built-in one. Omitted, all five pages are seeded with their built-in queries. This is the supported way to own a page's wording — the plugin re-syncs a page whose live query differs from the one it is configured to have, so a query edited through the API or the control plane is replaced on the next session. A skipped page is **not deleted**: one already seeded keeps its content and stops being re-synced. The scoping clause is appended to your query too, so a reworded page cannot start reporting a dependency's decisions as this project's. File-only, like `recallOptions`; in a `banks.<id>` section it replaces the global map rather than merging into it |
227
+ | `customPages` | — | knowledge pages of your own, seeded alongside the five above and keyed by the name they get: `{"Security posture": {"source_query": "...", "tags": ["knowledge:decision"]}}`. `source_query` is required; `tags` picks which facts feed the page and is optional — omitted, the page draws on everything the bank holds. A separate setting from `pages` on purpose, so that an unknown name there stays a typo warning rather than quietly creating a page. File-only, and replaced (not merged) by a `banks.<id>` section |
228
+ | `autoSeed` | `true` | SessionStart: auto-seed a cold repo's bank from git history |
229
+ | `seedLimit` | `300` | auto-seed: most-recent-N-commits cap |
230
+ | `codebaseSurvey` | `true` | SessionStart: headless survey of a cold repo's structure, run under the current harness's own CLI (claude/codex/antigravity/opencode), falling back to any available agent |
231
+ | `surveyModel` | `haiku` | model for the survey — Claude recipe only (`claude -p --model`); other agents use their configured default |
232
+ | `surveyBudgetUsd` | `2` | survey spend cap — Claude recipe only (`claude -p --max-budget-usd`); other agents rely on their read-only sandbox |
233
+ | `surveyRefreshCommits` | `20` | re-run the survey at SessionStart once this many commits have accrued since the last one, so the structural pages track an architecture that keeps moving (`0` = survey a cold repo only, never again) |
234
+ | `retainSessions` | `true` | session write-back, honored by every harness: hook harnesses write the transcript on Stop, Factory Droid also writes on its cancellation notification, and plugin harnesses (opencode, opencode 2, Kilo) upsert it every turn plus an idle flush that captures the reply the per-turn pass can't see. Set `false` - globally, per harness, or per bank - to stop writing transcripts (the background history import stops with it) while recall, git ingest and the memory tools keep working |
235
+ | `maxParallelRetains` | `10` | cap on concurrent retain-related requests: drain()'s per-op polls plus deepen's chat/git retain pools. The API rate-limits bursts, not single requests — if you see 429s, lower this rather than raising it |
236
+ | `logLevel` | `"info"` | plugin-log verbosity (`"debug"` \| `"info"` \| `"warn"` \| `"error"`); `HINDSIGHT_LOG_LEVEL` env overrides |
237
+ | `autoUpdate` | `true` | keep the installed runtime current by itself: once a day a session start asks npm for the published version and, when it is newer, re-stages `~/.hindsight/coding-agents` in the background. It rewires no host config, so a release adding a **new** hook entry point still needs a manual `install`. Set `false` to pin the installed version; `disabled` stops it too, since an inert plugin should stay inert. Only ever replaces a runtime installed the documented way, via `npx` — a copy installed with `npm i -g`, vendored as a project dependency, or built from a checkout is left to whoever manages it (update those the way you installed them), and it needs `npx` and `npm` on `PATH` |
238
+ | `gitIngest` | `"message"` | git depth for seeding AND staying current (same engine): `"message"` = commit messages only (one doc, re-upserted when HEAD has a commit it lacks); `"full"` = messages + per-commit full diffs (progressive, newest first); `"none"` = git off |
239
+ | `harnesses.<name>` | — | per-harness override of any field above |
240
+ | `harness` | `opencode` | **deepen engine only**: which session format `--conversations` is read as |
228
241
 
229
242
  By default a page refreshes **hourly, staggered**: `pageTriggerCron` is `"H * * * *"`, so every
230
243
  page gets its own minute of the hour (see below) and a tick with nothing new to fold in is skipped
@@ -271,6 +284,123 @@ file is the source of truth for these pages: to give one a different schedule, c
271
284
  page. Only the fields this plugin states are touched — a page's `mode`, its excluded siblings and
272
285
  its minimum refresh interval are left exactly as they are.
273
286
 
287
+ ### Customize Knowledge Pages — `pages`
288
+
289
+ Every repo gets the same five pages. They are a **taxonomy**, not a summary of your source: each one
290
+ is synthesized from what the bank ingested — commit history and past conversations — and each is
291
+ pinned to one knowledge tier, so a page draws only on the facts the extractor routed to it.
292
+
293
+ | Page | What it answers | Tier tag |
294
+ | ------------------------------ | ------------------------------------------------------------------------------------------------------- | ------------------------ |
295
+ | `Component map` | the main components/modules/subsystems, what each is responsible for, and how they depend on each other | `knowledge:component` |
296
+ | `Core concepts` | the domain abstractions and key entities — the vocabulary a developer has to know | `knowledge:concept` |
297
+ | `Conventions and patterns` | how THIS project does things: testing, error handling, naming, structure, how changes are made | `knowledge:convention` |
298
+ | `Key decisions and rationale` | the significant technical decisions and the durable "why we do it this way" behind them | `knowledge:decision` |
299
+ | `Initiatives and enhancements` | the major initiatives and features over time, linking out to each captured initiative's own page | `knowledge:feature-work` |
300
+
301
+ `pages` says which of them to seed and what each one asks. Keys are the page names above, matched
302
+ ignoring case and surrounding spaces:
303
+
304
+ ```jsonc
305
+ {
306
+ "pages": {
307
+ // don't seed this page at all
308
+ "Component map": false,
309
+ // seed it, but ask your question instead of the built-in one
310
+ "Key decisions and rationale": {
311
+ "source_query": "What did we decide about data retention, encryption and PII handling, and why? Prefer decisions that constrain what new code may do.",
312
+ },
313
+ },
314
+ }
315
+ ```
316
+
317
+ Omit `pages` entirely — the default — and all five are seeded with their built-in queries.
318
+
319
+ **Fewer pages.** Each page costs one LLM synthesis per refresh, so a repo that only wants the
320
+ architecture ones turns the rest off:
321
+
322
+ ```jsonc
323
+ {
324
+ "pages": {
325
+ "Initiatives and enhancements": false,
326
+ "Conventions and patterns": false,
327
+ "Key decisions and rationale": false,
328
+ },
329
+ }
330
+ ```
331
+
332
+ **Per repo**, like every other field — usually where this belongs, since what a page should ask is a
333
+ property of the project, not of your machine:
334
+
335
+ ```jsonc
336
+ {
337
+ "banks": {
338
+ "coding-agent::payments-api": {
339
+ "pages": {
340
+ "Core concepts": {
341
+ "source_query": "What are the payment domain's entities — orders, ledgers, settlement states — and what does each mean in OUR model?",
342
+ },
343
+ },
344
+ },
345
+ },
346
+ }
347
+ ```
348
+
349
+ Four things worth knowing before you reach for it:
350
+
351
+ - **This is the only durable way to reword a page.** Every session compares each seeded page against
352
+ the query it is configured to have and re-syncs the ones that differ, so a `source_query` edited
353
+ through the API or the control plane is replaced the next time an agent runs. Setting it here makes
354
+ your wording the configured one. When a re-sync does replace a query, the plugin now says which
355
+ page in the plugin log rather than doing it silently.
356
+ - **Your query still gets the scoping clause.** The sentence that keeps a dependency's decisions off
357
+ your project's page is appended to a custom query too — a bank holds facts about the libraries and
358
+ services a repo merely uses, and without that clause a page will present them as yours.
359
+ - **The tier tag stays the taxonomy's.** It selects which facts the synthesis reads; rewording the
360
+ question changes what is asked of those facts, not which ones are in scope.
361
+ - **`false` does not delete anything.** A page already seeded keeps its content and simply stops
362
+ being re-synced — remove it in the control plane if you want it gone.
363
+
364
+ A name that matches no page above is ignored with a warning in the plugin log, so a typo fails
365
+ loudly instead of looking like it disabled something. Adding pages of your own is not what this
366
+ setting is for: the agent's `hindsight_capture_initiative` tool already creates pages, one per
367
+ initiative, each with its own query.
368
+
369
+ #### Pages of your own — `customPages`
370
+
371
+ `pages` only reworks the five above. To add a page, name it under `customPages`:
372
+
373
+ ```jsonc
374
+ {
375
+ "customPages": {
376
+ "Security posture": {
377
+ "source_query": "What are this project's security decisions — authn, secrets handling, PII, dependency policy — and what do they constrain in new code?",
378
+ "tags": ["knowledge:decision"],
379
+ },
380
+ "Operational runbook": {
381
+ "source_query": "How does this project get deployed, monitored and rolled back? What has broken in production, and what fixed it?",
382
+ },
383
+ },
384
+ }
385
+ ```
386
+
387
+ `source_query` is required. `tags` is optional and picks which facts feed the page — one of the tier
388
+ tags above, or any tag you stamp on your own writes with `retainTags`. Omit it and the page draws on
389
+ everything the bank holds: a refresh matches tags with `all`, so no tags means no tag constraint,
390
+ **not** an empty page.
391
+
392
+ Your pages are seeded at the same root as the taxonomy, on the same refresh schedule, and re-synced
393
+ from the config the same way — reword one here and the live page follows on the next session. They
394
+ compose with `pages`, so trading two built-ins for one of your own is just both settings at once.
395
+
396
+ **Why it is a separate setting.** `pages` refuses a name that matches no seeded page, and that is
397
+ what makes a typo loud: if an unknown key there meant "create this page", `"Componnet map"` would
398
+ quietly create an empty second page instead of rewording the one you meant. For the same reason,
399
+ naming a seeded page under `customPages` is refused — reword it under `pages`.
400
+
401
+ A page you create yourself in the control plane is a third thing again, and the plugin never touches
402
+ it: the seed pass only visits the pages it is configured to own.
403
+
274
404
  ### A bank you shape yourself — `manageBankConfig`
275
405
 
276
406
  Pointed at a bank, this plugin gives it the shape its ingestion needs: retain strategies for the
@@ -286,13 +416,45 @@ already has it. To take the current default back, clear that override on the ban
286
416
  strategy, or the whole `retain_strategies` entry, in the control plane): the next session finds the
287
417
  bank silent there and seeds it again.
288
418
 
289
- Set `manageBankConfig: false` to keep the plugin out of the bank's configuration altogether — the
290
- right setting for a bank you share with non-coding work, or one you configure yourself. That bank
291
- should then define the five strategies above itself. Note that the miss is **silent**: the server
292
- does not reject a retain naming a strategy the bank lacks, it logs a warning and extracts with the
293
- bank's own configuration — so a commit diff, a session transcript and a survey marker would all get
294
- the same generic treatment instead of the extraction each needs. Knowledge pages are seeded either
295
- way; `pageTriggerType` governs what they cost.
419
+ One field is the exception: the extraction mode of the plugin's own four strategies (`git`,
420
+ `gitlog`, `conversation`, `document`) follows `retainExtractionMode` and is put back on every session
421
+ if it drifts — the same way a seeded page's query is. Change it in `coding-agent.json`, not in the
422
+ control plane. The strategies' other fields, and your own strategies, are still left alone.
423
+
424
+ **Your own defaults for new banks — `defaultBankConfig`.** Everything the template does not name, a
425
+ bank the plugin creates gets from the server: auto-consolidation on, observations on, a 60s floor
426
+ between mental-model refreshes. With one bank per repo those are the settings that cost money, and
427
+ a new repo an agent touches spawns a new bank with all of them switched on — while every bank you had
428
+ hand-tuned in the control plane sits at a cheaper baseline. `defaultBankConfig` names the baseline
429
+ once, in the plugin's config, and it travels in the same import that creates the bank:
430
+
431
+ ```json
432
+ {
433
+ "defaultBankConfig": {
434
+ "enable_observations": false,
435
+ "enable_auto_consolidation": false,
436
+ "mental_model_min_refresh_interval_seconds": 21600
437
+ }
438
+ }
439
+ ```
440
+
441
+ The keys are the bank-config API's own field names, passed straight through, so anything the
442
+ bank-config accepts can go here. They follow the same additive rule as the template: written only
443
+ where the bank is silent, so an existing bank picks them up on its next session **except** for the
444
+ fields it already sets — a value you chose in the control plane stays, even one equal to the server
445
+ default, and so does a value an earlier plugin release seeded (the template writes
446
+ `enable_observations: true` alongside the missions; clear that override on the bank to let your
447
+ default in). On a key the template also names, your default wins. The three fields the plugin
448
+ governs itself — `retain_strategies`, `entity_labels` and `retain_extraction_mode` — are refused
449
+ with a warning: the first two are merged entry by entry, the last is `retainExtractionMode`'s.
450
+
451
+ Set `manageBankConfig: false` to keep the plugin out of the bank's configuration altogether,
452
+ `defaultBankConfig` included — the right setting for a bank you share with non-coding work, or one
453
+ you configure yourself. That bank should then define the five strategies above itself. Note that the
454
+ miss is **silent**: the server does not reject a retain naming a strategy the bank lacks, it logs a
455
+ warning and extracts with the bank's own configuration — so a commit diff, a session transcript and
456
+ a survey marker would all get the same generic treatment instead of the extraction each needs.
457
+ Knowledge pages are seeded either way; `pageTriggerType` governs what they cost.
296
458
 
297
459
  Like every field here it can be set per bank, which is usually where it belongs:
298
460
 
@@ -352,6 +514,32 @@ every repo (present and future) beneath it:
352
514
  Rule of thumb: converge by **id** for a hand-picked set of repos; map by **path** when a folder is
353
515
  the boundary ("everything I clone under `work/client-x` shares memory").
354
516
 
517
+ ### Per-directory overrides — `paths.<prefix>`
518
+
519
+ When a folder is the boundary for something other than the bank — typically a different server
520
+ or tenant for client work — key the override by directory instead of by bank id:
521
+
522
+ ```jsonc
523
+ {
524
+ "apiToken": "personal-key",
525
+ "paths": {
526
+ "~/work/client-x": { "apiToken": "client-x-key" },
527
+ "~/work/acme": { "apiUrl": "https://hindsight.acme.internal", "apiToken": "acme-key" },
528
+ "~/oss": { "serverMode": "daemon" },
529
+ },
530
+ }
531
+ ```
532
+
533
+ Every repo under the prefix, present and future, keeps its own bank but uses the entry's
534
+ settings. The longest matching prefix wins, and a linked worktree outside the tree uses its main
535
+ checkout's entry, as with `mapPathToBank`. The section applies after bank resolution and before
536
+ `banks.<bankId>`, so a bank section still wins for its one repo. Bank-resolution and approval
537
+ fields (`bankId`, `mapPathToBank`, `bank`, `optInOnly`, `optInPaths`, ...) are ignored inside a
538
+ path section. Any connection setting can be overridden — `serverMode`, `apiUrl`, `apiPort`,
539
+ `apiToken` — so one directory can use a local daemon while another uses Cloud or a self-hosted
540
+ server. The token is re-read on a rejected request, like the top-level `apiToken`, but only while
541
+ the directory still points at the same server.
542
+
355
543
  ### Bank resolution
356
544
 
357
545
  Coding memory is **per repository**. Resolution order for the working directory:
@@ -487,10 +675,15 @@ as a JSON line to `~/.hindsight/coding-agents-logs/diag.jsonl` (override with
487
675
  `reflect_failed` / `pages_failed` record the error; if you're comparing memory-on vs memory-off,
488
676
  check this file — a run whose reflects failed is a no-memory run. When the failure was a timeout or
489
677
  a 5xx, the hook falls back to knowledge-page search and, if no page matches, to a raw recall of the
490
- bank's observations: `reflect_fallback_pages` / `reflect_fallback_observations` record what each
678
+ bank's memories: `reflect_fallback_pages` / `reflect_fallback_observations` record what each
491
679
  step returned (`*_failed` when it errored). Seed starts are logged as
492
680
  `seed_started`.
493
681
 
682
+ When `autoInject` names a retrieval source instead of reflect, that source records its own
683
+ outcome with the number of items it returned: `inject_pages` for `"pages"`, `inject_recall` for
684
+ `"recall"` (`inject_pages_failed` / `inject_recall_failed` when the call errored). No reflect
685
+ event is written on those turns — nothing reflected.
686
+
494
687
  **Tool usage** (is the agent using Hindsight?): one JSON line per finished user turn in
495
688
  `~/.hindsight/coding-agents-logs/usage.jsonl` (override `HINDSIGHT_USAGE_FILE`) — the `hindsight_*`
496
689
  tools the agent called during that turn, and whether its reply credited Hindsight memory ("From