Expand description
The source pack: the tracked tree as a few text files a language model’s file search can index, with nothing in it that is not source.
majordomus archive (the shell tool) hands a reader a zip. A chat model’s project files
are indexed one text file at a time and a zip is not text, so a model that is given the
archive can unpack it in a sandbox but cannot search it. The pack is the same selection,
written as Markdown shards that each stay under a token budget, with an index that
orients the reader and a manifest that lets verify prove, afterwards, that what
leaves the machine is what was selected and nothing else.
§What is selected
The profiles are share/archive.yaml’s: one declaration of what a snapshot is for, read
by the shell’s archive and by this module alike. The file set is the git index and the
content is the index’s blobs, never the working tree, so an ignored file, a build output,
a cache and the local half of the AI layer cannot travel by construction. On top of that
a profile that sets artifacts: drop refuses, whatever the index holds:
- a gitlink (mode
160000): a nested repository or worktree whose content is not here; - a symbolic link (mode
120000): its content is a path on the machine that wrote it; - a path matching
artifact_paths(target/,node_modules/, a-wt/worktree container, minified bundles, …): build output that was committed by accident; - content that is not UTF-8 text or holds a NUL byte: a binary whatever its extension.
An include re-admits what exclude or derived: drop left out, never one of these:
a list that could re-admit a binary is a list that eventually will.
§What is refused
The plan is a verdict, not only a selection. A single file over the shard budget, more shards than the profile allows, a selected file that names this machine (the checkout’s own absolute path or the home directory of the account packing it), and an empty selection are findings, and a pack with a finding is not built.
The content is carried exactly as committed and never rewritten. A pack holds nothing
the tracked tree does not, and what the tree may hold is decided where it is committed
(scripts/ci/no-machine-paths, the publication checks). Credential shapes are therefore
not redacted here: measured on this repository, the published-text table matches sk-
inside ordinary words (task-in-progress-…), so redacting would hand the reader prose
that was never written, and a digest of content that was never committed. The one leak
that can arise at packing time and not at commit time is the machine doing the packing,
which is what is refused, with no false positive by construction.
use majordomus_cli::pack::{DropReason, fence_for};
assert_eq!(DropReason::Worktree.as_str(), "worktree");
// a fence is always longer than the longest run of backticks in what it holds
assert_eq!(fence_for("no ticks"), "```");
assert_eq!(fence_for("a ```` b"), "`````");Structs§
- Dropped
File - One dropped file the report names. Derived files are counted, not listed: they are a function of files that are in the pack.
- Pack
Finding - A reason the pack cannot be built as planned, or a written pack is not what its manifest says: a stable code, the path when there is one, and the remedy.
- Pack
Plan - The plan of one pack: what it carries, what it leaves out and why, how it is cut into shards, and whether it may be built.
- Pack
Profile - One profile of
share/archive.yaml, as far as the pack reads it: what it drops, what it re-admits, what the index says first and the limits it is cut into. - Pack
Verdict - The verdict on a written pack: whether it could be read, what its manifest names, how many files and sources it holds, and every finding against it.
- Planned
- A plan with the content it was made from, which is what
buildwrites: the verdict, the profile it was made with, and the selected blobs in shard order. - Profiles
- What the distribution declares once for every profile: the default, the binary extensions, the artifact paths, and the profiles themselves.
- Shard
Limits - The shard limits of a profile: the reader’s own limits on what it can index, the file count of a project and the tokens one file of it may hold.
- Shard
Plan - One planned shard: a Markdown file of the pack, the paths it carries from first to last, and what it weighs in bytes and in tokens.
Enums§
- Drop
Reason - Why a tracked file is not in the pack. Every reason but
derivedandexcludedis final: noincludeof a profile re-admits a link, a gitlink, an artifact or a binary.
Constants§
- INDEX
- The orientation document’s file name inside a pack; it is shard zero.
- MANIFEST
- The manifest’s file name inside a pack.
- MANIFEST_
SCHEMA - The schema word of a pack’s manifest.
- OVERLAY
- A repository’s own profiles, relative to its root. A profile declared there under an id the distribution ships replaces the shipped one whole, as the shell’s archive reads it; the default and the two lists are the distribution’s.
- PROFILES
- The profiles file of the tool distribution, relative to the share directory.
Functions§
- build
- Write a planned pack into
out, which must be absent, empty, or a pack this command wrote (it holds a manifest); then verify what was written. - fence_
for - The fence for a content: three backticks, or one more than its longest run of them, so that nothing the content holds can close the block that carries it.
- is_text
- Is this content text the pack can carry? UTF-8 and free of NUL bytes.
- plan
- Plan a pack of the repository at
rootwith a profile of the distribution atshare: the index’s blobs, selected by the profile, cut into shards and judged. Nothing is written; a tree or a profile that cannot be read is an unmeasured plan, never a pass. - verify
- Verify a written pack: every file the manifest names is there with its digest, nothing
else is, every block’s content has the digest its marker records, no carried path is a
binary, an artifact, a link or a worktree under the profile it names, no file of the
pack is over the token budget or holds a NUL byte or a leak, and the pack has no more
files than the profile allows.
rootis the checkout whose path, with the account’s home directory, no file may name. Rebuilding is never the remedy for a finding here: a pack that fails is not sent.