Skip to content

Retire the memory_saved flag (v4.8.37) - #1727

Open
michael-wojcik wants to merge 35 commits into
mainfrom
retire-memory-saved-flag
Open

michael-wojcik wants to merge 35 commits into
mainfrom
retire-memory-saved-flag

Conversation

@michael-wojcik

@michael-wojcik michael-wojcik commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Retire the memory_saved flag

Refs #1723

What changed

  • Deleted the "Confirm Memory Saved" step from the pact-agent-teams skill's Before Completing checklist, and unnumbered the surviving item so the list does not read as truncated. Teammates no longer write the flag.
  • Removed the emitter docstring line documenting that no hook enforces the flag. No code changes.
  • Swapped the retired key out of two handoff-silence fixtures for a neutral key; the property under test — extra keys stay silent — is unchanged and still positively asserted.
  • Added a strict-token-ban regression pin over the six LLM-loaded instruction surfaces (skills/, agents/, commands/, protocols/, reference/, templates/; every tracked .md, .markdown, .MD file): after normalization (character-reference decode, backslash unescape, delimiter strip, whitespace collapse, casefold) a match of memory[-_ ]*saved anywhere is an offender. 65 prohibited forms, seven-surface seeding with every offending surface named, non-UTF-8 diagnostics, a population floor, a surface-file control, a tail-visit arm, a structural axis arm, and a four-census drift arm.
  • Widened the planning-artifact scrub and agent-memory leaf censuses to the same six directories, and widened the prose-root gate's census to six. That last widening found a real defect: reference/unattended-runs.md told agents to edit ~/.claude/settings.json, the wrong install on a non-default root. Both sites now use {config_dir} (set and non-empty, otherwise $HOME/.claude); the one reference/config.md literal documents a default that code hard-pins, and stays under a premise-pinned allowlist entry.
  • Version 4.8.37 across the five release files and both in-code release references, with the CHANGELOG section placed above main's v4.8.36.

Why

The flag was write-only: zero code readers, self-reported, unenforced. The incident behind the issue found five tasks flagged true with no PACT-prompt pact-memory records created in the measured window. Verify-before-set is structurally unavailable — memory records carry no task linkage, and the specialist who sets the flag never writes the store. The durable signals already exist downstream: HANDOFF presence at acceptance, agent_handoff journal events, and the secretary's harvest ledger.

The pin is a spelling guard, not an intent guard: it keeps the retired token out of text an LLM loads. Its strict ban is deliberate — ordinary English containing "memory saved" is an offender and must be reworded, which the diagnostic says. The decoder resolves references whose characters the normalization folds or strips; the boundaries it does not cover are named in the scan comment with their reasons rather than left silent.

Verification

