claude-dev-env 8.104.0 → 8.105.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/agents/test_verifier_agent.py +41 -0
- package/.agents/agents/verifier.md +43 -0
- package/.agents/skills/orchestrator/SKILL.md +2 -2
- package/.agents/skills/orchestrator/reference/completion-reporting.md +5 -4
- package/.agents/skills/orchestrator/reference/oversee-delegated-work.md +9 -7
- package/.agents/skills/orchestrator/test_orchestrator_skill_contract.py +27 -0
- package/docs/rule-guides/verified-work.md +51 -0
- package/hooks/features/spawn-routing.md +1 -1
- package/hooks/hooks_constants/spawn_oversight_hook_constants.py +13 -7
- package/hooks/routing/test_spawn_oversight_hook.py +40 -0
- package/package.json +1 -1
- package/rules/index.md +4 -5
- package/scripts/tests/test_verified_work_rule.py +36 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""The verifier agent carries the verified-work contract: three modes, reproduce first, and no pass without a reproduction."""
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
VERIFIER_PATH = Path(__file__).resolve().parent / "verifier.md"
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def _verifier_text() -> str:
|
|
9
|
+
return VERIFIER_PATH.read_text(encoding="utf-8")
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def test_the_verifier_names_a_mode_for_research_plan_and_fix() -> None:
|
|
13
|
+
verifier_text = _verifier_text()
|
|
14
|
+
assert "**Research.**" in verifier_text
|
|
15
|
+
assert "CONFIRMED or REFUTED" in verifier_text
|
|
16
|
+
assert "**Plan.**" in verifier_text
|
|
17
|
+
assert "SOUND or GAP" in verifier_text
|
|
18
|
+
assert "**Fix.**" in verifier_text
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def test_the_fix_mode_reproduces_on_the_old_state_before_it_confirms_on_the_new() -> None:
|
|
22
|
+
verifier_text = _verifier_text()
|
|
23
|
+
reproduce_position = verifier_text.index("1. Reproduce. On the old state")
|
|
24
|
+
confirm_position = verifier_text.index("2. Confirm. On the new state")
|
|
25
|
+
undo_position = verifier_text.index("3. Undo.")
|
|
26
|
+
assert reproduce_position < confirm_position < undo_position
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def test_a_fix_whose_issue_did_not_reproduce_never_passes() -> None:
|
|
30
|
+
assert "NOT REPRODUCED is never a pass" in _verifier_text()
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def test_the_verifier_leaves_the_work_under_review_untouched() -> None:
|
|
34
|
+
assert "Do not edit, create, or delete any file in the work under review" in _verifier_text()
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def test_the_brief_template_carries_the_spawn_oversight_clauses() -> None:
|
|
38
|
+
verifier_text = _verifier_text()
|
|
39
|
+
assert "Outcome: <" in verifier_text
|
|
40
|
+
assert "On a blocker: <" in verifier_text
|
|
41
|
+
assert "leaves out the worker's conclusion" in verifier_text
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: verifier
|
|
3
|
+
description: Separate checker for the verified-work flow. Spawn a fresh one after research, after the plan, and after the fix of each piece of work. It never checks work it did. For a fix it reproduces the issue on the old state first, then confirms the issue is gone on the new state, and it does not pass a fix whose issue it could not reproduce.
|
|
4
|
+
tools: Read, Glob, Grep, Bash, PowerShell
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You check work that another agent did. Read the brief, then run the mode it names. Use only primary evidence: files, command output, logs, and runs you read or produce yourself. A claim in the brief is a claim to test, never evidence.
|
|
8
|
+
|
|
9
|
+
Your check ends the chain: it needs no research, plan, or verifier of its own.
|
|
10
|
+
|
|
11
|
+
Do not edit, create, or delete any file in the work under review. Put probes and scratch files outside it, and name each one in the report.
|
|
12
|
+
|
|
13
|
+
## Modes
|
|
14
|
+
|
|
15
|
+
**Research.** For each claim, report CONFIRMED or REFUTED, with the file:line or command output you produced. Then list what the research missed that bears on the issue.
|
|
16
|
+
|
|
17
|
+
**Plan.** For each piece, report SOUND or GAP. SOUND means the piece closes part of the researched issue and breaks no test, budget, or constraint the brief names. Check each scope tag against the user's own words. A piece the words do not name, and that the named work does not need, is new scope: report it as GAP with the tag "new scope".
|
|
18
|
+
|
|
19
|
+
**Fix.** Run these steps in order.
|
|
20
|
+
|
|
21
|
+
1. Reproduce. On the old state, run the check that shows the issue. Report REPRODUCED with the output, or NOT REPRODUCED.
|
|
22
|
+
2. Confirm. On the new state, run the same check. Report FIXED with the output, or NOT FIXED.
|
|
23
|
+
3. Undo. Revert the fix in a scratch copy and run the check again. It must fail again. When the fix lives outside the files, such as an installed setting, and no scratch copy can revert it, report UNDO NOT RUN with the reason.
|
|
24
|
+
|
|
25
|
+
A fix passes only with REPRODUCED, FIXED, and an undo that fails again or UNDO NOT RUN with its reason. NOT REPRODUCED is never a pass: report what you ran, and say what check would show the issue.
|
|
26
|
+
|
|
27
|
+
## Report
|
|
28
|
+
|
|
29
|
+
End with one line per item: the item, the verdict, and the evidence. Then one overall line: PASS or FAIL.
|
|
30
|
+
|
|
31
|
+
## Brief template
|
|
32
|
+
|
|
33
|
+
The agent that spawns you writes the brief with these lines:
|
|
34
|
+
|
|
35
|
+
```text
|
|
36
|
+
Mode: research | plan | fix
|
|
37
|
+
Outcome: <the user's outcome, in the user's words>
|
|
38
|
+
Issue: <the issue, with the source that shows it>
|
|
39
|
+
Sources: <files, commands, the old state and the new state>
|
|
40
|
+
On a blocker: <the other routes to the same evidence>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
The brief gives the issue and the sources. It leaves out the worker's conclusion.
|
|
@@ -26,7 +26,7 @@ The current agent owns the user's outcome, its own work, and any delegated work.
|
|
|
26
26
|
Keep the goal, decisions, ownership, and next actions in the parent context.
|
|
27
27
|
Put bulk research, logs, and implementation detail in bounded worker contexts and linked artifacts.
|
|
28
28
|
Do short work inline when that keeps the task clear.
|
|
29
|
-
This session is the advisor for its executors
|
|
29
|
+
This session is the advisor for its executors. A fresh `verifier` agent checks each returned claim, per `~/.claude/docs/rule-guides/verified-work.md`.
|
|
30
30
|
|
|
31
31
|
## Gotchas
|
|
32
32
|
|
|
@@ -105,7 +105,7 @@ Send follow-ups only through a transport authorized by the current runtime and u
|
|
|
105
105
|
Read the evidence needed for your decision. Keep lengthy output in files and return short evidence pointers.
|
|
106
106
|
Check scope, acceptance results, and unresolved work before accepting a worker's conclusion.
|
|
107
107
|
Review every close a worker reports. Send a close back to that worker when it routes a defect the worker found in its own subject to another issue or epic, and have the worker carry the defect through its fix pull request.
|
|
108
|
-
|
|
108
|
+
Run every piece through the verified-work flow: a fresh `verifier` agent checks the research, the plan, and the fix, and the fix check reproduces the issue before it confirms the fix.
|
|
109
109
|
Checkpoint after decisions and state changes, before waiting, and before a known compaction.
|
|
110
110
|
|
|
111
111
|
### Complete the requested outcome
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
Use this procedure before a completion report or an answer about whether work is done.
|
|
4
4
|
|
|
5
5
|
1. Recover the user's requested outcome and acceptance conditions. Read the evidence for that outcome before choosing its status.
|
|
6
|
-
2.
|
|
7
|
-
3.
|
|
8
|
-
4.
|
|
9
|
-
5.
|
|
6
|
+
2. Confirm that a fresh `verifier` agent passed the result, per `~/.claude/docs/rule-guides/verified-work.md`. A fix passes only when the verifier reproduced the issue first and then confirmed it gone. A result with no passed verifier stays open and is reported as waiting on verification.
|
|
7
|
+
3. Check what each unfinished item changes. Missing deliverables, required verification, necessary approvals, and stated completion prerequisites keep the affected goal open. An administrative item whose absence has no effect on the result, its use, or its acceptance keeps its own task open.
|
|
8
|
+
4. State the main outcome first. When that outcome is verified complete and only incidental recordkeeping remains, report the task as complete. A requested status notice alone does not make the main outcome incomplete. Mention the administrative item separately when useful or required by the active reporting rules.
|
|
9
|
+
5. Keep unfinished work tracked honestly. When one tracker item combines the completed outcome and unfinished administration, preserve the outcome's goal and evidence, mark its work complete, and keep a separate open administrative follow-up. Do reachable administrative work before ending. Preserve its next action or blocker when it cannot be finished. Never mark it done merely to make the report look complete.
|
|
10
|
+
6. Preserve other goals and required delivery. A complete subgoal does not close an unfinished goal or the parent run. Use the goal's acceptance conditions in the [run record](run-state.md) to decide what its remaining work affects.
|
|
10
11
|
|
|
11
12
|
An administrative action can be requested without being a condition of the main outcome's completion. Treat it as a completion prerequisite when the user states that dependency, when it carries an essential requested result, or when its absence affects the result's usability, safety, or completeness.
|
|
12
13
|
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
# Oversee delegated work
|
|
2
2
|
|
|
3
3
|
Every agent that spawns a subagent, thread, or session owns that work until it reaches the user.
|
|
4
|
-
Agents make mistakes.
|
|
4
|
+
Agents make mistakes. A fresh `verifier` agent, separate from the worker, catches them before they reach the user.
|
|
5
5
|
The `spawn_oversight_hook` adds this duty to every spawn, at every level of the tree.
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
7
|
+
- Run each piece through the verified-work flow in `~/.claude/docs/rule-guides/verified-work.md`: research, verify, plan, verify, implement, verify.
|
|
8
|
+
- Brief each worker with the user's own words, the standards that apply, and the acceptance check.
|
|
9
|
+
- Brief each verifier with the issue, the sources, the old state, and the new state. Leave the worker's conclusion out.
|
|
10
|
+
- While a worker runs, read its progress. Wake a quiet agent with one concrete next step.
|
|
11
|
+
- A fix passes only when its verifier reproduced the issue on the old state and confirmed it gone on the new state.
|
|
12
|
+
- Send a FAIL back to the worker with the verifier's evidence, and give the next attempt a new verifier.
|
|
13
|
+
- Tag each piece in-scope or new scope. Ask the user once before building new scope, and keep in-scope work moving.
|
|
12
14
|
- Keep each brief, prompt, and context file you hand an agent a short map: when to use it, the steps, and pointers to reference files it opens on demand.
|
|
13
|
-
-
|
|
15
|
+
- Report as done only what a verifier passed, and name the verdict and its evidence. Report the rest as waiting on verification.
|
|
@@ -58,3 +58,30 @@ def test_executor_consult_block_names_orchestrating_session() -> None:
|
|
|
58
58
|
)
|
|
59
59
|
assert "<orchestrator-name>" in text
|
|
60
60
|
assert "your advisor" in text
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
_OVERSEE_PATH = _SKILL_DIR / "reference" / "oversee-delegated-work.md"
|
|
64
|
+
_COMPLETION_PATH = _SKILL_DIR / "reference" / "completion-reporting.md"
|
|
65
|
+
_VERIFIED_WORK_GUIDE = "~/.claude/docs/rule-guides/verified-work.md"
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def test_independent_verification_is_no_longer_conditional() -> None:
|
|
69
|
+
text = (_SKILL_DIR / "SKILL.md").read_text(encoding="utf-8")
|
|
70
|
+
assert "Use independent verification where the task or repository requires it." not in text
|
|
71
|
+
assert "Run every piece through the verified-work flow" in text
|
|
72
|
+
assert _VERIFIED_WORK_GUIDE in text
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def test_a_separate_verifier_checks_delegated_work() -> None:
|
|
76
|
+
text = _OVERSEE_PATH.read_text(encoding="utf-8")
|
|
77
|
+
assert "check it against the user's words and standards yourself" not in text
|
|
78
|
+
assert "A fresh `verifier` agent, separate from the worker" in text
|
|
79
|
+
assert "Leave the worker's conclusion out." in text
|
|
80
|
+
assert "reproduced the issue on the old state and confirmed it gone on the new state" in text
|
|
81
|
+
assert "Ask the user once before building new scope" in text
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def test_completion_needs_a_passed_verifier() -> None:
|
|
85
|
+
text = _COMPLETION_PATH.read_text(encoding="utf-8")
|
|
86
|
+
assert "Confirm that a fresh `verifier` agent passed the result" in text
|
|
87
|
+
assert "reported as waiting on verification" in text
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
Back to the [rules index](../../rules/index.md).
|
|
2
|
+
|
|
3
|
+
# Verified work
|
|
4
|
+
|
|
5
|
+
## In brief
|
|
6
|
+
|
|
7
|
+
Every piece of work runs in six steps: research, verify the research, plan, verify the plan, implement, verify the fix. A separate `verifier` agent runs each verify step. The fix check reproduces the issue on the old state first, then confirms it is gone on the new state. The user gets only results a verifier passed. New scope goes to the user as one question before it is built.
|
|
8
|
+
|
|
9
|
+
**When this applies:** Any task: a change to code, configuration, rules, or a document, and any finding, cause, or fix reported to the user.
|
|
10
|
+
|
|
11
|
+
## The six steps
|
|
12
|
+
|
|
13
|
+
1. **Research.** Find the issue and its cause in primary sources: files, logs, runs, command output. Write each finding as a claim with its source.
|
|
14
|
+
2. **Verify the research.** Spawn a fresh `verifier` in research mode. It reports CONFIRMED or REFUTED for each claim, and what the research missed. Fix the research before you plan.
|
|
15
|
+
3. **Plan.** List the pieces of the fix. Tag each piece in-scope or new scope (see [Scope](#scope)).
|
|
16
|
+
4. **Verify the plan.** Spawn a fresh `verifier` in plan mode. It reports SOUND or GAP for each piece: does it close part of the researched issue, and does it break a test, a budget, or a constraint. It checks each scope tag against the user's words. Revise the plan for each GAP.
|
|
17
|
+
5. **Implement.** Build the in-scope pieces.
|
|
18
|
+
6. **Verify the fix.** Spawn a fresh `verifier` in fix mode. It reproduces the issue on the old state, confirms the issue is gone on the new state, and confirms an undo of the fix fails again. When no scratch copy can revert the fix, such as an installed setting, it reports UNDO NOT RUN with the reason, and REPRODUCED plus FIXED still pass. A fix whose issue did not reproduce does not pass.
|
|
19
|
+
|
|
20
|
+
## The verifier
|
|
21
|
+
|
|
22
|
+
- The verifier is never the agent that did the work. The spawner is the owner of the work. A fresh agent at each verify step keeps the check apart from the author.
|
|
23
|
+
- Its brief gives the issue, the sources, the old state and the new state. It leaves out the worker's conclusion, so the verifier tests the claim and does not inherit it.
|
|
24
|
+
- Use the `verifier` agent definition and its brief template. On a host without that agent, give a fresh general-purpose agent the same contract.
|
|
25
|
+
- A verifier's own check ends the chain. It runs no research, plan, or verifier of its own.
|
|
26
|
+
- A FAIL goes back to the worker with the verifier's evidence. After the next attempt, a new verifier checks it.
|
|
27
|
+
|
|
28
|
+
## Scope
|
|
29
|
+
|
|
30
|
+
A piece is in-scope when it traces to the user's own words, or when the named work needs it to be done, such as a test for the fix, a doc row that the change makes stale, or a refactor the fix cannot land without. A piece is new scope when it is a feature, task, or system the user's words do not name and the named work does not need.
|
|
31
|
+
|
|
32
|
+
- In-scope work runs with no ask.
|
|
33
|
+
- New scope goes to the user as one question before any of it is built: what it is, why the work led to it, and what it costs. Use the session's question tool, per [`question-presentation.md`](question-presentation.md).
|
|
34
|
+
- While the question waits, keep building the in-scope pieces, per [`long-horizon-autonomy.md`](long-horizon-autonomy.md).
|
|
35
|
+
|
|
36
|
+
Examples, labelled as a format guide:
|
|
37
|
+
|
|
38
|
+
| Ask | Piece | Tag |
|
|
39
|
+
|-|-|-|
|
|
40
|
+
| Fix the sign-in step that fails in cloud sessions | Repair the token refresh the sign-in calls | in-scope |
|
|
41
|
+
| Fix the sign-in step that fails in cloud sessions | A lock and write-back system for shared credentials | new scope: ask first |
|
|
42
|
+
| Add a flag that skips the cache | Update the README table that lists the flags | in-scope |
|
|
43
|
+
| Add a flag that skips the cache | Rewrite the cache as a separate service | new scope: ask first |
|
|
44
|
+
|
|
45
|
+
## Reporting
|
|
46
|
+
|
|
47
|
+
Report only what a verifier passed. Name the verifier's verdict and the evidence it produced. A result that no verifier has passed is still work in progress: say that it waits on verification.
|
|
48
|
+
|
|
49
|
+
## Enforcement
|
|
50
|
+
|
|
51
|
+
`hooks/routing/spawn_oversight_hook.py` adds the six steps, the separate verifier, the reproduce-first check, the scope ask, and the reporting rule to every spawn at every level of the agent tree whose brief has an `Outcome:` line and an `On a blocker:` line; the hook already denies a brief without them, and the verifier brief template carries both. The flow itself adds context only. No hook refuses a report, a commit, or a spawn for a missing verifier run, so the flow never blocks work the user asked for.
|
|
@@ -5,7 +5,7 @@ This family reminds the agent to gather context before a spawn, refuses a brief
|
|
|
5
5
|
## Checks
|
|
6
6
|
|
|
7
7
|
- `routing/spawn_readiness_hook.py` adds context to a spawn that comes before a read step, or before an answered question or a settled-scope line. The spawn still runs.
|
|
8
|
-
- `routing/spawn_oversight_hook.py` denies a spawn whose brief has no `Outcome:` line or no `On a blocker:` clause, each with text after it. A spawn that passes gets the orchestrator oversight directive:
|
|
8
|
+
- `routing/spawn_oversight_hook.py` denies a spawn whose brief has no `Outcome:` line or no `On a blocker:` clause, each with text after it. A spawn that passes gets the orchestrator oversight directive: run each piece through the verified-work flow, with a fresh verifier agent that checks the research, the plan, and the fix, reproduces the issue before it confirms the fix, and leaves the worker's conclusion out of its brief; ask the user before new scope; report as done only what a verifier passed; and watch the agent while it runs. `routing/spawn_brief_text.py` reads the brief from each spawn tool for this hook and the readiness hook.
|
|
9
9
|
- `routing/thread_spawn_pace_hook.py` reshapes a thread request when usage is over pace or unreadable.
|
|
10
10
|
- `routing/subagent_model_routing.mjs` allows a selected Luna model, remaps eligible requests, and denies unsupported model routing.
|
|
11
11
|
- `blocking/haiku_spawn_slim_gate.py` denies an Agent, Task, or thread spawn whose `model` names Haiku. The deny reason gives the headless `claude -p` command that loads the slim profile through the account broker.
|
|
@@ -36,11 +36,17 @@ REFUSAL_SUFFIX = (
|
|
|
36
36
|
REASON_SEPARATOR = " "
|
|
37
37
|
|
|
38
38
|
SPAWN_OVERSIGHT_DIRECTIVE = (
|
|
39
|
-
"You own the work this spawn starts.
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
39
|
+
"You own the work this spawn starts. Run each piece through the verified-work "
|
|
40
|
+
"flow: research, then a separate verifier checks the research; plan, then a "
|
|
41
|
+
"separate verifier checks that the plan fixes the researched issue; implement, "
|
|
42
|
+
"then a separate verifier reproduces the issue on the old state before it "
|
|
43
|
+
"confirms the fix on the new state. Spawn a fresh verifier agent for each "
|
|
44
|
+
"check, never the agent that did the work, and brief it with the issue and "
|
|
45
|
+
"the sources and leave the worker's conclusion out. A verifier's check ends "
|
|
46
|
+
"the chain and gets no verifier of its own. Ask the user once before "
|
|
47
|
+
"you build new scope the user's words do not name, and keep in-scope work "
|
|
48
|
+
"moving while the question waits. Report as done only what a verifier "
|
|
49
|
+
"passed, with its evidence. While the agent runs, read its progress and wake "
|
|
50
|
+
"it with one next step when it goes quiet. Load the orchestrator skill and "
|
|
51
|
+
"follow its oversee delegated work reference."
|
|
46
52
|
)
|
|
@@ -232,3 +232,43 @@ def test_brief_gaps_should_name_each_missing_clause() -> None:
|
|
|
232
232
|
def test_a_workflow_script_path_that_cannot_be_opened_gets_the_directive() -> None:
|
|
233
233
|
payload = {"tool_name": "Workflow", "tool_input": {"scriptPath": "bad\u0000path.js"}}
|
|
234
234
|
assert json.loads(_run_script(json.dumps(payload))) == _directive_output()
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
def _emitted_directive() -> str:
|
|
238
|
+
stdout = _run_script(json.dumps(_spawn_payload("Agent", GOOD_BRIEF)))
|
|
239
|
+
return json.loads(stdout)["hookSpecificOutput"]["additionalContext"]
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
def test_the_emitted_directive_runs_research_plan_and_fix_in_order() -> None:
|
|
243
|
+
directive = _emitted_directive()
|
|
244
|
+
research_position = directive.index("research, then a separate verifier checks the research")
|
|
245
|
+
plan_position = directive.index("plan, then a separate verifier checks that the plan fixes the researched issue")
|
|
246
|
+
fix_position = directive.index("implement, then a separate verifier reproduces the issue")
|
|
247
|
+
assert research_position < plan_position < fix_position
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
def test_the_emitted_directive_reproduces_the_issue_before_it_confirms_the_fix() -> None:
|
|
251
|
+
directive = _emitted_directive()
|
|
252
|
+
assert directive.index("reproduces the issue on the old state") < directive.index(
|
|
253
|
+
"confirms the fix on the new state"
|
|
254
|
+
)
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
def test_the_emitted_directive_keeps_the_verifier_apart_from_the_worker() -> None:
|
|
258
|
+
directive = _emitted_directive()
|
|
259
|
+
assert "Spawn a fresh verifier agent for each check, never the agent that did the work" in directive
|
|
260
|
+
assert "leave the worker's conclusion out" in directive
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
def test_the_emitted_directive_asks_before_new_scope_and_keeps_in_scope_work_moving() -> None:
|
|
264
|
+
directive = _emitted_directive()
|
|
265
|
+
assert "Ask the user once before you build new scope" in directive
|
|
266
|
+
assert "keep in-scope work moving while the question waits" in directive
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
def test_the_emitted_directive_reports_only_verified_results() -> None:
|
|
270
|
+
assert "Report as done only what a verifier passed, with its evidence" in _emitted_directive()
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
def test_the_emitted_directive_ends_the_chain_at_the_verifier() -> None:
|
|
274
|
+
assert "A verifier's check ends the chain and gets no verifier of its own" in _emitted_directive()
|
package/package.json
CHANGED
package/rules/index.md
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
# Rules
|
|
2
|
-
Each line gives a rule in brief. When its trigger matches your task, open the guide and follow it in full.
|
|
2
|
+
Each line gives a rule in brief. When its trigger matches your task, open the guide and follow it in full.
|
|
3
3
|
|
|
4
4
|
**Writing**
|
|
5
5
|
- **Plain language** ([guide](../docs/rule-guides/asd-ste100-language.md)). Writing chat, narration, or repository prose. Short complete sentences on one topic, active voice, one action per step, each fact said once.
|
|
6
|
-
- **No contrast framing** ([guide](../docs/rule-guides/no-contrast-framing.md)). Any sentence a person reads. State the chosen point and leave out the discarded reading.
|
|
6
|
+
- **No contrast framing** ([guide](../docs/rule-guides/no-contrast-framing.md)). Any sentence a person reads. State the chosen point and leave out the discarded reading.
|
|
7
7
|
|
|
8
8
|
**Evidence**
|
|
9
9
|
- **Research mode** ([guide](../docs/rule-guides/research-mode.md)). Any claim, recommendation, or advice. Cite a source for each claim, and run the tool that settles a fact before you state it.
|
|
10
10
|
- **Verify before asking** ([guide](../docs/rule-guides/verify-before-asking.md)). Before a clarifying question. Look in files, config, environment, and tools first; ask only for a judgment or a preference.
|
|
11
|
+
- **Verified work** ([guide](../docs/rule-guides/verified-work.md)). Any task. Research, plan, and build; a fresh `verifier` agent checks each step and reproduces the issue before it confirms the fix. Report only verified results. Ask before new scope.
|
|
11
12
|
- **Verify runtime state** ([guide](../docs/rule-guides/verify-runtime-state.md)). Before you say a component works, is healthy, or is not the cause. Get a live signal this session.
|
|
12
13
|
|
|
13
14
|
**Before building**
|
|
@@ -21,10 +22,8 @@ Each line gives a rule in brief. When its trigger matches your task, open the gu
|
|
|
21
22
|
- **Filesystem search** ([guide](../docs/rule-guides/filesystem-search.md)). Finding files by name, path, size, or date. Scope the search to a project, worktree, or filter, never a root.
|
|
22
23
|
- **Clean up temporary files** ([guide](../docs/rule-guides/cleanup-temp-files.md)). Creating scratch files or debug dumps. Track them and remove them when the task ends.
|
|
23
24
|
|
|
24
|
-
**Shipping**
|
|
25
|
+
**Shipping and memory**
|
|
25
26
|
- **Pull request lifecycle**. Before a commit, push, pull request action, or merge. Invoke the `pr-lifecycle` skill; a hook denies those commands until it loads.
|
|
26
27
|
- **Proof before a pull request** ([guide](../docs/rule-guides/proof-before-pull-request.md)). Before you open a pull request. Run the change with and without it, and quote both under "Proof in practice".
|
|
27
28
|
- **Session title** ([guide](../docs/rule-guides/session-title.md)). The session has a tool whose name ends in `__set_session_title`. Set `<emoji> <name>` when the status changes.
|
|
28
|
-
|
|
29
|
-
**Memory**
|
|
30
29
|
- **Durable facts only** ([guide](../docs/rule-guides/memory-stores-durable-facts.md)). Writing auto-memory or a `MEMORY.md` entry. Keep only a fact that helps a fresh session weeks later.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""The always-loaded rules index carries the verified-work flow, and its guide spells out every step."""
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
PACKAGE_ROOT = Path(__file__).resolve().parents[2]
|
|
6
|
+
INDEX_PATH = PACKAGE_ROOT / "rules" / "index.md"
|
|
7
|
+
GUIDE_PATH = PACKAGE_ROOT / "docs" / "rule-guides" / "verified-work.md"
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def test_the_index_points_every_session_at_the_verified_work_guide() -> None:
|
|
11
|
+
index_text = INDEX_PATH.read_text(encoding="utf-8")
|
|
12
|
+
assert "- **Verified work** ([guide](../docs/rule-guides/verified-work.md))." in index_text
|
|
13
|
+
assert "reproduces the issue before it confirms the fix" in index_text
|
|
14
|
+
assert "Ask before new scope." in index_text
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def test_the_guide_runs_six_steps_in_order() -> None:
|
|
18
|
+
guide_text = GUIDE_PATH.read_text(encoding="utf-8")
|
|
19
|
+
all_step_markers = (
|
|
20
|
+
"1. **Research.**",
|
|
21
|
+
"2. **Verify the research.**",
|
|
22
|
+
"3. **Plan.**",
|
|
23
|
+
"4. **Verify the plan.**",
|
|
24
|
+
"5. **Implement.**",
|
|
25
|
+
"6. **Verify the fix.**",
|
|
26
|
+
)
|
|
27
|
+
all_positions = [guide_text.index(each_marker) for each_marker in all_step_markers]
|
|
28
|
+
assert all_positions == sorted(all_positions)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def test_the_guide_keeps_the_verifier_apart_and_asks_before_new_scope() -> None:
|
|
32
|
+
guide_text = GUIDE_PATH.read_text(encoding="utf-8")
|
|
33
|
+
assert "The verifier is never the agent that did the work." in guide_text
|
|
34
|
+
assert "A fix whose issue did not reproduce does not pass." in guide_text
|
|
35
|
+
assert "New scope goes to the user as one question before any of it is built" in guide_text
|
|
36
|
+
assert "In-scope work runs with no ask." in guide_text
|