Skip to content

feat(chatarchive): add incremental archive with file modification time tracking #93

@CodeMonkeyCybersecurity

Description

Problem

Currently, every archive run re-hashes ALL discovered files to check against the manifest. For large source directories (e.g. ~/Dev with thousands of files), this is O(n) SHA-256 computations on every run, even when nothing has changed.

Proposed fix

Track file modification time (mtime) and size in the manifest entries. On subsequent runs:

  1. If mtime+size match the manifest entry → skip hashing entirely
  2. If mtime or size differ → re-hash and check for content changes
  3. New files → hash as usual

This is the same approach git uses for its index (stat cache).

References

  • Git index format: mtime+size as stat cache
  • Go os.FileInfo.ModTime() and os.FileInfo.Size()

Acceptance criteria

  • Manifest entries include mod_time and size_bytes fields
  • Subsequent runs skip hashing when mtime+size match
  • Performance benchmark: measure hashing savings on 1000-file directory
  • Backward compatible: old manifests without mtime fall back to full hash

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions