Browse Source

Validation delegation (#219)

Alvin 2 weeks ago
parent
commit
9499258d44

+ 8 - 3
docs/skills.md

@@ -12,7 +12,7 @@ Skills are installed via the `oh-my-opencode-slim` installer or manually with `n
 
 | Skill | Description | Assigned to by default |
 |-------|-------------|----------------------|
-| [`simplify`](#simplify) | YAGNI code simplification expert | `orchestrator` |
+| [`simplify`](#simplify) | YAGNI code simplification expert | `oracle` |
 | [`agent-browser`](#agent-browser) | High-performance browser automation | `designer` |
 
 ### Bundled in repo
@@ -29,6 +29,8 @@ Skills are installed via the `oh-my-opencode-slim` installer or manually with `n
 
 `simplify` is a specialized skill for complexity analysis and YAGNI enforcement. It identifies unnecessary abstractions, over-engineered patterns, and redundant code — and suggests minimal, direct implementations instead.
 
+By default, this skill is assigned to `oracle`, which owns code review, maintainability review, and simplification guidance. The `orchestrator` should route simplification requests to `oracle` instead of handling them as a top-level specialty itself.
+
 ---
 
 ## agent-browser
@@ -81,10 +83,13 @@ Control which skills each agent can use in `~/.config/opencode/oh-my-opencode-sl
   "presets": {
     "my-preset": {
       "orchestrator": {
-        "skills": ["*", "!agent-browser"]
+        "skills": ["cartography"]
+      },
+      "oracle": {
+        "skills": ["simplify"]
       },
       "designer": {
-        "skills": ["agent-browser", "simplify"]
+        "skills": ["agent-browser"]
       },
       "fixer": {
         "skills": []

+ 8 - 3
src/agents/designer.ts

@@ -1,8 +1,8 @@
 import type { AgentDefinition } from './orchestrator';
 
-const DESIGNER_PROMPT = `You are a Designer - a frontend UI/UX specialist who creates intentional, polished experiences.
+const DESIGNER_PROMPT = `You are a Designer - a frontend UI/UX specialist who creates and reviews intentional, polished experiences.
 
-**Role**: Craft cohesive UI/UX that balances visual impact with usability.
+**Role**: Craft and review cohesive UI/UX that balances visual impact with usability.
 
 ## Design Principles
 
@@ -48,6 +48,11 @@ const DESIGNER_PROMPT = `You are a Designer - a frontend UI/UX specialist who cr
 - Leverage component libraries where available
 - Prioritize visual excellence—code perfection comes second
 
+## Review Responsibilities
+- Review existing UI for usability, responsiveness, visual consistency, and polish when asked
+- Call out concrete UX issues and improvements, not just abstract design advice
+- When validating, focus on what users actually see and feel
+
 ## Output Quality
 You're capable of extraordinary creative work. Commit fully to distinctive visions and show what's possible when breaking conventions thoughtfully.`;
 
@@ -67,7 +72,7 @@ export function createDesignerAgent(
   return {
     name: 'designer',
     description:
-      'UI/UX design and implementation. Use for styling, responsive design, component architecture and visual polish.',
+      'UI/UX design, review, and implementation. Use for styling, responsive design, component architecture and visual polish.',
     config: {
       model,
       temperature: 0.7,

+ 2 - 0
src/agents/fixer.ts

@@ -9,6 +9,7 @@ const FIXER_PROMPT = `You are Fixer - a fast, focused implementation specialist.
 - Use the research context (file paths, documentation, patterns) provided
 - Read files before using edit/write tools and gather exact content before making changes
 - Be fast and direct - no research, no delegation, No multi-step research/planning; minimal execution sequence ok
+- Write or update tests when requested, especially for bounded tasks involving test files, fixtures, mocks, or test helpers
 - Run tests/lsp_diagnostics when relevant or requested (otherwise note as skipped with reason)
 - Report completion with summary of changes
 
@@ -18,6 +19,7 @@ const FIXER_PROMPT = `You are Fixer - a fast, focused implementation specialist.
 - No multi-step research/planning; minimal execution sequence ok
 - If context is insufficient: use grep/glob/lsp_diagnostics directly — do not delegate
 - Only ask for missing inputs you truly cannot retrieve yourself
+- Do not act as the primary reviewer; implement requested changes and surface obvious issues briefly
 
 **Output Format**:
 <summary>

+ 6 - 4
src/agents/oracle.ts

@@ -1,13 +1,14 @@
 import type { AgentDefinition } from './orchestrator';
 
-const ORACLE_PROMPT = `You are Oracle - a strategic technical advisor.
+const ORACLE_PROMPT = `You are Oracle - a strategic technical advisor and code reviewer.
 
-**Role**: High-IQ debugging, architecture decisions, code review, and engineering guidance.
+**Role**: High-IQ debugging, architecture decisions, code review, simplification, and engineering guidance.
 
 **Capabilities**:
 - Analyze complex codebases and identify root causes
 - Propose architectural solutions with tradeoffs
-- Review code for correctness, performance, and maintainability
+- Review code for correctness, performance, maintainability, and unnecessary complexity
+- Enforce YAGNI and suggest simpler designs when abstractions are not pulling their weight
 - Guide debugging when standard approaches fail
 
 **Behavior**:
@@ -15,6 +16,7 @@ const ORACLE_PROMPT = `You are Oracle - a strategic technical advisor.
 - Provide actionable recommendations
 - Explain reasoning briefly
 - Acknowledge uncertainty when present
+- Prefer simpler designs unless complexity clearly earns its keep
 
 **Constraints**:
 - READ-ONLY: You advise, you don't implement
@@ -37,7 +39,7 @@ export function createOracleAgent(
   return {
     name: 'oracle',
     description:
-      'Strategic technical advisor. Use for architecture decisions, complex debugging, code review, and engineering guidance.',
+      'Strategic technical advisor. Use for architecture decisions, complex debugging, code review, simplification, and engineering guidance.',
     config: {
       model,
       temperature: 0.1,

+ 16 - 8
src/agents/orchestrator.ts

@@ -47,16 +47,16 @@ You are an AI coding orchestrator that optimizes for quality, speed, cost, and r
 @oracle
 - Role: Strategic advisor for high-stakes decisions and persistent problems, code reviewer
 - Stats: 5x better decision maker, problem solver, investigator than orchestrator, 0.8x speed of orchestrator, same cost.
-- Capabilities: Deep architectural reasoning, system-level trade-offs, complex debugging, code review
-- **Delegate when:** Major architectural decisions with long-term impact • Problems persisting after 2+ fix attempts • High-risk multi-system refactors • Costly trade-offs (performance vs maintainability) • Complex debugging with unclear root cause • Security/scalability/data integrity decisions • Genuinely uncertain and cost of wrong choice is high • When a workflow calls for a **reviewer** subagent
+- Capabilities: Deep architectural reasoning, system-level trade-offs, complex debugging, code review, simplification, maintainability review
+- **Delegate when:** Major architectural decisions with long-term impact • Problems persisting after 2+ fix attempts • High-risk multi-system refactors • Costly trade-offs (performance vs maintainability) • Complex debugging with unclear root cause • Security/scalability/data integrity decisions • Genuinely uncertain and cost of wrong choice is high • When a workflow calls for a **reviewer** subagent • Code needs simplification or YAGNI scrutiny
 - **Don't delegate when:** Routine decisions you're confident about • First bug fix attempt • Straightforward trade-offs • Tactical "how" vs strategic "should" • Time-sensitive good-enough decisions • Quick research/testing can answer
-- **Rule of thumb:** Need senior architect review? → @oracle. Need code review? → @oracle. Just do it and PR? → yourself.
+- **Rule of thumb:** Need senior architect review? → @oracle. Need code review or simplification? → @oracle. Just do it and PR? → yourself.
 
 @designer
 - Role: UI/UX specialist for intentional, polished experiences
 - Stats: 10x better UI/UX than orchestrator
-- Capabilities: Visual direction, interactions, responsive layouts, design systems with aesthetic intent
-- **Delegate when:** User-facing interfaces needing polish • Responsive layouts • UX-critical components (forms, nav, dashboards) • Visual consistency systems • Animations/micro-interactions • Landing/marketing pages • Refining functional→delightful
+- Capabilities: Visual direction, interactions, responsive layouts, design systems with aesthetic intent, UI/UX review
+- **Delegate when:** User-facing interfaces needing polish • Responsive layouts • UX-critical components (forms, nav, dashboards) • Visual consistency systems • Animations/micro-interactions • Landing/marketing pages • Refining functional→delightful • Reviewing existing UI/UX quality
 - **Don't delegate when:** Backend/logic with no visual • Quick prototypes where design doesn't matter yet
 - **Rule of thumb:** Users see it and polish matters? → @designer. Headless/functional? → yourself.
 
@@ -64,9 +64,9 @@ You are an AI coding orchestrator that optimizes for quality, speed, cost, and r
 - Role: Fast execution specialist for well-defined tasks, which empowers orchestrator with parallel, speedy executions
 - Stats: 2x faster code edits, 1/2 cost of orchestrator, 0.8x quality of orchestrator
 - Tools/Constraints: Execution-focused—no research, no architectural decisions
-- **Delegate when:** For implementation work, think and triage first. If the change is non-trivial or multi-file, hand bounded execution to @fixer
+- **Delegate when:** For implementation work, think and triage first. If the change is non-trivial or multi-file, hand bounded execution to @fixer • Writing or updating tests • Tasks that touch test files, fixtures, mocks, or test helpers
 - **Don't delegate when:** Needs discovery/research/decisions • Single small change (<20 lines, one file) • Unclear requirements needing iteration • Explaining to fixer > doing • Tight integration with your current work • Sequential dependencies
-- **Rule of thumb:** Explaining > doing? → yourself. Orchestrator paths selection is vastly improved by Fixer. eg it can reduce overall speed if Orchestrator splits what's usually a single task into multiple subtasks and parallelize it with fixer.
+- **Rule of thumb:** Explaining > doing? → yourself. Test file modifications and bounded implementation work usually go to @fixer. Orchestrator paths selection is vastly improved by Fixer. eg it can reduce overall speed if Orchestrator splits what's usually a single task into multiple subtasks and parallelize it with fixer.
 
 @council
 - Role: Multi-LLM consensus engine for high-confidence answers
@@ -114,9 +114,17 @@ Balance: respect dependencies, avoid parallelizing what must be sequential.
 4. Integrate results
 5. Adjust if needed
 
+### Validation routing
+- Validation is a workflow stage owned by the Orchestrator, not a separate specialist
+- Route UI/UX validation and review to @designer
+- Route code review, simplification, maintainability review, and YAGNI checks to @oracle
+- Route test writing, test updates, and changes touching test files to @fixer
+- If a request spans multiple lanes, delegate only the lanes that add clear value
+
 ## 6. Verify
 - Run \`lsp_diagnostics\` for errors
-- Suggest \`simplify\` skill when applicable
+- Use validation routing when applicable instead of doing all review work yourself
+- If test files are involved, prefer @fixer for bounded test changes and @oracle only for test strategy or quality review
 - Confirm specialists completed successfully
 - Verify solution meets requirements
 

+ 1 - 1
src/cli/codemap.md

@@ -393,7 +393,7 @@ InstallConfig (preferences)
 
 | Name | Repo | Agents | Description |
 |------|------|--------|-------------|
-| `simplify` | brianlovin/claude-config | orchestrator | YAGNI code simplification expert |
+| `simplify` | brianlovin/claude-config | oracle | YAGNI code simplification expert |
 | `agent-browser` | vercel-labs/agent-browser | designer | High-performance browser automation |
 
 ### Custom Bundled Skills (copied from src/skills/)

+ 3 - 3
src/cli/skills.test.ts

@@ -17,9 +17,9 @@ describe('skills permissions', () => {
     const designerPerms = getSkillPermissionsForAgent('designer');
     expect(designerPerms['agent-browser']).toBe('allow');
 
-    // Developer (orchestrator) should have simplify allowed (and everything else via *)
-    const orchPerms = getSkillPermissionsForAgent('orchestrator');
-    expect(orchPerms.simplify).toBe('allow');
+    // Oracle should have simplify allowed by recommendation
+    const oraclePerms = getSkillPermissionsForAgent('oracle');
+    expect(oraclePerms.simplify).toBe('allow');
   });
 
   it('should honor explicit skill list overrides', () => {

+ 1 - 1
src/cli/skills.ts

@@ -41,7 +41,7 @@ export const RECOMMENDED_SKILLS: RecommendedSkill[] = [
     name: 'simplify',
     repo: 'https://github.com/brianlovin/claude-config',
     skillName: 'simplify',
-    allowedAgents: ['orchestrator'],
+    allowedAgents: ['oracle'],
     description: 'YAGNI code simplification expert',
   },
   {