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

splinter

A small C99/POSIX agent harness: one turn, a tool registry, explicit authorization classes, an append-only session log.

make
make check

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 --autonomous was 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

include/splinter.h      the whole interface
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

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.

License

BSD-3-Clause.

S
Description
splinter (from the Thinkpad, ~/src/splinter)
Readme
9.3 MiB
0 Stars 3 Watchers 0 Forks
Languages
C 87.6%
Shell 6.1%
Python 2.7%
HTML 2.4%
Makefile 1.2%