Summary
Add a Claude Code SessionEnd hook that emits terminal reset escape sequences when a session ends. This provides defense-in-depth alongside terminal_guard() — the hook fires from inside Claude Code's exit path, covering cases where terminal_guard() might not execute (SIGTERM, etc.).
Proposed Configuration
Add to ~/.claude/settings.json (user-level, applies to all Claude Code sessions):
{
"hooks": {
"SessionEnd": [
{
"type": "command",
"command": "printf '\\e[?2004l\\e[?1l\\e[?25h\\e[=0u\\e[<99u\\e[?1000l\\e[?1003l\\e[?1006l\\e[J'"
}
]
}
}
Why Human Review
This is a user-level configuration change, not a code change:
- Goes in
~/.claude/settings.json, not in the project codebase
- Affects ALL Claude Code sessions (not just autoskillit cook/order)
- Needs human decision on whether this should be:
- Documented as a recommended setup step
- Added to the
autoskillit install flow
- Added to the
autoskillit doctor checks
- Left as optional guidance in docs
Relationship to #676
Issue #676 implements the code-level fix in terminal_guard(). This issue adds a complementary layer that fires from inside Claude Code itself. The two are independent — each covers gaps the other can't reach. The escape sequences are idempotent, so double-emission is harmless.
Investigation Report
.autoskillit/temp/investigate/investigation_terminal-state-corruption-after-cook-exit_2026-04-08_183000.md
Summary
Add a Claude Code
SessionEndhook that emits terminal reset escape sequences when a session ends. This provides defense-in-depth alongsideterminal_guard()— the hook fires from inside Claude Code's exit path, covering cases whereterminal_guard()might not execute (SIGTERM, etc.).Proposed Configuration
Add to
~/.claude/settings.json(user-level, applies to all Claude Code sessions):{ "hooks": { "SessionEnd": [ { "type": "command", "command": "printf '\\e[?2004l\\e[?1l\\e[?25h\\e[=0u\\e[<99u\\e[?1000l\\e[?1003l\\e[?1006l\\e[J'" } ] } }Why Human Review
This is a user-level configuration change, not a code change:
~/.claude/settings.json, not in the project codebaseautoskillit installflowautoskillit doctorchecksRelationship to #676
Issue #676 implements the code-level fix in
terminal_guard(). This issue adds a complementary layer that fires from inside Claude Code itself. The two are independent — each covers gaps the other can't reach. The escape sequences are idempotent, so double-emission is harmless.Investigation Report
.autoskillit/temp/investigate/investigation_terminal-state-corruption-after-cook-exit_2026-04-08_183000.md