πΊ
jaga
A multi-channel LLM reverse proxy that observes, rewrites, and accounts for every model request on the box.
Rust
tokio / hyper
SSE streaming
systemd
observability
The problem
Several AI coding agents run on one machine, each against a different upstream
(Anthropic, OpenAI, a self-hosted lane). There was no single place to answer
what did they actually send, what came back, how long did it take, what did it
cost β and no way to rewrite a request in flight without editing every client.
What I built
A Rust proxy (tokio/hyper, ~4,400 lines across 7 modules) that sits between each
agent and its upstream. One binary, seven listeners defined in config β each with
its own upstream and protocol. Per request it forwards faithfully, strips configured
prompt fragments, tees a normalized event stream to disk and a companion dashboard
via a non-blocking shadow observer, and records per-call latency and token counts.
systemd-managed with Restart=always; --version stamps the
release, exact git SHA, and a -dirty flag so "what's running" is never
a guess. A read-only dashboard tails those feeds and merges them with local usage
history β zero extra instrumentation in the hot path.
Technical depth
The hardest module is a streaming Anthropic β OpenAI protocol translator
β it re-emits one wire format's server-sent events as the other's, incrementally,
without ever buffering the full response.
β a real bug I fixed
A replay gate was blocking the translator cutover. The upstream model sent
finish_reason: "" β an empty-string placeholder β on every
mid-stream chunk, and the emitter treated Some("") as a terminal
signal, closing and reopening the content block on each delta:
292 content_block_start events for a single tool call
(130 empty vs 1 real), confirmed against captured traffic.
The fix was a one-line !finish.is_empty() guard, matching guards
already used elsewhere in the same file. In the same pass I made rule compilation
fail loud (print + exit) instead of silently dropping a regex that
won't compile β a previous bug had no-op'd exactly that way.
Why it matters
- Observability without touching clients β the classic proxy pattern, done at protocol level.
- Streaming correctness under a real, messy wire format.
- Regression tests built from captured real traffic: 73/73 tests green, clippy + fmt clean, 12/12 streaming captures verified.
- A later shipped fix in the same codebase β a UTF-8 boundary panic surfacing as a client-side connection reset β was root-caused from logs, reproduced in a test that provably panics on the pre-fix code, then fixed.
βοΈ
mag
A resident warm-pool shell runner that turns "re-establish your context every command" into a solved problem.
Rust (2024)
axum / tokio
systemd socket activation
unix sockets
The problem
A default agent shell is stateless: every command spawns a fresh process, so
cd, export, and activated virtualenvs evaporate between
calls. Any multi-step workflow re-establishes its own context every invocation β
and cold process spawn dominates latency when the real work is a 5 ms
git status.
What I built
mag β a resident shell runner (~7.9k lines of Rust, clippy::pedantic
enforced) backed by systemd-managed daemons holding pre-spawned bash shells. Jobs
dispatch in ~5β10 ms. Named sessions pin a warm shell so environment, working
directory, and functions survive across calls.
Technical depth
- Transport over per-instance unix sockets via systemd socket activation; a templated unit splits daemons by uid, since one process can only be one user.
- Session storage is an in-memory map keyed
<caller>:<session> behind a mutex; an idle reaper evicts stale shells, and the named-session cap is clamped below the worker count so pinned sessions can never starve the default lane.
- Resilience: partial pool-spawn failure reaps already-spawned children rather than orphaning them; every claim calls an
ensure_alive() check so a watchdog-killed shell restarts transparently instead of handing the next caller a broken pipe.
β two real bugs I fixed
Silent no-op. The session ID was honoured on one code path but
silently discarded on the simple lane used 95% of the time β so every
call looked continuous while getting a fresh shell. Diagnosed by diffing
the shell PID ($$) across calls; fixed by making session fields
envelope-level and orthogonal to the lane.
Identity collision. Caller identity came from an environment
variable that every privileged instance inherited the same value from β
misattributing 345 audit rows and letting two callers share one named shell.
Fixed by deriving identity from the socket the connection arrived on,
making it unspoofable by the client.
Why it matters
Persistent, low-latency shell context for many concurrent callers, with a full
audit trail and honest failure reporting β a pid=gone
verdict says the bookkeeping outlived the shell rather than guessing at the truth.
π‘
reactor
A ground-truth orientation service β one call answers "what is actually true on this box right now," and it refuses to manufacture a green light.
Julia
unix socket + CLI + HTTP
SQLite code graph
SRE
The problem
Every fresh session on a 40-service box started the same way: guessing. Is the
daemon up? What owns port 8787? Which files break if I touch this one? The answers
existed β in systemctl, /proc, a code graph, a memory DB β
but reaching them meant a dozen shell calls, and a wrong guess reads exactly like a
right one. Worse, a dead unit, a unit stuck in auto-restart, and a unit systemd
calls "active" whose socket never answers are three different bugs β calling all of
them "down" hides the useful part.
What I built
A resident Julia daemon holding one warm, JIT-compiled module, reachable through
three cheap doors: a unix socket, a CLI, and an HTTP endpoint. Read-only by design.
The verb set (service Β· port Β· health Β· impact Β· resolve Β· why Β· β¦) is
generated from the routing table itself, so the help can't drift from behaviour, and
verbs compose β resolve cli.rs | impact β because each returns a typed
result, not prose.
Technical depth
- Honest zeros. Every result carries a value, a provenance chain, and an explicit "unanswered" slot β five named zero-causes distinguish "isn't there" from "I couldn't reach that source." Partial answers are first-class.
- Live, not cached. Health probes shell out to
systemctl on both buses, then probe the socket only if systemd already claims active, and read the machine's own service roster rather than a private copy that could disagree.
- Blast radius. The "who depends on this file" verb reads a SQLite code graph ranked by the depender's centrality; a
0 rdeps verdict β the only one that invites deletion β is cross-examined against disk, which once caught the graph certifying a file as safe to delete that the parser had never actually entered.
β a real bug I fixed
First session using reactor as a live dashboard, its health sweep immediately
flagged a service flapping with 500+ restarts and climbing β a
state that had been failing silently. Traced it: a browser was being launched
without its remote-debugging port, so the controller had no endpoint to attach to
and died on every start. The catch was only possible because "flapping" is
a distinct verdict (auto-restart substate, or dead with >5 restarts) β a plain
up/down check shows green between restarts and misses it entirely.
Why it matters
Orientation becomes a single call instead of a guessing game β and the tool refuses
to lie: an empty roster returns a gap, not a clean bill of health. Two of its guards
exist because the tool lied once, was caught, and the fix was written into
the code with the receipt beside it.
π§΅
ariadne
A static cross-language dependency graph over 62 projects in 4 languages, refreshed nightly, that answers "what imports this?" before you delete it.
Rust
SQLite
systemd timer
multi-language parsing
The problem
Sixty-plus projects across four languages (Rust, Python, Julia, Kotlin/Java) on one
machine β no monorepo, no shared build system. Before touching or deleting a file,
the real question is what imports this? β and grep can't answer it across
language boundaries. Existing tools index text; nothing indexed relationships.
What I built
A Rust CLI that parses import statements per language into a normalized SQLite graph
(roots / paths / edges / unresolved), with query verbs for imports,
reverse dependencies, relatedness, and neighbourhoods. Around it, an automated
nightly pipeline (systemd timer): a discovery pass finds project roots by marker
files, the scan writes to a staging DB, and it is promoted over live
only if it passes sanity gates (non-zero paths; no >50% drop). A failed
scan leaves the working graph untouched. Live: 62 roots, 1,466 files, 3,043 edges.
Technical depth
- Per-root transactions, so a mid-scan crash can't leave half-written edges β and the scan-run record is opened outside the transaction so crash evidence survives the rollback.
- Unresolved imports are recorded with the correct language tag rather than dropped, with a "looks like ours" heuristic so standard-library noise doesn't flood the table.
β a real bug I fixed
The path resolver matched a bare relative path across all roots and
silently returned the lowest row id. 24 of 62 roots contain a
src/main.rs, so "reverse-deps of src/main.rs"
was confidently answering about a coin-flip project β the worst failure mode for a
tool people trust before deleting code. Fixed with layered resolution
(absolute β cwd-relative β bare path only if unique) that refuses loudly
on ambiguity, listing every root that holds the path.
The same pass caught two silent-loss bugs β a comment stripper that only understood
// (so a Julia using Foo # note produced neither an edge
nor an unresolved row) and an insert that hardcoded the language tag. After the fix,
unresolved rows went 74 β 275 with honest tags: the graph stopped lying
about how much it knew.
Why it matters
Delete-safety and blast-radius answers on demand, across languages, kept current
without anyone remembering to run it. The staging β gate β promote
pattern means the automation can never degrade the thing it maintains.
π
knowledge
Indexed full-text search over a ~900k-file tree β sub-second where a recursive grep never returns β with an enforcement layer that makes the slow path unreachable.
Rust / Tantivy
Bash
BM25
pre-execution hook
The problem
grep -r across a ~900k-file tree doesn't just run slow β it hangs the
session that launched it. But everyone reaches for grep by reflex. The fix had to be
both a faster tool and a mechanism that made the slow path unreachable β
because a tool nobody remembers to use isn't a fix.
What I built
knowledge β a CLI front-end over a Rust/Tantivy full-text daemon. One
entrypoint, two modes: an indexed BM25 content search, and a knowledge grep
bridge that forwards verbatim to a fast live scanner. Live: 912,520 documents,
388 ms query latency β versus a full-tree grep that never returns.
Technical depth
- The grep bridge is the real work: grep's flags don't map cleanly onto the modern scanner (some silently misfire, some are meaningless), so they're translated or dropped explicitly β and hidden/ignored files are always forced on, because a tool claiming to be an honest grep replacement can't silently skip exactly the dotfiles debugging hunts for.
- Enforcement lives in a pre-execution hook: simple grep invocations are rewritten in place to the indexed search (the span only, leaving pipes and redirects intact); anything else is denied with an escalating message keyed to a per-session counter β by the third attempt it stops suggesting flags and challenges the approach.
β real bugs I fixed
Silent query narrowing. A multi-word query kept only the last word
β each bare term clobbered the previous. Now joined. Silent wrong answers are
worse than loud failures.
Flag-unbundling corruption. Stripping one letter from a bundled
flag group also corrupted an adjacent argument-taking flag, which then ate the next
token as its value. Fixed by stopping the unbundle at the first argument-taking
letter and copying the tail through untouched.
Why it matters
Search went from session-hanging to sub-second at ~900k documents, and the
enforcement layer means the fast path is the only path β no
discipline required. The honest tradeoff (the index can be import-stale) is surfaced
in the tool itself, and the live-scan escape hatch is a first-class mode, not a
fallback.
π§
The Spine
A persistent semantic-memory subsystem giving a long-running agent continuity across sessions β retrieval that blends similarity with time-decay.
Python
PyTorch
SQLite (FTS5)
sentence-transformers
The problem
Conversational AI is stateless β every session starts from zero. Re-feeding whole
transcripts doesn't scale: slow, costly, and it buries the signal. The system needs
to start with the right context, not the whole history.
What I built
A memory subsystem that ingests session summaries and structured recall cards,
encodes each into a vector, and retrieves the relevant ones at wake-up so the agent
starts with context rather than a blank slate. A sentence-transformer produces a
384-dim embedding, projected down to a compact 128-dim vector; an idempotent CLI
exposes ingest / query / recall / status / decay.
Technical depth
- Retrieval blends semantic similarity with a time-decay half-life (old memories fade rather than vanish) plus a recency-reinforcement boost.
- Atomic writes with row-and-vector count verification against corruption; auto-chunking and token-budgeting for long documents.
- Scale: 202 sessions and 668 memory records indexed, sub-second query latency over the full corpus.
Why it matters
A practical, fully-local retrieval layer β the same problem space as production RAG
(embeddings, vector retrieval, ranking, decay, data integrity) β built and run
end-to-end rather than bolted together from a framework.
π¬
orchestra
A verified message-delivery lane between many concurrent AI agent processes β it reports what actually happened, and refuses to fake a green light.
Python
unix socket daemon
newline-JSON protocol
/proc introspection
systemd
The problem
Nine concurrent AI agent processes, running as long-lived terminal sessions under two
different user IDs, need to hand each other work. The only transport available injects
text into a pane β and by its own docs, "errors are not reported β¦ send-text always
succeeds, even if no text was sent to any window." A transport that structurally
cannot fail is worse than one that fails loudly: every delivery looks green, and
the first symptom of a dead lane is a task nobody did.
What I built
A resident daemon (~460 lines, a unix socket speaking newline-delimited JSON) doing
exactly one job β deliver a message to a named agent and verify it landed
β with a thin CLI on top. Delivery isn't a boolean: it returns one of three honest states β
unknown (couldn't resolve the target, nothing sent), reached
(characters read back off the recipient's screen), or sent (the send returned
but read-back didn't confirm). Deliberately absent: heard β whether the agent
understood isn't knowable from this side of the glass, so the tool refuses to imply it.
Technical depth
- Truth from the calls that can fail. Confidence comes from a match-check before (exits non-zero honestly on a miss) and a screen read-back after β not from the fire-and-forget send in between.
- Guard rails in the tool, not the docs. It refuses a pane that has dropped back to a shell (where an injected message becomes a command the shell would run), never fuzzy-matches a target name (a near-miss delivers your brief to the wrong agent, silently and permanently), and verifies the recipient's user ID can actually read the file you're pointing it at.
- One roster, no silent fallback. A single source-of-truth roster file β the tooling had grown one roster per transport and they disagreed, which is how a target once ended up with no delivery lane at all. The degrade-to-older-transport fallback was removed on purpose: it turned "this agent has no pane" into a second, more confusing failure that hid the first.
β a real bug I fixed
The read-back probe was a naive substring check. Panes wrap long lines, so the
probe straddled a newline that only exists on screen β and the tool reported
sent (its "suspicious, unconfirmed" state) for messages that had in fact
landed, been read, and been replied to. An instrument that cries failure
on success gets ignored exactly as fast as one that cries success on failure.
Fix: compare with all whitespace squashed, and poll to a deadline instead of
sleeping a fixed guess β the old fixed 150 ms sleep meant the reported
latency was measuring the sleep, not the lane. A sister bug in the same class: injecting
into a pane whose agent had quit was inert only because the text happened to
start with #. Luck, not design β which became the shell-occupant guard,
walking /proc descendants because the terminal reports only the top
foreground process and privileged agents launch under sudo.
Why it matters
The system stopped producing confident lies. Every send now returns evidence or an honest
refusal, and the failure modes that used to be invisible β dead listener, quit agent,
unreadable path, wrong-user socket β each surface as their own distinct message. It is the
message bus behind a multi-agent workflow where every handoff carries a sender, a
recipient, and a verifiable outcome.