cordance-core 0.1.1

Cordance core types, schemas, and ports. No I/O.
Documentation

cordance-core

Core types, schemas, and ports for the Cordance context-pack compiler. No I/O.

crates.io docs.rs license

Part of the Cordance workspace.

Discoverability

Search terms: Cordance core, context pack schema, source lock, evidence map, authority boundary, fenced regions, provenance, AI agent context, deterministic schemas.

What it does

cordance-core defines the central data model every other Cordance crate reads or writes:

  • CordancePack — the in-memory IR a cordance pack run produces.
  • SourceLock — the deterministic drift-detection lock that drives cordance check.
  • SourceRecord / SourceClass — classified-file metadata, content-agnostic by design (taxonomy comes from path, not prose).
  • AdviseReport, EvidenceMap, DoctrinePin — supporting on-disk shapes.
  • AuthorityBoundary / CortexReceiptV1Candidate / AxiomProjectHarnessTargetV1 — authority-bearing receipt structs, all #[non_exhaustive] with validate_invariants() enforcement.
  • fence::{find_regions, replace_regions, sanitise_fenced_value} — the fenced-region parser that makes AGENTS.md regeneration idempotent.
  • paths::doctrine_cache_dir_for_url — operator-trusted filesystem locations.
  • fs::{safe_write, safe_write_with_mkdir, SymlinkRefusal} — symlink-/ reparse-point-refusing write helpers used by every Cordance writer.

The crate is pure data + helpers; it never touches the filesystem outside the explicit fs:: and paths:: modules.

Install

[dependencies]
cordance-core = "0.1"

Quick start

use cordance_core::pack::{CordancePack, PackTargets, ProjectIdentity};
use cordance_core::lock::SourceLock;
use cordance_core::advise::AdviseReport;
use cordance_core::schema;

let pack = CordancePack {
    schema: schema::CORDANCE_PACK_V1.into(),
    project: ProjectIdentity {
        name: "my-project".into(),
        repo_root: ".".into(),
        kind: "rust-workspace".into(),
        host_os: "linux".into(),
        axiom_pin: None,
    },
    sources: vec![],
    doctrine_pins: vec![],
    targets: PackTargets::all(),
    outputs: vec![],
    source_lock: SourceLock::empty(),
    advise: AdviseReport::empty(),
    residual_risk: vec!["claim_ceiling=candidate".into()],
};

let json = serde_json::to_string_pretty(&pack).unwrap();
assert!(json.contains("cordance-pack.v1"));

See also

License

Dual-licensed under MIT OR Apache-2.0.