ClawTerm is a session-persistent binary protocol for AI agent terminals. Inspired by X.25 packet switching and IBM SNA. Built in C. Runs as a Kubernetes DaemonSet. Your AI sessions survive network drops, device switches, and reboots — because the session never closes.
Features
Every design decision exists because HTTP/WebSocket is the wrong foundation for persistent AI agent sessions.
Protocol Spec
Everything on the wire. 15 bytes of overhead. Big-endian. CRC-16/IBM checksum.
| Type | Value | Direction | Description |
|---|---|---|---|
| CT_CONNECT | 0x01 | C→S | Establish new session |
| CT_ACCEPT | 0x02 | S→C | Session accepted, return session_id |
| CT_RESUME | 0x03 | C→S | Reconnect to existing session |
| CT_RESUMED | 0x04 | S→C | Resume ack + replay buffered frames |
| CT_DATA | 0x10 | Both | Agent I/O payload |
| CT_KEEPALIVE | 0x20 | Both | Session heartbeat (30s interval) |
| CT_SUSPEND | 0x30 | C→S | Client going away — session stays warm |
| CT_DISCONNECT | 0x40 | Both | Clean session teardown |
Why ClawTerm
HTTP is a stateless document delivery protocol. AI agents need persistent sessions. ClawTerm is built for the problem, not bolted onto a workaround.
| Capability | WebSocket | ClawTerm |
|---|---|---|
| Session persistence | App-layer only | Protocol-native |
| Mobile disconnect | Session dies | SUSPEND / RESUME |
| Multi-device resume | New session | Any device, full context |
| Frame overhead | HTTP headers + framing | 15 bytes |
| Concurrency model | Thread / goroutine per conn | epoll, 10K+ / core |
| Pod IPC | Network required | Unix socket, zero-hop |
| Mobile transport | TCP only | QUIC (connection migration) |
| GC pauses | Runtime-dependent | Zero (C) |
Quick Start
ClawTerm is the transport layer powering ClawForge — the customer session layer for AI agents. Deploy AI employees that know your business, with sessions that never drop.