Skip to main content

agentlink_domain/
lib.rs

1//! The agentlink domain.
2//!
3//! agentlink gives every AI coding agent in a repository the same brain, without
4//! copying a single file. It does that by exploiting a fact about the 2026
5//! ecosystem: for the resources that matter most, **the format has already
6//! converged and only the location differs.**
7//!
8//! * Instructions converged on `AGENTS.md` (Linux Foundation, December 2025).
9//! * Skills converged on Agent Skills / `SKILL.md` (open specification,
10//!   December 2025), read by 30+ tools.
11//!
12//! So each pairing of an agent with a resource resolves to one of four verdicts:
13//!
14//! | Verdict                                       | Meaning                                   | Cost |
15//! |-----------------------------------------------|-------------------------------------------|------|
16//! | [`Native`](model::Strategy::Native)            | the tool already reads the canonical path | zero |
17//! | [`Link`](model::Strategy::Link)                | same format, different path               | one link |
18//! | [`Import`](model::Strategy::Import)            | link impossible; write a one-line stub    | one small file |
19//! | [`plan::Blocked`]                              | needs a human decision                    | nothing is written |
20//!
21//! The payoff is that bidirectional propagation is not a feature anyone has to
22//! implement. For a `Native` or `Link` verdict there is exactly one inode, so
23//! editing, renaming, moving or deleting through any agent's path is immediately
24//! visible to every other agent — with no daemon, no watcher and no
25//! reconciliation pass.
26//!
27//! # Layering
28//!
29//! ```text
30//! agentlink-cli    composition root, human-facing output
31//!       ↓
32//! agentlink-domain   this crate: pure domain, no `std::fs`
33//!       ↑
34//! agentlink-fs     adapter implementing [`Workspace`] against a real directory
35//! ```
36//!
37//! Everything here is deterministic and testable without a filesystem: planning
38//! is a pure function of observable state, and [`testing::FakeWorkspace`]
39//! simulates hosts — including Windows without symlink privileges — that a given
40//! CI runner cannot otherwise reproduce.
41
42#![forbid(unsafe_code)]
43#![warn(missing_debug_implementations, clippy::doc_markdown)]
44
45pub mod apply;
46pub mod config;
47pub mod detect;
48pub mod gitignore;
49pub mod layout;
50pub mod lock;
51pub mod model;
52pub mod path;
53pub mod plan;
54pub mod provider;
55pub mod registry;
56pub mod workspace;
57
58#[cfg(any(test, feature = "testing"))]
59pub mod testing;
60
61pub use apply::{ApplyReport, apply};
62pub use config::Config;
63pub use layout::Layout;
64pub use lock::Lock;
65pub use model::{LinkSupport, LinkTarget, NodeKind, ResourceKind, Strategy, Via};
66pub use path::RelPath;
67pub use plan::{Blocked, Outcome, Plan, Planner, Skip, Step};
68pub use provider::{Capability, Provider};
69pub use registry::Registry;
70pub use workspace::{FsError, FsResult, Workspace};
71
72/// The version of the `agentlink` crate, surfaced in `--version` and lock files.
73pub const VERSION: &str = env!("CARGO_PKG_VERSION");