Expand description
What a compiled development context is made of.
Every type here is a value, not a rendering. A ContextEntry carries the canonical
identifier of the thing it selects, where that thing came from, which selector reached
it and why, how confident the compiler is, how much of the budget it costs — and never
the prose. The prose belongs to the object, which objects.get serves whole; copying it
here would put the layer in the answer twice and would flatten the structure into text
before anything has decided what to keep.
use majordomus_cli::devcontext::{Selector, Tier};
// the tiers are a total order, and the order is the budget's order
assert!(Tier::Task < Tier::Governance);
assert!(Tier::Governance < Tier::History);
// a selector says whether what it produced was declared or inferred
assert!(Selector::Relation.declared());
assert!(!Selector::IntentMatch.declared());Structs§
- Budget
- The budget, and what became of it.
- Commit
Reference - One commit the layer itself names, and the record that named it.
- Compiled
Context - A compiled development context: what to give a session, what was left out, what collapsed into what, and the budget it was all decided under.
- Conflict
- Two things in the answer that do not agree, named rather than silently ordered.
- Context
Entry - One thing the compiler decided a session should be given: what it is, how it was reached, what it costs, and how far the compiler trusts it.
- Deduplicated
- Two names, one thing. The compiler keeps one entry and records the collapse here, so that “why is this ADR listed once when four things point at it” has an answer that is state rather than a log line.
- Discovery
- One way an entry was reached: which selector, why, how far from a seed, and how much the compiler trusts it. An entry keeps every one of these, because “five discovery paths found the same ADR” is the interesting fact, not a thing to hide.
- Entry
Provenance - Where the selected thing lives, as the index knows it. Nothing here is authored: every
field is the index’s own
crate::model::Provenance, carried rather than restated. - Excluded
- One thing the compiler reached and did not give. Excluded is not the same as absent: an under-filled context is debugged from this list, not by guessing.
- GitContext
- The head this answer was compiled against. A compiled context is only true of one tree, and these three fields plus the index fingerprint are what say which.
- Seed
- What the request asked to compile a context about.
- Tier
Spend - What one tier cost, how much of it survived, and how much of that could not have been dropped.
Enums§
- Exclusion
Reason - Why something the compiler selected did not survive.
- Selector
- What reached an entry. This is the provenance of the selection, and it is a different
fact from the provenance of the file:
Relationsays the compiler followed an edge the layer declares,IntentMatchsays it guessed from words. An answer that did not keep them apart could not say which half of itself to trust. - Tier
- Where an entry sits in the order the budget spends in.
Constants§
- BYTES_
PER_ TOKEN - Bytes of a file per estimated token. Four is the working figure for English prose and for the YAML and Markdown this layer is made of; the answer says which divisor it used so that a caller measuring differently can convert rather than guess.
- DEFAULT_
BUDGET_ TOKENS - The default ceiling, in estimated tokens.
- DEFAULT_
MAX_ DEPTH - The furthest the compiler walks from a seed unless the request says otherwise.
Functions§
- tokens_
for - Estimated tokens for a file of this many bytes: never fewer than one, so that an entry always costs something.