Skip to content

now.md and today-*.md are genuinely append-only, and five branches append a span without rolling it back #349

Closed

Description

@fdaviddpt

Found while tracing #346. The reporter there blamed unbounded appends to recent.md / archive.md; those two are rewritten wholesale and have never been appended to. The staging files are the ones that actually match his description, and nobody has looked at them from this angle.

The append is uncapped

staging_append (scripts/lib-staging-lock.sh:90-93) is a literal >> with no size check of any kind. Every save appends; only a successful consolidation retires the file.

Five branches append a span and never undo it

Each is individually documented and individually defensible — the comments explain, in every case, that a visible duplicate was chosen over an invisible erasure, which is the right call. What nobody costed is the behaviour under a persistent cause rather than a transient one:

  • scripts/save-session.sh:789
  • scripts/save-session.sh:886
  • scripts/save-session.sh:899
  • scripts/save-session.sh:917
  • scripts/run-consolidation.sh:188

Under sustained lock contention, a full disk, or a consolidation that has stopped for any reason (see #346 — after that bug lands a store in the skip-forever state, consolidation stops permanently), the same span is appended every round with nothing ever retiring it. That compounds, unbounded, in the files that are append-only.

Two adjacent things worth checking in the same pass

  • features.ndc_compression misconfigured disables hourly compression permanently, with only a log line to say so. now.md then grows for the life of the store, and the log line is in a file nobody reads unless they already suspect something.
  • The 600-token compression instruction in the consolidation prompt is advisory. Nothing enforces it, so a faithful re-emitter grows recent.md about 2 KB per round — measured reaching consolidate_max_bytes at round 298. Bounded by the cap by construction, so it is a slow grower rather than a multiplier, but it is the thing that walks a healthy store to the edge of recent.md and archive.md grow unbounded — hit 6.4GB/1.8GB, froze sessions #346 on its own.

What this is not

Not a request to remove the duplicate-over-erasure trade — that trade is correct. The gap is that no branch bounds the file it appends to, and no check anywhere notices a staging file that has been growing for weeks because the thing that consumes it has stopped.

Activity

  1. added
    cohort-1
    on Aug 27, 2026
  2. self-assigned this
    on Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

cohort-1

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions