Commit Graph
144 Commits
Author SHA1 Message Date
Konrad Lother fb877e263f sessions: state root vs session root, sessions under ~/.splinter/sessions
Add state_dir (config/token/commands/USER.txt, default ~/.splinter) and
default session_dir to <state>/sessions.  Telegram uses
<session>/telegram, so CLI and gateway sessions are separate trees.
Keep --session and the old configs working.  Also carries the pending
apply_selection model-pointer fix from the n95 tree.
2026-11-20 15:07:36 +00:00
Konrad Lother 6b51f48335 telegram: own session tree and a status channel
The daemon writes its sessions under <state>/telegram, so a CLI -c in
the same directory never picks a gateway conversation and /new in the
chat never creates a file a CLI would resume.  Command scripts and
USER.txt stay in the base state dir; only the session files move.

Add --notify TEXT ("-" reads stdin) and telegram { status_chat = ID }
to send status and cron messages to the status chat.  The daemon
announces its start there, and the cron bridge can use the same path.
2026-11-20 09:59:40 +00:00
lotherk 37d038f716 telegram: /status and an inline menu with /model
The command menu now carries /status and /menu; /model was already there. The
inline keyboard under /menu, /status, /help and /start has Status, Model, New
and Help. Status shows the TUI's facts (session, model, endpoint, agent,
tokens, steps, limits, compaction, meter); Model opens the provider picker,
which now has a Status button back. The bot menu button is forced to the
command list, so the commands show even if an older bot had another button.

The live config lists the local models (main/checked, plain, bench35, bench4b,
bench9b) so /model has more than one button; the last two need their
containers running.

tests/test_gateway.sh: /status, the /menu callback, the buttons and the
command list. tests/fake_telegram.py: the status callback and
setChatMenuButton. make check: all tests passed. check-asan: 41/41 clean.
2026-11-19 15:20:20 +00:00
lotherk fb3cacbb4c prompt: only name a task scope in a git work tree
The Telegram daemon runs in $HOME, not in a project; sp_task_scope_note would
have called the scope "home". .git in the working directory is the signal.
test_sessiontools: a plain temp directory gets no paragraph; test_engine still
sees the note in the repository root.
2026-11-19 14:16:56 +00:00
lotherk eba6f71a2d prompt: name the working directory's task scope; /effort sets the review depth
A session in ~/src/mikronix asked for "open tasks", called task_list without a
scope, got the makronix list and answered with it. The system prompt now names
the working directory as the default task scope (sp_task_scope_note), so the
model says "mikronix" instead of following the busiest scope. tasksd's
task_scopes/task_list descriptions now tell it to pass that scope (separate
repo, commit 4781f60).

/effort (off/low/medium/high/max or 0..12) sets X-Junction-Review-Rounds for
this process; unset keeps the router rule. The transport sends the header on
every request while set, so one session can run 0, 7 or 12 rounds without a
junction config change. /effort alone prints the current value.

test_engine: the prompt carries the scope paragraph; /effort maps to 12/2/0 and
rejects junk. make check: all tests passed. make check-asan: 41/41 clean.
2026-11-19 11:37:32 +00:00
lotherk e0825c04b7 sse: index-less parallel tool calls are separate calls
A bridge that replays a completed non-streaming message in one SSE delta sends
tool_calls without an index (the non-stream shape has none). Splinter put every
index-less call of such a delta into the last slot, so junction's reviewed
answers arrived as one call whose arguments were several JSON objects:
mcp_tasksd__task_scopes with "{}{"state":"pending",...}{...}". The model was
then told its own arguments were malformed and repeated them.

Several entries in one index-less delta are now distinct calls (index = position);
a lone entry stays the next fragment of the last call, which the piecewise
streaming shape needs.

test_sse: one delta with three index-less calls yields three calls with their own
names and arguments; with the old fallback the test fails (ncalls is 1).
make check: all tests passed. make check-asan: all 41 binaries clean.
2026-11-19 09:29:11 +00:00
lotherk 47d45bfd15 session: search only sessions that ran in this working directory
"What did we do last?" in a folder searched every session ever and wandered
off in another direction: the plugin walked the whole session directory while
only the prompt note was folder-scoped. Both tools now read the cwd from the
session's meta sidecar (sp_session_cwd, the same record the folder note uses)
and skip sessions from other folders -- and sessions that have no cwd record.

test_sessiontools creates a session in a second folder with the same needle:
with the filter disabled it shows up (red), with it the search and the list
stay in the folder, and even session=<id from elsewhere> answers "no message".

make check: all tests passed. make check-asan: all 41 test binaries clean.
2026-11-19 07:57:03 +00:00
lotherk 11d119be04 session: a plugin that reads earlier sessions, and a prompt that points at them
session_search walks the logs of earlier sessions in this folder newest first
(query, limit, days, session) and answers with date, session id, title and a
snippet around the match; session_list shows the sessions themselves. The
running session is left out -- that is context, and lcm's recall covers what
compaction dropped -- unless a call names it with session=.

The system prompt now carries two things. When the working directory has
earlier sessions, a paragraph says how many, the newest, and that
session_search/session_list read them, so the model looks before asking the
user something that was already answered. And the default prompt tells it to
use the mcp_* tools for tasks, memory, skills and knowledge bases actively, not
only when asked.

test_sessiontools drives both tools (hit, no hit, limit, days, explicit id,
list with the current session marked); test_engine checks the prompt paragraph
and the default text. make check: all tests passed.
make check-asan: all 41 test binaries clean.

The user's ~/.splinter/splinter.conf gained "plugin session { }" (backup:
splinter.conf.bak-session).
2026-11-19 07:40:49 +00:00
lotherk f07128cf9b tests: deterministic fuzz over the parsers that read foreign text
The markdown renderer, its chunk cursor, the SSE reader and the JSON parser
all consume text from a model or a provider. test_fuzz drives 4000 inputs from
a fixed seed through all four and checks the two properties a plain crash test
would miss: the renderer is deterministic, and the cursor always finishes (a
piece that does not advance would loop forever in the Telegram sender).

Red proof: with sp_tgmd_next() forced to return without advancing, the test
fails on "piece.len > 0"; with the real code it passes.

make check: all tests passed (test_fuzz included).
make check-asan: all 40 test binaries clean.
2026-11-19 07:15:30 +00:00
lotherk 0372981725 lcm: recall reads whole lines, and the catalogue loses 18 dead keys
One session line is one JSON object, and an observation can be tens of KiB.
recall read with an 8 KiB fgets, so a match in the middle came back without its
context and a long hit was printed in full. getline now reads the line whole; a
hit shows 1200 bytes of head and 400 of tail with the cut size, and the whole
answer stops at 12 KB. test_compactor drives it: with the cap raised it fails on
both the marker and the bound, with the cap it passes.

The i18n checker listed 18 keys nothing uses (the interview/plan/model
leftovers). They are gone from all three catalogues; catalogs.c is regenerated
from them by the build.

check_i18n: ok. make check: all tests passed. make check-asan: all 39 clean.
2026-11-19 06:34:38 +00:00
lotherk c11a6c7989 mcp: join the server threads and give the tools an owner
The MCP plugin's reconnect thread was detached: shutdown killed the child and
returned, so the thread could still be reading into its line buffer (up to
16 MiB) and could call sp_host_add_tool() into a host that was being freed -- a
use-after-free waiting to happen, and the reason three leaks were suppressed in
tests/asan.supp (read_line, register_tools, connect_server).

Each server now keeps its pthread_t, init creates it joinable, and shutdown
waits (bounded, 5 s) for every thread to return before joining it and freeing
its state. teardown() frees the line buffer for the HTTP transport too (it was
freed only for stdio) and closes the stdio pipes even when the child was
already reaped.

The registered tools leaked for a second reason: sp_registry_add copies the
struct, not the strings, and sp_registry_free freed only the arrays -- the
prefixed name, the description, the printed schema and the toolref of every MCP
tool were lost with the registry. struct sp_tool gets a dispose hook; the
registry calls it for each tool, and the MCP plugin frees what it allocated (the
default schema is strdup'd now, so ownership is uniform). Builtins and the
gateway's tools leave it NULL; every positional initializer got the new field.

tests/asan.supp is empty. make check-asan: all 39 test binaries clean.
make check: all tests passed.
2026-11-19 00:05:05 +00:00
lotherk 21287b88a9 agent: free the reply of a terminal failure, and make the tests leak-clean
ASAN over the unit tests found a real leak the normal gate cannot see: a
transport failure that is not retried (the fourth 500, a 4xx, a dead stream)
returned -1 with the last reply's body and calls still allocated. The caller
only reads the reply on success, so it leaked on every terminal failure -- a
long-running daemon with a flapping provider grows by one reply per failure.
test_agent's four-500 case leaked exactly the last "boom"; it is clean now.

The same run showed the tests leaking their own fixtures: test_anthropic and
test_tasks never freed the registry they filled, test_cli forgot host4 and
host5, test_confblock forgot its error buffer, test_mcpclient its registries.
Fixed; all 39 unit binaries are now clean under ASAN+UBSAN with leak detection.

That gate is `make check-asan`: it rebuilds the tree with the sanitizers, runs
the unit binaries with LSAN, and rebuilds normally afterwards. Three MCP-plugin
teardown allocations are suppressed in tests/asan.supp: its server thread is
detached, shutdown kills the child but cannot join the thread, so the line
buffer (bounded at RPC_MAX_LINE) and the tools registered by that thread can
outlive the host. Bounded, teardown-only, tracked separately.

make check: all tests passed. make check-asan: all 39 test binaries clean.
2026-11-18 23:16:26 +00:00
lotherk 4cbd57d829 tree: lcm keeps the task, and the in-flight work it sits in
Everything that was uncommitted in the shared tree, in one commit because the
changes are interleaved across the same files (lcm, engine, frontend, locales).

lcm: a continuation prompt is not the task. After /resume the newest user
message is "Continue with the task ...", and pinning it kept the keystroke
while the question it continues was cut away -- measured: a resumed session
woke up with the prompt, one tool call and its error, and no task at all. The
pin now skips the harness's own continuation prompts, so the real question is
pinned again. test_compactor drives it: with the skip disabled the task is
lost (red), with it the task comes back after the summary (green).

engine: /self-check and the exact tool-argument parse are in a1794fb; this
commit carries the tests for them (a failed tool observation must appear in
the self-check prompt; mcp_parse_exact rejects two objects in one string) and
the i18n keys the new code uses: cmd.script.*, main.no_profile, tg.busy,
tg.interview.running, ui.agent_busy in all three catalogues.

The rest is the in-flight work from the shared session: engine/frontend,
plugins, telegram/a2a, and their tests.

make check: all tests passed; check_i18n ok, 204 keys in 3 catalogues.
2026-11-18 23:03:09 +00:00
lotherk a1794fb101 engine: /self-check, and tool arguments must be one JSON object
/self-check (and /selfcheck) takes the last three turns of the conversation,
every failed tool result in them and the last turn's error, and starts a turn
with them: something went wrong, check yourself instead of asking the
operator, name the cause and continue. Messages are capped per message and in
total, oldest dropped first; it is refused mid-turn like /compact and is in
the completion list.

mcp_parse() stops at the closing brace, so a tool-call argument string holding
two objects parsed as the first one and the second command disappeared without
a word -- measured in sess-1795032073, where "cat a" ran and "cat b" was
silently dropped. mcp_parse_exact() requires the whole text to be the one
value; the agent's tool-argument validation uses it, so such a reply is
retried and then fails with "model sent malformed tool arguments" instead of
running half the command.

test_engine drives both spellings and the included turn; test_agent drives the
joined-argument reply (three requests, zero tool calls). test_engine and
test_agent pass; the build is -Wall -Wextra -Werror clean.
2026-11-18 21:54:04 +00:00
lotherk 6b560e63a0 agent: validate tool-call arguments before they enter the conversation
A model step with arguments like "{command:cd ..." is not JSON. Splinter
accepted it, ran "sh -c {command:cd ..." (exit 127), then sent the bad
assistant tool_call back on the next request: every endpoint answered 500
"Failed to parse tool call arguments as JSON" and junction cooled all four.

Arguments that start with '{' must parse now. If they do not, the reply is
freed without adding the assistant message or running a tool; the request is
retried up to three times and then fails with "model sent malformed tool
arguments". A bare string (mock/script shape) is still allowed.

test_agent drives a transport with exactly that malformed call: three requests,
zero tool calls, no "command:bad" in the conversation.

make check: all tests passed.
2026-11-18 15:45:42 +00:00
lotherk 7f8493c949 ui: multiline prompt, shift+enter, mouse; cache plugin; judge headers
Prompt box
- The input wraps at the window width and grows from one to five rows;
  beyond five it keeps the line with the cursor visible and scrolls inside.
  The conversation and sidebar shrink instead of the prompt being cut.
- Shift+Enter inserts a newline. It accepts the CSI-u and xterm modifyOtherKeys
  sequences and Alt+Enter; modifyOtherKeys is enabled at start and disabled on
  exit/signal. Enter still sends.
- History entries are folded to one line so the line-based history file stays
  readable.
- Mouse wheel scrolls the transcript (3 rows) in the prompt and during a turn.

Cache plugin
- New plugins/cache/cache.so: sidebar block and /cache command with the
  provider prompt-cache hit rate (last and session), cumulative cached tokens,
  and the junction cache from X-Junction-Cache plus its /status cache object
  (entries, hits, misses, bytes, ttl, joined).
- sp_meter/agent/engine now carry cached_total; the UI fills it.
- plugin cache { } added to the user config.

Junction judge schedule
- The transport parses X-Junction-Judge-Next/-In/-Next-Step/Every/Target/
  Model/Cache from every chat response and publishes the last one on the host.
- The junction widget and /junction show "judge next in N ... via ... cache
  ..." when the provider sends it; no stale schedule after a plain model.
- X-Junction-Cache is parsed even when no judge headers are present.

Self plugin
- Human labels and units: memory, threads, open files, children, bytes read/
  written; "children" instead of "kids".

Errors
- An in-stream error event now reads "provider error: ..." instead of "sse:",
  because it is the provider/router talking, not the stream parser.

make check: all tests passed.
2026-11-18 14:17:36 +00:00
lotherk 80154055f1 lcm: do not grow the conversation when the cut adds as much as it removes
/resume compacted N messages to N+1 every time. With keep_tail 6 and a short
history, the cut removed one message, then added the summary and the pinned
question: net +1. The context never shrank and the next /resume repeated it.

A message rewrite now happens only when it removes more messages than it adds
(drop > 1 + pinned). If the cut is that small, the old tool-output trim is kept
and the message list is left alone. test_compactor covers the 8-message case
(no change, no [lcm] row) and the 10-message case (10 -> 9).

make check: all tests passed.
2026-11-18 12:47:30 +00:00
lotherk 86e0233c16 model: the session remembers /model; the config does not
A session owns the model chosen inside it, so reopening that conversation
comes back on the same model. The config is never touched: a new session
starts on core default (or -m), and the old global 90-model drop-in stays
removed. Telegram's /model remains process-only and writes no config.

- <session>.model is written by /model (provider/model, e.g.
  junction/qwen3.6-35b) and read when the session is opened again.
- /new copies the model the session is on into the new session.
- test_engine checks the sidecar and that reopening restores test-model-2;
  a new session still starts on config test-model.
- docs say exactly that: session choice persists, config does not.

Verified with the real config: /model junction/qwen3.6-35b writes the sidecar,
-c comes back on qwen3.6-35b, a new session starts on qwen3.6-35b-judged.
2026-11-18 12:47:30 +00:00
lotherk d63da16c65 model: /model never saves; config (or -m) is the default
The user's rule: what the config says is the default, -m overrides it for one
run, /model overrides it for the running process - and nothing is written to
the config or to the session. The session sidecar from the previous change made
/model persistent, which is exactly the harness behaviour this rejects.

- removed <session>.model writing and restoring; a reopened session starts on
  the config default or -m, not on the last /model choice.
- /new no longer copies the current model into the new session.
- Telegram's /model and probe buttons no longer write 90-model.conf; the
  switch lasts for the gateway process.
- existing .model sidecars were moved out of ~/.splinter; the stale 90-model
  drop-in was moved aside earlier.
- test_engine asserts that /model leaves no sidecar and that reopening uses
  test-model, not test-model-2; test_gateway asserts that no 90-model.conf is
  written.
- docs: "choice lasts for this run and is not saved".

Verified with the real config: default is junction/qwen3.6-35b-judged, -m
junction/qwen3.6-35b uses qwen3.6-35b for that run, /model switches to
claude-haiku for that run and the next start is judged again.

make check: all tests passed.
2026-11-18 12:38:29 +00:00
lotherk 6813fff1b5 model: every choice is provider/model; no main row
The picker and the text list now say what goes on the command line:
junction/qwen3.6-35b-judged, local/qwen3.6-35b. Labels and selectors are the
same string, so there is no second format to explain.

- the core endpoint (the endpoint/model without a provider block) is called
  "local" in every choice; its old name "main" is still accepted as a selector
  so existing drop-ins and session files keep working.
- sp_provider_choose("local/model") resolves to the core endpoint; a configured
  provider with that name wins if one exists.
- /model, /model probe and the served-model list all emit provider/model.
- the session sidecar stores provider/model (junction/qwen3.6-35b).
- the sidebar and /usage print "local" for the core endpoint.
- -m provider/model no longer produces an extra main row, and 90-model.conf
  (the old global /model file) was moved aside; the config's provider wins.
- tests and docs use local/test-model and local/m.

make check: all tests passed.
2026-11-18 12:22:52 +00:00
lotherk 4be6e26f78 tests: keep their sessions out of ~/.splinter
`make check` created a session for every splinter invocation that did not set
HOME - the A2A and gateway scripts pass --no-config, which does not change the
session directory. The user's ~/.splinter collected hundreds of "hallo",
"fehler" and "auth ohne token" sessions; the last three in /sessions were test
noise that looked like aborted chats.

- SPLINTER_SESSION_DIR overrides the session directory (o->session_dir still
  wins when a caller names one, so test_engine keeps its temp dir).
- make check exports a mktemp session dir and removes it on exit; the scripts
  that inspect $D/home/.splinter point the variable there.
- docs/CONFIG documents the variable.
- the existing test sessions were moved to
  ~/.splinter/test-sessions-2026-11-18 (not deleted) so /sessions shows the
  real conversations again.

make check: all tests passed; ~/.splinter kept 211 sessions before and after.
2026-11-18 06:48:01 +00:00
lotherk ddf0ec5462 tools: valid schemas; sse: surface in-stream errors
A judged request sends the whole tool list to the judge. Claude validates the
schemas and rejected the request with 400
"tools.22.function.parameters.type: Field required": delegate_due and
delegate_jobs declared "parameters": {} instead of an object schema. junction
wrapped that 400 in the stream as data: {"error":{...,"code":400}}, but the SSE
parser ignored anything that was not a choice - so the turn ended with
"stream ended with no answer" and the one line explaining it was lost. Three
sessions stopped that way at the same minute.

- delegate_due/delegate_jobs now carry {"type":"object","properties":{}}.
- test_engine walks every registered tool and fails when parameters.type is
  not "object"; this catches the next schema before a judge does.
- sp_sse_line recognises a top-level error object, reports its message and
  remembers its code; the transport puts the code in the reply status.
- a 4xx from the stream ends the turn with the real message and is not
  retried; an empty 2xx stream and a 5xx still are. 402/429/529 stay with the
  usage-limit path, which already handles them.
- test_sse feeds the junction 400 event and checks message and code.
- README and docs/PLUGINS say why a tool schema needs type:object.

make check: all tests passed.
2026-11-18 06:28:23 +00:00
lotherk 0f8c5c7e96 plugin host: status segments get their own slots; tmux title
The status table was sized by MAX_COMPACTORS (8). With the status plugin's
seven segments and lcm's new "compact" segment, junction's segment was the
ninth: sp_host_add_status failed, junction_init returned -1 and the whole
plugin was skipped. The user saw no junction widget and no junction tool.
Status segments now have MAX_STATUS (16) slots of their own, and
test_compactor registers nine extra segments so the shared cap cannot come
back.

The curses chat also asks tmux, when TMUX and TMUX_PANE are set, to name the
window and pane after the directory it was started in: "S: <dir>", with
automatic-rename off for that window. tmux is exec'd directly, never through a
shell, and nothing is written into the curses screen. test_ui checks both
names.

make check: all tests passed.
2026-11-17 23:36:59 +00:00
lotherk af2001bfee ui, model, cost and idle timeouts
- lcm: the sidebar widget and /status segment show the context, the number of
  compactions, messages and bytes of the last cut, and how many old tool
  outputs were trimmed. The counters are the compactor's own, not an estimate.
- cost: a provider-reported USD cost (usage.cost/cost_usd) is carried through
  sse/openai, the agent and the engine. /cost reports it with the cache share
  and splits judged from plain turns; the notes say that an upstream judge is
  not visible in the provider's usage. The status plugin and junction prefer
  the reported number over list-price arithmetic.
- curses: the running turn's seconds moved from the input line to the status
  bar. Notes and errors are transcript rows below the cause, never text in the
  input line or the status bar; a failed backend request is a status row and is
  retried by the agent. The steer prompt is only "steer> " and what was typed.
- model: /model probe works in the chat. The picker lists the configuration at
  once, then asks the endpoint the session is on what it serves and adds those
  models, so a router's whole menu is selectable. provider/model selectors now
  apply the right provider instead of becoming a model name. The choice is
  written to <session>.model and restored when that session is reopened; /new
  carries the current model into the new session.
- sidebar: plugin titles are bold and underlined (this curses has no italic
  attribute), with a rule between the plugin blocks.
- run/cli: a command timeout is an idle window. Every chunk on stdout or
  stderr resets it, and the process is asked with waitpid(WNOHANG) whether it
  is still there before the window is extended. A long build that keeps
  reporting progress is no longer killed for being long; a silent hang is.
- config: ';' separates settings on one line, so
  plugin lcm { keep = 6; tool_trim = 8192 } parses as two keys.
- tests: lcm widget/status counters, one-line config blocks, session model
  restore and /model probe, cli idle timeout with a talkative and a silent
  command, run output reset, and the UI status/retry rows.

make check: all tests passed.
2026-11-17 23:21:56 +00:00
lotherk dc9a1c62ec lcm: never drop the newest user message
A long tool loop pushed the question out of the six-message tail; the model then
wrote 'The compaction dropped the user's actual question' and recovered it with
recall (session 1794952419). The newest user message is now pinned and put back
right after the summary, so the task survives any compaction. test_compactor
covers it.
2026-11-17 22:23:05 +00:00
lotherk 82bda09ed1 lcm: cut old tool outputs before dropping messages
Tool observations are the bulk of a long conversation. Before lcm drops any
message it now cuts every old tool output to a head and a tail with a marker
quoting its first line; the middle stays in the session log, where the recall
tool finds it. Only when that is still over budget are messages dropped, so a
conversation often keeps all its turns and only loses the middle of old
outputs.

- plugin lcm { keep = 6; tool_trim = 8192 } sets the verbatim tail and the cap
  per old observation (0 turns the trim off).
- the compacted summary says when tool output was cut too.
- test_compactor: a 20 KB old observation is trimmed, nothing is dropped, and
  the marker points at recall.
- docs/CONFIG and docs/PLUGINS updated; the user config uses 6/8192.

make check: all tests passed.
2026-11-17 21:44:45 +00:00
lotherk 63b6742447 retry reasoning-only streams, /compact, token threshold and target
- a stream that carried only reasoning and then ended without an answer used to
  abort with no retry: guarded_stream counted every chunk as "already
  produced". Only answer text and tool calls block a retry now; the thinking
  may repeat, a lost turn may not. test_agent has a stream that thinks, fails
  once and answers on the second attempt.
- /compact [tokens]: runs the compactors now (default: compact_target, else
  8000 tokens) and reports messages and bytes before/after.
- compact_threshold / compact_target in core (tokens): once the last request
  was larger than the threshold, the next request is compacted to the target
  before it is sent. 0 disables either.
- lcm gains a read tool `recall`: case-blind search in the session log for
  what compaction dropped from the prompt.
- user config: compact_threshold = 32000, compact_target = 12000.
- README/CONFIG document the command, the two keys and the cache trade-off.

make check: all tests passed.
2026-11-17 21:34:57 +00:00
lotherk 8aee12e9d4 drop tmux/planner/sysinfo, tasks becomes processes, no capitalised calls
- plugins/tmux, plugins/planner and plugins/sysinfo are gone (plugin list,
  Makefile rules, tests, docs). The config no longer loads them; the stale
  .so files were removed from the install tree.
- plugins/tasks is plugins/processes: plugin name "processes", widget
  "processes", tools process_start/process_list/process_result/process_kill.
  The sidebar now lists only running work: a finished task keeps its output
  in process_result but stops taking a row forever.
- the dead planner link in the delegate (link_plan_quota -> command "tasks")
  is removed with the planner.
- tool call rows are no longer capitalised: "run  ls -l", "read  src/x.c" as
  the model sent them, not "Run "/"Read ".
- tests updated (delegate panel expects no finished row, engine/UI expect the
  lowercase call row, secrets/delegate use the processes plugin and tools).
- the user's config gets a Delegate/Scheduler section: the three providers
  carry review/plan/docs tags and keep max_parallel=2; plugin scheduler stays
  loaded so waiting jobs are retried.

make check: all tests passed.
2026-11-17 21:06:55 +00:00
lotherk 1e15c91e4e interview: the model talks to the user, USER.txt rides in the prompt
The six-question form is gone. `splinter --interview` now opens the chat with an
interview system prompt: get to know the person, one question at a time, then
write a compact summary and end with INTERVIEW_COMPLETE.

- the marker is captured in the engine's turn thread and in the synchronous -p
  path: the summary before it is written to ~/.splinter/USER.txt (0600), the
  marker is stripped from the answer and the conversation, and a "interview
  saved to USER.txt" note goes into the transcript. An installation from before
  USER.txt keeps working: profile/<user>.md is the fallback until the first new
  interview.
- the USER.txt text is appended to the system prompt of every later session
  (plain "What you know about the user" block), including after /new and an
  agent switch (it rides in base_prompt).
- --interview is a chat mode with the interview prompt and no agent profiles;
  it needs a provider like any chat.
- Telegram: /interview swaps the system prompt, starts the conversation and
  restores the normal prompt once the summary is captured. The initial turn and
  every later reply are checked, so a model that summarizes immediately also
  works.
- test_interview.sh now proves capture, marker-free USER.txt and the summary in
  the next request; test_gateway drives /interview and the fake model answers
  with the marker when the interview prompt is in the request.
- docs (README, PLUGINS) describe the new flow.

make check: all tests passed.
2026-11-17 20:50:03 +00:00
lotherk 8aad48b928 remove the mem0 memory system
The memory tools talked to a mem0 server (memory_url/memory_key_env), one
bucket per unix user. It is gone: no memory_add, no memory_search, no mem0
client, no config keys, no test_memory.

- delete src/backend/memory.c and memory.h; the engine no longer registers the
  tools; config loses memory_url/memory_key_env; SPLINTER_MEM_KEY leaves the
  secret list; docs/CONFIG, ROADMAP and GATEWAY stop mentioning it.
- the unix identity helper stays, under its real name: sp_user_name() in
  src/backend/user.c (profiles, interview and the Telegram gateway used it).
- tool list is now read/search/list/write/edit/run/skill_*/... plus the MCP
  session tools; nothing about memory remains.
- test_mcpsession.sh: the client socket gets a 120 s read timeout, not the
  5 s connect timeout (a turn under load answered too late and looked hung).

make check: all tests passed.
2026-11-17 20:00:38 +00:00
lotherk 36a66ab4f0 self monitor, MCP session tools, junction serving endpoint
- plugins/self: what the session costs the machine - RSS, CPU, threads, fds
  and io of the process itself from /proc/self/*, and the same (count, RSS,
  CPU) for every process whose parent chain reaches it: run calls, MCP
  children, delegates. Widget, /self and the session_usage tool; interval in
  the plugin block (default 2 s).
- MCP server: the session tools. splinter_sessions, splinter_state,
  splinter_models, splinter_agents, splinter_history, splinter_say,
  splinter_open, splinter_model, splinter_agent, splinter_steer,
  splinter_cancel, splinter_approve. Say starts a real turn and returns the
  answer; a turn parked on an approval returns the question instead of
  failing. Mutating tools obey --autonomous. `--daemon --mcp-server-listen`
  runs the MCP server on a thread beside the Telegram daemon.
- the MCP server asks the engine for its registry on every call (a session
  switch replaces it) and copies the tool name out of the parsed JSON before
  freeing it (the first version compared a dangling pointer and answered
  every session call with empty text).
- junction: "serving <endpoint>" - streaming answers carry no
  X-Junction-Endpoint, so the plugin compares the route targets' ok counters
  from /status between samples and names the one that grew, with its
  last_ms. The header is still used when present (non-streaming). The
  X-Junction-Endpoint of the plugin's own /v1/models probe remains a probe
  fact in /junction only.
- transport: X-Junction-Endpoint is parsed from the response headers in both
  the streaming and the non-streaming path and published through
  sp_host_served_by(); sp_reply carries served_by.
- the curl rate guard (--speed-limit/--speed-time) is gone: it cut slow
  router streams with "Less than 1 bytes/sec" even while keepalives arrived.
  The overall -m timeout stays.
- focus: the sidebar shows "recap N, every M turns", and an applied recap
  writes "recap applied (turn N, every M turns)" into the transcript (host
  status messages are now drained during a turn; protocol clients get them
  as entry events too). The initial goal announcement says so as well.
- tests: test_self, test_mcpsession.sh (real socket), test_focus status
  messages, test_junction serving placeholder.

make check: all tests passed.
2026-11-17 19:13:59 +00:00
lotherk 55ca5c71f8 junction widget: the model's route, nothing else
Two reasons the sidebar was useless: it named the route of the *configured*
provider model, not of the model the run was switched to (/model
deepseek-v4.1-flash kept showing qwen3.6-35b's kontron/kompute route), and it
repeated server counters (MCP servers, queue, requests, probe headers) that
have nothing to do with the conversation.

- sp_host_model()/sp_host_set_model(): the engine publishes the model it is
  actually on; the engine sets it at plugin load, after /model and on every
  state read. The junction plugin prefers it over the config.
- the widget is now only the model, the route from the matching rule (one
  target per row, "!" when that target's probe fails) and "N/M up":
  deepseek-v4.1-flash / route opencode-go0 / opencode-go1 / ... / 4/4 up.
  Uptime, MCP servers, queue, requests, endpoint p95 and every response
  header stay in /junction.
- widget text may use up to 8 rows (a four-target route plus model and
  health is seven).
- test_junction: the widget must be exactly "m\nroute a\nb!\n1/2 up" and
  must not repeat mcp/models/probe stats.

make check: all tests passed.
2026-11-17 18:28:00 +00:00
lotherk 7e8fe5b825 retries are visible in the prompt line
The session showed the last error as "retry 1/3 in 5000ms: openai: stream
ended with no answer" with nothing on screen: the turn looked hung for the
five seconds, then either answered or failed. The retry itself was fine; the
operator could not see it.

- sp_agent_config gains note()/note_ctx: a status line for the operator, ""
  clears it. The engine turns it into SP_EV_NOTE, so curses shows it in the
  steer line and protocol clients get the note event.
- agent_request() emits "retrying in N s: <reason>" before sleeping and clears
  it when the attempt answers or the retries are exhausted.
- i18n ui.retry_note in en/de/pt_BR; README says the wait is visible.
- test_agent: the note callback must have seen "retrying in" on the recovery
  case.

make check: all tests passed.
2026-11-17 18:14:31 +00:00
lotherk b0c1da65a2 junction: the session's route, not the probe's endpoint
The widget printed "endpoint=opencode-go" because that is the
X-Junction-Endpoint header of the plugin's own /v1/models probe, which
junction routes there by a path rule. It says nothing about where the
conversation goes, and the operator's qwen3.6-35b is routed to kontron and
kompute0..2 - so the line was wrong, not just imprecise.

- read the active model from the config (sp_usage_active -> provider model)
  and match /status' rules against it: exact model > glob > catch-all, rules
  with a path are another route. The result is the route line:
  "route kontron! kompute0 kompute1 kompute2" ("!" = that target's own health
  probe is not ok).
- /junction shows model, route and "route health: N/M up, down: ..."; the
  /v1/models header block is marked as the probe's route, not the session's.
- the header stats label the probe values (probe-ms=, probe-cache=) and no
  longer print the endpoint header as if it were the route.
- side_text(): wrap one line at a time and let a continuation use up to three
  rows; passing a multi-line string to one mvwaddnstr() double-counted rows
  and cut "route ... kompute1 kompute2" in half.
- test_junction: fake /status gains rules and per-endpoint probe_ok; the test
  sets the run's model ("m") and expects "route a b!", "probe-ms=12",
  "route health: 1/2 up, down: b" and no "endpoint=" in the stats.

make check: all tests passed.
2026-11-17 12:31:58 +00:00
lotherk 0f46c22a58 model picker, steer feedback, tolerant SSE with retries, junction headers
- /model in the curses chat opens a picker: Up/Down, typing filters by
  provider/model, Enter takes the selector, Esc cancels. The list comes from
  the backend (sp_engine_models -> sp_provider_choices), not from a text
  scrape; the socket has a `models` command, so --attach gets the same picker,
  and the switch is still the ordinary "/model <selector>" input.
- steering: Enter during a turn now says so twice - a "steering queued: ..."
  row in the transcript and "Ns steering queued (n) steer>" in the input line
  until the step boundary picks it up; a rejected steer is an error entry.
- input lag: typing during a turn is echoed immediately (the input line is
  redrawn per key, not at the next 100 ms frame), and the history is only
  repainted when its generation changed, so a streaming turn no longer
  repaints the whole transcript on every clock tick.
- sidebar: the first line of every widget is bold, like its heading, so a
  plugin block has a title instead of a wall of small print.
- junction plugin: keeps every response header from /mcp, the status route and
  /v1/models; the widget shows the X-Junction-* routing stats, /junction lists
  all headers per source. It reads the status aliases (/status, /v1/status,
  /queue, /v1/queue) and remembers the one that answered, parses queue,
  endpoint p95/exhausted counts, and counts the models (/v1/models, probed on
  its own slower interval because it goes upstream).
- SSE: blank lines no longer abort a pretty-printed object, a truncated tail
  is dropped instead of failing the turn ("incomplete data line" is gone), and
  a [DONE] with a fragment clears it.
- retries: a request that fails before anything streamed (connection, missing
  status, 5xx) is tried three more times, 5 s apart; 4xx is not retried, and
  after the first chunk the error is reported instead of printing the answer
  twice. Ctrl-C ends a wait at once; SPLINTER_RETRY_WAIT_MS overrides the wait.
- tests: test_sse (split object across events, truncated tail), test_agent
  (four 500s = four requests; two 500s then an answer), test_engine and
  test_protocol (models list), test_junction (headers, aliases, models),
  test_ui (/model picker), test_focus (status keys).

make check: all tests passed.
2026-11-17 11:46:11 +00:00
lotherk 614988aa68 junction plugin, light/dark themes, goal completion
- plugins/junction: evaluates the X-Junction-Mcp header and /status; the
  sidebar widget, the "junction" status segment, junction_status and
  /junction show uptime, MCP-server health, queue and request counts.
  The url/header come from the plugin block, the mcp junction server or
  SPLINTER_JUNCTION_URL/TOKEN; the key is never printed.
- theme: two flat themes. light is a white page with black text, dark the
  same inverted; chat, sidebar and input share the page, the status line is
  the one separate surface. Each CDE palette keeps its own rules.
- curses: the sidebar uses the theme's own text on its own background
  (white/black) instead of white on a darkened surface; the one column
  between chat and sidebar is painted, so a white theme has no black seam.
- focus: the goal goes into the first prompt (config, resume, planner), and
  every goal-carrying text asks the model to end with GOAL_COMPLETE. The
  marker is read from the conversation and the session log and recorded as
  goal_state=succeeded in the session meta; /goal and the sidebar say
  [done], reminders stop, a new goal opens a new one.
- tests: test_junction (fake server, header identity, no colon in widget
  continuation lines, no key in the output), test_focus (announcement,
  completion in the compactor and from the tick, persisted state),
  test_theme (flat themes, list order).

make check: all tests passed.
2026-11-17 10:10:47 +00:00
lotherk be3d0ee415 ui: slash commands run off the screen thread, sysinfo one row per metric
A command that talks to the network (/connect, /model probe, a plugin
command, a commands/ program) ran on the UI thread: the prompt froze until
it returned. ui_command_run() now runs be->input on its own thread while
the screen keeps reading keys. One next line can be queued and is processed
when the command ends; Ctrl-C clears the edit, Ctrl-D quits. The worker
never touches curses, and the backend is not polled while it runs.

Widget text may now have continuation lines without "name:": they are
rendered under the widget above. sysinfo uses that for one metric per row
instead of wrapping "RAM ... CPU ..." into the same paragraph. A blank row
stays between widgets, not between their rows.

The Ctrl-C UI test looks for the active steer prompt; "working" is replaced
by it on the first 100 ms tick.

make check: all tests passed.
2026-11-16 18:42:27 +00:00
lotherk 67b4d5d070 goal in the session, /continue, a white sidebar, sysinfo
The goal lived only in the focus plugin's memory: a resume lost it and
there was no way to start the next turn from it. It is now stored in the
session's .meta (one line, 1000 bytes) and read back when the plugin sees a
new session id, so /open and a resumed process find their own goal again.
/continue reads the same sidecar and starts a turn with "Continue working
toward this goal: ...". /goal still sets it and starts the recap turn.

The sidebar was a patchwork of pairs and widgets could inherit the wrong
background. It now uses one PAIR_SIDE (white on a darkened theme
background) for every heading, label, usage row and widget; the window
gets that pair as its background, so no line paints its own surface.

New plugins/sysinfo: a widget thread samples /proc/meminfo, /proc/stat and
statvfs("/"), and publishes RAM, CPU, swap and disk with five-cell
[|||| ] gauges every two seconds. It is added to the shipped plugin list
and to the user's config.

agent.c keeps the last prompt/cache counters when a tool-call step reports
no usage. A zero there used to reset the ctx gauge in the status bar after
every tool call.

Tests: session goal survives reopen, /continue returns the prompt,
make check: all tests passed.
2026-11-16 18:30:42 +00:00
lotherk 006198425c sse: keepalives are not errors, pretty-printed data is assembled
An OpenAI-compatible proxy may put non-JSON text behind the data: prefix
(`data: ping`, `data: [PING]`) or pretty-print one JSON event over several
data: lines. The parser called both "unparseable data line" and failed the
turn.

- Empty payloads, `ping`-style text and non-[DONE] brackets are ignored as
  keepalives. Only a line that claims to be a JSON object is still an error.
- A data payload starting with '{' that does not parse yet is kept and the
  next data: line is appended; the event is parsed when it completes. A
  blank line (event end) with an unfinished object is still the error, and
  sp_sse_finish() refuses an unfinished tail.
- The Anthropic parser gets the same keepalive tolerance.

test_sse: keepalive lines, multi-line JSON and a broken event.
make check: all tests passed.
2026-11-16 18:01:06 +00:00
lotherk bff47eede8 ui: palette roles, a working unlimited usage count, /goal as the recap
Three things the screen and the goal were getting wrong.

Colours. The theme had one accent for the user and grey for everything
else. theme.h now carries agent, think, tool and notice colours. A CDE
palette maps them to sets 7 (answer), 3 (reasoning), 6 (tool) and 8
(status); Xresources uses colour10/11/14/13 on dark and 2/3/6/5 on
light. Role colours keep their hue and are pushed from the surface only
when they would disappear; each role has a slightly different minimum,
so even a monochrome palette yields distinguishable steps. The 256-colour
mapping now takes the nearest cube/ramp entry instead of rounding each
channel down, which turned a dark orange into grey 240.

Usage. sp_usage_get() only counted requests inside a declared window. A
provider without limit= therefore always read "0 calls" in the sidebar,
although every call was in its log. Calls are now counted when no window
is declared; test_usage covers it.

Goal. /goal <text> set a variable and answered "goal set" without starting
a turn. The engine now starts the recap prompt: the model writes a short
recap, the focus plugin remembers that answer and injects it every seventh
turn (SPLINTER_FOCUS_EVERY still overrides). /recap is gone as a command;
its old behaviour is what /goal does now. A palette and a wiki page are
not enough to make that visible: the prompt, the confirmation entry and
the sidebar goal all show up in the chat.

Tests: palette role separation and indexed roles in test_theme, four
unlimited calls in test_usage, recap capture/injection and the missing
/recap in test_focus, and a settle delay so the UI tests type after
ui_read_line() owns the keyboard. make check: all tests passed.
2026-11-16 17:48:22 +00:00
lotherk 1726bc1967 ui: a status bar above the prompt, a scroll fix, a steer space
The screen had no room for the numbers that say how a turn is doing, and
two older behaviours still hurt: scrolling to the top made PgDn jump back
to the top, and a catalogue's steer mark without its trailing space glued
the typed text to ">".

- draw_statusbar() in curses.c: one row above the prompt with
  ctx used/max + [||||    ] gauge, cache share and tok/s. The history and
  sidebar lose one row; the prompt stays the bottom row. The bar is drawn
  on every idle tick, during a turn and in --attach.
- ctx: optional field on a provider (and in core) in tokens; the engine
  reports it in struct sp_engine_state. SPLINTER_CTX_MAX still overrides it.
- cache: sp_reply gained tokens_cached. OpenAI reads
  prompt_tokens_details.cached_tokens / prompt_cache_hit_tokens, Anthropic
  reads cache_read_input_tokens and counts cache reads+writes in the prompt
  total. sp_agent_stats keeps the last request's prompt and cache share;
  the engine keeps the turn's output tokens for a real tok/s.
- scroll: grow scroll by the growth of maxscroll, not by the distance from
  the first visible line. At the top that distance was 0, so every frame
  re-added the whole scrollback and PgDn could not leave the top.
- steer mark: append the missing space if a catalogue omits it.
- protocol state carries ctx_used/ctx_max/cached/turn_tokens_out, so the
  attached UI shows the same bar.
- tests: cache parsing in test_sse/test_openai/test_anthropic, ctx parsing
  in test_confblock, and test_ui checks the bar, the cache share and the
  PgUp-to-top/PgDn-down path.

make check: all tests passed.
2026-11-16 16:59:49 +00:00
lotherk 76c9007c02 config: a core default is a choice, not something a main endpoint overrides
load_config() copied the config's main endpoint into the command-line
options, so apply_selection() saw o->endpoint != NULL and skipped
core { default = ... }. Every config with a main endpoint (and every
/model drop-in, which wrote exactly that) silently ran the main endpoint
instead of the default; a drop-in with model = provider/model even put a
slash-name into the model field.

- The main endpoint is applied only when no -m and no default exist.
  -m and a command-line --endpoint still win.
- /model saves a delegate choice as "default = ID[/MODEL]" instead of a
  second main endpoint; the provider block supplies kind, endpoint and
  key. A model of the main endpoint has no provider block, so that one
  keeps the full endpoint/model/api_key_env form.
- docs/CONFIG.md, README and test_providers describe the order and the
  new drop-in line.

Verified with a fake endpoint: core default -> mb, -m a -> ma, main-only
config -> mmain, a stale endpoint/model drop-in no longer shadows the
default, a "default = a" drop-in does.
make check: all tests passed.
2026-11-16 16:27:03 +00:00
lotherk 42c11f95c7 providers: a 3s connect timeout, one model-list path, a tmux test of its own
The model-list probe hung on a host that accepted no connection and the
delegate list had a second, worse way to ask: popen(curl) without the key and
a line-by-line "id" scan that saw only the first model in one-line JSON.

- http_get(): --connect-timeout 3, -m 8 for the answer. Every provider
  probe (/v1/models, usage/balance) uses it.
- delegate_list probe=1 builds an sp_provider and calls sp_provider_served(),
  so it sends the key, reads the JSON and lists every model.
- The route stays <endpoint>/models: /v1/models for opencode, ollama.com,
  api.anthropic.com and the junction gateway (verified against all four).
- test_tmux unsets TMUX/TMUX_PANE and points TMUX_TMPDIR at its own temp
  dir: no session, window or keystroke on the user's server. The literal "x"
  probe text is gone.

make check: all tests passed.
2026-11-16 15:28:38 +00:00
lotherk 9af7695064 gateway streams: the answer grows while the provider talks
- stream:true uses the provider's send_stream and writes each text delta as a
  chat.completion.chunk as it arrives, instead of one chunk at the end. The
  SSE headers and the role chunk go out before the upstream call, so a slow
  provider still gives the caller a live connection.
- caller tool calls are sent as one tool_calls delta at the end of the step,
  when their names and arguments are complete; filtered gw_ calls are
  renumbered 0,1,... so strict accumulators see no gap. Local gw_ calls stay
  invisible.
- stream_options.include_usage asks the provider for usage and adds the summed
  token counts in a final chunk before [DONE]. Usage is now summed over every
  upstream round, for the non-stream reply too.
- an error after the first byte becomes an SSE error object plus [DONE]; a
  bad request is still an ordinary HTTP 400. SIGPIPE is ignored and
  TCP_NODELAY set, so a caller that closes early cannot kill the gateway.
- tests: fake_gateway.py has a slow stream, tests/stream_probe.py measures
  that chunks arrive while the upstream streams, usage is checked, and the
  mixed reply keeps index 0 after filtering. make check green.
2026-11-16 14:06:54 +00:00
lotherk dd135f3b33 sessions get titles, /rename and /rm
- .meta carries a title: the first user line is stored once, /rename
  [ID] TITLE replaces it. Reopening preserves the title and the original
  creation time.
- /sessions shows the title, locally and over the link; the protocol's
  sessions event carries it. Old sessions without a stored title fall back
  to their first user line when listed.
- /rm ID removes a session that is not open: JSONL, meta, saved agent
  profile and logs/<id>; the open session is refused, /rm last resolves
  the newest.
- tests: test_session (auto title, explicit title survives reopen, old-log
  fallback, recursive removal), test_protocol (title, rename, rm, errors),
  test_ui (title, rename, rm). make check green.
2026-11-16 12:10:06 +00:00
lotherk a01bfe9df1 sessions switch locally, gateway keeps caller settings and mixed calls
- sp_engine_switch(): close the old engine and open the chosen session from
  the same options; if the new one fails, reopen the session the engine was
  on. The protocol's open and the in-process /open both use it. The curses
  screen clears the pane and replays the new history, so /open no longer says
  it needs --attach.
- gateway: temperature, top_p and max_tokens (max_completion_tokens) are
  forwarded to the provider instead of dropped; request bodies may be
  Transfer-Encoding: chunked; a mixed reply runs the gw_ calls, returns the
  caller's calls in tool_calls and puts the local observations in content
  (also in the SSE delta), so the caller can echo them back.
- reconnect: when the remembered session is gone, the screen says which one
  and stays on the session the server has instead of silently swapping the
  transcript.
- ring: the exits' transports are disposed on plugin shutdown.
- /status goes through the catalogues like the rest of the UI (the English
  labels and their alignment are unchanged, so existing parsers still work).
- the man page passes mandoc -Tlint and covers the gateway and /open.

Tests: test_ui.sh covers local /sessions and /open (new, back, history),
test_protocol.sh the shared switch, test_reconnect.sh a vanished session,
test_gateway_openai.sh forwarded parameters, a chunked body and the mixed
reply in JSON and SSE. make check green.
2026-11-16 10:18:41 +00:00
lotherk 5143fcd054 gateway, sessions, reconnect: splinter serves other harnesses and keeps tabs
- --openai-listen: an OpenAI-compatible /v1/chat/completions and /v1/models.
  The model gets splinter's local tools as gw_* (executed here) and the
  caller's tools under their own names (returned as tool_calls to run there).
  Local calls loop inside one request; a mixed reply runs the local calls and
  asks again. --autonomous gates mutation; beyond loopback a bearer token is
  required; stream:true answers with SSE.
- --serve keeps several sessions: sessions/open over the protocol and
  /sessions, /open in the attach screen. The server owns the engines, closes
  the old one before opening the next (plugins keep globals) and sends
  state/history after every switch. Session ids are unique per process, so two
  engines in the same second no longer share a file.
- --attach reconnects: when the server goes away the screen keeps running,
  retries every second, asks for its session by id and restores the
  transcript; a missing session falls back to the server's current one.
- transports own their context now: provider switches and close dispose it
  (a switch used to leak one per change). The idle screen repaints entries it
  drains, so a reconnect note is not invisible.
- docs/GATEWAY.md; PROTOCOL, FRONTENDS, README and the manual page describe
  the three; tests cover the gateway tools, sessions/open and a server
  restart under --attach.
2026-11-16 09:33:37 +00:00
lotherk a9f175c25b backend/frontend: an engine every front end can talk to
The harness was two halves that could not see each other: main.c built the
agent, ui.c ran it -- with the curses thread model, the approval condition
variable, the slash commands and the provider switching inside the drawing
code. A second front end had to copy all of it.

Now:

  src/backend/   engine.c owns the session, the turn thread, the event queue
                 and every command; agent, transports, tools, session, config,
                 providers, plugins and the protocol servers move here.
  src/frontend/  curses.c draws and reads keys through ui_backend.h;
                 ui_local.c is the engine in this process, ui_remote.c is a
                 served engine behind a socket. protocol.c serves the engine
                 as JSON lines (protocol 2: history, approvals, steering);
                 client.c is splinterctl, the reference client.

splinter --serve / --attach: the same screen runs as a client of a served
engine, so the socket carries everything the front end needs. docs/PROTOCOL.md
and docs/FRONTENDS.md describe the contract; docs/proto-example.py is a
60-line client. tests/test_engine, test_protocol and test_attach cover the
event order, the socket and the attach mode.

Review fixes in the same tree: dynamic line buffers (9 KB prompts and 8 KB
events were truncated), a turn event no longer ends the busy window (steer
leftovers), the screen finalises every turn, /new keeps the profile, reopens
the log and gets unique ids, the profile is remembered in <session>.agent so
--resume comes back in it, agent statistics are a locked snapshot (no data
race), !shell keeps 64 KiB with a marker, the socket probes for a live server,
compares its inode and sets CLOEXEC/SNDTIMEO, exit 2 means configuration,
BSD peer checks use getpeereid, and the i18n checker scans the new
subdirectories again.

Includes the parallel session's SSE fix: the parser reports what a line
produced, so a tool name no longer lands in the answer ("readread").
2026-11-16 09:06:51 +00:00
lotherk c9f21be89b ui: a call names itself once - no JSON, one row, quiet calls inline
Three places named the tool call and none of them said what it was.

The prompt line while a turn ran read "12s run {"command": "sleep 4; echo x"}":
the model's own encoding, cut at forty bytes in the middle of an escape, pushed
into the steer prompt. It is now "12s Run  sleep 4; echo x", and the call gives
way when the row is narrow - never the steer prompt, which is the one hint the
row exists for.

The approval question read "run run (destructive) {"command": ...}? y/N" - the
verb twice (the catalogue's "run" and the tool's name) and the raw arguments in
it. It is now "Run  touch /tmp/x (destructive)?  y/N", the same words as the
transcript row, then how far the call reaches.

In the transcript every row was dim and said "Run" again, so a run of shell
calls was a grey column of the same word. The call row is now painted in the
accent colour, its output stays dim, and the row shows the verb and the one
argument that matters - command, path, pattern, query, url - read out of the
argument object with mcp_parse instead of off the front of the pretty text: the
model orders its arguments as it likes, and a write carries the whole file
content next to the path. A call that answered with nothing but
"[exit status 0]" keeps that on its own row instead of a second block.

An observation keeps sixteen rows and 4 KiB, whichever comes first, with the
number of lines left out: a row limit alone let one enormous line through, a
byte limit alone let fifty short lines cover the screen. The log keeps all of
it. In the sidebar the last-turn line clipped to "3 " in a narrow column; it
gets two rows now.

tests/test_ui.sh holds the question to it: shows "Write  ", not_shows
'{"path"', and after the run ">> Write  ".
2026-11-15 21:04:20 +00:00
lotherkandClaude Opus 5.5 5054393e17 gateway: one instance per session dir; drop the keys the sidebar left behind
Two daemons poll getUpdates and race: one reads the update, the other never
sees it, so a message is answered by nobody or twice. The gateway now holds
flock on <session_dir>/gateway.pid and a second start says who has it.

Removing the sidebar left 12 catalogue keys nobody reads (sidebar.*,
widget.*, status.title, ui.running); they are gone from all three
catalogues and test_i18n checks keys that still exist.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 21:52:16 +00:00