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

Requirements index · View definition

evidence Valid

Requirement

Habeas’s bundled agent skills MUST jointly give the direction that the requirements on them specify. A skill consists of its SKILL.md and the files under its references/ directory. Each topic MUST be stated in full in exactly one skill, its home.

Rationale

Obligations in requirements.cli.skill_structure

  1. The bundled skills jointly give the direction the requirements on them specify. The refining requirements skill_structure.* and the per-skill requirements carry the content of that direction, and their own tests check it. The subject test does not need to repeat it.
  2. A skill is its SKILL.md plus the files under its references/ directory.
  3. Each topic is stated in full in exactly one skill, its home.

How the marked test covers them

tests/authoring_cli.rs#fn[bundled_skills_are_five_skill_directories_each_home_to_its_topics] is the only test marked for the subject. It does the following:

  • Skill set. It reads assets/skills and asserts that the directory names equal SKILLS, the five skills habeas, habeas-requirements, habeas-evidence, habeas-bootstrap-requirements and habeas-refactor. An extra or missing skill directory fails.
  • Publication. It asserts that Cargo.toml publishes the Symposium skills path assets/skills.
  • Front matter. It asserts each SKILL.md has front matter with a matching name.
  • Skill definition. For each skill it lists the files on disk: SKILL.md plus everything under references/. It asserts that list equals the file list from skill_files, which is what the other tests read through bundled_skill. This ties the tests’ notion of “a skill” to the requirement’s definition. An unlisted reference file fails.
  • Home and exclusivity. For each home, assert_home first asserts that bundled_skill(home), which is SKILL.md plus references collapsed, contains every home_markers(home) phrase. It then asserts that none of the other four skills’ combined text contains any of those phrases. A topic marker missing from its home, or restated verbatim in another skill, makes the test fail.

Coverage of topics

The marker lists in home_markers span the topics the refining requirements assign to each home:

  • habeas: routing table, selection globs, syntax and chapter paths, distributed requirements, gotchas.
  • habeas-requirements: drafting, per-group subagent review, the gate, roots, review criteria, report template, compound requirements.
  • habeas-evidence: judgment outcomes, habeas author, fixing findings, FIXME judgments, citation and site reviews, disagreeing assessments, commit message.
  • habeas-bootstrap-requirements: deriving an initial requirement set from existing code.
  • habeas-refactor: --dry-run, --map, “Would leave … unchanged”.

Remaining limits

The exclusivity check works on fixed marker phrases. A paraphrased restatement would escape it. This is inherent to checking “stated in full” mechanically. requirements.cli.skill_structure.refer has its own test, bundled_skills_refer_to_a_topic_home_instead_of_restating_it. The per-home tests for skill_structure.habeas, .requirements, .evidence, .bootstrap and .refactor also cover each home’s content. I found no unacknowledged gap in the subject’s own obligations.

Inputs

Tests

Input 2: outline tests/authoring_cli.rs fn[bundled_skills_are_five_skill_directories_each_home_to_its_topics]
// {test}`requirements.cli.skill_structure`
#[test]
fn bundled_skills_are_five_skill_directories_each_home_to_its_topics() {
    // Symposium publishes every skill under assets/skills.
    let manifest: toml::Value =
        toml::from_str(include_str!("../Cargo.toml")).expect("Cargo.toml parses");
    let published = manifest["package"]["metadata"]["symposium"]["skills"]
        .as_array()
        .unwrap();
    assert!(
        published
            .iter()
            .any(|skill| skill["source"]["path"].as_str() == Some("assets/skills")),
        "{published:?}"
    );
    // A skill is its SKILL.md and the files under its references/ directory;
    // the files these tests read are exactly those.
    let root = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("assets/skills");
    let mut dirs = fs::read_dir(&root)
        .unwrap()
        .map(|entry| entry.unwrap().file_name().into_string().unwrap())
        .collect::<Vec<_>>();
    dirs.sort();
    let mut expected = SKILLS.map(String::from).to_vec();
    expected.sort();
    assert_eq!(dirs, expected);
    for name in SKILLS {
        assert!(
            skill_md(name).starts_with(&format!("---\nname: {name}\ndescription: ")),
            "{name} front matter"
        );
        let mut on_disk = vec!["SKILL.md".to_owned()];
        if let Ok(entries) = fs::read_dir(root.join(name).join("references")) {
            for entry in entries {
                let file = entry.unwrap().file_name().into_string().unwrap();
                on_disk.push(format!("references/{file}"));
            }
        }
        on_disk.sort();
        let mut listed = skill_files(name)
            .iter()
            .map(|(path, _)| path.to_string())
            .collect::<Vec<_>>();
        listed.sort();
        assert_eq!(on_disk, listed, "{name}");
    }
    // Each topic is stated in full in exactly one skill.
    for home in SKILLS {
        assert_home(home);
    }
}

