requirements.cli.requirements_review_skill.present.apply
Requirements index · View definition
Requirement
Before presenting, the
habeas-requirementsskill MUST direct agents to apply the revised text the reviews return. Where reviews conflict, for example two reviews that split the same requirement differently, it MUST direct them to reconcile the conflict, and to present as a design question any conflict whose resolution changes what is promised.
Rationale
The tests adequately check the requirement. The requirement is about what the bundled habeas-requirements skill text directs agents to do. The single marked test, tests/authoring_cli.rs#fn[the_requirements_skill_applies_and_reconciles_reviews_before_presenting], checks each obligation against the skill’s workflow.
The helpers behave as the test needs. step_of panics unless a workflow step contains the phrase. workflow_steps collapses each step’s indented continuation lines, so phrases that wrap across lines in SKILL.md still match. assert_text asserts that every phrase is present. The skill text is in assets/skills/habeas-requirements/SKILL.md, in the Workflow section, step 3.
- Apply the revised text the reviews return:
step_of(SKILL, "Apply the revised text the reviews return")finds the step that says this, and the test fails if no step does. - Reconcile conflicting reviews: the test asserts that this step contains “reconcile reviews that clash, such as two that split the same requirement differently”. That covers both the reconcile directive and the example the requirement gives.
- Present as a design question any conflict whose resolution changes what is promised: the test asserts that the step contains “a clash whose resolution changes what is promised becomes a design question”.
- Before presenting:
assert!(apply < step_of(SKILL, "Present each group to the user"))checks that the apply and reconcile step comes before the presenting step.
A reviewer would find nothing else the requirement obliges. It names no other modes or boundaries, and the test would fail if the step’s wording were removed or moved after presenting.
Inputs
Implementation
Input 6: outline assets/skills/habeas-requirements/SKILL.md section[Habeas%20requirements]/section[Workflow]
- File:
assets/skills/habeas-requirements/SKILL.md - Selector:
section[Habeas%20requirements]/section[Workflow] - Kind:
section assets/skills/habeas-requirements/SKILL.md:12–86
## Workflow
- [ ] 1. Check the starting point. Run `git status` on the book's source
directory. If it has uncommitted edits you did not make in this task, ask
the user whether they belong to it. Read the relevant requirements, code,
and tests; `habeas info <selection>` prints a requirement's text and state.
If the change adds, alters, or removes no observable behavior (a comment typo, a
dependency bump, a speed-up), or an existing requirement already specifies
it (most bug fixes), tell the user which requirement covers it, or that
none is needed, and go to step 6.
- [ ] 2. Draft. Write drafts from the request straight into the chapter as
uncommitted, unstaged edits, with no draft marker; Git tracks what is in
progress. For a new chapter, add it to `SUMMARY.md` and `git add -N` it so
reviewers and Habeas see it. Ask the user only what the request can't
answer; the review in step 3 finds the rest. Drafts may be high-level,
compound, or incomplete. Cover each observable outcome and failure case
of the change without committing to an implementation. Reuse existing
requirements by full name, and propose a new one only for behavior none
covers; one general requirement, such as "invalid arguments MUST be
reported with usage", can cover many branches. Note the open product
choices; reviewers get them in step 3.
- [ ] 3. Review. Sort the new and changed requirements into groups that one
reviewer should see together: requirements that cite each other or
describe one feature. For each group, start a read-only subagent, all in
parallel. Tell it to read this skill's `references/review-prompt.md` and
the habeas skill's `SKILL.md` by absolute path, and give it the group's
full names and a brief: what the user asked for, the decisions already
made, and the open choices already noted, which it should not re-raise.
If you can't start subagents, review each group yourself against the
prompt, one group at a time. Apply the revised text the reviews return,
and reconcile reviews that clash, such as two that split the same
requirement differently; a clash whose resolution changes what is
promised becomes a design question.
- [ ] 4. Present each group to the user: its exact text, including any `{sites}`
and `{violations}` queries, and the design questions the review returned,
each with its options and your recommendation. Show text that was already
agreed or that the user supplied as a diff against that text, then a
"Mechanical:" list of the changes. Show the edits reviewers made outside
their group the same way, and list added `{example}`s, which each need a
test. Don't raise mechanical changes to new text as questions. Apply the
user's decisions. If a decision adds an obligation no reviewer saw,
review that group again.
**Gate:** no implementation or test code, and no commit, until the user
has agreed to, rejected, or deferred every group. Exact text the user supplied, or explicit agreement
earlier in the conversation, counts; a general request to build the
feature does not. If you cannot ask the user in this session, stop,
leave the drafts uncommitted, and report them with the design
questions.
- [ ] 5. Commit. Revert drafts the user rejected or deferred (`git restore -p`)
and list them in your report. Check with `git diff` that the book holds
exactly the agreed text, then commit it, all groups together, before any
code; leave out unrelated edits found in step 1. 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"). This commit fails
validation until evidence is authored; that is expected, as only the pull
request as a whole must pass. Report the full names. In a design session
with no code to write, stop here.
- [ ] 6. Implement and test. Add references as "Choosing references" says, then
check the work against "What the review checks". When a requirement was
split, move the `{impl}` and `{test}` of each split-off part to its new
name.
- [ ] 7. Next, follow the habeas-evidence skill to author evidence and fix what
it reports. When assessments disagree, follow its "Disagreeing
assessments".
Every change to agreed text, including a rewording for precision or removing a
requirement, goes through steps 3 to 5 before it is committed. If
implementation shows that agreed text must change, stop work that depends on it and take the changed requirements
through steps 3 to 5 first. Behavior no requirement covers goes back to step 2.
Renaming or moving a committed requirement is a habeas-refactor task, agreed
with the user and committed before its text changes. Restructuring code in
place, including renaming an item, needs no requirement review, but references
move with the code and the evidence is reassessed; moving code to another file
or outline node is a habeas-refactor task.
Tests
Input 2: outline tests/authoring_cli.rs fn[the_requirements_skill_applies_and_reconciles_reviews_before_presenting]
- File:
tests/authoring_cli.rs - Selector:
fn[the_requirements_skill_applies_and_reconciles_reviews_before_presenting] - Kind:
fn tests/authoring_cli.rs:3974–3988
// {test}`requirements.cli.requirements_review_skill.present.apply`
#[test]
fn the_requirements_skill_applies_and_reconciles_reviews_before_presenting() {
const SKILL: &str = "habeas-requirements";
let apply = step_of(SKILL, "Apply the revised text the reviews return");
assert_text(
"review step",
&step(SKILL, apply),
&[
"reconcile reviews that clash, such as two that split the same requirement differently",
"a clash whose resolution changes what is promised becomes a design question",
],
);
assert!(apply < step_of(SKILL, "Present each group to the user"));
}
Other sources
Input 1: requirements selection requirements.cli.requirements_review_skill.present.apply
requirements.cli.requirements_review_skill.present.apply:md/requirements/cli.md:167–170
:::{req} requirements_review_skill.present.apply
Before presenting, the `habeas-requirements` skill MUST direct agents to apply the revised text the reviews return. Where reviews conflict, for example two reviews that split the same requirement differently, it MUST direct them to reconcile the conflict, and to present as a design question any conflict whose resolution changes what is promised.
:::
Input 3: outline tests/authoring_cli.rs fn[step]
- File:
tests/authoring_cli.rs - Selector:
fn[step] - Kind:
fn tests/authoring_cli.rs:2991–2999
/// The text of one numbered workflow step.
// {cite}`habeas:util`
fn step(name: &str, number: u32) -> String {
workflow_steps(name)
.into_iter()
.find(|(n, _)| *n == number)
.unwrap_or_else(|| panic!("{name} has no step {number}"))
.1
}
Input 4: outline tests/authoring_cli.rs fn[step_of]
- File:
tests/authoring_cli.rs - Selector:
fn[step_of] - Kind:
fn tests/authoring_cli.rs:3001–3009
/// The number of the workflow step that contains `phrase`.
// {cite}`habeas:util`
fn step_of(name: &str, phrase: &str) -> u32 {
workflow_steps(name)
.into_iter()
.find(|(_, text)| text.contains(phrase))
.unwrap_or_else(|| panic!("no step of {name} contains {phrase:?}"))
.0
}
Input 5: outline tests/authoring_cli.rs fn[assert_text]
- File:
tests/authoring_cli.rs - Selector:
fn[assert_text] - Kind:
fn tests/authoring_cli.rs:3011–3016
// {cite}`habeas:util`
fn assert_text(label: &str, text: &str, phrases: &[&str]) {
for phrase in phrases {
assert!(text.contains(phrase), "{label} lacks {phrase:?}");
}
}