lifeboat

package
v0.16.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2026 License: MIT Imports: 39 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package lifeboat holds the brief-to-lifeboat contract and, later, the source adapters that fill it.

The mapping table below is the single source of truth for that contract. It is rendered into the brief's 00-meta.md, which calls the table "the contract" but has never carried one; a test asserts the two agree, so the document cannot drift from the code.

The table is a HYPOTHESIS, not a measurement. Each row states the best status a lifeboat could reach for one brief section at each source tier. The probe (`abcd disembark probe`) measures the same sections against real repositories and reports the same three-valued status, so the hypothesis and the evidence are directly comparable — and the hypothesis is expected to lose where they disagree.

Index

Constants

View Source
const (
	MarkerBegin = "<!-- BEGIN GENERATED: brief-lifeboat-mapping -->"
	MarkerEnd   = "<!-- END GENERATED: brief-lifeboat-mapping -->"
)

MarkerBegin and MarkerEnd delimit the rendered table inside the brief. The test that guards this contract reads between them.

View Source
const (
	LessonScoreMin = 0
	LessonScoreMax = 4
)

The lesson question's scale.

View Source
const (
	// PrinciplesSchemaVersion stamps principles.json. It is 2 since every entry
	// carries claim_type, reference and comparison beside its evidence
	// (adr-2609021016270132, spc-2609020626042471); a payload at 1 is refused as
	// unsupported, so a consumer sees the change by the version.
	PrinciplesSchemaVersion = 2
	// PressReleaseSchemaVersion stamps press-release.json.
	PressReleaseSchemaVersion = 1
	// ReviewSchemaVersion stamps review/review-<manifest12>.json.
	ReviewSchemaVersion = 1
)
View Source
const EmbarkSchemaVersion = 1

EmbarkSchemaVersion stamps EmbarkPlan and EmbarkResult so a future breaking change to their shape is detectable rather than silently misread.

View Source
const GraveyardSchemaVersion = 1

GraveyardSchemaVersion stamps archaeology.json and abandoned.json.

View Source
const LessonScoresSchemaVersion = 1

LessonScoresSchemaVersion is the scores file's shape.

View Source
const LessonsExample = `` /* 312-byte string literal not displayed */

LessonsExample is one `disembark graveyard --lessons-json` payload at LessonsSchemaVersion that passes CheckLessons.

View Source
const LessonsSchemaVersion = 1

LessonsSchemaVersion stamps lessons.json and each low-confidence file.

View Source
const MaxLessonScoresBytes = 128 << 10

MaxLessonScoresBytes caps a scores file: one short entry per lesson, for at most maxPredecessorLessons lessons.

View Source
const MaxLessonsBytes = maxLessonsBytes

MaxLessonsBytes is the exported cap a front door uses to bound its read of the untrusted lessons payload (file or stdin) before handing it to IngestLessons, which enforces the same ceiling internally.

View Source
const MaxSynthesisBytes = maxSynthesisBytes

MaxSynthesisBytes is the exported cap a front door uses to bound its read of an untrusted synthesis payload (file or stdin) before handing it to a core verb, which enforces the same ceiling internally (mirrors MaxLessonsBytes).

View Source
const PressReleaseExample = `` /* 497-byte string literal not displayed */

PressReleaseExample is one `disembark press-release --press-release-json` payload at PressReleaseSchemaVersion that passes CheckPressRelease.

View Source
const PrinciplesExample = `` /* 409-byte string literal not displayed */

PrinciplesExample is one `disembark principles --principles-json` payload at PrinciplesSchemaVersion that passes CheckPrinciples.

View Source
const ProvenanceName = "_provenance.json"

ProvenanceName is the lifeboat's commit marker and the key to embark's destination-safety gate. It is written last and hashes every other file.

View Source
const ReviewExample = `` /* 320-byte string literal not displayed */

ReviewExample is one `disembark review --review-json` payload at ReviewSchemaVersion that passes CheckReview.

View Source
const SchemaVersion = 2

SchemaVersion is the coverage-report schema version. It is stamped into every report and checked by the aggregate, so a future breaking change to the shape is detectable rather than silently misread.

Variables

View Source
var (
	LessonsFileType      = reflect.TypeOf(LessonsFile{})
	PrinciplesFileType   = reflect.TypeOf(PrinciplesFile{})
	PressReleaseFileType = reflect.TypeOf(PressReleaseFile{})
	ReviewArtefactType   = reflect.TypeOf(ReviewArtefact{})
)

The Go types the four inputs decode into.

View Source
var ErrEmbarkConflicts = errors.New("embark: target has conflicting files; nothing was written")

ErrEmbarkConflicts is the sentinel EmbarkFrom returns when the target already holds files that differ from what the lifeboat would write. On this error the write path has done NOTHING (decision 4): the returned EmbarkResult carries the full Conflicts slice for the surface to render as one bulk report, and no file was touched. The surface maps errors.Is(err, ErrEmbarkConflicts) to exit 1 (an expected refusal), distinct from a structural fault (exit 2).

View Source
var ErrLessonScores = errors.New("the lesson scores are refused")

ErrLessonScores is a scores file refused: nothing is ranked by it.

View Source
var ErrPressReleaseUncited = errors.New("press release cites no resolvable evidence; refusing to replace the derived press release")

ErrPressReleaseUncited is the whole-document refusal a delegated press release earns when its evidence resolves to nothing in the restricted packed-path set. The surface maps it to exit 2; the previously-derived deterministic file is left untouched (the document is one unit — there is no per-entry granularity to drop).

View Source
var Table = []Mapping{
	{"product/press-release", "brief/01-product/01-press-release.md",
		StatusBlank, StatusPartial, StatusGrounded,
		"README lede, docs/, shipped intents' press releases"},
	{"product/context", "brief/01-product/02-context.md",
		StatusPartial, StatusGrounded, StatusGrounded,
		"README, docs/, CONTRIBUTING, commit subjects"},
	{"product/mental-model", "brief/01-product/03-mental-model.md",
		StatusBlank, StatusPartial, StatusGrounded,
		"docs/ explanation pages, ADR context sections, the brief"},
	{"product/scope", "brief/01-product/04-scope.md",
		StatusPartial, StatusPartial, StatusGrounded,
		"README features, intents' in-scope/out-of-scope sections, the code's own surface"},
	{"product/personas", "brief/01-product/05-personas.md",
		StatusBlank, StatusBlank, StatusGrounded,
		"personas registry, press-release quote attributions"},
	{"product/framing", "brief/01-product/06-framing.md",
		StatusBlank, StatusPartial, StatusGrounded,
		"the brief's framing section, the brief-creation interview's committed framing products"},
	{"constraints/platform", "brief/02-constraints/01-platform.md",
		StatusPartial, StatusGrounded, StatusGrounded,
		"build manifests, CI workflows, README requirements"},
	{"constraints/dependencies", "brief/02-constraints/02-dependencies.md",
		StatusPartial, StatusGrounded, StatusGrounded,
		"add/remove churn from git history; the authoritative list needs the manifest and lockfile"},
	{"constraints/invariants", "brief/02-constraints/03-invariants.md",
		StatusBlank, StatusPartial, StatusGrounded,
		"CONTRIBUTING, agent-conventions router, lint configs, ADR consequences"},
	{"constraints/naming", "brief/02-constraints/04-naming.md",
		StatusBlank, StatusPartial, StatusGrounded,
		"glossary, naming registry, reserved-vocabulary tables"},
	{"evidence/what-worked", "brief/03-evidence/01-what-worked.md",
		StatusPartial, StatusPartial, StatusGrounded,
		"CHANGELOG, code that survived, reviews and retrospectives"},
	{"evidence/what-didnt", "brief/03-evidence/02-what-didnt.md",
		StatusPartial, StatusPartial, StatusGrounded,
		"the graveyard beneath it — reverts, dead branches, superseded records"},
	{"evidence/open-questions", "brief/03-evidence/03-open-questions.md",
		StatusBlank, StatusPartial, StatusGrounded,
		"TODO and FIXME markers, open issues, intents' open-questions sections"},
	{"evidence/tradeoffs", "brief/03-evidence/04-tradeoffs.md",
		StatusBlank, StatusPartial, StatusGrounded,
		"ADR alternatives-considered sections wherever ADRs live"},
	{"surfaces", "brief/04-surfaces/",
		StatusPartial, StatusGrounded, StatusGrounded,
		"CLI entrypoints and help text, README usage, per-surface design files"},
	{"internals", "brief/05-internals/",
		StatusPartial, StatusPartial, StatusGrounded,
		"package layout, architecture docs, the internals chapters"},
	{"delivery/build-sequence", "brief/06-delivery/01-build-sequence.md",
		StatusPartial, StatusPartial, StatusGrounded,
		"tags and release history, CHANGELOG, roadmap phases"},
	{"delivery/verification-matrix", "brief/06-delivery/02-verification-matrix.md",
		StatusPartial, StatusPartial, StatusGrounded,
		"test files and what they target, CI workflow steps; which check covers which surface is authored judgement"},
	{"delivery/out-of-scope", "brief/06-delivery/03-out-of-scope.md",
		StatusBlank, StatusPartial, StatusGrounded,
		"README non-goals, intents' out-of-scope sections"},
	{"glossary", "brief/glossary/",
		StatusBlank, StatusPartial, StatusGrounded,
		"docs glossary pages, the bounded-context glossary"},
	{"graveyard", "graveyard/",
		StatusGrounded, StatusGrounded, StatusGrounded,
		"reverted commits, branches abandoned unmerged, files deleted after substantial history, dependencies added then removed; then superseded records"},
	{"rescue/spine", "rescue/",
		StatusPartial, StatusPartial, StatusGrounded,
		"commit history as a spine where no record exists; the intent corpus where one does"},
	{"docs/adrs", "docs/adrs/",
		StatusBlank, StatusGrounded, StatusGrounded,
		"ADRs wherever they live, copied verbatim"},
	{"activity/issues", "activity/issues/",
		StatusBlank, StatusPartial, StatusGrounded,
		"issue exports, the capture ledger"},
}