Other sources

Input 1: requirements selection requirements.cli.skill_structure
:::{req} skill_structure
Habeas's bundled agent skills MUST jointly give the direction that the requirements on them specify. A skill consists of its `SKILL.md` and the files under its `references/` directory. Each topic MUST be stated in full in exactly one skill, its home.
:::
Input 3: outline tests/authoring_cli.rs fn[assert_home]
/// Asserts that `home` states each of its markers and no other skill does.
// {cite}`habeas:util`
fn assert_home(home: &str) {
    assert_phrases(home, home_markers(home));
    for other in SKILLS.into_iter().filter(|other| *other != home) {
        let text = bundled_skill(other);
        for marker in home_markers(home) {
            assert!(
                !text.contains(marker),
                "{other} restates {home}'s {marker:?}"
            );
        }
    }
}
Input 4: outline tests/authoring_cli.rs fn[skill_files]
/// The files of a bundled skill, by path relative to its directory: its
/// `SKILL.md` first, then every file under its `references/` directory.
// {cite}`habeas:util`
fn skill_files(name: &str) -> &'static [(&'static str, &'static str)] {
    match name {
        "habeas" => &[
            ("SKILL.md", include_str!("../assets/skills/habeas/SKILL.md")),
            (
                "references/ci.md",
                include_str!("../assets/skills/habeas/references/ci.md"),
            ),
            (
                "references/distributed-requirements.md",
                include_str!("../assets/skills/habeas/references/distributed-requirements.md"),
            ),
            (
                "references/syntax-details.md",
                include_str!("../assets/skills/habeas/references/syntax-details.md"),
            ),
        ],
        "habeas-requirements" => &[
            (
                "SKILL.md",
                include_str!("../assets/skills/habeas-requirements/SKILL.md"),
            ),
            (
                "references/review-prompt.md",
                include_str!("../assets/skills/habeas-requirements/references/review-prompt.md"),
            ),
        ],
        "habeas-evidence" => &[
            (
                "SKILL.md",
                include_str!("../assets/skills/habeas-evidence/SKILL.md"),
            ),
            (
                "references/authoring-failures.md",
                include_str!("../assets/skills/habeas-evidence/references/authoring-failures.md"),
            ),
            (
                "references/fixme.md",
                include_str!("../assets/skills/habeas-evidence/references/fixme.md"),
            ),
            (
                "references/reviews.md",
                include_str!("../assets/skills/habeas-evidence/references/reviews.md"),
            ),
        ],
        "habeas-bootstrap-requirements" => &[(
            "SKILL.md",
            include_str!("../assets/skills/habeas-bootstrap-requirements/SKILL.md"),
        )],
        "habeas-refactor" => &[(
            "SKILL.md",
            include_str!("../assets/skills/habeas-refactor/SKILL.md"),
        )],
        _ => panic!("unknown skill {name}"),
    }
}
Input 5: 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 6: outline tests/authoring_cli.rs fn[home_markers]
/// Phrases that state part of a topic in full, by the skill that is its home.
// {cite}`habeas:util`
fn home_markers(home: &str) -> &'static [&'static str] {
    match home {
        "habeas" => &[
            "| Task | Skill |",
            "A selection is a full name or a glob in which `*` matches any characters",
            "Its full name is the chapter path relative to that directory",
            "Fence a reference to attach commentary",
            "`:::{violations} <name>` selects constructs likely to break it",
            "Each site-query match makes a site",
            "omit a leading `reqs/` and a trailing `/index` or `/README`",
            "silently defines nothing",
            "needs a longer outer fence such as `::::{req}`",
            "Profiles, reports, and captured source under the Cargo target directory",
            "Install prerequisites",
        ],
        "habeas-requirements" => &[
            "Write drafts from the request straight into the chapter",
            "For each group, start a read-only subagent",
            "**Gate:** no implementation or test code",
            "A *root* is an item that carries out part of a requirement",
            "## What the review checks",
            "# Requirement group review",
            "**Compound:** a requirement that lists several independent forms",
        ],
        "habeas-evidence" => &[
            "A judgment is one of three outcomes",
            "`habeas author --all` assesses every definition whose evidence is missing, stale, or invalid",
            "## Fixing findings",
            "An item has recent coverage when it has its own reference, or when a recent version of an existing evidence record or review read it",
            "A FIXME judgment, such as",
            "gets a citation review. For project requirements and examples it checks that",
            "For built-ins it checks their permitted forms and stated criteria",
            "A site the requirement does not apply to is judged true",
            "The goal is that independent assessments of the same subject reach the same determination",
            "describing the change relative to the prior commit rather than the drafts that led to it",
        ],
        "habeas-bootstrap-requirements" => &[
            "every first-party runnable test or test case",
            "## Proposing requirements",
            "Independent recount:",
        ],
        "habeas-refactor" => &[
            "habeas refactor --dry-run",
            "`--map 'src/config.rs#fn[load]=src/config/load.rs#fn[load]'`",
            "\"Would leave ... unchanged\" lists records a mapping affects that fail a check",
        ],
        _ => panic!("unknown skill {home}"),
    }
}
Input 7: 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 8: 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"))
}
Input 9: requirements selection requirements.cli.skill_structure.*
:::{req} skill_structure.bootstrap
Under {cite}`requirements.cli.skill_structure`, the `habeas-bootstrap-requirements` skill MUST be the home of deriving an initial requirement set from existing code.
:::

