Skip to content

fix(calm): preserve short substantive mid-turn replies - #4823

Open
RibatTRW wants to merge 1 commit into
kunchenguid:mainfrom
RibatTRW:fm/firstmate-calm-short-substantive
Open

RibatTRW wants to merge 1 commit into
kunchenguid:mainfrom
RibatTRW:fm/firstmate-calm-short-substantive

Conversation

@RibatTRW

Copy link
Copy Markdown

Intent

Preserve the short substantive mid-turn Calm replies that current main still hides. The Calm PR #4634 conflicts with main, and the maintainer's merged fix 888871d (#4788) only preserves mid-turn text containing a newline or at least 240 trimmed characters. Measured on current main, these cases it exists to fix are still hidden: short captain-directed replies (the "which of the two fixes should I take" question, offers, waits on the captain), one-word confirmations such as "Saved.", short per-block mixed-message results ("Found it: the cache key is case-sensitive."), and short gerund outcome reports ("Testing confirms the fix works.", "Reviewing the logs found the case-sensitivity bug.", and longer findings). Extend the shared preservation contract both harnesses read so a short single-line block hides only when every sentence in it reads as routine working narration, keeping Claude and Pi on one rule rather than a Pi-only second classifier.

What Changed

  • Extends the shared calmTextIsSubstantive preservation rule so a short single-line mid-turn block hides only when every sentence reads as routine working narration (next-step announcements, in-progress gerunds, and routine monitoring state), preserving captain-directed replies, short confirmations, colon findings, and gerund outcome reports on both Claude and Pi.
  • Updates the docs/calm.md preservation contract and expands Claude and Pi test coverage for the narration gate.

Risk Assessment

✅ Low: The change monotonically narrows hiding (short text now hides only when every sentence matches routine-narration patterns) through one symlinked file both harnesses import, with all intent-listed cases traced to the correct verdict and the only behavior shift being extra-visible narration lines rather than hidden replies.

Testing

Drove the real shared preservation module (the one file both harnesses read, via the Pi symlink) against all 15 intent-named cases — every short substantive reply is now preserved and every routine-narration guard still hides — and the Claude-mod policy suite passes with its matching corpus; the Pi TUI renderer E2E could not run here because its required npm-installed Pi package layout is absent, so it is reported untested rather than guessed.

  • Live validation: ✅ go - 8 of 9 scenarios driven live against the product
Scenario Result Live Evidence
Captain asks which of two fixes to take mid-turn and the short question stays visible ✅ pass live calm-preservation-drive.log; tests/fm-calm-claude-mod.test.sh policy corpus
Short offer and wait on the captain stay visible instead of hiding as narration ✅ pass live calm-preservation-drive.log; tests/fm-calm-claude-mod.test.sh policy corpus
One-word confirmation (Saved.) stays visible ✅ pass live calm-preservation-drive.log; tests/fm-calm-claude-mod.test.sh policy corpus
Short per-block mixed-message result (Found it: the cache key is case-sensitive.) stays visible ✅ pass live calm-preservation-drive.log; tests/fm-calm-claude-mod.test.sh policy corpus
Short gerund outcome reports and longer findings stay visible ✅ pass live calm-preservation-drive.log; tests/fm-calm-claude-mod.test.sh policy corpus
Routine working narration still hides (gerund progress, next-step announcements, monitoring state) ✅ pass live calm-preservation-drive.log; tests/fm-calm-claude-mod.test.sh policy corpus
Length and newline backstops unchanged (240 chars preserves, multi-line preserves) ✅ pass live calm-preservation-drive.log; tests/fm-calm-claude-mod.test.sh policy corpus
Claude and Pi share one preservation rule (symlink identity plus policy parity assertions) ✅ pass live tests/fm-calm-claude-mod.test.sh policy-ok; Pi symlink resolves to the same implementation file
Full Pi mid-turn renderer E2E renders the new cases in a live Pi session ⏸️ untested no test_calm_mid_turn_working_notes requires an npm-installed @earendil-works/pi-coding-agent with a dist/ layout (FM_PI_PACKAGE_DIR); only the mise-installed Pi 0.85.1 is present, whose layout lacks dis…
Evidence: Direct drive of shipped Calm preservation contract (15/15 PASS)

Source: Direct drive of shipped Calm preservation contract (15/15 PASS)

