# cordance-core
> Core types, schemas, and ports for the Cordance context-pack compiler. No I/O.
[](https://crates.io/crates/cordance-core)
[](https://docs.rs/cordance-core)
[](#license)
Part of the [Cordance](https://github.com/0ryant/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
```toml
[dependencies]
cordance-core = "0.1"
```
## Quick start
```rust
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
- [Cordance project README](https://github.com/0ryant/cordance#readme)
- [`cordance-scan`](https://crates.io/crates/cordance-scan) — the canonical
producer of `SourceRecord` values.
- [`cordance-emit`](https://crates.io/crates/cordance-emit) — emitters that
consume `CordancePack`.
## License
Dual-licensed under MIT OR Apache-2.0.