Table is the brief-to-lifeboat contract.

Read the three status columns as the experiment's prediction. Two rows carry most of the thesis:

  • graveyard is the only section grounded at TierGit. What a project abandoned is written in its git history whether or not anyone wrote it down, which is why the graveyard is worth a section of its own.
  • product/personas is blank at every tier below abcd-native, and grounded there only from an authored brief file: a person's writing, never an extraction. The probe confirmed that across the corpus, so the section is human-owned (adr-36) — a question for a human, which a lifeboat carries as a blank to answer wherever no one has written the personas down.

Functions

func CheckLessons added in v0.16.1

func CheckLessons(repoRoot string, raw []byte) error

CheckLessons runs the lessons ingest's structural checks on raw: the cap, the strict decode, the schema gate and the lesson cap.

func CheckPressRelease added in v0.16.1

func CheckPressRelease(repoRoot string, raw []byte) error

CheckPressRelease runs the press release's structural checks on raw: the cap, the strict decode, and the schema, mode and prompt-version gates.

func CheckPrinciples added in v0.16.1

func CheckPrinciples(repoRoot string, raw []byte) error

CheckPrinciples runs the principles synthesis's structural checks on raw: the cap, the strict decode, the schema, mode and prompt-version gates, the principle cap, and every entry readable as an object.

func CheckReview added in v0.16.1

func CheckReview(repoRoot string, raw []byte) error

CheckReview runs the review's structural checks on raw: the cap, the strict decode, the schema, mode and prompt-version gates, the verdict and the finding cap.

func ManifestSHA256

func ManifestSHA256(files []PlannedFile) string

ManifestSHA256 is the pinned lifeboat hash (adr-35): the shared construction over every file EXCEPT _provenance.json (which cannot hash itself).

Types

type Abandoned

type Abandoned struct {
	SchemaVersion int       `json:"schema_version"`
	Findings      []Finding `json:"findings"`
}

Abandoned is layer 2: what the project explicitly declared dead in its record. Findings is never nil in a written file (an empty [] honestly states "the record declares nothing dead").

type AggregateRepo

type AggregateRepo struct {
	Name         string `json:"name"`
	Commits      int    `json:"commits"`
	TiersPresent []Tier `json:"tiers_present"`
}

AggregateRepo is a probed repository's identity in the aggregate header.

type AggregateReport

type AggregateReport struct {
	SchemaVersion int              `json:"schema_version"`
	Repos         []AggregateRepo  `json:"repos"`
	Sections      []AggregateRow   `json:"sections"`
	Verdict       []SectionVerdict `json:"verdict"`
}

AggregateReport is the cross-repo readout: one row per brief section, one column per probed repository, each cell the section's status in that repo. This is the artefact the M2 gate reads to decide which brief sections survive.

func Aggregate

func Aggregate(covs []Coverage) AggregateReport

Aggregate reduces per-repo coverage reports to the cross-repo table. Repos keep the order given; sections keep the mapping's canonical order.

func (AggregateReport) AlwaysBlankSections

func (a AggregateReport) AlwaysBlankSections() []Section

AlwaysBlankSections returns the sections no probed repo could ground, in the mapping's canonical order.

func (AggregateReport) Render

func (a AggregateReport) Render() string

Render returns the human-readable cross-repo aggregate table.

type AggregateRow

type AggregateRow struct {
	Section Section           `json:"section"`
	Cells   map[string]Status `json:"cells"` // repo name -> status
}

AggregateRow is one brief section across every repository.

type Answer

type Answer struct {
	Text          string `json:"text"`
	AuthoredBy    string `json:"authored_by"`
	AuthoredAt    string `json:"authored_at"`
	AgentAssisted bool   `json:"agent_assisted,omitempty"`
}

Answer is a human's authored answer to a blank. Its provenance is a person and a date — an honest non-file source, per adr-36 — never a file the answer did not come from.

type Archaeology

type Archaeology struct {
	SchemaVersion int       `json:"schema_version"`
	Findings      []Finding `json:"findings"`
}

Archaeology is layer 1: the Tier-0, git-only, deterministic, evidence-only dig. Findings is never nil in a written file (an empty [] is a first-class result — "history records nothing abandoned").

type BlankPrompt

type BlankPrompt struct {
	Section  Section  `json:"section"`
	Kind     Kind     `json:"kind"`
	Question string   `json:"question,omitempty"`
	Searched []string `json:"searched,omitempty"`
}

BlankPrompt is one unanswered brief section a human must supply.

type Confidence

type Confidence string

Confidence qualifies a non-blank status: how sure the adapter is that the evidence it cites actually grounds the section. It is meaningless for a blank.

const (
	ConfidenceHigh   Confidence = "high"
	ConfidenceMedium Confidence = "medium"
	ConfidenceLow    Confidence = "low"
)

type Conflict

type Conflict struct {
	Path         string       `json:"path"`
	LifeboatPath string       `json:"lifeboat_path"`
	Kind         ConflictKind `json:"kind"`
	Detail       string       `json:"detail,omitempty"`
}

Conflict is one target path embark cannot safely write. Path is the target repo-relative POSIX path; LifeboatPath is the source file in the lifeboat it was mapped from. Detail is a short, sanitised human explanation.

type ConflictKind

type ConflictKind string

ConflictKind classifies why embark cannot safely write one planned target.

const (
	// ConflictExistsDiffers: the target path is a regular file whose bytes differ
	// from what the lifeboat would write. Identical bytes are NOT a conflict.
	ConflictExistsDiffers ConflictKind = "exists-differs"
	// ConflictTargetNotRegular: the target path exists but is not a regular file
	// (a directory, symlink, or device). Embark refuses to replace it.
	ConflictTargetNotRegular ConflictKind = "target-not-regular"
	// ConflictDuplicateTarget: two lifeboat files resolve to the same embark
	// target (e.g. a bucket-less rescue/intents/<leaf> alongside
	// rescue/intents/drafts/<leaf>). Writing both would be a silent
	// last-writer-wins overwrite, so the collision refuses instead.
	ConflictDuplicateTarget ConflictKind = "duplicate-target"

	// ConflictParentNotDir: a parent component of the target path exists and is
	// not a real directory (a file, or a symlink). Writing the file would require
	// clobbering or traversing it, so embark refuses.
	ConflictParentNotDir ConflictKind = "parent-not-dir"
)

type Coverage

type Coverage struct {
	SchemaVersion int               `json:"schema_version"`
	Repo          RepoInfo          `json:"repo"`
	TiersPresent  []Tier            `json:"tiers_present"`
	Sections      []SectionCoverage `json:"sections"`
	Summary       Summary           `json:"summary"`

	// IncludedIgnored records that this probe read files git ignores. Only the
	// WIDE scan is stated: the narrow one is the default and every existing
	// report already means it, so omitempty keeps a default report byte-identical
	// and no schema bump is owed.
	//
	// It is stated because scope is not visible in the result. A section that
	// came back blank looks the same either way, and a reader of a packed
	// lifeboat cannot otherwise tell "nothing there" from "not looked at".
	IncludedIgnored bool `json:"included_ignored,omitempty"`
}

