@vectorize-io/hindsight-coding-agents 0.7.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +201 -16
  2. package/dist/antigravity-hook.js +1132 -115
  3. package/dist/antigravity-statusline.js +77 -11
  4. package/dist/antigravity-stop-hook.js +1193 -133
  5. package/dist/claude-hook.js +1132 -115
  6. package/dist/claude-sessionstart-hook.js +1241 -140
  7. package/dist/claude-stop-hook.js +1193 -133
  8. package/dist/cline.js +578 -163
  9. package/dist/codebuddy-hook.js +4270 -0
  10. package/dist/codebuddy-sessionstart-hook.js +5030 -0
  11. package/dist/codebuddy-stop-hook.js +4564 -0
  12. package/dist/codex-hook.js +1132 -115
  13. package/dist/codex-sessionstart-hook.js +1241 -140
  14. package/dist/codex-stop-hook.js +1193 -133
  15. package/dist/copilot-hook.js +1132 -115
  16. package/dist/copilot-sessionstart-hook.js +1241 -140
  17. package/dist/copilot-stop-hook.js +1193 -133
  18. package/dist/cursor-hook.js +1132 -115
  19. package/dist/cursor-sessionstart-hook.js +1241 -140
  20. package/dist/cursor-stop-hook.js +1193 -133
  21. package/dist/daemon-start.js +54 -9
  22. package/dist/dcode-hook.js +1132 -115
  23. package/dist/dcode-sessionstart-hook.js +1241 -140
  24. package/dist/dcode-stop-hook.js +1193 -133
  25. package/dist/deepen.js +370 -104
  26. package/dist/devin-hook.js +1132 -115
  27. package/dist/devin-sessionstart-hook.js +1241 -140
  28. package/dist/devin-stop-hook.js +1193 -133
  29. package/dist/droid-hook.js +1132 -115
  30. package/dist/droid-sessionstart-hook.js +1241 -140
  31. package/dist/droid-stop-hook.js +1193 -133
  32. package/dist/dsh.js +586 -164
  33. package/dist/grok-hook.js +1132 -115
  34. package/dist/grok-sessionstart-hook.js +1241 -140
  35. package/dist/grok-stop-hook.js +1193 -133
  36. package/dist/hindsight-seed.js +50 -8
  37. package/dist/index.js +587 -172
  38. package/dist/installer.js +2010 -769
  39. package/dist/kilo.js +587 -172
  40. package/dist/kimi-hook.js +4270 -0
  41. package/dist/kimi-sessionstart-hook.js +5030 -0
  42. package/dist/kimi-stop-hook.js +4564 -0
  43. package/dist/mcp-server.js +419 -115
  44. package/dist/opencode2.js +586 -169
  45. package/dist/pi.js +644 -175
  46. package/dist/prime-agent.js +644 -175
  47. package/dist/qwen-hook.js +1132 -115
  48. package/dist/qwen-sessionstart-hook.js +1241 -140
  49. package/dist/qwen-stop-hook.js +1193 -133
  50. package/dist/status.js +243 -52
  51. package/dist/traecode-hook.js +4270 -0
  52. package/dist/traecode-sessionstart-hook.js +5030 -0
  53. package/dist/traecode-stop-hook.js +4564 -0
  54. package/dist/workbuddy-hook.js +4270 -0
  55. package/dist/workbuddy-sessionstart-hook.js +5030 -0
  56. package/dist/workbuddy-stop-hook.js +4564 -0
  57. package/dist/zcode-hook.js +1132 -115
  58. package/dist/zcode-sessionstart-hook.js +1241 -140
  59. package/dist/zcode-stop-hook.js +1193 -133
  60. package/package.json +22 -12
  61. package/plugin.json +1 -1
  62. package/skill/SKILL.md +73 -14
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vectorize-io/hindsight-coding-agents",
3
- "version": "0.7.0",
3
+ "version": "0.8.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/vectorize-io/hindsight.git",
@@ -35,9 +35,21 @@
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",
41
+ "hindsight-workbuddy-hook": "dist/workbuddy-hook.js",
42
+ "hindsight-workbuddy-sessionstart-hook": "dist/workbuddy-sessionstart-hook.js",
43
+ "hindsight-workbuddy-stop-hook": "dist/workbuddy-stop-hook.js",
44
+ "hindsight-codebuddy-hook": "dist/codebuddy-hook.js",
45
+ "hindsight-codebuddy-sessionstart-hook": "dist/codebuddy-sessionstart-hook.js",
46
+ "hindsight-codebuddy-stop-hook": "dist/codebuddy-stop-hook.js",
38
47
  "hindsight-droid-hook": "dist/droid-hook.js",
