Skip to content

The 95% five-hour directive now names /handoff (Amendment 17) with /lane-swap as its alias, not the reverse, and configure_profile_runtime arms ~/.claude/usage-guard.on itself so no launcher-configured workstation runs the guard unguarded (#76) - #80

Merged
brettheap merged 1 commit into
mainfrom
fix/usage-guard-directive-and-arming
Sep 14, 2026

Conversation

@brettheap

@brettheap brettheap commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Brett Heap's ruling on #76 ("Arm globally + file the
directive (Recommended)") asks two things: the 95% five-hour line becomes
the DIRECTIVE the launcher's own comment already claimed it was, naming the
act by Amendment 17's name and its alias; and configure_profile_runtime
ensures the guard's global arming flag exists, because Eagle had the guard
wired into every profile (Amendment 11(4)) and still ran every lane on it
unguarded — ~/.claude/usage-guard.on was armed by hand only after the
question that opened this issue was asked, and nothing ensured it before
today.

NAMING (Amendment 17). claude-usage-guard.sh's auto_swap_directive() (the

=95% branch that holds a lane) named the act /lane-swap with /swap as its
Amendment-11(4) alias; it now names /handoff as the canonical command and
/lane-swap as its alias — one clause changed (claude-usage-guard.sh:201),
the rest of Amendment 11(4)'s addenda-mandated text (the R-A11-27 container
caveat, bounding step 3's wait on the writers, the substituted restart
command) is untouched, because Amendment 17 renames the act and changes
nothing else about it. The comment above that clause
(claude-usage-guard.sh:144-147) and the paragraph in claude-profile issue
#76 quotes verbatim (originally claude-profile:862, now claude-profile:875,
the block above lanes_edit_bin) are reworded the same way, and so is the
one paragraph in docs/claude-multi-account-profiles.md that describes what
the guard tells the session to run. The 90 and 80 lines are untouched —
they were never the directive, and stay advice.

