Commit Graph
44 Commits
Author SHA1 Message Date
Konrad fafbf7faa8 .gitignore: keep the test sources, ignore only the binaries
'make check' builds tests/test_<name> next to tests/test_<name>.c, so a plain
'tests/test_*' pattern silently hides new test sources too - the next test
written would have been invisible to git. The sources are un-ignored again.
2026-11-08 14:54:45 +00:00
Konrad 02fcb3c3ba splinter: the cli transport answers again, and .so files leave the index
One-shot mode always installed a stream callback and then, on success, printed
only a newline - correct for the openai transport, which had already streamed the
text, and wrong for every transport that cannot stream. With --transport cli the
answer vanished: 'splinter -p ... --transport cli' printed an empty line and exit
0, so a claude or opencode backend looked like a model that had nothing to say.
The callback is now installed only when the transport publishes send_stream.

  SPLINTER_CLI_CMD=hostname splinter -p 'sag hallo' --transport cli --plugin ...
  kitt

Also: libsplinter.so and plugins/*.so were tracked, so every build produced a
dirty tree (and a conflict on any pull). They are ignored and removed from the
index; the binaries are rebuilt by make.
2026-11-08 14:53:45 +00:00
Konrad 41662a7293 splinter: delegates on other hosts, and the first-run interview
A delegate may name a host; the whole invocation then goes through ssh, so
claude, opencode or another splinter run on that machine. delegate and
delegate_parallel both honour it, and the report names the host like any other
model. The environment does not cross the jump: a cli delegate carries its
command explicitly (quoted, because ssh rejoins its arguments into one remote
shell command), and the remote host supplies its own keys.

Proven: a delegate with host=172.25.206.16 ran on olivia and answered through a
provider only reachable over the wireguard link.

--interview asks seven questions once - language, who you are, stack, style,
what never to do, sacred paths - and writes ~/.splinter/profile/<user>.md. Enter
skips a question and the skip is recorded as a skip. Starting the chat without a
profile prints a hint.

Two bugs found while testing: the stdin intake ate the interview's answers before
it could ask, and the question texts carried literal \n because of how the file
was written - both fixed and verified by running the interview with piped
answers and reading the resulting profile.
2026-11-08 14:50:16 +00:00
Konrad e4f25b481f splinter: sessions belong to a directory, and splinter as an MCP server
Every session records the directory it was started in (<id>.meta, cwd=). With
that, '-c' means the last session that happened *here*:

  cd ~/src/splinter && splinter -c

A session from another tree is never silently loaded; if nothing happened in this
directory yet, it says so and exits. Verified in three directories - two report
no session, the one with history resumes.

folder_history gives the model the folder's memory instead of a guess: sessions
started there, newest first, with turn count and the last question.

--mcp-server-listen IP --mcp-listen-port N serves the registry over MCP
(newline-delimited JSON-RPC on TCP): initialize, tools/list, tools/call. Read
tools are served; mutating and destructive ones are refused unless the server was
started with --autonomous - a remote agent does not run shell commands here
because it asked nicely.

Proven with a real client on 127.0.0.1:8097: handshake answers splinter 0.1.0,
tools/list reports 14 tools, tools/call list returns the directory, tools/call run
is refused with the authorization message.
2026-11-08 14:35:29 +00:00
Konrad bea505b7e5 splinter: piped input, and a bare word as the prompt
cat /etc/passwd | splinter 'explain the file'

stdin becomes context, framed and labelled with its size, so the question and the
bytes stay distinguishable. Binary input is reported as binary instead of being
sprayed into the request; the size is capped at 192 KiB with a truncation mark;
--no-stdin ignores the pipe. Without a prompt the input becomes the prompt.

Two orderings had to be fixed to get there: a bare argument is now the prompt
(splinter "explain this" works without -p), and the read happens before the
config's 'no prompt means start the chat' default - otherwise a pipe with no
prompt opened curses and died on 'initscr: Inappropriate ioctl for device'.

Verified through wire.jsonl: prompt and stdin both in the request, the framed
block present, and 'a\0b' reported as [stdin: 3 bytes of binary data].
2026-11-08 14:24:27 +00:00
Konrad 7fdf2c7ed1 splinter: parallel results carry who, how long, and whether it worked
Every task in a parallel handover now comes back as a header - task, model,
score, duration, exit status, size - followed by the task text and the answer,
and a summary line per model:

  [parallel: 2 task(s), 12018 ms wall]
  ## task 1 | model slow | score 5 | 12018 ms | exit 0 | 75 B | requested tag 'slow'
  ## task 2 | model fast | score 5 | 16 ms | exit 0 | 74 B | requested tag 'fast'
  ## summary
  - slow: 1 task(s), 12018 ms total
  - fast: 1 task(s), 16 ms total

Three bugs found by running it:
 * the wall clock mixed CLOCK_MONOTONIC with time(), which produced a negative
   total;
 * completion was detected through POLLHUP only, so a fast job was marked done
   when the slow one finished - both reported 12018 ms, which is precisely the
   number that must differ;
 * the children's own 'splinter: ...' lines landed in the answer, so every
   delegate looked like it had commented on itself.

Fixed with non-blocking reads plus waitpid(WNOHANG), and a filter for the child's
own diagnostics.
2026-11-08 14:20:22 +00:00
Konrad 61f8abd0d1 splinter: delegate_parallel, several models at once
delegate_parallel takes a list of tasks. Each one picks its own model through the
same scoring as delegate, up to eight are spawned at once, and their pipes are
picked up by one poll loop - nobody waits behind the task in front of them.

Measured against a provider that takes 12 s per answer: two tasks returned in
12 s total, and the observation says so ([parallel: 2 tasks, 12 s]); serial
would have been 24.

max_parallel still applies per delegate: a full delegate skips its task with a
note rather than queueing silently - verified with two tasks on one delegate at
max_parallel 1, where the model reported that only one ran.
2026-11-08 14:11:54 +00:00
Konrad d8c94edb55 splinter: providers from the environment, prio and max_parallel
OLLAMA_KEY, OLLAMA_KEY_0.._N and CLAUDE_CODE_OAUTH_TOKEN, _0.._N are enough to
fill the harness: every Ollama key becomes a delegate and an exit in the ring,
every Claude token becomes a cli delegate running 'claude -p'. Several keys mean
several accounts; the ring walks them.

That is the workflow the tool exists for - a strong model plans and defines the
work, the local models implement it, delegate is the handover:

  OLLAMA_KEY=... CLAUDE_CODE_OAUTH_TOKEN=... splinter --choose 'plane die arbeit'
  claude-3   score=4   prio=10   task mentions 'plan'
  OLLAMA_KEY=... splinter --choose 'implementier das'
  ollama-2   score=3   prio=0    task mentions 'implement'

Delegates also take prio (tie-break, higher wins) and max_parallel (default 1,
a busy delegate says so instead of queueing silently). kind=cli with cmd=... runs
a program instead of an endpoint.

Keys travel in the environment, never on a command line or into a log.
test_config covers the scan, test_delegate the prio tie-break.
2026-11-08 14:05:48 +00:00
Konrad bb365ef08b splinter: the site speaks both languages, from one source
The page was hardcoded German while the program has catalogues - the same
inconsistency the operator keeps finding, this time in the docs.

tools/gen_www.py now holds the skeleton and both languages and writes
index.html (de) and index.en.html (en). A key that exists in one language and
not the other is a hard error, and 'make check' runs the generator with --check,
so a page that no longer matches its source fails the build instead of living on
as a stale copy - exactly the rule the program's own catalogues follow.

Verified: both pages generated (11158 / 10888 bytes), xmllint --html clean, and
both serve 200 on :8099 with a language switch in the header.
2026-11-08 14:00:51 +00:00
Konrad 6872aad60a splinter: a project page that says what this is
The old page described the loop and the plugin ABI and never answered the
question it exists to answer: this is an agent harness with a chat UI, like
Claude Code or opencode, ours to change. That comes first now.

HTML 4.01 Strict, one file, no JavaScript, no fonts to fetch. Every number on it
is taken from the build: 9125 lines, 248568 bytes, 21 test programs, 8 plugins,
42 palettes. The termnial block is a real transcript including the diff.

Served from src/www on :8099 - 200 on loopback, WireGuard and LAN.
2026-11-08 13:57:24 +00:00
Konrad 878c8588e0 splinter: default system prompt with placeholders, reminder plugin
The default prompt says what the code cannot: read the documentation before you
build - README, AGENTS, man pages, the source itself - because a hack that works
against the documented way is a bug with good timing. Also: check what exists,
change the approach instead of repeating a failure, evidence over claims, never
invent output, answer briefly.

Placeholders {{os}}, {{home}}, {{cwd}}, {{model}} are filled at startup, so the
model is told which machine it is on instead of asking.

plugins/reminder puts five short rules back into the conversation every tenth
turn (SPLINTER_REMINDER_EVERY), in front of the newest user message. A rule read
once and buried under forty thousand tokens has stopped existing; one that comes
back is still a rule.

The bug that made both pointless: ag.host was never set, so sp_host_compact was
never called by the real binary. Every compactor - lcm, focus, reminder - was
registered, tested in isolation, and dead in production. 'Compaction happens
before the budget is judged' was true only in the tests.

Verified: with SPLINTER_REMINDER_EVERY=1 the request body contains [reminder]
(checked in wire.jsonl), and the system prompt arrives with the OS and no
leftover {{...}}.
2026-11-08 13:51:48 +00:00
Konrad fb523c7a2c splinter: skills on demand, memory per user, streaming in the gateway
Skills: ~/.splinter/skills plus any skills_dir from the config. Nothing is
preloaded and the system prompt does not grow - the model asks:
skill_search {query} returns names, one-line descriptions and paths;
skill_load {name} returns the file. Both read-only. A miss says what exists
instead of answering with silence.

Memory: memory_search and memory_add against mem0's REST API. Every request
carries user_id, taken from the account the process runs as ($USER, else the
passwd entry) - deliberately not a config key, because a setting is a thing to
forget and the process already knows who it is. A memory written by root is
invisible to lotherk.

Gateway: it ran without a stream callback, so a provider that only speaks SSE
answered with a stream the non-streaming reader could not parse. It now passes a
no-op callback - nobody to stream to, but the transport takes the streaming path.

tests: test_skills (search, directory form, miss, load, unknown name) and
test_memory (user id from environment and fallback).
2026-11-08 13:44:32 +00:00
Konrad 8baa24f37a splinter: typing that actually runs, and a testable API base
Sending 'typing' every four seconds while a turn runs was in the code and never
on the screen: the API base became overridable and the URL format lost the token
on the way, so the gateway could not poll at all. Fixed, and proven against a
fake Telegram API with a slow provider behind it:

  get  /bot.../getUpdates
  typing  00s, 04s, 08s, 12s      (one per four seconds, whole turn)
  message <answer>                (typing stops with the turn)

SPLINTER_TELEGRAM_API now overrides the API base, because a gateway you can only
test in production is a gateway you test in production.
2026-11-08 13:37:36 +00:00
Konrad a720b67cb0 splinter: session logs, slash programs, telegram typing
Logs: every session keeps ~/.splinter/logs/<id>/session.log (readable, in order,
nothing truncated) and wire.jsonl (request bodies and replies). The agent records
the user's words, the answer, the reasoning, every tool call with arguments,
every observation, failures, and the transport records the wire.

Slash programs: anything executable in ~/.splinter/commands/ becomes /name. It
gets the rest of the line as one argument and its output goes to the *model* as
context, not to the operator as a reply. Two bugs found by trying it: the
directory was derived from --session (so a session elsewhere found nothing), and
the whole slash branch only ran when a plugin host existed, so without plugins
/uptime was never even looked at.

Telegram: a typing thread sends sendChatAction every four seconds while a turn
runs - and only while a turn runs, not while a plugin answers a slash command.
The gateway no longer appends to the session twice (the agent already does).

docs/ROADMAP.md lists what is still open, in the order it should be done.
2026-11-08 13:25:53 +00:00
Konrad 3ae2b8f74d splinter: gateway mode, answers on Telegram
--daemon long-polls getUpdates, runs one turn per message and replies. The token
comes from ~/.splinter/telegram.token (0600) or SPLINTER_TELEGRAM_TOKEN, never
from an argument: arguments end up in ps and in shell history.

telegram_allow lists who is answered, comma separated, nobody by default - an
empty list is a refusal, not an open door. Unknown senders are logged without
their text.

The loop survives a failed request instead of dying on it, and keeps no state
beyond the session: a restart re-delivers the last update, which costs one
duplicated answer and never a lost message.

test_telegram covers the token paths (file wins, environment as fallback, empty
file is not a token). Verified against api.telegram.org: the token works and
getMe answers hbx_splinter_bot. Sending needs the user to write first - a bot
cannot start a chat, the API says 'chat not found'.
2026-11-08 13:00:47 +00:00
Konrad 04420d9f8d splinter: exit ring, config next to the sessions, drop-ins
The config moved to ~/.splinter/splinter.conf - next to the sessions, where the
state of this thing already lives - and every *.conf in the directory named after
it is read after it, in name order. A later file overrides an earlier one, an
unknown key is still fatal, and the error now names the file it came from.

plugins/ring is the exit ring: several ways to reach a model, walked in order
when one is rate limited.

  exit = go    | OpenCode Go    | endpoint=... | model=...
  exit = groq  | Groq free tier | endpoint=... | model=... | key_env=GROQ_KEY
  exit = local | kontron, lokal | endpoint=... | model=...

Only pressure moves the ring - 429, 5xx, 'rate limit', 'quota'. A dead host or a
bad key stops the turn, because a ring that treats every failure as 'try the
next one' hides real breakage behind a random provider.

Two things had to be fixed underneath: sp_openai_transport kept its context in a
static variable, so building several transports pointed them all at the last one
(now one heap context per transport), and plugins had no way to read the config
or the registry (sp_host_config, sp_host_registry).

Measured against two fake providers: the first answers 429, the ring moves on and
the second answers 'Antwort vom zweiten Ausgang.'; a dead port does not move it
and the error stands.
2026-11-08 12:55:42 +00:00
Konrad 781e7eb514 splinter: delegation to configured models, chosen by splinter
A delegate is a line in the config - id, what it is good at, tags, endpoint,
model. No profiles: a profile is a directory of files, and this needs a line you
can read at 2 a.m.

The delegate tool takes a task and optional tags. The pick is code, not a guess:
requested tag 5, tag in the task 3, description word 1, ties to the earlier
entry. The observation opens with the choice and the reason, and --choose prints
the same decision without running anything:

  coder   7   task mentions 'code'
  quick   5   task mentions 'chat'
  coder   3   task mentions 'refactor'

The child is splinter itself in one-shot mode - same tools, own context, own
endpoint and model. Classed destructive, because it runs a whole agent; the
operator approves the delegation once.

test_delegate pins the decisions, including the two cases that must not pick
anything: no matching tag and no delegates at all.
2026-11-08 12:38:57 +00:00
Konrad e128d679e4 splinter: write and edit show a diff
A mutate tool that says 'wrote 23 bytes' tells the operator nothing. write and
edit now put a one-hunk diff into the observation - common prefix and suffix as
context - so the model sees what it did and the transcript shows it as its own
'anderung:' entry.

One hunk, not a general diff algorithm: a tool changes one place, and the point
is to see which. Verified against kontron: asking for an edit produced

  @@ -1,2 +1,2 @@
   zeile eins
  -zeile zwei
  +zeile zwei geaendert

and the file on disk really was changed.
2026-11-08 12:32:24 +00:00
Konrad be947d61d8 splinter: resume, and an MCP client
--resume loads the newest session in the directory into the conversation and
shows it. The first version opened a fresh id beside the old one and resumed
nothing while claiming to; it now picks the newest sess-*.jsonl before the id is
generated. Verified: a session that was told 'die Zahl ist 4711' and restarted
with --resume answered '4711' when asked.

plugins/mcp speaks MCP over stdio: handshake, tools/list, and each server tool
registered under its published inputSchema - not an empty object, because a tool
whose parameters the model cannot see gets called with nothing.

Two bugs the tests would not have caught without a real server:
 * the reply id was matched with strstr(), and servers that write "id": 1 lost
   the match - the client waited for a reply it already had;
 * tool descriptions pointed into the parsed reply and dangled once it was
   freed, so the request carried garbage bytes and the endpoint answered 500.

Also SPLINTER_DUMP_REQUEST=<path> now keeps the request body; finding that
garbage meant seeing what was actually sent.
2026-11-08 09:49:12 +00:00
Konrad c8b382c84e splinter: file tools, and approval asked on the screen
The harness had echo, run and clock - a chat with a shell. A coding agent needs
to look at a file, change one, find something, list a directory:

  read   (read)   numbered lines, offset/limit, refuses binary, says where it
                  stopped
  search (read)   literal search over a tree, capped at 100 hits
  list   (read)   a directory
  write  (mutate) up to 4 MiB
  edit   (mutate) exactly one occurrence; a non-unique 'old' is an error
  run    (destructive, already there)

Approval was dead code in the chat: ask_operator() read stdin, which a curses
program cannot do without eating its own keystrokes, so with --autonomous off
every mutate tool was silently denied ('fail closed'). The agent now asks through
a callback; the UI puts the question in the prompt line and parks the turn
thread on a condition variable until y or n arrives.

Measured against kontron: prompt appeared 6 s into the turn, 'y' ran the tool and
the answer carried its output; 'n' left the target file absent and the model saw
'error: denied by operator'.

test_builtin covers the refusals, not just the happy path: ambiguous edit writes
nothing, binary read reports instead of spraying, missing arguments say what is
required. README no longer claims there is no tool-call parser and no compaction.
2026-11-08 09:29:48 +00:00
Konrad fd72b688c1 splinter: Ctrl-C actually cancels, and no fixed /tmp
Pressing Ctrl-C killed the harness. cbreak() leaves ISIG on, so the terminal
driver turned the key into SIGINT and the process died before wgetch() could
return 3 - the 'Ctrl-C cancels' line was a claim, and one keystroke disproved it.
raw() hands every byte to the program.

Cancelling a turn also only took effect between steps, so a request in flight
kept running to completion. The transport used popen(), which returns a stream
and not a process id, so there was nothing to kill. It now forks and execs,
keeps the pid, and both the read loop and the streaming loop poll with a 200 ms
timeout and SIGKILL the child when the turn is cancelled. Measured: Ctrl-C during
a streaming request returns to the prompt in 510 ms and the UI survives.

Temp files no longer use a fixed /tmp path: $TMPDIR, then /var/tmp. Three sites,
including the cli plugin, and they carry the conversation, so the path is now a
512-byte buffer built at runtime instead of a literal.
2026-11-08 09:12:23 +00:00
Konrad c458f02385 splinter: no text reaches the screen without a catalogue
The last literals were the prompt ("> "), the millisecond format and the
placeholder for a missing session id. They are keys now.

More important than those three: the gate was too weak. check_i18n only proved
that keys used in the code exist in the catalogues - a literal drawn straight
into a curses window passed unseen, which is how 'du' or 'denkt' could have
been hardcoded without anyone noticing. It now scans the drawing calls
(mvwaddstr, mvwaddnstr, mvwprintw, waddstr, wprintw, winsstr) and fails on any
literal argument, and it checks that every role passed to add_entry() is one of
the known identifiers that have a role.<name> label.

Proven red before trusting it: with a literal prompt and a role 'benutzer'
injected, the gate reported both and returned 1; restored, it passes. The gate
also runs in make check now - it had been added to a target that no longer
existed.
2026-11-08 08:21:20 +00:00
Konrad 761cc6f612 splinter: the turn grows in place instead of jumping
The reasoning lived in a fixed box at the bottom of the pane and became an entry
when the turn ended, so it started in the wrong half of the screen and then moved
up under the message - exactly what was reported.

A streaming turn is now two entries that grow where they belong: 'denkt' is
created under the last message on the first reasoning chunk and rewritten on
every tick, tool calls are appended between it and the answer, and 'modell' is
created on the first answer chunk and grows in place. At the end nothing is
inserted, nothing shrinks: the reasoning keeps its full text, which also removes
the last jump (the 400-character tail made the block collapse and everything
below it slide up).

The tick dropped to 100 ms while a turn runs, so the text arrives in readable
steps. PgUp/PgDn now scroll the transcript itself instead of a box that no
longer exists.
2026-11-08 08:17:57 +00:00
Konrad 554b4c97b8 splinter: tool calls with arguments, newline-aware rows, complete i18n
Four things, three of them reported by the operator.

1. Rows are counted from the real line structure. The old arithmetic
   (strlen/cols) assumed one long line; a model's reasoning is full of '\n', so
   the true height was far larger than the estimate and the text painted over
   the answer below it - 'it just goes anywhere on the screen'. text_rows() and
   row_offset() split on newlines first, then wrap. entry_lines() now measures
   the string that is actually drawn ('role: text'), which also fixes the last
   character of an entry being cut off (a truncated code fence).

2. Tool calls are visible: the agent's tool_begin hook fires before each call,
   the UI drains the list under its lock and writes 'werkzeug: run
   {"command":"echo a"}' into the transcript; the one at the top of the live
   area shows the call while it runs. The reasoning entry is inserted before
   those lines, so the transcript reads du, denkt, werkzeug, modell.

3. The chat pane has a black background, and the status line sits between the
   pane and the prompt, the way Hermes shows it.

4. i18n is complete: every remaining literal in ui.c, main.c and the plugins
   goes through the catalogue, including widget texts and format strings.
   sp_td() carries a compiled-in English default, so a missing catalogue can
   never drop a printf placeholder. tools/check_i18n.py runs in make check and
   fails when a key used in the code is missing from any catalogue, or when a
   catalogue key is used nowhere.

Seventeen test binaries green.
2026-11-08 08:11:09 +00:00
Konrad 66da9652c6 splinter: fixed live regions, and input history on Up/Down
The reasoning wandered around the screen because its region was computed from
the text length: every new chunk changed the height, so everything above it
moved. The live block now has fixed heights - 8 rows reasoning, 5 answer, 1 tool
line - chosen once per turn. Verified against kontron across three captures of
one turn: the reasoning starts on the same row every time, and when the answer
arrives it lands in its own region below.

Up/Down walk the input history like a shell: kept in memory and appended to
<session_dir>/history, loaded at start, consecutive duplicates collapsed, 128
entries with the oldest dropped. Tested by typing two lines, walking back with
Up twice, and reading the file.
2026-11-08 07:35:14 +00:00
Konrad 9ce0395876 splinter: i18n with plain catalogues, German and English
Not gettext: this harness is meant to start in ten years, and gettext needs
msgfmt at build time and .mo files at runtime. So catalogues are 'key = text'
files in share/locale, read once at startup.

- language from the config key LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=, else SPLINTER_LOCALE, LC_ALL,
  LC_MESSAGES, LANG; regional variants are stripped (de_DE.UTF-8 -> de);
- catalogue search: $SPLINTER_LOCALE_DIR, the executable's own directory (so
   works from any cwd), the source tree, /usr/local/share;
- a missing key falls back to English, and a key that exists nowhere is shown as
  itself - an empty label hides a bug, a visible key does not;
- UI labels, roles, sidebar headings, status line, command errors and the shell
  escape all go through sp_t(); plugins can translate theirs the same way.

test_i18n loads both catalogues from share/locale, checks lookups, the
fallback chain, printf placeholders, and that de.msg covers every key en.msg
has - a translation that silently misses half the UI is worse than none.

Seventeen test binaries green.
2026-11-08 07:28:57 +00:00
Konrad a1011a96da splinter: the live area belongs at the bottom, under the last message
The running turn's reasoning was painted at the top of the chat pane, over the
oldest line on screen, and the streaming answer below it wherever it landed.
Both are bottom-anchored now: history reserves the lines the turn is using,
reasoning sits directly above the answer, tool name on the last line.

The reasoning that stays in the transcript is capped at 400 characters instead
of 1500: a model's plan is not the answer, and at full length it pushed the
answer out of the window - which looked exactly like a broken chat pane.
2026-11-08 07:26:25 +00:00
Konrad c87f7290f5 splinter: thinking in the chat pane, no more ?????
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.
2026-11-08 07:20:42 +00:00
Konrad 34a0152d6c splinter: !command runs a shell command into the conversation
The operator's own shell, one keystroke away and without leaving the UI: '!ls'
runs it, shows the output in the chat and pushes it into the conversation, so
the model works with what was just seen instead of being told about it.

Output is capped at 4 KiB; a command that prints nothing says so with its exit
status instead of looking like a successful silence.
2026-11-07 21:17:06 +00:00
Konrad dc35261ed2 splinter: the theme was unreadable, and here is why
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.
2026-11-07 21:16:14 +00:00
Konrad 8fa3e9d7bb splinter: /goal as a command, and widgets that are actually alive
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.
2026-11-07 20:50:58 +00:00
Konrad 5453b0a85a splinter: focus plugin - the goal every five turns
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.
2026-11-07 20:24:22 +00:00
Konrad 68861460df splinter: a config file, so 'splinter' alone starts the chat
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).
2026-11-07 20:03:17 +00:00
Konrad 95a57fdbbc splinter: exact token counts from the provider's usage block
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.
2026-11-07 19:48:32 +00:00
Konrad 4ce25255a7 splinter: the reasoning gets its own field in the sidebar
A reasoning model spends a minute thinking before it prints a word. That text
was hidden, so a long turn looked like a dead terminal. It now has its own
area in the sidebar: wrapped to the width, bottom-anchored like a log,
scrollable with PgUp/PgDn while it streams, and kept after the turn so you can
read what led to an answer.

Next to it the sidebar counts what the turn produced (characters and an
approximate token count, marked as approximate because the server only reports
the real number at the end).

Measured against kontron (Qwen3.6-35B): at 12 s the field was still empty
(prefill), at 37 s it held the plan in English while the answer came in German -
the model plans in one language and answers in another, which is worth being
able to see.

Also: the thinking field renders through the same ASCII transliteration as the
rest of the UI, so the vendored curses defect does not come back in the one
place that shows the most text.
2026-11-07 19:45:19 +00:00
Konrad 5c07b32478 splinter: streaming, thinking, and three defects the real model exposed
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.
2026-11-07 18:55:16 +00:00
Konrad 50bc6751b2 splinter: real-model fixes, steering, cli transport
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.
2026-11-07 15:43:47 +00:00
Konrad b8295ea474 splinter: compaction as plugins (lcm, cps)
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.
2026-11-07 13:44:43 +00:00
Konrad 15581139d5 splinter: conversation, OpenAI adapter, end-to-end over HTTP
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.
2026-11-07 13:34:26 +00:00
Konrad 424209141b www: describe the harness that exists now, not the kernel it started as
The old page described a loop. The page now shows the layout (chat three
quarters, sidebar one), the plugin ABI with its threading table, the theme
derivation from CDE palettes, and the limits - including that a plugin is not
sandboxed.
2026-11-07 11:53:27 +00:00
Konrad e4f910cc4e splinter: plugin ABI, widget sidebar, libsplinter
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.
2026-11-07 11:47:47 +00:00
Konrad d2e06b316d splinter: curses TUI on NetBSD curses, CDE palettes as themes
The harness now has the interface it was missing: a chat pane on three
quarters of the screen, a sidebar on one quarter, a status bar underneath.

- vendor/netbsd-curses: NetBSD's curses and terminfo, ported edition,
  vendored with PROVENANCE.md. The build of that one directory needs GNU
  make; splinter's own Makefile stays POSIX make.
- tools/genpalettes.py turns CDE's *.dp palette files into a C table. 42
  palettes, generated, checked in with the generator, so the source of every
  colour is a file in the CDE tree and not a guess.
- themes: roles are derived, not invented - background is the darkest of the
  eight colour sets, foreground the lightest, border the second darkest,
  accent the most saturated of the rest, status the accent darkened by a
  third. Delphinium is the default. Unknown palette is an error.
- colours map to the terminal through xterm's 256-colour cube when available,
  the 16 basic colours otherwise, so a palette looks the same everywhere
  within what the terminal can show.
- ui.c redraws only on change; the sidebar shows session, transport, theme
  and last-turn numbers. Widgets are a labelled empty area - the registry
  lands next.

Six test binaries green, including test_theme (42 palettes, ordering
invariants, unknown name rejected, colour indices in range).
2026-11-07 11:27:09 +00:00
Konrad 10e59f23ac splinter 0.1.0: loop, registry, session, transports, tests
Rebuilt from scratch after the previous attempt left no code behind: what
exists here is what compiles and what the tests prove, and nothing else is
claimed.

What is in it:
- a turn loop that refuses an over-budget request before sending it, reports
  unknown tools instead of guessing, and honours authorization classes
  (read runs, mutate/destructive ask unless --autonomous);
- a registry that is authoritative - the model names a tool, the registry
  decides whether it exists;
- an append-only JSONL session (O_APPEND, fsync per record), where a crash can
  only truncate the tail and the tail is skipped, not repaired;
- two transports: a deterministic mock (queue of replies, last request kept)
  and HTTP via curl(1) with the request body in a temp file;
- two builtins that exist to prove the classes: echo (read) and run
  (destructive, reports its exit status as an observation).

Five test binaries, no external framework, no network: mock driver covers the
answer path, a tool round, an unknown tool, a denial, autonomy, a failing tool,
the step limit, the byte budget (asserting that nothing was sent) and a
non-2xx reply.

The wire format is splinter's own line protocol (user/observe out,
answer/tool in); provider adapters translate. That is why the loop is testable
without a model, and why no vendor JSON is parsed in the core.
2026-11-07 08:06:34 +00:00
Konrad f574313ad5 splinter: CHAOS.md — every idea from the three agent-harness attempts
Collected on 2026-11-06 while planning an own harness: MikroAgent (92 items
across transport, loop, persistence, tools, compaction, budget, limits,
audit, endpoint policy, build/test), OpenITT (invariants, disk-backed
streaming, compression with retrieval, session format, memory accounting,
long-input + linecomp + notes loop) and agentk (context-engine vtable, LCM
pipeline, summary DAG, structural pre-cleanup, ObservationPack, prompt
cache, threaded reactor), plus the points where the three disagree and the
tool-call robustness gap measured on the MacBook.
2026-11-07 05:13:15 +00:00