Coverage is one repository's probe result: which brief sections a lifeboat could ground from it, at what confidence, citing what. It is the M2 experiment's per-repo readout, and it aggregates across repositories (see Aggregate) — that cross-repo table is what answers "is the brief structure sound."

func Probe

func Probe(repoRoot string, opts ...ProbeOption) (Coverage, error)

Probe runs every registered adapter over one repository and reduces the results to a Coverage report. Adapters run concurrently; the reduction is deterministic. It never writes to the source repository.

By default it honours .gitignore. See IncludeIgnored.

func (Coverage) Render

func (c Coverage) Render() string

Render returns the human-readable per-repo coverage report.

type CoverageHandoff

type CoverageHandoff struct {
	Present  bool          `json:"present"`
	Degraded bool          `json:"degraded,omitempty"`
	Note     string        `json:"note,omitempty"`
	Summary  Summary       `json:"summary"`
	Blanks   []BlankPrompt `json:"blanks,omitempty"`
	// PassBExemption is the lifeboat's own declaration that the transcript pass
	// did not run for it, carried through from _provenance.json. It is part of
	// the handoff because it is the difference between a gap a human has to close
	// and a pass that was never there: nil is a lifeboat that declares nothing,
	// and reads exactly as it did before the field existed.
	PassBExemption *PassBExemption `json:"pass_b_exemption,omitempty"`
}

CoverageHandoff is the blanks-first payload embark surfaces before the write summary. Present is false when the lifeboat carried no coverage.json; Degraded is true when it was present but unreadable/unparseable (Note explains).

type EmbarkAction

type EmbarkAction string

EmbarkAction is the disposition of a mapped, non-conflicting file against the current target. A conflicting file never appears in Planned — it is recorded in Conflicts instead.

const (
	// ActionCreate: the target path is absent; embark would write it.
	ActionCreate EmbarkAction = "create"
	// ActionUnchanged: the target already holds byte-identical content; embark
	// skips it (idempotent re-embark, and the P2 self-closure property).
	ActionUnchanged EmbarkAction = "unchanged"
)

type EmbarkPlan

type EmbarkPlan struct {
	SchemaVersion        int              `json:"schema_version"`
	LifeboatDir          string           `json:"lifeboat_dir"`
	TargetDir            string           `json:"target_dir"`
	SourceName           string           `json:"source_name"`
	ManifestVerified     bool             `json:"manifest_verified"`
	ManifestSHA256       string           `json:"manifest_sha256"`
	RecordManifestSHA256 string           `json:"record_manifest_sha256,omitempty"`
	Coverage             *CoverageHandoff `json:"coverage,omitempty"`
	Planned              []PlannedEmbark  `json:"planned,omitempty"`
	Conflicts            []Conflict       `json:"conflicts,omitempty"`
	Ignored              []IgnoredFile    `json:"ignored,omitempty"`
	Marker               MarkerResult     `json:"marker"`
}

EmbarkPlan is the read-only result of `embark probe <lifeboat> [target]`: what would land where, what conflicts would block a write, which lifeboat files are not embarked, the marker action, and the coverage handoff. It writes nothing.

func EmbarkProbe

func EmbarkProbe(lifeboatDir, targetDir string) (EmbarkPlan, error)

EmbarkProbe inspects the lifeboat at lifeboatDir against targetDir WITHOUT writing. Both are resolved to absolute dirs (the CLI defaults targetDir to cwd). It gates the lifeboat, verifies the manifest, computes the plan (mapped writes, conflicts, ignored files), predicts the marker action, and reads the coverage handoff. It returns a structural error for a non-lifeboat / schema-too-new / failed-verification / bad-target input; a plan WITH conflicts is a SUCCESS (probe is a report, never a refusal).

func (EmbarkPlan) Render

func (p EmbarkPlan) Render() string

Render is the human-readable `embark probe` report. The coverage BLANKS and their questions come FIRST — that is what a lifeboat hands a product thinker — then the write plan, the marker action, any conflicts as ONE bulk block, and the ignored/record-hash footer.

type EmbarkResult

type EmbarkResult struct {
	SchemaVersion int              `json:"schema_version"`
	LifeboatDir   string           `json:"lifeboat_dir"`
	TargetDir     string           `json:"target_dir"`
	SourceName    string           `json:"source_name"`
	Written       int              `json:"written"`
	Unchanged     int              `json:"unchanged"`
	BytesWritten  int              `json:"bytes_written"`
	Families      map[string]int   `json:"families,omitempty"` // family name -> files written
	Marker        MarkerResult     `json:"marker"`
	Coverage      *CoverageHandoff `json:"coverage,omitempty"`
	Ignored       []IgnoredFile    `json:"ignored,omitempty"`
	Conflicts     []Conflict       `json:"conflicts,omitempty"`
}

EmbarkResult is the outcome of `embark from <lifeboat> [target]`. On success Conflicts is empty and Written/Unchanged account for every mapped file. On the ErrEmbarkConflicts refusal path Conflicts is populated, Written is zero, and no file was touched.

func EmbarkFrom

func EmbarkFrom(lifeboatDir, targetDir string) (EmbarkResult, error)

EmbarkFrom performs the write. It runs the same planner as EmbarkProbe; if the plan carries ANY conflict it returns (result-with-Conflicts, ErrEmbarkConflicts) having written NOTHING. It judges the plan again under the target's ledger and intent locks, and a conflict found then refuses the same way. Otherwise it writes each ActionCreate file through os.Root containment + independent lexical validation + an exclusive create, skips ActionUnchanged files, ensures the marker last, and returns the summary.

func (EmbarkResult) Render

func (r EmbarkResult) Render() string

Render is the human-readable `embark from` outcome. On the conflict-refusal path (Conflicts populated, nothing written) it renders the coverage blanks, the bulk conflict block, and the "nothing was written" line. On success it renders the coverage blanks first, then the write summary and the marker verb.

type Evidence

type Evidence struct {
	Status     Status
	Confidence Confidence
	Sources    []string // evidence cited (repo-relative paths, git refs)
	Searched   []string // what was looked for (esp. on a blank)
	Question   string   // the human question (esp. on a blank)
	Reason     string   // why a partial is partial: what was found, what would ground it
}

Evidence is what one Source reports for its section against one repository. The orchestrator stamps the Tier and Section from the Source itself, so an adapter cannot misreport which tier or section it speaks for.

Contract by status:

  • grounded / partial: Sources must be non-empty — every claim cites a file or a git ref. Confidence should be set.
  • partial: Reason must be non-empty, naming what was found and what would ground the section — a partial that does not say why is a shrug, not a result. Build one with partial(), the only constructor a source uses.
  • blank: Searched should say what was looked for and Question should name the thing a human must answer. A blank is a first-class result.

type Finding

type Finding struct {
	ID       string   `json:"id"`
	Signal   Signal   `json:"signal"`
	Summary  string   `json:"summary"`
	Evidence []string `json:"evidence,omitempty"`
	Notices  []string `json:"notices,omitempty"`
}

Finding is one graveyard signal, uniform across layers 1 and 2. ID is a stable deterministic token (see the id helpers below) that a layer-3 lesson cites in its Evidence array; an entry citing no live id is dropped by the validator. Summary is a one-line human description.

Two channels carry the rest, and they are kept apart by type rather than by wording (iss-2608270926037088):

  • Evidence is the concrete cited material (commit subjects, quoted lines, paths). It is drawn from repository content a hostile or archived repo controls, so every string passes through gvText at build time.
  • Notices are the binary's own statements ABOUT the finding: a cap omission, a shadowed claimant, a truncated listing. They are authored here, never copied from the repository; where one names a record path, the path is a Go-quoted operand, so it cannot close its quotes and speak as the notice.

When the two shared one array, a crafted path or bullet could write text indistinguishable from an omission notice, and the layer-3 interpreter reading the file had no way to tell the forgery from the binary's word.

type IgnoredFile

type IgnoredFile struct {
	LifeboatPath string        `json:"lifeboat_path"`
	Reason       IgnoredReason `json:"reason"`
	Detail       string        `json:"detail,omitempty"`
}

IgnoredFile is one lifeboat file embark did not write, and why.

type IgnoredReason

type IgnoredReason string

IgnoredReason says why a lifeboat file is not embarked.

