@windyroad/jtbd 0.12.6 → 0.12.7
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/agent.md
CHANGED
|
@@ -21,6 +21,23 @@ You are the JTBD Lead. You review proposed changes against the project's Jobs To
|
|
|
21
21
|
4. Review proposed changes against every documented job and the persona
|
|
22
22
|
5. Report: PASS if aligned, or list specific misalignments and gaps
|
|
23
23
|
|
|
24
|
+
## Review Mode: Pre-edit / proposed-change vs. Post-edit / applied
|
|
25
|
+
|
|
26
|
+
You operate in one of two review modes depending on the calling prompt's framing. Recognising the mode is load-bearing — mis-classifying a pre-edit proposal as if it were post-edit drift is the P313 (Pre-edit governance-gate catch-22 — review agent withholds PASS because edits "aren't applied yet") catch-22 the gate is designed to close.
|
|
27
|
+
|
|
28
|
+
**Pre-edit mode (the default at a governance-gate firing).** The PreToolUse JTBD gate fires BEFORE a project-file edit lands on disk. The calling prompt describes a PROPOSED change, fix plan, RFC, ticket-body amendment, or about-to-be-made edit — the change is not yet on disk by design. Recognition signals (any one is sufficient): the prompt uses words like "proposed", "plan to", "about to", "PRE-EDIT", "PRE-EDIT alignment gate"; the prompt names the to-be-edited files but the edits are described in prose not yet applied; the prompt is an AFK orchestrator iter dispatch implementing a `## Fix Strategy` against a problem ticket; the prompt is a SKILL handing you an RFC body or story body before the implementation commit lands.
|
|
29
|
+
|
|
30
|
+
In pre-edit mode:
|
|
31
|
+
|
|
32
|
+
- If you receive a review request describing PROPOSED changes (not-yet-applied), classify alignment of the PROPOSAL itself. Not-yet-applied state of the proposed change is the EXPECTED baseline of a pre-edit gate. Do NOT treat "edits aren't applied yet" / "the residual old state is still live" / "the change isn't on disk yet" as ISSUES FOUND — that is the gate's design intent (P313 closes this catch-22).
|
|
33
|
+
- The ground truth you classify against is the **proposal** as described in the calling prompt (the diff sketch, the fix-strategy prose, the file-edit plan). The disk state is the legitimate "old state" the proposal is about to replace — including any JTBD policy file the proposal itself amends. A re-review fired by a `human-oversight: <state>` marker that invalidated because the JTBD policy changed in this session MUST classify the proposal that re-amends the policy, NOT withhold PASS because the prior policy text is still live on disk.
|
|
34
|
+
- PASS the review when the proposal aligns with documented jobs and the primary persona, the proposal does not introduce an undocumented user flow, and (where applicable) any cited persona/JTBD is ratified. ISSUES FOUND / JOB UPDATE NEEDED / PERSONA UPDATE NEEDED on a pre-edit review must cite a problem with the **proposal**, not with the not-yet-applied-ness of the proposal.
|
|
35
|
+
- All other review machinery below (Job Alignment, Persona Fit, Screen Mapping, API / Action Alignment, Unratified Dependency) applies normally — pre-edit mode does not relax any of those substantive checks. It constrains only the verdict-grammar around the not-yet-applied baseline.
|
|
36
|
+
|
|
37
|
+
**Post-edit mode (the explicit alignment-review or applied-change review).** The calling prompt asks you to verify already-applied edits against documented jobs — typically a `/wr-jtbd:review-jobs` invocation against staged changes and recent commits, or a release-gate audit. Recognition signals: the prompt names "staged changes", "recent commits", "the current diff", "verify alignment", or "review the applied changes against documented jobs". In post-edit mode you may flag drift between disk state and JTBD docs exactly as the original verdict grammar describes — the change is on disk by construction; the not-yet-applied carve-out does not apply.
|
|
38
|
+
|
|
39
|
+
**Default when ambiguous.** When the calling prompt does not name the mode explicitly, default to **pre-edit mode** if a PreToolUse gate context is plausible (the prompt was likely fired by `jtbd-detect.sh` or an AFK iter dispatch). The pre-edit default is the safer fail-mode: a true post-edit drift will still surface as ISSUES FOUND / JOB UPDATE NEEDED on the substance; a true pre-edit proposal mis-classified as post-edit fires the P313 catch-22.
|
|
40
|
+
|
|
24
41
|
## What You Check
|
|
25
42
|
|
|
26
43
|
All review criteria come from the JTBD documentation. Read the docs first and apply them. Typical checks include:
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env bats
|
|
2
|
+
# Doc-lint guard: jtbd agent.md must carry an explicit pre-edit /
|
|
3
|
+
# proposed-change review-mode carve-out so the agent classifies alignment
|
|
4
|
+
# of the PROPOSAL when the calling prompt describes a not-yet-applied
|
|
5
|
+
# change, instead of mis-classifying not-yet-applied state as ISSUES FOUND
|
|
6
|
+
# (P313 catch-22: gate blocks edits; reviewer wants edits done first).
|
|
7
|
+
#
|
|
8
|
+
# tdd-review: structural-permitted (justification: P176 — agent behaviour is
|
|
9
|
+
# prompt-driven with no skill-invocation harness to exercise the verdict
|
|
10
|
+
# behaviourally; ADR-052 Surface 2 structural-justified case, NOT an ADR-005
|
|
11
|
+
# Permitted Exception — ADR-052 narrows ADR-005 to exclude prose-doc greps).
|
|
12
|
+
# When P176 lands, upgrade to a behavioural test that feeds the agent a
|
|
13
|
+
# pre-edit proposal and asserts the PASS verdict.
|
|
14
|
+
#
|
|
15
|
+
# Cross-reference:
|
|
16
|
+
# P313 (Pre-edit governance-gate catch-22 — pass withheld pending edits)
|
|
17
|
+
# ADR-052 Surface 2 (structural-justified verdict) + P176 (harness gap)
|
|
18
|
+
# @jtbd JTBD-001 (Enforce Governance Without Slowing Down)
|
|
19
|
+
|
|
20
|
+
setup() {
|
|
21
|
+
AGENT_DIR="$(cd "$(dirname "$BATS_TEST_FILENAME")/.." && pwd)"
|
|
22
|
+
AGENT_FILE="${AGENT_DIR}/agent.md"
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@test "agent.md carries a Review Mode section distinguishing pre-edit from post-edit (P313)" {
|
|
26
|
+
run grep -nE "^## Review Mode: Pre-edit / proposed-change vs\. Post-edit / applied" "$AGENT_FILE"
|
|
27
|
+
[ "$status" -eq 0 ]
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@test "agent.md classifies alignment of the PROPOSAL in pre-edit mode (P313 verbatim core sentence)" {
|
|
31
|
+
run grep -nE "classify alignment of the PROPOSAL itself" "$AGENT_FILE"
|
|
32
|
+
[ "$status" -eq 0 ]
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@test "agent.md treats not-yet-applied state as the EXPECTED baseline of a pre-edit gate (P313)" {
|
|
36
|
+
run grep -nE "EXPECTED baseline of a pre-edit gate" "$AGENT_FILE"
|
|
37
|
+
[ "$status" -eq 0 ]
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@test "agent.md explicitly rejects 'edits aren't applied yet' as a valid ISSUES FOUND substance (P313)" {
|
|
41
|
+
run grep -nE "Do NOT treat .edits aren't applied yet" "$AGENT_FILE"
|
|
42
|
+
[ "$status" -eq 0 ]
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@test "agent.md cites P313 as the catch-22 closure (audit-trail)" {
|
|
46
|
+
run grep -nE "P313" "$AGENT_FILE"
|
|
47
|
+
[ "$status" -eq 0 ]
|
|
48
|
+
}
|
|
@@ -21,25 +21,25 @@ teardown() {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
@test "eval: scope text mentions problem files exemption (P029)" {
|
|
24
|
-
run bash "$HOOK"
|
|
24
|
+
run bash "$HOOK" </dev/null
|
|
25
25
|
[ "$status" -eq 0 ]
|
|
26
26
|
[[ "$output" == *"docs/problems/"* ]] || [[ "$output" == *"problem tickets"* ]]
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
@test "eval: scope text mentions BRIEFING.md exemption (P029)" {
|
|
30
|
-
run bash "$HOOK"
|
|
30
|
+
run bash "$HOOK" </dev/null
|
|
31
31
|
[ "$status" -eq 0 ]
|
|
32
32
|
[[ "$output" == *"BRIEFING"* ]]
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
@test "eval: scope text mentions docs/briefing/ exemption (P100)" {
|
|
36
|
-
run bash "$HOOK"
|
|
36
|
+
run bash "$HOOK" </dev/null
|
|
37
37
|
[ "$status" -eq 0 ]
|
|
38
38
|
[[ "$output" == *"docs/briefing/"* ]]
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
@test "eval: scope text mentions RISK-POLICY exemption (P029)" {
|
|
42
|
-
run bash "$HOOK"
|
|
42
|
+
run bash "$HOOK" </dev/null
|
|
43
43
|
[ "$status" -eq 0 ]
|
|
44
44
|
[[ "$output" == *"RISK-POLICY"* ]]
|
|
45
45
|
}
|
|
@@ -19,7 +19,7 @@ teardown() {
|
|
|
19
19
|
|
|
20
20
|
@test "eval: suggests update-guide when docs/jtbd/ missing (no UI files)" {
|
|
21
21
|
# No UI files, no docs — should still suggest
|
|
22
|
-
run bash "$HOOK"
|
|
22
|
+
run bash "$HOOK" </dev/null
|
|
23
23
|
[ "$status" -eq 0 ]
|
|
24
24
|
[[ "$output" == *"wr-jtbd:update-guide"* ]]
|
|
25
25
|
}
|
|
@@ -27,7 +27,7 @@ teardown() {
|
|
|
27
27
|
@test "eval: suggests update-guide when docs/jtbd/ missing (with UI files)" {
|
|
28
28
|
mkdir -p src
|
|
29
29
|
touch src/App.tsx
|
|
30
|
-
run bash "$HOOK"
|
|
30
|
+
run bash "$HOOK" </dev/null
|
|
31
31
|
[ "$status" -eq 0 ]
|
|
32
32
|
[[ "$output" == *"wr-jtbd:update-guide"* ]]
|
|
33
33
|
}
|
|
@@ -35,7 +35,7 @@ teardown() {
|
|
|
35
35
|
@test "eval: injects enforcement when docs/jtbd/README.md exists" {
|
|
36
36
|
mkdir -p docs/jtbd
|
|
37
37
|
echo "# Index" > docs/jtbd/README.md
|
|
38
|
-
run bash "$HOOK"
|
|
38
|
+
run bash "$HOOK" </dev/null
|
|
39
39
|
[ "$status" -eq 0 ]
|
|
40
40
|
[[ "$output" == *"MANDATORY JTBD CHECK"* ]]
|
|
41
41
|
}
|
|
@@ -46,7 +46,7 @@ teardown() {
|
|
|
46
46
|
# migrates into the directory layout.
|
|
47
47
|
mkdir -p docs
|
|
48
48
|
echo "# Jobs" > docs/JOBS_TO_BE_DONE.md
|
|
49
|
-
run bash "$HOOK"
|
|
49
|
+
run bash "$HOOK" </dev/null
|
|
50
50
|
[ "$status" -eq 0 ]
|
|
51
51
|
[[ "$output" != *"MANDATORY JTBD CHECK"* ]]
|
|
52
52
|
[[ "$output" == *"wr-jtbd:update-guide"* ]]
|
|
@@ -56,14 +56,14 @@ teardown() {
|
|
|
56
56
|
mkdir -p docs/jtbd
|
|
57
57
|
echo "# Index" > docs/jtbd/README.md
|
|
58
58
|
echo "# Jobs" > docs/JOBS_TO_BE_DONE.md
|
|
59
|
-
run bash "$HOOK"
|
|
59
|
+
run bash "$HOOK" </dev/null
|
|
60
60
|
[ "$status" -eq 0 ]
|
|
61
61
|
[[ "$output" == *"docs/jtbd"* ]]
|
|
62
62
|
[[ "$output" == *"MANDATORY JTBD CHECK"* ]]
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
@test "eval: does not reference UI-only scoping in output" {
|
|
66
|
-
run bash "$HOOK"
|
|
66
|
+
run bash "$HOOK" </dev/null
|
|
67
67
|
[ "$status" -eq 0 ]
|
|
68
68
|
[[ "$output" != *"UI files"* ]]
|
|
69
69
|
}
|