Repository navigation
fix(summary): one-line fixed issues, clip long records, ask for short ones - #30
Merged
Merged
Conversation
summary.md is read at the start of every session, so its size is paid on every session. The section caps from #19 bound how many records it shows, but not how long each one is, and a fixed issue still carried its whole fix text and its failed attempts. A fixed issue is now one line: id, title, location. Every record text is clipped to 300 characters; the location is never clipped. The full text stays in issues/, events.jsonl and search.
…lips Clipping keeps summary.md bounded, but a record written at its full length still loses its tail there, and the guidance only asked for entries to be "concise". The rules summary now states the limits: an issue title under 140 characters, every other record under 300, with further evidence going into another record_attempt. A test ties the stated number to LINE_CHARS so the two cannot drift. INSTRUCTIONS_VERSION goes to 2 so existing projects pick up the line on their next `pjm init`.
Review of the two previous commits found: - The word-boundary cut took the last space anywhere in the line, so "see <long path>" clipped to "see..." and text with a leading space to "...". The cut now only moves back to a space in the second half of the line; otherwise it cuts hard. - Clipping counted characters but kept line breaks, so a pasted traceback or a line starting with "## " still broke out of its list item. Whitespace is folded before measuring. - A fixed issue logged without a location lost where it was fixed; the fix location is used then. - The 140/300 limits were stated only in AI_INSTRUCTIONS.md, which a client that never calls get_instructions does not read. The summary descriptions of log_issue, record_attempt, record_fix, add_decision and add_note now state them too. - Both numbers were written out by hand next to the constant that enforces one of them. TITLE_CHARS and RECORD_CHARS now live in storage.py and every surface formats them in. The rendered instructions are unchanged, so the version 2 fingerprint still holds. The clipping test now checks the clipped text is a whole-word prefix of a sensible length, not only an upper bound.
- A location was printed as given, so one containing a line break could still open a stray "## " heading in summary.md. _loc() folds whitespace the same way record text is folded, without clipping, and replaces five copies of the same f-string. - _clip finds the word boundary with rfind's start index instead of a separate threshold check. Same output. - record_fix said summary.md clips longer text, but fix text is no longer in summary.md. It now states only the limit. - get_summary, the server instructions and AI_INSTRUCTIONS.md promised "a few hundred to ~1,500 tokens". An aged project is a few thousand now, so they say that. The version 2 fingerprint is updated; version 2 is not released yet. - Tests: one check over the five tool descriptions instead of five schema reads, and the fixed-issue location cases as one parametrized test. The short-record check moved into the long-record test as its control.
The names carry the meaning; the reasoning is in the commit messages and the PR.
riponcm
approved these changes
Oct 31, 2026
riponcm
left a comment
Owner
There was a problem hiding this comment.
Thanks, this is great work. I re-checked it on our side:
- Real project: a 238-event summary drops from 8,974 to 3,458 tokens.
- Synthetic worst case: from 17,269 to 6,318 tokens.
- Upgrade: from 0.3.4,
pjm initrefreshes the instructions, keeps the edited copy as.bak, and a second run changes nothing. - Tests: the new summary tests fail on main and pass here.
Two small follow-ups are on our side, not yours: a whitespace-only location now counts as none, and the README token table now uses measured numbers. Approving; this ships in 0.3.5.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #29.
TITLE_CHARS(140) andRECORD_CHARS(300) are instorage.py.AI_INSTRUCTIONS.mdand thesummarydescription of the five write tools now state the limits from those constants.log_issueused to say "~140 chars recommended".get_summary, the server instructions andAI_INSTRUCTIONS.mdnow says a few thousand for an aged project. That's closer to what the summary is after this change. The README table still has the old estimate; I left it alone.INSTRUCTIONS_VERSIONis 2, because the fingerprint test requires a bump. The nextpjm initreplaces an olderAI_INSTRUCTIONS.mdand keeps the old one as.bak, so a hand-edited copy needs merging back. Probably worth a line in the 0.3.5 notes.On the project from the issue (2.9k events now), the summary goes from 47.2 KB on
mainto 22.2 KB with this branch. Full suite passes (376).