fleet-memory/hindsight-integrations/claude-code/scripts/lib
Nicolò Boschi 2d31b67d0c
feat(claude-code): full-session retain with document upsert and configurable tags (#695)
* feat(claude-code): full-session retain mode with document upsert and configurable tags

Switch default retain behavior from per-turn chunks to full-session upsert.
Each session is now retained as a single document (document_id = session_id)
that gets updated on every Stop event, instead of creating fragmented
documents with timestamp-suffixed IDs.

New config options:
- retainMode: "full-session" (default) or "chunked" (legacy)
- retainTags: list with template variable support ({session_id}, {bank_id}, {timestamp})
- retainMetadata: extra metadata dict merged with built-in fields, supports templates

* fix(claude-code): respect retainEveryNTurns in full-session mode

The turn-count gating was only applied in chunked mode, meaning
full-session mode would re-ingest the entire transcript on every
single Stop event. Now retainEveryNTurns gates both modes.

Also fix test isolation: resolve ~/.hindsight/claude-code.json at
call time (not module load) so HOME override in tests works correctly.

* fix(claude-code): fix config tests after USER_CONFIG_PATH removal

Update tests to use HOME env var override instead of monkeypatching
the removed USER_CONFIG_PATH constant. Add autouse fixture to
TestLoadConfig to isolate all config tests from real user config
and HINDSIGHT_* env vars.
2026-03-26 12:06:30 +01:00
..
__init__.py feat: Add Claude Code integration plugin (#651) 2026-03-23 12:06:54 +01:00
bank.py feat: Add Claude Code integration plugin (#651) 2026-03-23 12:06:54 +01:00
client.py feat(claude-code): full-session retain with document upsert and configurable tags (#695) 2026-03-26 12:06:30 +01:00
config.py feat(claude-code): full-session retain with document upsert and configurable tags (#695) 2026-03-26 12:06:30 +01:00
content.py feat: Add Claude Code integration plugin (#651) 2026-03-23 12:06:54 +01:00
daemon.py fix(claude-code): pre-start daemon in background on SessionStart hook (#663) 2026-03-23 16:11:57 +01:00
llm.py feat: remove hardcoded default models from integrations (#670) 2026-03-24 17:20:15 +01:00
state.py fix(claude-code): make fcntl import conditional for Windows compatibility (#694) 2026-03-25 18:20:27 +01:00