const (
	// IgnoredReportOnly: an identity/git-derived or metadata file that informs the
	// report but is never written into a target (brief/**, coverage.*,
	// graveyard/**, rescue/spine.md, _provenance.json).
	IgnoredReportOnly IgnoredReason = "report-only"
	// IgnoredUnmapped: a file under a known family root that does not resolve to a
	// target (unknown bucket, unsafe leaf, or bucket-less where no default exists).
	IgnoredUnmapped IgnoredReason = "unmapped"
	// IgnoredUnknown: a file under no known family — a foreign or tampered entry.
	// It passed manifest verification (it is part of the sealed set) but embark
	// has no home for it, so it is reported and never written.
	IgnoredUnknown IgnoredReason = "unknown"
)

type Kind

type Kind string

Kind classifies a brief section by whether a repository could ever ground it. It is the durable form of the M2 gate decision (adr-36): a blank in an extractable section is coverage debt abcd can close with a better source or adapter; a blank in a human-owned section is not a failure at all — it is a standing prompt only a person can answer, and the lifeboat frames it that way.

const (
	// KindExtractable means a source or a richer adapter could ground the
	// section; an unfilled blank is coverage debt.
	KindExtractable Kind = "extractable"
	// KindHumanOwned means the section is not derivable from a repository by
	// design; the blank is a question for a human, never an extraction.
	KindHumanOwned Kind = "human-owned"
)

type Lesson

type Lesson struct {
	ID         string     `json:"id"`
	Lesson     string     `json:"lesson"`
	Confidence Confidence `json:"confidence"`
	Evidence   []string   `json:"evidence"`
}

Lesson is one layer-3 interpretation, both the untrusted input shape (the host-delegated interpreter emits an array of these) and the written output shape. Confidence reuses the coverage Confidence enum (high/medium/low); "low" routes the lesson to graveyard/low-confidence/ instead of lessons.json. Evidence must cite layer-1/2 Finding ids — an entry with no live ref is dropped. Lesson (the prose) is sanitised and marker-neutralised before it is written into the lifeboat.

type LessonDrop

type LessonDrop struct {
	ID     string `json:"id"`
	Reason string `json:"reason"`
}

LessonDrop records one lesson the validator refused to write, and why. A drop is reported, never fatal: one uncitable entry must not sink an otherwise-good interpretation batch.

type LessonQuestion added in v0.16.0

type LessonQuestion struct {
	ID          string `json:"id"`
	Release     string `json:"release"`
	Lesson      string `json:"lesson"`
	Type        string `json:"type"`
	Kind        string `json:"kind"`
	Ask         string `json:"ask"`
	Min         int    `json:"min"`
	Max         int    `json:"max"`
	StateSHA256 string `json:"state_sha256"`
}

LessonQuestion is one lesson's question, as the view lists it for the host: the lesson's id, its release and text, the judgement type and kind, the words and the scale, and the hash of the state it is asked over, which a score handed back names.

type LessonScore added in v0.16.0

type LessonScore struct {
	ID          string `json:"id"`
	StateSHA256 string `json:"state_sha256"`
	Score       *int   `json:"score"`
}

LessonScore is one lesson's score: its id, the state hash its question named, and a whole number on the scale.

type LessonScores added in v0.16.0

type LessonScores struct {
	SchemaVersion int           `json:"schema_version"`
	Scores        []LessonScore `json:"scores"`
}

LessonScores is the scores file the host hands back: every lesson asked, scored exactly once.

type LessonsFile

type LessonsFile struct {
	SchemaVersion int      `json:"schema_version"`
	Lessons       []Lesson `json:"lessons"`
}

LessonsFile is the on-disk shape of graveyard/lessons.json (and, for one entry, each graveyard/low-confidence/<id>.json).

type LessonsJudgement added in v0.16.0

type LessonsJudgement struct {
	Type          string `json:"type"`
	Mode          string `json:"mode"`
	Target        string `json:"target,omitempty"`
	RankedBy      string `json:"ranked_by"`
	ModelReported string `json:"model_reported,omitempty"`
	Fallback      string `json:"fallback,omitempty"`
	Pairs         int    `json:"pairs,omitempty"`
	PairsFile     string `json:"pairs_file,omitempty"`
	PairsNote     string `json:"pairs_note,omitempty"`
}

LessonsJudgement is the run record of a ranking that asked: the type and its mode, the adapter's target, what ranked the lessons, why a type turned on fell back to the host, and the shadow pairs kept, or why not.

type LessonsPlan added in v0.16.1

type LessonsPlan struct {
	Result LessonsResult
	SynthPlan
}

LessonsPlan is what IngestLessons would do: the result it would report, and the files it would write and clear.

func PlanIngestLessons added in v0.16.1

func PlanIngestLessons(lifeboatDir string, raw []byte, scan SecretScan) (LessonsPlan, error)

PlanIngestLessons does everything IngestLessons does before its first write: the lifeboat gate, the payload's decode and per-entry validation, the composition of every survivor file, and the secret scan over those bytes. A refused payload is refused here, in the same words; nothing is written.

func (LessonsPlan) Apply added in v0.16.1

func (p LessonsPlan) Apply() (LessonsResult, error)

Apply clears the prior layer 3 and writes the planned survivors.

type LessonsResult

type LessonsResult struct {
	LifeboatDir        string       `json:"lifeboat_dir"`
	Written            int          `json:"written"`
	LowConfidence      int          `json:"low_confidence"`
	Dropped            int          `json:"dropped"`
	Drops              []LessonDrop `json:"drops,omitempty"`
	LessonsPath        string       `json:"lessons_path,omitempty"`
	LowConfidencePaths []string     `json:"low_confidence_paths,omitempty"`
}

LessonsResult is the transport-agnostic outcome of `abcd disembark graveyard`. The core returns it; a surface renders it (the core never prints). Written + LowConfidence + Dropped accounts for every input entry.

func IngestLessons

func IngestLessons(lifeboatDir string, raw []byte, scan SecretScan) (LessonsResult, error)

IngestLessons validates host-produced lesson JSON against a PACKED lifeboat and writes the survivors into it. It is transport-agnostic: it returns a LessonsResult and never prints. It fails closed on structural problems (returns an error); per-entry problems drop that entry (recorded in the result), never the batch. Output ordering is deterministic (lessons sorted by id), so a re-ingest of the same payload writes byte-identical files.

Each ingest FULLY REPLACES layer 3: the prior graveyard/lessons.json and graveyard/low-confidence/ are cleared before the current survivors are written, so re-ingesting is the current interpretation, not an accretion of every past run — a lesson promoted low->high leaves no stale low-confidence file, and a lesson dropped from a later payload does not persist.

The written lessons files are DELIBERATELY NOT part of manifest_sha256. That hash is pinned at pack time (adr-35) over the deterministic layer-1/2 extraction and the rest of the lifeboat; it is the integrity seal _provenance.json records and the key to embark's re-pack closure. Layer 3 is a later, mutable, host-delegated interpretation written into an already-sealed lifeboat. Folding it into the manifest would either force a re-seal (breaking "pinned at pack time") or leave a hash that no longer matches _provenance.json. The graveyard interpretation's integrity is the per-entry cite-or-be-dropped rule, not the manifest seal — by design.

The payload is secret-scanned before it is written, as pack's planned bytes are: every file the call would write is handed to scan before anything is cleared or written, and a non-nil error refuses the whole call, leaving the lifeboat as it was. Refuse, never redact. A nil scan fails closed.

It is PlanIngestLessons followed by the plan's Apply, so a practice run (`--dry-run`) and the real write share every check.

func (LessonsResult) Render

func (r LessonsResult) Render() string

Render is the deterministic, sanitised human summary of an ingest.

type LessonsView added in v0.12.0

type LessonsView struct {
	corereflect.Ranking
	Retrospectives int `json:"retrospectives"`
	// Unranked is true when there was no brief text to rank against: the lessons
	// are listed in the order the lifeboat carries them, the top few first.
	Unranked bool `json:"unranked"`
	// Truncated is true when the lifeboat carried more than maxPredecessorLessons lessons
	// and only the first were read.
	Truncated bool `json:"truncated,omitempty"`
	// Questions are the judgement the ranking asks of the host: one score
	// question per lesson (RankPredecessorLessons), empty when nothing is
	// asked (no brief, no lessons, the host's scores given, or the decision
	// adapter's scores taken).
	Questions []LessonQuestion `json:"questions"`
	// Judgement is the run record of a ranking that asked; nil when nothing
	// was asked.
	Judgement *LessonsJudgement `json:"judgement,omitempty"`
	// contains filtered or unexported fields
}

