Local runtime protection for Claude Code

Claude got stuck in a loop.
ContextGuard stopped it.

Catches loop patterns and bloated output mid-session. Surfaces the root cause and offers safe intervention.

Audit my session

Runs 100% locally. Code and transcripts never leave your machine without action.

Free, no signup required

Claude actionnpm testsame failure • attempt 1

LOOP GUARD // EVIDENCE
[Demonstration scenario]
Session activeObserving

Analyzing action sequence

$ npm test • same failure • attempt 1
Step:

Monitoring action sequence

Interactive Defense System

Four Tiers of Session Defense

Autonomous modules intercept infinite loops, context bloat, and rule degradation in real time.

ARMED // CIRCUIT BREAKER

Halting No-Progress Repetition

Interception Trigger: 3 attemptsSavings per loop: ~35-50K tokens
1

Input Signal

Live telemetry from Claude Code and workspace state:

  • Bash / Edit / Read tool execution sequence
  • Error signature hash & non-zero exit code
  • Workspace git diff between iterations (delta = 0)
[INTAKE STREAM: 100% LOCAL MEMORY]
2

Cognitive Decision

Local semantic loop analyzer:

  • 3rd identical attempt detection without code edits
  • Session progress evaluation: 0.00% over last 4 minutes
  • Circuit Breaker engagement with precise problem diagnosis
[ANALYSIS LATENCY: < 2 ms]
3

Guaranteed Outcome

Context preserved with clean recovery path:

  • Up to 45K tokens saved on intercepted incident
  • Precise diagnostic report explaining why Claude is looping
  • Force Rethink prompt injected to redirect strategy
[STATUS: ZERO REGRESSION VERIFIED]
Interactive Simulator: Loop Interception Simulator
Step 01

Attempt 1: npm test (failing on line 42)

Step 02

Attempt 2: npm test (zero code edits, repeat failure)

Step 03

Attempt 3: Loop Guard intercepted execution

Runtime Capabilities // Cognitive Engine

Complete Control Over Claude Code Cost & Logic

From deep cache and token cost telemetry to live loop interruption and invariant rule retention.

Cost & Prompt Caching Telemetry

Real-time visibility into token input/output, cache write efficiency, and dynamic session cost.

Session Cost Tracking-85.2%
$0.42$2.85

Sub-penny precision accounting calibrated to official Anthropic model pricing.

Input & Output Tokens15.2K TOTAL
Input: 12.4KOutput: 2.8K

Granular accounting of context payload vs generated code stream.

Cache Read vs Write5-MIN WINDOW
94.2K READ / 4.8K WRITE

Continuous tracking of the 5-minute Prompt Caching window saving up to 90% cost.

Cache Hit Efficiency
96.4%HEALTHY REUSE

Maintaining 96%+ cache reuse to maximize 5-hour quota availability.

● PROMPT CACHE METERING ENGINESLIDING 5-MIN HIT RATE: 96.4%
[Turn 12] Prompt payload: 98,420 tokens | Cache Read: 94,800 tok ($0.028) | Cache Write: 3,620 tok ($0.013)
✓ Cache hit discount applied: saved $0.264 on single turn (Anthropic Prompt Caching Protocol)
Live Runtime Scenario

Interactive Terminal: Loop Interception & Recovery

Step-by-step reproduction of a real Claude Code session: repeating errors, circuit breaker engagement, evidence telemetry, and stabilization.

LiveStep 1/5
// [14:22:01] User Prompt: "Fix 401 Unauthorized error in auth session endpoint"
claude>I will run the test suite to inspect the failing assertion.
$ claude-tool: bash "npm run test:auth"
FAIL test/auth-session.spec.ts (42ms)
✕ POST /api/v1/auth/session should return 200 with valid bearer (line 42:15)
AssertionError: expected 401 to be 200
Tests: 1 failed, 11 passed, 12 total
[CONTEXTGUARD RUNTIME: OBSERVING BASELINE TELEMETRY]Input Tokens: 12.4K
Speed:
Transcript Inspector // 100% Local-First

