Published July 14, 2026
| Version v1.6.0
Software
Open
smartpipe: semantic pipes for your terminal
Authors/Creators
Description
[1.6.0] — 2026-07-14
- Make graph entity-name folding report determinate per-name progress and use an exact chunked NumPy GEMM strategy when available, with the pure-Python implementation as a dependency-free fallback. The shared
distinctleader-clustering semantics remain input-order stable and first-match exact.
Added
doctor --probenow exercises every configured remote role (C8). In addition to the five-call modality/schema baseline and optional remote STT, configuredocr-model,fallback-model, andmedia-embed-modelroles each receive one deterministic tiny request through their real container wire. The announcement derives its count from successfully built plans; build faults spend nothing and render their own✗row, while runtime faults never suppress later role exercises.- Ollama structured-output and vision conformance (C7). Schema-attached
Ollama requests now ground the exact schema in the user message while retaining
the native
format;:cloudtags warn eagerly about unenforced schemas, carry a picker capability chip and post-pick note, and are refused by--local-onlyfor every role. Doctor anddoctor --probenow expose schema capability, with the probe exercising one tiny schema-shaped reply. graphhonors the stt-model role in the scanning modes (C4 #20).--fastand--name-topnow transcribe audio and video tracks through the resolvedstt-model—--stt-model(new flag, shell-completed) >SMARTPIPE_STT_MODEL> config, where configuring or flagging the role IS the consent (theocr-modelrule). The resolve doubles as a preflight: a missing key, an unsupported wire, or a--local-onlyfence hit faults at SETUP (2) before a byte is read. A paid wire is disclosed once per run (transcribing audio via openai/whisper-1 (paid transcription)) on top of the per-row conversion notes;stt-model = "local"rides the same seam free and quiet. Bare--faststays byte-identical, local, and free — no chat ref is consulted, so an ambient OpenAI key changes nothing. The flag refuses outside the scanning modes (--stt-model rides the scanning modes — pair it with --fast or --name-top); full mode's native ladder is a ledgered follow-up. The--fastreceipt's cost segment now reads the live meter (still0 tokwhen nothing metered) so a paid transcription shows up in it.- You can always see it working (C2 #19/#32/#36/#37). Four visibility fixes
with one pinned rule behind them — every phase that can hold the terminal for
more than ~2 seconds owns a visible element, painted immediately:
- First paint at
start()(#36/#37). Every status line now shows its zero state the moment its phase begins —0% · 0/Nfor a known total,Processing [0] 0.0/sfor an unknown one, the caption for a pending wait — instead of waiting for the first completion. The fold bar's first byte no longer waits on the first embed batch (which an admission cooldown plus the retry ladder can hold for minutes);start(0)and non-TTY stderr stay silent. - A terminal arbiter for diagnostics (#32). Every one-line stderr message
(notes, warnings, previews, the drain summary, an error screen's first
line) now erases the live status line, prints whole, and lets the line
redraw — from any thread. A local-NER note fired from a worker thread used
to glue onto the pending caption (
…preparing local NER modelnote: …); that interleave is now structurally impossible. The raw SIGINT acknowledgement stays lock-free by design. - Plain
--inglobs read lazily (#19). Whole-crate file lists now load each file only when the pipeline pulls it — a 62-file MP3 corpus no longer transcodes in silence before the first bar frame. The read bar's total is the number of files the glob NAMED (an unreadable file warns, skips, and honestly leaves the bar short of 100%); chained pipes keep streaming with an unknown total. One accepted delta: a glob whose files all fail to load still spends the paid modes' one schema-canary probe (cached on rerun). - Fold and canary visibility (#37). The label-cluster fold now wears a
[fold]count line at all three call sites (fast scan, full, adopt), and the pre-spend schema canary wears a pending caption —checking the model holds the schema— while it probes. A PTY smoke pins the zero-state frames against a real terminal.
- First paint at
- A density hint when the graph is window math, not signal (C6 #34). The
scanning modes (
--fastand--name-tophybrid) now notice a near-complete graph — at least 20 folded nodes with the kept edges ≥ 0.8 of the C(n,2) possible — and say so once on stderr:near-complete graph (N of M possible edges) — everything co-occurs with everything; --window sentence tightens it, then --min-weight 2 keeps recurring pairs. The thresholds are structural (one long MP3 read as one chunk window makes a complete graph by construction), the guidance is ordered deliberately (--min-weight 2alone empties a one-window corpus), and hybrid fires the hint BEFORE its paid naming spend so Ctrl-C beats paying to name geometry. Full/adopt modes are untouched. - Graph batches its text chunks (C5 #21). The full-extraction and
hybrid-naming workers now ride the run's coalescing posture exactly like
map/extend/filter (item 62): eligible TEXT chunks pack onto the shared
coalescer (full's 4-property triple schema admits 10 per call, 6 with
--entities; hybrid's single-property naming schema admits 12), media chunks stay solo behind the wire semaphore, and the schema canary keeps firing solo. One packed flight charges one--max-callsunit; stdout is byte-identical batching on or off. The pre-spend plan note says true things while coalescing: it gains(batching may pack text chunks into fewer wire calls)and the belt-short tail softens from "the graph will be partial" to "may be partial"; batching off keeps today's strings byte-identical. - Embeddings and transcriptions now cache across runs (C5 #22). The one
result-cache posture, store, sweep, and receipt now cover four more
surfaces beside chat completions and OCR pages: text embeddings bank
PER TEXT (a rerun's graph fold embeds zero unchanged names; duplicate
texts in one call pay once; the on-device key carries the fastembed
version so an upgrade re-embeds), joint media embedders keep their
embed_partscapability marker through the cache (pixels stay uncached v1 pass-throughs), remote STT transcriptions key on provider/model/mime/bytes, and local whisper transcripts bank behind a synchronous ContextVar-installedTranscriptBankwhose hits skip the whisper model load entirely. Cache layers stay OUTERMOST — a hit never charges the belt, takes admission, or counts as a call — and the free graph fold stays off-belt AND banked. A cache-write failure never sinks a computed batch. NER is deliberately not cached (fast local inference; banking spans would flood the LRU for zero wire savings). SMARTPIPE_FIGURE_CAPresizes the per-document figure ceiling (C6 #35). The D32 default of 8 embedded figures per document item is now an env knob: whole numbers ≥ 1 set the cap; unset/blank keeps 8; anything else —"0"included, on purpose: attach-nothing is a cost off-switch, a different feature — refuses at SETUP (exit 2) before the first item is read, on every file kind: the knob is validated where each file-reading door constructs its figure census, so even an audio-only or csv-only corpus faults up front (a pure-stdin run never consults the knob — stdin items never attach embedded figures). The figure census rollup now names the knob when anything was capped ((100 capped — SMARTPIPE_FIGURE_CAP raises it)); the per-file note is unchanged.
Changed
- smartpipe says true things (C3 #28/#31/#33). Three honesty fixes.
Converted is not degraded: the disclosure ledger grew a third channel —
an expected conversion (whisper/stt transcript, LLM caption/watch, an
ocr-model parse) now prints a calm
note: converted:row instead of a⚠ degraded:warning; genuine loss (frames/figures dropped, a failed native attempt, OCR fallbacks) keeps the ⚠. Rollup order at end of run is pinned: converted → degraded → skipped. Live adopt receipt: piping edge records intographno longer prints a hardcoded· 0 tok— the receipt reads the meter, so a paid canonicalization fold shows its real spend (· run: ↑… ↓… tok); still byte-identical0 tokwhen nothing metered. Qualified --fast claims: help and docs no longer say "zero model calls" —--fastis on-device with no chat-model calls, and exactly two configured roles can spend, disclosed: a cloud--embed-modelon the name fold (entity names ride that wire) and a remote--stt-modelper clip (audio rides that wire). The caption-consent message now also notes that ollama:cloudtags ride Ollama's cloud, off-device (C7 ruling 2). - Result caching now ships ON by default (owner directive: always cache). The
posture ladder is unchanged (SMARTPIPE_CACHE > config
cache), but the unset default flips from off to on, mirroring batching's default-on:_cache_enablednow returnsconfig.cache is not False, andconfig show/usingreportscache on (default). Every explicit opt-out still works untouched (SMARTPIPE_CACHE=0/off/false/no at the env, orcache = falsein config.toml). - The
graphfold embedder now honors the configured embed-model, with a local fallback (owner ruling: specified wins). The name-canonicalization fold in every graph mode (--fast, a focus prompt,--name-top, adopt) now resolves its embedder through the same chainembeduses - a new--embed-modelflag > SMARTPIPE_EMBED_MODEL > configembed-model- and falls back to the free on-device local model only when nothing is set (the prior always-local behavior). Because a configured cloud embedder then spends even on the "free"--fastpath,fold_vectorsemits a one-line stderr disclosure (folding N entity names via <ref> (paid embeddings)) whenever the resolved fold embedder is a paid cloud wire — the on-device local model and free loopback/self-hosted ollama stay quiet. - The chat wire's breaker, concurrency gate, and failover are now composed as
decorators at the composition root. A new
models/resilience.pyprovides native-Python resilience combinators (retried,circuit_broken,rate_limited) plus theBreaker/Cooldowncollaborators, and the container stacks them into aResilientChatModel— the per-ref transport streak, trip signal, and concurrency semaphore thatOutboundCallPolicyowned for chat now live in first-class wrappers the root composes. The provider-down failover rides the same stack:circuit_broken(*, fallback_factory=…)owns the trip AND the wholesale swap — on the breaker opening it builds the configured fallback lazily and routes every later call to it for the rest of the run, raisingCircuitOpenTransport(switched=…)so the runner replays the held in-flight window onto the swapped target. Per-item verbs (map,extend,filter,join) now ask the container for oneresilient_chat_model()and run on the returnedWiredChat— a plainChatModelplus an honest answered-per-model receipt — and never branch on the wire's health. This retires the caller-handled failover machinery wholesale:verbs/common.py'sModelSlotandmake_failover, andrun_ordered'sfailover=/switch()seam (the runner keeps its held-window replay, now readingCircuitOpenTransport.switchedinstead of driving the swap itself). Behavior is preserved end to end — the failover contract's tests still pass byte for byte; embed/OCR/STT keep the shared admission policy (failover is a chat concern).
Fixed
doctor --probeexercises the resolved STT path (C4). The probe used to render a resolved display string as health — an invalid key, an unsupported wire, or missing whisper wheels all charted fine. A remote resolution now sends one tiny disclosed transcription through the real container wire (announced:probing modalities with 5 tiny calls (… · stt: whisper-1)) and reports the exercised truth under the matrix (stt: ✓ transcribed via openai/whisper-1, orstt: ✗with the wire's own first error line). Alocalresolution is verified but never run (no model download inside doctor):stt: – local whisper ready (not exercised); nothing resolved keeps today's 4-call announcement and adds no line.- A cut
graphfold no longer discards paid work (#30).fold_vectorsnow keeps every vector already embedded when the fold is cut — by a drained Ctrl-C (polled per batch, on the synchronous predicate only), by the--max-callsbelt, or by a wire fault mid-run (including a runtimeSetupFault: the wire dying mid-fold degrades to a partial fold instead of killing a fully-paid run). Already-embedded names still fold; the rest keep their spelling; the graph is always written. New stderr wordings:entity folding interrupted — N of M names embedded; the rest keep their spelling(note) andentity folding stopped early (…) — N of M names embedded; the rest keep their spelling(warn); the nothing-embeddedentity folding skipped (…)line is unchanged. The verb-levelfold_assertionscalls also run ungated now, so a latched Ctrl-C can no longer zero the salvage write (the owner's 28-minute, 0-byte loss). graphpreflights the fold embedder before any spend (#27). A broken embed config (missing key, chat-model-as-embedder) now faults at exit 2 at dispatch time, in every mode, before any read, NER grind, schema canary, or paid extraction — previously a small corpus could exit 0 on a config any real run would fault on, and a big run discovered it only after paying. The bare-terminal three-forms refusal still outranks the preflight (exit 64).- A belt-cut
graphfold flips the run to PARTIAL, never 0 (#29 ruling). The paid fold stays metered against--max-calls; when the belt cuts it, all four modes exit 1 with the salvaged graph on stdout, and the belt stop never wears thedone: interrupteddrain summary (that line is reserved for a real Ctrl-C). Free local/ollama folds stay off-belt and cannot flip the exit. - An over-belt OCR corpus now asks before it overspends (A8). The shared
ingestion preflight (
ocr_preflightinio/readers.py) disclosed a paid page count but never had the belt handle or a way to ask — so a 6,863-page scan corpus against a--max-calls 4000belt silently guaranteed a partial parse plus mid-read belt exhaustion. It now takes the run'sCallBudgetand atty_asker-style asker threaded throughresolve_items: when the billable pages exceed the remaining belt (limit − calls) at a TTY, it prints the joint math (~N OCR pages through <ref> exceed --max-calls (M remaining)) and promptsproceed with a partial parse? [y/N]before a cent is spent — exactly as the extraction preflight'sCONFIRM_PARTIALdoes. A decline abandons the manifest and reads nothing (a clean exit 0, zero pages billed;outliersnow treats the empty corpus as done like itscluster/distinct/top_ksiblings rather than raising a spurious "needs at least 3 items" usage fault) instead of falling through to a garbage binary read; a non-TTY run keeps today's disclose-and-proceed note; a corpus within the belt never asks.ocr_preflightnow returns a typedOcrDecision(route/fallback/declined) instead of a bare bool, and every OCR-capable verb (graph, map, extend, filter, embed, join, split, distinct, reduce, top_k, outliers, cluster, diff, and reader mode) threadscontainer.budgetdown to it. - A sustained rate-limit storm is now paced, not burned through. The
outbound-call policy (
OutboundCallPolicy, shared by the embed/OCR/STT wires) had no cross-call cooldown: a ref that returned429was retried immediately on its next admission, so a dedicated wire could exhaust its whole ladder in ~2 s. Two fixes work together. (1) Per-ref cooldown (A5.2): a429carrying a serverRetry-Afternow threads that hint onto the exhaustedRetryableError(a new typedretry_afterfield) all the way to the policy, which records a per-ref "not-before" floor and makes that ref's next admission wait it out — keyed perModelRef(a hot ref never stalls a different one), clamped to the 60 s abuse ceiling, extended-never-shrunk when concurrent429s disagree, and driven by an injected clock/sleep so it is deterministic under test. The wait happens outside the concurrency gate, so a cooling ref frees its slot for the other roles sharing the policy. (2) Longer dedicated OCR ladder (A5.3): the paid Mistral OCR wire is now built with its own frozenOCR_RETRY_POLICY(attempts=5, cap ~30 s) instead of the default 3-attempt chat ladder — a page parse is far cheaper to wait on than to re-buy, since every retry avoids a fresh paid conversion. The default chat ladder is untouched. - Paid Mistral OCR conversions are now banked across runs — a rerun re-reads
them for free instead of re-paying. The
ocr-modeldocument wire (MistralOcrParser, charged per page) had no cache layer, so every rerun re-uploaded and re-paid every page; a pilot spent 943 paid conversions (~$1.89) with nothing banked. A newCachingDocumentParsernow wraps that wire OUTERMOST —cache → admission → budget → parser, mirroring the chat cache — so a hit short-circuits before admission gates it or the page belt meters it. Both paid methods cache:parse_imagekeys on the image bytes and mime,parse_pdfon the file's bytes, each under the OCR model'sprovider/nameand a route tag so an image hash never collides with a pdf hash (nor one image format with another); the page tuple round-trips byte-identical. Banking is best-effort — an unwritable cache dir or a full disk never sinks a run that already paid for its pages. It rides the same posture (SMARTPIPE_CACHE), directory, and daily TTL/LRU sweep as the chat cache, and its hits join the once-per-runcache: N hits · M missesreceipt. (Vision-OCR page images already rode the chat cache; this closes the dedicated Mistral document wire.) - Regular-file redirects keep progress without corrupting downstream process
output (B3).
graph … > edges.jsonlstill shows its stderr status bar, but producers whose stdout is a FIFO, anonymous pipe, socket, or unclassifiable endpoint suppress carriage-return animation. The in-process terminal arbiter cannot coordinate a middle process's stderr redraws with a downstream process writing to the same terminal. Newline warnings, notes, and receipts remain visible. Graph's grind/fold notes now promise "progress below" only when their corresponding bar is actually visible. - Note floods no longer bury the load-bearing lines. Three high-volume
diagnostics now collapse the way the degrade ledger already does - the first few
print verbatim, then one rollup closes the run. Embedded-figure notes route
through a per-run
FigureCensus, so a 200-file corpus ends with onefigures attached: N files · M figuresline instead of N near-identicalnote:lines (a small run is unchanged).graph's per-chunk skip warnings bucket through the run'sDegradationLogkeyed by the reason prefix, so a run of identical schema failures rolls up toskipped: <reason> ×Ninstead of repeating one absolute-path line per chunk. The schema-mismatch message now truncates the echoed model reply (~160 chars) while keeping the pinned "does not match the schema" phrasing and jsonschema's own reason. And the OCR wire's 429/5xx errors render a human reason ("rate limited" / "server error") with the status code, never the raw JSON wire body. graphhonors--fallback-model- the failover was dead weight before. Both paid modes (a focus prompt for extraction,--name-topfor naming) now run on the composed resilient chat wire, so a provider-down primary trips the breaker and swaps to the configured fallback WHOLESALE, replaying the held window onto it - the sameswitching to <model> for the rest of the runline and answered-per-model receipt the per-item verbs print. A pilot run configured afallback-modelthatgraphsilently ignored; now it engages.graphproves the model can hold the schema before spending on OCR. Both paid modes now fire one synthetic extraction ("Alice pays Bob for the shipment.") through the compiled schema before any ingestion — full mode before the reader touches a paid page, hybrid before the naming loop. A model that cannot produce the typed shape (even after the one shape-repair rung) refuses at SETUP (2) naming the model and a fix, instead of burning the whole run — a pilot run spent 943 OCR pages and 7 extractions before a wholesale schema collapse. The probe charges one belt unit and is cached, so a rerun's check is free; the partial-run plan counts that unit, so a belt sized exactly to the corpus warns "partial" up front instead of silently dropping the last chunk — and the note reports what is LEFT in the belt ("2 left in the belt" for a belt-3 on 3 chunks), not the raw limit, so the shortfall is honest and a reader who raises the belt clears the chunk count instead of landing one short again. The probe is skipped entirely when the belt can't afford it plus real work (a--max-calls 1run does its one real call unprobed). An availability fault at canary time (belt/429/breaker) propagates as itself and is never mistaken for a capability verdict.- A model that keeps breaking the reply schema now says so, once. When a
schema-attached request comes back violating its schema even after the one
paid repair rung — so the item skips —
map(andgraph, whose chunks flow through it) prints one loud stderr line per run naming the model. A loose wire that only advises the schema (ollama'sformat, which many cloud models ignore) is told it "likely ignores constrained decoding"; a strict-enforcing wire (openai, mistral) doing the same is flagged as a possible provider-side regression. A run of skips now reads as "wrong model" instead of a mystery. - A fail-fast halt no longer throws away everything already extracted. When
the failure policy trips mid-extraction (too many chunks failed the schema),
graphfull mode now folds and writes the edges it already has to stdout, then exits ALL_FAILED (3) carrying that salvaged graph, instead of propagating past the writer and leaving a 0-byte file. A pilot run lost 7 good extractions and 943 paid OCR pages to this exact gap. Hybrid mode salvages too: the free co-occurrence graph is already whole, so a naming-model collapse stops only the naming pass and exits PARTIAL (1) with the strongest edges kept as co-occurs. - A failed OCR upload no longer eats a later document's page belt. The
dedicated OCR wire reserves a document's full page count against
--max-callsbefore uploading, so an over-belt PDF never uploads partially. When that upload then fails — a 429 ladder exhausted, the breaker open — the reservation is now refunded, because those pages were never converted; a dead document can no longer starve the documents that come after it. - The huggingface_hub "set a HF_TOKEN" warning stays off stderr. The first
graph --fastrun downloads the local NER weights through huggingface_hub, which printed an unauthenticated-request warning straight to stderr. smartpipe now sets that warning's own documented toggle (HF_HUB_DISABLE_IMPLICIT_TOKEN) the same per-library way onnxruntime's log level is pinned, so diagnostics own stderr — never the hub's chatter. - The
usewizard's OCR-stage model picker is curated, not a capability dump. The document-OCR stage listed every model models.dev tags image-input in raw registry order, so junk likechatgpt-image-latestandgpt-realtime-2.1ranked as document parsers and a blind 30-row cap buried real parsers under "(N more not shown)". It now applies the SAME curation the text/chat stage already does — the openai capability-dump denylist (realtime/image/audio/search/…) and the dated-YYYY-MM-DDsnapshot drop — and leads the survivors with one model per provider so a long openai list can't crowd out anthropic/gemini/etc. The dedicatedmistral-ocr-latestwire and the picked vision chat model still lead the menu as their own rows. graph --fast/--hybridno longer look hung while the local NER model loads. The one-time weights download and ONNX session init happened silently inside the first per-item NER call, with no smartpipe-owned feedback. A caller-ownedpreparing local NER modelstatus line now covers that load up front, under the same destination-aware gate as every other bar. Whenever stderr is a TTY, huggingface_hub's own carriage-return bar is suppressed too; with process-pipe stdout both bars stay off, preventing a downstream collision.- A dead OCR wire stops the run instead of silently wrecking every scan. The
"falling back to local extraction" path is now two-tier: an isolated file whose
429 retry ladder exhausted still degrades to local extraction, but with an honest
ocr rate-limited: <file>(the raw wire body is no longer dumped). A SYSTEMIC availability fault never masquerades as a fallback — and never crashes as an internal bug: when the breaker concludes the OCR wire is down, the run stops at SETUP (exit 2) with the truth ("rate-limited … rerun later"), converted to a setup fault that flows cleanly past every per-file handler so no verb grinds the rest of the corpus into bogus skips; a page belt exhausted mid-read stops ALL_FAILED (exit 3) with the belt truth rather than the internal-error screen a stray item error would trigger. A pilot run degraded a whole scanned corpus to near-garbage local text under a sustained rate limit, and reported belt exhaustion mid-read as "ocr failed … falling back". - Ctrl-C now works during
graph's heavy fold, and a stuck run can always be killed. Three coupled fixes to the interrupt path. (B1) The CPU-bound fold phases (fold_surfaces/fold_edgesand their assertion twins) ran ON the event loop thread, so a large corpus — a pilot folded 627,520 edges from 302 files — starved the loop for minutes: no signal callbacks, no bar redraws, Ctrl-C ignored. They now run OFF the loop viaasyncio.to_thread, drive afold-stage progress bar, and poll an injectedshould_stopper window so a drained Ctrl-C salvages a clean partial graph (edges written, exit reflects partial), mirroring the extraction-halt salvage. The projected-grind note now says "files" (the pass iterates files) and names the fold as its own phase. (B2) The SIGINT handler was aloop.add_signal_handlercallback — unreachable exactly while the loop was starved. It is now a rawsignal.signalhandler that runs between bytecodes on the main thread, backed by athreading.Eventany worker thread reads synchronously; the first press writes a direct fd-2 acknowledgment ("stopping — draining; press Ctrl-C again to exit now") and arms the drain watchdog, the second hard-exits 130. A new watchdog escalation closes a latent hang: after the cap cancels the run,asyncio.run's teardown still JOINS running executor threads, so a stuck to-thread (a mid-inference call, an uncooperative fold) could hold the drain far past the cap — an off-loop daemon now takes the hard-exit path itself after a short grace. Windows is no longer carved out (signal.signalsupports SIGINT there). (B6) Hard-exit paths (os._exit) skipped the manifest'sabandon(), leaking the 0-byte*.manifest.tmpthe run reserved eagerly; a hard-exit cleanup hook now unlinks it before exit. The drain grace has its ownSMARTPIPE_DRAIN_GRACE_SECONDStest seam alongsideSMARTPIPE_DRAIN_SECONDS.
Notes
Files
prabal-rje/smartpipe-v1.6.0.zip
Additional details
Related works
- Is supplement to
- Software: https://github.com/prabal-rje/smartpipe/tree/v1.6.0 (URL)
Software
- Repository URL
- https://github.com/prabal-rje/smartpipe