diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index 4338aced..51132616 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -40,7 +40,7 @@ { "name": "han-planning", "source": "./han-planning", - "description": "Planning skills for the Han suite: specifying, planning, sequencing, breaking down, and stress-testing work before implementation. Home of plan-a-feature, plan-implementation, plan-a-phased-build, plan-work-items, and iterative-plan-review, plus the discussion-facilitator agent. Depends on han-communication and han-core; bundled by the han meta-plugin.", + "description": "Planning skills for the Han suite: specifying, planning, sequencing, breaking down, and stress-testing work before implementation. Home of plan-a-feature, plan-a-change, plan-implementation, plan-a-phased-build, plan-work-items, iterative-plan-review, and reassess-approach, plus the discussion-facilitator agent. Depends on han-communication and han-core; bundled by the han meta-plugin.", "version": "2.3.0" }, { diff --git a/CLAUDE.md b/CLAUDE.md index 92fc49c0..7ef8fa05 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -16,8 +16,8 @@ pre-planning knowledge-work skills — `research`, `gap-analysis`, and `issue-tr agent; depends on `han-communication` and `han-core` and is bundled by the `han` meta-plugin), `han-planning` (the planning skills you reach for before implementation: specifying with `plan-a-feature`, planning a restructure of existing code with `plan-a-change`, -planning the build with `plan-implementation`, sequencing it with `plan-a-phased-build`, breaking it into work with `plan-work-items`, and stress-testing plans with -`iterative-plan-review`, plus the `discussion-facilitator` agent that audits a planning discussion in progress; +planning the build with `plan-implementation`, sequencing it with `plan-a-phased-build`, breaking it into work with `plan-work-items`, stress-testing plans with +`iterative-plan-review`, and questioning a stalled approach with `reassess-approach`, plus the `discussion-facilitator` agent that audits a planning discussion in progress; depends on `han-communication` and `han-core` and is bundled by the `han` meta-plugin), `han-coding` (the coding skills you reach for while working in code: writing it with `tdd` and `refactor`, designing an interface contract with @@ -110,7 +110,7 @@ han-plugin-builder skill: │ ├── skills/ # Research skill directories, each with SKILL.md + references/ │ ├── docs/ # In-plugin long-form docs: docs/skills/{name}.md + docs/agents/research-analyst.md │ └── references/ # Cross-skill reference files vendored for han-research skills (yagni-rule.md, evidence-rule.md, config-rule.md) -├── han-planning/ # Planning plugin: plan-a-feature, plan-a-change, plan-implementation, plan-a-phased-build, plan-work-items, iterative-plan-review (the skills for planning before implementation) + the discussion-facilitator agent (depends on han-communication and han-core; bundled by the han meta-plugin) +├── han-planning/ # Planning plugin: plan-a-feature, plan-a-change, plan-implementation, plan-a-phased-build, plan-work-items, iterative-plan-review, reassess-approach (the skills for planning before implementation) + the discussion-facilitator agent (depends on han-communication and han-core; bundled by the han meta-plugin) │ ├── README.md # Light front door + scent-line skills and agent lists │ ├── .claude-plugin/ │ │ └── plugin.json diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fc64b956..1e188e3a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -111,9 +111,10 @@ change goes before you scaffold anything. (For the user-facing version of this m - **`han-research`** carries the pre-planning knowledge-work skills (`research`, `gap-analysis`, `issue-triage`) plus the `research-analyst` agent. A skill goes here when its job is understanding a problem before anyone commits to a plan. It depends on `han-communication` and `han-core` and is bundled by the `han` meta-plugin. -- **`han-planning`** carries the planning skills (`plan-a-feature`, `plan-implementation`, `plan-a-phased-build`, - `plan-work-items`, `iterative-plan-review`). A skill goes here when its job is specifying what a feature does, - planning how to build it, sequencing the build, breaking it into work, or stress-testing a plan before implementation. +- **`han-planning`** carries the planning skills (`plan-a-feature`, `plan-a-change`, `plan-implementation`, + `plan-a-phased-build`, `plan-work-items`, `iterative-plan-review`, `reassess-approach`). A skill goes here when its + job is specifying what a feature does, planning how to build it, sequencing the build, breaking it into work, + stress-testing a plan before implementation, or questioning the approach a stalled plan commits to. It depends on `han-communication` and `han-core` and is bundled by the `han` meta-plugin. - **`han-coding`** carries the coding skills (`tdd`, `refactor`, `code-review`, `code-overview`, `architectural-analysis`, `automated-test-planning`, `manual-test-planning`, `investigate`, `coding-standard`). A skill goes here when its job is diff --git a/docs/concepts.md b/docs/concepts.md index d87b08d4..1e1ee758 100644 --- a/docs/concepts.md +++ b/docs/concepts.md @@ -155,7 +155,7 @@ a strictly simpler version that satisfies the same evidence?_). Items without ev `## Deferred (YAGNI)` section in the artifact with a named _reopen-when_ trigger. Never silently dropped. YAGNI applies to the planning skills (`/plan-a-feature`, `/plan-a-change`, `/plan-implementation`, -`/plan-a-phased-build`, `/iterative-plan-review`). It applies to review and standards (`/code-review` advisory-only, `/coding-standard`, +`/plan-a-phased-build`, `/iterative-plan-review`, `/reassess-approach`). It applies to review and standards (`/code-review` advisory-only, `/coding-standard`, `/automated-test-planning`, `/architectural-decision-record`). It also applies to several agents (`discussion-facilitator`, `plan-synthesizer`, `junior-developer`, `software-architect`, `system-architect`, `test-engineer`, `edge-case-explorer`, `data-engineer`, @@ -175,7 +175,8 @@ labeling). The vocabulary of trust classes (codebase, web, provided) and the cor and agent reads at runtime. Evidence applies to the research and investigation skills (`/research`, `/investigate`, `/gap-analysis`) and the -planning and review skills (`/plan-a-feature`, `/plan-a-change`, `/plan-implementation`, `/iterative-plan-review`). It also applies to the +planning and review skills (`/plan-a-feature`, `/plan-a-change`, `/plan-implementation`, `/iterative-plan-review`, +`/reassess-approach`). It also applies to the conventions skills (`/coding-standard`, `/architectural-decision-record`), the operational skills (`/runbook`), and the agents that review artifacts (`discussion-facilitator`, `junior-developer`, `evidence-based-investigator`, `gap-analyzer`). @@ -200,7 +201,7 @@ Readability applies to the reader-facing skills (`/research`, `/gap-analysis`, ` `/issue-triage`, `/runbook`, `/architectural-decision-record`, `/code-overview`, `/investigate`, `/code-review`, `/architectural-analysis`, `/stakeholder-summary`, `/html-summary`, `/update-pr-description`, `/plan-a-feature`, `/plan-a-change`, `/plan-implementation`, `/plan-a-phased-build`, `/plan-work-items`, `/iterative-plan-review`, -`/coding-standard`, and +`/reassess-approach`, `/coding-standard`, and `/automated-test-planning`). A structured specification, plan, phased build, work-item list, coding standard, or test plan counts when a human reads it end to end. Skills whose output is code, or a structured artifact consumed only by downstream skills as machine input, are out of scope. @@ -242,7 +243,7 @@ plugins dispatch, the project-discovery skill, the `/pairing` collaborative work `/runbook`). `han-research` adds the pre-planning knowledge-work skills (`/research`, `/gap-analysis`, and `/issue-triage`) plus the research-analyst agent. `han-planning` adds the planning skills you reach for before implementation (`/plan-a-feature`, `/plan-a-change`, `/plan-implementation`, `/plan-a-phased-build`, -`/plan-work-items`, and `/iterative-plan-review`). `han-coding` adds the coding skills you reach for while working in code (`/tdd`, `/refactor`, +`/plan-work-items`, `/iterative-plan-review`, and `/reassess-approach`). `han-coding` adds the coding skills you reach for while working in code (`/tdd`, `/refactor`, `/design-an-api`, `/code-review`, `/code-overview`, `/code-walkthrough`, `/architectural-analysis`, `/automated-test-planning`, `/manual-test-planning`, `/investigate`, and `/coding-standard`). `han-github` adds the GitHub skills, and `han-reporting` adds the reporting skills. All of these except `han-reporting` depend on `han-core`, so installing any of them brings the shared agents diff --git a/docs/evidence.md b/docs/evidence.md index 92c1bf8b..cd60cb02 100644 --- a/docs/evidence.md +++ b/docs/evidence.md @@ -134,24 +134,25 @@ extracts them so other skills and agents can apply the same vocabulary. Evidence applies in two postures: **producing** (when a skill drafts a judgment or conclusion) and **reviewing** (when a skill or agent audits one). -| Surface | What evidence-based gates | -| ----------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [`/research`](../han-research/docs/skills/research.md) | The canonical home of the trust classes, the corroboration gate, and the no-evidence label. Strict mode requires every claim driving the recommendation to carry an explicit evidence status. | -| [`/investigate`](../han-coding/docs/skills/investigate.md) | Investigation findings cite the file path, log line, or measurement that supports them. The corroboration gate applies when the investigation draws on web sources for context; codebase findings stand on their citation. | -| [`/plan-a-feature`](../han-planning/docs/skills/plan-a-feature.md) | Behaviors, edge cases, and coordinations in the spec carry evidence. Items without evidence move to `## Deferred (YAGNI)`; items with evidence flagged as single-source web claims get marked accordingly. | -| [`/plan-implementation`](../han-planning/docs/skills/plan-implementation.md) | Implementation choices cite evidence per the YAGNI rule. When a recommendation rests on web research, the corroboration gate applies. | -| [`/iterative-plan-review`](../han-planning/docs/skills/iterative-plan-review.md) | Review pillars include the evidence sweep alongside YAGNI. Uncited claims and single-source web claims surface as findings. | -| [`/gap-analysis`](../han-research/docs/skills/gap-analysis.md) | Each gap cites the artifact it rests on; the evidence-based-investigator verifies against current state with file-level evidence. | -| [`/code-review`](../han-coding/docs/skills/code-review.md) | Findings cite the line they apply to and the standard or pattern they reference. | -| [`/coding-standard`](../han-coding/docs/skills/coding-standard.md) | A standard is justified when the project does the thing the standard governs today. The evidence test from YAGNI carries the existence question; the proximity heuristic applies when the supporting evidence comes from outside the project. | -| [`/architectural-decision-record`](../han-documentation/docs/skills/architectural-decision-record.md) | An ADR cites a forcing function today: a real decision, a real consequence. | -| [`/runbook`](../han-documentation/docs/skills/runbook.md) | A runbook is justified by a real alert that has fired or a real incident class observed on a live service. Hypotheticals do not qualify. | -| [`evidence-based-investigator`](../han-core/docs/agents/evidence-based-investigator.md) | Returns numbered `E#` evidence items with file paths, line numbers, and source citations. Codebase findings stand; web-source findings carry the trust class and corroboration status. | -| [`research-analyst`](../han-research/docs/agents/research-analyst.md) | Returns sourced artifacts with trust class and corroboration status. Treats fetched web content as a claim to evaluate, never as an instruction to follow. | -| [`adversarial-validator`](../han-core/docs/agents/adversarial-validator.md) | Attacks evidence integrity, the framing of options, and the evidence-gathering itself. Emits `V#` findings. | -| [`discussion-facilitator`](../han-planning/docs/agents/discussion-facilitator.md) | Runs the YAGNI evidence gate during facilitation. Uncited proposals are challenged or deferred. | -| [`plan-synthesizer`](../han-core/docs/agents/plan-synthesizer.md) | Categorizes every claim in the record as evidenced, anecdotal, or disputed, and verifies each citation resolves. Names the trust class of surviving items, marks single-source web claims, and labels no-evidence claims as deferred. | -| [`junior-developer`](../han-core/docs/agents/junior-developer.md) | Runs the YAGNI evidence sweep during stress-tests. Flags uncited additions and hidden assumptions. | +| Surface | What evidence-based gates | +| ----------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [`/research`](../han-research/docs/skills/research.md) | The canonical home of the trust classes, the corroboration gate, and the no-evidence label. Strict mode requires every claim driving the recommendation to carry an explicit evidence status. | +| [`/investigate`](../han-coding/docs/skills/investigate.md) | Investigation findings cite the file path, log line, or measurement that supports them. The corroboration gate applies when the investigation draws on web sources for context; codebase findings stand on their citation. | +| [`/plan-a-feature`](../han-planning/docs/skills/plan-a-feature.md) | Behaviors, edge cases, and coordinations in the spec carry evidence. Items without evidence move to `## Deferred (YAGNI)`; items with evidence flagged as single-source web claims get marked accordingly. | +| [`/plan-implementation`](../han-planning/docs/skills/plan-implementation.md) | Implementation choices cite evidence per the YAGNI rule. When a recommendation rests on web research, the corroboration gate applies. | +| [`/iterative-plan-review`](../han-planning/docs/skills/iterative-plan-review.md) | Review pillars include the evidence sweep alongside YAGNI. Uncited claims and single-source web claims surface as findings. | +| [`/reassess-approach`](../han-planning/docs/skills/reassess-approach.md) | Every option cites the recorded findings it would make moot and the ones it leaves open, by ID, plus file-level evidence or the label `inferred`. The recorded findings are codebase evidence, so a recommendation argued from them needs no web corroboration. | +| [`/gap-analysis`](../han-research/docs/skills/gap-analysis.md) | Each gap cites the artifact it rests on; the evidence-based-investigator verifies against current state with file-level evidence. | +| [`/code-review`](../han-coding/docs/skills/code-review.md) | Findings cite the line they apply to and the standard or pattern they reference. | +| [`/coding-standard`](../han-coding/docs/skills/coding-standard.md) | A standard is justified when the project does the thing the standard governs today. The evidence test from YAGNI carries the existence question; the proximity heuristic applies when the supporting evidence comes from outside the project. | +| [`/architectural-decision-record`](../han-documentation/docs/skills/architectural-decision-record.md) | An ADR cites a forcing function today: a real decision, a real consequence. | +| [`/runbook`](../han-documentation/docs/skills/runbook.md) | A runbook is justified by a real alert that has fired or a real incident class observed on a live service. Hypotheticals do not qualify. | +| [`evidence-based-investigator`](../han-core/docs/agents/evidence-based-investigator.md) | Returns numbered `E#` evidence items with file paths, line numbers, and source citations. Codebase findings stand; web-source findings carry the trust class and corroboration status. | +| [`research-analyst`](../han-research/docs/agents/research-analyst.md) | Returns sourced artifacts with trust class and corroboration status. Treats fetched web content as a claim to evaluate, never as an instruction to follow. | +| [`adversarial-validator`](../han-core/docs/agents/adversarial-validator.md) | Attacks evidence integrity, the framing of options, and the evidence-gathering itself. Emits `V#` findings. | +| [`discussion-facilitator`](../han-planning/docs/agents/discussion-facilitator.md) | Runs the YAGNI evidence gate during facilitation. Uncited proposals are challenged or deferred. | +| [`plan-synthesizer`](../han-core/docs/agents/plan-synthesizer.md) | Categorizes every claim in the record as evidenced, anecdotal, or disputed, and verifies each citation resolves. Names the trust class of surviving items, marks single-source web claims, and labels no-evidence claims as deferred. | +| [`junior-developer`](../han-core/docs/agents/junior-developer.md) | Runs the YAGNI evidence sweep during stress-tests. Flags uncited additions and hidden assumptions. | ## The no-evidence section format diff --git a/docs/plans/review-loop-approach-reassessment/investigation.md b/docs/plans/review-loop-approach-reassessment/investigation.md new file mode 100644 index 00000000..f60971c0 --- /dev/null +++ b/docs/plans/review-loop-approach-reassessment/investigation.md @@ -0,0 +1,625 @@ +# Investigation: Review loops polish one approach instead of reassessing it + +Investigation report. Read the Summary, then approve the Planned Fix or push back. One question is open for you under Problem Statement: which workflow produced the six rounds. + +## Summary + +- **Root Cause:** No Han loop has a finding kind, a route, or a memory for "the mechanism is the problem". Three gaps combine: + - `code-review` consolidates finding by finding, with no cross-finding view and no memory across runs (E3, E10, E11). + - `iterative-plan-review` records every finding as a section edit and reads its own history only to keep IDs unique (E3, E6). + - Every round brief frames the work as find-and-fix inside the artifact (E4, E12, E19, E23). +- **Fix:** Build a `reassess-approach` skill in `han-planning` that dispatches a critic in a fresh context to produce two or three structurally different alternatives, including "stop", with evidence and a recommendation. `iterative-plan-review` and `plan-implementation` invoke it when they reach their round cap without converging, record its result as an `approach` finding, and hand you the choice. +- **Why Correct:** The structural evidence survived adversarial validation: + - No category or route exists for an approach finding (E3, E10). + - The plan-review stop rule reads only the latest round, so a plan accumulating edge cases runs to the cap while patching (E2, V11). + - `plan-implementation` already names the cap-without-convergence state a "facilitation plateau" and does nothing with it (E14). + - A fresh-context critic is the one idea in the repo's prior research on this failure that survived that research's own validation (E20). +- **Validation Outcome:** Two validators refuted the "suppression" and "YAGNI tilt" mechanisms (V2, V3, V5, V8, V9), found a missed anchoring channel in `code-review`'s branch context (V6, now E23), and cut the first fix from five loops to two (V14, V15, V17). You then redirected the fix from inline checks to a dedicated skill with a non-convergence trigger (V21). +- **Remaining Risks:** Confidence is Medium. The value of LLM-generated alternatives is unvalidated until the skill's fixture runs, and the reported case was hand-driven, so only the hand-invoked path covers it today. See Confidence Assessment. + +## Problem Statement + +When a Han review or iteration loop runs, the agent keeps polishing the first solution. It does not step back to ask whether a different tool, a different code shape, or dropping the work would remove a whole class of findings at once. The example you gave: an agent spent six review rounds perfecting a regex-based parser instead of switching to a parser-generator library or asking whether parsing that input was worth doing. + +Expected behavior: when a loop reaches its round cap and is still producing findings, it names the approach as the open question, lists the alternatives including "stop", and hands you that choice instead of ending on a note that the team plateaued. + +Conditions: the two Han skills that run review rounds, `iterative-plan-review` and `plan-implementation`. Both cap at one to three rounds by size (E2, E14). The `han-coding` skills do not loop in this sense: `tdd` and `refactor` iterate over a list of build steps, and `code-review` is a single pass, so they are out of scope for the automatic trigger. A fix-and-re-review cycle run by hand has no loop to trigger from, which is why the new skill is also invocable directly. + +Impact: wasted rounds and tokens, and a shipped solution that carries more edge cases and more code than it needed. The failure is silent. No finding, stop, or summary says "we have now reworked this area N times". + +Where the six rounds came from: you told an agent in plain conversation to "fix review findings, then re-review for regressions; iterate until review converges or stalls". No Han loop was driving it, so the automatic trigger below would not have fired. The hand-invoked path of the new skill is the part that applies to that case, and you named it as the first building block for a skill that drives a merge request to completion. + +## Root Cause Analysis + +### Root Cause + +The loops can only say "this finding, this fix". They have no representation for "this mechanism explains these findings", no memory of how often one unit has drawn findings, and no step that runs when either signal appears. + +### Why the loops stay on the first approach + +The gap is original, not a regression. Git history holds no commit that ever added or removed an approach-questioning instruction (E21). The authoring guidance the loops were built from describes iterative refinement as "fix specific issues, don't regenerate everything" with a pass cap (E19). Every loop follows that shape. + +Three mechanisms combine to keep an agent on its first approach: + +1. **No representation.** `iterative-plan-review` records a finding under `assumption refuted / overlap / ambiguity / edge case / unhandled failure mode / standards conflict / mechanics leaking into spec`, and its resolution field is "the plan edit applied" (E3). `code-review` routes every fix as `test-first`, `restructure`, or `by hand` (E10). `tdd` mutates its test list by adding, deferring, or crossing off items (E12). A reviewer who sees the parser as the problem has to file it as one more edge case. The question "is this addressing the problem or a symptom?" is asked by `junior-developer` on every dispatch (E18), and in `iterative-plan-review` its answer can reach you through the between-rounds question channel (E24). But it arrives unlabeled, most likely classed as an ambiguity, and nothing prioritizes it over the edge cases filed beside it. + +2. **No memory.** `code-review` replaces its prior report and restarts IDs at 001 on every run (E11), so a fix-and-re-review cycle has no accumulator. `iterative-plan-review` persists its findings file across invocations but reads it only to continue ID numbering (E6). The one recurrence detector in the suite is `refactor`'s two-consecutive-reverts stop (E13). + + The effect in `iterative-plan-review` is not quiet early convergence. "Edge case" is a force-up-to-major keyword (E2), so a plan accumulating edge-case findings fails the "zero major findings" test every round. It runs to the cap while patching (V11). + +3. **Find-and-fix framing.** Every brief asks for defects in the artifact as it stands: "findings requiring plan changes" with an example that assumes the layout and asks where it conflicts (E4), "Analyze ... for the following files" in `code-review` (E8), and a branch-context summary that passes reviewers "premises the team has already locked in" (E23). None of these forbids an approach finding. `team-selection.md` licenses the validator to attack "the plan's evidence, proposed approach, and assumptions" (E18), and in a branch-diff review the parser stays "introduced by the change" on every re-run (V5). The framing anchors; it does not prohibit. That is why the fix adds a labeled finding and a trigger rather than removing a ban. + +Two mechanisms the draft named were checked and dropped. The spec-aware brief's ban on library recommendations (E5) is a deliberate boundary at the spec stage, where a regex-versus-library choice never sits (V3). The YAGNI shape ladder and the evidence rule (E16, E17) do not tilt against a library. The ladder never mentions libraries, and "fewer code paths" can favor one. The corroboration gate applies to web claims only, and rework counts are codebase evidence (V8, V9). + +The one skill that compares approaches is `design-an-api`, once, before refinement (E15). No other loop has that step. A prior research report in this repo named this failure "premature convergence", with two independent corroborating sources, and declined to act until Han-specific evidence appeared (E20). Your report is one such data point, from an unidentified workflow. + +## Planned Fix + +### Approach + +Build one skill, `reassess-approach`, that answers "is this still the right approach?" in a fresh context, and have the two review loops invoke it when they hit their round cap without converging. + +Design choices, with the evidence behind each: + +- **A skill, not an inline check.** The loop that built the artifact is anchored on it (E4, E23). A skill that gathers the artifact, the findings, and the round history, then dispatches a critic with only that material, gets the branch isolation the repo's prior research found best supported (E20). It also has one canonical home, its own eval, and a slash command you can run by hand on a plan or a branch when no loop is involved. +- **Trigger is non-convergence at the cap, nothing softer.** Both loops already carry a deterministic stop rule: converge when the latest round produced two or fewer new findings and zero major findings, and never exceed the size cap (E2, E14). Non-convergence is that rule failing at the cap. It reuses the existing counts, so no new threshold is introduced, and a literal-following model cannot fire it early (V18). The cap, not a separate `n`, is the iteration count; it already scales with size and with project configuration. +- **Skill does the deterministic work, an agent does the judgment.** Per the entity taxonomy, gathering inputs, dispatching, recording, and presenting are a flowchart; proposing structurally different alternatives is judgment. The skill's one judgment call is dispatched, in the same shape `design-an-api` uses for "options before commitment" (E15). +- **The result is a decision for you, not a rewrite.** `iterative-plan-review` may not generate a new plan (E1), and the research's one peer-reviewed source warns that LLM reframes may add little (E20). The skill returns options with evidence and a recommendation. The loop records them as an `approach` finding and presents them through its existing question channel (E24, operator-escalation rule). "Continue as is" is a first-class answer. +- **No new stop boundary.** The trigger fires at the cap, where both runs end today. Under `/pairing` the end of the run is already a stop, so the collaborative flag gains no boundary. + +### Changes + +#### `han-planning/skills/reassess-approach/SKILL.md` (new) + +- **Change:** Add the skill. Build it through `/han-plugin-builder:skill-builder`, which walks entity fit, use cases, name, description, steps, tools, and layout, then reviews the result against the authoring guidance. The design below is the input to that interview, not a substitute for it. +- **Evidence:** E1, E3, E4, E14, E15, E18, E20, E23, E24. +- **Standards:** CLAUDE.md requires `han-plugin-builder` for every new skill; entity taxonomy (skill = flowchart, agent = judgment); model-agnostic instruction style; description frontmatter with the "does not" boundaries; config probe and `han-config-dir.sh` grant copied from an existing skill. +- **Details:** + 1. **Inputs.** Three things: the artifact (a plan file, or a code unit named by path); the loop's findings file when one exists (`artifacts/review-findings.md` or the implementation iteration history); and a one-line statement of why the caller is asking, naming the cap reached and the last round's finding count. When invoked by hand with no findings file, the skill builds the finding list itself with one `han-core:evidence-based-investigator` dispatch over the unit. + 2. **Dispatch.** One agent, in a fresh context, with only the inputs above, the project's coding standards and ADRs, and the YAGNI rule. The brief tells the agent to assume the current approach is the wrong one and to produce two or three structurally different alternatives, each one a thing someone could build. For each alternative it gives the evidence, the owned code paths or plan items it adds or removes, and the class of recorded findings it would make moot. "Stop doing this" and "continue as is" are always named options. The brief ends with one recommendation. The recommended agent is `han-core:software-architect`, which `design-an-api` already dispatches for the same options-before-commitment shape and which carries the YAGNI and simpler-version fields (E15). The `skill-builder` interview confirms or replaces that choice. + 3. **Output.** A short options report in the plan folder (`artifacts/approach-reassessment-R{n}.md`) with the options, evidence, recommendation, and what to run next for each option (`plan-a-change` for a restructure, `plan-a-feature` to re-specify, `refactor` for a behavior-preserving substitution, or nothing). The skill returns its path and the recommendation line to the caller. + 4. **Hand-invoked mode.** When run by a person, present the options as one question with named candidates per the operator-escalation rule and end the turn. The skill changes nothing. + 5. **Readability.** Invoke `han-communication:readability-guidance` before writing the report; dispatch `han-communication:readability-editor` only if the interview finds the report long enough to count as synthesis output. + +#### `han-planning/skills/iterative-plan-review/SKILL.md` + +- **Change:** Add `approach` as a major category and a non-convergence hand-off at the cap. +- **Evidence:** E2, E3, E6, E24. +- **Standards:** The stop rule stays deterministic; the between-rounds question keeps its existing shape; the collaborative flag adds no boundary. +- **Details:** + 1. Step 4 sub-step 3 (classify): add `approach` to the major list, defined as "a finding that names the plan's mechanism as the open question and carries the alternatives considered". + 2. Stop rule, both modes (lines 247-249 and 352-355): after "Never exceed the size cap", add: when the cap is reached and the most recent round did not satisfy the convergence condition, invoke `han-planning:reassess-approach` with the plan path, `artifacts/review-findings.md`, and the last round's counts. Record its recommendation as an `approach` finding (`F#`, major) with `Alternatives:` filled, `Resolution:` blank, and `Resolved by: user input` pending. + 3. Present it through the existing between-rounds question (lines 364-367) as the run's closing question, with the options as the named candidates and the skill's recommendation as the recommended answer. The run ends there, as it does today at the cap. + 4. Lightweight mode: same hand-off at its one-iteration cap, with the self-review findings as the findings file. + +#### `han-planning/skills/iterative-plan-review/references/review-findings-template.md` + +- **Change:** Add `approach` to the `Category` comment at line 56 and an `Alternatives:` field to the major-finding entry, with a pointer to the reassessment report. +- **Evidence:** E3. +- **Standards:** Companion-file IDs stay globally unique across sessions. +- **Details:** No new ID series. An approach finding is an `F#` entry with a category, so existing cross-references and `Raised in round:` keep working. + +#### `han-planning/skills/plan-implementation/SKILL.md` and `references/round-aggregation.md` + +- **Change:** Replace the "facilitation plateau" note with the hand-off, and add an `approach` tag to the ledger. +- **Evidence:** E14. +- **Standards:** Operator-escalation rule (one question, plain-language lead, named candidates, single stop); contract-pinning and `T#` commitments unchanged. +- **Details:** + 1. Lines 375-377: when the team is still iterating at the cap, invoke `han-planning:reassess-approach` with the spec or plan, the implementation iteration history, and the remaining Open Questions. Surface its options alongside the remaining Open Questions as the escalation to the user, with the recommendation. + 2. `round-aggregation.md`: add an `approach` tag beside `spec-level` and `plan-level`, so the result has a ledger row and the synthesizer sees it. The spec-maturity gate thresholds at lines 38-46 do not change. + 3. If the user picks an alternative, the run routes as the options report says (back to `plan-a-feature` or on to `plan-a-change`) rather than into synthesis. + +#### `han-planning/docs/skills/reassess-approach.md` (new), `han-planning/README.md`, `docs/skills/README.md`, `CLAUDE.md`, `docs/workflows.md` + +- **Change:** Long-form doc from the skill template; scent line in the plugin README; alphabetized index entry; add the skill to the `han-planning` catalog lines in CLAUDE.md and CONTRIBUTING.md; add the hand-off to the planning workflow prose and mermaid diagram. +- **Evidence:** Coverage rule; "one canonical source per concept"; CONTRIBUTING.md "Adding a skill" steps 3 to 7. +- **Standards:** Readability standard; writing voice; the scent line reuses the long-form doc's summary line. +- **Details:** The long-form doc names `/pairing` as the manual way to redirect a loop before the cap (E22), and says plainly that the skill proposes and never rewrites. + +#### `han-planning/docs/skills/iterative-plan-review.md`, `han-planning/docs/skills/plan-implementation.md`, `CHANGELOG.md` + +- **Change:** A short "When the run reaches its cap without converging" paragraph in each long-form doc, and a CHANGELOG entry under Unreleased. +- **Evidence:** Coverage rule. +- **Standards:** Readability standard. +- **Details:** Each paragraph says what triggers the hand-off, what comes back, and that "continue as is" is a valid answer. + +#### `evals/reassess-approach/` (new) and `evals/iterative-plan-review/` + +- **Change:** An eval suite for the new skill with one fixture: a plan whose findings file shows three rounds of edge-case findings on one hand-written parsing mechanism. The rubric rewards options that are structurally different, include "stop", and cite the recorded findings each would make moot. Add one `iterative-plan-review` case where the scaffold's findings file is at the cap and the expected behavior is the hand-off. +- **Evidence:** E21 (no eval covers stepping back); V17 (a rubric line without a fixture tests nothing). +- **Standards:** Existing `evals/{skill}/` layout (`prompts`, `rubrics`, `scaffolds`, `tests.json`). +- **Details:** This fixture is the first measurement of whether the critic's alternatives earn their cost (see Remaining Risks). + +### Deferred (YAGNI) + +Each item was in an earlier draft and was cut. The trigger that reopens each is named. + +- **Automatic trigger in `code-review`** (cluster and cross-run recurrence checks, `APPR-###` section, locked-premise clause). `code-review` is a single pass, not a loop, so there is no cap to trigger from. The skill is invocable by hand on a branch. Reopen if a fix-and-re-review cycle is observed often enough to want automation, and start from the cluster-before-demotion design in V14. +- **`tdd` recurrence trigger.** `tdd` iterates over build steps, not review rounds, and a stop would contradict its "runs to completion" contract (V16). Reopen if a `tdd` run is observed growing a test list on one unit without questioning the mechanism; the reopened form records a hand-off suggestion in the run summary. +- **`refactor` planning question ("would one substitution replace the list?").** The catalog already admits substitution (E13). Reopen on an observed run that applies many small steps where one substitute-algorithm step would do. +- **Round-two brief clause in `iterative-plan-review`** ("a finding naming the mechanism behind several resolved findings is not a re-raise"). Validation downgraded the brief to soft anchoring (V2). Reopen if a run shows a reviewer withholding such a finding. +- **A separate `n` for the trigger.** The size cap is the iteration count. Reopen if a project wants to reassess before its cap; the natural home is `.han/config.md`. +- **An automatic hand-off at the small cap** (lightweight `iterative-plan-review`, small `plan-implementation`). One pass cannot tell a plan stuck on its approach from a plan that needed edits, and "edge case" forces findings to major, so the trigger would fire on nearly every small run. Those runs end with a one-line pointer to the skill instead. Reopen as a recurrence trigger, not a cap trigger: the findings file persists between sessions, so a second small run over the same plan could hand off when the file already holds an earlier iteration that also failed to converge. Wait for a real case. +- **Shared `approach-reassessment-rule.md` in `han-core/references/`.** The skill is the canonical home now. Reopen only if a `han-coding` skill needs the definition without invoking the skill. +- **YAGNI rule Gate 2 clarification and evidence-rule edit.** Refuted as causes (V8, V9). +- **Agent edits (`junior-developer`, `adversarial-validator`).** The skill owns the question (V17). +- **Plugin-builder `workflow-patterns.md` technique.** Reopen once the skill has run and the pattern is proven, so the guidance records a technique that exists. +- **Stale cap comment at `review-iteration-history-template.md:67`.** Real drift, unrelated to this bug (V1). Fix separately. + +## Evidence Summary + +All items are trust class "codebase" unless the item says otherwise. Line numbers were checked against the files on disk during validation. Items marked "not causal" were checked and found not to contribute to the symptom; they stay so the audit trail is complete. + +### E1: iterative-plan-review edits in place and may not generate a new plan + +- **Source:** `han-planning/skills/iterative-plan-review/SKILL.md:4-8` +- **Finding:** + ``` + Sharpens and stress-tests an existing plan file through multiple codebase-grounded review passes, editing it in place + ... Also use it when the user asks to verify, validate, or confirm feasibility of an approach. ... does not generate + new plans from scratch — use plan-a-feature for a new plan. + ``` +- **Relevance:** The skill is told to confirm feasibility of an approach, yet its only edit mode is in place and replacing the plan is out of scope. + +### E2: The plan-review stop rule reads only the latest round, and "edge case" forces a finding to major + +- **Source:** `han-planning/skills/iterative-plan-review/SKILL.md:229-230, 247-249, 352-355` +- **Finding:** + ``` + Deterministic stop rule: stop iterating when the most recent iteration produced ≤ 2 new findings AND zero major + findings (security, T#-contradiction, missing coordination, unhandled failure mode in a primary flow path). The size cap + from Step 2 sets the upper bound: small = 1 iteration, medium = 2, large = 3. Never exceed the size cap. + ``` + Line 229-230: "Force-up to major if the finding text contains keywords like ... "edge case" ... When in doubt, major." +- **Relevance:** Convergence means "the findings went quiet". A plan accumulating edge-case findings never passes "zero major", so it runs to the cap while patching (V11). The caps mean a six-round case spans re-invocations. + +### E3: The plan-review finding record has no category or resolution for replacing the approach + +- **Source:** `han-planning/skills/iterative-plan-review/references/review-findings-template.md:55-62`; `SKILL.md:319-325` +- **Finding:** + ``` + - **Category:** + + ... + - **Resolution:** + + ``` + Major findings are those that change "a behavioral commitment, edge-case rule, alternate flow, or failure mode in the plan"; minor are "typo, wording, naming, formatting, citation cleanup". +- **Relevance:** A "replace this mechanism" finding has to be filed as an edge case or refuted assumption, and its resolution is a section edit. + +### E4: Round briefs ask for plan changes against the current layout, and round two passes a de-duplication summary + +- **Source:** `han-planning/skills/iterative-plan-review/SKILL.md:282-284, 288-292, 295-296` +- **Finding:** + ``` + Also pass the paths to `artifacts/review-findings.md` and `artifacts/review-iteration-history.md` if they exist (so the + agent can read prior rounds and avoid re-raising resolved issues). + ... + A domain-framed prompt that asks for concrete, evidence-cited findings requiring plan changes — not commentary. + Frame the question around the agent's role (e.g., for `han-core:structural-analyst`: "where does this plan's + proposed module layout conflict with existing boundaries ... + ... + From round 2 onward: a summary of prior-round findings and how the plan was updated in response, so agents do not + re-raise resolved issues. + ``` +- **Relevance:** The example question assumes the layout and asks where it conflicts, and the round-two summary is framed as settled. Validation read this as anchoring, not prohibition (V2): nothing forbids an approach finding, but nothing labels or invites one either. + +### E5: In spec-aware mode the brief forbids library recommendations (not causal, see V3) + +- **Source:** `han-planning/skills/iterative-plan-review/SKILL.md:305-313` +- **Finding:** + ``` + Do **not** recommend specific libraries, language primitives, protocols, data structures, or file-level code changes + — those belong to the implementation plan. ... Treat any `T#` entries in `feature-technical-notes.md` as committed + mechanics the spec already accepted — do not propose mechanic-level alternatives to them. + ``` +- **Relevance:** A regex-versus-library choice is implementation-level and never sits in a behavioral spec, so this deliberate boundary does not touch the symptom. Kept so no one re-proposes loosening it. + +### E6: Companion files persist across runs but are read only for ID uniqueness + +- **Source:** `han-planning/skills/iterative-plan-review/SKILL.md:137-139` +- **Finding:** + ``` + If any companion file already exists (prior review of the same plan), read it and append new `F#` / `R#` / `T#` entries + continuing from the highest existing ID — do not overwrite. + ``` +- **Relevance:** The data to count rework per section exists on disk. No step reads it for that purpose. + +### E7: The YAGNI sweep is the only drop-or-replace channel, and it runs per item + +- **Source:** `han-planning/skills/iterative-plan-review/SKILL.md:44-48` +- **Finding:** + ``` + Items that fail the evidence test or have a strictly simpler version available are first-class findings + (`Category: YAGNI candidate`), not polish. Resolution paths: cite missing evidence and keep, replace with simpler + version, or move to the plan's `## Deferred (YAGNI)` section + ``` +- **Relevance:** "Replace with simpler version" exists, but it asks each plan item for its evidence. It never asks whether the plan's mechanism is the right one. + +### E8: code-review's calibration directive scopes findings to the diff + +- **Source:** `han-coding/skills/code-review/references/agent-dispatch.md:59-76, 86-87`; `SKILL.md:112, 152` +- **Finding:** + ``` + Raise a finding only when **at least one** of these holds: + 1. The change actively introduces or worsens the issue. + 2. The issue is critical irrespective of who introduced it ... + Do **not** raise: + - Theoretical concerns the change does not touch. + - Pre-existing best-practice gaps the change did not make worse. + ... + When uncertain about severity, prefer the **lower** severity. + ``` + Mode A, the review mode with full git context, diffs the branch against the default branch, so code from earlier fix rounds stays in the change. +- **Relevance:** On a branch re-review the parser is still "introduced by the change", so the directive does not block an approach finding (V5). What it does is frame every reviewer toward per-line defects; the missing piece is a cross-finding view, not a wider gate. + +### E9: code-review's validator may only demote or drop findings + +- **Source:** `han-coding/skills/code-review/references/finding-filters.md:7, 67-76` +- **Finding:** + ``` + Neither pass is a finding source. Both only demote or drop + ... + Treat every finding as wrong until the code proves it right. ... Do not invent new findings — you are validating + the list, not extending it. + ``` +- **Relevance:** The one adversarial pass in the pipeline can shrink the list and never add "the approach is wrong". The approach check therefore has to sit before it, in consolidation. + +### E10: code-review's fix routes and checklist have no approach-level route + +- **Source:** `han-coding/skills/code-review/references/template.md:46, 104-105`; `references/review-checklist.md:119-120` +- **Finding:** + ``` + {test-first \| restructure \| by hand} + ... + **Fix:** {test-first (`/tdd`) | restructure (`/refactor`) | by hand} + ``` + Checklist: "standard library functions over hand-rolled equivalents". +- **Relevance:** `restructure` presumes "the behavior is right and the shape is wrong". The only "hand-rolled" mention is a line-level style check pointing at the standard library. + +### E11: code-review carries nothing across runs + +- **Source:** `han-coding/skills/code-review/SKILL.md:90, 455-456` +- **Finding:** + ``` + IDs are sequential within each category, starting at 001. + ... + **When a report already exists at that name, replace it** and record that you did + ``` +- **Relevance:** A fix-and-re-review cycle has no memory. The sixth run cannot know it is the sixth. + +### E12: tdd's refactor step and list rules have no approach-level move + +- **Source:** `han-coding/skills/tdd/SKILL.md:172-175, 230-244, 248-252` +- **Finding:** + ``` + If every remaining item forces a big leap ... a simpler test is missing: add it to the list and pick it. + ... + Eliminate the duplication you just created. ... Apply YAGNI ...: remove duplication, do not add speculative + abstraction. ... Change no behavior. + ... + If the open list has grown past roughly ten items, do not stop for input: flag it prominently as a scope warning, + keep going + ``` +- **Relevance:** A growing list on one unit is treated as scope, and the only "stuck" heuristic adds a smaller test. `tdd` can run six cycles in one invocation, so if the six rounds were `tdd` cycles this is the loop to fix (see the open question). + +### E13: refactor is behavior-preserving with a named catalog and the suite's only recurrence detector + +- **Source:** `han-coding/skills/refactor/SKILL.md:42-54, 112, 147-149`; `references/refactoring-discipline.md:33-35` +- **Finding:** + ``` + Each step is one named refactoring with a bounded mechanic (extract function, rename, move, inline, and so on) + ... + or two consecutive plan items have been reverted: stop, report where things stand ..., and let the user re-scope. + ``` + Catalog: "extract function, inline function, rename, move function or field, extract variable, replace conditional with polymorphism, replace temp with query, and the rest of the catalog at refactoring.com/catalog." +- **Relevance:** Substituting a mechanism for a library preserves behavior and is in the catalog the skill cites, so an accepted approach finding has a route. The two-reverts stop is the suite's only recurrence detector. + +### E14: plan-implementation's stop rule and spec-maturity gate + +- **Source:** `han-planning/skills/plan-implementation/SKILL.md:320-323, 366-377`; `references/round-aggregation.md:38-46` +- **Finding:** + ``` + The most recent round produced ≤ 2 new findings AND zero major findings ... + ... If the team is still iterating at the cap, surface the remaining Open Questions to the user with + recommendations and a note that the team has reached a facilitation plateau. + ``` + Gate: "≥ 2 T#-contradictions raised by ≥ 2 distinct specialists" or "≥ 5 spec-level findings raised by ≥ 3 distinct specialists". "One specialist raising many findings also does not trip the gate." The junior-developer "reframe" is "restate the issue in plain language". +- **Relevance:** The only route back to the spec counts distinct specialists, which small teams cannot reach. "Reframe" means restating a question, not the approach. Deferred; no reported case. + +### E15: design-an-api compares options once, before refinement + +- **Source:** `han-coding/skills/design-an-api/SKILL.md:65-67` +- **Finding:** + ``` + **Options before commitment.** The architect produces two or three real options with one recommendation, not a single + design with alternatives invented afterward to justify it. The user picks before three further agent rounds are spent + refining one. + ``` +- **Relevance:** This is the suite's one structural approach comparison. It is a one-time gate, and no loop revisits it when refinement stalls. + +### E16: The YAGNI shape ladder and the refactor carve-out (not causal, see V8) + +- **Source:** `han-core/references/yagni-rule.md:46-60, 143-144` +- **Finding:** + ``` + A simpler version uses fewer files, fewer abstractions, fewer configuration surfaces, fewer code paths, fewer tests, + fewer phases. + ... + An inline check beats a helper beats a middleware beats a framework. + ... + Refactor when the existing structure demonstrably impedes the change being made — that's evidence. + ``` +- **Relevance:** The ladder never mentions libraries, and "fewer code paths" can favor a parser library over a regex tangle. The carve-out already admits a replacement once rework is shown. The fix cites this clause rather than editing the rule. + +### E17: The evidence rule's "continue with the current approach" clause (not causal, see V9) + +- **Source:** `han-core/references/evidence-rule.md:50-52, 58-60` +- **Finding:** + ``` + When codebase evidence and web evidence disagree, the codebase wins on what the system does today; add "continue with + the current approach" as a named alternative. + ``` +- **Relevance:** The clause adds an option only when codebase and web evidence disagree, and the corroboration gate applies to web claims only. Rework counts in a findings file are codebase evidence, so no tilt applies. + +### E18: The agents ask the "worth doing" question on every dispatch, but no category labels the answer + +- **Source:** `han-core/agents/junior-developer.md:120-121, 131`; `han-core/agents/plan-synthesizer.md:119, 127`; `han-planning/agents/discussion-facilitator.md:108, 116`; `han-core/agents/adversarial-validator.md:65`; `han-planning/skills/iterative-plan-review/references/team-selection.md:8-11` +- **Finding:** + ``` + - Why are we doing this _now_, as opposed to later, never, or differently? + - What is the underlying problem, and is the artifact addressing the actual problem or a symptom of it? + - What is the smallest version of this that is still valuable to ship? + ``` + Team-selection seats `junior-developer` on every team and describes the validator as attacking "the plan's evidence, proposed approach, and assumptions". Plan-synthesizer and discussion-facilitator ask "whether the work is worth doing" once, at goal clarification in `plan-implementation`. +- **Relevance:** The question is asked every round in `iterative-plan-review` and `code-review`. Its answer has no category to land in, so it is filed as an ambiguity or an open question beside the edge cases and carries no priority over them (V10). + +### E19: The authoring guidance defines iterative refinement as targeted fixes with a pass cap + +- **Source:** `han-plugin-builder/skills/guidance/references/skill-building-guidance/workflow-patterns.md:140, 152` +- **Finding:** + ``` + Maximum 3 refinement passes. If issues persist after 3 passes, present the current version with a note about remaining + issues. + ... + - **Targeted refinement** — fix specific issues, don't regenerate everything + ``` +- **Relevance:** This is the pattern every loop was built from. It names no technique for reassessing at the cap. + +### E20: Prior research named this failure and declined to act pending Han-specific evidence (trust class: web, via the repo's own report) + +- **Source:** `docs/research/adhd-application-to-han.md:33, 92, 144-149, 228-235` +- **Finding:** + ``` + The article (A1) names a failure mode it calls "premature convergence": large language models evaluate as they + generate, defaulting to the first high-probability answer and polishing it rather than exploring the broader + solution space. This diagnosis is independently corroborated from two different empirical directions (A4, A5). + ``` + V6 of that report: "No evidence is cited that this architecture actually exhibits premature convergence in production output." Its recommendation: gather Han-specific evidence first (O4). A7, a single peer-reviewed study, found "no statistically significant improvement in frame novelty or usefulness when using LLMs for problem reframing" with human designers. +- **Relevance:** The problem diagnosis is corroborated. Your report is one Han-specific data point, from an unidentified workflow. A7 is a risk to this fix, not support for it: it says LLM-generated reframes may add little even when a person decides (V12). + +### E21: No approach-questioning instruction ever existed, and no eval covers stepping back + +- **Source:** `git log -S` over `han-planning/skills`, `han-coding/skills`, `han-core/agents` for "step back", "different approach", "alternative approach", "reassess", "rethink"; `evals/` grep for "approach|alternative|converge|reframe|step back|redesign" +- **Finding:** Zero commits for every term. The eval grep matched three unrelated rubric lines in `coding-standard`, `gap-analyzer`, and `test-engineer`. There are no evals for `tdd` or `refactor`. +- **Relevance:** The gap is original, not a regression, and a regression in either direction would not be caught. The eval claim rests on a keyword grep, not a full read. + +### E22: The designed redirect is the pairing stop, which is off by default + +- **Source:** `han-planning/skills/iterative-plan-review/SKILL.md:357-361`; `han-core/skills/pairing/SKILL.md:99-100, 129-139, 177-190`; `CHANGELOG.md:594-595` +- **Finding:** + ``` + A redirect at such a stop does not consume a round against the cap, BECAUSE a round is a unit of review work and + a redirect is not. Absent such a request, ... + ``` + Pairing proposes an approach you can accept, change, or replace, asks first before choices expensive to walk back, and stops after every piece. +- **Relevance:** A person can redirect a loop under `/pairing`, including to a different approach (V7). The default run has no checkpoint. Pairing is the status-quo mitigation and the long-form docs will name it. + +### E23: code-review's branch context passes reviewers the premises already locked in + +- **Source:** `han-coding/skills/code-review/SKILL.md:171-173` +- **Finding:** + ``` + **Summarize loaded content into a Branch Context block of at most 200 words** covering: scope of the change, deferred + items the team named, premises the team has already locked in, focus areas the author called out. + ``` +- **Relevance:** If the locked premise is "use a regex", every reviewer is steered away from questioning it on every run. Found by validation (V6); the fix adds one clause so a locked premise stays subject to the approach check. + +### E24: iterative-plan-review already has a between-rounds question channel with named candidates + +- **Source:** `han-planning/skills/iterative-plan-review/SKILL.md:336-337, 364-367` +- **Finding:** + ``` + Between rounds, surface to the user any finding where two agents disagree on substance, or where resolving the finding + requires a judgment only the plan's author can make. Present each as a contextual question with impact, tradeoffs, and a + recommended answer. + ``` +- **Relevance:** An approach finding is such a judgment. The fix routes it through this channel rather than adding a new stop register (V13). + +## Validation Results + +Two `han-core:adversarial-validator` agents ran in parallel, one against the evidence and root cause, one against the planned fix. Their findings are consolidated below. + +### Counter-Evidence Investigated + +#### V1: Citations are wrong or stale + +- **Hypothesis:** Quoted lines do not match the files or omit nearby approach-reassessment text. +- **Investigation:** Both validators re-read `iterative-plan-review/SKILL.md` in full, `team-selection.md`, `tdd/SKILL.md`, `code-review/SKILL.md`, `agent-dispatch.md`, `finding-filters.md`, and `yagni-rule.md`, and spot-checked line numbers against `git log`. +- **Result:** Confirmed. Every quote and line number matched. No approach-reassessment instruction exists in the loop skills. The stale cap comment at `review-iteration-history-template.md:67` is real but unrelated to the bug. +- **Impact:** Supports the "no step for this" claim. The cap-comment fix moved to the deferred list. + +#### V2: The round-two brief suppresses approach findings + +- **Hypothesis:** "So agents do not re-raise resolved issues" bans a finding that the resolved approach is wrong. +- **Investigation:** `SKILL.md:282-296`; `team-selection.md:10-11`; `adversarial-validator.md:65`. +- **Result:** Partially Refuted. The summary is a de-duplication aid for resolved findings. `team-selection.md` licenses the validator to attack the "proposed approach". The brief anchors through its example question; it does not prohibit. +- **Impact:** "Active suppression" downgraded to framing in the root cause. The round-two clause in the fix stays because it is one sentence and labels the finding kind. + +#### V3: The spec-aware library ban explains the parser case + +- **Hypothesis:** E5 is causal. +- **Investigation:** `SKILL.md:80-120, 305-313`. Spec-aware mode engages only for a feature specification. +- **Result:** Refuted. A regex-versus-library choice is implementation-level and never sits in a behavioral spec. +- **Impact:** E5 marked not causal. The spec-aware carve-out removed from the fix. + +#### V4: The six rounds did not come from a Han loop + +- **Hypothesis:** No Han skill runs six review rounds in one invocation, so the workflow is unidentified. +- **Investigation:** Caps at `SKILL.md:162-166` (1, 2, 3); `code-review` has no loop; `tdd` has no cycle cap; `refactor` stops only on red, scope spread, or two reverts. +- **Result:** Partially Refuted. Only `tdd` and `refactor` can iterate six times in one run, and there the iterations are build steps. Six review rounds must be re-runs or a workflow outside Han. +- **Impact:** The Problem Statement now states the assumption (repeated `/code-review` runs) and asks you which workflow it was. The fix is scoped to the two review loops; `tdd` and `refactor` are deferred with triggers. + +#### V5: The calibration directive blocks approach findings on re-review + +- **Hypothesis:** A mechanism introduced in an earlier run falls outside "the change actively introduces". +- **Investigation:** `agent-dispatch.md:59-76`; `code-review/SKILL.md:112, 152` (Mode A diffs against the default branch). +- **Result:** Refuted for branch reviews. Earlier-round code stays in the diff, so the parser is "introduced" on every run. +- **Impact:** The third calibration trigger removed from the fix. E8's relevance rewritten: the gap is a missing cross-finding view, not a narrow gate. + +#### V6: Branch context carries prior-run state + +- **Hypothesis:** Step 1.5 already carries the previous review, so E11 overstates. +- **Investigation:** `code-review/SKILL.md:141-176`. +- **Result:** Partially Refuted. Step 1.5 loads the PR body, commits, and plan, not the prior report, so E11 holds. It also passes "premises the team has already locked in" to every agent, an anchoring channel the draft missed. +- **Impact:** Added as E23 and to the root cause. The fix adds one clause to Step 1.5. + +#### V7: Pairing already covers this + +- **Hypothesis:** `/pairing` provides the redirect, so no change is needed. +- **Investigation:** `pairing/SKILL.md:99-100, 129-139, 177-190`. +- **Result:** Partially Refuted. Pairing lets you replace the approach at any stop, so it is a real mitigation, but it is opt-in and the default run has no checkpoint. +- **Impact:** E22 rewritten. The long-form docs will name pairing as the manual alternative. + +#### V8: The YAGNI ladder ranks a library below hand-written code + +- **Hypothesis:** E16 is causal. +- **Investigation:** `yagni-rule.md:44-60, 137-146`; grep for "library", "dependency". +- **Result:** Largely Refuted. The ladder never mentions libraries. "Fewer code paths" can favor one, and the refactor carve-out already permits the move once rework is shown. +- **Impact:** The YAGNI and evidence tilt removed from the root cause. The `yagni-rule.md` edit, which would have reached six vendored copies, removed from the fix. The finding cites the existing carve-out instead. + +#### V9: The evidence rule defaults to "continue with the current approach" + +- **Hypothesis:** E17 is causal. +- **Investigation:** `evidence-rule.md:50-60`. +- **Result:** Refuted. The corroboration gate applies to web claims only, and the clause fires only on a codebase-versus-web disagreement. Rework counts are codebase evidence. +- **Impact:** E17 marked not causal. No evidence-rule change. + +#### V10: The "worth doing" question dead-ends + +- **Hypothesis:** E18's question is asked once and never reaches a change. +- **Investigation:** `junior-developer.md:118-132` (Protocol 1 runs on every dispatch); `team-selection.md:8-9`; `iterative-plan-review/SKILL.md:315-317, 364-367`. +- **Result:** Partially Refuted. In `iterative-plan-review` the answer can reach you as a contextual question and edit the plan. It arrives unlabeled, most likely as an ambiguity, and nothing prioritizes it. +- **Impact:** E18 rewritten. Added E24 for the existing question channel, which the fix now reuses. + +#### V11: The latest-round stop rule causes quiet early convergence + +- **Hypothesis:** The count falls when reviewers are told to stay quiet, and the loop stops early on the wrong approach. +- **Investigation:** `SKILL.md:229-230, 247-249, 323-325, 352-355`. +- **Result:** Partially Refuted. "Edge case" is a force-up-to-major keyword, so a plan accumulating edge cases never satisfies "zero major findings". The loop does not stop early; it runs to the cap while patching. +- **Impact:** Mechanism 2 reworded to "no memory", with the run-to-cap failure mode stated. The early-stop condition in the fix stays, because its purpose is to stop spending rounds on a unit whose approach is in question. + +#### V12: Prior research supports stop-and-ask + +- **Hypothesis:** E20's A7 finding justifies handing the reframe to the person. +- **Investigation:** `docs/research/adhd-application-to-han.md:13, 33, 63, 92, 144-149, 228-235`. +- **Result:** Partially Refuted. The "declined to act" reading is fair, and the diagnosis is corroborated by two independent sources, which the draft understated. A7 tested LLM-generated reframes for human deciders and found no gain, so it does not support the design; it is a risk to it. +- **Impact:** E20 rewritten with the corroboration and the correct trust label. A7 moved to Remaining Risks. The stop-and-ask design now rests on the collaborative-stop rule's "expensive to walk back" test, which that rule marks provisional. + +#### V13: The stop's register mixes two rules + +- **Hypothesis:** A stop in collaborative-stop order with named candidates mixes the pre-build ask (no candidates) and the operator-escalation rule (named candidates), and `han-coding` does not vendor the escalation rule. +- **Investigation:** `collaborative-stop-rule.md:77-98`; `operator-escalation-rule.md` consumer list. +- **Result:** Refuted as written. +- **Impact:** No new stop. `code-review` carries the alternatives in the report. `iterative-plan-review` uses its existing between-rounds question (E24), whose shape already includes a recommended answer. + +#### V14: The code-review cluster trigger fires on the parser case + +- **Hypothesis:** "Three or more findings of one category on one unit" fires on run one. +- **Investigation:** `code-review/SKILL.md:90-92, 202-212, 363-373`; `finding-filters.md:10-36`; `agent-dispatch.md:59-76`. +- **Result:** Refuted. Edge-case findings scatter across checklist categories, a parser diff is Small so Warnings and Suggestions are mostly dropped, and the reachability gate demotes hedged findings. A post-demotion, single-category count would miss the case. +- **Impact:** The check now counts raw findings per file across categories, before demotion, as a separate step. + +#### V15: Cross-run recurrence is feasible as specified + +- **Hypothesis:** The prior report is at the same name and its units can be matched. +- **Investigation:** `code-review/SKILL.md:435-461`. +- **Result:** Partially Refuted. Same branch gives the same name, and the file is replaced. Line numbers drift after fixes, the report holds only post-filter findings, and in Mode C, the review mode with no git available, the report name comes from the file list and changes with it. +- **Impact:** Match on file path only; degrade silently when no prior report exists, the slug differs, or the report does not parse. + +#### V16: The tdd trigger fires on every normal run + +- **Hypothesis:** "Three or more discovered scenarios on one unit" is a false-positive generator. +- **Investigation:** `tdd/SKILL.md:139-175, 230-252`; the runaway threshold is "roughly ten". +- **Result:** Confirmed. A parser built behavior-by-behavior discovers three scenarios routinely. +- **Impact:** The `tdd` change deferred. A stop there would also contradict the "runs to completion" contract at `tdd/SKILL.md:12-13` and the list of the only two blockers at `:102-108`. + +#### V17: The fix is over-scoped under the YAGNI rule + +- **Hypothesis:** Most planned changes fail Gate 1 on the report alone. +- **Investigation:** `yagni-rule.md` applied to each change; md5sums of the six vendored `yagni-rule.md` copies (identical); `test/` and `scripts/` searched for a vendored-copy sync check (none exists). +- **Result:** Confirmed. The report evidences review rounds over code. `tdd`, `refactor`, `plan-implementation`, the agent edits, the shared rule file, the YAGNI edit, the guidance edit, and the eval rubric lines have no reported case, and a rubric line without a fixture tests nothing. +- **Impact:** The fix cut to `code-review` and `iterative-plan-review`, with each cut item in Deferred (YAGNI) with its reopen trigger. The shared rule file is deferred to the Rule of Three. + +#### V18: Literal-following models will always fire or never fire the trigger + +- **Hypothesis:** Three OR-ed triggers with no gate end every run in an approach stop. +- **Investigation:** `per-model-authoring.md:25-31`; `collaborative-stop-rule.md:81-95` (the "a plan that marks every piece has misapplied the test" calibration). +- **Result:** Confirmed. +- **Impact:** Cluster and recurrence now only prompt the check. A finding is emitted only when the check names an alternative that makes the clustered findings moot. A calibration clause says an approach finding is expected on a minority of files, and the run reports when every file flags or none does. + +#### V19: The `rethink` route misroutes + +- **Hypothesis:** Routing to `/plan-a-change` or `/design-an-api` points at skills whose descriptions exclude a mechanism swap, and a re-run would re-flag the same unit. +- **Investigation:** `plan-a-change/SKILL.md:3-9`; `design-an-api/SKILL.md:65-67`; `scope-justification-rule.md`; `contract-pinning-rule.md`. +- **Result:** Partially Refuted. No mechanical loop, but a misroute. +- **Impact:** The fix-route enum is unchanged. Approach findings carry no route, like YAGNI findings. `finding-content.md` states once that an accepted behavior-preserving substitution goes to `/refactor` and a behavior change to `/tdd`. + +#### V20: Convention pieces are missing + +- **Hypothesis:** A required convention is left out. +- **Investigation:** CLAUDE.md shared-rule lists; `marketplace.json`; `docs/workflows.md`; `output-verification.md:61-64`; `template.md:33` (ID prefixes). +- **Result:** Partially Refuted. With no shared rule file, the CLAUDE.md and vendoring items fall away. The approach finding needed an ID prefix, a section, and a verification rule. +- **Impact:** `APPR-###` prefix, a `### 🔁 Approach` section mirroring the YAGNI section, and a verification rule mirroring rule 12 added to the fix. + +#### V21: Your redirect: a dedicated skill with a non-convergence trigger + +- **Hypothesis:** A skill invoked when a loop fails to converge after its cap is a better shape than inline checks in each loop. +- **Investigation:** Your direction after the first plan, checked against the entity taxonomy (`plugin-entity-taxonomy.md`), `design-an-api`'s options step (E15), the `plan-implementation` plateau note (E14), and the prior research's branch-isolation finding (E20). You also noted that `han-coding` skills do not run review loops. +- **Result:** Confirmed. A skill gives the check a fresh context, one canonical home, its own eval, and a hand-invoked path for cycles that happen outside any loop. The cap is an existing deterministic boundary, so the trigger adds no threshold and no stop. +- **Impact:** The fix was rebuilt around `reassess-approach`. The `code-review` changes moved to the deferred list. + +### Adjustments Made + +- Root cause rewritten from four mechanisms to three; "active suppression" became "find-and-fix framing" (V2, V5) and the YAGNI/evidence tilt was removed (V8, V9). +- E5, E16, E17 marked not causal; E8, E18, E20, E22 rewritten; E23 and E24 added (V3, V5, V6, V7, V10, V12). +- First fix cut from five loops, a shared rule, six vendored YAGNI edits, two agents, guidance, and evals to two loops plus docs (V4, V16, V17). +- Stop design replaced: no new stop register (V13, V19). A named-alternative gate and a calibration clause were added to the inline checks (V18), then superseded. +- Second fix rebuilt around a dedicated `reassess-approach` skill in `han-planning`, triggered at the round cap when the convergence condition fails, invoked by `iterative-plan-review` and `plan-implementation` only, and invocable by hand (V21). The `code-review` cluster and recurrence checks, the `APPR-###` section, and the locked-premise clause moved to Deferred. +- An eval fixture for the new skill added, so the mechanism's value is measured rather than assumed (V17, V18). + +### Confidence Assessment + +- **Confidence:** Medium. +- **Remaining Risks:** + - The value of LLM-generated alternatives is unvalidated. A7 in the prior research (E20) found no gain from LLM reframing even with a person deciding. The eval fixture is the first measurement; if the options come back as nearby variants of the current approach, the critic brief or the agent choice needs rework. + - The six-round case came from a hand-driven fix-and-re-review instruction, not a Han loop, so the automatic trigger never fires for it. Only the hand-invoked path helps until a skill exists that drives a merge request to completion and can call `reassess-approach` at its own stall point. + - Firing only at the cap means a small plan gets one round before the question is asked, and a large plan gets three rounds of polishing first. That is the trade for a trigger with no new threshold. + - The recommended agent, `han-core:software-architect`, is an intra-codebase architect. For a plan whose question is "should this exist at all", a generalist may produce better options. The `skill-builder` interview decides; the plan records the recommendation, not the decision. + - First-answer anchoring is model behavior; a fresh context reduces it and does not remove it. + - `plan-implementation` routing after an accepted alternative (back to `plan-a-feature` or on to `plan-a-change`) is a hand-off, not an automated step, and the person has to run it. + +## Coding Standards Reference + +| Standard | Source | Applies To | +| --- | --- | --- | +| Every new skill is built with `han-plugin-builder` (`skill-builder` for a skill) and reviewed against its guidance | `CLAUDE.md`, "Creating skills, agents, or other plugin aspects" | `reassess-approach` SKILL.md | +| Skill = deterministic flowchart; agent = contextual judgment; dispatch flows from skills to agents | `han-plugin-builder/skills/guidance/references/plugin-entity-taxonomy.md` | `reassess-approach` design (gather, dispatch, record, present) | +| Model-agnostic instructions: goal and reasons first, load-bearing constraints explicit, no micro-checklist | `han-plugin-builder/skills/guidance/references/per-model-authoring.md` | all SKILL.md edits | +| Constraints carry their reasoning; conventions are heading, one-line rule, example | `.../skill-building-guidance/writing-effective-instructions.md` | all SKILL.md edits | +| Config probe runs `han-config-dir.sh`; grant copied from an existing skill | `.../skill-building-guidance/context-injection-commands.md`; `CONTRIBUTING.md` "Adding a skill" step 2 | `reassess-approach` frontmatter | +| Every skill gets a long-form doc, a README scent line, and an index entry in the same change | `docs/templates/coverage-rule.md`; `CONTRIBUTING.md` steps 3 to 5 | docs changes | +| One question per turn, plain-language lead, named candidates, single stop | `han-planning/references/operator-escalation-rule.md` | how both loops present the options | +| The collaborative flag adds no new boundary | `han-core/references/collaborative-stop-rule.md` | trigger placement at the existing cap | +| YAGNI: evidence gate and simpler-version gate; deferrals carry a reopen trigger | `han-core/references/yagni-rule.md` | the critic brief and the Deferred list | +| Readability standard applied in stages; editor pass for synthesis output | `han-communication/references/readability-rule.md` | the options report and the docs | diff --git a/docs/readability.md b/docs/readability.md index e9aafe24..55f08e0b 100644 --- a/docs/readability.md +++ b/docs/readability.md @@ -158,6 +158,7 @@ skills that meet that test today. | [`/plan-a-phased-build`](../han-planning/docs/skills/plan-a-phased-build.md) | The reader of the phased build (mixed engineering / product by default) | Synthesis: dispatches `readability-editor` | | [`/plan-work-items`](../han-planning/docs/skills/plan-work-items.md) | The engineer who grabs a work item and implements it | Self-check only | | [`/iterative-plan-review`](../han-planning/docs/skills/iterative-plan-review.md) | The reader of the plan the review refines | Self-check only | +| [`/reassess-approach`](../han-planning/docs/skills/reassess-approach.md) | The person who decides whether to keep the approach, who may not have read the artifact | Self-check only | | [`/coding-standard`](../han-coding/docs/skills/coding-standard.md) | The engineer who must follow the standard | Synthesis: dispatches `readability-editor` | | [`/automated-test-planning`](../han-coding/docs/skills/automated-test-planning.md) | The engineer who will implement the tests | Synthesis: dispatches `readability-editor` | | [`/manual-test-planning`](../han-coding/docs/skills/manual-test-planning.md) | The person who runs the tests by hand, who may not be technical | Synthesis: dispatches `readability-editor` | diff --git a/docs/skills/README.md b/docs/skills/README.md index e38fbdaa..819fe334 100644 --- a/docs/skills/README.md +++ b/docs/skills/README.md @@ -90,6 +90,9 @@ skill-and-agent split is fuzzy, read [Concepts](../concepts.md) first. - [`/readability-guidance`](../../han-communication/docs/skills/readability-guidance.md) — Surface the shared readability standard into a calling skill's own context so it drafts in voice and self-checks against one canonical copy. +- [`/reassess-approach`](../../han-planning/docs/skills/reassess-approach.md) — Ask, in a fresh context, whether the + approach a plan or a piece of code commits to is still the right one, and get structurally different alternatives, + including stopping, with one recommendation. - [`/refactor`](../../han-coding/docs/skills/refactor.md) — Restructure existing code without changing its behavior through a test-gated loop that re-runs the full suite after every small step. - [`/research`](../../han-research/docs/skills/research.md) — Research an open-ended question across the codebase and the diff --git a/docs/workflows.md b/docs/workflows.md index 30700406..596d7556 100644 --- a/docs/workflows.md +++ b/docs/workflows.md @@ -26,6 +26,9 @@ flowchart TD research --> feature["/plan-a-feature"] feature --> impl["/plan-implementation"] impl --> review["/iterative-plan-review"] + review -.at the cap, not converged.-> reassess["/reassess-approach"] + impl -.at the cap, not converged.-> reassess + reassess -.re-specify.-> feature review --> items["/plan-work-items"] impl --> items items --> gh["/work-items-to-issues (GitHub)"] @@ -49,6 +52,14 @@ flowchart TD [`/iterative-plan-review`](../han-planning/docs/skills/iterative-plan-review.md) → [`/plan-work-items`](../han-planning/docs/skills/plan-work-items.md).** Specify, plan the build, stress-test the plan, then break it into work. Skip the review pass when the plan is already trusted. +- **[`/plan-implementation`](../han-planning/docs/skills/plan-implementation.md) or + [`/iterative-plan-review`](../han-planning/docs/skills/iterative-plan-review.md) → + [`/reassess-approach`](../han-planning/docs/skills/reassess-approach.md).** When either loop's multi-round run + (medium or large) reaches its cap without converging, it hands the plan and its findings to a fresh-context critic + that returns structurally different alternatives, including stopping, and asks you to choose. A small run ends with a + pointer to the skill instead. "Continue as is" sends the run on as before; a different + approach sends it back to `/plan-a-feature` or on to [`/plan-a-change`](../han-planning/docs/skills/plan-a-change.md). + You can also run it by hand on any plan or code path that keeps drawing findings. - **[`/plan-work-items`](../han-planning/docs/skills/plan-work-items.md) → publish.** Turn the work items into tickets where your team tracks them: [`/work-items-to-issues`](../han-github/docs/skills/work-items-to-issues.md) for GitHub, [`/work-items-to-jira`](../han-atlassian/docs/skills/work-items-to-jira.md) for Jira (opt-in `han-atlassian`), or diff --git a/docs/yagni.md b/docs/yagni.md index 725b97e7..e711e58d 100644 --- a/docs/yagni.md +++ b/docs/yagni.md @@ -110,6 +110,7 @@ audits one). | [`/plan-implementation`](../han-planning/docs/skills/plan-implementation.md) | Every plan step, abstraction, infrastructure addition, observability hook, and rollout step. A YAGNI sweep runs before the plan is committed. | | [`/plan-a-phased-build`](../han-planning/docs/skills/plan-a-phased-build.md) | Every phase. Phases whose only justification is "completeness of the roadmap" get deferred or merged into a smaller adjacent phase. | | [`/iterative-plan-review`](../han-planning/docs/skills/iterative-plan-review.md) | A YAGNI review pillar runs alongside correctness, completeness, and risk. Every uncited item raises a `Category: YAGNI candidate` finding. | +| [`/reassess-approach`](../han-planning/docs/skills/reassess-approach.md) | The simpler-version gate applied to a whole approach, measured in owned code paths or plan items: a library or a different shape that removes more than it adds is the simpler version. Repeated rework on one mechanism is the "existing structure demonstrably impedes the change" evidence. "Stop doing this" stays on every options list, and options set aside land in the report's `Deferred (YAGNI)` section with a reopening trigger. | | [`/code-review`](../han-coding/docs/skills/code-review.md) | YAGNI is **advisory-only** and runs as a two-pass procedure (Pass 1 evidence test against Gate 1; Pass 2 named anti-pattern match). Each finding records the failing evidence type, the matched anti-pattern, and the simpler form considered. Findings surface speculative additions but do not block a clean review on their own; the reviewer's posture is "make the cost of inclusion visible," not "reject the change." Skipped in Mode B (uncommitted changes) and Mode C (no git) unless explicitly requested via the focus-areas argument, since no diff exists to distinguish introduced code from pre-existing code. | | [`/coding-standard`](../han-coding/docs/skills/coding-standard.md) | A standard is justified only when the project does the thing the standard governs _today_ and the standard solves a real, concrete problem the team is currently hitting. | | [`/automated-test-planning`](../han-coding/docs/skills/automated-test-planning.md) | A YAGNI sweep removes speculative tests: for code paths that don't exist, hypothetical adversaries, or branches the change doesn't touch. | diff --git a/evals/architectural-analysis/prompts/skill-call-adr-graphql-switch.md b/evals/architectural-analysis/prompts/skill-call-adr-graphql-switch.md index 88427ff6..4ae9f4c1 100644 --- a/evals/architectural-analysis/prompts/skill-call-adr-graphql-switch.md +++ b/evals/architectural-analysis/prompts/skill-call-adr-graphql-switch.md @@ -1 +1 @@ -create an ADR for our decision to switch from REST to GraphQL \ No newline at end of file +create an ADR for our decision to switch from REST to GraphQL diff --git a/evals/architectural-analysis/prompts/skill-call-analyze-payments-module.md b/evals/architectural-analysis/prompts/skill-call-analyze-payments-module.md index 62c637cb..2b710381 100644 --- a/evals/architectural-analysis/prompts/skill-call-analyze-payments-module.md +++ b/evals/architectural-analysis/prompts/skill-call-analyze-payments-module.md @@ -1 +1 @@ -analyze the architecture of the src/payments module \ No newline at end of file +analyze the architecture of the src/payments module diff --git a/evals/architectural-analysis/prompts/skill-call-architectural-debt-refactor.md b/evals/architectural-analysis/prompts/skill-call-architectural-debt-refactor.md index dcd9a3c6..a1ed7a59 100644 --- a/evals/architectural-analysis/prompts/skill-call-architectural-debt-refactor.md +++ b/evals/architectural-analysis/prompts/skill-call-architectural-debt-refactor.md @@ -1 +1 @@ -I need to understand the architectural debt in lib/auth before we refactor it \ No newline at end of file +I need to understand the architectural debt in lib/auth before we refactor it diff --git a/evals/architectural-analysis/prompts/skill-call-architecture-book-recommendation.md b/evals/architectural-analysis/prompts/skill-call-architecture-book-recommendation.md index 788c58df..80886caa 100644 --- a/evals/architectural-analysis/prompts/skill-call-architecture-book-recommendation.md +++ b/evals/architectural-analysis/prompts/skill-call-architecture-book-recommendation.md @@ -1 +1 @@ -what's the best software architecture book for beginners \ No newline at end of file +what's the best software architecture book for beginners diff --git a/evals/architectural-analysis/prompts/skill-call-concurrency-data-flow.md b/evals/architectural-analysis/prompts/skill-call-concurrency-data-flow.md index 2e344bdd..2133b1da 100644 --- a/evals/architectural-analysis/prompts/skill-call-concurrency-data-flow.md +++ b/evals/architectural-analysis/prompts/skill-call-concurrency-data-flow.md @@ -1 +1 @@ -assess the concurrency patterns and data flow in our worker pipeline \ No newline at end of file +assess the concurrency patterns and data flow in our worker pipeline diff --git a/evals/architectural-analysis/prompts/skill-call-debug-webhook-errors.md b/evals/architectural-analysis/prompts/skill-call-debug-webhook-errors.md index bd44bd60..29524c09 100644 --- a/evals/architectural-analysis/prompts/skill-call-debug-webhook-errors.md +++ b/evals/architectural-analysis/prompts/skill-call-debug-webhook-errors.md @@ -1 +1 @@ -the payment webhook is returning 500 errors intermittently, figure out why \ No newline at end of file +the payment webhook is returning 500 errors intermittently, figure out why diff --git a/evals/architectural-analysis/prompts/skill-call-document-notification-system.md b/evals/architectural-analysis/prompts/skill-call-document-notification-system.md index da8f2e9b..7df86b8a 100644 --- a/evals/architectural-analysis/prompts/skill-call-document-notification-system.md +++ b/evals/architectural-analysis/prompts/skill-call-document-notification-system.md @@ -1 +1 @@ -write documentation for how the notification system works \ No newline at end of file +write documentation for how the notification system works diff --git a/evals/architectural-analysis/prompts/skill-call-evaluate-api-gateway-coupling.md b/evals/architectural-analysis/prompts/skill-call-evaluate-api-gateway-coupling.md index 1255ee99..b73eda1f 100644 --- a/evals/architectural-analysis/prompts/skill-call-evaluate-api-gateway-coupling.md +++ b/evals/architectural-analysis/prompts/skill-call-evaluate-api-gateway-coupling.md @@ -1 +1 @@ -evaluate the structural health and coupling in our api gateway directory \ No newline at end of file +evaluate the structural health and coupling in our api gateway directory diff --git a/evals/architectural-analysis/prompts/skill-call-mermaid-architecture-diagram.md b/evals/architectural-analysis/prompts/skill-call-mermaid-architecture-diagram.md index 472c2978..174430f7 100644 --- a/evals/architectural-analysis/prompts/skill-call-mermaid-architecture-diagram.md +++ b/evals/architectural-analysis/prompts/skill-call-mermaid-architecture-diagram.md @@ -1 +1 @@ -write an architecture diagram in Mermaid for the README \ No newline at end of file +write an architecture diagram in Mermaid for the README diff --git a/evals/architectural-analysis/prompts/skill-call-module-boundaries-dependencies.md b/evals/architectural-analysis/prompts/skill-call-module-boundaries-dependencies.md index e3263360..1746ae87 100644 --- a/evals/architectural-analysis/prompts/skill-call-module-boundaries-dependencies.md +++ b/evals/architectural-analysis/prompts/skill-call-module-boundaries-dependencies.md @@ -1 +1 @@ -review the module boundaries and dependencies in src/core \ No newline at end of file +review the module boundaries and dependencies in src/core diff --git a/evals/architectural-analysis/prompts/skill-call-review-branch-code-changes.md b/evals/architectural-analysis/prompts/skill-call-review-branch-code-changes.md index a5c64e83..102d6e47 100644 --- a/evals/architectural-analysis/prompts/skill-call-review-branch-code-changes.md +++ b/evals/architectural-analysis/prompts/skill-call-review-branch-code-changes.md @@ -1 +1 @@ -review the code changes on this branch for quality issues \ No newline at end of file +review the code changes on this branch for quality issues diff --git a/evals/architectural-analysis/prompts/skill-call-setup-directory-structure.md b/evals/architectural-analysis/prompts/skill-call-setup-directory-structure.md index 68cbd346..b7490e97 100644 --- a/evals/architectural-analysis/prompts/skill-call-setup-directory-structure.md +++ b/evals/architectural-analysis/prompts/skill-call-setup-directory-structure.md @@ -1 +1 @@ -help me set up the project directory structure for a new microservice \ No newline at end of file +help me set up the project directory structure for a new microservice diff --git a/evals/architectural-analysis/prompts/skill-call-test-plan-auth-module.md b/evals/architectural-analysis/prompts/skill-call-test-plan-auth-module.md index 0c83ad90..db5b585a 100644 --- a/evals/architectural-analysis/prompts/skill-call-test-plan-auth-module.md +++ b/evals/architectural-analysis/prompts/skill-call-test-plan-auth-module.md @@ -1 +1 @@ -create a test plan for the user authentication module \ No newline at end of file +create a test plan for the user authentication module diff --git a/evals/architectural-analysis/rubrics/architectural-analysis-quality.md b/evals/architectural-analysis/rubrics/architectural-analysis-quality.md index e433c088..f99bac39 100644 --- a/evals/architectural-analysis/rubrics/architectural-analysis-quality.md +++ b/evals/architectural-analysis/rubrics/architectural-analysis-quality.md @@ -1,6 +1,7 @@ ## Rubric: architectural-analysis of go-project scaffold ### Presence — things the analysis must identify + - The analysis notices the fan-in concurrency pattern in runner.go where three goroutines send results through a shared channel - The analysis calls out that the goroutines (pi.Compute, fibonacci.Compute, sqrt.Compute) have no way to propagate errors back — if one panics, the runner will deadlock waiting on the channel - The analysis picks up on the tight coupling between runner.go and the three computation packages, since it directly imports and calls all three @@ -10,16 +11,19 @@ - The analysis produces a risk assessment that rates findings by severity or impact ### Specificity — the analysis must be concrete + - Findings reference actual file paths like internal/runner/runner.go or internal/fibonacci/fibonacci.go, not just vague package names - When discussing the concurrency pattern, the analysis points to the specific channel operations (the make(chan types.Result, 3) and the for range 3 loop) - The coupling discussion names the specific imports in runner.go that create the dependency fan-out ### Depth — the analysis must be actionable + - At least one recommendation sketches out what a fix would look like — something like an interface, a registry pattern, or passing context down to the goroutines - The analysis explains why the missing error propagation is a real risk, not just a style nit — e.g., what actually happens if a goroutine panics - Architectural recommendations connect back to specific findings rather than offering generic advice like "reduce coupling" ### Absence — the analysis must not do these things + - The analysis doesn't invent concurrency bugs that aren't there — the channel is buffered correctly and the receive loop count matches the send count, so there's no actual deadlock in the happy path - The analysis doesn't claim there are data races when the goroutines don't actually share any mutable state - The analysis doesn't hallucinate files or packages that don't exist in the scaffold diff --git a/evals/architectural-analysis/tests.json b/evals/architectural-analysis/tests.json index a3706080..30e01d21 100644 --- a/evals/architectural-analysis/tests.json +++ b/evals/architectural-analysis/tests.json @@ -12,18 +12,109 @@ { "llm-judge": { "rubricFile": "architectural-analysis-quality.md", "model": "opus", "threshold": 0.8 } } ] }, - { "name": "Skill Call: analyze payments module architecture", "type": "skill-call", "skillFile": "han-coding:architectural-analysis", "promptFile": "skill-call-analyze-payments-module.md", "model": "opus", "expect": [{ "skill-call": true }] }, - { "name": "Skill Call: evaluate api gateway coupling", "type": "skill-call", "skillFile": "han-coding:architectural-analysis", "promptFile": "skill-call-evaluate-api-gateway-coupling.md", "model": "opus", "expect": [{ "skill-call": true }] }, - { "name": "Skill Call: understand architectural debt before refactor", "type": "skill-call", "skillFile": "han-coding:architectural-analysis", "promptFile": "skill-call-architectural-debt-refactor.md", "model": "opus", "expect": [{ "skill-call": true }] }, - { "name": "Skill Call: review module boundaries and dependencies", "type": "skill-call", "skillFile": "han-coding:architectural-analysis", "promptFile": "skill-call-module-boundaries-dependencies.md", "model": "opus", "expect": [{ "skill-call": true }] }, - { "name": "Skill Call: assess concurrency and data flow", "type": "skill-call", "skillFile": "han-coding:architectural-analysis", "promptFile": "skill-call-concurrency-data-flow.md", "model": "opus", "expect": [{ "skill-call": true }] }, - { "name": "Skill Call: write mermaid architecture diagram", "type": "skill-call", "skillFile": "han-coding:architectural-analysis", "promptFile": "skill-call-mermaid-architecture-diagram.md", "model": "sonnet", "expect": [{ "skill-call": false }] }, - { "name": "Skill Call: architecture book recommendation", "type": "skill-call", "skillFile": "han-coding:architectural-analysis", "promptFile": "skill-call-architecture-book-recommendation.md", "model": "sonnet", "expect": [{ "skill-call": false }] }, - { "name": "Skill Call: set up project directory structure", "type": "skill-call", "skillFile": "han-coding:architectural-analysis", "promptFile": "skill-call-setup-directory-structure.md", "model": "sonnet", "expect": [{ "skill-call": false }] }, - { "name": "Skill Call: review code changes on branch", "type": "skill-call", "skillFile": "han-coding:architectural-analysis", "promptFile": "skill-call-review-branch-code-changes.md", "model": "sonnet", "expect": [{ "skill-call": false }] }, - { "name": "Skill Call: debug intermittent webhook errors", "type": "skill-call", "skillFile": "han-coding:architectural-analysis", "promptFile": "skill-call-debug-webhook-errors.md", "model": "sonnet", "expect": [{ "skill-call": false }] }, - { "name": "Skill Call: create test plan for auth module", "type": "skill-call", "skillFile": "han-coding:architectural-analysis", "promptFile": "skill-call-test-plan-auth-module.md", "model": "sonnet", "expect": [{ "skill-call": false }] }, - { "name": "Skill Call: document notification system", "type": "skill-call", "skillFile": "han-coding:architectural-analysis", "promptFile": "skill-call-document-notification-system.md", "model": "sonnet", "expect": [{ "skill-call": false }] }, - { "name": "Skill Call: create ADR for GraphQL switch", "type": "skill-call", "skillFile": "han-coding:architectural-analysis", "promptFile": "skill-call-adr-graphql-switch.md", "model": "sonnet", "expect": [{ "skill-call": false }] } + { + "name": "Skill Call: analyze payments module architecture", + "type": "skill-call", + "skillFile": "han-coding:architectural-analysis", + "promptFile": "skill-call-analyze-payments-module.md", + "model": "opus", + "expect": [{ "skill-call": true }] + }, + { + "name": "Skill Call: evaluate api gateway coupling", + "type": "skill-call", + "skillFile": "han-coding:architectural-analysis", + "promptFile": "skill-call-evaluate-api-gateway-coupling.md", + "model": "opus", + "expect": [{ "skill-call": true }] + }, + { + "name": "Skill Call: understand architectural debt before refactor", + "type": "skill-call", + "skillFile": "han-coding:architectural-analysis", + "promptFile": "skill-call-architectural-debt-refactor.md", + "model": "opus", + "expect": [{ "skill-call": true }] + }, + { + "name": "Skill Call: review module boundaries and dependencies", + "type": "skill-call", + "skillFile": "han-coding:architectural-analysis", + "promptFile": "skill-call-module-boundaries-dependencies.md", + "model": "opus", + "expect": [{ "skill-call": true }] + }, + { + "name": "Skill Call: assess concurrency and data flow", + "type": "skill-call", + "skillFile": "han-coding:architectural-analysis", + "promptFile": "skill-call-concurrency-data-flow.md", + "model": "opus", + "expect": [{ "skill-call": true }] + }, + { + "name": "Skill Call: write mermaid architecture diagram", + "type": "skill-call", + "skillFile": "han-coding:architectural-analysis", + "promptFile": "skill-call-mermaid-architecture-diagram.md", + "model": "sonnet", + "expect": [{ "skill-call": false }] + }, + { + "name": "Skill Call: architecture book recommendation", + "type": "skill-call", + "skillFile": "han-coding:architectural-analysis", + "promptFile": "skill-call-architecture-book-recommendation.md", + "model": "sonnet", + "expect": [{ "skill-call": false }] + }, + { + "name": "Skill Call: set up project directory structure", + "type": "skill-call", + "skillFile": "han-coding:architectural-analysis", + "promptFile": "skill-call-setup-directory-structure.md", + "model": "sonnet", + "expect": [{ "skill-call": false }] + }, + { + "name": "Skill Call: review code changes on branch", + "type": "skill-call", + "skillFile": "han-coding:architectural-analysis", + "promptFile": "skill-call-review-branch-code-changes.md", + "model": "sonnet", + "expect": [{ "skill-call": false }] + }, + { + "name": "Skill Call: debug intermittent webhook errors", + "type": "skill-call", + "skillFile": "han-coding:architectural-analysis", + "promptFile": "skill-call-debug-webhook-errors.md", + "model": "sonnet", + "expect": [{ "skill-call": false }] + }, + { + "name": "Skill Call: create test plan for auth module", + "type": "skill-call", + "skillFile": "han-coding:architectural-analysis", + "promptFile": "skill-call-test-plan-auth-module.md", + "model": "sonnet", + "expect": [{ "skill-call": false }] + }, + { + "name": "Skill Call: document notification system", + "type": "skill-call", + "skillFile": "han-coding:architectural-analysis", + "promptFile": "skill-call-document-notification-system.md", + "model": "sonnet", + "expect": [{ "skill-call": false }] + }, + { + "name": "Skill Call: create ADR for GraphQL switch", + "type": "skill-call", + "skillFile": "han-coding:architectural-analysis", + "promptFile": "skill-call-adr-graphql-switch.md", + "model": "sonnet", + "expect": [{ "skill-call": false }] + } ] } diff --git a/evals/architectural-decision-record/tests.json b/evals/architectural-decision-record/tests.json index fe097cc4..7af55087 100644 --- a/evals/architectural-decision-record/tests.json +++ b/evals/architectural-decision-record/tests.json @@ -29,9 +29,7 @@ "skillFile": "han-documentation:architectural-decision-record", "promptFile": "skill-call-architectural-decision-record.md", "scaffold": "node-project", - "expect": [ - { "skill-call": true } - ] + "expect": [{ "skill-call": true }] }, { "name": "Skill Call: no architectural-decision-record", @@ -39,9 +37,7 @@ "model": "sonnet", "skillFile": "han-documentation:architectural-decision-record", "promptFile": "skill-call-no-architectural-decision-record.md", - "expect": [ - { "skill-call": false } - ] + "expect": [{ "skill-call": false }] } ] } diff --git a/evals/automated-test-planning/tests.json b/evals/automated-test-planning/tests.json index f1a7f1df..5dd18402 100644 --- a/evals/automated-test-planning/tests.json +++ b/evals/automated-test-planning/tests.json @@ -29,9 +29,7 @@ "skillFile": "han-coding:automated-test-planning", "promptFile": "skill-call-automated-test-planning.md", "scaffold": "ruby-project", - "expect": [ - { "skill-call": true } - ] + "expect": [{ "skill-call": true }] }, { "name": "Skill Call: no automated-test-planning", @@ -39,9 +37,7 @@ "model": "sonnet", "skillFile": "han-coding:automated-test-planning", "promptFile": "skill-call-no-automated-test-planning.md", - "expect": [ - { "skill-call": false } - ] + "expect": [{ "skill-call": false }] } ] } diff --git a/evals/code-review/rubrics/code-review-quality.md b/evals/code-review/rubrics/code-review-quality.md index 69c52406..4e8a3bcd 100644 --- a/evals/code-review/rubrics/code-review-quality.md +++ b/evals/code-review/rubrics/code-review-quality.md @@ -1,6 +1,7 @@ ## Rubric: code-review of ruby-project scaffold ### Presence — things the review must identify + - The review identifies that `forEach` is not a valid Ruby method and should be `each` (lib/example.rb, line 8) - The review identifies that `total + 1` should be `total + num` — the method adds 1 per element instead of summing the actual values (lib/example.rb, line 9) - The review identifies core tests need to be written for the example.rb file @@ -12,13 +13,16 @@ - The review has a Review Recommendation stating that at least one item must be fixed ### Specificity — the review must be concrete + - Each identified issue references the file name `example.rb` or `lib/example.rb` - The review identifies that the manual iteration and incrementing total should be a `.reduce` call instead ### Depth — the review must be actionable + - At least one finding includes a suggested fix showing the corrected code - At least one finding should suggest removing code that appears to be for debugging ### Absence — the review must not do these things + - The review does not hallucinate bugs or issues that are not present in the scaffold code - The review does not suggest changes that are not idiomatic ruby diff --git a/evals/code-review/rubrics/code-review-security-quality.md b/evals/code-review/rubrics/code-review-security-quality.md index 1cf8ebf5..3dff6f74 100644 --- a/evals/code-review/rubrics/code-review-security-quality.md +++ b/evals/code-review/rubrics/code-review-security-quality.md @@ -1,6 +1,7 @@ ## Rubric: code-review of go-security-project scaffold ### Presence — things the review must identify + - The review identifies that `GetUser` in `internal/db/users.go` builds the SQL query via string concatenation, making it vulnerable to SQL injection - The review identifies that `internal/db/db.go` hardcodes production database credentials in a source-committed constant - The review identifies that `jwtKey` in `internal/auth/jwt.go` is set to the short, predictable value `"secret"`, making tokens susceptible to brute-force key recovery @@ -13,17 +14,20 @@ - Each SEC finding must include an EXPLOIT field with a concrete attack path ### Specificity — the review must be concrete + - The SQL injection finding names the `GetUser` function and shows the concatenated query string in `internal/db/users.go` - The SSRF finding names a concrete reachable target, such as `http://169.254.169.254/latest/meta-data/` (cloud instance metadata) or an internal service address - The timing attack finding names `crypto/subtle.ConstantTimeCompare` as the required fix - The race condition finding references the `responseCache` variable in `internal/runner/runner.go` specifically ### Depth — the review must be actionable + - The SQL injection finding shows the corrected form using a parameterized query, consistent with the safe pattern already present in `GetUserByID`: `DB.QueryRow("... WHERE name = $1", name)` - The timing attack finding explains the exploit mechanism: an attacker can measure response-time differences across requests to determine whether a username is valid or to extract information about the stored hash - The JWT weakness finding explains the operational consequence of missing expiry: once issued, a compromised token remains valid indefinitely with no way to revoke it short of a server-side blocklist ### Absence — the review must not do these things + - The review does not flag the buffered channel fan-in pattern in `runner.go`'s `Start` function as a race condition — the goroutines communicate only via the correctly-sized channel, and the race exists in `responseCache`, not in the channel mechanics - The review does not hallucinate vulnerabilities not present in the scaffold code - The review does not claim that `database/sql` usage is itself the vulnerability — the flaw is the string concatenation in `GetUser`, not the library diff --git a/evals/code-review/tests.json b/evals/code-review/tests.json index 528a6d75..fbb14887 100644 --- a/evals/code-review/tests.json +++ b/evals/code-review/tests.json @@ -42,9 +42,7 @@ "skillFile": "han-coding:code-review", "promptFile": "skill-call-code-review.md", "scaffold": "ruby-project", - "expect": [ - { "skill-call": true } - ] + "expect": [{ "skill-call": true }] }, { "name": "Skill Call: don't include the word 'review'", @@ -53,9 +51,7 @@ "skillFile": "han-coding:code-review", "model": "opus", "scaffold": "ruby-project", - "expect": [ - { "skill-call": true } - ] + "expect": [{ "skill-call": true }] }, { "name": "Skill Call: movie review", @@ -64,9 +60,7 @@ "skillFile": "han-coding:code-review", "promptFile": "skill-call-movie-review.md", "scaffold": "ruby-project", - "expect": [ - { "skill-call": false } - ] + "expect": [{ "skill-call": false }] }, { "name": "Skill Call: book review", @@ -75,9 +69,7 @@ "skillFile": "han-coding:code-review", "promptFile": "skill-call-book-review.md", "scaffold": "ruby-project", - "expect": [ - { "skill-call": false } - ] + "expect": [{ "skill-call": false }] }, { "name": "Skill Call: review changes in branch", @@ -86,9 +78,7 @@ "skillFile": "han-coding:code-review", "model": "opus", "scaffold": "ruby-project", - "expect": [ - { "skill-call": true } - ] + "expect": [{ "skill-call": true }] } ] } diff --git a/evals/coding-standard/rubrics/coding-standard-quality.md b/evals/coding-standard/rubrics/coding-standard-quality.md index bc3a5bbb..fc4a17d4 100644 --- a/evals/coding-standard/rubrics/coding-standard-quality.md +++ b/evals/coding-standard/rubrics/coding-standard-quality.md @@ -1,21 +1,25 @@ ## Rubric: coding-standard of rails-api-project scaffold ### Presence — things the coding standard must identify + - The coding standard identifies that business logic (such as the pi calculation) should not live directly in controller actions - The coding standard identifies the service object pattern (FibonacciCalculator) as the preferred approach for extracting business logic from controllers - The coding standard identifies inconsistent response formats across API endpoints (e.g., result vs value keys) - The coding standard identifies the need for input validation on controller parameters ### Specificity — the coding standard must be concrete + - The coding standard references specific files from the project (e.g., pi_controller.rb, fibonacci_controller.rb, fibonacci_calculator.rb) - The coding standard includes code examples showing both correct and incorrect patterns ### Depth — the coding standard must be actionable + - The coding standard provides "correct usage" examples that demonstrate the preferred pattern - The coding standard provides "what to avoid" examples that show the anti-pattern - The coding standard explains why extracting logic to service objects is preferred over inline controller logic ### Absence — the coding standard must not do these things + - The coding standard does not hallucinate files or classes that do not exist in the project - The coding standard does not suggest database-related or ORM-related conventions (this project has no database) - The coding standard does not recommend linter/formatter rules as coding standard content diff --git a/evals/coding-standard/tests.json b/evals/coding-standard/tests.json index b62ba76b..bcbb9f96 100644 --- a/evals/coding-standard/tests.json +++ b/evals/coding-standard/tests.json @@ -51,9 +51,7 @@ "skillFile": "han-coding:coding-standard", "promptFile": "skill-call-coding-standard.md", "scaffold": "ruby-project", - "expect": [ - { "skill-call": true } - ] + "expect": [{ "skill-call": true }] }, { "name": "Skill Call: no coding standard", @@ -62,9 +60,7 @@ "skillFile": "han-coding:coding-standard", "promptFile": "skill-call-no-coding-standard.md", "scaffold": "ruby-project", - "expect": [ - { "skill-call": false } - ] + "expect": [{ "skill-call": false }] } ] } diff --git a/evals/edge-case-explorer/prompts/agent-call-boundary-values-db-layer.md b/evals/edge-case-explorer/prompts/agent-call-boundary-values-db-layer.md index 42de96ed..c56c00f7 100644 --- a/evals/edge-case-explorer/prompts/agent-call-boundary-values-db-layer.md +++ b/evals/edge-case-explorer/prompts/agent-call-boundary-values-db-layer.md @@ -1 +1 @@ -What boundary values and failure modes should we test for in the database access layer? \ No newline at end of file +What boundary values and failure modes should we test for in the database access layer? diff --git a/evals/edge-case-explorer/prompts/agent-call-exhaustive-edge-case-analysis.md b/evals/edge-case-explorer/prompts/agent-call-exhaustive-edge-case-analysis.md index 202d8e34..fc1b149e 100644 --- a/evals/edge-case-explorer/prompts/agent-call-exhaustive-edge-case-analysis.md +++ b/evals/edge-case-explorer/prompts/agent-call-exhaustive-edge-case-analysis.md @@ -1 +1 @@ -Do an exhaustive exploration of edge cases for the runner module — check all dimensions including race conditions and error propagation \ No newline at end of file +Do an exhaustive exploration of edge cases for the runner module — check all dimensions including race conditions and error propagation diff --git a/evals/edge-case-explorer/prompts/agent-call-find-edge-cases-auth.md b/evals/edge-case-explorer/prompts/agent-call-find-edge-cases-auth.md index 900a10b1..4f6d74c2 100644 --- a/evals/edge-case-explorer/prompts/agent-call-find-edge-cases-auth.md +++ b/evals/edge-case-explorer/prompts/agent-call-find-edge-cases-auth.md @@ -1 +1 @@ -Find the edge cases in the authentication module — what unexpected inputs could break it? \ No newline at end of file +Find the edge cases in the authentication module — what unexpected inputs could break it? diff --git a/evals/edge-case-explorer/prompts/agent-call-how-can-handlers-fail.md b/evals/edge-case-explorer/prompts/agent-call-how-can-handlers-fail.md index 4a36b6c9..a85b8bc2 100644 --- a/evals/edge-case-explorer/prompts/agent-call-how-can-handlers-fail.md +++ b/evals/edge-case-explorer/prompts/agent-call-how-can-handlers-fail.md @@ -1 +1 @@ -Explore how the HTTP handlers can fail — trace the inputs and find edge cases we haven't thought of \ No newline at end of file +Explore how the HTTP handlers can fail — trace the inputs and find edge cases we haven't thought of diff --git a/evals/edge-case-explorer/prompts/agent-call-negative-boundary-survey.md b/evals/edge-case-explorer/prompts/agent-call-negative-boundary-survey.md index 036b5ec6..09005af7 100644 --- a/evals/edge-case-explorer/prompts/agent-call-negative-boundary-survey.md +++ b/evals/edge-case-explorer/prompts/agent-call-negative-boundary-survey.md @@ -1 +1 @@ -What are the boundary lines for the property at 123 Main Street? \ No newline at end of file +What are the boundary lines for the property at 123 Main Street? diff --git a/evals/edge-case-explorer/prompts/agent-call-negative-edge-case-interview.md b/evals/edge-case-explorer/prompts/agent-call-negative-edge-case-interview.md index 04a4e5ef..c23e2497 100644 --- a/evals/edge-case-explorer/prompts/agent-call-negative-edge-case-interview.md +++ b/evals/edge-case-explorer/prompts/agent-call-negative-edge-case-interview.md @@ -1 +1 @@ -Give me some edge case interview questions for a product manager role \ No newline at end of file +Give me some edge case interview questions for a product manager role diff --git a/evals/edge-case-explorer/prompts/agent-call-negative-edge-computing.md b/evals/edge-case-explorer/prompts/agent-call-negative-edge-computing.md index fede9302..4f9b29d0 100644 --- a/evals/edge-case-explorer/prompts/agent-call-negative-edge-computing.md +++ b/evals/edge-case-explorer/prompts/agent-call-negative-edge-computing.md @@ -1 +1 @@ -Explain how edge computing works and when to deploy workloads to the edge versus the cloud \ No newline at end of file +Explain how edge computing works and when to deploy workloads to the edge versus the cloud diff --git a/evals/edge-case-explorer/prompts/agent-call-sibling-code-review.md b/evals/edge-case-explorer/prompts/agent-call-sibling-code-review.md index 31c537be..d48fb158 100644 --- a/evals/edge-case-explorer/prompts/agent-call-sibling-code-review.md +++ b/evals/edge-case-explorer/prompts/agent-call-sibling-code-review.md @@ -1 +1 @@ -Review the handlers code for quality issues and security vulnerabilities \ No newline at end of file +Review the handlers code for quality issues and security vulnerabilities diff --git a/evals/edge-case-explorer/prompts/agent-call-sibling-investigate-crash.md b/evals/edge-case-explorer/prompts/agent-call-sibling-investigate-crash.md index 3dcf04ba..f7aeb227 100644 --- a/evals/edge-case-explorer/prompts/agent-call-sibling-investigate-crash.md +++ b/evals/edge-case-explorer/prompts/agent-call-sibling-investigate-crash.md @@ -1 +1 @@ -Investigate why the server crashes on startup when the DATABASE_URL environment variable is missing \ No newline at end of file +Investigate why the server crashes on startup when the DATABASE_URL environment variable is missing diff --git a/evals/edge-case-explorer/prompts/agent-call-sibling-structural-coupling.md b/evals/edge-case-explorer/prompts/agent-call-sibling-structural-coupling.md index 2a3bc11a..1b3b28f8 100644 --- a/evals/edge-case-explorer/prompts/agent-call-sibling-structural-coupling.md +++ b/evals/edge-case-explorer/prompts/agent-call-sibling-structural-coupling.md @@ -1 +1 @@ -Analyze the coupling between the internal packages and identify module boundary violations \ No newline at end of file +Analyze the coupling between the internal packages and identify module boundary violations diff --git a/evals/edge-case-explorer/prompts/agent-call-sibling-test-plan.md b/evals/edge-case-explorer/prompts/agent-call-sibling-test-plan.md index a9f962f3..56ee4ad3 100644 --- a/evals/edge-case-explorer/prompts/agent-call-sibling-test-plan.md +++ b/evals/edge-case-explorer/prompts/agent-call-sibling-test-plan.md @@ -1 +1 @@ -Plan what tests we need for the auth module — identify untested behaviors and prioritize by risk \ No newline at end of file +Plan what tests we need for the auth module — identify untested behaviors and prioritize by risk diff --git a/evals/edge-case-explorer/prompts/agent-call-type-coercion-traps.md b/evals/edge-case-explorer/prompts/agent-call-type-coercion-traps.md index 7cfae0d3..1fdeab89 100644 --- a/evals/edge-case-explorer/prompts/agent-call-type-coercion-traps.md +++ b/evals/edge-case-explorer/prompts/agent-call-type-coercion-traps.md @@ -1 +1 @@ -Look for type coercion traps and unexpected input formats that could cause silent data corruption in the user service \ No newline at end of file +Look for type coercion traps and unexpected input formats that could cause silent data corruption in the user service diff --git a/evals/edge-case-explorer/prompts/agent-prompt-go-security-edge-cases.md b/evals/edge-case-explorer/prompts/agent-prompt-go-security-edge-cases.md index a3574987..a64d4acb 100644 --- a/evals/edge-case-explorer/prompts/agent-prompt-go-security-edge-cases.md +++ b/evals/edge-case-explorer/prompts/agent-prompt-go-security-edge-cases.md @@ -1 +1 @@ -Explore the edge cases in this Go project. Trace inputs, find boundary values, type coercion traps, and integration boundary issues. Write the full analysis to edge-case-analysis.md. \ No newline at end of file +Explore the edge cases in this Go project. Trace inputs, find boundary values, type coercion traps, and integration boundary issues. Write the full analysis to edge-case-analysis.md. diff --git a/evals/edge-case-explorer/rubrics/edge-case-explorer-quality.md b/evals/edge-case-explorer/rubrics/edge-case-explorer-quality.md index 66baabdf..2813965f 100644 --- a/evals/edge-case-explorer/rubrics/edge-case-explorer-quality.md +++ b/evals/edge-case-explorer/rubrics/edge-case-explorer-quality.md @@ -1,6 +1,7 @@ ## Rubric: edge-case-explorer of go-security-project scaffold ### Presence — things the edge case analysis must identify + - The analysis identifies SQL injection edge cases in the database layer where user-controlled input is interpolated into query strings (internal/db/users.go) - The analysis identifies race condition edge cases in the runner's responseCache where concurrent access can cause data corruption (internal/runner/runner.go) - The analysis identifies boundary value edge cases for JWT token handling — empty tokens, malformed tokens, expired tokens, tokens with tampered signatures (internal/auth/jwt.go) @@ -9,18 +10,21 @@ - The analysis includes an Input Source Map table mapping inputs to their origins and validation status ### Specificity — the edge case analysis must be concrete + - Every edge case finding references a specific file path and line number where the affected code lives - Each finding specifies a concrete scenario — the exact input value or condition that triggers the edge case, not just a category name - The analysis traces inputs to their callers to determine what values are actually passed, not just what the parameter types allow - Findings cite the current handling (or lack thereof) for each edge case with reference to the specific code that does or does not guard against it ### Depth — the edge case analysis must be actionable + - Each finding includes a severity assessment (Critical/High/Medium/Low) with justification based on likelihood and impact - Each finding describes the expected correct behavior — what the code should do when the edge case occurs - Each finding describes the risk — what happens if the edge case is not handled (e.g., silent data corruption, crash, security bypass) - The analysis distinguishes between edge cases that are already handled in code, partially handled, and completely unhandled ### Absence — the edge case analysis must not do these things + - The analysis must not report edge cases that are purely theoretical with no realistic path to occurrence in this codebase - The analysis must not dismiss edge cases with "the framework handles this" without verifying the specific framework version and usage - The analysis must not inflate priorities — Critical findings should be reserved for likely AND severe AND unhandled scenarios @@ -28,12 +32,15 @@ - The analysis must not list a dimension as "not applicable" without checking whether the code actually touches that dimension ## File: edge-case-analysis.md + ### Presence + - The file contains a Summary section with a priority count table (Critical, High, Medium, Low) - The file contains an Input Source Map table with columns for Input, Origin, Type, and Validated status - The file contains a Findings section with EC-series items grouped by priority - The file contains a Coverage Summary section breaking down edge cases by discovery status (already tested, handled but untested, no handling and no tests) ### Specificity + - Each EC-series finding includes Priority, Dimension, Input, Scenario, Code location, Current handling, Expected behavior, and Risk fields - The Dropped Edge Cases section lists excluded scenarios with specific reasons for exclusion diff --git a/evals/edge-case-explorer/tests.json b/evals/edge-case-explorer/tests.json index def37ad7..79fb7c8c 100644 --- a/evals/edge-case-explorer/tests.json +++ b/evals/edge-case-explorer/tests.json @@ -104,9 +104,7 @@ "promptFile": "agent-prompt-go-security-edge-cases.md", "scaffold": "go-security-project", "model": "opus", - "expect": [ - { "llm-judge": { "rubricFile": "edge-case-explorer-quality.md", "model": "opus", "threshold": 0.8 } } - ] + "expect": [{ "llm-judge": { "rubricFile": "edge-case-explorer-quality.md", "model": "opus", "threshold": 0.8 } }] } ] } diff --git a/evals/gap-analyzer/prompts/agent-call-check-code-covers-requirements.md b/evals/gap-analyzer/prompts/agent-call-check-code-covers-requirements.md index 2774767e..5961d43a 100644 --- a/evals/gap-analyzer/prompts/agent-call-check-code-covers-requirements.md +++ b/evals/gap-analyzer/prompts/agent-call-check-code-covers-requirements.md @@ -1 +1 @@ -check if the code covers everything in the requirements document \ No newline at end of file +check if the code covers everything in the requirements document diff --git a/evals/gap-analyzer/prompts/agent-call-check-readme-preserved.md b/evals/gap-analyzer/prompts/agent-call-check-readme-preserved.md index 85afabfe..feeb1efc 100644 --- a/evals/gap-analyzer/prompts/agent-call-check-readme-preserved.md +++ b/evals/gap-analyzer/prompts/agent-call-check-readme-preserved.md @@ -1 +1 @@ -check if the updated README preserved all the important facts from the original \ No newline at end of file +check if the updated README preserved all the important facts from the original diff --git a/evals/gap-analyzer/prompts/agent-call-compare-impl-to-prd.md b/evals/gap-analyzer/prompts/agent-call-compare-impl-to-prd.md index 15607abe..8a2db4c9 100644 --- a/evals/gap-analyzer/prompts/agent-call-compare-impl-to-prd.md +++ b/evals/gap-analyzer/prompts/agent-call-compare-impl-to-prd.md @@ -1 +1 @@ -compare my implementation against the PRD and find any gaps \ No newline at end of file +compare my implementation against the PRD and find any gaps diff --git a/evals/gap-analyzer/prompts/agent-call-db-performance-bottleneck.md b/evals/gap-analyzer/prompts/agent-call-db-performance-bottleneck.md index c59f5b5f..a50a430c 100644 --- a/evals/gap-analyzer/prompts/agent-call-db-performance-bottleneck.md +++ b/evals/gap-analyzer/prompts/agent-call-db-performance-bottleneck.md @@ -1 +1 @@ -find the performance bottleneck in the database queries \ No newline at end of file +find the performance bottleneck in the database queries diff --git a/evals/gap-analyzer/prompts/agent-call-diff-built-vs-planned.md b/evals/gap-analyzer/prompts/agent-call-diff-built-vs-planned.md index 8c0b262f..9f2cdc15 100644 --- a/evals/gap-analyzer/prompts/agent-call-diff-built-vs-planned.md +++ b/evals/gap-analyzer/prompts/agent-call-diff-built-vs-planned.md @@ -1 +1 @@ -analyze the differences between what we built and what was planned \ No newline at end of file +analyze the differences between what we built and what was planned diff --git a/evals/gap-analyzer/prompts/agent-call-find-gaps-migration-target.md b/evals/gap-analyzer/prompts/agent-call-find-gaps-migration-target.md index eefcd85f..9a6da164 100644 --- a/evals/gap-analyzer/prompts/agent-call-find-gaps-migration-target.md +++ b/evals/gap-analyzer/prompts/agent-call-find-gaps-migration-target.md @@ -1 +1 @@ -find gaps between the current system and the migration target \ No newline at end of file +find gaps between the current system and the migration target diff --git a/evals/gap-analyzer/prompts/agent-call-investigate-500-error.md b/evals/gap-analyzer/prompts/agent-call-investigate-500-error.md index a4f415c3..cd62daa0 100644 --- a/evals/gap-analyzer/prompts/agent-call-investigate-500-error.md +++ b/evals/gap-analyzer/prompts/agent-call-investigate-500-error.md @@ -1 +1 @@ -investigate why the login endpoint returns a 500 error \ No newline at end of file +investigate why the login endpoint returns a 500 error diff --git a/evals/gap-analyzer/prompts/agent-call-module-coupling.md b/evals/gap-analyzer/prompts/agent-call-module-coupling.md index a9b27d85..42facbef 100644 --- a/evals/gap-analyzer/prompts/agent-call-module-coupling.md +++ b/evals/gap-analyzer/prompts/agent-call-module-coupling.md @@ -1 +1 @@ -analyze the module boundaries and coupling in the auth service \ No newline at end of file +analyze the module boundaries and coupling in the auth service diff --git a/evals/gap-analyzer/prompts/agent-call-refactor-suggestions.md b/evals/gap-analyzer/prompts/agent-call-refactor-suggestions.md index 4a50b6e7..05d0b24a 100644 --- a/evals/gap-analyzer/prompts/agent-call-refactor-suggestions.md +++ b/evals/gap-analyzer/prompts/agent-call-refactor-suggestions.md @@ -1 +1 @@ -suggest ways to refactor this module for better readability \ No newline at end of file +suggest ways to refactor this module for better readability diff --git a/evals/gap-analyzer/prompts/agent-call-revenue-projections.md b/evals/gap-analyzer/prompts/agent-call-revenue-projections.md index 35aa9df3..9225e93a 100644 --- a/evals/gap-analyzer/prompts/agent-call-revenue-projections.md +++ b/evals/gap-analyzer/prompts/agent-call-revenue-projections.md @@ -1 +1 @@ -analyze the gap between our revenue projections and actual earnings \ No newline at end of file +analyze the gap between our revenue projections and actual earnings diff --git a/evals/gap-analyzer/prompts/agent-call-trace-data-flow.md b/evals/gap-analyzer/prompts/agent-call-trace-data-flow.md index 02ca6778..2ef58a1c 100644 --- a/evals/gap-analyzer/prompts/agent-call-trace-data-flow.md +++ b/evals/gap-analyzer/prompts/agent-call-trace-data-flow.md @@ -1 +1 @@ -trace the data flow through the payment processing pipeline \ No newline at end of file +trace the data flow through the payment processing pipeline diff --git a/evals/gap-analyzer/prompts/agent-call-whats-missing-from-spec.md b/evals/gap-analyzer/prompts/agent-call-whats-missing-from-spec.md index c372d698..047ec86d 100644 --- a/evals/gap-analyzer/prompts/agent-call-whats-missing-from-spec.md +++ b/evals/gap-analyzer/prompts/agent-call-whats-missing-from-spec.md @@ -1 +1 @@ -what's missing from this feature compared to the spec? \ No newline at end of file +what's missing from this feature compared to the spec? diff --git a/evals/gap-analyzer/rubrics/gap-analyzer-quality.md b/evals/gap-analyzer/rubrics/gap-analyzer-quality.md index 69a0d53d..4c8692e3 100644 --- a/evals/gap-analyzer/rubrics/gap-analyzer-quality.md +++ b/evals/gap-analyzer/rubrics/gap-analyzer-quality.md @@ -1,6 +1,7 @@ ## Rubric: gap-analyzer of two-project-security-gap scaffold ### Presence — things the analysis must identify + - The analysis identifies that Rails lacks password hashing, comparing Rails plaintext password comparison against Go's hashed password implementation - The analysis identifies that Rails lacks token-based (JWT) authentication, compared to Go's JWT implementation - The analysis identifies SQL injection vulnerabilities present in both applications' user lookup functions @@ -10,15 +11,18 @@ - The analysis declares the comparison direction used ### Specificity — the analysis must be concrete + - The analysis references specific file paths when citing evidence from both projects (e.g., app/models/user.rb, internal/db/users.go) - The analysis provides evidence pairs — citations from both the Rails and Go codebases for each finding - The analysis identifies the specific methods or functions involved in each gap (e.g., find_by_name, GetUser, ValidatePassword) ### Depth — the analysis must be actionable + - The analysis explains how the Rails plaintext password approach differs from Go's hashing approach at a feature/behavior level - The analysis distinguishes between shared vulnerabilities (present in both) and gaps where one app has a feature the other lacks ### Absence — the analysis must not do these things + - The analysis must not recommend specific programming languages, frameworks, or libraries as fixes (per the agent's rules about not reporting implementation details) - The analysis must not include prioritization or impact assessment (per the agent's rules) - The analysis must not hallucinate security vulnerabilities that don't exist in the scaffold code @@ -26,6 +30,7 @@ ## File: gap-analysis.md ### Presence + - The file contains a "Gap Analysis" heading describing the security comparison between the Rails and Go applications - The file contains a comparison direction section declaring Rails as current state and Go as desired state - The file contains a summary section with a gap category count table covering Missing, Partial, Divergent, and Implicit categories @@ -33,9 +38,11 @@ - Each finding includes Category, Feature/Behavior, Current State, and Desired State fields ### Specificity + - Each finding's Current State and Desired State fields cite specific file paths from the scaffold (e.g., app/models/user.rb, internal/auth/auth.go, internal/db/users.go) - Each finding includes an evidence pair with citations from both the Rails and Go codebases ### Absence + - The file must not contain prioritization or impact rankings for findings - The file must not recommend specific implementation fixes or library choices diff --git a/evals/gap-analyzer/tests.json b/evals/gap-analyzer/tests.json index 6445c93b..a89c20aa 100644 --- a/evals/gap-analyzer/tests.json +++ b/evals/gap-analyzer/tests.json @@ -1,18 +1,110 @@ { "plugins": ["han-core"], "tests": [ - { "name": "Agent Call: compare implementation to PRD", "type": "agent-call", "agentFile": "han-core:gap-analyzer", "promptFile": "agent-call-compare-impl-to-prd.md", "model": "opus", "expect": [{ "agent-call": true }] }, - { "name": "Agent Call: check code covers requirements", "type": "agent-call", "agentFile": "han-core:gap-analyzer", "promptFile": "agent-call-check-code-covers-requirements.md", "model": "opus", "expect": [{ "agent-call": true }] }, - { "name": "Agent Call: what's missing from spec", "type": "agent-call", "agentFile": "han-core:gap-analyzer", "promptFile": "agent-call-whats-missing-from-spec.md", "model": "opus", "expect": [{ "agent-call": true }] }, - { "name": "Agent Call: diff built vs planned", "type": "agent-call", "agentFile": "han-core:gap-analyzer", "promptFile": "agent-call-diff-built-vs-planned.md", "model": "opus", "expect": [{ "agent-call": true }] }, - { "name": "Agent Call: find gaps to migration target", "type": "agent-call", "agentFile": "han-core:gap-analyzer", "promptFile": "agent-call-find-gaps-migration-target.md", "model": "opus", "expect": [{ "agent-call": true }] }, - { "name": "Agent Call: revenue projections (negative)", "type": "agent-call", "agentFile": "han-core:gap-analyzer", "promptFile": "agent-call-revenue-projections.md", "model": "sonnet", "expect": [{ "agent-call": false }] }, - { "name": "Agent Call: db performance bottleneck (negative)", "type": "agent-call", "agentFile": "han-core:gap-analyzer", "promptFile": "agent-call-db-performance-bottleneck.md", "model": "sonnet", "expect": [{ "agent-call": false }] }, - { "name": "Agent Call: refactor suggestions (negative)", "type": "agent-call", "agentFile": "han-core:gap-analyzer", "promptFile": "agent-call-refactor-suggestions.md", "model": "sonnet", "expect": [{ "agent-call": false }] }, - { "name": "Agent Call: investigate 500 error (sibling)", "type": "agent-call", "agentFile": "han-core:gap-analyzer", "promptFile": "agent-call-investigate-500-error.md", "model": "sonnet", "expect": [{ "agent-call": false }] }, - { "name": "Agent Call: module coupling (sibling)", "type": "agent-call", "agentFile": "han-core:gap-analyzer", "promptFile": "agent-call-module-coupling.md", "model": "sonnet", "expect": [{ "agent-call": false }] }, - { "name": "Agent Call: trace data flow (sibling)", "type": "agent-call", "agentFile": "han-core:gap-analyzer", "promptFile": "agent-call-trace-data-flow.md", "model": "sonnet", "expect": [{ "agent-call": false }] }, - { "name": "Agent Call: check README preserved (sibling)", "type": "agent-call", "agentFile": "han-core:gap-analyzer", "promptFile": "agent-call-check-readme-preserved.md", "model": "sonnet", "expect": [{ "agent-call": false }] }, - { "name": "Agent Prompt: security gap analysis — rails to go migration", "type": "agent-prompt", "agentFile": "han-core:gap-analyzer", "promptFile": "agent-prompt-security-gap-rails-to-go.md", "scaffold": "two-project-security-gap", "model": "opus", "expect": [{ "llm-judge": { "rubricFile": "gap-analyzer-quality.md", "model": "opus", "threshold": 0.8 } }] } + { + "name": "Agent Call: compare implementation to PRD", + "type": "agent-call", + "agentFile": "han-core:gap-analyzer", + "promptFile": "agent-call-compare-impl-to-prd.md", + "model": "opus", + "expect": [{ "agent-call": true }] + }, + { + "name": "Agent Call: check code covers requirements", + "type": "agent-call", + "agentFile": "han-core:gap-analyzer", + "promptFile": "agent-call-check-code-covers-requirements.md", + "model": "opus", + "expect": [{ "agent-call": true }] + }, + { + "name": "Agent Call: what's missing from spec", + "type": "agent-call", + "agentFile": "han-core:gap-analyzer", + "promptFile": "agent-call-whats-missing-from-spec.md", + "model": "opus", + "expect": [{ "agent-call": true }] + }, + { + "name": "Agent Call: diff built vs planned", + "type": "agent-call", + "agentFile": "han-core:gap-analyzer", + "promptFile": "agent-call-diff-built-vs-planned.md", + "model": "opus", + "expect": [{ "agent-call": true }] + }, + { + "name": "Agent Call: find gaps to migration target", + "type": "agent-call", + "agentFile": "han-core:gap-analyzer", + "promptFile": "agent-call-find-gaps-migration-target.md", + "model": "opus", + "expect": [{ "agent-call": true }] + }, + { + "name": "Agent Call: revenue projections (negative)", + "type": "agent-call", + "agentFile": "han-core:gap-analyzer", + "promptFile": "agent-call-revenue-projections.md", + "model": "sonnet", + "expect": [{ "agent-call": false }] + }, + { + "name": "Agent Call: db performance bottleneck (negative)", + "type": "agent-call", + "agentFile": "han-core:gap-analyzer", + "promptFile": "agent-call-db-performance-bottleneck.md", + "model": "sonnet", + "expect": [{ "agent-call": false }] + }, + { + "name": "Agent Call: refactor suggestions (negative)", + "type": "agent-call", + "agentFile": "han-core:gap-analyzer", + "promptFile": "agent-call-refactor-suggestions.md", + "model": "sonnet", + "expect": [{ "agent-call": false }] + }, + { + "name": "Agent Call: investigate 500 error (sibling)", + "type": "agent-call", + "agentFile": "han-core:gap-analyzer", + "promptFile": "agent-call-investigate-500-error.md", + "model": "sonnet", + "expect": [{ "agent-call": false }] + }, + { + "name": "Agent Call: module coupling (sibling)", + "type": "agent-call", + "agentFile": "han-core:gap-analyzer", + "promptFile": "agent-call-module-coupling.md", + "model": "sonnet", + "expect": [{ "agent-call": false }] + }, + { + "name": "Agent Call: trace data flow (sibling)", + "type": "agent-call", + "agentFile": "han-core:gap-analyzer", + "promptFile": "agent-call-trace-data-flow.md", + "model": "sonnet", + "expect": [{ "agent-call": false }] + }, + { + "name": "Agent Call: check README preserved (sibling)", + "type": "agent-call", + "agentFile": "han-core:gap-analyzer", + "promptFile": "agent-call-check-readme-preserved.md", + "model": "sonnet", + "expect": [{ "agent-call": false }] + }, + { + "name": "Agent Prompt: security gap analysis — rails to go migration", + "type": "agent-prompt", + "agentFile": "han-core:gap-analyzer", + "promptFile": "agent-prompt-security-gap-rails-to-go.md", + "scaffold": "two-project-security-gap", + "model": "opus", + "expect": [{ "llm-judge": { "rubricFile": "gap-analyzer-quality.md", "model": "opus", "threshold": 0.8 } }] + } ] } diff --git a/evals/investigate/tests.json b/evals/investigate/tests.json index c5f1a564..edcbc34b 100644 --- a/evals/investigate/tests.json +++ b/evals/investigate/tests.json @@ -29,9 +29,7 @@ "skillFile": "han-coding:investigate", "promptFile": "skill-call-investigate.md", "scaffold": "ruby-project", - "expect": [ - { "skill-call": true } - ] + "expect": [{ "skill-call": true }] }, { "name": "Skill Call: no investigate", @@ -40,9 +38,7 @@ "skillFile": "han-coding:investigate", "promptFile": "skill-call-no-investigate.md", "scaffold": "ruby-project", - "expect": [ - { "skill-call": false } - ] + "expect": [{ "skill-call": false }] } ] } diff --git a/evals/iterative-plan-review/prompts/skill-call-check-plan-correctness.md b/evals/iterative-plan-review/prompts/skill-call-check-plan-correctness.md index ae2a7dd1..6e571aee 100644 --- a/evals/iterative-plan-review/prompts/skill-call-check-plan-correctness.md +++ b/evals/iterative-plan-review/prompts/skill-call-check-plan-correctness.md @@ -1 +1 @@ -check that plan for correctness and consistency \ No newline at end of file +check that plan for correctness and consistency diff --git a/evals/iterative-plan-review/prompts/skill-call-create-new-plan.md b/evals/iterative-plan-review/prompts/skill-call-create-new-plan.md index a48d4ffd..ca070f95 100644 --- a/evals/iterative-plan-review/prompts/skill-call-create-new-plan.md +++ b/evals/iterative-plan-review/prompts/skill-call-create-new-plan.md @@ -1 +1 @@ -create a new plan for adding auth to the app \ No newline at end of file +create a new plan for adding auth to the app diff --git a/evals/iterative-plan-review/prompts/skill-call-document-payment-system.md b/evals/iterative-plan-review/prompts/skill-call-document-payment-system.md index d6b0b347..a7da0a61 100644 --- a/evals/iterative-plan-review/prompts/skill-call-document-payment-system.md +++ b/evals/iterative-plan-review/prompts/skill-call-document-payment-system.md @@ -1 +1 @@ -document how the payment system works \ No newline at end of file +document how the payment system works diff --git a/evals/iterative-plan-review/prompts/skill-call-follow-plan-implement.md b/evals/iterative-plan-review/prompts/skill-call-follow-plan-implement.md index 69c0d227..a11a853b 100644 --- a/evals/iterative-plan-review/prompts/skill-call-follow-plan-implement.md +++ b/evals/iterative-plan-review/prompts/skill-call-follow-plan-implement.md @@ -1 +1 @@ -follow the plan in PLAN.md and implement the changes \ No newline at end of file +follow the plan in PLAN.md and implement the changes diff --git a/evals/iterative-plan-review/prompts/skill-call-investigate-login-500.md b/evals/iterative-plan-review/prompts/skill-call-investigate-login-500.md index 501cdb79..1e0fd98b 100644 --- a/evals/iterative-plan-review/prompts/skill-call-investigate-login-500.md +++ b/evals/iterative-plan-review/prompts/skill-call-investigate-login-500.md @@ -1 +1 @@ -investigate why the login endpoint is returning 500s \ No newline at end of file +investigate why the login endpoint is returning 500s diff --git a/evals/iterative-plan-review/prompts/skill-call-iterate-the-plan.md b/evals/iterative-plan-review/prompts/skill-call-iterate-the-plan.md index 04b8e654..abe8e0dc 100644 --- a/evals/iterative-plan-review/prompts/skill-call-iterate-the-plan.md +++ b/evals/iterative-plan-review/prompts/skill-call-iterate-the-plan.md @@ -1 +1 @@ -iterate the plan \ No newline at end of file +iterate the plan diff --git a/evals/iterative-plan-review/prompts/skill-call-post-pr-review.md b/evals/iterative-plan-review/prompts/skill-call-post-pr-review.md index d7565223..2032291a 100644 --- a/evals/iterative-plan-review/prompts/skill-call-post-pr-review.md +++ b/evals/iterative-plan-review/prompts/skill-call-post-pr-review.md @@ -1 +1 @@ -post a review of this PR to GitHub \ No newline at end of file +post a review of this PR to GitHub diff --git a/evals/iterative-plan-review/prompts/skill-call-review-code-changes.md b/evals/iterative-plan-review/prompts/skill-call-review-code-changes.md index 59b5d770..c2a8ff04 100644 --- a/evals/iterative-plan-review/prompts/skill-call-review-code-changes.md +++ b/evals/iterative-plan-review/prompts/skill-call-review-code-changes.md @@ -1 +1 @@ -review the code changes \ No newline at end of file +review the code changes diff --git a/evals/iterative-plan-review/prompts/skill-call-test-plan-auth.md b/evals/iterative-plan-review/prompts/skill-call-test-plan-auth.md index a07119c6..b9e79f77 100644 --- a/evals/iterative-plan-review/prompts/skill-call-test-plan-auth.md +++ b/evals/iterative-plan-review/prompts/skill-call-test-plan-auth.md @@ -1 +1 @@ -write a test plan for the new auth module \ No newline at end of file +write a test plan for the new auth module diff --git a/evals/iterative-plan-review/prompts/skill-call-validate-current-plan.md b/evals/iterative-plan-review/prompts/skill-call-validate-current-plan.md index c7f899d4..4c5524b6 100644 --- a/evals/iterative-plan-review/prompts/skill-call-validate-current-plan.md +++ b/evals/iterative-plan-review/prompts/skill-call-validate-current-plan.md @@ -1 +1 @@ -validate the current plan \ No newline at end of file +validate the current plan diff --git a/evals/iterative-plan-review/prompts/skill-call-verify-test-suite.md b/evals/iterative-plan-review/prompts/skill-call-verify-test-suite.md index 14d26e0e..ca4358fd 100644 --- a/evals/iterative-plan-review/prompts/skill-call-verify-test-suite.md +++ b/evals/iterative-plan-review/prompts/skill-call-verify-test-suite.md @@ -1 +1 @@ -verify the test suite passes \ No newline at end of file +verify the test suite passes diff --git a/evals/iterative-plan-review/prompts/skill-call-verify-will-work.md b/evals/iterative-plan-review/prompts/skill-call-verify-will-work.md index d6a61210..b41ddd0d 100644 --- a/evals/iterative-plan-review/prompts/skill-call-verify-will-work.md +++ b/evals/iterative-plan-review/prompts/skill-call-verify-will-work.md @@ -1 +1 @@ -can you verify this will work as expected? \ No newline at end of file +can you verify this will work as expected? diff --git a/evals/iterative-plan-review/rubrics/iterative-plan-review-quality.md b/evals/iterative-plan-review/rubrics/iterative-plan-review-quality.md index 0819ef17..9e963c0a 100644 --- a/evals/iterative-plan-review/rubrics/iterative-plan-review-quality.md +++ b/evals/iterative-plan-review/rubrics/iterative-plan-review-quality.md @@ -1,6 +1,7 @@ ## Rubric: iterative-plan-review of ruby-security-app scaffold ### Presence — things the review must identify + - The review surfaces the ordering contradiction in Section 4.1 — the plan lists the test framework under Phase 4 but states it must run before Phase 1 tests can land, and the iteration should either move it or explicitly resolve the contradiction - The review challenges the Phase 1.2 backfill strategy that bcrypts the legacy `password` column, noting that `db/migrate/001_create_users.rb` stores plaintext and the migration assumes every row has a non-null, bcrypt-compatible value - The review challenges the "dummy `BCrypt::Password.create("")` on the nil-user branch" in Section 1.2 as insufficient for constant-time auth — creating a fresh digest has variable cost and the common fix is a precomputed dummy digest constant @@ -10,17 +11,20 @@ - The review produces an iteration summary section at the end of the plan file covering iterations completed, assumptions challenged, consolidations made, and ambiguities resolved ### Specificity — the review must be concrete + - Challenges cite specific plan sections by their numeric identifier (e.g., "Section 1.2", "Phase 2.2", "Section 4.1") - Challenges cite specific file paths from the scaffold (e.g., `app/models/user.rb`, `db/migrate/001_create_users.rb`, `config/database.yml`) when grounding claims in the codebase - Challenges reference specific review IDs from the cross-reference table (SEC-001, CRIT-007, WARN-013, etc.) when discussing which findings are affected - The iteration summary includes concrete counts (number of iterations, number of assumptions challenged, number of consolidations) rather than vague language ### Depth — the review must be actionable + - For each assumption the review refutes or challenges, the plan file is edited with a concrete change — new wording, an added step, a removed redundancy, or a resolution note — not just a comment that "this may be wrong" - Proposed plan edits show what the new plan text should say, not just what is wrong with the current text - When overlap with existing codebase patterns is identified, the review cites the specific file or construct being duplicated ### Absence — the review must not do these things + - The review does not hallucinate files, methods, controllers, migrations, or review IDs that do not exist in the scaffold or the plan - The review does not rewrite the plan wholesale or replace its phase structure, cross-reference table, or open-questions section with a new organization - The review does not execute or begin implementing the plan (no edits to `app/`, `config/`, or `db/` files — only to the plan file) @@ -31,13 +35,16 @@ ## File: plans/code-review-result.plan.md ### Presence + - The file contains a new iteration summary section (e.g., "## Iteration Summary" or equivalent heading) added by the skill - The file's content differs from the original — at least one phase section has been edited in response to a challenged assumption or identified overlap ### Specificity + - The iteration summary section lists numeric counts for iterations completed and assumptions challenged - Any new or edited plan steps reference specific scaffold file paths rather than generic descriptions ### Absence + - The file still contains the original phase structure (Phase 0 through Phase 4), the "Cross-Reference: Review ID → Plan Section" table, and the "Open Questions / Decisions Needed" section — the skill refines, it does not replace - The file does not contain placeholder markers like `TBD`, `TODO(claude)`, or `` diff --git a/evals/iterative-plan-review/scaffolds/ruby-security-app/plans/code-review-result.md b/evals/iterative-plan-review/scaffolds/ruby-security-app/plans/code-review-result.md index 214422ed..7cf02e4b 100644 --- a/evals/iterative-plan-review/scaffolds/ruby-security-app/plans/code-review-result.md +++ b/evals/iterative-plan-review/scaffolds/ruby-security-app/plans/code-review-result.md @@ -2,56 +2,56 @@ ## 📋 Review Summary -| Task ID | Category | File | Description | -|---------|----------|------|-------------| -| CRIT-001 | [Testing: Coverage Gap] | app/models/user.rb:5-17 | No test pins the SQL injection behavior in `User.find_by_name` | -| CRIT-002 | [Testing: Coverage Gap] | app/controllers/sessions_controller.rb:19 | No test characterizes the plaintext password comparison | -| CRIT-003 | [Testing: Coverage Gap] | app/models/user.rb:20-33 | No test asserts the parameterized `find_by_user_id` is not injectable | -| CRIT-004 | [Testing: Edge Case] | app/models/user.rb:6 | SQL injection via `params[:name]` flowing into interpolated SQL | -| CRIT-005 | [Testing: Edge Case] | app/controllers/sessions_controller.rb:19 | Plaintext password comparison against plaintext DB column | -| CRIT-006 | [Testing: Edge Case] | app/models/user.rb:6-7 | `find_by_name` has no `LIMIT 1`; injection or index drop enables wrong-user auth | -| CRIT-007 | [Testing: Edge Case] | app/controllers/sessions_controller.rb:24-25 | Session fixation — no `reset_session` before assigning `session[:user_id]` | -| CRIT-008 | [Testing: Edge Case] | app/controllers/users_controller.rb:17-22 | Unauthenticated PII/role disclosure via `GET /users?name=` | -| CRIT-009 | [Security] | app/models/user.rb:6 | → see SEC-001 for full exploit path | -| CRIT-010 | [Security] | config/database.yml:5-9 | → see SEC-002 for full exploit path | -| CRIT-011 | [Security] | db/migrate/001_create_users.rb:6 | → see SEC-003 for full exploit path | -| CRIT-012 | [Security] | app/controllers/sessions_controller.rb:14-22 | → see SEC-004 for full exploit path | -| CRIT-013 | [Security] | app/controllers/application_controller.rb:2-4 | → see SEC-005 for full exploit path | -| CRIT-014 | [Security] | app/controllers/users_controller.rb:17-22 | → see SEC-006 for full exploit path | -| CRIT-015 | [Security] | config/routes.rb:2 | → see SEC-007 for full exploit path | -| WARN-001 | [Code Maintainability] | app/models/user.rb:10-16, 26-32 | Row-to-User mapping duplicated across `find_by_name` and `find_by_user_id` | -| WARN-002 | [Testing: Coverage Gap] | app/controllers/sessions_controller.rb:4-28 | No happy-path login test | -| WARN-003 | [Testing: Coverage Gap] | app/controllers/sessions_controller.rb:8-11 | No test for blank username/password 400 branch | -| WARN-004 | [Testing: Coverage Gap] | app/controllers/sessions_controller.rb:13-17 | No test for user-not-found 401 branch | -| WARN-005 | [Testing: Coverage Gap] | app/controllers/users_controller.rb:17-22 | No test pins the JSON response shape for `users#show` | -| WARN-006 | [Testing: Coverage Gap] | app/controllers/users_controller.rb:6-9 | No test for blank `name` 400 branch | -| WARN-007 | [Testing: Coverage Gap] | app/controllers/users_controller.rb:11-15 | No test for user-not-found 404 branch | -| WARN-008 | [Testing: Coverage Gap] | app/models/user.rb:5-17 | No happy-path test for `find_by_name` field population | -| WARN-009 | [Testing: Coverage Gap] | app/models/user.rb:20-33 | No happy-path test for `find_by_user_id` field population | -| WARN-010 | [Testing: Coverage Gap] | app/controllers/application_controller.rb:2-4 | No test characterizes the `rescue_from StandardError` message leak | -| WARN-011 | [Testing: Edge Case] | app/controllers/sessions_controller.rb:5-6 | Array/Hash param types bypass `blank?` and reach SQL interpolation | -| WARN-012 | [Testing: Edge Case] | app/models/user.rb:6 | Legitimate apostrophe in `name` (e.g. "O'Brien") breaks SQL query | -| WARN-013 | [Testing: Edge Case] | app/models/user.rb:6 | Unicode normalization / case sensitivity mismatches on `name` | -| WARN-014 | [Testing: Edge Case] | app/controllers/sessions_controller.rb:5-6 | No length cap on username/password; multi-MB inputs reach DB | -| WARN-015 | [Testing: Edge Case] | app/controllers/sessions_controller.rb:8 | `blank?` distinguishes "missing field" vs "wrong password" error shapes | -| WARN-016 | [Testing: Edge Case] | app/models/user.rb:7 | DB connection failures propagate to `rescue_from` and leak messages | -| WARN-017 | [Testing: Edge Case] | app/controllers/application_controller.rb:2-4 | Exception messages rendered to client as JSON error body | -| WARN-018 | [Testing: Edge Case] | app/controllers/sessions_controller.rb:24 | No CSRF protection (`ActionController::API` skips CSRF) on cookie-backed login | -| SUGG-001 | [Code Organization] | Gemfile | No `Gemfile.lock` committed; dependency resolution is non-reproducible | -| SUGG-002 | [API Design] | config/routes.rb | No logout/session destroy route | -| SUGG-003 | [Testing] | Gemfile | No test framework or `test` group declared | -| SUGG-004 | [Testing: Coverage Gap] | app/models/user.rb:8 | No test for `find_by_name` returning nil on no match | -| SUGG-005 | [Testing: Coverage Gap] | app/models/user.rb:24 | No test for `find_by_user_id` returning nil on unknown id | -| SUGG-006 | [Testing: Edge Case] | app/controllers/users_controller.rb:5 | Sentinel strings like "null"/"undefined" pass `blank?` and hit the DB literally | -| SUGG-007 | [Testing: Edge Case] | app/models/user.rb:15 | No CHECK constraint on `role`; DB drift can introduce unexpected roles into `session[:role]` | -| SUGG-008 | [Testing: Edge Case] | app/controllers/sessions_controller.rb:8 | Whitespace-only passwords are blocked at the controller regardless of what is stored | -| SEC-001 | [OWASP: A03 Injection] | app/models/user.rb:6-7 | SQL injection via string-interpolated `name` | -| SEC-002 | [OWASP: A02/A07] | config/database.yml:5-9 | Hardcoded production DB credentials committed to repo | -| SEC-003 | [OWASP: A02] | db/migrate/001_create_users.rb:6 | Plaintext password storage (no bcrypt / `has_secure_password`) | -| SEC-004 | [OWASP: A07] | app/controllers/sessions_controller.rb:14-22 | Non-constant-time password compare + username enumeration | -| SEC-005 | [OWASP: A05] | app/controllers/application_controller.rb:2-4 | Raw exception message leaked via rescue handler | -| SEC-006 | [OWASP: A02/A01] | app/controllers/users_controller.rb:17-22 | Sensitive fields (email, role) returned unauthenticated | -| SEC-007 | [OWASP: A01] | config/routes.rb:2 | Broken access control — no authentication on `/users` | +| Task ID | Category | File | Description | +| -------- | ----------------------- | --------------------------------------------- | -------------------------------------------------------------------------------------------- | +| CRIT-001 | [Testing: Coverage Gap] | app/models/user.rb:5-17 | No test pins the SQL injection behavior in `User.find_by_name` | +| CRIT-002 | [Testing: Coverage Gap] | app/controllers/sessions_controller.rb:19 | No test characterizes the plaintext password comparison | +| CRIT-003 | [Testing: Coverage Gap] | app/models/user.rb:20-33 | No test asserts the parameterized `find_by_user_id` is not injectable | +| CRIT-004 | [Testing: Edge Case] | app/models/user.rb:6 | SQL injection via `params[:name]` flowing into interpolated SQL | +| CRIT-005 | [Testing: Edge Case] | app/controllers/sessions_controller.rb:19 | Plaintext password comparison against plaintext DB column | +| CRIT-006 | [Testing: Edge Case] | app/models/user.rb:6-7 | `find_by_name` has no `LIMIT 1`; injection or index drop enables wrong-user auth | +| CRIT-007 | [Testing: Edge Case] | app/controllers/sessions_controller.rb:24-25 | Session fixation — no `reset_session` before assigning `session[:user_id]` | +| CRIT-008 | [Testing: Edge Case] | app/controllers/users_controller.rb:17-22 | Unauthenticated PII/role disclosure via `GET /users?name=` | +| CRIT-009 | [Security] | app/models/user.rb:6 | → see SEC-001 for full exploit path | +| CRIT-010 | [Security] | config/database.yml:5-9 | → see SEC-002 for full exploit path | +| CRIT-011 | [Security] | db/migrate/001_create_users.rb:6 | → see SEC-003 for full exploit path | +| CRIT-012 | [Security] | app/controllers/sessions_controller.rb:14-22 | → see SEC-004 for full exploit path | +| CRIT-013 | [Security] | app/controllers/application_controller.rb:2-4 | → see SEC-005 for full exploit path | +| CRIT-014 | [Security] | app/controllers/users_controller.rb:17-22 | → see SEC-006 for full exploit path | +| CRIT-015 | [Security] | config/routes.rb:2 | → see SEC-007 for full exploit path | +| WARN-001 | [Code Maintainability] | app/models/user.rb:10-16, 26-32 | Row-to-User mapping duplicated across `find_by_name` and `find_by_user_id` | +| WARN-002 | [Testing: Coverage Gap] | app/controllers/sessions_controller.rb:4-28 | No happy-path login test | +| WARN-003 | [Testing: Coverage Gap] | app/controllers/sessions_controller.rb:8-11 | No test for blank username/password 400 branch | +| WARN-004 | [Testing: Coverage Gap] | app/controllers/sessions_controller.rb:13-17 | No test for user-not-found 401 branch | +| WARN-005 | [Testing: Coverage Gap] | app/controllers/users_controller.rb:17-22 | No test pins the JSON response shape for `users#show` | +| WARN-006 | [Testing: Coverage Gap] | app/controllers/users_controller.rb:6-9 | No test for blank `name` 400 branch | +| WARN-007 | [Testing: Coverage Gap] | app/controllers/users_controller.rb:11-15 | No test for user-not-found 404 branch | +| WARN-008 | [Testing: Coverage Gap] | app/models/user.rb:5-17 | No happy-path test for `find_by_name` field population | +| WARN-009 | [Testing: Coverage Gap] | app/models/user.rb:20-33 | No happy-path test for `find_by_user_id` field population | +| WARN-010 | [Testing: Coverage Gap] | app/controllers/application_controller.rb:2-4 | No test characterizes the `rescue_from StandardError` message leak | +| WARN-011 | [Testing: Edge Case] | app/controllers/sessions_controller.rb:5-6 | Array/Hash param types bypass `blank?` and reach SQL interpolation | +| WARN-012 | [Testing: Edge Case] | app/models/user.rb:6 | Legitimate apostrophe in `name` (e.g. "O'Brien") breaks SQL query | +| WARN-013 | [Testing: Edge Case] | app/models/user.rb:6 | Unicode normalization / case sensitivity mismatches on `name` | +| WARN-014 | [Testing: Edge Case] | app/controllers/sessions_controller.rb:5-6 | No length cap on username/password; multi-MB inputs reach DB | +| WARN-015 | [Testing: Edge Case] | app/controllers/sessions_controller.rb:8 | `blank?` distinguishes "missing field" vs "wrong password" error shapes | +| WARN-016 | [Testing: Edge Case] | app/models/user.rb:7 | DB connection failures propagate to `rescue_from` and leak messages | +| WARN-017 | [Testing: Edge Case] | app/controllers/application_controller.rb:2-4 | Exception messages rendered to client as JSON error body | +| WARN-018 | [Testing: Edge Case] | app/controllers/sessions_controller.rb:24 | No CSRF protection (`ActionController::API` skips CSRF) on cookie-backed login | +| SUGG-001 | [Code Organization] | Gemfile | No `Gemfile.lock` committed; dependency resolution is non-reproducible | +| SUGG-002 | [API Design] | config/routes.rb | No logout/session destroy route | +| SUGG-003 | [Testing] | Gemfile | No test framework or `test` group declared | +| SUGG-004 | [Testing: Coverage Gap] | app/models/user.rb:8 | No test for `find_by_name` returning nil on no match | +| SUGG-005 | [Testing: Coverage Gap] | app/models/user.rb:24 | No test for `find_by_user_id` returning nil on unknown id | +| SUGG-006 | [Testing: Edge Case] | app/controllers/users_controller.rb:5 | Sentinel strings like "null"/"undefined" pass `blank?` and hit the DB literally | +| SUGG-007 | [Testing: Edge Case] | app/models/user.rb:15 | No CHECK constraint on `role`; DB drift can introduce unexpected roles into `session[:role]` | +| SUGG-008 | [Testing: Edge Case] | app/controllers/sessions_controller.rb:8 | Whitespace-only passwords are blocked at the controller regardless of what is stored | +| SEC-001 | [OWASP: A03 Injection] | app/models/user.rb:6-7 | SQL injection via string-interpolated `name` | +| SEC-002 | [OWASP: A02/A07] | config/database.yml:5-9 | Hardcoded production DB credentials committed to repo | +| SEC-003 | [OWASP: A02] | db/migrate/001_create_users.rb:6 | Plaintext password storage (no bcrypt / `has_secure_password`) | +| SEC-004 | [OWASP: A07] | app/controllers/sessions_controller.rb:14-22 | Non-constant-time password compare + username enumeration | +| SEC-005 | [OWASP: A05] | app/controllers/application_controller.rb:2-4 | Raw exception message leaked via rescue handler | +| SEC-006 | [OWASP: A02/A01] | app/controllers/users_controller.rb:17-22 | Sensitive fields (email, role) returned unauthenticated | +| SEC-007 | [OWASP: A01] | config/routes.rb:2 | Broken access control — no authentication on `/users` | > **Note:** An additional 7 testing edge-case findings (EC17, EC18, EC19, EC20, EC21, EC22, EC23 from the edge-case explorer) were omitted to stay within the 30-item testing finding cap. Another code review is recommended after addressing the current items. @@ -206,6 +206,7 @@ A whitespace-only password is blocked at the controller by `blank?`. Users whose ## 🔐 Security Vulnerabilities **SEC-001: SQL Injection in `User.find_by_name`** + - **OWASP:** A03 — Injection - **Location:** `app/models/user.rb:6-7` - **Evidence:** @@ -217,6 +218,7 @@ A whitespace-only password is blocked at the controller by `blank?`. Users whose - **Severity:** Critical **SEC-002: Hardcoded Database Credentials** + - **OWASP:** A02 — Cryptographic Failures / A07 — Authentication Failures - **Location:** `config/database.yml:5-9` - **Evidence:** @@ -230,6 +232,7 @@ A whitespace-only password is blocked at the controller by `blank?`. Users whose - **Severity:** Critical **SEC-003: Plaintext Password Storage** + - **OWASP:** A02 — Cryptographic Failures - **Location:** `db/migrate/001_create_users.rb:6` and `app/models/user.rb:14` - **Evidence:** Schema defines `t.string :password, null: false` and the model reads `user.password = result["password"]` then compares `user.password != password` in `sessions_controller.rb:19`. @@ -237,6 +240,7 @@ A whitespace-only password is blocked at the controller by `blank?`. Users whose - **Severity:** Critical **SEC-004: Non-Constant-Time Password Comparison and Username Enumeration** + - **OWASP:** A07 — Identification and Authentication Failures - **Location:** `app/controllers/sessions_controller.rb:14-22` - **Evidence:** @@ -251,6 +255,7 @@ A whitespace-only password is blocked at the controller by `blank?`. Users whose - **Severity:** High **SEC-005: Stack Trace / Internal Detail Leakage via Rescue Handler** + - **OWASP:** A05 — Security Misconfiguration - **Location:** `app/controllers/application_controller.rb:2-4` - **Evidence:** @@ -263,6 +268,7 @@ A whitespace-only password is blocked at the controller by `blank?`. Users whose - **Severity:** High **SEC-006: Sensitive Data Exposure in API Response** + - **OWASP:** A02 — Cryptographic Failures / A01 — Broken Access Control - **Location:** `app/controllers/users_controller.rb:17-22` - **Evidence:** @@ -274,6 +280,7 @@ A whitespace-only password is blocked at the controller by `blank?`. Users whose - **Severity:** High **SEC-007: Broken Access Control — No Authentication on Sensitive Endpoints** + - **OWASP:** A01 — Broken Access Control - **Location:** `config/routes.rb:2` and `app/controllers/application_controller.rb` (no `before_action`) - **Evidence:** `ApplicationController < ActionController::API` contains no authentication filter; `UsersController` has no `before_action`; `/users` is reachable without a session. diff --git a/evals/iterative-plan-review/scaffolds/ruby-security-app/plans/code-review-result.plan.md b/evals/iterative-plan-review/scaffolds/ruby-security-app/plans/code-review-result.plan.md index c8ff08c1..7d919408 100644 --- a/evals/iterative-plan-review/scaffolds/ruby-security-app/plans/code-review-result.plan.md +++ b/evals/iterative-plan-review/scaffolds/ruby-security-app/plans/code-review-result.plan.md @@ -5,7 +5,7 @@ This plan resolves every item in `code-review-result.md`: 15 critical issues, 18 ## Guiding Principles - **Characterize, then fix.** For each critical defect, land a failing/characterization test first (in the same PR as the fix) so the behavioral change is visible in the diff. This is what CRIT-001..CRIT-003 and WARN-010 are asking for. -- **Rotate before removing.** Secrets already committed (SEC-002) must be rotated on the live systems *before* they are scrubbed from the repo, or the scrub is cosmetic. +- **Rotate before removing.** Secrets already committed (SEC-002) must be rotated on the live systems _before_ they are scrubbed from the repo, or the scrub is cosmetic. - **Auth opt-out, not opt-in.** Move `authenticate_user!` onto `ApplicationController` and have exceptions `skip_before_action` explicitly. Prevents the whole class of SEC-007-style omissions. - **Fail closed on errors.** Exceptions must never render `e.message` to clients. All paths go through an opaque error with a server-side correlation id. @@ -35,6 +35,7 @@ Goal: close every unauthenticated remote exploit path. Everything in this phase - Both finders call the helper. **Tests to land with the fix (same PR):** + - CRIT-001: characterization test `User.find_by_name("nobody' OR name='admin' --")` that asserted the vulnerable return before the fix, now asserts `nil` after. - CRIT-003: `User.find_by_user_id("1 OR 1=1")` returns `nil` — pins the parameterization invariant on the already-safe finder. - WARN-008, WARN-009: happy-path tests that insert a row and assert every field is populated by each finder. @@ -46,13 +47,14 @@ Goal: close every unauthenticated remote exploit path. Everything in this phase **Files:** `app/models/user.rb`, `app/controllers/sessions_controller.rb:14-22`, `db/migrate/001_create_users.rb:6`, new migration `db/migrate/002_add_password_digest_to_users.rb`. -- New migration adds `password_digest:string, null: false` and backfills existing rows via a one-shot bcrypt of the legacy plaintext column. Drop the plaintext `password` column in a follow-up migration *after* all readers are off it. Do not drop in the same migration — it kills rollback. +- New migration adds `password_digest:string, null: false` and backfills existing rows via a one-shot bcrypt of the legacy plaintext column. Drop the plaintext `password` column in a follow-up migration _after_ all readers are off it. Do not drop in the same migration — it kills rollback. - `User` adds `has_secure_password`. Remove `user.password = result["password"]` from `row_to_user`; the digest is loaded by AR automatically once `password_digest` exists. - `SessionsController#create` replaces `user.password != password` with `user.authenticate(password)`. - Equal-time branches: even when `User.find_by_name` returns `nil`, run a dummy `BCrypt::Password.create("")` comparison before returning `401`, so the user-not-found and wrong-password timings match. - Both failure branches return the same JSON body (`"invalid credentials"`) — they already do (noted in "What's Good"), keep it. **Tests to land with the fix:** + - CRIT-002: happy-path login test (seed user, POST correct creds, assert 200 + `session[:user_id]` + `session[:role]`). - WARN-002: same test, verifying the contract. - SEC-004 timing: `user.authenticate` is called on both the nil-user and wrong-password paths (assert via stub that the dummy compare ran when the user was missing). @@ -69,6 +71,7 @@ Goal: close every unauthenticated remote exploit path. Everything in this phase - The client never sees `e.message`. This closes the error-based SQLi oracle (WARN-012, WARN-017) and the generic leak (SEC-005). **Tests to land with the fix:** + - WARN-010: stub `User.find_by_name` to raise; assert response body does not contain the exception message and does contain a UUID-shaped `id`. - WARN-016: stub to raise `ActiveRecord::ConnectionNotEstablished`; assert 500 + opaque body. @@ -79,9 +82,10 @@ Goal: close every unauthenticated remote exploit path. Everything in this phase - `ApplicationController` gains `before_action :authenticate_user!`, implemented as: look up `session[:user_id]`, set `@current_user`, 401 if missing. - `SessionsController` `skip_before_action :authenticate_user!, only: :create` (login cannot require a session). - `UsersController` stays authenticated; additionally narrow the response to the current user unless `@current_user.role == "admin"` (SEC-006 scoping). Do not remove the field allow-list — keep `{ id, name, email, role }` as-is, never serialize the whole record. -- In `SessionsController#create`, call `reset_session` *before* assigning `session[:user_id]` / `session[:role]` to close the fixation window (CRIT-007, WARN-018 interacts). +- In `SessionsController#create`, call `reset_session` _before_ assigning `session[:user_id]` / `session[:role]` to close the fixation window (CRIT-007, WARN-018 interacts). **Tests:** + - CRIT-008: unauthenticated `GET /users?name=alice` → 401. - WARN-005: authenticated `GET /users` response body has exactly the fields `id`, `name`, `email`, `role` — no `password`, no `password_digest`. - CRIT-007: pre-seed a session cookie, log in, assert `session.id` changed. @@ -101,7 +105,7 @@ Runs after Phase 1. Each item is small and independently landable. - Add `config/database.yml` to `.gitignore`? **No** — Rails reads it at boot. Instead, commit a sanitized template and keep the ENV values out of git. If the team prefers encrypted credentials, use `Rails.application.credentials.database` and keep `master.key` out of version control. - Add a CI check (Phase 4) that greps `config/database.yml` for literal `Password123!` and any `.internal` host. -Note: this is *in addition to* the Phase 0 rotation. The file scrub without rotation is useless; rotation without the scrub leaves the next dev to rediscover it. +Note: this is _in addition to_ the Phase 0 rotation. The file scrub without rotation is useless; rotation without the scrub leaves the next dev to rediscover it. ### 2.2 — Input validation on login and user show (WARN-011, WARN-014, WARN-015, SUGG-006, SUGG-008) @@ -110,7 +114,7 @@ Note: this is *in addition to* the Phase 0 rotation. The file scrub without rota - Extract a helper `scalar_param(name, max: 255)` on `ApplicationController` that: - Returns `nil` if the value is not a `String` (rejects `Array` / `ActionController::Parameters` — WARN-011). - Returns `nil` if over `max` bytes (WARN-014). - - Does *not* strip whitespace — whitespace normalization for names happens in the model (see 3.1). + - Does _not_ strip whitespace — whitespace normalization for names happens in the model (see 3.1). - Both controllers call it for `name` / `username` / `password`, returning 400 `invalid request body` on `nil`. - WARN-015: change the blank-param branch in `SessionsController` to return `401 invalid credentials` instead of `400 invalid request body`, so blank and wrong-password share a response shape. (Trade-off acknowledged: this makes malformed requests indistinguishable from bad credentials for legitimate clients. The review explicitly asks for it; preserving 400 for explicitly-missing keys while returning 401 on wrong values is an acceptable middle ground if the team pushes back.) - SUGG-006: reject literal `"null"`, `"undefined"`, `"NaN"` in `scalar_param` or document that they are treated as literal names. Default here: reject with 400, because no legitimate user has a name of `"null"`. @@ -190,22 +194,22 @@ Note: this is *in addition to* the Phase 0 rotation. The file scrub without rota ## Cross-Reference: Review ID → Plan Section -| Review ID | Section | -|---|---| -| CRIT-001, CRIT-003, WARN-008, WARN-009, SUGG-004, SUGG-005, WARN-012 | 1.1 | -| CRIT-002, CRIT-005, CRIT-011, CRIT-012, WARN-002, SEC-003, SEC-004 | 1.2 | -| CRIT-004, CRIT-009, SEC-001, CRIT-006 | 1.1 | -| CRIT-013, SEC-005, WARN-010, WARN-016, WARN-017 | 1.3 | -| CRIT-007, CRIT-008, CRIT-014, CRIT-015, SEC-006, SEC-007, WARN-005 | 1.4 | -| CRIT-010, SEC-002 | 0, 2.1 | -| WARN-001 | 1.1 (extracted with the fix) | -| WARN-003, WARN-004, WARN-006, WARN-007, WARN-011, WARN-014, WARN-015, SUGG-006, SUGG-008 | 2.2 | -| SUGG-002 | 2.3 | -| WARN-018 | 2.4 | -| WARN-013 | 3.1 | -| SUGG-007 | 3.2 | -| SUGG-003 | 4.1 (executed first) | -| SUGG-001 | 4.2 | +| Review ID | Section | +| ---------------------------------------------------------------------------------------- | ---------------------------- | +| CRIT-001, CRIT-003, WARN-008, WARN-009, SUGG-004, SUGG-005, WARN-012 | 1.1 | +| CRIT-002, CRIT-005, CRIT-011, CRIT-012, WARN-002, SEC-003, SEC-004 | 1.2 | +| CRIT-004, CRIT-009, SEC-001, CRIT-006 | 1.1 | +| CRIT-013, SEC-005, WARN-010, WARN-016, WARN-017 | 1.3 | +| CRIT-007, CRIT-008, CRIT-014, CRIT-015, SEC-006, SEC-007, WARN-005 | 1.4 | +| CRIT-010, SEC-002 | 0, 2.1 | +| WARN-001 | 1.1 (extracted with the fix) | +| WARN-003, WARN-004, WARN-006, WARN-007, WARN-011, WARN-014, WARN-015, SUGG-006, SUGG-008 | 2.2 | +| SUGG-002 | 2.3 | +| WARN-018 | 2.4 | +| WARN-013 | 3.1 | +| SUGG-007 | 3.2 | +| SUGG-003 | 4.1 (executed first) | +| SUGG-001 | 4.2 | --- diff --git a/evals/iterative-plan-review/tests.json b/evals/iterative-plan-review/tests.json index f6f2a8e8..5c7a5bb2 100644 --- a/evals/iterative-plan-review/tests.json +++ b/evals/iterative-plan-review/tests.json @@ -8,9 +8,7 @@ "skillFile": "han-planning:iterative-plan-review", "promptFile": "skill-call-iterative-plan-review.md", "scaffold": "ruby-project", - "expect": [ - { "skill-call": true } - ] + "expect": [{ "skill-call": true }] }, { "name": "Skill Call: iterate for correctness", @@ -19,9 +17,7 @@ "skillFile": "han-planning:iterative-plan-review", "promptFile": "skill-call-iterate-for-correctness.md", "scaffold": "ruby-project", - "expect": [ - { "skill-call": true } - ] + "expect": [{ "skill-call": true }] }, { "name": "Skill Call: prompt with /iterative-plan-review", @@ -30,9 +26,7 @@ "skillFile": "han-planning:iterative-plan-review", "promptFile": "prompt-iterative-plan-review.md", "scaffold": "ruby-project", - "expect": [ - { "skill-call": true } - ] + "expect": [{ "skill-call": true }] }, { "name": "Skill Call: no iterative-plan-review", @@ -41,9 +35,7 @@ "skillFile": "han-planning:iterative-plan-review", "promptFile": "skill-call-no-iterative-plan-review.md", "scaffold": "ruby-project", - "expect": [ - { "skill-call": false } - ] + "expect": [{ "skill-call": false }] }, { "name": "Skill Call: validate the current plan", @@ -51,9 +43,7 @@ "model": "opus", "skillFile": "han-planning:iterative-plan-review", "promptFile": "skill-call-validate-current-plan.md", - "expect": [ - { "skill-call": true } - ] + "expect": [{ "skill-call": true }] }, { "name": "Skill Call: iterate the plan", @@ -61,9 +51,7 @@ "model": "opus", "skillFile": "han-planning:iterative-plan-review", "promptFile": "skill-call-iterate-the-plan.md", - "expect": [ - { "skill-call": true } - ] + "expect": [{ "skill-call": true }] }, { "name": "Skill Call: check plan for correctness and consistency", @@ -71,9 +59,7 @@ "model": "opus", "skillFile": "han-planning:iterative-plan-review", "promptFile": "skill-call-check-plan-correctness.md", - "expect": [ - { "skill-call": true } - ] + "expect": [{ "skill-call": true }] }, { "name": "Skill Call: verify this will work as expected", @@ -81,9 +67,7 @@ "model": "opus", "skillFile": "han-planning:iterative-plan-review", "promptFile": "skill-call-verify-will-work.md", - "expect": [ - { "skill-call": true } - ] + "expect": [{ "skill-call": true }] }, { "name": "Skill Call: follow plan and implement changes", @@ -91,9 +75,7 @@ "model": "sonnet", "skillFile": "han-planning:iterative-plan-review", "promptFile": "skill-call-follow-plan-implement.md", - "expect": [ - { "skill-call": false } - ] + "expect": [{ "skill-call": false }] }, { "name": "Skill Call: create a new plan for auth", @@ -101,9 +83,7 @@ "model": "sonnet", "skillFile": "han-planning:iterative-plan-review", "promptFile": "skill-call-create-new-plan.md", - "expect": [ - { "skill-call": false } - ] + "expect": [{ "skill-call": false }] }, { "name": "Skill Call: review the code changes", @@ -111,9 +91,7 @@ "model": "sonnet", "skillFile": "han-planning:iterative-plan-review", "promptFile": "skill-call-review-code-changes.md", - "expect": [ - { "skill-call": false } - ] + "expect": [{ "skill-call": false }] }, { "name": "Skill Call: verify the test suite passes", @@ -121,9 +99,7 @@ "model": "sonnet", "skillFile": "han-planning:iterative-plan-review", "promptFile": "skill-call-verify-test-suite.md", - "expect": [ - { "skill-call": false } - ] + "expect": [{ "skill-call": false }] }, { "name": "Skill Call: write a test plan for auth module", @@ -131,9 +107,7 @@ "model": "sonnet", "skillFile": "han-planning:iterative-plan-review", "promptFile": "skill-call-test-plan-auth.md", - "expect": [ - { "skill-call": false } - ] + "expect": [{ "skill-call": false }] }, { "name": "Skill Call: investigate login 500 errors", @@ -141,9 +115,7 @@ "model": "sonnet", "skillFile": "han-planning:iterative-plan-review", "promptFile": "skill-call-investigate-login-500.md", - "expect": [ - { "skill-call": false } - ] + "expect": [{ "skill-call": false }] }, { "name": "Skill Call: document the payment system", @@ -151,9 +123,7 @@ "model": "sonnet", "skillFile": "han-planning:iterative-plan-review", "promptFile": "skill-call-document-payment-system.md", - "expect": [ - { "skill-call": false } - ] + "expect": [{ "skill-call": false }] }, { "name": "Skill Call: post a PR review to GitHub", @@ -161,9 +131,7 @@ "model": "sonnet", "skillFile": "han-planning:iterative-plan-review", "promptFile": "skill-call-post-pr-review.md", - "expect": [ - { "skill-call": false } - ] + "expect": [{ "skill-call": false }] }, { "name": "Skill Prompt: iterative-plan-review on ruby-security-app code-review plan", diff --git a/evals/project-discovery/tests.json b/evals/project-discovery/tests.json index d0dbd482..7e61ad32 100644 --- a/evals/project-discovery/tests.json +++ b/evals/project-discovery/tests.json @@ -29,9 +29,7 @@ "skillFile": "han-core:project-discovery", "promptFile": "skill-call-project-discovery.md", "scaffold": "polyglot-project", - "expect": [ - { "skill-call": true } - ] + "expect": [{ "skill-call": true }] }, { "name": "Skill Call: no project-discovery", @@ -39,9 +37,7 @@ "model": "sonnet", "skillFile": "han-core:project-discovery", "promptFile": "skill-call-no-project-discovery.md", - "expect": [ - { "skill-call": false } - ] + "expect": [{ "skill-call": false }] } ] } diff --git a/evals/project-documentation/tests.json b/evals/project-documentation/tests.json index 6967ecaf..da7d8852 100644 --- a/evals/project-documentation/tests.json +++ b/evals/project-documentation/tests.json @@ -29,9 +29,7 @@ "skillFile": "han-documentation:project-documentation", "promptFile": "skill-call-project-documentation.md", "scaffold": "node-project", - "expect": [ - { "skill-call": true } - ] + "expect": [{ "skill-call": true }] }, { "name": "Skill Call: no project-documentation", @@ -39,9 +37,7 @@ "model": "sonnet", "skillFile": "han-documentation:project-documentation", "promptFile": "skill-call-no-project-documentation.md", - "expect": [ - { "skill-call": false } - ] + "expect": [{ "skill-call": false }] } ] } diff --git a/evals/reassess-approach/prompts/prompt-reassess-parser-plan.md b/evals/reassess-approach/prompts/prompt-reassess-parser-plan.md new file mode 100644 index 00000000..ea260870 --- /dev/null +++ b/evals/reassess-approach/prompts/prompt-reassess-parser-plan.md @@ -0,0 +1 @@ +run /reassess-approach on plans/ingest-parser/plan.md with the findings in plans/ingest-parser/artifacts/review-findings.md. Three review rounds have gone into the hand-written parser and the edge-case findings keep landing on it. diff --git a/evals/reassess-approach/prompts/skill-call-no-refine-plan.md b/evals/reassess-approach/prompts/skill-call-no-refine-plan.md new file mode 100644 index 00000000..89f31ccb --- /dev/null +++ b/evals/reassess-approach/prompts/skill-call-no-refine-plan.md @@ -0,0 +1 @@ +Iterate on plans/ingest-parser/plan.md and tighten it up: check its assumptions against the code and fix anything that is wrong. diff --git a/evals/reassess-approach/prompts/skill-call-no-research-libraries.md b/evals/reassess-approach/prompts/skill-call-no-research-libraries.md new file mode 100644 index 00000000..6916d95d --- /dev/null +++ b/evals/reassess-approach/prompts/skill-call-no-research-libraries.md @@ -0,0 +1 @@ +Research the Ruby parser-generator libraries that are actively maintained in 2026 and compare their trade-offs for parsing a line-oriented feed format. diff --git a/evals/reassess-approach/prompts/skill-call-reassess-approach.md b/evals/reassess-approach/prompts/skill-call-reassess-approach.md new file mode 100644 index 00000000..bc7571f0 --- /dev/null +++ b/evals/reassess-approach/prompts/skill-call-reassess-approach.md @@ -0,0 +1 @@ +/reassess-approach plans/ingest-parser/plan.md diff --git a/evals/reassess-approach/prompts/skill-call-step-back-after-rounds.md b/evals/reassess-approach/prompts/skill-call-step-back-after-rounds.md new file mode 100644 index 00000000..3bfbdb2a --- /dev/null +++ b/evals/reassess-approach/prompts/skill-call-step-back-after-rounds.md @@ -0,0 +1 @@ +We have been through six review rounds on the regex parser in lib/ingest/parser.rb and the edge cases keep coming. Step back and question whether this approach is still the right one before we spend another round on it. diff --git a/evals/reassess-approach/prompts/skill-call-worth-doing.md b/evals/reassess-approach/prompts/skill-call-worth-doing.md new file mode 100644 index 00000000..1317a733 --- /dev/null +++ b/evals/reassess-approach/prompts/skill-call-worth-doing.md @@ -0,0 +1 @@ +The plan in plans/ingest-parser/plan.md keeps absorbing findings without converging. Is parsing this feed ourselves even worth doing, or should we use a different tool or drop it? diff --git a/evals/reassess-approach/rubrics/reassess-approach-quality.md b/evals/reassess-approach/rubrics/reassess-approach-quality.md new file mode 100644 index 00000000..e45d863f --- /dev/null +++ b/evals/reassess-approach/rubrics/reassess-approach-quality.md @@ -0,0 +1,31 @@ +## Rubric: reassess-approach on the ruby-ingest-parser scaffold + +### Presence — things the run must produce + +- The run writes one report file named `approach-reassessment-{n}.md` under `plans/ingest-parser/artifacts/` and names its path in the reply +- The report opens with a Recommendation section that picks exactly one option and gives a reason a person who has not read the plan could follow +- The report restates what the current approach commits to (a hand-written regex line parser in `lib/ingest/parser.rb` driven by the plan's section 2) and lists the findings it has absorbed by ID (F1 through F9) +- The report carries at least one alternative that is structurally different from the current approach: a parser-generator or grammar-based library, a different code shape such as a tokenizer plus a small state machine, or a smaller slice that parses only the record types the plan's section 1 requires +- The report carries a "Stop doing this" option and a "Continue as is" option, each with the same fields as the other options +- The reply hands the decision to the user as one question, led by the consequence of staying on the current approach, with the options as named candidates and the recommendation marked, and ends the turn + +### Specificity — the report must be concrete + +- Every option names the recorded findings it would make moot and the ones it leaves open, using the F# IDs from `review-findings.md` +- Every option states what it adds and removes in owned code paths or plan items (for example, removing the escape-handling branches in `lib/ingest/parser.rb` or adding a gem dependency) +- Evidence cites specific scaffold paths (`lib/ingest/parser.rb`, `plans/ingest-parser/plan.md`, `plans/ingest-parser/artifacts/review-findings.md`) or finding IDs rather than generic claims +- Each option names what to run next if chosen (`plan-a-change`, `plan-a-feature`, `refactor`, `tdd`, or nothing) + +### Depth — the options must be real alternatives + +- At least one alternative would make the clustered edge-case findings (F2, F4, F5, F7, F8) moot together, and the report says why +- The recommendation weighs the alternatives against the recorded findings rather than against taste or best practice +- Options that were considered and set aside appear under Deferred (YAGNI) with a reopening trigger + +### Absence — the run must not do these things + +- The run does not edit `plans/ingest-parser/plan.md`, `review-findings.md`, or any file under `lib/` +- The run does not implement any option, start `/refactor` or `/tdd`, or re-run a review round +- The run does not present options that differ from the current approach only in parameters, naming, or ordering as if they were structurally different +- The run does not hallucinate files, findings, or review rounds that do not exist in the scaffold +- The run does not dispatch more than one critic agent, apart from a single relaunch when the first return lacks a structurally different alternative or a standing option diff --git a/evals/reassess-approach/scaffolds/ruby-ingest-parser/Gemfile b/evals/reassess-approach/scaffolds/ruby-ingest-parser/Gemfile new file mode 100644 index 00000000..c791a2a4 --- /dev/null +++ b/evals/reassess-approach/scaffolds/ruby-ingest-parser/Gemfile @@ -0,0 +1,3 @@ +source "https://rubygems.org" + +gem "rspec", "~> 3.13" diff --git a/evals/reassess-approach/scaffolds/ruby-ingest-parser/lib/ingest/parser.rb b/evals/reassess-approach/scaffolds/ruby-ingest-parser/lib/ingest/parser.rb new file mode 100644 index 00000000..935972e4 --- /dev/null +++ b/evals/reassess-approach/scaffolds/ruby-ingest-parser/lib/ingest/parser.rb @@ -0,0 +1,52 @@ +module Ingest + # Parses the partner feed: one record per line, pipe-delimited fields, with + # quoted fields that may contain pipes, escaped quotes, and continuation + # lines that start with a tab. + class Parser + RECORD = /\A(?[A-Z]{2,4})\|(?\d+)\|(?.*)\z/ + FIELD = /(?:"((?:[^"\\]|\\.)*)"|([^|]*))(?:\||\z)/ + CONTINUATION = /\A\t(.*)\z/ + + Record = Struct.new(:type, :id, :fields, :line_number) + + def initialize(io) + @io = io + end + + def each_record + buffer = nil + line_number = 0 + @io.each_line do |raw| + line_number += 1 + line = raw.chomp + if (m = CONTINUATION.match(line)) + raise ParseError, "continuation without a record at line #{line_number}" if buffer.nil? + + buffer << "\n" << m[1] + next + end + yield build(buffer, line_number - 1) if buffer + buffer = line.dup + end + yield build(buffer, line_number) if buffer + end + + private + + def build(line, line_number) + m = RECORD.match(line) + raise ParseError, "malformed record at line #{line_number}" unless m + + fields = [] + rest = m[:rest] + rest.scan(FIELD) do |quoted, bare| + value = quoted ? quoted.gsub(/\\(.)/, '\1') : bare + fields << value + end + fields.pop if fields.last == "" && !rest.end_with?("|") + Record.new(m[:type], Integer(m[:id]), fields, line_number) + end + end + + class ParseError < StandardError; end +end diff --git a/evals/reassess-approach/scaffolds/ruby-ingest-parser/plans/ingest-parser/artifacts/review-findings.md b/evals/reassess-approach/scaffolds/ruby-ingest-parser/plans/ingest-parser/artifacts/review-findings.md new file mode 100644 index 00000000..d9ec4dab --- /dev/null +++ b/evals/reassess-approach/scaffolds/ruby-ingest-parser/plans/ingest-parser/artifacts/review-findings.md @@ -0,0 +1,135 @@ +# Review findings: Ingest the partner feed + +Three review rounds (R1, R2, R3) of `plans/ingest-parser/plan.md`. The round cap for this plan is 3. Round 3 produced +four new findings, three of them major, so the stop rule's convergence condition was not met at the cap. + +## Major findings + +### F1: Record envelope regex rejects ids with leading zeros + +- **Agent:** edge-case-explorer +- **Category:** edge case +- **Finding:** `RECORD` in `lib/ingest/parser.rb:6` matches `\d+` and the job calls `Integer(m[:id])`, which raises on + `007`. The partner's sample feed contains zero-padded ids. +- **Evidence considered:** `lib/ingest/parser.rb:6`, `lib/ingest/parser.rb:47` +- **Alternatives:** — +- **Resolution:** Section 2 gained the rule "ids are parsed as decimal with leading zeros allowed". +- **Resolved by:** evidence +- **Raised in round:** R1 +- **Changed in plan:** Section 2 + +### F2: Escaped backslash before a closing quote ends the field early + +- **Agent:** edge-case-explorer +- **Category:** edge case +- **Finding:** `FIELD` at `lib/ingest/parser.rb:7` treats `\\"` as an escaped quote, so a field ending in a literal + backslash (`"C:\path\"`) swallows the closing quote and the next field. +- **Evidence considered:** `lib/ingest/parser.rb:7` +- **Alternatives:** — +- **Resolution:** Section 2 escape rule reworded; `FIELD` regex to gain an alternation for `\\\\` before `"`. +- **Resolved by:** evidence +- **Raised in round:** R1 +- **Changed in plan:** Section 2 + +### F3: Continuation line before any record raises the wrong error class + +- **Agent:** junior-developer +- **Category:** unhandled failure mode +- **Finding:** The job's rollback contract names `Ingest::ParseError`, but a continuation line as the first line raises + from inside `each_record` before the transaction opens. +- **Evidence considered:** `lib/ingest/parser.rb:23`, plan section 3 +- **Alternatives:** — +- **Resolution:** Section 3 now opens the transaction before the first `each_record` call. +- **Resolved by:** evidence +- **Raised in round:** R1 +- **Changed in plan:** Section 3 + +### F4: Quoted field spanning a continuation line is split into two fields + +- **Agent:** edge-case-explorer +- **Category:** edge case +- **Finding:** `FIELD` is applied per logical line after continuation joining, but the newline inserted at + `lib/ingest/parser.rb:26` is not inside the quote-aware branch, so a quote opened before the continuation and closed + after it yields two fields and an unterminated-quote error on the first. +- **Evidence considered:** `lib/ingest/parser.rb:26`, `lib/ingest/parser.rb:7` +- **Alternatives:** — +- **Resolution:** Section 2 gained the rule "a continuation line that follows an unterminated quote belongs to the quoted + field". Implementation note: join before scanning and let `[^"\\]` match the newline. +- **Resolved by:** evidence +- **Raised in round:** R2 +- **Changed in plan:** Section 2 + +### F5: Empty quoted field is indistinguishable from a missing field + +- **Agent:** behavioral-analyst +- **Category:** edge case +- **Finding:** `FIELD` captures `""` as an empty quoted group and `` as an empty bare group; both land as `""` in + `fields`, so the job cannot tell "explicitly empty" from "absent", which section 3 says it must for `ADJ` reason + codes. +- **Evidence considered:** `lib/ingest/parser.rb:40-44`, plan section 3 +- **Alternatives:** — +- **Resolution:** Section 2 gained a rule distinguishing `""` from an absent field; the struct gains a `quoted` flag + per field. +- **Resolved by:** evidence +- **Raised in round:** R2 +- **Changed in plan:** Section 2, Section 3 + +### F6: Trailing-pipe rule contradicts the sample feed + +- **Agent:** evidence-based-investigator +- **Category:** assumption refuted +- **Finding:** The partner's sample feed ends every record with `|`, so the rule "a trailing `|` produces an empty final + field" would give every record one phantom field. +- **Evidence considered:** partner sample in the ticket; `lib/ingest/parser.rb:45` +- **Alternatives:** — +- **Resolution:** Section 2 trailing-pipe rule inverted; `fields.pop` condition inverted to match. +- **Resolved by:** evidence +- **Raised in round:** R2 +- **Changed in plan:** Section 2 + +### F7: Windows line endings inside a quoted field are stripped + +- **Agent:** edge-case-explorer +- **Category:** edge case +- **Finding:** `raw.chomp` at `lib/ingest/parser.rb:21` strips `\r\n` at the end of every physical line, including the + line that ends a quoted field whose value legitimately ends in `\r`. +- **Evidence considered:** `lib/ingest/parser.rb:21` +- **Alternatives:** — +- **Resolution:** Section 2 line-ending rule narrowed to "outside quotes"; implementation to chomp only when the quote + depth is zero. +- **Resolved by:** evidence +- **Raised in round:** R3 +- **Changed in plan:** Section 2 + +### F8: Backslash escape rule is ambiguous for `\n` + +- **Agent:** junior-developer +- **Category:** ambiguity +- **Finding:** Section 2 says "a backslash escapes any character", so `\n` inside a quoted field is the letter `n`, but + the partner's documentation says `\n` is a newline. `gsub(/\\(.)/, '\1')` at `lib/ingest/parser.rb:43` implements the + plan, not the partner. +- **Evidence considered:** `lib/ingest/parser.rb:43`, partner documentation section 4.2 +- **Alternatives:** — +- **Resolution:** Open. Needs the partner's escape table, which the plan does not carry. +- **Resolved by:** deferred to open item +- **Raised in round:** R3 +- **Changed in plan:** — + +### F9: Whitespace-only field rule has no test and the regex collapses it + +- **Agent:** edge-case-explorer +- **Category:** edge case +- **Finding:** Section 2 says a whitespace-only field is kept, but the bare-field branch of `FIELD` is applied after + `chomp` and a trailing whitespace-only field at end of line is dropped by the `fields.pop` guard at + `lib/ingest/parser.rb:45`. +- **Evidence considered:** `lib/ingest/parser.rb:45`, plan section 4 +- **Alternatives:** — +- **Resolution:** Open. The guard needs to know whether the last field was bare or quoted, which the scan loses. +- **Resolved by:** deferred to open item +- **Raised in round:** R3 +- **Changed in plan:** — + +## Minor edits + +- F10: Section 1 record-type list reformatted as a table — junior-developer — Section 1 +- F11: "nightly" clarified to "once per calendar day, 02:00 UTC" — evidence-based-investigator — Section 1 diff --git a/evals/reassess-approach/scaffolds/ruby-ingest-parser/plans/ingest-parser/plan.md b/evals/reassess-approach/scaffolds/ruby-ingest-parser/plans/ingest-parser/plan.md new file mode 100644 index 00000000..df0e228e --- /dev/null +++ b/evals/reassess-approach/scaffolds/ruby-ingest-parser/plans/ingest-parser/plan.md @@ -0,0 +1,40 @@ +# Plan: Ingest the partner feed + +## 1. What the feed must yield + +The partner sends a nightly text feed. Each line is one record: a two-to-four letter record type, a numeric id, and a +variable number of fields. Only three record types matter to us today: `ORD` (order header), `LN` (order line), and +`ADJ` (adjustment). Every other type is skipped. The ingest job must turn the feed into `Order`, `OrderLine`, and +`Adjustment` rows and reject a feed that contains a malformed record, naming the line number. + +## 2. How the feed is read + +A hand-written line parser in `lib/ingest/parser.rb` reads the feed with three regular expressions: one matches the +record envelope (`type|id|rest`), one splits `rest` into fields while honoring quoted fields and backslash escapes, and +one recognizes continuation lines (a leading tab) that extend the previous record's last field. The parser yields one +`Record` struct per logical record with its starting line number. + +Edge-case rules the parser enforces: + +- A quoted field may contain `|` and `\"`; a backslash escapes any character. +- A continuation line appends to the previous record with a newline between the parts. +- A trailing `|` produces an empty final field; a line without a trailing `|` does not. +- A record type outside the three we handle is parsed and then skipped by the job, not by the parser. +- An unterminated quote at end of line is an error naming the line number. +- A continuation line that follows an unterminated quote belongs to the quoted field, not to a new field. +- Windows line endings are stripped before matching. +- A field that is only whitespace is kept as whitespace, not collapsed to empty. + +## 3. How records become rows + +`lib/ingest/job.rb` consumes `Parser#each_record`, dispatches on `type`, maps fields by position to the three row +types, and wraps the whole feed in one transaction so a malformed record rolls everything back. + +## 4. Tests + +`spec/ingest/parser_spec.rb` covers each edge-case rule in section 2 with one example per rule. `spec/ingest/job_spec.rb` +covers the three record types and the rollback. + +## Open questions + +- None recorded. See `artifacts/review-findings.md` for the review history. diff --git a/evals/reassess-approach/tests.json b/evals/reassess-approach/tests.json new file mode 100644 index 00000000..3977c16d --- /dev/null +++ b/evals/reassess-approach/tests.json @@ -0,0 +1,61 @@ +{ + "plugins": ["han-communication", "han-core", "han-planning"], + "tests": [ + { + "name": "Skill Call: /reassess-approach", + "type": "skill-call", + "model": "opus", + "skillFile": "han-planning:reassess-approach", + "promptFile": "skill-call-reassess-approach.md", + "scaffold": "ruby-ingest-parser", + "expect": [{ "skill-call": true }] + }, + { + "name": "Skill Call: step back after six review rounds", + "type": "skill-call", + "model": "opus", + "skillFile": "han-planning:reassess-approach", + "promptFile": "skill-call-step-back-after-rounds.md", + "scaffold": "ruby-ingest-parser", + "expect": [{ "skill-call": true }] + }, + { + "name": "Skill Call: is this worth doing at all", + "type": "skill-call", + "model": "opus", + "skillFile": "han-planning:reassess-approach", + "promptFile": "skill-call-worth-doing.md", + "scaffold": "ruby-ingest-parser", + "expect": [{ "skill-call": true }] + }, + { + "name": "Skill Call: refine the plan is not a reassessment", + "type": "skill-call", + "model": "sonnet", + "skillFile": "han-planning:reassess-approach", + "promptFile": "skill-call-no-refine-plan.md", + "scaffold": "ruby-ingest-parser", + "expect": [{ "skill-call": false }] + }, + { + "name": "Skill Call: research parsing libraries is not a reassessment", + "type": "skill-call", + "model": "sonnet", + "skillFile": "han-planning:reassess-approach", + "promptFile": "skill-call-no-research-libraries.md", + "expect": [{ "skill-call": false }] + }, + { + "name": "Skill Prompt: reassess the hand-written parser after three stalled review rounds", + "type": "skill-prompt", + "model": "opus", + "skillFile": "han-planning:reassess-approach", + "promptFile": "prompt-reassess-parser-plan.md", + "scaffold": "ruby-ingest-parser", + "expect": [ + { "result-contains": "Continue as is" }, + { "llm-judge": { "rubricFile": "reassess-approach-quality.md", "model": "opus", "threshold": 0.8 } } + ] + } + ] +} diff --git a/evals/test-engineer/prompts/agent-call-behavioral-test-plan.md b/evals/test-engineer/prompts/agent-call-behavioral-test-plan.md index 22fa8d80..17777feb 100644 --- a/evals/test-engineer/prompts/agent-call-behavioral-test-plan.md +++ b/evals/test-engineer/prompts/agent-call-behavioral-test-plan.md @@ -1 +1 @@ -Create a behavioral test plan for the API endpoints — focus on inputs, outputs, and side effects \ No newline at end of file +Create a behavioral test plan for the API endpoints — focus on inputs, outputs, and side effects diff --git a/evals/test-engineer/prompts/agent-call-find-untested-behaviors.md b/evals/test-engineer/prompts/agent-call-find-untested-behaviors.md index 1a521910..0c8e09ce 100644 --- a/evals/test-engineer/prompts/agent-call-find-untested-behaviors.md +++ b/evals/test-engineer/prompts/agent-call-find-untested-behaviors.md @@ -1 +1 @@ -Find untested behaviors in the user service and recommend what tests to write \ No newline at end of file +Find untested behaviors in the user service and recommend what tests to write diff --git a/evals/test-engineer/prompts/agent-call-negative-behavior-psychology.md b/evals/test-engineer/prompts/agent-call-negative-behavior-psychology.md index 0dbe04ca..31d05a85 100644 --- a/evals/test-engineer/prompts/agent-call-negative-behavior-psychology.md +++ b/evals/test-engineer/prompts/agent-call-negative-behavior-psychology.md @@ -1 +1 @@ -Explain behavioral patterns in consumer psychology and how they affect purchasing decisions \ No newline at end of file +Explain behavioral patterns in consumer psychology and how they affect purchasing decisions diff --git a/evals/test-engineer/prompts/agent-call-negative-engineering-plan.md b/evals/test-engineer/prompts/agent-call-negative-engineering-plan.md index 7eb36a5c..f3614d65 100644 --- a/evals/test-engineer/prompts/agent-call-negative-engineering-plan.md +++ b/evals/test-engineer/prompts/agent-call-negative-engineering-plan.md @@ -1 +1 @@ -Plan the sprint for next week and assign tasks to the engineering team \ No newline at end of file +Plan the sprint for next week and assign tasks to the engineering team diff --git a/evals/test-engineer/prompts/agent-call-negative-sports-test.md b/evals/test-engineer/prompts/agent-call-negative-sports-test.md index 677c3b30..1cd81d9e 100644 --- a/evals/test-engineer/prompts/agent-call-negative-sports-test.md +++ b/evals/test-engineer/prompts/agent-call-negative-sports-test.md @@ -1 +1 @@ -What were the test results from last night's game? \ No newline at end of file +What were the test results from last night's game? diff --git a/evals/test-engineer/prompts/agent-call-plan-tests-for-auth-module.md b/evals/test-engineer/prompts/agent-call-plan-tests-for-auth-module.md index ee91cdae..bba92d8e 100644 --- a/evals/test-engineer/prompts/agent-call-plan-tests-for-auth-module.md +++ b/evals/test-engineer/prompts/agent-call-plan-tests-for-auth-module.md @@ -1 +1 @@ -Plan what tests we need for the auth module \ No newline at end of file +Plan what tests we need for the auth module diff --git a/evals/test-engineer/prompts/agent-call-prioritize-test-cases.md b/evals/test-engineer/prompts/agent-call-prioritize-test-cases.md index 410477c9..0b03dd3c 100644 --- a/evals/test-engineer/prompts/agent-call-prioritize-test-cases.md +++ b/evals/test-engineer/prompts/agent-call-prioritize-test-cases.md @@ -1 +1 @@ -Look at the database layer and prioritize which test cases we should write first based on risk \ No newline at end of file +Look at the database layer and prioritize which test cases we should write first based on risk diff --git a/evals/test-engineer/prompts/agent-call-sibling-architecture.md b/evals/test-engineer/prompts/agent-call-sibling-architecture.md index e9656e76..7baf83f1 100644 --- a/evals/test-engineer/prompts/agent-call-sibling-architecture.md +++ b/evals/test-engineer/prompts/agent-call-sibling-architecture.md @@ -1 +1 @@ -Analyze the architectural structure of the internal packages and identify coupling problems \ No newline at end of file +Analyze the architectural structure of the internal packages and identify coupling problems diff --git a/evals/test-engineer/prompts/agent-call-sibling-code-review.md b/evals/test-engineer/prompts/agent-call-sibling-code-review.md index f1d72e60..edfedbc1 100644 --- a/evals/test-engineer/prompts/agent-call-sibling-code-review.md +++ b/evals/test-engineer/prompts/agent-call-sibling-code-review.md @@ -1 +1 @@ -Review the code in the handlers package for quality issues, security flaws, and best practice violations \ No newline at end of file +Review the code in the handlers package for quality issues, security flaws, and best practice violations diff --git a/evals/test-engineer/prompts/agent-call-sibling-edge-cases.md b/evals/test-engineer/prompts/agent-call-sibling-edge-cases.md index ff48dd31..ee42a276 100644 --- a/evals/test-engineer/prompts/agent-call-sibling-edge-cases.md +++ b/evals/test-engineer/prompts/agent-call-sibling-edge-cases.md @@ -1 +1 @@ -Explore all the edge cases and boundary values for the authentication module — what inputs could cause it to fail? \ No newline at end of file +Explore all the edge cases and boundary values for the authentication module — what inputs could cause it to fail? diff --git a/evals/test-engineer/prompts/agent-call-sibling-investigate-bug.md b/evals/test-engineer/prompts/agent-call-sibling-investigate-bug.md index a5f3ac95..d9ac7397 100644 --- a/evals/test-engineer/prompts/agent-call-sibling-investigate-bug.md +++ b/evals/test-engineer/prompts/agent-call-sibling-investigate-bug.md @@ -1 +1 @@ -Investigate why the user creation endpoint is returning 500 errors in production — find the root cause \ No newline at end of file +Investigate why the user creation endpoint is returning 500 errors in production — find the root cause diff --git a/evals/test-engineer/prompts/agent-call-test-coverage-gaps.md b/evals/test-engineer/prompts/agent-call-test-coverage-gaps.md index e52942c5..9c075ffc 100644 --- a/evals/test-engineer/prompts/agent-call-test-coverage-gaps.md +++ b/evals/test-engineer/prompts/agent-call-test-coverage-gaps.md @@ -1 +1 @@ -Examine the handlers package and identify test coverage gaps — what behaviors are missing tests? \ No newline at end of file +Examine the handlers package and identify test coverage gaps — what behaviors are missing tests? diff --git a/evals/test-engineer/prompts/agent-prompt-go-security-test-plan.md b/evals/test-engineer/prompts/agent-prompt-go-security-test-plan.md index 00859fa3..29ea5e55 100644 --- a/evals/test-engineer/prompts/agent-prompt-go-security-test-plan.md +++ b/evals/test-engineer/prompts/agent-prompt-go-security-test-plan.md @@ -1 +1 @@ -Examine the Go project and create a test plan. Identify all untested behaviors, recommend test doubles for isolation, and prioritize test cases by value and brittleness risk. Write the full analysis to test-plan.md. \ No newline at end of file +Examine the Go project and create a test plan. Identify all untested behaviors, recommend test doubles for isolation, and prioritize test cases by value and brittleness risk. Write the full analysis to test-plan.md. diff --git a/evals/test-engineer/rubrics/test-engineer-quality.md b/evals/test-engineer/rubrics/test-engineer-quality.md index 4620a9df..b48a0625 100644 --- a/evals/test-engineer/rubrics/test-engineer-quality.md +++ b/evals/test-engineer/rubrics/test-engineer-quality.md @@ -1,6 +1,7 @@ ## Rubric: test-engineer of go-security-project scaffold ### Presence — things the test plan must identify + - The test plan identifies that the auth package (auth.go, jwt.go) has no tests covering password comparison or JWT generation/validation behaviors - The test plan identifies that the database layer (db.go, users.go) has no tests covering connection initialization or user query behaviors - The test plan identifies that the HTTP handlers (handlers/users.go, handlers/fetch.go) have no tests covering request handling, response formation, or error responses @@ -9,30 +10,36 @@ - The test plan includes a priority table with High, Medium, and Low counts ### Specificity — the test plan must be concrete + - Every test recommendation references a specific entry point with a file path and line number (e.g., `internal/auth/auth.go:15`) - Test recommendations specify which collaborators to stub (queries) and which to mock (commands) for each test case - Each test case specifies the expected observable output — what the function returns, what side effect occurs, or what error surfaces to the caller - The test plan references the existing runner_test.go file and its patterns when recommending how new tests should be structured ### Depth — the test plan must be actionable + - Each test case includes a concrete test approach with behavior description, stubs, input/action, expected output, and expected commands - The test plan evaluates brittleness risk for each recommendation — explaining why a test would or would not break on routine refactors - The test plan recommends appropriate test levels (unit vs integration) with justification — not defaulting everything to unit tests - The test plan distinguishes between high-value behaviors (data integrity, security boundaries) and low-value behaviors when prioritizing ### Absence — the test plan must not do these things + - The test plan must not recommend writing test code — it produces a plan only - The test plan must not recommend snapshot or golden-file tests without evaluating churn risk - The test plan must not recommend tests that assert on mock internals (call counts, argument order) without tying them to observable behavioral outcomes - The test plan must not include test recommendations for behaviors with no meaningful observable outcome ## File: test-plan.md + ### Presence + - The file contains a Summary section with a priority count table - The file contains a Findings section with T-series items ordered by priority - The file contains a Coverage Assessment describing which behaviors are well-tested vs have gaps - The file contains a Scope section identifying the files analyzed ### Specificity + - Each T-series finding includes Priority, Test level, Entry point, Gap type, Test approach, and Brittleness assessment fields - The Coverage Estimate section specifies expected behavioral coverage after all recommended tests are written diff --git a/evals/test-engineer/tests.json b/evals/test-engineer/tests.json index 736a9ec3..cff13cfc 100644 --- a/evals/test-engineer/tests.json +++ b/evals/test-engineer/tests.json @@ -104,9 +104,7 @@ "promptFile": "agent-prompt-go-security-test-plan.md", "scaffold": "go-security-project", "model": "opus", - "expect": [ - { "llm-judge": { "rubricFile": "test-engineer-quality.md", "model": "opus", "threshold": 0.8 } } - ] + "expect": [{ "llm-judge": { "rubricFile": "test-engineer-quality.md", "model": "opus", "threshold": 0.8 } }] } ] } diff --git a/han-core/docs/agents/software-architect.md b/han-core/docs/agents/software-architect.md index e4c32450..c039bdc9 100644 --- a/han-core/docs/agents/software-architect.md +++ b/han-core/docs/agents/software-architect.md @@ -16,7 +16,8 @@ _how_ to dispatch the agent. For what the agent does internally, read the agent - **When to dispatch it.** Dispatch after the three architectural analysts and `risk-analyst` have produced findings for a focus area that lives inside a single codebase or bounded context. Then dispatch it when you want synthesis into recommended changes with pseudocode sketches. Always dispatched by `/architectural-analysis` (it runs on the synthesis - spine at every size) and by `/plan-a-change` (it proposes the target structure at every size). Conditionally + spine at every size), by `/plan-a-change` (it proposes the target structure at every size), and by + `/reassess-approach` (it is the fresh-context critic that produces the alternatives). Conditionally dispatched by `/architectural-decision-record`, `/gap-analysis`, `/iterative-plan-review`, and `/plan-implementation` when the work touches intra-codebase module boundaries or abstractions. `/plan-a-feature` excludes it from the default spec-stage roster and includes it only when you ask for @@ -233,6 +234,9 @@ URL: https://www.oreilly.com/library/view/design-patterns-elements/0201633612/ - [`/design-an-api`](../../../han-coding/docs/skills/design-an-api.md). Dispatches this agent in its four-agent spine, at every size, to produce the options document and every later amendment. - [`/plan-a-change`](../../../han-planning/docs/skills/plan-a-change.md). Dispatches this agent at Step 4 at every size, to propose the target structure under the YAGNI and contract-pinning directives. +- [`/reassess-approach`](../../../han-planning/docs/skills/reassess-approach.md). Dispatches this agent once, in a + fresh context, to produce structurally different alternatives to a stalled approach, always including "stop doing + this" and "continue as is". - [agent-domain-focus.md](../../../han-plugin-builder/skills/guidance/references/agent-building-guidelines/agent-domain-focus.md). Why the agent uses precise domain vocabulary and named anti-patterns. - [agent-model-selection.md](../../../han-plugin-builder/skills/guidance/references/agent-building-guidelines/agent-model-selection.md). diff --git a/han-planning/.claude-plugin/plugin.json b/han-planning/.claude-plugin/plugin.json index 9201edda..614ad8fe 100644 --- a/han-planning/.claude-plugin/plugin.json +++ b/han-planning/.claude-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "han-planning", - "description": "Planning-facing skills for the Han suite: specifying, planning, sequencing, breaking down, and stress-testing work before implementation. Home of plan-a-feature (build a feature specification from scratch through a relentless, evidence-based interview that walks the design tree), plan-a-change (plan an architecture-driven change to code that already exists, recording the surface delta and the behavior each entry preserves or changes), plan-implementation (turn a feature specification into an implementation plan through a facilitated team conversation), plan-a-phased-build (split a body of context into a sequence of independently demoable vertical-slice phases), plan-work-items (break a trusted implementation plan into independently-grabbable, atomic work items), and iterative-plan-review (stress-test an existing plan through multiple codebase-grounded review passes). Also home of the discussion-facilitator agent, which audits a planning discussion in progress without deciding anything. Depends on han-communication and han-core; bundled by the han meta-plugin.", + "description": "Planning-facing skills for the Han suite: specifying, planning, sequencing, breaking down, and stress-testing work before implementation. Home of plan-a-feature (build a feature specification from scratch through a relentless, evidence-based interview that walks the design tree), plan-a-change (plan an architecture-driven change to code that already exists, recording the surface delta and the behavior each entry preserves or changes), plan-implementation (turn a feature specification into an implementation plan through a facilitated team conversation), plan-a-phased-build (split a body of context into a sequence of independently demoable vertical-slice phases), plan-work-items (break a trusted implementation plan into independently-grabbable, atomic work items), iterative-plan-review (stress-test an existing plan through multiple codebase-grounded review passes), and reassess-approach (ask, in a fresh context, whether a stalled plan's approach is still the right one, and return structurally different alternatives including stopping). Also home of the discussion-facilitator agent, which audits a planning discussion in progress without deciding anything. Depends on han-communication and han-core; bundled by the han meta-plugin.", "version": "2.3.0", "dependencies": ["han-communication", "han-core"] } diff --git a/han-planning/README.md b/han-planning/README.md index c2469b1c..00323a52 100644 --- a/han-planning/README.md +++ b/han-planning/README.md @@ -13,7 +13,9 @@ with [`/plan-implementation`](docs/skills/plan-implementation.md), sequence it w [`/plan-a-phased-build`](docs/skills/plan-a-phased-build.md), and break it into work with [`/plan-work-items`](docs/skills/plan-work-items.md); stress-test any plan along the way with [`/iterative-plan-review`](docs/skills/iterative-plan-review.md). When the work is restructuring code that already -exists rather than adding behavior, start at [`/plan-a-change`](docs/skills/plan-a-change.md) instead. +exists rather than adding behavior, start at [`/plan-a-change`](docs/skills/plan-a-change.md) instead. When a plan or +a piece of code keeps drawing findings without converging, ask +[`/reassess-approach`](docs/skills/reassess-approach.md) whether the approach is still the right one. ## Skills @@ -29,6 +31,9 @@ exists rather than adding behavior, start at [`/plan-a-change`](docs/skills/plan independently-grabbable, atomic work items in a single work-items file. - [`/iterative-plan-review`](docs/skills/iterative-plan-review.md) — Stress-test an already-written plan through multiple codebase-grounded review passes. +- [`/reassess-approach`](docs/skills/reassess-approach.md) — Ask, in a fresh context, whether the approach a plan or a + piece of code commits to is still the right one, and get structurally different alternatives, including stopping, + with one recommendation. ## Agents diff --git a/han-planning/docs/skills/iterative-plan-review.md b/han-planning/docs/skills/iterative-plan-review.md index d5a345ea..dbb5b665 100644 --- a/han-planning/docs/skills/iterative-plan-review.md +++ b/han-planning/docs/skills/iterative-plan-review.md @@ -78,6 +78,9 @@ and _how_ to use the skill. For what the skill does internally, read the skill d or `/post-code-review-to-pr` to post the review to a GitHub PR. This skill reviews plans, not code diffs. - **Bug investigation.** Use `/investigate` for evidence-based root-cause work on a bug or failure. This skill iterates on a plan that might come out of an investigation, not on the investigation itself. +- **Questioning whether the plan's approach is still the right one.** Use [`/reassess-approach`](./reassess-approach.md) + to get structurally different alternatives, including stopping, from a fresh context. This skill hands off to it on + its own when a team-mode run reaches its round cap without converging. - **Architectural analysis of existing code.** Use `/architectural-analysis` to assess coupling, cohesion, data flow, concurrency, and SOLID alignment of an already-built module. This skill iterates on a forward-looking plan, not on retrospective architectural assessment. @@ -146,6 +149,8 @@ in-channel summary: in lightweight mode, or the specialist name in team mode), the category, the finding text, and the evidence considered. It also records the resolution, what resolved it (`Resolved by:` evidence / user input / deferred), the `R#` round it was raised in (`Raised in round:`), and the plan sections that changed in response (`Changed in plan:`). + An `approach` finding from the hand-off at the cap also carries `Alternatives:`, the path of the reassessment report + that holds its options. This is where the review's full record lives. The plan file references entries by ID rather than inlining them. - An **`artifacts/review-iteration-history.md`** companion file. One `R#` entry per iteration (lightweight) or round (team). Each entry records the mode, the specialists engaged, the `F#` findings raised that pass (`Findings raised:`), @@ -258,6 +263,14 @@ How the size is chosen: required roster plus one chosen specialist; a large team is the required roster plus two. - **Early stopping inside the cap.** The round cap is the upper bound, not a target. The skill stops earlier when stability assessment shows the next pass would only produce cosmetic changes. +- **A hand-off when a team-mode run reaches its cap without converging.** When the last of two or three rounds still + produced more than two new findings or any major one, the plan has stopped converging on its current approach rather + than on its details. Lightweight mode never hands off, because one pass cannot show that; it ends with a one-line + pointer to the skill instead. In team mode the skill invokes [`/reassess-approach`](./reassess-approach.md) with the plan and its findings file, records the + result as a major `approach` finding, and closes the run with one question: the options as named candidates, the + recommendation marked, and the consequence of staying on the current approach leading. "Continue as is" is a + complete answer, and the next invocation then runs as it does today. To redirect before the cap, drive the loop with + [`/pairing`](../../../han-core/docs/skills/pairing.md). How to override the size: @@ -444,6 +457,8 @@ https://projectmanagementcompass.substack.com/p/building-decision-logs-that-prot - [`/plan-implementation`](./plan-implementation.md). The upstream skill for producing a committable implementation plan. This skill is the natural next step when the team wants the implementation plan stress-tested across multiple review passes. +- [`/reassess-approach`](./reassess-approach.md). The skill this one invokes when a team-mode run reaches its round cap + without converging, to put the plan's approach itself in front of you as a choice. - [`junior-developer`](../../../han-core/docs/agents/junior-developer.md). The generalist stress-tester the skill always includes in team mode. - [`software-architect`](../../../han-core/docs/agents/software-architect.md). Engaged in team mode when the plan contains diff --git a/han-planning/docs/skills/plan-a-change.md b/han-planning/docs/skills/plan-a-change.md index 911d479f..dea815ac 100644 --- a/han-planning/docs/skills/plan-a-change.md +++ b/han-planning/docs/skills/plan-a-change.md @@ -51,6 +51,9 @@ and _how_ to use the skill. For what the skill does internally, read the skill d report is a valid input here when the root cause turns out to be structural. - **Designing a new interface that does not exist yet.** Use [`/design-an-api`](../../../han-coding/docs/skills/design-an-api.md). +- **Questioning whether the current approach is the right one at all.** Use + [`/reassess-approach`](./reassess-approach.md). It argues structurally different alternatives, including stopping, + from the recorded findings; this skill plans the restructure once an alternative is chosen. - **Carrying out the change.** Use [`/refactor`](../../../han-coding/docs/skills/refactor.md) for a behavior-preserving unit, or [`/tdd`](../../../han-coding/docs/skills/tdd.md) to build one test-first. @@ -208,6 +211,8 @@ safe. this skill's: it keeps symbol names out, because it specifies what a user observes. - [`/plan-work-items`](./plan-work-items.md). The usual next step, converting the sequenced change units into independently-grabbable work. +- [`/reassess-approach`](./reassess-approach.md). The upstream question when a plan or a piece of code keeps drawing + findings: its report names this skill as the next step for a restructure the person accepts. - [`/refactor`](../../../han-coding/docs/skills/refactor.md). Carries out a behavior-preserving change unit once the plan names its target and its refactoring. - [`/tdd`](../../../han-coding/docs/skills/tdd.md). Builds a behavior-changing change unit test-first. diff --git a/han-planning/docs/skills/plan-implementation.md b/han-planning/docs/skills/plan-implementation.md index 9bf4d32a..b4a23eb7 100644 --- a/han-planning/docs/skills/plan-implementation.md +++ b/han-planning/docs/skills/plan-implementation.md @@ -107,6 +107,10 @@ _how_ to use the skill. For what the skill does internally, read the skill defin skill assumes the _what_ is settled and plans the _how_. - **Refining or stress-testing an already-written implementation plan.** Use `/iterative-plan-review` when the implementation plan exists and needs multiple review passes challenging assumptions and identifying overlap. +- **Questioning whether the feature's approach is still the right one.** Use + [`/reassess-approach`](./reassess-approach.md) to get structurally different alternatives, including stopping, from a + fresh context. This skill hands off to it on its own when a medium or large run reaches its round cap without + converging. - **Investigating a bug or failure.** Use `/investigate` for evidence-based root-cause work. - **Analyzing existing architecture.** Use `/architectural-analysis` for assessing coupling, cohesion, data flow, concurrency, and SOLID alignment of an already-built module. @@ -294,6 +298,14 @@ How the size is chosen: the cap counts chosen specialists rather than seats: counting seats would make medium indistinguishable from small. - **Round cap is the upper bound, not a target.** The loop exits when the deterministic stop rule fires or only user-input items remain. The round cap prevents runaway cycles. +- **A hand-off when a medium or large run reaches its cap without converging.** When the team is still iterating at a + cap of two or three rounds, the skill no longer reports a facilitation plateau and moves on. A small run, capped at + one round, never hands off, because one round cannot show the approach is the problem; it names the skill in its + escalation pass instead. At medium or large it invokes [`/reassess-approach`](./reassess-approach.md) with + the specification and the iteration history, tags the result `approach` in the claim ledger, and puts it first among + the questions it escalates to you: the options as named candidates, the recommendation marked, the consequence of + staying on the current approach leading. Synthesis waits for your answer. "Continue as is" sends the run on to + synthesis as before; a different approach sends it back to `/plan-a-feature` or on to `/plan-a-change`. How to override the size: @@ -457,7 +469,8 @@ The skill's loop (rounds of specialist review plus facilitation until convergenc for medium, 3 for large) draws on the broader iterative-and-incremental tradition. Craig Larman and Victor Basili documented this tradition, and it is embedded in every modern Agile framework. Iteration gives specialists the chance to update their input as new information lands from other specialists. The cap prevents runaway cycles when facilitation -has plateaued. +has plateaued, and a plateau at the cap now hands the approach itself to `/reassess-approach` rather than ending on a +note. URL: https://ieeexplore.ieee.org/document/1204375 @@ -478,6 +491,8 @@ URL: https://ieeexplore.ieee.org/document/1204375 `feature-specification.md` into a plain-language summary for non-technical stakeholders before this skill runs, so the implementation plan starts from a shape stakeholders have already greenlit. - [`/iterative-plan-review`](./iterative-plan-review.md). The complement for stress-testing the plan after it lands. +- [`/reassess-approach`](./reassess-approach.md). The skill this one invokes when a medium or large run reaches its + round cap without converging, to put the approach itself in front of you before synthesis. - [`/design-an-api`](../../../han-coding/docs/skills/design-an-api.md). The narrower sibling for when the open question is the shape of one interface rather than how to deliver the whole feature. This skill produces the committable plan. `/iterative-plan-review` iterates on it. diff --git a/han-planning/docs/skills/reassess-approach.md b/han-planning/docs/skills/reassess-approach.md new file mode 100644 index 00000000..ba7cad8b --- /dev/null +++ b/han-planning/docs/skills/reassess-approach.md @@ -0,0 +1,188 @@ +# /reassess-approach + +Operator documentation for the `/reassess-approach` skill in the han plugin. This document helps you decide _when_ and +_how_ to use the skill. For what the skill does internally, read the skill definition at +[`han-planning/skills/reassess-approach/SKILL.md`](../../skills/reassess-approach/SKILL.md). + +> See also: [Plugin README](../../README.md) · [Repo root](../../../README.md) · [All skills](../../../docs/skills/README.md) · +> [All agents](../../../docs/agents/README.md) · [YAGNI](../../../docs/yagni.md) + +## TL;DR + +- **What it does.** Asks, in a fresh context, whether the approach a plan or a piece of code commits to is still the + right one, and returns structurally different alternatives, always including "stop doing this" and "continue as is", + with evidence and one recommendation. +- **When to use it.** When a plan or a piece of code has absorbed round after round of review findings without + converging, and you want the approach questioned before anyone spends another round polishing it. +- **What you get back.** One options report, `approach-reassessment-{n}.md`, and a decision handed to you. The skill + changes nothing else. + +## Key concepts + +- **Fresh context.** The critic that produces the options receives the artifact, the recorded findings, the reason it is + being asked, and the project's conventions, and nothing else. It never sees the conversation that built the artifact + or any defense of the current approach, because that context is the thing anchoring the loop. +- **Structurally different.** An option is a different mechanism, a different shape, or a smaller slice. Two candidates + that differ only in parameters, naming, or ordering count as one, and a list of nearby variants is the failure this + skill exists to interrupt. +- **Standing options.** "Stop doing this" and "continue as is" are always on the list, with the same fields as every + other option, so the question stays "does this work still earn its cost" rather than "which way shall we keep going". +- **Rework as evidence.** Each option says which recorded findings it would make moot and which it leaves open, and what + it adds or removes in owned code paths or plan items. Repeated rework on one mechanism is the case the YAGNI rule + already names as evidence for a change. + +## When to use it + +**Invoke when:** + +- A review loop has run its rounds and the same section or mechanism keeps drawing findings. +- You have been telling an agent "fix the findings, re-review, repeat" and the cycle is not closing. +- You suspect a hand-written mechanism (a parser, a scheduler, a cache) should be a library, a different shape, or + nothing at all, and want that argued from the recorded findings rather than from taste. +- You are not sure the work is worth finishing and want the stop option costed alongside the alternatives. + +`/iterative-plan-review` and `/plan-implementation` invoke it on their own when a medium or large run reaches its round +cap without converging, so you will also meet it as the closing question of those runs. A small run, capped at one +round, only points you here, because a single pass cannot show that the approach is the problem. + +**Do not invoke for:** + +- **Reviewing a plan round by round.** Use [`/iterative-plan-review`](./iterative-plan-review.md) instead; it hands off + to this skill at its cap when it needs to. +- **Planning the restructure an accepted alternative calls for.** Use [`/plan-a-change`](./plan-a-change.md) instead. +- **Surveying options from the open web.** Use [`/research`](../../../han-research/docs/skills/research.md) instead; + this skill argues from the artifact and its findings, not from prior art. +- **Assessing a module's architecture and stopping at findings.** Use + [`/architectural-analysis`](../../../han-coding/docs/skills/architectural-analysis.md) instead. +- **Redirecting a loop before it reaches its cap.** Use [`/pairing`](../../../han-core/docs/skills/pairing.md), which + stops after every round and lets you change or replace the approach by hand. + +## How to invoke it + +Run `/reassess-approach` in Claude Code. + +Give it: + +1. **The subject.** A plan file path, or a code path (a file or a directory). The sharper the subject, the sharper the + options: "the regex parser in `lib/ingest/parser.rb`" beats "the ingest module". +2. **The findings, optional.** A path to the findings file the subject has absorbed: a review-findings file, an + implementation iteration history, or a code-review report. When you give none, the skill looks beside the subject, + then falls back to the findings already in the conversation. +3. **Why now, optional.** One line in your own words. "Six review rounds on the parser and the edge cases keep coming" + tells the critic what the options have to explain. + +Example prompts: + +- `/reassess-approach docs/plans/ingest-pipeline/plan.md`. _"Three review rounds and section 2 keeps changing. Is the + streaming design still the right call?"_ +- `/reassess-approach lib/ingest/parser.rb docs/code-review-ingest.md`. _"We have fixed review findings on this parser + six times. Should it be a parser library, or should we stop parsing this format at all?"_ + +## What you get back + +One file, `approach-reassessment-{n}.md`, in the plan's `artifacts/` folder for a plan subject, or in a folder resolved +per the Han configuration for a code subject. It leads with the recommendation, then states why the question was asked, +restates what the current approach commits to and which findings it has absorbed, and lists the options. + +Every option, including the two standing ones, carries the same fields: the findings it makes moot, the findings it +leaves open, what it adds and removes in owned code paths or plan items, the recorded decisions or standards it would +reopen, the evidence, and what to run next if it is chosen. A `Deferred (YAGNI)` list holds options considered and set +aside, each with its reopening trigger. + +When a loop invoked the skill, the recommendation also lands in that loop's own record: an `approach` finding in +`review-findings.md` for `/iterative-plan-review`, or an `approach` tag in the claim ledger for `/plan-implementation`. +The report path sits in that entry's `Alternatives:` field. + +In both cases the decision comes to you as one question, led by the consequence of staying on the current approach, +with the options as named candidates and the recommendation marked. "Continue as is" is a complete answer. + +## How to get the most out of it + +- **Point it at the findings, not only the artifact.** The options are argued from the recorded findings, so a findings + file with IDs gives you options you can check line by line. +- **Say why you are asking.** A one-line reason ("the edge-case list doubled since round two") is the difference between + options that address your stall and options that address a generic one. +- **Answer the question before running anything.** The skill names the skill to run next for each option. Running + `/plan-a-change` or `/refactor` before you have picked is the polishing loop starting again. +- **Pair with `/pairing` when you want to steer earlier.** This skill fires at a loop's cap. If you want to redirect + after every round instead, drive the loop with `/pairing`. + +## YAGNI + +The skill is a YAGNI instrument pointed at a whole approach rather than at single items. It applies the +[YAGNI rule](../../../docs/yagni.md)'s simpler-version gate to each option, measured in owned code paths or plan items, +so a library or a different shape that removes more than it adds is the simpler version. It treats repeated rework on +one mechanism as the "existing structure demonstrably impedes the change" evidence the rule names, and it keeps "stop +doing this" on every list so the evidence test is applied to the work as a whole. Options the critic considered and set +aside land in the report's `Deferred (YAGNI)` section with their reopening trigger. The skill never deletes or defers +anything in the artifact itself; it proposes, and the decision stays with you. + +## Cost and latency + +One `han-core:software-architect` dispatch is the whole cost and the most expensive step; the skill relaunches it at most +once, when the first return carries no structurally different alternative or lacks a standing option. There is no +fan-out. It is built for infrequent, high-signal runs at a loop's cap or by hand when a cycle stalls, not for tight-loop +use after every round. + +## In more detail + +The skill exists because Han's review loops can only say "this finding, this fix". A finding has no category for "the +mechanism is the problem", a stop rule reads only the latest round's counts, and every round brief frames the work as +find-and-fix inside the artifact as it stands. A plan or a piece of code that keeps drawing edge-case findings therefore +runs to the cap while being patched, and nothing ever asks whether a different tool or shape would make the whole class +of findings moot. + +The repo's own research on this failure, which the literature calls premature convergence, found one mitigation with +independent support: give the question to a context that did not build the artifact. That is why this skill is a +separate dispatch with a deliberately narrow brief, rather than a step inside the loop. It is also why the result is a +decision for you rather than a rewrite. Replacing an approach is the choice that is expensive to walk back, and the +collaborative-stop rule reserves exactly that kind of choice for the person. + +The two consuming loops call it at their round cap when their convergence condition still fails. The cap is the +existing deterministic boundary, so no new threshold and no new stop was introduced; the run ends where it ended before, +with a better question. Under `/pairing`, the end of the run is already a stop. + +## Sources + +The skill's protocols and vocabulary are grounded in three in-repo sources. Each is cited because the skill draws a +specific, named artifact from it. + +### Han research: ADHD application to Han, 2026 + +The report names the failure mode (premature convergence: evaluating while generating and polishing the first +high-probability answer) and finds branch isolation, running the critic in a context with no shared history, to be the +mitigation with independent corroboration. The skill's fresh-context dispatch and its "pass nothing else" rule trace to +that finding. The same report's caution that LLM reframing adds little even with a human deciding is why the skill +measures its options against recorded findings rather than offering them on their own authority. + +URL: [docs/research/adhd-application-to-han.md](../../../docs/research/adhd-application-to-han.md) + +### Han YAGNI rule + +The simpler-version gate, measured here in owned code paths or plan items, and the "refactor when the existing structure +demonstrably impedes the change" carve-out are the footing for treating repeated rework as evidence. + +URL: [han-core/references/yagni-rule.md](../../../han-core/references/yagni-rule.md) + +### Han collaborative-stop rule + +The "expensive to walk back" test is why the skill hands the choice back rather than applying the recommendation. + +URL: [han-core/references/collaborative-stop-rule.md](../../../han-core/references/collaborative-stop-rule.md) + +## Related documentation + +- [Plugin README](../../README.md). The plugin's front door: its skills, agents, and how they fit together. +- [Repo root README](../../../README.md). The Han suite landing page. Start here if you arrived from outside the docs + tree. +- [YAGNI](../../../docs/yagni.md). The evidence-based "You Aren't Gonna Need It" rule. The two gates, the + acceptable-evidence list, the named anti-patterns, and the deferral format. +- [`iterative-plan-review`](./iterative-plan-review.md). Hands off to this skill at its round cap when the plan has not + converged. +- [`plan-implementation`](./plan-implementation.md). Hands off to this skill at its round cap instead of reporting a + facilitation plateau. +- [`plan-a-change`](./plan-a-change.md). Where an accepted restructure goes next. +- [`software-architect`](../../../han-core/docs/agents/software-architect.md). The critic this skill dispatches, in the + same options-before-commitment shape `/design-an-api` uses. +- [Multi-agent economics](../../../han-plugin-builder/skills/guidance/references/agent-building-guidelines/multi-agent-economics.md). + Why the skill dispatches one agent and no reviewer of it. diff --git a/han-planning/skills/iterative-plan-review/SKILL.md b/han-planning/skills/iterative-plan-review/SKILL.md index 04b3987a..8c099a91 100644 --- a/han-planning/skills/iterative-plan-review/SKILL.md +++ b/han-planning/skills/iterative-plan-review/SKILL.md @@ -5,8 +5,9 @@ description: > and recording every finding and iteration in cross-referenced companion files. Use this skill whenever the user wants to iterate on, refine, tighten, or improve a plan. Also use it when the user asks to verify, validate, or confirm feasibility of an approach. Does not implement plan steps, write test plans, review code, or investigate bugs, and - does not generate new plans from scratch — use plan-a-feature for a new plan. Runs its review rounds to completion - without pausing between them; to review each round as it lands, use pairing. + does not generate new plans from scratch — use plan-a-feature for a new plan. Does not propose a different approach + when a plan stops converging — at its round cap it hands that question to reassess-approach. Runs its review rounds to + completion without pausing between them; to review each round as it lands, use pairing. arguments: size argument-hint: "[size: small | medium | large | dynamic] [context or path to plan file]" allowed-tools: @@ -225,8 +226,9 @@ and there is no mandatory agent consultation for these findings. 1. **Classify each finding as major or minor before recording.** Major: changes a behavioral commitment, edge-case rule, alternate flow, or failure mode in the plan; touches security/auth/PII/secrets/supply-chain; touches a coordination across actors, services, or subsystems; is a `T#-contradiction`; leaves a contract the build must conform to - un-pinned; or is a "mechanics leaking into spec" finding. Minor: typo, wording, naming, formatting, citation - cleanup. Force-up to major if the finding text contains keywords like "auth", "PII", "race", "ordering", + un-pinned; is a "mechanics leaking into spec" finding; or is an `approach` finding, which names the plan's + mechanism as the open question and carries the alternatives considered. Minor: typo, wording, naming, formatting, + citation cleanup. Force-up to major if the finding text contains keywords like "auth", "PII", "race", "ordering", "coordination", "edge case", "T#", "format", "contract", "schema", "interface", "signature". When in doubt, major. For each refuted assumption, overlap finding, ambiguity, or edge case that required attention, append an `F#` entry @@ -248,6 +250,13 @@ and there is no mandatory agent consultation for these findings. findings (security, T#-contradiction, missing coordination, unhandled failure mode in a primary flow path). The size cap from Step 2 sets the upper bound: small = 1 iteration, medium = 2, large = 3. Never exceed the size cap. +**No hand-off in lightweight mode.** When the single iteration did not satisfy the convergence condition above, say so +in the closing summary and add one line: if this plan keeps drawing findings, run `/reassess-approach` on it. Do not +invoke `han-planning:reassess-approach` from this mode, BECAUSE one pass cannot tell a plan that is stuck on its +approach from a plan that needed edits, and the hand-off would add the suite's most expensive dispatch to its cheapest +mode on that weakest signal. The hand-off belongs to team mode, where it fires after two or three rounds (Step 4, +sub-step 7). + Skip to Step 6. ## Step 5: Team Iteration Rounds (team mode only) @@ -319,10 +328,11 @@ loop earlier whenever a round goes quiet, so the cap is a ceiling rather than a 3. **Classify and record findings.** For each finding from a specialist, classify it as major or minor before recording. Major: changes a behavioral commitment, edge-case rule, alternate flow, or failure mode in the plan; touches security/auth/PII/secrets/supply-chain; touches a coordination across actors, services, or subsystems; is a - `T#-contradiction`; leaves a contract the build must conform to un-pinned; or is a "mechanics leaking into spec" - finding. Minor: typo, wording, naming, formatting, citation cleanup. Force-up to major if the finding text contains - keywords like "auth", "PII", "race", "ordering", "coordination", "edge case", "T#", "format", "contract", "schema", - "interface", "signature". When in doubt, major. + `T#-contradiction`; leaves a contract the build must conform to un-pinned; is a "mechanics leaking into spec" + finding; or is an `approach` finding, which names the plan's mechanism as the open question and carries the + alternatives considered. Minor: typo, wording, naming, formatting, citation cleanup. Force-up to major if the finding + text contains keywords like "auth", "PII", "race", "ordering", "coordination", "edge case", "T#", "format", + "contract", "schema", "interface", "signature". When in doubt, major. Append the entry to `{plan-dir}/artifacts/review-findings.md` (create the `artifacts/` subfolder if it does not already exist; append to the legacy root-level path if the prior session used it). Major findings go under @@ -354,6 +364,16 @@ loop earlier whenever a round goes quiet, so the cap is a ceiling rather than a primary flow path). The size cap from Step 2 sets the upper bound: medium = 2 rounds, large = 3 rounds. Never exceed the size cap. +7. **Hand off at the cap.** When the cap is reached and the most recent round did not satisfy the convergence condition + in sub-step 6, the plan has stopped converging on its current approach. Invoke `han-planning:reassess-approach` with + the plan path, `{plan-dir}/artifacts/review-findings.md`, the output folder `{plan-dir}/artifacts/`, and a one-line + reason naming the cap and what the last round produced. Record its recommendation as a major `F#` entry with + `Category: approach`, `Agent: reassess-approach`, `Alternatives:` pointing at the report it wrote, `Resolution:` + blank, and `Resolved by:` awaiting user input. Present it through the between-rounds channel below as the run's + closing question, and end the run. Do not spend a further round on the plan, BECAUSE the budget is spent and another + pass would polish an approach the person has not yet confirmed. "Continue as is" is a complete answer and, when + given, the next invocation proceeds as it does today. + **Running collaboratively.** When the request asks to review each round as it lands, which is what `pairing` does when it hands work here, stop at the end of each round and hand control back instead of starting the next. Present the stop in the shape [collaborative-stop-rule.md](../../references/collaborative-stop-rule.md) specifies: the round's findings @@ -364,7 +384,9 @@ continue as below; an ordinary invocation is unchanged. Between rounds, surface to the user any finding where two agents disagree on substance, or where resolving the finding requires a judgment only the plan's author can make. Present each as a contextual question with impact, tradeoffs, and a recommended answer. Record the question on the corresponding `F#` entry and, if the user answers before the next round, -update `Resolution:` / `Resolved by:` and the relevant plan section. +update `Resolution:` / `Resolved by:` and the relevant plan section. An `approach` finding from the hand-off at the cap +is such a judgment: its options are the named candidates, its recommendation is the recommended answer, and the +consequence of staying on the current approach leads the question. ## Step 6: Update the Plan's Review History Section diff --git a/han-planning/skills/iterative-plan-review/references/review-findings-template.md b/han-planning/skills/iterative-plan-review/references/review-findings-template.md index 1848d8fe..67962427 100644 --- a/han-planning/skills/iterative-plan-review/references/review-findings-template.md +++ b/han-planning/skills/iterative-plan-review/references/review-findings-template.md @@ -53,10 +53,12 @@ feature-technical-notes.md in sync. - **Agent:** - **Category:** - + - **Finding:** - **Evidence considered:** +- **Alternatives:** + - **Resolution:** - **Resolved by:** @@ -71,6 +73,7 @@ feature-technical-notes.md in sync. - **Category:** ... - **Finding:** ... - **Evidence considered:** ... +- **Alternatives:** ... - **Resolution:** ... - **Resolved by:** ... - **Raised in round:** ... diff --git a/han-planning/skills/plan-a-change/SKILL.md b/han-planning/skills/plan-a-change/SKILL.md index 179944ba..9d049fb6 100644 --- a/han-planning/skills/plan-a-change/SKILL.md +++ b/han-planning/skills/plan-a-change/SKILL.md @@ -7,7 +7,8 @@ description: > a restructure, extraction, split, consolidation, responsibility shift, or API revision of existing code, including "these responsibilities are wrong, plan the fix". Does not assess an area and stop at findings — use architectural-analysis. Does not specify new behavior — use plan-a-feature. Does not diagnose a bug — use investigate. - Does not write the code — use refactor to restructure it or tdd to build it. + Does not question whether the current approach is the right one — use reassess-approach. Does not write the code — + use refactor to restructure it or tdd to build it. arguments: size argument-hint: "[size: small | medium | large | dynamic] [what needs to change, optional: source findings path]" allowed-tools: diff --git a/han-planning/skills/plan-implementation/SKILL.md b/han-planning/skills/plan-implementation/SKILL.md index 53f64a86..e46110a9 100644 --- a/han-planning/skills/plan-implementation/SKILL.md +++ b/han-planning/skills/plan-implementation/SKILL.md @@ -5,8 +5,9 @@ description: > facilitated team conversation. Use when the user wants to plan how to implement, build, deliver, or ship a feature that has already been specified. Does not specify what the feature should do — use plan-a-feature first. Does not design the contract for an interface — use design-an-api. Does not refine or stress-test an already-written plan — - use iterative-plan-review. Runs its resolution rounds to completion and holds its questions until after they finish; - to review each round as it lands, use pairing. + use iterative-plan-review. Does not propose a different approach when the rounds stop converging — at its round cap it + hands that question to reassess-approach. Runs its resolution rounds to completion and holds its questions until after + they finish; to review each round as it lands, use pairing. arguments: size argument-hint: "[size: small | medium | large | dynamic] [feature specification path, optional: additional context]" allowed-tools: @@ -368,13 +369,27 @@ For each iteration: - The deterministic next-step recommendation is **"blocked pending user input"** and all blocking Open Questions have been escalated to the user with recommendations still awaiting answers. - The most recent round produced ≤ 2 new findings AND zero major findings (security, T#-contradiction, missing - coordination, unhandled failure mode, or any finding tagged `spec-level`). + coordination, unhandled failure mode, or any finding tagged `spec-level` or `approach`). Otherwise, continue with another iteration. The round cap from Step 3 sets the upper bound: small = 1 round, medium = 2 rounds, large = 3 rounds. Never exceed the -size cap. If the team is still iterating at the cap, surface the remaining Open Questions to the user with -recommendations and a note that the team has reached a facilitation plateau. +size cap. + +**Hand off at the cap (medium and large only).** If the team is still iterating at a cap of two or more rounds, the +plan has stopped converging on its current approach. At the small cap of one round, do not invoke the hand-off: say in +the Step 7 escalation that the round did not converge and that `/reassess-approach` is available by hand, BECAUSE one +round cannot tell a plan stuck on its approach from a plan that needed a round of work. At medium or large, invoke +`han-planning:reassess-approach` with the specification or plan path, +`{folder}/artifacts/implementation-iteration-history.md`, the output folder `{folder}/artifacts/`, and a one-line reason +naming the cap and what the last round produced. Tag its recommendation `approach` in the claim ledger. Then surface the +remaining Open Questions to the user with recommendations, and present the reassessment as the first of them per +[../../references/operator-escalation-rule.md](../../references/operator-escalation-rule.md): the consequence of staying +on the current approach leads, the options are the named candidates, and the report's recommendation is marked. Do not +proceed to synthesis until the person answers, BECAUSE a plan synthesized on an approach they have not confirmed is the +work this hand-off exists to avoid. "Continue as is" is a complete answer and sends the run on to Step 7 as it does +today; an accepted alternative sends it where the report says (`plan-a-feature` to re-specify, `plan-a-change` to +restructure) instead of into synthesis. ## Step 7: Final User Escalation Pass diff --git a/han-planning/skills/plan-implementation/references/round-aggregation.md b/han-planning/skills/plan-implementation/references/round-aggregation.md index 58d0156d..d0d8376d 100644 --- a/han-planning/skills/plan-implementation/references/round-aggregation.md +++ b/han-planning/skills/plan-implementation/references/round-aggregation.md @@ -30,10 +30,12 @@ cited entry and reading which field each figure came from. behavior. - `T#-contradiction` — the specialist recommends a mechanic that conflicts with a committed `T#` note. Load-bearing by construction. +- `approach` — the recommendation `han-planning:reassess-approach` returns at the round cap, naming the plan's approach + as the open question with the alternatives considered. Never resolved inside the loop; it goes to the user. Use simple text rules: a finding that names a spec section and says "the spec is silent" / "not specified" / "undefined -behavior" is `spec-level`. A finding that names a `T#` ID and proposes a different mechanic is `T#-contradiction`. -Everything else is `plan-level`. +behavior" is `spec-level`. A finding that names a `T#` ID and proposes a different mechanic is `T#-contradiction`. A +finding that arrives from the cap hand-off is `approach`. Everything else is `plan-level`. **Compute the spec-maturity gate.** The gate trips when either condition holds: diff --git a/han-planning/skills/reassess-approach/SKILL.md b/han-planning/skills/reassess-approach/SKILL.md new file mode 100644 index 00000000..1dc87452 --- /dev/null +++ b/han-planning/skills/reassess-approach/SKILL.md @@ -0,0 +1,145 @@ +--- +name: "reassess-approach" +description: > + Asks whether the approach a plan or a piece of code commits to is still the right one, in a fresh context, and returns + structurally different alternatives, always including stopping the work and continuing as is, each with evidence and + one recommendation. Use when a plan or a piece of code has absorbed round after round of review findings without + converging, when you want to step back and question the approach, the tool, or the shape before spending another + round, or when you wonder whether the work is worth doing at all. iterative-plan-review and plan-implementation invoke + it when a multi-round run reaches its cap without converging. Produces an options report and changes nothing. Does + not review a plan round by round — use iterative-plan-review. Does not plan the restructure an accepted alternative + calls for — use plan-a-change. Does not survey options from the open web — use research. Does not assess a module's + architecture and stop at findings — use architectural-analysis. +argument-hint: "[plan file or code path] [optional: findings file path] [optional: why you are asking]" +allowed-tools: + Read, Write, Glob, Grep, Agent, Bash(find *), Bash(mkdir *), + Bash(bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh") +--- + +## Project Context + +- CLAUDE.md: !`find . -maxdepth 1 -name "CLAUDE.md" -type f` +- project-discovery.md: !`find . -maxdepth 3 -name "project-discovery.md" -type f` +- personal config directory: !`bash "${CLAUDE_PLUGIN_ROOT}/scripts/han-config-dir.sh" 2>/dev/null || echo "$HOME/.claude"` +- project .han/config.md: !`cat .han/config.md 2>/dev/null || echo ""` + +As your first action, use the Read tool on `.han/config.md` inside the `personal config directory` path above. A read +that returns no file is no personal configuration: continue silently. When that file or the `project .han/config.md` +probe supplies content, apply it per [config-rule.md](../../references/config-rule.md), which governs precedence +between the two files, relative-path resolution, and what to do with a file that reads but cannot be used. + +## Operating Principles + +- **A fresh context is the mechanism, not a nicety.** The critic receives the subject, the recorded findings, the reason + it is being asked, and the project's conventions, and nothing else. Never pass it the calling run's own assessment, + the conversation's defense of the current approach, or a preferred answer, BECAUSE the context that built an artifact + is anchored on it, and an anchored reviewer polishes where it should question. +- **Options are structurally different, or they are not options.** A different mechanism, a different shape, a smaller + slice, or none at all. Two candidates that differ only in parameters, naming, or ordering are one option, and a list of + nearby variants is the failure this skill exists to interrupt. +- **"Stop doing this" and "continue as is" are always on the list.** The question is whether the work still earns its + cost, so both standing options carry the same fields as every other option, BECAUSE a list without them is a list of + ways to keep going. +- **The recorded findings are the evidence.** Each option says which recorded findings it would make moot and which it + leaves open, and what it adds or removes in owned code paths or plan items. Repeated rework on one mechanism is the + "existing structure demonstrably impedes the change" case the YAGNI rule names as evidence, so apply + [../../references/yagni-rule.md](../../references/yagni-rule.md) to each option on that footing: a library or a + different shape that removes more owned code paths than it adds is the simpler version. +- **This skill proposes and changes nothing.** It writes one report and edits no plan, no code, and no companion file. + The choice belongs to the person, and a loop that invoked this skill resumes only on their answer. +- **One agent.** One critic dispatch produces the options. Do not add a reviewer of the critic, and do not dispatch an + investigator to pre-digest the subject: the critic reads it directly. A second dispatch is allowed only as the single + relaunch Step 3 describes. + +# Reassess the Approach + +## Step 1: Establish the Subject, the Findings, and the Reason + +Determine how the skill was reached and what it is looking at. + +1. **Mode.** When a calling skill passed a plan path, a findings path, a reason, and an output location, you are in + **hand-off mode**: take those inputs as given and ask nothing. Otherwise you are in **hand-invoked mode** and resolve + each input below from the argument and the conversation. +2. **Subject.** A plan file, or a code path (a file or a directory). Read the plan in full, or list the code path and + read its entry points, so the next steps can name what the current approach commits to. If no subject can be + resolved, ask for one in a single question and end the turn. +3. **Findings.** Use the findings file passed in, or look for one beside a plan subject: `artifacts/review-findings.md`, + `artifacts/implementation-iteration-history.md`, or their legacy root-level counterparts. Beside a code subject, look + for a `code-review-*.md` report in the documentation root. When nothing is on disk, take the findings the + conversation already holds. When there are none at all, record that and continue: the critic then works from the + subject alone, and the report says so. +4. **Reason.** One line stating why the question is being asked now: the cap a loop reached and what its last round + produced, or the person's own words. In hand-invoked mode with no stated reason, record "asked by hand, no stall + recorded". +5. **Output location.** For a plan subject, the report lands in that plan's `artifacts/` folder as + `approach-reassessment-{n}.md`, with `{n}` continuing from any existing reassessment files there. For a code subject, + resolve the folder per [config-rule.md](../../references/config-rule.md): a folder the user named wins; otherwise the + `output-directory` setting; otherwise a three-to-five-word kebab-case folder under the documentation root discovered + from CLAUDE.md's `## Project Discovery` section, `project-discovery.md`, or a Glob fallback (`docs/plans/`, `docs/`). + In hand-invoked mode on a code subject, confirm the folder name before writing. + +## Step 2: Resolve Project Conventions + +Read CLAUDE.md's `## Project Discovery` section for the coding-standards and ADR directories, fall back to +`project-discovery.md`, then to a Glob over `docs/adr/` and `docs/coding-standards/`. Collect the paths of the standards +and decisions that bear on the subject, so the critic's options respect what the project has already decided rather +than rediscovering it. + +## Step 3: Dispatch the Critic + +Launch `han-core:software-architect` with one `Agent` call. Pass it only: + +- The subject: the plan file path, or the code path, with the instruction to read it directly. +- The findings file path (or the findings gathered in Step 1, verbatim), labelled as the record the options must + account for. +- The reason line from Step 1. +- The convention paths from Step 2 and the YAGNI rule at `${CLAUDE_PLUGIN_ROOT}/references/yagni-rule.md`. +- The report template at [references/approach-reassessment-template.md](./references/approach-reassessment-template.md), + as the shape of its answer. + +Its brief must say: + +1. **Assume the current approach is the wrong one** until the evidence says otherwise. Restate in one paragraph what the + subject commits to today and which recorded findings it has absorbed, by ID. +2. **Produce one to three alternatives**, each structurally different from the current approach and from each other: a + different mechanism, a different shape, or a smaller slice. Each one is a thing someone could build, not a strawman. +3. **Always add two standing options**, "stop doing this" and "continue as is", carrying the same fields as the rest. +4. **For every option**, give the evidence for it, the recorded findings it would make moot and the ones it leaves open, + the owned code paths or plan items it adds and removes, the recorded decisions or standards it would reopen, and what + to run next if it is chosen (`plan-a-change` for a restructure, `plan-a-feature` to re-specify, `refactor` for a + behavior-preserving substitution, `tdd` for a behavior change, or nothing). +5. **End with one recommendation** and the reasoning that selects it, plus a `Deferred (YAGNI)` list for anything + considered and set aside with its reopening trigger. + +Do not pass the calling skill's own reading of the findings, any earlier recommendation, or the conversation's reasons +for the current approach. + +**Check what comes back before using it.** An option that differs from the current approach only in parameters, naming, +or ordering is not an alternative, and a return without both standing options is incomplete. In either case relaunch the +critic once with the missing requirement restated. If the second return still carries no structurally different +alternative, do not invent one: the report records that none was produced, with the critic's stated reason, and presents +the two standing options alone. If the agent fails or returns nothing usable twice, stop and tell the person the critic +could not be run, naming what was passed to it. + +## Step 4: Write the Report + +Invoke `han-communication:readability-guidance` to source the shared readability standard, then write the report at the +Step 1 location from [references/approach-reassessment-template.md](./references/approach-reassessment-template.md). +Hold the named audience: the person who decides, who may not have read the plan or the code. Lead with the +recommendation, keep one option per section, and put the technical detail under each option's prose rather than in it. +Preserve every finding ID and every path the critic cited. Run the standard's self-check over the prose before moving on. + +The report is the only file this skill writes. Create the `artifacts/` folder when it is missing and never edit the +subject, the findings file, or any other companion file. + +## Step 5: Hand the Decision Back + +**In hand-off mode**, return the report path and the recommendation line to the calling skill and stop. The caller +presents the options through its own question channel and resumes only on the person's answer. + +**In hand-invoked mode**, present the decision per +[../../references/operator-escalation-rule.md](../../references/operator-escalation-rule.md): one question, opening with +the consequence of staying on the current approach in plain language, then the options as named candidates with the +recommendation marked, then the report path and the technical references below. End the turn. A reply of "keep going" +or "continue as is" is a complete answer. Do not implement, plan, or re-run anything on the person's behalf; when they +pick an option, name the skill the report says to run next and let them run it. diff --git a/han-planning/skills/reassess-approach/references/approach-reassessment-template.md b/han-planning/skills/reassess-approach/references/approach-reassessment-template.md new file mode 100644 index 00000000..d0821d40 --- /dev/null +++ b/han-planning/skills/reassess-approach/references/approach-reassessment-template.md @@ -0,0 +1,75 @@ +# Approach reassessment: {subject name} + +Reassessment report. Read the Recommendation, then pick an option or ask for more on any of them. Nothing has been +changed. + +## Recommendation + +- **Pick:** {option ID and name} +- **Because:** {one or two sentences a person who has not read the plan or the code can follow} +- **What it costs to walk back:** {what has to be redone if this choice turns out wrong} + +## Why this was asked + +- **Subject:** `{plan file path or code path}` +- **Asked by:** {calling skill name, or "hand invocation"} +- **Reason:** {the cap reached and what the last round produced, or the person's words} +- **Findings read:** `{findings file path}`, or "none on disk; findings taken from the conversation", or "none" + +## The approach as it stands + +{One paragraph: what the subject commits to today, in plain words. Then the recorded findings it has absorbed, by ID, +and the ones still open.} + +## Options + + + +### O1: {name} + +{One or two sentences on what changes, for a reader who has not seen the artifact.} + +- **Findings it makes moot:** {IDs} +- **Findings it leaves open:** {IDs} +- **Adds and removes:** {owned code paths or plan items added; owned code paths or plan items removed} +- **Reopens:** {recorded decisions, pinned contracts, or standards this option would reopen, or "nothing"} +- **Evidence:** {file:line citations, finding IDs, or the label "inferred"} +- **Run next if chosen:** {`plan-a-change` | `plan-a-feature` | `refactor` | `tdd` | nothing} + +### O2: {name} + +{Same fields.} + +### Stop doing this + +{What is lost and what is saved if the work stops here.} + +- **Findings it makes moot:** {IDs, usually all of them} +- **Findings it leaves open:** {IDs} +- **Adds and removes:** {what is removed or left unbuilt} +- **Reopens:** {the commitment or work item that asked for this} +- **Evidence:** {…} +- **Run next if chosen:** {nothing, or the skill that records the decision} + +### Continue as is + +{What another round costs and what it would have to produce to be worth it.} + +- **Findings it makes moot:** none +- **Findings it leaves open:** {IDs} +- **Adds and removes:** nothing +- **Reopens:** nothing +- **Evidence:** {…} +- **Run next if chosen:** {the calling skill, or the next step the person was about to take} + +## Deferred (YAGNI) + + + +- **{Option}.** {Why it was set aside.} Reopen when {trigger}. + +## Evidence + + + +- **{E1}:** `{file:line}` — {what it shows}