Skip to content

Open-source skills for designing and reviewing software with AI agents

feat(draft): compare the draft with the brief (#171)

Mohab Fekry82b03968e300
diff --git a/distributions/claude/skills/egm-brainstorm/SKILL.md b/distributions/claude/skills/egm-brainstorm/SKILL.md
index f6009dc..b2772c7 100644
--- a/distributions/claude/skills/egm-brainstorm/SKILL.md
+++ b/distributions/claude/skills/egm-brainstorm/SKILL.md
@@ -196,6 +196,11 @@ The `concepts_brief.md` artifact follows this structure:
* **In-Scope Goals:** [Explicitly defined scope items]
* **Out-of-Scope Non-Goals:** [Features intentionally excluded]
+## Alternatives Weighed
+
+[Each option rejected during ideation, with the reason. `/egm-draft` copies
+these into Alternatives Considered and has no other source for them.]
+
## Key Decisions & Staging for Next Steps
[Key decisions resolved during ideation to be carried forward into `/egm-draft`.]
diff --git a/distributions/claude/skills/egm-draft/SKILL.md b/distributions/claude/skills/egm-draft/SKILL.md
index 1f67074..b6065cc 100644
--- a/distributions/claude/skills/egm-draft/SKILL.md
+++ b/distributions/claude/skills/egm-draft/SKILL.md
@@ -195,8 +195,10 @@ this strict generation order:
### Step 4: Draft Alternatives
-1. **Review Alternatives**: Recall the alternatives debated and rejected during
- brainstorming.
+1. **Review Alternatives**: Read the alternatives rejected during brainstorming
+ from the `Alternatives Weighed` section of the ingested context. Do not
+ rely on memory: drafting often runs in a new session. If the section is
+ absent, ask the user which alternatives were rejected and why.
2. **Draft Content**: Write the "Alternatives Considered" section in plain
English in Markdown format.
3. **Detail Reasons**: For each alternative, explicitly state *why* it was
@@ -244,7 +246,27 @@ any impactful decisions. Follow these guidelines:
When you are asked to write or save the design document, follow these rules
strictly:
-1. **Target Directory**: If the user specified a target directory or file, use
+1. **Reconcile against the Predecessor Context**: Do not grade the draft
+ against the Zoom Out standard here. The session that wrote the draft agrees
+ with it; `/egm-review` Stage 5 runs that check from a fresh context.
+ Instead, re-read the context ingested at Step 1 and compare it with the
+ draft. No Goldfish can do this check, because no Goldfish reads the brief.
+ * **Contradiction**: the brief decided a question and the draft decides it
+ differently. Report every one.
+ * **Addition**: the draft decides a question the brief did not raise.
+ Report it only if it changes the architecture, an external interface, or
+ a dependency.
+
+ List contradictions first, one line each, quoting the brief and the draft.
+ Ask the user to decide each one. Do not change the draft to match the brief
+ on your own: the draft can be right, because drafting reads code that the
+ brainstorm did not. If nothing diverges, say so in one line. If Step 1
+ found no predecessor file, skip this step.
+
+ If a contradiction is open, stop and wait for the user. Apply each
+ decision to `design_draft.md` before Step 6.2.
+
+2. **Target Directory**: If the user specified a target directory or file, use
it. Otherwise, probe the workspace for existing design directories (from
`Context File` directory, `docs/designs/`, or `<project>/docs/designs/`),
bind `[DiscoveredPath]` (defaulting to `docs/designs/`), and present a
@@ -273,19 +295,9 @@ strictly:
`"Please specify the custom target directory path where you would like
to save the design document."` and yield active execution.
-2. **Update Sitemap**: If `<DESIGN_DIR>/SITEMAP.md` exists, register the new
+3. **Update Sitemap**: If `<DESIGN_DIR>/SITEMAP.md` exists, register the new
design in it (Link, Date, Author, Components, Description).
-3. **Self-Evaluate against Zoom Out Standard**: Before saving the file,
- self-evaluate the compiled design document (contents of `design_draft.md`)
- against the EGM Zoom Out Standard
- (`resources/document_standards/zoom-out-standard.md`).
- Verify that the design remains focused on the root problem, does not
- introduce premature optimizations or speculative logic (YAGNI), maximizes
- reuse, and avoids repeating itself. If any issues are found, present them to
- the user, explain the proposed improvements, and ask for confirmation before
- refining the draft.
-
4. **Write doc**: Once finalized, write the contents of `design_draft.md` to
the designated destination file at `<DESIGN_DIR>/<FEATURE>.md` using your
file-writing tool. Follow the [template](references/design_doc.md) for final
diff --git a/docs/designs/draft.md b/docs/designs/draft.md
index 75d07dd..6c7676b 100644
--- a/docs/designs/draft.md
+++ b/docs/designs/draft.md
@@ -60,7 +60,6 @@ sequenceDiagram
participant Draft as egm-draft Skill
participant Summary as Artifact: concepts_brief.md / notes
participant DraftArtifact as Artifact: design_draft.md
- participant ZoomOut as zoom-out-standard.md
participant Workspace as Workspace File: docs/designs/<FEATURE>.md
participant Review as egm-review Skill
@@ -79,7 +78,8 @@ sequenceDiagram
Draft->>Human: Request Feedback on Implementation Checklist
Note over Human,Draft: Step 6: Finalization, Watermark & Handoff
- Draft->>ZoomOut: Self-Evaluate vs zoom-out-standard.md
+ Draft->>Summary: Reconcile draft against concepts_brief.md
+ Draft->>Human: Report contradictions & architectural additions
Draft->>DraftArtifact: Append Watermark Footer
Draft->>Workspace: Write docs/designs/<FEATURE>.md
Draft->>Human: Provide link to spec & recommend /egm-review
@@ -110,7 +110,7 @@ Appends component diagrams (Mermaid), API signatures, and data flow narratives.
### Step 4: Alternatives Considered
Documents rejected alternatives with concrete trade-off justifications (latency,
-complexity, maintenance).
+complexity, maintenance), read from the brief's `Alternatives Weighed` section.
### Step 5: Detailed Implementation Plan
@@ -123,8 +123,9 @@ Drafts the execution section:
### Step 6: Finalization, Formatting & Registration
-* Performs a final self-evaluation against
- [`zoom-out-standard.md`](../../resources/document_standards/zoom-out-standard.md).
+* Reconciles the draft against the predecessor context and asks the user to
+ decide each contradiction. It does not self-grade against the Zoom Out
+ standard; `/egm-review` Stage 5 does that from a fresh context.
* Appends a standardized provenance watermark footer (*`*Drafted with EGM*`*)
separated by a horizontal rule delimiter (`--------------------------------------------------------------------------------`)
after trailing open questions.
diff --git a/skills/egm-brainstorm/SKILL.md b/skills/egm-brainstorm/SKILL.md
index f6009dc..b2772c7 100644
--- a/skills/egm-brainstorm/SKILL.md
+++ b/skills/egm-brainstorm/SKILL.md
@@ -196,6 +196,11 @@ The `concepts_brief.md` artifact follows this structure:
* **In-Scope Goals:** [Explicitly defined scope items]
* **Out-of-Scope Non-Goals:** [Features intentionally excluded]
+## Alternatives Weighed
+
+[Each option rejected during ideation, with the reason. `/egm-draft` copies
+these into Alternatives Considered and has no other source for them.]
+
## Key Decisions & Staging for Next Steps
[Key decisions resolved during ideation to be carried forward into `/egm-draft`.]
diff --git a/skills/egm-draft/SKILL.md b/skills/egm-draft/SKILL.md
index 1f67074..b6065cc 100644
--- a/skills/egm-draft/SKILL.md
+++ b/skills/egm-draft/SKILL.md
@@ -195,8 +195,10 @@ this strict generation order:
### Step 4: Draft Alternatives
-1. **Review Alternatives**: Recall the alternatives debated and rejected during
- brainstorming.
+1. **Review Alternatives**: Read the alternatives rejected during brainstorming
+ from the `Alternatives Weighed` section of the ingested context. Do not
+ rely on memory: drafting often runs in a new session. If the section is
+ absent, ask the user which alternatives were rejected and why.
2. **Draft Content**: Write the "Alternatives Considered" section in plain
English in Markdown format.
3. **Detail Reasons**: For each alternative, explicitly state *why* it was
@@ -244,7 +246,27 @@ any impactful decisions. Follow these guidelines:
When you are asked to write or save the design document, follow these rules
strictly:
-1. **Target Directory**: If the user specified a target directory or file, use
+1. **Reconcile against the Predecessor Context**: Do not grade the draft
+ against the Zoom Out standard here. The session that wrote the draft agrees
+ with it; `/egm-review` Stage 5 runs that check from a fresh context.
+ Instead, re-read the context ingested at Step 1 and compare it with the
+ draft. No Goldfish can do this check, because no Goldfish reads the brief.
+ * **Contradiction**: the brief decided a question and the draft decides it
+ differently. Report every one.
+ * **Addition**: the draft decides a question the brief did not raise.
+ Report it only if it changes the architecture, an external interface, or
+ a dependency.
+
+ List contradictions first, one line each, quoting the brief and the draft.
+ Ask the user to decide each one. Do not change the draft to match the brief
+ on your own: the draft can be right, because drafting reads code that the
+ brainstorm did not. If nothing diverges, say so in one line. If Step 1
+ found no predecessor file, skip this step.
+
+ If a contradiction is open, stop and wait for the user. Apply each
+ decision to `design_draft.md` before Step 6.2.
+
+2. **Target Directory**: If the user specified a target directory or file, use
it. Otherwise, probe the workspace for existing design directories (from
`Context File` directory, `docs/designs/`, or `<project>/docs/designs/`),
bind `[DiscoveredPath]` (defaulting to `docs/designs/`), and present a
@@ -273,19 +295,9 @@ strictly:
`"Please specify the custom target directory path where you would like
to save the design document."` and yield active execution.
-2. **Update Sitemap**: If `<DESIGN_DIR>/SITEMAP.md` exists, register the new
+3. **Update Sitemap**: If `<DESIGN_DIR>/SITEMAP.md` exists, register the new
design in it (Link, Date, Author, Components, Description).
-3. **Self-Evaluate against Zoom Out Standard**: Before saving the file,
- self-evaluate the compiled design document (contents of `design_draft.md`)
- against the EGM Zoom Out Standard
- (`resources/document_standards/zoom-out-standard.md`).
- Verify that the design remains focused on the root problem, does not
- introduce premature optimizations or speculative logic (YAGNI), maximizes
- reuse, and avoids repeating itself. If any issues are found, present them to
- the user, explain the proposed improvements, and ask for confirmation before
- refining the draft.
-
4. **Write doc**: Once finalized, write the contents of `design_draft.md` to
the designated destination file at `<DESIGN_DIR>/<FEATURE>.md` using your
file-writing tool. Follow the [template](references/design_doc.md) for final
diff --git a/skills/egm-draft/TEST.md b/skills/egm-draft/TEST.md
index 5c0723d..668a2d8 100644
--- a/skills/egm-draft/TEST.md
+++ b/skills/egm-draft/TEST.md
@@ -1,3 +1,14 @@
# Test Plan: EGM Draft Skill
Frontmatter and link checks run in `pytest tests/unit` (see [TESTING.md](../../TESTING.md)).
+
+## Protocol Verification Checklist
+
+When evaluating or exploring `egm-draft` interactively in chat, verify:
+
+- **Step 4 (Alternatives):** Reads rejected alternatives from the brief's
+ `Alternatives Weighed` section, or asks the user if it is absent.
+- **Step 6 (Finalize):** Reports contradictions between the brief and the
+ draft before directory selection, and waits for the user to decide each
+ one. Does not self-grade against
+ the Zoom Out standard.
diff --git a/skills/egm-draft/test_scenarios.yaml b/skills/egm-draft/test_scenarios.yaml
index a0ef752..a2da19f 100644
--- a/skills/egm-draft/test_scenarios.yaml
+++ b/skills/egm-draft/test_scenarios.yaml
@@ -120,3 +120,18 @@ scenarios:
- type: "contains"
pattern: "../sibling/README.md"
message: "Sibling link must use relative path formatting."
+
+ - scenario_id: "finalize_reconciles_instead_of_self_grading"
+ description: "Verifies Step 6 reconciles the draft against the brief and does not self-grade against the Zoom Out standard."
+ eval_type: "deterministic"
+ system_prompt:
+ skill_file: "skills/egm-draft/SKILL.md"
+ turns:
+ - user_input: "All sections are approved. concepts_brief.md chose PostgreSQL; the draft uses Spanner. Finalize the document."
+ assertions:
+ - type: "required_pattern"
+ pattern: "(?i)contradiction"
+ message: "Finalization must report the brief/draft contradiction to the user."
+ - type: "forbidden_pattern"
+ pattern: "Save to detected directory"
+ message: "Directory selection must wait until the user decides each contradiction."