Instant .jsonl Session Audit

Drop a Claude Code session file or test the sample transcript to see real costs, loops, and cache efficiency.

Where is my session file located?
~/.claude/projects/<project>/session.jsonl
100% Client-Side Privacy Guarantee

Transcripts are parsed purely in JavaScript inside your browser. Zero server uploads.

Don't have a .jsonl file handy? .
PRICING & LICENSING // NO HIDDEN FEES

Choose Your Level of Protection

The CLI is free forever for offline inspection. Pro adds active real-time runtime defense. Unconditional 14-day money-back guarantee.

100% OFFLINE

Free Community

Local transcript audit, historical loop inspection, and config linting.

$0/ forever
ВКЛЮЧЕНО В CLI:
  • Local CLI audit of .jsonl session files
  • CLAUDE.md & MCP configuration cleanup
  • Cost estimation calibrated to Anthropic rates
  • 100% offline processing on your local disk
ОГРАНИЧЕНИЯ FREE:
  • No active real-time loop interception
  • No Continuity Guard (rules after /compact)
  • No Output Guard (test log distillation)
RUNTIME DEFENSE

Pro Monthly

Active real-time protection for developers building with Claude Code daily.

$12/ month
УНИКАЛЬНАЯ ЦЕННОСТЬ PRO:
  • Live Loop Interceptor: stops no-progress loops (< 2ms)
  • Output Guard: compresses test dumps & noise by 84.2%
  • Continuity Guard: 100% rule retention across /compact
  • 5-Hour Quota Radar & Velocity Alerts
  • Lossless Vault: local offline archive without token burn
  • 14-day unconditional money-back guarantee
LIMITED EARLY ACCESS // 500 SEATS★ BEST DEAL

Pro Lifetime

Lifetime access to all Pro capabilities and future updates with zero recurring fees.

$79/ one-time payment
ПОЖИЗНЕННЫЕ ПРИВИЛЕГИИ:
  • All Pro capabilities included forever
  • No monthly subscriptions or recurring fees
  • Priority access to new modules & beta updates
  • Direct founder priority technical support
  • Transferable license key
FOR TEAMS

Team & Organization

Centralized quota visibility, team rule synchronization, and organization budget safety.

$29/ user / month
КОМАНДНЫЙ КОНТРОЛЬ:
  • All Pro features for every team developer
  • Central team dashboard with cache reuse metrics
  • Security rule & policy synchronization
  • Centralized billing and invoice management
  • Dedicated onboarding manager & SLA

What are you paying for?

ContextGuard pays for itself within 2–3 days of active engineering by preventing sudden 5-hour limit burnouts mid-task and saving $40 to $60/month in unnecessary API token waste.

Payment Methods

Security Guarantee: Transactions processed via certified gateways (Stripe, CoinGate). No card numbers stored.

Available Online:
  • Credit & Debit Cards (Visa, Mastercard, Mir)
  • Cryptocurrency (USDT TRC20, USDC Polygon, BTC, ETH, TON)
  • Fast Payment System (SBP)
Temporarily under maintenance:

PayPal & Apple Pay (Integration updating)

100% LOCAL-FIRST // DATA INTEGRITY

Transparent Privacy Architecture

Your code and prompts never leave your local machine. Cloud telemetry is strictly opt-in and restricted to high-level numeric metrics.

100% ON YOUR DEVICE // ZERO NETWORK REQUESTS

Local Runtime (CLI, Plugin, Web Audit)

All parsing, transcript analysis, CLAUDE.md linting, and loop interception happen strictly on your computer.

  • Source code, git diffs, and repository files
  • User prompts and Claude model output text
  • CLAUDE.md contents, .env files, and secret tokens
  • Raw session transcripts (~/.claude/projects/)
  • Local hook telemetry vault (~/.contextguard/vault/)
