220 lines
18 KiB
HTML
220 lines
18 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<meta name="color-scheme" content="light dark">
|
|
<title>splinter — an agent harness in C99</title>
|
|
<meta name="description" content="Agent harness in C99/POSIX: curses chat, tools with authorization classes, plugins, any OpenAI-compatible endpoint, MCP, A2A and a Telegram gateway.">
|
|
<style>
|
|
:root{
|
|
--bg:#e3e7ec; --panel:#d6dce4; --ink:#17202b; --dim:#4d5a69; --rule:#aab4c0;
|
|
--acc:#1d5f80; --read:#2a6f97; --mut:#9a5b0c; --des:#a3282b; --term:#0f1720; --termink:#d3dce6;
|
|
--serif:Charter,"Bitstream Charter","Iowa Old Style","Palatino Linotype",Palatino,Georgia,serif;
|
|
--mono:ui-monospace,"DejaVu Sans Mono","Liberation Mono",Menlo,Consolas,monospace;
|
|
}
|
|
@media (prefers-color-scheme:dark){:root{
|
|
--bg:#141a22; --panel:#1c242f; --ink:#d9e0e8; --dim:#93a0af; --rule:#334050;
|
|
--acc:#7dbbd8; --read:#6fb0d6; --mut:#e0a24f; --des:#ee7b7e; --term:#0b1016; --termink:#cfd8e2;}}
|
|
*{box-sizing:border-box}
|
|
html{-webkit-text-size-adjust:100%}
|
|
body{margin:0;background:var(--bg);color:var(--ink);font:1.0625rem/1.62 var(--serif)}
|
|
a{color:var(--acc);text-underline-offset:.18em}
|
|
a:focus-visible,summary:focus-visible{outline:2px solid var(--acc);outline-offset:3px}
|
|
code,pre,.m{font-family:var(--mono)}
|
|
code{font-size:.88em;background:var(--panel);padding:.08em .32em}
|
|
.bar{display:flex;justify-content:space-between;gap:1rem;padding:.55rem 1rem;border-bottom:1px solid var(--rule);font:.8rem var(--mono);color:var(--dim)}
|
|
.bar a{color:var(--dim)} .bar b{color:var(--ink);font-weight:600}
|
|
.shell{display:grid;grid-template-columns:minmax(0,1fr);max-width:68rem;margin:0 auto;padding:0 1rem}
|
|
nav.rail{display:none}
|
|
main{min-width:0;max-width:44rem;padding:2.5rem 0 5rem}
|
|
@media (min-width:62rem){
|
|
.shell{grid-template-columns:11.5rem minmax(0,1fr);gap:3rem}
|
|
nav.rail{display:block;position:sticky;top:0;align-self:start;padding:2.6rem 0;font:.85rem/1.9 var(--mono)}
|
|
nav.rail a{display:block;color:var(--dim);text-decoration:none;border-left:2px solid var(--rule);padding-left:.8rem}
|
|
nav.rail a:hover{color:var(--ink);border-color:var(--acc)}
|
|
}
|
|
h1{font:700 clamp(3rem,11vw,5.2rem)/.95 var(--serif);letter-spacing:-.035em;margin:.2em 0 .25em}
|
|
h2{font:700 1.45rem/1.2 var(--serif);margin:3.2rem 0 .8rem;padding-top:1.2rem;border-top:1px solid var(--rule)}
|
|
h3{font:600 1rem var(--serif);margin:1.5rem 0 .3rem}
|
|
p{margin:.8em 0} .lead{font-size:1.28rem;line-height:1.5}
|
|
.dim{color:var(--dim)} .small{font-size:.9rem}
|
|
pre{background:var(--term);color:var(--termink);margin:1.2rem 0;padding:1rem 1.1rem;overflow-x:auto;font-size:.82rem;line-height:1.55;border-left:4px solid var(--acc)}
|
|
pre .u{color:#fff;font-weight:600} pre .d{color:#7f8ea0} pre .r{color:#7fbfe6} pre .a{color:#f0b35e} pre .x{color:#ff8f92}
|
|
@media (prefers-color-scheme:dark){pre .u{color:#fff}}
|
|
.tw{overflow-x:auto;margin:1.1rem 0}
|
|
table{border-collapse:collapse;width:100%;font-size:.93rem}
|
|
th{text-align:left;font-weight:600;color:var(--dim);padding:.3rem .7rem;border-bottom:1px solid var(--rule)}
|
|
td{padding:.42rem .7rem;border-bottom:1px solid var(--rule);vertical-align:top}
|
|
td:first-child{font:.82rem var(--mono);white-space:nowrap}
|
|
tr.r td:first-child{box-shadow:inset 4px 0 var(--read)} tr.a td:first-child{box-shadow:inset 4px 0 var(--mut)} tr.x td:first-child{box-shadow:inset 4px 0 var(--des)}
|
|
@media (max-width:40rem){table,tbody,tr,td{display:block}tr:first-child{display:none}tr{border-bottom:1px solid var(--rule);padding:.35rem 0}td{border:0;padding:.1rem .7rem}td:first-child{white-space:normal;overflow-wrap:anywhere}}
|
|
.key{display:flex;flex-wrap:wrap;gap:.4rem 1.4rem;font:.82rem var(--mono);margin:.8rem 0}
|
|
.key span:before{content:"";display:inline-block;width:.9rem;height:.5rem;margin-right:.45rem;background:var(--c)}
|
|
dl{margin:1rem 0} dt{font:600 .9rem var(--mono);margin-top:1rem} dd{margin:.15rem 0 0}
|
|
ul{padding-left:1.2rem} li{margin:.3rem 0}
|
|
.cols{display:grid;gap:0 2rem;grid-template-columns:repeat(auto-fit,minmax(15rem,1fr))}
|
|
footer{border-top:1px solid var(--rule);margin-top:4rem;padding-top:1.2rem;font-size:.88rem;color:var(--dim)}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="bar"><span><b>splinter</b>(1)</span><span class="langs"><a href="index.html">de</a> <b>en</b> <a href="index.pt.html">pt-BR</a></span></div>
|
|
<div class="shell">
|
|
<nav class="rail" aria-label="Sections">
|
|
<a href="#checks">checks</a><a href="#tools">tools</a><a href="#models">models</a><a href="#plugins">plugins</a><a href="#agents">other agents</a><a href="#telegram">telegram</a><a href="#files">config & logs</a><a href="#build">build</a><a href="#not">not</a>
|
|
</nav>
|
|
<main>
|
|
<h1>splinter</h1>
|
|
<p class="lead">An agent harness in C99. It sits between you and a model, runs the tools the model asks for, and decides which of them may run. You can read all of it.</p>
|
|
<p>Chat in a curses terminal, one-shot from a pipe, or over Telegram. Any endpoint that speaks the OpenAI chat API, any program that prints an answer, or another agent over A2A. Tools declare what they may do; the harness enforces it and tells the model what it refused.</p>
|
|
|
|
<pre><span class="d"># illustrative transcript, not a log</span>
|
|
<span class="u">you</span> set the version in Makefile to 0.2.0
|
|
<span class="u">tool</span> read {"path":"Makefile"} <span class="r">read</span>
|
|
<span class="u">tool</span> edit {"path":"Makefile","old":"0.1.0","new":"0.2.0"} <span class="a">mutate</span>
|
|
<span class="u">ask</span> edit Makefile ? [y/N] <span class="x">n</span>
|
|
<span class="u">seen</span> error: denied by operator <span class="d">← this is what the model reads</span>
|
|
<span class="u">model</span> I was not allowed to edit it. Say so if I should try again.</pre>
|
|
<p class="small dim">About 29,500 lines of C (as of 2026-11-11), 16 plugins, 35 test programs. BSD-3-Clause.</p>
|
|
|
|
<h2 id="checks">Three checks before a tool runs</h2>
|
|
<dl>
|
|
<dt>Budget</dt><dd>Before every request the conversation is measured against the configured byte budget. If it does not fit, plugins such as <code>lcm</code> may compact it first. If it still does not fit, nothing is sent and the turn fails, instead of letting an endpoint truncate silently.</dd>
|
|
<dt>Registry</dt><dd>A tool name that does not exist becomes an observation for the model, not a crash and not a guess.</dd>
|
|
<dt>Authorization class</dt><dd>Each tool declares <em>read</em>, <em>mutate</em> or <em>destructive</em>. The tool says so, not the model and not the prompt. Mutating and destructive calls need your consent unless you started with <code>--autonomous</code>. A plugin can sit in front as a gate: allow, refuse with a reason, or have no opinion. The kid-mode plugin is one.</dd>
|
|
</dl>
|
|
<p>A refusal is never silent. It comes back to the model as the tool's observation, so the model can react to it.</p>
|
|
|
|
<h2 id="tools">Tools</h2>
|
|
<p>41 are built in or shipped as plugins. An MCP server can add more at runtime.</p>
|
|
<div class="key"><span style="--c:var(--read)">read</span><span style="--c:var(--mut)">mutate</span><span style="--c:var(--des)">destructive</span></div>
|
|
<div class="tw"><table>
|
|
<tr><th>tool</th><th>what it does</th></tr>
|
|
<tr class="r"><td>read, search, list</td><td>Numbered lines with offset and limit, refuses binaries. Literal search, at most 100 hits. Directory listing.</td></tr>
|
|
<tr class="a"><td>write, edit</td><td>Write a file, with the diff in the observation. Edit replaces exactly one occurrence; an ambiguous match is an error.</td></tr>
|
|
<tr class="x"><td>run</td><td>A shell command. The exit status is an observation.</td></tr>
|
|
<tr class="r"><td>websearch</td><td>Web search.</td></tr>
|
|
<tr class="a"><td>webfetch</td><td>Fetch a URL.</td></tr>
|
|
<tr class="r"><td>folder_history</td><td>What last happened in this directory, so the model does not guess.</td></tr>
|
|
<tr class="r"><td>skill_search, skill_load</td><td>Find installed skills, read one in full. Nothing is preloaded.</td></tr>
|
|
<tr class="r"><td>memory_search</td><td>Your memories on a mem0 server, kept apart per user.</td></tr>
|
|
<tr class="a"><td>memory_add</td><td>Remember one fact.</td></tr>
|
|
<tr class="x"><td>delegate, delegate_parallel, delegate_submit, delegate_retry</td><td>Hand work to another model: one task, several at once, as a background job, or retry a failure.</td></tr>
|
|
<tr class="r"><td>delegate_list, delegate_jobs, delegate_result, delegate_due</td><td>List delegates, see jobs, collect a result, see what is due.</td></tr>
|
|
<tr class="x"><td>task_start, task_kill</td><td>Run a shell command in the background (four at a time) or stop it.</td></tr>
|
|
<tr class="r"><td>task_list, task_result</td><td>Background jobs and their output.</td></tr>
|
|
<tr class="a"><td>plan_task_add, plan_task_update</td><td>A persistent to-do list for the session.</td></tr>
|
|
<tr class="r"><td>plan_task_list</td><td>Read that list.</td></tr>
|
|
<tr class="x"><td>tmux_start</td><td>Start a command in a detached tmux session and make it the target.</td></tr>
|
|
<tr class="a"><td>tmux_send, tmux_ask</td><td>Type into it (text or keys such as C-c), wait for new output and return only the new lines.</td></tr>
|
|
<tr class="r"><td>tmux_status, tmux_capture, tmux_read</td><td>Look at the pane and read what is new.</td></tr>
|
|
<tr class="x"><td>a2a_send, a2a_cancel_task</td><td>Message another agent (optionally with a file) or cancel its task.</td></tr>
|
|
<tr class="r"><td>a2a_get_task, a2a_subscribe</td><td>Read another agent's task and its events.</td></tr>
|
|
<tr class="r"><td>echo, clock</td><td>Small utilities.</td></tr>
|
|
</table></div>
|
|
|
|
<h2 id="models">Models</h2>
|
|
<p>A transport turns the harness's plain line protocol into whatever the other side speaks. The loop never sees a vendor API, which is why <code>make check</code> runs against a scripted mock with no network and no key.</p>
|
|
<dl>
|
|
<dt>openai</dt><dd>Any OpenAI-compatible endpoint, streaming over SSE. HTTP goes through <code>curl(1)</code>.</dd>
|
|
<dt>cli</dt><dd>Any program as the model, for example <code>claude -p</code>.</dd>
|
|
<dt>a2a</dt><dd>Another agent over A2A.</dd>
|
|
<dt>ring</dt><dd>An exit ring. On a 429 or a limit, the next configured exit takes over.</dd>
|
|
</dl>
|
|
<h3>Delegation</h3>
|
|
<p>The model can hand work to another model. splinter picks one: a requested tag scores 5, a tag found in the task text 3, a word from the delegate's description 1. The observation opens with the choice and the reason, so a wrong pick is visible.</p>
|
|
<pre><span class="d"># ~/.splinter/splinter.conf.d/20-delegates.conf</span>
|
|
delegate = coder | C99, POSIX, review | tags=code,c99 | endpoint=... | model=...
|
|
delegate = quick | short answers | tags=chat,cheap | endpoint=... | model=...
|
|
|
|
<span class="u">$</span> splinter --choose "check this C code for memory errors"
|
|
coder 7 task mentions 'code'</pre>
|
|
<p><code>delegate_parallel</code> sends up to eight tasks at once. The report names who answered, how long it took and the exit status for each, so a slow or failing delegate shows in the header.</p>
|
|
<pre>[parallel: 2 task(s), 12018 ms wall]
|
|
## task 1 | model slow | score 5 | 12018 ms | exit 0 | 75 B
|
|
## task 2 | model fast | score 5 | 16 ms | exit 0 | 74 B</pre>
|
|
<p>A delegate may name a <code>host=</code>. The whole call then goes over ssh, so claude, opencode or another splinter runs where the model or the network is, with that machine's own keys.</p>
|
|
<pre>delegate = remote | on another box | tags=remote | host=build.example.org | endpoint=... | model=...</pre>
|
|
|
|
<h2 id="plugins">Plugins</h2>
|
|
<p>A plugin is a <code>.so</code> loaded with dlopen. It can register tools, slash commands, sidebar widgets, transports and gates. A widget's tick runs on its own thread; only the UI thread draws. The ABI is in <code>docs/PLUGINS.md</code>. Plugins run in the process with your rights.</p>
|
|
<div class="cols"><ul>
|
|
<li><b>lcm</b>, <b>cps</b>: compact the conversation</li>
|
|
<li><b>focus</b>: reminds the model of <code>/goal</code> every N turns</li>
|
|
<li><b>reminder</b>: puts the ground rules back every 10 turns</li>
|
|
<li><b>ring</b>: next exit on 429 or limit</li>
|
|
<li><b>mcp</b>, <b>a2a</b>, <b>cli</b>: reach other tools and agents</li>
|
|
<li><b>provider</b>: add a provider while running</li>
|
|
</ul><ul>
|
|
<li><b>tasks</b>: background shell jobs</li>
|
|
<li><b>planner</b>: the session's to-do list</li>
|
|
<li><b>tmux</b>: drive a program that wants a terminal</li>
|
|
<li><b>scheduler</b>: timed work</li>
|
|
<li><b>status</b>: context, tokens per second, cost if you set prices</li>
|
|
<li><b>kids</b>: kid mode</li>
|
|
<li><b>clock</b>: a sidebar clock and a tool</li>
|
|
</ul></div>
|
|
|
|
<h2 id="agents">Other agents, both ways</h2>
|
|
<h3>MCP</h3>
|
|
<p>As a client, splinter takes an MCP server's tools with the server's own schemas. As a server it offers its own tools to others:</p>
|
|
<pre><span class="u">$</span> splinter --mcp-server-listen 127.0.0.1 --mcp-listen-port 8098</pre>
|
|
<p>It answers <code>initialize</code>, <code>tools/list</code> and <code>tools/call</code>. It serves read tools. Mutating and destructive ones only run with <code>--autonomous</code>, so a foreign agent does not get a shell just by asking.</p>
|
|
<h3>A2A</h3>
|
|
<pre><span class="u">$</span> SPLINTER_A2A_SERVER_TOKEN=... splinter --a2a-server-listen 127.0.0.1 --a2a-listen-port 8099</pre>
|
|
<ul>
|
|
<li><code>POST /a2a</code> takes <code>SendMessage</code>, <code>SendStreamingMessage</code> (SSE), <code>GetTask</code>, <code>ListTasks</code> and <code>SubscribeToTask</code>. The agent card is at <code>/.well-known/agent-card.json</code>.</li>
|
|
<li>A <code>contextId</code> is a conversation. Without one, the server makes one and returns it.</li>
|
|
<li>A mutating tool pauses the task as <code>INPUT_REQUIRED</code>. A follow-up with the <code>taskId</code> and <code>yes</code> or <code>no</code> resumes it. <code>CancelTask</code> stops it.</li>
|
|
<li>A push notification config posts the finished task to a webhook (loopback, or hosts in <code>SPLINTER_A2A_PUSH_ALLOW</code>).</li>
|
|
<li>Binary file parts land in <code>inbox/</code> and the model is told the path. URL parts are fetched only from allowed hosts.</li>
|
|
<li>Beyond loopback a bearer token is required.</li>
|
|
<li>As a client, <code>a2a_send</code> can attach a file and <code>a2a_subscribe</code> reads a remote task's events.</li>
|
|
</ul>
|
|
|
|
<h2 id="telegram">Telegram</h2>
|
|
<p><code>splinter --daemon</code> long-polls <code>getUpdates</code>, runs one turn per message and answers with the same slash commands as the terminal. The token is read from a 0600 file or the environment, never from an argument. Only user ids listed in <code>telegram_allow</code> get an answer.</p>
|
|
<ul>
|
|
<li>Consent arrives as Yes/No buttons. The text reply <code>ok <id></code> still works.</li>
|
|
<li><code>/model</code> switches between configured models; <code>/model probe</code> asks the endpoints for <code>/v1/models</code>. <code>/connect</code> asks for name, endpoint, model and key variable, runs a test turn and writes the provider into <code>splinter.conf.d</code>. <code>/new</code> starts a fresh conversation. <code>/interview</code> asks the setup questions in the chat.</li>
|
|
<li>Answers are sent as Telegram HTML: bold, italic, code, links, quotes and tables as monospace columns. Markdown images go out as photos, other local files as documents. A piece Telegram cannot parse is sent as plain text rather than lost.</li>
|
|
<li>Programs in <code>~/.splinter/commands/</code> become <code>/name</code> and show up in the bot's menu.</li>
|
|
</ul>
|
|
<h3>Kid mode</h3>
|
|
<p>With the <code>kids</code> plugin, every change needs a parent's approval by Telegram, a whitelist lets harmless calls through, the model is reminded of an age-appropriate tone on each request, and a daily minute budget ends the day when it is spent.</p>
|
|
|
|
<h2 id="files">Config, logs, ways in</h2>
|
|
<pre><span class="d"># ~/.splinter/splinter.conf (plus splinter.conf.d/*.conf, in name order)</span>
|
|
endpoint = http://127.0.0.1:8080/v1/chat/completions
|
|
model = my-model
|
|
locale = en
|
|
theme = Delphinium
|
|
telegram_allow = 123456789
|
|
plugin = plugins/lcm/lcm.so</pre>
|
|
<p>It is plain <code>key = value</code>. An unknown key stops startup with the file and line, because a typo that does nothing is a config that lies. Command line beats file beats default.</p>
|
|
<pre><span class="d">~/.splinter/logs/<session>/session.log</span> readable, in order
|
|
<span class="d">~/.splinter/logs/<session>/wire.jsonl</span> every request and reply, raw</pre>
|
|
<p>Words, reasoning, every tool call with its arguments, every observation, errors and token counts. Nothing is cut, because a log that keeps only the good parts cannot explain a bad turn.</p>
|
|
<pre><span class="u">$</span> cat /etc/passwd | splinter "explain this file"
|
|
<span class="u">$</span> cd ~/src/project && splinter -c <span class="d"># last session that happened here</span>
|
|
<span class="u">$</span> splinter --interview <span class="d"># once: language, style, off-limits paths</span></pre>
|
|
<p>Standard input becomes framed, size-capped context. Skills live in <code>~/.splinter/skills/</code> and are found on demand. When several splinters run in one directory, <code>/swarm</code> sends a line to the least busy one. The interface has 42 CDE colour palettes and is translated to German, English and Brazilian Portuguese; a missing translation fails <code>make check</code>.</p>
|
|
|
|
<h2 id="build">Build</h2>
|
|
<pre><span class="u">$</span> make <span class="d"># libsplinter.so, the binary, the plugins</span>
|
|
<span class="u">$</span> make check <span class="d"># 35 test programs, shell tests, i18n check; no network, no model</span>
|
|
<span class="u">$</span> splinter</pre>
|
|
<p>POSIX make and a C99 compiler, <code>-Wall -Wextra -Werror</code>. NetBSD curses is in the tree. At run time splinter calls <code>curl(1)</code> for HTTP. Manual: <code>man ./docs/splinter.1</code>.</p>
|
|
|
|
<h2 id="not">What it is not</h2>
|
|
<ul>
|
|
<li>Not a model. It ships none and chooses none for you.</li>
|
|
<li>Not a cloud. It talks to the endpoints you list.</li>
|
|
<li>Not a sandbox. The classes protect you from the model, not from code you chose to load.</li>
|
|
</ul>
|
|
<footer>splinter, BSD-3-Clause. Plugin ABI: <code>docs/PLUGINS.md</code>. Config: <code>docs/CONFIG.md</code>.</footer>
|
|
</main>
|
|
</div>
|
|
</body>
|
|
</html>
|