LessonsView is the embark view of the predecessor's lessons: the ranking, how many retrospectives the lifeboat carried, and whether the ranking had a brief to rank against.

func PredecessorLessons added in v0.12.0

func PredecessorLessons(lifeboatDir, framing string) (LessonsView, error)

PredecessorLessons reads every retrospective the lifeboat at lifeboatDir carries and ranks their lessons against framing, the new voyage's brief framing text (corereflect.RankLessons). It writes nothing. A lifeboat that is not one, is newer than this abcd, or fails its manifest is refused before any lesson is read.

func RankPredecessorLessons added in v0.16.0

func RankPredecessorLessons(ctx context.Context, v LessonsView, r *judge.Router, scores []byte) (LessonsView, error)

RankPredecessorLessons ranks the lessons of v, as PredecessorLessons read them, through the decision adapter's router r (nil keeps the type on the host), with scores the host's scores file when it gave one (nil when not). With no question asked (no brief, or no lessons) it returns v as it is, and refuses scores. A scores file out of shape is refused with ErrLessonScores, nothing ranked; the adapter's failure is never an error (turned on it is a fallback receipt, in shadow a pair that records it). Only a stopped ctx, or a question the router refuses, is.

func (LessonsView) Render added in v0.12.0

func (v LessonsView) Render() string

Render is the person's view of the lessons: what ranked them, the few first, each with its id and the release it came from, then the rest as a list, and the judgement asked of the host, or why the decision adapter did not answer. Every lesson is already one cleaned line; the release is a validated tag.

type Lifeboat

type Lifeboat struct {
	Coverage  Coverage      `json:"coverage"`
	Files     []PlannedFile `json:"files"`
	Omissions []Omission    `json:"omissions,omitempty"`
}

Lifeboat is the complete plan for one disembark: every file that would be written, the coverage it was derived from, and any records deliberately left out. Pack (M3b) is Plan plus a write over exactly this file set — one code path, so a dry-run cannot lie about what a real pack will do. Nothing here touches the destination.

func Plan

func Plan(repoRoot string, opts ...ProbeOption) (Lifeboat, error)

Plan produces the complete lifeboat plan for a repository, read-only. It runs the probe, then assembles: the grounded and partial brief section files (each citing its source), the coverage report (JSON and Markdown), verbatim copies of the ADRs and the issue ledger, the rescue spine, and _provenance.json with the pinned manifest hash. It writes nothing — Plan has no destination.

func (Lifeboat) Manifest

func (lb Lifeboat) Manifest() PlanManifest

Manifest reduces a Lifeboat to its dry-run manifest: paths and sizes, the pinned hash, the totals, and any omissions — the content is deliberately dropped (PlannedFile marshals path and byte count only).

func (Lifeboat) RenderManifest

func (lb Lifeboat) RenderManifest() string

RenderManifest returns the human-readable dry-run: the file list with sizes, then the totals, any omissions, and the pinned hash. It writes nothing — it only describes what a pack would write.

type Mapping

type Mapping struct {
	Section      Section
	LifeboatPath string
	Git          Status
	Conventions  Status
	Native       Status
	Reads        string
}

Mapping is one row of the contract: where a brief section lands in a lifeboat, the best status each tier could ground it to, and what a source adapter reads to try.

func (Mapping) StatusAt

func (m Mapping) StatusAt(t Tier) Status

StatusAt returns the hypothesised best status for this section at tier t.

type MarkerAction

type MarkerAction string

MarkerAction is what embark would do (probe) or did (from) to the marker block in the target's conventions file.

const (
	// MarkerActionInstall: no block present; embark injects the current block.
	MarkerActionInstall MarkerAction = "install"
	// MarkerActionRefresh: an outdated/duplicated block present; embark replaces it.
	MarkerActionRefresh MarkerAction = "refresh"
	// MarkerActionCurrent: the current block is already present; no write.
	MarkerActionCurrent MarkerAction = "current"
	// MarkerActionSkip: the target's setup chose no conventions file, or the
	// chosen file is a symlink or otherwise unwritable; embark reports why and
	// writes no block (non-fatal to the record writes).
	MarkerActionSkip MarkerAction = "skip"
)

type MarkerResult

type MarkerResult struct {
	Target  string       `json:"target"`  // "AGENTS.md", or "" when no file was chosen
	Action  MarkerAction `json:"action"`  // probe: predicted; from: performed
	Changed bool         `json:"changed"` // probe: would change; from: did change
	Note    string       `json:"note,omitempty"`
}

MarkerResult reports the marker disposition for the target's conventions file. Target names the file chosen ("AGENTS.md"), and is empty when none was chosen, which always comes with MarkerActionSkip and a Note saying why.

type Omission

type Omission struct {
	Path   string `json:"path"`
	Reason string `json:"reason"`
}

Omission records a file that belonged in the lifeboat but was left out, and why. A lifeboat that silently drops a record is worse than one that declares the gap: the coverage experiment is about honesty, so every skipped record (too large to read, unreadable, or dropped because the plan hit its size cap) is named here rather than vanishing.

type PackResult

type PackResult struct {
	Dest           string     `json:"dest"`
	SourceName     string     `json:"source_name"`
	ManifestSHA256 string     `json:"manifest_sha256"`
	FilesWritten   int        `json:"files_written"`
	BytesWritten   int        `json:"bytes_written"`
	Omissions      []Omission `json:"omissions,omitempty"`
	VoyageAppended bool       `json:"voyage_appended"`
	VoyageNote     string     `json:"voyage_note,omitempty"`
}

PackResult reports what a pack wrote.

func Pack

func Pack(repoRoot, dest string, scan SecretScan, opts ...ProbeOption) (PackResult, error)

Pack plans a lifeboat for repoRoot and writes it to dest. It never writes to the source (Plan reads read-only). dest must pass the destination safety gate. Planned bytes are secret-scanned before any write; a hard-fail refuses the whole pack. Files are written into a staging directory and renamed into place, so a crash leaves staging, never a half-lifeboat, and _provenance.json is written last — it is the commit marker and the gate key for a later re-pack.

func (PackResult) Render

func (r PackResult) Render() string

Render is the human-readable pack summary.

type PassBExemption added in v0.6.8

type PassBExemption struct {
	Reason string `json:"reason"`
}

PassBExemption is the lifeboat's declaration that Pass B did not run for it.

Pass B is the pass that mines chat transcripts for the rationale nobody wrote down. The roadmap promises it "ships as a declared exemption in _provenance.json" (phase-6-lifeboat.md), never a silent gap — and until it had this field the promise had no implementing code, so a section Pass B would have grounded arrived as a blank indistinguishable from one nothing could ever ground. The declaration carries its reason rather than being a bare flag, because what the roadmap promised is a DECLARED exemption: a reader of the artefact has to be able to see why the pass is absent.

type PlanManifest

type PlanManifest struct {
	SchemaVersion  int           `json:"schema_version"`
	SourceName     string        `json:"source_name"`
	ManifestSHA256 string        `json:"manifest_sha256"`
	FileCount      int           `json:"file_count"`
	TotalBytes     int           `json:"total_bytes"`
	Files          []PlannedFile `json:"files"`
	Omissions      []Omission    `json:"omissions,omitempty"`
}

PlanManifest is the dry-run view of a Lifeboat: what `disembark plan` would write, by path and size, plus the pinned manifest hash and any omitted records — never the content. It is what a human (or a machine) reads to see the shape of a pack before any pack happens.

type PlannedEmbark

type PlannedEmbark struct {
	LifeboatPath string       `json:"lifeboat_path"`
	TargetPath   string       `json:"target_path"`
	Family       string       `json:"family"`
	Bytes        int          `json:"bytes"`
	Action       EmbarkAction `json:"action"`
	Content      []byte       `json:"-"`
}

PlannedEmbark is one lifeboat file embark maps to a target write. Content is carried for the write path but omitted from JSON (mirrors PlannedFile), so a probe render reports size, not bytes.

type PlannedFile

type PlannedFile struct {
	Path    string `json:"path"`
	Content []byte `json:"-"`
	// Bytes is the content length, carried so a dry-run render (and the JSON
	// form of a plan) can report size without echoing the content.
	Bytes int `json:"bytes"`
}

PlannedFile is one file the packer would write into a lifeboat, produced without touching disk. Path is destination-relative, POSIX-separated, cleaned, with no leading slash and no ".." — it is safe to join under a destination root. Content is the exact bytes that would be written.

