Skip to main content

lean_ctx/core/
mod.rs

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