You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(claude-code): tidy configuration reference and sync README (#706)
* docs(claude-code): tidy configuration reference and sync README
Add missing settings (retainMode, retainToolCalls, retainTags,
retainMetadata, embedPackagePath, llmApiKeyEnv, agentName, and
several recall options) that existed in code but not in docs.
Restructure config tables with prose introductions, clearer
descriptions, and consistent layout across both files.
* refactor(claude-code): remove recallTopK setting
Unused client-side cap — Hindsight server already controls result
count via recallBudget and recallMaxTokens.
export HINDSIGHT_LLM_PROVIDER=claude-code # No API key needed
82
82
```
83
83
84
-
The model is selected automatically by the Hindsight API. To override, set `HINDSIGHT_API_LLM_MODEL`.
84
+
The model is selected automatically by the Hindsight API. To override, set `HINDSIGHT_LLM_MODEL`.
85
85
86
86
### 3. Existing Local Server
87
87
88
88
If you already have `hindsight-embed` running, leave `hindsightApiUrl` empty and set `apiPort` to match your server's port. The plugin will detect it automatically.
89
89
90
90
## Configuration
91
91
92
-
All settings are in `~/.hindsight/claude-code.json`. Every setting can also be overridden via environment variables.
92
+
All settings live in `~/.hindsight/claude-code.json`. Every setting can also be overridden via environment variables. The plugin ships with sensible defaults — you only need to configure what you want to change.
93
+
94
+
**Loading order** (later entries win):
95
+
1. Built-in defaults (hardcoded in the plugin)
96
+
2. Plugin `settings.json` (ships with the plugin, at `CLAUDE_PLUGIN_ROOT/settings.json`)
97
+
3. User config (`~/.hindsight/claude-code.json` — recommended for your overrides)
98
+
4. Environment variables
99
+
100
+
---
93
101
94
102
### Connection & Daemon
95
103
96
-
| Setting | Default | Env Var | Description |
104
+
These settings control how the plugin connects to the Hindsight API.
105
+
106
+
| Setting | Env Var | Default | Description |
97
107
|---------|---------|---------|-------------|
98
-
|`hindsightApiUrl`|`""`|`HINDSIGHT_API_URL`| External Hindsight API URL. Empty = use local daemon. |
99
-
|`hindsightApiToken`|`null`|`HINDSIGHT_API_TOKEN`| Auth token for external API |
100
-
|`apiPort`|`9077`|`HINDSIGHT_API_PORT`| Port for local Hindsight daemon |
101
-
|`daemonIdleTimeout`|`0`|`HINDSIGHT_DAEMON_IDLE_TIMEOUT`| Seconds before idle daemon shuts down (0 = never) |
102
-
|`embedVersion`|`"latest"`|`HINDSIGHT_EMBED_VERSION`|`hindsight-embed` version for `uvx`|
108
+
|`hindsightApiUrl`|`HINDSIGHT_API_URL`|`""` (empty) | URL of an external Hindsight API server. When empty, the plugin uses a local daemon instead. |
109
+
|`hindsightApiToken`|`HINDSIGHT_API_TOKEN`|`null`| Authentication token for the external API. Only needed when `hindsightApiUrl` is set. |
110
+
|`apiPort`|`HINDSIGHT_API_PORT`|`9077`| Port used by the local `hindsight-embed` daemon. Change this if you run multiple instances or have a port conflict. |
111
+
|`daemonIdleTimeout`|`HINDSIGHT_DAEMON_IDLE_TIMEOUT`|`0`| Seconds of inactivity before the local daemon shuts itself down. `0` means the daemon stays running until the session ends. |
112
+
|`embedVersion`|`HINDSIGHT_EMBED_VERSION`|`"latest"`| Which version of `hindsight-embed` to install via `uvx`. Pin to a specific version (e.g. `"0.5.2"`) for reproducibility. |
113
+
|`embedPackagePath`|`HINDSIGHT_EMBED_PACKAGE_PATH`|`null`| Local filesystem path to a `hindsight-embed` checkout. When set, the plugin runs from this path instead of installing via `uvx`. Useful for development. |
103
114
104
-
### LLM Provider (daemon mode only)
115
+
---
105
116
106
-
| Setting | Default | Env Var | Description |
117
+
### LLM Provider (local daemon only)
118
+
119
+
These settings configure which LLM the local daemon uses for fact extraction. They are **ignored** when connecting to an external API (the server uses its own LLM configuration).
|`llmModel`| provider default |`HINDSIGHT_LLM_MODEL`| Model override |
123
+
|`llmProvider`|`HINDSIGHT_LLM_PROVIDER`| auto-detect | Which LLM provider to use. Supported values: `openai`, `anthropic`, `gemini`, `groq`, `ollama`, `openai-codex`, `claude-code`. When omitted, the plugin auto-detects by checking for API key env vars in order: `OPENAI_API_KEY` → `ANTHROPIC_API_KEY` → `GEMINI_API_KEY` → `GROQ_API_KEY`. |
124
+
|`llmModel`|`HINDSIGHT_LLM_MODEL`| provider default | Override the default model for the chosen provider (e.g. `"gpt-4o"`, `"claude-sonnet-4-20250514"`). When omitted, the Hindsight API picks a sensible default for each provider. |
125
+
|`llmApiKeyEnv`| — | provider standard | Name of the environment variable that holds the API key. Normally auto-detected (e.g. `OPENAI_API_KEY` for the `openai` provider). Set this only if your key is in a non-standard env var. |
110
126
111
-
Auto-detection checks these env vars in order: `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `GEMINI_API_KEY`, `GROQ_API_KEY`.
127
+
---
112
128
113
129
### Memory Bank
114
130
115
-
| Setting | Default | Env Var | Description |
131
+
A **bank** is an isolated memory store — like a separate "brain." These settings control which bank the plugin reads from and writes to.
132
+
133
+
| Setting | Env Var | Default | Description |
116
134
|---------|---------|---------|-------------|
117
-
|`bankId`|`"claude_code"`|`HINDSIGHT_BANK_ID`| Static bank ID (when `dynamicBankId` is false) |
118
-
|`bankMission`| generic assistant |`HINDSIGHT_BANK_MISSION`| Agent identity/purpose for the memory bank |
119
-
|`retainMission`| extraction prompt | — | Custom retain mission (what to extract from conversations) |
|`dynamicBankGranularity`|`["agent", "project"]`| — | Fields for dynamic bank ID: `agent`, `project`, `session`, `channel`, `user`|
122
-
|`bankIdPrefix`|`""`| — | Prefix for all bank IDs (e.g. `"prod"`) |
135
+
|`bankId`|`HINDSIGHT_BANK_ID`|`"claude_code"`| The bank ID to use when `dynamicBankId` is `false`. All sessions share this single bank. |
136
+
|`bankMission`|`HINDSIGHT_BANK_MISSION`| generic assistant prompt | A short description of the agent's identity and purpose. Sent to Hindsight when creating or updating the bank, and used during recall to contextualize results. |
137
+
|`retainMission`| — | extraction prompt | Instructions for the fact extraction LLM — tells it *what* to extract from conversations (e.g. "Extract technical decisions and user preferences"). |
138
+
|`dynamicBankId`|`HINDSIGHT_DYNAMIC_BANK_ID`|`false`| When `true`, the plugin derives a unique bank ID from context fields (see `dynamicBankGranularity`), giving each combination its own isolated memory. |
139
+
|`dynamicBankGranularity`| — |`["agent", "project"]`| Which context fields to combine when building a dynamic bank ID. Available fields: `agent` (agent name), `project` (working directory), `session` (session ID), `channel` (channel ID), `user` (user ID). |
140
+
|`bankIdPrefix`| — |`""`| A string prepended to all bank IDs — both static and dynamic. Useful for namespacing (e.g. `"prod"` or `"staging"`). |
141
+
|`agentName`|`HINDSIGHT_AGENT_NAME`|`"claude-code"`| Name used for the `agent` field in dynamic bank ID derivation. |
142
+
143
+
---
123
144
124
145
### Auto-Recall
125
146
126
-
| Setting | Default | Env Var | Description |
147
+
Auto-recall runs on every user prompt. It queries Hindsight for relevant memories and injects them into Claude's context as invisible `additionalContext` (the user doesn't see them in the chat transcript).
|`recallMaxTokens`|`1024`|`HINDSIGHT_RECALL_MAX_TOKENS`| Max tokens in recall response |
131
-
|`recallContextTurns`|`1`|`HINDSIGHT_RECALL_CONTEXT_TURNS`| Prior turns for query composition |
151
+
|`autoRecall`|`HINDSIGHT_AUTO_RECALL`|`true`| Master switch for auto-recall. Set to `false` to disable memory retrieval entirely. |
152
+
|`recallBudget`|`HINDSIGHT_RECALL_BUDGET`|`"mid"`| Controls how hard Hindsight searches for memories. `"low"` = fast, fewer strategies; `"mid"` = balanced; `"high"` = thorough, slower. Affects latency directly. |
153
+
|`recallMaxTokens`|`HINDSIGHT_RECALL_MAX_TOKENS`|`1024`| Maximum number of tokens in the recalled memory block. Lower values reduce context usage but may truncate relevant memories. |
154
+
|`recallTypes`| — |`["world", "experience"]`| Which memory types to retrieve. `"world"` = general facts; `"experience"` = personal experiences; `"observation"` = raw observations. |
155
+
|`recallContextTurns`|`HINDSIGHT_RECALL_CONTEXT_TURNS`|`1`| How many prior conversation turns to include when composing the recall query. `1` = only the latest user message; higher values give more context but may dilute the query. |
156
+
|`recallMaxQueryChars`|`HINDSIGHT_RECALL_MAX_QUERY_CHARS`|`800`| Maximum character length of the query sent to Hindsight. Longer queries are truncated. |
157
+
|`recallRoles`| — |`["user", "assistant"]`| Which message roles to include when building the recall query from prior turns. |
158
+
|`recallPromptPreamble`| — | built-in string | Text placed above the recalled memories in the injected context block. Customize this to change how Claude interprets the memories. |
159
+
160
+
---
132
161
133
162
### Auto-Retain
134
163
135
-
| Setting | Default | Env Var | Description |
164
+
Auto-retain runs after Claude responds. It extracts the conversation transcript and sends it to Hindsight for long-term storage and fact extraction.
|`retainEveryNTurns`|`10`| — | Retain every Nth turn (sliding window) |
139
-
|`retainOverlapTurns`|`2`| — | Extra overlap turns for continuity |
140
-
|`retainRoles`|`["user", "assistant"]`| — | Which message roles to retain |
168
+
|`autoRetain`|`HINDSIGHT_AUTO_RETAIN`|`true`| Master switch for auto-retain. Set to `false` to disable memory storage entirely. |
169
+
|`retainMode`|`HINDSIGHT_RETAIN_MODE`|`"full-session"`| Retention strategy. `"full-session"` sends the full conversation transcript (with chunking). |
170
+
|`retainEveryNTurns`| — |`10`| How often to retain. `1` = every turn; `10` = every 10th turn. Higher values reduce API calls but delay memory capture. Values > 1 enable **chunked retention** with a sliding window. |
171
+
|`retainOverlapTurns`| — |`2`| When chunked retention fires, this many extra turns from the previous chunk are included for continuity. Total window size = `retainEveryNTurns + retainOverlapTurns`. |
172
+
|`retainRoles`| — |`["user", "assistant"]`| Which message roles to include in the retained transcript. |
173
+
|`retainToolCalls`| — |`true`| Whether to include tool calls (function invocations and results) in the retained transcript. Captures structured actions like file reads, searches, and code edits. |
174
+
|`retainTags`| — |`["{session_id}"]`| Tags attached to the retained document. Supports `{session_id}` placeholder which is replaced with the current session ID at runtime. |
175
+
|`retainMetadata`| — |`{}`| Arbitrary key-value metadata attached to the retained document. |
176
+
|`retainContext`| — |`"claude-code"`| A label attached to retained memories identifying their source. Useful when multiple integrations write to the same bank. |
177
+
178
+
---
141
179
142
-
### Miscellaneous
180
+
### Debug
143
181
144
-
| Setting |Default |Env Var | Description |
182
+
| Setting | Env Var| Default| Description |
145
183
|---------|---------|---------|-------------|
146
-
|`debug`|`false`|`HINDSIGHT_DEBUG`| Enable debug logging to stderr |
184
+
|`debug`|`HINDSIGHT_DEBUG`|`false`| Enable verbose logging to stderr. All log lines are prefixed with `[Hindsight]`. Useful for diagnosing connection issues, recall/retain behavior, and bank ID derivation.|
0 commit comments