Repository navigation
Description
precheck_file is the tool that should stop an agent from repeating a dead end, so I measured how often it actually shows the earlier failures for the file an agent is about to edit.
On one of my projects (two months old, 248 issues, ~3k events) I took every issue that has at least one failed or partial attempt and a location: 51 cases. For each one I asked: "an agent is about to edit this file; does projectmem show it what already failed there?"
| Source | Shows the earlier failures | Tokens per question |
|---|---|---|
precheck_file(<file>) |
33.3% | ~55 |
the whole summary.md |
35.3% | ~6,800 |
Most of precheck's 33% (15 of 17 hits) comes from the open-issue check printing the issue title, not from the failed-attempts check. Running only the failed-attempts check over the 51 cases, it would have shown the case's own failures for one of them.
A minimal reproduction:
log_issue("token refresh race", location="src/auth.py") # 40 days ago
record_attempt("wrapped refresh in a lock", outcome="failed") # 40 days ago, no location
record_attempt("retry halves the failures", outcome="partial") # 3 days ago, no location
record_fix("serialized refresh per user")precheck_file("src/auth.py")
src/auth.py: no warnings. Safe to modify.
Where the misses come from (the other 50 cases):
| Cause | Cases |
|---|---|
The attempts carry no location, so precheck never links them to the file. location is optional on record_attempt, and agents usually leave it out because the issue already has one. |
30 |
The failures are older than RECENT_DAYS (30). A dead end two months ago is still a dead end while the file exists. |
12 |
Only partial attempts in the window. Precheck counts failed only, although summary.md already treats partial attempts as lessons (L-027b). |
8 |
What I'd suggest:
- An attempt (or fix) without its own location inherits its issue's file in
_live_event_paths. - Failed and partial attempts are lessons; partial ones get their own mark. The block severity still counts failed attempts only.
- Lessons are not subject to
RECENT_DAYS. Churn, reverts and decisions keep the window, and the staleness check still flags memories whose file changed a lot.
The same reproduction then gives:
projectmem precheck: src/auth.py
[WARN] What already failed here (2 attempts, 1 only partly worked):
- ~ retry halves the failures (3d ago)
- x wrapped refresh in a lock (1mo ago)
On the same 51 cases recall goes from 33.3% to 72.5%, at about 109 tokens per question, so about 1.6% of what the full summary costs. Nothing in events.jsonl changes. The existing tests pass, and I added tests for each of the three points.
Two smaller things on the same branch, happy to drop either:
precheck_files(file_paths)checks several files in one call and one analysis pass, for changes that touch more than one file.- When more than three lessons exist, the overflow line names the issues that hold the hidden ones (
... and 2 more, from #0012 (get_issue(issue_id))) instead of pointing topjm search --failed-only, which leaves partial attempts out.
Open questions:
- Is dropping the window for lessons acceptable, or would you prefer a longer one (say 180 days) or a
config.tomlsetting? precheck_filesas a separate tool, or a list parameter onprecheck_file?- Should
record_attemptalso nudge agents to passlocationwhen it differs from the issue's, or is inheritance enough?
The change is on bigfree:fix/precheck-lessons (two commits on top of main, diff). I can open a PR if this direction works for you.
Activity
Merge bigfree/fix/precheck-lessons: precheck shows every lesson for a…
riponcm commentedon Nov 20, 2026
Shipped in 0.3.6, thank you. Attempts now inherit their issue's file, partial attempts count, and failed or partial lessons no longer expire. Churn and decisions keep the 30-day window.
To your questions:
precheck_filesis a separate tool, as you built it.record_attemptdoesn't nudge agents to passlocation.I also checked it on a project created with 0.3.5: an old attempt logged without a location now shows up in precheck. Closing.