Intelligence

Your AI agent picks the wrong tools, ignores budgets, and wastes compute on trivial tasks.

LeanCTX routes every request through a graph-powered adaptive pipeline. It classifies task intent, fuses BM25, semantic embeddings, and graph proximity via Reciprocal Rank Fusion (RRF) for search, enforces token and cost budgets, and enriches overviews with knowledge facts and graph hotspots. Progressive throttling and compression levels (Off/Lite/Standard/Max) keep long sessions efficient.

The Problem

Every Request Gets the Same Treatment

Without intelligent routing, every request gets the same generic treatment. A simple rename gets the same heavy context as a complex refactor. There is no task awareness, no budget control, no optimization.

ctx_intent classifies your task and automatically selects the optimal read mode, budget, and pipeline strategy.

ctx_intent
ctx_intent ({ task: "rename getUserById to findUserById" })
- intent: refactor/rename
- mode: signatures
- budget: 8,000 tokens
- profile: coder
Intelligence

11 tools

01

Intent Routing

Automatic task classification routes requests to the optimal processing mode.

02

Mode Selection

Learned mode predictor selects the best compression strategy based on task type and context.

03

Budget Enforcement

Token, cost, and time budgets with SLO actions: warn, throttle, or block.

04

Adaptive Pipeline

Six pipeline stages with per-profile toggles and real-time metrics.

05

Hybrid Search Fusion

Combines BM25 keyword matching, semantic embeddings, and graph proximity scores via Reciprocal Rank Fusion (RRF).

06

Knowledge-Enriched Overview

ctx_overview surfaces relevant knowledge facts and Property Graph hotspots alongside the architecture summary.

07

Progressive Search Throttling

Escalating hints guide the agent when repeated searches return diminishing results, reducing wasted tokens.

08

Compression Levels

Unified CompressionLevel system (Off/Lite/Standard/Max) controls output density across all tools. Set via <code>lean-ctx compression &lt;level&gt;</code>, ideal for tuning verbosity per session.

09

Context Potential (Φ)

Every context item is scored by a six-factor potential function combining relevance, structure, recency, history, cost, and redundancy.

10

Context Compiler

Greedy Φ-ranked selection builds minimal context packages within any token budget, with automatic redundancy elimination.

11

Context Handles

Lazy sparse references (@F1, @K3) that defer content loading until needed — zero-cost context pointers for token efficiency.

Protocol

Cognitive Efficiency Protocol (CEP)

A structured protocol for maximizing AI reasoning quality through optimized context delivery.

CEP Protocol
protocol CEP
version v1
pillar Intelligence
status active
6 Routing Strategies
8 Context Profiles
Auto Mode Selection
Intelligence

Related Documentation

Verification

Every output carries proof

LeanCTX generates proof artifacts for every session: which files were read, what was compressed, which checks passed, and how tokens were spent. This makes AI work auditable, replayable, and trustworthy.

Explore Intelligence Tools

LeanCTX routes every request through a graph-powered adaptive pipeline. It classifies task intent, fuses BM25, semantic embeddings, and graph proximity via Reciprocal Rank Fusion (RRF) for search, enforces token and cost budgets, and enriches overviews with knowledge facts and graph hotspots. Progressive throttling and compression levels (Off/Lite/Standard/Max) keep long sessions efficient.