ContextOps, an ESLint-like static analyzer for LLM context ContextOps, a new open-source static analysis tool for LLM context, has been released. It acts as a deterministic linter that evaluates structural quality—such as redundancy, token waste, and source concentration—before inference, producing a Context Health Score without requiring embeddings or external API calls. The tool aims to make LLM context quality observable and testable, similar to how ESLint enforces code quality in software engineering. Static analysis for LLM context. ContextOps is a deterministic, model-independent context linter for LLM applications. It analyzes the context sent to an LLM before inference and detects structural problems such as redundancy, token waste, context imbalance, and source concentration. It produces a reproducible Context Health Score CHS together with actionable diagnostics — without embeddings, model calls, or external services. Think of ContextOps as ESLint for LLM context . Modern software engineering has deterministic quality gates. - Compilers catch syntax errors. - Linters catch code smells. - Formatters enforce consistency. - Static analyzers detect architectural problems. LLM applications rarely have an equivalent layer for the context they send into models. Instead, prompts quietly grow over time: - duplicated retrieval chunks - bloated system prompts - runaway conversation history - excessive tool output - hidden token waste These issues increase latency and cost, make model behavior less predictable, and often go unnoticed until production. ContextOps makes context quality observable, measurable, and testable before inference. ContextOps evaluates four structural dimensions. | Dimension | Max Penalty | What It Measures | |---|---|---| Redundancy | 30 pts | Lexical duplication across context items | Density | 30 pts | Token waste from formatting and structural bloat | Structure | 20 pts | Distribution imbalance between context components | Concentration | 20 pts | Over-reliance on a single document or source | The result is a deterministic 0–100 Context Health Score together with detailed findings and suggested fixes. ContextOps intentionally does not evaluate: - prompt engineering quality - reasoning ability or hallucinations - factual correctness - retrieval relevance - LLM outputs It focuses exclusively on the structural quality of the context before inference. contextops inspect context.json Context Health Score: 81 / 100 ✓ Low structural complexity ✓ Good source diversity Warnings • 214 duplicated tokens detected • Retrieval occupies 78% of context • Two retrieval chunks are near duplicates Estimated token savings: 12% Use --roast mode for more candid diagnostics: contextops inspect context.json --roast pip install contextops Run the interactive demo: contextops demo Dependencies: Only tiktoken and click . No GPU, no network, no external API keys required. Save your LLM payload before sending it to the model. python import json messages = {"role": "system", "content": system prompt}, {"role": "user", "content": user query}, Add two lines before your API call with open "context.json", "w" as f: json.dump messages, f, indent=2 response = openai.chat.completions.create model="gpt-4o", messages=messages Or use the structured dict format for richer analysis: { "system": "You are a helpful customer support bot.", "messages": {"role": "user", "content": "How long will my refund take?"} , "chunks": {"content": "Refunds take 3-5 business days.", "source": "docs/refunds.md"} , "memory": "The user asked about a refund yesterday." , "tools": {"name": "search api", "output": "Tool response text here"} } contextops inspect context.json contextops check context.json --min-score 75 Analyse a context file and display a rich report. contextops inspect context.json contextops inspect context.json --roast contextops inspect context.json --profile rag contextops inspect context.json --explain contextops inspect context.json --json-output | Flag | Default | Description | |---|---|---| --json-output | off | Output raw JSON instead of terminal format | --model