--- name: create-superagent description: Build a new specialist superagent using the QRSQPI process + agent_factory.py. Triggered when Jake encounters a task with no existing specialist agent. model: opus trigger: manual or auto (when Jake identifies a task type with no existing agent) --- # Create Superagent Build a new specialist agent from scratch using the QRSQPI framework and the existing agent_factory infrastructure. ## When to Use This Skill Use this skill when: - Jake receives a task type that no existing agent handles well - A new domain or capability gap is identified (3+ occurrences with no specialist) - Mike explicitly asks to build a new agent for a specific role - The `agent_factory.py` gap detector surfaces an unserved pattern ## QRSQPI Process ### Q — Query: Define the Problem State clearly: 1. What task type or domain needs a specialist? 2. What is the failure pattern? (What does Jake currently do that's suboptimal?) 3. What would success look like? (What should the new agent do that nothing else does?) 4. Estimated usage frequency (daily / weekly / on-demand) ### R — Research: What Exists Run these checks before building: ```bash # Check existing agents ls /Users/mikerodgers/Desktop/Startup-Intelligence-OS/claude/agents/ # Check the 500+ agent catalog cat /Users/mikerodgers/Desktop/Startup-Intelligence-OS/startup-os/domains/500-ai-agents-projects/catalog.yaml | grep -i "[domain keyword]" # Run agent_factory gap detector cd /Users/mikerodgers/Desktop/Startup-Intelligence-OS/susan-team-architect/backend source .venv/bin/activate python3 -c " from collective.agent_factory import AgentFactory af = AgentFactory() patterns = af.analyze_task_patterns('data/runs/') for p in patterns[:5]: print(p) " ``` Check for keyword overlap with existing agents. If overlap > 50%, consider extending rather than creating. ### S — Spec: Design the Blueprint Define the agent blueprint: ```yaml agent_id: [kebab-case-name] name: [Human Name — Role Title] domain: [primary domain] model: [haiku|sonnet|opus] # haiku for fast/cheap, opus for complex reasoning cost_tier: [CHEAP|MID|EXPENSIVE] trigger_keywords: [list of 5-8 routing keywords] tools: [list of tools this agent needs] handoff_to: [list of agents this routes to] ``` System prompt must include these 4 sections: 1. **Identity** — who this agent is, expertise, perspective 2. **Responsibilities** — what it does (5-7 bullet points) 3. **Tools** — how it uses each available tool 4. **Principles** — constraints, quality standards, failure modes to avoid ### Q — Quality: Validate the Blueprint Before generating the file, verify: - [ ] Name doesn't conflict with existing agents (check `claude/agents/`) - [ ] Trigger keyword overlap with existing agents is < 50% - [ ] System prompt has all 4 required sections - [ ] System prompt is > 200 words - [ ] Model tier matches complexity (don't use Opus for simple tasks) - [ ] At least 3 concrete examples of tasks this agent would handle If any check fails: fix before proceeding. ### P — Produce: Generate the Agent File Use `agent_factory.py` to generate the file, OR manually write it: ```bash cd /Users/mikerodgers/Desktop/Startup-Intelligence-OS/susan-team-architect/backend source .venv/bin/activate python3 -c " from collective.agent_factory import AgentFactory, AgentPattern af = AgentFactory() pattern = AgentPattern( domain='[domain]', task_types=['[task1]', '[task2]'], frequency=5, example_prompts=['[example1]', '[example2]'], complexity='[simple|moderate|complex]' ) blueprint = af.design_agent(pattern) valid = af.validate_blueprint(blueprint) print('Valid:', valid) filepath = af.generate_agent_file(blueprint, output_dir='../../claude/agents/') print('Generated:', filepath) " ``` Output file location: `/Users/mikerodgers/Desktop/Startup-Intelligence-OS/claude/agents/{agent-id}.md` ### P — Post: Wire into Routing After generating the file: 1. **Add to Jake's routing table** — append routing entry to `startup-os/JAKE.yaml` under `routing_table` section: ```yaml - agent: [agent-id] triggers: [keyword list] handoff_from: jake ``` 2. **Test the routing** — give Jake a sample prompt that should trigger the new agent and verify it routes correctly. 3. **Commit the new agent** — use `/commit` with scope `agents`. ### I — Integrate: Run and Validate First run checklist: - [ ] Feed the agent a representative task - [ ] Verify output quality vs. what Jake would have done - [ ] Check token cost is within expected tier - [ ] Confirm handoff back to Jake works - [ ] Log the new agent in `startup-os/artifacts/` if it's a major addition ## Auto-Trigger Protocol Jake should automatically invoke this skill when: 1. The same task type fails or is awkward 3+ times 2. `agent_factory.py` returns a high-confidence unserved pattern 3. Mike says "build an agent for X" or "we need a specialist for Y" When auto-triggered, run Q and R silently, then present the blueprint to Mike for approval before P (produce). ## Examples of Agents to Build - **Email intelligence agent** — classifies, drafts replies, tracks threads - **LinkedIn outreach agent** — personalizes connection requests at scale - **Competitive intelligence agent** — monitors competitor moves, pricing, hiring - **Contract/proposal agent** — drafts SOWs, proposals, pricing for RIG engagements - **Daily metrics agent** — compiles KPIs from Supabase + reports anomalies