Expand description
prepare → (skill executes) → finalize, plus abort and resume.
All filesystem state changes happen here; the agent only writes data
files into the slots prepare carved out. Hash chaining and atomic
writes are handled in hasher; concurrency in lock.
Structs§
- Pending
Run - Pending run pointer: control id, run id, and the run dir.
- Prepare
Opts - Options for
prepare. Onlytodayis required; the rest are agent-supplied metadata.
Functions§
- abort
- Tear down a pending run by sealing a failed manifest. Records the
reason in
manifest.failure_reasonso the audit trail says why. Leaves any partial evidence on disk under the run dir. - finalize
- Hash every artifact, link the manifest to the prior run, atomically
write
manifest.json, updatestate.json, and remove the pending sentinel. Returns the sealed manifest. - finalize_
at - Like
finalize, but with an injectable completion clock. The CLI path usesfinalize(wall-clock); tests pincompleted_atso the coverage math (on-time vs late) is deterministic instead of drifting with the calendar. - git_
head - Resolve the registry repo’s HEAD commit hex via gix. Errors when
rootisn’t a git repo or HEAD can’t be peeled (no commits yet, detached weirdness, etc) —preparerequires a real git sha to pin what the registry said at run time. - list_
pending - Walk
<root>/evidence/looking for.run-pendingsentinels. A sentinel sitting next to a sealedmanifest.jsonis treated as crash-recovery debris from a finalize that died after the manifest landed but before sentinel removal: it’s silently swept rather than surfaced as a pending run (which would block fresh prepares for that control). - prepare
- Allocate a run directory, snapshot scope, write
prepare.json, drop the.run-pendingsentinel, and return the prepare context. Holds the root lock for the duration so concurrent prepares serialise. - resume
- Re-emit the prepare context for a pending run. No-op idempotent helper for resuming after an interrupted agent session.