Skip to main content

Crate tokenectomy

Crate tokenectomy 

Source
Expand description

§Tokenectomy 🕵️‍♂️

Autonomous Machine-to-Machine (M2M) Model Context Protocol (MCP) server and context surgery engine for AI coding agents.

Designed specifically for autonomous coding assistants (Claude Desktop, Cursor, Cline, Roo Code, Windsurf, and Google Antigravity), Tokenectomy operates silently as a background sidecar. It intercepts noisy framework errors, strips 90%+ of internal runtime frames (node_modules, site-packages, .cargo/registry), and auto-redacts sensitive credentials (JWTs, database URLs, API keys) before prompt transmission.

§Key Capabilities for AI Coding Agents

  • Log Surgery: Reduces massive 38K token error dumps down to <2K tokens, preserving only user-written code.
  • Secret Redaction: Employs compiled, ReDoS-safe linear-time regexes (LazyLock) to strip credentials locally before cloud transmission.
  • Local Response Cache: SHA-256 error fingerprinting with a 24-hour local TTL so identical CI/CD errors cost $0.00 in LLM API calls.
  • M2M MCP Stdio Protocol: Full JSON-RPC 2.0 stdio interface exposing get_error_context, search_stack_overflow, and apply_code_patch.

§Quick Library Example

use tokenectomy::redact::redact_secrets;

let raw_log = "Error connecting with DATABASE_URL=postgres://user:secret@localhost:5432/db";
let sanitized = redact_secrets(raw_log);
assert!(sanitized.contains("[CONNECTION_STRING_REDACTED]"));

Re-exports§

pub use crate::app::run_cli;
pub use crate::mcp::ControlPlaneEnvelope;

Modules§

analyzer
app
cache
cli
config
dashboard
extractor
formatter
git
mcp
provider
proxy
redact
search
workspace

Constants§

AUTHOR_NAME
Immutable Author identity baked into .rodata segment
ENGINE_SIGNATURE
Immutable Cryptographic / Architectural Engine Signature
REPOSITORY_URL
Immutable Official Project Repository
VENDOR_NAME
Immutable Organization / Vendor identity