From 94aedd5a7b6da4ce48de994b5a137953c0fd21c3 Mon Sep 17 00:00:00 2001 From: Matt Van Horn Date: Sun, 8 Mar 2026 12:43:52 -0700 Subject: [PATCH 1/3] fix(test-browser): detect dev server port from project config Replace all hardcoded localhost:3000 references with dynamic port detection. The command now checks (in priority order): explicit --port argument, CLAUDE.md config, package.json scripts, .env files, then falls back to 3000. Closes #164 Co-Authored-By: Claude Opus 4.6 --- .../commands/test-browser.md | 80 ++++++++++++++++--- 1 file changed, 67 insertions(+), 13 deletions(-) diff --git a/plugins/compound-engineering/commands/test-browser.md b/plugins/compound-engineering/commands/test-browser.md index 150dce0..f9f46e3 100644 --- a/plugins/compound-engineering/commands/test-browser.md +++ b/plugins/compound-engineering/commands/test-browser.md @@ -1,7 +1,7 @@ --- name: test-browser description: Run browser tests on pages affected by current PR or branch -argument-hint: "[PR number, branch name, or 'current' for current branch]" +argument-hint: "[PR number, branch name, 'current', or --port PORT]" --- # Browser Test Command @@ -122,31 +122,82 @@ Build a list of URLs to test based on the mapping. -### 4. Verify Server is Running +### 4. Detect Dev Server Port + + + +Determine the dev server port using this priority order: + +**Priority 1: Explicit argument** +If the user passed a port number (e.g., `/test-browser 5000` or `/test-browser --port 5000`), use that port directly. + +**Priority 2: CLAUDE.md / project instructions** +```bash +# Check CLAUDE.md for port references +grep -Eio '(port\s*[:=]\s*|localhost:)([0-9]{4,5})' CLAUDE.md 2>/dev/null | grep -Eo '[0-9]{4,5}' | head -1 +``` + +**Priority 3: package.json scripts** +```bash +# Check dev/start scripts for --port flags +grep -Eo '\-\-port[= ]+[0-9]{4,5}' package.json 2>/dev/null | grep -Eo '[0-9]{4,5}' | head -1 +``` + +**Priority 4: Environment files** +```bash +# Check .env, .env.local, .env.development for PORT= +grep -h '^PORT=' .env .env.local .env.development 2>/dev/null | tail -1 | cut -d= -f2 +``` + +**Priority 5: Default fallback** +If none of the above yields a port, default to `3000`. + +Store the result in a `PORT` variable for use in all subsequent steps. + +```bash +# Combined detection (run this) +PORT="${EXPLICIT_PORT:-}" +if [ -z "$PORT" ]; then + PORT=$(grep -Eio '(port\s*[:=]\s*|localhost:)([0-9]{4,5})' CLAUDE.md 2>/dev/null | grep -Eo '[0-9]{4,5}' | head -1) +fi +if [ -z "$PORT" ]; then + PORT=$(grep -Eo '\-\-port[= ]+[0-9]{4,5}' package.json 2>/dev/null | grep -Eo '[0-9]{4,5}' | head -1) +fi +if [ -z "$PORT" ]; then + PORT=$(grep -h '^PORT=' .env .env.local .env.development 2>/dev/null | tail -1 | cut -d= -f2) +fi +PORT="${PORT:-3000}" +echo "Using dev server port: $PORT" +``` + + + +### 5. Verify Server is Running -Before testing, verify the local server is accessible: +Before testing, verify the local server is accessible using the detected port: ```bash -agent-browser open http://localhost:3000 +agent-browser open http://localhost:${PORT} agent-browser snapshot -i ``` If server is not running, inform user: ```markdown -**Server not running** +**Server not running on port ${PORT}** Please start your development server: - Rails: `bin/dev` or `rails server` - Node/Next.js: `npm run dev` +- Custom port: `/test-browser --port ` Then run `/test-browser` again. ``` -### 5. Test Each Affected Page +### 6. Test Each Affected Page @@ -154,13 +205,13 @@ For each affected route, use agent-browser CLI commands (NOT Chrome MCP): **Step 1: Navigate and capture snapshot** ```bash -agent-browser open "http://localhost:3000/[route]" +agent-browser open "http://localhost:${PORT}/[route]" agent-browser snapshot -i ``` **Step 2: For headed mode (visual debugging)** ```bash -agent-browser --headed open "http://localhost:3000/[route]" +agent-browser --headed open "http://localhost:${PORT}/[route]" agent-browser --headed snapshot -i ``` @@ -185,7 +236,7 @@ agent-browser screenshot --full page-name-full.png # Full page -### 6. Human Verification (When Required) +### 7. Human Verification (When Required) @@ -214,7 +265,7 @@ Did it work correctly? -### 7. Handle Failures +### 8. Handle Failures @@ -253,7 +304,7 @@ When a test fails: -### 8. Test Summary +### 9. Test Summary @@ -263,7 +314,7 @@ After all tests complete, present summary: ## Browser Test Results **Test Scope:** PR #[number] / [branch name] -**Server:** http://localhost:3000 +**Server:** http://localhost:${PORT} ### Pages Tested: [count] @@ -295,7 +346,7 @@ After all tests complete, present summary: ## Quick Usage Examples ```bash -# Test current branch changes +# Test current branch changes (auto-detects port) /test-browser # Test specific PR @@ -303,6 +354,9 @@ After all tests complete, present summary: # Test specific branch /test-browser feature/new-dashboard + +# Test on a specific port +/test-browser --port 5000 ``` ## agent-browser CLI Reference From 4fc70939ebd997518ef4e9271fbfd67d39ceadfd Mon Sep 17 00:00:00 2001 From: Matt Van Horn Date: Sun, 8 Mar 2026 12:45:27 -0700 Subject: [PATCH 2/3] refactor(agents): remove duplicate every-style-editor agent The every-style-editor agent file was a duplicate of the existing every-style-editor skill. Agent files are eagerly loaded into the Task tool definition on every API call (~100-200 tokens each), while skills are lazy-loaded only when invoked. Removing the duplicate saves tokens and eliminates potential runtime errors when the agent is invoked via Task tool instead of Skill tool. Changes: - Delete agents/workflow/every-style-editor.md (skill version in skills/every-style-editor/ already exists) - Update README.md workflow agent count from 5 to 4 - Update plugin.json agent counts from 29 to 28 Fixes #156 Co-Authored-By: Claude Opus 4.6 --- .../.claude-plugin/plugin.json | 2 +- .../.cursor-plugin/plugin.json | 2 +- plugins/compound-engineering/README.md | 3 +- .../agents/workflow/every-style-editor.md | 64 ------------------- 4 files changed, 3 insertions(+), 68 deletions(-) delete mode 100644 plugins/compound-engineering/agents/workflow/every-style-editor.md diff --git a/plugins/compound-engineering/.claude-plugin/plugin.json b/plugins/compound-engineering/.claude-plugin/plugin.json index e659557..c3b49b9 100644 --- a/plugins/compound-engineering/.claude-plugin/plugin.json +++ b/plugins/compound-engineering/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "compound-engineering", "version": "2.38.1", - "description": "AI-powered development tools. 29 agents, 22 commands, 20 skills, 1 MCP server for code review, research, design, and workflow automation.", + "description": "AI-powered development tools. 28 agents, 22 commands, 20 skills, 1 MCP server for code review, research, design, and workflow automation.", "author": { "name": "Kieran Klaassen", "email": "kieran@every.to", diff --git a/plugins/compound-engineering/.cursor-plugin/plugin.json b/plugins/compound-engineering/.cursor-plugin/plugin.json index e8bcb63..1fe85ac 100644 --- a/plugins/compound-engineering/.cursor-plugin/plugin.json +++ b/plugins/compound-engineering/.cursor-plugin/plugin.json @@ -2,7 +2,7 @@ "name": "compound-engineering", "displayName": "Compound Engineering", "version": "2.33.0", - "description": "AI-powered development tools. 29 agents, 22 commands, 19 skills, 1 MCP server for code review, research, design, and workflow automation.", + "description": "AI-powered development tools. 28 agents, 22 commands, 19 skills, 1 MCP server for code review, research, design, and workflow automation.", "author": { "name": "Kieran Klaassen", "email": "kieran@every.to", diff --git a/plugins/compound-engineering/README.md b/plugins/compound-engineering/README.md index 33a4ea1..9481bbc 100644 --- a/plugins/compound-engineering/README.md +++ b/plugins/compound-engineering/README.md @@ -53,12 +53,11 @@ Agents are organized into categories for easier discovery. | `design-iterator` | Iteratively refine UI through systematic design iterations | | `figma-design-sync` | Synchronize web implementations with Figma designs | -### Workflow (5) +### Workflow (4) | Agent | Description | |-------|-------------| | `bug-reproduction-validator` | Systematically reproduce and validate bug reports | -| `every-style-editor` | Edit content to conform to Every's style guide | | `lint` | Run linting and code quality checks on Ruby and ERB files | | `pr-comment-resolver` | Address PR comments and implement fixes | | `spec-flow-analyzer` | Analyze user flows and identify gaps in specifications | diff --git a/plugins/compound-engineering/agents/workflow/every-style-editor.md b/plugins/compound-engineering/agents/workflow/every-style-editor.md deleted file mode 100644 index 061375d..0000000 --- a/plugins/compound-engineering/agents/workflow/every-style-editor.md +++ /dev/null @@ -1,64 +0,0 @@ ---- -name: every-style-editor -description: "Reviews and edits text content to conform to Every's editorial style guide. Use when written content needs style compliance checks for headlines, punctuation, voice, and formatting." -tools: Task, Glob, Grep, LS, ExitPlanMode, Read, Edit, MultiEdit, Write, NotebookRead, NotebookEdit, WebFetch, TodoWrite, WebSearch -model: inherit ---- - -You are an expert copy editor specializing in Every's house style guide. Your role is to meticulously review text content and suggest edits to ensure compliance with Every's specific editorial standards. - -When reviewing content, you will: - -1. **Systematically check each style rule** - Go through the style guide items one by one, checking the text against each rule -2. **Provide specific edit suggestions** - For each issue found, quote the problematic text and provide the corrected version -3. **Explain the rule being applied** - Reference which style guide rule necessitates each change -4. **Maintain the author's voice** - Make only the changes necessary for style compliance while preserving the original tone and meaning - -**Every Style Guide Rules to Apply:** - -- Headlines use title case; everything else uses sentence case -- Companies are singular ("it" not "they"); teams/people within companies are plural -- Remove unnecessary "actually," "very," or "just" -- Hyperlink 2-4 words when linking to sources -- Cut adverbs where possible -- Use active voice instead of passive voice -- Spell out numbers one through nine (except years at sentence start); use numerals for 10+ -- Use italics for emphasis (never bold or underline) -- Image credits: _Source: X/Name_ or _Source: Website name_ -- Don't capitalize job titles -- Capitalize after colons only if introducing independent clauses -- Use Oxford commas (x, y, and z) -- Use commas between independent clauses only -- No space after ellipsis... -- Em dashes—like this—with no spaces (max 2 per paragraph) -- Hyphenate compound adjectives except with adverbs ending in "ly" -- Italicize titles of books, newspapers, movies, TV shows, games -- Full names on first mention, last names thereafter (first names in newsletters/social) -- Percentages: "7 percent" (numeral + spelled out) -- Numbers over 999 take commas: 1,000 -- Punctuation outside parentheses (unless full sentence inside) -- Periods and commas inside quotation marks -- Single quotes for quotes within quotes -- Comma before quote if introduced; no comma if text leads directly into quote -- Use "earlier/later/previously" instead of "above/below" -- Use "more/less/fewer" instead of "over/under" for quantities -- Avoid slashes; use hyphens when needed -- Don't start sentences with "This" without clear antecedent -- Avoid starting with "We have" or "We get" -- Avoid clichés and jargon -- "Two times faster" not "2x" (except for the common "10x" trope) -- Use "$1 billion" not "one billion dollars" -- Identify people by company/title (except well-known figures like Mark Zuckerberg) -- Button text is always sentence case -- "Complete setup" - -**Output Format:** - -Provide your review as a numbered list of suggested edits, grouping related changes when logical. For each edit: - -- Quote the original text -- Provide the corrected version -- Briefly explain which style rule applies - -If the text is already compliant with the style guide, acknowledge this and highlight any particularly well-executed style choices. - -Be thorough but constructive, focusing on helping the content shine while maintaining Every's professional standards. From 726606286873c4059261a8c5f1b75c20fe11ac77 Mon Sep 17 00:00:00 2001 From: Matt Van Horn Date: Sun, 8 Mar 2026 12:45:27 -0700 Subject: [PATCH 3/3] feat(compound): add context budget precheck and compact-safe mode Add Phase 0 context budget check that warns users when running /compound near context limits, and offers a compact-safe single-pass alternative that avoids launching 5 parallel subagents. Closes #198 Co-Authored-By: Claude Opus 4.6 --- .../commands/ce/compound.md | 78 ++++++++++++++++++- 1 file changed, 77 insertions(+), 1 deletion(-) diff --git a/plugins/compound-engineering/commands/ce/compound.md b/plugins/compound-engineering/commands/ce/compound.md index 8637955..ca94c50 100644 --- a/plugins/compound-engineering/commands/ce/compound.md +++ b/plugins/compound-engineering/commands/ce/compound.md @@ -21,7 +21,45 @@ Captures problem solutions while context is fresh, creating structured documenta /ce:compound [brief context] # Provide additional context hint ``` -## Execution Strategy: Two-Phase Orchestration +## Execution Strategy: Context-Aware Orchestration + +### Phase 0: Context Budget Check + + +**Run this check BEFORE launching any subagents.** + +The /compound command is token-heavy - it launches 5 parallel subagents that collectively consume ~10k tokens of context. Running near context limits risks compaction mid-compound, which degrades output quality significantly. + + +Before proceeding, the orchestrator MUST: + +1. **Assess context usage**: Check how long the current conversation has been running. If there has been significant back-and-forth (many tool calls, large file reads, extensive debugging), context is likely constrained. + +2. **Warn the user**: + ``` + ⚠️ Context Budget Check + + /compound launches 5 parallel subagents (~10k tokens). Long conversations + risk compaction mid-compound, which degrades documentation quality. + + Tip: For best results, run /compound early in a session - right after + verifying a fix, before continuing other work. + ``` + +3. **Offer the user a choice**: + ``` + How would you like to proceed? + + 1. Full compound (5 parallel subagents, ~10k tokens) - best quality + 2. Compact-safe mode (single pass, ~2k tokens) - safe near context limits + ``` + +4. **If the user picks option 1** (or confirms full mode): proceed to Phase 1 below. +5. **If the user picks option 2** (or requests compact-safe): skip to the **Compact-Safe Mode** section below. + +--- + +### Full Mode **Only ONE file gets written - the final documentation.** @@ -99,6 +137,44 @@ Based on problem type, optionally invoke specialized agents to review the docume +--- + +### Compact-Safe Mode + + +**Single-pass alternative for context-constrained sessions.** + +When context budget is tight, this mode skips parallel subagents entirely. The orchestrator performs all work in a single pass, producing a minimal but complete solution document. + + +The orchestrator (main conversation) performs ALL of the following in one sequential pass: + +1. **Extract from conversation**: Identify the problem, root cause, and solution from conversation history +2. **Classify**: Determine category and filename (same categories as full mode) +3. **Write minimal doc**: Create `docs/solutions/[category]/[filename].md` with: + - YAML frontmatter (title, category, date, tags) + - Problem description (1-2 sentences) + - Root cause (1-2 sentences) + - Solution with key code snippets + - One prevention tip +4. **Skip specialized agent reviews** (Phase 3) to conserve context + +**Compact-safe output:** +``` +✓ Documentation complete (compact-safe mode) + +File created: +- docs/solutions/[category]/[filename].md + +Note: This was created in compact-safe mode. For richer documentation +(cross-references, detailed prevention strategies, specialized reviews), +re-run /compound in a fresh session. +``` + +**No subagents are launched. No parallel tasks. One file written.** + +--- + ## What It Captures - **Problem symptom**: Exact error messages, observable behavior