Skip to main content

Puddlerouter

@puddleworks/puddlerouterv2026.11.10.3· 13d agoBEHAVIORSWORKFLOWSEXTENDSACCEPTED WARNINGS
01README

Routes each turn typed into Claude Code to swamp, Jev or Claude. In live mode Jev answers yes/no questions without Claude; shadow mode (the default) logs what live mode would do and always lets Claude run.

02Behaviors1
@puddleworks/puddlerouterv2026.11.10.3puddlerouter.ts
fn alwaysLlm(text: string, repoDir?: string)
Check the turn against the alwaysLlm list in puddlerouter.yaml; store `alwaysLlm`.
ArgumentTypeDescription
textstringThe cleaned turn text.
repoDir?stringThe runtime repo; its puddlerouter.yaml lists the phrases.
fn merged(text: string)
If the turn only says a PR merged, check the PR and its worktree
ArgumentTypeDescription
textstringThe cleaned turn text.
fn stats(days?: coerce.number)
Count the stored replies of the last `days` days: turns, routes,
ArgumentTypeDescription
days?coerce.numberHow many days back to count; replies are kept for 14.
fn split(turnFile: string, repoDir?: string, maxChars?: number)
Read a turn file, cut the turn into pieces and try the first
ArgumentTypeDescription
turnFilestringPath of a copy of the turn file; the hook writes it with mktemp.
repoDir?stringThe runtime repo: its puddlerouter.yaml and its recipes instance.
maxChars?numberLongest cleaned text kept, as in load.
fn search(text: string, sourceRef?: string, repoDir?: string, capture?: boolean)
Search for extensions that could answer a turn; store `search`.
ArgumentTypeDescription
textstringThe cleaned turn text.
sourceRef?stringThe turn's sourceRef; the key of the Capture request logged for it.
repoDir?stringThe runtime repo; its puddlerouter.yaml adds allowlist entries.
capture?booleanThe turn had a capture: prefix: skip the search, draft the request as is.
fn load(turnFile: string, maxChars?: number)
Read a turn file, clean it and store it as `turn`.
ArgumentTypeDescription
turnFilestringPath of the file holding the turn text. The hook writes it with mktemp.
maxChars?numberLongest cleaned text kept; the rest is cut off.
fn recall(sourceRef: string)
Read Jev's earlier answers for the turn from the route cache; store `recall`.
ArgumentTypeDescription
sourceRefstringThe turn's sourceRef; the route cache key.
fn reply(mode?: enum, sourceRef: string, capture?: boolean, alwaysLlm?: boolean, choice?: string, confidence?: number, cutoff?: number, hookStartedAt?: number, complete?: boolean, yes?: number, answerCutoff?: number, matchKind?: enum, recipeId?: string, resultAction?: string, resultOk?: boolean, resultText?: string, confirmAction?: string, confirmOk?: boolean, confirmText?: string, confirmError?: string, confirmRecipeId?: string, candidates?: array, pickChoice?: string, pickConfidence?: number, requestUrl?: string, mergedMatched?: boolean, mergedOk?: boolean, mergedText?: string, mergedSummary?: string, mergedError?: string)
Turn the route into a reply for the hook; store `reply`.
ArgumentTypeDescription
mode?enumshadow logs the route and always passes; live acts on it.
sourceRefstringThe turn's sourceRef.
capture?booleanThe turn had a capture: prefix, so it goes to Capture whatever Jev or the cache says.
alwaysLlm?booleanThe turn matched a listed phrase, so it goes to Claude whatever a recipe or the cache says.
choice?stringJev's route; empty or missing when the route step did not answer.
confidence?numberJev's confidence in `choice`.
cutoff?numberBelow this confidence the route is llm.
hookStartedAt?numberWhen the hook started, in ms since the epoch; 0 or missing if unknown.
complete?booleanThe turn's `complete`. A decision is only answered for a complete turn.
yes?numberJev's probability that the answer is yes; null if it was not asked.
answerCutoff?numberA yes needs `yes` at or above this, a no at or below 1 minus this.
matchKind?enumrecipe if the `match` step matched, else the `search` step's kind.
recipeId?stringThe matched recipe's id.
resultAction?stringWhat `execute` did: ran, ask, would-ask or none; empty if it did not run.
resultOk?booleanTrue if `execute` gave an answer.
resultText?stringThe recipe's answer, or the plan it asks about.
confirmAction?stringWhat `confirm` did with a plan: ran, refused or none; empty if it did not run.
confirmOk?booleanTrue if the confirmed recipe ran.
confirmText?stringThe confirmed recipe's answer.
confirmError?stringWhy `confirm` ran nothing.
confirmRecipeId?stringThe recipe the plan was for.
candidates?arrayExtensions found by search, in c1, c2, c3 order.
pickChoice?stringJev's pick: c1, c2, c3 or none.
pickConfidence?numberJev's confidence in the pick.
requestUrl?stringThe Capture request logged for a turn nothing could answer; empty if none was.
mergedMatched?booleanTrue when the `merged` step found the turn only says a PR merged.
mergedOk?booleanTrue if the merged check ran.
mergedText?stringWhat the merged check found and the steps to finish.
mergedSummary?stringThe merged check in one line, e.g. #12 clean.
mergedError?stringWhy the merged check failed; empty if it ran.

