The 900 s wait was not the defect -- a person reads and thinks. Being hard coded was: a run with no operator attached (an older protocol client that does not know SP_EV_ASK, a script) lost the turn for fifteen minutes and nobody could shorten it. Measured before the change: a client that ignores the event saw the question and then no turn for 10 s. sp_ask_wait_s() reads $SPLINTER_ASK_TIMEOUT, then ask_timeout from the config, then SP_ASK_WAIT_S = 900. No upper bound: how long a turn may wait is the operator's call. Consumers: engine_ask, tg_ask. protocol.c also dropped sp_engine_answer's return value, so an answer that arrived after the question was gone (wait expired, turn cancelled) looked accepted. It now reports "no question is pending", as steer already did. Test evidence: - tests/test_ask_timeout.sh (new, wired into make check): with SPLINTER_ASK_TIMEOUT=3 the turn returns in 3 s with the "no answer" observation instead of parking. Proven red against the old code (env ignored: 5 FAILs, the client got no turn at all) and green on the fix. - ask_timeout in the config file takes effect too: measured 3.1 s against a running --serve, so the docs line is not a claim. - sp_ask_wait_s() edge cases: unset/0/-5/abc -> 900, 1 -> 1, 42 -> 42, 999999999999 -> clamped. - make check green (336 s), make check-asan and check-tsan clean (46 binaries each).
616 lines
29 KiB
Markdown
616 lines
29 KiB
Markdown
# Configuration
|
|
|
|
Splinter reads one file, so that `splinter` alone is enough to start working.
|
|
|
|
```
|
|
~/.splinter/splinter.conf
|
|
```
|
|
|
|
next to the sessions. If that file does not exist, an older install's
|
|
`$XDG_CONFIG_HOME/splinter/config` (or `~/.config/splinter/config`) is read
|
|
instead.
|
|
|
|
`SPLINTER_CONFIG=/path` overrides the location, `--config PATH` does the same
|
|
for one run, `--no-config` ignores the file entirely, and `--init-config`
|
|
writes a commented example.
|
|
|
|
## Format
|
|
|
|
Blocks with `{ }`, settings as `name = value`, lists in `[ ]`, `#` starts a
|
|
comment, `"${NAME}"` inserts an environment variable. Not JSON, on purpose —
|
|
this file gets edited by hand, and a missing comma must not be the reason the
|
|
harness will not start. An error names the line you wrote.
|
|
|
|
```
|
|
core {
|
|
default = provider/model # a provider, provider/model, or a pool
|
|
theme = Xresources
|
|
autonomous = true
|
|
steps = 60
|
|
on_limit = wait # a usage limit is waited out (or: fail)
|
|
max_wait = 2d
|
|
}
|
|
|
|
plugin lcm { } # one block per plugin, see "Plugins"
|
|
plugin cli { }
|
|
|
|
telegram { allow = [123456789] }
|
|
|
|
provider ocgo {
|
|
about = "fast and cheap, good at planning"
|
|
tags = [cloud, code, fast]
|
|
endpoint = https://api.example.org/v1
|
|
model = some-model
|
|
key_env = EXAMPLE_API_KEY
|
|
prio = 10
|
|
limit = 100/5h
|
|
}
|
|
provider claude-a {
|
|
kind = cli
|
|
cmd = "claude -p"
|
|
tags = [cli, big]
|
|
limit = 40/5h
|
|
env { CLAUDE_CODE_OAUTH_TOKEN = "${CLAUDE_A_TOKEN}" }
|
|
}
|
|
provider anthropic-a {
|
|
kind = anthropic
|
|
about = "Claude via the API, account A"
|
|
tags = [analyze, decide, review, big]
|
|
endpoint = https://api.anthropic.com/v1
|
|
model = claude-sonnet-5-5
|
|
limit = 40/5h
|
|
key = "sk-ant-oat01-..." # or key_env = CLAUDE_CODE_OAUTH_TOKEN
|
|
}
|
|
|
|
pool claude { members = [claude-a, claude-b, anthropic-a] strategy = balance }
|
|
```
|
|
|
|
`kind` says which shape the endpoint speaks:
|
|
|
|
| kind | endpoint | auth |
|
|
|-------------|--------------------------------------------|-------------------------------------------------------------|
|
|
| `openai` (default) | `.../v1` (POSTs to `/chat/completions`) | `Authorization: Bearer`, from `key_env` or `key` |
|
|
| `anthropic` | `https://api.anthropic.com/v1` (POSTs to `/messages`) | `sk-ant-oat...` as a Bearer token with the oauth beta (a Claude Code token); `sk-ant-api...` as `x-api-key` |
|
|
| `cli` | none; a program (`cmd`) | its own, from `env { }` |
|
|
|
|
A `cli` provider can take its model from `-m` like any other:
|
|
|
|
```
|
|
provider occli {
|
|
kind = cli
|
|
cmd = "opencode run" # {model} marks where the model goes
|
|
provider = opencode # prefix for a bare model name
|
|
model = big-pickle # the default
|
|
}
|
|
```
|
|
|
|
`-m occli` runs `opencode run --model opencode/big-pickle`,
|
|
`-m occli/deepseek-v4.1-flash-free` runs `... --model
|
|
opencode/deepseek-v4.1-flash-free`, and a model that already has a `/`
|
|
(`-m occli/opencode-go/kimi-k2`) is passed as it is. Without `{model}` in
|
|
`cmd` the model is appended as `--model`; without any model the command runs
|
|
unchanged. A model name may hold only letters, digits and `._:/@+-`, since the
|
|
command goes through `/bin/sh`.
|
|
|
|
A `kind = anthropic` provider is called directly, without the `claude` CLI:
|
|
tools become `tool_use` blocks, their observations `tool_result` blocks, and
|
|
the system prompt is sent as the top-level `system` field. One provider per
|
|
OAuth token, one pool over them, and `-m POOL` spreads the work over the
|
|
accounts. An `sk-ant-oat` token gets Claude Code's first system block added,
|
|
because the API refuses such a token without it (with a 429 whose message is
|
|
only "Error").
|
|
|
|
Blocks: `core` (everything that is not a provider; bare `name = value` lines at
|
|
the top level also go there), `telegram`, `provider NAME`, `pool NAME`,
|
|
`exit NAME`. A provider is anything the run or a delegation can talk to: the
|
|
fields are the ones of `delegate =` below, plus `delegate = false` to keep it
|
|
out of delegation. Several files work: every `splinter.conf.d/*.conf` is read
|
|
too, each in either format.
|
|
|
|
The older flat form (`key = value` per line, `delegate = id | text | k=v`)
|
|
still loads, and is what the tables below describe key by key.
|
|
|
|
## Choosing a model: `-m` and `--model-list`
|
|
|
|
```
|
|
splinter --model-list # everything -m takes; asks each endpoint what it serves
|
|
splinter -m claude # a pool (the member with the most left)
|
|
splinter -m ocgo # a provider
|
|
splinter -m ocgo/other-model # a provider with another of its models
|
|
splinter -m some-model-name # a model that one provider has
|
|
```
|
|
|
|
Without `-m`, `default` in `core` decides. The order is: `-m` on the command
|
|
line, then the last `default` from the config and its drop-ins (a `/model`
|
|
choice writes one), then the `endpoint`/`model` of the `core` block (the main
|
|
endpoint). An explicit `default` is never shadowed by a core endpoint.
|
|
|
|
## Agent profiles: build, plan and your own
|
|
|
|
Tab in the chat (Shift-Tab back) switches the agent profile, like opencode.
|
|
The prompt carries the name (`plan> `), the transcript notes the switch,
|
|
`/agent` lists them, `/agent NAME` picks one, `splinter --agent NAME` starts in
|
|
one and `--agent-list` prints them.
|
|
|
|
- `build` is the default: every tool.
|
|
- `plan` reads, searches and analyses, changes nothing (tools of the class
|
|
read only, plus `delegate*` and `plan_task_*`), and ends with a plan.
|
|
|
|
Your own are markdown files, `NAME.md`, with front matter like opencode's:
|
|
|
|
```
|
|
---
|
|
description: Reviews code without touching it
|
|
model: analyst # what -m takes: provider, pool, provider/model
|
|
tools: read # all (default) | mutate | read
|
|
allow: [delegate*] # names (or prefix*) allowed beyond that
|
|
deny: [run] # never allowed, wins over everything
|
|
autonomous: false # run mutating tools without asking, or not
|
|
---
|
|
The prompt. It is added to the system prompt while this profile is active.
|
|
```
|
|
|
|
Where they are read, later ones replacing earlier ones of the same name:
|
|
`~/.splinter/agents/`, then `.agents/` and `.splinter/agents/` from the
|
|
working directory's parents down to the working directory itself. A file named
|
|
`build.md` or `plan.md` replaces the built-in profile. `mode: subagent` in the
|
|
front matter marks a file as not for the chat; other keys (temperature ...)
|
|
are ignored.
|
|
|
|
The switch applies from the next turn. A refused tool says so in its result
|
|
and tells the model to ask for a switch. `model:` moves the chat to that
|
|
provider (an HTTP one; a cli provider such as `claude -p` cannot be switched
|
|
to mid-chat, use `delegate` for it) and the next profile without a `model`
|
|
moves it back.
|
|
|
|
## Pools
|
|
|
|
A pool is a name for providers that stand in for each other. Naming it is
|
|
naming a model: `-m POOL`, `/model POOL` and `POOL/model` all work. A pool is
|
|
not a fan-out - one member carries the turn, and the pool is what happens when
|
|
that member cannot:
|
|
|
|
- `failover` takes the first member that has room, in the order listed;
|
|
- `balance` takes the member with the most left of its allowance.
|
|
|
|
For the conversation: when the provider it is on hits a limit, splinter moves
|
|
to the next member with room and repeats the request. For delegation: a task
|
|
that fits a member goes to whichever member the pool picks, as long as that
|
|
member has every tag of the one that matched (a private task never leaves
|
|
the `private` provider). A cli member's pool mates become its fallback.
|
|
|
|
## How a task finds its provider
|
|
|
|
`delegate` (and `--choose TEXT`, which shows the verdict) scores every
|
|
provider that is not benched or used up:
|
|
|
|
| | points |
|
|
|---|---|
|
|
| the model asked for the tag (`tags` argument) | +6 |
|
|
| a word of the task is the tag | +3 |
|
|
| a word of the task starts with the tag, or is a synonym of it | +2 |
|
|
| a word of the provider's `about` is in the task (max +2) | +1 |
|
|
|
|
Words, not substrings: `client` is not `cli`. Synonyms are built in, German
|
|
and English: `big` is also gross, large, komplex, migration; `review` is
|
|
pruef, audit; `plan` is entwurf, architektur; `private` is privat, geheim,
|
|
secret; and so on for `code`, `small`, `fast`, `cheap`, `local`, `chat`,
|
|
`summary`, `research`, `test`, `doc`. A tag counts once.
|
|
|
|
Two things are rules, not scores. A task that is private (tag `private` or its
|
|
synonyms) only goes to a provider tagged `private`; with none available it
|
|
fails rather than leaving the house. And when no tag fits at all, `default`
|
|
takes the task (unless it is private) instead of an error.
|
|
|
|
Equal scores go to the provider with the most left of its allowance, then to
|
|
the higher `prio`. A pool then picks its member (see above).
|
|
|
|
## When everything is at its limit
|
|
|
|
splinter finds out when the limit lifts (from `Retry-After`, from the reset a
|
|
provider names in its message, or from its own count), says so, waits and
|
|
repeats the request: `on_limit = wait`, the default. `max_wait` bounds it
|
|
(default 12h). In the chat the screen stays alive; Ctrl-C stops the wait and
|
|
`/resume` goes on. `on_limit = fail` reports the limit instead.
|
|
|
|
## Not in the file: the goal
|
|
|
|
The session goal is set at runtime with `/goal <text>` — in the TUI, or in a
|
|
one-shot run (`splinter -p "/goal ship the config"`). It sets the goal and
|
|
starts a turn that writes a short recap; the recap is injected every seventh
|
|
turn. The goal itself is stored in the session's `.meta`, so `/continue` and a
|
|
resumed session find it. It belongs to the conversation in front of you.
|
|
|
|
## The `.meta` sidecar is shared
|
|
|
|
`<session dir>/<id>.meta` is one `key=value` per line. The core owns `cwd`,
|
|
`created`, `opened`, `title`, `goal` and `goal_state` and rewrites the file on
|
|
every open, rename and `/goal`. Any other key is kept verbatim, so a plugin can
|
|
mark a session in the same file — `plugins/foreign` records `foreign=hermes:h-1`
|
|
there to say where an imported conversation came from, and the marker survives
|
|
the reopen that `-c` or `/open` causes. Unknown keys are carried through
|
|
unchanged, up to eight of them; a `key=value` longer than 159 bytes is cut.
|
|
|
|
## Precedence
|
|
|
|
Command line, then the file, then the built-in default. 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.
|
|
|
|
## Keys
|
|
|
|
A setting that names a path (`session_dir`, `state_dir`, `tools_root`,
|
|
`skills_dir`) takes a leading `~` as the home directory, exactly as the shipped
|
|
template writes it: `~/src` is `$HOME/src`. Any other path is used verbatim.
|
|
The `${NAME}` form inserts an environment variable.
|
|
|
|
| key | meaning |
|
|
|-----|---------|
|
|
| `endpoint` | the API base, e.g. `http://127.0.0.1:8080/v1`; splinter appends `/chat/completions` (or `/messages` for `kind = anthropic`), `/models`, and the usage routes. A full route still works: it is cut back to the base |
|
|
| `model` | model name the endpoint expects |
|
|
| `ctx` | context window in tokens, optional; the curses status bar uses it for the `ctx used/max` gauge. `SPLINTER_CTX_MAX` overrides it for one run |
|
|
| `api_key_env` | name of the env var holding the key (default `SPLINTER_API_KEY`) |
|
|
| `transport` | a transport a plugin provides, e.g. `cli` |
|
|
| `cli_cmd` | command for the `cli` transport, e.g. `claude -p` |
|
|
| `plugin` | a plugin to load, one line each: a shipped plugin's name (`lcm`) or a path; in the block form `plugin NAME { }`, see "Plugins" |
|
|
| `theme` | `Xresources` (the default: `*foreground`, `*background`, `*color0..15` from `xrdb`), `light`/`dark` (white or black page, black or white text), or a CDE palette name (`splinter --list-themes`) |
|
|
| `locale` | language code (`de`, `en`); catalogues live in `share/locale` |
|
|
| `autonomous` | `1` runs mutating/destructive tools without asking |
|
|
| `ask_timeout` | seconds an `ask` waits for the operator's answer (default 900); `SPLINTER_ASK_TIMEOUT` overrides it for one run. Shorten it for a run with no operator attached, so a turn does not park for the full wait |
|
|
| `steps` | tool rounds per turn (default 150) |
|
|
| `max_bytes` | conversation budget in bytes, `0` = no limit |
|
|
| `compact_threshold` | context tokens past which the next request is compacted (`0` = off); judged by the prompt size the provider reports, which every streamed turn asks for |
|
|
| `compact_target` | the size compaction aims for, in tokens; `/compact [tokens]` forces it now |
|
|
| `embed` | the session's search index: `local` (default, built-in CPU encoder, no model and no key), `openai` (posts to `embed_endpoint`), `off` |
|
|
| `embed_dims` | vector size, 8..4096, default 256; only meaningful for `local`, and `openai` must match what the model returns |
|
|
| `embed_model` | model name for `embed = openai`, e.g. `nomic-embed-text` |
|
|
| `embed_endpoint` | base URL for `embed = openai`, e.g. `http://127.0.0.1:11434/v1` |
|
|
| `embed_key_env` | env var holding the key for `embed_endpoint` |
|
|
| `embed_timeout` | seconds one embedding request may take |
|
|
| `session_dir` | where session logs go (default `~/.splinter`); `SPLINTER_SESSION_DIR` overrides it, which is how `make check` keeps its test sessions out of yours |
|
|
| `tools_root` | the only directory the file tools (`read`, `write`, `edit`, `search`, `list`) may touch. Empty — the default — means no boundary, so an existing setup keeps working. `run` is not fenced by it (a shell can open any path); it starts there. Resolved once at startup with `realpath`, so `..` and symlinks are checked against the file that is actually reached, and a root that does not exist is refused at startup instead of matching nothing |
|
|
| `system_prompt` | sent once at the start of a conversation |
|
|
| `telegram_allow` | user ids the gateway answers, comma-separated; empty means nobody |
|
|
| `skills_dir` | a directory of skills, one line each |
|
|
| `env_delegates` | `1` turns `CLAUDE_CODE_OAUTH_TOKEN(_N)` into delegates (default off) |
|
|
| `on_limit` | `wait` (default) or `fail`: what a usage limit does |
|
|
| `max_wait` | longest wait for a limit, e.g. `6h`, `2d` (default 12h) |
|
|
| `kind` | of the core endpoint: `openai` (default) or `anthropic` |
|
|
| `default` | the provider or pool the conversation starts on |
|
|
| `pool` | `pool = id \| strategy=failover\|balance \| members=a,b` |
|
|
| `limit`, `tokens` | allowance of the core endpoint, see Usage limits |
|
|
| `exit` | one way to reach a model for the exit ring, see below |
|
|
| `delegate` | another model the `delegate` tool can hand work to, see below |
|
|
| `mcp` | an MCP server whose tools become splinter's tools, see below |
|
|
|
|
Secrets never go into the file: every `*key_env` names a variable, and the
|
|
variable holds the key. Those variables are hidden from the `run` tool's shell.
|
|
|
|
## Exits and delegates
|
|
|
|
Both are one line each, `|`-separated, every field but the first named:
|
|
|
|
```
|
|
exit = groq | Groq free tier | endpoint=https://api.groq.com/openai/v1/chat/completions | model=llama-3.3-70b | key_env=GROQ_KEY
|
|
|
|
delegate = coder | C99, POSIX, kennt den Quellbaum | endpoint=http://127.0.0.1:8080/v1/chat/completions | model=qwen | tags=code,review | prio=5 | max_parallel=2
|
|
delegate = far | the same, on another machine | host=buildbox | endpoint=... | model=...
|
|
delegate = claude-cli | Claude Code | kind=cli | cmd=claude -p | tags=plan
|
|
delegate = claude-b | Claude Code, second account | kind=cli | cmd=claude -p | env=CLAUDE_CODE_OAUTH_TOKEN=sk-ant-oat01-...
|
|
```
|
|
|
|
`exit` fields: `endpoint`, `model`, `key_env`; the second field is the label.
|
|
`delegate` fields: `endpoint`, `model`, `key_env`, `tags`, `prio`,
|
|
`max_parallel`, `kind` (`openai`, `anthropic` or `cli`), `cmd` (for `cli`), and
|
|
`host` - an ssh target: the child splinter runs there, with that machine's
|
|
keys. An unnamed field is the description the selection reads.
|
|
|
|
### Usage limits
|
|
|
|
Subscriptions (Claude Pro, ollama.com, opencode-go ...) give an allowance per
|
|
window and mostly no API that says how much is left. splinter counts its own
|
|
calls: one line per call in `~/.splinter/usage/<id>.log`, shared by every
|
|
splinter on the machine. You declare the allowance:
|
|
|
|
```
|
|
limit = 45/5h # the core endpoint: 45 calls per 5 hours
|
|
tokens = 2000000/7d # and/or tokens per window (5m, 5h, 7d, 2w)
|
|
delegate = claude-a | Claude Pro A | kind=cli | cmd=claude -p | tags=plan | limit=45/5h
|
|
delegate = claude-b | Claude Pro B | kind=cli | cmd=claude -p | tags=plan | limit=45/5h | env=CLAUDE_CODE_OAUTH_TOKEN=...
|
|
delegate = cloud | ollama.com | endpoint=... | model=... | tags=code | tokens=5000000/7d
|
|
```
|
|
|
|
What it does with that:
|
|
|
|
- `/usage` shows how full each allowance is (`claude-a 5h 62%`), a benched
|
|
one shows when it is back;
|
|
- delegation skips a provider whose allowance is used up, and among providers
|
|
that fit the task equally well (same tags: a pool of accounts) it takes the
|
|
one with the most left;
|
|
- a refused call (HTTP 429/402/529, or "you've hit your limit - resets 3am")
|
|
benches the provider until the reset it names.
|
|
|
|
The counts are splinter's own: use the same account elsewhere and the real
|
|
usage is higher than shown. Set the limit a little below the real one.
|
|
|
|
`env=NAME=VALUE` (repeatable, up to 8) sets a variable for the delegate's
|
|
child right before it starts, overwriting whatever the parent exported - so two
|
|
delegates can run the same CLI with two different accounts. With `host=` it is
|
|
sent in front of the remote command as `env 'NAME=VALUE'`. A value cannot
|
|
contain `|`. A literal token in the file is a secret in the file: `chmod 600`.
|
|
|
|
### Limits: bench and fall back
|
|
|
|
A delegate whose answer says it is at its limit - a 429, "rate limit", "usage
|
|
limit", claude's "You've hit your weekly limit · resets 3am (Europe/Lisbon)" -
|
|
is benched until that reset, and the same task goes to the next delegate that
|
|
fits (the request's tags plus the benched one's). The bench is a file,
|
|
`~/.splinter/cooldown/<id>` holding the epoch, so every splinter on the machine
|
|
skips it, even when it is asked for by name; delete the file to unbench early.
|
|
A reset that cannot be read benches for an hour. In `delegate_parallel` the
|
|
task moves to the next delegate in its own slot while the others keep running,
|
|
unless that one is already at its `max_parallel`. Only when nothing else fits
|
|
does the job wait (`waiting_quota`) for the reset.
|
|
|
|
## Plugins
|
|
|
|
Every plugin has its own block. The block loads it, and everything in it
|
|
apart from `path` and `enabled` is that plugin's own configuration:
|
|
|
|
```
|
|
plugin lcm {
|
|
keep = 6 # messages kept verbatim
|
|
tool_trim = 8192 # older tool outputs are cut to this
|
|
}
|
|
plugin junction { } # url/header from the mcp junction server
|
|
plugin session { } # old sessions: session_search/session_list
|
|
plugin mine {
|
|
path = ~/my/plugin.so # not shipped: say where it is
|
|
foo = bar
|
|
}
|
|
plugin status { enabled = false } # kept in the file, not loaded
|
|
```
|
|
|
|
| field | meaning |
|
|
|-------|---------|
|
|
| `path` | the `.so` to load; without it the shipped plugin of that name |
|
|
| `enabled` | `false` keeps the block but does not load the plugin (default on) |
|
|
| anything else | the plugin's own setting, read with `sp_host_plugin_config()` |
|
|
|
|
Without `path`, `plugin NAME { }` finds the shipped plugin next to the
|
|
binary: `plugins/NAME/NAME.so` in the build tree, then the installed
|
|
`$(PREFIX)/lib/splinter/plugins/NAME.so`, then the build directory the binary
|
|
was compiled in. A nested block gives dotted names: `server a { url = x }`
|
|
inside `plugin foo` is `server.a.url`; a list `[a, b]` arrives as `a,b`.
|
|
`docs/PLUGINS.md` has the API.
|
|
|
|
The old forms still load, so an existing file keeps working:
|
|
`plugins = [plugins/lcm/lcm.so, ...]` in `core` (one path each) and the flat
|
|
`plugin = /path/to/x.so`. They carry no plugin settings.
|
|
|
|
`plugin junction { }` reads the address and the key from the `mcp junction`
|
|
server it already uses; its own block may override them:
|
|
|
|
```
|
|
plugin junction {
|
|
url = http://127.0.0.1:8090/mcp
|
|
header = "Authorization: Bearer ${JUNCTION_TOKEN}"
|
|
interval = 5000 # ms between /mcp and status checks
|
|
models_interval = 60000 # ms between /v1/models probes
|
|
status_path = /status # first alias; /v1/status, /queue, /v1/queue follow
|
|
}
|
|
```
|
|
|
|
It evaluates the `X-Junction-Mcp` response header (that is how junction
|
|
identifies itself; a 200 without it is reported as "not junction") and reads
|
|
uptime, MCP-server health, queue and request counts from `/status`. The sidebar
|
|
widget, the `junction` status segment, `junction_status` and `/junction` all
|
|
show that snapshot. Without either block, `SPLINTER_JUNCTION_URL` and
|
|
`SPLINTER_JUNCTION_TOKEN` are read.
|
|
|
|
## MCP servers
|
|
|
|
An MCP server contributes tools. The servers are the configuration of the
|
|
`mcp` plugin, one `server` block each:
|
|
|
|
```
|
|
plugin mcp {
|
|
# streamable HTTP: one POST per message
|
|
server junction {
|
|
url = http://172.25.206.16:8090/mcp
|
|
header = "Authorization: Bearer ${JUNCTION_TOKEN}"
|
|
}
|
|
|
|
# or a program that speaks MCP on its stdin/stdout
|
|
server files {
|
|
cmd = "npx -y @modelcontextprotocol/server-filesystem /home"
|
|
}
|
|
|
|
# a server that exists but should not be asked
|
|
server old { url = http://127.0.0.1:9000/mcp enabled = false }
|
|
}
|
|
```
|
|
|
|
The top-level `mcp NAME { ... }` block and the flat `mcp = ...` line from
|
|
before still work (they need the plugin loaded as well).
|
|
|
|
| field | meaning |
|
|
|-------|---------|
|
|
| `url` | the endpoint, streamable-HTTP transport (`.../mcp`) |
|
|
| `cmd` | a program started with `/bin/sh -c`, spoken to over stdin/stdout |
|
|
| `header` | one header line, usually the token: `Authorization: Bearer ...` |
|
|
| `enabled` | `0`/`false` keeps the entry but does not load it (default on) |
|
|
|
|
The token belongs in the environment: `"${JUNCTION_TOKEN}"` is expanded when
|
|
the file is read, and the header travels to curl through its stdin config, so
|
|
it is never in `ps`. A literal token in the file is a secret in the file:
|
|
`chmod 600`.
|
|
|
|
Tool names: with one server they are `mcp_<tool>`; with several they are
|
|
`mcp_<server>_<tool>`, so two servers that both offer `search` stay apart. They
|
|
are all in the `mutate` class - a server can do anything, and the harness does
|
|
not pretend to know better. The sidebar widget shows how many tools came back
|
|
and says so when a server stops answering.
|
|
|
|
The handshake is `initialize` + `notifications/initialized` + `tools/list`; a
|
|
server that fails it is reported and skipped, and the others still load. The
|
|
single-server environment variable from before still works:
|
|
`SPLINTER_MCP_CMD="npx -y ..."` is one stdio server.
|
|
|
|
## Example: local model
|
|
|
|
```
|
|
endpoint = http://127.0.0.1:8080/v1
|
|
model = /models/unsloth/Qwen3.6-35B-A3B-MTP-GGUF/Qwen3.6-35B-A3B-UD-Q8_K_XL.gguf
|
|
theme = Xresources
|
|
autonomous = 1
|
|
plugin = lcm
|
|
plugin = cps
|
|
plugin = clock
|
|
session_dir = /home/lotherk/.splinter
|
|
tools_root = /home/lotherk/src # the file tools stay here; omit for none
|
|
```
|
|
|
|
## Example: Claude Code as the model
|
|
|
|
```
|
|
transport = cli
|
|
cli_cmd = claude -p
|
|
cli_timeout = 1800 # seconds of silence, not a wall clock
|
|
plugin = cli
|
|
theme = Xresources
|
|
```
|
|
|
|
`cli_env = NAME=VALUE` (repeatable, up to 8) sets a variable for the cli
|
|
program, e.g. `cli_env = CLAUDE_CODE_OAUTH_TOKEN=sk-ant-oat01-...`. It
|
|
overwrites an exported variable of the same name.
|
|
|
|
### Sessions
|
|
|
|
A cli program keeps its own conversation across calls. splinter exports its
|
|
session id as `SPLINTER_CLI_SESSION`; a cli delegate extends it with its name
|
|
(`sess-...:claude0`), so every delegate has its own conversation per splinter
|
|
session, and `claude0` and `claude1` never share one. From that key:
|
|
|
|
- `claude`: a UUID derived from the key, `--session-id` on the first call,
|
|
`--resume` after that (remembered in `~/.splinter/cli/`, or
|
|
`$SPLINTER_CLI_STATE`). If claude disagrees - session moved or deleted - the
|
|
other form is tried once, which costs no model call.
|
|
- `opencode`: `--session ses_<derived>`, created by opencode if missing.
|
|
- anything else: `{session}` and `{uuid}` in the command expand to the key and
|
|
the UUID.
|
|
|
|
Consecutive calls stay in one conversation, so the provider's prompt cache
|
|
covers the history: measured with claude, the second call read 17.6k tokens
|
|
from cache and wrote 80. A command that already says `--session`, `--resume`
|
|
or `--continue` is left alone; an exported empty `SPLINTER_CLI_SESSION` turns
|
|
sessions off. Only the newest user message is sent - the program has the rest.
|
|
|
|
`cli_fallback = claude1, claude0` names cli delegates to use, in order, when
|
|
`cli_cmd` is at its limit: their `cmd` and `env=` replace the main ones for
|
|
that call. The main command is benched as `cli`, a fallback under its own id -
|
|
the same bench delegation uses, so an account at its limit is skipped
|
|
everywhere. The session key stays, so claude resumes the same conversation
|
|
under the next account. A fallback's `env=` reaches the program through a
|
|
0600 file the shell sources, never through a command line `ps` would show.
|
|
When every account is benched, the turn fails with the first reset time.
|
|
|
|
`cli_cmd` may contain `{file}` (the prompt temp-file path) or `{prompt}` (a
|
|
shell-quoted prompt). Without a placeholder the prompt is fed on stdin, which
|
|
works for `claude -p`, `ollama run`, and similar tools. For CLIs that take the
|
|
message as an argument, use e.g. `cli_cmd = opencode run --format default {file}`
|
|
or pass the prompt via a flag your CLI supports.
|
|
|
|
With both `endpoint` and `transport` set, `transport` wins — it is the more
|
|
specific instruction.
|
|
|
|
## Searching the session: `embed`
|
|
|
|
Compaction drops messages from the conversation to fit the window. They stay in
|
|
the session file, and the model gets a `history_search` tool to find them again
|
|
by meaning. The digest that replaces them names the tool — but only when it is
|
|
really registered, since a prompt pointing at a missing tool teaches the model
|
|
to call nothing.
|
|
|
|
```
|
|
core {
|
|
embed = local # default
|
|
embed_dims = 256
|
|
}
|
|
```
|
|
|
|
`embed = local` is the built-in encoder: no model, no key, no network. It hashes
|
|
words, four-character prefixes and bigrams into a signed vector on the CPU. It
|
|
is weaker than a real embedding model (measured: paraphrase 0.92, unrelated
|
|
0.01) and it is enough to tell "the deploy machine" from "the frontend build".
|
|
|
|
`embed = openai` sends the text to `<embed_endpoint>/embeddings` with
|
|
`embed_model`; `embed_dims` must match what the model returns. The **question**
|
|
goes to the same endpoint: an index built by a model can only be searched by
|
|
that model, so a query is never hashed locally when the index was not. `embed =
|
|
off` keeps the tool out entirely.
|
|
|
|
Two things it does **not** do: it never runs inside the turn, and it never
|
|
delays an answer. The indexer is its own thread; a 937 KB session costs the turn
|
|
28 ms. The index lives in `<session_dir>/emb/<session-id>.emb`, next to the
|
|
session log, and grows with it — a resumed session becomes searchable in the
|
|
background without anything having been compacted.
|
|
|
|
`/status` shows what the indexer is doing (`status.embed`).
|
|
|
|
The tool says what it found, or why it found nothing: `the index is still
|
|
filling; ask again in a moment` while the thread catches up on a session that
|
|
just grew, `the index is empty: nothing in this session has been indexed yet`
|
|
when there is nothing to search, `the query has no searchable words` when the
|
|
question was all stopwords (local encoder), and `the embedding endpoint refused
|
|
the query` when the remote one did. All of them are answers, not errors.
|
|
|
|
## Adding a provider from the chat
|
|
|
|
`/connect` — in the Telegram gateway and in the TUI (one answer per line) —
|
|
asks for a name, an endpoint, a model and the
|
|
variable that holds the key, then writes one `delegate` line to
|
|
`<config>.d/20-connect.conf` — the drop-in next to the file that is in use, so
|
|
`--config` works too. Adding the same name again replaces its line. The
|
|
provider is usable in that run at once: the delegate table in memory is the one
|
|
the running agent reads. `ollama` and `opencode` are accepted instead of a URL
|
|
and stand for `http://127.0.0.1:11434/v1` and
|
|
`https://opencode.ai/zen/go/v1` (the latter with
|
|
`OPENCODE_GO_API_KEY`).
|
|
|
|
`/model` offers the models the config names and switches the transport; the
|
|
choice is written to the session's sidecar (`<session>.model`) as a selector,
|
|
so reopening that session brings the model back without changing what a new
|
|
session starts on. The provider block supplies kind, endpoint and key variable;
|
|
the sidecar only names the choice. `/model probe` asks each endpoint
|
|
`/v1/models` and lists what it really serves; the picker in the curses chat
|
|
also asks the endpoint the session is on and adds those models to its list.
|
|
`/model <name>` takes another model from the current endpoint. With a plugin
|
|
`transport` nothing is written — that program picks the model.
|
|
|
|
## Drop-ins
|
|
|
|
Next to the config file, a directory with the same name plus `.d` is read after
|
|
it, every `*.conf` in name order:
|
|
|
|
```
|
|
~/.splinter/splinter.conf
|
|
~/.splinter/splinter.conf.d/10-local.conf
|
|
~/.splinter/splinter.conf.d/20-delegates.conf
|
|
```
|
|
|
|
A later file overrides an earlier one, and an unknown key is still an error -
|
|
now with the file it came from. Proven in `test_config`.
|
|
|
|
## Installieren ohne root
|
|
|
|
make install PREFIX=$HOME/.local
|
|
|
|
Das installierte Binary traegt einen RPATH auf `$ORIGIN/../lib`, findet seine
|
|
`libsplinter.so` also neben sich. Kein Wrapper, kein `LD_LIBRARY_PATH`, keine
|
|
Umgebungsdatei: `~/.local/bin/splinter` ist das Programm.
|
|
|
|
Keys kommen aus der Umgebung, die du selbst exportierst — splinter liest keine
|
|
fremde Konfigurationsdatei mit. Ein Delegate nennt nur den Namen der Variablen
|
|
(`key_env=OPENCODE_GO_API_KEY`).
|