Expand description
Handovers across the mesh. A handover is written on one machine by majordomus handover into that checkout’s .ai/local/state/handovers/; this module is the bridge
between that record and the journal, in both directions:
- publish reads a local record — its front matter’s facts and its Markdown body —
into the
HandoverBodya journal event carries, bounded, identified by the digest of its body; - materialize writes a consumed handover into the consuming checkout’s handovers
directory as a record of the same schema, so
majordomus handover --resolveon a checkout of the same branch finds it through the ordinary resolution. It names the repository the way the resolver compares it (the local git common directory) and the origin runtime as its worktree — another checkout’s record on the same branch, tier 1 — and never copies a path of the author’s disk.
Materializing the same handover twice writes one file.
The publishing half needs nothing but the record on disk, which is what the round trip below exercises: the newest record of a checkout, read into the bounded body a journal event carries, identified by the digest of that body and carrying none of the paths of the machine that wrote it.
use majordomus_cli::mesh::handover::{directory, latest, to_body};
let checkout = tempfile::tempdir().unwrap();
let dir = directory(checkout.path());
std::fs::create_dir_all(&dir).unwrap();
std::fs::write(
dir.join("20260915T100000Z--feature-x--abcdef1--0011.md"),
"---\nschema_version: 1\ntask_id: t-1\nbranch: feature/x\nhead: abcdef1234\n\
worktree: /checkout/of/the/author\n---\n\n# Objective\nship\n",
)
.unwrap();
let newest = latest(checkout.path()).unwrap();
let body = to_body(&newest, Some("#184".into()), None).unwrap();
assert_eq!(body.branch.as_deref(), Some("feature/x"));
assert_eq!(body.issue.as_deref(), Some("#184"), "the publisher's to say");
// the author's disk never travels: the record's worktree is not part of the body
assert!(!serde_json::to_string(&body).unwrap().contains("/checkout/of/the/author"));Functions§
- directory
- Where a checkout’s handover records live. It is under
.ai/local/, which is never committed, so a handover is a fact about one checkout until something — this module, or a person — moves it; both halves of this module agree on the location by calling here rather than by each spelling the path. - latest
- The newest handover record of a checkout: names begin with a compact UTC timestamp, so the greatest name is the latest record.
- materialize
- Write a consumed handover into
root’s handovers directory, or return the record that already holds it. The record’s worktree ismesh:<origin runtime>: it resolves as another checkout’s handover on the same branch. - read
- Split a record into its front matter (flat
key: valuelines; list items are skipped) and its body. - to_body
- The journal body of a local record.
issueandmilestoneare the publisher’s to say: a handover record has no field for either.