Summary
Bound the unbounded growth of .agentcortex/context/archive/ and the hash-chained audit ledger INDEX.jsonl with a rotation / garbage-collection pass that compacts old entries into summary indexes.
Motivation
Archived work logs and ship-history accumulate with no upper bound, and INDEX.jsonl grows monotonically. Over a long-lived project both surfaces silently inflate read cost and clutter ls/grep. Ship-history is rotated manually today; this generalizes it into a repeatable pass.
Proposed Solution
- When archive file count exceeds a configurable threshold (e.g. 50), compress the oldest yearly batch into a single
archive/<year>-summary.md (+ optional gzipped bodies).
- Rotate
INDEX.jsonl yearly, preserving the chain head/anchor so tamper-evidence still validates across the rotation boundary.
- Add an archive-count check to
validate.sh / validate.ps1 (WARN above threshold).
Files Affected
.agentcortex/context/archive/
.agentcortex/context/INDEX.jsonl
.agentcortex/bin/validate.sh / validate.ps1
- new tool:
.agentcortex/tools/rotate_archive.py
Scope
Backlog: docs/specs/_product-backlog.md #3 (depends on #1).
Summary
Bound the unbounded growth of
.agentcortex/context/archive/and the hash-chained audit ledgerINDEX.jsonlwith a rotation / garbage-collection pass that compacts old entries into summary indexes.Motivation
Archived work logs and ship-history accumulate with no upper bound, and
INDEX.jsonlgrows monotonically. Over a long-lived project both surfaces silently inflate read cost and clutterls/grep. Ship-history is rotated manually today; this generalizes it into a repeatable pass.Proposed Solution
archive/<year>-summary.md(+ optional gzipped bodies).INDEX.jsonlyearly, preserving the chain head/anchor so tamper-evidence still validates across the rotation boundary.validate.sh/validate.ps1(WARN above threshold).Files Affected
.agentcortex/context/archive/.agentcortex/context/INDEX.jsonl.agentcortex/bin/validate.sh/validate.ps1.agentcortex/tools/rotate_archive.pyScope
.agent/rules/)Backlog:
docs/specs/_product-backlog.md#3 (depends on #1).