Measured at 41f8eebe:

  • Pin class 85 tests; 65 prohibited forms, each caught; each decode path (escape, entity, delimiter strip, whitespace collapse, casefold, foldable guard, pass order) mutation-killed with an exact failure set.
  • 16-module touched set (every changed module plus main's changed CI modules): 2157 passed, 1 skipped, 0 failed, 0 errors.
  • Lint gate green on both CI legs (ruff 0.17.3).
  • check-release-notes.sh 4.8.37 rc=0 against the merged changelog; all five carriers and both in-code release references at 4.8.37.
  • Population re-measured after the merge: 119 tracked files across the six surfaces; all four censuses equal.
  • The merge queue's full-suite run is the formal full-suite gate; no local full-suite result is claimed at this head.
  • A fresh peer review across four lanes (architect, test-engineer, backend-coder, and a blind diff-only cold reviewer) plus Bugbot found no blocking findings. Every finding raised was fixed or shown wrong with file:line evidence.

Reviewer notes

  • No runtime or hook code path changes. The only production change outside release metadata is reference/unattended-runs.md, whose two config-root literals now use the {config_dir} convention.
  • The pin's strict ban is intentionally over-broad for prose; that cost is stated in the class docstring and pinned by its own arm.
  • Known declared misses are listed in the scan comment with reasons: double-encoded entities, encoded letters, non-flattening markup, named whitespace references outside the closed map, and Unicode confusables.

Cover whitespace and inline-markup variants, include all six instruction surfaces, and add real-Git self-tests for matcher and population weakening.

Record the regression pin in v4.8.36 and scope its behavior-neutrality claim to runtime and hook code.
Reject repeated and whitespace-adjacent separators, exercise every instruction surface, and pin named non-UTF-8 failures. Scope the release notes to the measured pact-memory census.
Normalize backslash-escaped separators and report offending and non-UTF-8 files together. Cover both cases with real-Git fixtures.
- Population filter accepts .md, .markdown, and .MD instruction files
  (was case-sensitive .md only); seeded-offender self-tests assert each
  extension variant is caught and named.
- Unescape backslash-escaped separators (underscore, hyphen, star)
  before star removal; new prohibited forms cover memory\*saved.
- Decode numeric character references of separator-class characters
  (decimal and case-insensitive hex); all other entities stay literal
  and arbitrary-markup shapes remain out of contract by design.
- Rename the temp-git self-test to say seeded instead of real.

Changelog extended in the same commit. Remediation of PR #1727
round-1 review findings R1-R4.
… (v4.8.36)

- The real-tree pin run now asserts its known member (the
  pact-agent-teams skill) is present in the enumerated population,
  so a silently narrowed tracked-file set fails loudly instead of
  passing green over a world that skipped the teaching surface.
- Numeric-entity decoding moved inside its try: over-long or
  out-of-range references stay literal instead of raising
  CPython's digit-limit ValueError inside re.sub; a seeded
  5000-digit reference proves the pin completes and reports
  normally.
- Changelog clause extended in the same commit. Remediation of
  PR #1727 round-2 review findings S1 and N2.
- The entity decoder resolves named HTML entities of the separator
  class (_lowbar/underbar/under, hyphen/dash/minus, nbsp with its
  legacy NBSP alias) to their ASCII separators, completing the
  entity-decoding class the pin already claims for numeric
  references; every other named entity stays literal by the same
  contract as before.
- Three new prohibited forms (lowbar, hyphen, NBSP) exercise the
  widening on every surface; changelog clause extended in the same
  commit. Remediation of PR #1727 round-3 review findings.
….36)

- The real-tree run's known-member control now requires one known
  tracked file per surface, so a narrowed population that keeps a
  single file no longer passes green over five unsanctioned
  surfaces; a RED arm proves the control fires on a
  single-member-subset world.
- The decoder's comment now declares the named-entity map as the
  bounded separator-class set it is, instead of calling it
  exhaustive.
- Changelog known-member clause extended in the same commit.
  Remediation of PR #1727 round-4 review findings.
