SuperAPI AI Directory

Tokenectomy

Log noise removal, secret redaction and atomic compiler patch verification with instant rollback for AI debugging sessions.

Open website

About this tool

Purpose

Tokenectomy Razor is used during AI coding agent debugging to first perform "log surgery" on terminal error logs locally: strip out third-party framework noise and redact sensitive credentials before handing them to the model, thereby reducing token consumption, preventing the AI from being misled by framework-internal code, preventing key leakage, and easing rate-limit pressure on tools such as Claude Code and Cursor.

Main Capabilities

  • Framework noise removal: Strips large numbers of stack frames from node_modules and site-packages out of runtime crash logs from Next.js, Express, FastAPI, Tokio, and others. According to the documentation, it can remove 41.7%–99.7% of framework noise, compressing a 40,000-character crash log to fewer than 200 key tokens in under 0.2 milliseconds.
  • Secret redaction: Uses deterministic linear-time regular expressions and an Aho-Corasick automaton to detect and redact PostgreSQL/MongoDB connection URIs, JWT bearer tokens, and cloud API keys, replacing them with [REDACTED].
  • Local AI gateway: Runs as a local reverse proxy at 127.0.0.1:8080, supports multi-provider automatic routing and generic LLM translation, can bidirectionally convert Anthropic /v1/messages and OpenAI /v1/chat/completions, and supports pointing Claude Code at DeepSeek or Ollama.
  • Prompt caching: Caches prompts to reduce repeated consumption.
  • Real-time dashboard: Visit http://127.0.0.1:8080/dashboard to view token reduction, cache hits, cost savings, and redacted credentials.
  • FinOps JSON interface: Returns telemetry data such as rate_limits_mitigated, circuit_breaker_trips, last_latency_ms, current_hourly_tokens, cache_hits, cache_tokens_saved, and estimated_cost_saved_usd.
  • MCP tools: Includes deep diagnostic tools such as get_error_context, analyze_code, and apply_code_patch, as well as search_stack_overflow.

How to Use

  1. Zero-config wrapper: Use wrap to run any coding agent or test suite.
  2. Manually start the gateway: Run the local gateway and point the coding agent or CLI at 127.0.0.1:8080.
  3. Dashboard: Open in a browser http://127.0.0.1:8080/dashboard。
  4. MCP Server: Configure a companion MCP server for agents that need to invoke deep diagnostic tools.
  5. Terminal Piping and CLI Cleaning: Pipe directly or clean terminal test output.
  6. Installation Methods: npx -y tokenectomy-razor; Cargo (crates.io); GitHub Releases provides precompiled standalone binaries for Linux, macOS, and Windows; GHCR provides multi-architecture Docker containers.

Use Cases

  • When using AI coding assistants such as Claude Code and Cursor, frequently encountering rate limits caused by pasting large crash logs.
  • When debugging framework projects such as Next.js, Express, FastAPI, and Tokio, wanting to keep AI focused on business code rather than the internals of third-party libraries.
  • Needing to prevent database connection strings, JWTs, and cloud keys from being sent to external model servers.
  • Uniformly managing calls and caching across multiple LLM providers in local or containerized agent topologies.

Limitations

  • All performance data is based on a 10-core Intel Core i5-1235U @ 15W, Arch Linux, Kernel 6.13 test environment; performance depends on hardware, and desktop or server CPUs with higher TDP and faster memory buses can improve throughput.
  • Local execution by default; in MCP mode, only search_stack_overflow has outbound network access, and --local-only can be added to disable it completely.
  • File operations are locked to the workspace root directory (CWD), blocking path traversal and unsafe symbolic links.
  • Implemented using safe Rust, with linear time and resource constraints on the core execution path.
  • Enterprise-grade AST self-healing features require checking the Sentinel version; specific information such as pricing, platform, and effectiveness is not currently provided.

Other Information

The project is developed by Daffa (@daffa2555) and uses the MIT License. The legal disclaimer states that downstream forks, clones, redistributions, or private deployments are completely independent of the original author, and Tokenectomy Labs and its maintainers assume no responsibility for illegal, malicious, or unauthorized actions by third parties using this codebase or derivatives.