The components
Each part of somm in the same four parts: what it is, the problem it solves, how it connects to the rest, and the proof. Proof is a number or an incident from this repository, cited by file, or the words no evidence yet. Terms link to the glossary.
- Client, providers and streaming
- Routing, cooldowns and pins
- Ledger, mirror and the ledgers on a machine
- Workloads
- Data boundary
- Shadow evaluation and judges
- Recommendations and the inbox
- The sommelier
- MCP server and skill
- Service and dashboard
- The proxy
- Plans and quota pacing
- Harnesses
- Decision calls
- Workload handlers and the climb
- Rented GPUs
- Read API
- The CLI
Client, providers and streaming
- What it is
-
somm.llm(project="my_app")returns a client withgenerate,stream,embed,generate_structuredfor JSON, tool calling,decideand async versions. Passraise_on_failure=Trueand a failure is raised as a typed error carrying provider, model and call id;timeout=bounds one call. A stream goes through the same admission, routing and recording asgenerate, andevents=Trueyields typed stream events. Behind it are eleven built-in providers: eight APIs (Anthropic, DeepSeek, Gemini, MiniMax, Ollama, OpenAI, OpenRouter, Perplexity) and three seats (claude-cli,codex-cli,chatgpt), plus OpenAI-compatible servers reached by base URL or named inSOMM_OPENAI_ENDPOINTS. The library's only third-party dependency ishttpx. - The problem
-
A project has three places that call a model, written months apart,
each with its own retry loop and its own idea of which exceptions
matter. None of them records which model actually answered.
Changing one import,
from somm.compat import GenericLLMCompat as FooLLM, leaves every call site alone and gives all three fallback, a cost and a readable error, written to one place. - How it connects
- Every call goes through routing and writes one row to the ledger. Hooks let other tools watch calls or stamp their own job id on them (plugins.md).
- Proof
-
In October 2026 a census of one machine counted 1.7 million calls
recorded since June across nine projects (VISION.md, "Re-grounding,
October 2026"). Provider differences are real and handled once:
image prompts failed on every OpenAI-compatible provider until
0.19.2 translated the block shape per provider (CHANGELOG.md, #70).
Streams were recorded wrongly twice: an abandoned stream as
okuntil 0.23.0, and one cut off before the provider's end marker asokuntil 0.25.0, which records it asupstream_error(CHANGELOG.md). Provider list:packages/somm/src/somm/providers/registry.py.
Routing, cooldowns and pins
- What it is
-
The router tries the configured providers in order. With no
override the order is MiniMax, OpenRouter, DeepSeek, Anthropic,
Gemini, OpenAI, Perplexity, then Ollama last, skipping any without
a key;
SOMM_PROVIDER_ORDERreplaces it. A model that fails is put in a cooldown stored in SQLite, so every process sees it. A call that names no provider moves on to the next. A call that names one is a pin: it is served by what you named or it fails, and the failure is recorded against the model you asked for. A workload's policy can set retries, timeouts or thesomm/autotiers. - The problem
-
One rejected API key at the front of the chain used to fail every
call that had not named a provider. Since 0.19.2 that provider is
cooled and the call carries on to the next one, and
on_fallbackreports that it was passed over. The opposite failure matters as much: an answer quietly served by a substitute model makes every benchmark and comparison you run wrong, which is why a pin never substitutes unless you passallow_fallback=True. - How it connects
- Before each attempt it checks the data boundary, the workload's policy and plan pacing. After it, it writes provider health and the call row. Recommendations read those failures.
- Proof
- A withdrawn OpenRouter model was retried every two minutes for six months and reached 68,166 consecutive failures in one ledger, because cooldowns had a fixed length. Since 0.17.2 the cooldown doubles every ten consecutive failures, to at most a day (CHANGELOG.md, 0.17.2).
Ledger, mirror and the ledgers on a machine
- What it is
-
The ledger is a
SQLite file per project,
.somm/calls.sqlite. Each call is one row: workload, provider, model, tokens, latency, cost and where the cost came from, outcome, a bounded error message and the data tier it reached. The mirror,~/.somm/global.sqlite, receives copies of calls and workloads from every project (on by default;SOMM_CROSS_PROJECT=0turns it off). Decisions are always written there. Graded samples, evaluations and recommendations stay in the project's own ledger. A registry (~/.somm/registry.json) lists every project's ledger:somm ledgersshows each one's size, schema, last call, client versions and how far the mirror is behind;somm fleet statusgives one line per project;somm mirror synccopies rows the mirror lacks. - The problem
- "What did I spend on MiniMax across all my projects this month?" should be one query, not a dozen. And a telemetry failure must never break the call it describes, or make you pay for it twice.
- How it connects
- Everything else reads it. The read API is the supported way to do so; plain SQL works too. Details: ledgers.md.
- Proof
- The October census read the mirror, saw zero evaluations and zero recommendations, and first concluded the loop had never run. The truth, 7,281 graded samples and 21 recommendations, was in one project's own ledger, because the mirror does not carry those tables (CHANGELOG.md, 0.17.0). In November one bad row was found to kill the telemetry writer for the life of the process, and a locked ledger could discard a paid answer and buy it again; 0.20.2 fixed both (CHANGELOG.md, 0.20.2). Until 0.24.0, two projects declaring the same workload shared one mirror row and global views credited one project's calls to the other (CHANGELOG.md, 0.24.0).
Workloads
- What it is
-
A workload is a
named job your code asks for, such as
claim_extract, rather than a model or a provider. It can carry a privacy class, a data boundary, a daily budget, required capabilities, input and output schemas and a routing policy. It is the unit that cost, failures, grades and recommendations attach to. - The problem
- Two jobs can use the same model: one is fine, the other fails half the time and costs most of the bill. "Which of my jobs is the problem?" is a question about workloads, and it cannot be answered from per-model totals.
- How it connects
- Every ledger row names one. Shadow evaluation, handlers, recommendations and decisions are all keyed on it.
- Proof
- The evidence so far is about what is still hard. In August 2026, 26 of 29 workloads could not be matched to the code that called them, including every one of the busiest (VISION.md); schema 23 added the call site. Only 3 of 214 workloads declare an output schema, so grading most of them is a similarity guess (ROADMAP.md, phase 3).
Data boundary
- What it is
-
Every route (a
provider, a model, an endpoint) gets a
tier, from
strictest to loosest:
local,zdr,subscribed,unvetted. A workload may declare a boundary; any route looser than it is refused before a request leaves the process, and every served call records its tier. Unknown routes areunvetted; the classifier never guesses upward. Your own~/.somm/boundary.tomloverrides the shipped defaults. An OpenRouter model counts aszdronly when OpenRouter's published zero-retention list names a qualifying upstream for it, and the request is then pinned to those upstreams. A workload handler may declare onlylocal. - The problem
- A workload that reads medical notes is marked private. Before 0.21, a pinned call, a stream, the proxy or an MCP comparison could still send it to a cloud provider, although three documents said the router prevented that.
- How it connects
-
Checked by routing, pins, streams, the OpenRouter roster walk,
workload handlers, the proxy, MCP compare, shadow evaluation and
harnesses. A refusal is a ledger row and never falls through to a
looser route.
somm boundary routeslists every route's tier and why;somm boundary auditreads the ledger and reports the loosest tier that served each workload. Details: data-boundary.md. - Proof
-
0.21.0 fixed the leak above and a documented shadow-evaluation
privacy guard that did not exist (CHANGELOG.md, 0.21.0, "Fixed").
0.22.0 admits an OpenRouter model as
zdronly when OpenRouter's own zero-retention list names qualifying upstreams; on 2026-11-09 neither of the two free models in the default roster had one, so both are still refused under that boundary (CHANGELOG.md, 0.22.0).
Shadow evaluation and judges
- What it is
-
Opt a workload in and somm stores a sample of its successful calls
(for example 3%). A background worker re-runs each one on a
gold model and
scores how closely the production answer matches. An optional
judge panel scores
answers against a rubric. Gold and judge requests are ordinary
ledger rows, so grading shows up in your costs, and a daily budget
caps it. The gold call replays the request as production sent it:
system prompt, tools, response format, temperature and
max_tokens. - The problem
- You picked a cheap model on day one without knowing whether it was good enough. Two weeks of graded samples from your real prompts show how close it gets to the stronger model, without writing a test set by hand.
- How it connects
-
Reads stored samples; writes evaluation results. Feeds
somm frontier, recommendations, the sommelier's ranking andsomm eval promote-call, which turns a graded call into a fixture for CI. Private workloads are never sampled. Runs withsomm loop runor on a timer withsomm loop install(intelligence-loop.md). - Proof
- One project's grader ran inside its web process, graded 7,281 samples, and stopped on 2026-09-19 when that process did; nobody noticed for three weeks (CHANGELOG.md, 0.17.0). That is why the loop became a command and a timer in 0.17. Until 0.24.0 two workers could both claim one sample and pay for its gold call twice, and an unparseable judge reply scored 0.0 (CHANGELOG.md, 0.24.0). Without an output schema, grading measures similarity to the gold answer, not correctness (ROADMAP.md, phase 3).
Recommendations and the inbox
- What it is
-
A weekly worker applies four rules and writes each finding with its
evidence:
switch_model(another graded model scores at least 0.1 higher on a 0–1 scale at no more cost, with at least 20 grades for each model in 30 days and a 95% interval that excludes zero),new_model_landed(a newer same-provider model is at least 20% cheaper),chronic_cooldown(at least 10% of a workload's calls to a provider fail) andadaptive_param_bump(a reasoning model keeps spending its whole output budget thinking). These are rules, not a language model. An open recommendation expires after 30 days. The inbox (somm inbox list|show|apply|dismiss, or the MCP tools) is where you act on them. - The problem
- Grades in a table change nothing. Someone has to see "this workload would do as well on a cheaper model, here are the scores" and decide.
- How it connects
- Reads evaluations, calls, provider health and model intel. Applying one records a decision.
- Proof
-
The evidence so far is unflattering. Triage of 49 open
recommendations in October found 40 came from one rule misreading
one column; 0.17.2 fixed it (CHANGELOG.md, 0.17.2). Until 0.24.0
five grades and any 0.1 lift were enough for a
switch_model(packages/somm/src/somm/workers/agent.py). By November, 54 recommendations had been created and none applied (VISION.md). No recommendation has yet been applied on a real fleet because the evidence said so; that is the graduation test for ROADMAP phase 6.
The sommelier
- What it is
-
Decision memory.
somm_adviseranks candidate models using model intel, shadow scores, plan headroom and your earlier decisions.somm_record_decisionstores the choice and the reason, always in the machine-wide store.somm_search_decisionsfinds earlier decisions from any project. When a choice follows an earlier decision, the agent passes its id asrecalled_from, and that recall is counted. The name is a metaphor: it suggests, and remembers what you liked. - The problem
- In one project you tried a free vision model and found it flaky. A month later, in another project, your coding agent suggests the same model from its training data. With the decision recorded, the agent finds it first (see the illustration on the home page).
- How it connects
- Reads model intel, evaluations, plans and decisions; written to from the MCP server and when an inbox item is applied.
- Proof
-
No evidence yet that it works in practice. In October 87 decisions
had been recorded, nearly all from one session; in November,
recalls had never been stored, and nearly every decision in the
shared ledger had been written by a test fixture (VISION.md). 0.20.2
stopped the test suite writing there, and 0.23.0 began storing
recalls, which
somm doctornow counts (CHANGELOG.md). There is no history of recalls yet.
MCP server and skill
- What it is
-
somm-mcpis a local MCP server with 14 tools:somm_stats,somm_search_calls,somm_recommend,somm_inbox,somm_apply_recommendation,somm_dismiss_recommendation,somm_register_workload,somm_register_prompt,somm_compare,somm_replay,somm_eval_promote_call,somm_advise,somm_record_decisionandsomm_search_decisions.somm-skillis a set of instructions (SKILL.md,SOMMELIER.md) that tells a coding agent to usesomm.llm(), name its workloads and ask the sommelier before choosing a model.somm mcp installregisters the server with Claude Code or Codex andsomm skill installlinks the skill into their skill directories. - The problem
- Asked what a workload cost this week, or which model to use, a coding agent answers from its training data. With the server connected it answers from your ledger.
- How it connects
- Reads the ledger, the mirror and the inbox; writes workloads, prompt versions and decisions. Stored prompt and response text is returned marked as untrusted, so an agent does not take it as instructions (threat-model.md).
- Proof
-
No evidence of use yet. The November audit found both installed in
no coding-agent harness (VISION.md); the install commands arrived
in 0.23.0 (CHANGELOG.md) and
somm doctorshows their state per harness.
Service and dashboard
- What it is
-
somm-service, started withsomm serve, is a local web app onlocalhost:7878: a dashboard of usage, cost and quality by project and workload, a JSON read API, the scheduler that runs the loop, the proxy and OpenTelemetry trace ingest (JSON, or protobuf with thesomm-service[otlp]extra). It binds to loopback by default and requires a bearer token for everything except the dashboard's own reads and inbox actions from a loopback connection. - The problem
- Not every question deserves a SQL query. A browser view of the week by workload answers most of them.
- How it connects
- Reads the ledger; hosts the loop workers; the proxy and trace ingest write ledger rows.
- Proof
- A security fix rather than a usage number: until 0.21.0, three request headers that any client can set opened every service route, including the proxy routes that spend money. The header path now requires a loopback peer and covers only dashboard reads and inbox actions (CHANGELOG.md, 0.21.0, "Security"). No dashboard screenshot is published yet.
The proxy
- What it is
-
Three HTTP routes in the service:
POST /v1/messages(Anthropic Messages),POST /v1/chat/completions(OpenAI Chat Completions) andPOST /v1/responses(OpenAI Responses, the common subset), each with streaming. Each request becomes one call on somm's own client, so it is routed, pinned, cooled, boundary-checked, budget-gated, priced and recorded like a library call, and a stream is forwarded event by event as it arrives. The model string picks the route (somm/auto,provider/model, or a bare model on the route's default provider);X-Somm-Workloadnames the workload. Fields it cannot apply yet are accepted and named in anx-somm-ignoredheader. - The problem
- A program you cannot edit, or one not written in Python, still makes model calls. Point its base URL at somm and they are recorded.
- How it connects
- Writes ledger rows under the named workload and project; reaches only providers somm has configured.
- Proof
-
No usage evidence yet. Since 0.24.0 each route translates the
request into one call on somm's own client, so proxied calls are
routed, cooled, boundary-checked, priced and recorded like library
calls (
packages/somm-service/src/somm_service/proxy.py, CHANGELOG.md), and since 0.25.0 its streams forward tokens as they arrive.
Plans and quota pacing
- What it is
-
~/.somm/plans.tomlsays how each provider bills: PAYG (per-token dollars) or metered (a quota per window, such as requests per five hours).somm plansshows usage in each window across every project, the pace against the clock, a projection, and observed ceilings learned from your own rate-limit errors. The router tries a provider that is burning faster than its window allows only after the others; withenforce = trueit skips one that is exhausted. - The problem
- A coding plan costs nothing per call and still runs out on Tuesday. A meter that counts only dollars never sees it coming.
- How it connects
- Routing reads pacing before each call; the sommelier notes headroom when it ranks a metered model; adaptive routing conserves a weekly subscription quota (adaptive-routing.md).
- Proof
-
In the week of 13 July 2026 one project made 306,734 calls and
91.1% failed because every provider in its chain was cooling;
536,862 such failures over the five-week incident. An observed
ceiling had been recorded in
plans.toml, but withenforce = falsenothing throttled, and no alert fired (the incident write-up). The guard that existed was switched off.
Harnesses
- What it is
-
somm.harnessesruns one attempt of a coding agent (Claude Code, Codex, OpenCode or Pi) and returns one result shape: outcome, final text, session id, usage, reported cost, why it stopped, and when a seat limit lifts.record=Truewrites the attempt to the ledger. It is not a job runner: queues, retries across attempts and approvals belong to the tool that calls it. - The problem
- A task runner that switches from one agent CLI to another should not have to rewrite its event parsing, and an agent attempt is often the most expensive call a project makes, so it belongs in the same ledger as the API calls.
- How it connects
- Writes ledger rows beside API calls, and is checked against the data boundary before launch. Details: agent-harnesses.md.
- Proof
- Before 0.17 no agent attempt reached the ledger (CHANGELOG.md, 0.17.0). In 0.18 a read-only request sent to an adapter that could not enforce it ran with full write access; 0.19.0 refuses such requests (CHANGELOG.md, 0.19.0). No recommendation yet uses which harness a model ran in (ROADMAP.md, "Later").
Decision calls
- What it is
-
llm.decide(text, ask=..., labels=... | scale=...)asks a decision model one typed question and returns a label, its probability, every label's probability and an abstained flag when no label reachesmin_p.decide_manyasks several named questions in one request. Each request is one decision call, a ledger row withkind = 'decide', checked against the data boundary and budget and priced like any call. The one provider is TypeSafe System One. - The problem
- "Is this ticket about billing?" is a yes/no question, but asked of an LLM it is a paid paragraph that code then parses, and the model's "confidence" is whatever text it wrote. A decision model returns a probability per label, which can be checked against the right answers.
- How it connects
-
result.verdict(label)records the right answer (a verdict);somm_core.read.decision_calibrationreports the Brier score and calibration error per workload.somm.decide.grade_decisionshas an LLM answer the same questions on sampled inputs, andsomm_core.read.decision_economicscompares agreement and cost per 1,000 inputs with and without the decision model. Escalating an abstained answer to an LLM is the caller's next call, under the same workload (decisions.md). - Proof
- No evidence yet. The adapter is built from the vendor's documentation and tested against fakes; no live call was made while building it (docs/decisions.md, "Limits").
Workload handlers and the climb
- What it is
-
A handler serves a
workload with something other than the provider chain: a rule, a
classifier, a chip.
It returns an answer or declines, and a declined call goes to the
models as before. Its calls are recorded under the same workload
name, so model-served and handler-served calls compare in one
query. The climb is
the practice this allows: move each part of a workload that a rule
can decide out of the model, one evidenced step at a time, and
move it back if a model does better.
somm climbis a read-only report of a workload's rungs, read from the receipts chipsocket writes: decisions per rung, the share answered without a model, and model cost per 1,000 decisions. - The problem
- A workload starts as a model call because that is quickest to write. The ledger later shows that many inputs always get the same answer. A router that only chooses between models cannot say "stop calling a model here"; a handler can, and the ledger shows what it saved.
- How it connects
-
Runs before the provider chain; published by other packages through
the
somm.workload_handlersentry point. The first non-model kind,chip, is published by fab (workload-handlers.md). The climb report joins a model-answered receipt to its ledger row by call id when the receipt carries one, else by exact workload name (the-climb.md). - Proof
-
The first climb is live: gabe's
same_event, 700,000 calls on a 7B local model, runs as a chipsocket socket with somm as its gateway and meter (VISION.md). The November audit adds the limit: rules answered more than nine in ten of one workload's decisions and somm saw only the rest, so most of the climb is invisible to the ledger (VISION.md).somm climb(0.25.0) reads those decisions from the receipts; it has not yet been run on a published workload, and the join to the ledger needs the receipt writer to pass a call id (ROADMAP.md, phase 5).
Rented GPUs
- What it is
-
Two separate things.
somm gpu spendis a read-only report of what you spent renting GPUs, read from the receipt files gipper (a separate GPU rental tool) writes: totals by day and workload, and the failed and capped jobs with what they cost. And a model you serve on a rented machine with an OpenAI-compatible server joins somm as a named provider throughSOMM_OPENAI_ENDPOINTS. somm never rents, starts or stops a machine. - The problem
- A batch job on a rented GPU can cost more than a month of API calls, and it is not in the ledger at all. Seeing both side by side is the start of deciding where a workload should run.
- How it connects
-
Where a gipper job's workload name matches a somm workload exactly,
the report prints the ledger's spend for that workload beside the
GPU spend; there is no other join.
somm doctorprints a one-line total when a receipts directory exists. A named endpoint is classified by the usual data boundary rules and, with no known price, records an unknown cost (rented-gpus.md). - Proof
- No evidence yet. GPU cost is not attributed to individual calls (ROADMAP.md, phase 5).
Read API
- What it is
-
somm_core.read: read-only functions over a ledger (search_calls,get_calls,rollup,provider_health,spend_today,north_star,across_ledgersand the decision reads) with a stability promise: result fields are only ever added, never renamed or removed, and a read on an older ledger returnsNonefor a column it predates.somm_core.vocabulary.vocabulary()returns the outcome, tier, route-source, cost-source and meter-unit sets with a version stamp. - The problem
- Every tool that writes its own SQL against the ledger invents its own answer to small questions, such as what to call a call with no registered workload, and the dashboards stop agreeing.
- How it connects
- The CLI, the MCP server and the service use it, and so can your tools (read-api.md).
- Proof
- By October 2026 seven tools in one estate each had their own rollup and disagreed (read-api.md). Adoption is not finished: in November ten consumers still read the ledger with their own SQL (VISION.md); 0.24.0 added the reads they were writing by hand (CHANGELOG.md).
The CLI
- What it is
-
The
sommcommand, with 32 top-level commands in 0.25.0 (somm --help). The ones used most:status,doctor,plans,inbox,loop,boundary,frontier,compare,generateandserve.--projectgoes before or after any subcommand. With--json, output and failures have a fixed shape, and exit codes follow one contract (cli.md). - The problem
-
During an incident you need one screen that says what is wrong:
somm doctorshows configuration, the ledger, active cooldowns, the loop's last run and the share of calls in the last 24 hours that failed because every provider was cooling. - How it connects
- Reads through the read API; drives the loop, workloads, prompts and evaluations.
- Proof
-
somm doctor --max-exhausted-ratewas added after the July incident and exits non-zero above a threshold, so a timer can alert; the write-up notes the worst week would have shown 91.1% (incident).