Skip to main content

Module core

Module core 

Source

Modules§

a2a
a2a_transport
A2A transport envelope signing for inter-agent communication. Uses HMAC for transport-level message integrity. Distinct from commercial Verified Attribution (Section 8) which provides billing CPAO credit with chain integrity.
active_inference
Active Inference Preload — predictive context loading.
activity
Facade of lean-ctx-activity: the per-session activity stream under <data dir>/activity, with this Instance’s secret redaction. Producers (hooks, MCP calls, ACP client callbacks) call record; it never fails the caller.
adaptive
adaptive_policy
Adaptive compression policy (OSS stub).
adaptive_thresholds
admitted_sources
Admitted acquisition for tools that rank, summarize, cache or index what they read (G01).
agent_budget
agent_identity
agent_lease
Bounded, payload-free ownership leases for multi-agent mutation planning.
agent_registry
First-class agent identities: registry + lifecycle (GL #433, H3 Epic D).
agent_templates
Agent instruction templates the hook installers write (crate lean-ctx-hooks). They live with the engine’s other templates (rust/src/templates), so every crate that ships them embeds the same bytes from inside its own package.
agents
archive
archive_fts
artifacts
atomic_fs
Facade: atomic-write mechanics live in the lean-ctx-fs crate.
attribution
Deterministic identifiers and grouping for savings attribution records.
audit_trail
auto_capture
Opt-in automatic knowledge capture from tool outputs.
auto_findings
auto_mode_resolver
behavior_nudge
In-band behavior nudges + turn-economy telemetry.
binary_detect
bm25_cache
bm25_index
bm25_store
BM25 index lifecycle: per-thread shared cache, load-or-refresh with the cold-build budget, resident-cache storage.
bounce_tracker
bounded_lock
budget
Turn-level context budget controller (#1306).
budgets
cache
call_graph
canonical
Canonical JSON serialization and Ed25519 signatures for signed artifacts.
capabilities
capsule_transport
Local reference transport for authenticated OCLA A2A capsule delivery (P11).
causal_attribution
Causal outcome attribution (OSS stub).
ccr
Content-addressed recovery (CCR) for the proxy’s lossy rewrites (#482).
chunks_ts
Tree-sitter AST-aware code chunking for semantic search.
claude_host
Claude Code host facts the engine reads without the hook installers.
claude_md
Claude Code’s global CLAUDE.md pointer block and the managed-block helpers every global instructions file (CLAUDE.md / CODEBUDDY.md) shares.
client_capabilities
client_constraints
cloud_files
Detection of cloud-backed placeholder files (OneDrive “Files On-Demand” on Windows, iCloud Drive “dataless” files on macOS).
cloud_gate
Whether this engine may use LeanCTX | Cloud: the release switch, the preview switch for a loopback Cloud, and the lines printed while Cloud is off. The engine reads it to keep Cloud tools and commands out of every list; the Cloud connector re-exports it.
cloud_signals
Engine signal counts (K10, K12, K13) and redacted-secret hits (K21), named where they happen: an output served truncated or fetched back, a rule that refused or would have, programs no rule covers, a secret the redaction path removed.
cockpit_launch_record
The Cockpit launch record: which local Cockpit server belongs to this data dir.
code_health
Native code-health engine — clean code as a token-cost lever.
codebook
command_root
The project a command-line invocation acts for, and the read boundary a command-line read enforces against it.
compliance_evidence
Signed compliance evidence (GL #677) on the one engine.
compressor
Generic text compressors.
config
config_heal
Heal a config.toml that got stranded in the DATA dir (#594).
conformance
Conformance & reproducibility scorecard (conformance-v1, EPIC 12.17).
consolidation
Consolidation engine for provider data — hippocampal sleep replay.
consolidation_engine
Canonical session→knowledge consolidation (#995 Phase 4).
content_cache
Resident, bounded file-content cache shared across the search-index build and ctx_search (issue #148).
content_chunk
Universal content chunk — the atomic unit of the Context Engine.
context_admission
Context admission: the one local decision every governed source passes before it is cached, compressed, indexed or delivered.
context_capsule
Payload-free, delta-capable contract for multi-agent context handoffs.
context_checkpoint
Verified context-checkpoint lineage and canonical session storage.
context_compiler
Context Compiler – builds minimal context packages under budget constraints.
context_field
Context Field Theory (CFT) – unified potential function for context items.
context_ir
context_ledger
context_os
context_overhead
Honest accounting of the fixed per-turn context lean-ctx injects (GitHub #361).
context_overlay
Reversible context overlays — user/policy manipulations that modify context items without changing source files (“synaptic modulation”).
context_package
context_proof
context_quality
Context Quality System — shared vocabulary for quality evidence.
context_store
The Context Store: one access contract over the stores that already hold LeanCTX state. It is a logical layer, not another database.
contracts
conversation
Conversation identity for read-cache scoping.
cross_source_edges
Cross-source graph edges — connects external data to code via the graph index.
cross_source_hints
Cross-source hints — lateral connections between cortical columns.
customer_proof_v2
V2 customer-proof assembly from already materialized local observations.
data_consolidate
Consolidate a split data layout into one canonical directory (GH #414).
data_dir
debug_log
Opt-in human-readable debug log of intercepted tool activity (#520).
decision_loop
End-to-end wiring from task triage through execution-value assessment.
deep_queries
Tree-sitter deep queries for extracting imports, call sites, and type definitions.
deps
derivation_cache
Opt-in, content-addressed cache of pure parse derivations, shared across worktrees and data homes (GitHub #2247).
diagnostics_store
Active compiler/linter diagnostics as a context-priority signal (#499).
dynamic_tools
Tool categories, the public-surface name lists (local collaboration, internal host hooks, Cloud) and the dynamic per-category tool state. Pure name logic: it needs no tool registry, so engine code outside the MCP server reads it here. The call-resolving helpers (ctx_call spellings) stay in server::dynamic_tools, which re-exports this module.
edit_metering
Edit-efficiency metering (#1008, honest-metering philosophy #361).
edit_quality
Quality loop v1 (#494): compression-caused edit failures feed back into mode selection.
editor_registry
egress
Egress / output DLP for agent writes & actions (GL #676) — the output side of the Great Filter.
embedding_access
Policy-gated access to the shared embedding engine. Moved down from tools/ctx_knowledge/embeddings.rs so engine callers (entropy, extractive, telemetry) do not depend on the tools layer.
embedding_index
Persistent, incremental embedding index.
embeddings
Embedding engine for semantic code search.
energy
Electricity-footprint estimate for saved tokens.
engine_interface
Internal proof bridge from one native OCLA capability to Engine Interface v1.
entropy
error
Facade: the engine’s error types live in the lean-ctx-fs crate.
etpao
ETPAO: Effective Tokens per Accepted Outcome (#1318).
events
eviction_orchestrator
Connects the RSS-based memory_guard to real cache eviction via HomeostasisController.
evidence_bundle
Evidence bundle generator (evidence-bundle-v1, GL #425, H3 Epic A).
execution_ledger
Append-only, task-aware execution ledger.
execution_lifecycle
Canonical execution lifecycle and subordinate Decision Spine state.
execution_protocol
Strict validation for the typed execution protocol carried by one lifecycle run.
extension_registry
Pluggable read-modes, compressors, and chunkers (extension-registry-v1).
extractive
Extractive prose compression: keep the most informative sentences within a char budget instead of truncating to the prefix.
extractors
Format extractors & format-aware chunkers (extractors-v1, EPIC 12.13).
failure_template
Turns a tool’s error message into a template that is safe to report.
feature_list
The feature list of a task: its locked acceptance tests (process-v1 §4, contracts/process-v1/feature-list.schema.json).
file_lock
Facade: bounded advisory file locks live in the lean-ctx-fs crate.
filters
finops_export
FinOps cost/savings export (GL #402): CloudZero CBF, Vantage, FOCUS CSV.
firewall
Context firewall: replace large tool outputs with a compact digest + retrieval ref.
gain
git
Native git support: remote-repo reading (cached shallow clone) and a shadow history of agent changes.
git_worktree
Linked git worktrees, read from git’s own files without running git.
gotcha_tracker
governor_hosts
Governor detection on hosts other than Claude Code: which hosts have a governor setup, where their files live, and whether it is installed.
grammar_usage
Persistent per-extension signature-backend telemetry (GH #690 Phase 2).
graph_cache
Resident graph-index cache (Phase 5 of the efficiency epic).
graph_context
Graph-driven context loading — automatically includes related files based on Property Graph proximity and token budgeting.
graph_enricher
Unified Graph Enricher — indexes Git history, tests, and knowledge into the PropertyGraph.
graph_export
graph_index
graph_provider
handle
Stable cross-turn symbol handles: path#name@Lline.
handoff_ledger
handoff_transfer_bundle
hasher
Facade: BLAKE3 hashing helpers live in the lean-ctx-fs crate.
heatmap
hnsw
Lightweight HNSW (Hierarchical Navigable Small World) index for approximate nearest neighbors.
home
Facade: home and Codex directory resolution live in the lean-ctx-fs crate.
homeostasis
Homeostatic Memory Guard — Proactive multi-level resource management.
hook_mode
Hook-mode policy shared by the engine and the agent-hook installers.
host_coverage
Host coverage — what the context gateway can actually see and stop per host.
host_env
Environment markers as the host that started this process sees them.
host_state
Host session state the observe hook records for the rest of the engine.
html_crush
Deterministic HTML content extractor — extracts article/main content from web pages, converts to clean markdown, discards boilerplate (#1124).
http_client
hybrid_search
Hybrid search combining BM25 (lexical) with dense vector search.
immune_detector
Immune detector (#8): artificial-immune-system screening for context poisoning.
import_resolver
Import-to-file resolution (AST-driven import strings → project paths).
index_admission
Admission control for heavy index builds (#685).
index_filter
Index-time file filters (#735): one shared corpus-membership decision for every index builder.
index_namespace
index_orchestrator
index_paths
Index path utilities — project-root normalization and graph match keys.
index_progress
Shared progress counters for index builds (BM25, semantic, graph). Build code reports here; CLI / status_json read snapshots. Decouples builders from the orchestrator (no module cycles).
ingestion
Ingestion front-door (ingestion-spec-v1).
input_filters
Inbound content filters (GL #675) — the input side of the Great Filter.
installation_id
Persistent anonymous installation identifier for default-on telemetry.
instruction_files
Instruction-file and user-exclusion predicates shared by ctx_read, the automatic mode resolver and the hook redirect. Moved down from tools/ctx_read/helpers.rs so engine callers do not depend on the tools layer.
integrity
Build-origin integrity verification and rebrand resistance.
intelligence_runtime
Public installation authority for the optional, separately licensed runtime. No private implementation, account, entitlement, or implicit network access.
intent_engine
intent_protocol
intent_router
interrupt
User-initiated cooperative cancellation (Ctrl-C / SIGINT).
introspect
Cognition introspection — proves that each scientific subsystem is wired and actually active at runtime.
io_boundary
io_health
journal
json_crush
Moved to the lean-ctx-patterns crate; re-exported so engine paths stay stable.
jsonc
Facade: the JSONC parser lives in the lean-ctx-fs crate.
knowledge
knowledge_consolidate
Consolidation engine: session import, fact lifecycle (quality only — facts have no count limit), lossless capacity reclaim of the pattern and history stores, and the consolidation reports (#995). Moved down from tools::ctx_knowledge, which re-exports it.
knowledge_embedding
Embedding-based Knowledge Retrieval for ctx_knowledge.
knowledge_provider_extract
Knowledge auto-extraction from provider data (issues, PRs, DB schemas).
knowledge_relations
language_capabilities
layout_pin
XDG layout commitment pin (GL #623 / #624).
legacy_adoption
Adoption of context that releases before 3.11.5 stored without a provable project (AP05).
levenshtein
Shared edit-distance “did you mean” helper (#712).
limits
litm
mcp_catalog
MCP Tool-Catalog Federation (#210) — Engine pillar.
mcp_manifest
mcp_roots
memory_archive
Multi-store, lossless memory archive (#995 Phase 1).
memory_boundary
memory_guard
Process-level RAM guardian with adaptive eviction and hard OOM protection.
memory_lifecycle
Memory Lifecycle Management — consolidation, decay, compaction, archival.
memory_policy
model_catalog
Bundled mz6/mz14 subscription model catalog (data/model_catalog.json, generated from the Cloud catalog by scripts/sync-model-catalog.py; CI checks it equals the pinned Cloud source).
model_registry
multi_repo
ocla
Open Context & Token Lifecycle Architecture (OCLA) public OSS contract.
ocla_bus
OCLA Event Bus (P2 / Track B — Event-Backbone).
ocp
Open Context Protocol (OCP) v0.1 export adapter.
openapi
OpenAPI 3.0 document for the public /v1 surface, generated from a single in-code endpoint inventory (endpoints). The HTTP route that serves it lives in http_server; the SSOT lives here so it stays compiled and drift-tested without the http-server feature.
opencode_config
Single source of truth for locating OpenCode’s global config file.
ort_environment
ONNX Runtime global environment: single init per process, runtime dylib loading.
ort_execution_providers
ONNX Runtime execution provider selection: CPU default, opt-in GPU providers.
outcome
Outcome contracts, local signal adapters, and deterministic evaluation.
output_sanitizer
Output sanitizer: detects and cleans degenerate model artifacts from compressed output.
output_verification
owasp_alignment
Maps lean-ctx security features to the OWASP Top 10 for Agentic Applications (2025). Used by lean-ctx audit CLI and /v1/audit/events endpoint.
path_mode_memory
Persistent per-path bounce memory (#496).
path_resolve
Shared path-resolution for tool handlers.
path_suggest
“Did you mean …?” for a path that does not exist.
pathjail
pathjail_autobind
Project auto-binding for sessions that start without a project.
pathjail_scope
Path-jail scope: which directories the jail treats as the user’s own code.
pathjail_write
Write destinations below a trusted root that refuse symlinked components.
paths
Typed XDG base-directory resolvers for lean-ctx (GH #408 / GL #602).
pathutil
patterns
Shell-output compression patterns.
persona
Context personas (persona-spec-v1).
phase_timing
Named phases of a long tool call (#2063).
pipeline
Context Pipeline
policy
Context Policy Packs v1 — Policies-as-Code (GL #489).
portable_binary
process_capture
Captured execution with bounded child waiting and process-tree cleanup.
product_capabilities
Canonical v4 product-capability registry.
profiles
Agent profiles — workload-specific configurations.
project_hash
property_graph
Property Graph Engine — SQLite-backed code knowledge graph.
protect
Explicit, deterministic preservation of user-marked spans across every compressor (read, shell, proxy, prose).
protected_store
Kernel store boundary of protected sessions: the pinned child rules, the in-process store-path check and the launcher’s control-file profiles. Kernel-enforced control-file immutability for the managed macOS MCP child. Named Unix sockets are restricted too; TCP and Mach are not contained here.
protocol
provider_bandit
Provider Bandit — Thompson Sampling for provider selection.
providers
proxy_endpoint
Where the local lean-ctx proxy listens and whether it answers.
proxy_introspect
The proxy’s persisted request introspection: the proxy process writes proxy-introspect.json (proxy::introspect), gain and the dashboard read it.
proxy_metrics
Cross-process proxy request totals: the proxy process counts and persists them, gain, the dashboard and the context-overhead report read them.
proxy_usage
On-disk record of the proxy’s measured provider spend (proxy_usage.json).
proxy_value_metrics
Per-session value metrics for proxied completions.
rabin_karp
read_mode
Type-safe ctx_read modes (#528 / #509 Phase 2).
read_stub_index
Persistent, conversation-scoped index of fully-delivered file reads (#955).
recovery
Recovery-hint policy + grammar.
redaction
reference_docs
Generated reference documentation.
reference_store
relevance_tracker
Proactive context expansion (#1122): automatically injects previously compressed data when it becomes relevant to the current request.
request_ledger
Request ledger of a serving process: counters, oldest pending request and last completions for doctor and health (#2197). Request ledger of a serving process (#2197).
response_optimizer
Response Optimizer (P9 / DIM 2 — Output-Optimierung).
roles
Role-based access control for agent governance.
root_selection
Which of several workspace roots a session binds to, made visible (AP04-G7, owner decision 19.10.).
rooted_read
Rooted, admitted file readers shared by the engine and the MCP tools: every source is opened inside its root (no symlink escape), decoded, and admitted through the context gateway before its content is returned. Re-exported from tools::ctx_read for the tool layer.
rule_artifacts
The committed LEAN-CTX.md rule artifacts as (relative_path, content) pairs — the single source shared by the regenerator (gen_rules example) and the drift gate (tests/rules_drift.rs) so the project copy and the rust/ copy can never disagree.
rules_canonical
Canonical rules source — single source of truth for all lean-ctx guidance.
rules_channel
Cross-channel rule deduplication policy (#684).
rules_dedup
Collapse duplicated lean-ctx guidance (#578): the planner and fixer behind lean-ctx rules dedup, setup, doctor --fix and the hook refresh.
rules_overhead
Shared accounting for the rules files an agent auto-loads each session.
runtime_flags
sanitize
savings_footer
savings_ledger
Verified Savings Ledger (G1) — the per-event, auditable counterfactual store.
savings_tracker
Per-session compression accounting, persisted when the tracker is dropped.
scent_field
Stigmergic scent field for zero-token multi-agent coordination (#540, EFF-3).
search_delta
search_hook
Search hot-path bridge for kernel evidence and repeat detection.
search_index
Resident line-search index for ctx_search (Phase 1 of the efficiency epic).
search_kernel
Evidence and repeated-query tracking for the search tool.
search_reranking
Post-RRF Reranking Pipeline for code-aware search.
search_walk
Walk limits and file filters shared by ctx_search and the search index, so both see the same searchable universe. Moved down from tools/ctx_search/implementation.rs.
secret_detection
secure_fs
Owner-only secret files.
security_events
Provable security events for the value surface.
semantic
Semantic code intelligence on top of the tree-sitter structure.
sensitivity
Per-item sensitivity model with a uniform policy floor (#212).
server_capabilities
GET /v1/capabilities — runtime discovery of what this lean-ctx instance supports, so any client (any language) can branch on real features instead of trial calls. The HTTP route lives in http_server; the payload builder lives here so it stays compiled (and drift-tested) without the http-server feature.
session
session_rights
Rights per session (process-v1 §9, contracts/process-v1/role-profile.schema.json).
session_summary
AI session summaries (#292): periodically distil the working session into a compact, semantically-recallable digest.
session_token
shared_context
Durable facts agents share through ctx_memory, partitioned by project.
shell_allowlist
Shell command lexing and the registered shell-allowlist gate.
shell_file_effects
Which files a shell command reads or rewrites, for bounce accounting.
signatures
Signature extraction.
signatures_ts
signer_trust
Signer trust anchors for handoff bundles and context packages (GHSA-gvg8-285q-m62g).
slow_log
solution_tracker
startup_guard
stats
structured_read
surprise
Predictive Surprise Scoring — conditional entropy relative to LLM knowledge.
syntax_validate
Post-edit syntax gate (#1008): a tree-sitter parse check used to reject an edit that turns a cleanly parsing file into a broken one.
tabular_crush
Deterministic tabular (CSV/TSV) crusher — columnar redundancy factoring for delimited data (#982, Headroom tabular-compressor port, GitLab Epic #973).
task_relevance
task_spine
Canonical task lineage with immutable async/blocking execution scopes.
tdd_schema
telemetry
Telemetry and metrics collection following OpenTelemetry GenAI conventions.
telemetry_aggregate
Privacy-safe daily telemetry aggregation.
telemetry_consent
Disclosure, consent and environment rules for default-on telemetry.
telemetry_failure
Why a built-in tool call failed, as a closed class for telemetry.
telemetry_features
The closed registry of feature codes for telemetry (3.11.1+).
telemetry_ledger
Local append-only ledger of sent telemetry heartbeats.
telemetry_notices
Notices from the LeanCTX team, carried back with a telemetry acknowledgement.
telemetry_send
Sending the telemetry-v2 daily totals: on MCP exit, on tool-call ticks and from the daemon’s hourly loop, with the local send ledger.
telemetry_v2
Privacy-bounded, versioned telemetry event contract.
terse
Terse Compression Engine
text_decode
Source-text decoding shared by every reader that feeds the indexes.
theme
tokens
Moved to the lean-ctx-patterns crate; re-exported so engine paths stay stable.
tool_catalog
The MCP tool catalog: the definitions of every registered tool.
tool_health
lean-ctx tools health — does every advertised MCP tool and injected rule earn its always-on token cost? (#848)
tool_lifecycle
Shared tool lifecycle — ensures CLI and MCP paths have identical side effects.
tool_profiles
tool_visibility
Pure tool-visibility policy for the MCP tools/list response.
transcript_compact
Transcript/conversation compaction for agent session JSONL files.
triage
type_ref_edges
Cross-file type-reference edges (GH #398).
untrusted
Foreign content as data (X5): every bus message, task body/update and repo fact pulled from Cloud that reaches an agent’s context passes wrap first.
update_scheduler
OS-specific auto-update scheduler management. Supports macOS LaunchAgent, Linux systemd/cron, Windows Task Scheduler.
updater
value
Value surface: makes what lean-ctx did visible outside the dashboard — subtly, outside the model’s context, and with every number provable.
value_gate
End-to-end task value assessment: execution cost → outcome → CPAO.
vault_map
<data_dir>/cloud/projects.json: the vaults Cloud resolved for this machine’s repositories and the local checkouts seen for each. Written when a checkout is resolved; read wherever a checkout’s vault matters (bus, sync, and the per-vault policy floor).
version_check
walk_filter
Central filter_entry predicate shared by every directory walker (graph/index builders, ctx_search, ctx_tree, ctx_glob, CLI scans).
web
Web & research context layer.
work_graph
Bounded Work Graph for multi-agent orchestration.
work_graph_delegation
Control boundary for host-started Work Graph nodes.
work_graph_store
Crash-safe, project-scoped persistence for the local bounded Work Graph.
workflow
workspace_authority
Launcher-bound Workspace authority (#2120).
workspace_trust
Workspace trust for project-local .lean-ctx.toml overrides (GH security audit, finding 4).
wrapped
xdg_migrate
On-demand XDG split migration (GH #408 / GL #606).
yaml_crush
Deterministic YAML crusher — structural compaction for YAML documents (#985, Headroom YAML-compressor port, GitLab Epic #973).