PASS preserved=true expected=true :: short captain-directed question :: "Captain, which of the two fixes should I take?"
PASS preserved=true expected=true :: short captain-directed offer :: "Let me know if you'd like me to proceed."
PASS preserved=true expected=true :: short wait on the captain :: "Still waiting on your reply."
PASS preserved=true expected=true :: one-word confirmation :: "Saved."
PASS preserved=true expected=true :: short per-block mixed-message result :: "Found it: the cache key is case-sensitive."
PASS preserved=true expected=true :: short gerund outcome report (testing) :: "Testing confirms the fix works."
PASS preserved=true expected=true :: short gerund outcome report (reviewing) :: "Reviewing the logs found the case-sensitivity bug."
PASS preserved=true expected=true :: longer gerund finding :: "Reviewing the recent production logs from yesterday found th"
PASS preserved=false expected=false :: routine gerund progress still hides :: "Checking the file."
PASS preserved=false expected=false :: routine next-step announcement still hides :: "Let me check the sample file."
PASS preserved=false expected=false :: routine monitoring state still hides :: "No changes. Continuing to monitor."
PASS preserved=false expected=false :: routine gerund progress still hides :: "Running the tests now."
PASS preserved=true expected=true :: 239-char unrecognized text errs toward showing :: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
PASS preserved=true expected=true :: 240-char threshold preserves :: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
PASS preserved=true expected=true :: multi-line preserves :: "line one\nline two"
THRESHOLD=240
ALL-DRIVE-PASS

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 8 of 9 scenarios driven live against the product
Scenario Result Live Evidence
Captain asks which of two fixes to take mid-turn and the short question stays visible ✅ pass live calm-preservation-drive.log; tests/fm-calm-claude-mod.test.sh policy corpus
Short offer and wait on the captain stay visible instead of hiding as narration ✅ pass live calm-preservation-drive.log; tests/fm-calm-claude-mod.test.sh policy corpus
One-word confirmation (Saved.) stays visible ✅ pass live calm-preservation-drive.log; tests/fm-calm-claude-mod.test.sh policy corpus
Short per-block mixed-message result (Found it: the cache key is case-sensitive.) stays visible ✅ pass live calm-preservation-drive.log; tests/fm-calm-claude-mod.test.sh policy corpus
Short gerund outcome reports and longer findings stay visible ✅ pass live calm-preservation-drive.log; tests/fm-calm-claude-mod.test.sh policy corpus
Routine working narration still hides (gerund progress, next-step announcements, monitoring state) ✅ pass live calm-preservation-drive.log; tests/fm-calm-claude-mod.test.sh policy corpus
Length and newline backstops unchanged (240 chars preserves, multi-line preserves) ✅ pass live calm-preservation-drive.log; tests/fm-calm-claude-mod.test.sh policy corpus
Claude and Pi share one preservation rule (symlink identity plus policy parity assertions) ✅ pass live tests/fm-calm-claude-mod.test.sh policy-ok; Pi symlink resolves to the same implementation file
Full Pi mid-turn renderer E2E renders the new cases in a live Pi session ⏸️ untested no test_calm_mid_turn_working_notes requires an npm-installed @earendil-works/pi-coding-agent with a dist/ layout (FM_PI_PACKAGE_DIR); only the mise-installed Pi 0.85.1 is present, whose layout lacks dis…
  • bash tests/fm-calm-claude-mod.test.sh (passes; includes the shared-preservation parity corpus: Saved., captain-directed question/offer/wait, colon finding, gerund outcomes preserved; gerund progress, next-step, monitoring hidden)
  • node /tmp/calm-drive.mjs — direct drive of the shipped calmTextIsSubstandard contract via the Pi symlink path (.pi/extensions/lib/fm-calm-preservation.ts) across 15 intent-named cases
  • bash tests/fm-calm-pi-extension.test.sh (passes for runnable parts; test_calm_mid_turn_working_notes skips by design: no npm-installed @earendil-works/pi-coding-agent with dist layout in this environment)
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

Current main's shared threshold rule still hides short single-line
substantive replies: captain-directed questions, offers, and waits,
one-word confirmations, per-block mixed-message results, and gerund
outcome reports such as 'Testing confirms the fix works.' all sit below
240 characters with no newline, so both harnesses drop them.

Extend the shared calmTextIsSubstantive contract both harnesses already
read: a short single-line block is now hidden only when every sentence
in it reads as routine working narration, erring toward showing. The
narration classifier moves here from the Pi-only layout adapter, so
Claude and Pi keep one rule and cannot drift apart; the Pi layout goes
back to the shared per-block filter with no second classifier.

Cover the kept behavior behaviorally on both suites plus the mod's own
engine tests, and describe the extended contract in docs/calm.md. Filler
fixtures that used to pin the length boundary now read as narration,
since unrecognized short text is preserved by design.

Authored with AI assistance.
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