Skip to main content

lean_ctx/core/
mod.rs

1// ---------------------------------------------------------------------------
2// Domain: Compression
3// ---------------------------------------------------------------------------
4pub mod activity;
5pub mod admitted_sources;
6pub mod aggressiveness;
7pub mod auto_capture;
8pub mod auto_findings;
9pub mod behavior_nudge;
10pub mod cockpit_launch_record;
11pub mod codebook;
12#[cfg(target_os = "macos")]
13pub mod codesign;
14pub mod command_cwd;
15pub mod command_root;
16pub mod command_vars;
17pub mod compress_preview;
18pub mod compression_safety;
19pub mod compressor;
20pub mod context_prefetch;
21pub mod datadog_push;
22pub(crate) mod engine_artifact;
23pub mod engine_interface;
24pub mod entropy;
25pub mod etpao;
26pub mod extractive;
27pub mod finops_export;
28pub(crate) mod foreign_mcp;
29pub use lean_ctx_compress::html_crush;
30#[allow(unused_imports)]
31pub mod ib;
32pub mod import;
33/// Simulated end-to-end self-test of the decision loop; a test, not product evidence.
34#[cfg(test)]
35pub(crate) mod integration_proof;
36pub mod intelligence_runtime;
37pub mod json_crush;
38pub(crate) mod migration_lock;
39pub mod output_sanitizer;
40pub mod policy;
41pub mod pop_pruning;
42pub mod pre_edit;
43pub mod preservation;
44pub mod process_capture;
45pub mod protect;
46pub mod rabin_karp;
47pub mod relevance_tracker;
48pub mod rooted_read;
49pub mod rule_artifacts;
50pub mod rule_discovery;
51pub mod rules_canonical;
52pub mod rules_channel;
53pub mod rules_dedup;
54pub mod rules_overhead;
55pub(crate) mod rules_sections;
56pub(crate) mod rules_validation;
57pub mod runtime_flags;
58pub mod shared_context;
59pub mod solution_auto_capture;
60pub mod solution_tracker;
61/// Backward-compatible re-export of the Solution Intelligence types that live in
62/// `core::knowledge`. Kept on purpose for library users (#1923).
63pub mod solution_types;
64pub mod structured_read;
65pub use lean_ctx_compress::tabular_crush;
66pub mod task_receipt_migration;
67#[allow(unreachable_pub)]
68#[cfg(windows)]
69pub(crate) mod windows_file;
70#[cfg(windows)]
71pub mod windows_private;
72pub use lean_ctx_compress::yaml_crush;
73
74// ---------------------------------------------------------------------------
75// Domain: Memory
76// ---------------------------------------------------------------------------
77pub mod interrupt;
78pub mod legacy_adoption;
79pub mod memory_archive;
80pub mod memory_boundary;
81pub(crate) mod memory_capacity;
82pub(crate) mod memory_consolidation;
83pub mod memory_guard;
84pub mod memory_lifecycle;
85pub mod memory_policy;
86pub(crate) mod memory_salience;
87pub mod prospective_memory;
88
89// ---------------------------------------------------------------------------
90// Domain: Graph
91// ---------------------------------------------------------------------------
92pub mod call_graph;
93pub mod community;
94pub mod graph_analysis;
95pub mod graph_context;
96pub mod graph_coordinator;
97pub mod graph_enricher;
98pub mod graph_export;
99pub mod graph_index;
100pub mod graph_parity;
101pub mod graph_provider;
102pub mod pagerank;
103pub mod property_graph;
104pub mod repomap;
105
106// ---------------------------------------------------------------------------
107// Domain: Context
108// ---------------------------------------------------------------------------
109pub mod context_admission;
110pub mod context_bundle;
111pub mod context_compiler;
112pub mod context_deficit;
113pub mod context_field;
114pub mod context_handles;
115pub mod context_ir;
116// Accidental historical surface retained for source compatibility. Public
117// embedders should use `engine::ContextEngine` or `lean-ctx-sdk`.
118pub mod context_checkpoint;
119#[doc(hidden)]
120pub mod context_kernel;
121pub mod context_ledger;
122pub mod context_lint;
123pub mod context_os;
124pub mod context_overhead;
125pub mod context_overlay;
126pub mod context_package;
127pub mod context_policies;
128pub mod context_proof;
129pub mod context_proof_v2;
130pub mod context_quality;
131pub mod context_radar;
132pub mod context_snapshot;
133pub mod context_store;
134pub mod cross_source_edges;
135pub mod cross_source_hints;
136pub mod customer_proof_v2;
137
138// ---------------------------------------------------------------------------
139// Domain: Knowledge
140// ---------------------------------------------------------------------------
141pub mod claim_extractor;
142pub mod execution_ledger;
143pub mod knowledge;
144pub mod knowledge_bootstrap;
145pub mod knowledge_bridge;
146pub mod knowledge_consolidate;
147pub mod knowledge_embedding;
148pub mod knowledge_provider_extract;
149pub mod knowledge_relations;
150pub mod knowledge_router;
151pub mod outcome;
152pub mod trust;
153
154// ---------------------------------------------------------------------------
155// Domain: Search & Retrieval
156// ---------------------------------------------------------------------------
157pub mod bm25_cache;
158pub mod bm25_index;
159pub mod bm25_store;
160pub mod bounded_lock;
161pub mod bypass_hint;
162pub mod content_cache;
163pub mod content_chunk;
164pub mod context_packing;
165pub mod dense_backend;
166pub mod embedding_access;
167pub mod embedding_index;
168pub(crate) mod embedding_quant;
169pub mod embeddings;
170pub mod energy;
171pub mod hybrid_search;
172pub mod instruction_files;
173pub mod mcp_roots;
174#[cfg(feature = "pgvector")]
175pub(crate) mod pgvector_store;
176#[cfg(feature = "qdrant")]
177pub(crate) mod qdrant_store;
178pub mod read_mode;
179pub mod reference_store;
180pub mod search_hook;
181pub mod search_kernel;
182pub mod search_reranking;
183pub mod search_walk;
184pub mod semantic;
185pub mod semantic_cache;
186pub mod splade_retrieval;
187
188// ---------------------------------------------------------------------------
189// Domain: Session & Handoff
190// ---------------------------------------------------------------------------
191pub mod ccp_session_bundle;
192pub mod handoff_ledger;
193pub mod handoff_transfer_bundle;
194pub mod session;
195pub mod session_diff;
196pub mod session_readset;
197pub mod session_rights;
198pub mod session_summary;
199pub mod signer_trust;
200pub mod skillify;
201
202// ---------------------------------------------------------------------------
203// Domain: Attention & Placement
204// ---------------------------------------------------------------------------
205pub mod litm;
206
207// ---------------------------------------------------------------------------
208// Domain: Embeddings / ML
209// ---------------------------------------------------------------------------
210// ORT runtime glue links against the `ort` crate, which is only pulled in by the
211// `embeddings` feature. On platforms ORT does not support (e.g.
212// FreeBSD, see #586) these features are disabled, so the modules must be gated
213// to keep the build clean without them.
214#[cfg(all(feature = "embeddings", any(feature = "ort-cuda", test)))]
215pub(crate) mod ort_cuda_imports;
216#[cfg(feature = "embeddings")]
217pub mod ort_environment;
218#[cfg(feature = "embeddings")]
219pub mod ort_execution_providers;
220
221// ---------------------------------------------------------------------------
222// Domain: Patterns & Shell
223// ---------------------------------------------------------------------------
224pub mod patterns;
225
226// ---------------------------------------------------------------------------
227// Domain: Agents & A2A
228// ---------------------------------------------------------------------------
229pub mod a2a;
230pub mod a2a_transport;
231pub mod agent_identity;
232pub mod agent_runtime_env;
233pub mod agent_templates;
234pub mod agents;
235pub mod autonomy;
236pub mod canonical;
237pub mod hive_gate;
238pub mod hive_models;
239
240// ---------------------------------------------------------------------------
241// Domain: Adaptive & Scoring
242// ---------------------------------------------------------------------------
243pub mod adaptive;
244pub mod adaptive_policy;
245pub mod adaptive_thresholds;
246pub mod auto_mode_resolver;
247pub mod decision_loop;
248pub mod decision_loop_runtime;
249#[cfg(test)]
250mod decision_loop_runtime_tests;
251pub mod decisions;
252pub mod execution_lifecycle;
253pub mod execution_protocol;
254pub mod model_catalog;
255pub mod model_registry;
256pub mod shadow;
257pub mod task_relevance;
258pub mod task_spine;
259
260// ---------------------------------------------------------------------------
261// Domain: Diagnostics & Quality
262// ---------------------------------------------------------------------------
263pub mod benchmark;
264pub mod code_health;
265pub mod conformance;
266pub mod contracts;
267#[cfg(feature = "tree-sitter")]
268pub(crate) mod cyclomatic;
269pub mod loop_detection;
270pub mod output_verification;
271pub mod quality;
272pub(crate) mod safety_needles;
273pub mod scorecard;
274pub mod setup_report;
275pub mod slow_log;
276pub mod smells;
277pub mod subagent_contract;
278pub mod surprise;
279pub mod system_info;
280pub mod verification_observability;
281
282// ---------------------------------------------------------------------------
283// Domain: Config & Infrastructure
284// ---------------------------------------------------------------------------
285pub mod active_inference;
286pub mod agent_budget;
287pub mod agent_lease;
288pub mod anchor;
289pub(crate) mod ann_cache;
290pub mod atomic_fs;
291pub mod attribution;
292pub mod audit_trail;
293pub mod binary_detect;
294pub mod binary_identity;
295pub mod bounce_tracker;
296pub mod budget;
297pub mod budgets;
298pub mod cache;
299pub mod capabilities;
300pub mod capsule_transport;
301pub mod causal_attribution;
302pub mod ccr;
303pub mod claude_host;
304pub mod claude_md;
305pub mod cli_cache;
306pub mod client_capabilities;
307pub mod client_constraints;
308pub mod cloud_files;
309pub mod compact_directive;
310pub mod config;
311pub mod config_heal;
312pub mod consolidation;
313pub mod consolidation_engine;
314pub mod context_capsule;
315pub mod contextops;
316pub mod conversation;
317pub mod crash_log;
318pub mod crypto_provider;
319pub mod dashboard_pro;
320pub mod data_consolidate;
321pub mod data_dir;
322pub mod debug_log;
323pub mod diagnostics_store;
324pub mod dynamic_tools;
325pub mod editor_signal;
326pub mod egress;
327pub mod error;
328pub mod events;
329pub mod eviction_orchestrator;
330pub(crate) mod evidence;
331pub mod extension_registry;
332pub mod extractors;
333pub mod file_lock;
334pub mod filters;
335pub mod gain;
336pub mod git;
337pub mod git_cache;
338pub mod git_signals;
339pub mod git_util;
340pub mod git_worktree;
341pub(crate) mod godot;
342pub mod gotcha_tracker;
343pub mod governor_hosts;
344pub mod handle;
345pub mod hasher;
346pub mod heatmap;
347pub mod hive_signals;
348pub mod hnsw;
349pub mod home;
350pub mod homeostasis;
351pub mod hook_mode;
352pub mod host_coverage;
353pub mod host_state;
354pub mod immune_detector;
355pub mod mcp_catalog;
356pub mod metering;
357pub mod ocla;
358pub mod ocla_bus;
359pub mod unit_claims;
360pub mod work_graph;
361pub mod work_graph_delegation;
362pub mod work_graph_store;
363
364pub mod agent_registry;
365pub mod compliance_evidence;
366pub mod edit_metering;
367pub mod edit_quality;
368pub mod efficacy;
369pub mod evidence_bundle;
370pub mod failure_template;
371pub mod grammar_usage;
372pub mod graph_cache;
373pub mod host_env;
374pub mod http_client;
375pub mod ide_permissions;
376pub use lean_ctx_syntax::import_resolver;
377pub mod index_admission;
378pub mod index_filter;
379pub mod index_namespace;
380pub mod index_orchestrator;
381pub mod index_paths;
382pub mod index_progress;
383pub mod ingestion;
384pub mod input_filters;
385pub mod installation_id;
386pub mod instruction_compiler;
387// Compiled into build.rs (`#[path]`); here only for its tests.
388#[cfg(test)]
389mod build_origin;
390pub mod integrity;
391pub mod intent_engine;
392pub(crate) mod intent_lang;
393pub mod intent_protocol;
394pub mod intent_router;
395pub mod introspect;
396pub mod io_boundary;
397pub mod io_health;
398pub mod journal;
399pub mod jsonc;
400pub mod language_capabilities;
401#[cfg(target_os = "macos")]
402pub(crate) mod launchd;
403pub mod layout_pin;
404pub mod levenshtein;
405pub mod limits;
406pub mod llm_feedback;
407pub mod logging;
408pub mod mcp_manifest;
409pub mod multi_repo;
410pub(crate) mod nc_compress;
411pub mod ocp;
412pub mod openapi;
413pub mod opencode_config;
414pub mod output_echo;
415pub mod output_shapers;
416pub mod owasp_alignment;
417pub mod path_locks;
418pub mod path_mode_memory;
419pub mod path_resolve;
420pub mod path_suggest;
421pub mod paths;
422pub mod pathutil;
423pub mod persona;
424pub mod phase_timing;
425pub mod pipeline;
426pub mod portable_binary;
427pub mod product_capabilities;
428pub mod profile_suggest;
429pub mod profiles;
430pub mod project_hash;
431pub mod project_link;
432/// Supervised execution channel for protected sessions (macOS refuses nested
433/// Seatbelt profiles, so command children are started by the launcher's
434/// wrapper, outside the MCP sandbox).
435#[cfg(unix)]
436pub mod protected_execution;
437/// Kernel store boundary of protected sessions: the pinned child rules, the
438/// in-process store-path check and the launcher's control-file profiles.
439pub mod protected_store;
440pub mod protocol;
441pub mod provenance;
442pub mod provider_bandit;
443pub mod provider_cache;
444pub mod providers;
445pub mod proxy_cache_attribution;
446pub mod proxy_endpoint;
447pub mod proxy_introspect;
448pub mod proxy_metrics;
449pub mod proxy_usage;
450pub mod proxy_value_metrics;
451pub mod read_stub_index;
452pub mod recovery;
453pub mod redaction;
454pub mod reference_docs;
455/// Request ledger of a serving process: counters, oldest pending request and
456/// last completions for doctor and health (#2197).
457pub mod request_ledger;
458pub mod response_optimizer;
459pub mod roles;
460pub mod root_selection;
461pub mod route_extractor;
462pub mod sandbox;
463#[cfg(target_os = "linux")]
464pub(crate) mod sandbox_landlock;
465pub(crate) mod sandbox_seatbelt;
466pub mod sanitize;
467pub mod savings_footer;
468pub mod savings_ledger;
469pub mod savings_tracker;
470pub mod scent_field;
471pub mod search_delta;
472pub mod search_index;
473pub mod secret_detection;
474pub mod secure_fs;
475pub mod security_events;
476pub mod security_posture;
477pub mod sensitivity;
478pub mod server_capabilities;
479pub mod session_token;
480pub mod share;
481pub mod shell_allowlist;
482pub mod shell_file_effects;
483pub mod shell_history;
484pub mod startup_guard;
485pub mod stats;
486pub mod symbol_map;
487pub mod vault_map;
488pub use lean_ctx_syntax::syntax_validate;
489pub mod task_briefing;
490/// macOS Seatbelt self-sandbox (#356): wraps launchd-owned daemon/proxy/updater
491/// in a `sandbox-exec` profile that denies `~/Documents`/`~/Desktop`/
492/// `~/Downloads`, so the TCC privacy prompt can never appear.
493#[cfg(target_os = "macos")]
494pub mod tcc_guard_sandbox;
495pub mod tdd_schema;
496pub mod telemetry;
497pub mod telemetry_aggregate;
498pub mod telemetry_consent;
499pub mod telemetry_failure;
500pub mod telemetry_features;
501pub mod telemetry_ledger;
502pub mod telemetry_notices;
503pub mod telemetry_send;
504pub mod telemetry_v2;
505pub mod terse;
506pub mod text_decode;
507pub mod theme;
508pub mod tokens;
509pub mod tool_catalog;
510pub mod tool_health;
511pub mod tool_lifecycle;
512pub mod tool_profiles;
513pub mod tool_visibility;
514pub mod transcript_compact;
515pub mod triage;
516pub mod untrusted;
517pub mod update_scheduler;
518pub mod updater;
519pub mod value;
520pub mod value_gate;
521pub mod version_check;
522pub mod walk_filter;
523/// WASM extension runtime (`wasm-abi-v1`): sandboxed, language-independent
524/// compressors and providers. Feature-gated behind `wasm`.
525#[cfg(feature = "wasm")]
526pub(crate) mod wasm_ext;
527pub mod web;
528pub mod workflow;
529pub mod workspace_config;
530pub mod wrapped;
531pub(crate) mod wrapped_share;
532pub(crate) mod wrapped_svg;
533pub mod xdg_migrate;
534
535// ---------------------------------------------------------------------------
536// Feature-gated modules
537// ---------------------------------------------------------------------------
538pub mod archive;
539pub mod archive_fts;
540pub mod artifact_index;
541pub mod artifacts;
542#[cfg(feature = "tree-sitter")]
543pub(crate) use lean_ctx_syntax::ast_walk;
544#[cfg(feature = "tree-sitter")]
545pub mod chunks_ts;
546pub mod context_gc;
547pub use lean_ctx_syntax::deep_queries;
548pub mod deps;
549#[cfg(test)]
550mod doc_claims;
551pub mod editor_registry;
552pub mod feature_list;
553pub mod firewall;
554pub mod pathjail;
555pub mod pathjail_scope;
556pub mod pathjail_write;
557pub mod relevance_gate;
558pub mod signatures;
559#[cfg(feature = "tree-sitter")]
560pub use lean_ctx_syntax::signatures_ts;
561pub mod storage_maintenance;
562pub mod type_ref_edges;
563pub mod workspace_args;
564pub mod workspace_authority;
565pub mod workspace_trust;