Skip to content

[Feature] Archive directory GC + INDEX.jsonl rotation #141

Description

@KbWen

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

  1. 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).
  2. Rotate INDEX.jsonl yearly, preserving the chain head/anchor so tamper-evidence still validates across the rotation boundary.
  3. 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

  • Deploy / tooling change
  • Guardrail update (.agent/rules/)

Backlog: docs/specs/_product-backlog.md #3 (depends on #1).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestgovernanceGovernance rules, guardrails, or gate logic

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions