Skip to content

feature: mode keeper#2

Merged
usulpro merged 24 commits into
mainfrom
feature/mode-keeper
Jul 7, 2026
Merged

feature: mode keeper#2
usulpro merged 24 commits into
mainfrom
feature/mode-keeper

Conversation

@usulpro

@usulpro usulpro commented Jul 7, 2026

Copy link
Copy Markdown
Owner

No description provided.

usulpro and others added 24 commits July 6, 2026 00:49
The Codex additionalContext POC is done; the epic is now resumed in a
real Claude Code session for the second POC. Close the Phase 3 handoff
task and point the active task at the Claude Code POC.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A real headless claude -p turn in a scratch project proved that a
project-local UserPromptSubmit hook returning
hookSpecificOutput.additionalContext reaches model context: the model
echoed the injected token exactly, and the transcript JSONL carries the
injection as a hook_additional_context attachment record. No trust
gating was hit on the headless path; interactive TUI rendering was not
observed and is recorded as a known limitation. With both platform POCs
green, the mechanism-validation risk is marked mitigated and Phase 3 is
closed; Phase 4 (unbind trigger phrase design) is next.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ct in SKILL.md

The frontmatter description now lists detaching the current session
from its epic (canonical phrase 'unbind epic', or recognized intent to
work outside the epic) among the skill triggers. A new Hooks subsection
documents when to unbind, the unbind-session.mjs --current/--session-id
command shapes with optional --reason, the no-op guarantee for unbound
sessions, and rebinding via the normal resume flow. The script itself
lands in Phase 5; a cross-doc contract audit task is added as Phase 4's
verification gate.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The verification pass compared the documented unbind-session.mjs
contract across SKILL.md, the Phase 2 design doc, and the decision log:
zero discrepancies (flags, no-op guarantee, silent-hooks-after-unbind,
rebind-via-resume, verbatim 'unbind epic' phrase). Frontmatter YAML
parses, runtime copies are diff-clean, validate and all 33 unit tests
pass. Also restores the hand-added Phase 4 verification task that
close-phase.mjs re-rendered away from tracker.md (tracker is the
source of truth; the structured roadmap state never knew the task) and
records the default --reason follow-up for Phase 5 tests.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
buildModeReminder in lib/hooks.mjs injects a one-line [epic-loop]
reminder via hookSpecificOutput.additionalContext on UserPromptSubmit
for sessions bound in shaping or review mode, sourced solely from the
already-loaded binding; handleHook composes it with the implementation
continuation through a single ?? fallback. New unbind-session.mjs
(unbindSession in lib/epics.mjs) detaches the resolved session from its
active binding: --current/--session-id detection identical to
bind-session, optional --reason (default user-requested-unbind),
active:false + deactivated_at + additive deactivated_reason, cleans the
active_sessions pointer, mirrors unbind.json into the epic runtime, and
is a no-op (exit 0) for unbound sessions. Unbound sessions still
produce zero hook output; implementation-mode Stop behavior unchanged.
Smoke-tested against a temp root; runtime copies deliberately not
re-synced until the Phase 5 unit tests pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ssion

Ten node --test cases exercise the real CLIs against temp roots:
shaping/review UserPromptSubmit turns get the exact [epic-loop]
additionalContext reminder, while unbound sessions, Stop events,
implementation-mode sessions, and freshly unbound session ids all
produce strictly empty stdout. unbind-session contract is pinned:
no-op message and exit 0 for never-bound/already-unbound ids with the
bindings file byte-identical, active:false + deactivated_at +
deactivated_reason (default user-requested-unbind and custom --reason),
active_sessions pointer removal, and the unbind.json mirror fields.
Full suite: 43/43.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…session-routing; close Phase 5

hooks-and-session-routing.md now lists the UserPromptSubmit
additionalContext mode reminder among hook capabilities and documents
user-requested unbind (command shape, deactivation fields, post-unbind
silence, rebind via bind-session) in Binding Sessions, consistent with
SKILL.md. Runtime copies were re-synced via self-update after the
43-test green suite (both diff-clean), completing the repo's
change-hook-behavior convention and closing Phase 5.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…eature

The full suite runs 43/43 with all ten unbind-and-reminder tests
present, package validation exits clean, and both runtime skill copies
are diff-identical to plugins/. All six phases of the mode-reminder
epic are now closed; state-of-epic records the completed lifecycle and
the remaining user-side step (branch review/merge).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…st coverage

The reminder builder sits behind the existing getSessionBinding gate
and the unbind-and-reminder suite pins empty stdout for unbound, Stop,
implementation-mode, and freshly unbound sessions, so the zero-output
guarantee risk is closed as mitigated. The implementation log records
the epic exit summary with the four feature commits and final green
verification.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Shaping outcome for the mode-reminder follow-up: the epic holds exactly one
lifecycle mode in runtime-state.json (Current mode: prose line to be dropped),
bindings become mode-less epic membership with any number of member sessions
receiving the compact mode marker, active_sessions is deleted by design, the
implementation loop keeps one exclusive driver, and non-driver members get an
advisory read-only lock marker while the loop runs. New design doc
docs/epic-mode-model.md; decision-log, risk-register, tracker (Phase 7:
Epic-Centric Mode Model And Compact Reminder) and state-of-epic updated.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@usulpro usulpro merged commit ded08e9 into main Jul 7, 2026
1 check passed
@usulpro usulpro deleted the feature/mode-keeper branch July 7, 2026 12:30
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