Skip to main content

claim_ledger/
lib.rs

1//! # claim-ledger
2//!
3//! Deterministic, local-first claim/evidence/provenance ledger.
4//!
5//! Creates receipts for all material operations.
6//!
7//! ## Core Concepts
8//!
9//! - **Claim**: A source-spanned atomic assertion extracted from a document.
10//! - **Evidence Bundle**: A collection of evidence links supporting a claim.
11//! - **Support Judgment**: A scoped support state assigned to a claim via an evidence bundle.
12//! - **Support Admission**: An operator-admitted or fixture-admitted upgrade to a support judgment.
13//! - **Contradiction Record**: A detected conflict between two claims with a resolution lifecycle.
14//! - **Claim Ledger**: An append-only, hash-chained ledger of claim events and support states.
15//! - **Export Receipt**: A binding receipt digest for any material output operation.
16//!
17//! ## Crate Architecture
18//!
19//! | Module | Purpose |
20//! |--------|---------|
21//! | [`ids`] | ULID/Hash-based stable identifiers |
22//! | [`error`] | Thiserror-based error types |
23//! | [`types`] | Domain types: Claim, EvidenceBundle, SupportJudgment, etc. |
24//! | [`ledger`] | Append-only hash-chained ledger |
25//! | [`receipt`] | Export and admission receipt types |
26
27pub mod budget;
28pub mod candidate;
29pub mod envelope;
30pub mod error;
31pub mod ids;
32pub mod ledger;
33pub mod receipt;
34pub mod types;
35
36// Re-export commonly used types at the crate root for ergonomic access.
37pub use budget::{
38    budget_for_claim, evaluate_proof_debt_gate, evaluate_proof_debt_gate_with_config,
39    evaluate_proof_debt_gate_with_waiver, evaluate_proof_debt_gate_with_waiver_and_config,
40    proof_debt_weight, total_proof_debt_weight, total_proof_debt_weight_with_config,
41    verify_proof_debt_waiver, ProofDebtBudgetConfig, ProofDebtBudgetV1, ProofDebtCreditV1,
42    ProofDebtDebitV1, ProofDebtGateDecision, ProofDebtGateResult, ProofDebtSummaryV1,
43    ProofDebtWaiverReceipt, ProofDebtWaiverValidationError, VerifiedProofDebtWaiver,
44    PROOF_DEBT_WAIVER_AUTHORIZATION_DOMAIN, PROOF_DEBT_WAIVER_SCHEMA_VERSION,
45};
46pub use candidate::{
47    ProofPacketCandidateProvenanceV1, SimilarClaimCandidateV1,
48    PROOF_PACKET_CANDIDATE_PROVENANCE_V1_SCHEMA, SIMILAR_CLAIM_CANDIDATE_V1_SCHEMA,
49};
50pub use envelope::{
51    ArtifactEnvelopeV1, EnvelopeError, EnvelopeVerificationContext, EnvelopeVerificationReport,
52    EnvelopeVerificationStatus, PolicyAdmission,
53};
54pub use error::ClaimLedgerError;
55pub use ids::{normalize_text, sha256_bytes, sha256_text, stable_id, ulid};
56pub use ledger::{
57    compact_ledger, compact_ledger_from_snapshot, compute_entry_digest, compute_snapshot_digest,
58    entry_digest_preimage, parse_ledger_entries, serialize_entry, verify_compaction, verify_ledger,
59    verify_ledger_tail, verify_snapshot, CompactedLedger, CompactionPolicy, CompactionReceipt,
60    ExpectedLedgerHead, LedgerEntry, LedgerEntryBuilder, LedgerEvent, LedgerSnapshot,
61    LedgerVerification, SnapshotClaim, SnapshotClaimSupport, SnapshotContentClaimLink,
62    SnapshotContradictionState, SnapshotFactClaimLink, SnapshotSupportJudgment,
63    UnprojectableEventPolicy,
64};
65pub use receipt::{
66    ContradictionResolutionReceipt, ExportReceipt, LedgerAppendReceipt, SupersessionReceipt,
67    SupportAdmissionReceipt,
68};
69pub use types::{
70    Claim, ContradictionRecord, ContradictionResolution, ContradictionResolutionRecord,
71    ContradictionStatus, EvidenceBundle, EvidenceLink, EvidenceRelation, ProofDebt, SourceArtifact,
72    SourceIndex, SourceSpan, Supersession, SupportAdmission, SupportAdmissionMethod,
73    SupportJudgment, SupportProofPayload, SupportState,
74};