type PressReleaseFile

type PressReleaseFile struct {
	SchemaVersion int                 `json:"schema_version"`
	Mode          SynthesisMode       `json:"mode"`
	PromptVersion string              `json:"prompt_version,omitempty"`
	Headline      string              `json:"headline"`
	Subhead       string              `json:"subhead,omitempty"`
	Body          string              `json:"body"`
	Quotes        []PressReleaseQuote `json:"quotes,omitempty"`
	Evidence      []string            `json:"evidence"`
}

PressReleaseFile is the on-disk shape of press-release.json. PromptVersion is omitted in deterministic mode.

type PressReleasePlan added in v0.16.1

type PressReleasePlan struct {
	Result PressReleaseResult
	SynthPlan
}

PressReleasePlan is what ComposePressRelease would do: the result it would report and the two files it would write.

func PlanPressRelease added in v0.16.1

func PlanPressRelease(lifeboatDir string, raw []byte, scan SecretScan) (PressReleasePlan, error)

PlanPressRelease does everything ComposePressRelease does before its write: the gate, the packed-path set, either mode's composition or validation (the whole-document refusal included), and the secret scan. Nothing is written.

func (PressReleasePlan) Apply added in v0.16.1

Apply writes the planned press-release.json and press-release.md.

type PressReleaseQuote

type PressReleaseQuote struct {
	Attribution string `json:"attribution"`
	Text        string `json:"text"`
}

PressReleaseQuote is one attributed pull-quote. Both fields are sanitised.

type PressReleaseResult

type PressReleaseResult struct {
	LifeboatDir      string        `json:"lifeboat_dir"`
	Mode             SynthesisMode `json:"mode"`
	EvidenceRefs     int           `json:"evidence_refs"`
	PressReleasePath string        `json:"press_release_path,omitempty"`
	RenderPath       string        `json:"render_path,omitempty"`
}

PressReleaseResult is the transport-agnostic outcome of `disembark press-release`.

func ComposePressRelease

func ComposePressRelease(lifeboatDir string, raw []byte, scan SecretScan) (PressReleaseResult, error)

ComposePressRelease builds or ingests press-release.json (+ press-release.md) for a packed lifeboat. raw == nil composes deterministically; raw != nil validates the untrusted delegated document. It is transport-agnostic. The deterministic file is always written; the delegated document is written whole or refused whole (ErrPressReleaseUncited), never partially. Both files are secret-scanned before either is written, as pack's planned bytes are; a non-nil error from scan refuses the whole call, and a nil scan fails closed.

It is PlanPressRelease followed by the plan's Apply, so a practice run (`--dry-run`) and the real write share every check.

func (PressReleaseResult) Render

func (r PressReleaseResult) Render() string

Render is the deterministic, sanitised human summary of a press-release run.

type Principle

type Principle struct {
	ID         string     `json:"id"`
	Principle  string     `json:"principle"`
	Confidence Confidence `json:"confidence"`
	ClaimType  *string    `json:"claim_type"`
	Reference  *string    `json:"reference"`
	Comparison *string    `json:"comparison"`
	Evidence   []string   `json:"evidence"`
}

Principle is one distilled principle — both the untrusted delegated input shape and the written output shape. Principle (the prose) is sanitised and marker-neutralised before it is written into the lifeboat.

The three claim keys beside Evidence are the record's principle keys (adr-2609021016270132): claim_type (criterion, causal or context), reference (the entity the principle is about) and comparison (what was compared to produce it). They are pointers so a declined claim is carried as a JSON null rather than omitted, and they are never omitempty: an absent key and a null one are different claims, and the validator reads the payload raw to tell them apart.

type PrincipleDrop

type PrincipleDrop struct {
	ID     string `json:"id"`
	Reason string `json:"reason"`
}

PrincipleDrop records one delegated principle the validator refused to write, and why. A drop is reported, never fatal.

type PrinciplesFile

type PrinciplesFile struct {
	SchemaVersion int           `json:"schema_version"`
	Mode          SynthesisMode `json:"mode"`
	PromptVersion string        `json:"prompt_version,omitempty"`
	Principles    []Principle   `json:"principles"`
}

PrinciplesFile is the on-disk shape of principles.json. PromptVersion is omitted in deterministic mode.

type PrinciplesPlan added in v0.16.1

type PrinciplesPlan struct {
	Result PrinciplesResult
	SynthPlan
}

PrinciplesPlan is what SynthesizePrinciples would do: the result it would report and the two files it would write.

func PlanPrinciples added in v0.16.1

func PlanPrinciples(lifeboatDir string, raw []byte, scan SecretScan) (PrinciplesPlan, error)

PlanPrinciples does everything SynthesizePrinciples does before its write: the gate, either mode's synthesis or validation, the composition of both files, and the secret scan over them. Nothing is written.

func (PrinciplesPlan) Apply added in v0.16.1

func (p PrinciplesPlan) Apply() (PrinciplesResult, error)

Apply writes the planned principles.json and principles.md.

type PrinciplesResult

type PrinciplesResult struct {
	LifeboatDir    string          `json:"lifeboat_dir"`
	Mode           SynthesisMode   `json:"mode"`
	Written        int             `json:"written"`
	Dropped        int             `json:"dropped"`
	Drops          []PrincipleDrop `json:"drops,omitempty"`
	PrinciplesPath string          `json:"principles_path,omitempty"`
	RenderPath     string          `json:"render_path,omitempty"`
}

PrinciplesResult is the transport-agnostic outcome of `disembark principles`.

func SynthesizePrinciples

func SynthesizePrinciples(lifeboatDir string, raw []byte, scan SecretScan) (PrinciplesResult, error)

SynthesizePrinciples builds or ingests principles.json (+ principles.md) for a packed lifeboat. raw == nil selects the deterministic evidence-only fallback; raw != nil validates the untrusted delegated payload. It is transport-agnostic: it returns a PrinciplesResult and never prints. Structural faults fail closed (an error, nothing written); per-entry faults drop that entry (recorded), never the batch. The file is always written on success — an all-drop ingest writes "principles": [] and reports the drops, exit 0. Both files are secret-scanned before either is written, as pack's planned bytes are; a non-nil error from scan refuses the whole call, and a nil scan fails closed.

It is PlanPrinciples followed by the plan's Apply, so a practice run (`--dry-run`) and the real write share every check.

func (PrinciplesResult) Render

func (r PrinciplesResult) Render() string

Render is the deterministic, sanitised human summary of a principles run.

type ProbeOption added in v0.6.7

type ProbeOption func(*SourceContext)

ProbeOption adjusts one probe run. Options are variadic so the default stays the safe one and every widening is written at the call site.

func IncludeIgnored added in v0.6.7

func IncludeIgnored() ProbeOption

IncludeIgnored widens the walk to files git ignores. Off by default: a file a user told git to ignore is out of scope until they say otherwise, and a packed lifeboat cites evidence by path:line. Pass it for the salvage case — a dead or archived repository whose uncommitted residue is the point.

type Provenance

type Provenance struct {
	SchemaVersion  int    `json:"schema_version"`
	Generator      string `json:"generator"`
	SourceName     string `json:"source_name"`
	SourceRootSHA  string `json:"source_root_sha,omitempty"`
	TiersPresent   []Tier `json:"tiers_present"`
	ManifestSHA256 string `json:"manifest_sha256"`
	// recordManifestSHA256 is the pinned hash over ONLY the record-derived
	// families (docs/adrs/**, activity/issues/**, rescue/intents/**,
	// rescue/specs/**, graveyard/abandoned.json) — the P1 closure seal. It is
	// byte-identical across pack -> embark -> re-pack of the same records, and is
	// recorded here so embark can surface it and a re-pack can be compared without
	// re-deriving the families. It carries no timestamp, so a re-plan stays stable.
	RecordManifestSHA256 string     `json:"record_manifest_sha256,omitempty"`
	Omissions            []Omission `json:"omissions,omitempty"`
	// PassBExemption declares that the transcript pass did not contribute to this
	// package. Nil means it did, or that the package predates the field: an
	// unmarked record marshals exactly as it always has, which is why the field
	// is an omitempty pointer rather than a bool.
	PassBExemption *PassBExemption `json:"pass_b_exemption,omitempty"`
}

Provenance is the lifeboat's manifest header: what produced it, from what source, the pinned hash over every other file, and any records left out. It deliberately carries no timestamp, so a re-plan of an unchanged source is byte-identical and the hash is stable.

