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.
splinter
A C99/POSIX agent harness with a curses interface: chat on three quarters of the screen, a sidebar on one quarter, plugins that can put tools and widgets into both.
make # libsplinter.so, the binary, the example plugin
make check # seven test binaries
./splinter --chat --plugin plugins/clock/clock.so --script replies.txt
What it does
splinter -p "list the C files" --endpoint http://127.0.0.1:8080/turn sends a
prompt, runs the tools the transport asks for, and prints the answer. Every turn
is appended to ~/.splinter/<id>.jsonl as one JSON object per line.
What it refuses to do
- Send a request that exceeds the configured byte budget (nothing is sent; the turn fails instead of letting an endpoint truncate silently).
- Run a tool that is not in the registry (the model is told, not guessed at).
- Run a mutating or destructive tool without operator consent, unless
--autonomouswas given. - Skip a denial silently: the denial becomes the observation the model sees.
Protocol
The harness speaks a line protocol with its transport, not a vendor API:
request user <text>
request observe <tool> <output>
reply answer <text>
reply tool <name> <arguments>
A provider adapter translates an OpenAI-compatible endpoint into this shape and
back. That is why make check needs no network, no key and no model: the mock
transport replays replies.
Layout
libsplinter.so every symbol, once; binary and plugins link to it
include/splinter.h the core interface
include/splinter_plugin.h plugin ABI and host API
src/plugin.c dlopen loader, widget registry, worker threads
src/ui.c curses UI: chat 3/4, sidebar 1/4, status bar
src/theme.c CDE palettes -> terminal colours
src/palettes.c generated from CDE's *.dp files
tools/genpalettes.py the generator
plugins/clock/ example plugin: sidebar clock + a tool
vendor/netbsd-curses/ NetBSD curses and terminfo, vendored
docs/PLUGINS.md the ABI, the threading rules
src/buf.c growable buffer, JSON escaping
src/tool.c registry
src/session.c append-only JSONL session
src/transport.c deterministic mock transport
src/transport_curl.c HTTP via curl(1), request body through a temp file
src/builtin.c echo (read) and run (destructive)
src/agent.c the loop
src/main.c CLI
tests/ five test binaries, run by `make check`
docs/splinter.1 manual page
src/www/index.html HTML 4.01 static page
Plugins and themes
A plugin is a .so against libsplinter.so, exporting
sp_plugin_describe(). It can register tools (with authorization classes the
loop enforces) and widgets (rendered in the sidebar). A widget's tick() runs
on its own thread and publishes text; only the UI thread draws. See
docs/PLUGINS.md.
Themes are CDE palettes: 42 of them, generated from the desktop's own .dp
files. Roles are derived from the eight colour sets — darkest is the
background, lightest the foreground, the most saturated the accent. Default is
Delphinium. --list-themes prints the names, --theme NAME picks one.
Limits, stated
- Tool arguments reach the tool as one string; each tool validates its own.
- The loop has no JSON tool-call parser yet. Wire formats live in adapters, so the loop stays testable; an OpenAI adapter is the next piece.
- No compaction, no retrieval tiers. When a turn does not fit the budget it fails loudly, which is the honest behaviour until compaction exists.
- A
tick()that never returns hangs the exit: the host can stop a thread only between ticks, not inside one. - Plugins are not sandboxed. They run in the process with full rights; the authorization classes protect the harness from the model, not from code you chose to load.
License
BSD-3-Clause.