Skip to content

Hand the repository to someone who cannot clone it

Take a snapshot that a model can read or a gate can run in, without sending anything untracked and without losing the file modes on the way.

guaranteed Repository knowledgebasicmaintaineragentwrites state

Situation

The repository has to go somewhere it cannot be cloned: into a language model's context, to a reviewer on a locked-down machine, onto an air-gapped network, into an audit that must run the checks on a copy. Done by hand it is a git ls-files, a tar and a list of exclusions retyped from memory, and it goes wrong in two ways that only appear at the far end — where nobody can compare the copy with the original, and where both failures read as the repository being broken rather than the copy being wrong. Something untracked travels that should not have, or the file modes are gone and nothing in the tree will run.

What you run

  • archive --list: the profiles, each one a different reader and therefore a different snapshot
  • archive --dry-run: what would travel, with every file left out attributed to the rule that left it out
  • archive: the snapshot, verified through its own container before the command returns

Scenario

setup: installed
given:
  - 'a repository with the layer installed and its files committed'
steps:
  - id: profiles
    run: ['archive', '--list']
    note: 'the snapshots are declarations in share/archive.yaml, not flags'
    expect:
      exit: 0
      stdout_contains: ['context', 'audit', 'governance']
  - id: what-would-travel
    run: ['archive', '--dry-run']
    note: 'the count archived is stated beside the count tracked, so a selection that matched nothing cannot look like one that matched everything'
    expect:
      exit: 0
      stdout_contains: ['profile context', 'tracked file', 'nothing written']
  - id: written-and-read-back
    run: ['archive', '--format', 'tar.gz']
    note: 'the archive is opened again before the command returns'
    expect:
      exit: 0
      stdout_contains: ['OK   archive', 'read back']
  - id: no-such-profile
    run: ['archive', 'nosuch']
    note: 'exit 12 is MISSING_ARTIFACT, and the message names the command that lists what exists'
    expect:
      exit: 12
      stdout_contains: ['no profile', 'archive --list']
then:
  - 'nothing untracked is in the archive, because the file set is the git index'
  - 'every entry carries the mode the index records, and the archive says so in its own manifest'
  - 'the archive was read back before the command returned, and an unreadable one is a failure rather than a delivery'

Outcome

One gesture instead of a remembered incantation. What is left out is declared rather than retyped, and the declaration it reads for the generated files is .gitattributes, which the repository already maintains for another reason — so there is no second list to go stale. The copy arrives with its modes and can be made runnable with one script, which means a check that fails in it failed for a reason that belongs to the repository.

The scenario

Executed against the real tool, in a repository prepared by installed, every time this site is generated. What follows is not a description of what should happen; it is what happened.

given

  • a repository with the layer installed and its files committed

when

  1. 1majordomus archive --list
  2. 2majordomus archive --dry-run
  3. 3majordomus archive --format tar.gz
  4. 4majordomus archive nosuch

then

  • nothing untracked is in the archive, because the file set is the git index
  • every entry carries the mode the index records, and the archive says so in its own manifest
  • the archive was read back before the command returned, and an unreadable one is a failure rather than a delivery

What the tool did

Evidence of the run this page was generated from: pass, 4 step(s). Output is normalised: the repository's path, timestamps, ids and durations are placeholders; nothing else is edited.

Tested by test/cases/94_use_cases.sh, which runs every scenario and refuses a step whose recorded output is not what it produced.

  1. the snapshots are declarations in share/archive.yaml, not flags

    context      Context for a language model  (default)
                 Every tracked source, without the projections generated from it, under one orientation document.
    chatgpt      Sources for a ChatGPT project
                 Every tracked source as token-bounded Markdown shards a ChatGPT project's file search indexes, without binaries, worktrees, links, build output, projections or recorded measurements.
    audit        A faithful copy the gates can run in
                 Every tracked file, nothing dropped, with the modes and a local git index restored.
    governance   The operating contract alone
                 The AI layer, the documentation and the provider bootstraps, without any code.
    archive: 4 profile(s)
    • exit 0
    • stdout_contains /context/
    • stdout_contains /audit/
    • stdout_contains /governance/
  2. the count archived is stated beside the count tracked, so a selection that matched nothing cannot look like one that matched everything

    archive: profile context — 106 of 106 tracked file(s), 255 KB of content
             nothing written (--dry-run)
    • exit 0
    • stdout_contains /profile context/
    • stdout_contains /tracked file/
    • stdout_contains /nothing written/
  3. the archive is opened again before the command returns

    OK   archive     repo-context-<date>.tar.gz — 110 entr(ies) read back, 1 of them executable
    archive: profile context — 106 of 106 tracked file(s), 255 KB of content
             wrote tmp/archives/repo-context-<date>.tar.gz (<size> KB)
    • exit 0
    • stdout_contains /OK archive/
    • stdout_contains /read back/
  4. exit 12 is MISSING_ARTIFACT, and the message names the command that lists what exists

    majordomus: archive: no profile 'nosuch' (run: majordomus archive --list)
    • exit 12
    • stdout_contains /no profile/
    • stdout_contains /archive --list/

Why the tool knows this

The chain from this page to the code: the use case names commands, rules and claims; each rule is dispatched from the registry and each claim names the test that proves it; the scenario above executed the commands. Nothing in this chain is prose about intent.

Guarantees exercised

Related use cases

Computed from what they share: claims, rules, commands, category, applications. Nobody maintains this list.

Searches the titles and descriptions of every page this site publishes.