type RepoInfo

type RepoInfo struct {
	Name    string `json:"name"`
	RootSHA string `json:"root_sha,omitempty"`
	Commits int    `json:"commits"`
}

RepoInfo identifies the probed repository.

type Resolution

type Resolution string

Resolution is the fill state of a blank as it travels with the lifeboat.

const (
	// ResolutionOpen is a blank that has not been answered yet — the default the
	// probe stamps on every blank.
	ResolutionOpen Resolution = "open"
	// ResolutionAnswered is a blank a human has answered; Answer is set.
	ResolutionAnswered Resolution = "answered"
	// ResolutionDeferred is a blank a human chose not to answer now; it
	// re-surfaces at embark rather than being dropped.
	ResolutionDeferred Resolution = "deferred"
)

type ReviewArtefact

type ReviewArtefact struct {
	SchemaVersion    int             `json:"schema_version"`
	Mode             SynthesisMode   `json:"mode"`
	PromptVersion    string          `json:"prompt_version,omitempty"`
	Verdict          ReviewVerdict   `json:"verdict"`
	SourceName       string          `json:"source_name"`
	ManifestSHA256   string          `json:"manifest_sha256"`
	ManifestVerified bool            `json:"manifest_verified"`
	Coverage         Summary         `json:"coverage"`
	Findings         []ReviewFinding `json:"findings"`
}

ReviewArtefact is the on-disk shape of review/review-<manifest12>.json. PromptVersion is omitted in deterministic mode. ManifestVerified is the verifyManifest outcome — a false value is a MAJOR_RETHINK verdict input, NOT a fatal error.

type ReviewFinding

type ReviewFinding struct {
	ID       string   `json:"id"`
	Severity string   `json:"severity,omitempty"`
	Finding  string   `json:"finding"`
	Evidence []string `json:"evidence"`
}

ReviewFinding is one audit finding. Finding (the prose) is sanitised; Evidence must cite packed lifeboat paths. Severity is optional, sanitised free text (no closed enum in M6).

type ReviewFindingDrop

type ReviewFindingDrop struct {
	ID     string `json:"id"`
	Reason string `json:"reason"`
}

ReviewFindingDrop records one delegated finding the validator refused to write.

type ReviewPlan added in v0.16.1

type ReviewPlan struct {
	Result ReviewResult
	SynthPlan
}

ReviewPlan is what ReviewLifeboat would do: the result it would report, the review pair it would write, and the legacy pair it would remove.

func PlanReview added in v0.16.1

func PlanReview(lifeboatDir, sourceRepo string, raw []byte, scan SecretScan) (ReviewPlan, error)

PlanReview does everything ReviewLifeboat does before its write: both gates, the manifest attestation, either mode's verdict, the composition of the pair, and the secret scan. Nothing is written or removed.

func (ReviewPlan) Apply added in v0.16.1

func (p ReviewPlan) Apply() (ReviewResult, error)

Apply writes the planned review pair and removes this manifest's legacy one.

type ReviewResult

type ReviewResult struct {
	LifeboatDir string              `json:"lifeboat_dir"`
	Mode        SynthesisMode       `json:"mode"`
	Verdict     ReviewVerdict       `json:"verdict"`
	Written     int                 `json:"written"`
	Dropped     int                 `json:"dropped"`
	Drops       []ReviewFindingDrop `json:"drops,omitempty"`
	ReviewPath  string              `json:"review_path,omitempty"`
	RenderPath  string              `json:"render_path,omitempty"`
}

ReviewResult is the transport-agnostic outcome of `disembark review`.

func ReviewLifeboat

func ReviewLifeboat(lifeboatDir, sourceRepo string, raw []byte, scan SecretScan) (ReviewResult, error)

ReviewLifeboat audits the packed lifeboat at lifeboatDir against sourceRepo. When raw is nil it runs the deterministic mapping; when raw carries a payload it validates the delegated audit. It is transport-agnostic (returns an ReviewResult, never prints) and fails closed on structural problems; a manifest failure is a verdict input, not an error. The audit is ALWAYS written on success. Both audit files are secret-scanned before either is written, as pack's planned bytes are; a non-nil error from scan refuses the whole call (nothing written, nothing removed), and a nil scan fails closed.

It is PlanReview followed by the plan's Apply, so a practice run (`--dry-run`) and the real write share every check.

func (ReviewResult) Render

func (r ReviewResult) Render() string

Render is the deterministic, sanitised human summary of an audit (the transport render; the surface prints it).

type ReviewVerdict

type ReviewVerdict string

ReviewVerdict is a lifeboat-reviewer review verdict.

const (
	// VerdictShip: the lifeboat is a faithful, shippable proxy of the record.
	VerdictShip ReviewVerdict = "SHIP"
	// VerdictNeedsWork: shippable but with named, addressable gaps.
	VerdictNeedsWork ReviewVerdict = "NEEDS_WORK"
	// VerdictMajorRethink: the lifeboat does not faithfully carry the record.
	VerdictMajorRethink ReviewVerdict = "MAJOR_RETHINK"
)

func (ReviewVerdict) Valid

func (v ReviewVerdict) Valid() bool

Valid reports whether v is a registered review verdict.

type SecretScan

type SecretScan func(files []PlannedFile) error

SecretScan inspects the fully-planned bytes and returns a non-nil error if any file carries a hard-fail secret, or the scanner is unavailable. Pack refuses to write when it returns an error: a secret in a source file is a bug to fix at source, never something to redact into the artefact. It is injected so the lifeboat core stays free of the scanner adapter.

type Section

type Section string

Section is a brief section, named as it appears in the coverage report.

func (Section) Kind

func (s Section) Kind() Kind

Kind reports whether the section is extractable or human-owned.

type SectionCoverage

type SectionCoverage struct {
	Name       Section    `json:"name"`
	Kind       Kind       `json:"kind"`
	Status     Status     `json:"status"`
	Confidence Confidence `json:"confidence,omitempty"`
	Tier       Tier       `json:"tier,omitempty"`
	Evidence   []string   `json:"evidence,omitempty"`
	Searched   []string   `json:"searched,omitempty"`
	Question   string     `json:"question,omitempty"`
	// Reason says why a partial row is partial: what the probe found and what
	// would ground the section. It is set on every partial and on nothing else;
	// omitempty keeps a grounded or blank row byte-identical, so no schema bump
	// is owed.
	Reason string `json:"reason,omitempty"`
	// Resolution tracks a blank's fill state across the round-trip. It is
	// meaningful only for a blank; a grounded/partial section leaves it empty.
	Resolution Resolution `json:"resolution,omitempty"`
	// Answer is present only once a human has answered the blank. Its provenance
	// is authored-by, structurally distinct from an extracted citation.
	Answer *Answer `json:"answer,omitempty"`
}

SectionCoverage is the probe result for one brief section, and — from schema v2 (adr-36) — a fillable object across the disembark→embark round-trip. A grounded or partial row cites evidence; a blank row carries what was searched, the question a human must answer, its Kind (extractable coverage debt vs a human-owned prompt), a Resolution that tracks whether it has been answered or deferred, and, once answered, an authored Answer whose provenance is a person and a date — never a file it did not come from.

type SectionVerdict

type SectionVerdict struct {
	Section       Section `json:"section"`
	GroundedCount int     `json:"grounded_count"`
	PartialCount  int     `json:"partial_count"`
	BlankCount    int     `json:"blank_count"`
	// AlwaysBlank is true when no probed repo grounded or partially grounded the
	// section — evidence the section may not be derivable from a repository at
	// all, and belongs to a human rather than an extraction.
	AlwaysBlank bool `json:"always_blank"`
}

SectionVerdict summarises a section across the corpus: how the record-rich repos fared versus the record-poor ones. It is the quantified answer to "what is the record worth" for that section.

type Signal

type Signal string

Signal names the specific graveyard signal one Finding reports. It is the discriminator layer 3 (and the human renderer) reads to group findings, and its fixed ordering (signalRank) gives both graveyard files a deterministic, byte-stable layout across re-plans of an unchanged repo.