Resources

turn(14d)— The cleaned text of the last turn and its sourceRef.
reply(14d)— What the hook should do with the last turn, and why.
search(14d)— The extensions a search found for a deterministic turn, and the request to log.
recall(14d)— Jev's earlier answers for the turn, from the route cache.
routeCache(7d)— Jev's route, decision and pick for a turn, kept 7 days.
searchCache(1d)— Extensions a search found, kept 1 day.
merged(14d)— Whether the turn only says a PR merged, and what checking it found.
stats(1d)— The shadow log's totals for the last few days, for the router-stats recipe.
split(14d)— The turn cut into pieces, and whether the first only says merged (logged only).
alwaysLlm(14d)— Whether the turn matched a phrase that always goes to Claude.
03Workflows3
@puddleworks/puddlerouter9366b226-da00-46dc-9a1c-1e6ad0d4c39d

Route one turn typed into Claude Code. The hook writes the turn to a temp file and passes only its path. load cleans and hashes the text. alwaysLlm sends a phrase listed in puddlerouter.yaml straight to Claude. confirm runs a plan the last turn showed if this turn is only a yes, and drops it otherwise. @puddleworks/recipes then tries to match a recipe, whatever Jev would say, and runs it, or asks first if it makes changes. Only if none matches does Jev pick a route and answer the yes/no question