THE FABLE WEEKLY 95% LINE STAYS ADVICE, DELIBERATELY, AGAIN. SPEC §9 left
it "Open" because the weekly bucket does not refill in hours the way the
five-hour window does. The question issue #76 was filed from — "what is
the best process if it ran out of tokens and [we] never did the swap...
how should [the operator] get a new account loaded and resume that old
session?" — reads like an argument for making this a directive too, and
the issue names that argument explicitly ("the swap to another profile is
the same act"). It is not the same act here, and the reason is mechanical:
auto_swap_directive()'s last sentence prints pclaude ${CLAUDE_PROFILE_NAME:-<profile>} — the SAME profile the session is
already on. For the five-hour window that is correct: the window refills
in hours and the same profile is exactly where the operator should return.
A weekly-Fable exhaustion needs a DIFFERENT, non-exhausted profile, and
choosing one is a decision only the operator can make — this guard has no
way to know what other profiles exist or their state. Turning the Fable-95
line into today's same no-question automatic directive would print a
restart command pointed straight back at the exhausted profile, which does
not answer the question the issue was filed from. So the Fable-95 line
keeps its plain warning, unchanged, until a future amendment lets the
skill target a profile other than the current one.

ARMING. configure_profile_runtime (base-image/files/claude-profile) already
resolves guard_source and links it into the profile's own usage-guard.sh
when found; right after that (guard_ok=true), it now also ensures
$HOME/.claude/usage-guard.on exists: mkdir -p "$HOME/.claude", then create
the flag only if [[ ! -e ]], both fenced with || true so a failure here
(a read-only $HOME, say) cannot abort profile configuration under the
script's own set -euo pipefail. This never removes or truncates a flag
already there, armed or later disarmed by an operator — proven by
devcontainer.test/test-claude-profile-skill-install.sh's new scenario 13c,
which writes a marker into the flag and re-runs the real launcher's
configure_profile_runtime over it, then checks the marker survived.
docs/claude-multi-account-profiles.md's guard paragraph now says the
launcher places the flag itself and that the write is idempotent.

TESTS.

  • devcontainer.test/test-claude-usage-guard-auto-swap.sh: scenario 1's
    assertions now require /handoff (the canonical act) instead of /swap, and
    still require /lane-swap (now the alias); scenarios 17, 18a and 19 (the
    session/lane fences) each gained an assertion that /handoff is also
    absent from that fallback path, not just /lane-swap. 23 scenarios, 100
    assertions passed (was 23 scenarios, 97 assertions before this change —
    measured both ways via git stash).
  • devcontainer.test/test-claude-profile-skill-install.sh: new scenario 13c
    proves the arm is idempotent and never removes an existing flag. 18
    scenarios, 155 assertions passed (was 17 scenarios, 152 assertions before
    this change, same measurement).
  • Full relevant suite re-run after every edit, all green: test-claude-
    profile-amendment-11.sh (114 scenarios, 469 assertions),
    test-claude-profile-session-start-hook.sh (12 scenarios, 28 assertions),
    test-claude-profile-lane-default.sh (31 scenarios, 109 assertions),
    test-claude-profile-lane-start.sh, test-claude-profile-preserves-model.sh,
    test-base-image-dockerfile.sh, test-claude-statusline-snapshots.sh (all
    PASS).
  • bash -n on every touched shell file: clean.
  • All three .github/workflows/*.yml files (devbenches-helper-safety.yml,
    speckit-git-bash.yml, speckit-git-powershell.yml) were read in full: none
    of their push/pull_request path filters match any file this commit
    touches, so no workflow runs automatically on this PR's paths.

Closes #76

Lane: openrepotools-3 (openRepoTools-3)

🤖 Generated with Claude Code

Summary by Sourcery

Align the five-hour usage directive with Amendment 17 and ensure launcher-configured profiles are globally protected by the usage guard.

New Features:

  • Make /handoff the canonical five-hour usage-limit directive, with /lane-swap as its alias.
  • Automatically create the global usage-guard flag when profile runtime configuration wires the guard, while preserving any existing flag.

Bug Fixes:

  • Prevent launcher-configured workstations from running profiles without the usage guard armed by default.

Documentation:

  • Update multi-account profile documentation to reflect the renamed directive and automatic, idempotent global guard arming.

Tests:

  • Update usage-guard directive and safety-fence coverage for the new command naming.
  • Add coverage proving global guard arming is idempotent and does not overwrite operator-managed flags.

…`/lane-swap` as its alias, not the reverse, and `configure_profile_runtime` arms `~/.claude/usage-guard.on` itself so no launcher-configured workstation runs the guard unguarded (#76)

Brett Heap's ruling on #76 ("Arm globally + file the
directive (Recommended)") asks two things: the 95% five-hour line becomes
the DIRECTIVE the launcher's own comment already claimed it was, naming the
act by Amendment 17's name and its alias; and `configure_profile_runtime`
ensures the guard's global arming flag exists, because Eagle had the guard
wired into every profile (Amendment 11(4)) and still ran every lane on it
unguarded — `~/.claude/usage-guard.on` was armed by hand only after the
question that opened this issue was asked, and nothing ensured it before
today.

NAMING (Amendment 17). claude-usage-guard.sh's auto_swap_directive() (the
>=95% branch that holds a lane) named the act /lane-swap with /swap as its
Amendment-11(4) alias; it now names /handoff as the canonical command and
/lane-swap as its alias — one clause changed (claude-usage-guard.sh:201),
the rest of Amendment 11(4)'s addenda-mandated text (the R-A11-27 container
caveat, bounding step 3's wait on the writers, the substituted restart
command) is untouched, because Amendment 17 renames the act and changes
nothing else about it. The comment above that clause
(claude-usage-guard.sh:144-147) and the paragraph in claude-profile issue
#76 quotes verbatim (originally claude-profile:862, now claude-profile:875,
the block above lanes_edit_bin) are reworded the same way, and so is the
one paragraph in docs/claude-multi-account-profiles.md that describes what
the guard tells the session to run. The 90 and 80 lines are untouched —
they were never the directive, and stay advice.

THE FABLE WEEKLY 95% LINE STAYS ADVICE, DELIBERATELY, AGAIN. SPEC §9 left
it "Open" because the weekly bucket does not refill in hours the way the
five-hour window does. The question issue #76 was filed from — "what is
the best process if it ran out of tokens and [we] never did the swap...
how should [the operator] get a new account loaded and resume that old
session?" — reads like an argument for making this a directive too, and
the issue names that argument explicitly ("the swap to another profile is
the same act"). It is not the same act here, and the reason is mechanical:
auto_swap_directive()'s last sentence prints `pclaude
${CLAUDE_PROFILE_NAME:-<profile>}` — the SAME profile the session is
already on. For the five-hour window that is correct: the window refills
in hours and the same profile is exactly where the operator should return.
A weekly-Fable exhaustion needs a DIFFERENT, non-exhausted profile, and
choosing one is a decision only the operator can make — this guard has no
way to know what other profiles exist or their state. Turning the Fable-95
line into today's same no-question automatic directive would print a
restart command pointed straight back at the exhausted profile, which does
not answer the question the issue was filed from. So the Fable-95 line
keeps its plain warning, unchanged, until a future amendment lets the
skill target a profile other than the current one.

ARMING. configure_profile_runtime (base-image/files/claude-profile) already
resolves guard_source and links it into the profile's own usage-guard.sh
when found; right after that (guard_ok=true), it now also ensures
$HOME/.claude/usage-guard.on exists: `mkdir -p "$HOME/.claude"`, then create
the flag only if `[[ ! -e ]]`, both fenced with `|| true` so a failure here
(a read-only $HOME, say) cannot abort profile configuration under the
script's own `set -euo pipefail`. This never removes or truncates a flag
already there, armed or later disarmed by an operator — proven by
devcontainer.test/test-claude-profile-skill-install.sh's new scenario 13c,
which writes a marker into the flag and re-runs the real launcher's
`configure_profile_runtime` over it, then checks the marker survived.
docs/claude-multi-account-profiles.md's guard paragraph now says the
launcher places the flag itself and that the write is idempotent.

TESTS.
- devcontainer.test/test-claude-usage-guard-auto-swap.sh: scenario 1's
  assertions now require /handoff (the canonical act) instead of /swap, and
  still require /lane-swap (now the alias); scenarios 17, 18a and 19 (the
  session/lane fences) each gained an assertion that /handoff is also
  absent from that fallback path, not just /lane-swap. 23 scenarios, 100
  assertions passed (was 23 scenarios, 97 assertions before this change —
  measured both ways via `git stash`).
- devcontainer.test/test-claude-profile-skill-install.sh: new scenario 13c
  proves the arm is idempotent and never removes an existing flag. 18
  scenarios, 155 assertions passed (was 17 scenarios, 152 assertions before
  this change, same measurement).
- Full relevant suite re-run after every edit, all green: test-claude-
  profile-amendment-11.sh (114 scenarios, 469 assertions),
  test-claude-profile-session-start-hook.sh (12 scenarios, 28 assertions),
  test-claude-profile-lane-default.sh (31 scenarios, 109 assertions),
  test-claude-profile-lane-start.sh, test-claude-profile-preserves-model.sh,
  test-base-image-dockerfile.sh, test-claude-statusline-snapshots.sh (all
  PASS).
- `bash -n` on every touched shell file: clean.
- All three `.github/workflows/*.yml` files (devbenches-helper-safety.yml,
  speckit-git-bash.yml, speckit-git-powershell.yml) were read in full: none
  of their push/pull_request path filters match any file this commit
  touches, so no workflow runs automatically on this PR's paths.

Lane: openrepotools-3 (openRepoTools-3)
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot AI lite review requested due to automatic review settings September 14, 2026 17:50
@brettheap

Copy link
Copy Markdown
Contributor Author

@codex review

@sourcery-ai

sourcery-ai Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

This PR applies Amendment 17’s command-name correction for the five-hour 95% guard directive and updates all related documentation and tests, while changing profile configuration to create the global usage-guard flag idempotently so launcher-configured workstations are guarded by default without overwriting operator changes.

Sequence diagram for idempotent usage-guard arming

sequenceDiagram
    participant Launcher as configure_profile_runtime
    participant Guard as claude-usage-guard.sh
    participant Home as HOME/.claude/usage-guard.on
    Launcher->>Guard: resolve guard_source and link guard
    Guard-->>Launcher: guard_ok=true
    Launcher->>Home: mkdir -p HOME/.claude
    alt flag does not exist
        Launcher->>Home: create usage-guard.on
    else flag already exists
        Launcher->>Home: preserve existing flag
    end
Loading

Sequence diagram for the five-hour 95% handoff directive

sequenceDiagram
    participant Session
    participant Guard as auto_swap_directive
    participant Lane as Held lane
    Session->>Guard: usage reaches 95% of five-hour window
    Guard->>Lane: verify session holds a lane
    alt session holds a lane
        Guard-->>Session: run /handoff alias /lane-swap
        Session->>Session: complete Amendment 11(4) swap steps
        Guard-->>Session: print pclaude profile restart command
    else session does not hold a lane
        Guard-->>Session: print non-directive advice
    end
Loading

File-Level Changes

Change Details Files
Renamed the five-hour 95% automatic directive to use /handoff as the canonical command and /lane-swap as its alias.
  • Updated the guard directive and explanatory comments to reflect Amendment 17 naming.
  • Updated the profile issue text and multi-account documentation.
  • Kept the directive mechanics, 90/80% advice, weekly Fable warning, and lane/session safety fences unchanged.
  • Adjusted positive and negative assertions to validate the new canonical command and prevent directives in fallback paths.
base-image/files/claude-usage-guard.sh
base-image/files/claude-profile
docs/claude-multi-account-profiles.md
devcontainer.test/test-claude-usage-guard-auto-swap.sh
Made profile runtime configuration automatically arm the globally scoped usage guard without overwriting operator state.
  • Creates $HOME/.claude/usage-guard.on after wiring the guard, tolerating mkdir/file-creation failures under strict shell settings.
  • Only creates the flag when absent, preserving existing armed or disarmed marker contents.
  • Added an integration scenario that reruns the real launcher configuration and verifies idempotence.
base-image/files/claude-profile
devcontainer.test/test-claude-profile-skill-install.sh
docs/claude-multi-account-profiles.md
Expanded regression coverage for directive naming, safety behavior, and automatic guard arming.
  • Updated usage-guard expectations from /swap to /handoff plus /lane-swap.
  • Added assertions that neither directive command appears when session or lane identity fences force fallback advice.
  • Added the new profile-install scenario and updated scenario counts.
devcontainer.test/test-claude-usage-guard-auto-swap.sh
devcontainer.test/test-claude-profile-skill-install.sh

Assessment against linked issues

Issue Objective Addressed Explanation
#76 Make the five-hour usage guard's 95% threshold an explicit no-question directive to run /handoff now, identifying /lane-swap as its alias, while leaving the 90% and 80% thresholds as advice. ✅
#76 Ensure launcher-configured workstations automatically arm the usage guard by creating ~/.claude/usage-guard.on, document the arming behavior, and preserve any existing operator-managed flag. ✅
#76 Define the behavior of the Fable weekly 95% threshold and add regression coverage proving the five-hour directive wording and automatic guard arming. ✅

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai 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.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="base-image/files/claude-usage-guard.sh" line_range="202" />
<code_context>
+  printf '%s' "⚠ 5-HOUR WINDOW AT ${pct}% (resets ${reset}). AUTOMATIC SWAP (lane-collision-protocol Amendment 11(4)) for lane ${WORKBENCHES_CLAUDE_LANE}: run /handoff (alias /lane-swap) NOW, every step in order, and do not ask the operator whether to — the 95% breakpoint is the decision. Bound step 3's wait on the writers: name any writer still holding unpushed work in the handoff and proceed, killing nothing and pushing nobody's work. The swap record it writes is what the next launch resolves this lane from, so write it wherever the skill can — and in a container with no LANES_WORKSTATION it cannot (R-A11-27): there the register and object-log writes are refused, the handoff still carries the gap, and the restart command names the lane with --lane because there is no record to resolve it from. Then print the one restart command the skill derives — pclaude ${CLAUDE_PROFILE_NAME:-<profile>} — and stop."
</code_context>
<issue_to_address>
**issue (bug_risk):** At the five-hour 95% breakpoint, the guard instructs the session to run `/handoff`, but the repository still installs only the `lane-swap` skill and the `swap` command alias; no `/handoff` skill or command is installed. The automatic directive therefore names an unresolvable command, and the new test passes by checking only that the string appears in the output rather than verifying that the command exists.

**Triggers:** When a launcher-managed session with a lane reaches 95% of the five-hour window.

**Suggested fix:** Install `/handoff` as the canonical skill with `/lane-swap` as its alias, or keep emitting the currently installed `/lane-swap` command until that rename is implemented.

```suggestion
  printf '%s' "⚠ 5-HOUR WINDOW AT ${pct}% (resets ${reset}). AUTOMATIC SWAP (lane-collision-protocol Amendment 11(4)) for lane ${WORKBENCHES_CLAUDE_LANE}: run /lane-swap NOW, every step in order, and do not ask the operator whether to — the 95% breakpoint is the decision. Bound step 3's wait on the writers: name any writer still holding unpushed work in the handoff and proceed, killing nothing and pushing nobody's work. The swap record it writes is what the next launch resolves this lane from, so write it wherever the skill can — and in a container with no LANES_WORKSTATION it cannot (R-A11-27): there the register and object-log writes are refused, the handoff still carries the gap, and the restart command names the lane with --lane because there is no record to resolve it from. Then print the one restart command the skill derives — pclaude ${CLAUDE_PROFILE_NAME:-<profile>} — and stop."
```
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 1 finding to address first, and this creates a global usage-guard policy for every configured workstation whenever the flag is absent, so a mistaken decision activates the 95% handoff directive across all sessions without requiring an operator to opt in. Reverting the code does not remove flags already created, and any sessions that act on the directive may have already written or pushed handoff changes.

Blocking findings: base-image/files/claude-usage-guard.sh:202


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

return 0
fi
printf '%s' "⚠ 5-HOUR WINDOW AT ${pct}% (resets ${reset}). AUTOMATIC SWAP (lane-collision-protocol Amendment 11(4)) for lane ${WORKBENCHES_CLAUDE_LANE}: run /lane-swap (alias /swap) NOW, every step in order, and do not ask the operator whether to — the 95% breakpoint is the decision. Bound step 3's wait on the writers: name any writer still holding unpushed work in the handoff and proceed, killing nothing and pushing nobody's work. The swap record it writes is what the next launch resolves this lane from, so write it wherever the skill can — and in a container with no LANES_WORKSTATION it cannot (R-A11-27): there the register and object-log writes are refused, the handoff still carries the gap, and the restart command names the lane with --lane because there is no record to resolve it from. Then print the one restart command the skill derives — pclaude ${CLAUDE_PROFILE_NAME:-<profile>} — and stop."
printf '%s' "⚠ 5-HOUR WINDOW AT ${pct}% (resets ${reset}). AUTOMATIC SWAP (lane-collision-protocol Amendment 11(4)) for lane ${WORKBENCHES_CLAUDE_LANE}: run /handoff (alias /lane-swap) NOW, every step in order, and do not ask the operator whether to — the 95% breakpoint is the decision. Bound step 3's wait on the writers: name any writer still holding unpushed work in the handoff and proceed, killing nothing and pushing nobody's work. The swap record it writes is what the next launch resolves this lane from, so write it wherever the skill can — and in a container with no LANES_WORKSTATION it cannot (R-A11-27): there the register and object-log writes are refused, the handoff still carries the gap, and the restart command names the lane with --lane because there is no record to resolve it from. Then print the one restart command the skill derives — pclaude ${CLAUDE_PROFILE_NAME:-<profile>} — and stop."

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (bug_risk): At the five-hour 95% breakpoint, the guard instructs the session to run /handoff, but the repository still installs only the lane-swap skill and the swap command alias; no /handoff skill or command is installed. The automatic directive therefore names an unresolvable command, and the new test passes by checking only that the string appears in the output rather than verifying that the command exists.

Triggers: When a launcher-managed session with a lane reaches 95% of the five-hour window.

Suggested fix: Install /handoff as the canonical skill with /lane-swap as its alias, or keep emitting the currently installed /lane-swap command until that rename is implemented.

Suggested change
printf '%s' "⚠ 5-HOUR WINDOW AT ${pct}% (resets ${reset}). AUTOMATIC SWAP (lane-collision-protocol Amendment 11(4)) for lane ${WORKBENCHES_CLAUDE_LANE}: run /handoff (alias /lane-swap) NOW, every step in order, and do not ask the operator whether to — the 95% breakpoint is the decision. Bound step 3's wait on the writers: name any writer still holding unpushed work in the handoff and proceed, killing nothing and pushing nobody's work. The swap record it writes is what the next launch resolves this lane from, so write it wherever the skill can — and in a container with no LANES_WORKSTATION it cannot (R-A11-27): there the register and object-log writes are refused, the handoff still carries the gap, and the restart command names the lane with --lane because there is no record to resolve it from. Then print the one restart command the skill derives — pclaude ${CLAUDE_PROFILE_NAME:-<profile>} — and stop."
printf '%s' "⚠ 5-HOUR WINDOW AT ${pct}% (resets ${reset}). AUTOMATIC SWAP (lane-collision-protocol Amendment 11(4)) for lane ${WORKBENCHES_CLAUDE_LANE}: run /lane-swap NOW, every step in order, and do not ask the operator whether to — the 95% breakpoint is the decision. Bound step 3's wait on the writers: name any writer still holding unpushed work in the handoff and proceed, killing nothing and pushing nobody's work. The swap record it writes is what the next launch resolves this lane from, so write it wherever the skill can — and in a container with no LANES_WORKSTATION it cannot (R-A11-27): there the register and object-log writes are refused, the handoff still carries the gap, and the restart command names the lane with --lane because there is no record to resolve it from. Then print the one restart command the skill derives — pclaude ${CLAUDE_PROFILE_NAME:-<profile>} — and stop."

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2821a4207c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

return 0
fi
printf '%s' "⚠ 5-HOUR WINDOW AT ${pct}% (resets ${reset}). AUTOMATIC SWAP (lane-collision-protocol Amendment 11(4)) for lane ${WORKBENCHES_CLAUDE_LANE}: run /lane-swap (alias /swap) NOW, every step in order, and do not ask the operator whether to — the 95% breakpoint is the decision. Bound step 3's wait on the writers: name any writer still holding unpushed work in the handoff and proceed, killing nothing and pushing nobody's work. The swap record it writes is what the next launch resolves this lane from, so write it wherever the skill can — and in a container with no LANES_WORKSTATION it cannot (R-A11-27): there the register and object-log writes are refused, the handoff still carries the gap, and the restart command names the lane with --lane because there is no record to resolve it from. Then print the one restart command the skill derives — pclaude ${CLAUDE_PROFILE_NAME:-<profile>} — and stop."
printf '%s' "⚠ 5-HOUR WINDOW AT ${pct}% (resets ${reset}). AUTOMATIC SWAP (lane-collision-protocol Amendment 11(4)) for lane ${WORKBENCHES_CLAUDE_LANE}: run /handoff (alias /lane-swap) NOW, every step in order, and do not ask the operator whether to — the 95% breakpoint is the decision. Bound step 3's wait on the writers: name any writer still holding unpushed work in the handoff and proceed, killing nothing and pushing nobody's work. The swap record it writes is what the next launch resolves this lane from, so write it wherever the skill can — and in a container with no LANES_WORKSTATION it cannot (R-A11-27): there the register and object-log writes are refused, the handoff still carries the gap, and the restart command names the lane with --lane because there is no record to resolve it from. Then print the one restart command the skill derives — pclaude ${CLAUDE_PROFILE_NAME:-<profile>} — and stop."

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Install the command named by the automatic directive

When a lane-holding session crosses the 95% five-hour threshold, this now directs it to run /handoff, but a repo-wide tracked-file and path search finds no handoff command or skill. The setup code installs only skills/lane-swap/SKILL.md and commands/swap.md, whose front matter still identifies /lane-swap as canonical. Consequently, the automatic safety path names an unavailable command at the moment it must execute; either install /handoff as an alias to the existing skill or keep the directive on an installed command.

Useful? React with 👍 / 👎.

Comment on lines +129 to +130
if [[ ! -e "$HOME/.claude/usage-guard.on" ]]; then
: > "$HOME/.claude/usage-guard.on" 2>/dev/null || true

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve an operator's global disarm

If an operator disarms the global guard by removing ~/.claude/usage-guard.on, the next pclaude run—or even pclaude status/login, since all three call configure_profile_runtime—immediately recreates it and re-enables the guard. The new test only preserves contents of an existing file, but contents are irrelevant because claude-usage-guard.sh gates solely on -f; removal is the meaningful disarm operation. This contradicts the accompanying promise that a later operator disarm is left untouched and leaves no persistent global opt-out.

Useful? React with 👍 / 👎.

Copilot AI 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.

🟡 Changes recommended

Unresolved critical and moderate findings remain, including documentation consistency, atomic flag creation, failure reporting, test assertions, and test registration.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Updates the Claude usage guard directive naming and globally arms the guard during profile configuration.

Changes:

  • Renames the 95% five-hour directive to /handoff, with /lane-swap as its alias.
  • Creates ~/.claude/usage-guard.on idempotently.
  • Updates documentation and regression tests.
File summaries
File Summary
docs/claude-multi-account-profiles.md Documents the new naming and arming behavior. Nit (1 vote): clarify the remaining manual /swap usage versus automatic /handoff.
devcontainer.test/test-claude-usage-guard-auto-swap.sh Updates directive assertions. Nit (1 vote): update stale header documentation. Moderate (2 votes): register this suite or add equivalent checks to the documented test flow.
devcontainer.test/test-claude-profile-skill-install.sh Tests idempotent arming. Moderate (1 vote): use -f instead of -e. Moderate (2 votes): register the suite or add equivalent checks to the documented test flow.
base-image/files/claude-usage-guard.sh Updates emitted directive text. Critical (2 votes): reconcile remaining documentation, including the earlier descriptions and line 202, with /handoff and /lane-swap.
base-image/files/claude-profile Adds global guard arming. Moderate (2 votes): use atomic no-clobber creation to avoid TOCTOU truncation. Moderate (1 vote): surface arming failures or provide a fallback location.
Review details

Suppressed comments (5)

base-image/files/claude-profile:130

  • Both failures are swallowed, so a read-only or otherwise unwritable $HOME leaves the global gate absent while configure_profile_runtime still reports success. That violates the new guarantee that a configured workstation is armed and is especially difficult to diagnose because no warning is emitted; keep setup non-fatal if required, but surface the failed arm or provide a fallback flag location.
    mkdir -p "$HOME/.claude" 2>/dev/null || true
    if [[ ! -e "$HOME/.claude/usage-guard.on" ]]; then
      : > "$HOME/.claude/usage-guard.on" 2>/dev/null || true

base-image/files/claude-usage-guard.sh:202

  • This directive now tells the session to invoke /handoff, but the launcher still installs only skills/lane-swap/SKILL.md and commands/swap.md (setup-claude-profiles.sh loops over lane-swap and swap), with no handoff skill or command. A session following the new 95% instruction will therefore hit an unknown slash command instead of performing the swap; add the new invocable surface and update its installer/tests, or keep the directive on a command that is actually installed.
  printf '%s' "⚠ 5-HOUR WINDOW AT ${pct}% (resets ${reset}). AUTOMATIC SWAP (lane-collision-protocol Amendment 11(4)) for lane ${WORKBENCHES_CLAUDE_LANE}: run /handoff (alias /lane-swap) NOW, every step in order, and do not ask the operator whether to — the 95% breakpoint is the decision. Bound step 3's wait on the writers: name any writer still holding unpushed work in the handoff and proceed, killing nothing and pushing nobody's work. The swap record it writes is what the next launch resolves this lane from, so write it wherever the skill can — and in a container with no LANES_WORKSTATION it cannot (R-A11-27): there the register and object-log writes are refused, the handoff still carries the gap, and the restart command names the lane with --lane because there is no record to resolve it from. Then print the one restart command the skill derives — pclaude ${CLAUDE_PROFILE_NAME:-<profile>} — and stop."

devcontainer.test/test-claude-profile-skill-install.sh:641

  • These assertions use -e, but the guard's gate is [ -f "$HOME/.claude/usage-guard.on" ]; a directory or other non-regular path would satisfy this test while the guard remains disabled. Use -f for both the initial and second-run checks so scenario 13c proves the launcher created a usable arm.
GUARD_FLAG="$FAKE_HOME/.claude/usage-guard.on"
[[ -e "$GUARD_FLAG" ]] \
    || fail "arm: configure_profile_runtime wired the guard but did not arm $GUARD_FLAG — a launcher-configured workstation still runs unguarded until someone arms it by hand"; assertion

devcontainer.test/test-claude-usage-guard-auto-swap.sh:35

  • The new Amendment 17 note leaves the test file's earlier contract at lines 8–9 unchanged: it still says the directive runs /lane-swap with /swap as the alias. That makes the test documentation internally contradictory with the new assertions and can mislead future updates; revise the old header references to the new canonical/alias pair.
# Since lane-collision-protocol Amendment 17, the directive's canonical name
# is /handoff and /lane-swap is its alias — SPEC §9 above still describes
# Amendment 11(4)'s own mechanics, which this rename does not change.

docs/claude-multi-account-profiles.md:572

  • The surrounding section is still headed “/swap, manual and automatic” and says /swap is the alias used for the automatic act, but the changed paragraph now makes /handoff the automatic canonical command. Please distinguish the remaining manual /swap alias from the automatic /handoff directive so this README does not describe the old automatic surface.
guard tells the session to run `/handoff` (alias `/lane-swap`) now, every step
in order, with no question put to the operator. The steps are Amendment 8(a)'s
  • Files reviewed: 5/5 changed files
  • Comments generated: 4
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +144 to +147
# The directive names `/handoff` by its canonical name (lane-collision-protocol
# Amendment 17) and `/lane-swap` as its alias, because the session may have
# either installed, and it names the one fact the skill cannot derive from
# inside a hook: that nobody is being asked.
Comment on lines +129 to +131
if [[ ! -e "$HOME/.claude/usage-guard.on" ]]; then
: > "$HOME/.claude/usage-guard.on" 2>/dev/null || true
fi
Comment on lines +630 to +638
# ---------------------------------------------------------------------------
# 13c. THE GLOBAL ARM IS IDEMPOTENT AND NEVER REMOVED (opensoft/workBenches#76).
# configure_profile_runtime places $HOME/.claude/usage-guard.on itself now, so
# no launcher-configured workstation runs unguarded for want of someone arming
# it by hand (the guard is silent unless armed — claude-usage-guard.sh:52-66 —
# and nothing before this ever set the flag). The write must never clobber a
# flag that is already there, whichever way an operator left it: proven here
# by giving the file content of its own and re-running configure over it.
scenario
Comment on lines +291 to +294
grep -qF '/handoff' <<<"$guard_out" \
|| fail "directive: /handoff was not named as the canonical act, Amendment 17 (out=[$guard_out])"; assertion
grep -qF '/lane-swap' <<<"$guard_out" \
|| fail "directive: /lane-swap was not named (out=[$guard_out])"; assertion
grep -qF '/swap' <<<"$guard_out" \
|| fail "directive: /swap was not named as the alias (out=[$guard_out])"; assertion
|| fail "directive: /lane-swap was not named as the alias (out=[$guard_out])"; assertion
@brettheap
brettheap merged commit 1ac00ac into main Sep 14, 2026
6 checks passed
@brettheap
brettheap deleted the fix/usage-guard-directive-and-arming branch September 14, 2026 19:33
brettheap added a commit that referenced this pull request Sep 14, 2026
…a36eb3 wins the pin and the vendored bytes; act 4b's deletions and verification kept

`git merge origin/main` (2e55d67, carrying #78/#80/#81) into this branch
(3ad62ed). Merge, not rebase: the branch is under the non-fast-forward
ruleset and keeps its commits' shas.

THE PIN. devBenches/base-image/upstream-pin.yaml, every vendored file under
devBenches/base-image/files/openrepotools/ and files/openreposhape/,
scripts/setup-estate-commands.sh and devcontainer.test/test-setup-estate-
commands.sh did not conflict: main has not touched them again since #78
landed as d17bd28 (the commit this branch's own earlier merge, 29befcf,
already took wholesale), so there was nothing left to re-resolve and no
pin move to drop. `python3 devBenches/base-image/update-upstream.py check`
exits 0 unmodified: 16 vendored copies match, openrepotools still pinned at
8a36eb344935 with its fourteen install paths.

THE ONE CONFLICT. devcontainer.test/test-claude-profile-skill-install.sh,
two hunks:

- `EXPECTED_SCENARIOS`: HEAD (act 4b's own rewrite) said 9; origin/main,
  which has not yet absorbed act 4b's loop deletion, had grown its
  pre-deletion count to 18 (commit 2821a42, #80/workBenches#76, added
  scenario 13c today). Resolved to 11 (see below).
- The scenario body: HEAD had already inverted this suite around the
  post-deletion contract — scenarios 2-5 prove NO skill, NO command and NO
  SessionStart entry are installed by this script for either artefact
  post-deletion, superseding origin/main's still-present pre-deletion
  scenarios 10-13 (the `/swap` alias loop's install / idempotent / drift /
  missing-source checks), which are dropped as superseded, exactly as act
  4b's own prior merge already dropped their skill-loop counterparts.
  origin/main's scenarios 13b ("the usage guard reaches a production
  path") and 13c ("the global arm is idempotent and never removed",
  today's new one) test `configure_profile_runtime`'s usage-guard wiring —
  a feature act 4b's rewrite never touched and has no opinion on — so both
  are kept, renumbered 9 and 10 ahead of the final "alias file's own text"
  scenario (renumbered 11, unchanged body). Verified 13c's `$GUARD_BIN`
  dependency on the renumbered-9 scenario's setup still resolves in
  sequence by running the merged suite directly: 11 scenarios, 126
  assertions passed, exit 0.

EVERYTHING ELSE auto-merged with no conflict: base-image/files/claude-
profile, base-image/files/claude-usage-guard.sh, devcontainer.test/test-
claude-profile-lane-default.sh, devcontainer.test/test-claude-usage-guard-
auto-swap.sh and docs/claude-multi-account-profiles.md all gained #80/#81's
new content (the usage-guard global arm, the declined-take defect capture)
beside act 4b's own prior changes with nothing overwritten. Confirmed by
inspection: base-image/files/claude-profile carries both act 4b's earlier
merge's `lane_start_install_act()` probe and #81's `lane_defect_retire_
line()`/defect-capture logic; `bash -n` clean on every file this merge
touched.

Lane: openrepotools-3 (openRepoTools-3)
Co-Authored-By: Claude Fable 5.1 <[email protected]>
brettheap added a commit that referenced this pull request Sep 14, 2026
… exit-8 story: it is "nothing to pick", not "the operator quit"

The picker still gates on opensoft/openRepoTools#45 landing `lane`, so this
stays draft — the point of this commit is that merging main and #45's own
contract text no longer surfaces anything for this branch to fix once it does.

The merge: one real conflict, in
devcontainer.test/test-claude-profile-lane-default.sh. Both sides touched the
scenario count; kept, at the number the corrected suite actually reports (28).
Both sides also inserted new scenarios at the same spot: this branch's own
picker-replaces-the-guess rewrite left nothing there, main's
#77/#81 live-fork-defect fix (11d/11e/11f) added three.
Keeping #81's three verbatim left them exercising a lane source this branch
retires — the workstation's newest-swap-record guess, confirmed through
`lane-start --confirm` — so they failed against the merged launcher (proved by
running them: lane-start was never invoked, argv ''). Rebased onto precedence
1 (an explicit `--lane`) instead of deleted: it is the one remaining lane
source that, like the retired guess, starts unrenamed and so still exercises
the same defect-capture tee around lane-start's bare call, which the merged
code applies unconditionally to every source now rather than only to the
guess. All three pass unchanged in every other respect. Every other file
auto-merged clean; the vendored openRepoTools bytes under
devBenches/base-image/files/openrepotools/ were already at 8a36eb3 in both
parents and moved nowhere.

Read against opensoft/openRepoTools#45's own `lane` (its script, README.md and
docs/README-lanes.md hunks): the ARGV side matches exactly — bare `lane`, no
flags, precedence 1-3's lane names all reach lane-start bare with no
`--confirm`, `go_available`'s `pclaude --lane <lane> [--dir <path>] <profile>`
parses correctly against claude-profile's own leading-options loop. The one
mismatch was in what this launcher's OWN comments and docs claimed exit 8
means. `lane`'s `q|''` case only exits 8 when its own count of pickable lanes
was already zero; declining a question that DID have a lane on it is exit 0,
the same code an acted-on pick returns (read directly out of #45's `lane`,
the `case "$(lc "$answer")" in q | '') ... if [ "$n" = 0 ]; then exit 8; fi;
exit 0` block). "exit 8 (the operator quit, or there was nothing to pick)"
was wrong on the "operator quit" half in three places — this file's two
comment blocks and docs/claude-multi-account-profiles.md's own paragraph —
and none of the three mentioned `lane`'s other two documented statuses (1, a
read failed; 64, usage, unreachable from a bare no-arg call anyway), which
this launcher's `case ... 0|8) ... esac` already sends down the same
fall-through as 2 without saying so. Corrected all three to state what `lane`
actually returns and why; behaviour is unchanged; a case that already treated
"not 0 or 8" as "not an answer" was already doing the right thing, just not
saying it accurately.

Tests: bash -n and shellcheck -S error clean on the launcher and all three
touched suites. test-claude-profile-lane-default.sh: 28 scenarios, 101
assertions passing (was 25/86 pre-merge; +3 scenarios for the rebased 11d-f,
+15 assertions). test-claude-profile-lane-start.sh: unaffected, passing.
test-claude-profile-amendment-11.sh: fails at a pre-existing, unrelated
citation audit against the VENDORED devBenches/base-image/files/openrepotools/
skills/lane-swap/SKILL.md ("A12 reconciliation" / "R-A11-27") that already
fails on origin/main alone, and already failed at this branch's own merge
base before either side's changes — confirmed by running the suite against
origin/main in isolation and against the merge-base commit's own vendored
copy. Unrelated to the picker and out of scope here; left alone. Also ran
clean post-merge: test-claude-profile-lane-start.sh,
test-claude-usage-guard-auto-swap.sh (23/100), test-claude-profile-skill-
install.sh (11/126), test-setup-estate-commands.sh and
test-setup-workspace-repo.sh (152 checks). gh pr checks 82: CodeQL only
(Analyze x3 + CodeQL), all passing; no workflow in this repository wires the
claude-profile launcher suites to CI.

Lane: openRepoTools-3 (openRepoTools-3)

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_019UFwD7bCS73jaUMJ2vuo5m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants