fleet-memory/hindsight-integrations/claude-code/tests
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
..
conftest.py fix(claude-code): fix plugin installation, config UX, and release workflow (#661) 2026-03-23 15:15:16 +01:00
test_bank.py fix(claude-code): fix plugin installation, config UX, and release workflow (#661) 2026-03-23 15:15:16 +01:00
test_client.py fix(claude-code): fix plugin installation, config UX, and release workflow (#661) 2026-03-23 15:15:16 +01:00
test_config.py feat(claude-code): full-session retain with document upsert and configurable tags (#695) 2026-03-26 12:06:30 +01:00
test_content.py fix(claude-code): fix plugin installation, config UX, and release workflow (#661) 2026-03-23 15:15:16 +01:00
test_hooks.py feat(claude-code): full-session retain with document upsert and configurable tags (#695) 2026-03-26 12:06:30 +01:00