const (

	// SignalRevert is a commit that reverts an earlier one (a deliberate,
	// explicit abandonment written into history).
	SignalRevert Signal = "revert"
	// SignalUnmergedBranch is a local branch never merged into the default
	// branch, ranked by how long ago it diverged.
	SignalUnmergedBranch Signal = "unmerged-branch"
	// SignalDeletedPath is a path deleted after substantial history — sustained
	// investment abandoned, not a scratch file swept.
	SignalDeletedPath Signal = "deleted-path"
	// SignalRemovedDependency is a dependency (or a whole manifest) present in
	// history but absent at HEAD — a dependency adopted then dropped.
	SignalRemovedDependency Signal = "removed-dependency"
	// SignalWholesaleRewrite is a single commit that replaces a large fraction of
	// the tree — a restructure/rewrite rather than incremental work.
	SignalWholesaleRewrite Signal = "wholesale-rewrite"

	// SignalSupersededIntent is an intent in the superseded/ bucket.
	SignalSupersededIntent Signal = "superseded-intent"
	// SignalSupersededADR is an ADR whose status is superseded (or whose
	// superseded_by is non-null).
	SignalSupersededADR Signal = "superseded-adr"
	// SignalAlternativesConsidered is an ADR's "Alternatives Considered" section —
	// options the decision weighed and rejected.
	SignalAlternativesConsidered Signal = "alternatives-considered"
	// SignalWontfixIssue is an issue moved to the wontfix/ ledger bucket.
	SignalWontfixIssue Signal = "wontfix-issue"
	// SignalRejectedOption is a decision record, or a frozen decision log's
	// line, naming a rejected option.
	SignalRejectedOption Signal = "rejected-option"
)

type Source

type Source interface {
	Section() Section
	Tier() Tier
	Probe(*SourceContext) Evidence
}

Source is one tiered adapter: it reads a single brief section at a single tier and reports what it found. Probe must be side-effect-free and must never write to the source repository — a probe is read-only by construction.

(M3 adds a Plan method to this interface so that pack is "plan plus a write" over the same adapters; probe needs only Probe.)

type SourceContext

type SourceContext struct {
	RepoRoot string
	// contains filtered or unexported fields
}

SourceContext is the read-only material every Source probes. It is built once per repository and shared across all adapters, so git history is queried and files are read through a single contained, cached surface. Every read is contained to the repository root via os.Root (no symlinked component can redirect a read outside the repo) and bounded in size, so probing a hostile or archived tree cannot escape it, hang on a FIFO, or exhaust memory.

func (*SourceContext) Close

func (c *SourceContext) Close()

Close releases the containment handle.

func (*SourceContext) CommitCount

func (c *SourceContext) CommitCount() int

CommitCount is the number of commits reachable from HEAD, or 0 outside a repo.

func (*SourceContext) Exists

func (c *SourceContext) Exists(rel string) bool

Exists reports whether a repo-relative path exists (of any kind) within the containment root.

func (*SourceContext) FindFirst

func (c *SourceContext) FindFirst(candidates ...string) string

FindFirst returns the first candidate that exists (case-sensitive, as given), or "" if none do. Adapters pass the conventional spellings they care about (e.g. "README.md", "README", "readme.md").

func (*SourceContext) Git

func (c *SourceContext) Git(args ...string) (string, error)

Git runs a read-only git subcommand under the repo, isolated from the developer's git config, and caches the result so repeated identical queries across adapters cost one exec. Outside a git repo it returns an error.

func (*SourceContext) GitLines

func (c *SourceContext) GitLines(args ...string) []string

GitLines runs a git subcommand and splits stdout into non-empty lines.

func (*SourceContext) IgnoredAreIncluded added in v0.6.7

func (c *SourceContext) IgnoredAreIncluded() bool

IgnoredAreIncluded reports whether this walk reads files git ignores. Adapters use it to SAY which scan ran, so a reader of a packed lifeboat can tell whether an absent citation means "nothing there" or "not looked at".

func (*SourceContext) IsDir

func (c *SourceContext) IsDir(rel string) bool

IsDir reports whether a repo-relative path is a directory within the root.

func (*SourceContext) IsGit

func (c *SourceContext) IsGit() bool

IsGit reports whether the source is a git working tree.

func (*SourceContext) ListDir

func (c *SourceContext) ListDir(rel string) []string

ListDir returns the names (not paths) of entries directly under a repo-relative directory, sorted. It never recurses and never escapes the root. The open is non-blocking (matching ReadFile): a probed tree is untrusted, so a FIFO planted where a directory is expected must return promptly instead of blocking open().

func (*SourceContext) ReadFile

func (c *SourceContext) ReadFile(rel string) ([]byte, bool)

ReadFile reads a repo-relative file through the containment root, bounded and non-blocking. It returns (data, true) only for a regular file within the cap; a missing file, a directory, a FIFO/device, an escaping path, or an oversized file returns (nil, false) — never an error and never a blocked read.

func (*SourceContext) RootSHA

func (c *SourceContext) RootSHA() string

RootSHA is the canonical root-commit SHA, or "" outside a git repo.

func (*SourceContext) WalkFiles

func (c *SourceContext) WalkFiles(rel string) (paths []string, truncated walkTruncation)

WalkFiles returns the repo-relative POSIX paths of every regular file beneath a repo-relative directory, sorted, and reports whether the walk stopped at any of its bounds — the file cap, the directory cap, the depth cap, or a single directory exceeding the per-directory read bound. It is the recursive counterpart of ListDir, for adapters whose evidence is the shape of the tree rather than a known filename. Content is still read through ReadFile, so the walk adds no second read path.

It is contained by the same os.Root as every other read, descending through a sub-root per directory so each child opens in O(1) while the containment property holds; it skips the walkSkipDirs trees, and skips non-regular files (FIFOs, devices, sockets) so no path it yields can block on open. Symlinks — file or directory — are SKIPPED and the walk continues. This deliberately differs from embark's walkLifeboatFiles, where a symlink is a trust violation in a packed lifeboat and therefore fatal: a probe reads an arbitrary foreign tree in which a symlink is ordinary, so refusing to follow one is enough, and erroring on one would blank a whole section over a repository's normal furniture.

A start below the root yields exactly what the whole-tree walk yields beneath it: a skip-set or symlinked start (or one beneath either) yields nothing, and a regular-file start yields that file (see walkStart).

type Status

type Status string

Status is the three-valued coverage result for one brief section. A blank is a first-class result — it names a question a human must answer — not a failure of the probe.

const (
	// StatusBlank means nothing in the repository grounds the section.
	StatusBlank Status = "blank"
	// StatusPartial means the section can be started but not completed from
	// this tier; some claims would have no source to cite.
	StatusPartial Status = "partial"
	// StatusGrounded means every claim in the section can cite a source file.
	StatusGrounded Status = "grounded"
)

func (Status) Valid

func (s Status) Valid() bool

Valid reports whether s is a member of the status enum.

type Summary

type Summary struct {
	Grounded int `json:"grounded"`
	Partial  int `json:"partial"`
	Blank    int `json:"blank"`
}

Summary counts sections by status. Blank is counted, not hidden — a blank is a result.

type SynthPlan added in v0.16.1

type SynthPlan struct {
	// Plan is the practice run's report.
	Plan dryrun.Plan
	// contains filtered or unexported fields
}

SynthPlan is what a post-pack verb would do to a packed lifeboat: the files it would write, each path relative to the lifeboat, and the files it would remove, reported as effects (`remove`, path). Apply lays it.

type SynthesisMode

type SynthesisMode string

SynthesisMode records how a synthesis artifact was produced.

const (
	// ModeDeterministic: built by the Go core from the packed lifeboat's own files,
	// no model in the loop. prompt_version is omitted.
	ModeDeterministic SynthesisMode = "deterministic"
	// ModeDelegated: validated host-delegated model output. prompt_version records
	// the agent prompt's semver.
	ModeDelegated SynthesisMode = "delegated"
)

type Tier

type Tier string

Tier names a class of source material, ordered by how much a repository has to have done deliberately for the tier to exist at all. Adapters degrade: a section is filled by the richest tier present, falling back to poorer ones.

Tiers are CUMULATIVE. A repository that has conventions still has git, so the status quoted at a tier is what is achievable using that tier and every poorer one together. This is why a richer tier can never ground a section worse than a poorer one, and why a test enforces exactly that.

const (
	// TierGit reads commit history, authors, branches, reverts, file lifespans,
	// tags, and dependency churn. Present in every git repository.
	TierGit Tier = "git"
	// TierConventions reads README, docs/, CHANGELOG, LICENSE, CONTRIBUTING,
	// issue exports, and ADRs wherever they happen to live. Present in most.
	TierConventions Tier = "conventions"
	// TierNative reads .abcd/ — decisions, intents, specs, brief, roadmap,
	// issues, reviews, memory. Present only in a repository abcd manages.
	TierNative Tier = "abcd-native"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL