Three things the operator asked for, and one bug he found:
1. The reasoning moved out of the sidebar into the left pane, above the answer,
dimmed - the same place every other harness puts it. While a turn runs it
scrolls with PgUp/PgDn; afterwards it is appended to the transcript as a
'thinking' entry (capped at 1500 characters) so it can be read later.
2. ????? - glibc transliterates ß but turns ü into '?', so German answers came
back as question-mark soup. Letters now come from a table generated out of
Unicode's decompositions (tools/gen_decomp.py, 266 entries, U+00A0..U+024F,
German umlauts written out as ae/oe/ue), punctuation goes through iconv
(— -> --, … -> ...). Verified: 'ein — Gedankenstrich, „Zitat“, Auslassung…'
becomes 'ein -- Gedankenstrich, ,,Zitat", Auslassung...'.
3. Slices for the viewport now start and end on UTF-8 sequence boundaries: a
column offset could cut a character in half and draw a replacement glyph.
4. The shell tool ran the JSON as a command. 'run' received
{"command":"uname -sr"} and handed that string to popen. It now parses the
arguments (echo too) and falls back to the raw string for the mock transport.
Proven against kontron: the model called run, the observation was
'Linux 7.1.3+deb14-amd64 [exit status 0]', and it read that back correctly.
Sixteen test binaries green, test_ascii added for the transliteration.
Two real defects, both measurable:
1. COLORS was read before start_color(), so it was 0 and the colour mapper took
the eight-basic-colour branch. Every palette collapsed to white on black -
the theme was effectively ignored.
2. A CDE palette is eight mid-tones. Painted literally, Delphinium's accent sat
8% away from the background in luma and its secondary text 14%: readable on a
1995 desktop with a light backdrop, unreadable in a terminal.
Fix: the background is darkened (same hue) until its luma is a terminal
background, then each role is pushed away from it - foreground 120k, accent
100k, labels 60k in luma units. Delphinium now gives 14:1 for text, 7.7:1 for
accent and 4.7:1 for labels on a slate background, with the palette's blues
intact. Verified in the escape stream: 38;5;230 text, 38;5;68 and 38;5;74
accents, 48;5;235 surface.
sp_color_darken and sp_color_separate live in theme.c so any future consumer
gets the same rule, and the deltas are named in one place instead of spread over
four init_pair calls.
The goal is not configuration: it belongs to the conversation in front of you.
So it moved out of the config file and became a command.
- commands are an ABI now: sp_host_add_command / sp_host_command, so the UI
never needs to know a plugin by name. A leading '/' is never sent to the
model; an unknown command lists what exists.
- works in both modes: '/goal <text>' in the TUI and
'splinter -p "/goal ..."' (exit 0 on success, 2 on an unknown command).
- focus registers /goal (set, show when empty of arguments) and /recap (force
a reminder into the next turn, regardless of the five-turn cadence).
Fixed while testing it: the UI only repainted on a keypress, so a plugin widget
that ticks was frozen on screen - the clock showed the time from when the window
opened. The input read now times out after 500 ms and that timeout repaints the
sidebar and status line: clock, focus and cps are alive while you do nothing.
Fifteen test binaries green; test_focus covers the command path too: set, show,
force a recap outside the cadence, refuse an unknown command.
Long conversations drift, and a model ten turns in is deep in a detail while the
reason the session exists has scrolled away. focus puts it back: on every fifth
turn it inserts one system message with the goal and asks whether the last step
was closer to it.
Details that matter and are tested:
- one reminder per turn at most, even if compaction runs twice;
- inserted BEFORE the newest user message, so the model reads goal then request
and answers the request instead of treating the goal as a reply;
- nothing at all without a goal: no goal, no noise;
- the goal comes from the operator (config key goal -> SPLINTER_FOCUS_GOAL),
never from the model, and is truncated with a marker rather than eating the
budget it is meant to protect.
The host now counts turns (sp_host_turn) so a plugin can schedule against them;
that is what makes 'every five' mean five user turns and not five requests.
Sidebar shows the goal and the reminder count. Fourteen test binaries green,
test_focus drives the counter directly: turn 1 silent, turn 2 one reminder
in the right position, a second compaction in the same turn adds none, turn 3
silent, turn 4 the second reminder.
One file, key = value, comments with '#'. /splinter/config (or
~/.config/splinter/config), overridable with SPLINTER_CONFIG or --config,
ignorable with --no-config, generatable with --init-config.
Precedence is command line, then file, then built-in default, and an unknown
key is an error with its line number - a typo that is silently ignored is a
config that lies about what it does. The example file is written and read back
by the test suite, so it cannot rot into something the parser rejects.
What it covers: endpoint, model, api_key_env, transport, cli_cmd, plugin
(repeatable), theme, autonomous, steps, max_bytes, session_dir, system_prompt.
Verified from /tmp with nothing but the word 'splinter': the chat started, the
sidebar showed the configured endpoint, theme, cps and clock widgets, and a
turn against kontron answered 'Ich bin ein grosses Sprachmodell...' with the
session written to /home/lotherk/.splinter.
Thirteen test binaries green (test_config: full file, trimming, unknown key
with line number, missing '=', missing file, example round-trip, env path).
The sidebar counted characters and guessed tokens. The provider reports the
real numbers in the final chunk (prompt_tokens/completion_tokens, or
input_tokens/output_tokens), so both the streaming accumulator and the
one-shot reply parser now keep them, the agent sums them per turn, and the
sidebar shows '79 tok (in 344)' instead of an estimate. The estimate stays as
the fallback for endpoints that report nothing, and it is still labelled as
one.
Streaming: the OpenAI transport reads SSE over curl -N and reports deltas as
they arrive. Text goes to the chat pane, a tool-call start to the sidebar, and
a reasoning model's reasoning_content is shown dimmed above the answer instead
of being hidden - which is what made a 143 s turn look like a dead terminal.
Measured against kontron (Qwen3.6-35B, strata-poly): first byte at 11.6 s on a
short question, text growing visibly in the TUI at 7 s and 17 s on a longer one.
test_sse drives the accumulator with recorded lines: plain text, a tool call
split over three chunks, two calls in one turn, a broken data line, keepalives.
Twelve test binaries green.
Defects found while proving it, each fixed or stated:
- typed umlauts were dropped: the input loop accepted ASCII only. Every byte
above 0x1f is kept now and the line is redrawn from the buffer.
- setlocale() was never called, so curses had no encoding at all.
- the vendored NetBSD curses emits Latin-1 bytes for wide characters (ü ->
0xFC) while ncurses passes UTF-8 through; proven with a raw pty dump of both.
The UI therefore transliterates for display (gruen) and the conversation and
session log keep the exact UTF-8. The library defect is written down, not
papered over.
- an answer longer than the screen was skipped by the viewport and the chat
looked empty; draw_history now shows the bottom of the content, including
entries taller than the window.
First run against a real model (Qwen3.6-35B-A3B on kontron, strata-poly)
exposed two things a stub never would:
- our tool schema sent "properties":{}, which tells the model that no
arguments exist. Tools now carry a real JSON schema (echo/command/clock), and
the loop completes a tool round against the 35B: request 1 -> tool_call,
request 2 -> "Das Ergebnis ist: ping".
- an answer longer than the screen was not drawn at all: the entry did not
'fit', so the viewport skipped it and the chat looked empty. draw_history is
now a real viewport (total height, bottom-anchored, entries taller than the
screen start at the offset that puts their end on screen).
Steering: a turn runs on its own thread while the UI keeps reading keys. Enter
queues text the loop picks up at the next step boundary; Ctrl-C cancels; in a
single-step turn the text becomes the next message instead of disappearing.
Curses remains UI-thread-only. A dangling ag->cfg after the turn made a steer
run twice - the caller's config is now restored, and the session log confirms
one user line per steer.
Transports are plugins now (sp_host_add_transport / --transport). plugins/cli
makes any program the model: SPLINTER_CLI_CMD, run through /bin/sh, prompt on
stdin, stdout as the answer, 4 MiB cap, non-zero exit with the program's stderr,
empty output is an error. Verified with sed, with claude -p (2.9 s, answer OK)
and with cat.
Eleven test binaries green, test_cli included.
Compaction is not a flag in the loop; it is a compactor registered by a
plugin and run on the main thread before every request, with the whole
conversation in hand. Returning 1 means changed, 0 nothing to do, -1 failed -
and a failure is counted, not fatal.
lcm: deterministic lossy compression. Over budget, it keeps the leading
system prompt and the last six messages and inserts one system message that
says how many messages went, of which roles, and quotes the head of the
oldest dropped turn. No second model, so a run stays reproducible and costs
nothing extra.
cps: continuous parallel compression. The worker thread decides what would go
from an index it got under a mutex (role, size, 64 bytes of head per message)
and never touches the conversation; the main thread splices the prepared plan
in one pass when the budget is hit. The sidebar line shows applied/prepared
counts or a ready plan, so the claim is visible.
The limit is in both files: they can decide which messages go, not summarise
their text, because the text is not the worker's to read.
Ten test binaries green; test_compactor drives both against their real .so
files, including that lcm leaves the system prompt first, inserts the [lcm]
record at index 1, keeps the tail verbatim, and that cps needs two calls
(prepare, then apply) to change anything.
Splinter can now talk to a real endpoint: --endpoint plus --model shapes the
whole conversation into one chat/completions request and parses the reply back.
The seam changed from a raw string to the conversation, because a provider
adapter cannot invent history and the loop must not depend on vendor JSON:
- sp_conv: owned messages (role, name, call_id, content, raw tool_calls),
geometric growth, trim from the front. Copy on push, so a compaction step
must produce a new array - which is what makes it reviewable.
- sp_openai_request(): conversation + tool table -> JSON body.
- sp_openai_reply(): choices[0].message -> content + calls, and it keeps the
provider's raw tool_calls array to hand back verbatim next round.
- provider error objects, empty choice lists, non-JSON bodies and empty bodies
each produce a distinct, quoted error instead of a silent empty answer.
- transport_openai: curl, body through a temp file, status from curl's -w, key
from the environment only.
- libmcp's JSON parser is vendored and instantiated exactly once (src/json.c);
two instantiations would be a link error rather than a silent duplicate.
Proven end to end against a local stub speaking the real wire format:
request 1 (1 message, 2 tools, 448 bytes) -> tool_call for echo; splinter ran
the tool, request 2 (3 messages, 682 bytes) -> final text; the session log
holds user, observation, assistant.
Nine test binaries green, including test_openai (request shape, tool_call
parsing, raw array kept, four failing reply shapes) and test_conv.
A plugin is a .so against libsplinter.so, exporting sp_plugin_describe().
The layout changes so there is exactly one copy of each symbol in the
process: all logic lives in libsplinter.so and both the binary and every
plugin link against it. Two copies would have meant two registries.
What the ABI offers:
- tools with the authorization classes the loop already enforces, so the
decision stays in the harness and not in the plugin;
- widgets rendered in the sidebar, one line per widget (name: text);
- a worker thread per widget with tick(), which may block, read files, wait
on sockets - and which cannot touch curses at all;
- sp_host_widget_text() as the only thread-safe write path: the host copies
the string under a mutex, so a stack buffer is safe and the UI never holds
a pointer a worker could free.
Error paths are part of the design: a wrong ABI number is refused with both
numbers in the message, a failed init is reported and skipped, a duplicate
widget name is refused, a tool without a run function is not registered, and
nothing is dlclose()d while a thread might be inside it.
Layout: chat on three quarters, sidebar on one (session, transport, theme,
last-turn numbers, widgets), status bar underneath. The clock example plugin
proves the path end to end - its widget publishes 11:45:23 into the sidebar
from its own thread.
Seven test binaries green; test_plugin loads the real clock.so with dlopen
and checks the worker actually published, plus every refusal above.