diff --git a/hindsight-docs/docs-integrations/claude-code.md b/hindsight-docs/docs-integrations/claude-code.md index 491e76a267..cb607f6ea3 100644 --- a/hindsight-docs/docs-integrations/claude-code.md +++ b/hindsight-docs/docs-integrations/claude-code.md @@ -204,7 +204,7 @@ Auto-retain runs after Claude responds. It extracts the conversation transcript | `retainOverlapTurns` | — | `2` | When chunked retention fires, this many extra turns from the previous chunk are included for continuity. Total window size = `retainEveryNTurns + retainOverlapTurns`. | | `retainRoles` | — | `["user", "assistant"]` | Which message roles to include in the retained transcript. | | `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. | -| `retainTags` | — | `["{session_id}"]` | Tags attached to the retained document. Supports `{session_id}` placeholder which is replaced with the current session ID at runtime. | +| `retainTags` | `HINDSIGHT_RETAIN_TAGS` | `["{session_id}"]` | Tags attached to the retained document. The env var accepts JSON or a comma-separated list. Supports `{session_id}` placeholder which is replaced with the current session ID at runtime. | | `retainMetadata` | — | `{}` | Arbitrary key-value metadata attached to the retained document. | | `retainContext` | — | `"claude-code"` | A label attached to retained memories identifying their source. Useful when multiple integrations write to the same bank. | diff --git a/hindsight-integrations/claude-code/README.md b/hindsight-integrations/claude-code/README.md index 50c67a892b..a2520963ba 100644 --- a/hindsight-integrations/claude-code/README.md +++ b/hindsight-integrations/claude-code/README.md @@ -248,7 +248,7 @@ Auto-retain runs after Claude responds. It extracts the conversation transcript | `retainOverlapTurns` | — | `2` | When chunked retention fires, this many extra turns from the previous chunk are included for continuity. Total window size = `retainEveryNTurns + retainOverlapTurns`. | | `retainRoles` | — | `["user", "assistant"]` | Which message roles to include in the retained transcript. | | `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. | -| `retainTags` | — | `["{session_id}"]` | Tags attached to the retained document. Supports template placeholders: `{session_id}`, `{bank_id}`, `{timestamp}`, and `{user_id}` (resolved from `HINDSIGHT_USER_ID` env var; empty string if unset). Tags whose resolved form ends in an empty namespace part (e.g. `"user:"` when `HINDSIGHT_USER_ID` is unset) are dropped from the outgoing request. See [Template variables](#template-variables-for-retaintags-and-retainmetadata) below. | +| `retainTags` | `HINDSIGHT_RETAIN_TAGS` | `["{session_id}"]` | Tags attached to the retained document. The env var accepts JSON or a comma-separated list. Supports template placeholders: `{session_id}`, `{bank_id}`, `{timestamp}`, and `{user_id}` (resolved from `HINDSIGHT_USER_ID` env var; empty string if unset). Tags whose resolved form ends in an empty namespace part (e.g. `"user:"` when `HINDSIGHT_USER_ID` is unset) are dropped from the outgoing request. See [Template variables](#template-variables-for-retaintags-and-retainmetadata) below. | | `retainMetadata` | — | `{}` | Arbitrary key-value metadata attached to the retained document. Same template placeholders as `retainTags`. | | `retainContext` | — | `"claude-code"` | A label attached to retained memories identifying their source. Useful when multiple integrations write to the same bank. | diff --git a/hindsight-integrations/claude-code/scripts/lib/config.py b/hindsight-integrations/claude-code/scripts/lib/config.py index 10ad13b245..f974149995 100644 --- a/hindsight-integrations/claude-code/scripts/lib/config.py +++ b/hindsight-integrations/claude-code/scripts/lib/config.py @@ -82,6 +82,7 @@ "HINDSIGHT_RECALL_TAGS_MATCH": ("recallTagsMatch", str), "HINDSIGHT_RECALL_TAG_GROUPS": ("recallTagGroups", dict), "HINDSIGHT_RECALL_ADDITIONAL_BANK_FILTERS": ("recallAdditionalBankFilters", dict), + "HINDSIGHT_RETAIN_TAGS": ("retainTags", list), "HINDSIGHT_API_PORT": ("apiPort", int), "HINDSIGHT_DAEMON_IDLE_TIMEOUT": ("daemonIdleTimeout", int), "HINDSIGHT_REQUEST_TIMEOUT_SECONDS": ("requestTimeoutSeconds", int), diff --git a/hindsight-integrations/claude-code/tests/test_config.py b/hindsight-integrations/claude-code/tests/test_config.py index 5cb259a53c..1fc794b8c7 100644 --- a/hindsight-integrations/claude-code/tests/test_config.py +++ b/hindsight-integrations/claude-code/tests/test_config.py @@ -87,6 +87,12 @@ def test_recall_tags_env_override_accepts_comma_list(self, tmp_path, monkeypatch cfg = load_config() assert cfg["recallTags"] == ["memory_type:rule", "tech_stack:supabase"] + def test_retain_tags_env_override_accepts_comma_list(self, tmp_path, monkeypatch): + monkeypatch.setenv("CLAUDE_PLUGIN_ROOT", str(tmp_path)) + monkeypatch.setenv("HINDSIGHT_RETAIN_TAGS", "project:payments, source:claude-code") + cfg = load_config() + assert cfg["retainTags"] == ["project:payments", "source:claude-code"] + def test_recall_tag_groups_env_override_accepts_json(self, tmp_path, monkeypatch): monkeypatch.setenv("CLAUDE_PLUGIN_ROOT", str(tmp_path)) monkeypatch.setenv( diff --git a/skills/hindsight-docs/references/sdks/integrations/claude-code.md b/skills/hindsight-docs/references/sdks/integrations/claude-code.md index 2e2bccf617..434e4b4ce8 100644 --- a/skills/hindsight-docs/references/sdks/integrations/claude-code.md +++ b/skills/hindsight-docs/references/sdks/integrations/claude-code.md @@ -198,7 +198,7 @@ Auto-retain runs after Claude responds. It extracts the conversation transcript | `retainOverlapTurns` | — | `2` | When chunked retention fires, this many extra turns from the previous chunk are included for continuity. Total window size = `retainEveryNTurns + retainOverlapTurns`. | | `retainRoles` | — | `["user", "assistant"]` | Which message roles to include in the retained transcript. | | `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. | -| `retainTags` | — | `["{session_id}"]` | Tags attached to the retained document. Supports `{session_id}` placeholder which is replaced with the current session ID at runtime. | +| `retainTags` | `HINDSIGHT_RETAIN_TAGS` | `["{session_id}"]` | Tags attached to the retained document. The env var accepts JSON or a comma-separated list. Supports `{session_id}` placeholder which is replaced with the current session ID at runtime. | | `retainMetadata` | — | `{}` | Arbitrary key-value metadata attached to the retained document. | | `retainContext` | — | `"claude-code"` | A label attached to retained memories identifying their source. Useful when multiple integrations write to the same bank. |