39
48
  "hindsight-droid-sessionstart-hook": "dist/droid-sessionstart-hook.js",
40
- "hindsight-droid-stop-hook": "dist/droid-stop-hook.js"
49
+ "hindsight-droid-stop-hook": "dist/droid-stop-hook.js",
50
+ "hindsight-kimi-hook": "dist/kimi-hook.js",
51
+ "hindsight-kimi-sessionstart-hook": "dist/kimi-sessionstart-hook.js",
52
+ "hindsight-kimi-stop-hook": "dist/kimi-stop-hook.js"
41
53
  },
42
54
  "exports": {
43
55
  ".": {
@@ -83,27 +95,25 @@
83
95
  "test:dcode-e2e": "npm run build && HINDSIGHT_DCODE_E2E=1 vitest run src/dcode-plugin.e2e.test.ts",
84
96
  "test:harness-e2e": "npm run build && HINDSIGHT_HARNESS_E2E=1 vitest run src/harness.e2e.test.ts"
85
97
  },
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
98
  "devDependencies": {
99
+ "@modelcontextprotocol/sdk": "^1.29.0",
94
100
  "@opencode-ai/plugin": "^1.18.9",
95
- "@opencode/plugin": "^2.0.3",
96
101
  "@opencode-ai/sdk": "^1.18.9",
102
+ "@opencode/plugin": "^2.0.3",
97
103
  "@types/node": "^26.1.0",
104
+ "@vectorize-io/hindsight-all": "^0.10.2",
105
+ "jsonc-parser": "^3.3.1",
106
+ "smol-toml": "^1.8.0",
98
107
  "tsup": "^8.3.0",
99
108
  "typescript": "^5.6.0",
100
- "vitest": "^4.1.11"
109
+ "vitest": "^4.1.11",
110
+ "zod": "^4.4.3"
101
111
  },
102
112
  "overrides": {
103
113
  "esbuild": ">=0.25.0 <1.0.0",
104
114
  "fast-uri": ">=3.1.6 <4.0.0",
105
115
  "hono": ">=4.13.5 <5.0.0",
106
- "ip-address": ">=10.3.1 <11.0.0",
116
+ "ip-address": ">=10.5.1 <11.0.0",
107
117
  "postcss": ">=8.5.23 <9.0.0",
108
118
  "vite": ">=6.4.3 <7.0.0"
109
119
  }
package/plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hindsight-coding-agents",
3
- "version": "0.7.0",
3
+ "version": "0.8.1",
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
@@ -110,14 +110,16 @@ Configuration is **one JSON file**: `~/.hindsight/coding-agent.json`. Layering,
110
110
  (`HINDSIGHT_<FIELD_IN_CAPS>`), for containers and CI that inject config rather than write a file
111
111
  3. the file's top level
112
112
  4. its `harnesses.<name>` section — per-agent override
113
- 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
114
116
  (see [Per-repo opt-in/out](#per-repo-opt-inout--banksbankid))
115
117
 
116
118
  Environment variables are a **fallback**: the file wins wherever it sets a value, so adding env to
117
119
  an existing setup changes nothing. The two list-valued settings, `retainTags` and `optInPaths`, take
118
120
  a comma-separated value (`HINDSIGHT_RETAIN_TAGS="project:{gitProject},env:work"`); entries are
119
121
  trimmed and blanks dropped.
120
- The map-valued settings (`mapPathToBank`, `harnesses`, `banks`, `retainMetadata`) are file-only —
122
+ The map-valued settings (`mapPathToBank`, `harnesses`, `paths`, `banks`, `retainMetadata`) are file-only —
121
123
  per-key branching doesn't survive flattening into one variable. `maxParallelRetains` is available
122
124
  as `HINDSIGHT_MAX_PARALLEL_RETAINS` for containers and CI.
123
125
 
@@ -203,18 +205,22 @@ hook by Codex...), so one shared config serves several agents side by side:
203
205
  | `resolveWorktrees` | `true` | linked worktrees inherit the main checkout's bank identity, path approval, and mapping |
204
206
  | `retainTags` | — | extra tags on every document written by the integration, e.g. `["project:{gitProject}"]` — see **Recording where a memory came from** below |
205
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` |
206
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 |
207
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 |
208
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 |
209
213
  | `disabled` | `false` | hard off-switch (inert plugin/hook — a no-memory baseline) |
210
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) |
211
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 |
212
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 |
213
- | `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), so they stay well inside the hook window |
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`, and when one finds nothing for the prompt it tries again on the next one, up to 5 prompts |
214
219
  | `autoReflect` | `true` | **deprecated** — use `autoInject`. Still honoured (`false` = `autoInject: "none"`), ignored when `autoInject` is set, and logs a deprecation warning |
215
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 |
216
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 |
217
- | `pageRefreshEveryTurns` | `10` | refetch the knowledge pages and re-inject the page roster + tool guide every N user turns |
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` | `1` | refetch the knowledge pages and re-inject the page roster + tool guide every N user turns (`0` also means 1) |
218
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) |
219
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 |
220
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 |
@@ -229,7 +235,7 @@ hook by Codex...), so one shared config serves several agents side by side:
229
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 |
230
236
  | `logLevel` | `"info"` | plugin-log verbosity (`"debug"` \| `"info"` \| `"warn"` \| `"error"`); `HINDSIGHT_LOG_LEVEL` env overrides |