● ЛОКАЛЬНАЯ ОБРАБОТКА В ПАМЯТИ
STRICTLY USER-INITIATED (--push)

Cloud Dashboard (Team Analytics)

Sent only when explicitly running npx contextguard audit --push or signing into the dashboard.

  • Aggregated token counts (Input / Output / Cache)
  • Estimated session cost in USD and cache hit rate
  • Anonymous hostname label for team aggregation
  • Account email and Pro license status
● ЧИСЛОВАЯ АГРЕГАЦИЯ БЕЗ КОДА
STRICT CODE-LEVEL GUARANTEE

What ContextGuard Never Does

  • Never reads or uploads source code to the cloud
  • Never intercepts your Anthropic or OpenAI API keys
  • Never transmits telemetry without an explicit --push flag
  • Never sells or shares user data with third parties
● ПОЛНЫЙ ЗАПРЕТ ВНЕШНЕГО ДОСТУПА

Data Processing & Isolation Diagram

Clear visual separation of the local perimeter and optional cloud layer

Полная Privacy Policy
● SECURITY AUDIT VERIFIEDZERO BACKGROUND EGRESS ENFORCED

Хуки ContextGuard подключаются локально через Node.js middleware. Анализ токенов и детекция зацикливаний выполняются за < 2мс без сетевых сокетов.

FAQ // FREQUENTLY ASKED QUESTIONS

Frequently Asked Questions

Everything you need to know about privacy, pricing, compatibility, and real-time runtime defense in ContextGuard.

01Where are my prompts, source code, and repository files sent?

Nowhere, ever. ContextGuard operates under a strict 100% Local-First principle. All parsing, .jsonl transcript auditing, loop interception, and config linting run entirely in your local memory. Not a single line of code or prompt is transmitted over the network. The cloud dashboard is strictly opt-in via --push and only receives anonymous token integers.

02Do I need a separate Claude paid subscription or an Anthropic API key?

ContextGuard works alongside the official Claude Code CLI under any authentication mode: whether you use a Claude Pro / Max web subscription or a direct Anthropic API key. ContextGuard does not require its own API key and does not alter your billing relationship with Anthropic.

03How does ContextGuard calculate dollar cost estimations?

Costs are calculated using official published Anthropic API pricing for active models (Claude 3.7 Sonnet, Claude 3 Opus, Claude 3.5 Haiku). It accurately tracks Input ($3/MTok), Output ($15/MTok), Cache Write ($3.75/MTok), and the 90% discount on Cache Read ($0.30/MTok).

04Does runtime inspection slow down Claude Code command execution?

No. ContextGuard hooks are implemented as ultralight Node.js middleware executing in < 2 milliseconds. In fact, by compressing massive test failure dumps via Output Guard, ContextGuard actively speeds up Claude's generation latency.

05Which operating systems and terminal environments are supported?

ContextGuard is cross-platform and natively supports macOS (Apple Silicon M-series & Intel), Linux (Ubuntu, Debian, Fedora, Arch), and Windows (PowerShell, WSL2, CMD). It only requires Node.js 18+.

06How accurate are the token metrics and loop detection algorithms?

Token counts are 100% accurate because the CLI and web inspector parse official system transcripts generated directly by Anthropic's backend. The loop detector inspects exit-code sequences and git diff deltas to prevent false positives.

07How does subscription cancellation work and is there a refund guarantee?

You can cancel your monthly subscription with a single click from the dashboard at any time with no questions asked. All Pro tiers (including Lifetime) come with an unconditional 14-day full refund guarantee: just email support@contextguard.dev for an immediate refund.

08What is included with the Pro Lifetime license?

Pro Lifetime is a one-time $79 investment instead of recurring fees. You receive permanent Pro access to all current and future ContextGuard modules, a transferable license key, beta channel access, and direct technical support from the founders.