demos: live tmux hotkey recording (keycast overlay) + per-keystroke typing; fix explain live-mode resolution#13
Merged
Merged
Conversation
explain now resolves the live mode the same way the hook does (env, pane-mode files, config), so its verdict matches what the hook would actually decide. Previously it hardcoded "enabled", so a disabled pane or FAILSAFE_MODE=disabled was invisible to explain — contradicting the docs' claim that explain shows what the hook would do. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TiYGMkQeeiUQ6vWVqJaaQc
…ping Rewrite scripts/record-docs.sh (v2): - Human-visible typing: every command is typed one glyph at a time via a new type_line helper (TYPE_DELAY, default 0.05s; 0 = instant), replacing the atomic `virtui exec` in the step loop with type_line + `virtui wait`. Casts now read like someone at a keyboard, not text teleporting in. - --render and --claude parse in any order. - New tmux-hotkey scenario: the Ctrl+Alt+T per-pane toggle flipping the guard enabled<->disabled live — the same command BLOCKs, then (after the chord, sent as `press Escape Ctrl+T` through the tmux root key table) ALLOWs when re-run from shell history, then BLOCKs again, with the status bar following. The tmux config is materialised from docs/toggle/tmux.md's own fenced blocks (via test/docs/lib/extract.sh) so it can't drift. - New opt-in --claude scenario (record_claude_hook): failsafe blocking a kubectl delete inside Claude Code, then the hotkey flipping the guard without leaving the Claude TUI. Runs with the REAL home (Claude auth is Keychain/~/.claude), isolates writes via FAILSAFE_LOG -> throwaway file, and removes only the pane-mode file its toggle creates. Degrades gracefully (skips if claude/tmux absent; a flaky turn warns and the other casts are unaffected). Recorded + rendered: explain-block, mode-toggle, audit, tmux-hotkey (.cast + .svg). Per-char typing verified (one output event per glyph); tmux-hotkey verified to contain Decision: BLOCK, Decision: ALLOW, and the `sudo` status flip. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TiYGMkQeeiUQ6vWVqJaaQc
…) and clean pane banner Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TiYGMkQeeiUQ6vWVqJaaQc
The banner is printed by the outer bash that virtui spawns, before tmux's default-command runs, so BASH_SILENCE_DEPRECATION_WARNING must be injected at spawn time via virtui run -e (verified live during the re-record). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TiYGMkQeeiUQ6vWVqJaaQc
…--claude scenario Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TiYGMkQeeiUQ6vWVqJaaQc
…be-style) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TiYGMkQeeiUQ6vWVqJaaQc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
failsafe explainhardcodedMode: "enabled"instead of resolving the live mode chain (env, pane files) — its verdict could disagree with what the hook would actually do. Now resolves the same chain as the hook, with a regression test. Fail-safe: an unresolvable mode falls back toenabled.scripts/record-docs.sh): per-keystroke typing baked into every cast (TYPE_DELAY, default 50ms/key),--render/--claudeflags, and a newtmux-hotkeyscenario.tmux-hotkey: the documentedCtrl+Alt+Tbinding pressed live through tmux's root key table (virtui writes to the client PTY — the path a real keyboard takes, which even the bats harness can't exercise). A keycast overlay (⌨ Ctrl+Alt+T) shows the keypress like a video demo. Story:explainBLOCKs → hotkey → status bar flips to 🔓 sudo → same command ALLOWs → hotkey re-arms 🔒 on. The demo's tmux config is materialized fromdocs/toggle/tmux.md's own fenced blocks via the harness extractor, so the recording provably shows the documented setup.toggle/tmux.md, cross-link fromreference/modes.md, documentTYPE_DELAY+ the honest split (tmux hotkey now recordable; WezTerm/iTerm stay manual).Deliberately not in this PR
The inside-Claude demo (
--claude): the scenario skeleton exists but no recording ships. It runs the recorded Claude with the operator's own unmodified config and never instructs the inner agent to skip its own review steps — if another guard fires first, that layered result is what gets recorded. It ships once reliable (see docs/demos/README.md "Planned").Verification
go test ./cmd/failsafe/green (includes newTestRun_ExplainResolvesLiveMode)Decision: BLOCK,Decision: ALLOW,sudo, no macOS zsh banner🤖 Generated with Claude Code
https://claude.ai/code/session_01TiYGMkQeeiUQ6vWVqJaaQc