Skip to main content

forge_engine/
lib.rs

1//! # forge-engine
2//!
3//! Operational verification and evaluation engine for the local-first AI stack.
4//!
5//! `forge-engine` owns the execution-heavy lane: compile mindstate, validate and
6//! apply structured patches, run checks, score candidate outcomes, persist
7//! operational evidence, and update causal edit-attribution state.
8//!
9//! ## Authority boundary
10//!
11//! - `semantic-memory-forge` owns raw verification/export wire truth.
12//! - `forge-memory-bridge` owns transformation only.
13//! - `semantic-memory` owns durable projected/queryable truth.
14//! - `forge-engine` owns operational verification work on top of those crates.
15//!
16//! The `danger-sm-write` feature remains a compatibility-only escape hatch and
17//! is not the canonical export/import path.
18
19pub mod adapters;
20pub mod baseline;
21pub mod cea;
22pub mod config;
23pub mod error;
24pub mod exec;
25pub mod experiment;
26pub mod export;
27pub mod failure;
28pub mod invariants;
29pub mod lab;
30pub mod runtime;
31pub mod scoring;
32pub mod store;
33pub mod tool_receipts;
34
35// Re-export primary public types.
36pub use config::ForgeConfig;
37pub use error::{ForgeError, ForgeResult, Violation, ViolationKind};
38
39// Runtime types
40pub use runtime::mindstate::MindState;
41pub use runtime::patch::{
42    apply_patch, render_diff, validate_patch, Anchor, EditOp, FileEdit, FileMode,
43    LineAttributionMap, LineRange, StructuredPatch, ValidationResult,
44};
45pub use runtime::stabilizer::Stabilizer;
46pub use runtime::{compile_mindstate, extract_strategy_tags, AttemptPhase, DeltaPolicy};
47
48// Exec types
49pub use exec::{
50    is_env_allowed, select_backend, CheckCommand, CheckKind, CheckResult, CommandOutput,
51    CommandTimings, ContainerBackend, ContainerRuntime, EffectSignature, ExecutionBackend,
52    ExecutionBackendKind, HostBackend, LocatedEffect, LogBundle, ParsedCheckOutput,
53    PatchedWorkspace, Workspace,
54};
55
56// Adapter types
57pub use adapters::{CargoAdapter, ProjectAdapter};
58
59// Store types
60pub use store::ForgeStore;
61
62// Lab types
63pub use config::ForgeLimits;
64pub use lab::evaluate::{compute_correctness, compute_scores, persist_eval_run};
65pub use lab::{
66    archive_insert, compute_cell_key, compute_score_summary, promote, AlgebraSpec, ArchiveUpdate,
67    BasisVersion, CausalFingerprint, CausalHypothesis, EvalRunResult, EvalSuite, EvalTask,
68    ExperimentEvidenceBundle, ExperimentRunner, HypothesisStatus, LocalExperimentRunner,
69    ParameterBounds, ScoreVector, VerificationPlan, VerificationType,
70};
71
72// CEA types
73pub use cea::{
74    attribute_effects, build_edit_op_signature, compute_run_hash, load_graph, load_graph_with_tx,
75    predict, update_graph, update_graph_with_tx, AttributedRunResult, AttributionTriple,
76    CausalEdge, CausalGraph, CausalNode, CausalPrediction, CoverageSummary, EditOpSignature,
77    RiskFlag, UpdateResult,
78};
79
80// Baseline types
81pub use baseline::{
82    capture_baseline_provenance, BaselineDescriptor, BaselineSourceKind, ComparabilityPolicy,
83    WorkspacePolicy,
84};
85
86// Experiment types
87pub use experiment::{
88    AnalysisRecord, CacheMode, EffectKind, EvidenceRecord, ExecutionRecord, ExperimentConfig,
89    ExperimentDiff, ExperimentExportRecord, ExperimentMode, ExperimentResult,
90    PairedExperimentRunner, RunIdentity, StatisticsPolicy, TrialRecord, TrialSide,
91    TypedLocatedEffect,
92};
93
94// Scoring types
95pub use scoring::{
96    ComparabilityClass, ObjectiveKind, ObjectivePolicy, PatchExecutionPlan, PlannedCheck,
97};
98
99// Export types
100pub use export::{
101    compute_export_key, export_bundle, export_bundle_with_memory_write_through_compat,
102    EpisodeExport, RENDERING_VERSION,
103};
104pub use tool_receipts::ForgeToolReceiptSink;
105
106// Failure types
107pub use failure::{FailureClass, FailureRecord};
108
109// Evidence types (v2 + Phase 5)
110pub use lab::evidence::{
111    build_hypothesis_edges, compute_assessment, generate_verification_plan,
112    local_hypothesis_support_confidence, update_hypotheses_from_diff, AssessmentCategory,
113    BundleScope, ClaimStrength, ContradictionState, Covariates, DroppedStep, EvidenceAssessment,
114    HypothesisEdge, HypothesisEdgeKind, PairComparability, PlanBudget, ReceiptKind, ReceiptRef,
115    ReceiptStorage, SampleSupport, StepRequirement, Treatment, VerificationPolicy,
116    VerificationState, VerificationStep,
117};
118
119// Claim ledger types (Phase 7 — wired into forge-pilot export boundary)
120pub use claim_ledger::{Claim, EvidenceBundle, LedgerEntry, LedgerEvent};