Skip to content

Tokenectomy Razor

High-Performance Log Surgery & Secret Redaction Engine for AI Coding Agents

Crates.io npm CI License: MIT

Tokenectomy Razor is an autonomous, machine-to-machine (M2M) Model Context Protocol (MCP) server and stream processing engine written in safe Rust. It operates as a high-throughput background sub-cortex for AI coding assistants like Claude Desktop, Cursor, Cline, Roo Code, Windsurf, and Google Antigravity.

What does it do?

  • Purges 90%+ of framework noise from error traces (node_modules, site-packages, .cargo/registry)
  • Redacts secrets (API keys, JWTs, connection strings) with O(N) ReDoS-immune regex
  • Sub-millisecond latency — designed for real-time agent loops
  • SHA-256 idempotency cache — zero repeated API cost for identical failures
                  ┌──────────────────────────────────────────────┐
  Agent Error     │              TOKENECTOMY RAZOR               │    Sanitized Context
  Dump (38K toks) │  - Polyglot Stack Frame Filter               │ ──►  (2K toks) ──► LLM
 ────────────────►│  - Deterministic Secret Redactor (O(N))      │
                  │  - SHA-256 Idempotency Cache (24h TTL)       │
                  └──────────────────────────────────────────────┘

Quick Start

# Instant via npx (no Rust toolchain needed)
npx -y tokenectomy-razor --mcp

# Or install via cargo
cargo install tokenectomy

# Or via npm
npm install -g tokenectomy-razor

Verified Performance

Benchmark Result
250K lines (24 MB) redaction 333 ms (73 MB/s)
ReDoS resistance (50K chars) 1.44 ms (linear O(N))
100 concurrent threads 27 ms (7,312 ops/s)
Peak memory (250K lines) 76 MB VmRSS

Supported Languages

Language Frameworks
Rust Tokio, Actix-web, Axum
Python Django, FastAPI, Flask, PyTorch
TypeScript / JavaScript Next.js, Express, NestJS, Vite
Golang Gin, Fiber, Stdlib panics
Java / Kotlin Spring Boot, Quarkus, Gradle
C / C++ GDB Backtraces, AddressSanitizer
PHP Laravel, Symfony

Get started → View on GitHub →