Skip to content

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

fix(review): ask before passing outside links to reviewers (#268)

Yash Dayani244292ca394a
diff --git a/distributions/claude/skills/egm-review-loop/SKILL.md b/distributions/claude/skills/egm-review-loop/SKILL.md
index c08cbfe..e7b710a 100644
--- a/distributions/claude/skills/egm-review-loop/SKILL.md
+++ b/distributions/claude/skills/egm-review-loop/SKILL.md
@@ -54,7 +54,8 @@ The caller or user provides exactly these parameters:
* **`Standards`**: Mapping of reviewer names to standard names (shortnames or
paths).
* **`GoldfishContext`**: A reading list (source files, directories, or
- documentation URLs) fed to reviewers to establish their baseline.
+ documentation URLs) fed to reviewers to establish their baseline. An empty
+ list from the caller counts as provided; do not ask for it again.
## Path & Standard Resolution Logic
@@ -115,8 +116,10 @@ file` mode is specified, confirm full-file line bounds).
The synthesizer spawns the Goldfish review swarm in
parallel, deduplicates findings, writes the report artifact, and
returns a single summary message to avoid context pollution in the root
- conversation. Pass it the Failed Reviewers rule below. Its summary must
- give a status, `completed` or `not run`, for each requested reviewer.
+ conversation. Pass it the Failed Reviewers rule below and
+ `GoldfishContext`, and tell it to give those files to each reviewer.
+ Its summary must give a status, `completed` or `not run`, for each
+ requested reviewer.
* **Direct Dispatch (Flat Swarm)**: Alternatively, spawn each requested
reviewer subagent in `Reviewers` directly.
Instruct each subagent to first read its persona definition in
diff --git a/distributions/claude/skills/egm-review/SKILL.md b/distributions/claude/skills/egm-review/SKILL.md
index e497822..2116de0 100644
--- a/distributions/claude/skills/egm-review/SKILL.md
+++ b/distributions/claude/skills/egm-review/SKILL.md
@@ -72,8 +72,7 @@ If your harness has no subagent tool, stop and tell the user: a review in the sa
* **`TargetFile`**: Absolute or relative path to the design document.
* **`GoldfishContext`** (Optional): Reading list to establish the system
- baseline. If omitted, the system defaults to no additional context (but
- always automatically reads files linked or referenced in the design doc).
+ baseline. If omitted, it holds only the linked files that Step 1.3 adds.
* **`Step` (Optional)**: Specific pipeline preset or stage to run (e.g.
`interactive`, `uninterrupted`, `feature_spec`, `implementation`, or an
individual stage `5`, `6`, `7`, `8`, `9`). If omitted, the user is prompted.
@@ -89,16 +88,32 @@ If your harness has no subagent tool, stop and tell the user: a review in the sa
use structured question tools such as `ask_question`, as providing an
arbitrary file path is an open-ended text input, not a choice between
fixed options) and end your turn.
-2. Once `TargetFile` is provided, verify if `GoldfishContext` is provided (or
- if the user explicitly stated in their prompt to proceed with no additional
- context). If missing:
+2. Once `TargetFile` is provided, verify if `GoldfishContext` is provided (an
+ empty list counts as provided, as does the user explicitly stating in their
+ prompt to proceed with no additional context). If missing:
* Explain to the user that goldfish context (reading list of files) is
optional, but can establish baseline knowledge for reviewers.
- * Clarify that reviewers **always automatically read** files explicitly
- mentioned or linked in the target design document itself.
+ * Clarify that linked files inside the working directory are added
+ automatically, and that other links and URLs need approval.
* Prompt the user in chat via regular text if they wish to provide
additional context files. Do NOT use structured question tools for
open-ended file paths.
+3. **Linked Files (run later)**: Do not run this during intake. Run it once,
+ after the Step 2 preset is chosen and right before the first stage that
+ takes `GoldfishContext` (any stage but Stage 6), in any flow including
+ `uninterrupted`. Read `TargetFile`, skip anchor-only links (`#...`), drop
+ the `#fragment` from other links, and resolve each relative link against
+ the design document's folder. Add each link whose real path (after
+ following symbolic links) stays inside the working directory to
+ `GoldfishContext`, skipping files that do not exist. If any link resolves
+ outside the working directory or is a URL, list those links in chat as
+ regular text, ask which to include, and end your turn; if no one can
+ answer, as in a headless run, leave them all out and keep going. Add only
+ approved ones and tell the user which were left out. Some reviewers cannot
+ open URLs, so save each approved page as a file in the working directory
+ (or your harness's artifact directory) and pass its path. Pass
+ `GoldfishContext` to every stage except Stage 6, which reads the document
+ alone; tell any synthesizer to give these files to each reviewer.
### Step 2: Curated Pipeline Preset Selection
@@ -248,6 +263,7 @@ plain chat):
* **Resume Notification**: When the author replies in chat indicating
edits are complete:
* Re-read `TargetFile` to recalculate line shifts.
+ * If Step 1.3 has run, apply its rules to links added since then.
* Re-run the current stage subflow.
* **1-Audit Convergence Cap**: Each stage allows a maximum of 1
re-audit. If manual doc updates are requested again after a
@@ -263,7 +279,8 @@ plain chat):
1. **Uninterrupted Stage Execution**: Execute all five review stages in
sequence without interactive checkpoint pauses between steps. For each
stage, write the individual report file to the working directory (or your
- harness's artifact directory, if it has one):
+ harness's artifact directory, if it has one). Pass `GoldfishContext` to
+ every step except Step 6.
* **Step 5 (Initial Zoom Out)**: Spawn `egm-synthesizer` (or direct
subagent) with `Reviewers: [egm-zoom-out]` on `full file` → write
`zoom_out_report.md`.
@@ -300,6 +317,7 @@ plain chat):
as Step 8 (Intermediate Zoom Out), include `zoom_out_report.md` path in
context and focus on additions/mitigations from Comprehension and Critic
stages.
+ In both Stage 5 and Stage 8, pass `GoldfishContext`.
2. **Delivery**: Write findings to `zoom_out_report.md` (Stage 5) or
`intermediate_zoom_out_report.md` (Stage 8) using your file-writing tool.
3. **Notify User (No Chat Dumps)**: Notify user that findings are written to
@@ -348,9 +366,9 @@ plain chat):
### Subflow: Critic Review
1. **Invoke Antagonistic Review Loop**: Invoke `egm-review-loop` in-thread on
- `FeatureRange` with reviewers `[egm-design, egm-structural, egm-style]` and
+ `FeatureRange` with reviewers `[egm-design, egm-structural, egm-style]`,
standards `{"egm-design": "feature-spec-standard", "egm-structural":
- "feature-spec-standard"}`.
+ "feature-spec-standard"}`, and `GoldfishContext`.
2. **Notify User (No Chat Dumps)**: Notify user that findings are written to
`critic_report.md` (give its path).
3. **Checkpoint Gate**: Present the Stage 7 gate:
@@ -378,7 +396,8 @@ plain chat):
`DetailedRange` with reviewers `[egm-implementation-readiness,
egm-codebase-details, egm-style]` and standards
`{"egm-implementation-readiness": "implementation-readiness-standard",
- "egm-codebase-details": "implementation-readiness-standard"}`.
+ "egm-codebase-details": "implementation-readiness-standard"}`, and
+ `GoldfishContext`.
2. **Notify User (No Chat Dumps)**: Notify user that findings are written to
`implementation_readiness_report.md` (give its path).
3. **Terminal Checkpoint Gate**: Present the Stage 9 terminal gate:
diff --git a/skills/egm-review-loop/SKILL.md b/skills/egm-review-loop/SKILL.md
index c08cbfe..e7b710a 100644
--- a/skills/egm-review-loop/SKILL.md
+++ b/skills/egm-review-loop/SKILL.md
@@ -54,7 +54,8 @@ The caller or user provides exactly these parameters:
* **`Standards`**: Mapping of reviewer names to standard names (shortnames or
paths).
* **`GoldfishContext`**: A reading list (source files, directories, or
- documentation URLs) fed to reviewers to establish their baseline.
+ documentation URLs) fed to reviewers to establish their baseline. An empty
+ list from the caller counts as provided; do not ask for it again.
## Path & Standard Resolution Logic
@@ -115,8 +116,10 @@ file` mode is specified, confirm full-file line bounds).
The synthesizer spawns the Goldfish review swarm in
parallel, deduplicates findings, writes the report artifact, and
returns a single summary message to avoid context pollution in the root
- conversation. Pass it the Failed Reviewers rule below. Its summary must
- give a status, `completed` or `not run`, for each requested reviewer.
+ conversation. Pass it the Failed Reviewers rule below and
+ `GoldfishContext`, and tell it to give those files to each reviewer.
+ Its summary must give a status, `completed` or `not run`, for each
+ requested reviewer.
* **Direct Dispatch (Flat Swarm)**: Alternatively, spawn each requested
reviewer subagent in `Reviewers` directly.
Instruct each subagent to first read its persona definition in
diff --git a/skills/egm-review/SKILL.md b/skills/egm-review/SKILL.md
index e497822..2116de0 100644
--- a/skills/egm-review/SKILL.md
+++ b/skills/egm-review/SKILL.md
@@ -72,8 +72,7 @@ If your harness has no subagent tool, stop and tell the user: a review in the sa
* **`TargetFile`**: Absolute or relative path to the design document.
* **`GoldfishContext`** (Optional): Reading list to establish the system
- baseline. If omitted, the system defaults to no additional context (but
- always automatically reads files linked or referenced in the design doc).
+ baseline. If omitted, it holds only the linked files that Step 1.3 adds.
* **`Step` (Optional)**: Specific pipeline preset or stage to run (e.g.
`interactive`, `uninterrupted`, `feature_spec`, `implementation`, or an
individual stage `5`, `6`, `7`, `8`, `9`). If omitted, the user is prompted.
@@ -89,16 +88,32 @@ If your harness has no subagent tool, stop and tell the user: a review in the sa
use structured question tools such as `ask_question`, as providing an
arbitrary file path is an open-ended text input, not a choice between
fixed options) and end your turn.
-2. Once `TargetFile` is provided, verify if `GoldfishContext` is provided (or
- if the user explicitly stated in their prompt to proceed with no additional
- context). If missing:
+2. Once `TargetFile` is provided, verify if `GoldfishContext` is provided (an
+ empty list counts as provided, as does the user explicitly stating in their
+ prompt to proceed with no additional context). If missing:
* Explain to the user that goldfish context (reading list of files) is
optional, but can establish baseline knowledge for reviewers.
- * Clarify that reviewers **always automatically read** files explicitly
- mentioned or linked in the target design document itself.
+ * Clarify that linked files inside the working directory are added
+ automatically, and that other links and URLs need approval.
* Prompt the user in chat via regular text if they wish to provide
additional context files. Do NOT use structured question tools for
open-ended file paths.
+3. **Linked Files (run later)**: Do not run this during intake. Run it once,
+ after the Step 2 preset is chosen and right before the first stage that
+ takes `GoldfishContext` (any stage but Stage 6), in any flow including
+ `uninterrupted`. Read `TargetFile`, skip anchor-only links (`#...`), drop
+ the `#fragment` from other links, and resolve each relative link against
+ the design document's folder. Add each link whose real path (after
+ following symbolic links) stays inside the working directory to
+ `GoldfishContext`, skipping files that do not exist. If any link resolves
+ outside the working directory or is a URL, list those links in chat as
+ regular text, ask which to include, and end your turn; if no one can
+ answer, as in a headless run, leave them all out and keep going. Add only
+ approved ones and tell the user which were left out. Some reviewers cannot
+ open URLs, so save each approved page as a file in the working directory
+ (or your harness's artifact directory) and pass its path. Pass
+ `GoldfishContext` to every stage except Stage 6, which reads the document
+ alone; tell any synthesizer to give these files to each reviewer.
### Step 2: Curated Pipeline Preset Selection
@@ -248,6 +263,7 @@ plain chat):
* **Resume Notification**: When the author replies in chat indicating
edits are complete:
* Re-read `TargetFile` to recalculate line shifts.
+ * If Step 1.3 has run, apply its rules to links added since then.
* Re-run the current stage subflow.
* **1-Audit Convergence Cap**: Each stage allows a maximum of 1
re-audit. If manual doc updates are requested again after a
@@ -263,7 +279,8 @@ plain chat):
1. **Uninterrupted Stage Execution**: Execute all five review stages in
sequence without interactive checkpoint pauses between steps. For each
stage, write the individual report file to the working directory (or your
- harness's artifact directory, if it has one):
+ harness's artifact directory, if it has one). Pass `GoldfishContext` to
+ every step except Step 6.
* **Step 5 (Initial Zoom Out)**: Spawn `egm-synthesizer` (or direct
subagent) with `Reviewers: [egm-zoom-out]` on `full file` → write
`zoom_out_report.md`.
@@ -300,6 +317,7 @@ plain chat):
as Step 8 (Intermediate Zoom Out), include `zoom_out_report.md` path in
context and focus on additions/mitigations from Comprehension and Critic
stages.
+ In both Stage 5 and Stage 8, pass `GoldfishContext`.
2. **Delivery**: Write findings to `zoom_out_report.md` (Stage 5) or
`intermediate_zoom_out_report.md` (Stage 8) using your file-writing tool.
3. **Notify User (No Chat Dumps)**: Notify user that findings are written to
@@ -348,9 +366,9 @@ plain chat):
### Subflow: Critic Review
1. **Invoke Antagonistic Review Loop**: Invoke `egm-review-loop` in-thread on
- `FeatureRange` with reviewers `[egm-design, egm-structural, egm-style]` and
+ `FeatureRange` with reviewers `[egm-design, egm-structural, egm-style]`,
standards `{"egm-design": "feature-spec-standard", "egm-structural":
- "feature-spec-standard"}`.
+ "feature-spec-standard"}`, and `GoldfishContext`.
2. **Notify User (No Chat Dumps)**: Notify user that findings are written to
`critic_report.md` (give its path).
3. **Checkpoint Gate**: Present the Stage 7 gate:
@@ -378,7 +396,8 @@ plain chat):
`DetailedRange` with reviewers `[egm-implementation-readiness,
egm-codebase-details, egm-style]` and standards
`{"egm-implementation-readiness": "implementation-readiness-standard",
- "egm-codebase-details": "implementation-readiness-standard"}`.
+ "egm-codebase-details": "implementation-readiness-standard"}`, and
+ `GoldfishContext`.
2. **Notify User (No Chat Dumps)**: Notify user that findings are written to
`implementation_readiness_report.md` (give its path).
3. **Terminal Checkpoint Gate**: Present the Stage 9 terminal gate:
diff --git a/skills/egm-review/TEST.md b/skills/egm-review/TEST.md
index c266749..99075be 100644
--- a/skills/egm-review/TEST.md
+++ b/skills/egm-review/TEST.md
@@ -7,6 +7,9 @@ Frontmatter and link checks run in `pytest tests/unit` (see [TESTING.md](../../T
When evaluating or exploring `egm-review` interactively in chat, verify:
- **Step 1 (Intake):** Gathers `TargetFile` and optional `GoldfishContext`.
+ Before the first stage that takes `GoldfishContext`, adds linked files
+ inside the working directory and asks before adding links that resolve
+ outside it or URLs.
- **Step 2 (Preset Selection):** Offers the four review presets (interactive,
consolidated, feature spec only, implementation plan only), or maps an
explicit `Step` argument to its corresponding preset or individual stage subflow.
diff --git a/skills/egm-review/test_scenarios.yaml b/skills/egm-review/test_scenarios.yaml
index 7745fc3..b3c06ac 100644
--- a/skills/egm-review/test_scenarios.yaml
+++ b/skills/egm-review/test_scenarios.yaml
@@ -123,3 +123,32 @@ scenarios:
- type: "required_pattern"
pattern: "(?i)paraphrase"
message: "The comprehension report must keep the paraphrase, also when there are no findings."
+
+ - scenario_id: "linked_files_outside_workspace_need_approval"
+ description: "Asserts that links outside the working directory are listed and need user approval, and that declined links are reported as excluded."
+ eval_type: "deterministic"
+ system_prompt:
+ skill_file: "skills/egm-review/SKILL.md"
+ turns:
+ - user_input: "Run EGM Review on docs/design.md with Step: uninterrupted and no additional context. The doc links to ./api.md, /etc/hosts, ../../other-repo/notes.md, and https://example.com/spec."
+ assertions:
+ - type: "required_pattern"
+ pattern: "/etc/hosts"
+ message: "Review must list the absolute path outside the working directory."
+ - type: "required_pattern"
+ pattern: "other-repo/notes\\.md"
+ message: "Review must list the relative link that resolves outside the working directory."
+ - type: "required_pattern"
+ pattern: "example\\.com/spec"
+ message: "Review must list the URL."
+ - type: "required_pattern"
+ pattern: "(?i)(include|approve|add|pass|use|allow)[^\\n]*\\?"
+ message: "Review must ask the user which outside links to include."
+ - type: "forbidden_pattern"
+ pattern: "(?i)automatically read (every|all|any) (file|link)s? (the (design )?doc|it|that)"
+ message: "Review must not claim reviewers automatically read linked files."
+ - user_input: "Include none of those three links. Continue."
+ assertions:
+ - type: "required_pattern"
+ pattern: "(?i)((omitted|exclud\\w*|skipped|left out|not (be )?(includ|add|pass)\\w*)[^\\n]{0,80}(/etc/hosts|other-repo|example\\.com|links?\\b|them\\b)|(/etc/hosts|other-repo|example\\.com|links?\\b|those\\b|them\\b)[^\\n]{0,80}(omitted|exclud|skipped|left out|not (be )?(includ|add|pass))|leav\\w* (them|those|these|all)\\b[^\\n]{0,30}\\bout\\b|none of (those|these|the)\\b[^\\n]{0,60}(includ|add|pass))"
+ message: "Review must confirm the declined links are left out of the reviewers' context."