Skip to content

fix(auto-capture): locate a commit at its code, not at .projectmem/ files - #23

Open
RTE404 wants to merge 2 commits into
riponcm:mainfrom
RTE404:fix/20-autocapture-location
Open

RTE404 wants to merge 2 commits into
riponcm:mainfrom
RTE404:fix/20-autocapture-location

Conversation

@RTE404

@RTE404 RTE404 commented Sep 29, 2026 •

Copy link
Copy Markdown

Fixes #20.

Auto-captured commits used files[0] as their location. git lists changed paths sorted, .projectmem/ sorts ahead of most paths, and summary.md is regenerated on every event, so most commits were located at .projectmem/summary.md. The staleness check then counted every later commit to summary.md against those events and flagged nearly all of them as possibly stale.

Change: commands/auto_capture.py now picks the first changed path outside .projectmem/ as the location. A commit that touches only memory files gets no location, so it is never flagged against summary.md either. files is unchanged: the event still lists every path the commit touched.

Tests: new tests/test_auto_capture.py makes a real git repo and runs _capture_commit against it:

  • a commit touching .projectmem/summary.md and src/login.py is located at src/login.py, and its files still include summary.md;
  • a commit touching only .projectmem/summary.md has no location.

Both tests fail on main and pass with this change.

Verification (Windows 11, Python 3.12):

  • Full suite: 277 passed, 4 failed. The same 4 fail on main without this change (test_global_mcp.py ×3, test_init_ux.py::test_print_mcp_config_single_project_still_pins_the_root), so they're pre-existing on Windows and unrelated. The two MCP stdio tests in test_mcp_server.py time out intermittently on this machine on both main and this branch.
  • ruff check: no new findings. auto_capture.py reports the same 9 as on main; tests/test_auto_capture.py is clean.
  • Merges cleanly with current main.

Notes:

  • Events captured before this fix keep their old location, since the log is append-only, so existing stale flags on .projectmem/ files will persist.
  • Separate, not changed here: git diff-tree without --root lists no files for a repo's first commit, so that commit is captured with no files. Happy to send a follow-up if that's wanted.

…iles

`location` was `files[0]`. git lists changed paths sorted and `.projectmem/`
sorts ahead of most paths, while summary.md is regenerated on every event,
so most auto-captured commits were located at `.projectmem/summary.md`. The
staleness check then counted every later commit to summary.md against them
and flagged nearly all as possibly stale.

The location now skips paths under `.projectmem/`; a commit that touches
only memory files gets no location. `files` is unchanged.

Fixes riponcm#20
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@riponcm

riponcm commented Oct 1, 2026

Copy link
Copy Markdown
Owner

Thanks Rohan, good catch, and confirmed: the new tests fail on main and pass with your change. I'll merge this in the next update, planned for this Sunday. And yes, a follow-up for the first-commit --root case would be welcome.

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.

Auto-capture tags commits at .projectmem/ files, so precheck flags valid memories as stale

2 participants