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.flip_guidance

Requirements index · View definition

evidence Valid

Requirement

The habeas-evidence skill MUST state the goal that independent assessments of the same subject reach the same determination, because the requirement, code, and tests leave no gap a careful reviewer could find and no reading a careful reviewer could take differently, and the other bundled skills MUST refer to it rather than restate it. The skills MUST tell agents that assessments of the same subject that disagree are findings against that goal. They MUST direct agents to read both rationales and decide whether one assessment found a real gap or the requirement text admits more than one reading, then fix the source or tests, or tighten the requirement text, rather than re-running an assessment to obtain a different determination. Every change to agreed requirement text, including a rewording for precision, MUST be reviewed with the user under cite requirements.cli.requirements_review_skill.agreed_text before it is committed, and the skills MUST then direct agents to give the reason, and the rationale that prompted the change, in the message of the commit that makes it. That message MUST describe the change relative to the prior commit, not the intermediate drafts that led to it.

Rationale

The single test tests/authoring_cli.rs#fn[bundled_skills_treat_disagreeing_assessments_as_findings] covers each obligation of requirements.cli.flip_guidance, and its assertions enforce them. I checked the helpers it uses: assert_text_in_order, assert_text, assert_phrases, section, bundled_skill and skill_md. section and bundled_skill collapse whitespace, so the phrase matches survive the line wrapping in the skill files. I also compared the asserted phrases with the actual assets/skills/habeas-evidence/SKILL.md, and they match.

Obligations and the assertions that cover them:

  • The evidence skill states the goal. The test asserts the full GOAL sentence, in order, at the start of the ## Disagreeing assessments section of habeas-evidence.
  • Disagreeing assessments are findings against that goal. The next ordered phrase is “Assessments that disagree are findings against that goal”.
  • Read both assessments and decide between a real gap and an ambiguous requirement. The ordered phrases “Read both assessments” and “Decide whether one found a real gap or the requirement text admits more than one reading” cover this. The wording says “assessments” where the requirement says “rationales”. The actual section text spells out reading the rationales, so this is not a gap.
  • Fix the source or tests, or tighten the requirement text, rather than re-running. The ordered phrase “Fix the source or tests, or tighten the requirement text through habeas-requirements steps 3 to 5…” is asserted. The ## Rules section is asserted to say “Never re-run an assessment to get a different result” and “Fix the source, tests, references, or requirement text instead”.
  • A change to agreed text, even a rewording, is reviewed with the user before the commit. The ## Rules section is asserted to say it “goes through habeas-requirements steps 3 to 5 (subagent review, the user’s agreement, commit) first”. Those steps are the review under the cited requirements.cli.requirements_review_skill.agreed_text. That requirement’s own obligations are not reassessed here.
  • The commit message gives the reason and the prompting rationale, relative to the prior commit. Both the Rules text (“Then give the reason, and the rationale that prompted it… relative to the prior commit rather than the drafts that led to it”) and the habeas-requirements pointer to it are asserted.
  • The other skills refer to the goal rather than restate it. Pointer phrases are asserted in habeas-requirements, habeas-bootstrap-requirements, the habeas Gotchas section and the last workflow step of habeas-refactor. A loop over all skills except habeas-evidence asserts that none contains the collapsed GOAL text. Because bundled_skill collapses whitespace, that negative check is meaningful.

I found no unconstrained scenario that would let behavior violating the requirement pass. No {fixme} acknowledgments apply.

Inputs

Implementation

Input 10: outline assets/skills/habeas-evidence/SKILL.md section[Habeas%20evidence]/section[Disagreeing%20assessments]
## Disagreeing assessments

The goal is that independent assessments of the same subject reach the same
determination, because the requirement, code, and tests leave no gap a careful
reviewer could find and no reading a careful reviewer could take differently.
Assessments that disagree are findings against that goal.

By default (`confirm` policy), `habeas author` checks each `true` or FIXME
result with a second assessment and a verifier, and notes any disagreement at
the end of the recorded rationale. A determination that changes on
reassessment, though the subject and sources have not changed in substance, is
the same kind of finding.

1. Read both assessments: for a recorded disagreement, the rationale and its
   note (`habeas info`); for a changed determination, the new rationale and the
   previous one, which only Git has, such as by asking a subagent to summarize
   `git show HEAD:evidence/<full-name>.json`. Decide whether one found a real
   gap or the requirement text admits more than one reading.
