Skip to content

summary.md is still ~12k tokens on an aged project: entries have no length limit #29

Closed

Description

@bigfree

Follow-up to #19.

Since 0.3.4 the summary has a bounded number of entries, but nothing limits how long a single entry is. On one of my projects (eight weeks old, 226 issues, 2.8k events) summary.md is 50.6 KB, roughly 12.6k tokens. The guidance says "a few hundred to ~1,500", and the file gets loaded at the start of every session.

Where it comes from:

Section Size
Open issues (14) and their failed/partial attempts 26.0 KB
10 newest fixed issues 9.4 KB
Decisions (15) 9.0 KB
Notes (10) 5.5 KB

Two things stand out:

  1. Fixed issues carry their whole fix. An entry looks like this:

    - [DONE] #0031 Timeline jumps to the top after a reload [web/timeline.tsx] -> Restored the scroll anchor after the virtual list measured its rows; the layout effect ran before the rows had a height, so the offset came from estimates. Added a test that reloads at row 400 and checks the anchor stays within 4 px. [web/use-anchor.ts] (fixed)
      - Failed attempt: window.scrollTo(savedY) on mount, the list re-measured and moved it back [web/timeline.tsx]
    

    Once an issue is closed, the next session mostly needs to know it existed. The details are one get_issue call away.

  2. Long records are printed verbatim. Agents like to put a whole investigation into one record_attempt. In that project 90 of 150 attempts are over 300 characters and 11 are over 1 KB, and every open issue shows up to three of them.

What I'd suggest:

  • Render a fixed issue as a single line: - [DONE] #0031 Timeline jumps to the top after a reload [web/timeline.tsx] (fixed)

  • Clip every record text in the summary to around 300 characters at a word boundary, but never the [location]:

    - [OPEN] #0042 CSV export times out for accounts with more than 50k rows: measured 41 s on the staging copy against a 30 s gateway limit, the query plan shows a sequential scan on orders.created_at because the composite index starts with tenant_id, and the retry in the client doubles the load on every timeout... [api/export.py] (open)
    

Nothing in events.jsonl or issues/ would change. I tried both against the same event log, and the summary went from 50.6 KB to 23.0 KB (about 5.8k tokens) with the existing tests still passing.

Open questions:

  • Is 300 a sensible default, or should it be a config.toml setting?
  • Should the guidance also ask agents for shorter records (for example an issue title under 140 characters, as the log_issue docstring already hints), so the summary stays small without relying on clipping?
  • Open-issue attempts are the rest of the size. I'd keep them, since they stop repeated dead ends, but maybe 2 instead of 3 per issue?

Activity

  1. bigfree commented on Oct 20, 2026

    @bigfree
    ContributorAuthor

    The branch is here if you want to look at it: https://github.com/bigfree/projectmem/tree/summary-compact-entries

    Diff against main: main...bigfree:projectmem:summary-compact-entries

    It's one commit touching summary.py and tests/test_summary.py. I added three tests, and test_summary_and_issue_file_are_regenerated now looks for the fix text in the issue file instead of the summary. The full suite passes (359). I can open it as a PR whenever you like, or change it once the open questions above are settled.

  2. riponcm commented on Oct 28, 2026

    @riponcm
    Owner

    Thanks, this is a fair catch. 0.3.4 capped how many entries the summary shows, but not how long each one is, and my measurement used short synthetic entries, so it missed exactly this. Yes, please open the PR from your branch. On your questions:

    • 300 characters: a good default. Let's keep it a constant for now and add a config.toml setting only if someone needs it.
    • One-line fixed issues: agreed. The details are one get_issue call away.
    • Shorter records: yes. A line in the guidance asking for concise summaries would help, alongside the clipping.
    • Attempts on open issues: keep 3. Once each one is clipped, they cost far less, and they're what stops repeated dead ends.

    Planned for 0.3.5.

  3. bigfree commented on Oct 29, 2026

    @bigfree
    ContributorAuthor

    Opened #30. It's rebased on current main and follows what you wrote:

    • 300 is a constant, RECORD_CHARS, next to TITLE_CHARS (140) in storage.py.
    • A fixed issue is one line. If the issue itself has no location, the fix's location is shown instead.
    • Open issues still show 3 attempts, each clipped.
    • The guidance line is in AI_INSTRUCTIONS.md. The same limits are also in the summary description of the write tools, for clients that never call get_instructions.

    Two things to look at before merging:

    • The template change needed INSTRUCTIONS_VERSION 2, so pjm init will replace older instruction files and keep a .bak.
    • The "~1,500 tokens" claim in get_summary and the instructions is updated. The README table still has it.

    On the same project the summary is now 22.2 KB, down from 47.2 KB on main.

    Thanks!

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

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