Skip to main content

memstead_base/ingest/
mod.rs

1//! The deterministic ingest-orchestration surface.
2//!
3//! Ingest today has two implementations that have drifted apart: a full
4//! orchestration (selection, backoff, change-detection, brief assembly,
5//! process-state lifecycle) living in the Claude-Code plugin's Node.js, and
6//! a hard-coded natural-language charge in the macOS app that uses none of
7//! it. This module is the engine-side home the deterministic half is being
8//! ported into, so that the plugin skill and the macOS app both reduce to
9//! thin clients pulling the *same* rendered run-brief from the engine —
10//! honouring "every engine-reachable operation is reachable over UniFFI
11//! *and* CLI" and "the engine owns mem-repo state".
12//!
13//! The boundary is load-bearing: **deterministic → engine** (selection,
14//! backoff, change-detection, brief assembly, cursor/process-state);
15//! **LLM-inherent → agent** (reading sources, mutating the graph). The
16//! engine renders the brief and advances deterministic state — it never
17//! hosts the agent.
18//!
19//! The deterministic half is ported and wired: the structural [`resolve`]
20//! layer (joins an ingest config to its projection, facets, and mediums), the
21//! [`change_detection`] primitives, the [`cursor`] driver that assembles a
22//! per-source changed slice across the git / graph / mtime strategies, and
23//! [`brief`] assembly — all reachable through `memstead ingest brief` (CLI)
24//! and the UniFFI surface, which the plugin skill and macOS app consume as
25//! thin clients.
26
27pub mod advance;
28pub mod brief;
29pub mod change_detection;
30pub mod cursor;
31pub mod findings;
32pub mod guidance;
33pub mod prune;
34pub mod refinement;
35pub mod render;
36pub mod report;
37pub mod resolve;
38pub mod selection;
39pub mod slice;
40pub mod status;
41
42pub use advance::{
43    AdvanceError, AdvanceOutcome, AdvanceState, DispositionInput, EXCLUDED_VERDICT, ExcludeError,
44    ExcludeOutcome, advance_baseline, advance_store_path, delete_advance_store, read_advance_store,
45    record_exclusions, write_advance_store,
46};
47pub use brief::{
48    NoSignalNote, PROCESS_MEM_SCHEMA, ProcessMemInfo, SourceCursor, SyncCommand,
49    assemble_discovery_brief, assemble_one_shot_brief, render_changed_slice, render_goal_and_avoid,
50    render_intent, render_one_shot_lens, render_operative_data, render_situation,
51    render_sync_brief, render_verify_brief,
52};
53pub use change_detection::{
54    Digest, StatDiff, StatEntry, StatMap, compute_stat_map, diff_stat_maps, digest_stat_map,
55    digests_equal, parse_digest_token, serialize_digest_token,
56};
57pub use cursor::{
58    compute_source_cursor, enumerate_facet_files, source_moved, write_active_deny_file,
59};
60pub use findings::{
61    FacetEnumerability, Finding, FindingClass, FindingKey, FindingTarget, FindingsBatch,
62    FindingsError, FindingsStore, FullResyncDecision, FullResyncRefusal, VerifyOutcome,
63    adjudicate_anchor, current_findings, delete_findings_store, findings_store_path,
64    read_findings_store, schedule_full_resync, verify_binding, write_findings_store,
65};
66pub use guidance::{
67    GuidanceDefaults, MemGuidance, ResolvedGuidance, merge_guidance_block, resolve_writing_guidance,
68};
69pub use prune::{
70    PruneDisposition, PruneMerge, PruneMode, PruneProposal, classify_prune_candidate,
71    prune_proposals,
72};
73pub use refinement::{
74    Batch, ROTATION_ANCHOR_ADJUDICATION, ROTATION_UNCOVERED_FILES, bump_verify_runs, next_batch,
75    next_rotation_batch,
76};
77pub use render::{
78    RenderBriefError, mode_name, render_ingest_brief, render_sync_brief_for,
79    render_verify_brief_for,
80};
81pub use report::{
82    ALLOWED_REPORT_INCLUDE_KEYS, AnchorComposition, DEFAULT_REPORT_BUDGET, DenominatorBasis,
83    FacetCapability, FacetFreshness, FidelityReport, GrainCoverage, RenderedFidelityReport,
84    TreeFanout, compute_fidelity_report, render_fidelity_report,
85};
86pub use resolve::{
87    ChangeStrategy, ResolveError, ResolvedIngest, ResolvedPrimarySource, ResolvedSource,
88    find_git_root, resolve_binding, resolve_binding_run, resolve_change_strategy,
89};
90pub use selection::{BackoffEntry, MAX_SKIP_LEVEL, apply_backoff, select_next_due, should_skip};
91pub use slice::{
92    Slice, SliceOutcome, graph_changes_to_slice, graph_slice_outcome, is_git_token,
93    mtime_slice_outcome,
94};