Local-first <1ms Bash guardrail and decision trace CLI for Claude Code
aisona-lab released Tucana Code v0.1.1, an offline <1 ms PreToolUse guardrail and multi-currency spend kill-switch for Claude Code, Codex, and OpenCode.
By Dillip Chowdary • Dec 03, 2026 • Source: github.com

At a glance
- Product
- Tucana Code
- Version
- v0.1.1 (schema v0.1.0)
- Price
- $0, MIT open-source license
- Runtime
- Node.js >=22.16.0, 27.5 kB packed, ~56 ms cold start
- Currencies
- USD, EUR, MXN, COP, ARS, BRL, CLP, PEN
- Latency
- <1 ms System 0, 0 ms kill-switch
In this post
This update breakdown covers Tucana Code's deterministic versus local-LLM architecture, multi-currency spend caps, installation commands, and closed-loop trace calibration. It is aimed at developers running pay-as-you-go coding agents such as Claude Code, Codex, OpenCode, and Gemini CLI who need hard spending ceilings and deterministic command blocking with zero telemetry.
01Sub-millisecond guardrails and gateway comparison
Coding agents execute real shell commands on developer machines, where a hallucinated rm -rf, a leaked .env piped to curl, or a runaway reasoning loop can cause immediate damage. Tucana Code v0.1.1 replaces manual confirmation prompts and slow cloud proxies with an offline System 0 gate that evaluates safe read-only checks such as git status or test runs in under 1 ms at $0 cost. The published CLI carries zero runtime dependencies, measures 27.5 kB packed, and starts in roughly 56 ms.
| Capability | Unprotected Agent | Cloud AI Gateways | Tucana Code (v0.1.1) |
|---|---|---|---|
| Safe read-only checks | Manual click or YOLO | +150–600 ms network roundtrip | <1 ms System 0, $0, 100% offline |
| Destructive / exfil protection | Hope the LLM behaves | Cloud policy / SaaS lock-in | Instant deterministic block + fail-safe |
| API spend ceiling & Kill-Switch | Surprise invoice tomorrow | USD-only / proxy account | Real-time USD + EUR + 6 LATAM currencies |
| Telemetry & cloud accounts | Vendor telemetry | Cloud dashboard + auth | Zero accounts · Zero network · MIT |
| Learn from your overrides | Re-prompt forever | Vendor fine-tuning | Human review in tucana-lab → <1 ms rules |
Instead of routing agent calls through a SaaS dashboard that adds 150–600 ms of network latency, Tucana Code stores all configuration and traces locally under ~/.tucana-code/. The MIT-licensed CLI contains no PostHog, Axiom, Clerk, analytics beacons, or cloud relay dependencies.
02Two-tier System 0 and System 1 routing
Tucana Code splits command evaluation into two tiers so common checks stay instant while ambiguous commands receive deeper inspection. Every incoming PreToolUse hook or wrapped CLI command first hits the local budget kill-switch, which immediately returns a 0 ms DENY verdict if a spending limit has been exceeded. Within-budget calls proceed to System 0, which combines deterministic rules with exact-match human-approved rules loaded from ~/.tucana-code/policy-calibration.json to issue sub-millisecond ALLOW or BLOCK verdicts.
Gray-zone commands that System 0 cannot classify deterministically escalate to an optional System 1 tier. Developers can connect a local chat or instruct model running in LM Studio at http://localhost:1234/v1, point to Ollama via OLLAMA_HOST, or optionally supply JEV_API_KEY. When offline or unconfigured, System 1 gracefully falls back to an interactive ask prompt rather than crashing the agent session.
03Multi-currency budget caps and kill-switch
Pay-as-you-go developers outside the United States can track token spend and enforce hard ceilings in their local currency. Tucana Code supports USD ($), EUR (€), MXN (MX$), COP (COL$), ARS (ARS$), BRL (R$), CLP (CLP$), and PEN (S/), storing active thread and daily caps in ~/.tucana-code/budget.json. Once token recording pushes a thread or daily total to its configured ceiling, the kill-switch halts even benign commands such as git status at 0 ms.
Advertisement
Tech Pulse Daily
Get tomorrow's pulse first
Join engineers who read Tech Pulse before stand-up. Free, weekday mornings.
tucana-code budget set --currency MXN --thread-limit 0.15 --daily-limit 2.00
tucana-code budget status --currency MXN --thread-id session-1
tucana-code budget record --model claude-sonnet-5-5 --input 100000 --output 20000 --thread-id session-1 --currency MXN
tucana-code trace summary --currency MXN
tucana-code budget set --thread-limit none --daily-limit noneDevelopers can inspect accumulated thread costs at any point or clear caps with none when ready to resume. Every budget denial, System 0 decision, and System 1 escalation writes an immutable record to ~/.tucana-code/traces/decision-trace.jsonl.
04Quickstart installation and hook setup
Installing Tucana Code globally takes one shell command via GitHub Releases, or developers can download the release tarball or standalone .mjs bundle directly. Running tucana-code init --dry-run backs up ~/.claude/settings.json with a timestamp, registers tucana-code hook claude-pretool using the resolved binary path rather than slow npx, and logs real traces in observation mode before live blocking is enabled.
curl -fsSL https://raw.githubusercontent.com/aisona-lab/tucana-code/main/install.sh | bash
tucana-code init --dry-run --currency MXN
tucana-code doctor
tucana-code guard check -- git status
tucana-code guard check -- "rm -rf /"
tucana-code init --currency MXN
tucana-code system1 set --lmstudio
tucana-code system1 testUsers of Codex, OpenCode, Gemini CLI, or local scripts can wrap any command in one line using tucana-code guard check -- <command>. For LM Studio setups, tucana-code system1 set --lmstudio auto-detects the loaded local model and saves the configuration to ~/.tucana-code/config.json, or developers can override endpoints via TUCANA_LOCAL_OPENAI_URL and TUCANA_LOCAL_OPENAI_MODEL.
Note: Tucana Code requires Node.js >=22.16.0; npm install -g tucana-code and npx tucana-code --help will work directly once the package is published to npmjs.org.
05Local cockpit and Tucana Lab calibration
Cloning the monorepo and running pnpm dev launches the Local Safety Cockpit, an Editorial Instrument web UI for agent governance. It defaults to a warm paper canvas (#F4EEE3) with a toggle to dark space mode (#0B101B), features a 44px top telemetry ribbon to switch System 0 between Active, Strict, and Dry-run modes, and includes an interactive Budget Guard popover for changing currencies and caps. A collapsible editorial rail indexes numbered sessions alongside Workspace & Git, System 0 Gate, and Budget Guard cards, while local WebSocket interruptions display a reconnecting state without cloud dependencies.
Every verdict appended to decision-trace.jsonl conforms to schemas/decision-trace.schema.json v0.1.0 and feeds into the companion aisona-lab/tucana-lab tool. Developers can measure 10-bin Reliability Diagrams, Expected Calibration Error, and Brier scores, label uncertain edge cases into feedback.jsonl via keyboard-first Active Learning, and export policy-calibration.json back to ~/.tucana-code/policy-calibration.json for instant sub-millisecond rule updates without model training, or export SFT JSONL datasets for fine-tuning local Qwen, Llama, or Mistral classifiers.
Frequently asked questions
How does Tucana Code protect Claude Code without slowing down safe commands?
Tucana Code registers tucana-code hook claude-pretool using the resolved binary path instead of npx and evaluates safe read-only checks through an offline System 0 engine in under 1 ms. Known destructive or exfiltration commands are blocked deterministically at the same speed with zero network roundtrips.
Which local LLM providers work with Tucana Code System 1?
System 1 supports LM Studio at http://localhost:1234/v1 via tucana-code system1 set --lmstudio, Ollama via tucana-code system1 set --ollama or OLLAMA_HOST, and optionally JEV_API_KEY. When offline or unconfigured, gray-zone commands gracefully fall back to an interactive ask prompt.
What currencies and limits does the Tucana Code budget kill-switch support?
Developers can set per-thread and daily spending caps in USD, EUR, MXN, COP, ARS, BRL, CLP, and PEN stored in ~/.tucana-code/budget.json. Once a limit is reached, the kill-switch halts even benign commands like git status in 0 ms.
How does Tucana Code improve its guardrails over time without vendor fine-tuning?
Every verdict is appended to ~/.tucana-code/traces/decision-trace.jsonl, which developers can open in aisona-lab/tucana-lab to label uncertain edge cases and measure ECE and Brier scores. Exporting policy-calibration.json updates System 0's sub-millisecond rules immediately without training a model.
Sources
Author
Dillip Chowdary
Writes Tech Bytes coverage of AI, engineering, and the tools that actually ship. Editor of Tech Pulse Daily.
Related on Tech Bytes
Advertisement