:::{req} skill_structure.evidence
Under {cite}`requirements.cli.skill_structure`, the `habeas-evidence` skill MUST be the home of the authoring workflow, fixing validation findings, including uncovered Rust items, outcomes and FIXME judgments, citation and site reviews, disagreeing assessments, and the commit message for a change to agreed requirement text.
:::

:::{req} skill_structure.habeas
Under {cite}`requirements.cli.skill_structure`, the `habeas` skill MUST be the home of routing tasks to skills, `habeas status` and `habeas info`, directive and reference syntax, distributed requirements, and gotchas common to every task.
:::

:::{req} skill_structure.refactor
Under {cite}`requirements.cli.skill_structure`, the `habeas-refactor` skill MUST be the home of moving code, tests, and requirements to another file, chapter, or outline node, and of renaming requirements.
:::

:::{req} skill_structure.refer
A skill that needs a topic whose home under {cite}`requirements.cli.skill_structure` is another skill MUST refer to that skill instead of restating the topic. It MAY summarize the topic in a few lines.
:::

:::{req} skill_structure.requirements
Under {cite}`requirements.cli.skill_structure`, the `habeas-requirements` skill MUST be the home of drafting, reviewing, and agreeing requirements, the requirement review criteria, the procedure for choosing references, and the criteria the assessment applies to code and tests.
:::
Input 10: 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
}