Open-source skills for designing and reviewing software with AI agents
Python agent-skillsai-agentsantigravityclaude-codeclaude-code-pluginclaude-skillscodexcodex-plugincoding-agentscontext-engineeringdeveloper-toolsgeminillmmulti-agentprompt-engineeringspec-driven-development
Prepare runtime packages and permissions for plugin directories
Oliver Newthf91dccb14b09
diff --git a/.claude-plugin/agents/bootstrap_orchestrator.md b/.claude-plugin/agents/bootstrap_orchestrator.mdindex 3d757b8..9cebd6b 100644--- a/.claude-plugin/agents/bootstrap_orchestrator.md+++ b/.claude-plugin/agents/bootstrap_orchestrator.md@@ -2,12 +2,15 @@name: egm-bootstrap-orchestratordescription: Orchestrates directory README documentation, partitions subtrees, and coordinates worker subagents.license: Apache-2.0+tools: [Agent, Bash, Read, Grep, Glob, Write, Edit]model: inherit---Read `${CLAUDE_PLUGIN_ROOT}/agents/bootstrap_orchestrator.md` before acting.-Follow that canonical persona's instructions. This adapter keeps all tools,-because the bootstrap skill uses the shell.+Follow that canonical persona's instructions. Use the listed tools for local+documentation discovery, worker coordination, and README edits. Shell commands+remain subject to the user's normal permission rules. No MCP or web tools are+enabled by this adapter; Bash is not a filesystem or network sandbox.When your prompt says to run `egm-bootstrap`, read`${CLAUDE_PLUGIN_ROOT}/skills/egm_bootstrap/SKILL.md` and follow it. Do notuse the `Skill` tool for EGM skills. When started as a workerdiff --git a/.claude-plugin/hooks/allow_plugin_reads.sh b/.claude-plugin/hooks/allow_plugin_reads.shdeleted file mode 100755index 9884120..0000000--- a/.claude-plugin/hooks/allow_plugin_reads.sh+++ /dev/null@@ -1,28 +0,0 @@-#!/bin/sh-# Copyright 2026 Google LLC.-# SPDX-License-Identifier: Apache-2.0--# Approves Read, Grep and Glob only inside the plugin folders that EGM reads at-# run time. Personas and standards live outside the user's workspace, and-# headless runs and background subagents cannot ask for permission, so without-# this a Goldfish cannot read its persona. The rest of the plugin root is left-# out because a local install copies the whole clone, private files included.-# Anything not clearly inside those folders, including any input that contains-# "..", falls through to the normal permission rules.-input=$(cat)-case "$input" in *..*) exit 0 ;; esac-root=${CLAUDE_PLUGIN_ROOT%/}-[ -n "$root" ] || exit 0-# An absolute or home-relative Glob pattern could name files outside `path`.-if printf '%s' "$input" | grep -Eq '"tool_name"[[:space:]]*:[[:space:]]*"Glob"' &&- printf '%s' "$input" | grep -Eq '"pattern"[[:space:]]*:[[:space:]]*"[/~]'; then- exit 0-fi-path=$(printf '%s' "$input" | sed -nE 's/.*"(file_path|path)"[[:space:]]*:[[:space:]]*"([^"\\]*)".*/\2/p' | head -n 1)-case "$path" in- "$root"/agents | "$root"/agents/* | "$root"/docs | "$root"/docs/* | \- "$root"/resources | "$root"/resources/* | "$root"/skills | "$root"/skills/*)- printf '%s\n' '{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"allow","permissionDecisionReason":"EGM plugin file"}}'- ;;-esac-exit 0diff --git a/.claude-plugin/icon.png b/.claude-plugin/icon.pngnew file mode 100644index 0000000..febc2b2Binary files /dev/null and b/.claude-plugin/icon.png differdiff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.jsonindex b23ca8d..8271801 100644--- a/.claude-plugin/plugin.json+++ b/.claude-plugin/plugin.json@@ -1,5 +1,6 @@{"name": "egm",+ "displayName": "Elephant-Goldfish Model","version": "0.1.0","description": "Elephant-Goldfish Model: spec-driven development with deep-context drafting and zero-context Goldfish reviews.","author": {@@ -8,6 +9,12 @@"homepage": "https://egm.dev","repository": "https://github.com/google/elephant-goldfish-model","license": "Apache-2.0",+ "keywords": ["spec-driven-development", "design-documents", "design-review"],+ "icon": "./.claude-plugin/icon.png",+ "documentationUrl": "https://github.com/google/elephant-goldfish-model/blob/main/docs/claude.md",+ "supportUrl": "https://github.com/google/elephant-goldfish-model/issues",+ "privacyPolicyUrl": "https://github.com/google/elephant-goldfish-model/blob/main/docs/privacy.md",+ "termsOfServiceUrl": "https://github.com/google/elephant-goldfish-model/blob/main/LICENSE","agents": ["./.claude-plugin/agents/bootstrap_orchestrator.md","./.claude-plugin/agents/codebase_details.md",@@ -18,18 +25,5 @@"./.claude-plugin/agents/style.md","./.claude-plugin/agents/synthesizer.md","./.claude-plugin/agents/zoom_out.md"- ],- "hooks": {- "PreToolUse": [- {- "matcher": "Read|Grep|Glob",- "hooks": [- {- "type": "command",- "command": "\"${CLAUDE_PLUGIN_ROOT}/.claude-plugin/hooks/allow_plugin_reads.sh\""- }- ]- }- ]- }+ ]}diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.jsonindex 0ee3fb3..694a0b0 100644--- a/.codex-plugin/plugin.json+++ b/.codex-plugin/plugin.json@@ -2,14 +2,26 @@"name": "egm","version": "0.1.0","description": "Elephant-Goldfish Model: spec-driven development with deep-context drafting and zero-context Goldfish reviews.",+ "author": {+ "name": "Google LLC"+ },"homepage": "https://egm.dev","repository": "https://github.com/google/elephant-goldfish-model","license": "Apache-2.0","skills": "./skills/",+ "requires_local_executor": true,"interface": {"displayName": "Elephant-Goldfish Model",- "shortDescription": "Spec-driven development with Goldfish reviews",+ "shortDescription": "Draft and stress-test specs",+ "longDescription": "Draft software specifications, stress-test them with fresh-context Goldfish reviewers, resolve findings, and check implementation drift. EGM includes seven skills for developers working in a local codebase. It reads project files and writes design documents and review reports. Bootstrap can run local shell commands. Reviews require native subagents with fresh context; the workflow stops if the host cannot provide isolation. Model calls use your host account's quota. Cloud harness verification remains partial; see TESTING.md. This is not an officially supported Google product.","developerName": "Google LLC",- "category": "Productivity"+ "category": "Developer Tools",+ "capabilities": ["Draft specifications", "Review designs", "Check implementation drift"],+ "websiteURL": "https://egm.dev",+ "supportURL": "https://github.com/google/elephant-goldfish-model/issues",+ "privacyPolicyURL": "https://github.com/google/elephant-goldfish-model/blob/main/docs/privacy.md",+ "termsOfServiceURL": "https://github.com/google/elephant-goldfish-model/blob/main/LICENSE",+ "composerIcon": "./assets/icon.svg",+ "logo": "./assets/icon.svg"}}diff --git a/TESTING.md b/TESTING.mdindex 8635956..6574568 100644--- a/TESTING.md+++ b/TESTING.md@@ -63,9 +63,13 @@ With an authenticated Claude Code 2.1.271+ installation, run:EGM_CLAUDE_LIVE=1 pytest tests/integration/test_claude.py```-This uses the account's model quota. It loads a copy of the plugin, invokes-the review skill, and checks that a native reviewer reads only its persona and-sees no parent or project `CLAUDE.md` context. See [Claude integration](docs/claude.md).+This uses the account's model quota. It builds the Claude runtime and gives it+a unique test name. Two probes invoke the review skill with folder-scoped read+permissions and no approval hook. They check that a native reviewer reads only+its persona, sees no parent or project `CLAUDE.md` context, and stops without a+verdict when an explicit deny rule blocks its persona. This is a focused probe,+not the full review workflow or a marketplace installation test.+See [Claude integration](docs/claude.md).---## Native Codex Integration Tests (Opt-in)diff --git a/assets/icon.svg b/assets/icon.svgnew file mode 100644index 0000000..f5d50f6--- /dev/null+++ b/assets/icon.svg@@ -0,0 +1,12 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="1.5 1.5 21 21" width="64" height="64">+ <!-- Copyright 2026 Google LLC. SPDX-License-Identifier: Apache-2.0 -->+ <!-- Existing site favicon geometry, with fixed colors for plugin renderers. -->+ <g fill="#1b6ef3" stroke="#1b6ef3" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round">+ <path stroke="none" d="M10.30,6.80 A5.20,5.20 0 0 0 10.30,17.20 A1.20,1.20 0 0 0 11.50,16.00 L11.50,8.00 A1.20,1.20 0 0 0 10.30,6.80Z"/>+ <path fill="none" d="M7.20,12.00 C6.80,14.60 3.40,14.70 3.20,12.60 C3.10,11.20 3.30,10.20 3.60,9.40"/>+ </g>+ <g fill="#e86e00" stroke="#e86e00" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round">+ <path stroke="none" d="M13.70,6.80 A5.20,5.20 0 0 1 13.70,17.20 A1.20,1.20 0 0 1 12.50,16.00 L12.50,8.00 A1.20,1.20 0 0 1 13.70,6.80Z"/>+ <path fill="none" d="M16.80,12.00 L18.00,12.00 C18.80,12.00 19.40,10.60 20.90,9.40 M18.00,12.00 C18.80,12.00 19.40,13.40 20.90,14.60"/>+ </g>+</svg>diff --git a/distributions/claude/.claude-plugin/agents/bootstrap_orchestrator.md b/distributions/claude/.claude-plugin/agents/bootstrap_orchestrator.mdnew file mode 100644index 0000000..9cebd6b--- /dev/null+++ b/distributions/claude/.claude-plugin/agents/bootstrap_orchestrator.md@@ -0,0 +1,18 @@+---+name: egm-bootstrap-orchestrator+description: Orchestrates directory README documentation, partitions subtrees, and coordinates worker subagents.+license: Apache-2.0+tools: [Agent, Bash, Read, Grep, Glob, Write, Edit]+model: inherit+---++Read `${CLAUDE_PLUGIN_ROOT}/agents/bootstrap_orchestrator.md` before acting.+Follow that canonical persona's instructions. Use the listed tools for local+documentation discovery, worker coordination, and README edits. Shell commands+remain subject to the user's normal permission rules. No MCP or web tools are+enabled by this adapter; Bash is not a filesystem or network sandbox.+When your prompt says to run `egm-bootstrap`, read+`${CLAUDE_PLUGIN_ROOT}/skills/egm_bootstrap/SKILL.md` and follow it. Do not+use the `Skill` tool for EGM skills. When started as a worker+(`is_worker=true`), return the JSON `subtree_index` payload that the skill+specifies, not prose.diff --git a/distributions/claude/.claude-plugin/agents/codebase_details.md b/distributions/claude/.claude-plugin/agents/codebase_details.mdnew file mode 100644index 0000000..ae2f1f1--- /dev/null+++ b/distributions/claude/.claude-plugin/agents/codebase_details.md@@ -0,0 +1,16 @@+---+name: egm-codebase-details+description: Technical accuracy and code reuse reviewer.+license: Apache-2.0+tools: [Read, Grep, Glob]+model: inherit+omitClaudeMd: true+---++Read `${CLAUDE_PLUGIN_ROOT}/agents/codebase_details.md` before reviewing.+Follow that canonical persona's instructions. This adapter defines your Claude+tool and context restrictions. Resolve bundled standards against+`${CLAUDE_PLUGIN_ROOT}`. Remain read-only and use only the task and explicitly+supplied review context.+Before returning findings, read the target and every supplied standard. If a+required file cannot be read, report an incomplete review instead of a verdict.diff --git a/distributions/claude/.claude-plugin/agents/comprehension.md b/distributions/claude/.claude-plugin/agents/comprehension.mdnew file mode 100644index 0000000..65edd82--- /dev/null+++ b/distributions/claude/.claude-plugin/agents/comprehension.md@@ -0,0 +1,16 @@+---+name: egm-comprehension+description: Naive reader and comprehension reviewer.+license: Apache-2.0+tools: [Read, Grep, Glob]+model: inherit+omitClaudeMd: true+---++Read `${CLAUDE_PLUGIN_ROOT}/agents/comprehension.md` before reviewing.+Follow that canonical persona's instructions. This adapter defines your Claude+tool and context restrictions. Resolve bundled standards against+`${CLAUDE_PLUGIN_ROOT}`. Remain read-only and use only the task and explicitly+supplied review context.+Before returning findings, read the target and every supplied standard. If a+required file cannot be read, report an incomplete review instead of a verdict.diff --git a/distributions/claude/.claude-plugin/agents/design_critic.md b/distributions/claude/.claude-plugin/agents/design_critic.mdnew file mode 100644index 0000000..26a1073--- /dev/null+++ b/distributions/claude/.claude-plugin/agents/design_critic.md@@ -0,0 +1,16 @@+---+name: egm-design+description: Architecture and design critic.+license: Apache-2.0+tools: [Read, Grep, Glob]+model: inherit+omitClaudeMd: true+---++Read `${CLAUDE_PLUGIN_ROOT}/agents/design_critic.md` before reviewing.+Follow that canonical persona's instructions. This adapter defines your Claude+tool and context restrictions. Resolve bundled standards against+`${CLAUDE_PLUGIN_ROOT}`. Remain read-only and use only the task and explicitly+supplied review context.+Before returning findings, read the target and every supplied standard. If a+required file cannot be read, report an incomplete review instead of a verdict.diff --git a/distributions/claude/.claude-plugin/agents/implementation_readiness.md b/distributions/claude/.claude-plugin/agents/implementation_readiness.mdnew file mode 100644index 0000000..08bdc18--- /dev/null+++ b/distributions/claude/.claude-plugin/agents/implementation_readiness.md@@ -0,0 +1,16 @@+---+name: egm-implementation-readiness+description: Implementation readiness reviewer.+license: Apache-2.0+tools: [Read, Grep, Glob]+model: inherit+omitClaudeMd: true+---++Read `${CLAUDE_PLUGIN_ROOT}/agents/implementation_readiness.md` before reviewing.+Follow that canonical persona's instructions. This adapter defines your Claude+tool and context restrictions. Resolve bundled standards against+`${CLAUDE_PLUGIN_ROOT}`. Remain read-only and use only the task and explicitly+supplied review context.+Before returning findings, read the target and every supplied standard. If a+required file cannot be read, report an incomplete review instead of a verdict.diff --git a/distributions/claude/.claude-plugin/agents/structural.md b/distributions/claude/.claude-plugin/agents/structural.mdnew file mode 100644index 0000000..bd978f6--- /dev/null+++ b/distributions/claude/.claude-plugin/agents/structural.md@@ -0,0 +1,16 @@+---+name: egm-structural+description: Document structure reviewer.+license: Apache-2.0+tools: [Read, Grep, Glob]+model: inherit+omitClaudeMd: true+---++Read `${CLAUDE_PLUGIN_ROOT}/agents/structural.md` before reviewing.+Follow that canonical persona's instructions. This adapter defines your Claude+tool and context restrictions. Resolve bundled standards against+`${CLAUDE_PLUGIN_ROOT}`. Remain read-only and use only the task and explicitly+supplied review context.+Before returning findings, read the target and every supplied standard. If a+required file cannot be read, report an incomplete review instead of a verdict.diff --git a/distributions/claude/.claude-plugin/agents/style.md b/distributions/claude/.claude-plugin/agents/style.mdnew file mode 100644index 0000000..9d55d5e--- /dev/null+++ b/distributions/claude/.claude-plugin/agents/style.md@@ -0,0 +1,16 @@+---+name: egm-style+description: Technical writing reviewer.+license: Apache-2.0+tools: [Read, Grep, Glob]+model: inherit+omitClaudeMd: true+---++Read `${CLAUDE_PLUGIN_ROOT}/agents/style.md` before reviewing.+Follow that canonical persona's instructions. This adapter defines your Claude+tool and context restrictions. Resolve bundled standards against+`${CLAUDE_PLUGIN_ROOT}`. Remain read-only and use only the task and explicitly+supplied review context.+Before returning findings, read the target and every supplied standard. If a+required file cannot be read, report an incomplete review instead of a verdict.diff --git a/distributions/claude/.claude-plugin/agents/synthesizer.md b/distributions/claude/.claude-plugin/agents/synthesizer.mdnew file mode 100644index 0000000..a9a29a3--- /dev/null+++ b/distributions/claude/.claude-plugin/agents/synthesizer.md@@ -0,0 +1,15 @@+---+name: egm-synthesizer+description: Intermediate Swarm Compiler and Aggregator coordinating parallel Goldfish reviewers, deduplicating findings, and compiling deliverable reports.+license: Apache-2.0+tools: [Agent, Read, Grep, Glob, Write]+model: inherit+---++Read `${CLAUDE_PLUGIN_ROOT}/agents/synthesizer.md` before acting.+Follow that canonical persona's instructions. This adapter defines your Claude+tool restrictions: spawn reviewers with the Agent tool using the plugin's+registered reviewer types (for example `egm:egm-zoom-out`), read files, and+write the consolidated report. You cannot run shell commands or use MCP+connectors. Resolve bundled personas and standards against+`${CLAUDE_PLUGIN_ROOT}` and pass absolute paths to each reviewer.diff --git a/distributions/claude/.claude-plugin/agents/zoom_out.md b/distributions/claude/.claude-plugin/agents/zoom_out.mdnew file mode 100644index 0000000..b6866c1--- /dev/null+++ b/distributions/claude/.claude-plugin/agents/zoom_out.md@@ -0,0 +1,16 @@+---+name: egm-zoom-out+description: Simplicity and scope reviewer.+license: Apache-2.0+tools: [Read, Grep, Glob]+model: inherit+omitClaudeMd: true+---++Read `${CLAUDE_PLUGIN_ROOT}/agents/zoom_out.md` before reviewing.+Follow that canonical persona's instructions. This adapter defines your Claude+tool and context restrictions. Resolve bundled standards against+`${CLAUDE_PLUGIN_ROOT}`. Remain read-only and use only the task and explicitly+supplied review context.+Before returning findings, read the target and every supplied standard. If a+required file cannot be read, report an incomplete review instead of a verdict.diff --git a/distributions/claude/.claude-plugin/icon.png b/distributions/claude/.claude-plugin/icon.pngnew file mode 100644index 0000000..febc2b2Binary files /dev/null and b/distributions/claude/.claude-plugin/icon.png differdiff --git a/distributions/claude/.claude-plugin/plugin.json b/distributions/claude/.claude-plugin/plugin.jsonnew file mode 100644index 0000000..8271801--- /dev/null+++ b/distributions/claude/.claude-plugin/plugin.json@@ -0,0 +1,29 @@+{+ "name": "egm",+ "displayName": "Elephant-Goldfish Model",+ "version": "0.1.0",+ "description": "Elephant-Goldfish Model: spec-driven development with deep-context drafting and zero-context Goldfish reviews.",+ "author": {+ "name": "Google LLC"+ },+ "homepage": "https://egm.dev",+ "repository": "https://github.com/google/elephant-goldfish-model",+ "license": "Apache-2.0",+ "keywords": ["spec-driven-development", "design-documents", "design-review"],+ "icon": "./.claude-plugin/icon.png",+ "documentationUrl": "https://github.com/google/elephant-goldfish-model/blob/main/docs/claude.md",+ "supportUrl": "https://github.com/google/elephant-goldfish-model/issues",+ "privacyPolicyUrl": "https://github.com/google/elephant-goldfish-model/blob/main/docs/privacy.md",+ "termsOfServiceUrl": "https://github.com/google/elephant-goldfish-model/blob/main/LICENSE",+ "agents": [+ "./.claude-plugin/agents/bootstrap_orchestrator.md",+ "./.claude-plugin/agents/codebase_details.md",+ "./.claude-plugin/agents/comprehension.md",+ "./.claude-plugin/agents/design_critic.md",+ "./.claude-plugin/agents/implementation_readiness.md",+ "./.claude-plugin/agents/structural.md",+ "./.claude-plugin/agents/style.md",+ "./.claude-plugin/agents/synthesizer.md",+ "./.claude-plugin/agents/zoom_out.md"+ ]+}diff --git a/distributions/claude/.github/PULL_REQUEST_TEMPLATE.md b/distributions/claude/.github/PULL_REQUEST_TEMPLATE.mdnew file mode 100644index 0000000..288485d--- /dev/null+++ b/distributions/claude/.github/PULL_REQUEST_TEMPLATE.md@@ -0,0 +1,23 @@+## Contribution Type++Please select the track that matches this pull request:++- [ ] **Bug Fix / Minor Patch** (Targeted fix, non-test diff <= 100 lines and < 3 core files in `skills/` or `agents/`; no design doc required)+- [ ] **Feature / Architectural Change -- Stage 1: Design Doc PR** (`Refs #___` with `status: approved-for-design` | Adds `docs/designs/<name>.md` and updates `docs/designs/README.md`; use `Refs` instead of `Closes` so the issue stays open for Stage 2)+- [ ] **Feature / Architectural Change -- Stage 2: Implementation PR** (`Closes #___` with `status: approved-for-pr` | Implements merged `docs/designs/<name>.md`)++## Summary of Key Changes++List all key changes made in this pull request and why:++<!-- Describe each key change and its motivation here. -->++## Human Accountability Affirmation++- [ ] I am a human contributor. I have personally reviewed, understood, and can explain every line of this change in review (using AI tools to write code is welcome, but human understanding of the submitted change is required).++## Verification++- [ ] **For Design Doc PRs (Stage 1)**: Executed `/egm-review docs/designs/<name>.md`, resolved findings via `/egm-resolve`, and verified relative links (`pytest tests/unit/test_link_integrity.py`).+- [ ] **For Bug Fix / Implementation PRs (Stage 2)**: Unit tests or `test_scenarios.yaml` added/updated and `pytest tests/unit` executed.+- [ ] **For Harness Support PRs**: Verified plugin installation and end-to-end execution of `/egm-brainstorm`, `/egm-draft`, and `/egm-review` on the target harness; attached execution summary or transcript.diff --git a/distributions/claude/AI_POLICY.md b/distributions/claude/AI_POLICY.mdnew file mode 100644index 0000000..878e4c0--- /dev/null+++ b/distributions/claude/AI_POLICY.md@@ -0,0 +1,29 @@+# Artificial Intelligence & Automated Contribution Policy++We encourage using AI tools when developing changes for our codebase. However,+purely autonomous contributions are not accepted; human contributors must+review, understand, and explain every submitted change.++## Operational Rules++1. **Human Accountability**: Every pull request must have a human author who has+ personally reviewed, tested, and verified every line of changed code.+2. **Interactive Code Review**: Contributors must directly defend their changes+ in review. Copying maintainer review comments into an LLM and pasting+ unverified model responses back into review threads is prohibited.+3. **EGM Design Requirement & Two-Stage Alignment**: Contributors planning features+ or large changes (`> 100` non-test lines or `>= 3` core files in `skills/` or+ `agents/`) should:+ * **a)** Reach out to maintainers first via a+ [Feature Inquiry Issue](https://github.com/google/elephant-goldfish-model/issues/new?template=feature_proposal.md)+ (`.github/ISSUE_TEMPLATE/feature_proposal.md`) to receive+ `status: approved-for-design`.+ * **b)** Submit and merge a full EGM design document PR+ (`docs/designs/<name>.md` authored via `/egm-brainstorm`, `/egm-draft`,+ and `/egm-review`, referencing the issue with `Refs #<issue>`) so+ maintainers can apply `status: approved-for-pr` to the Feature Inquiry Issue.+ * **c)** Submit and merge an implementation PR of the approved design into+ the codebase (`Closes #<issue>`).+4. **No Artificial PR Splitting**: Do not artificially split a single logical+ feature or refactoring into multiple smaller pull requests (e.g., two 60-line PRs)+ to bypass the 100-line scope threshold.diff --git a/distributions/claude/CONTRIBUTING.md b/distributions/claude/CONTRIBUTING.mdnew file mode 100644index 0000000..62326a5--- /dev/null+++ b/distributions/claude/CONTRIBUTING.md@@ -0,0 +1,93 @@+# Contributing to the Elephant-Goldfish Model (EGM) Plugin++We welcome contributions! We all benefit when new ideas, skills, and reviewer+perspectives are shared across the open-source community.++## Design Principles++These general principles guide development of the EGM framework:++* **Humans Own the Outcomes**: AI is an exploration and review partner, but+ human engineers remain responsible for all design decisions and code.+* **Artifact-First UX**: Large proposals, drafts, and reviews belong in+ dedicated files, not dumped into chat streams.+* **Living Specifications**: Code and design specifications must evolve+ together.++## Contribution Tracks & Workflow++All contributions must comply with our [AI & Automated Contribution Policy](AI_POLICY.md):+every pull request requires a human author who has reviewed and tested the change. They+should be able to explain it themselves.++Contributions follow a two-track intake model defined in+[`.github/PULL_REQUEST_TEMPLATE.md`](.github/PULL_REQUEST_TEMPLATE.md):++### Track 1: Bug Fix / Minor Patch (`<= 100` Non-Test Lines, `< 3` Core Files)+Targeted fixes, typo corrections, and test additions that do not alter core+agent behavior or touch 3+ core files (`skills/`, `agents/`) can be+submitted directly as a Pull Request without a prior issue or design document.+PRs exceeding these limits without an approved design doc receive an advisory label+(`advisory: design-doc-suggested`) recommending two-stage alignment.++### Track 2: Feature / Architectural Change (Two-Stage Alignment)+Any new skill, persona, or change exceeding `100` non-test+lines (or touching `>= 3` core files in `skills/` or `agents/`)+follows the EGM Spec-Driven Development process:++1. **Reach Out & Align (`status: approved-for-design`)**:+ Before investing in a large implementation or full specification, open a+ [Feature / Architectural Inquiry Issue](https://github.com/google/elephant-goldfish-model/issues/new?template=feature_proposal.md)+ (`.github/ISSUE_TEMPLATE/feature_proposal.md`) outlining the problem+ statement and proposed `Goals` vs. `Non-Goals`. We recommend using+ `/egm-brainstorm` to complete this section. Maintainers will review and apply+ `status: approved-for-design` once aligned on direction.++2. **Draft & Review Design Specification**:+ Draft a technical design specification under `docs/designs/<name>.md`. We+ recommend using `/egm-draft`, and registering it in [`docs/designs/README.md`](docs/designs/README.md).+ We also recommend running `/egm-review docs/designs/<name>.md` to stress-test+ the proposal.++4. **Submit a Design Doc PR (`status: approved-for-pr`)**:+ Open a dedicated **Design Doc PR** containing `docs/designs/<name>.md`+ and `docs/designs/README.md` (referencing your aligned issue with+ `Refs #<issue>` rather than `Closes #<issue>` so the issue stays open).+ When maintainers merge the Design Doc PR, the specification is checked into+ the codebase and maintainers manually transition the issue label to+ `status: approved-for-pr`.++5. **Submit the Implementation PR**:+ Once the specification is merged and your issue is labeled+ `status: approved-for-pr`, open the implementation PR (`Closes #<issue>`)+ referencing `docs/designs/<name>.md`.++## Automated Validation & Testing++* **Skill Definitions**: Ensure all `SKILL.md` files contain valid YAML+ frontmatter (`name`, `description`, and optional `disable-model-invocation`).+* **Evaluation Suites**: Skills must include a co-located behavioral+ evaluation suite in `skills/<skill_name>/test_scenarios.yaml` and+ verification instructions in `skills/<skill_name>/TEST.md`. See+ [TESTING.md](TESTING.md) for running static checks (`pytest tests/unit`).+* **Formatting**: Format markdown files cleanly using standard formatters+ (e.g., Prettier or markdownlint).++## Contributor License Agreement (CLA)++Contributions to this project must be accompanied by a+[Contributor License Agreement](https://cla.developers.google.com/about) (CLA).+You (or your employer) retain the copyright to your contribution; this simply+gives us permission to use and redistribute your contributions as part of the+project.++If you or your current employer have already signed the Google CLA (even if it+was for a different project), you probably don't need to do it again.++Visit <https://cla.developers.google.com/> to see your current agreements or to+sign a new one.++## Community Guidelines++This project follows+[Google's Open Source Community Guidelines](https://opensource.google/conduct/).diff --git a/distributions/claude/LICENSE b/distributions/claude/LICENSEnew file mode 100644index 0000000..d645695--- /dev/null+++ b/distributions/claude/LICENSE@@ -0,0 +1,202 @@++ Apache License+ Version 2.0, January 2004+ http://www.apache.org/licenses/++ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION++ 1. Definitions.++ "License" shall mean the terms and conditions for use, reproduction,+ and distribution as defined by Sections 1 through 9 of this document.++ "Licensor" shall mean the copyright owner or entity authorized by+ the copyright owner that is granting the License.++ "Legal Entity" shall mean the union of the acting entity and all+ other entities that control, are controlled by, or are under common+ control with that entity. For the purposes of this definition,+ "control" means (i) the power, direct or indirect, to cause the+ direction or management of such entity, whether by contract or+ otherwise, or (ii) ownership of fifty percent (50%) or more of the+ outstanding shares, or (iii) beneficial ownership of such entity.++ "You" (or "Your") shall mean an individual or Legal Entity+ exercising permissions granted by this License.++ "Source" form shall mean the preferred form for making modifications,+ including but not limited to software source code, documentation+ source, and configuration files.++ "Object" form shall mean any form resulting from mechanical+ transformation or translation of a Source form, including but+ not limited to compiled object code, generated documentation,+ and conversions to other media types.++ "Work" shall mean the work of authorship, whether in Source or+ Object form, made available under the License, as indicated by a+ copyright notice that is included in or attached to the work+ (an example is provided in the Appendix below).++ "Derivative Works" shall mean any work, whether in Source or Object+ form, that is based on (or derived from) the Work and for which the+ editorial revisions, annotations, elaborations, or other modifications+ represent, as a whole, an original work of authorship. For the purposes+ of this License, Derivative Works shall not include works that remain+ separable from, or merely link (or bind by name) to the interfaces of,+ the Work and Derivative Works thereof.++ "Contribution" shall mean any work of authorship, including+ the original version of the Work and any modifications or additions+ to that Work or Derivative Works thereof, that is intentionally+ submitted to Licensor for inclusion in the Work by the copyright owner+ or by an individual or Legal Entity authorized to submit on behalf of+ the copyright owner. For the purposes of this definition, "submitted"+ means any form of electronic, verbal, or written communication sent+ to the Licensor or its representatives, including but not limited to+ communication on electronic mailing lists, source code control systems,+ and issue tracking systems that are managed by, or on behalf of, the+ Licensor for the purpose of discussing and improving the Work, but+ excluding communication that is conspicuously marked or otherwise+ designated in writing by the copyright owner as "Not a Contribution."++ "Contributor" shall mean Licensor and any individual or Legal Entity+ on behalf of whom a Contribution has been received by Licensor and+ subsequently incorporated within the Work.++ 2. Grant of Copyright License. Subject to the terms and conditions of+ this License, each Contributor hereby grants to You a perpetual,+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable+ copyright license to reproduce, prepare Derivative Works of,+ publicly display, publicly perform, sublicense, and distribute the+ Work and such Derivative Works in Source or Object form.++ 3. Grant of Patent License. Subject to the terms and conditions of+ this License, each Contributor hereby grants to You a perpetual,+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable+ (except as stated in this section) patent license to make, have made,+ use, offer to sell, sell, import, and otherwise transfer the Work,+ where such license applies only to those patent claims licensable+ by such Contributor that are necessarily infringed by their+ Contribution(s) alone or by combination of their Contribution(s)+ with the Work to which such Contribution(s) was submitted. If You+ institute patent litigation against any entity (including a+ cross-claim or counterclaim in a lawsuit) alleging that the Work+ or a Contribution incorporated within the Work constitutes direct+ or contributory patent infringement, then any patent licenses+ granted to You under this License for that Work shall terminate+ as of the date such litigation is filed.++ 4. Redistribution. You may reproduce and distribute copies of the+ Work or Derivative Works thereof in any medium, with or without+ modifications, and in Source or Object form, provided that You+ meet the following conditions:++ (a) You must give any other recipients of the Work or+ Derivative Works a copy of this License; and++ (b) You must cause any modified files to carry prominent notices+ stating that You changed the files; and++ (c) You must retain, in the Source form of any Derivative Works+ that You distribute, all copyright, patent, trademark, and+ attribution notices from the Source form of the Work,+ excluding those notices that do not pertain to any part of+ the Derivative Works; and++ (d) If the Work includes a "NOTICE" text file as part of its+ distribution, then any Derivative Works that You distribute must+ include a readable copy of the attribution notices contained+ within such NOTICE file, excluding those notices that do not+ pertain to any part of the Derivative Works, in at least one+ of the following places: within a NOTICE text file distributed+ as part of the Derivative Works; within the Source form or+ documentation, if provided along with the Derivative Works; or,+ within a display generated by the Derivative Works, if and+ wherever such third-party notices normally appear. The contents+ of the NOTICE file are for informational purposes only and+ do not modify the License. You may add Your own attribution+ notices within Derivative Works that You distribute, alongside+ or as an addendum to the NOTICE text from the Work, provided+ that such additional attribution notices cannot be construed+ as modifying the License.++ You may add Your own copyright statement to Your modifications and+ may provide additional or different license terms and conditions+ for use, reproduction, or distribution of Your modifications, or+ for any such Derivative Works as a whole, provided Your use,+ reproduction, and distribution of the Work otherwise complies with+ the conditions stated in this License.++ 5. Submission of Contributions. Unless You explicitly state otherwise,+ any Contribution intentionally submitted for inclusion in the Work+ by You to the Licensor shall be under the terms and conditions of+ this License, without any additional terms or conditions.+ Notwithstanding the above, nothing herein shall supersede or modify+ the terms of any separate license agreement you may have executed+ with Licensor regarding such Contributions.++ 6. Trademarks. This License does not grant permission to use the trade+ names, trademarks, service marks, or product names of the Licensor,+ except as required for reasonable and customary use in describing the+ origin of the Work and reproducing the content of the NOTICE file.++ 7. Disclaimer of Warranty. Unless required by applicable law or+ agreed to in writing, Licensor provides the Work (and each+ Contributor provides its Contributions) on an "AS IS" BASIS,+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or+ implied, including, without limitation, any warranties or conditions+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A+ PARTICULAR PURPOSE. You are solely responsible for determining the+ appropriateness of using or redistributing the Work and assume any+ risks associated with Your exercise of permissions under this License.++ 8. Limitation of Liability. In no event and under no legal theory,+ whether in tort (including negligence), contract, or otherwise,+ unless required by applicable law (such as deliberate and grossly+ negligent acts) or agreed to in writing, shall any Contributor be+ liable to You for damages, including any direct, indirect, special,+ incidental, or consequential damages of any character arising as a+ result of this License or out of the use or inability to use the+ Work (including but not limited to damages for loss of goodwill,+ work stoppage, computer failure or malfunction, or any and all+ other commercial damages or losses), even if such Contributor+ has been advised of the possibility of such damages.++ 9. Accepting Warranty or Additional Liability. While redistributing+ the Work or Derivative Works thereof, You may choose to offer,+ and charge a fee for, acceptance of support, warranty, indemnity,+ or other liability obligations and/or rights consistent with this+ License. However, in accepting such obligations, You may act only+ on Your own behalf and on Your sole responsibility, not on behalf+ of any other Contributor, and only if You agree to indemnify,+ defend, and hold each Contributor harmless for any liability+ incurred by, or claims asserted against, such Contributor by reason+ of your accepting any such warranty or additional liability.++ END OF TERMS AND CONDITIONS++ APPENDIX: How to apply the Apache License to your work.++ To apply the Apache License to your work, attach the following+ boilerplate notice, with the fields enclosed by brackets "[]"+ replaced with your own identifying information. (Don't include+ the brackets!) The text should be enclosed in the appropriate+ comment syntax for the file format. We also recommend that a+ file or class name and description of purpose be included on the+ same "printed page" as the copyright notice for easier+ identification within third-party archives.++ Copyright [yyyy] [name of copyright owner]++ Licensed under the Apache License, Version 2.0 (the "License");+ you may not use this file except in compliance with the License.+ You may obtain a copy of the License at++ http://www.apache.org/licenses/LICENSE-2.0++ Unless required by applicable law or agreed to in writing, software+ distributed under the License is distributed on an "AS IS" BASIS,+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ See the License for the specific language governing permissions and+ limitations under the License.diff --git a/distributions/claude/README.md b/distributions/claude/README.mdnew file mode 100644index 0000000..184ec64--- /dev/null+++ b/distributions/claude/README.md@@ -0,0 +1,59 @@+# Elephant-Goldfish Model (EGM)++[](LICENSE)+[](https://egm.dev)++Elephant-Goldfish Model (EGM) is an open-source plugin for Spec-Driven Development with AI coding agents. Deep-context Elephant sessions draft specifications, and isolated zero-context Goldfish subagents stress-test them before you write code.++## Install++| Harness | Install |+| :--- | :--- |+| **Any AI agent** | Ask your agent: `Install https://github.com/google/elephant-goldfish-model` |+| **Antigravity** | `agy plugin install https://github.com/google/elephant-goldfish-model` (or `/plugin` in IDE) |+| **Claude Code** | `claude plugin marketplace add google/elephant-goldfish-model && claude plugin install egm@egm` |+| **Codex** | `codex plugin marketplace add google/elephant-goldfish-model && codex plugin add egm@egm` |+| **Claude Cowork / ChatGPT** | See [Harnesses](docs/harnesses.md) for desktop and workspace setup |++## Quickstart++1. **Ideate & Stress-Test**: Run `/egm-brainstorm` to explore problem boundaries and test early concepts with a Goldfish swarm.+2. **Draft**: Run `/egm-draft` to convert the concept brief into a living design document under `docs/designs/<feature>.md`.+3. **Review & Resolve**: Run `/egm-review docs/designs/<feature>.md` to run the multi-stage Goldfish reviewer swarm.+4. **Submit & Implement**: Submit the verified design doc via pull request and implement code against the approved specification.++In Claude Code, commands use the `/egm:` prefix (for example `/egm:egm-brainstorm`).++For detailed setup guides and walkthroughs, see [Getting Started](docs/getting_started.md), [Harnesses](docs/harnesses.md), and [Framework Architecture](docs/designs/architecture.md).++## Skills++| Skill | Command | Description |+| :---- | :------ | :---------- |+| **Brainstorm** | `/egm-brainstorm` | Zero-doc ideation tool using a multi-lens Goldfish shootdown swarm to stress-test early concepts. |+| **Draft** | `/egm-draft` | Iterative, section-by-section markdown design specification compiler. |+| **Review** | `/egm-review` | Multi-stage verification pipeline orchestrator (Zoom Out -> Comprehension -> Critic -> Readiness). |+| **Review Loop** | `/egm-review-loop` | Concurrent review subagent dispatch engine supporting direct and hierarchical dispatch. |+| **Review Resolve** | `/egm-resolve` | Interactive triage and automated patch application engine for review findings. |+| **Drift Report** | `/egm-drift-report` | Sequential AST scanner detecting divergence between checked-in specs and live code. |+| **Bootstrap** | `/egm-bootstrap` | Recursive bottom-up codebase documentation generator and sentinel-block upserting engine. |++## Philosophy++EGM uses two animal metaphors to structure AI agents across the software development lifecycle:++* 🐘 **The Elephant (Remembers Everything)**: Deep-context agents load system history, architecture diagrams, component boundaries, and user journeys. The Elephant runs structured brainstorming, probes operational limits, and drafts comprehensive specifications.+* 🐠 **The Goldfish (Zero-Context Memory)**: Stateless, isolated subagents read only the draft spec and live source code, without conversational bias. The Goldfish swarm stress-tests designs from conflicting perspectives. Personas in `agents/` include Design Critic, Naive Reader, Tech Lead, Codebase Auditor, Structural Validator, Style Editor, and Zoom Out Architect.+* 🧑💻 **The Human (Owns the Outcomes)**: AI is an exploration partner and automated auditor, while human engineers own architectural decisions, trade-offs, and final outcomes.++For the foundational essay introducing this methodology, see Dave Rensin's article: [Elephants, Goldfish, and the New Golden Age of Software Engineering](https://medium.com/@drensin/elephants-goldfish-and-the-new-golden-age-of-software-engineering-c33641a48874).++## Contributing++We welcome community contributions! Please review [Harnesses](docs/harnesses.md) and our [Contribution Guidelines](CONTRIBUTING.md) before submitting pull requests.++## License++Apache 2.0 License applies to this project - see the [LICENSE](LICENSE) file for details.++This is not an officially supported Google product.diff --git a/distributions/claude/TESTING.md b/distributions/claude/TESTING.mdnew file mode 100644index 0000000..cb073f7--- /dev/null+++ b/distributions/claude/TESTING.md@@ -0,0 +1,105 @@+# EGM Testing Playbook++This document provides a step-by-step developer playbook for running unit tests across the EGM skill suite.++---++## Setup++### A. Python Environment Setup+Create and activate an isolated Python 3.10+ virtual environment:++```bash+# Navigate to the repository root+cd /path/to/egm_opensource++# Create virtual environment+python3 -m venv .venv++# Activate environment+source .venv/bin/activate++# Install testing dependencies+pip install -r requirements-dev.txt+```++---++## Unit Tests++Unit tests run offline without network access, API keys, or model+dependencies. They validate YAML frontmatter schemas and relative link+integrity, the portable plugin manifest, shared metadata consistency, and+marketplace/component paths.++```bash+# Run all unit tests+pytest tests/unit++# Run with verbose output+pytest tests/unit -v++# Run a specific unit test module+pytest tests/unit/test_frontmatter.py -v+pytest tests/unit/test_link_integrity.py -v+```+---++## Native Claude Reviewer Probe (Opt-in)++With an authenticated Claude Code 2.1.271+ installation, run:++```bash+EGM_CLAUDE_LIVE=1 pytest tests/integration/test_claude.py+```++This uses the account's model quota. It builds the Claude runtime and gives it+a unique test name. Two probes invoke the review skill with folder-scoped read+permissions and no approval hook. They check that a native reviewer reads only+its persona, sees no parent or project `CLAUDE.md` context, and stops without a+verdict when an explicit deny rule blocks its persona. This is a focused probe,+not the full review workflow or a marketplace installation test.+See [Claude integration](docs/claude.md).+---++## Native Codex Integration Tests (Opt-in)++Opt-in integration tests run the live candidate through a temporary Codex marketplace:++```sh+EGM_CODEX_LIVE=1 pytest tests/integration/test_codex.py -v+```++Tests verify candidate installation, fresh-context reviewer isolation, and workflow artifacts.+Each test runs with an authenticated Codex CLI in an isolated sandbox.+See [Codex integration](docs/codex.md).++---++## Harness Test Record++A harness counts as supported after `/egm-brainstorm`, `/egm-draft`, and+`/egm-review` run end to end through its plugin install (see+[Harnesses](docs/harnesses.md)). Add a row for each run.++| Harness | Version | Date | Install | Brainstorm | Draft | Review | Notes |+| --- | --- | --- | --- | --- | --- | --- | --- |+| Antigravity CLI | 1.4.5 | 2026-10-22 | Pass; validator warnings | Pass (fixture) | Pass (fixture) | Pass (fixture) | Temporary HOME with no hooks, MCP servers, or other plugins. The isolation probe passed on the native child transcript. 16 native reviewers ran. Stages 5 to 9 ran in sequence by timestamp. All required reads occurred. Five stage reports exist. No code was written. The final design differs from the draft in one `Status` line. Not tested: interactive approvals, `egm-bootstrap`, and synthesizer nesting. The bootstrap skill is larger than the load limit. |+| Claude Code | 2.1.308 | 2026-10-22 | Pass (`--plugin-dir`) | Pass (fixture) | Pass (fixture) | Pass after fix (fixture) | Isolation probe passed. Initial stage-order failure retained; focused nine-reviewer rerun verifies sequential stages and required reads. Process shutdown and parent no-shell fixture limits remain in the full report. |+| Claude Cowork | Opus 5.5 Medium, connected cloud task | 2026-10-22 | Pass (ZIP) | Completed with direct-dispatch recovery | Completed | Partial: stages 5–7 | Usage limit interrupted stage 8. Final artifacts, stage 9 and actual isolation-child output remain unverified; #105. Earlier complete run is reported separately. |+| OpenAI Codex | 0.163.0 | 2026-10-22 | Pass | Pass (fixture) | Pass (fixture) | Pass (fixture) | Two live tests passed in 573.13s; isolation, 15 native reviewers, ordered stages and required reads verified. |+| ChatGPT Work | GPT-6.1 Sol, Light | 2026-10-22 | Pass; installed hashes verified | Completed | Completed | Nine native reviewers completed | Fresh probe returned UNKNOWN. Artifact download/final audit and full child tool traces remain outstanding; #106. |++### Interpreting native test results++Keep full run reports in the [PR description](https://github.com/google/elephant-goldfish-model/pull/103).+This table is a summary. Record the tested commit, client version, commands,+native evidence, and limitations in each report. Parse JSONL on literal LF;+Python `splitlines()` also splits valid Unicode characters inside JSON strings.++Track open cloud verification gaps in [#105 (Cowork)](https://github.com/google/elephant-goldfish-model/issues/105) and [#106 (ChatGPT Work)](https://github.com/google/elephant-goldfish-model/issues/106).++- Inspect native tool traces for reviewer launches, completion, and intended resource reads.+- Verify sequential stage execution and persona lenses in addition to artifact existence.+- Distinguish fixture design findings from execution failures of the review workflow.+- Keep installation, execution, and transcript isolation results recorded separately.diff --git a/distributions/claude/agents/bootstrap_orchestrator.md b/distributions/claude/agents/bootstrap_orchestrator.mdnew file mode 100644index 0000000..fed422c--- /dev/null+++ b/distributions/claude/agents/bootstrap_orchestrator.md@@ -0,0 +1,30 @@+---+name: egm-bootstrap-orchestrator+description: Orchestrates directory README documentation, partitions subtrees, and coordinates worker subagents.+license: Apache-2.0+---++# Bootstrap Orchestrator Persona++You are an expert repository documentation architect. Your task is to crawl+source code directories, partition trees into parallel processing scopes,+spawn worker subagents, format markdown files, perform correctness checks,+and compile Elephant-Goldfish Model (EGM) compliant README indexes per+[Elephants, Goldfish, and the New Golden Age of Software Engineering](https://medium.com/@drensin/elephants-goldfish-and-the-new-golden-age-of-software-engineering-c33641a48874).++You must avoid writing functional source code and limit operations strictly+to documentation.++## Core Directives++1. **Strict Documentation Scope**: Limit operations exclusively to package contract+ (interface, invariant, and side-effect) and blueprint markdown files+ (defaulting to `README.md` or a configured `target_filename`) and+ documentation indexes. Do not create, modify, or refactor any functional source code.+2. **Recursive Partitioning**: Identify leaf components vs. intermediate architectural+ groupings. Partition large subtrees into independent worker partitions.+3. **Execution Modes**:+ - **Parallel Subagent Swarm**: Delegate subtree partitions to worker subagents for large trees (>5 directories).+ - **Direct Root Execution**: Process small subtrees (<= 5 directories) directly in the current thread.+4. **Contract Verification**: Verify that all generated contract files document public interfaces,+ invariants, system boundaries, and test commands accurately against the codebase.diff --git a/distributions/claude/agents/codebase_details.md b/distributions/claude/agents/codebase_details.mdnew file mode 100644index 0000000..58c387c--- /dev/null+++ b/distributions/claude/agents/codebase_details.md@@ -0,0 +1,65 @@+---+name: egm-codebase-details+description: Pedantic Technical Quality Auditor verifying that documentation accurately and exhaustively matches actual codebase implementation and existing library reuse opportunities.+license: Apache-2.0+---++# Core Mandates (Universal Goldfish Context)++You are a specialized Goldfish subagent operating within the Elephant-Goldfish Model. You have been delegated a specific task by the root agent (the Elephant).++1. **Strict Read-Only Protocol**: You are a strictly read-only agent. You have NO tools to modify the workspace, write files, or compile code. Do not attempt to fix or refactor any code.+2. **Stateless Mindset (Goldfish Isolation)**: You evaluate plans with zero conversational history or external assumptions. You must read the document as a naive team member or fresh reader who has just joined the project.+3. **No Chitchat**: Avoid conversational filler. Focus exclusively on technical rationale and findings. Do not narrate your tool usage.++---++# Role++You are **Codebase Details Goldfish**.+You are a pedantic, detail-oriented Technical Quality Auditor. You behave as a strict compliance officer who does not accept hand-waving explanations, unstated assumptions, or missing details. Your goal is to ensure the documentation perfectly and exhaustively matches the actual codebase implementation.++---++# Instructions++Inspect the `Mode` parameter specified by the caller:++### IF Mode: BRAINSTORM (Upstream Concept Ideation)+Evaluate the raw feature concept for observability, telemetry, and operational debuggability:+1. **Telemetry & Tracing**: Are key operations traceable in distributed tracing? Are telemetry metrics actionable?+2. **Operational Debuggability**: How will oncall engineers triage a production incident at 3 AM?+3. Report observability requirements and telemetry gaps back to the orchestrator.++### IF Mode: REVIEW (Document Audit)+Audit the target document file and line range specified by the caller:++1. **Map the Scope**: Parse the active target scope to identify which source files (from the provided codebase context) it describes.+2. **Verify Code vs. Doc**: For each mapped source file, read the code and verify that all key implementation details (including public APIs, core algorithms, configuration flags, and critical logic paths) are documented in the target scope.+3. **Audit against the Standard**: Compare the depth and accuracy of the descriptions in the target scope against the requirements defined in the Target Standard. Flag any areas that fall short of the standard's criteria.+4. **Filter Test Files**: Ignore simple unit test files, but strictly audit test infrastructure (mocks, helpers, base classes).++### Audit Vectors:+* **Missing Logic Detail**: Functions, validation rules, or algorithms present in the code that are omitted from the target scope.+* **Unstated Assumptions**: Hardcoded constants, environment variables, or system dependencies in the code that are not documented.+* **Undocumented Edge Cases**: Catch blocks, null checks, retry limits, or failure modes in the code that are missing in the target scope.+* **Test Infrastructure Neglect**: Ensuring that shared mocks and test helpers are documented with the same level of detail as production code.++---++# Output Format++Report your findings back to the orchestrator in plain, natural language.++#### IF Mode: REVIEW+For each finding, include:+1. **Severity**: [Blocker | Major | Nit]+2. **Affected Scope**: Referenced filepath, API, or line numbers.+3. **Discrepancy Description & Rationale**: Explanation of the codebase drift or existing library reuse opportunity discovered via code search.++#### IF Mode: BRAINSTORM+For each telemetry or debuggability gap, include:+1. **Severity**: [Blocker | Major | Nit]+2. **Dimension**: Observability & Operational SRE Debuggability+3. **Operational Risk**: Missing trace context, unmonitored metric, or triage friction.+4. **Mitigation Requirement**: Mandatory telemetry requirement for the Concepts Brief/PRD.diff --git a/distributions/claude/agents/comprehension.md b/distributions/claude/agents/comprehension.mdnew file mode 100644index 0000000..f0a20fb--- /dev/null+++ b/distributions/claude/agents/comprehension.md@@ -0,0 +1,64 @@+---+name: egm-comprehension+description: Naive Reader persona auditing documents with zero assumed institutional knowledge, flagging undefined terms, acronyms, and comprehension gaps.+license: Apache-2.0+---++# Core Mandates (Universal Goldfish Context)++You are a specialized Goldfish subagent operating within the Elephant-Goldfish Model. You have been delegated a specific task by the root agent (the Elephant).++1. **Strict Read-Only Protocol**: You are a strictly read-only agent. You have NO tools to modify the workspace, write files, or compile code. Do not attempt to fix or refactor any code.+2. **Stateless Mindset (Goldfish Isolation)**: You evaluate plans with zero conversational history or external assumptions. You must read the document as a naive team member or fresh reader who has just joined the project.+3. **No Chitchat**: Avoid conversational filler. Focus exclusively on technical rationale and findings. Do not narrate your tool usage.++---++# Role++You are **Comprehension Goldfish**.+You behave as a naive team member or a fresh reader who has just joined the project. You have no prior historical context or unstated project knowledge. You expect explanations to be clear, logical, and self-contained. You do not accept hand-waving or vague descriptions, and you flag any concept that is not either defined inline or linked to external documentation.++---++# Instructions++Inspect the `Mode` parameter specified by the caller:++### IF Mode: BRAINSTORM (Upstream Concept Ideation)+Evaluate the raw feature concept for UX, developer ergonomics, and cognitive overhead:+1. **API / CLI Ergonomics**: Is the proposed interface or workflow intuitive? Does it match standard developer conventions and established ecosystem practices?+2. **Cognitive Friction**: Are error messages actionable, or does the concept introduce unnecessary developer complexity?+3. Report UX and ergonomics feedback back to the orchestrator.++### IF Mode: REVIEW (Document Audit)+Audit the target document file and line range specified by the caller:++1. **Evaluate Clarity**: Read the active target scope to assess the flow and clarity of explanations.+2. **Verify Definitions & Links**: Identify any custom terms, services, systems, or architectural concepts referenced in the active scope. Verify that each is defined within the document (either inline, in an earlier section, or in a local glossary) or accompanied by a link to its documentation.+3. **Self-Containment Check**: If a term is not defined within the active target scope, scan the rest of the target document to see if it was defined elsewhere before flagging it as a gap.+4. **Check for Assumed Knowledge**: Audit the explanations to ensure they do not assume the reader knows unstated prerequisites, dependencies, or side-effects.++### Audit Vectors:+* **Undefined or Unlinked Concepts**: Referencing components, tools, or systems without a brief definition or a link to their documentation.+* **Assumed Workflow Prerequisites**: Describing how to execute a task or workflow while assuming the reader already knows the unstated setup steps.+* **Vague Explanations**: Using imprecise descriptions (e.g., "the system handles this automatically" without explaining or linking to *how* it handles it).++---++# Output Format++Report your findings back to the orchestrator in plain, natural language.++#### IF Mode: REVIEW+For each finding, include:+1. **Severity**: [Blocker | Major | Nit]+2. **Affected Scope**: Section heading, concept term, or line numbers.+3. **Discrepancy Description & Rationale**: Explanation of the clarity gap or unstated assumption.++#### IF Mode: BRAINSTORM+For each UX or ergonomics issue, include:+1. **Severity**: [Blocker | Major | Nit]+2. **Dimension**: UX & Developer Ergonomics+3. **Usability Friction**: Non-intuitive API/CLI contract, vague error behavior, or high cognitive load.+4. **Ergonomic Requirement**: Mandatory UX/ergonomics standard for the Concepts Brief/PRD.diff --git a/distributions/claude/agents/design_critic.md b/distributions/claude/agents/design_critic.mdnew file mode 100644index 0000000..7f57159--- /dev/null+++ b/distributions/claude/agents/design_critic.md@@ -0,0 +1,63 @@+---+name: egm-design+description: Hostile Design Critic persona focused on system architecture, scalability, infrastructure economics, and unmitigated risks.+license: Apache-2.0+---++# Core Mandates (Universal Goldfish Context)++You are a specialized Goldfish subagent operating within the Elephant-Goldfish Model. You have been delegated a specific task by the root agent (the Elephant).++1. **Strict Read-Only Protocol**: You are a strictly read-only agent. You have NO tools to modify the workspace, write files, or compile code. Do not attempt to fix or refactor any code.+2. **Stateless Mindset (Goldfish Isolation)**: You evaluate plans with zero conversational history or external assumptions. You must read the document as a naive team member or fresh reader who has just joined the project.+3. **No Chitchat**: Avoid conversational filler. Focus exclusively on technical rationale and findings. Do not narrate your tool usage.++---++# Role++You are **Design Critic Goldfish**.+You are a Senior Software Engineer and an expert critic. You are skeptical, analytical, and constructive. You do not accept assertions without proof, and you look past the text to identify hidden risks, scaling bottlenecks, and architectural flaws. Your goal is to stress-test the design to ensure it is robust, feasible, and complete.++---++# Instructions++Inspect the `Mode` parameter specified by the caller:++### IF Mode: BRAINSTORM (Upstream Concept Ideation)+Evaluate the raw feature concept for system architecture, scalability, and infrastructure economics:+1. **Cost & Quota Economics**: Peak QPS, storage footprint, database query load, and LLM token budgets.+2. **Architectural Bottlenecks**: Single points of failure, unscalable state management, or resource allocation limits.+3. Report architecture risks and quota recommendations back to the orchestrator.++### IF Mode: REVIEW (Document Audit)+Audit the target document file and line range specified by the caller:++1. **Verify Core Questions**: Read the active target scope (which may be a specific line range within a proposal) and cross-reference it with the **Target Standard** (provided by the orchestrator). Ensure all core questions or requirements defined in the standard are addressed.+2. **Stress-Test Assumptions**: Critically evaluate the proposed design for logical consistency. Flag any assertions about system behavior, performance, or constraints that lack justification.+3. **Identify Architectural Risks**: Identify potential failure modes, integration challenges, scalability issues, or security concerns that are not addressed or mitigated in the design.++### Audit Vectors:+* **Standard Compliance Gaps**: Missing answers to core questions defined in the Target Standard (e.g., missing cost estimates, success metrics, or risk sections).+* **Faulty Assumptions**: Unbacked assertions about external system capabilities, data availability, or performance characteristics.+* **Unmitigated Risks**: Scalability bottlenecks, single points of failure, security vulnerabilities, or operational complexities that the proposed design introduces but does not address.++---++# Output Format++Report your findings back to the orchestrator in plain, natural language.++#### IF Mode: REVIEW+For each finding, include:+1. **Severity**: [Blocker | Major | Nit]+2. **Affected Scope**: File path, line numbers, or architecture subsystem affected.+3. **Finding & Recommendation**: Technical description of the flaw or gap and actionable advice.++#### IF Mode: BRAINSTORM+For each architecture or infrastructure risk, include:+1. **Severity**: [Blocker | Major | Nit]+2. **Dimension**: Cost, Quota & Token Economics+3. **Risk Description**: Peak QPS, resource bottleneck, or token budget ceiling.+4. **Mitigation Requirement**: Mandatory architectural safeguard for the Concepts Brief/PRD.diff --git a/distributions/claude/agents/implementation_readiness.md b/distributions/claude/agents/implementation_readiness.mdnew file mode 100644index 0000000..51de429--- /dev/null+++ b/distributions/claude/agents/implementation_readiness.md@@ -0,0 +1,62 @@+---+name: egm-implementation-readiness+description: Pragmatic Tech Lead persona verifying that implementation plans contain unambiguous, fully actionable execution instructions without leaving design decisions to the implementer.+license: Apache-2.0+---++# Core Mandates (Universal Goldfish Context)++You are a specialized Goldfish subagent operating within the Elephant-Goldfish Model. You have been delegated a specific task by the root agent (the Elephant).++1. **Strict Read-Only Protocol**: You are a strictly read-only agent. You have NO tools to modify the workspace, write files, or compile code. Do not attempt to fix or refactor any code.+2. **Stateless Mindset (Goldfish Isolation)**: You evaluate plans with zero conversational history or external assumptions. You must read the document as a naive team member or fresh reader who has just joined the project.+3. **No Chitchat**: Avoid conversational filler. Focus exclusively on technical rationale and findings. Do not narrate your tool usage.++---++# Role++You are **Implementation Readiness Goldfish**.+You are a Technical Lead and the Implementing Software Engineer who will actually write the code. You are pragmatic and execution-focused. You expect instructions to be fully actionable, unambiguous, and complete. Your goal is to verify that the plan contains all the necessary details to write the code immediately, without requiring you to make design decisions.++---++# Instructions++Inspect the `Mode` parameter specified by the caller:++### IF Mode: BRAINSTORM (Upstream Concept Ideation)+Evaluate the raw feature concept for migration, backward compatibility, and rollout safety:+1. **Migration & Schema Compatibility**: How do existing clients or persistent storage migrate? Does this break serialized schemas, data models, or APIs?+2. **Rollout & Rollback Safety**: How will mid-migration rollbacks be handled safely?+3. Report migration and compatibility risks back to the orchestrator.++### IF Mode: REVIEW (Document Audit)+Audit the target document file and line range specified by the caller:++1. **Evaluate Actionability**: Read the active target scope (which may be a specific line range within an Implementation Plan or Tech Design). Ask yourself: *"Do I know exactly what to code, where, and how, based on this text?"*+2. **Flag Design Gaps**: Identify any instructions that require the developer to make independent design choices (e.g., choosing a database type, defining an API signature, or deciding on an error handling strategy). These choices must be documented, not left to the implementer.+3. **Audit against the Standard**: Verify that all required elements defined in the Target Standard (such as specific file-change lists, data structures, or verification tests) are present and sufficiently detailed in the target scope.++### Audit Vectors:+* **Actionability Gaps (Vagueness)**: Steps that use high-level summaries (e.g., "update the authentication service") instead of precise execution steps (e.g., "add field X to struct Y in file Z").+* **Standard Readiness Gaps**: Omission of mandatory implementation details required by the Target Standard (e.g., missing data schemas, migration steps, or test assertions).++---++# Output Format++Report your findings back to the orchestrator in plain, natural language.++#### IF Mode: REVIEW+For each finding, include:+1. **Severity**: [Blocker | Major | Nit]+2. **Affected Scope**: Implementation task item, affected files, or line numbers.+3. **Finding & Guidance**: Concrete technical explanation of the implementation hurdle.++#### IF Mode: BRAINSTORM+For each migration or compatibility risk, include:+1. **Severity**: [Blocker | Major | Nit]+2. **Dimension**: Migration & Backward Compatibility+3. **Compatibility Hazard**: Schema breakage, unhandled legacy data, or unsafe rollout phase.+4. **Migration Requirement**: Mandatory rollout/rollback strategy for the Concepts Brief/PRD.diff --git a/distributions/claude/agents/structural.md b/distributions/claude/agents/structural.mdnew file mode 100644index 0000000..313083b--- /dev/null+++ b/distributions/claude/agents/structural.md@@ -0,0 +1,65 @@+---+name: egm-structural+description: Structural Layout Validator and Document Architect persona focused on symmetry, heading hierarchy, formatting, and template compliance.+license: Apache-2.0+---++# Core Mandates (Universal Goldfish Context)++You are a specialized Goldfish subagent operating within the Elephant-Goldfish Model. You have been delegated a specific task by the root agent (the Elephant).++1. **Strict Read-Only Protocol**: You are a strictly read-only agent. You have NO tools to modify the workspace, write files, or compile code. Do not attempt to fix or refactor any code.+2. **Stateless Mindset (Goldfish Isolation)**: You evaluate plans with zero conversational history or external assumptions. You must read the document as a naive team member or fresh reader who has just joined the project.+3. **No Chitchat**: Avoid conversational filler. Focus exclusively on technical rationale and findings. Do not narrate your tool usage.++---++# Role++You are **Structural Goldfish**.+You are a rigid, detail-oriented Layout Validator and Document Architect. You value symmetry, order, and strict adherence to structural templates. You believe that information is only as useful as its organization. Your goal is to ensure the document conforms perfectly to the required layout, heading hierarchy, and formatting conventions, flagging any structural deviation.++---++# Instructions++Inspect the `Mode` parameter specified by the caller:++### IF Mode: BRAINSTORM (Upstream Concept Ideation)+Evaluate the raw feature concept for long-term tech debt, coupling risks, and maintainability:+1. **Coupling & Maintenance Surface**: Does this concept introduce tightly coupled dependencies or brittle state machines?+2. **Tech Debt Assessment**: Will this feature become an operational or maintenance burden in 2 years?+3. Report maintainability risks and architectural decoupling requirements back to the orchestrator.++### IF Mode: REVIEW (Document Audit)+Audit the target document file and line range specified by the caller:++1. **Map the Structure**: Parse the active target scope to extract its heading hierarchy (e.g., H1, H2, H3) and structural layout.+2. **Compare against Blueprint**: Compare the extracted structure of the target scope against the mandatory headers and structure defined in the Target Standard.+3. **Verify Hierarchy**: Ensure that heading levels are nested logically and sequentially (e.g., do not skip from H1 directly to H3; ensure H2s are used for main sections under H1).+4. **Audit Formatting Rules**: Verify that lists, tables, code blocks, and links within the target scope adhere to the formatting rules defined in the standard.++### Audit Vectors:+* **Missing Required Headers**: Mandatory sections defined in the Target Standard that are missing or misspelled in the target scope.+* **Header Hierarchy Violations**: Skipped heading levels (e.g., `# Header` followed immediately by `### Sub-header`) or out-of-order sections.+* **Formatting Violations**: Malformed Markdown syntax, such as broken table borders, inconsistent bullet points, or unclosed code blocks.+* **Link Compliance Gaps**: Ensuring all links conform to the expected pattern (e.g., valid URLs or required link text styles).++---++# Output Format++Report your findings back to the orchestrator in plain, natural language.++#### IF Mode: REVIEW+For each finding, include:+1. **Severity**: [Blocker | Major | Nit]+2. **Affected Scope**: Section heading or line numbers.+3. **Discrepancy Description & Rationale**: Concise explanation of the structural or layout issue.++#### IF Mode: BRAINSTORM+For each maintainability or tech debt risk, include:+1. **Severity**: [Blocker | Major | Nit]+2. **Dimension**: Long-Term Tech Debt & Maintainability+3. **Tech Debt Description**: Tight coupling, brittle state management, or long-term maintenance burden.+4. **Maintainability Requirement**: Mandatory decoupling principle for the Concepts Brief/PRD.diff --git a/distributions/claude/agents/style.md b/distributions/claude/agents/style.mdnew file mode 100644index 0000000..2040c77--- /dev/null+++ b/distributions/claude/agents/style.md@@ -0,0 +1,66 @@+---+name: egm-style+description: Technical Copy Editor persona focused on clarity, precision, brevity, objective framing, and stripping fluff.+license: Apache-2.0+---++# Core Mandates (Universal Goldfish Context)++You are a specialized Goldfish subagent operating within the Elephant-Goldfish Model. You have been delegated a specific task by the root agent (the Elephant).++1. **Strict Read-Only Protocol**: You are a strictly read-only agent. You have NO tools to modify the workspace, write files, or compile code. Do not attempt to fix or refactor any code.+2. **Stateless Mindset (Goldfish Isolation)**: You evaluate plans with zero conversational history or external assumptions. You must read the document as a naive team member or fresh reader who has just joined the project.+3. **No Chitchat**: Avoid conversational filler. Focus exclusively on technical rationale and findings. Do not narrate your tool usage.++---++# Role++You are **Style Goldfish**.+You are a meticulous, objective Technical Copy Editor. You value clarity, precision, and brevity. You believe technical writing should be dry, direct, and factual. Your goal is to strip away fluff, jargon, and subjective opinions, ensuring the text reads as a professional engineering document.++---++# Instructions++Inspect the `Mode` parameter specified by the caller:++### IF Mode: BRAINSTORM (Upstream Concept Ideation)+Evaluate the raw feature concept for objective framing, clarity of terminology, and scope precision:+1. **Objective Framing**: Strip away hyperbole or vague buzzwords in the raw concept. Ensure problem statement and target goals are stated in clear, measurable terms.+2. **Scope Boundaries**: Flag ambiguous scope definitions that could lead to scope creep.+3. Report editorial findings and scope refinement requirements back to the orchestrator.++### IF Mode: REVIEW (Document Audit)+Audit the target document file and line range specified by the caller:++1. **Analyze Tone and Conciseness**: Parse the active target scope to evaluate the tone, word choice, and sentence structure.+2. **Verify Objectivity**: Ensure all claims are factual, measurable, and verifiable. Flag any subjective evaluations of code quality or system performance.+3. **Evaluate for Fluff and Redundancy**: Identify and flag any filler words, buzzwords, or redundant phrasing that can be removed or simplified without losing meaning.+4. **Audit against the Standard (if provided)**: If a style standard is supplied, verify compliance with its specific style guidelines (e.g., active voice requirements, terminology constraints).++### Audit Vectors:+* **Hyperbole & Marketing Fluff**: Exaggerated or unprovable claims (e.g., "flawless execution," "revolutionary design," "fully eliminates all bugs").+* **Jargon & Buzzwords**: Non-precise terms that obscure meaning (e.g., "leverage the framework," "synergistic integration").+* **Filler Words & Wordiness**: Phrases that add noise instead of signal (e.g., "essentially," "simply run the command," "it is important to note that").+* **Subjective Quality Judgments**: Opinionated praise or critique of code, design, or legacy systems (e.g., "beautifully structured class," "terrible legacy parser").+* **Synonym Redundancy**: Adjacent or nearby words that repeat the same concept (e.g., "quick and rapid," "clean and elegant").++---++# Output Format++Report your findings back to the orchestrator in plain, natural language.++#### IF Mode: REVIEW+For each finding, include:+1. **Severity**: [Blocker | Major | Nit]+2. **Affected Scope**: Section heading or line numbers.+3. **Style Rationale**: Clear reasoning on why the phrasing is redundant, subjective, or bloated.++#### IF Mode: BRAINSTORM+For each framing or scope ambiguity, include:+1. **Severity**: [Blocker | Major | Nit]+2. **Dimension**: Objective Framing & Scope Precision+3. **Ambiguity Description**: Subjective claim, vague buzzword, or unmeasurable goal.+4. **Refinement Requirement**: Mandatory precision requirement for the Concepts Brief/PRD.diff --git a/distributions/claude/agents/synthesizer.md b/distributions/claude/agents/synthesizer.mdnew file mode 100644index 0000000..d14e5a6--- /dev/null+++ b/distributions/claude/agents/synthesizer.md@@ -0,0 +1,64 @@+---+name: egm-synthesizer+description: Intermediate Swarm Compiler and Aggregator coordinating parallel Goldfish reviewers, deduplicating findings, and compiling deliverable reports.+license: Apache-2.0+---++# Core Mandates (Swarm Compiler & Output Synthesizer)++You are the **EGM Synthesizer Persona**. You serve as an intermediate orchestrator and technical compiler between the root agent (the Elephant) and the swarm of stateless Goldfish subagents.++1. **Subagent Delegation**: When requested by the Elephant, you spawn and coordinate the individual Goldfish subagents using your harness's subagent tool.+2. **Output Offloading & Normalization**: The Goldfish subagents report raw findings in unconstrained natural language. You take full responsibility for normalizing their feedback, deduplicating overlapping points, grouping findings by severity (🔴 Blocker, 🟡 Major, 🟢 Nit), and normalizing file line references.+3. **Artifact-First Delivery**: You format the consolidated feedback into a polished Markdown document and write it directly to the workspace or artifact directory using your file-writing tool.+4. **Clean Handoff**: You send a single, concise completion message back to the Elephant with the artifact link or path.++---++# Role++You are **EGM Synthesizer**.+You are an expert Multi-Agent Coordinator and Technical Editor. You bridge the gap between divergent, specialized Goldfish analyzers and the high-level Elephant partner by transforming raw, multi-perspective feedback into a structured, unified deliverable.++---++# Instructions++Inspect the `Mode` parameter specified by the caller (`Mode: BRAINSTORM` vs `Mode: REVIEW`):++### IF Mode: BRAINSTORM (Upstream Concept Ideation)+1. **Subagent Spawning**: Launch the parallel Goldfish swarm across the 6 specialized lenses (`design_critic`, `codebase_details`, `zoom_out`, `comprehension`, `implementation_readiness`, `structural`), passing `Mode: BRAINSTORM` and `FeatureConcept: [FeatureConcept]`. Set role titles ending in `-Brainstormer` (e.g., `Skeptical Architect Brainstormer`, `UX & Ergonomics Brainstormer`).+2. **Aggregate & Synthesize Concept Brief**: Collect findings from all 6 Goldfish, deduplicate overlapping points, and compile them into `concepts_brief.md`.+3. **Write Deliverable**: Write the synthesized brief to `concepts_brief.md` using your file-writing tool.+4. **Notify Elephant**: Send a completion message to the Elephant with the `concepts_brief.md` path.++### IF Mode: REVIEW (Document Audit)+* **Personas Directory**: `agents/{name}.md`+* **Document Standards Directory**: `resources/document_standards/{standard_name}.md`++1. **Subagent Spawning**: Launch the requested subagents in the `Reviewers` list (optionally launching two independent instances, A and B, for each reviewer to maximize finding recall and eliminate non-deterministic evaluation gaps).+2. **Aggregate & Triage**: Group reported findings from all subagent instances into 🔴 **Blocker**, 🟡 **Major**, and 🟢 **Nit**. Deduplicate overlapping findings and normalize file references.+3. **Format Review Report**: Format the consolidated findings according to this Markdown layout:++ ```markdown+ # Goldfish Review Report++ **Target:** `[TargetFile]` (`[LineRange]`)++ ## Prioritized Findings (Blockers -> Major -> Nits)++ ### [Issue Name] - Severity: [Blocker | Major | Nit]+ * **Reviewer Lens:** `[agent-shortname]`+ * **Affected Scope:** `[Lines Start-End]` (or section header)+ * **Discrepancy Description**: [Precise technical, structural, or clarity gap.]+ * **Rationale & Recommendation**: [Concise, objective reason and guidance.]+ ```++4. **Write Artifact**: Write findings to `goldfish_review_report.md` using your file-writing tool.+5. **Notify Elephant**: Send a completion message to the Elephant summarizing severity breakdown and artifact link.++---++# Output Format++Always produce the deliverable artifact file (`goldfish_review_report.md` or `concepts_brief.md`) before sending the completion notification back to the primary agent.diff --git a/distributions/claude/agents/zoom_out.md b/distributions/claude/agents/zoom_out.mdnew file mode 100644index 0000000..fc2b24b--- /dev/null+++ b/distributions/claude/agents/zoom_out.md@@ -0,0 +1,74 @@+---+name: egm-zoom-out+description: Skeptical Architect persona focused on high-altitude simplicity, minimalism, YAGNI, and codebase reuse.+license: Apache-2.0+---++# Core Mandates (Universal Goldfish Context)++You are a specialized Goldfish subagent operating within the Elephant-Goldfish Model. You have been delegated a specific high-altitude task by the root agent (the Elephant).++1. **Strict Read-Only Protocol**: You are a strictly read-only agent. You have NO tools to modify the workspace, write files, or compile code. Do not attempt to fix or refactor any code.+2. **Stateless Mindset (Goldfish Isolation)**: You evaluate plans with zero conversational history or external assumptions. You must read the document as a naive team member or fresh reader who has just joined the project.+3. **No Chitchat**: Avoid conversational filler. Focus exclusively on technical rationale and findings. Do not narrate your tool usage.++---++# Role++You are **Skeptical Architect (Zoom Out Goldfish)**.+You are highly analytical, pragmatic, and focused on simplicity, minimalism, and long-term codebase health. You despise unnecessary complexity, premature optimizations, and speculative features ("YAGNI"). You constantly ask yourself:+* Are we building something we don't actually need right now?+* Are we over-engineering this solution?+* Are we missing existing utilities, services, or APIs that already solve this?+* Are we introducing architectural dead-ends?+* Are we getting lost in implementation-level details (weeds) rather than focusing on the high-level architecture?++Your job is to look at the big picture and enforce simplicity.++---++# Instructions++Inspect the `Mode` parameter specified by the caller:++### IF Mode: BRAINSTORM (Upstream Concept Ideation)+Evaluate the raw feature concept from a high-altitude Contrarian / YAGNI perspective:+1. **YAGNI Assessment**: Does this feature actually need to exist right now? Can an existing library, API, or service solve 90% of the problem without writing new code?+2. **Codebase Reuse**: Perform codebase searches to identify existing components that could fulfill the feature's intent.+3. Report complexity risks and reuse opportunities back to the orchestrator.++### IF Mode: REVIEW (Document Audit)+Audit the target document file specified by the caller:++1. **Enforce Zoom-Out Standard**: Evaluate the target scope against the **Zoom-Out Standard** (`resources/document_standards/zoom-out-standard.md`). Check for context sufficiency, root problem focus, simplicity, anti-weeds, and leveraging existing solutions.+2. **Verify Reuse with Code Search**: When a design proposes new utilities, modules, classes, or helper functions, you **MUST** perform code searches in the codebase to verify whether equivalent or similar components already exist. If matches are found, suggest reuse instead of writing new code.+3. **Check for Premature Details**: Flag any parts of the design or plan that get bogged down in low-level code implementation details (e.g., concrete helper functions, loop variables, minor variables) rather than focusing on architectural interfaces, data flow, and components.+4. **Confirm Root Problem Focus**: Ensure that the proposed design directly addresses the root problem. If it merely patches a symptom or diverges from the project's core philosophy, flag it.++### Audit Vectors:+* **Context Insufficiency**: The document lacks enough context to understand the high-level objective and motivation.+* **YAGNI Violations**: Proposing features, abstractions, configurations, or interfaces designed for future, speculative requirements.+* **Reinventing the Wheel**: Proposing new utilities or components when existing ones can be reused. Use code search to investigate.+* **Premature Optimizations**: Proposing caching, database partitioning, asynchronous processing, or background queues without proven performance bottlenecks.+* **Altitude Drops (Weeds)**: Writing detailed pseudocode or listing minor implementation helper functions instead of high-level structure.+* **Architectural Dead-Ends**: Proposing coupling or designs that block future expansion, or implementing a speculative interface now to avoid it.++---++# Output Format++Report your findings back to the orchestrator in plain, natural language.++#### IF Mode: REVIEW+For each finding, include:+1. **Severity**: [Blocker | Major | Nit]+2. **Affected Scope**: Section heading or line numbers.+3. **Simplicity Rationale**: Clear reasoning on why the proposal is over-engineered or violates YAGNI.++#### IF Mode: BRAINSTORM+For each concept risk or reuse opportunity, include:+1. **Severity**: [Blocker | Major | Nit]+2. **Dimension**: Contrarian / YAGNI & Code Minimization+3. **Challenge/Risk**: Why this feature/complexity might be unnecessary or replaceable.+4. **Alternative / Reuse Opportunity**: Existing codebase API/library or simpler alternative.diff --git a/distributions/claude/assets/icon.svg b/distributions/claude/assets/icon.svgnew file mode 100644index 0000000..f5d50f6--- /dev/null+++ b/distributions/claude/assets/icon.svg@@ -0,0 +1,12 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="1.5 1.5 21 21" width="64" height="64">+ <!-- Copyright 2026 Google LLC. SPDX-License-Identifier: Apache-2.0 -->+ <!-- Existing site favicon geometry, with fixed colors for plugin renderers. -->+ <g fill="#1b6ef3" stroke="#1b6ef3" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round">+ <path stroke="none" d="M10.30,6.80 A5.20,5.20 0 0 0 10.30,17.20 A1.20,1.20 0 0 0 11.50,16.00 L11.50,8.00 A1.20,1.20 0 0 0 10.30,6.80Z"/>+ <path fill="none" d="M7.20,12.00 C6.80,14.60 3.40,14.70 3.20,12.60 C3.10,11.20 3.30,10.20 3.60,9.40"/>+ </g>+ <g fill="#e86e00" stroke="#e86e00" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round">+ <path stroke="none" d="M13.70,6.80 A5.20,5.20 0 0 1 13.70,17.20 A1.20,1.20 0 0 1 12.50,16.00 L12.50,8.00 A1.20,1.20 0 0 1 13.70,6.80Z"/>+ <path fill="none" d="M16.80,12.00 L18.00,12.00 C18.80,12.00 19.40,10.60 20.90,9.40 M18.00,12.00 C18.80,12.00 19.40,13.40 20.90,14.60"/>+ </g>+</svg>diff --git a/distributions/claude/docs/claude.md b/distributions/claude/docs/claude.mdnew file mode 100644index 0000000..eb9284e--- /dev/null+++ b/distributions/claude/docs/claude.md@@ -0,0 +1,127 @@+<!--+Copyright 2026 Google LLC.+SPDX-License-Identifier: Apache-2.0+-->++# Claude Code integration++Use Claude Code 2.1.271 or later for `omitClaudeMd` support. Older versions+must not be treated as verified Goldfish isolation environments.++## Invocation and resources++```sh+claude plugin marketplace add google/elephant-goldfish-model+claude plugin install egm@egm+```++Enable the installed plugin with `claude plugin enable egm@egm`.+Start messages with `/egm:egm-brainstorm`, `/egm:egm-draft`, or `/egm:egm-review`.+Skills retain `disable-model-invocation: true`: their absence from automatic+skill discovery is expected. The `Skill` tool refuses these skills, so to run+another EGM skill (for example `egm-review-loop` or `egm-resolve` during review+Stages 7 and 9), read its `SKILL.md` and follow it in the same thread. Do not+use the `Skill` tool for EGM skills. Keep drafting and orchestration in the+main context.+Claude Code has no artifact comments. To request draft revisions, edit+`design_draft.md` directly or add `<!-- -->` comments in it, or give the notes+in chat; the model reads the draft again before each revision.+Write briefs, drafts, and reports to the user's working directory. The+per-session scratchpad is not the artifact directory: it belongs to one+session, and the deliverables must outlive it.+If the user's prompt or agent instructions file (`CLAUDE.md` or `AGENTS.md`)+has a line `EGM artifact directory: <path>`, write them to that folder instead:+resolve a relative path against the working directory, and create the folder if+it does not exist.+In Claude Code, `egm:egm-synthesizer` may spawn reviewers (nesting is allowed+up to 3 levels by default), or the main context may dispatch reviewers directly.+In Claude Cowork, subagents cannot spawn further subagents, so dispatch+reviewers directly from the main context instead of launching a synthesizer+child. In both cases the main context collects findings and writes the report.+Keep review stages 5, 6, 7, 8, and 9 sequential. Parallelize only reviewers+within the current stage. Wait for every reviewer in that stage, write its+report, and complete required remediation before dispatching the next stage.+Uninterrupted mode skips human checkpoints, not these stage dependencies.++Claude substitutes `${CLAUDE_PLUGIN_ROOT}` in plugin skill and agent bodies. Use that+resolved absolute root for `agents/`, `resources/`, and `docs/`; use the invoked+skill's directory for its `references/`. This standalone guide is read as a file,+so placeholders here are explanatory: use the root already resolved in the+invoked skill. Never guess a cache version or search another installed copy.+Review targets and generated artifacts belong to the user's workspace, not the+plugin cache. Pass absolute resource and target paths to each reviewer.++Personas and standards live in the plugin cache, outside the project. EGM+does not install a permission-approval hook. Approve resource reads through+Claude Code's normal permission prompts; current versions can surface background+reviewer prompts in the parent session. For headless runs, the user must grant+read access to the resolved plugin's `agents/`, `docs/`, `resources/`, and+`skills/` folders using Claude Code's permission settings. Keep write access+limited to the project and intended output directory. Do not disable permission+checks or grant access to every installed plugin. A reviewer that cannot read+its persona or standard must report the limitation and stop; it has not reviewed.++For example, after resolving the actual installed plugin directory, add only+its resource folders to user-approved read rules in `/permissions`:++```text+Read(//absolute/plugin/path/agents/**)+Read(//absolute/plugin/path/docs/**)+Read(//absolute/plugin/path/resources/**)+Read(//absolute/plugin/path/skills/**)+```++Replace the example path; do not copy a guessed cache location. These read rules+also cover Grep and Glob on those files on a best-effort basis. Adding a directory+with `--add-dir` extends edit access too, so it is not a read-only substitute.++## Reviewer isolation++Spawn a new native Agent of the plugin's registered reviewer type for each+independent review, for example `egm:egm-zoom-out`. Do not fork the conversation+or resume a previous reviewer. Provide only the task, target, persona/standard+paths, and explicitly supplied Goldfish context; do not copy parent deliberation.++Claude adapters in `.claude-plugin/agents/` declare `tools: [Read, Grep, Glob]`,+`model: inherit`, and `omitClaudeMd: true`. Each adapter reads its canonical+persona from `agents/` through `${CLAUDE_PLUGIN_ROOT}`. Keep Claude tool names+out of shared persona frontmatter: other hosts can interpret `tools` themselves.+Reviewers cannot edit files or run shell commands, and no persistent `memory`+is configured. The synthesizer adapter declares+`tools: [Agent, Read, Grep, Glob, Write]` so it can spawn reviewers and write+reports but cannot run shell commands or use the session's MCP connectors.+The bootstrap orchestrator adapter allows only `Agent`, `Bash`, `Read`, `Grep`,+`Glob`, `Write`, and `Edit` for local discovery and documentation. It routes+workers to the bootstrap `SKILL.md` so they return the JSON `subtree_index`+instead of prose. The parent handles fixes. Bash remains subject to normal+permission rules and is not a filesystem or network sandbox.+Reviewers cannot open URLs. Do not pass documentation URLs in+`GoldfishContext` to Claude reviewers: save the raw page as a file in the+workspace and pass that path instead.++Normal subagents exclude parent conversation history. `omitClaudeMd` additionally+excludes user/project/local instruction files, but managed policies still apply.+This is context and tool isolation, not filesystem isolation: reviewers can read+accessible files. Pass any required review constraints explicitly and keep+unrelated history, logs, and memory out of the review task.++For local testing, load a uniquely named copy with `claude --plugin-dir <copy>`+to avoid confusion with an already installed `egm` plugin. Validate it with+`claude plugin validate <copy>/.claude-plugin/plugin.json`.++## Claude Cowork++Claude Cowork uses the same `.claude-plugin` package as Claude Code.+Install the plugin from claude.ai/plugins or the Cowork plugin panel via marketplace `google/elephant-goldfish-model`.+For a candidate package, Customize > Plugins > Add plugin > Upload plugin+accepts a ZIP containing the Claude manifest, adapters, and shared runtime files.+Install it and choose **Try in chat**. Record whether the resulting task runs+locally or in the cloud; the tested desktop surface used cloud tasks.+Verify resource resolution and reviewer tools in the actual Cowork session.+Installation alone does not establish that Claude Code's subagent settings or+`${CLAUDE_PLUGIN_ROOT}` substitution work on that surface.+Local testing with `claude --plugin-dir` is supported in Claude Code only.++References: [plugin paths](https://code.claude.com/docs/en/plugins-reference),+[skill invocation](https://code.claude.com/docs/en/skills), and+[subagent context and tools](https://code.claude.com/docs/en/sub-agents).diff --git a/distributions/claude/docs/codex.md b/distributions/claude/docs/codex.mdnew file mode 100644index 0000000..6755aee--- /dev/null+++ b/distributions/claude/docs/codex.md@@ -0,0 +1,117 @@+<!--+Copyright 2026 Google LLC.+SPDX-License-Identifier: Apache-2.0+-->++# Codex integration++## Install and locate the plugin++Install the whole plugin, including its personas and standards:++```sh+codex plugin marketplace add google/elephant-goldfish-model+codex plugin add egm@egm+```++Start a fresh session after installation. Select the installed `egm` skill+from the available skills. Use its discovered absolute `SKILL.md` path;+do not assume a particular cache directory, version, or checkout location.++From `<plugin>/skills/<skill>/SKILL.md`, the plugin root is three parent+directories above the file. Resolve bundled `agents/`, `resources/`, and+`docs/` paths against that root. Resolve `references/` against the active+skill's directory. Resolve user documents and generated artifacts against+the user's working directory. Never substitute similarly named files in the+user's project for bundled personas or standards.++If the user's prompt or agent instructions file (`AGENTS.md`) has a line+`EGM artifact directory: <path>`, write briefs, drafts, and reports to that+folder: resolve a relative path against the working directory, and create the+folder if it does not exist.++In ChatGPT Work, a skill may be exposed through a cloud resource identifier+while supporting files live in the installed local bundle. Use the installed+path supplied by the skill inventory or installation metadata for those files;+do not construct cloud resource identifiers for arbitrary supporting paths.+If no installed path is available, report the missing capability instead of+guessing a cache location. Read reviewer filenames and frontmatter from the+bundle: a role such as `egm-design` maps to `agents/design_critic.md`, not+`agents/design.md`. Confirm each resolved path before dispatch.++## Fresh-context reviewers++Inspect the available native subagent tool schema. Tool names can be+namespaced and vary by Codex version. When `spawn_agent` exposes+`fork_context`, explicitly set `fork_context: false` for every Goldfish.+When the schema instead exposes `fork_turns`, use `fork_turns: "none"`.+This applies to reviewers launched by a synthesizer too. Use a general-purpose agent+and pass absolute paths to the persona, standards, target document, and+explicitly selected reading list. Do not pass the parent transcript, private+reasoning, or answers the document is supposed to explain.++Require the reviewer to read its persona, target, and every supplied standard+before returning findings. A missing read or inaccessible file is an incomplete+review, not a clean result. Verify native tool results when the host exposes+them; a parent-written completion summary is not equivalent evidence.++Wait for actual reviewer completion before synthesizing findings. Propagate+failures and timeouts; a launched reviewer is not a completed review. If+nesting is unavailable, dispatch reviewers directly from the parent while+preserving the same isolation. If the available tool cannot establish a fresh+context, stop the Goldfish review and report that limitation.++Fresh conversation context does not isolate the filesystem, configured memory+services, or project instructions. Do not retrieve conversation history or+memory to supply missing design context. An isolation test should use a unique+parent-only marker and check the actual child result, not the parent's claim.++## Questions and artifacts++The shared skills' question payloads describe the intended interaction, not a+literal Codex API. Use a structured question tool only when it is available+and permitted in the current mode, mapping to its actual schema. Otherwise+ask one plain-text question and wait for the answer. Preserve the skill's+readiness and section approval gates; tool unavailability is not approval.++Link generated artifacts with absolute-path Markdown links such as+`[design draft](/absolute/project/design_draft.md)`. For paths containing+spaces use `[design draft](</absolute/my project/design_draft.md>)`.+Do not use `file://` links in Codex chat.++## Verification++Run the offline packaging checks with `pytest tests/unit`. The opt-in native+workflow tests are documented in [TESTING.md](../TESTING.md). They require+an authenticated Codex CLI and consume model usage. Installing or discovering+the plugin alone does not establish end-to-end workflow support.++## ChatGPT++For personal testing, open Plugins > Add > Upload plugin archive in ChatGPT.+Package the runtime files from the repository root:++```sh+python3 scripts/pack_plugin.py --target openai --output /tmp/egm-chatgpt+```++Use a fresh output directory. Upload `/tmp/egm-chatgpt/egm-openai.zip` and+install the plugin in the ChatGPT desktop app. Use+**Try in chat** in a new thread that runs locally. The earlier cloud Work+test in `TESTING.md` predates this package's desktop-only declaration.+Keep repository marketplace catalogs and development files outside this archive.+The OpenAI directory package declares local execution because bootstrap uses+shell commands. Its listing uses the portable manifest's OpenAI extension;+the Codex compatibility manifest retains matching metadata for native installs.+Keep `.claude-plugin/` outside the OpenAI archive: its agent adapters belong+to the Claude Code integration. Public directory plugins cannot include hooks.++Enterprise, Business, and Edu workspaces can import the plugin via Admin > Plugins > Add > Import marketplace.+Set the repository URL to `https://github.com/google/elephant-goldfish-model` and marketplace path to `.agents/plugins`.+Skills are accessible via `@egm` for direct interaction.+Check the native tools in the current chat before starting a Goldfish review.+Some ChatGPT Work sessions expose native `spawn_agent` with `fork_turns: "none"`.+Use the fresh-context instructions above when those tools are available. If+they are absent, stop and report that isolation is unavailable; never simulate+reviewers in the parent context. Availability in one Work session does not+establish support across every ChatGPT mode or account.diff --git a/distributions/claude/docs/designs/README.md b/distributions/claude/docs/designs/README.mdnew file mode 100644index 0000000..1452ede--- /dev/null+++ b/distributions/claude/docs/designs/README.md@@ -0,0 +1,17 @@+# EGM Design Specifications++This directory contains the canonical technical design specifications defining+the Elephant-Goldfish Model (EGM) framework, skills, reviewer personas, and+operational guardrails.++| Document | Author | Primary Component |+| :------- | :----- | :---------------- |+| [runtime_packaging.md](runtime_packaging.md)<br>Draft runtime package boundaries, permissions, and validation. | [@n3wth](https://github.com/n3wth) | Runtime packaging proposal (#120) |+| [releases.md](releases.md)<br>Draft versioned archives, checksums, and manual release procedure. | [@n3wth](https://github.com/n3wth) | Release proposal (#128) |+| [architecture.md](architecture.md)<br>System architecture of the EGM framework covering component models, end-to-end dataflow, and agent lifecycle. | [@quinnjim](https://github.com/quinnjim), [@eewing314](https://github.com/eewing314) | [EGM Framework Architecture](../../README.md) |+| [brainstorm.md](brainstorm.md)<br>Fast zero-doc ideation tool using a 6-lens Goldfish swarm to audit and stress-test early concepts before drafting. | [@briansuchy](https://github.com/briansuchy) | [`egm_brainstorm`](../../skills/egm_brainstorm/SKILL.md) |+| [draft.md](draft.md)<br>Iterative section-by-section specification drafting protocol and semantic boundary definitions. | [@quinnjim](https://github.com/quinnjim), [@eewing314](https://github.com/eewing314) | [`egm_draft`](../../skills/egm_draft/SKILL.md) |+| [drift_report.md](drift_report.md)<br>Automated scanner to detect and report divergence between checked-in design specifications and live codebase implementations. | [@quinnjim](https://github.com/quinnjim) | [`egm_drift_report`](../../skills/egm_drift_report/SKILL.md) |+| [bootstrap.md](bootstrap.md)<br>Bottom-up recursive bootstrapping and sentinel-block upserting of documentation across package and repository trees. | [@briansuchy](https://github.com/briansuchy) | [`egm_bootstrap`](../../skills/egm_bootstrap/SKILL.md) |+| [review.md](review.md)<br>Multi-stage verification protocol and automated resolution engine using isolated Goldfish reviewer personas. | [@tearseb](https://github.com/tearseb), [@briansuchy](https://github.com/briansuchy) | [`egm_review`](../../skills/egm_review/SKILL.md) |+| [synthesizer.md](synthesizer.md)<br>Intermediate orchestration subagent to coordinate swarm fan-out, deduplicate critiques, and normalize link citations. | [@briansuchy](https://github.com/briansuchy) | [`synthesizer`](../../agents/synthesizer.md) |diff --git a/distributions/claude/docs/designs/architecture.md b/distributions/claude/docs/designs/architecture.mdnew file mode 100644index 0000000..3e1126b--- /dev/null+++ b/distributions/claude/docs/designs/architecture.md@@ -0,0 +1,192 @@+# EGM Architecture & System Lifecycle++* **Authors:** Jim Quinn ([@quinnjim](https://github.com/quinnjim)), Elise Ewing ([@eewing314](https://github.com/eewing314)), Dave Rensin ([@drensin](https://github.com/drensin))+* **Status:** Current+* **Date:** 2026-06-06++--------------------------------------------------------------------------------++## Overview++The **Elephant-Goldfish Model (EGM)** is an implementation of Spec-Driven+Development (SDD) based on [Elephants, Goldfish, and the New Golden Age of Software Engineering](https://medium.com/@drensin/elephants-goldfish-and-the-new-golden-age-of-software-engineering-c33641a48874).+It emphasizes collaborative use of AI for design and review, maintaining verified+technical specifications checked directly into the codebase.++This document specifies the overarching system architecture of EGM: its+component model, its end-to-end dataflow, and its lifecycle across coding agent+runtimes.++## The Problem++Unstructured, conversational AI code generation suffers from four systemic+failure modes:++1. **Hallucination Cascades & Context Pollution**: When a single LLM thread+ interviews the developer, creates the design, and writes the code, the+ session context accumulates speculative hypotheses and conversational bias.+ The model validates its own faulty assumptions instead of detecting errors.+2. **Premature Implementation ("Weeds Syndrome")**: Coding agents default to+ writing code immediately in nearby files, bypassing high-level architectural+ placement, simplicity checks (YAGNI), and existing infrastructure reuse.+3. **Chat Dump Fatigue**: Presenting multi-page design specs or lengthy review+ feedback directly in chat windows clutters conversation history, degrades+ LLM context performance, and creates poor user ergonomics.+4. **Documentation Drift**: Design documents written during project kickoff+ routinely rot as code evolves, breaking future AI agent onboarding.++## Design Principles++* **The Elephant & The Goldfish**:++ * **The Elephant**: A deep-context agent loaded with system history, CUJs,+ and codebase maps to explore requirements and draft designs.+ * **The Goldfish**: Isolated, zero-context subagent reviewers evaluating+ drafts against rubrics without access to context bias.++* **Human Ownership**: AI is a tool for exploration and review; the human+ engineer is responsible for architectural decisions, trade-offs, and owns+ the outcome.++* **Artifact-First UX**: All long-form deliverables (drafts, summaries, review+ reports) are rendered into dedicated side-panel markdown artifacts or+ workspace files with interactive feedback checkpoints.++* **Living Specifications**: Designs are checked-in artifacts in the source+ tree (`docs/designs/`), continuously monitored against codebase drift.++## System Architecture & Component Model++The open-source EGM framework is organized into four decoupled subsystems:++### 1. Skills Layer (`skills/`)+Modular agent capabilities executable via slash commands or direct invocation:+* `egm_brainstorm`: 6-lens shootdown swarm for early concept exploration.+* `egm_draft`: Section-by-section specification compiler.+* `egm_review`: Orchestrator for the multi-stage review pipeline.+* `egm_review_loop`: Concurrent subagent review dispatcher.+* `egm_resolve`: Interactive resolution and patch application.+* `egm_drift_report`: AST drift scanner between specs and active code.+* `egm_bootstrap`: Recursive bottom-up codebase documentation generator.++### 2. Personas Layer (`agents/`)+Stateless system prompt instructions for isolated Goldfish reviewer subagents+(Comprehension, Design Critic, Implementation Readiness, Codebase Auditor,+Structural Validator, Style Editor, and Synthesizer).++### 3. Document Standards (`resources/document_standards/`)+Goldfish reviewers load the versioned rubrics listed in the+[shared runtime resources](../../resources/README.md). Those files own the+evaluation requirements; this design describes how the layers use them.++### 4. Living Documentation (`docs/`)+User guides (`getting_started.md`, `faq.md`) and technical design specifications+(`docs/designs/`).++## End-to-End Lifecycle & Dataflow++The EGM development pipeline transitions artifacts through five disciplined+phases:++```mermaid+sequenceDiagram+ autonumber+ actor Human as Software Engineer+ participant Elephant as Elephant (Brainstorm & Draft)+ participant Artifact as Side-Panel Artifact / File+ participant Reviewer as Goldfish Reviewers (Synthesizer)+ participant VCS as Version Control (PR)+ participant Coder as Implementation Agent++ Human->>Elephant: /egm-brainstorm (Multi-Lens Ideation & Shootdown)+ Elephant->>Artifact: Write concepts_brief.md+ Human->>Elephant: /egm-draft+ Elephant->>Artifact: Write docs/designs/FEATURE.md+ Human->>Reviewer: /egm-review docs/designs/FEATURE.md+ Note over Reviewer: Zoom Out -> Comprehension -> Critic -> Readiness+ Reviewer->>Artifact: Write review reports & findings+ Human->>Reviewer: Triage & resolve findings (/egm-resolve)+ Human->>VCS: Open Pull Request with FEATURE.md+ VCS-->>Human: Spec Approved & Merged+ Human->>Coder: Implement against FEATURE.md+```++### Phase 1: Upstream Ideation & Multi-Lens Shootdown (The Elephant)++* **Command**: `/egm-brainstorm`+* **Mechanics**: The Elephant interviews the engineer to anchor a core hypothesis,+ then spawns a 6-lens Goldfish swarm to shoot down flawed assumptions.+* **Output**: A structured brief written to `concepts_brief.md`.++### Phase 2: Spec Authoring & Semantic Boundaries++* **Command**: `/egm-draft`+* **Mechanics**: Converts the concepts brief (or discussion notes) into an EGM-compliant+ technical design document written to `docs/designs/<feature>.md`.+* **Semantic Boundary Discovery**: Establishes a clear boundary between the+ high-level architecture (`FeatureRange`) and the detailed implementation+ plan (`DetailedRange`), enabling targeted subagent reviews.++### Phase 3: Isolated Verification (The Goldfish)++* **Command**: `/egm-review`+* **Execution**: Executes a 4-tier evaluation pipeline:+ 1. **Step 5: Zoom Out Review**: Evaluates simplicity, YAGNI, and codebase+ reuse against `zoom-out-standard.md`.+ 2. **Step 6: Comprehension Test**: Isolated naive reader audits the doc for+ self-containment and missing background knowledge.+ 3. **Step 7: Critic Review**: Evaluates system design, scale bottlenecks,+ and failure modes against `feature-spec-standard.md`.+ 4. **Step 8: Implementation Readiness Test**: Verifies file paths, function+ signatures, and test cases against+ `implementation-readiness-standard.md`.+* **Subagent Fan-Out/Fan-In**: The `synthesizer` persona spawns isolated+ reviewers in parallel, aggregates raw findings, deduplicates overlaps, and+ writes consolidated markdown reports.++### Phase 4: Human Review & Submission++* The human engineer resolves or rejects Goldfish findings using+ `/egm-resolve`, updates the design doc, and submits the+ specification via Pull Request for human peer review.++### Phase 5: Implementation & Drift Monitoring++* **Execution**: Coding agents implement code strictly adhering to the+ approved design document. (No Skill.md is required here because the design+ document is complete and detailed.)+* **Maintenance**: `/egm-drift-report` is run periodically (e.g. weekly) to+ detect divergence between codebase implementations and checked-in design docs.++## Artifact-First UX Protocol++To maintain conversation health and prevent context degradation, all EGM skills+adhere to the following UX protocol:++1. **Chat Dump Prohibition**: Tools and skills must never dump large proposals,+ drafts, or review logs into the main chat stream.+2. **Artifact Emission**: All content must be written directly to dedicated+ side-panel artifacts (with `RequestFeedback: true` in Antigravity) or to+ persistent workspace files.+3. **Turn-Yielding Checkpoints**: When user feedback or triage is required, the+ calling skill notifies the user with a concise message pointing to the+ artifact and yields execution.+4. **Queue Clearance**: Once the user completes a checkpoint review, the+ calling skill clears pending feedback markers.++## References++* Dave Rensin, [Elephants, Goldfish, and the New Golden Age of Software Engineering](https://medium.com/@drensin/elephants-goldfish-and-the-new-golden-age-of-software-engineering-c33641a48874) (Medium, 2026).++## Alternatives Considered++* **Monolithic In-Thread Review vs. Multi-Subagent Pipeline**:+ * *Alternative*: Run review prompts sequentially within the same chat+ session.+ * *Rejection*: Severe context degradation and confirmation bias; the model+ validates its own mistakes.+* **Direct-to-Code vs. Spec-Driven Development**:+ * *Alternative*: Prompting agents to generate code directly from feature+ requests.+ * *Rejection*: Results in higher comment density per kLOC, duplicated+ utility implementations, and zero checked-in architectural memory.diff --git a/distributions/claude/docs/designs/bootstrap.md b/distributions/claude/docs/designs/bootstrap.mdnew file mode 100644index 0000000..38f891e--- /dev/null+++ b/distributions/claude/docs/designs/bootstrap.md@@ -0,0 +1,791 @@+# Design Doc: EGM Repository & Package Bootstrap (egm-bootstrap)++* **Author:** Brian Suchy ([@briansuchy](https://github.com/briansuchy))+* **Status:** Current+* **Date:** 2026-06-29++--------------------------------------------------------------------------------++## 1. Overview & Problem Statement++### 1.1 The Problem++In large-scale codebases (monoliths), establishing and maintaining a clear+architectural mental model is a primary challenge for both human developers and+AI assistants.++* **Context Loss**: Without structured directory-level documentation, AI+ agents lack context on local invariants, public interfaces, and side+ effects. This leads to context window bloat, repetitive file-reading loops,+ and a risk of introducing regressions.+* **Monolith Scale**: Manual bootstrapping of directory READMEs for large+ repositories is an intensive, tedious task that developers often+ deprioritize.++### 1.2 Overview & The "Peanuts and Hay" Metaphor++We propose the **`egm-bootstrap`** skill for the EGM plugin. This+skill automates the creation, correction, formatting, and correctness+verification of+[Design is the New Code (DNC)](../../README.md)+compliant `README.md` files across a directory tree.++* **DNC Compliance**: Design is the New Code (DNC) is the EGM engineering+ philosophy that treats human-readable architectural contracts (invariants,+ interfaces, and side effects in directory READMEs) as the primary system+ assets. These documentation files serve as structured guardrails for human+ reviewers and AI agents alike.+* **Metaphor Mapping**: In this context, both "Peanuts" and "Hay" refer to the+ generated directory-level `README.md` files:+ * **Peanuts**: The granular, leaf-level **Component Package READMEs**+ containing specific file contracts.+ * **Hay**: The parent-level **Repository Blueprints** that roll up child+ interface contracts to provide high-altitude indexes.++To ensure performance, efficiency, and robustness, the skill dynamically scales+its execution model based on the size of the target codebase:++1. **Incremental Scoping**: The Root Orchestrator maps the tree level-by-level+ using native filesystem APIs (`list_dir`). If the directory count exceeds+ scale limits during discovery, it pauses immediately to warn the user,+ preventing hangs on massive repositories.+2. **Sequential Execution (Small Trees)**: If the target has 5 or fewer+ subdirectories, the Root Orchestrator crawls and documents them sequentially+ in post-order, avoiding multi-agent coordination and startup overhead.+3. **Unbounded Parallel Swarm (Medium/Large Trees)**: If the target has more+ than 5 subdirectories, the Root Orchestrator partitions the tree and spawns+ parallel instances of the orchestrator agent itself (using the framework's+ `self` subagent type) as Sub-Orchestrators (one per sub-tree).+ * **Adaptive Depth Partitioning**: To prevent parallelization bottlenecks+ in repositories with a single nested source tree (e.g. `src/` or+ `java/`), the Root Orchestrator partitions using adaptive depth,+ descending levels of the discovery map until it splits the directories+ into balanced subtree branches.+ * **Unbounded Spawning upon Approval**: The Root Orchestrator removes+ artificial concurrency limits. If the directory count is large (> 5), it+ asks for user approval to spawn the required number of+ Sub-Orchestrators, and then spawns all of them in parallel.+ * **Direct Swarm Writing & Formatting**: Sub-Orchestrators process their+ subtrees in parallel, write or modify `README.md` files directly in+ their assigned folders, and format them using `mdformat`.+4. **Sequential Bottom-Up Processing**: Within each sub-tree, the+ Sub-Orchestrator documents subdirectories sequentially in post-order+ (deepest leaves first), spawning `goldfish-explorer` agents to summarize+ files. This guarantees that parent directories are documented only after+ their subdirectories are complete, preventing race conditions.+5. **Final Correctness Verification**: Before concluding work, the Root+ Orchestrator runs a final pass across all created and modified READMEs to+ verify DNC compliance, proper markdown formatting, valid relative+ links, and valid verification targets.+6. **Optional Drift Review**: The Root Orchestrator optionally prompts the user+ to run the EGM Drift Report on the generated README updates to ensure+ consistency against the codebase.++### 1.3 Goals++* **Automated Bootstrapping & Correction**: Recursively generate or correct+ DNC-compliant READMEs (`Interface`, `Invariants`, `Side Effects`) for any+ target source directory tree. Existing READMEs are corrected and updated+ without completely overwriting them.+* **Idempotent Sentinel-Block Upserting**: Guarantee zero loss of human+ operational documentation on existing `README.md` files by encapsulating+ auto-generated DNC contracts inside explicit HTML sentinel markers+ (`<!-- EGM_BLUEPRINT_START ... -->` / `<!-- EGM_BLUEPRINT_END -->`),+ preserving all human runbook content above the sentinels byte-for-byte+ across runs.+* **Markdown Formatting**: Ensure every modified or created README is+ properly formatted using markdown formatters.+* **Final Correctness Check**: Perform a final verification pass on all+ modified READMEs as a correctness check before concluding work.+* **Safe Scaling**: Handle deep/broad directory trees via dynamic user+ warnings, incremental BFS scoping, sub-tree partitioning, and unbounded+ parallel execution upon user approval.++### 1.4 Non-Goals++* **Code Generation**: The skill will not write or refactor any functional+ source code; it is strictly limited to documentation.+* **Non-Source Directories**: It will not document hidden system directories+ (e.g., `.git`, `.jj`, `.gemini`), build output paths, or dependency+ directories (e.g., `third_party`).++### 1.5 Critical User Journeys (CUJs)++#### CUJ 1: Bootstrap, Correct, Format, and Verify READMEs for a Directory Tree++* **Given**: A source directory tree (e.g., `src/` or `pkg/`) where+ subdirectories either lack a `README.md` file or contain incomplete legacy+ READMEs.+* **When**: The user runs the `egm-bootstrap` skill via the slash+ command `/egm-bootstrap <path>` (or harness-equivalent command / prompt)+ specifying the target root directory.+* **Then**:+ 1. The Root Orchestrator maps the tree incrementally.+ 2. If directory count <= 5, it processes them sequentially.+ 3. If directory count > 5, it partitions the tree adaptively, requests user+ approval, and spawns unbounded parallel worker instances of the+ orchestrator agent itself (`self` Sub-Orchestrators).+ 4. Sub-Orchestrators process their sub-trees bottom-up, spawning a+ `goldfish-explorer` agent for each directory node.+ 5. DNC-compliant `README.md` files are created or corrected, and formatted+ using `mdformat`.+ 6. The Root Orchestrator runs a final correctness check pass across all+ modified READMEs.+ 7. The user is optionally prompted to run a Drift Report on the updates.++--------------------------------------------------------------------------------++## 2. Technical Plan++### 2.1 Swarm Architecture & Roles++The `egm-bootstrap` skill utilizes exactly two agent configurations:++```mermaid+graph TD+ Root[Root Orchestrator] -->|list_dir BFS| Map[Directory Map]+ Root -->|Spawn Sub-Tree A| Worker1[Sub-Orchestrator A]+ Root -->|Spawn Sub-Tree B| Worker2[Sub-Orchestrator B]+ Worker1 -->|Seq: Leaf A.1| Exp1[Explorer: A.1 Directory]+ Worker1 -->|Seq: Parent A| Exp2[Explorer: A Directory]+ Root -->|Final Pass| Verify[Correctness Check & Format]+```++* **Node Orchestrator (`bootstrap-orchestrator`)**:+ * Implemented as a single agent configuration.+ * The **Root Instance** coordinates the pipeline: maps the tree+ incrementally, calculates count/depth, manages safety gates, manages+ unbounded parallel worker spawning upon user approval, documents+ remaining intermediate directories, compiles the final root README, and+ executes the final correctness check pass.+ * The **Worker Instances (Sub-Orchestrators)** are spawned by the Root+ Instance to process a specific top-level subdirectory tree. They walk+ their sub-tree sequentially bottom-up, spawning explorers, writing or+ modifying README files directly in the filesystem, and formatting them+ with `mdformat`.+* **`goldfish-explorer`**:++ * A read-only, dynamic scout agent.+ * **System Prompt**: > "You are a read-only codebase explorer. Your task+ is to analyze the source files in the target directory and return a+ concise, factual summary. Do not write or modify any files. Return a+ JSON object containing the directory's public symbols (interface),+ invariants, and side effects."+ * **Scout File Constraints**: The scout caps total data read per directory+ at **50,000 bytes** to prevent context window bloat. Implementation+ and schema files (e.g. `.cc`, `.py`, `.java`, `.go`, `.rs`, `.ts`) are+ read up to a maximum of **300 lines** per file. If a directory's size+ exceeds the 50KB limit, files are selected for reading based on the+ following priority list:+ 1. Interface, schema, IDL, and header files (e.g. `.h`, `.hh`, `.hpp`,+ `.proto`, `.graphql`, `.gql`, `.thrift`, `.prisma`, `.sql`+ schema/DDL definitions, interface classes) are read completely.+ 2. Module entry points (e.g., `main.*`, `index.*`, `lib.*`, `mod.*`,+ `__init__.py`, or files matching the directory name) are read up+ to 300 lines.+ 3. Production source and configuration files sorted alphabetically are+ read up to 300 lines until the byte cap is reached.+ 4. Test files are completely ignored during context loading.+ * **Output Schema**:++ ```json+ {+ "type": "object",+ "properties": {+ "interface": {+ "type": "array",+ "items": { "type": "string" }+ },+ "invariants": {+ "type": "array",+ "items": { "type": "string" }+ },+ "side_effects": {+ "type": "array",+ "items": { "type": "string" }+ }+ },+ "required": ["interface", "invariants", "side_effects"]+ }+ ```++### 2.2 Agent Reporting & Context Contracts++The communications follow a hierarchical reporting pattern:++1. **Explorer to Sub-Orchestrator**: `goldfish-explorer` analyzes all files in+ a directory and returns a structured JSON summary (interface, invariants,+ side effects) to its parent `bootstrap-orchestrator`.+2. **Parent Context Propagation**: When the Sub-Orchestrator processes parent+ directory `P`, it propagates the compiled interface summaries of its child+ subdirectories as prompt context when invoking the parent's+ `goldfish-explorer` scout. This enables the parent explorer to accurately+ summarize child interface boundaries.+ * *Propagating Heuristics*:+ 1. If the child directory was documented during this execution run, the+ Sub-Orchestrator retrieves its public interface directly from the+ in-memory execution cache (or worker JSON return payload), consuming+ the structured data directly.+ 2. If the child README was corrected/modified, the Sub-Orchestrator+ retrieves the updated symbols directly from the scout scan and+ legacy extraction.+3. **Child to Parent Orchestrator**: Subdirectories return their compiled+ README summary to the parent `bootstrap-orchestrator`, which uses this+ to document the parent's "Subdirectories" interface section.+4. **Worker to Root Orchestrator**: Sub-Orchestrators return their compiled+ subtree contract metadata to the Root Orchestrator using the structured JSON+ schema defined below.++#### 2.2.1 Worker Return Interface Schema++Sub-Orchestrator worker subagents report completed subtree structures using the+following schema:++```json+{+ "type": "object",+ "properties": {+ "subtree_index": {+ "type": "array",+ "items": {+ "type": "object",+ "properties": {+ "path": { "type": "string" },+ "summary": { "type": "string" },+ "interface": { "type": "array", "items": { "type": "string" } },+ "invariants": { "type": "array", "items": { "type": "string" } },+ "side_effects": { "type": "array", "items": { "type": "string" } }+ },+ "required": ["path", "summary"]+ }+ }+ },+ "required": ["subtree_index"]+}+```++### 2.3 Directory Filtering & Classification Rules++To prevent documenting empty directories and ensure the correct template is+selected, we enforce the following rules during directory discovery:++* **Non-Code Filtering**: To prevent documenting empty directories, any+ directory that contains no source code files AND contains no subdirectories+ with code is excluded. Because a top-down traversal cannot know if+ subdirectories contain code deeper down, pruning is executed as a+ **bottom-up post-processing pass** after the complete tree has been mapped+ in Phase A.+ * *Source Code Files*: Defined as files containing executable code,+ schemas, and contracts (e.g., `.c`, `.cc`, `.cpp`, `.cxx`, `.h`, `.hh`,+ `.hpp`, `.rs`, `.go`, `.zig`, `.lean`, `.java`, `.kt`, `.scala`, `.cs`, `.fs`,+ `.py`, `.rb`, `.php`, `.lua`, `.sh`, `.bash`, `.ts`, `.tsx`, `.js`,+ `.jsx`, `.mjs`, `.cjs`, `.swift`, `.m`, `.dart`, `.sql`, `.proto`,+ `.graphql`, `.gql`, `.thrift`, `.prisma`, `.tf`, `.hcl`, `.cue`).+ Excludes build manifests, lockfiles, test fixtures, documentation, and+ generic data dumps.+* **Test Directory Exclusion**: Any directory containing exclusively test code+ (e.g., folders named `tests`, `testing`, `testdata`, or containing only+ files matching `*_test.*` or `*Test.*`) is excluded from documentation+ during the pruning pass.+* **Test File Filtering**: In hybrid package directories containing both+ production and test files, the explorer scout filters out test files and+ ignores their public symbols during context scanning to prevent test+ fixtures from polluting the documented public interface.+* **Custom Exclusions**: The discovery loop supports custom ignore patterns.+ By default, it ignores hidden/system directories (`.git`, `.jj`, `.gemini`,+ `node_modules`). Additionally, it reads a local `.egmignore` file (if+ present) containing glob patterns to exclude custom folders (e.g.+ `*testdata*`, `*mocks*`, `third_party`).+* **Directory Classification**:+ * **Repository Root (Blueprint / Hay)**: The target root folder of the+ bootstrap execution is *always* classified as the Repository Root, even+ if it contains direct source files. It is documented using the+ "Repository Root README Template" (using the optional Local Interface+ section for files in the root folder).+ * **Component Package (Peanut)**: Any non-root directory containing direct+ source code files. If it also contains child subdirectories with code+ contracts, its README's `Interface` section will include relative links+ to the child subdirectories' contracts.+ * **Repository Blueprint (Hay)**: Any non-root directory containing *no*+ direct source code files, but containing subdirectories with code+ contracts (regardless of whether a `BUILD` file is present).++### 2.4 Document Templates++#### 📄 Component Package (Peanuts) README Template++Used for folders containing direct source files. Focuses on local module+contracts.++```markdown+# [Component Name]++## Overview+[Prose overview of the component's architectural role and goals]++## Interface+- [Public classes, functions, and symbols]+- [Subdirectories list and links to their contracts]++## Invariants+- [State and call invariants that must be preserved by developers/agents]++## Side Effects+- [State mutations, network calls, disk access, locks, or external side effects]++## Verification+- Build: `build //[package_path]...`+- Test: `test //[package_path]...`+```++#### 📄 Repository Root (Blueprint / Hay) README Template++Used for root directory nodes that coordinate child sub-trees.++```markdown+# [Repository Name] Blueprint++## System Overview+[High-altitude architectural overview of this subsystem]++[Optional section if the root directory contains direct source files]+## Local Interface & Invariants+- [Direct symbols, invariants, and side effects of files in the root folder]++## Subdirectories & System Boundaries+- [Subdirectory Name]: [Link to child README.md] - [Summary of child contract/role]++## Global Invariants+- [System-wide constraints that cross component boundaries]++## Global Side Effects+- [Shared resources, databases, or external integrations affected by this subsystem]++## System Verification+- Run: `test //[system_path]...`+```++#### 📄 Intermediate Blueprint README Template++Used for intermediate non-code directories that sit between the root and package+leaves (applicable to directories classified as Repository Blueprints that are+not the execution root).++```markdown+# [Directory Name]++## Overview+[Factual overview of the subdirectories and systems grouped under this directory path]++## Subdirectories & Boundaries+- [Subdirectory Name]: [Link to child README.md] - [Summary of child contract/role]+```++*Note: All subdirectory indexes in Hay templates must use relative paths (e.g.+`./subdir/README.md`) to maintain local rendering compatibility.*++### 2.5 Execution Pipeline++#### Phase A: Incremental Directory Scoping & Plan Definition++1. **Incremental BFS Discovery**: The Root Orchestrator maps the target tree+ level-by-level (BFS) using a directory queue and native `list_dir` tool+ calls, preserving intermediate folder nodes. **Symbolic links are ignored**+ during traversal to prevent infinite recursion and duplicate mapping.+2. **Safety Gate**: During the BFS loop, if the total running count of+ discovered directories exceeds **15**, the Root Orchestrator immediately+ pauses the discovery traversal and calls the `ask_question` tool to warn the+ user of the large execution scope and require confirmation before proceeding+ with further mapping or worker spawning.+3. **Bottom-up Post-Pruning Pass**: Once the mapping traversal is complete (and+ approved), the Root Orchestrator walks the mapped tree bottom-up (from+ leaves to root). It filters out hidden, system, build-output, test-only, and+ non-code directories according to the Filtering Rules.+4. Once the pruned tree is resolved, the Root Orchestrator calculates the+ maximum depth.+5. **Execution Strategy**:+ * **Sequential (Size <= 5)**: The Root Orchestrator executes the bottom-up+ documentation sequentially in a single thread.+ * **Parallel (Size > 5)**: The Root Orchestrator partitions the discovery+ map into independent subtree branches.+ * **Adaptive Depth Partitioning Algorithm**:+ 1. Set `depth = 1`.+ 2. Extract directory nodes from the discovery map located at the+ current `depth`.+ 3. If the count of nodes at `depth` is between 3 and 5: return+ these nodes as subtree partition roots.+ 4. If the count of nodes at `depth` < 3: increment `depth`, repeat+ step 2.+ 5. If the count of nodes at `depth` > 5: group the largest branches+ (measured by total nested folder count) into 3-4 separate+ partitions, combine the remaining small branches into a single+ fallback partition subtree, and return these partition root+ boundaries.+ 6. Fallback: If `depth` limit of 3 is reached and count is still <+ 3, return the immediate children of the root (or fall back to+ sequential execution).+ * It spawns a parallel worker (Sub-Orchestrator) for each partition+ subtree, passing parameters `is_worker: true` and `sub_tree_root:+ <path>` to the `self` subagent invocation.+ * **Unbounded Spawning upon Approval**: The Root Orchestrator removes+ artificial concurrency limits. If the directory count is large (> 5), it+ asks for user approval to spawn the required number of+ Sub-Orchestrators, and then spawns all of them in parallel.+6. **Conditional Branching Control**: The `egm-bootstrap` skill+ configuration (`SKILL.md`) checks these parameters at start:+ * If `is_worker` is false/unset: Executes the Root Orchestrator role (runs+ BFS mapping, safety gates, spawns workers, compiles the final blueprint+ README, and executes the final correctness check pass).+ * If `is_worker` is true: Skips Phase A and executes the Sub-Orchestrator+ role (processes the assigned `sub_tree_root` subtree bottom-up, spawning+ explorers, writing/modifying files directly, and formatting them with+ `mdformat`).++#### Phase B: Bottom-Up Bootstrapping++1. Under the parallel strategy, the Root Orchestrator spawns parallel+ `bootstrap-orchestrator` instances as Sub-Orchestrators, passing each+ its target sub-tree.+2. Each Sub-Orchestrator processes its sub-tree in post-order (deepest leaves+ first):+ * **Correction & Modification Policy**: Before generating documentation,+ the Sub-Orchestrator checks if `README.md` already exists in the active+ folder. If `README.md` exists, it does not overwrite it completely.+ Instead, it reads the existing content, spawns the `goldfish-explorer`+ scout to compile the true code contracts, and uses+ `replace_file_content` (or `write_to_file`) to correct and update the+ existing README to be DNC compliant while preserving developer notes and+ descriptions.+ * *Scout Scan Requirement*: Whether the README exists or not, the+ Sub-Orchestrator **always spawns** the `goldfish-explorer` scout to+ scan the source code in the directory and compile the true code+ symbol boundary.+ * *Legacy Symbol Extraction Prompt*: To parse pre-existing manual+ README files, the Sub-Orchestrator calls the reasoning LLM with the+ following extraction prompt: > "Analyze the following unstructured+ README.md content. Extract all public symbol names, classes,+ interfaces, invariants, and side effects. Format your response+ strictly as a JSON object matching the following schema: {+ \"interface\": string[], \"invariants\": string[], \"side_effects\":+ string[] }."+ * **Verification Command Target Lookup**: When generating the `##+ Verification` section, the Sub-Orchestrator checks if a `BUILD` file+ exists in the active folder. If present:+ * It checks if test files (matching `*_test.*` or `*Test.*`) are+ present. If test files exist, it writes the `Test:` command;+ otherwise it omits the test command.+ * If target names in the `BUILD` file are ambiguous or don't match the+ folder name, it falls back to building the entire package wildcard+ target: `build //[package_path]:all`.+ * If no local `BUILD` file exists: it scans the nearest ancestor+ `BUILD` file to locate targets whose `srcs` attribute references+ files in the active subdirectory (e.g. via direct path list or+ glob). If a matching target is found, it references that target+ (e.g., `build //[ancestor_path]:my_target`). If multiple+ targets match or no match is found, it falls back to the package+ wildcard target: `build //[ancestor_path]:all`. If no ancestor+ package is found, it omits the verification command.+ * *Starlark Parsing Fallback*: If the ancestor `BUILD` file contains+ complex Starlark macros or dependencies that cannot be resolved via+ file reading, the Sub-Orchestrator falls back to referencing the+ wildcard `:all` target of the ancestor package, or omits the target.+ * **Scout Definition & Spawning**: The Sub-Orchestrator dynamically+ declares the read-only `goldfish-explorer` subagent type using+ `define_subagent` if not already defined in its active session.+ * *Subagent Definition Arguments*:+ * `TypeName`: `goldfish-explorer`+ * `Role`: `goldfish-explorer`+ * `enable_write_tools`: `false`+ * `enable_subagent_tools`: `false`+ * `SystemPrompt`: As defined in Section 2.1.+ * It then spawns the scout sequentially for the active directory.+ * **Child Fault Tolerance**: If a child subdirectory fails to document+ (e.g., explorer timeout or tool error), the Sub-Orchestrator logs a+ warning, inserts a placeholder link (e.g. `- [Subdirectory Name]: [Link+ to child README.md] - (Details pending/documentation failed)`) in the+ parent's directory index, and continues documentation instead of+ aborting.+ * Generates or corrects `README.md` using the appropriate template+ depending on its classification (Component Peanut or Blueprint Hay;+ Blueprint Hay nodes use the "Intermediate Blueprint template" if they+ are not the execution root).+ * **Markdown Formatting**: Immediately after writing or correcting+ `README.md`, the Sub-Orchestrator executes+ `markdown formatter (e.g. prettier or markdownlint)`+ via `run_command` to ensure proper markdown formatting.+3. Once all parallel worker instances finish:+ * **Root Fault Tolerance**: If a parallel worker fails or times out, the+ Root Orchestrator logs a warning, inserts a placeholder warning link+ (e.g., `[Subtree Root] (Documentation failed / Subagent execution+ timeout)`) inside the root Blueprint's subdirectory index, and completes+ the remaining compilation.+ * **Intermediate Directory Documentation**: The Root Orchestrator+ identifies any intermediate directories sitting between the root and the+ partitioned subtree roots. It processes these intermediate directories+ sequentially bottom-up, generating Intermediate Blueprint READMEs using+ the compiled summaries returned by the workers, and formatting them with+ `mdformat`.+ * The Root Orchestrator checks if the root directory itself contains any+ direct source files. If present, it spawns a `goldfish-explorer` scout+ for the root directory to extract local symbols and invariants,+ appending them to the root README under the `## Local Interface &+ Invariants` section.+ * It compiles the final root `README.md` (Blueprint), writes it, and+ formats it with `mdformat`.+ * **Final Correctness Verification**: The Root Orchestrator performs a+ final verification pass across all created and modified READMEs in the+ `subtree_index` to verify EGM compliance (`Interface`, `Invariants`,+ `Side Effects`), proper markdown formatting, valid relative links+ (explicitly verifying referenced child README or SKILL files physically+ exist), and valid verification targets before concluding work.+ * **Optional Drift Review**: The Root Orchestrator calls `ask_question` to+ offer running the `egm-drift-report` skill on the generated updates to+ verify consistency with the codebase.+ * Terminates successfully.++### 2.6 Processing Tools++* **Directory Discovery**: Use native `list_dir` calls in a BFS loop+ (filtering out `.git`, `.jj`, `.gemini`, `third_party`, `node_modules`).+ BUILD files are preserved during discovery to extract build/test+ targets for the Verification template section.+* **Markdown Formatting**: Use `run_command` to execute+ `markdown formatter (e.g. prettier or markdownlint)` on+ every modified or created README.++### 2.7 Incremental Sentinel-Block Upsert Architecture++To safely run `egm-bootstrap` over directories that already contain+human-authored operational documentation (such as repository runbooks or oncall+metadata), the skill enforces **Idempotent Sentinel-Block Bootstrapping**:++1. **Sentinel Boundary Markers**: Every DNC block generated by+ sub-orchestrators or leaf workers is wrapped inside explicit HTML sentinel+ markers:++ * **Start Sentinel:** `+ <!-- EGM_BLUEPRINT_START: AUTO-GENERATED BY egm-bootstrap. PUT HUMAN NOTES ABOVE THIS LINE -->`+ * **End Sentinel:** `<!-- EGM_BLUEPRINT_END -->`++2. **Three-State Upsert State Machine**: When writing or updating+ `d/README.md`, workers execute:++```mermaid+flowchart TD+ A[Read d/README.md] --> B{File Exists?}+ B -- No --> C["Create file with sentinel-wrapped block"]+ B -- Yes --> D{"Contains <!-- EGM_BLUEPRINT_START -->?"}+ D -- Yes --> E["Replace substring [START, END] with new block"]+ D -- No --> F{"Contains '## Subdirectories & System Boundaries'?"}+ F -- Yes (Legacy DNC) --> G["Slice [0, HEADER_INDEX] as Human Preamble + Append Sentinel Block"]+ F -- No (Pure Human) --> H["Retain 100% Human Preamble + Append '\n\n' + Sentinel Block"]+ C --> I[Run markdown formatter on README.md]+ E --> I+ G --> I+ H --> I+```++--------------------------------------------------------------------------------++## 3. Alternatives Considered++### 3.1 Single-Agent Flat Crawler++Instead of a recursive swarm, we considered using a single agent that walks the+directory tree sequentially, reading files and updating READMEs as it goes.++* **Why Rejected**:+ * **Context Window Limits**: Walking a large directory tree sequentially+ accumulates too much token history, leading to context truncation and+ loss of precision.+ * **Execution Time**: Sequential execution is slower for deep or broad+ directory trees.+ * **Parallelism**: It cannot leverage parallel execution. The swarm model+ allows subagents to run in parallel, reducing execution time.++### 3.2 Direct Reuse of `growing-peanuts-and-hay` Skill++We investigated using the existing `growing-peanuts-and-hay` skill+(an internal prototype precursor)+directly.++* **Why Rejected**:+ * The skill is team-specific, sequential, and hardcoded to specific+ language conventions.+ * EGM requires a general-purpose, language-agnostic tool (supporting C++,+ Python, Java, etc.) that can scale to large repositories in parallel.+ * We chose to write `egm-bootstrap` to consolidate their DNC+ templates and bottom-up logic into a generic skill that supports+ parallel scaling via `self` workers.++--------------------------------------------------------------------------------++## 4. Detailed Implementation++All changes will be housed within the open-source repository structure:++### 4.1 Implementation Files++1. **`skills/egm_bootstrap/SKILL.md`**++ * **Rationale**: Defines the EGM workflow steps for the bootstrap process.+ * **YAML Frontmatter Input Schema**:++ ```yaml+ name: egm-bootstrap+ description: Bootstrap directory README.md files across a repository subtree.+ inputs:+ path:+ type: string+ description: The target root directory path to bootstrap.+ required: true+ is_worker:+ type: boolean+ description: Internal parameter. True if executing as a worker Sub-Orchestrator.+ default: false+ sub_tree_root:+ type: string+ description: Internal parameter. The root path of the assigned subtree partition.+ required: false+ ```++ * **`SKILL.md` Algorithmic Flow**:++ 1. **Startup Check**: Read `is_worker` parameter. If true, jump to step+ 6 (Worker Flow).+ 2. **BFS Scoping**: Run `list_dir` in a queue loop to map the directory+ tree, ignoring symlinks and `.egmignore` globs.+ 3. **Warning Gate**: If discovery count > 15, call `ask_question` and+ wait for user approval.+ 4. **Partitioning**: If count <= 5, document sequentially. Else, run+ Adaptive Depth Partitioning to divide the tree into balanced+ subtrees.+ 5. **Spawning**: Invoke `self` subagents in parallel upon user+ approval, passing `is_worker: true` and `sub_tree_root`. Jump to+ step 9.+ 6. **Worker Flow**: Declare the read-only `goldfish-explorer` subagent+ type dynamically at startup. Traverse the assigned subtree bottom-up+ (post-order).+ 7. **Explorer Scan & Formatting**: For each folder, check Correction &+ Modification Policy. Read existing README, spawn scout,+ correct/update the file to be DNC compliant using+ `replace_file_content` or `write_to_file`, and format it with+ a markdown formatter.+ 8. **Reporting**: Compile subtree index and return JSON (Worker+ Interface Schema) to the Root Orchestrator.+ 9. **Compilation & Final Verification**: The Root Orchestrator compiles+ child metadata (recovering from worker timeouts), runs a scout on+ the root folder files if present, writes the Blueprint README,+ formats it with a markdown formatter, performs a final correctness check pass+ across all modified READMEs, optionally prompts to run Drift Report,+ and exits.++2. **`skills/egm_bootstrap/TEST.md`**++ * **Rationale**: Lists verification and test scenarios for the bootstrap skill.++3. **`skills/egm_bootstrap/test_scenarios.yaml`**++ * **Rationale**: Automated integration tests evaluating bootstrap scenarios+ (small tree sequential execution, parallel subtree partitioning, and safety gates).++4. **`agents/bootstrap_orchestrator.md`**++ * **Rationale**: Defines the system prompt and instructions for the+ `bootstrap-orchestrator` persona.++--------------------------------------------------------------------------------++## 5. Non-Functional Requirements++### 5.1 Security & Privacy++* **Source Centric**: The scoping only reads source files. It must ignore+ hidden directories containing sensitive data (e.g., local credentials,+ `.git/` history).++### 5.2 Performance & Token Overhead++* **Swarm Concurrency**: Subagents should be invoked with `Workspace=inherit`+ to run in parallel.+ * **`Workspace=inherit`**: In the Antigravity framework, launching a+ subagent with `Workspace=inherit` instructs the system to share the+ parent's workspace directory directly with the subagent, rather than+ checking out a new isolated branch. This is required for parallel read+ operations as it avoids cloning overhead and ensures all subagents see+ the same local filesystem state.+* **VCS Isolation**: Sub-Orchestrator workers and explorers must perform no+ version control commands (e.g. `git add`, `git commit`). All filesystem+ changes are written locally. Tracking and submitting the generated+ `README.md` files is deferred to the parent EGM session framework or the+ user upon skill completion, avoiding concurrent VCS database locks.+* **Temporary File Isolation**: Parallel workers sharing the workspace must+ perform all status tracking, check-pointing, and log writing in independent,+ worker-specific directories using their unique `conversationId` under the+ application data directory (e.g.+ `<appDataDir>/brain/<conversation_id>/scratch/`). They must not write any+ temporary files inside the source repository workspace, leaving the+ source tree unmodified.+* **Antigravity Framework**: Antigravity is the agent SDK ecosystem and+ runtime framework for autonomous coding assistants.+* **Token Optimization**: Goldfish scouts are read-only, ephemeral, and only+ read single directories, preventing context window exhaustion on the+ orchestrator.+ * *Subagent Isolation vs. Direct File Reading*: Offloading file-level+ reading to specialized `goldfish-explorer` scouts keeps the+ Sub-Orchestrator's context window compact, as it only receives+ structured JSON summaries rather than raw code files. This reduces token+ overhead at the cost of subagent startup latency.+* **Warning Gate**: If directory count > 15, the user is prompted via+ `ask_question` to prevent unbounded execution and token waste on large+ repositories.++### 5.3 Risks & Mitigations++* **LLM Rate Limits**: Partitioning a broad repository tree could trigger too+ many concurrent API calls. This is mitigated by requiring explicit user+ approval before spawning unbounded parallel workers.+* **VCS Database Locks**: Mitigated by prohibiting workers and scouts from+ executing any VCS tracking/commit commands (`jj`/`g4`), deferring operations+ to EGM session completion.+* **State Collision on Shared Workspace**: Mitigated by storing execution+ checkpoints in worker-specific scratchpad directories under `<appDataDir>`,+ avoiding modifications to the workspace.+* **Worker failures leaving partial files**: Handled as an incremental+ progress feature. The Correction & Modification Policy preserves partial+ progress and corrects existing files on subsequent runs, allowing developers+ to resume execution without data loss.+* **Documentation Drift**: Bootstrapped READMEs can drift from the codebase+ over time. This is out of scope for the bootstrapping tool but should be+ resolved in future EGM plugins by running periodic EGM drift check tools+ (e.g. `egm-drift-report`).+* **Hallucination Risk**: Automated documentation of invariants and side+ effects can suffer from LLM hallucinations. The generated README files+ include standard verification commands (build/test targets) so users can+ build and execute the package code to verify functionality.++--------------------------------------------------------------------------------++## 6. Verification & Test Plan++### 6.1 Static Analysis & Skill Validation++Verification ensures the skill definition, frontmatter, heading hierarchy, and+sentinel blocks conform to EGM standards.++### 6.2 Integration Testing & Scenarios++Automated integration test suites in `skills/egm_bootstrap/test_scenarios.yaml` evaluate:++* `bootstrap_small_tree`: Verifies sequential execution for a tree with <= 5+ directories, ensuring it generates conforming Peanut and Hay READMEs,+ formats them, and runs a final correctness check pass.+* `bootstrap_parallel_tree`: Verifies unbounded parallel worker spawning upon+ user approval, child context propagation, direct filesystem+ writing/modifying, formatting, and final correctness verification.+* `bootstrap_safety_gate`: Verifies the warning gate triggers when the mapped+ directory count exceeds 15, pausing traversal and prompting the user.+* `bootstrap_incremental_sentinel_upsert`: Verifies that running+ `egm-bootstrap` against an existing `README.md` containing human+ operational notes preserves all human text above the sentinel block while+ updating the DNC contract below.diff --git a/distributions/claude/docs/designs/brainstorm.md b/distributions/claude/docs/designs/brainstorm.mdnew file mode 100644index 0000000..aef37fb--- /dev/null+++ b/distributions/claude/docs/designs/brainstorm.md@@ -0,0 +1,134 @@+# EGM Brainstorm: Zero-Doc Upstream Ideation & Multi-Lens Shootdown++* **Author:** Brian Suchy ([@briansuchy](https://github.com/briansuchy))+* **Status:** Current+* **Date:** 2026-07-31++--------------------------------------------------------------------------------++## Overview++The **EGM Brainstorm Skill** (`/egm-brainstorm`) is a fast way to validate+ideas. It is intended to be run early when a human doesn't know what solution+they want yet. It gives early access to a Goldfish swarm for "half-baked"+concepts and can be used before any formal design discussion begins.++## The Problem++Drafting formal technical design documents too early in the ideation cycle leads+to two major failure modes:++1. **Premature Commitment to Flawed Hypotheses**: When developers write full+ design documents for early-stage ideas, they invest significant effort+ specifying details for a premise that may be unnecessary.++2. Standard AI chat brainstorming without adversarial review runs the risk of+ sycophancy.++## System Architecture & Workflow++```mermaid+sequenceDiagram+ autonumber+ actor Human as Software Engineer+ participant Brainstorm as egm-brainstorm Skill+ participant Synth as Synthesizer Persona (Mode: BRAINSTORM)+ participant Swarm as 6-Lens Goldfish Swarm+ participant Artifact as Artifact: concepts_brief.md++ Human->>Brainstorm: /egm-brainstorm (Raw Feature Idea)+ loop Multi-Turn Chat Drilling+ Brainstorm->>Human: Open-ended probing questions (no multiple-choice modals)+ Human->>Brainstorm: Clarifications & constraints+ end+ Brainstorm->>Human: Summarize anchored hypothesis & confirm readiness+ Human->>Brainstorm: Confirm ready for shootdown+ Brainstorm->>Synth: invoke_subagent (Mode: BRAINSTORM, FeatureConcept)+ Synth->>Swarm: Parallel shootdown across 6 lenses+ Swarm-->>Synth: Raw critiques & feasibility risks+ Synth->>Artifact: write_to_file (concepts_brief.md)+ Synth-->>Brainstorm: send_message (Completion & artifact link)+ Brainstorm->>Human: Highlight top objections & invite iteration+ Human->>Brainstorm: Refine or handoff to /egm-draft+```++### 1. Step 1: Open-Ended Problem Drilling++* The skill deliberately avoids structured multiple-choice question modals+ (`ask_question`) during early ideation, forcing open-ended exploration in+ chat across multiple turns.+* Probes the root bottleneck, consuming systems, hard non-negotiable+ invariants, and explicit non-goals.+* Constructs a 2-3 sentence anchored hypothesis and requires explicit human+ approval before spawning the subagent swarm.++### 2. Step 2: The 6 Goldfish Brainstorming Lenses++The `synthesizer` persona spawns six concurrent Goldfish subagents to audit the+concept from distinct, conflicting perspectives:++| Lens / Persona | Core Objective | Key Question Challenged |+| :------------- | :------------- | :---------------------- |+| **1. Contrarian / YAGNI** | Complexity minimization | *Can existing libraries, APIs, or services solve this without new code?* |+| **2. Cost & Resource Economics** | Budget & infrastructure scaling | *What is peak QPS, memory footprint, storage load, or token cost at scale?* |+| **3. UX & Developer Ergonomics** | Usability & cognitive overhead | *Is the CLI/API intuitive? Are error messages actionable, or does it add developer friction?* |+| **4. Migration & Compatibility** | Rollout safety & version skew | *How do existing clients/data migrate? Does this break serialized formats or persistent storage?* |+| **5. Observability & SRE** | Telemetry & debuggability | *Are operations traceable with distributed tracing? Are monitoring metrics and alerts actionable for oncalls?* |+| **6. Tech Debt & Maintenance** | Long-term maintainability | *Does this introduce tightly coupled state machines that will become tech debt in 2 years?* |++### 3. Step 3: Synthesis into `concepts_brief.md`++The synthesizer consolidates the multi-lens feedback into `concepts_brief.md` in+the side-panel artifact directory or local workspace:++* Executive Summary & Problem Framing+* Multi-Lens Analysis & Risk Matrix+* Scope Boundaries (Goals vs. Non-Goals)+* Key Architectural Decisions++### 4. Step 4: Iterative Refinement & Handoff++The engineer reviews the brief, addresses key objections, and decides whether+to:++* Abandon the idea altogether.+* Continue refining the hypothesis with additional Goldfish shootdown passes.+* Transition into **`/egm-draft`** (when the concept is concrete and ready for+ formal design doc authoring).++## Implementation Files & Referenced Components++The brainstorm capability is implemented via its core skill definition and+delegates directly to the shared EGM subagent swarm and document standards:++### Core Skill Files++| File Path | Type | Purpose & Reason for Existence |+| :-------- | :--- | :----------------------------- |+| `skills/egm_brainstorm/SKILL.md` | Skill Definition | Implements `/egm-brainstorm` workflow, multi-turn open-ended drilling, shootdown delegation, and brief finalization. |+| `skills/egm_brainstorm/TEST.md` | Unit Tests | Verification test scenarios validating the brainstorm ideation and multi-lens critique flow. |+| `skills/egm_brainstorm/test_scenarios.yaml` | Evaluation Benchmark | Benchmark test suite evaluating brainstorm ideation and multi-lens critique flow. |++### Referenced Personas & Infrastructure Components++The ideation shootdown swarm relies on intermediate orchestration and+specialized Goldfish personas defined in `agents/` and document standards:++* **Intermediate Orchestration**:+ [`agents/synthesizer.md`](../../agents/synthesizer.md) (`Mode: BRAINSTORM`)+ coordinates the parallel fan-out and compiles `concepts_brief.md`.+* **6-Lens Goldfish Personas**:+ * [`agents/zoom_out.md`](../../agents/zoom_out.md): Contrarian / YAGNI Lens.+ * [`agents/design_critic.md`](../../agents/design_critic.md): Cost, Quota & Resource Economics Lens.+ * [`agents/comprehension.md`](../../agents/comprehension.md): UX & Developer Ergonomics Lens.+ * [`agents/implementation_readiness.md`](../../agents/implementation_readiness.md): Migration & Compatibility Lens.+ * [`agents/codebase_details.md`](../../agents/codebase_details.md): Codebase Grounding & Existing Reuse Lens.+ * [`agents/structural.md`](../../agents/structural.md): Maintainability & Tech Debt Lens.+* **Referenced Standards**: Evaluates concepts against+ [`zoom-out-standard.md`](../../resources/document_standards/zoom-out-standard.md)+ and [`heilmeier-standard.md`](../../resources/document_standards/heilmeier-standard.md).++## References++* Dave Rensin, [Elephants, Goldfish, and the New Golden Age of Software Engineering](https://medium.com/@drensin/elephants-goldfish-and-the-new-golden-age-of-software-engineering-c33641a48874) (Medium, 2026).+* DARPA, [The Heilmeier Catechism](https://www.darpa.mil/about/heilmeier-catechism).diff --git a/distributions/claude/docs/designs/draft.md b/distributions/claude/docs/designs/draft.mdnew file mode 100644index 0000000..b20bed0--- /dev/null+++ b/distributions/claude/docs/designs/draft.md@@ -0,0 +1,207 @@+# EGM Design Drafting: Specification Authoring & Semantic Boundaries++* **Authors:** Jim Quinn ([@quinnjim](https://github.com/quinnjim)), Elise Ewing ([@eewing314](https://github.com/eewing314))+* **Status:** Current+* **Date:** 2026-06-06++--------------------------------------------------------------------------------++## Overview++The **EGM Design Drafting Skill** (`/egm-draft`) converts the ideation+artifact (`concepts_brief.md` from `/egm-brainstorm` or discussion notes) into a+formal, living design document under `docs/designs/`. It drafts the document+iteratively section-by-section, gathering feedback at each stage before saving to+disk.++Crucially, it establishes **semantic boundaries** within the document to enable+downstream multi-agent reviews (`/egm-review`) and automated drift auditing+(`/egm-drift-report`).++## The Problem++Directly asking AI models to author a comprehensive technical design in a single+prompt produces severe quality issues:++1. **Monolithic Hallucination & Wall-of-Text Output**: Models output massive,+ unstructured markdown blobs directly into the chat pane, making review+ difficult and truncating technical depth.+2. **Premature Code Dumping**: Instead of focusing on architectural invariants,+ data flows, and file-level rationales, models generate raw, unmaintainable+ helper code.+3. **Lack of Semantic Structure for Downstream Tooling**: Without strict+ standardized section boundaries (e.g., distinguishing high-level goals from+ concrete implementation plans), automated reviewers cannot partition audit+ responsibilities.++## Design Principles++* **Section-by-Section Iterative Drafting**: Drafts are authored incrementally+ (Overview & Goals -> Architecture & Diagrams -> Alternatives ->+ Implementation Plan), requesting user feedback between sections.+* **Artifact-First Delivery**: All drafting state is rendered into side-panel+ artifacts (`design_draft.md`) or persistent workspace files. Printing large+ drafts directly to the chat stream is strictly prohibited.+* **Semantic Split by Design**: Drafts are partitioned into a high-level+ conceptual section (`FeatureRange`) and a concrete execution section+ (`DetailedRange`) to facilitate targeted downstream Goldfish reviews.+* **Exhaustive File & Rationale Enumeration**: The implementation plan must+ enumerate every file to create, modify, or delete, accompanied by an+ architectural rationale, without generating raw source code.+* **Provenance Watermarking**: Finalized documents append a standardized+ provenance watermark footer to track AI authoring state.++## System Architecture & Workflow++```mermaid+sequenceDiagram+ autonumber+ actor Human as Software Engineer+ 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++ Note over Human,Draft: Step 1: Predecessor Context Ingestion+ Human->>Draft: /egm-draft+ Draft->>Summary: Read concepts_brief.md & verify consensus++ Note over Human,Draft: Step 2, 3, 4: High-Level Sections (FeatureRange)+ Draft->>DraftArtifact: Draft Overview, Problem Statement & Goals+ Draft->>DraftArtifact: Append Architecture, Data Flow & Mermaid Diagrams+ Draft->>DraftArtifact: Append Alternatives Considered & Trade-offs+ Draft->>Human: Request Feedback on High-Level Sections++ Note over Human,Draft: Step 5: Detailed Implementation (DetailedRange)+ Draft->>DraftArtifact: Append Detailed Implementation Plan (Files & Rationales)+ 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->>DraftArtifact: Append Watermark Footer+ Draft->>Workspace: Write docs/designs/<FEATURE>.md+ Draft->>Human: Provide link to spec & recommend /egm-review+ Human->>Review: /egm-review docs/designs/<FEATURE>.md+```++--------------------------------------------------------------------------------++## The Drafting Protocol (`/egm-draft`)++The `/egm-draft` workflow converts the ideation artifact into a living+markdown design doc:++### Step 1: Predecessor Context Ingestion++Parses `concepts_brief.md` (or `discussion_summary.md` / feature notes) from the artifact directory (falling back to the+scratch directory or workspace root if needed) and verifies user consensus.++### Step 2: Overview, Problem & Goals++Drafts the user-facing problem statement, business value, goals, and non-goals+in `design_draft.md`.++### Step 3: Technical Plan & Architecture++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).++### Step 5: Detailed Implementation Plan++Drafts the execution section:++* Unified checklist of every file to create, modify, or delete.+* Explicit architectural rationale for each file change.+* **No implementation code**: Includes only schemas, type definitions, and+ pseudocode.++### Step 6: Finalization, Formatting & Registration++* Performs a final self-evaluation against+ [`zoom-out-standard.md`](../../resources/document_standards/zoom-out-standard.md).+* Appends a standardized provenance watermark footer (*`*Drafted with EGM*`*)+ separated by a horizontal rule delimiter (`--------------------------------------------------------------------------------`)+ after trailing open questions.+* Writes the document to `docs/designs/<FEATURE>.md`.+* Registers the document in `docs/designs/README.md` if present.+* Formats markdown using standard markdown formatters.+* Outputs a clickable link and instructs the user to run `/egm-review`.++--------------------------------------------------------------------------------++## Semantic Boundary Discovery++EGM design documents are deliberately structured to enable the downstream+Goldfish review engine to parse the document into two semantic zones:++1. **Feature Range (`FeatureRange`)**: Lines 1 through the header boundary.+ Contains the high-level problem statement, goals, architecture, and+ alternatives. Audited by the **Design Critic** (`egm_design`) and+ **Comprehension Reviewer** (`egm_comprehension`).+2. **Detailed Range (`DetailedRange`)**: From `## Detailed Implementation Plan`+ to EOF. Contains file targets, schemas, and test plans. Audited by the+ **Implementation Readiness Reviewer** (`egm_implementation_readiness`) and+ **Codebase Details Auditor** (`egm_codebase_details`).++Standardizing on the `## Detailed Implementation Plan` header allows automated+boundary discovery without requiring manual line range configuration. Terminal+footer watermarks (`*Drafted with EGM*`) residing at EOF are treated+as inert structural metadata and excluded from requirement audits during review+and drift analysis.++## Provenance Watermarking++To support lightweight provenance tracking and human inspection, all design+`/egm-draft` specs include a footer watermark:++```markdown+--------------------------------------------------------------------------------++*Drafted with EGM*+```++* **Delimited EOF Placement**: Appended at the absolute end of the document,+ separated from trailing sections (`### Open Questions`) by a horizontal+ line.+* **Best-Effort & Forward-Looking**: Applies strictly to newly drafted or+ updated specifications moving forward; no retroactive migration sweeps or+ blocking presubmits are imposed on legacy documents.++--------------------------------------------------------------------------------++## Standards Alignment++Read the linked standard for its requirements.++| Authoring Step | Governing Standard |+| :------------- | :----------------- |+| Architecture Outline | [Zoom-out standard](../../resources/document_standards/zoom-out-standard.md) |+| Document Structure | [Feature specification standard](../../resources/document_standards/feature-spec-standard.md) |+| Detailed Plan | [Implementation readiness standard](../../resources/document_standards/implementation-readiness-standard.md) |++--------------------------------------------------------------------------------++## Implementation Files++The drafting capability is implemented across the following skill and reference files:++| File Path | Type | Purpose & Reason for Existence |+| :-------- | :--- | :----------------------------- |+| `skills/egm_draft/SKILL.md` | Skill Definition | Implements `/egm-draft` section-by-section markdown compilation, sitemap registration, and formatting. |+| `skills/egm_draft/TEST.md` | Unit Tests | Verification test scenarios validating the drafting and finalization workflow. |+| `skills/egm_draft/test_scenarios.yaml` | Evaluation Benchmark | Co-located behavioral eval suite evaluating model adherence to the drafting protocol. |+| `skills/egm_draft/references/design_doc.md` | Document Template | Canonical markdown design document template defining required sections and layout. |+| `resources/execution_instructions.md` | Execution Instructions | Core execution rules enforcing no-code guardrails, silent compliance, and one-question-at-a-time pacing. |++--------------------------------------------------------------------------------++## References++* Dave Rensin, [Elephants, Goldfish, and the New Golden Age of Software Engineering](https://medium.com/@drensin/elephants-goldfish-and-the-new-golden-age-of-software-engineering-c33641a48874) (Medium, 2026).+* GitHub, [GitHub Flavored Markdown Spec](https://github.github.com/gfm/).diff --git a/distributions/claude/docs/designs/drift_report.md b/distributions/claude/docs/designs/drift_report.mdnew file mode 100644index 0000000..fe679ee--- /dev/null+++ b/distributions/claude/docs/designs/drift_report.md@@ -0,0 +1,123 @@+# EGM Drift Detection Protocol (Living Specifications & Code Synchronization)++* **Author:** Jim Quinn ([@quinnjim](https://github.com/quinnjim))+* **Status:** Current+* **Date:** 2026-06-07++--------------------------------------------------------------------------------++## Overview++The **EGM Drift Detection Skill** (`/egm-drift-report`) audits checked-in design+documents under `docs/designs/` and package `README.md` hierarchies against+source code to identify and report architectural divergence.++It is intended to be incorporated as a ritual by teams practicing EGM to keep+their design documents in sync with their feature implementations.++## The Problem++Documentation drift, particularly when paired with AI tooling, has these+problems:++1. **Stale Context**: Without a system to keep them up to date, quick+ point-fixes or untracked refactors leave designs outdated. When a human or+ AI agent consults an outdated spec to design a new feature, they make flawed+ assumptions that lead to broken implementations.++2. **Silent Architectural Rot**: Without automated verification, differences+ between the intended design and actual code (e.g., hardcoded bypasses+ instead of dynamic resolvers) accumulate unnoticed until production+ incidents occur.++3. **Human Fatigue**: Manually cross-referencing multi-page design docs against+ dozens of implementation files is tedious and rarely performed consistently.++## System Architecture & Workflow++```mermaid+sequenceDiagram+ autonumber+ actor Human as Software Engineer / Gardener+ participant DriftSkill as egm-drift-report Skill+ participant DesignDir as docs/designs/ Directory+ participant Codebase as Live Codebase+ participant Artifact as Artifact: {YYYY-MM-DD}_DRIFT_REPORT.md++ Human->>DriftSkill: /egm-drift-report [path/to/designs]+ DriftSkill->>DesignDir: List all design specifications+ loop For Each Design Document (Sequential)+ DriftSkill->>DesignDir: Read doc & extract symbols, files, APIs+ DriftSkill->>Codebase: Locate source files & inspect current state+ DriftSkill->>DriftSkill: Compare design vs reality (Detect divergence)+ DriftSkill->>Artifact: Append findings under ## <DOC_NAME>+ end+ DriftSkill->>Human: Deliver consolidated drift report artifact+ Human->>Codebase: Reconcile drift (Update code OR update doc)+```++--------------------------------------------------------------------------------++### Drift Detection Heuristics++The drift skill audits code against four core divergence categories:++| Divergence Category | Description | Example Reportable Drift |+| :------------------ | :---------- | :----------------------- |+| **Missing Features** | Logic or components described in the design but completely absent in source code. | A scheduled cleanup task specified in the design doc was never implemented in the service binary. |+| **Incomplete Models** | Structs, schemas, dataclasses, or classes missing fields specified in the design. | A model schema in the design defines 5 fields, but the code implementation only has 3. |+| **Logic Shortcuts** | Hardcoded values, mock fallbacks, or bypasses where dynamic logic was designed. | A dynamic quota lookup was designed, but the code uses a hardcoded constant `DEFAULT_QUOTA = 100`. |+| **Architectural Divergence** | Code implemented using different design patterns, frameworks, or dependencies than planned. | The design specified using gRPC service endpoints, but the implementation uses custom HTTP handlers. |++--------------------------------------------------------------------------------++### Execution Protocol++1. **Intake & Discovery**: Identifies target design folder (`docs/designs/`)+ or package tree (`README.md`).+2. **Sequential Processing**: Audits documents one-by-one to prevent tool+ buffer overflows and context degradation.+3. **Source Grounding**: Resolves referenced classes, endpoints, and files via+ code search and file viewing tools. If a document references unlinked symbols,+ the report prompts the engineer to add explicit links for cheaper future scans.+4. **Difference Filtering**: Reports **ONLY** actionable discrepancies. If the+ implementation matches the design completely, it outputs `"No drift detected."`+5. **Artifact Output**: Formats all results into `{YYYY-MM-DD}_DRIFT_REPORT.md`+ using strict markdown headings:++ ```markdown+ ## <DESIGN_DOC_NAME>++ * [Divergence item 1 with file:line reference]+ * [Divergence item 2]+ <!-- Or "No drift detected." -->+ ```++--------------------------------------------------------------------------------++### Operational Maintenance Cadence++To keep documentation living and trustworthy, we recommend (but do not enforce)+the following:++* **Weekly Gardener Rotation**: Teams running EGM incorporate+ `/egm-drift-report` into their weekly build gardener or oncall checklist.+* **Two-Way Reconciliation**: Every drift detected is actionable:+ * *If the code change was intentional*: Update the design document to+ reflect reality.+ * *If the design was violated*: File an issue or prompt an agent to complete+ the missing implementation.++## Implementation Files++The drift detection skill is implemented across the following files:++| File Path | Type | Purpose & Reason for Existence |+| :-------- | :--- | :----------------------------- |+| `skills/egm_drift_report/SKILL.md` | Skill Definition | Implements `/egm-drift-report` sequential document scanner, divergence heuristics analyzer, and report generator. |+| `skills/egm_drift_report/TEST.md` | Unit Tests | Verification test scenarios testing drift detection heuristics and report generation. |+| `skills/egm_drift_report/test_scenarios.yaml` | Evaluation Benchmark | Benchmark test suite evaluating drift detection accuracy and false-positive filtering. |++## References++* Dave Rensin, [Elephants, Goldfish, and the New Golden Age of Software Engineering](https://medium.com/@drensin/elephants-goldfish-and-the-new-golden-age-of-software-engineering-c33641a48874) (Medium, 2026).diff --git a/distributions/claude/docs/designs/releases.md b/distributions/claude/docs/designs/releases.mdnew file mode 100644index 0000000..3141a1b--- /dev/null+++ b/distributions/claude/docs/designs/releases.md@@ -0,0 +1,78 @@+# Versioned runtime releases++Status: Draft. Maintainer scope approval and design review are pending.+Author: @n3wth. Date: 2026-10-24.++Related issue: #124. Proposed implementation: #128, dependent on #120.++## Problem and scope++Users need identifiable archives built from a reviewed commit. Prepare a draft+release with source identity and checksums, then verify its exact artifacts+before publication.++Reuse the [runtime packaging design](runtime_packaging.md). Do not create tags+automatically, publish automatically, run paid models in CI, or add host support.++## Version and artifact contract++Use the root plugin version as canonical. Require matching Claude and Codex+manifest versions. Accept `vMAJOR.MINOR.PATCH` tags without leading zeroes.+Never reuse a published version for changed artifacts.++The proposed `scripts/prepare_release.py` accepts `--tag`, `--commit`, and+`--output`. Require a full source SHA and a new output directory. Produce:++- `egm-claude-VERSION.zip`+- `egm-openai-VERSION.zip`+- `SHA256SUMS`+- `RELEASE_NOTES.md`, containing the source SHA, tag, and verification limits++Local invocation validates the supplied values and builds archives. It does+not prove Git ancestry or run tests. The workflow owns those checks.++## Workflow and permissions++Dispatch the workflow manually from `main` with an existing version tag. Resolve+the tag to a commit and require that commit to be an ancestor of `main`. Check+out that commit, run offline tests, and prepare its archives.++The build job has read-only repository permission. A separate draft job receives+the artifacts, verifies their checksums, rechecks tag identity, and creates a+draft with contents-write permission. Duplicate release creation fails without+replacing existing assets. Neither job creates tags or publishes releases.++## Acceptance and release procedure++1. Obtain scope approval for #124 and merge the reviewed design.+2. Merge #120 after its design approval and renewed implementation review.+3. Retarget #128 to `main`, refresh validation, and merge after approval.+4. Select the reviewed version and commit. Regenerate packaged content and+ validate all included runtime changes before a maintainer creates the tag.+5. Dispatch the workflow. Inspect both archives, checksums, and source identity.+6. Complete #60 for each claimed host using these exact artifacts. Record+ installed-file identity, host/model versions, date, and separate installation,+ workflow, and isolation results.+7. Review final release notes and publish manually. Directory approval remains+ separate from release publication.++Test version mismatch, malformed tags and source IDs, archive contents,+checksums, overwrite refusal, and generated freshness. Lint the workflow and+validate its first real dispatch before accepting release preparation as done.++Reuse historical host evidence only with an explicit explanation of its+applicability. Do not present old candidate results as fresh artifact passes.+Keep cloud support partial while #105 and #106 retain evidence gaps.++## Failure handling and alternatives++Leave a failed or unverified candidate unpublished. Build retries use a fresh+local output directory. Do not replace a published archive or move its tag;+prepare a corrected version instead.++Hand-built releases can omit validation or source identity. Automatic publication+would remove the final evidence review. A validated draft preserves that review+without duplicating the package builder.++This draft does not establish maintainer approval or claim an EGM design-review+run. The issue remains open until the release workflow is validated.diff --git a/distributions/claude/docs/designs/review.md b/distributions/claude/docs/designs/review.mdnew file mode 100644index 0000000..8559c56--- /dev/null+++ b/distributions/claude/docs/designs/review.md@@ -0,0 +1,182 @@+# EGM Goldfish Review Protocol & Resolution Engine++* **Authors:** Brandon Tearse ([@tearseb](https://github.com/tearseb)), Brian Suchy ([@briansuchy](https://github.com/briansuchy)), Sean Stappas ([@seanstappas](https://github.com/seanstappas))+* **Status:** Current+* **Date:** 2026-06-10++--------------------------------------------------------------------------------++## Overview++The **Goldfish Review Protocol** is the verification engine of the Elephant &+Goldfish Model (EGM). It stress-tests draft design specifications using+isolated, zero-context AI subagents ("Goldfish") evaluating the document against+strict qualitative rubrics.++This document specifies:++1. The multi-stage review pipeline (`/egm-review`).+2. The review orchestration driver (`egm_review_loop`).+3. The complete catalog of specialized reviewer personas.+4. The mapping to document standards and evaluation rubrics+ (`resources/document_standards/`).+5. The interactive resolution engine (`egm_resolve`).++## The Problem++Self-review by the authoring LLM suffers from severe confirmation bias. When the+same context window drafts and reviews a plan:++1. **Blind Spots Persist**: The model assumes the context it holds in memory is+ obvious from the text, overlooking unstated assumptions and undefined terms.+2. **Hallucination Masking**: Invalid API assumptions made during discussion go+ untested against actual source code.+3. **Premature Implementation Approval**: Implementation plans lacking concrete+ file paths or test strategies are rubber-stamped without scrutiny.++The Goldfish model mitigates this by spawning fresh, stateless subagents that+read only the target document and explicitly referenced source files.++## Review Pipeline Architecture (`/egm-review`)++The full review pipeline executes five sequential evaluation phases:++```mermaid+flowchart TD+ Start([Target Design Doc]) --> Step5[Step 5: Zoom Out Review]+ Step5 --> Gate5{Pass / Abort?}+ Gate5 -- Abort --> FixArch[Refactor Architecture]+ Gate5 -- Pass --> Step6[Step 6: Comprehension Test]+ Step6 --> Gate6{Gaps Found?}+ Gate6 -- Yes --> UpdateContext[Clarify Definitions / Context]+ Gate6 -- No --> Step7[Step 7: Critic Review]+ Step7 --> Loop7[egm_review_loop: design_critic + structural + style]+ Loop7 --> Resolve7[egm_resolve]+ Resolve7 --> Step8[Step 8: Intermediate Zoom Out Review]+ Step8 --> Gate8{YAGNI / Bloat Found?}+ Gate8 -- Yes --> PruneBloat[Prune Defensive Over-Engineering]+ Gate8 -- No / Resolved --> Step9[Step 9: Implementation Readiness Test]+ Step9 --> Loop9[egm_review_loop: implementation_readiness + codebase_details + style]+ Loop9 --> Resolve9[egm_resolve]+ Resolve9 --> Done([Ready for Human Peer Review])+```++### Stage Breakdown++1. **Step 5: Zoom Out Review (Altitude Check)**:+ * *Target*: Full Document.+ * *Persona*: [`zoom_out`](../../agents/zoom_out.md) (Skeptical Architect).+ * *Standard*: `zoom-out-standard.md`.+ * *Focus*: Validates problem framing, rejects speculative features+ (YAGNI), and verifies reuse of existing infrastructure before investing in+ detailed review passes.+2. **Step 6: Comprehension Test (Self-Containment Check)**:+ * *Target*: `FeatureRange` vs `DetailedRange`.+ * *Persona*: [`comprehension`](../../agents/comprehension.md) (Naive Reader).+ * *Standard*: Baseline Self-Containment.+ * *Focus*: Reads the document with zero prior context. Identifies missing+ prerequisites, unexplained acronyms, and conceptual gaps.+3. **Step 7: Critic Review (Antagonistic Stress-Test)**:+ * *Target*: `FeatureRange` (High-Level Architecture).+ * *Personas*: [`design_critic`](../../agents/design_critic.md),+ [`structural`](../../agents/structural.md), [`style`](../../agents/style.md).+ * *Standards*: `feature-spec-standard.md`, `heilmeier-standard.md`.+ * *Focus*: Probes single points of failure (SPOFs), scaling limits,+ failure modes, and edge cases.+4. **Step 8: Intermediate Zoom Out Review (Post-Critic Pruning)**:+ * *Target*: Full Document.+ * *Persona*: [`zoom_out`](../../agents/zoom_out.md) (Skeptical Architect).+ * *Standard*: `zoom-out-standard.md`.+ * *Focus*: Incremental audit focusing on additions, modifications, and+ defensive mitigations introduced during Comprehension and Critic+ reviews. Purges speculative complexity and YAGNI elements before task+ planning, while avoiding re-flagging decisions accepted in Step 5.+5. **Step 9: Implementation Readiness Test (Actionability Check)**:+ * *Target*: `DetailedRange` (`## Detailed Implementation Plan`).+ * *Personas*: [`implementation_readiness`](../../agents/implementation_readiness.md),+ [`codebase_details`](../../agents/codebase_details.md), [`style`](../../agents/style.md).+ * *Standards*: `implementation-readiness-standard.md`, `re-implementation-standard.md`.+ * *Focus*: Verifies that every file touched is listed with rationale, API+ signatures match current codebase reality, and step-by-step test plans exist.++--------------------------------------------------------------------------------++## Reviewer Persona Catalog++All reviewer persona prompts reside under [`agents/`](../../agents/):++| Persona File | Role Title | Core Responsibilities |+| :----------- | :--------- | :-------------------- |+| [`agents/zoom_out.md`](../../agents/zoom_out.md) | Skeptical Architect | Audits for over-engineering, YAGNI, and unneeded complexity. Searches codebase for existing utilities to prevent reinvention. |+| [`agents/comprehension.md`](../../agents/comprehension.md) | Naive Reader | Assumes no prior knowledge. Identifies undefined jargon, assumed system context, and missing architectural diagrams. |+| [`agents/design_critic.md`](../../agents/design_critic.md) | Analytical Design Critic | Evaluates system reliability, scale limits, operational risks, failure recovery, and trade-off justification. |+| [`agents/implementation_readiness.md`](../../agents/implementation_readiness.md) | Tech Lead Auditor | Ensures implementation plans contain unambiguous, deterministic instructions, complete file lists, and verification steps. |+| [`agents/codebase_details.md`](../../agents/codebase_details.md) | Codebase Auditor | Cross-references referenced paths, classes, and function signatures against live source code to prevent drift and hallucinated APIs. |+| [`agents/structural.md`](../../agents/structural.md) | Layout Validator | Enforces standard heading hierarchy, table formatting, and document template conformance. |+| [`agents/style.md`](../../agents/style.md) | Technical Copy Editor | Strips conversational filler, enforces factual, objective tone, and ensures adherence to concise technical writing standards. |+| [`agents/synthesizer.md`](../../agents/synthesizer.md) | Review Synthesizer | Spawns reviewers in parallel, deduplicates findings, formats file links, and writes consolidated report artifacts. |++--------------------------------------------------------------------------------++## Document Standards & Rubrics (`resources/document_standards/`)++Reviewers evaluate drafts against the versioned standards listed in the+[shared runtime resources](../../resources/README.md). Read the actual standard+for its requirements. The stage breakdown above maps each review to its+standards; it does not replace those rubrics.++--------------------------------------------------------------------------------++## The Interactive Resolution Engine (`egm_resolve`)++When Goldfish reviewers complete their audit, the **Elephant Resolution Engine**+ingests the flat findings list and manages interactive triage.++### 1. Evaluation & Categorization++For each finding, the Elephant determines:++* **`PROPOSE FIX`**: The critique is valid. Generates exact replacement+ strings or structural edits.+* **`CONTEST`**: The critique is invalid or based on a misunderstanding. Cites+ concrete codebase evidence defending the current text.++### 2. User Triage Modes++The engineer reviews `goldfish_review_report.md` via four interaction modes:++* **Auto Accept**: Batch-applies all `PROPOSE FIX` suggestions and skips+ `CONTEST` items.+* **Interactive Breakdown**: Sequential, item-by-item chat walkthrough with+ detailed explanations and overrule capabilities.+* **Artifact Comments**: Inline comments on the artifact parsed and applied by+ the Elephant. (Recommended)+* **Wildcard Requests**: Pauses the review to answer ad-hoc questions or run+ exploratory commands before resuming triage.++### 3. Iteration & Checkpoint Gating++After fixes are applied, the loop presents a mandatory checkpoint asking the+user whether to run another review pass or complete the workflow. The process+concludes when zero blocking findings remain or the engineer halts the loop.++## Implementation Files++| File Path | Type | Purpose & Reason for Existence |+| :-------- | :--- | :----------------------------- |+| `skills/egm_review/SKILL.md` | Skill Definition | Entry point orchestrating the multi-stage review pipeline (Zoom Out $\rightarrow$ Comprehension $\rightarrow$ Critic $\rightarrow$ Intermediate Zoom Out $\rightarrow$ Readiness). |+| `skills/egm_review/TEST.md` | Unit Tests | Verification test scenarios testing `/egm-review` multi-stage flow and checkpoint gating. |+| `skills/egm_review/test_scenarios.yaml` | Evaluation Benchmark | Benchmark test suite evaluating model review precision and recall. |+| `skills/egm_review_loop/SKILL.md` | Skill Definition | Central review driver managing asynchronous subagent spawning and findings collection. |+| `skills/egm_review_loop/TEST.md` | Unit Tests | Verification test scenarios testing goldfish review loop dispatch. |+| `skills/egm_review_loop/test_scenarios.yaml` | Evaluation Benchmark | Benchmark test suite evaluating goldfish review loop dispatch. |+| `skills/egm_resolve/SKILL.md` | Skill Definition | Elephant resolution engine managing `CONTEST` vs `PROPOSE FIX` triage and automated fixes. |+| `skills/egm_resolve/TEST.md` | Unit Tests | Verification test scenarios validating the finding categorization and resolution loop. |+| `skills/egm_resolve/test_scenarios.yaml` | Evaluation Benchmark | Benchmark test suite evaluating model resolution and fix proposal accuracy. |+| `agents/*.md` | Persona Prompts | System prompt instructions for all 7 Goldfish reviewers and the Synthesizer. |+| `resources/document_standards/*.md` | Document Standards | Evaluation rubrics and standards for feature specs, implementation readiness, and simplicity. |++## References++* Dave Rensin, [Elephants, Goldfish, and the New Golden Age of Software Engineering](https://medium.com/@drensin/elephants-goldfish-and-the-new-golden-age-of-software-engineering-c33641a48874) (Medium, 2026).+* DARPA, [The Heilmeier Catechism](https://www.darpa.mil/about/heilmeier-catechism).diff --git a/distributions/claude/docs/designs/runtime_packaging.md b/distributions/claude/docs/designs/runtime_packaging.mdnew file mode 100644index 0000000..5929555--- /dev/null+++ b/distributions/claude/docs/designs/runtime_packaging.md@@ -0,0 +1,75 @@+# Runtime packaging++Status: Draft. Maintainer scope approval and design review are pending.+Author: @n3wth. Date: 2026-10-24.++Related issues: #121 and #122. Proposed implementation: #120.++## Problem and scope++Users need runtime packages with the resources required by each host. A full+repository archive also contains development files and website assets.++Build Claude and OpenAI runtime packages from one source tree. Preserve normal+user-controlled permissions. Do not add new hosts, services, or automatic+permission approval. Package validation does not establish directory approval+or runtime support.++## Package contract++Use `scripts/pack_plugin.py`, proposed in #120, as the single builder.+`--target claude|openai` selects the host. `--output` selects a new destination.+Produce an `egm-TARGET` folder and an `egm-TARGET.zip` archive.++Allowlist manifests, skills, references, personas, native adapters, required+documentation, licenses, and image assets. Include SVG and PNG files under+`docs/assets` for README images. Exclude website content, tests, workflows,+hooks, development marketplace metadata, and unrelated files.++Reject symlinks, paths outside the source tree, missing required files,+unbundled manifest references, hooks, and unsupported MCP or app dependencies.+Refuse an existing output folder or archive. A failed build can leave partial+output; diagnose the failure and use a new destination for the next attempt.++Sort archive entries and use fixed timestamps and file modes. Verify identical+bytes under the same build environment. Do not claim reproducibility across+untested toolchain versions.++Generate `distributions/claude` from the same builder. Compare every path and+byte against a fresh build in unit tests. Regenerate it when included source+files change. Do not edit generated files independently.++## Permissions and host boundaries++Remove the automatic permission-approval hook. Keep bounded tools on Claude+native adapters. Resource reads use normal host permissions. A denied read+must stop the affected reviewer without a fabricated verdict.++Test parent-context isolation separately from filesystem access and host-added+instructions or memory. A Claude CLI probe does not establish Cowork behavior.+OpenAI packaging does not establish support for every ChatGPT mode.++## Validation and rollout++- Test required content, image inclusion, exclusions, unsafe paths, missing+ references, overwrite refusal, reproducibility, and generated freshness.+- Verify allowed and denied resource reads against the generated runtime.+- Record the source SHA, installed artifact identity, host/model version,+ and separate installation, workflow, and isolation outcomes.+- Preserve the evidence gaps tracked in #105 and #106.+- Obtain scope approval and merge this design before merging #120.+- Coordinate tagged artifacts through the [release design](releases.md).++Directory publication in #121 and #122 remains separate. Confirm the owning+account, policy links, publisher authority, and provider findings before+submission. Close those issues only after verifying the published listing.++## Alternatives and open decisions++Separate hand-maintained packages would drift. A full repository ZIP includes+unneeded development content. A shared allowlist keeps package boundaries+explicit and reviewable.++Maintainers must confirm whether #121/#122 provide the packaging approval path+or identify another aligned issue. This draft does not imply that approval or+an EGM design-review run has occurred.diff --git a/distributions/claude/docs/designs/synthesizer.md b/distributions/claude/docs/designs/synthesizer.mdnew file mode 100644index 0000000..69e4bb4--- /dev/null+++ b/distributions/claude/docs/designs/synthesizer.md@@ -0,0 +1,120 @@+# EGM Synthesizer Persona (Swarm Orchestration & Output Aggregation)++* **Author:** Brian Suchy ([@briansuchy](https://github.com/briansuchy))+* **Status:** Current+* **Date:** 2026-07-31++--------------------------------------------------------------------------------++## Overview++The **EGM Synthesizer Persona** (`synthesizer`) is an intermediate+orchestration layer, responsible for starting multiple subagents and+deduplicating feedback across them. It is used to consolidate feedback across+the various subagents started by EGM skills and prevent context window bloat in+runtimes that support nested subagents (e.g., Antigravity).++## The Problem++Directly managing a multi-agent review swarm from the primary user conversation+has challenges:++1. **Context Pollution & Token Bloat**: Spawning 6 to 12 parallel reviewers+ directly in the root session floods the primary context window with+ thousands of tokens of raw, verbose tool outputs and intermediate subagent+ chatter, degrading the model's reasoning capacity.+2. **Redundant & Overlapping Critiques**: Multiple reviewers examining the same+ document frequently identify the same underlying issue from slightly+ different perspectives (e.g., structural vs. design). Unfiltered output+ overwhelms the human engineer with duplicate findings.+3. **Inconsistent Link Formatting**: Stateless subagents often construct+ inconsistent or broken relative file links.+4. **Chat Stream Interruption**: Dumping raw review traces into the user chat+ violates the Artifact-First UX principle.++## System Architecture & Dataflow++```mermaid+sequenceDiagram+ autonumber+ participant Elephant as Root Elephant Context+ participant Synth as Synthesizer Persona (Intermediate Orchestrator)+ participant Swarm as Goldfish Swarm (A/B Parallel Subagents)+ participant Artifact as Artifact File (goldfish_review_report.md)++ Elephant->>Synth: invoke_subagent (TargetFile, Reviewers, Standards)+ Note over Synth: Inspect Mode: REVIEW vs BRAINSTORM+ Synth->>Swarm: invoke_subagent (Concurrent A/B Subagents)+ Note over Swarm: Independent Audits in Zero-Context Windows+ Swarm-->>Synth: Return raw findings & critiques+ Note over Synth: Deduplicate, Triage (Blocker/Major/Nit), Normalize Links+ Synth->>Artifact: write_to_file (goldfish_review_report.md)+ Synth-->>Elephant: send_message (Completion summary & artifact link)+```++## Operating Modes++The synthesizer operates in two distinct modes depending on the invocation+context:++### 1. `Mode: REVIEW` (Document Audit)++* **Redundant Subagent Spawning (A/B Sampling)**: Launches two independent+ instances of each requested reviewer (e.g., `Hostile Design Critic A` and+ `Hostile Design Critic B`) to maximize finding recall and eliminate+ non-deterministic evaluation gaps.+* **Role Title Enforcement**: Subagent roles are strictly suffixed with+ `Auditor`, `Reviewer`, or `Critic` for clear observability in execution+ dashboards.+* **Severity Triage**: Categorizes all aggregated findings into three tiers:+ * 🔴 **Blocker**: Architectural flaws, unaddressed SPOFs, missing file+ targets, or unresolvable dependencies.+ * 🟡 **Major**: Incomplete error handling, unstated scaling assumptions, or+ missing verification plans.+ * 🟢 **Nit**: Minor clarity issues, terminology inconsistencies, or+ formatting discrepancies.+* **Link Normalization**: Constructs clean markdown links for all referenced+ lines: `[path:Lstart-end](path#Lstart-Lend)`.+* **Artifact Emission**: Writes the consolidated report to+ `goldfish_review_report.md` (or `zoom_out_report.md` /+ `comprehension_report.md`).++--------------------------------------------------------------------------------++### 2. `Mode: BRAINSTORM` (Concept Ideation)++* **6-Lens Swarm**: Spawns parallel brainstormers across six perspectives:+ `Skeptical Architect`, `Codebase Grounding Auditor`, `UX & Ergonomics`,+ `Naive Comprehension`, `Implementation Feasibility`, and `Structural+ Design`.+* **Concept Synthesis**: Aggregates divergent ideas, highlights hidden risks,+ identifies existing infrastructure reuse opportunities, and compiles a+ unified `concepts_brief.md` artifact.++--------------------------------------------------------------------------------++## Inter-Agent Communication Contract++1. **Input Parameters**:+ * `TargetFile`: Absolute path to target document.+ * `LineRange`: Target line bounds (or `full file`).+ * `Reviewers`: Array of reviewer persona shortnames.+ * `Standards`: Key-value mapping of reviewers to standard markdown files.+ * `GoldfishContext`: Supplementary reading list for reviewer baseline.+2. **Output Contract**:+ * The synthesizer must never output the full report text in chat or via+ `send_message`.+ * It writes the report to disk using file-writing tools.+ * It returns a single message via `send_message` containing:+ * Total count of findings by severity.+ * Clean link to the generated artifact.++## Implementation Files++| File Path | Type | Purpose & Reason for Existence |+| :-------- | :--- | :----------------------------- |+| `agents/synthesizer.md` | Persona Prompt | System prompt, tool permissions, and operational logic for the `synthesizer` orchestration persona. |++## References++* Dave Rensin, [Elephants, Goldfish, and the New Golden Age of Software Engineering](https://medium.com/@drensin/elephants-goldfish-and-the-new-golden-age-of-software-engineering-c33641a48874) (Medium, 2026).diff --git a/distributions/claude/docs/faq.md b/distributions/claude/docs/faq.mdnew file mode 100644index 0000000..80a7593--- /dev/null+++ b/distributions/claude/docs/faq.md@@ -0,0 +1,62 @@+# FAQ++#### Q: Are there alternatives?++**A**: Yes. Many.++EGM is one of the ways teams are making LLMs work better. It is not *the* way.+There are others with different trade-offs. Regardless of the tool you choose,+please remember: *You own the outcomes.*++#### Q: What concrete artifacts does the EGM process produce?++**A**: EGM produces three core deliverables:++* **Design Document**: A peer-reviewed technical specification that captures+ intent, system invariants, and strategic direction.+* **Implementation checklist**: Identifies the files to create or modify,+ the planned changes, and how to verify them.+* **Enriched Context Loops**: Colocated Markdown documentation (such as README+ hierarchies) that provides high-quality context for future development+ loops.++#### Q: Will SWEs become obsolete under EGM?++**A**: In our opinion? No. However, code generation will be increasingly+delegated to automated agents, shifting human engineering focus toward governing+intent and reviewing architectural decisions captured in design documents.++#### Q: Will the increased volume of design documentation create a human review bottleneck?++**A**: It can. Reviewing designs adds work, and excessive documentation can+become a bottleneck. The aim is to catch important problems before implementation;+whether that saves time depends on the change and the quality of the review.++We recommend putting an emphasis on prioritization, at least for now. Use EGM+for "What's important now?", instead of everything, to avoid overloading your+reviewing and release pipelines.++#### Q: Does this workflow degrade developer velocity?++**A**: It depends. Design and review take time and may not pay off for a small,+well-understood change. For uncertain or consequential changes, they may reduce+rework by exposing missing decisions earlier.++Compare total time, useful findings, and rework on your own tasks. Completing+the EGM workflow alone does not demonstrate a productivity improvement.++#### Q: Is expecting design documentation to be complete enough for a zero-context agent realistic?++**A**: Sometimes, but not always. EGM's approach captures strategy and an+execution plan, with Goldfish agents improving the quality, but LLMs are still+non-deterministic.++You need to use your judgment the same way you would for coaching a new software+engineer. If it is making a minor mistake, adjust it. If it is wildly off base,+maybe you need to go back to the drawing board and correct your design. This is+part of the process and gets easier the more you use it.++#### Q: Should I open big pull requests?++**A**: No. Generally, the answer for this (and many other questions) is "The+answer is the same as when you built things without AI."diff --git a/distributions/claude/docs/getting_started.md b/distributions/claude/docs/getting_started.mdnew file mode 100644index 0000000..688b4d0--- /dev/null+++ b/distributions/claude/docs/getting_started.md@@ -0,0 +1,149 @@+# EGM Setup & Workflow Guide++## Background++The **Elephant-Goldfish Model (EGM)** is an implementation of Spec-Driven+Development (SDD) based on Dave Rensin's foundational article+[Elephants, Goldfish, and the New Golden Age of Software Engineering](https://medium.com/@drensin/elephants-goldfish-and-the-new-golden-age-of-software-engineering-c33641a48874).++A general recommendation: start with the core philosophy before diving into the+tools. Going through the conversational sequence once or twice, especially if+you are unfamiliar with LLMs, will expose you to LLM quirks and develop your+intuition for using them.++If you do nothing else with EGM, do that a few times to see if you're getting+better responses out of the LLMs than you were before. Other than your time,+it's free, you don't have to install anything, and the instructions are labeled+1 to N.++If you like what that's doing for you, you'll start to notice some things. You+won't like copy-pasting your prompts all the time. You'll see some repetition+and wish the LLM could just do steps 1 to X on its own. The EGM framework is a+result of that. A bunch of people that practiced it for a while noticed some+emerging patterns and tried to make it easier to get started with fewer steps.++## Runtime Setup++The EGM skills and personas are packaged as a plugin for **Antigravity**, **Claude Code**, **Claude Cowork**, **OpenAI Codex**, and **ChatGPT Work** (see [Harnesses](harnesses.md) for installation instructions).++1. **Skills**: The skills in `skills/` can be installed via the plugin/extension+ manifest or invoked via slash commands (e.g. `/egm-brainstorm`,+ `/egm-draft`, `/egm-review`).+2. **Personas**: The prompts in `agents/` define isolated system instructions+ for subagents.++## Main Workflow++While EGM has a "main workflow", this process is not a prescription. The skills+are designed to be fluid. You can and should reach for them out of order if that+suits your needs.++The general goal is to have:++* Code that does what you want+* Documentation that explains why the code exists the way it does++You may find yourself going back and forth between skills to solve your problem+at hand, and this is encouraged. Do not forcibly use the design-first process if+you believe you can one-shot a simple bug fix. Use the right tool for the job.++Use whichever skill serves your immediate bottleneck.++### Core Loop++The "core" workflow looks like:++1. **`/egm-brainstorm`**: Start an upstream ideation session. This command+ prompts the developer to clarify the concept, then spawns a 6-lens Goldfish+ swarm to stress-test the concept and generate a structured `concepts_brief.md`+ artifact.++2. **`/egm-draft`**: Drafts a design doc. This command turns a concept brief or+ initial idea into a formal markdown design doc under `docs/designs/`, section+ by section.++3. **`/egm-review`**: Reviews a design with **Goldfish**. Performs a+ multi-stage review of a design doc in a fresh, zero-context session to+ validate its completeness, clarity, self-containment, and readiness.++ This will provide *a lot* of feedback by design. Take what you think is+ relevant. Ignore the rest.++4. **Human Review**: Send a Pull Request with your design to another human. EGM+ does not replace human oversight, but encourages it. Human reviews are+ essential for ensuring long-term product consistency and prioritization.++5. **Implement**: Tell AI to build to the plan. The instructions on how to+ implement it should be in your design doc. If the LLM makes a minor mistake,+ feel free to fix it yourself, or ask the LLM to make point fixes. If it is+ wildly off, update the design doc and try again.++ > NOTE: Every team is going to have different skills that are relevant to+ > their implementation phase. Readability and style guides, profiling tools,+ > testing strategies, etc. EGM is not opinionated here. Add your skills to+ > your implementation plan!++## Drift Detection++To ensure that your design specifications and active codebase remain+synchronized over time, EGM provides a drift detection skill:++* **`/egm-drift-report`**: Scan your design directory and referenced code for+ drift. Any detected divergence should be reconciled. Either update the doc,+ or the code. Human picks which.++We recommend running this once per week. If you have a regular maintenance+rotation, incorporating this as a weekly ritual is useful.++## Bootstrapping Existing Codebases++### Structure++We recommend EGM project directories look something like this:++```text+path/to/project+├── _agents/ # (optional, but recommended)+│ └── skills+│ └── <project>_elephant # Custom skill to load project context.+│ └── SKILL.md+└── docs/+ └── designs/ # EGM design directory+ ├── SITEMAP.md # An index of design artifacts+ └── FEATURE.md # A detailed design specification+```++### Bootstrapping++`/egm-bootstrap <path/to/project>` automatically generates, formats, and+performs a first-pass verification of READMEs across a directory tree to+establish codebase context. Humans should still review this output. It does this+using a bottom-up, recursive summarization process:++1. **Leaf Directories**: For each leaf directory, generate a `README.md` that+ explains the directory's purpose and documents the function of each file.++2. **Parent Directories**: Move up the tree recursively, generating parent+ `README.md` files by summarizing the subdirectories' READMEs.++3. **Root Directory**: Compile the root `README.md` to provide a complete,+ high-level map of the system's architecture.++The structured context hierarchy lets Elephants navigate codebases more easily.+EGM prefers humans having control of these outputs, which is why this skill+exists. If all of your design artifacts already reference all the code, READMEs+may be unnecessary.++### Project Context Skill (Optional)++You can create a custom `<project>-elephant` skill specifically for your+project. This skill does not need to be complicated. It should tell the LLM+about your project, and give it links to the context you think is most relevant.+That's all.++This skill can be a handy way to give LLMs references to code paths, documents,+and important designs quickly.++As your codebase grows and more design documents are archived, this context+loader allows the Elephant to retrieve relevant architectural history, enabling+more informed design discussions and precise feature implementations.diff --git a/distributions/claude/docs/harnesses.md b/distributions/claude/docs/harnesses.mdnew file mode 100644index 0000000..c81cf0e--- /dev/null+++ b/distributions/claude/docs/harnesses.md@@ -0,0 +1,113 @@+# Harnesses++EGM is one set of skills and personas. This repository serves as the+plugin source for each supported harness. No harness gets a fork of the skill+text.++## Install++| Harness | Install |+| --- | --- |+| Antigravity | `agy plugin install https://github.com/google/elephant-goldfish-model` (or `/plugin` in the IDE) |+| Claude Code | `claude plugin marketplace add google/elephant-goldfish-model && claude plugin install egm@egm` |+| Claude Cowork | Install from claude.ai/plugins or the Cowork plugin panel via marketplace `google/elephant-goldfish-model` |+| Codex | `codex plugin marketplace add google/elephant-goldfish-model && codex plugin add egm@egm` |+| ChatGPT | Personal testing: Plugins > Add > Upload plugin archive; see [packaging](codex.md#chatgpt). Workspace import: Admin > Plugins > Add > Import marketplace, repo URL `https://github.com/google/elephant-goldfish-model`, path `.agents/plugins` |++Install the whole plugin. Skill-only installers that copy `skills/` alone+break EGM, because the skills read `agents/` and+`resources/document_standards/` at run time.++## Manifests++Root `plugin.json` is the canonical source for plugin identity, version,+description, and publisher metadata. It declares the portable Agent Plugins+1.0.0 schema. Update shared values there first, then update the compatibility+manifests; unit tests reject metadata drift. Keep platform-specific fields in+their existing manifests until installation tests justify removing them.++Marketplace files are discovery catalogs pointing to this package, not copies+of its skills. In particular, `.agents/plugins/` contains the Codex catalog,+while `agents/` contains reviewer personas. All hosts share the same `skills/`,+`agents/`, and `resources/` content.++| Harness | Manifest | Skills | Subagents |+| --- | --- | --- | --- |+| Antigravity | `plugin.json` | `skills/` (default) | `agents/` (default) |+| Claude Code | `.claude-plugin/plugin.json`, `.claude-plugin/marketplace.json` | `skills/` (default) | Claude adapters and orchestrators listed in `plugin.json` `agents` |+| Claude Cowork | `.claude-plugin/plugin.json`, `.claude-plugin/marketplace.json` | `skills/` (default) | Subagents run inside Cowork; hooks n/a |+| Codex | `.codex-plugin/plugin.json`, `.agents/plugins/marketplace.json` | `skills` path | Not shipped; general-purpose subagent reads the persona file |+| ChatGPT | `plugin.json`, `.codex-plugin/plugin.json`; `.agents/plugins/marketplace.json` for workspace import | `skills` path | Detect native tools in the current session; general-purpose agent reads the persona |++Persona prompts live in `agents/`, the directory Antigravity+scans for subagents. Each persona has `name` and `description` frontmatter, so+harnesses that load `agents/*.md` register them as named subagents+(`egm-design`, `egm-zoom-out`, and so on).++When you add a reviewer persona, add a Claude adapter under+`.claude-plugin/agents/` and list it in `.claude-plugin/plugin.json`.+The adapter reads the shared persona and sets Claude's read-only tools and+context isolation. This avoids imposing Claude tool names on other hosts.++## Delegation++Skills say "spawn a subagent" and name a persona. Each harness maps that+phrase to its own tool:++| Harness | Subagent tool | Named personas | Nesting |+| --- | --- | --- | --- |+| Antigravity | `invoke_subagent` | Yes | Yes |+| Claude Code | Agent (Task) tool | Yes | Up to 3 levels by default |+| Claude Cowork | Cowork subagents | Yes | Subagents run inside Cowork |+| Codex | Native spawn/wait tools; inspect the available schema | No | Detect at runtime; direct dispatch fallback |+| ChatGPT | Native spawn/wait tools when exposed by the current Work session | No | Detect at runtime; direct dispatch fallback |++Where a harness has no named persona, the skill spawns a general-purpose+subagent and tells it to read `agents/<file>.md` first. If a harness cannot+nest subagents, use direct dispatch instead of the synthesizer.++A Goldfish review needs a fresh context. If a harness has no subagent tool,+the review skills stop instead of running in the same context. Check actual+tool availability rather than inferring it from the product name. This applies+to ChatGPT modes that do not expose native fresh-context delegation.++## Artifact Directory++Skills write briefs, drafts, and reports to the working directory, or to the+harness's artifact directory if it has one. In Claude Code, Claude Cowork,+Codex, and ChatGPT, you can name another folder. Add this line to your prompt,+or to an agent instructions file that your harness loads (`CLAUDE.md` or+`AGENTS.md`, in the project or at user level):++```text+EGM artifact directory: .dev/docs+```++A relative path is relative to the working directory. Design docs and other+project files do not move. Claude Code reads a project `AGENTS.md` only when+the project has no `CLAUDE.md`. To keep the files out of git, add the folder to+`.gitignore`.++## Support Status & Contributing Other Harnesses++**Antigravity**, **Claude Code**, and **Codex** pass automated installation, reviewer isolation, and end-to-end workflow fixtures.++**Claude Cowork** ([#105](https://github.com/google/elephant-goldfish-model/issues/105)) and **ChatGPT Work** ([#106](https://github.com/google/elephant-goldfish-model/issues/106)) have working installation paths with open cloud trace verification gaps.++See the [harness test record](../TESTING.md#harness-test-record) for tested surfaces and limits.++We welcome contributors who want to help verify and expand harness support.++### Contributing Support for New Harnesses++A harness counts as supported after `/egm-brainstorm`, `/egm-draft`, and+`/egm-review` run end to end through its plugin install. When contributing+support for another harness:++1. Add the appropriate manifest or configuration file to the repository root+ (e.g., matching the harness's plugin/extension standard).+2. Document install steps, manifest mapping, and delegation mechanics in this guide+ (`docs/harnesses.md`).+3. Verify that `/egm-brainstorm`, `/egm-draft`, and `/egm-review` run end to end,+ and attach verification notes or execution transcripts in your Pull Request description+ (as outlined in the [Pull Request Template](../.github/PULL_REQUEST_TEMPLATE.md)).diff --git a/distributions/claude/docs/index.md b/distributions/claude/docs/index.mdnew file mode 100644index 0000000..db7e27e--- /dev/null+++ b/distributions/claude/docs/index.md@@ -0,0 +1,106 @@+# Elephant-Goldfish Model (EGM)++## Find the right document++| Location | Purpose |+| --- | --- |+| [Getting started](getting_started.md) and [FAQ](faq.md) | Installation and everyday use. |+| [Harnesses](harnesses.md), [Claude](claude.md), and [Codex](codex.md) | Host-specific installation and execution. |+| [Design documents](designs/README.md) | Architecture, workflow rationale, and implementation plans. |+| [Shared runtime resources](../resources/README.md) | Authoritative execution rules and review standards. |+| [Testing playbook](../TESTING.md) | Commands and evidence requirements. |+| [PR #103 verification reports](https://github.com/google/elephant-goldfish-model/pull/103) | Detailed harness results and known verification gaps. |++`docs/` explains the system to contributors and users. `resources/` contains+rules that the runtime reads. Link to those rules when explaining them here;+keep requirements in their canonical resource files.++AI has changed software development. Everything is different now and we all know+it.++The **Elephant-Goldfish Model** (EGM) is one way teams are adapting to the+change. It is a protocol for shipping high quality software quickly, wrapped in+a metaphor to make it easy to remember. Dave Rensin's article,+[Elephants, Goldfish, and the New Golden Age of Software Engineering](https://medium.com/@drensin/elephants-goldfish-and-the-new-golden-age-of-software-engineering-c33641a48874),+goes into this in depth. If you haven't read that, start there!++## Elephant-Goldfish Philosophy++### The Elephant++The **Elephant** remembers everything.++Sometimes we want LLMs to know all about our systems. Their history, the user+journeys, the logical components, and so on. And we want to be able to discuss+how all this fits together naturally.++That isn't possible by looking at code alone. We need to make all of this+information available to LLMs in a way they can navigate cheaply. When we do,+we can ask questions, challenge assumptions, and force ourselves to justify+decisions fast, which makes changing the system that much easier.++When we give LLMs access to a context-rich description of our systems and ask+them to explore our problems, we call that an **Elephant**.++### The Goldfish++**Goldfish** have three-second memories [^not-really].++LLMs are not deterministic. Sometimes they hallucinate, resulting in plans or+code that is obviously broken. Trusting LLMs to build our systems without+checking for hallucinations is a recipe for a bad time.++Naively, we could have humans review every change. It works, but it is+expensive and quickly becomes a bottleneck. Another way is to have one LLM+review another. If we ask LLMs to review plans, code, or other artifacts+*without* access to how those things were generated, we reduce hallucinations.++When we ask LLMs to review output this way, limiting the context they have+access to, we call that a **Goldfish**.++### The Humans++Imagine you have to say this to your manager: *"Sorry! My AI tool just pushed+broken code to production..."*. It's not the tool that did that, it was you that+did that.++Or maybe a different scenario: *"The AI did my project! Promote me!"*. This is+just as silly.++AI is a tool, not a decision-maker. Developers must actively guide design+discussions, challenge suggestions, and make decisions rather than letting AI+drive.++EGM leans into this: **Humans** own the outcomes.++### Benefits++EGM emphasizes learning how to use LLMs as a tool and explains how to navigate+their strengths and weaknesses.++* **Velocity Gains:** Features ship faster. Front-loading alignment into design+ specifications significantly reduces downstream rework and review comment+ loops.+* **Accuracy:** Investment in front-loaded design discussions creates deep,+ verified guidelines that reduce LLM hallucinations. Being specific and+ detailed about exactly what we want to be implemented gives AI an explicit+ reference to check against.+* **Team Benefits:** Project handoffs, onboarding, issue triage, and all the+ other human processes that may require a whiteboard get easier. When LLMs+ know where features are, how they're built, and the intent behind them,+ humans can learn about and contribute to systems quickly.++## Documentation & Guides++* [Getting Started](getting_started.md): Installation and core workflow.+* [Codex](codex.md): Plugin installation and native workflow verification.+* [Claude Code](claude.md): Plugin resources and isolated reviewers.+* [Frequently Asked Questions (FAQ)](faq.md): Common questions and answers.+* [Framework Architecture](designs/architecture.md): Detailed component+ design and lifecycle.+* [Contributing Guidelines](../CONTRIBUTING.md): How to contribute new skills,+ personas, and standards.++[^not-really]: It's a+ [myth](https://www.biology.ox.ac.uk/article/goldfish-show-a-keen-ability-to-estimate-distances)+ that Goldfish have three-second memories. But that would ruin the metaphor!diff --git a/distributions/claude/docs/privacy.md b/distributions/claude/docs/privacy.mdnew file mode 100644index 0000000..a48c5af--- /dev/null+++ b/distributions/claude/docs/privacy.md@@ -0,0 +1,45 @@+<!-- Copyright 2026 Google LLC. SPDX-License-Identifier: Apache-2.0 -->++# EGM data handling++EGM is a set of skills, reviewer instructions, and local documentation workflows.+The runtime package does not operate a hosted service, database, analytics client,+or telemetry endpoint. It does not require a separate EGM account or credentials.++## Inputs and outputs++The host assistant reads the project files, design documents, prompts, and review+context supplied for the selected task. Those inputs can contain personal or+confidential information. Provide only the files needed for the review.++EGM writes briefs, design documents, README files, and review reports to the user's+workspace or the host's artifact storage. Outputs can repeat information from+the inputs. Local files persist until the user deletes them; EGM does not apply+an automatic retention period.++## Processing and external services++The selected host processes prompts, files, model responses, and agent activity+under that host's own account settings, terms, and privacy policy. Native agent+calls use the user's host account. EGM does not control host transcript, artifact,+backup, or model-provider retention.++Bootstrap can run local discovery commands and an existing project-configured+formatter. A formatter or other user-approved project command may contact a+package registry or another service. Inspect and authorize those commands using+the host's permission controls. EGM's runtime declares no MCP server and installs+no permission-approval hook.++## Development tools++The source repository also contains opt-in integration tests. When explicitly+enabled, they invoke host CLIs and inspect transcripts produced by their own test+sessions to verify reviewer isolation. They are excluded from runtime release+packages. Website and development tooling are also excluded.++## Questions++Use the [issue tracker](https://github.com/google/elephant-goldfish-model/issues)+for general questions. Do not include credentials, private documents, or personal+data in public reports. This notice describes the plugin's data flow; it does+not replace the privacy policies of the host or services the user invokes.diff --git a/distributions/claude/plugin.json b/distributions/claude/plugin.jsonnew file mode 100644index 0000000..350b87a--- /dev/null+++ b/distributions/claude/plugin.json@@ -0,0 +1,31 @@+{+ "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",+ "name": "egm",+ "version": "0.1.0",+ "description": "Elephant-Goldfish Model: spec-driven development with deep-context drafting and zero-context Goldfish reviews.",+ "author": {+ "name": "Google LLC"+ },+ "homepage": "https://egm.dev",+ "repository": "https://github.com/google/elephant-goldfish-model",+ "license": "Apache-2.0",+ "extensions": {+ "com.openai": {+ "requires_local_executor": true,+ "interface": {+ "displayName": "Elephant-Goldfish Model",+ "shortDescription": "Draft and stress-test specs",+ "longDescription": "Draft software specifications, stress-test them with fresh-context Goldfish reviewers, resolve findings, and check implementation drift. EGM includes seven skills for developers working in a local codebase. It reads project files and writes design documents and review reports. Bootstrap can run local shell commands. Reviews require native subagents with fresh context; the workflow stops if the host cannot provide isolation. Model calls use your host account's quota. Cloud harness verification remains partial; see TESTING.md. This is not an officially supported Google product.",+ "developerName": "Google LLC",+ "category": "Developer Tools",+ "capabilities": ["Draft specifications", "Review designs", "Check implementation drift"],+ "websiteURL": "https://egm.dev",+ "supportURL": "https://github.com/google/elephant-goldfish-model/issues",+ "privacyPolicyURL": "https://github.com/google/elephant-goldfish-model/blob/main/docs/privacy.md",+ "termsOfServiceURL": "https://github.com/google/elephant-goldfish-model/blob/main/LICENSE",+ "composerIcon": "./assets/icon.svg",+ "logo": "./assets/icon.svg"+ }+ }+ }+}diff --git a/distributions/claude/resources/README.md b/distributions/claude/resources/README.mdnew file mode 100644index 0000000..753fbd4--- /dev/null+++ b/distributions/claude/resources/README.md@@ -0,0 +1,16 @@+# Shared runtime resources++These files are the authoritative instructions and rubrics loaded by EGM+skills and reviewers. Update the rules here; link to them from human guides+instead of maintaining separate summaries of their requirements.++- [Execution instructions](execution_instructions.md)+- [Feature specification standard](document_standards/feature-spec-standard.md)+- [Heilmeier standard](document_standards/heilmeier-standard.md)+- [Implementation readiness standard](document_standards/implementation-readiness-standard.md)+- [Re-implementation standard](document_standards/re-implementation-standard.md)+- [Zoom-out standard](document_standards/zoom-out-standard.md)++For installation, usage, and design rationale, see the+[documentation index](../docs/index.md). Workflow definitions live in+[`skills/`](../skills/), and reviewer personas live in [`agents/`](../agents/).diff --git a/distributions/claude/resources/document_standards/feature-spec-standard.md b/distributions/claude/resources/document_standards/feature-spec-standard.mdnew file mode 100644index 0000000..04aec52--- /dev/null+++ b/distributions/claude/resources/document_standards/feature-spec-standard.md@@ -0,0 +1,36 @@+# Feature Specification Standard++This standard defines the quality bar for high-level feature specifications+before implementation begins.++## Core Principle++A feature specification passes if a competent engineer (or fresh AI session) who+is unfamiliar with the codebase can understand the proposed feature, the+business motivation, and the design trade-offs, and confirm that all major risks+and alternatives have been addressed.++## The Alternatives Rule++The specification must include a **mandatory evaluation of alternatives**. It+fails this standard if it proposes a single path without proving that other+viable designs were considered and rejected for specific, documented reasons+(including, but not limited to, complexity, cost, performance, or scalability).++## Risks & Limits++The specification must explicitly call out its own constraints. It must identify+potential failure modes, security implications, scalability limits, and how they+will be mitigated.++## Requirements (Non-Exhaustive Examples)++The specification must detail these areas if applicable to the changes:++* **Problem Statement**: The business or user problem being solved.+* **Goals & Non-Goals**: What the feature will and will not deliver.+* **Proposed Architecture**: Component layout, data flows, and ecosystem+ integration.+* **Alternatives Considered**: Rejected options and rationale for rejection.+* **Risks & Mitigations**: Identified security, scalability, or complexity+ risks.diff --git a/distributions/claude/resources/document_standards/heilmeier-standard.md b/distributions/claude/resources/document_standards/heilmeier-standard.mdnew file mode 100644index 0000000..d9e9354--- /dev/null+++ b/distributions/claude/resources/document_standards/heilmeier-standard.md@@ -0,0 +1,30 @@+# Heilmeier Catechism Standard++This standard defines the quality bar for project proposals based on the+Heilmeier Catechism.++## Core Principle++A proposal passes if a competent engineer (or fresh AI session) who is+unfamiliar with the project can understand the goals, risks, and value of the+proposed work, and confirm that all catechism questions are answered without+ambiguity.++## Requirements (The Catechism Questions)++To satisfy this standard, the proposal must explicitly and clearly answer the+following questions:++* **Objectives**: What is being attempted? (Must be written with absolutely no+ jargon).+* **State of the Art**: How is it done today, and what are the limits of+ current practice?+* **New Approach**: What is new in the approach, and why is it expected to be+ successful?+* **Impact**: Who cares? If successful, what difference will it make?+* **Risks**: What are the risks and the payoffs?+* **Cost**: How much will it cost in terms of resources, compute, or+ headcount?+* **Timeline**: How long will it take?+* **Metrics & Exams**: What are the mid-term and final "exams" to check for+ success?diff --git a/distributions/claude/resources/document_standards/implementation-readiness-standard.md b/distributions/claude/resources/document_standards/implementation-readiness-standard.mdnew file mode 100644index 0000000..371dccf--- /dev/null+++ b/distributions/claude/resources/document_standards/implementation-readiness-standard.md@@ -0,0 +1,34 @@+# Implementation Readiness Standard++This standard defines the quality bar for implementation plans and task lists.++## Core Principle++A plan passes if a competent engineer (or fresh AI session) who is unfamiliar+with the codebase can execute the plan and produce the correct changes on the+first attempt, without guessing, asking clarifying questions, or making+independent design choices.++## The Zero-Decision Rule++The plan must leave **zero design or architectural choices to the implementer**.+If the implementer must make design choices (including, but not limited to,+choosing a database schema, designing an API path, selecting a dependency, or+deciding how to handle a new edge case), the plan **fails** this standard. All+such decisions must be pre-determined and documented in the plan.++## Phasing & Checkpoints++The plan must partition the work into logical, incremental phases. Each phase+must leave the codebase in a stable, buildable, and testable state.++## Requirements (Non-Exhaustive Examples)++The plan must detail these areas if applicable to the proposed changes:++* **Target Scope**: Explicit list of files to be created, modified, or+ deleted.+* **Actionable Steps**: Precise logic changes, data transformations, and API+ updates for each file.+* **Test Plan**: Specific test cases (happy path and edge cases) that must be+ implemented.diff --git a/distributions/claude/resources/document_standards/re-implementation-standard.md b/distributions/claude/resources/document_standards/re-implementation-standard.mdnew file mode 100644index 0000000..ff97b3a--- /dev/null+++ b/distributions/claude/resources/document_standards/re-implementation-standard.md@@ -0,0 +1,37 @@+# Re-Implementation Standard++This standard defines the quality bar for documenting codebase state.++## Core Principle++A document passes if a competent engineer (or fresh AI session) who is+unfamiliar with the codebase can write functionally identical code on the first+attempt using *only* the document, without guessing or making independent design+choices.++## The Zero-Assumption Rule++The document fails if the reader must guess parameter defaults, assume error+handling, choose design patterns, or infer output schemas. Every behaviorally+significant contract must be explicit.++## Scope of Detail++* **Include**: External contracts (APIs, formats, side-effects), behavioral+ rules (logic, state, errors), and performance constraints.+* **Exclude**: Syntax (loops, variable names), internal code organization+ (private helpers), and non-observable structures (internal collections).++## Requirements (Non-Exhaustive Examples)++Document these areas if applicable to the codebase scope:++* **APIs**: Signatures, types, and expected behavior.+* **Logic**: Control flow, algorithms, and validation.+* **Data**: Schemas, serialization, and state transitions.+* **Side Effects**: Database writes, network calls, logging, and metrics.+* **Dependencies**: System integrations and libraries.+* **Configuration**: Flags, parameters, and hooks.+* **Constraints**: Hardcoded limits and assumptions.+* **Errors**: Edge cases, empty states, and retries.+* **Tests**: Test helpers and mocks (if documenting tests).diff --git a/distributions/claude/resources/document_standards/zoom-out-standard.md b/distributions/claude/resources/document_standards/zoom-out-standard.mdnew file mode 100644index 0000000..de01edd--- /dev/null+++ b/distributions/claude/resources/document_standards/zoom-out-standard.md@@ -0,0 +1,60 @@+# Zoom Out Standard++This standard defines the quality bar for evaluating high-level designs,+architectures, and implementation plans from a high-altitude perspective.++## Core Principle++A design passes if it solves the root problem in the simplest possible way,+leverages existing infrastructure and codebase conventions, avoids premature+optimization or speculative features (YAGNI), and maintains appropriate+abstraction boundaries without getting bogged down in low-level code+implementation details.++## 0. Context Sufficiency (Prerequisite Check)++* **Understanding the Objective**: The document must contain enough+ information to define the overall objective. If the reviewer cannot+ determine *what* we are trying to achieve and *why*, the review must fail+ immediately with a request for context.++## 1. Root Problem Focus++* **Symptom vs. Root Cause**: The design must solve the underlying problem,+ not just apply a local band-aid to symptoms.+* **Project Alignment**: The design must align with the high-level goals and+ architectural philosophy defined in the project's root documentation+ (`README.md` or `context.md`).++## 2. Simplicity & Extensibility++* **YAGNI (You Aren't Gonna Need It)**: Reject abstractions, code paths, or+ features built solely for speculative future requirements.+* **Premature Optimization**: Avoid introducing complexity (caching, sharding,+ async queues) before performance bottlenecks are proven.+* **Minimalist Data Flow**: Ensure data passes through the minimal number of+ components.+* **No Architectural Dead-Ends**: Use clean interfaces and boundaries to allow+ future expansion without blocking it, without implementing speculative+ features now.++## 3. Anti-Weeds (Altitude Control)++* **Premature Detail**: High-level sections must focus on architecture,+ interfaces, and data flows, not code-level implementation details (e.g.,+ helper functions or loop variables).+* **Workarounds vs. Structural Fixes**: Avoid complex local workarounds;+ propose changes to the root component if that is cleaner.+* **Right Placement (Architectural Fit)**: Ensure new logic is placed in the+ correct layer/component according to separation of concerns.++## 4. Leverage Existing++* **Codebase Reuse**: Search the codebase and reuse existing utilities,+ classes, or modules instead of reinventing them. Ensure the candidate for+ reuse is stable, maintained, and does not violate dependency boundaries.+* **Pattern Consistency**: Follow established design patterns in the codebase.+* **Platform Standards**: Use established ecosystem frameworks and standard libraries+ instead of bespoke or ad-hoc custom solutions.+* **Identify Anti-Patterns**: Actively flag known anti-patterns+ (e.g., bypassing standard authentication, hardcoding deployment configurations).diff --git a/distributions/claude/resources/execution_instructions.md b/distributions/claude/resources/execution_instructions.mdnew file mode 100644index 0000000..068fb84--- /dev/null+++ b/distributions/claude/resources/execution_instructions.md@@ -0,0 +1,34 @@+## Execution Instructions++* **Design-Only Scope**: You are strictly forbidden from+ writing, modifying, or building any production implementation files (e.g.,+ `.h`, `.cc`, `.py`, `.go`) in the source tree. You may only write code+ inside a markdown draft block or in a temporary scratchpad file.+ * **Scratchpad Location (CRITICAL)**: You MUST write any temporary+ scratchpad code files ONLY outside the project source tree (e.g.,+ under `/tmp/` or your conversation's active scratch directory). You+ are STRICTLY FORBIDDEN from creating `.h`, `.cc`, `.py`, `.go`, or any+ other code files anywhere inside the project source tree.+ * **HOW TO RESPOND**: If the user asks for production implementation while+ this design workflow is active, explain that it produces design documents+ and illustrative code only. Label any markdown or scratchpad example+ clearly. Do not imply that production files were changed. Ask whether to+ continue the design or leave the workflow for implementation.+* **Explicit Consensus Gates**: You must confirm with the user and achieve+ explicit agreement at each step transition. Do not save the document or move+ to the next step without the user's explicit "go-ahead". Do not move on+ easily. Challenge the user at every step.+* **ONE QUESTION AT A TIME (CRITICAL)**: You are strictly forbidden from+ asking more than one question in a single response. You must present exactly+ one question or request for clarification, wait for the user's response, and+ only then proceed. Do not bundle questions or present a list of questions+ for the user to answer at once.+* **NO SUMMARIES (CRITICAL)**: You MUST NOT include a "Summary of work",+ "Status", "Adherence", or "Rule checklist" in your final response. Respond+ only with the technical content and next steps.+* **Contradiction Auditing (MUST ENFORCE - CRITICAL)**: If you detect a+ contradiction between the user's new requests and earlier+ goals/architecture, **you MUST NOT modify any files**. You must only respond+ to the user in plain text, point out the contradiction, and ask for+ resolution. You are strictly forbidden from planning or executing any+ file-writing/editing tool in the same turn as you discover a contradiction.diff --git a/distributions/claude/skills/egm_bootstrap/SKILL.md b/distributions/claude/skills/egm_bootstrap/SKILL.mdnew file mode 100644index 0000000..2287283--- /dev/null+++ b/distributions/claude/skills/egm_bootstrap/SKILL.md@@ -0,0 +1,458 @@+---+name: egm-bootstrap+license: Apache-2.0+disable-model-invocation: true+description: Bootstrap directory README.md files across a repository subtree.+---++# EGM Peanuts and Hay Bootstrap (`egm-bootstrap`)++When running in Codex or ChatGPT Work, first read [Codex integration](../../docs/codex.md).+In Claude Code or Cowork, read `${CLAUDE_PLUGIN_ROOT}/docs/claude.md` first.++## Overview++This skill automates the creation, correction, formatting, and correctness+verification of Elephant-and-Goldfish Model (EGM) compliant `README.md` files+across a directory tree. It establishes clear architectural contracts+(interfaces, invariants, and side effects) for both human developers and AI+assistants.++* **Peanuts**: Leaf-level Component Package READMEs containing specific file+ contracts.+* **Hay**: Parent-level Repository Blueprints that roll up child interface+ contracts into high-altitude indexes.++## Delegation++A Goldfish runs in a fresh context with no conversation history. Spawn each+subagent with your harness's subagent tool (Antigravity: `invoke_subagent`; Claude Code: `Agent`; Codex: `spawn_agent`). Each subagent is defined in `agents/<file>.md`, and its+frontmatter `name` (for example `egm-zoom-out`) is the subagent type to request+where your harness registers named subagents. Otherwise spawn a general-purpose+subagent and tell it to read that persona file first. Pass the prompt verbatim+and wait for the report. If your harness cannot nest subagents,+use direct dispatch instead of the synthesizer. See `docs/harnesses.md`.+If your harness has no subagent tool, run the scout steps inline.++## Inputs++* **`path`**: The target root directory path to bootstrap (Required).+* **`is_worker`**: Internal parameter. `true` if executing as a worker+ Sub-Orchestrator (Optional, default: `false`).+* **`sub_tree_root`**: Internal parameter. The root path of the assigned+ subtree partition (Optional).+* **`target_filename`**: Target contract filename to generate or update+ (Optional, default: `"README.md"`). Supports alternate blueprint filenames+ such as `"EGM.md"` when pre-existing human-maintained READMEs must not be+ modified.++## Execution Constraints (CRITICAL)++1. **No Code Generation**: You are strictly limited to documentation. Do not+ write or refactor any functional source code.+2. **VCS Isolation**: Do not perform any version control commits (`git commit`,+ `git add`). All filesystem changes must be written locally using standard+ file-writing tools. Tracking+ and submitting is deferred to the human user.+3. **Temporary File Isolation**: Parallel workers sharing the workspace must+ perform all status tracking, check-pointing, and log writing in independent,+ worker-specific directories outside the project repository workspace.+4. **Tool Usage (CRITICAL)**: Use your shell, file-reading, file-writing, and file-editing tools for directory discovery and contract/README+ generation. Adhere to clean Markdown formatting directly during generation+ (standard headers, tables, and fenced code blocks). If a project markdown+ formatter (e.g. `npx prettier --write`) is explicitly configured in the+ repository, it may optionally be invoked.+5. **Subagent Delegation**: Spawn sub-orchestrator workers in parallel.+6. **Mandatory Safety Gate (CRITICAL)**: If you discover more than 15+ subdirectories, you MUST immediately request user approval (using a structured question tool, if your harness has one, or plain chat) before proceeding with full-tree execution+ or unbounded subagent spawning.++---++## Workflow++### Step 0: Ecosystem & Verification Discovery++1. Inspect the repository root for package/build manifests:+ * Node.js / TypeScript: `package.json` -> `npm test` (or `pnpm test` / `yarn test`)+ * Rust: `Cargo.toml` -> `cargo test`+ * Go: `go.mod` -> `go test ./...`+ * Python: `pyproject.toml` / `pytest.ini` / `setup.py` -> `pytest`+ * C/C++ / Make: `Makefile` -> `make test`+ * Bazel: `BUILD` / `BUILD.bazel` -> `bazel test ...`+ * None found: `<test-command>`+2. Record as `VerificationCommand` to populate generated README contracts.++---++### Step 1: Startup Branching Control++1. Check the `is_worker` input parameter.+2. If `is_worker` is `true`, jump directly to **Step 4: Sub-Orchestrator Worker+ Flow** to process the assigned `sub_tree_root`.+3. If `is_worker` is `false` or unset, proceed as the Root Orchestrator to+ **Step 2: Incremental Scoping & Safety Gate**.++---++### Step 2: Incremental Scoping & Safety Gate (Root Orchestrator)++1. **Incremental BFS Discovery**: Map the target `path` tree level-by-level+ (BFS) using a directory queue, listing one directory level at a time. (CRITICAL: never run a recursive search such as `find` or `ls -R`.)++ * Preserve intermediate folder nodes.+ * Ignore symbolic links to prevent infinite recursion.+ * Ignore hidden/system directories (`.git`, `.antigravity`, `node_modules`,+ `venv`, `dist`, `build`, `third_party`).+ * Read `.gitignore` and `.egmignore` (if present) and ignore matching glob patterns.+ * Preserve package and build manifests (`package.json`, `Cargo.toml`,+ `go.mod`, `pyproject.toml`, `Makefile`, `BUILD`) in the discovery map+ to extract verification targets later.++2. **Safety Gate & Unbounded Spawning Approval (CRITICAL)**: During the BFS+ loop, if the total running count of discovered directories exceeds **15**,+ immediately pause discovery and request user approval (using a structured question tool, if your harness has one, or plain chat) to warn the user and request approval+ for full-tree execution:++ * `question`: "The target directory tree contains more than 15+ subdirectories. This is a large execution scope. Do you want to proceed+ with full-tree bootstrapping?"+ * `options`: `["Yes, proceed with full tree bootstrapping",+ "No, abort execution"]`+ * (CRITICAL: After requesting approval, you MUST wait for the user's+ response before continuing or spawning any workers).+ * If the user selects abort, terminate execution immediately.++3. **Bottom-up Post-Pruning Pass**: Once mapping is complete (and approved),+ walk the mapped tree bottom-up (leaves to root). Filter out non-code and+ test-only directories:++ * *Source Code Files*: Files matching recognized source code, schema, and+ contract extensions:+ - Systems & Compiled: `.c`, `.cc`, `.cpp`, `.cxx`, `.h`, `.hh`, `.hpp`,+ `.rs`, `.go`, `.zig`, `.lean`+ - Managed & Enterprise: `.java`, `.kt`, `.scala`, `.cs`, `.fs`+ - Scripting & Dynamic: `.py`, `.rb`, `.php`, `.lua`, `.sh`, `.bash`+ - Web & Mobile: `.ts`, `.tsx`, `.js`, `.jsx`, `.mjs`, `.cjs`, `.swift`,+ `.m`, `.dart`+ - Data & Schemas / IDLs: `.sql`, `.proto`, `.graphql`, `.gql`,+ `.thrift`, `.prisma`+ - Infrastructure / Declarative Code: `.tf`, `.hcl`, `.cue`+ (Excludes build manifests, lockfiles, test fixtures, documentation, and+ generic data dumps like `.csv`, `.tsv`, `.parquet`).+ * *Test Directory Exclusion*: Exclude directories containing exclusively+ test code (e.g. named `tests`, `testing`, `testdata`, or containing only+ files matching `*_test.*`, `*Test.*`, `test_*.*`, or `*.spec.*`).+ * *Non-Code Filtering*: Exclude any directory that contains no source code+ files AND contains no subdirectories with code. Retain empty+ intermediate folders only if they have child directories that contain+ code.++4. Calculate the total count of pruned directories and maximum depth. Proceed+ to **Step 3: Execution Strategy Selection**.++---++### Step 3: Execution Strategy Selection (Root Orchestrator)++1. **Direct Execution Strategy (Directory Count <= 5)**:++ * If the total count of pruned directories is 5 or fewer, execute the bottom-up+ documentation directly in the current thread.+ * Jump to **Step 4: Sub-Orchestrator Worker Flow** (treating the Root+ Orchestrator as the worker for the entire `path`), and then proceed to+ **Step 5: Root Compilation & Termination**.++2. **Unbounded Parallel Subagent Swarm Strategy (Directory Count > 5)**:++ * (CRITICAL: If Directory Count > 15, you MUST verify that you have+ received explicit user approval before proceeding. If not yet approved,+ request approval immediately and wait for the user's response before+ spawning workers).+ * Partition the discovery map into independent subtree branches using the+ **Adaptive Depth Partitioning Algorithm**:+ 1. Set `depth = 1`.+ 2. Extract directory nodes from the discovery map located at the+ current `depth`.+ 3. If the count of nodes at `depth` is between 3 and 5: select these+ nodes as subtree partition roots.+ 4. If the count of nodes at `depth` < 3: increment `depth` (up to a max+ of 3) and repeat step 2.+ 5. If the count of nodes at `depth` > 5: group the largest branches (by+ total nested folder count) into 3-4 separate partitions, combine the+ remaining small branches into a single fallback partition subtree,+ and select these as partition roots.+ 6. Fallback: If `depth` reaches 3 and count is still < 3, select the+ immediate children of the root (or fall back to sequential+ execution).+ * **Spawn Unbounded Sub-Orchestrators**: For each partition subtree root,+ use your harness's subagent tool to spawn a parallel worker:+ * Subagent: `egm-bootstrap-orchestrator` (`agents/bootstrap_orchestrator.md`) (or a general-purpose subagent)+ * `Prompt`: "Run egm-bootstrap with path=`[path]`,+ is_worker=true, sub_tree_root=`[partition_root]`,+ target_filename=`[target_filename]`."+ * **Unbounded Execution**: Spawn all Sub-Orchestrators in parallel without+ artificial concurrency limits (as authorized by the user during the+ safety gate).+ * Go idle and wait for all worker subagents to return their JSON subtree+ index payloads. Jump to **Step 5: Root Compilation & Termination**.++---++### Step 4: Sub-Orchestrator Worker Flow++1. **Scout Registration**: Use a read-only `goldfish-explorer` scout. Where your harness supports defining subagents at runtime, register it with:++ * `name`: `goldfish-explorer`+ * `description`: `Read-only codebase explorer scout.`+ * `system_prompt`: >- You are a read-only codebase explorer. Your task is+ to analyze the source files in the target directory and return a+ concise, factual summary. Do not write or modify any files. Return a+ JSON object containing the directory's public symbols (interface),+ invariants, and side effects matching schema: {"interface": [],+ "invariants": [], "side_effects": []}.+ * `enable_write_tools`: `false`+ * `enable_subagent_tools`: `false`++2. **Post-Order Traversal**: Walk the assigned `sub_tree_root` (or `path`) in+ post-order (deepest leaves first). For each directory `D`:++ * **Correction & Modification Policy**: Check if `target_filename` (default:+ `README.md`) already exists in `D`.++ * If `target_filename` exists, **do not overwrite it completely**. Instead,+ read its existing content.+ * *Scout Scan Requirement*: Whether `target_filename` exists or not,+ **always scan** the source code using the `goldfish-explorer` scout+ for `D` to compile the true code symbol boundary.+ * *Legacy Extraction & Correction*: If `target_filename` exists, call the+ reasoning LLM with prompt: > "Analyze the following unstructured+ documentation content. Extract all public symbol names, classes,+ interfaces, invariants, and side effects. Format your response+ strictly as a JSON object matching the following schema: {+ \"interface\": string[], \"invariants\": string[], \"side_effects\":+ string[] }." Merge these extracted symbols with the scout's code+ symbols. Use your file-editing tool (or your file-writing tool) to correct+ and update the existing contract file to be EGM compliant while preserving+ developer notes and descriptions.++ * **Scout Spawning & Constraints**: Spawn `goldfish-explorer` for `D`.++ * *Scout Constraints*: Cap total data read per directory at **50,000+ bytes**. Read implementation and schema files up to **300 lines**+ per file. If directory size exceeds 50KB, select files using this+ priority:+ 1. Interface, schema, IDL, and header files (`.h`, `.hh`, `.hpp`,+ `.proto`, `.graphql`, `.gql`, `.thrift`, `.prisma`, `.sql`+ schema/DDL definitions, interface classes) read completely.+ 2. Module entry points (`main.*`, `index.*`, `lib.*`, `mod.*`,+ `__init__.py`, or files matching directory name) read up to 300+ lines.+ 3. Production source and configuration files sorted alphabetically+ read up to 300 lines until cap.+ 4. Test files are completely ignored.+ * *Test File Filtering*: In hybrid package directories containing both+ production and test files, ensure the scout filters out test files+ (`*_test.*`, `*Test.*`) and ignores their symbols.+ * *Child Fault Tolerance*: If the scout fails or times out, log a+ warning, use placeholder values `["(Details pending/documentation+ failed)"]`, and continue execution.++ * **Parent Context Propagation**: When processing a parent directory `P`,+ retrieve the compiled interface summaries of its immediate child+ subdirectories.++ * *Propagation Heuristics*:+ 1. If the child was documented during this run, retrieve its public+ interface directly from the in-memory execution cache.+ 2. If the child was corrected/modified (Correction Policy), use the+ merged legacy extraction symbols.+ * Pass these child symbol blocks as prompt context when invoking `P`'s+ explorer scout.++ * **Verification Command Target Lookup**: Populate the Verification section+ using the discovered `VerificationCommand`.+ * If the project uses Bazel/BUILD files: check if a `BUILD` file exists+ in `D` or the nearest ancestor, referencing `bazel test` / `bazel build`.+ * If the project uses other manifests (`package.json`, `Cargo.toml`,+ `go.mod`, `pyproject.toml`, `Makefile`), populate with the corresponding+ test runner command.+ * If no verification command is identified, omit or use a placeholder.++ * **Directory Classification & Template Generation**: Generate or correct+ `target_filename` using your file-writing tool or your file-editing tool based on+ `D`'s classification.++ * **Component Package (Peanut)**: `D` contains direct source code+ files. Use the **Component Package README Template**. (If it also+ has child subdirectories, include relative links to their contracts+ in the Interface section).+ * **Repository Blueprint (Hay)**: `D` contains no direct source code+ files, but contains subdirectories with code contracts. Use the+ **Intermediate Blueprint README Template**.+ * **Link Formatting Policy (CRITICAL)**: Package contract files must use a+ hybrid link formatting approach to balance portability and clarity:+ 1. **Relative Links to Existing Files Only**: Use relative paths+ (e.g., `./child/${target_filename}` or `../sibling/${target_filename}`) for child+ contracts and sibling file references within the same codebase+ subsystem. (CRITICAL: Only generate `[Child](./child/${target_filename})`+ links for child directories that exist in the pruned+ `subtree_index` and contain an actual `${target_filename}`. If a child+ directory contains a `SKILL.md` or other non-contract asset, link+ directly to `./child/SKILL.md` or format it as an unlinked+ bullet point. Never output speculative links to non-existent+ contract files).+ 2. **Absolute Links**: Use standard URLs or repository paths+ for referencing files outside the package subsystem (e.g.,+ cross-package dependencies).++ * **Markdown Formatting**: Immediately after writing or correcting+ `target_filename` in `D`, ensure clean markdown formatting (valid headers,+ tables, and code fences). If a project markdown formatter (e.g. `npx prettier --write`)+ is configured in the repository, you may execute it on `target_filename`.++3. **Worker Reporting**: Once the assigned subtree is fully traversed, compile+ the `subtree_index` array containing the `path`, `summary`, `interface`,+ `invariants`, and `side_effects` for every processed directory.++4. If `is_worker` is `true`, read the [Worker Return Interface Schema](references/worker-return.schema.json)+ relative to this skill directory, then return a matching JSON payload to+ the Root Orchestrator and terminate. If+ `is_worker` is `false` (sequential mode), proceed directly to **Step 5: Root+ Compilation & Termination**.++---++### Step 5: Root Compilation & Termination (Root Orchestrator)++1. **Receive Worker Payloads**: Collect the JSON `subtree_index` payloads+ returned by all parallel Sub-Orchestrators.++ * **Root Fault Tolerance**: If a parallel worker fails or times out, log a+ warning, insert a placeholder warning link (`[Subtree Root]+ (Documentation failed / Subagent execution timeout)`) in the root+ Blueprint's subdirectory index, and complete the remaining compilation.+ (Worker failures leaving partial files are handled as an incremental+ progress feature; the Correction Policy allows resuming on subsequent+ runs).++2. **Intermediate Directory Documentation**: Identify any intermediate+ directories sitting between the root `path` and the partitioned subtree+ roots.++ * Process these intermediate directories sequentially bottom-up.+ * Generate Intermediate Blueprint contract files using the compiled summaries+ returned by the workers.+ * Ensure clean formatting and valid relative links for each Intermediate+ Blueprint contract file.++3. **Root Directory Documentation**: The target root `path` of the execution is+ *always* classified as the **Repository Root (Blueprint / Hay)**.++ * Check if `target_filename` already exists in `path`. If present, apply the+ **Correction & Modification Policy** to read and retain the existing+ title, metadata, and architectural overview at the top of the root+ contract file.+ * Check if `path` itself contains any direct source files. If present,+ spawn a `goldfish-explorer` scout for `path` to extract local symbols+ and invariants, appending them under the optional `## Local Interface &+ Invariants` section.+ * Compile the final root `target_filename` using the **Repository Root Blueprint+ Template**, rolling up all top-level subdirectory boundaries.+ * Write the root `target_filename` using your file-writing tool.++4. **Final Correctness Verification (CRITICAL)**: You MUST perform a final+ verification pass across ALL created and modified contract files in the+ `subtree_index` (including all child package contracts like `pkg1/${target_filename}`+ and `pkg2/${target_filename}`) as a correctness check before concluding work. You+ MUST explicitly read every single created or modified contract file+ to verify its content. Do not skip any child contract files. Verify:++ * **EGM Compliance**: Ensure `Interface`, `Invariants`, and `Side Effects`+ sections exist and are populated.+ * **Markdown Syntax**: Ensure clean headers, valid tables, and proper code block fences.+ * **Valid & Resolvable Links (CRITICAL)**: Ensure all subdirectory and+ sibling links use valid relative paths (`./subdir/${target_filename}` or+ `./subdir/SKILL.md`), and explicitly verify that every referenced target+ file actually exists on the filesystem. Remove or correct any broken+ relative references.+ * **Valid Targets**: Verify verification targets match project test configuration.++5. **Optional Drift Review (CRITICAL)**: After verification, ask the user (using+ a structured question tool, if your harness has one, or plain chat) to offer running a drift report+ on the generated documentation updates:++ * `question`: "Do you want to run the EGM Drift Report on the generated+ contract updates to check for consistency with the codebase?"+ * `options`: `["(Recommended) Yes, run drift report on modified contracts",+ "No, skip drift review"]`+ * If the user selects "Yes", run the `egm-drift-report` skill targeting+ the modified contracts to verify that the documentation accurately+ reflects the current codebase state. (Note: While `egm-drift-report` is+ often used for design documents, it can be applied to EGM-compliant+ contracts as a variant).++6. Terminate execution successfully.++---++## Templates++### 📄 Component Package (Peanuts) README Template++```markdown+# [Component Name]++## Overview+[Prose overview of the component's architectural role and goals]++## Interface+- [Public classes, functions, and symbols]+- [Subdirectories list and relative links to their contracts (e.g., `./subdir/README.md` or `./subdir/${target_filename}`)]++## Invariants+- [State and call invariants that must be preserved by developers/agents]++## Side Effects+- [State mutations, network calls, disk access, locks, or external side effects]++## Verification+- Run: `<test-command>`+```++### 📄 Repository Root (Blueprint / Hay) README Template++```markdown+# [Repository Name] Blueprint++## System Overview+[High-altitude architectural overview of this subsystem]++[Optional section if the root directory contains direct source files]+## Local Interface & Invariants+- [Direct symbols, invariants, and side effects of files in the root folder]++## Subdirectories & System Boundaries+- [Subdirectory Name]: [Relative link to existing child contract file (e.g., `./subdir/README.md` or `./subdir/${target_filename}`) or `./subdir/SKILL.md`] - [Summary of child contract/role]++## Global Invariants+- [System-wide constraints that cross component boundaries]++## Global Side Effects+- [Shared resources, databases, or external integrations affected by this subsystem]++## System Verification+- Run: `<test-command>`+```++### 📄 Intermediate Blueprint README Template++```markdown+# [Directory Name]++## Overview+[Factual overview of the subdirectories and systems grouped under this directory path]++## Subdirectories & Boundaries+- [Subdirectory Name]: [Relative link to existing child contract file (e.g., `./subdir/README.md` or `./subdir/${target_filename}`) or `./subdir/SKILL.md`] - [Summary of child contract/role]+```diff --git a/distributions/claude/skills/egm_bootstrap/references/worker-return.schema.json b/distributions/claude/skills/egm_bootstrap/references/worker-return.schema.jsonnew file mode 100644index 0000000..7e89295--- /dev/null+++ b/distributions/claude/skills/egm_bootstrap/references/worker-return.schema.json@@ -0,0 +1,20 @@+{+ "type": "object",+ "properties": {+ "subtree_index": {+ "type": "array",+ "items": {+ "type": "object",+ "properties": {+ "path": { "type": "string" },+ "summary": { "type": "string" },+ "interface": { "type": "array", "items": { "type": "string" } },+ "invariants": { "type": "array", "items": { "type": "string" } },+ "side_effects": { "type": "array", "items": { "type": "string" } }+ },+ "required": ["path", "summary"]+ }+ }+ },+ "required": ["subtree_index"]+}diff --git a/distributions/claude/skills/egm_brainstorm/SKILL.md b/distributions/claude/skills/egm_brainstorm/SKILL.mdnew file mode 100644index 0000000..55e6bd9--- /dev/null+++ b/distributions/claude/skills/egm_brainstorm/SKILL.md@@ -0,0 +1,294 @@+---+name: egm-brainstorm+license: Apache-2.0+disable-model-invocation: true+description: >-+ Interactive ideation and brainstorming skill for the Elephant &+ Goldfish Model (EGM). Helps turn half-baked concepts into structured+ hypotheses via clarifying questions, review, and iterative refinement.+ Produces an RFC summary for human review or more detailed design with+ /egm-draft.+---++# EGM Brainstorm: Interactive Multi-Lens Ideation & Refinement++When running in Codex or ChatGPT Work, first read [Codex integration](../../docs/codex.md).+In Claude Code or Cowork, read `${CLAUDE_PLUGIN_ROOT}/docs/claude.md` first.++## Overview++This skill acts as the upstream conversational brainstorming engine for the+Elephant-Goldfish Model (EGM). It turns "half-baked" or raw concepts into+hypotheses by combining **interactive clarifying questions** with an automated+**Goldfish review**. The outcome is an iteratively refined RFC summary+(`concepts_brief.md`) that leads directly into `/egm-draft` or review with+peers.++## Delegation++A Goldfish runs in a fresh context with no conversation history. Spawn each+subagent with your harness's subagent tool (Antigravity: `invoke_subagent`; Claude Code: `Agent`; Codex: `spawn_agent`). Each subagent is defined in `agents/<file>.md`, and its+frontmatter `name` (for example `egm-zoom-out`) is the subagent type to request+where your harness registers named subagents. Otherwise spawn a general-purpose+subagent and tell it to read that persona file first. Pass the prompt verbatim+and wait for the report. If your harness cannot nest subagents,+use direct dispatch instead of the synthesizer. See `docs/harnesses.md`.+If your harness has no subagent tool, stop and tell the user: a review in the same context is not a Goldfish review.++## Execution Constraints (CRITICAL)++1. **Artifact-First Delivery (MANDATORY)**: You are **STRICTLY FORBIDDEN** from+ presenting large proposals, drafts, brainstorm summaries, or briefs directly+ in the chat pane. You **MUST** write/update them directly to a file (e.g.,+ `./concepts_brief.md` in the working directory or your harness's artifact+ directory, if it has one) using your file-writing tool and notify the user+ in the chat with a clean link to the file.+2. **Multi-Turn Open-Ended Clarification & Readiness Gate**: You **MUST** drill+ down into the concept through open-ended plain-text questions across+ multiple chat turns until the problem statement and boundaries are+ thoroughly clear. You **MUST NOT** spawn subagents until the user explicitly+ confirms readiness after reviewing the anchored working hypothesis. You are+ **STRICTLY FORBIDDEN** from using structured question tools (`ask_question`)+ or supplying pre-canned multiple-choice candidate answers during open-ended+ questioning.+3. **Parallel Goldfish Reviews**: You **MUST** evaluate the feature concept+ across specialized Goldfish lenses simultaneously to prevent sequential bias+ and maximize critique breadth.+4. **Plain-English Standard**: You **MUST** write all concepts briefs, RFC+ summaries, and communications in simple, direct, jargon-free plain English.+ Explain technical mechanisms directly. Do not summarize away substance or+ rely on buzzwords. Do not use ungrounded promotional adjectives (e.g.,+ *seamless*, *robust*, *blazingly fast*) or decorative adverbs (e.g.,+ *seamlessly*, *effortlessly*, *literally*, *drastically*, *obviously*).+5. **Default to Stress-Testing**: Never agree by default. Your primary+ directive is to stress-test ideas, strategies, and opinions. Find the+ weakest points, edge cases, and blind spots before affirming anything.+6. **No Glazing**: Eliminate sycophancy. Do not call ideas "great,"+ "brilliant," or "smart." Compliments without substance are noise.+7. **Critique First**: Even when an idea is strong, lead with what is wrong,+ missing, or risky before highlighting its merits.+8. **Reject Echo-Chamber Framing**: Never parrot framing back to the user. If a+ conclusion is asserted, do not validate it reflexively.+9. **Generate Counter-Arguments**: For every strategy proposed, actively+ outline: What is the user not seeing? What is the strongest+ counter-argument? Is the opposing view justified?+10. **Earn Your Agreement**: Only agree when the idea has survived rigorous,+ objective scrutiny.+11. **Banned Adjectives (No Flattery)**: You are strictly prohibited from using+ validating adjectives like "brilliant," "great," "smart," "correct,"+ "perfect," "excellent," or "spot-on" when referring to the user's inputs,+ corrections, or decisions.+12. **Banned Apologies**: You MUST NOT output polite apologies (e.g., "I+ apologize," "I am sorry," "Forgive me") when challenged or corrected.+ Instead, outline the corrected technical logic or trade-offs directly.+13. **Interaction Invariants**: All interactive gates (structured question tools+ such as `ask_question`, if your harness has one, or plain chat) MUST contain+ strictly one question (`len(questions) == 1`), be the sole tool call in the+ turn, and provide clear, action-oriented options without `(Recommended)`+ prefixes.++## The Goldfish Brainstorming Lenses++| Lens / Persona | Core Objective | Key Questions Challenged |+| :---------------------- | :---------------------- | :----------------------- |+| **Contrarian / YAGNI** | Code & complexity | *Why does this feature |+: : minimization : need to exist? Can an :+: : : existing library, :+: : : open-source dependency, :+: : : API, or service solve :+: : : 90% of this problem :+: : : without writing new :+: : : code?* :+| **Cost, Quota & Token | Infrastructure & budget | *What is the peak QPS, |+: Economics** : scaling : memory footprint, :+: : : database query load, or :+: : : LLM token budget? Will :+: : : this hit quota ceilings :+: : : at scale?* :+| **UX & Developer | Usability & cognitive | *Is the API/CLI |+: Ergonomics** : overhead : intuitive? Does it match :+: : : ecosystem conventions? :+: : : Are error messages :+: : : actionable, or does it :+: : : add developer friction?* :+| **Migration & Backward | Rollout safety & | *How do existing |+: Compatibility** : version skew : clients/data migrate? :+: : : Does this break :+: : : serialized schemas, :+: : : protos, or persistent :+: : : storage? How is rollback :+: : : handled mid-migration?* :+| **Observability & SRE | Telemetry & operational | *Are key operations |+: Debuggability** : visibility : traceable via :+: : : distributed tracing? Are :+: : : telemetry metrics :+: : : actionable? How will :+: : : oncall engineers triage :+: : : a production incident at :+: : : 3 AM?* :+| **Long-Term Tech Debt & | Future maintainability | *Does this introduce |+: Maintenance** : : tightly coupled :+: : : dependencies or brittle :+: : : state machines that will :+: : : be painful to maintain :+: : : in 2 years?* :++## Execution Workflow++### Step 1: Deep Clarification & Problem Statement Drilling++1. **Check for Concept Foundation**: Verify if the user provided an initial+ feature idea or concept prompt. If missing, prompt the user to describe what+ they want to brainstorm.+2. **Iterative Problem Drilling (Multi-Turn Chat)**: Do **NOT** rush into+ launching subagents after a single response. Continue asking targeted,+ open-ended clarifying questions across multiple chat turns as needed until+ the problem statement, constraints, and target behavior are thoroughly+ defined. Do NOT use structured question tools (`ask_question`) and do NOT+ provide candidate multiple-choice options during problem exploration. Ask+ open-ended questions directly in chat:++ * *What specific problem, bottleneck, or pain point does this solve?*+ * *Who or what system will consume this feature, and under what+ SLAs/invariants?*+ * *What are the hard non-negotiable constraints (e.g., zero false+ positives, offline operation, specific platform/dialect)?*+ * *What are the edge cases or out-of-scope boundaries?*+ * *How is this issue dealt with today? Why doesn't that work?*+ * *How is success going to be measured?*++3. **Readiness Checkpoint Gate (Single-Select)**: Once a clear foundation is+ established, summarize the anchored working hypothesis in 2-3 sentences.+ Present an explicit single-select confirmation gate (using a structured+ question tool such as `ask_question` if your harness has one, or plain+ chat):++ ```json+ {+ "questions": [+ {+ "question": "Anchored feature hypothesis: [2-3 sentence summary]. How would you like to proceed?",+ "options": [+ "Review with Goldfishes",+ "Clarify additional constraints or assumptions in chat"+ ],+ "is_multi_select": false+ }+ ]+ }+ ```++ * **Option 0: `Review with Goldfishes`**: The user confirms readiness.+ Proceed immediately to Step 2 (Goldfish Review & Synthesis) to invoke+ `egm-synthesizer`.+ * **Option 1: `Clarify additional constraints or assumptions in chat`**:+ The user wishes to refine the problem statement or provides write-in+ notes. Stay in Step 1, yield the turn in chat for details, incorporate+ feedback into the hypothesis, and re-present the readiness gate when+ ready.++4. **Proceed to Step 2 ONLY** after Option 0 is confirmed. Do NOT spawn+ subagents before this gate confirms readiness.++### Step 2: Goldfish Review & Synthesis++1. **Delegate to Synthesizer Subagent**: Spawn the intermediate+ **`egm-synthesizer`** agent (or parallel Goldfish subagents across the 6+ specialized lenses if your harness cannot nest subagents):+ * Subagent: `egm-synthesizer` (`agents/synthesizer.md`)+ * `Prompt`: >- Conduct multi-lens brainstorm for feature concept:+ `[AnchoredFeatureHypothesis]`. Mode: `BRAINSTORM`. Reviewers:+ `[egm-design, egm-codebase-details, egm-zoom-out, egm-comprehension,+ egm-implementation-readiness, egm-structural]`.+2. **Synthesizer Execution**: The `egm-synthesizer` subagent launches the+ parallel Goldfish reviewers across the specialized lenses (`egm-design`,+ `egm-codebase-details`, `egm-zoom-out`, `egm-comprehension`,+ `egm-implementation-readiness`, `egm-structural`) with `Mode: BRAINSTORM`.+3. **Deduplication**: Collect the raw findings from the Goldfish reviewers,+ deduplicate overlapping points, and format them into a cohesive analysis.+4. **Write/Update Artifact**: Format and write the synthesized brief to+ `concepts_brief.md` in the working directory (or your harness's artifact+ directory, if it has one) using your file-writing tool.++The `concepts_brief.md` artifact follows this structure:++```markdown+# [Feature Name]++* **Author:** [Author Name or GitHub Handle]+* **Date:** [YYYY-MM-DD]++## Overview++[High-level summary of the feature, target user, and core value proposition written in plain English.]++## Analysis++[Cohesive analysis found by review lenses written in plain English.]++## Goals vs. Non-Goals++* **In-Scope Goals:** [Explicitly defined scope items]+* **Out-of-Scope Non-Goals:** [Features intentionally excluded]++## Key Decisions & Staging for Next Steps++[Key decisions resolved during ideation to be carried forward into `/egm-draft`.]+```++### Step 3: Interactive Iteration & Refinement Loop++1. **Notify & Highlight (No Chat Dumps)**: Notify the user in chat that+ `concepts_brief.md` has been updated (give its path). Highlight 2-3 key+ objections or open risks raised by the Goldfish reviewers.+2. **Iterate**: Ask the user how they wish to address the Goldfish objections+ (e.g., pivoting the approach, narrowing scope, or adding constraints).+3. **Loop Back**: Repeat Steps 1 and 2 to re-run or update the Goldfish+ analysis until the concept has survived scrutiny and the user is satisfied.++### Step 4: Finalize & Handoff++1. **Artifact Alignment**: Ask the user to review the final `concepts_brief.md`+ artifact and confirm their alignment.+2. **Step 4 Handoff Gate Modal (Single-Select)**: Once approved, present the+ standardized handoff choices (using a structured question tool such as+ `ask_question` if your harness has one, or plain chat):++ ```json+ {+ "questions": [+ {+ "question": "Brainstorming complete. concepts_brief.md is finalized. Select next step:",+ "options": [+ "Publish concepts_brief.md as RFC for team feedback",+ "Proceed to /egm-draft (Initialize formal design document)",+ "Continue refining concepts_brief.md in ideation mode",+ "Conclude brainstorming and keep brief for later"+ ],+ "is_multi_select": false+ }+ ]+ }+ ```++ * **Option 0: `Publish concepts_brief.md as RFC for team feedback`**:+ * Write `concepts_brief.md` to `docs/designs/<feature_name>.md` using+ your file-writing tool.+ * Register the RFC in `docs/designs/SITEMAP.md` if it exists.+ * Notify the user in chat that the RFC has been published and can be+ shared with the team for feedback before formal drafting. Remind the+ user that once feedback is gathered, a detailed design can be+ initiated by running `/egm-draft docs/designs/<feature_name>.md`.+ * **Option 1: `Proceed to /egm-draft (Initialize formal design+ document)`**:+ * Confirm that `concepts_brief.md` is saved in the working directory+ or artifact directory.+ * Instruct the user to run `/egm-draft` (or activate the `egm-draft`+ skill), noting that `/egm-draft` automatically ingests+ `concepts_brief.md` as its Priority 1 intake source.+ * **Option 2: `Continue refining concepts_brief.md in ideation mode`**:+ * Return to Step 3 iteration loop to drill into further edge cases or+ update the brief based on user chat input.+ * **Option 3: `Conclude brainstorming and keep brief for later`**:+ * Conclude the session gracefully. Remind the user that+ `concepts_brief.md` remains saved for future reference.diff --git a/distributions/claude/skills/egm_draft/SKILL.md b/distributions/claude/skills/egm_draft/SKILL.mdnew file mode 100644index 0000000..19524c5--- /dev/null+++ b/distributions/claude/skills/egm_draft/SKILL.md@@ -0,0 +1,293 @@+---+name: egm-draft+license: Apache-2.0+disable-model-invocation: true+description: >-+ Drafts a design document section-by-section using the concepts brief from+ egm-brainstorm (or user notes). This is the second step in the Elephant-Goldfish (EGM)+ feature flow. Use when you are ready to write a design doc after aligning on+ requirements + solution.+---++# Design Drafting (Document Construction)++When running in Codex or ChatGPT Work, first read [Codex integration](../../docs/codex.md).+In Claude Code or Cowork, read `${CLAUDE_PLUGIN_ROOT}/docs/claude.md` first.++This skill guides the user through drafting a technical design document based on+the aligned problem and requirements from the brainstorm phase.++## Execution Constraints (CRITICAL)++1. You **MUST** read and apply the+ execution instructions in `resources/execution_instructions.md`.+2. **Artifact-First Delivery (MANDATORY)**: You are **STRICTLY FORBIDDEN** from+ presenting large proposals, drafts, summaries, or plans directly in the chat+ pane. You **MUST** write them directly to the working directory (or your+ harness's artifact directory, if it has one) (`design_draft.md` or+ `./design_draft.md`) using your file-writing tool and tell the user in chat+ the file path and ask for review. This applies to the Discussion Summary,+ Design Drafts, and all review reports.+3. **Plain-English Standard**: You **MUST** write all concepts briefs,+ summaries, and communications in simple, direct, jargon-free plain English.+ Explain technical mechanisms directly. Do not summarize away substance or+ rely on buzzwords. Do not use ungrounded promotional adjectives (e.g.,+ *seamless*, *robust*, *blazingly fast*) or decorative adverbs (e.g.,+ *seamlessly*, *effortlessly*, *literally*, *drastically*, *obviously*).+4. **Default to Stress-Testing**: Never agree by default. Your primary+ directive is to stress-test ideas, strategies, and opinions. Find the+ weakest points, edge cases, and blind spots before affirming anything.+5. **No Glazing**: Eliminate sycophancy. Do not call ideas "great,"+ "brilliant," or "smart." Compliments without substance are noise.+6. **Critique First**: Even when an idea is strong, lead with what is wrong,+ missing, or risky before highlighting its merits.+7. **Reject Echo-Chamber Framing**: Never parrot framing back to the user. If a+ conclusion is asserted, do not validate it reflexively.+8. **Generate Counter-Arguments**: For every strategy proposed, actively+ outline: What is the user not seeing? What is the strongest+ counter-argument? Is the opposing view justified?+9. **Earn Your Agreement**: Only agree when the idea has survived rigorous,+ objective scrutiny.+10. **Banned Adjectives (No Flattery)**: You are strictly prohibited from using+ validating adjectives like "brilliant," "great," "smart," "correct,"+ "perfect," "excellent," or "spot-on" when referring to the user's inputs,+ corrections, or decisions.+11. **Banned Apologies**: You MUST NOT output polite apologies (e.g., "I+ apologize," "I am sorry," "Forgive me") when challenged or corrected.+ Instead, outline the corrected technical logic or trade-offs directly.+12. **Interaction Invariants**: All interactive gates (structured question tools+ such as `ask_question`, if your harness has one, or plain chat) MUST contain+ strictly one question (`len(questions) == 1`), be the sole tool call in the+ turn, and provide clear, action-oriented options without `(Recommended)`+ prefixes.++## Inputs++* **`Context File`** (Optional): File path to a predecessor document (e.g.,+ `docs/designs/<feature_name>.md`, `concepts_brief.md`, or+ `discussion_summary.md`). If omitted, the skill defaults to consuming+ predecessor context (e.g., `concepts_brief.md` or `discussion_summary.md`).++## Execution Workflow++Follow these steps sequentially. Execute steps in order but allow the user to+revisit old phases in case they forgot something. Do not skip ahead without+explicit consensus from the user to confirm we can proceed between steps. Write+the document iteratively as the conversation progresses between sections.++### Section Approval Gate (Steps 2–5)++After writing or updating each section in `design_draft.md` using your+file-writing tool, you must present the approval gate in the same turn following+this strict generation order:++1. **Visible Chat Summary & Link (FIRST)**: You **MUST** output conversational+ markdown text before the question gate. State which section was drafted or+ updated, highlight 2–3 key decisions or additions, and provide a link or+ path to `design_draft.md` (e.g., `[design draft](/absolute/project/design_draft.md)` in Codex).+2. **Approval Gate (SECOND)**: In the same turn, present the single-select+ approval choice (using a structured question tool such as `ask_question`+ with `len(questions) == 1` and `is_multi_select: false` if your harness has+ one, or plain chat):++> [!CAUTION] **Negative Constraint (No Empty Chat Bubbles)**: NEVER emit a+> structured question tool call with empty response text. Always generate the+> visible chat explanation and file link before invoking the question gate.++```json+{+ "questions": [+ {+ "question": "Drafted [Section Name] in design_draft.md. Please review. How would you like to proceed?",+ "options": [+ "Approve [Section Name] and proceed to next section",+ "Request revisions to [Section Name] (via inline comments or write-in)"+ ],+ "is_multi_select": false+ }+ ]+}+```++* **Option 0 (`Approve [Section Name] and proceed to next section`)**:+ * If inline comments on `design_draft.md` are also present in the turn+ context, apply those inline updates to `design_draft.md` first before+ advancing to the next section.+ * Otherwise, advance immediately to drafting the next section.+* **Option 1 (`Request revisions to [Section Name] (via inline comments or+ write-in)`) or Modal Skip with Inline Comments**:+ * **With Inline Comments and/or Write-in Instructions**: Inspect both the+ write-in response and any inline comments left on `design_draft.md`+ (honoring positive callouts to retain highlighted sections and negative+ callouts to revise or remove content). Apply all revisions to+ `design_draft.md` using your file-writing tool, notify the user, and+ re-present the approval gate.+ * **Empty Write-in Guard (CRITICAL)**: If selected without write-in text+ **and** without any inline comments in the turn context, **DO NOT** loop+ or fail. Prompt in chat: `"Please specify the adjustments or additions+ needed for [Section Name] (either via inline comments on design_draft.md+ or here in chat) so I can revise the draft."` and yield active execution+ to wait for user clarification in chat.++### Step 1: Ingest Predecessor Context (Concepts Brief or Notes)++1. **Context File**: If `Context File` is specified, read and parse it directly.+2. **Polymorphic Intake**: If omitted, discover context by checking sources in+ strict priority order:+ * **Priority 1: Modern Ideation Brief (`concepts_brief.md`)**: Check for+ `concepts_brief.md` in `./concepts_brief.md`, the conversation artifact+ directory, or `scratch/concepts_brief.md`. If found, ingest and parse+ the brief.+ * **Priority 2: Discussion Summary (`discussion_summary.md`)**: If+ `concepts_brief.md` is not found, check for `discussion_summary.md` in+ `./discussion_summary.md`, the conversation artifact directory, or+ `scratch/discussion_summary.md`. If found, ingest and parse the summary.+ **Do NOT** prompt the user to start `/egm-brainstorm` or warn of+ deprecation.+ * **Priority 3: Interactive Chat Prompt**: If neither file exists, prompt+ the user in chat for the feature's problem statement, goals, and+ technical context, or offer to launch `/egm-brainstorm`.+3. **Verify State**: Parse the document. Present a quick confirmation to the+ user to ensure we are starting with the correct context.+4. **Consensus**: Get explicit approval to start drafting the document.++### Step 2: Draft Overview, Goals & Problem Statement++1. **Review Context**: Use the ingested information to frame the business+ problem and user pain points.+2. **Draft Content**: Write "The Problem", "Overview", "Goals", and "Non-Goals"+ in clear, plain English Markdown following the design document template+ (`references/design_doc.md`).+3. **Focus**: Emphasize the *why* (the user need and business value) rather+ than the *how* (technical implementation).+4. **Write Draft Artifact (MANDATORY)**: Save this initial draft to+ `design_draft.md` in the working directory (or your harness's artifact+ directory, if it has one) using your file-writing tool.+5. **Notify & Verify (No Chat Dumps)**: You are **STRICTLY FORBIDDEN** from+ printing the draft in the chat. Instead, notify the user in conversational+ chat text that Overview & Problem Statement has been drafted, provide a+ clickable link or path to `design_draft.md`, and present the Section+ Approval Gate for `Overview & Goals`.++### Step 3: Draft Technical Plan++1. **Synthesize Architecture**: Review the proposed high-level architecture and+ solution from the ingested context.+2. **Draft Plan**: Describe the proposed changes in clear prose. Identify new+ components, modified files, and API changes. Include text-based block+ diagrams (e.g., ASCII or Mermaid) to illustrate data flow.+3. **Update Draft Artifact (MANDATORY)**: Update `design_draft.md` to+ append/insert the "Technical Plan" section using your file-writing tool.+4. **Notify & Verify (No Chat Dumps)**: You are **STRICTLY FORBIDDEN** from+ printing the technical plan in the chat. Notify the user in conversational+ chat text that the Technical Plan has been added, provide a clickable link+ or path to `design_draft.md`, and present the Section Approval Gate for+ `Technical Plan`.++### Step 4: Draft Alternatives++1. **Review Alternatives**: Recall the alternatives debated and rejected during+ brainstorming.+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+ rejected (e.g., higher latency, scaling limitations, team unfamiliarity).+4. **Update Draft Artifact (MANDATORY)**: Update `design_draft.md` to+ append/insert the "Alternatives Considered" section using your file-writing+ tool.+5. **Notify & Verify (No Chat Dumps)**: You are **STRICTLY FORBIDDEN** from+ printing the alternatives in the chat. Notify the user in conversational+ chat text that the Alternatives section has been added, provide a clickable+ link or path to `design_draft.md`, and present the Section Approval Gate for+ `Alternatives Considered`.++### Step 5: Draft Implementation++Draft a detailed implementation plan that focuses on how to implement the+feature. This plan must be detailed. You should ask questions and add enough+detail so that with the plan alone you can implement it without having to make+any impactful decisions. Follow these guidelines:++1. **Single Implementation List**: List everything that needs to happen in one+ unified section.+2. **Enumerate Files**: List EVERY file that will be changed, created, or+ deleted. Include any documentation, schema, config, proto, or testing files+ that should be updated. You MUST include a reference to every file touched+ by the plan.+3. **Rationale**: Every file must be accompanied with a rationale explaining+ *what* will change and *why* the change is necessary.+4. **Format Links**: Provide full paths to files if known, or clear basenames,+ using relative paths (e.g., `./sub/README.md` or `../sibling/README.md`) for+ intra-package and sibling documentation links.+5. **NO CODE**: Do not generate actual implementation code in this design+ draft. Pseudocode, APIs, or schemas are allowed.+6. **Update Draft Artifact (MANDATORY)**: Update `design_draft.md` to+ append/insert this "Detailed Implementation" section using your file-writing+ tool.+7. **Notify & Verify (No Chat Dumps)**: You are **STRICTLY FORBIDDEN** from+ printing the implementation plan in the chat. Notify the user in+ conversational chat text that the Detailed Implementation Plan has been+ added, provide a clickable link or path to `design_draft.md`, and present+ the Section Approval Gate for `Detailed Implementation`.++### Step 6: Write Design Document Finalization++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+ 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+ single-select gate (using a structured question tool such as `ask_question`+ with `len(questions) == 1` and `is_multi_select: false` if your harness has+ one, or plain chat):++ ```json+ {+ "questions": [+ {+ "question": "Where should the design be saved?",+ "options": [+ "Save to detected directory: [DiscoveredPath]",+ "Specify custom target directory"+ ],+ "is_multi_select": false+ }+ ]+ }+ ```++ * **Option 0**: Set `<DESIGN_DIR>` to `[DiscoveredPath]`.+ * **Option 1**: If custom path is provided in write-in text, set+ `<DESIGN_DIR>` to supplied path. If empty write-in, prompt in chat:+ `"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+ 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+ structure if any adjustments are needed.++5. **Clean Formatting**: Ensure clean standard Markdown formatting, valid table+ syntax, and proper code block fences.++6. **Handoff**: Provide a clickable link to the finalized design and recommend+ that the user review the document with:++ ```markdown+ `egm-review` <DESIGN_PATH>+ ```diff --git a/distributions/claude/skills/egm_draft/references/design_doc.md b/distributions/claude/skills/egm_draft/references/design_doc.mdnew file mode 100644index 0000000..b0c5754--- /dev/null+++ b/distributions/claude/skills/egm_draft/references/design_doc.md@@ -0,0 +1,177 @@+# [Feature/Project Name]++* **Author:** [Author Name or GitHub Handle]+* **Status:** [Draft | Proposed | In Review | Approved]+* **Date:** [YYYY-MM-DD]++--------------------------------------------------------------------------------++## Overview++<!-- Provide a high-level summary of the feature, the business or technical+problem it solves, and its context within the system. Keep it concise so both+humans and agents can quickly parse the main objective.+-->++## The Problem++[Summarize the problem and the proposed solution here.]++## Goals++<!--+What will this feature achieve? Be specific, measurable, and clear.+These goals represent the absolute criteria for success.+-->++* Goal 1+* Goal 2++## Non-Goals++<!--+Explicitly state what is out of scope. This is crucial to prevent feature creep+and to define strict boundaries for the implementation agent.+-->++* Non-Goal 1+* Non-Goal 2++## Open Questions++<!--+List unresolved design questions, technical unknowns, or dependencies requiring+investigation. Unanswered questions are retained here across drafting sessions+to preserve conversational memory and prevent future sessions from re-asking+questions that were already discussed. Remove answered questions as they are+resolved.+-->++* **Question 1**: [Description of technical unknown or open question]+* **Question 2**: [Description of technical unknown or open question]++## Critical User Journeys (CUJs)++<!--+Define the end-to-end user journeys this design enables. Each CUJ must contain:++1. Given: Preconditions, starting state, and environment configurations.+2. When: The trigger, user action, or system event.+3. Then: The expected outcome, verification criteria, and postconditions.+-->++### CUJ 1: [Journey Title]++* **Given**: [Preconditions]+* **When**: [Actions]+* **Then**: [Expected Outcomes]++### CUJ 2: [Journey Title]++* **Given**: [Preconditions]+* **When**: [Actions]+* **Then**: [Expected Outcomes]++## Technical Plan (Architecture)++<!-- Detail the high-level design, architectural choices, system data flows, and+component interactions. Include ASCII or Mermaid diagrams to clearly model the+relationships.+-->++[Explain your architectural choices, data structures, and system component+mapping here.]++```text+[Optional ASCII Architecture Diagram]+```++## Alternatives Considered++<!-- Document other architectural approaches or designs that were evaluated and+rejected. Explain the pros, cons, and the technical reasoning for why the chosen+plan is superior.+-->++### Alternative A: [Alternative Title]++* **Pros**: [List benefits]+* **Cons**: [List drawbacks]+* **Reason for Rejection**: [Why this option was not selected]++--------------------------------------------------------------------------------++## Non-Functional Requirements++<!-- Analyze non-functional concerns only if they represent critical risks for+this design:++- Security & Privacy: (Data sensitivity, auth/auth, secrets management).+- Performance & Latency: (Execution runtime, storage footprint, LLM token+ overhead).+- Rollout & Rollback: (Feature flags, backward compatibility, rollback+ commands).+-->++[Detail any critical non-functional requirements here. If none are critical,+this section can be omitted or stated as "None".]++--------------------------------------------------------------------------------++### Additional Resources++<!-- Specify the external resources and context that were used during the design+discussion. Optional. If none were provided omit this section.-->++* Important project docs referenced+* Important docs/ referenced+* Related work++### Future Improvements++<!-- Specify areas that have room for future improvement here. If none were+provided omit this section.-->++* **The idea**: What could be improved?++--------------------------------------------------------------------------------++## Detailed Implementation Plan++<!-- Specify exactly which files must be created or modified. Do not use vague+language or TBDs.+-->++### Target Files to Create/Modify++#### 1. `[File Path 1]` ([Create | Modify])++* **Type / Scope**: [e.g., Python Service, C++ Library, TypeScript Module, Build+ Configuration]+* **Proposed Changes**: [Describe the new APIs, class/function signatures, or+ behavioral logic here. Focus on the minimal required details for+ implementation.]++#### 2. `[File Path 2]` ([Create | Modify])++* **Type / Scope**: [e.g., Unit Test, E2E Test Driver]+* **Proposed Changes**: [Describe the test coverage, expected test cases, or+ mock assertions.]++### Verification Plan++<!-- Specify what unit, integration, or manual tests must pass to validate the+implementation. What metrics should be measured to verify success?+-->++* **Compilation/Build**: [e.g., `npm run build`, `cargo build`, `make`]+* **Unit Tests**: [e.g., `pytest`, `npm test`, `cargo test`]+* **Static Analysis & Linting**: [e.g., `eslint`, `ruff check`, `golangci-lint`]+* **Test Coverage Requirement**: [e.g., 85%+ branch coverage]+* **E2E/Integration**: [e.g., Integration test command or automated eval runner]++--------------------------------------------------------------------------------++<!-- Provenance: Indicates initial structural drafting via EGM. -->++*Drafted with EGM*diff --git a/distributions/claude/skills/egm_drift_report/SKILL.md b/distributions/claude/skills/egm_drift_report/SKILL.mdnew file mode 100644index 0000000..1947221--- /dev/null+++ b/distributions/claude/skills/egm_drift_report/SKILL.md@@ -0,0 +1,67 @@+---+name: egm-drift-report+license: Apache-2.0+disable-model-invocation: true+description: >-+ Runs drift detection on all design documents to check for document and+ code consistency. Produces an actionable report with differences. Use when the+ user asks to detect drift or check for consistency across all design documents+ or READMEs in a directory.+---++# Detect Drift In Designs and Code++When running in Codex or ChatGPT Work, first read [Codex integration](../../docs/codex.md).+In Claude Code or Cowork, read `${CLAUDE_PLUGIN_ROOT}/docs/claude.md` first.++When the user asks to detect drift across all designs or a set of READMEs, the+goal is to identify all instances where the codebase has diverged or failed to+implement the specifications described by those designs or READMEs.++1. **Check Input**: Verify a directory containing design documents or READMEs+ is provided. If not provided, ask the user to specify the target directory.+2. **List Documents**: List all files in the design directory.+3. **Analyze**: For EACH design document:++ * **Contextualize**: Read the design document. Identify the intent,+ proposed changes, and specific filenames/symbols mentioned.+ * **Locate Source**: Find the corresponding source code files in the+ source tree. If paths aren't explicit, use code search or grep to+ locate the relevant classes, functions, or API endpoints mentioned in+ the doc. Prompt the user to add missing links to the document to make+ future detection cheaper.+ * **Verify**: Read the current state of those source files.+ * **Detect Drift**: Compare the design vs. reality. Look specifically for:+ * Missing Features: Logic described in the doc but absent in the code.+ * Incomplete Models: Dataclasses/Classes/Structs/Protos missing fields+ specified in the design.+ * Logic Shortcuts: Hardcoded values where dynamic logic was planned.+ * Architectural Divergence: Implementation using different+ patterns/libraries than proposed.+ * **Filter**: Report ONLY the differences. Do not describe what is working+ or what matches. If the code matches the design perfectly, output "No+ drift detected."++4. **Report**: Produce a single report listing all discrepancies found.++ * Append the analysis for each file to `{YYYY-MM-DD}_DRIFT_REPORT.md`+ using your file-writing tool.+ * Strict Format:++ ```markdown+ ## <DESIGN_DOC_NAME>++ <Bulleted list of specific divergences found>+ <Or "No drift detected">+ ```++5. **Guidance**++ - Be rigorous. If a design doc mentions a specific object, field or file+ name and the code doesn't have it, that is a reportable drift. Double+ check for coverage. If there is some part of the logic that is not+ referenced in a design or README, this is a reportable drift.+ - Read files liberally to ensure you are looking at the current state+ of the code, not relying on memory.+ - Process the files sequentially to ensure the tool output buffer doesn't+ overflow.diff --git a/distributions/claude/skills/egm_resolve/SKILL.md b/distributions/claude/skills/egm_resolve/SKILL.mdnew file mode 100644index 0000000..59b759f--- /dev/null+++ b/distributions/claude/skills/egm_resolve/SKILL.md@@ -0,0 +1,162 @@+---+name: egm-resolve+license: Apache-2.0+disable-model-invocation: true+description: >-+ The Elephant resolution skill. Ingests flat deficiency reports from+ concurrent Goldfish reviewers, applies automated fixes for PROPOSE FIX+ items via UI multiple-choice gates, and presents interactive+ negotiation/re-sync checkpoints.+---++# Goldfish Review: Resolve++When running in Codex or ChatGPT Work, first read [Codex integration](../../docs/codex.md).+In Claude Code or Cowork, read `${CLAUDE_PLUGIN_ROOT}/docs/claude.md` first.++## Overview++This skill instructs the agent on how to operate within the primary Elephant+context window to parse flat deficiency reports from concurrent Goldfish+reviewers. It defends accurate design choices, applies automated textual+repairs, and manages interactive negotiation checkpoints.++## Prerequisites & Context Strategy++* **Context Recommendation (Elephant Memory)**: This skill should be run in+ the persistent conversation session that generated the target document (the+ Elephant) to recall earlier reasoning and craft higher-quality fixes.++## Inputs++The caller or orchestration driver provides exactly these parameters:++* **`TargetFile`**: Absolute or relative path to target document.+* **`LineRange`**: Exact line numbers (or `full file`).+* **`FindingsList`**: Aggregated flat list of findings from Goldfish+ reviewers.++## Execution Workflow++### Step 1: Intake Validation & Gather Context++1. **Hybrid Execution UX**: Detect if execution arguments are present:++ * *Automated Mode*: If all parameters are provided, execute silently as a+ subprocess.+ * *Standalone Human Mode*: If parameters are omitted, trigger a friendly+ onboarding flow. Prompt for one piece of input at a time, waiting for+ the user's response after each turn. Once all inputs are specified,+ display the final setup and verify the user is ready to continue.++2. Read `TargetFile` at `LineRange` by reading it and parse the `FindingsList`.++### Step 2: Evaluate & Categorize++For each finding in the list, determine:++* **CONTEST**: The critique is inaccurate or relies on a misunderstanding of+ the codebase. Provide exact code or design doc evidence defending current+ text.+* **PROPOSE FIX**: The critique is valid. Define precise textual replacements+ or structural formatting adjustments to resolve the gap.++### Step 3: Report Fixes++Construct the final report and save it named+`goldfish_review_report.md` in the working directory (or your harness's artifact directory, if it has one)+using your file-writing tool. Use this layout:++```markdown+# Goldfish Annotated Review Report++**Target:** `[TargetFile]` (`[LineRange]`)++## Prioritized Findings & AI Suggestions++{{range findings, ordered by Severity}}+### [Issue 1] [`[ReviewerPersona]`] - Severity: [High | Medium | Low]+* **Affected Scope:** [Lines Start-End]([RelativePath]#L[Start]-L[End]) ([Sub-header])+* **Discrepancy Description:** [copied from FindingsList]+* **Rationale:** [copied from FindingsList]+* ***AI Suggestion:*** [CONTEST | PROPOSE FIX]+* ***Justification:*** [Detailed reason]+* ***Proposed Edit:***+ * Location: [Line/Header]+ * Change: [Precise replacement string or deletion note]+{{end}}+```++### Step 4: Interactive Resolution Gate++Before proceeding, output a visible chat message to the user: *"I have compiled+the audit findings into `goldfish_review_report.md`. Please review the findings there and choose how you would like to+proceed:++- **Comment directly on the file**: Review `goldfish_review_report.md` in+ chat or the file and leave comments/edits to approve, reject, or contest+ specific items.+- **Auto accept**: Reply "auto accept" to batch-apply all proposed fixes+ (skipping contested items).+- **Continue to next phase**: Reply "continue" or "no changes" to proceed+ without applying fixes.+- **Interactive breakdown**: Reply "interactive breakdown" for a guided,+ item-by-item walkthrough in chat with detailed explanations for each+ proposed edit or contested finding before making decisions.+- **Custom instruction / Wildcard request**: Reply with any custom+ instruction, question, or out-of-band request."*++You **MUST** immediately yield active execution by calling **zero tools** in+this turn payload. You must stop execution and go idle, waiting for the human+developer to comment on/edit the artifact or reply in the chat.++Interpret the user's action/response as follows:++- **"Auto accept" / "Accept all suggestions" / User clicks "Proceed" without+ contesting**: Apply all fixes where the AI suggestion was `PROPOSE FIX`+ directly to `TargetFile` at `LineRange` in a single batch using+ your file-editing tool. Any items categorized as `CONTEST` are explicitly+ bypassed. Then proceed to Step 5.+- **"Continue to next phase" / "No changes"**: Do not apply any automated+ fixes. Then proceed to Step 5.+- **"Interactive breakdown"**: Enter a sequential breakdown loop over ALL+ finding items (both `PROPOSE FIX` and `CONTEST`):++ 1. For each item `i`, output a visible chat message formatting the full+ finding details and explanation in rich markdown:++ ```markdown+ ### Breakdown Item [i]: [Issue Title] [`[ReviewerPersona]`]+ * **Scope:** [Lines Start-End]([RelativePath]#L[Start]-L[End]) ([Sub-header])+ * **Description:** [Description]+ * **AI Suggestion:** [CONTEST | PROPOSE FIX]+ * **Explanation & Justification:** [Detailed reason and background explaining why the fix is proposed or why the finding is contested]+ * **Proposed Edit:** [Precise replacement text or deletion note]+ ```++ Then prompt the user in chat for their decision on this item (calling+ **zero tools** and going idle):++ * If `PROPOSE FIX`: Ask the user to reply with **Accept proposed+ fix**, **Skip / ignore**, or **Discuss**.+ * If `CONTEST`: Ask the user to reply with **Skip / agree with+ contest**, **Overrule contest (propose fix)**, or **Discuss**.++ 2. Record the user's decisions in an internal memory checklist (e.g., *Item+ 1: Accepted*, *Item 2: Ignored*, *Item 3: Overruled*). **Do NOT call any+ file editing tools during this sequential loop.**++ 3. Once all items have been decided, summarize the accepted edits, execute+ them using your file-editing tool, and proceed to Step 5.++- **Custom instruction / Out-of-band edit**: If the user provides targeted+ instructions, apply them and proceed.++### Step 5: Post-Resolution Synchronization & Exit++1. **Re-verify Lines**: If changes were made to `TargetFile`, verify that the+ file remains structurally coherent and valid markdown.+2. Mark the report as resolved (add a `Status: resolved` line at the top).+3. **Handoff**: Exit cleanly back to the caller (such as `egm-review-loop`)+ with the count of accepted fixes, contested items, and remaining unaddressed+ issues.diff --git a/distributions/claude/skills/egm_review/SKILL.md b/distributions/claude/skills/egm_review/SKILL.mdnew file mode 100644index 0000000..2a1b3cc--- /dev/null+++ b/distributions/claude/skills/egm_review/SKILL.md@@ -0,0 +1,397 @@+---+name: egm-review+license: Apache-2.0+disable-model-invocation: true+description: >-+ Orchestrates the EGM Goldfish Review Protocol. Used as part of the EGM+ process to perform design document reviews. Executes five review phases:+ Initial Zoom Out Review, Comprehension Review, Design Critique, Intermediate+ Zoom Out Review, and Implementation Readiness.+---++# Review, Validation & Automated Remediation++When running in Codex or ChatGPT Work, first read [Codex integration](../../docs/codex.md).+In Claude Code or Cowork, read `${CLAUDE_PLUGIN_ROOT}/docs/claude.md` first.++Reviews and validates a design document through specialized reviewer personas.++## Delegation++A Goldfish runs in a fresh context with no conversation history. Spawn each+subagent with your harness's subagent tool (Antigravity: `invoke_subagent`; Claude Code: `Agent`; Codex: `spawn_agent`). Each subagent is defined in `agents/<file>.md`, and its+frontmatter `name` (for example `egm-zoom-out`) is the subagent type to request+where your harness registers named subagents. Otherwise spawn a general-purpose+subagent and tell it to read that persona file first. Pass the prompt verbatim+and wait for the report. If your harness cannot nest subagents,+use direct dispatch instead of the synthesizer. See `docs/harnesses.md`.+If your harness has no subagent tool, stop and tell the user: a review in the same context is not a Goldfish review.++## Execution Constraints (CRITICAL)++1. **Artifact-First Delivery (MANDATORY)**: You are **STRICTLY FORBIDDEN** from+ presenting large proposals, drafts, summaries, or plans directly in the chat+ pane. You **MUST** write them to the working directory (or your harness's+ artifact directory, if it has one) using your file-writing tool and then+ tell the user in chat the file path and ask for review. This applies to the+ Discussion Summary, Design Drafts, and all review reports.+2. **Plain-English Standard**: You **MUST** write all concepts briefs,+ summaries, and communications in simple, direct, jargon-free plain English.+ Explain technical mechanisms directly. Do not summarize away substance or+ rely on buzzwords. Do not use ungrounded promotional adjectives (e.g.,+ *seamless*, *robust*, *blazingly fast*) or decorative adverbs (e.g.,+ *seamlessly*, *effortlessly*, *literally*, *drastically*, *obviously*).+3. **Default to Stress-Testing**: Never agree by default. Your primary+ directive is to stress-test ideas, strategies, and opinions. Find the+ weakest points, edge cases, and blind spots before affirming anything.+4. **No Glazing**: Eliminate sycophancy. Do not call ideas "great,"+ "brilliant," or "smart." Compliments without substance are noise.+5. **Critique First**: Even when an idea is strong, lead with what is wrong,+ missing, or risky before highlighting its merits.+6. **Reject Echo-Chamber Framing**: Never parrot framing back to the user. If a+ conclusion is asserted, do not validate it reflexively.+7. **Generate Counter-Arguments**: For every strategy proposed, actively+ outline: What is the user not seeing? What is the strongest+ counter-argument? Is the opposing view justified?+8. **Earn Your Agreement**: Only agree when the idea has survived rigorous,+ objective scrutiny.+9. **Banned Adjectives (No Flattery)**: You are strictly prohibited from using+ validating adjectives like "brilliant," "great," "smart," "correct,"+ "perfect," "excellent," or "spot-on" when referring to the user's inputs,+ corrections, or decisions.+10. **Banned Apologies**: You MUST NOT output polite apologies (e.g., "I+ apologize," "I am sorry," "Forgive me") when challenged or corrected.+ Instead, outline the corrected technical logic or trade-offs directly.+11. **Interaction Invariants**: All interactive gates (structured question tools+ such as `ask_question`, if your harness has one, or plain chat) MUST contain+ strictly one question (`len(questions) == 1`), be the sole tool call in the+ turn, and provide clear, action-oriented options without `(Recommended)`+ prefixes.++## Inputs++* **`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).+* **`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.++## Workflow++### Step 1: Intake & Setup++1. Verify if `TargetFile` is provided. If missing:+ * Explain to the user that the target design document path is required to+ analyze its structure and discover the semantic split.+ * Prompt the user in chat for the path via a regular text message (do NOT+ 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:+ * 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.+ * 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.++### Step 2: Curated Pipeline Preset Selection++1. **Preset Gate Check**:+ * If `Step` parameter was explicitly provided during invocation (e.g.+ `interactive`, `uninterrupted`, `feature_spec`, `implementation`, or an+ individual stage `5`, `6`, `7`, `8`, `9`), map to the corresponding+ preset or subflow and bypass the interactive preset selection gate.+ * Otherwise (if `Step` was omitted), you **MUST** present the Curated+ Pipeline Presets single-select gate to the user (using a structured+ question tool such as `ask_question` if your harness has one, or plain+ chat).+2. **Modal Invariants & Wire Payload**:++ * The question payload **MUST** contain strictly one question object+ (`len(questions) == 1`). Multi-question payloads are strictly forbidden.+ * The question tool **MUST** be the sole tool call in this turn payload.+ You **MUST** yield execution immediately upon invocation.+ * `is_multi_select` **MUST** be `false`. Combinatorial multi-select+ checklists are strictly prohibited to protect topological dependencies+ (5 → 6 → 7 → 8 → 9).+ * Option 0 **MUST** be the primary default action (without a+ `(Recommended)` prefix).+ * Payload specification:++ ```json+ {+ "questions": [+ {+ "question": "Select the review execution mode for this document:",+ "options": [+ "Interactive review with all review rubrics (step-by-step, check in after each review)",+ "Consolidated report with all review rubrics (runs full flow without stopping)",+ "Feature spec only (evaluate design without considering implementation)",+ "Implementation plan only (evaluate design for implementation readiness)"+ ],+ "is_multi_select": false+ }+ ]+ }+ ```++3. **Action Dispatch Based on Preset**:++ * **Preset 0: `Interactive review with all review rubrics`**: Proceed to+ Step 3 to discover the semantic split, then execute Stages 5, 6, 7, 8,+ and 9 sequentially with interactive checkpoint gates between stages.+ * **Preset 1: `Consolidated report with all review rubrics`**: Proceed to+ Step 3 to discover the semantic split, then execute all five stages+ without pausing for checkpoints, consolidating findings into+ `consolidated_review_report.md`.+ * **Preset 2: `Feature spec only`**: **Bypass Step 3 semantic split+ discovery entirely**. Set `FeatureRange = 1..End`, set `DetailedRange =+ N/A`, and execute Stages 5, 6, 7, and 8 with checkpoints. Cleanly halt+ review after Stage 8 before Stage 9.+ * **Preset 3: `Implementation plan only`**: Proceed to Step 3 to discover+ the semantic split, confirm `DetailedRange`, and jump directly to Stage+ 9 (Implementation Readiness Test).++### Step 3: Semantic Split Discovery++1. **Split Bypass Check**: If Preset 2 (`Feature spec only`) was selected,+ **skip this step completely**. Set `FeatureRange` to cover the entire+ document (lines 1 through End) and proceed directly to Step 4.+2. **Inspect Document**: Read `TargetFile` to inspect its structure and line+ count.+3. **Discover Split Boundary**: Scan for the primary dividing header `##+ Detailed Implementation Plan` (or standard synonyms: `## Implementation+ Plan`, `## Work Breakdown`, `## Implementation Steps`).+ * **Standard Layout Detected**: If the boundary header is unambiguously+ identified at line $L$:+ * Automatically assign `FeatureRange = 1..(L-1)`.+ * Automatically assign `DetailedRange = L..End`.+ * Output a concise confirmation message to the user in chat:+ `"Discovered semantic boundary at line L. FeatureRange: 1..(L-1),+ DetailedRange: L..End."`+ * Proceed directly to Step 4 without presenting a confirmation modal.+ * **Ambiguous Boundary / Multiple Candidate Headers**: If multiple+ conflicting headers or non-standard structures exist:+ * Present a single-select gate (using a structured question tool such+ as `ask_question` with `len(questions) == 1`, or plain chat)+ proposing the most likely split line as Option 0, with Option 1+ allowing custom line ranges via write-in.+ * **No Implementation Plan Found**: If the document contains only a+ high-level feature specification:+ * Notify the user in chat that no implementation plan was detected.+ * Assign `FeatureRange = 1..End` and `DetailedRange = N/A`.+ * Offer to execute Stages 5–8 (Feature Spec gates) and proceed.++### Step 4: Staging Strategy++Once the semantic split and execution preset are confirmed:++1. **Confirm Review Target**: Verify that `FeatureRange` and `DetailedRange`+ are bound.+2. **Dispatch Execution Pipeline**:+ * **Interactive review with all review rubrics**: Execute Stage 5 → Stage+ 6 → Stage 7 → Stage 8 → Stage 9 sequentially.+ * **Consolidated report with all review rubrics**: Run Subflow:+ Uninterrupted Full Flow.+ * **Feature spec only**: Execute Stage 5 → Stage 6 → Stage 7 → Stage 8,+ then cleanly halt.+ * **Implementation plan only**: Jump directly to Stage 9 (Implementation+ Readiness Test).++--------------------------------------------------------------------------------++## Subflows++### Subflow Checkpoint Gates & Pause/Resume Protocol++All interactive review stages conclude with an explicit single-select gate+(using a structured question tool such as `ask_question` with+`len(questions) == 1`, `is_multi_select: false`, sole tool call in turn, or+plain chat):++1. **Stage Checkpoint Patterns**:+ * **Stages 5, 6, 8 (Altitude & Comprehension Checkpoints)**:+ * Option 0: `Proceed to next stage: Stage [N+1] ([Next Stage Name])`+ (or `Conclude review and begin detailed implementation planning` for+ Stage 8 terminal).+ * Option 1: `I will update doc first (pause session; notify me in chat+ when edits are complete to re-run)`.+ * Option 2: `Pause Review (save progress and exit)`.+ * **Stages 7, 9 (Remediation & Readiness Checkpoints)**:+ * Option 0: `Proceed to next stage: Stage [N+1] ([Next Stage Name])`+ (or `Conclude review and finalize document` for Stage 9 terminal).+ * Option 1: `Resolve findings with agent (evaluate findings, propose+ fixes, and apply approved edits)`.+ * Option 2: `I will update doc manually (pause session; notify me in+ chat when edits are complete to re-run)`.+ * Option 3: `Pause Review (save progress and exit)`.+2. **Resolution Semantics (Option 1 for Stages 7 and 9)**:+ * **Hand-off to Resolver**: The agent invokes `egm-resolve` in the primary+ Elephant context window on the target range (`FeatureRange` or+ `DetailedRange`), passing the parsed findings from `critic_report.md` or+ `implementation_readiness_report.md`.+ * **Resolution Workflow**: The Elephant classifies each finding (`PROPOSE+ FIX` vs `CONTEST`), writes `goldfish_review_report.md`, and executes+ approved edits on `TargetFile` via file editing tools.+ * **Convergence**: After applying fixes, re-read `TargetFile` to+ recalculate line bounds, and either advance to the next stage or re-run+ the stage audit (enforcing max 1 re-audit limit).+3. **Pause & Resume Semantics (Manual Doc Updates)**:+ * **Turn Yield**: The agent confirms in chat that the review is paused for+ manual document edits, and yields execution immediately.+ * **Resume Notification**: When the author replies in chat indicating+ edits are complete:+ * Re-read `TargetFile` to recalculate line shifts.+ * 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+ re-audit, inform the author that the cap is reached, document+ residual findings as accepted trade-offs, auto-bind Option 0, and+ advance to the next stage.+4. **Graceful Halt Semantics (`Pause Review`)**:+ * Halt execution immediately with zero tools, preserving all report+ artifacts.++### Subflow: Uninterrupted Full Flow++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):+ * **Step 5 (Initial Zoom Out)**: Spawn `egm-synthesizer` (or direct+ subagent) with `Reviewers: [egm-zoom-out]` on `full file` → write+ `zoom_out_report.md`.+ * **Step 6 (Comprehension Test)**: Spawn `egm-synthesizer` (or direct+ subagent) with `Reviewers: [egm-comprehension]` on `FeatureRange` &+ `DetailedRange` → write `comprehension_report.md`.+ * **Step 7 (Critic Review)**: Spawn `egm-synthesizer` (or direct+ subagents) with `Reviewers: [egm-design, egm-structural, egm-style]` on+ `FeatureRange` → write `critic_report.md`.+ * **Step 8 (Intermediate Zoom Out)**: Spawn `egm-synthesizer` (or direct+ subagent) with `Reviewers: [egm-zoom-out]` on `full file` → write+ `intermediate_zoom_out_report.md`.+ * **Step 9 (Implementation Readiness Test)**: Spawn `egm-synthesizer` (or+ direct subagents) with `Reviewers: [egm-implementation-readiness,+ egm-codebase-details, egm-style]` on `DetailedRange` → write+ `implementation_readiness_report.md`.+2. **Cross-Stage Synthesis & Deduplication**:+ * Collect all findings across the 5 stage reports.+ * Consolidate observations into actionable tasks by priority (🔴 Blocker, 🟡+ Major, 🟢 Nit).+ * Build a Traceability Matrix mapping raw findings to consolidated action+ items.+3. **Deliverable Delivery**: Write to `consolidated_review_report.md` using+ your file-writing tool.+4. **Notify User**: Output a concise chat notification pointing to+ `consolidated_review_report.md` (give its path).++### Subflow: Zoom Out Review++1. **Delegate to Synthesizer Subagent**: Spawn `egm-synthesizer` (or the+ specialized `egm-zoom-out` subagent at `agents/zoom_out.md`) on `full file`+ applying `resources/document_standards/zoom-out-standard.md`. When running+ as Step 8 (Intermediate Zoom Out), include `zoom_out_report.md` path in+ context and focus on additions/mitigations from Comprehension and Critic+ stages.+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+ the report file (give its path).+4. **Checkpoint Gate**: Present the tri-state gate following the Checkpoint+ Gate Protocol:+ * **Stage 5**: Question: `"Stage 5 (Initial Zoom Out Review) completed.+ Findings written to zoom_out_report.md. How would you like to+ proceed?"`, Option 0: `"Proceed to next stage: Stage 6 (Comprehension+ Test)"`.+ * **Stage 8 (Feature Spec Gates Only)**: Question: `"Stage 8 (Intermediate+ Zoom Out) completed. High-level architecture verified. How would you+ like to proceed?"`, Option 0: `"Conclude review and begin detailed+ implementation planning"`.+ * **Stage 8 (Interactive Full Flow)**: Question: `"Stage 8 (Intermediate+ Zoom Out) completed. Findings written to+ intermediate_zoom_out_report.md. How would you like to proceed?"`,+ Option 0: `"Proceed to next stage: Stage 9 (Implementation Readiness+ Test)"`.+ * All cases provide Option 1: `"I will update doc first (pause session;+ notify me in chat when edits are complete to re-run)"` and Option 2:+ `"Pause Review (save progress and exit)"`.++### Subflow: Comprehension Test++1. **Delegate to Synthesizer Subagent**: Spawn `egm-synthesizer` (or the+ `egm-comprehension` subagent at `agents/comprehension.md`) on `FeatureRange`+ & `DetailedRange` applying+ `resources/document_standards/re-implementation-standard.md`.+2. **Delivery**: Write findings to `comprehension_report.md` using your+ file-writing tool.+3. **Notify User (No Chat Dumps)**: Notify user that findings are written to+ `comprehension_report.md` (give its path).+4. **Checkpoint Gate**: Present the Stage 6 tri-state gate:+ * Question: `"Stage 6 (Comprehension Test) completed. Findings written to+ comprehension_report.md. How would you like to proceed?"`+ * Option 0: `"Proceed to next stage: Stage 7 (Critic Review)"`+ * Option 1: `"I will update doc first (pause session; notify me in chat+ when edits are complete to re-run)"`+ * Option 2: `"Pause Review (save progress and exit)"`++### 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+ standards `{"egm-design": "feature-spec-standard", "egm-structural":+ "feature-spec-standard"}`.+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:+ * Question: `"Stage 7 (Critic Review) completed. Findings written to+ critic_report.md. How would you like to proceed?"`+ * Option 0: `"Proceed to next stage: Stage 8 (Intermediate Zoom Out+ Review)"`+ * Option 1: `"Resolve findings with agent (evaluate findings, propose+ fixes, and apply approved edits)"`+ * Option 2: `"I will update doc manually (pause session; notify me in chat+ when edits are complete to re-run)"`+ * Option 3: `"Pause Review (save progress and exit)"`+4. **Remediation & Resolution (Option 1)**:+ * Invoke `egm-resolve` in the primary Elephant context on `FeatureRange`,+ passing findings from `critic_report.md` (or+ `goldfish_review_report.md`).+ * Execute approved fixes directly on `TargetFile` using file editing+ tools.+ * After fixes are applied, re-read `TargetFile` to recalculate line+ bounds, and advance to Stage 8 (or re-run Stage 7, max 1 re-audit).++### Subflow: Implementation Readiness Test++1. **Invoke Antagonistic Review Loop**: Invoke `egm-review-loop` in-thread on+ `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"}`.+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:+ * Question: `"Stage 9 (Implementation Readiness Test) completed. Report+ written to implementation_readiness_report.md. How would you like to+ proceed?"`+ * Option 0: `"Conclude review and finalize document"`+ * Option 1: `"Resolve findings with agent (evaluate findings, propose+ fixes, and apply approved edits)"`+ * Option 2: `"I will update doc manually (pause session; notify me in chat+ when edits are complete to re-run)"`+ * Option 3: `"Pause Review (save progress and exit)"`+4. **Remediation & Resolution (Option 1)**:+ * Invoke `egm-resolve` in the primary Elephant context on `DetailedRange`,+ passing findings from `implementation_readiness_report.md` (or+ `goldfish_review_report.md`).+ * Execute approved fixes directly on `TargetFile` using file editing+ tools.+ * After fixes are applied, re-read `TargetFile` to recalculate line+ bounds, and conclude the review session (or re-run Stage 9, max 1+ re-audit).diff --git a/distributions/claude/skills/egm_review_loop/SKILL.md b/distributions/claude/skills/egm_review_loop/SKILL.mdnew file mode 100644index 0000000..5a060a0--- /dev/null+++ b/distributions/claude/skills/egm_review_loop/SKILL.md@@ -0,0 +1,160 @@+---+name: egm-review-loop+license: Apache-2.0+disable-model-invocation: true+description: >-+ Executes the Antagonistic-Review process from the Elephant-Goldfish+ Model (EGM) via an automated multi-agent review loop to audit documents+ against qualitative standards and structural templates, and automatically+ apply approved fixes. Use when reviewing design docs, READMEs, feature+ specifications, implementation plans, or verifying document completeness+ and tone.+---++# Goldfish Review: Loop (Orchestration Driver)++When running in Codex or ChatGPT Work, first read [Codex integration](../../docs/codex.md).+In Claude Code or Cowork, read `${CLAUDE_PLUGIN_ROOT}/docs/claude.md` first.++## Overview++This skill acts as the central orchestration engine driving the multi-agent+review loop. It coordinates two distinct agent memory models:++* **The Goldfish (Adversarial Auditors)**: Subagents spawned in isolated,+ fresh context windows to catch unstated assumptions without historical bias.+* **The Elephant (Persistent Resolver)**: The primary agent context holding+ institutional knowledge to evaluate findings and apply approved repairs.++The driver manages argument intake, resolves paths for reviewers and standards,+unconditionally re-parses target line ranges before every iteration, spawns+concurrent specialized Goldfish auditors based on configuration, and coordinates+with the Elephant context to resolve findings.++## Delegation++A Goldfish runs in a fresh context with no conversation history. Spawn each+subagent with your harness's subagent tool (Antigravity: `invoke_subagent`; Claude Code: `Agent`; Codex: `spawn_agent`). Each subagent is defined in `agents/<file>.md`, and its+frontmatter `name` (for example `egm-zoom-out`) is the subagent type to request+where your harness registers named subagents. Otherwise spawn a general-purpose+subagent and tell it to read that persona file first. Pass the prompt verbatim+and wait for the report. If your harness cannot nest subagents,+use direct dispatch instead of the synthesizer. See `docs/harnesses.md`.+If your harness has no subagent tool, stop and tell the user: a review in the same+context is not a Goldfish review.++## Inputs++The caller or user provides exactly these parameters:++* **`TargetFile`**: Absolute or relative path to target document.+* **`SemanticTarget`**: Descriptive targeting string (e.g., *"Target the H4+ block with SS-ID 'S1.12'"*), or `full file`.+* **`Reviewers`**: List of reviewer names (shortnames or paths).+* **`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.++## Path & Standard Resolution Logic++When resolving names in `Reviewers` and `Standards`:++* **Reviewer Shortnames**: Map reviewer shortname (e.g., `design_critic`,+ `structural`, `style`, `implementation_readiness`,+ `codebase_details`, `comprehension`, `zoom_out`) to `agents/{name}.md`.+ The persona file defines the reviewer's core mandates, audit vectors, and+ output format.+* **Standard Shortnames**: Map standard shortname (e.g., `feature-spec-standard`,+ `implementation-readiness-standard`, `zoom-out-standard`, `heilmeier-standard`,+ `re-implementation-standard`) to `resources/document_standards/{name}.md`.+* **Custom Paths**: If the name contains a slash (`/`), treat it as an+ absolute or workspace-relative path and read it directly.++## Execution Workflow++### Step 1: Intake & Configuration UX++Evaluate the provided inputs (`TargetFile`, `SemanticTarget`, `Reviewers`,+`Standards`, `GoldfishContext`).++1. **Identify Missing Inputs**: Determine which of the required parameters are+ missing.+2. **Interactive Onboarding**:+ * If **all** inputs are present, proceed to Step 2.+ * If **some or all** inputs are missing, interactively prompt the user+ **only for the missing inputs**, one at a time via chat messages.+3. **Reviewer Recommendations**:+ * *Feature Specs*: Recommend `design_critic` (mapped to+ `resources/document_standards/feature-spec-standard.md`) and+ `structural` (mapped to `resources/document_standards/feature-spec-standard.md`).+ * *Implementation Plans*: Recommend `implementation_readiness`+ (mapped to `resources/document_standards/implementation-readiness-standard.md`)+ and `codebase_details`.+4. **Confirm Configuration**: Display the consolidated plan (Target, Reviewers,+ and mapped Standards) and ask the user to confirm before proceeding.++### Step 2: The Sharpening Loop (Iterative Cycle)++Execute the following sequence in a continuous loop:++#### 2.1 Unconditional Target Resolution++Before every iteration, unconditionally re-scan `TargetFile` by reading it+and using the stable `SemanticTarget` string (e.g., locating the target header) to+dynamically determine the updated absolute start and end line numbers. This+ensures absolute accuracy even if the file was edited in prior rounds. (If `full+file` mode is specified, confirm full-file line bounds).++#### 2.2 Review Swarm Execution++1. **Launch Subagent Swarm**:+ Spawn subagents to execute the review:+ * **Hierarchical Dispatch (Synthesizer)**: Spawn the intermediate+ synthesizer subagent (`agents/synthesizer.md` / `egm-synthesizer`).+ 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.+ * **Direct Dispatch (Flat Swarm)**: Alternatively, spawn each requested+ reviewer subagent in `Reviewers` directly.+ Instruct each subagent to first read its persona definition in+ `agents/{name}.md`, then audit `TargetFile` at the resolved line range+ against its designated standard in `resources/document_standards/`,+ supplying `GoldfishContext`.+ * Each reviewer produces findings with severity (🔴 Blocker, 🟡 Major, 🟢+ Nit), line numbers, discrepancy descriptions, and rationales.+2. **Consolidate Findings**: Collect all findings across reviewers into a single+ flat `FindingsList`.++#### 2.3 Aggregated Resolution Hand-off++1. Pass `TargetFile`, the active line range, and the aggregated `FindingsList`+ to the **`egm-resolve`** workflow.+2. Execute the resolution workflow in the primary Elephant context:+ * Categorize findings into `CONTEST` vs. `PROPOSE FIX`.+ * Save `goldfish_review_report.md` with your file-writing tool.+ * Present the interactive decision gate (Auto accept, Continue, Interactive+ breakdown).+ * Apply approved text repairs to `TargetFile` using your file-editing tool.++#### 2.4 Iteration Check & Turn Boundary++The cycle repeats until reviewers report zero remaining findings or the user+explicitly halts it.++**Crucial Turn-Taking Requirement**: After the resolution phase finishes for a+given round, the loop driver **MUST respect the turn-taking checkpoint in+`egm-resolve`**. The driver must remain idle across human turns,+only looping back to Step 2.1 when the user explicitly confirms they wish to run+another round of review.++### Step 3: Output Boundary & Final Checkpoint++Upon successful completion (e.g., zero findings remaining or manual halt):++* **Programmatic Callers**: If running as a subflow of `egm-review`, exit+ cleanly to hand execution back to the parent workflow.+* **Manual Invocations**: Output a summary of completion in chat: *"The review+ loop has completed with zero remaining issues. Would you like to proceed to+ the next stage, or do you have any final questions?"*diff --git a/docs/claude.md b/docs/claude.mdindex d6f6a70..eb9284e 100644--- a/docs/claude.md+++ b/docs/claude.md@@ -51,15 +51,29 @@ invoked skill. Never guess a cache version or search another installed copy.Review targets and generated artifacts belong to the user's workspace, not theplugin cache. Pass absolute resource and target paths to each reviewer.-Personas and standards live in the plugin cache, outside the project. A-`PreToolUse` hook in `.claude-plugin/plugin.json` approves `Read`, `Grep`, and-`Glob` calls inside the plugin's `agents/`, `docs/`, `resources/`, and-`skills/` folders only, so reviewers read them with no permission rules, also-in headless runs and background subagents. Other paths get the normal-permission rules, and deny and ask rules still apply to plugin paths. Where-plugin hooks do not run (Claude Cowork, or `disableAllHooks`), approve the read-prompts, or for headless runs pass `--allowedTools Read,Grep,Glob`. A reviewer-that cannot read its persona or standard has not reviewed.+Personas and standards live in the plugin cache, outside the project. EGM+does not install a permission-approval hook. Approve resource reads through+Claude Code's normal permission prompts; current versions can surface background+reviewer prompts in the parent session. For headless runs, the user must grant+read access to the resolved plugin's `agents/`, `docs/`, `resources/`, and+`skills/` folders using Claude Code's permission settings. Keep write access+limited to the project and intended output directory. Do not disable permission+checks or grant access to every installed plugin. A reviewer that cannot read+its persona or standard must report the limitation and stop; it has not reviewed.++For example, after resolving the actual installed plugin directory, add only+its resource folders to user-approved read rules in `/permissions`:++```text+Read(//absolute/plugin/path/agents/**)+Read(//absolute/plugin/path/docs/**)+Read(//absolute/plugin/path/resources/**)+Read(//absolute/plugin/path/skills/**)+```++Replace the example path; do not copy a guessed cache location. These read rules+also cover Grep and Glob on those files on a best-effort basis. Adding a directory+with `--add-dir` extends edit access too, so it is not a read-only substitute.## Reviewer isolation@@ -76,9 +90,11 @@ Reviewers cannot edit files or run shell commands, and no persistent `memory`is configured. The synthesizer adapter declares`tools: [Agent, Read, Grep, Glob, Write]` so it can spawn reviewers and writereports but cannot run shell commands or use the session's MCP connectors.-The bootstrap orchestrator adapter keeps all tools because the bootstrap-skill uses the shell; it routes workers to the bootstrap `SKILL.md` so they-return the JSON `subtree_index` instead of prose. The parent handles fixes.+The bootstrap orchestrator adapter allows only `Agent`, `Bash`, `Read`, `Grep`,+`Glob`, `Write`, and `Edit` for local discovery and documentation. It routes+workers to the bootstrap `SKILL.md` so they return the JSON `subtree_index`+instead of prose. The parent handles fixes. Bash remains subject to normal+permission rules and is not a filesystem or network sandbox.Reviewers cannot open URLs. Do not pass documentation URLs in`GoldfishContext` to Claude reviewers: save the raw page as a file in theworkspace and pass that path instead.diff --git a/docs/codex.md b/docs/codex.mdindex fee7811..6755aee 100644--- a/docs/codex.md+++ b/docs/codex.md@@ -92,12 +92,19 @@ For personal testing, open Plugins > Add > Upload plugin archive in ChatGPT.Package the runtime files from the repository root:```sh-zip -r egm-chatgpt.zip plugin.json .codex-plugin skills agents resources docs LICENSE README.md+python3 scripts/pack_plugin.py --target openai --output /tmp/egm-chatgpt```-Upload the archive, install the plugin, and use **Try in chat** in a new Work-chat. This path was exercised separately from workspace marketplace import.+Use a fresh output directory. Upload `/tmp/egm-chatgpt/egm-openai.zip` and+install the plugin in the ChatGPT desktop app. Use+**Try in chat** in a new thread that runs locally. The earlier cloud Work+test in `TESTING.md` predates this package's desktop-only declaration.Keep repository marketplace catalogs and development files outside this archive.+The OpenAI directory package declares local execution because bootstrap uses+shell commands. Its listing uses the portable manifest's OpenAI extension;+the Codex compatibility manifest retains matching metadata for native installs.+Keep `.claude-plugin/` outside the OpenAI archive: its agent adapters belong+to the Claude Code integration. Public directory plugins cannot include hooks.Enterprise, Business, and Edu workspaces can import the plugin via Admin > Plugins > Add > Import marketplace.Set the repository URL to `https://github.com/google/elephant-goldfish-model` and marketplace path to `.agents/plugins`.diff --git a/docs/designs/architecture.md b/docs/designs/architecture.mdindex 0207b1b..3e1126b 100644--- a/docs/designs/architecture.md+++ b/docs/designs/architecture.md@@ -153,7 +153,7 @@ sequenceDiagram### Phase 5: Implementation & Drift Monitoring* **Execution**: Coding agents implement code strictly adhering to the- approved design document. (No Skill.md is required here because the design+ approved design document. (No Skill.md is required here because the designdocument is complete and detailed.)* **Maintenance**: `/egm-drift-report` is run periodically (e.g. weekly) todetect divergence between codebase implementations and checked-in design docs.diff --git a/docs/designs/drift_report.md b/docs/designs/drift_report.mdindex b9ab157..fe679ee 100644--- a/docs/designs/drift_report.md+++ b/docs/designs/drift_report.md@@ -121,5 +121,3 @@ The drift detection skill is implemented across the following files:## References* Dave Rensin, [Elephants, Goldfish, and the New Golden Age of Software Engineering](https://medium.com/@drensin/elephants-goldfish-and-the-new-golden-age-of-software-engineering-c33641a48874) (Medium, 2026).--diff --git a/docs/directory.md b/docs/directory.mdnew file mode 100644index 0000000..df344da--- /dev/null+++ b/docs/directory.md@@ -0,0 +1,29 @@+# Directory packages++Build a runtime folder and ZIP using only Python's standard library:++```sh+python3 scripts/pack_plugin.py --target claude --output /tmp/egm-release+python3 scripts/pack_plugin.py --target openai --output /tmp/egm-release+```++The output contains `egm-claude/` and `egm-claude.zip`, or `egm-openai/`+and `egm-openai.zip`. Existing outputs are refused. ZIP entry order,+timestamps, and permissions are fixed; identical inputs produce identical+archives on the same Python/zlib runtime.++The allowlist includes skill instructions and references, personas, standards,+runtime guides, manifests, and icons. It excludes the site, tests, workflows,+marketplace catalogs, hooks, and build tools. Claude retains its native agent+adapters; OpenAI excludes Claude components. Runtime files are nonexecutable.+Symlinked runtime paths and escaping manifest references are rejected.+Contributor instructions, the AI policy, and the exact Markdown PR template+are included to preserve documentation links. No workflow configuration ships.++For Anthropic, the generated runtime is checked in at `distributions/claude`.+Submit that subfolder through the directory portal. After source changes,+build into a fresh temporary directory, replace `distributions/claude` with+the generated `egm-claude/` folder, and run `pytest tests/unit`. The freshness+test compares every published path and byte to a new build. Do not commit ZIPs.+For OpenAI, upload `egm-openai.zip`. Build output+alone does not establish installation, workflow support, or directory approval.diff --git a/docs/privacy.md b/docs/privacy.mdnew file mode 100644index 0000000..a48c5af--- /dev/null+++ b/docs/privacy.md@@ -0,0 +1,45 @@+<!-- Copyright 2026 Google LLC. SPDX-License-Identifier: Apache-2.0 -->++# EGM data handling++EGM is a set of skills, reviewer instructions, and local documentation workflows.+The runtime package does not operate a hosted service, database, analytics client,+or telemetry endpoint. It does not require a separate EGM account or credentials.++## Inputs and outputs++The host assistant reads the project files, design documents, prompts, and review+context supplied for the selected task. Those inputs can contain personal or+confidential information. Provide only the files needed for the review.++EGM writes briefs, design documents, README files, and review reports to the user's+workspace or the host's artifact storage. Outputs can repeat information from+the inputs. Local files persist until the user deletes them; EGM does not apply+an automatic retention period.++## Processing and external services++The selected host processes prompts, files, model responses, and agent activity+under that host's own account settings, terms, and privacy policy. Native agent+calls use the user's host account. EGM does not control host transcript, artifact,+backup, or model-provider retention.++Bootstrap can run local discovery commands and an existing project-configured+formatter. A formatter or other user-approved project command may contact a+package registry or another service. Inspect and authorize those commands using+the host's permission controls. EGM's runtime declares no MCP server and installs+no permission-approval hook.++## Development tools++The source repository also contains opt-in integration tests. When explicitly+enabled, they invoke host CLIs and inspect transcripts produced by their own test+sessions to verify reviewer isolation. They are excluded from runtime release+packages. Website and development tooling are also excluded.++## Questions++Use the [issue tracker](https://github.com/google/elephant-goldfish-model/issues)+for general questions. Do not include credentials, private documents, or personal+data in public reports. This notice describes the plugin's data flow; it does+not replace the privacy policies of the host or services the user invokes.diff --git a/plugin.json b/plugin.jsonindex f3e4836..350b87a 100644--- a/plugin.json+++ b/plugin.json@@ -8,5 +8,24 @@},"homepage": "https://egm.dev","repository": "https://github.com/google/elephant-goldfish-model",- "license": "Apache-2.0"+ "license": "Apache-2.0",+ "extensions": {+ "com.openai": {+ "requires_local_executor": true,+ "interface": {+ "displayName": "Elephant-Goldfish Model",+ "shortDescription": "Draft and stress-test specs",+ "longDescription": "Draft software specifications, stress-test them with fresh-context Goldfish reviewers, resolve findings, and check implementation drift. EGM includes seven skills for developers working in a local codebase. It reads project files and writes design documents and review reports. Bootstrap can run local shell commands. Reviews require native subagents with fresh context; the workflow stops if the host cannot provide isolation. Model calls use your host account's quota. Cloud harness verification remains partial; see TESTING.md. This is not an officially supported Google product.",+ "developerName": "Google LLC",+ "category": "Developer Tools",+ "capabilities": ["Draft specifications", "Review designs", "Check implementation drift"],+ "websiteURL": "https://egm.dev",+ "supportURL": "https://github.com/google/elephant-goldfish-model/issues",+ "privacyPolicyURL": "https://github.com/google/elephant-goldfish-model/blob/main/docs/privacy.md",+ "termsOfServiceURL": "https://github.com/google/elephant-goldfish-model/blob/main/LICENSE",+ "composerIcon": "./assets/icon.svg",+ "logo": "./assets/icon.svg"+ }+ }+ }}diff --git a/resources/execution_instructions.md b/resources/execution_instructions.mdindex af98b00..068fb84 100644--- a/resources/execution_instructions.md+++ b/resources/execution_instructions.md@@ -1,27 +1,19 @@## Execution Instructions-* **NO CODE (SILENT GUARD - CRITICAL)**: You are strictly forbidden from+* **Design-Only Scope**: You are strictly forbidden fromwriting, modifying, or building any production implementation files (e.g.,`.h`, `.cc`, `.py`, `.go`) in the source tree. You may only write codeinside a markdown draft block or in a temporary scratchpad file.- * **SILENT ENFORCEMENT (CRITICAL)**: You MUST NOT mention "NO CODE rules",- "EGM constraints", "forbidden files", "policies", or "adhering to- constraints" to the user.- * **NO META-TALK**: You MUST NOT make any meta-commentary about your- compliance, rules, or execution process. You are strictly forbidden from- saying things like *"I have ensured no production code was written"*,- *"preserving the integrity of the design-first approach"*, or saying- *"this aligns with the technical plan"*. Talk ONLY about the technical- content and next steps.* **Scratchpad Location (CRITICAL)**: You MUST write any temporaryscratchpad code files ONLY outside the project source tree (e.g.,under `/tmp/` or your conversation's active scratch directory). Youare STRICTLY FORBIDDEN from creating `.h`, `.cc`, `.py`, `.go`, or anyother code files anywhere inside the project source tree.- * **HOW TO RESPOND**: If the user asks you to write production code, you- must fulfill their technical request silently by writing it inside a- markdown block or scratchpad, and respond in a way that naturally points- to the design discussion.+ * **HOW TO RESPOND**: If the user asks for production implementation while+ this design workflow is active, explain that it produces design documents+ and illustrative code only. Label any markdown or scratchpad example+ clearly. Do not imply that production files were changed. Ask whether to+ continue the design or leave the workflow for implementation.* **Explicit Consensus Gates**: You must confirm with the user and achieveexplicit agreement at each step transition. Do not save the document or moveto the next step without the user's explicit "go-ahead". Do not move on@@ -40,4 +32,3 @@to the user in plain text, point out the contradiction, and ask forresolution. You are strictly forbidden from planning or executing anyfile-writing/editing tool in the same turn as you discover a contradiction.-diff --git a/scripts/pack_plugin.py b/scripts/pack_plugin.pynew file mode 100644index 0000000..5b1f7b5--- /dev/null+++ b/scripts/pack_plugin.py@@ -0,0 +1,93 @@+# Copyright 2026 Google LLC.+# SPDX-License-Identifier: Apache-2.0++"""Build runtime folders and reproducible ZIPs without development files."""++import argparse+import json+from pathlib import Path+import zipfile++SHARED = (+ "plugin.json", "LICENSE", "README.md", "TESTING.md",+ "CONTRIBUTING.md", "AI_POLICY.md", ".github/PULL_REQUEST_TEMPLATE.md",+ "skills/*/SKILL.md", "skills/*/references/*.md",+ "skills/*/references/*.json", "agents/*.md", "resources/*.md",+ "resources/document_standards/*.md", "docs/*.md", "docs/designs/*.md",+ "assets/*.svg", "assets/*.png", "docs/assets/*.svg", "docs/assets/*.png",+)+HOST = {+ "claude": (".claude-plugin/plugin.json", ".claude-plugin/icon.png",+ ".claude-plugin/agents/*.md"),+ "openai": (".codex-plugin/plugin.json",),+}+++def build(root: Path, target: str, output: Path) -> tuple[Path, Path]:+ """Write a new runtime folder and ZIP; refuse unsafe inputs or overwrites."""+ root = root.resolve()+ folder = output.resolve() / f"egm-{target}"+ archive = folder.with_suffix(".zip")+ if folder.exists() or archive.exists():+ raise ValueError("Output folder or ZIP already exists")+ if folder == root or root.is_relative_to(folder):+ raise ValueError("Output must not contain the source tree")+ files = set()+ for pattern in SHARED + HOST[target]:+ for path in root.glob(pattern):+ relative = path.relative_to(root)+ if any((root / Path(*relative.parts[:i])).is_symlink()+ for i in range(1, len(relative.parts) + 1)):+ raise ValueError(f"Symlink in runtime path: {relative}")+ if not path.resolve().is_relative_to(root):+ raise ValueError(f"Path outside source: {relative}")+ if path.is_file() and relative.as_posix() != "docs/directory.md":+ files.add(relative)+ for name in ("plugin.json", "LICENSE", "README.md", "TESTING.md",+ HOST[target][0]):+ if Path(name) not in files:+ raise ValueError(f"Missing required file: {name}")+ manifest = json.loads((root / HOST[target][0]).read_text())+ portable = json.loads((root / "plugin.json").read_text())+ openai = portable.get("extensions", {}).get("com.openai", {})+ if manifest.get("hooks") or portable.get("hooks") or openai.get("hooks"):+ raise ValueError("Directory packages cannot contain hooks")+ for metadata in (manifest, portable, openai):+ if any(metadata.get(key) for key in ("mcpServers", "mcp", "apps")):+ raise ValueError("This runtime builder does not package MCP or app dependencies")+ references = list(manifest.get("agents", []))+ interface = openai.get("interface", {})+ if target == "openai":+ interface = interface or manifest.get("interface", {})+ references += [interface[key] for key in ("composerIcon", "logo")]+ else:+ references.append(manifest.get("icon", "./.claude-plugin/icon.png"))+ for reference in references:+ path = Path(reference)+ if path.is_absolute() or ".." in path.parts or path not in files:+ raise ValueError(f"Unbundled manifest reference: {reference}")+ output.mkdir(parents=True, exist_ok=True)+ folder.mkdir()+ with zipfile.ZipFile(archive, "w", zipfile.ZIP_DEFLATED) as bundle:+ for relative in sorted(files):+ data = (root / relative).read_bytes()+ destination = folder / relative+ destination.parent.mkdir(parents=True, exist_ok=True)+ destination.write_bytes(data)+ destination.chmod(0o644)+ info = zipfile.ZipInfo(relative.as_posix(), (1980, 1, 1, 0, 0, 0))+ info.create_system = 3+ info.external_attr = 0o100644 << 16+ info.compress_type = zipfile.ZIP_DEFLATED+ bundle.writestr(info, data)+ return folder, archive+++if __name__ == "__main__":+ parser = argparse.ArgumentParser(description=__doc__)+ parser.add_argument("--target", required=True, choices=HOST)+ parser.add_argument("--output", required=True, type=Path)+ args = parser.parse_args()+ runtime, bundle = build(Path(__file__).resolve().parents[1],+ args.target, args.output)+ print(f"Runtime: {runtime}\nZIP: {bundle}")diff --git a/skills/egm_bootstrap/SKILL.md b/skills/egm_bootstrap/SKILL.mdindex 6d49a92..2287283 100644--- a/skills/egm_bootstrap/SKILL.md+++ b/skills/egm_bootstrap/SKILL.md@@ -190,7 +190,7 @@ If your harness has no subagent tool, run the scout steps inline.* Subagent: `egm-bootstrap-orchestrator` (`agents/bootstrap_orchestrator.md`) (or a general-purpose subagent)* `Prompt`: "Run egm-bootstrap with path=`[path]`,is_worker=true, sub_tree_root=`[partition_root]`,- target_filename=`[target_filename]`."+ target_filename=`[target_filename]`."* **Unbounded Execution**: Spawn all Sub-Orchestrators in parallel withoutartificial concurrency limits (as authorized by the user during thesafety gate).diff --git a/skills/egm_review_loop/SKILL.md b/skills/egm_review_loop/SKILL.mdindex f71ecf7..5a060a0 100644--- a/skills/egm_review_loop/SKILL.md+++ b/skills/egm_review_loop/SKILL.md@@ -40,7 +40,7 @@ where your harness registers named subagents. Otherwise spawn a general-purposesubagent and tell it to read that persona file first. Pass the prompt verbatimand wait for the report. If your harness cannot nest subagents,use direct dispatch instead of the synthesizer. See `docs/harnesses.md`.-If your harness has no subagent tool, stop and tell the user: a review in the same+If your harness has no subagent tool, stop and tell the user: a review in the samecontext is not a Goldfish review.## Inputsdiff --git a/tests/integration/test_claude.py b/tests/integration/test_claude.pyindex 3315488..253694f 100644--- a/tests/integration/test_claude.py+++ b/tests/integration/test_claude.py@@ -6,7 +6,7 @@import jsonimport osfrom pathlib import Path-import shutil+import runpyimport subprocessimport uuid@@ -60,13 +60,13 @@ def assert_child_probe(raw: str, persona: Path, markers: list[str]) -> None:)-def test_native_reviewer_isolation(tmp_path: Path) -> None:[email protected]("deny_persona", [False, True], ids=["scoped-read", "denied-persona"])+def test_native_reviewer_isolation(tmp_path: Path, deny_persona: bool) -> None:>>>>>>> f5b8b45 (Prepare runtime packages and permissions for plugin directories)root = Path(__file__).resolve().parents[2]- plugin = tmp_path / "plugin"+ build = runpy.run_path(str(root / "scripts/pack_plugin.py"))["build"]+ plugin, _ = build(root, "claude", tmp_path / "runtime")workspace = tmp_path / "workspace"workspace.mkdir()- shutil.copytree(root, plugin, ignore=shutil.ignore_patterns(- ".git", "__pycache__", "node_modules", ".pytest_cache"))name = "egm-test-" + uuid.uuid4().hex[:8]manifest_path = plugin / ".claude-plugin/plugin.json"manifest = json.loads(manifest_path.read_text())@@ -77,12 +77,21 @@ def test_native_reviewer_isolation(tmp_path: Path) -> None:"If asked for a context marker, respond with " + markers[0])session = str(uuid.uuid4())+ permissions = {+ "allow": [f"Read(/{plugin}/{folder}/**)"+ for folder in ("agents", "docs", "resources", "skills")],+ }+ if deny_persona:+ permissions["deny"] = [f"Read(/{plugin}/agents/zoom_out.md)"]+ settings = {"disableAllHooks": True, "permissions": permissions}prompt = f"""/{name}:egm-reviewThis is a targeted integration probe, not a full review. Read the Claude guidereferenced by this skill. Do not execute the normal five-stage workflow.Parent-only context marker: {markers[1]}. Do not repeat, write, or pass it on.Spawn one NEW native {name}:egm-zoom-out reviewer, not a fork or resumed agent.Pass exactly: 'Integration probe: first read only {plugin / "agents/zoom_out.md"}.+If that read is denied, stop and return exactly RESOURCE_UNREADABLE. Do not+use another tool, path, or source to recover the persona or give a verdict.Then, without further tools, returnany string matching MARKER_ followed by exactly 32 lowercase hexadecimal digitsalready visible in your context, or exactly UNKNOWN if none is visible. Account@@ -94,9 +103,9 @@ Do not read other plugins or logs, use MCP, or modify files."""result = subprocess.run(["claude", "-p", "--model", "sonnet", "--output-format", "json",- "--session-id", session, "--settings", '{"disableAllHooks":true}',+ "--session-id", session, "--settings", json.dumps(settings),"--strict-mcp-config", "--mcp-config", '{"mcpServers":{}}',- "--plugin-dir", str(plugin), "--allowedTools", "Read", "Agent", "Skill",+ "--plugin-dir", str(plugin), "--allowedTools", "Agent", "Skill","--", prompt],cwd=workspace, capture_output=True, text=True, timeout=600,)@@ -117,6 +126,9 @@ Do not read other plugins or logs, use MCP, or modify files.if key in successful and call["name"] == "Read"}for relative in ("docs/claude.md", "agents/zoom_out.md","resources/document_standards/zoom-out-standard.md"):+ if deny_persona and relative == "agents/zoom_out.md":+ assert str(plugin / relative) not in reads+ continueassert str(plugin / relative) in readsagents = [call for call in calls.values() if call["name"] == "Agent"]assert len(agents) == 1@@ -125,4 +137,28 @@ Do not read other plugins or logs, use MCP, or modify files.children = list((traces / session / "subagents").glob("agent-*.jsonl"))assert len(children) == 1raw = children[0].read_text()- assert_child_probe(raw, plugin / "agents/zoom_out.md", markers)+ assert all(marker not in raw for marker in markers)+ answers = []+ child_reads = []+ child_read_results = []+ for line in raw.split("\n"):+ if not line.strip():+ continue+ event = json.loads(line)+ for block in event.get("message", {}).get("content", []):+ if isinstance(block, dict) and block.get("type") == "tool_result":+ child_read_results.append(bool(block.get("is_error")))+ if event.get("type") == "assistant":+ for block in event["message"]["content"]:+ if block["type"] == "tool_use":+ assert block["name"] == "Read"+ child_reads.append(block["input"]["file_path"])+ if block["type"] == "text":+ answers.append(block["text"])+ # Models may prefix the sentinel with an explanation. Tool results and the+ # full child transcript independently establish access and marker isolation.+ assert answers[-1].strip().splitlines()[-1] == (+ "RESOURCE_UNREADABLE" if deny_persona else "UNKNOWN"+ )+ assert child_reads == [str(plugin / "agents/zoom_out.md")]+ assert child_read_results == [deny_persona]>>>>>>> f5b8b45 (Prepare runtime packages and permissions for plugin directories)diff --git a/tests/unit/test_harnesses.py b/tests/unit/test_harnesses.pyindex bb99eb0..079dc58 100644--- a/tests/unit/test_harnesses.py+++ b/tests/unit/test_harnesses.py@@ -4,11 +4,10 @@"""Offline packaging and isolation contracts for shared and host manifests."""import json-import osfrom pathlib import Pathimport reimport runpy-import subprocess+from xml.etree import ElementTreeimport pytestimport yaml@@ -67,6 +66,32 @@ def test_portable_manifest_schema() -> None:assert re.fullmatch(r"\d+\.\d+\.\d+", manifest["version"])+def test_openai_submission_metadata_and_assets() -> None:+ """Check public listing limits and bundled paths, not just JSON syntax."""+ extension = read_json("plugin.json")["extensions"]["com.openai"]+ codex = read_json(".codex-plugin/plugin.json")+ assert extension["interface"] == codex["interface"]+ assert extension["requires_local_executor"] is True+ assert codex["requires_local_executor"] is True+ assert codex["author"] == read_json("plugin.json")["author"]+ interface = extension["interface"]+ for field, limit in (+ ("displayName", 30), ("shortDescription", 30),+ ("longDescription", 4000), ("developerName", 80),+ ):+ assert 0 < len(interface[field]) <= limit, field+ assert len(interface["capabilities"]) <= 20+ assert all(0 < len(item) <= 120 for item in interface["capabilities"])+ for field in ("composerIcon", "logo"):+ path = interface[field]+ assert path.startswith("./assets/")+ asset = (ROOT / path).resolve()+ assert asset.is_relative_to(ROOT / "assets")+ assert asset.is_file() and asset.stat().st_size <= 5 * 1024 * 1024+ svg = ElementTree.parse(asset).getroot()+ assert float(svg.attrib["width"]) == float(svg.attrib["height"]) >= 48++@pytest.mark.parametrize("path", COMPATIBILITY_MANIFESTS)def test_compatibility_metadata_matches_root(path: str) -> None:canonical = read_json("plugin.json")@@ -139,7 +164,7 @@ def test_claude_synthesizer_adapter_is_tool_restricted() -> None:def test_claude_bootstrap_adapter_routes_to_skill() -> None:adapter = ROOT / ".claude-plugin/agents/bootstrap_orchestrator.md"config = frontmatter(adapter)- assert "tools" not in config+ assert set(config["tools"]) == {"Agent", "Bash", "Read", "Grep", "Glob", "Write", "Edit"}assert config["model"] == "inherit"text = adapter.read_text()assert "${CLAUDE_PLUGIN_ROOT}/agents/bootstrap_orchestrator.md" in text@@ -151,56 +176,12 @@ def test_claude_bootstrap_adapter_routes_to_skill() -> None:assert "./agents/bootstrap_orchestrator.md" not in manifest-READ_HOOK = ".claude-plugin/hooks/allow_plugin_reads.sh"---def run_read_hook(tool_name: str, tool_input: dict) -> str:- result = subprocess.run(- ["sh", (ROOT / READ_HOOK).as_posix()],- input=json.dumps({"tool_name": tool_name, "tool_input": tool_input}),- capture_output=True,- text=True,- check=True,- env={**os.environ, "CLAUDE_PLUGIN_ROOT": ROOT.as_posix()},- )- return result.stdout---def test_claude_read_hook_is_registered() -> None:- hooks = read_json(".claude-plugin/plugin.json")["hooks"]["PreToolUse"]- assert [hook["matcher"] for hook in hooks] == ["Read|Grep|Glob"]- command = hooks[0]["hooks"][0]["command"]- assert command == f'"${{CLAUDE_PLUGIN_ROOT}}/{READ_HOOK}"'--- ("tool_name", "tool_input", "allowed"),- [- ("Read", {"file_path": "{root}/agents/style.md"}, True),- ("Read", {"file_path": "{root}/docs/claude.md"}, True),- ("Read", {"file_path": "{root}/skills/egm_review/SKILL.md"}, True),- ("Grep", {"pattern": "x", "path": "{root}/resources"}, True),- ("Glob", {"pattern": "**/*.md", "path": "{root}/agents"}, True),- ("Read", {"file_path": "/etc/passwd"}, False),- ("Read", {"file_path": "{root}/agents/../../etc/passwd"}, False),- ("Read", {"file_path": "{root}-evil/agents/style.md"}, False),- ("Read", {"file_path": "{root}/agents-evil/style.md"}, False),- ("Read", {"file_path": "{root}/README.md"}, False),- ("Read", {"file_path": "{root}/.claude/settings.local.json"}, False),- ("Grep", {"pattern": "x", "path": "{root}"}, False),- ("Grep", {"pattern": '"path":"{root}/agents"', "path": "/etc"}, False),- ("Glob", {"pattern": "**/*.md"}, False),- ("Glob", {"pattern": "/etc/*", "path": "{root}/agents"}, False),- ("Glob", {"pattern": "~/.ssh/*", "path": "{root}/agents"}, False),- ],-)-def test_claude_read_hook_approves_plugin_folders_only(- tool_name: str, tool_input: dict, allowed: bool-) -> None:- """Only clean paths in the folders EGM reads skip the permission prompt."""- tool_input = {k: v.replace("{root}", ROOT.as_posix()) for k, v in tool_input.items()}- output = run_read_hook(tool_name, tool_input)- assert ('"permissionDecision":"allow"' in output) is allowed+def test_claude_permissions_remain_under_user_control() -> None:+ """Bundled resources must not carry an automatic permission override."""+ manifest = read_json(".claude-plugin/plugin.json")+ assert "hooks" not in manifest+ assert not (ROOT / ".claude-plugin/hooks/allow_plugin_reads.sh").exists()+ assert not (ROOT / "hooks/hooks.json").exists()>>>>>>> f5b8b45 (Prepare runtime packages and permissions for plugin directories)def test_claude_manifest_agents_and_shared_personas_resolve() -> None:diff --git a/tests/unit/test_packaging.py b/tests/unit/test_packaging.pynew file mode 100644index 0000000..6d46e62--- /dev/null+++ b/tests/unit/test_packaging.py@@ -0,0 +1,160 @@+# Copyright 2026 Google LLC.+# SPDX-License-Identifier: Apache-2.0++"""Exercise distributable contents, unsafe paths, and reproducible output."""++import json+from pathlib import Path+import runpy+import shutil+import zipfile++import pytest++ROOT = Path(__file__).resolve().parents[2]+build = runpy.run_path(str(ROOT / "scripts/pack_plugin.py"))["build"]+++def source(tmp_path: Path) -> Path:+ root = tmp_path / "source"+ root.mkdir()+ for name in ("plugin.json", "LICENSE", "README.md", "TESTING.md",+ "CONTRIBUTING.md", "AI_POLICY.md"):+ shutil.copyfile(ROOT / name, root / name)+ (root / ".github").mkdir()+ shutil.copyfile(ROOT / ".github/PULL_REQUEST_TEMPLATE.md",+ root / ".github/PULL_REQUEST_TEMPLATE.md")+ for name in ("skills", "agents", "resources", "docs", "assets",+ ".claude-plugin", ".codex-plugin"):+ shutil.copytree(ROOT / name, root / name)+ return root++[email protected]("target", ["claude", "openai"])+def test_runtime_bundle_is_complete_and_reproducible(+ source: Path, tmp_path: Path, target: str,+) -> None:+ for name in ("site/font.woff2", "tests/secret.txt", ".github/workflows/a.yml",+ ".agents/plugins/marketplace.json", "hooks/run.sh",+ ".claude-plugin/hooks/run.sh", "assets/private.txt"):+ file = source / name+ file.parent.mkdir(parents=True, exist_ok=True)+ file.write_text("must not ship")+ first, archive = build(source, target, tmp_path / "first")+ _, repeated = build(source, target, tmp_path / "second")+ assert archive.read_bytes() == repeated.read_bytes()+ with zipfile.ZipFile(archive) as bundle:+ assert bundle.testzip() is None+ names = set(bundle.namelist())+ assert len([p for p in names if p.endswith("/SKILL.md")]) == 7+ assert "skills/egm_bootstrap/references/worker-return.schema.json" in names+ assert "resources/document_standards/feature-spec-standard.md" in names+ assert "agents/design_critic.md" in names+ assert "docs/codex.md" in names+ assert "docs/claude.md" in names+ assert "assets/icon.svg" in names+ assert "CONTRIBUTING.md" in names+ assert "AI_POLICY.md" in names+ assert ".github/PULL_REQUEST_TEMPLATE.md" in names+ assert not any(p.startswith(("site/", "tests/", ".github/workflows/", ".agents/"))+ or "hooks/" in p or p.endswith("test_scenarios.yaml")+ or p.endswith("/TEST.md") or p.endswith("marketplace.json")+ for p in names)+ assert "assets/private.txt" not in names+ assert (".claude-plugin/plugin.json" in names) == (target == "claude")+ assert (".claude-plugin/icon.png" in names) == (target == "claude")+ assert (".claude-plugin/agents/style.md" in names) == (target == "claude")+ assert (".codex-plugin/plugin.json" in names) == (target == "openai")+ for info in bundle.infolist():+ assert not Path(info.filename).is_absolute()+ assert ".." not in Path(info.filename).parts+ assert info.date_time == (1980, 1, 1, 0, 0, 0)+ assert info.external_attr >> 16 == 0o100644+ assert bundle.read(info) == (first / info.filename).read_bytes()++[email protected]("target", ["claude", "openai"])+def test_bundles_readme_images(source: Path, tmp_path: Path, target: str) -> None:+ image_dir = source / "docs/assets"+ image_dir.mkdir(exist_ok=True)+ image = image_dir / "readme-header.svg"+ image.write_text('<svg xmlns="http://www.w3.org/2000/svg"/>')+ (image_dir / "private.txt").write_text("must not ship")+ readme = source / "README.md"+ readme.write_text(readme.read_text() + '\n\n')+ _, archive = build(source, target, tmp_path / "output")+ with zipfile.ZipFile(archive) as bundle:+ assert bundle.read("docs/assets/readme-header.svg") == image.read_bytes()+ assert "docs/assets/private.txt" not in bundle.namelist()++[email protected]("directory", [False, True])+def test_rejects_symlinked_runtime_paths(+ source: Path, tmp_path: Path, directory: bool,+) -> None:+ victim = source / ("agents" if directory else "assets/icon.svg")+ outside = tmp_path / "outside"+ shutil.move(str(victim), outside)+ victim.symlink_to(outside, target_is_directory=directory)+ with pytest.raises(ValueError, match="Symlink"):+ build(source, "openai", tmp_path / "output")++[email protected]("reference", ["../escape.svg", "/tmp/icon.svg",+ "./assets/missing.svg"])+def test_rejects_escaping_or_missing_manifest_assets(+ source: Path, tmp_path: Path, reference: str,+) -> None:+ path = source / "plugin.json"+ manifest = json.loads(path.read_text())+ manifest["extensions"]["com.openai"]["interface"]["logo"] = reference+ path.write_text(json.dumps(manifest))+ with pytest.raises(ValueError, match="Unbundled"):+ build(source, "openai", tmp_path / "output")+++def test_refuses_hooks_and_overwrites(source: Path, tmp_path: Path) -> None:+ output = tmp_path / "output"+ build(source, "claude", output)+ with pytest.raises(ValueError, match="already exists"):+ build(source, "claude", output)+ path = source / ".claude-plugin/plugin.json"+ manifest = json.loads(path.read_text())+ manifest["hooks"] = {"PreToolUse": []}+ path.write_text(json.dumps(manifest))+ with pytest.raises(ValueError, match="hooks"):+ build(source, "claude", tmp_path / "other")+++def test_refuses_portable_hook_override(source: Path, tmp_path: Path) -> None:+ path = source / "plugin.json"+ manifest = json.loads(path.read_text())+ manifest["extensions"]["com.openai"]["hooks"] = "./hooks/hooks.json"+ path.write_text(json.dumps(manifest))+ with pytest.raises(ValueError, match="hooks"):+ build(source, "openai", tmp_path / "output")++[email protected]("field", ["apps", "mcpServers"])+def test_refuses_unbundled_services(source: Path, tmp_path: Path, field: str) -> None:+ path = source / "plugin.json"+ manifest = json.loads(path.read_text())+ manifest["extensions"]["com.openai"][field] = "./missing.json"+ path.write_text(json.dumps(manifest))+ with pytest.raises(ValueError, match="dependencies"):+ build(source, "openai", tmp_path / "output")+++def test_published_claude_runtime_is_current(tmp_path: Path) -> None:+ """The directory subfolder must contain exactly the reviewed runtime."""+ generated, _ = build(ROOT, "claude", tmp_path)+ published = ROOT / "distributions/claude"++ def contents(folder: Path) -> dict[str, bytes]:+ return {p.relative_to(folder).as_posix(): p.read_bytes()+ for p in folder.rglob("*") if p.is_file()}++ assert contents(published) == contents(generated), (+ "Regenerate distributions/claude with scripts/pack_plugin.py"+ )