shrt tests a backend through chains of API calls. A chain is a YAML file: log in, create an item, add stock, read it back. You run the chains, a person approves a passing run as the baseline, and every later release is replayed against that baseline. When a field changes, shrt names the step, the field, and the write it suspects.
It was built to be driven by a coding agent (shrt init installs a Claude Code skill and its docs),
but every command works by hand, and the demo below is all by hand.
shrt speaks the Connect protocol: each call is JSON over HTTP POST. A server built with connect-go answers it, since connect-go serves Connect and gRPC side by side. A server that speaks only gRPC (binary frames over HTTP/2, as plain grpc-go does) does not. Unary and server-streaming rpcs are supported; a streaming step reads the first message.
You need Go 1.26.2 or later, and buf on your PATH: shrt
compiles the backend's .proto files with buf build to learn every rpc and message.
go install github.com/N4darae/shrt/cmd/shrt@latest
shrt versionOr build from a checkout with go build -o shrt ./cmd/shrt and put the binary on your PATH.
The demo runs shrt against examples/inventory, a small connect-go service with four rpcs: Login,
CreateItem, GetItem and AddStock. Started with -release 2, it serves GetItem from a stale
cache, and that is the regression the demo catches.
Copy the example out of the checkout first. shrt init writes .shrt/, .claude/ and a
.gitignore into the directory it runs in, and .shrt/config.yaml is where everything it sets
lives, the backend's address (target.base_url) included.
git clone https://github.com/N4darae/shrt
cp -r shrt/examples/inventory /tmp/inventory-demo
cd /tmp/inventory-demogo build -o inventory .
./inventory & echo $! > inventory.pidIt listens on 127.0.0.1:8080, which is also where shrt init looks by default. If that port is
taken, the service exits with address already in use. Start it with -addr 127.0.0.1:9090
instead, pass -base-url http://127.0.0.1:9090 to shrt init, and give the same -addr again
when you start release 2 in step 6.
export API_USER=demo API_PASSWORD=demo-password
shrt init
shrt doctorinit builds the descriptor from the protos, guesses which rpc is the login, and logs in once to
see how responses report success. Two of its lines say what it found:
write .shrt/config.yaml auth: inventory.v1.AuthService/Login, GUESSED from the descriptor: check it and the credential variables it names
write .shrt/config.yaml conventions: envelope_path status.code, envelope_ok OK (read from one Login answer)
The descriptor is the compiled form of the protos, kept in .shrt/descriptor.binpb. The envelope
is the field every response of this service uses to report success, here status.code, which is
OK when a call worked.
Credentials stay in the environment. The config refers to them as ${env.API_USER} and
${env.API_PASSWORD}, so export them again in any new terminal you run shrt from. Passwords and
tokens are redacted from every run record.
A contract says what each rpc should do: which fields it requires, where each value comes from, how
it refuses, and what a write does to numbers. shrt contract init -all writes a skeleton full of
TODOs, which you (or an agent) fill in from the service's code. The example ships a filled-in one,
and the cp below replaces the skeleton with it:
shrt contract init -all
cp contracts/inventory.yaml .shrt/contracts/
shrt contract lintThe line that matters most for this demo is in AddStock: effects: {qty_on_hand: {increase: qty}}.
It tells the planner that stock read after an AddStock should have grown by qty.
shrt contract plan -all -writeThis writes one chain per rpc, four chains and 53 steps in all. Each one calls its rpc the normal
way and then probes it: the boundary values in the contract, a missing token and a bad one, an id
nobody created, a duplicate sku. Around the first AddStock call the planner reads the item once
before and once after, and the read after asserts the stock the effects line works out.
shrt gate
shrt confirm -all -note "release 1 of the inventory demo"
shrt confirm -all -approve -by you@example.comgate sends every chain once, and all four pass. On this first run it also writes
.shrt/hollow-baseline, the number of read steps that passed while the response carried nothing.
Later gates fail when that count moves away from it, so every change to it shows up as an edit to
the file.
A safe spot is shrt's name for a chain's approved baseline run. confirm -all proposes each passing
run as one and prints a table of what was run and which refusals each chain asserts. Only a person
approves: an agent driving shrt is told to show that table and wait for a yes. Once approved, each
response field becomes part of the baseline, including fields no assertion checks.
kill "$(cat inventory.pid)"
./inventory -release 2 & echo $! > inventory.pid
shrt gateFAIL inventory-addstock regression: get_item_after_add_stock (ItemService/GetItem) item.qty_on_hand want=5 got=0; unclear: write add_stock (ItemService/AddStock) or the read
PASS inventory-createitem
PASS inventory-getitem
PASS inventory-login
checking session lifetime of auth profile default: holding a fresh token 2.2s (-no-session-check skips this)
session check: early token refusal was a restart (fresh token held 2.2s accepted)
failures by suspect rpc:
ItemService/AddStock or the read ItemService/GetItem: 1 step(s) in 1 chain(s); e.g. inventory-addstock get_item_after_add_stock
shrt gate: FAIL: 1 of 4 chain(s) failed; details: shrt verify <chain>, or shrt run <chain> -keep-going
The restart threw away the token shrt had cached, so the backend refused it. Before blaming the backend for ending sessions too early, the gate holds a fresh token for a few seconds (30 at most) and checks it is still accepted; that is the pause you see. The gate exits 1, so in CI it fails the build.
shrt verify inventory-addstock shows the evidence. AddStock answered 5, but the read after it
still says 0, the stock the read before it saw:
inventory-addstock: DRIFT (regression), 1 step(s) changed vs safe spot ...; first: get_item_after_add_stock (ItemService/GetItem) item.qty_on_hand want=5 got=0; unclear: write add_stock (ItemService/AddStock) or the read: answered qty_on_hand=5, but GetItem read 0
add_stock sent {"id_item":"item-11","qty":"5"}
[get_item_after_add_stock] changed item.qty_on_hand want=5 got=0
not counted: 50 (-masked lists them)
The last line counts the values kept out of the comparison, such as ids, tokens and names built from
the run's own tag, which differ on every run by design. shrt verify inventory-addstock -masked
lists them.
When you are done, stop the service and remove the directory:
kill "$(cat inventory.pid)"
cd .. && rm -rf /tmp/inventory-demoIn a real repository you commit .shrt/config.yaml, .shrt/hollow-baseline, the contracts, the
chains and the safe spots, and run .shrt/ci-gate.sh (written by init) in CI against each new
release. That script runs from the root of a git repository, so it does not work in the demo
directory.
Chains create records and send deliberately bad requests, so pointing one at production would
write test data there. shrt only sends to this machine (localhost, a 127.x.x.x or ::1
address, or 0.0.0.0) unless the host is listed in the config:
target:
base_url: https://staging.example.com
allow_hosts: [staging.example.com]With a host missing from that list, run, verify, gate, chain slice -verify, chain pin and
init's login all refuse before the first call and print the line to add. run -dry-run still works, because it sends nothing. The same
check applies to target.host_override. shrt cannot tell staging from production by itself, so list
only backends whose data you are willing to have changed. It also cannot see through a local port
that forwards somewhere else: an SSH tunnel to production on 127.0.0.1 passes the check.
shrt init installs .claude/skills/shrt/SKILL.md, a subagent that writes contracts, and the agent
docs under .shrt/docs/. The sources of those docs are in docs/agent/: the command
reference, every config and chain key, the procedures, and a symptom-to-fix list. The design and its
limits are in docs/OVERVIEW.md.
Every command prints its flags and exit codes with -h.
MIT. See LICENSE.