2. Fix the source or tests, or tighten the requirement text through habeas-requirements steps 3 to 5 (subagent review, the user's agreement, commit).

Tests

Input 3: outline tests/authoring_cli.rs fn[bundled_skills_treat_disagreeing_assessments_as_findings]
// {test}`requirements.cli.flip_guidance`
#[test]
fn bundled_skills_treat_disagreeing_assessments_as_findings() {
    const GOAL: &str = "The goal is that independent assessments of the same subject reach the same determination, because the requirement, code, and tests leave no gap a careful reviewer could find and no reading a careful reviewer could take differently";
    // habeas-evidence is the home: the goal leads and the procedure follows.
    assert_text_in_order(
        "disagreeing assessments",
        &section(skill_md("habeas-evidence"), "## Disagreeing assessments"),
        &[
            GOAL,
            "Assessments that disagree are findings against that goal",
            "Read both assessments",
            "Decide whether one found a real gap or the requirement text admits more than one reading",
            "Fix the source or tests, or tighten the requirement text through habeas-requirements steps 3 to 5",
        ],
    );
    // Never re-run for a different determination; a change to agreed text is
    // reviewed with the user, then explained in its commit message.
    assert_text_in_order(
        "rules",
        &section(skill_md("habeas-evidence"), "## Rules"),
        &[
            "Never re-run an assessment to get a different result",
            "Fix the source, tests, references, or requirement text instead",
            "A change to agreed requirement text, even a rewording, goes through habeas-requirements steps 3 to 5 (subagent review, the user's agreement, commit) first",
            "Then give the reason, and the rationale that prompted it, in the message of the commit that makes it, describing the change relative to the prior commit rather than the drafts that led to it",
        ],
    );
    assert_phrases(
        "habeas-requirements",
        &[
            "For a change to agreed text, the message gives the reason and the rationale that prompted it, relative to the prior commit (habeas-evidence, \"Rules\")",
        ],
    );
    // The other skills point to it rather than restate it.
    assert_phrases(
        "habeas-requirements",
        &["When assessments disagree, follow its \"Disagreeing assessments\""],
    );
    assert_phrases(
        "habeas-bootstrap-requirements",
        &["follow \"Disagreeing assessments\" in the habeas-evidence skill"],
    );
    assert_text(
        "habeas gotchas",
        &section(skill_md("habeas"), "## Gotchas"),
        &[
            "When assessments of the same subject disagree, follow \"Disagreeing assessments\" in the habeas-evidence skill",
        ],
    );
    let (_, last) = workflow_steps("habeas-refactor").pop().unwrap();
    assert_text(
        "habeas-refactor's last step",
        &last,
        &[
            "following the habeas-evidence skill, and if assessments disagree, its \"Disagreeing assessments\"",
        ],
    );
    for name in SKILLS.into_iter().filter(|name| *name != "habeas-evidence") {
        assert!(
            !bundled_skill(name).contains(GOAL),
            "{name} restates the goal"
        );
    }
    // No skill keeps a separate log of requirement changes.
    for name in SKILLS {
        assert!(
            !bundled_skill(name).contains("audit log"),
            "{name} mentions an audit log"
        );
    }
}

Referenced definitions

Input 2: requirements selection requirements.cli.requirements_review_skill.agreed_text
:::{req} requirements_review_skill.agreed_text
The `habeas-requirements` skill MUST direct agents to take every change to agreed requirement text, including a rewording for precision and the removal of a requirement, through the same review and agreement before committing it.
:::

Other sources

Input 1: requirements selection requirements.cli.flip_guidance
:::{req} flip_guidance
The `habeas-evidence` skill MUST state the goal that independent assessments
of the same subject reach the same determination, because the requirement, code,
and tests leave no gap a careful reviewer could find and no reading a careful
reviewer could take differently, and the other bundled skills MUST refer to it
rather than restate it. The skills MUST tell agents that assessments of the
same subject that disagree are findings against that goal. They MUST direct agents to read both
rationales and decide whether one assessment found a real gap or the requirement
text admits more than one reading, then fix the source or tests, or tighten the
requirement text, rather than re-running an assessment to obtain a different
determination. Every change to agreed requirement text, including a rewording for precision,
MUST be reviewed with the user under
{cite}`requirements.cli.requirements_review_skill.agreed_text` before it is committed, and the
skills MUST then direct agents to give the reason, and the rationale that
prompted the change, in the message of the commit that makes it. That message
MUST describe the change relative to the prior commit, not the intermediate
drafts that led to it.
:::
Input 4: outline tests/authoring_cli.rs fn[assert_text_in_order]
/// Asserts that the text contains each phrase, each after the previous one.
// {cite}`habeas:util`
fn assert_text_in_order(label: &str, text: &str, phrases: &[&str]) {
    let mut from = 0;
    for phrase in phrases {
        let at = text[from..]
            .find(phrase)
            .unwrap_or_else(|| panic!("{label} lacks {phrase:?} after byte {from}"));
        from += at + phrase.len();
    }
}
Input 5: outline tests/authoring_cli.rs fn[assert_phrases]
// {cite}`habeas:util`
fn assert_phrases(name: &str, phrases: &[&str]) {
    assert_text(name, &bundled_skill(name), phrases);
}
Input 6: 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:?}");
    }
}
Input 7: outline tests/authoring_cli.rs const[SKILLS]
/// The bundled skills, by name.
// {cite}`habeas:util`
const SKILLS: [&str; 5] = [
    "habeas",
    "habeas-requirements",
    "habeas-evidence",
    "habeas-bootstrap-requirements",
    "habeas-refactor",
];
Input 8: 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 9: 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 11: outline tests/authoring_cli.rs fn[bundled_skill]
/// A bundled skill: its `SKILL.md` together with its reference files,
/// collapsed.
// {cite}`habeas:util`
fn bundled_skill(name: &str) -> String {
    let files = skill_files(name)
        .iter()
        .map(|(_, text)| *text)
        .collect::<Vec<_>>();
    collapse(&files.join("\n"))
}