SIFTRCODE • CLAUDE CODE INTEGRATION

Claude Code Integration

Context optimization for Claude Code CLI and Claude 3.7 Sonnet. Intercept repository bloat, provide typed AST interface contracts, protect causal edit targets, and keep prompts within budget limits.

$ claude mcp add siftrcode -- npx -y siftrcode mcp
$ npx siftrcode context "fix webhook race condition"
Interactive Live Demo →

Setup

Connect SiftrCode to your Claude Code CLI environment in seconds.

01
Add SiftrCode to Claude Code CLI
RECOMMENDED

Run the standard Claude Code MCP registration command from any terminal:

$ claude mcp add siftrcode -- npx -y siftrcode mcp

claude mcp add registers the SiftrCode MCP server instantly.

02
Commit Shared Team Config

To automatically enable SiftrCode for every developer on your repository, commit a .mcp.json in your project root:

{
  "mcpServers": {
    "siftrcode": {
      "command": "npx",
      "args": ["-y", "siftrcode", "mcp"]
    }
  }
}
03
Add Custom Slash Command /siftr

Drop .claude/commands/siftr.md into your repository to trigger AST interface synthesis on demand by typing /siftr [path] directly inside Claude Code.

$ npx siftrcode init

npx siftrcode init automatically creates .mcp.json, .claude/commands/siftr.md, and CLAUDE.md rules for you.

Why Claude 3.7 Sonnet Needs SiftrCode

200k context windows exist, but loading full codebases into them creates severe penalties.

Eliminate Latency Spikes

Feeding 100k+ tokens of raw method bodies to Claude 3.7 Sonnet drives query latency up to 45+ seconds. With SiftrCode, context drops to 8k tokens and turns finish in 3.8s.

Stop Context Dilution

LLMs lose needle-in-haystack precision when drowned in TLS logic and loop implementations. Skeletons guarantee 100% focus on interface boundaries.

Token Budget Economics

Claude 3.7 Sonnet costs $3.00/MTok input. A 100k query costs $0.30; a SiftrCode pruned query costs $0.024. Teams save $360+/engineer/month.

Metric Raw Full-File Reading With SiftrCode AST Synthesis Net Improvement
Typical Repo Context Load 125,000 tokens 9,800 tokens -92.2% Token Reduction
Turn Latency (Claude 3.7) 38.4s – 46.2s 3.2s – 4.5s 10x Faster Turnaround
Cost per 50-turn day $18.75 / day $1.47 / day Save $518/mo per dev
Interface Contract Loss 0% 0% (100% Types Preserved) Zero Type Degradation

Available MCP Tools in Claude Code

10 NATIVE TOOLS

Once connected, Claude automatically calls these tools via Model Context Protocol to optimize its own prompt.

How Claude Code Dispatches SiftrCode V2
1. Session Handshake: siftr_session(action: "start", taskDescription: "...")

Claude starts an active session with environment discovery (model provenance, platform metadata) and opens telemetry tracking in local SQLite.

2. Pre-Flight Context: siftr_context(taskPrompt, budgetTokens: 16000)

Claude queries SiftrCode over stdio. 6-stage pipeline runs with 3-stage resolution lineage (ranker → budgeted → final). Shadow JEV executes concurrently in the background (sub-40ms).

3. Discrete Method Expansion: siftr_expand(planId, unitId, requestedResolution: "BODY")

If Claude needs to inspect a method implementation in detail, it expands to BODY resolution. Siftr isolates precisely that method while strictly excluding sibling methods to avoid bloat.

4. Zero-Hallucination Edit:

Claude receives focused context, accurately targeting APIs without context saturation or truncated line numbers.

5. Closed-Loop Verification: siftr_outcome(planId, verifiedSuccess: true | false | null)

Claude reports tri-state verification evidence (unit tests, build output, error logs). Local SQLite records the verified outcome linked to ranking lineage.

siftr_context

PRIMARY V2 TOOL

Complete outcome-aware context optimization. Given a task prompt and token budget (e.g. 16,000 tokens), executes the full 6-stage pipeline with 3-stage resolution lineage (rankerResolution → budgetedResolution → finalResolution) and post-render budget degradation ladder. Supports TypeScript, Python, Golang, and Rust with 100% bit-for-bit plan invariance.

siftr_expand

DISCRETE AST SLICING

Progressive disclosure tool expanding a unit to BODY or FULL resolution. Discrete AST slicing isolates strictly the target method body and parameters while pruning sibling methods and inner classes, maintaining compile-safe context boundaries without token waste.

siftr_outcome

TRI-STATE FEEDBACK

Captures downstream verification signals (test execution, linter status, user feedback) and records truthful tri-state outcomes (verifiedSuccess: true | false | null) directly into local SQLite, linking verified completes with candidate exposure decisions.

siftr_session

Session Lifecycle

Manages multi-turn session lifecycle: action start establishes canonical systemConfigurationHash provenance, validating model and platform identity across all downstream plans, observations, and telemetry.

siftr_optimize

Advanced Workspace Engine

Configurable workspace context optimizer allowing custom candidate units, manual budget constraints, and degradation strategy selection for complex multi-agent orchestrations.

siftr_rank

Diagnostic Ranking

Runs heuristic candidate ranking and outputs transparent scoring breakdowns, boost multipliers, and penalty evaluations without modifying file contents.

siftr_skeleton & siftr_batch_skeleton

AST Surface Extraction

Synthesizes clean interface contracts from source code in TypeScript, Python, Go, and Rust. Strips imperative function bodies while keeping all types, classes, interfaces, parameter signatures, and docstrings 100% intact.

siftr_pack & siftr_audit

Architecture & Auditing

Prepares directory-wide AST architectural packs and audits entire repositories for deadweight files, reporting exact token bloat, potential economic savings, and efficiency opportunities.

Ready to test it on your codebase?

Run a 5-second audit or register SiftrCode directly with your agent.

Run audit:
$ npx siftrcode audit