Mission Lifecycle and Artifact Store
Project initialization, mission and spec authoring (propose, check, put, templates, test scaffolds), skill and adapter registries, session templates, and the canonical .harness path builders, run-id plumbing, atomic artifact transactions and hash chains.
Depends on: Artifact Schemas (11), Runtime Adapters and In-Runtime Extensions (10), Verification, Review and Promotion (2), Runtime Execution and Supervision (1), Run Control and Team Coordination (1)
Used by: Runtime Adapters and In-Runtime Extensions (38), Run Control and Team Coordination (26), Verification, Review and Promotion (25), Runtime Execution and Supervision (20), CLI Entry, Build and Project Tooling (15), Observability, Accounting and Reporting (12), Mission Control TUI (3)
(Numbers are distinct file-to-file dependencies.)
| File | Summary | Key symbols |
|---|---|---|
src/harness/adapter-add.ts |
Implements uh adapter add: holds the built-in YAML manifest templates for every wired runtime adapter and writes the selected one into the project’s .harness/adapters/ directory. |
listAdapterTemplates, addAdapter |
src/harness/artifact-paths.ts |
Tiny helper that returns a relative artifact path with forward-slash separators, handling Windows absolute paths and cross-volume targets. | relativeArtifactPath |
src/harness/artifact-transaction.ts |
Atomic artifact write primitives: rename with retry on transient Windows errors, write-temp-then-rename, and an exclusive artifact transaction lock using a named pipe on Windows and a bounded filesystem lock elsewhere. | renameWithRetry, writeAtomicArtifact, withArtifactTransaction, withWindowsTransaction |
src/harness/exit-codes.ts |
Pure mapping from run settlement status and stop code to process exit codes (0 passed, 1 failed, 2 blocked, 130 cancelled, 143 signal). | exitCodeForRun |
src/harness/hash-chain.ts |
Tiny append-only sha256 hash chain over canonical JSON lines, shared by hive facts, the intervention ledger, and the land decision index so edits, deletions, or reorders are detectable. | canonicalJson, sortValue, sha256Hex, sha256File, entryHash, chainEntry, verifyChainedLines, lastChainedHash, … |
src/harness/init.ts |
Initializes a project’s .harness directory tree with project.yaml, skills and sandbox indexes, an audit log, and default workflow profiles. | initializeHarness, getDefaultWorkflows |
src/harness/mission-check.ts |
Pre-launch mission packet checker that validates YAML, schema self-consistency, context files, runtime overrides, independent-review packets, expected outputs, change-only constraints, and grounding, rendering PASS/FAIL lines. | extractChangeOnlyPaths, checkRuntimeOverrides, checkIndependentReview, checkExpectedOutputs, checkConstraints, checkGrounding, checkMissionPackets, renderMissionCheckLines |
src/harness/mission-put.ts |
Installs validated mission packets from the coordinator’s allowed path into protected .harness mission directories, staging, checking, and rolling back writes atomically. | readPacket, stage, rollback, putMissionPackets |
src/harness/mission.ts |
Mission creation and shared mission guards: scaffolds mission.yaml with an optional design.md, and validates mission ids, initialized projects, workflow profiles, symlinks, and root containment. | createMission, renderDesignTemplate, assertSafeMissionId, requireInitializedProject, requireWorkflowProfile, rejectSymlinkIfExists, isPathWithin, assertWithinRoot, … |
src/harness/paths.ts |
Canonical path builders for every .harness location: project.yaml, adapters, workflows, skills, specs, missions, runs, sandboxes, and audit logs. | resolveRoot, harnessDir, projectYaml, adaptersDir, workflowsDir, skillsDir, specsActiveDir, specsArchiveDir, … |
src/harness/propose.ts |
Creates new mission packets for uh mission propose, either from CLI options or from a uh.spec.v0 spec file, validating the in-memory document before writing, and parses issue-ref and required-check CLI specs. |
proposeMission, resolveMissionPath, buildMissionDocument, proposeMissionFromSpec, serializeIssueRef, parseIssueRef, parseRequiredCheck |
src/harness/registry.ts |
Runtime adapter registry that lists, loads and validates .harness/adapters/*.yaml manifests and dispatches availability checks to runtime-specific checkers, exposing a process-wide singleton. | findManifestPath, readManifestFile, RuntimeRegistry |
src/harness/run-id.ts |
Per-run artifact directory plumbing (UH-82/UH-90): generates and validates run ids, maintains latest.json and runs/index.json, mirrors the latest runtime result and prunes old runs. | generateRunId, assertValidRunId, ensureRunDir, writeLatestPointer, readLatestPointer, appendRunsIndexEntry, mirrorRuntimeResultToLatest, pruneOldRuns |
src/harness/session-template-adoption.ts |
Adopts a session template for a mission invocation: applies it to the mission file and translates the result into runtime-config overrides and worker rules. | appendWorkerRules, adoptSessionTemplate |
src/harness/session-templates.ts |
Loads session templates from .harness/templates and merges them into mission documents with mission-first precedence and strict guard containment. | loadSessionTemplates, getSessionTemplate, applySessionTemplate, describeAppliedTemplate |
src/harness/skill.ts |
Skill registry operations for uh skill: add a skill directory with validated SKILL.md frontmatter to the skills index, list skills, and check a skill’s consistency. |
addSkill, listSkills, checkSkill, assertSafeSkillId, coerceEntry, readSkillsIndexFile, parseSkillFrontmatter, arraysEqual |
src/harness/spec-loader.ts |
Loads and parses uh.spec.v0 markdown specs: frontmatter, required sections, bullet lists and acceptance criteria, plus helpers mapping specs to mission ids and Linear refs. | loadSpecFile, parseSpecContent, linearRefsFromSpec, missionIdFromSpecId, extractSections, parseAcceptanceCriteria |
src/harness/spec-templates.ts |
Starter spec template library (UH-111) holding uh.spec.v0 markdown templates as shipped constants with list and lookup helpers. | listSpecTemplates, getSpecTemplate |
src/harness/test-scaffold.ts |
Generates and merges TypeScript or Python test scaffolds from a spec file’s acceptance criteria, emitting one AC block per criterion and preserving blocks a human has already filled in. | scaffoldTestsFromSpec, generateFreshScaffold, mergeScaffoldContent, scaffoldHeader, extractTypeScriptAcBlocks, extractPythonAcBlocks, renderAcBlocks, shouldPreserveBlock, … |