- The escape strip now consumes backtick escapes alongside
  underscore, hyphen, and star, so the CommonMark-equivalent
  memory\`saved no longer evades a pin that already catches the
  raw form; the escaped-backtick prohibited form lands with its
  own case on every surface.
- The changelog's known-member bullet now states the control's
  actual guarantee (fires when the population drops any known
  member) instead of claiming every strict subset is caught.
- The offender failure message names the innocent-prose class and
  its two outs (reword the prose, or update the pin deliberately);
  a message assertion pins the caveat.
- Remediation of PR #1727 round-5 review findings.
…v4.8.36)

- The decoder docstring's out-of-contract sentence now names every
  probe-confirmed miss beside the existing example: double-encoded
  entities, an escaped backslash before a separator, and numeric
  references without a semicolon, so the stated boundary matches
  the measured one.
- The module header's Tests-cover enumeration gains the
  memory_saved regression pin, restoring the module's own
  census convention.
- Remediation of PR #1727 round-6 review findings.
- The uppercase-X hex marker gets its own prohibited form
  (memory-saved), so a regression narrowing the hex-marker
  check can no longer land green.
- Literal-stays arms now cover the remaining decoder exits:
  an over-range reference past chr's valid range, an unlisted
  named entity, and a malformed non-numeric reference — each
  asserted to keep the pin passing on a tracked file carrying it.
- The changelog sentence gains over-range alongside malformed and
  over-long, matching the arms. Remediation of PR #1727 round-7
  review findings.
- The changelog's known-member bullet now scopes its vacuous-green
  clause to member-dropping narrowings and names the fixture's
  documented boundary: narrowings that keep every known member are
  caught by the module's count oracles, not this control.
- The decoder docstring's out-of-contract list gains the two
  probe-named shapes (an escaped space, a newline entity) so the
  stated boundary matches the measured one.
- Remediation of PR #1727 round-8 review findings.
- KNOWN_MEMBERS gains the nested-recursion member
  (skills/pact-testing-strategies/references/test-pyramid.md),
  so a tracked-files fixture regression that stops recursing
  into nested skill directories now fails the control loudly
  instead of passing green over an unrecursed scan; RED arm
  proves the control fires on the flat-six world.
- The changelog sentence states only the control's own
  guarantee and drops the count-oracle claim the round-9 review
  could not verify for this population.
- Remediation of PR #1727 round-9 review findings.
A class-scope assert keeps SURFACE_FILES and KNOWN_MEMBERS equal,
so a future surface seeded for the self-tests cannot silently
lack a known-member control. Remediation of PR #1727 round-10
review finding.
The decoder comment's confirmed-miss census now terminates the
direction at class level: Unicode dashes, zero-width joiners, and
homoglyph separators all stay literal by the same ASCII-class
contract, stated beside the enumerated shapes so no future reader
over-trusts the headline. Remediation of PR #1727 round-11
review finding.
…8.36)

- The class docstring's boundary paragraph now states that the
  six-surface enumeration is a curated judgment: a new
  instruction-surface directory is not scanned until added to the
  population, and surface completeness is reviewed per-PR rather
  than machine-checked.
- The offender/undecodable diagnostics join file names with a
  plain comma-separated list instead of nesting a Python list
  repr inside the assertion's rendered output.
- Remediation of PR #1727 round-12 review findings.
A malformed numeric reference never matches the entity pattern at
all; only over-long and over-range references stay literal in the
decoder, by its caught conversion and range failures. The sentence
now names each mechanism instead of crediting the decoder for the
regex's non-match. Remediation of PR #1727 round-13 review
finding.
session_init's on-demand notice and the protocols SSOT both point agents at
reference/ files, so the planning-artifact scrub and the agent-memory leaf
pin now scan it. templates/ stays out: no in-plugin consumer reads it into
agent context. The retirement pin keeps its own six-surface population
because absence scanning is safe when broader.
The pin caught innocent English ("memory saved") and left three blind
spots unarmed: a truncated scan, a collapsed population, and a decoder
branch documented as literal-only. It also paid a per-case fixture for
217 cases that repeat the same file-agnostic matcher.

Identifier-shaped spellings stay caught anywhere; a literal-whitespace
spelling is caught only in a backticked span or key position. Add a
population floor, a last-entry traversal arm, a non-separator decoder
arm, a collected drift test, and a narrowed exception wrapper. Loop the
seven surfaces inside one arm per form, keeping every form x surface
assertion.

Refs #1723
The test-run scope census already enumerates templates/*.md as a surface an
agent opens one hop from its instructions, with
templates/environment-model.md as its known member. The planning-artifact
scrub and the agent-memory leaf pin now scan the same six directories as the
retirement pin (119 tracked files each), and the false no-consumer exclusion
is gone. No violations surfaced in templates/.
Every documented prose-catch path is now exercised: tilde joins the
delimiter strip, the context test reads an emphasis-stripped view that
keeps backticks, escaped space unescapes, and a key position must carry a
value-shaped token, so a quoted sentence with a prose colon stays green.
The five unarmed named separators, the bare backticked span, the emphasis
variants, an assignment form and a JSON key each get an arm.

The floor gains a structural control, the surface axis is one constant
checked against the curated directory set, the duplicate narrowed-
population arm is gone, and each form now seeds all seven surfaces in one
run, asserting the diagnostic names every offending surface.

43 prohibited forms x 7 surfaces; class 61 tests; touched set 323 passed,
1 skipped, 0 errors.

Refs #1723

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

The key-position rule had two sides: flag-shaped values such as enabled,
null and a bare number stayed green, while prose starting with a boolean
word or wrapped in brackets red. A quoted key now accepts any value and
takes precedence; an unquoted key accepts only a closed scalar literal
ending the line or closing a brace or bracket, so a comma or a prose tail
is not a match.

The decoder-required decision is per match, carrying decode provenance
through the delimiter strip and the whitespace collapse, so an English
decoy in the same file can no longer mask an encoded spelling. Backticks
pair by parity within a line, so prose between two separate code spans is
no longer read as one span; a span that wraps a line is documented out of
scope.

66 prohibited forms x 7 surfaces; class 101 tests; touched set 363
passed, 1 skipped, 0 errors.

Refs #1723
The identifier-versus-prose grammar cost two remediation cycles and kept
yielding edges: markup emphasis, span parity, value tokens, terminators.
The pin's job is to keep a retired token out of instruction text, so it no
longer tries to tell prose from a flag. After normalization a match of
memory[-_ ]*saved anywhere in the six surfaces is an offender, and the
diagnostic says to reword. The cost is stated in the docstring and pinned
by an arm.

The scan sequence now derives from SURFACE_DIRECTORIES, so the directory
list has one enumeration, and a drift arm holds the three sibling censuses
equal. The leaf pin's population source is named in the release notes.

43 prohibited forms; pin class 62 tests; touched set 835 passed,
1 skipped, 0 errors.

Refs #1723
The decoder resolved names no HTML processor recognises (underbar, under,
NBSP) while missing the canonical ones that render as the flag: UnderBar,
NonBreakingSpace, NewLine and Tab. It also rejected numeric references to
non-ASCII whitespace and to the Markdown delimiters it strips. The decoder
now resolves any reference whose character the normalizer folds or strips,
and the escaped tilde and Markdown hard break fold like their literals.

The literal-stays arms move to genuinely unfolded characters (©,
a), the miss list states every remaining evasion with its reason, the
fail-open label becomes over-resolves, and the two diagnostics agree
in number. 60 prohibited forms; pin class 79 tests; touched set 852
passed, 1 skipped, 0 errors.

Refs #1723
Decode character references before unescaping, so an encoded backslash
becomes the escape the next step consumes; add the bsol name and admit
backslash in the decoder even though it is not foldable itself. Narrow the
claim to the closed map and name the named-whitespace boundary as a
declared miss. Pin the guard's negative direction, which survived every
test until an entity-encoded letter gave it a shape to reject.

The prose-root gate now scans the same six surfaces. reference/ was a
declared instruction surface while the gate still skipped it, and widening
the census proved it: unattended-runs.md told agents to edit
~/.claude/settings.json, the wrong install on a non-default root. Both
sites now use {config_dir}; the one reference/ literal that documents the
code's hard-pinned default stays, allowlisted with its reason.

65 prohibited forms; 11-module touched set 1374 passed, 1 skipped,
0 errors.

Refs #1723

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 56caab5. Configure here.

Main took v4.8.36 for the parallel fast-CI change while this branch held the
same version for the flag retirement. The retirement's section becomes
v4.8.37 above main's, all five carriers and the two in-code release
references move with it, and the release checker passes against the merged
changelog.

Also lands the round-seven fixes: the prose-root gate's census joins the
drift arm as a fourth copy, the config-doc allowlist gains a premise pin on
the exact default-root expression, the named-whitespace list drops
⁠ because U+2060 is not whitespace, and the {config_dir} definition
keeps the canonical set-and-non-empty qualifier.

Refs #1723
@michael-wojcik michael-wojcik changed the title Retire the memory_saved flag (v4.8.36) Retire the memory_saved flag (v4.8.37) Nov 23, 2026

This branch has not been deployed

No deployments
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.

1 participant