mainload, alwaysLlm, recall, confirm, merged, match, route, decide, search, pick, execute, raise, reply.
1.loadpuddlerouter.load— Read the turn file; store the cleaned text as turn.
2.alwaysLlmpuddlerouter.alwaysLlm— Check the turn against the alwaysLlm list in puddlerouter.yaml. A hit goes straight to Claude: only confirm and reply still run. Skipped for an empty or withheld turn and a capture: turn, which goes to Capture whatever it says. A failure only loses the check.
3.recallpuddlerouter.recall— Read Jev's earlier route, decision and pick for this exact turn from the route cache (7 days). Never fails; a miss sets every flag false.
4.confirmrecipes.confirm— If the last turn in this session showed a plan, run it when this turn is only a yes and drop it otherwise. A capture: turn or a phrase on the alwaysLlm list is never a yes. Skipped in shadow mode, which never keeps a plan, and with no session.
5.mergedpuddlerouter.merged— If the turn only says a PR merged ("merged", "12 is merged"), check the PR and the worktree it was built in, read-only, and store the steps to finish. Jev and the recipes are then skipped. Skipped for an empty, withheld or capture: turn, a phrase on the alwaysLlm list and a yes confirm handled; a failure only loses the hint.
6.matchrecipes.match— Try the turn against the recipes, through @puddleworks/recipes, before asking Jev anything. A hit is deterministic whatever Jev would say, so route, decide and search are skipped; a failure carries on to route. Skipped for an empty, withheld or capture: turn, a merged turn, a phrase on the alwaysLlm list and a yes confirm handled.
7.routejev.choice— Ask Jev which route the turn should take. Skipped for an empty turn, for a turn that looks like it holds a secret (never sent to Jev), when the route cache already holds the answer, and for a merged turn, a turn sent with the capture prefix, a phrase on the alwaysLlm list, a turn a recipe matched or a yes confirm handled.
8.decidejev.noul— Ask Jev the yes/no question in the turn. Skipped unless the route is a decision at or above the cut-off (fresh or cached) and the turn is complete (nothing pasted, fenced or cut, so the text to judge is all there), when the route cache already holds the answer, and for a merged or capture: turn, a phrase on the alwaysLlm list, a turn a recipe matched or a yes confirm handled.
9.searchpuddlerouter.search— Search for extensions when no recipe matched a deterministic turn. If match failed it still runs, so the turn is not lost. A capture: turn always runs it (unless empty or withheld) and gets the request draft with no search. Skipped for a merged turn, a phrase on the alwaysLlm list or a yes confirm handled.
10.pickjev.choice— Ask Jev which extension search found, if any, can answer the turn. Skipped unless search found candidates, and when the route cache already holds the pick.
11.executerecipes.execute— Run the matched recipe, through @puddleworks/recipes, or show its plan if it makes changes. Skipped unless match found a recipe.
12.raise— Log one request in Capture as a draft, through @puddleworks/capture-log-request, for a deterministic turn that no recipe or allowlisted extension can answer, or for a capture: turn. The turn's sourceRef is the Idempotency-Key, so the same turn gives the same request. Live mode only, so shadow mode has no side effects.
13.replypuddlerouter.reply— Store what the hook should do. Runs whether or not Jev answered.
@puddleworks/puddlerouter-key-checka621994d-33e8-4822-bea0-1ea5d8764449

Check that Jev's API key still works, and raise a GitHub issue when it does not. An expired key makes every route step fail, and the router fails open, so without this check routing stops silently. The hook starts this on the first turn of each day; the schedule only fires under swamp serve.

main
1.checkjev.choice— Ask Jev the kind of question a route step asks. It needs a valid key and an account that may use the model, and stores a new version of jev's choice-key-check data when it succeeds. Listing models is not used: OpenCode Zen answers in a shape @swamp/typesafe-ai rejects.
2.raisegithub.create_issue— Raise one issue per outage. The key counts the successful checks so far, so it stays the same until the key works again.
@puddleworks/puddlerouter-split012f461a-19fa-48b5-9595-53776f74dead

Log what a routed turn's first piece would hit on its own (issue #25). split reads a copy of the turn file, cleans it as load does, cuts it at commas, "then", sentence ends and spaced dashes, and tries the first of two or more pieces against the merged phrasing and the recipes (match only). Nothing reads what it stores. The hook starts this in the background as it exits, after the reply, so no turn waits for it. Nothing is stored for an empty, withheld or capture: turn, or a phrase on the always

main
1.splitpuddlerouter.split— Split the turn and store what its first piece would hit.
04Extends1
@swamp/gitgit_worktrees.ts
fn worktree_list()
List the repo's worktrees (read-only, via git worktree list --porcelain).

Resources

worktreeList(ephemeral)— The repo's worktrees: path, HEAD, branch and flags.
05Previous Versions3
2026.11.09.2
2026.11.05.1

Modified 1 behaviors

2026.10.13.2
06Stats
A
93 / 100
Downloads
12
Archive size
66.7 KB
  • Has README or module doc2/2earned
  • README has a code example1/1earned
  • README is substantive1/1earned
  • Most symbols documented1/1earned
  • No slow types (deprecated)1/1earned
  • Dependencies pass trust audit2/2earned
  • Docs keep secrets in a vault1/1earned
  • Has description1/1earned
  • Platform support declared (or universal)2/2earned
  • License1/2partial

    no SPDX license declared

  • Verified public repository2/2earned

08Platforms