231
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` |
232
- | `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 |
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 |
233
239
  | `harnesses.<name>` | — | per-harness override of any field above |
234
240
  | `harness` | `opencode` | **deepen engine only**: which session format `--conversations` is read as |
235
241
 
@@ -415,13 +421,40 @@ One field is the exception: the extraction mode of the plugin's own four strateg
415
421
  if it drifts — the same way a seeded page's query is. Change it in `coding-agent.json`, not in the
416
422
  control plane. The strategies' other fields, and your own strategies, are still left alone.
417
423
 
418
- Set `manageBankConfig: false` to keep the plugin out of the bank's configuration altogether — the
419
- right setting for a bank you share with non-coding work, or one you configure yourself. That bank
420
- should then define the five strategies above itself. Note that the miss is **silent**: the server
421
- does not reject a retain naming a strategy the bank lacks, it logs a warning and extracts with the
422
- bank's own configuration — so a commit diff, a session transcript and a survey marker would all get
423
- the same generic treatment instead of the extraction each needs. Knowledge pages are seeded either
424
- way; `pageTriggerType` governs what they cost.
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.
425
458
 
426
459
  Like every field here it can be set per bank, which is usually where it belongs:
427
460
 
@@ -481,6 +514,32 @@ every repo (present and future) beneath it:
481
514
  Rule of thumb: converge by **id** for a hand-picked set of repos; map by **path** when a folder is
482
515
  the boundary ("everything I clone under `work/client-x` shares memory").
483
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
+
484
543
  ### Bank resolution
485
544
 
486
545
  Coding memory is **per repository**. Resolution order for the working directory:
@@ -629,8 +688,8 @@ event is written on those turns — nothing reflected.
629
688
  `~/.hindsight/coding-agents-logs/usage.jsonl` (override `HINDSIGHT_USAGE_FILE`) — the `hindsight_*`
630
689
  tools the agent called during that turn, and whether its reply credited Hindsight memory ("From
631
690
  Hindsight memory"). The credit rate counts only turns that called a retrieval tool (search, list,
632
- read, reflect); saving a document is not expected to be credited. Recorded when the session is written back, so a scope with
633
- `retainSessions: false` records none. It never leaves your machine. Summarize it per agent with:
691
+ read, reflect); saving a document is not expected to be credited. Recorded at the end of each turn,
692
+ whether or not `retainSessions` writes the session back. It never leaves your machine. Summarize it per agent with:
634
693
 
635
694
  ```bash
636
695
  npx @vectorize-io/hindsight-coding-agents stats