Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

requirements.cli.distributed_guidance.bootstrap

Requirements index · View definition

evidence Valid

Requirement

The habeas-bootstrap-requirements skill MUST direct agents to propose a distributed requirement for a cross-cutting convention instead of marking each of its sites with {impl}.

Rationale

Obligation. requirements.cli.distributed_guidance.bootstrap has one MUST. The habeas-bootstrap-requirements skill must direct agents to propose a distributed requirement for a cross-cutting convention, rather than marking each site {impl}.

Test. tests/authoring_cli.rs#fn[bootstrap_skill_proposes_distributed_requirements_for_conventions] is marked {test} for the requirement. It does the following:

  • It loads the bundled habeas-bootstrap-requirements skill’s raw SKILL.md with skill_md.
  • It extracts the ## Proposing requirements section with section. The helper collapses whitespace and stops at the next heading of the same or a higher level, outside code fences.
  • It asserts with assert_text that the section contains “propose a distributed requirement instead of marking each site {impl}”.

Fit with the skill text. The ## Proposing requirements section of assets/skills/habeas-bootstrap-requirements/SKILL.md contains this directive. It reads: “When a convention applies on its own at many sites, such as how every validation function continues after a failed check, propose a distributed requirement instead of marking each site {impl}; read the habeas skill’s references/distributed-requirements.md.” The phrase is split across a line break in the source. The collapsed section text from section makes it match, so the assertion is sound.

Assessment.

  • The assertion pins the directive to the section where an agent proposes requirements. It fails if the directive is removed, reworded, or moved out of that section.
  • The test does not assert the “when a convention applies on its own at many sites” lead-in. The lead-in is only the condition for the directive. The requirement text itself is the directive, and the asserted phrase carries both the action and the contrast with {impl} marking. I don’t count this as a gap.
  • The requirement is a documentation obligation, and it has no input classes, modes, or failure cases beyond the presence of this guidance. No other obligations are delegated to refining requirements. No exemptions are needed.
  • No {fixme} acknowledgments apply.

The test adequately checks the requirement.

Inputs

Implementation

Input 6: outline assets/skills/habeas-bootstrap-requirements/SKILL.md section[Bootstrap%20requirements]/section[Proposing%20requirements]
## Proposing requirements

Write one requirement per obligation a user could rely on; the
habeas-requirements review (step 3) splits compound ones. For tests of internal
invariants, write a requirement for the invariant they check rather than
inventing a user-facing promise. Label each proposal and act on the label:

- **Intended:** state the observed behavior.
- **Possible bug:** ask the user what behavior is intended and write the
  requirement for that. Don't change the code during bootstrap unless the user
  asks; the resulting false judgment stays on the gap list, or gets a
  `{fixme}` reference if the user defers it (the habeas-evidence skill's
  `references/fixme.md`).
- **Incidental:** the user chooses between a requirement, often with MAY, and
  removing the behavior. For example, a command that also accepts an
  undocumented alias.

When a convention applies on its own at many sites, such as how every
validation function continues after a failed check, propose a distributed
requirement instead of marking each site `{impl}`; read the habeas skill's
`references/distributed-requirements.md`.

Tests

Input 2: outline tests/authoring_cli.rs fn[bootstrap_skill_proposes_distributed_requirements_for_conventions]
// {test}`requirements.cli.distributed_guidance.bootstrap`
#[test]
fn bootstrap_skill_proposes_distributed_requirements_for_conventions() {
    assert_text(
        "proposing requirements",
        &section(
            skill_md("habeas-bootstrap-requirements"),
            "## Proposing requirements",
        ),
        &["propose a distributed requirement instead of marking each site `{impl}`"],
    );
}

Other sources

Input 1: requirements selection requirements.cli.distributed_guidance.bootstrap
:::{req} distributed_guidance.bootstrap
The `habeas-bootstrap-requirements` skill MUST direct agents to propose a distributed requirement for a cross-cutting convention instead of marking each of its sites with `{impl}`.
:::
Input 3: outline tests/authoring_cli.rs fn[skill_md]
/// A bundled skill's raw `SKILL.md`.
// {cite}`habeas:util`
fn skill_md(name: &str) -> &'static str {
    skill_files(name)[0].1
}
Input 4: outline tests/authoring_cli.rs fn[section]
/// The collapsed body of a Markdown section, from the line after `heading` to
/// the next heading of the same or a higher level outside a code fence.
// {cite}`habeas:util`
fn section(raw: &str, heading: &str) -> String {
    let level = heading.chars().take_while(|c| *c == '#').count();
    let mut lines = raw.lines().skip_while(|line| *line != heading);
    assert!(lines.next().is_some(), "no section {heading:?}");
    let mut fence: Option<usize> = None;
    let mut body = Vec::new();
    for line in lines {
        let ticks = line.trim_start().chars().take_while(|c| *c == '`').count();
        match fence {
            Some(open) if ticks >= open && line.trim().chars().all(|c| c == '`') => fence = None,
            Some(_) => {}
            None if ticks >= 3 => fence = Some(ticks),
            None => {
                let hashes = line.chars().take_while(|c| *c == '#').count();
                if hashes > 0 && hashes <= level && line[hashes..].starts_with(' ') {
                    break;
                }
            }
        }
        body.push(line);
    }
    collapse(&body.join("\n"))
}
Input 5: outline tests/authoring_cli.rs fn[assert_text]
// {cite}`habeas:util`
fn assert_text(label: &str, text: &str, phrases: &[&str]) {
    for phrase in phrases {
        assert!(text.contains(phrase), "{label} lacks {phrase:?}");
    }
}