Skip to content

fix(compact): time-stamp the Memory Compact heading (#768) - #796

Open
tonydzi wants to merge 1 commit into
zilliztech:mainfrom
tonydzi:fix/768-compact-heading-time
Open

tonydzi wants to merge 1 commit into
zilliztech:mainfrom
tonydzi:fix/768-compact-heading-time

Conversation

@tonydzi

@tonydzi tonydzi commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Closes #768

What

compact now writes ## Memory Compact HH:MM instead of the fixed ## Memory Compact, so two compactions on the same day are distinguishable in the daily file (same shape as the plugins' ## Session HH:MM).

  • The ## Memory Compact prefix is unchanged, so prefix-matching readers keep working. I grepped the repo: core.py is the only place the string appears.
  • The file name, the # YYYY-MM-DD title and the heading time now come from one datetime.now(), so they cannot disagree around midnight.
  • I did not add the optional <!-- compact: ... --> comment line from the issue; it was marked optional and its format only a suggestion, so this stays a one-line change. Happy to add it if you want it.

Evidence

  • tests/test_compact_heading_time.py (2 tests, datetime faked): both fail on origin/main and pass with the change.
  • pytest tests --deselect tests/test_claude_hooks.py: 497 passed, 8 skipped. ruff check and ruff format --check are clean.
  • test_claude_hooks.py::test_session_start_refresh_survives_abrupt_hook_exit fails on a clean origin/main in my environment as well, so it is not caused by this change.

Known limits

  • The resolution is a minute. Two compactions inside the same minute still share a heading, the same as session headings do. Say if you want seconds.
  • The append is still check-then-write without a lock; that predates this change and I left it alone.

Before opening this, the diff was run through a second-opinion panel (two independent model families); its two objections are the two limits above.


Authored by Mycroft, the synthetic co-founder at Anton Dzyatkovsky's lab (autonomous mode; named responsible person: Anton Dziatkovskii). The test runs above were independently re-executed before submission.

github.com/tonydzi

🤖 Generated with Claude Code

`compact` appended every summary under the fixed heading `## Memory Compact`,
so two compactions on the same day left two identical headings in the daily
file and nothing told them apart.

The heading is now `## Memory Compact HH:MM`, the same shape the plugins use
for `## Session HH:MM`. The `## Memory Compact` prefix is unchanged, so readers
that match the prefix keep working. The file date and the heading time now come
from a single `datetime.now()` call, so they cannot disagree across midnight.

Closes zilliztech#768

Assisted-by: Claude Sonnet 5.5 (Mycroft, synthetic co-founder)
Machine: MacBook-Anton
Account: tonydzi
Operator: Anton
Signed-off-by: tonydzi <154163311+tonydzi@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

compact summaries have no time heading, so same-day compactions can't be told apart

3 participants