kookr-terminal-backendlisted
Install: claude install-skill kookr-ai/kookr
# Kookr terminal backend
Coding agents survive a Kookr restart because dtach owns their processes. Kookr
owns an attach client, not the lifetime of the shell. Terminal transport failure
must remain distinct from evidence that an agent exited.
## Find the owner before editing
- `src/adapters/terminal-backend.ts` is the current contract. There is no tmux
rollback backend or returned `SessionHandle`. Lifecycle, byte writes, capture,
resize, stream subscriptions, and diagnostics use one `TerminalBackend`.
- `LocalDtachBackend` owns the manifest, rings, and one persistent attach per
session. `local-dtach-stream.ts` owns the byte path; recovery is in
`local-dtach-recovery.ts`.
- `src/server/start.ts` selects the default in-process backend. The experimental
`KOOKR_TERMINAL_HOST=true` path instead constructs `TerminalHostBackend`; its
child owns the real backend, input coordinator, terminal sockets, asynchronous
ring persistence, and reconstruction worker. Never construct both real owners
for the same instance directory.
- `TerminalInputCoordinator` serializes input and tracks prompt ownership.
Preserve its epoch and cleanup fences for HTTP, WebSocket, and adapter input.
No transport retry may silently replay an input whose delivery is uncertain.
The legacy names `tmuxName` and `session.tmuxSession` identify dtach sessions.
Renaming the persisted field requires a schema migration; it is not a switch of
terminal technology.
## Browser streaming invariants
`se