HTTP server (ka serve)
ka serve # binds 127.0.0.1:8417ka serve --addr 127.0.0.1:9000 --token "$KA_TOKEN"A hand-rolled HTTP/SSE server: same process, no framework. The bearer token is required on every request when set. It binds to loopback by default; if you expose it, set a token.
Prompting from the terminal
Section titled “Prompting from the terminal”ka queue "run the tests" # prompt the live serve sessionka queue "run the tests" --addr 127.0.0.1:9000 --token "$KA_TOKEN"ka queue <prompt> sends a prompt to a live serve session from any terminal, with the same --addr / --token flags as ka serve.
Configuration
Section titled “Configuration”ka serve loads the full config chain: built-in defaults, the user layer, the project layer when the directory is already trusted (a server never prompts), extra --config files (repeatable, last wins), then environment overrides. There are no CLI model/mode/feature flags on serve; set them in a ka.toml layer or the environment. For an unattended server, [permissions] prompt_policy = "deny" is the stance to set (the run surfaces also take --mode dont_ask); serve reads the same chain, so layers and environment carry it.
ka serve --config /etc/ka/server.tomlSessions and streaming
Section titled “Sessions and streaming”Create a session and the conversation streams over SSE. Sessions can start from, or resume, strands on disk:
curl -s http://127.0.0.1:8417/sessions \ -H 'content-type: application/json' \ -d '{"resume": "latest"}'"resume" accepts "latest" or a strand id / prefix; the prior transcript is replayed over SSE before the new turn, so a restarted client sees the full conversation.
Reconnects
Section titled “Reconnects”The stream honors Last-Event-ID: a dropped connection resumes from the last event received, rather than restarting the turn. Combined with strand persistence, a ka serve session survives client restarts and network blips.
Observing a session
Section titled “Observing a session”Any number of observers can stream a session without owning it: GET /sessions/{id}/events replays the ring-buffered history, then streams live events, and honors Last-Event-ID for mid-session reconnects. Presence changes broadcast as {"type":"presence","busy":…,"attached":…} events. GET /sessions lists every session with presence and title; GET /sessions/{id} returns one.
ka attach [id] is the built-in observer: a read-only TUI over that SSE stream, with busy · N attached in the footer. The write path stays single-owner: observers have no prompt route; POST /sessions/{id}/prompt remains the only writer API.
When to use it
Section titled “When to use it”- a local web UI or tool that wants a conversation without embedding the engine
- scripting ka from languages where spawning a process is clumsy
- bridging one ka conversation to several viewers (each with its own
Last-Event-ID)