diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json
index bede7d0ed..2e751f266 100644
--- a/.claude-plugin/marketplace.json
+++ b/.claude-plugin/marketplace.json
@@ -10,7 +10,7 @@
"plugins": [
{
"name": "genie",
- "version": "3.260314.8",
+ "version": "3.260316.14",
"source": "./plugins/genie",
"description": "Human-AI partnership for Claude Code. Share a terminal, orchestrate workers, evolve together. Brainstorm ideas, wish them into plans, make with parallel agents, ship as one team. A coding genie that grows with your project."
}
diff --git a/.claude/commands/level-up.md b/.claude/commands/level-up.md
new file mode 100644
index 000000000..bcdb7569b
--- /dev/null
+++ b/.claude/commands/level-up.md
@@ -0,0 +1,1275 @@
+---
+description: Assess your Claude Code level (0-10) and get a personalized roadmap to the next one
+---
+
+# Level Up
+
+The 10 Levels of Claude Code. Scan your environment, determine where you actually are, get a focused roadmap to the next level, and optionally build the first step right now.
+
+This is NOT the generic "10 Levels of Claude" (browser, desktop, projects). This is specifically about Claude Code mastery. Level 0 is "just installed it." Level 10 is genuinely rare.
+
+**Usage:**
+- `/level-up` - Full flow: assess, roadmap, build
+- `/level-up --assess` - Just show your current level
+- `/level-up --build` - Skip assessment, jump to building
+
+---
+
+## How It Works
+
+```
+Scan Environment → Determine Level → Show Roadmap → Build First Step
+ ↓ ↓ ↓ ↓
+ Phase 1 Phase 1 Phase 2 Phase 3
+ (automatic) (+ 3 questions) (next level) (optional)
+```
+
+Designed to be run repeatedly. Every time you level up, the assessment updates.
+
+---
+
+## The 10 Levels of Claude Code
+
+| Level | Name | What It Means (Plain English) |
+|-------|------|-------------------------------|
+| 0 | Terminal Tourist | You just installed it. You're typing prompts like it's ChatGPT but in a terminal. No setup, no config. That's fine, everyone starts here. |
+| 1 | Grounded | You've created a CLAUDE.md file so Claude actually knows who you are and what you want. You know the basic commands. This alone makes a huge difference. |
+| 2 | Connected | Claude can read your actual tools: your Slack, your Drive, your Notion, your Gmail. You're not copy-pasting context anymore. It just pulls what it needs. |
+| 3 | Skilled | You've built reusable commands (skills) you run regularly. Instead of re-explaining the same task every session, you type `/research` or `/review` and it just works. |
+| 4 | Context Architect | You've built a structured knowledge system: memory files, patterns, client profiles, examples. Claude doesn't just follow instructions, it draws from everything you've taught it. Output gets better over time. |
+| 5 | System Builder | Your skills chain together. One feeds into the next. You use sub-agents for parallel work. You have approval gates so nothing ships without your sign-off. This is where Claude feels like a team, not a tool. |
+| 6 | Pipeline Engineer | You're calling Claude from scripts. Headless mode, JSON output, piping data through it programmatically. Claude is a component in your automation stack, not just a chat window. |
+| 7 | Browser Commander | Claude controls a browser. It scrapes websites, takes screenshots, generates PDFs, builds carousels. Research pipelines that crawl the web and turn findings into deliverables. |
+| 8 | Multi-Agent Operator | Multiple Claude instances running simultaneously. Each one is a specialist. You coordinate them like a team lead. They share work through files and git. |
+| 9 | Always On | Claude runs on a schedule whether you're at your desk or not. Cron jobs, background agents, automated monitoring. It's infrastructure now, not a tool you open. |
+| 10 | Swarm Architect | Agents that manage other agents. Autonomous execution loops. Give it a goal and it works toward it, spawning sub-agents as needed. Genuinely rare. Maybe a handful of people on the planet. |
+
+Most users land between Level 1 and 4. Level 5 is strong. Level 7+ is rare.
+
+---
+
+## Phase 1: Assess Your Level
+
+### Step 1.1: Environment Scan
+
+Silently scan the user's environment. Do NOT ask permission for each check. Just read what's available.
+
+**Check all of these:**
+
+```
+1. CLAUDE.md (check ALL locations)
+ - Check: CLAUDE.md, .claude/CLAUDE.md, CLAUDE.local.md, ~/.claude/CLAUDE.md
+ - Does any exist? How many locations are used?
+ - How many lines total? (< 10 = minimal, 10-50 = basic, 50-150 = solid, 150+ = advanced)
+ - Does it reference memory files, patterns, workflows?
+ - Does it have navigation tables, progressive disclosure, workflow instructions?
+
+2. Skills / Commands
+ - Check both .claude/commands/ AND .claude/skills/ directories
+ - Count total skills
+ - Read 2-3 to check complexity:
+ * Simple (< 20 lines, single prompt) = Level 3
+ * Medium (20-80 lines, multi-step) = Level 3-4
+ * Complex (80+ lines, phases, approval gates, tool calls) = Level 5+
+ * Skills that call other skills or orchestrate sub-agents = Level 5-6
+
+3. MCP Configuration
+ - Check .mcp.json in current directory (project-level)
+ - Check ~/.claude.json for mcpServers (user-level)
+ - Optionally check managed config if enterprise
+ - Count configured MCP servers across all locations
+ - Categorize: data (Notion, Drive), comms (Slack, Gmail), dev (GitHub, Supabase), browser (Puppeteer, Chrome), specialty (PostHog, GSC)
+
+4. Memory / Context Structure
+ - Is there a memory/ directory?
+ - How deep? (flat files = Level 4, nested dirs like memory/patterns/, memory/customers/, memory/examples/ = Level 4-5)
+ - Are there templates, workflows, experience directories?
+ - Does the CLAUDE.md reference and route to memory files?
+
+5. Quality Gate Signals (Level 5+)
+ - Hook configurations in .claude/settings.json? (PreToolUse, PostToolUse, etc.)
+ - Agent definitions in .claude/agents/ or ~/.claude/agents/?
+ - Hooks are quality gates, not infrastructure. They belong here, not at Level 9.
+
+6. Automation Signals (Level 6+)
+ - Any shell scripts that call `claude -p` or `claude --print`?
+ - Any package.json with Playwright or Puppeteer?
+ - Any screenshot scripts, PDF generators, scraping tools?
+ - Evidence of JSON output piping?
+ - Chrome browser integration enabled (CLI flags)?
+
+7. Multi-Agent Signals (Level 8+)
+ - tmux config files or scripts?
+ - Multiple CLAUDE.md files for different agent roles?
+ - VPS deployment evidence?
+
+8. Always-On Signals (Level 9-10)
+ - Cron jobs, launchd services, or systemd services calling Claude on a schedule?
+ - Background agents running 24/7 (pm2, systemd)?
+ - Autonomous loop scripts (PRD + test suite patterns)?
+ - Agent orchestration configs (Agent Teams, Gastown, OpenClaw)?
+ - Evidence of agents managing other agents?
+```
+
+### Step 1.2: Context Questions
+
+Ask the user these 3 questions:
+
+1. **What do you mainly use Claude Code for?** (coding / content creation / research / automation / business operations / other)
+2. **What's your biggest friction right now?** (output quality / context limits / don't know what's possible / speed / reliability)
+3. **If you could automate one thing you do repeatedly, what would it be?**
+
+### Step 1.3: Determine Level
+
+Use this scoring system. The user's level is determined by the HIGHEST level where they meet ALL criteria:
+
+| Level | Required Signals |
+|-------|-----------------|
+| 0 | No CLAUDE.md, no .claude/ directory |
+| 1 | CLAUDE.md exists (any size). Knows basic slash commands. |
+| 2 | .mcp.json with 1+ working MCP servers. Pulling real data into sessions. |
+| 3 | 3+ custom skills in .claude/commands/ or .claude/skills/. Uses them regularly. |
+| 4 | Structured memory/ directory with patterns, examples, or knowledge files. CLAUDE.md references them. Context architecture, not just a config file. |
+| 5 | Complex multi-phase skills (80+ lines). Skills chain together (output of one feeds another). Evidence of subagent usage or agent definitions in .claude/agents/. Hook configurations for quality gates. Consistent production-quality output. |
+| 6 | Shell scripts or automation calling `claude -p`. JSON output piping. Programmatic integration beyond interactive use. |
+| 7 | Browser automation in project (Playwright, Puppeteer, or Chrome integration). Screenshot automation, PDF generation, web scraping workflows. Browser-powered pipelines. |
+| 8 | tmux multi-session setups. Multiple parallel CC instances. Different agent roles. VPS or remote deployment. |
+| 9 | Cron jobs or scheduled tasks running CC. Background agents running 24/7. CC as persistent infrastructure, not a tool you open. |
+| 10 | Autonomous execution loops. Multi-agent orchestration frameworks. Agents spawning and managing other agents. Safety boundaries and rollback systems. |
+
+**Important:** Having lots of files doesn't automatically mean advanced. 50 simple skills is still Level 3. The complexity and integration between components matters more than quantity.
+
+### Step 1.4: Present the Assessment
+
+Show the user their level with clear reasoning. The goal is to make them feel understood, not judged. Explain WHY each thing matters, not just that you found it.
+
+```
+## Your Claude Code Level: [X] / 10
+
+**[Level Name]**
+
+### Here's why you're at Level [X]:
+
+Walk through the levels one by one, bottom to top, showing what you found for each:
+
+**Level 0 (Terminal Tourist): ✓ You're past this.**
+You have [specific thing], so you're clearly not just typing into a terminal with no setup.
+
+**Level 1 (Grounded): ✓ Covered.**
+Your CLAUDE.md [describe what it looks like: how long, what's in it, how detailed].
+This means Claude actually knows [what it knows about them]. That's the foundation.
+
+**Level 2 (Connected): ✓ Covered.**
+You have [X] MCP servers: [list them]. That means Claude can directly [what those MCPs enable: read your Slack, check your email, pull from Notion, etc.]. You're not copy-pasting context anymore.
+
+[Continue for each level they've achieved...]
+
+**Level [X+1] ([Name]): ✗ This is where it stops.**
+[Explain plainly what's missing and WHY it matters. Don't just say "no headless scripts found." Say something like: "Right now you're doing everything interactively. You open Claude, type a command, wait for output. Level 6 is about making Claude work without you sitting there. You'd write a script that calls Claude, processes the output, and saves it somewhere. Like a morning briefing that generates itself before you wake up. I didn't find any scripts like that in your setup."]
+
+### The short version:
+[One paragraph summary. Example: "You've got a solid foundation: Claude knows who you are, it can pull from your real tools, and you've built workflows that run on command. That's strong. What you're missing is the jump from interactive to programmatic. Everything still requires you to be in the chair typing commands."]
+
+### Where that puts you:
+Most Claude Code users land between Level 1 and 4. At Level [X], you're [ahead of most / in the middle / at the frontier / etc.].
+```
+
+**Tone rules:**
+- Talk to them like a knowledgeable friend, not a grading rubric
+- Explain things like you're talking to someone smart who just hasn't seen this particular thing before
+- If something is impressive, say so genuinely
+- If something is messy or could be better, say that too, but constructively
+- Use "you" and "your", not "the user"
+- Avoid jargon without explanation. If you mention "headless mode" also say "that means running Claude from a script instead of typing into the terminal"
+- The goal is: after reading this, they understand exactly what they have, what they're missing, and why the next level matters
+
+If `--assess` flag was used, stop here. Otherwise continue to Phase 2.
+
+---
+
+## Phase 2: Your Roadmap
+
+Show ONLY the next level transition. Do not dump all 10 levels. Focus is everything.
+
+**Pick the matching section below based on assessed level.**
+
+---
+
+### Level 0 → Level 1: Get Grounded
+
+**What this unlocks:** Claude remembers your preferences, follows your rules, produces consistent output instead of generic responses every session.
+
+**Your roadmap:**
+
+1. **Create your CLAUDE.md** (10 minutes)
+ - This is the single most important file. Claude reads it at the start of every session.
+ - Include: who you are, what you do, your communication preferences, your project context, rules for output quality.
+ - Think of it as onboarding a new team member. What would they need to know on day one?
+
+2. **Set up your project folder** (2 minutes)
+ - Create a dedicated folder for your main work.
+ - Initialize git: `git init` (Claude Code works best in git repos, it tracks changes).
+ - Put your CLAUDE.md at the root.
+
+3. **Learn the essential commands** (5 minutes)
+ - `/compact` compresses your conversation to save context space
+ - `/model` switches between Opus (deep reasoning), Sonnet (daily work), Haiku (quick tasks)
+ - `/cost` shows how much you've spent this session
+ - `/help` shows everything available
+
+4. **Run a real task** (10 minutes)
+ - Don't start with toy problems. Give it something you actually need done.
+ - Notice how it follows your CLAUDE.md rules.
+
+**Community tip:** "The quality of your repository dictates the quality of your output." Members who invested 30 minutes in their CLAUDE.md before doing anything else got dramatically better results from day one.
+
+**Common mistake:** Writing a CLAUDE.md that's too vague. "Be helpful" means nothing. "Always write in short paragraphs, use data to support claims, never use jargon" means everything.
+
+---
+
+### Level 1 → Level 2: Connect Your Data
+
+**What this unlocks:** Claude reads your actual Slack messages, Notion pages, Google Docs, Gmail. No more copy-pasting context. It just knows.
+
+**Your roadmap:**
+
+1. **Pick your first MCP** (5 minutes)
+ - MCP stands for "Model Context Protocol." In plain English: it's a plugin that lets Claude directly read and write to your tools. Instead of you copying a Slack message and pasting it into Claude, an MCP lets Claude go read Slack itself.
+ - Pick the tool you use most: Google Drive, Notion, Slack, or Gmail.
+
+2. **Add it to your config** (5 minutes)
+ - You tell Claude about your MCPs by adding them to a settings file called `.mcp.json`. Think of it like a contact list: you're giving Claude the address of each tool so it knows how to reach it.
+ - Create `.mcp.json` in your project root (or add to `~/.claude.json` for global access).
+ - Example structure:
+ ```json
+ {
+ "mcpServers": {
+ "google-drive": {
+ "command": "npx",
+ "args": ["-y", "@anthropic-ai/google-drive-mcp"]
+ }
+ }
+ }
+ ```
+ - Restart Claude Code after adding.
+
+3. **Test it with a real task** (5 minutes)
+ - Just ask Claude something that requires your tool. If it works, the MCP is connected:
+ - "Summarize the last 5 messages in #general on Slack"
+ - "What are the action items from my last meeting notes in Notion?"
+ - "Draft a reply to the last email from [name]"
+
+4. **Add a second MCP** (5 minutes)
+ - Two connected data sources is where the magic starts. Claude can cross-reference: "Based on the Slack discussion AND the Notion brief, draft the proposal."
+
+**Community tip:** Don't install 15 MCPs on day one. Tijmen discovered that too many MCPs bloat your starting context. Claude Code's tool search feature helps (dropped context from 51% to 13%), but fewer is still better. Start with 1-2 that match your daily work.
+
+**Best first combos:**
+- Content creators: Google Drive + Notion
+- Marketers: Slack + Google Drive
+- Developers: GitHub + Supabase
+- Consultants: Notion + Gmail + Slack
+
+---
+
+### Level 2 → Level 3: Build Your Skills
+
+**What this unlocks:** Repeatable workflows you trigger with a single command. Instead of re-explaining tasks every session, you type `/review` or `/research` and it runs the whole thing.
+
+**Your roadmap:**
+
+1. **Identify your most repeated task** (5 minutes)
+ - Think about what you keep explaining to Claude over and over. "Research this company and give me a summary." "Review this document for quality." "Write a LinkedIn post in my voice." If you've said it more than twice, it should be a skill.
+
+2. **Create the skill file** (10 minutes)
+ - A skill is just a text file with instructions. You write down what you want Claude to do, step by step, and save it as a file. Then instead of typing those instructions every time, you just type `/name` and Claude follows the instructions automatically.
+ - Create `.claude/commands/` directory if it doesn't exist.
+ - Create a markdown file: `.claude/commands/[name].md` (for example, `research.md`)
+ - Structure:
+ ```markdown
+ ---
+ description: What this skill does in one line
+ ---
+
+ # [Skill Name]
+
+ [2-3 sentences: what this does and when to use it]
+
+ ## Steps
+
+ 1. [First thing Claude should do]
+ 2. [Second thing]
+ 3. [Third thing]
+
+ ## Output Format
+
+ [Describe what the final output should look like]
+
+ ## Rules
+
+ - [Important constraint 1]
+ - [Important constraint 2]
+ ```
+
+3. **Test and iterate** (5 minutes)
+ - Type `/[name]` to run it. Claude reads your instructions and follows them.
+ - First version won't be perfect. Run it, see what's off, edit the .md file. The skill improves every time you tweak it.
+
+4. **Build 2-3 more skills** (ongoing)
+ - Most people start with three: one for research, one for creating something, one for reviewing quality. Once you have those, they start feeding into each other naturally.
+
+**Community tip:** Skills turn Claude into a team member who never forgets the process. After building 5+ skills, output consistency goes from "hit or miss" to "reliable every time."
+
+**Note on terminology:** "Custom commands" and "skills" are the same thing. Files in `.claude/commands/` and `.claude/skills/` both create slash commands.
+
+---
+
+### Level 3 → Level 4: Become a Context Architect
+
+**What this unlocks:** A persistent knowledge system. Claude doesn't just follow instructions. It draws from your accumulated knowledge, patterns, client history and examples to produce work that improves over time.
+
+**What "context architecture" actually means:** Right now, every time you start a new Claude session, it starts fresh. It doesn't remember what you did last week. A context architecture is a folder of files that Claude reads at the start of every session: who your clients are, what approaches you use, examples of your best work. It's like giving a new employee a handbook on day one instead of re-training them every morning.
+
+**Your roadmap:**
+
+1. **Create your knowledge folders** (20 minutes)
+ - Make a `memory/` folder in your project with subfolders for different types of knowledge:
+ ```
+ memory/
+ ├── company/ # About your business, your positioning, your offers
+ ├── customers/ # One file per client: who they are, what you're doing for them
+ ├── patterns/ # Approaches that work: "how I run a strategy call," "how I write proposals"
+ └── examples/ # Your best past work that Claude can use as a reference
+ ```
+ - Each file is just a plain text document. Keep them focused: one topic per file.
+
+2. **Point Claude to your knowledge** (10 minutes)
+ - Update your CLAUDE.md so it tells Claude where to find things. Add a section like "Before starting client work, read memory/customers/[client name]." This way Claude knows to check your notes before it starts working.
+
+3. **Write down what you know** (30 minutes)
+ - Start with 5 things you do the same way every time: how you structure a proposal, how you run a meeting, how you write a LinkedIn post. Save each one as a file in memory/patterns/.
+ - Save 3-5 examples of your best output. Claude will use these as a reference for quality and style.
+
+4. **Build the feedback loop** (ongoing)
+ - After every project, save what worked. Your system gets smarter with every project. This is where the compounding starts: month one feels slow, month two you notice the difference.
+
+**Community tip:** "I moved my entire business into GitHub. Everything is a repo." The members running structured knowledge systems report 3-5x productivity gains after the first month of accumulation.
+
+**The formula:** Context quality = output quality. This is not prompt engineering. This is context engineering.
+
+---
+
+### Level 4 → Level 5: Build Systems, Not Skills
+
+**What this unlocks:** Instead of running one skill at a time, your skills work together like an assembly line. You become the person who designs the system, not the person who runs each step.
+
+**What "systems" means here:** At Level 3-4, you have individual skills: `/research`, `/create`, `/review`. At Level 5, these connect. Research automatically feeds into creation, which automatically gets reviewed. You also have "subagents," which are like assistants that Claude spins up to handle parts of the work in parallel. One researches while another writes. And you have "hooks," which are automatic safety checks that run every time Claude does something: like a spell-checker that runs every time you save a document.
+
+**Your roadmap:**
+
+1. **Add phases to your skills** (15 minutes)
+ - Right now your skills probably do everything in one go. Break them into phases with checkpoints where Claude pauses and asks "does this look right?" before continuing. This prevents Claude from going off-track for 10 minutes before you notice.
+ ```markdown
+ ## Phase 1: Research
+ [Steps...]
+ **Approval gate:** Show me what you found. Wait for my OK before continuing.
+
+ ## Phase 2: Create
+ [Steps...]
+ **Approval gate:** Show me the draft. Wait for my OK before finalizing.
+
+ ## Phase 3: Review
+ [Steps...]
+ ```
+
+2. **Connect your skills together** (10 minutes)
+ - Design skills so the output of one becomes the input of the next. Your `/research` skill saves a brief. Your `/create` skill reads that brief and uses it. Your `/review` skill checks the final output. It's a pipeline: each step feeds the next.
+
+3. **Use subagents for parallel work** (10 minutes)
+ - A subagent is a separate Claude instance that runs alongside your main session. Think of it like delegating: "You go research the competitor while I work on the proposal." Claude can spin these up inside your skills. One subagent researches, another writes, another reviews: all at the same time.
+ - Define agent roles in `.claude/agents/` so each one has its own personality and expertise.
+
+4. **Set up automatic safety checks** (10 minutes)
+ - Hooks are rules that run automatically before or after Claude does something. For example: "Before writing any file, check it's not a password file." Or: "After editing code, run the linter." You configure these in `.claude/settings.json`. They're like guardrails that prevent mistakes without you having to watch every action.
+
+5. **Quality systems** (ongoing)
+ - Build review checklists into your skills. Point Claude to your memory/examples/ files so it knows what "good" looks like. Output should be ready to send to a client, not "good enough."
+
+**Community tip:** The jump from Level 4 to 5 is where Claude Code stops feeling like a tool and starts feeling like a team. The key is building the orchestration layer, not just having more skills.
+
+---
+
+### Level 5 → Level 6: Programmatic Pipelines
+
+**What this unlocks:** Claude works without you being there. You write a script once, and it runs Claude automatically whenever you want: every morning, before every meeting, on demand from your phone.
+
+**What "headless mode" actually means:** Normally you open Claude Code, type something, and wait for a response. That's "interactive mode": you're sitting there having a conversation. "Headless mode" means you run Claude from a script instead. No conversation, no typing. You give it a task in advance, it does the work, and saves the result to a file. You come back later and the work is done. It's the difference between calling someone on the phone vs. sending them a task by email.
+
+**Your roadmap:**
+
+1. **Try headless mode once** (5 minutes)
+ - Instead of opening Claude Code and typing, run this one line in your terminal:
+ ```bash
+ claude -p "Analyze all files in /src and write a security audit to audit.md"
+ ```
+ - That's it. Claude reads the task, does the work, and saves the output. No conversation needed. The `-p` flag means "just do this task and finish."
+ - **Important:** Your slash commands (like `/lookout`) only work in interactive mode. In headless mode, you either describe the task in plain English or feed it the skill file directly: `claude -p "$(cat .claude/commands/lookout.md)"`
+
+2. **Write your first automation script** (15 minutes)
+ - A script is just a text file with a list of commands your computer runs in order. You write it once and can run it whenever you want with a single click or command. Here's what one looks like:
+ ```bash
+ #!/bin/bash
+ # This script generates a morning briefing automatically.
+ # You run it by typing: bash morning-briefing.sh
+ # Or you can schedule it to run every morning at 7am (that's Level 9).
+ claude -p "Read my latest emails and Slack messages, write a morning briefing to briefing.md" \
+ --allowedTools "Read,Write,Glob,Grep,mcp__google__gmail_search_messages"
+ ```
+ - Save this as a file (e.g. `morning-briefing.sh`), then run it with `bash morning-briefing.sh`. Claude does the work and saves the result. You don't need to be watching.
+
+3. **Chain outputs together** (10 minutes)
+ - You can make Claude output structured data (JSON) instead of plain text, then feed that into another tool or another Claude call. Think of it like an assembly line: step 1 gathers data, step 2 analyzes it, step 3 creates the report. Each step runs automatically.
+
+4. **Integrate with your existing tools** (ongoing)
+ - Once you're comfortable with scripts, you can plug Claude into anything: automatically review code when someone submits a change, generate reports from your database, process incoming data.
+
+**Community tip:** Level 6 is where most people who do real automation work land. It's the practical ceiling for most use cases. Beyond here, you're building infrastructure.
+
+---
+
+### Level 6 → Level 7: Browser Power
+
+**What this unlocks:** Claude can open a web browser, visit websites, read what's on the page, take screenshots, and generate PDFs. It can research companies by actually visiting their website instead of relying on what it already knows.
+
+**What "browser automation" actually means:** You know how you open Chrome, go to a website, scroll around, and copy information? Browser automation means Claude does that same thing, but programmatically. It opens a real browser (you just can't see it), navigates to pages, reads the content, and brings back what it found. It can also take a screenshot of an HTML file you created and turn it into an image or PDF.
+
+**Your roadmap:**
+
+1. **Install browser tools** (5 minutes)
+ - Run `npm install playwright` in your project, then `npx playwright install chromium`. This installs a browser that Claude can control. Think of it like giving Claude its own Chrome window.
+ - Alternatively, enable Chrome integration via Claude Code CLI flags (`--browser`).
+
+2. **Screenshot and PDF generation** (10 minutes)
+ - Build skills that create an HTML page (like a deck or report), then screenshot it into a clean image or PDF. This is how you make professional-looking deliverables without Canva or PowerPoint.
+
+3. **Web research workflows** (15 minutes)
+ - Build a skill where Claude visits a company's website, reads their pages, checks their LinkedIn, and synthesizes everything into a brief. Instead of relying on its training data (which might be outdated), it's reading the live website.
+
+4. **Research pipelines** (ongoing)
+ - Combine browser + your other tools: Claude scrapes a website, saves the findings to Notion, and alerts you via Slack. Competitive intelligence on demand.
+
+**Community tip:** This is the level where Claude Code starts replacing paid SaaS tools. Members have canceled Gamma (decks), Canva Pro (design), Superhuman (email) after building equivalent browser-powered workflows.
+
+---
+
+### Level 7 → Level 8: Multi-Agent Operations
+
+**What this unlocks:** Multiple Claude Code sessions running at the same time, each doing different work. Like having a team of specialists working in parallel.
+
+**What "multi-agent" actually means:** Imagine you have three employees. One is researching a competitor, one is writing a proposal, and one is reviewing last week's deliverable. They're all working at the same time on different tasks. That's what multi-agent means: you open multiple Claude Code windows and give each one a different job. They work simultaneously, and you coordinate the results.
+
+**Your roadmap:**
+
+1. **Open multiple Claude sessions at once** (10 minutes)
+ - Use a tool called tmux (a terminal multiplier: it splits your terminal screen into multiple panels). Each panel runs its own Claude Code session. One researches, another writes, another reviews: all at the same time.
+ ```bash
+ tmux new-session -s orchestrator
+ # Split panes: Ctrl+B then %
+ # Each pane runs: cd /project && claude
+ ```
+
+2. **Give each session a role** (15 minutes)
+ - Each Claude session gets its own instructions. One is the "researcher" (only gathers information), one is the "writer" (only creates content), one is the "reviewer" (only checks quality). They pass work between each other through shared files in your project folder.
+
+3. **Move to a cloud server** (30 minutes)
+ - Instead of running everything on your laptop, you rent a small cloud server (a VPS: a computer in the cloud that's always on). You set up Claude Code there and access it from your phone or any computer via an app like Termius. Your agents are always available, even when your laptop is closed.
+
+4. **Coordination patterns** (ongoing)
+ - The tricky part isn't running multiple agents: it's making sure they don't step on each other's work. Use shared task files, separate git branches per agent, and a review step before merging anything.
+
+**Community tip:** R moved his entire business to this model. "We've all become endpoint facilitators for our agents. We're context generators, for now." This level requires discipline. Multiple agents without coordination create chaos, not productivity.
+
+---
+
+### Level 8 → Level 9: Always On
+
+**What this unlocks:** Claude runs on a schedule whether you're at your desk or not. Like having an employee who works night shifts: they do the routine work while you sleep, and the results are waiting for you in the morning.
+
+**What "always on" actually means:** At every previous level, you start Claude, give it work, and close it when you're done. At Level 9, Claude runs on a timer. Your computer (or cloud server) automatically starts Claude at specific times: 7am every morning, every Monday at noon, every hour. It does the work, saves the results, and stops. You never opened it or typed anything. It's like setting an alarm clock, but instead of waking you up, it wakes up Claude.
+
+**Your roadmap:**
+
+1. **Schedule a task to run automatically** (15 minutes)
+ - Your computer has a built-in scheduler (called "cron" on Mac/Linux). You tell it: "At 7am every weekday, run this script." The script calls Claude in headless mode, Claude does the work, saves the output. You wake up and the briefing is already there.
+ ```bash
+ # This line tells your computer: at 7am every day, run Claude and generate a briefing
+ 0 7 * * * cd /project && claude -p "Generate morning briefing" >> /logs/briefing.log
+ ```
+ - On macOS, launchd (another scheduler) is more reliable than cron. Either works.
+
+2. **Keep agents running continuously** (15 minutes)
+ - Instead of running Claude once and stopping, you can keep it running all the time using tools like pm2 (a process manager: it keeps programs alive and restarts them if they crash). Claude watches for new tasks in a file or queue and processes them as they appear. Like a customer service rep who's always on shift.
+
+3. **Monitoring and alerting** (15 minutes)
+ - Claude checks your data sources on a schedule and pings you when something needs attention. Example: every morning, check competitor pricing and alert you if anything changed. Or: scan your Slack channels for unanswered questions.
+
+**Community tip:** Level 9 is where the line between "using a tool" and "running an AI system" disappears. Most people don't need this. If your work is project-based, Level 5-7 is the sweet spot. Level 9 is for people running continuous operations.
+
+---
+
+### Level 9 → Level 10: Swarm Architecture
+
+**What this unlocks:** You give Claude a goal, and it figures out how to get there on its own. It breaks the goal into tasks, assigns them to other Claude instances, reviews the results, and keeps going until the goal is met. You check in periodically, but you're not driving.
+
+**What "swarm" actually means:** At Level 8, you manually set up multiple Claude sessions and tell each one what to do. At Level 10, one "boss" Claude does that for you. You say "build this feature" and the boss Claude breaks it into pieces, spins up worker Claudes to handle each piece, checks their work, and assembles the final result. It's managing a team of AI agents the way a project manager manages a team of people, except the project manager is also AI.
+
+**Your roadmap:**
+
+1. **The autonomous loop** (advanced)
+ - Give Claude a document describing what you want built, plus a set of tests that define "done." Claude picks a task, does the work, runs the tests. If they pass, it commits and moves to the next task. If they fail, it fixes the issue and tries again. It keeps going until everything passes.
+ - Safety checklist (this is important because you're letting Claude work unsupervised):
+ - Always run in a sandboxed environment (an isolated copy, not your main project)
+ - Set clear boundaries on what it can modify
+ - Review its work before it goes live
+ - Set a maximum number of attempts so it doesn't loop forever
+ - Keep a kill switch accessible so you can stop it anytime
+
+2. **Agent orchestration frameworks**
+ - The community is testing tools that make this easier: frameworks where you define agent roles and the system handles coordination. Each agent has its own instructions, its own memory, its own skills. The orchestrator assigns work and reviews results.
+
+3. **Agent-to-agent communication**
+ - Agents talk to each other through shared files. One agent writes a task list, another picks up items, does the work, and marks them done. They coordinate through your project folder and git branches, like coworkers using a shared task board.
+
+4. **Always-on assistants**
+ - OpenClaw: an open source framework that runs Claude as a persistent assistant you can message via WhatsApp or Telegram. You text it like a colleague. It's always available, always has your context.
+
+**Community tip:** Level 10 is experimental. The community is actively building and testing these patterns. Things break. The value is in the learning. Very few people are here, and those who are spend significant time managing the systems. This is not "set and forget." This is "build, monitor, iterate."
+
+---
+
+## Generate Dashboard
+
+After completing Phase 1 (assessment) and Phase 2 (roadmap), ALWAYS generate an HTML dashboard and open it in the browser. This is not optional. Every `/level-up` run ends with a visual dashboard.
+
+### Instructions
+
+1. Build a single self-contained HTML file using the template below
+2. Replace ALL placeholder tokens with actual assessment data
+3. Write it to `~/Desktop/level-up-results.html`
+4. Open it in the browser (platform-aware: `open` on macOS, `xdg-open` on Linux, `start` on Windows/WSL)
+5. Tell the user it's open and print the file path
+
+### Placeholder Tokens
+
+Replace these in the HTML template with real values from your assessment:
+
+- `{{LEVEL_NUMBER}}` — The assessed level (0-10)
+- `{{LEVEL_NAME}}` — The level name (e.g. "Browser Commander")
+- `{{SUMMARY_TEXT}}` — The "short version" paragraph from Step 1.4
+- `{{CAPABILITY_CARDS}}` — HTML for each detected capability (see card format below)
+- `{{NEXT_LEVEL_NUMBER}}` — Current level + 1
+- `{{NEXT_LEVEL_NAME}}` — Name of the next level
+- `{{GAP_EXPLANATION}}` — Plain English explanation of what's missing (from Step 1.4)
+- `{{ROADMAP_STEPS}}` — HTML for each roadmap step (see step format below)
+- `{{PROGRESS_DOTS}}` — HTML for the 0-10 progress dots (see dot format below)
+- `{{LEVELS_TABLE_ROWS}}` — HTML rows for the reference table
+
+### Card Format (for {{CAPABILITY_CARDS}})
+
+Generate one card per detected capability. Categories: CLAUDE.md, MCPs, Skills, Memory, Automation, Browser, Workflows, Templates.
+
+```html
+
+```
+
+For missing capabilities (levels above the user), use this variant:
+
+```html
+
+
✗
+
HOOKS
+
No hook configurations found settings.json is empty
+
+```
+
+### Step Format (for {{ROADMAP_STEPS}})
+
+Generate one step per roadmap item from Phase 2:
+
+```html
+
+
1
+
+
Configure hooks
+
Your .claude/settings.json is empty. Hooks let you auto-run things before or after Claude acts. Start with a post-edit hook that auto-formats files.
+
~10 minutes
+
+
+```
+
+If the roadmap step includes a code example, add it inside step-body wrapped in a code-wrapper with a copy button:
+
+```html
+
+
claude -p "/lookout" --output-format json > ~/briefing.md
+
+
+```
+
+### Dot Format (for {{PROGRESS_DOTS}})
+
+Generate 11 dots (0-10). Completed levels get class "done", current level gets "current", future levels get no extra class:
+
+```html
+
0
+
1
+
+
7
+
8
+
+
10
+```
+
+### Levels Table Rows (for {{LEVELS_TABLE_ROWS}})
+
+One row per level. Current level gets class "current-row":
+
+```html
+
+
0
+
Terminal Tourist
+
Just installed it. Typing prompts like ChatGPT in a terminal.
+
+
+
7
+
Browser Commander
+
Browser control, screenshots, PDF generation, scraping workflows.
+
+```
+
+### HTML Template
+
+Write this exact template, replacing all `{{TOKENS}}` with generated content:
+
+```html
+
+
+
+
+
+Level {{LEVEL_NUMBER}} | The 10 Levels of Claude Code
+
+
+
+
+
+
+
The 10 Levels of Claude Code
+
thegenaicircle.com
+
+
+
+
+
Your Level
+
{{LEVEL_NUMBER}}
+
{{LEVEL_NAME}}
+
+
{{SUMMARY_TEXT}}
+
+
+
+ {{PROGRESS_DOTS}}
+
+
+
+
What You Have
+
+ {{CAPABILITY_CARDS}}
+
+
+
+
+
Your Roadmap
+
Level {{NEXT_LEVEL_NUMBER}}: {{NEXT_LEVEL_NAME}}
+
{{GAP_EXPLANATION}}
+
+ {{ROADMAP_STEPS}}
+
+
+
+
+
All 10 Levels
+
+
+
+
Level
+
Name
+
What It Means
+
+
+
+ {{LEVELS_TABLE_ROWS}}
+
+
+
+
+
+
+
+
+
+
+
+```
+
+### After Writing the HTML
+
+1. Write the completed HTML (with all tokens replaced) to `~/Desktop/level-up-results.html`
+2. Open it: run `open ~/Desktop/level-up-results.html` via Bash
+3. Tell the user: "Your level-up dashboard is open in the browser."
+
+---
+
+## Phase 3: Build It Now
+
+**Ask the user:** "Want me to build the first step of your roadmap right now?"
+
+If yes, execute the matching build step below. If no, end with the roadmap summary.
+
+---
+
+### Build: CLAUDE.md Starter (for Level 0)
+
+Create a CLAUDE.md in the current project root using the context questions:
+
+```markdown
+# [Project/Business Name]
+
+## About
+- **Role:** [from Q1 answer]
+- **Main work:** [from Q1 answer]
+- **Key tools:** [detected from environment]
+
+## Communication Style
+- [Infer from conversation]
+- Be direct and actionable
+- Use plain language
+
+## Project Context
+[Based on files and structure detected]
+
+## Output Rules
+- [Address their biggest friction from Q2]
+- Always be specific, not vague
+- Include examples when explaining concepts
+
+## What I Want to Automate
+- [ ] [From Q3 answer]
+```
+
+Adapt this template. Make it specific to the user. Don't use it verbatim.
+
+---
+
+### Build: First MCP Setup (for Level 1)
+
+Based on Q1, recommend and configure their first MCP:
+
+1. Determine the best MCP for their use case
+2. Create or update `.mcp.json`
+3. Walk through authentication
+4. Test with a real query
+
+---
+
+### Build: First Skill (for Level 2)
+
+Based on Q3 (what they'd automate):
+
+1. Create `.claude/commands/` directory
+2. Write a skill .md file for their specific use case
+3. Test it by running the command
+4. Suggest 2-3 more skills they should build next
+
+---
+
+### Build: Memory Architecture (for Level 3-4)
+
+1. Create the `memory/` directory structure
+2. Seed with initial files based on their work
+3. Update CLAUDE.md to reference the memory structure
+4. Show how the feedback loop works
+
+---
+
+### Build: Multi-Phase Skill Upgrade (for Level 4-5)
+
+1. Take their most-used existing skill
+2. Rewrite it with phases, approval gates, and sub-agent calls
+3. Add references to memory/patterns/ for consistency
+4. Test the upgraded version
+
+---
+
+### Build: First Automation Script (for Level 5-6)
+
+1. Create a shell script that calls `claude -p` for a routine task
+2. Test it end-to-end
+3. Show how to schedule with cron or run on demand
+
+---
+
+### Build: Advanced Optimization (for Level 6+)
+
+For power users:
+1. **Context budget audit:** How much context consumed on startup? Optimize.
+2. **Skill architecture review:** Which skills could chain? Build connections.
+3. **Memory file health check:** Stale files? Outdated patterns? Clean up.
+4. **MCP health check:** All configured MCPs actually working? Test each one.
+5. **Pipeline review:** Where could headless mode replace interactive sessions?
+
+---
+
+## Community Wisdom (from GenAI Circle)
+
+**On context windows:**
+Break tasks into smaller chunks. The "auto-compact" (the community calls it "the lobotomy") loses important context. Better to do 5 focused sessions than 1 marathon.
+
+**On getting started:**
+Your CLAUDE.md is 80% of the early value. Spend 30 minutes on it before anything else. Claude can only be as good as the context you give it.
+
+**On MCP management:**
+Fewer is better. Tool search helps manage context (dropped startup from 51% to 13%), but don't load MCPs you don't use daily.
+
+**On replacing SaaS:**
+Track what you're paying for monthly. Try replacing one tool per week. Members have canceled Gamma, Canva Pro, Superhuman, Clay after building equivalent workflows.
+
+**On building your knowledge system:**
+The pattern is Claude Code + MCP + markdown memory files + git. Your system gets smarter with every project. The first month feels slow. By month two, the compounding kicks in.
+
+**On autonomous work:**
+Start supervised. Remove guardrails gradually. The members who trust too fast burn tokens on bad output. The members who never trust miss the productivity multiplier.
+
+**On the levels:**
+There's no shame in being at Level 1. The jump from 1 to 3 takes a weekend. The jump from 3 to 5 takes a few weeks of daily use. Most people find their sweet spot between 4 and 6. Going higher means running infrastructure, and that's only worth it if your work demands it.
+
+---
+
+## After Running This
+
+Come back and run `/level-up` again whenever you're ready for the next step. The assessment updates based on your actual environment.
+
+---
+
+**Version:** 3.0.0
+**Created by the GenAI Circle community** (thegenaicircle.com)
diff --git a/.genie/brainstorm.md b/.genie/brainstorm.md
index 091f344ab..6f1c31af0 100644
--- a/.genie/brainstorm.md
+++ b/.genie/brainstorm.md
@@ -3,6 +3,8 @@
## Simmering
## Ready
## Poured
+- **task-leader-architecture** — Task leader built-in role, --wish flag, autonomous lifecycle → [WISH.md](.genie/wishes/task-leader-architecture/WISH.md)
+- **skill-refresh** — Refresh all 13 skills + orchestration rules rewrite → [WISH.md](.genie/wishes/skill-refresh/WISH.md)
- **deps-bump-readme-rewrite** — Deps bump + README rewrite (cognitive load positioning) → [WISH.md](.genie/wishes/deps-bump-readme-rewrite/WISH.md)
- **report-skill-plugin-rename** — /report skill + plugin rename + debug->trace → [WISH.md](.genie/wishes/report-skill-plugin-rename/WISH.md)
- **genie-default-command** — tui rename + session-per-folder + onboarding hotfix → [WISH.md](.genie/wishes/genie-default-command/WISH.md)
diff --git a/.genie/brainstorms/agent-directory/DESIGN.md b/.genie/brainstorms/agent-directory/DESIGN.md
deleted file mode 100644
index 07f86d585..000000000
--- a/.genie/brainstorms/agent-directory/DESIGN.md
+++ /dev/null
@@ -1,310 +0,0 @@
-# DESIGN: Agent Directory & Multi-Agent Spawn Redesign
-
-> Redesign genie's agent spawn and communication system so that pre-existing agents
-> (each with their own home directory, identity files, and project assignments) can be
-> registered once, spawned in one command, and message each other by name.
-
-## Problem
-
-`genie agent spawn` creates clones of the spawning agent — they inherit the parent's session context and CLAUDE.md rather than loading their own AGENTS.md identity. Cross-agent messaging requires manual `--team` flags. CWD and identity source are conflated via the `-d` flag. This blocks multi-agent workflows where a PM, Engineer, and QA need independent identities while collaborating on the same project.
-
-## Architecture
-
-### Two Registries, Two Lifecycles
-
-```
-┌─────────────────────────────┐ ┌─────────────────────────────┐
-│ Agent Directory │ │ Worker Registry │
-│ ~/.genie/agent-directory │ │ ~/.genie/workers.json │
-│ .json │ │ │
-│ │ │ │
-│ WHO the agent IS │ │ HOW to restart it │
-│ - name │ │ - paneId, session │
-│ - home (AGENTS.md src) │ │ - claudeSessionId │
-│ - project (CWD) │ │ - state, team │
-│ - default team │ │ + templates[] for recovery │
-│ │ │ │
-│ Human-configured │ │ Auto-generated at spawn │
-│ Persistent across reboots │ │ Ephemeral (pane lifecycle) │
-│ Source of truth for ID │ │ Source of truth for state │
-└──────────────┬──────────────┘ └──────────────┬──────────────┘
- │ │
- │ 1. spawn resolves identity │ 3. template saved
- │ 2. CWD + prompt injected │ for auto-respawn
- ▼ ▼
- ┌─────────────────────────────────────────────┐
- │ genie agent spawn │
- │ Reads directory → injects identity → │
- │ launches in tmux → registers worker → │
- │ saves template for recovery │
- └─────────────────────────────────────────────┘
-```
-
-### Key Separations
-
-| Concern | Source | Used At |
-|---------|--------|---------|
-| **Identity** (AGENTS.md) | `--home` directory in agent-directory.json | Spawn time → `--append-system-prompt` |
-| **Workspace** (CWD) | `--project` path in agent-directory.json | Spawn time → tmux pane CWD |
-| **Address** | Agent name in directory | Message routing → flat, no `--team` prefix |
-| **Team** | Optional grouping | Tmux window organization, not required for identity or messaging |
-| **Recovery** | WorkerTemplate in workers.json | Auto-respawn on message to dead agent |
-
-## Scope
-
-### IN
-- Persistent agent directory (`~/.genie/agent-directory.json`)
-- `genie agent register --home --project ` subcommand
-- `genie agent unregister ` subcommand
-- `genie agent directory` subcommand (list all registered agents with status)
-- `genie agent spawn ` resolving from directory (positional arg)
-- Identity injection: read AGENTS.md from `--home`, inject via `--append-system-prompt`
-- CWD/identity separation: pane opens at `--project`, identity from `--home`
-- Flat messaging: `genie send --to ` resolves via directory without `--team`
-- Auto-spawn on message to offline registered agent
-- Backward compat: `genie agent spawn --role implementor` still works unchanged
-
-### OUT
-- Changes to Claude Code's native teammate protocol itself
-- New messaging transport (still mailbox + native inbox)
-- Multi-project per agent (one project at a time per directory entry)
-- Modifying AGENTS.md content (directory is a pointer, not an editor)
-
-## Detailed Design
-
-### 1. New Module: `src/lib/agent-directory.ts`
-
-Persistent JSON registry at `~/.genie/agent-directory.json`.
-
-```typescript
-// Schema
-interface DirectoryEntry {
- name: string; // unique key, e.g., "totvs-pm"
- home: string; // absolute path to agent home (contains AGENTS.md)
- project: string; // absolute path to project repo (CWD at spawn)
- team?: string; // optional default team grouping
- registeredAt: string; // ISO timestamp
-}
-
-interface AgentDirectory {
- entries: Record;
- lastUpdated: string;
-}
-
-// Public API
-register(name, home, project, team?): void // persist entry
-unregister(name): void // remove entry
-resolve(name): DirectoryEntry | null // lookup by name
-list(): DirectoryEntry[] // all entries
-loadIdentity(name): string | null // read AGENTS.md from home
-```
-
-**Storage:** Same `~/.genie/` directory as `workers.json` and `config.json`. Uses the same file-lock pattern from `agent-registry.ts` for concurrent access safety.
-
-**Path validation:** `resolve()` returns the entry as-is (fast). `loadIdentity()` checks if `home/AGENTS.md` exists and returns null if missing. Spawn command fails fast with clear error on missing paths.
-
-### 2. Modified: `src/lib/provider-adapters.ts`
-
-Add `systemPrompt?: string` to `SpawnParams`:
-
-```typescript
-export interface SpawnParams {
- // ... existing fields ...
- /** System prompt content to inject via --append-system-prompt. */
- systemPrompt?: string;
-}
-```
-
-In `buildClaudeCommand()`: if `systemPrompt` is provided, persist to file via the existing `persistSystemPrompt()` pattern from `team-lead-command.ts`, then add `--append-system-prompt "$(cat )"`.
-
-**Implementation detail:** Extract `persistSystemPrompt()` from `team-lead-command.ts` into a shared utility (or just import it). The file goes to `~/.genie/prompts/.md`. The existing `promptMode` config (`'append'` vs `'system'`) is respected.
-
-### 3. Modified: `src/term-commands/agents.ts` — spawn command
-
-Change the spawn command signature from:
-
-```
-genie agent spawn --role [--team ] [--cwd ] ...
-```
-
-To:
-
-```
-genie agent spawn [name] --role [--team ] [--cwd ] ...
-```
-
-Resolution logic in `handleWorkerSpawn()`:
-
-```
-1. If positional `name` provided:
- a. Resolve from agent directory
- b. If not found → error: "Agent '' not registered. Run: genie agent register ..."
- c. Set CWD = entry.project (override --cwd if not explicitly provided)
- d. Load AGENTS.md from entry.home → set systemPrompt on SpawnParams
- e. Set GENIE_AGENT_NAME = name (via env in launch command)
- f. Use entry.team as default team (if --team not explicit)
- g. Use name as the role for native team registration
-
-2. If no positional name (--role provided):
- a. Existing behavior, unchanged
- b. No directory lookup
-```
-
-**Backward compat:** `--role` becomes optional (was `.requiredOption`). Validation: either positional `name` or `--role` must be provided, error otherwise.
-
-### 4. New Subcommands in `agents.ts`
-
-```
-genie agent register --home --project [--team ]
-genie agent unregister
-genie agent directory [--json]
-```
-
-**register:** Validates both paths exist on disk. Writes to `agent-directory.json`.
-
-**unregister:** Removes entry. Does not affect running workers or templates.
-
-**directory:** Lists all registered agents with runtime state enrichment:
-
-```
-NAME HOME PROJECT STATUS TEAM
-totvs-pm ~/.../totvs-pm ~/.../projects/totvs-poc idle recon
-totvs-engineer ~/.../totvs-recon-engineer ~/.../projects/totvs-poc working recon
-totvs-qa ~/.../totvs-qa ~/.../projects/totvs-poc stopped —
-```
-
-STATUS is derived by cross-referencing the worker registry: if a worker with matching name/role exists and its pane is alive → show its state. Otherwise → "stopped".
-
-### 5. Modified: `src/lib/protocol-router.ts` — sendMessage()
-
-Add directory-aware resolution as the **first** lookup tier in `sendMessage()`:
-
-```
-Current: resolveRecipient(to) → workers by ID > role > team:role
-New: directoryResolve(to) → agent directory by name
- ↓ (if found + alive)
- deliver directly
- ↓ (if found + not alive)
- auto-spawn from directory entry → deliver
- ↓ (if not found in directory)
- resolveRecipient(to) → existing worker registry resolution
-```
-
-**Auto-spawn from directory:** When a directory agent isn't running, the router:
-1. Calls `agentDirectory.resolve(to)` → gets home + project
-2. Calls `agentDirectory.loadIdentity(to)` → gets AGENTS.md content
-3. Spawns using the same `spawnWorkerFromTemplate` pattern but with directory-derived params
-4. Waits for ready, delivers message
-
-**Collision handling:** If an agent name in the directory matches a worker ID from a different context, directory wins. A debug-level warning is logged.
-
-### 6. Modified: `src/hooks/handlers/auto-spawn.ts`
-
-The hook also needs directory awareness for the case where Claude Code's SendMessage fires before the protocol router handles it:
-
-```
-Current: check worker registry → check templates → spawn from template
-New: check worker registry → check agent directory → check templates
-```
-
-If the directory has the recipient, spawn using directory identity (same as protocol-router path). This keeps the hook and router consistent.
-
-### 7. Identity Injection Flow (end-to-end)
-
-```
-1. Human runs: genie agent register totvs-pm \
- --home /home/genie/agents/namastexlabs/totvs-pm \
- --project /home/genie/agents/namastexlabs/projects/totvs-poc
-
-2. Human (or another agent) runs: genie agent spawn totvs-pm
-
-3. handleWorkerSpawn():
- a. directory.resolve("totvs-pm") → { home: "/...totvs-pm", project: "/...totvs-poc" }
- b. directory.loadIdentity("totvs-pm") → reads /...totvs-pm/AGENTS.md → string content
- c. persistSystemPrompt("totvs-pm", content) → writes ~/.genie/prompts/totvs-pm.md
- d. SpawnParams.systemPrompt = content
- e. buildClaudeCommand() adds: --append-system-prompt "$(cat ~/.genie/prompts/totvs-pm.md)"
- f. Launch env includes: GENIE_AGENT_NAME=totvs-pm
- g. tmux pane CWD = /...totvs-poc
-
-4. Agent starts with:
- - Its own AGENTS.md as system prompt (independent identity)
- - CWD in the project repo (not its home directory)
- - GENIE_AGENT_NAME set (identity-inject hook tags outgoing messages)
-
-5. PM sends to engineer: genie send 'assess filter extension' --to totvs-engineer
- a. protocol-router.sendMessage() → directoryResolve("totvs-engineer")
- b. If alive → deliver
- c. If not alive → auto-spawn from directory → deliver
- d. No --team flag needed
-```
-
-## Risks
-
-| ID | Risk | Severity | Mitigation |
-|----|------|----------|------------|
-| R1 | **Dual resolution ambiguity** — directory name collides with worker ID/role from different team | Medium | Directory wins on exact name match. Log warning on collision. |
-| R2 | **Stale directory entries** — agent home moved/deleted, spawn fails | Low | `loadIdentity()` returns null on missing AGENTS.md. Spawn fails fast with clear error. `genie agent directory` validates paths and shows warnings. |
-| R3 | **`--append-system-prompt` size limits** — large AGENTS.md files | Low | Reuse `persistSystemPrompt()` file-persist + `$(cat)` pattern from `team-lead-command.ts`. Already battle-tested. |
-| R4 | **Auto-spawn race** — hook and router both try to spawn | Medium | Both paths check `isPaneAlive()` before spawning. `cleanupDeadWorkers()` runs before spawn. Same guards that prevent double-spawn today. |
-| R5 | **`--role` required → optional** — could break scripts | Low | Validation: require either positional `name` OR `--role`. Error message guides users. Existing `--role` invocations are unaffected. |
-
-## Acceptance Criteria
-
-1. **Register + resolve:** `genie agent register totvs-pm --home /path --project /path` persists to `~/.genie/agent-directory.json`. `genie agent directory` lists it.
-2. **Spawn by name:** `genie agent spawn totvs-pm` sets CWD to project, injects AGENTS.md from home via `--append-system-prompt`, sets `GENIE_AGENT_NAME=totvs-pm`.
-3. **Independent identity:** Two directory agents spawned into the same project have different AGENTS.md injected. Verified by differing `~/.genie/prompts/.md`.
-4. **Flat messaging:** `genie send 'hello' --to totvs-engineer` delivers without `--team`, resolving via directory.
-5. **Auto-spawn + deliver:** Sending to an offline directory agent triggers spawn then delivery.
-6. **Template auto-creation:** Spawning a directory agent saves a `WorkerTemplate` for crash recovery.
-7. **Backward compat:** `genie agent spawn --role implementor --team myteam` works unchanged.
-8. **Path validation:** Spawn fails fast with clear error if home or project path doesn't exist.
-9. **Unregister:** `genie agent unregister totvs-pm` removes from directory without affecting running workers.
-
-## Implementation Groups
-
-### Group 1: Foundation (no behavioral changes)
-- [ ] Create `src/lib/agent-directory.ts` with register/unregister/resolve/list/loadIdentity
-- [ ] Extract `persistSystemPrompt()` from `team-lead-command.ts` into shared util
-- [ ] Add `systemPrompt?: string` to `SpawnParams` in `provider-adapters.ts`
-- [ ] Wire `systemPrompt` into `buildClaudeCommand()` using persist+cat pattern
-
-### Group 2: Spawn Integration
-- [ ] Add `register`, `unregister`, `directory` subcommands to `agents.ts`
-- [ ] Add optional `[name]` positional to `spawn` command
-- [ ] Make `--role` conditionally required (required if no positional name)
-- [ ] Wire directory resolution into `handleWorkerSpawn()`
-- [ ] Set `GENIE_AGENT_NAME` and CWD from directory entry at spawn
-
-### Group 3: Messaging Integration
-- [ ] Add directory-aware first-pass resolution in `protocol-router.ts:sendMessage()`
-- [ ] Add directory lookup in `auto-spawn.ts` hook (before template fallback)
-- [ ] Implement auto-spawn-from-directory in protocol router for offline agents
-- [ ] Verify `identity-inject.ts` works with directory-spawned agents (uses GENIE_AGENT_NAME — should work as-is)
-
-### Group 4: Polish + Validation
-- [ ] `genie agent directory` shows runtime state by cross-referencing worker registry
-- [ ] Path validation warnings in directory listing
-- [ ] Tests for agent-directory.ts (register, resolve, loadIdentity)
-- [ ] Tests for directory-aware spawn (mock directory, verify systemPrompt injection)
-- [ ] Integration test: register → spawn → send message → verify delivery
-
-## Files Changed
-
-| File | Change Type | Description |
-|------|------------|-------------|
-| `src/lib/agent-directory.ts` | **New** | Persistent agent directory module |
-| `src/lib/provider-adapters.ts` | Modified | Add `systemPrompt` to SpawnParams, wire into buildClaudeCommand |
-| `src/lib/team-lead-command.ts` | Modified | Extract `persistSystemPrompt` to shared location |
-| `src/term-commands/agents.ts` | Modified | Add register/unregister/directory subcommands, optional positional spawn |
-| `src/lib/protocol-router.ts` | Modified | Directory-first resolution in sendMessage |
-| `src/hooks/handlers/auto-spawn.ts` | Modified | Directory lookup before template fallback |
-| `src/types/genie-config.ts` | Unchanged | No config schema changes needed |
-
-## Non-Goals (Explicit)
-
-- No changes to Claude Code's native teammate protocol
-- No new messaging transport
-- No multi-project support per agent
-- No auto-discovery of agent directories (explicit registration only)
-- No modifications to AGENTS.md content from genie
diff --git a/.genie/brainstorms/agent-directory/DRAFT.md b/.genie/brainstorms/agent-directory/DRAFT.md
deleted file mode 100644
index bd35763c1..000000000
--- a/.genie/brainstorms/agent-directory/DRAFT.md
+++ /dev/null
@@ -1,628 +0,0 @@
-# Genie CLI v2 — Complete Framework Redesign
-
-**Status:** Ready
-**WRS:** 100/100
-
-## Problem
-The genie CLI has accumulated 40+ commands with overlapping functionality, inconsistent naming, and poor DX. Agent spawning creates clones instead of independent agents. Cross-agent messaging requires manual `--team` flags. Task state tracking (beads) is heavyweight and unreliable. Skill prompts don't align with the orchestration model. The entire framework needs a clean-break redesign.
-
----
-
-## Architecture Decisions (all confirmed)
-
-### 1. Native `--system-prompt-file` / `--append-system-prompt-file`
-Claude Code hidden flags, confirmed working. Eliminates `persistSystemPrompt()`, `$(cat)` pattern, all temp files. Genie passes the file path directly to Claude Code at spawn time.
-
-### 2. One Folder Per Agent
-Each agent has ONE folder. That folder is where Claude Code starts (CWD) and contains `AGENTS.md` (identity). May or may not have git — irrelevant to agent identity.
-
-### 3. Repo is Team-Level
-- Agent directory entries CAN have an optional `repo` for solo use
-- When agent is in a team, the team's `repo` overrides the agent's individual repo
-- All team members work in the same repo/worktree
-- Hierarchy: team repo > agent repo > agent dir (fallback CWD)
-
-### 4. Per-Agent Prompt Mode
-Directory entry stores `system` or `append`:
-- **PMs, non-coders:** `system` — replace Claude's default coding prompt entirely
-- **Engineers:** `append` — keep Claude's coding capabilities + add agent identity
-- Determines whether `--system-prompt-file` or `--append-system-prompt-file` is used at spawn
-
-### 5. Per-Agent Model Default
-Directory entry stores optional `model` (e.g., `sonnet`, `opus`, `codex`). Can be overridden at spawn time with `--model`.
-
-### 6. Optional Roles Declaration
-Directory entry stores optional `roles[]` — built-in roles the agent can orchestrate (e.g., `implementor`, `tester`, `debugger`). Helps the agent self-organize without PM spelling it out. Dynamic orchestration still takes priority — having roles declared doesn't force anything.
-
-### 7. No Backward Compatibility
-Clean break. All old patterns replaced.
-
-### 8. Agent Names Globally Unique
-Flat routing by name. No `--team` needed for messaging.
-
-### 9. Agents Can Be in Multiple Teams
-Same agent hired into different teams, working on different tasks simultaneously.
-
-### 10. Send Scoped to Own Team
-Team leader can only message members of their own team (prevents cross-talk).
-
----
-
-## Agents vs Roles
-
-**Agents** and **Roles** are separate concepts:
-
-- **Agents** = registered entities with identity (totvs-engineer, totvs-pm). Persistent. Have AGENTS.md, memory, personality. Registered in user directory.
-- **Roles** = built-in capabilities (implementor, tester, reviewer, debugger...). Ephemeral. Spawned on demand. No identity, no memory. Ship with genie package.
-- **Orchestration** = who bosses whom. Decided dynamically at runtime by whoever is leading. Not statically configured.
-
-### Hierarchy Examples
-
-**Complex project (dedicated agents):**
-```
-totvs-pm (agent)
- └─ totvs-engineer (agent, roles: [implementor, tester, debugger])
- └─ spawns implementor/tester/debugger roles as needed
- └─ totvs-qa (agent, roles: [reviewer, verifier, security])
- └─ spawns reviewer/verifier roles as needed
-```
-
-**Simple project (no dedicated agents):**
-```
-PM (agent)
- └─ implementor (built-in role, spawned directly)
- └─ reviewer (built-in role, spawned directly)
-```
-
-### Built-in Roles (ship with genie)
-
-| Role | Description |
-|---|---|
-| `implementor` | Implements features and fixes bugs |
-| `tester` | Writes and runs tests |
-| `reviewer` | Reviews code and provides feedback |
-| `debugger` | Diagnoses and fixes bugs |
-| `verifier` | Verifies fixes and writes regression tests |
-| `investigator` | Investigates root causes |
-| `reproducer` | Creates minimal reproductions |
-| `dreamer` | Generates ideas and explores possibilities |
-| `critic` | Evaluates and refines ideas |
-| `security` | Security-focused review |
-
-### Built-in Council Members (ship with genie)
-
-| Member | Lens | Default Model |
-|---|---|---|
-| `council-questioner` | Challenge assumptions | sonnet |
-| `council-benchmarker` | Performance evidence | sonnet |
-| `council-simplifier` | Complexity reduction | sonnet |
-| `council-sentinel` | Security oversight | opus |
-| `council-ergonomist` | Developer experience | sonnet |
-| `council-architect` | Systems thinking | opus |
-| `council-operator` | Operations reality | sonnet |
-| `council-deployer` | Zero-config deployment | sonnet |
-| `council-measurer` | Observability | sonnet |
-| `council-tracer` | Production debugging | sonnet |
-
-Council is hired as a group: `genie team hire council` (all or none).
-
-### Resolution Order
-```
-User directory (genie dir add) > Built-in agents (ships with package)
-```
-User can override a built-in by registering the same name.
-
----
-
-## Session & Team Flow
-
-### Default Session (no args)
-```bash
-genie
-# Opens persistent session in current dir
-# For quick questions, ongoing conversation
-# No team, no worktree
-```
-
-### Named Session
-```bash
-genie --session
-# Start or resume a named leader session
-# Claude Code session naming used by default (not UUIDs)
-```
-
-### Team-Based Work
-```bash
-genie team create fix/auth-bug --repo ~/repos/genie --branch dev
-# 1. Reads worktreeBase from ~/.genie/config.json (default: '.worktrees')
-# 2. git -C ~/repos/genie pull origin dev
-# 3. git -C ~/repos/genie worktree add /fix/auth-bug -b fix/auth-bug dev
-# 4. Team leader session starts in /fix/auth-bug/
-# 5. All hired agents work in /fix/auth-bug/
-```
-
-### Team Name = Branch Name
-Following conventional git prefixes. No separate `--prefix` flag:
-```bash
-genie team create feat/agent-directory --repo ~/repos/genie --branch dev
-genie team create fix/auth-bug --repo ~/repos/genie --branch dev
-genie team create chore/cleanup --repo ~/repos/genie --branch dev
-```
-
----
-
-## Shared Worktree as Context Layer
-
-All context files live in the team's worktree `.genie/` folder. No commits needed for sharing — all agents read/write from the same filesystem.
-
-```
-/fix/auth-bug/
-├── .genie/
-│ ├── brainstorms/auth-bug/DRAFT.md # shared brainstorm draft
-│ ├── brainstorms/auth-bug/DESIGN.md # crystallized design
-│ ├── wishes/auth-bug.md # shared wish
-│ └── state/auth-bug.json # task state (genie-managed)
-├── src/
-└── ...
-```
-
----
-
-## State Machine (replaces beads)
-
-**Core principle: agents never touch the state file. Genie is the state machine.**
-
-### State File: `.genie/state/.json`
-
-```json
-{
- "wish": "auth-bug",
- "groups": {
- "1": {
- "status": "done",
- "assignee": "totvs-engineer",
- "startedAt": "2026-03-13T14:00:00Z",
- "completedAt": "2026-03-13T14:30:00Z"
- },
- "2": {
- "status": "in_progress",
- "assignee": "totvs-engineer",
- "startedAt": "2026-03-13T14:35:00Z"
- },
- "3": {
- "status": "blocked",
- "dependsOn": [2]
- }
- }
-}
-```
-
-### State Transition Rules
-1. Only `genie work` sets `in_progress` (at dispatch time, BEFORE spawn)
-2. Only `genie done` sets `done` (explicit signal, run by leader or agent)
-3. Only genie reads the state file to enforce ordering
-4. Hooks validate: can't dispatch group N+1 until group N is `done`
-5. Agents never import, read, or write the state file directly
-6. Orchestrator (team leader) keeps track of guarantees at prompt level
-
-### Failure Modes
-| Failure | What Happens |
-|---|---|
-| Agent crashes mid-work | Group stays `in_progress`. Leader sees it, re-dispatches |
-| Agent finishes but nobody runs `done` | Group stays `in_progress`. Leader follows up |
-| Someone tries to start group 3 early | Genie refuses: "group 2 is not done" |
-| Leader forgets where they left off | `genie status ` shows all group states |
-
----
-
-## Dispatch Commands (lifecycle)
-
-Four dispatch commands mirror the skill lifecycle. Each one: resolves context → manages state → spawns agent with rich context injection.
-
-### Context Injection Pattern
-All dispatch commands inject:
-1. **File path** to the full document (wish, brainstorm, etc.) — agent can read the whole thing
-2. **Extracted section** content — the specific group/section being worked on
-3. **Wish-level context** — problem statement, scope, decisions (the WHY)
-
-### `genie brainstorm `
-- Reads `.genie/brainstorms//DRAFT.md` from shared worktree
-- Spawns agent with draft content + file path as context
-- Agent enters `/brainstorm` with full seed
-- **Multi-agent:** multiple agents can brainstorm the same topic. PM kicks off, delegates, reviews
-- Human can participate at any time via messaging
-
-### `genie wish `
-- Reads `.genie/brainstorms//DESIGN.md` from shared worktree
-- Spawns agent with design as context + file path
-- Agent enters `/wish` with crystallized design
-- **Collaborative:** PM and agent go back-and-forth on wish quality
-- Creates state file with group definitions and dependency graph
-
-### `genie work #`
-- Reads `.genie/wishes/.md` — passes file path for full context
-- Extracts specific group content (tasks, acceptance criteria)
-- Checks state: are dependencies met? → refuses if not
-- Sets group to `in_progress` in state file BEFORE spawn
-- Spawns agent with group context + wish file path
-- Agent enters `/work` ready to execute
-
-### `genie review #`
-- Reads wish group + PR/diff context
-- Spawns agent with review scope + file path
-- Agent enters `/review` with criteria to validate against
-- Council can participate (via team chat)
-
-### `genie done #`
-- Sets group to `done` in state file
-- Unblocks dependent groups
-
-### `genie status `
-- Shows all groups with current state, assignees, timestamps
-
----
-
-## Command Tree v2 (complete)
-
-### Entry Point
-```
-genie # Persistent session in current dir
-genie --session # Named/resumed leader session
-```
-
-### Dispatch (lifecycle — team leader orchestration)
-```
-genie brainstorm # Spawn + inject brainstorm context
-genie wish # Spawn + inject design for wish creation
-genie work # # Check deps → in_progress → spawn with context
-genie review # # Spawn + inject review scope
-genie done # # Mark group done, unblock dependents
-genie status # Show wish group states
-```
-
-### Agent Lifecycle (top-level verbs)
-```
-genie spawn # Spawn registered agent or built-in role
-genie kill # Force kill agent
-genie stop # Stop current run, keep pane alive
-genie ls # List agents, teams, state
-genie history # Compressed session timeline
-genie read # Tail agent pane output
-genie answer # Answer agent prompt (menu nav / text)
-```
-
-### Messaging (flat routing by name)
-```
-genie send '' --to # Direct message (scoped to own team)
-genie broadcast '' # Leader → all team members (one-way)
-genie chat '' [--team ] # Team group channel (interactive)
-genie chat read [--team ] # Read team channel history
-genie inbox [] [--unread] # View inbox
-```
-
-### Directory (agent registry)
-```
-genie dir add # Add agent to directory
- --dir # Agent folder (CWD + AGENTS.md)
- [--repo ] # Default git repo (overridden by team)
- [--prompt-mode append|system] # Default: append
- [--model ] # Default model
- [--roles ] # Built-in roles this agent can orchestrate
-genie dir rm # Remove from directory
-genie dir ls [] # List all or show single entry
-genie dir edit # Update entry fields
- [--dir ]
- [--repo ]
- [--prompt-mode append|system]
- [--model ]
- [--roles ]
-```
-
-### Team (dynamic collaboration)
-```
-genie team create # Form team + worktree (idempotent)
- --repo # Git repo (required)
- [--branch ] # Base branch (default: dev)
-genie team hire # Add agent (auto-detects team from leader)
- [--team ]
-genie team hire council # Hire all 10 council members
-genie team fire # Remove agent
- [--team ]
-genie team ls [] # List teams or team members
-genie team disband # Kill members, cleanup worktree
-```
-
-### Infrastructure
-```
-genie setup # Install (review with install.sh base)
-genie doctor # Diagnostics (review dep coverage)
-genie shortcuts show|install|uninstall # tmux keyboard shortcuts
-```
-
----
-
-## Complete Command Fate Map
-
-### PROMOTED TO TOP-LEVEL
-| Old | New |
-|---|---|
-| `genie agent spawn --role` | `genie spawn ` |
-| `genie agent list` | `genie ls` |
-| `genie agent kill ` | `genie kill ` |
-| `genie agent suspend ` | `genie stop ` |
-| `genie agent history ` | `genie history ` |
-| `genie agent answer ` | `genie answer ` |
-| `genie agent read ` | `genie read ` |
-| `genie agent close + ship` | `genie done #` |
-| `genie send` | `genie send` (flat routing) |
-| `genie inbox` | `genie inbox` |
-
-### NEW COMMANDS
-| Command | Purpose |
-|---|---|
-| `genie --session ` | Named leader sessions |
-| `genie brainstorm ` | Multi-agent brainstorm dispatch |
-| `genie wish ` | Collaborative wish creation dispatch |
-| `genie work #` | State-managed work dispatch |
-| `genie review #` | Review dispatch |
-| `genie done #` | Explicit completion signal |
-| `genie status ` | Wish state overview |
-| `genie broadcast ''` | Leader → all members |
-| `genie chat` / `genie chat read` | Team group channel |
-| `genie team hire/fire` | Dynamic membership |
-| `genie team hire council` | Group hire all council members |
-| `genie dir add/rm/ls/edit` | Agent directory CRUD |
-
-### DROPPED
-| Command | Reason |
-|---|---|
-| `genie agent dashboard` | Never used |
-| `genie agent watchdog` | Never used |
-| `genie agent approve` | Future sprint |
-| `genie agent exec` | Use tmux directly |
-| `genie agent ship` | Merged into `genie done` |
-| `genie agent events` | Internal only, not a user command |
-| `genie _open [team]` | Incorporated into session flow |
-| `genie team ensure` | Absorbed by `team create` |
-| `genie team blueprints` | Dropped |
-| `genie profiles *` (5 commands) | Replaced by directory |
-| `genie daemon *` (4 commands) | Beads removed |
-| `genie ledger *` (2 commands) | Beads removed |
-| `genie brainstorm crystallize` | Beads integration, broken |
-| `genie work ` (old) | Replaced by dispatch commands |
-| `genie task *` (10 commands) | Replaced by state machine. Issue opened to monitor if sub-group granularity (option C) needed later |
-| `genie council` (old command) | Replaced by `genie team hire council` + skill |
-
----
-
-## Skill Prompt Review
-
-### Skills Needing `/refine` Pass
-
-All skills that dispatch subagents or interact with the orchestration model need updating:
-
-| Skill | Key Changes |
-|---|---|
-| **brainstorm** | Multi-agent aware. Reads/writes in shared worktree. Acknowledges injected context from dispatch. Multiple agents can edit same DRAFT.md |
-| **wish** | Collaborative. Creates state file with group definitions + dependency graph. Reads design from shared worktree. Back-and-forth via messaging |
-| **work** | Does NOT manage state (no checkboxes, no `bd close`). Receives group context from dispatch. Signals completion to leader via message. Uses `genie spawn` for subagent dispatch |
-| **review** | Receives scope from dispatch. Council can participate via team chat. Uses `genie spawn` for dispatch. Posts findings to team chat |
-| **fix** | Uses `genie spawn` for fixer/reviewer dispatch. Max 2 loops unchanged |
-| **dream** | Uses new team/worktree model. Creates teams per wish. Uses `genie work` for dispatch. State machine for tracking |
-| **council** | Two modes: (1) Lightweight = same as today, simulated in one session. (2) Full spawn = `genie team hire council`, real agents discuss in team chat, leader makes final call |
-| **trace** | Uses `genie spawn` for dispatch. Hands off to `/fix` unchanged |
-| **onboarding** | Update for new directory model (`genie dir add`), new team model, new session naming |
-| **docs** | Uses `genie spawn` for dispatch |
-
-### Skills Unchanged
-| Skill | Reason |
-|---|---|
-| **report** | Independent of orchestration. Uses `/trace` internally |
-| **brain** | Independent. Knowledge vault via notesmd-cli |
-| **refine** | Independent. Prompt optimizer, no dispatch |
-| **learn** | Independent. Behavioral config only |
-
-### Cross-Cutting Changes (all refined skills)
-1. **Dispatch method:** `genie spawn ` replaces `Task tool` / `genie agent spawn --role`
-2. **File paths:** `.genie/` in shared worktree, not repo root
-3. **State management:** `/work` no longer manages state — transitions happen via `genie work`/`genie done`
-4. **Context injection:** Skills acknowledge injected context (file path + extracted section) from dispatch commands
-5. **Role separation preserved:** Never combine implementor+reviewer, fixer+reviewer, tracer+fixer in same session
-
----
-
-## Schemas
-
-### Agent Directory Entry
-```typescript
-interface DirectoryEntry {
- name: string; // globally unique
- dir: string; // agent folder (CWD + AGENTS.md)
- repo?: string; // default git repo (overridden by team)
- promptMode: 'system' | 'append';
- model?: string; // default model (sonnet, opus, codex)
- roles?: string[]; // built-in roles this agent can orchestrate
- registeredAt: string;
-}
-```
-
-### Team
-```typescript
-interface Team {
- name: string; // = branch name (e.g., "fix/auth-bug")
- repo: string; // git repo path (required)
- baseBranch: string; // branch to create worktree from (default: "dev")
- worktreePath: string; // /
- leader: string; // leader's session reference
- members: string[]; // agent names (directory or built-in)
- createdAt: string;
-}
-```
-
-### Wish State
-```typescript
-interface WishState {
- wish: string; // slug
- groups: Record;
-}
-
-interface GroupState {
- status: 'blocked' | 'ready' | 'in_progress' | 'done';
- assignee?: string; // agent name
- dependsOn?: number[]; // group numbers
- startedAt?: string;
- completedAt?: string;
-}
-```
-
-### Genie Config (relevant additions)
-```typescript
-// In ~/.genie/config.json
-{
- terminal: {
- worktreeBase: string; // default: '.worktrees'
- }
-}
-```
-
----
-
-## Naming Conventions
-| Pattern | Convention |
-|---|---|
-| List anything | `ls` |
-| Remove anything | `rm` |
-| Add anything | `add` |
-| Create group entity | `create` |
-| Destroy group entity | `disband` |
-| Add member | `hire` |
-| Remove member | `fire` |
-
----
-
-## Risks
-
-| ID | Risk | Severity | Mitigation |
-|----|------|----------|------------|
-| R1 | **State file abandonment** — agents don't run `genie done`, groups stay `in_progress` forever | High | State transitions are genie commands, not agent behavior. Orchestrator tracks at prompt level. Leader follows up on stale `in_progress` |
-| R2 | **Concurrent worktree edits** — multiple agents editing same files in shared worktree | Medium | Git handles file-level conflicts. Wish groups should be scoped to non-overlapping files. Review catches integration issues |
-| R3 | **Built-in vs directory collision** — user registers agent with same name as built-in | Low | User directory wins (explicit override). Clear resolution order documented |
-| R4 | **Multi-team agent confusion** — agent in 3 teams, receives message, which context? | Medium | Send is scoped to own team. Agent receives team context with each dispatch. Genie tracks which team each session belongs to |
-| R5 | **`--system-prompt-file` undocumented** — hidden Claude Code flag could change/break | Medium | Test in CI. Flag confirmed working today. If removed, fall back to `--system-prompt "$(cat)"` pattern |
-| R6 | **Skill prompt drift** — 10 skills need `/refine` pass, high effort | Medium | Prioritize core chain (brainstorm→wish→work→review). Others can be refined incrementally |
-| R7 | **Council as real agents** — 10 agents spawned = 10 Claude sessions = cost | Low | Leader chooses subset (smart routing). Full council is rare. Lightweight mode (skill) exists for cheap reviews |
-
----
-
-## Acceptance Criteria
-
-### AC1: Agent Directory
-- `genie dir add totvs-pm --dir ~/agents/pm --prompt-mode system` persists entry
-- `genie dir ls` shows all registered agents
-- `genie dir ls totvs-pm` shows single entry details
-- `genie dir rm totvs-pm` removes entry
-- `genie dir edit totvs-pm --model opus` updates entry
-- Directory entry supports: name, dir, repo, promptMode, model, roles
-
-### AC2: Spawn from Directory
-- `genie spawn totvs-pm` resolves from directory, sets CWD to `dir`, injects AGENTS.md via `--[append-]system-prompt-file`
-- Prompt mode from directory entry determines which flag is used
-- Model from directory entry (or `--model` override) is passed to Claude Code
-- Spawning a built-in role works without directory registration: `genie spawn implementor`
-- Agent spawned outside team context → CWD = agent dir
-- Agent spawned in team context → CWD = team worktree
-
-### AC3: Team Lifecycle
-- `genie team create feat/my-feature --repo ~/repos/genie --branch dev` creates worktree at `/feat/my-feature`, branch `feat/my-feature` from `dev`
-- `genie team create` is idempotent (re-running doesn't fail)
-- `genie team hire totvs-engineer` adds to team (auto-detects team from leader context)
-- `genie team hire council` hires all 10 council members
-- `genie team fire totvs-engineer` removes from team
-- `genie team ls` lists all teams. `genie team ls feat/my-feature` lists members
-- `genie team disband feat/my-feature` kills all members, cleans up worktree
-
-### AC4: State Machine
-- `genie work totvs-engineer auth-bug#2` checks dependencies → sets group 2 to `in_progress` → spawns agent with context
-- `genie work` refuses if dependencies not met ("group 1 is not done")
-- `genie done auth-bug#2` sets group to `done`, unblocks dependents
-- `genie status auth-bug` shows all groups with status, assignee, timestamps
-- State file lives at `.genie/state/.json` in shared worktree
-- Agents never read or write the state file directly
-
-### AC5: Dispatch Commands
-- `genie brainstorm ` spawns with DRAFT.md path + content injected
-- `genie wish ` spawns with DESIGN.md path + content injected
-- `genie work #` extracts group content, injects with wish file path
-- `genie review #` injects group + PR/diff context
-- All dispatch commands pass the file path so agent can read the full document
-
-### AC6: Messaging
-- `genie send 'msg' --to totvs-engineer` delivers without `--team` flag
-- Send is scoped: leader can only message own team members
-- `genie broadcast 'msg'` delivers to all team members (leader only)
-- `genie chat 'msg'` posts to team group channel
-- `genie chat read` shows channel history
-- Message to offline agent triggers auto-spawn + delivery
-
-### AC7: Flat Naming
-- All listing commands use `ls`
-- All remove commands use `rm`
-- All add commands use `add`
-- `genie stop` (not suspend), `genie done` (not close/ship)
-
-### AC8: Skill Prompt Alignment
-- 10 skills updated via `/refine` to use `genie spawn` for dispatch
-- `/work` does NOT manage state — receives context, signals completion via message
-- `/brainstorm` and `/wish` read/write in shared worktree `.genie/`
-- `/council` supports two modes: lightweight (skill) and full spawn (team)
-- All skills acknowledge injected context from dispatch commands
-
-### AC9: Cleanup
-- All 10 `genie task *` commands removed
-- All `genie profiles *` commands removed (replaced by directory)
-- All `genie daemon *` commands removed (beads removed)
-- All `genie ledger *` commands removed (beads removed)
-- `genie agent *` namespace removed (promoted to top-level)
-- `genie team ensure`, `genie team blueprints` removed
-- `genie _open`, `genie agent dashboard/watchdog/approve/exec/ship` removed
-- Issue opened to monitor if sub-group task granularity needed later
-
----
-
-## Decisions Made (complete — 36 decisions)
-1. Native `--system-prompt-file` / `--append-system-prompt-file` ✅
-2. One folder per agent ✅
-3. Repo at team level, optional at agent level, team overrides ✅
-4. Per-agent prompt mode in directory entry ✅
-5. Per-agent default model in directory entry ✅
-6. Optional roles declaration in directory entry ✅
-7. No backward compat ✅
-8. Agent names globally unique ✅
-9. Flat messaging by name, scoped to own team ✅
-10. Agents can be in multiple teams ✅
-11. `suspend` → `stop` ✅
-12. Team = dynamic hire/fire ✅
-13. Team name = branch name (conventional git prefixes) ✅
-14. Worktree base configurable, default `.worktrees` ✅
-15. Broadcast (leader-only) + Chat (group channel) ✅
-16. Auto-spawn on message to offline agent ✅
-17. `close` + `ship` → `done` (state transition) ✅
-18. Profiles replaced by directory ✅
-19. Blueprints dropped ✅
-20. Dashboard, watchdog, approve, exec dropped ✅
-21. `_open` removed, session flow replaces it ✅
-22. `ensure` absorbed into `team create` (idempotent) ✅
-23. Naming: ls/rm/add consistently ✅
-24. Commands promoted to top-level (no `agent` namespace) ✅
-25. `genie` no args = persistent session ✅
-26. Context files live in shared worktree `.genie/` ✅
-27. Beads replaced by wish-native state file ✅
-28. State machine: only genie commands mutate state, agents never touch it ✅
-29. Dispatch commands (brainstorm/wish/work/review) inject context + manage state ✅
-30. Brainstorm/wish are now multi-agent with optional human participation ✅
-31. Skill prompts must be refined to align with new orchestration model ✅
-32. Council: lightweight (skill) + full spawn (team hire) modes ✅
-33. Tasks die completely — wish groups are the only unit of work ✅
-34. Agents ≠ Roles — separate concepts, dynamic orchestration ✅
-35. Built-in roles + council ship with genie package ✅
-36. Council hired as group: `genie team hire council` (all or none) ✅
diff --git a/.genie/brainstorms/deps-bump-readme-rewrite/DESIGN.md b/.genie/brainstorms/deps-bump-readme-rewrite/DESIGN.md
deleted file mode 100644
index 02b0398f7..000000000
--- a/.genie/brainstorms/deps-bump-readme-rewrite/DESIGN.md
+++ /dev/null
@@ -1,121 +0,0 @@
-# Design: Dependency Bump + README Rewrite
-
-## Problem
-
-Genie has the highest engineering-to-visibility ratio in the Claude Code framework space (2,022 commits / 250 stars). The README undersells the product with abstract jargon ("markdown-native agent framework"), first-person voice, insider skill names, and an overwhelming CLI dump. Dependencies are stale with 9 outdated packages (5 major bumps). Both need fixing.
-
-## Scope
-
-### IN
-- Bump all dependencies to latest compatible versions
-- Full README rewrite (~120 lines) with new positioning, structure, and voice
-- Move CLI reference and configuration sections to docs or collapsible sections
-
-### OUT
-- Plugin marketplace listing (separate wish)
-- Comparison pages vs competitors (separate wish)
-- Video/GIF recording (separate wish — needs actual recording)
-- Architecture diagram (separate wish — needs design work)
-- Content strategy / blog posts (separate wish)
-- Cross-platform support documentation (separate wish)
-
-## Decisions
-
-### D1: Positioning angle — Cognitive load reduction
-Genie lowers YOUR cognitive load. It interviews you into clarity during brainstorm, captures comprehensive context, then executes a standardized pipeline with consistent results. The orchestrator preserves its own context window by dispatching scoped specialists.
-
-### D2: Tagline
-**Hero:** "Wishes in, PRs out."
-**Subtitle:** Describe the problem. Genie interviews you, plans the work, dispatches agents, and reviews the code. You approve and ship.
-
-### D3: Voice — Third person, pain-first
-Kill first-person Genie voice. Clear, direct, third-person. Lead with developer pain, not feature names.
-
-### D4: README structure (~120 lines)
-1. Hero image + badges + tagline + subtitle
-2. Quick nav links (Install, Quick Start, Features, Docs, Discord)
-3. "What is Genie?" — 3 sentences max
-4. "Right for you if" — pain-moment checklist (6 items)
-5. 3-step quickstart (install → launch → wish)
-6. Feature grid (3x3 with short descriptions)
-7. "Without Genie / With Genie" pain table (6 rows)
-8. The Wish Pipeline (one-line flow + 5 one-line descriptions)
-9. CLI reference (collapsed ``)
-10. Configuration (collapsed ``)
-11. Development (4 commands)
-12. Community + License + footer
-
-### D5: Security signals
-- npm as primary install path
-- No `--dangerously-skip-permissions` in README examples
-- Prerequisites listed explicitly
-
-### D6: Dependency bump strategy
-| Package | Current | Target | Risk |
-|---------|---------|--------|------|
-| @types/bun | ^1.1.0 | ^1.3.10 | None (patch) |
-| @types/node | ^20.10.5 | ^22.0.0 | Low (type defs only) |
-| esbuild | ^0.27.2 | ^0.27.3 | None (patch) |
-| knip | ^5.85.0 | ^5.86.0 | None (minor) |
-| zod | ^3.22.4 | ^3.25.0 | Low (stay on v3, skip v4 — breaking API) |
-| commander | ^12.1.0 | ^13.0.0 | Medium (check breaking changes, skip v14 initially) |
-| uuid | ^11.1.0 | ^11.1.0 | None (skip v13 — breaking ESM changes) |
-| @inquirer/prompts | ^7.0.0 | ^7.10.0 | None (stay on v7, skip v8 — breaking) |
-| @biomejs/biome | ^1.9.4 | ^1.9.4 | None (skip v2 — config format breaking) |
-| husky | ^9.1.7 | ^9.1.7 | None (already latest v9) |
-| typescript | ^5.3.3 | ^5.8.0 | Low (minor TS features) |
-| @commitlint/* | ^20.4.1 | ^20.4.1 | None (already latest) |
-
-**Strategy:** Bump safe patches/minors. Stay on current majors for zod (v3), commander (v12→v13 only), @inquirer/prompts (v7), biome (v1), uuid (v11). Skip risky major bumps (zod v4, biome v2, uuid v13, inquirer v8, commander v14).
-
-## Risks
-- **R1:** "Wishes" is jargon — mitigated by using plain language in hero, introducing term in body
-- **R2:** Tmux as implementation detail — mitigated by saying "live terminal sessions" not "tmux"
-- **R3:** Commander v13 breaking changes — mitigate with test suite verification
-- **R4:** Feature grid may undersell depth — mitigated by linking to full docs
-
-## Acceptance Criteria
-- [ ] README is under 150 lines (excluding collapsed sections)
-- [ ] No first-person voice
-- [ ] 3-step quickstart (install, launch, try)
-- [ ] Feature grid (3x3 or similar)
-- [ ] "Without/With" pain table (6 rows)
-- [ ] No `--dangerously-skip-permissions` in any example
-- [ ] CLI reference and config in collapsed `` sections
-- [ ] All safe dependency bumps applied
-- [ ] `bun run check` passes after all changes
-- [ ] Prerequisites listed explicitly (macOS/Linux, Bun, Claude Code)
-
-## Content Blocks (pre-written)
-
-### "What is Genie?"
-> Genie is a CLI that turns vague ideas into shipped PRs through a structured pipeline. You describe what you want — Genie interviews you to capture the full context, builds a plan with acceptance criteria, dispatches specialized agents to execute in parallel, and runs automated review before anything reaches your eyes. You make decisions. Genie does everything else.
-
-### "Genie is right for you if"
-- You've re-explained your codebase architecture to Claude Code for the third time this week
-- You have 5+ AI coding tabs open and can't remember which one is doing what
-- You've watched an AI agent spiral for 20 minutes because it lost the original context
-- You want AI to ask *you* the right questions before writing code, not the other way around
-- You want to go to lunch and come back to reviewed PRs, not a stuck terminal
-- You want a repeatable process that works the same whether you're focused or half-asleep
-
-### "Without Genie / With Genie"
-| Without Genie | With Genie |
-|---|---|
-| *"Wait, did I already tell Claude about the auth middleware?"* — Re-explain context every session. | Genie interviews you once during brainstorm. That context flows to every agent automatically. |
-| Copy-paste requirements into Claude, hope it understood, watch it build the wrong thing. | `/wish` captures scope, boundaries, and acceptance criteria before a single line of code. |
-| One Claude Code tab. One task. Alt-tab to check. Alt-tab back. Repeat for 5 tasks. | Parallel agents in live terminal panes. Watch all of them. Or don't — review when they're done. |
-| AI generates code, you eyeball it, you miss a bug, you ship it, you fix it at 2am. | Automated `/review` with severity-tagged gaps. Nothing ships with CRITICAL or HIGH issues. |
-| 45 minutes in, Claude forgets your earlier instructions. Context rot. | Orchestrator dispatches scoped specialists. No single context window accumulates junk. |
-| "Let me set up the prompt, load the files, explain the conventions..." — 10 min before work starts. | `genie work bd-42` — agent inherits project context, conventions, and task scope automatically. |
-
-## Execution Groups
-
-### Group 1: Dependency bump (safe patches/minors + careful majors)
-- Bump @types/bun, @types/node, esbuild, knip, typescript, zod (within v3), commander (to v13)
-- Run `bun run check` after each batch
-- Validate: `bun run check` passes, no type errors, no test failures
-
-### Group 2: README rewrite
-- Write new README.md following the structure in D4 with pre-written content blocks
-- Validate: under 150 lines (excluding collapsed), no first-person, all sections present
diff --git a/.genie/brainstorms/deps-bump-readme-rewrite/DRAFT.md b/.genie/brainstorms/deps-bump-readme-rewrite/DRAFT.md
deleted file mode 100644
index 6d2f8cd82..000000000
--- a/.genie/brainstorms/deps-bump-readme-rewrite/DRAFT.md
+++ /dev/null
@@ -1,65 +0,0 @@
-# Brainstorm: Dependency Bump + README Rewrite
-
-## Topic 1: Dependency Audit
-
-### Current State (bun outdated)
-
-| Package | Current | Latest | Jump |
-|---------|---------|--------|------|
-| @inquirer/prompts | 7.10.1 | 8.3.0 | major |
-| commander | 12.1.0 | 14.0.3 | major |
-| uuid | 11.1.0 | 13.0.0 | major |
-| zod | 3.25.76 | 4.3.6 | major |
-| @biomejs/biome (dev) | 1.9.4 | 2.4.6 | major |
-| @types/bun (dev) | 1.3.8 | 1.3.10 | patch |
-| @types/node (dev) | 20.19.30 | 25.4.0 | major |
-| esbuild (dev) | 0.27.2 | 0.27.3 | patch |
-| knip (dev) | 5.85.0 | 5.86.0 | minor |
-
-### Risk Assessment
-- **@types/bun, esbuild, knip**: Safe patch/minor bumps, no breaking changes
-- **@types/node**: 20→25 is cosmetic (type defs only), low risk
-- **zod 3→4**: Major — need to check schema API changes
-- **commander 12→14**: Major — need to check CLI API changes
-- **uuid 11→13**: Major — need to check if API changed
-- **@inquirer/prompts 7→8**: Major — need to check prompt API
-- **@biomejs/biome 1→2**: Major — lint rules may change, config format may break
-
-## Topic 2: README Rewrite
-
-### What Paperclip Does Well (inspiration analysis)
-1. **Identity-first headline**: "Open-source orchestration for zero-human companies" — immediately answers "what is this?"
-2. **Positioning line**: "If OpenClaw is an employee, Paperclip is the company" — instant mental model
-3. **3-step quickstart table**: Numbered, scannable, no jargon
-4. **"Right for you if" section**: Self-qualifying checklist with checkmarks
-5. **Problem/solution table**: "Without X / With X" — visceral contrast
-6. **"What X is NOT" section**: Sets boundaries, prevents misunderstanding
-7. **Feature grid**: 3x3 table with emoji headers, not a wall of text
-8. **Visual hierarchy**: Center-aligned hero, badges, video, then content
-9. **FAQ section**: Anticipates objections directly
-
-### What Genie's Current README Gets Wrong
-1. **"Markdown-native agent framework"** — too abstract, means nothing to newcomers
-2. **First-person voice** ("I'm a markdown-native agent framework") — cute but unclear
-3. **No positioning against alternatives** — what is this vs Cursor, vs Codex, vs raw Claude?
-4. **Features are skill names** (`/dream`, `/brain`) — insiders-only language
-5. **No "right for you if"** — reader can't self-qualify
-6. **No problem/solution framing** — jumps straight to features
-7. **CLI reference is a giant table dump** — overwhelming
-8. **Missing: architecture diagram, video/gif, "what this is not"**
-9. **Outdated references**: "terminal UI" (renamed to session), some stale commands
-
-### Proposed README Structure (inspired by Paperclip)
-1. Hero image + badges + tagline
-2. One-liner positioning ("If Claude Code is a developer, Genie is the engineering manager")
-3. 3-step quickstart (install → launch → wish)
-4. "What is Genie?" — 3 sentences max
-5. "Genie is right for you if" — checkbox list
-6. Feature grid (3x3 with icons)
-7. The Wish Pipeline (visual flow)
-8. "Without Genie / With Genie" problem table
-9. "What Genie is NOT"
-10. CLI reference (collapsed)
-11. Configuration (collapsed)
-12. Development
-13. Community + License
diff --git a/.genie/brainstorms/genie-default-command/DESIGN.md b/.genie/brainstorms/genie-default-command/DESIGN.md
deleted file mode 100644
index 0dbdf48fa..000000000
--- a/.genie/brainstorms/genie-default-command/DESIGN.md
+++ /dev/null
@@ -1,172 +0,0 @@
-# Design: genie default command + tui rename + --team cleanup + onboarding hotfix
-
-| Field | Value |
-|-------|-------|
-| **Slug** | `genie-default-command` |
-| **Date** | 2026-03-10 |
-| **Status** | Ready for /wish |
-
-## Problem
-
-Four related issues in the genie CLI:
-
-1. **Hotfix (P0):** `/onboarding` skill crashes because `!` + backtick on line 499 of `skills/onboarding/SKILL.md` triggers Claude SDK's executable interpolation regex, passing markdown table content to bash.
-
-2. **Naming debt:** Internal code uses `tui` naming across 14+ files (59 occurrences) despite the user-facing command being just `genie`.
-
-3. **Session-per-folder:** Running `genie` from any directory should auto-create a tmux window named after the folder within a single `"genie"` session, or attach if one exists.
-
-4. **`--team` global shortcut:** The `genie --team ` global routing in `team-shortcut.ts` is dead code. Remove the global shortcut while keeping `--team` on subcommands that need it (`agent spawn`, `send`).
-
-## Architecture
-
-### tmux Session Model
-
-```
-tmux session: "genie" <- single persistent session
- |-- Window 0: "myapp" <- genie run from ~/projects/myapp
- | |-- Pane 0: team-lead
- | |-- Pane 1: agent (spawned)
- | +-- Pane 2: agent (spawned)
- |
- |-- Window 1: "api-server-c7b1" <- genie run from ~/work/api-server (disambiguated)
- | +-- Pane 0: team-lead
- |
- +-- Window 2: "myapp2" <- genie run from ~/projects/myapp2
- +-- Pane 0: team-lead
-```
-
-- **One session** called `"genie"` (configurable via `--name`)
-- **Each folder** gets its own window (tab), named `basename(cwd)`
-- **Collision handling:** if a window with the same basename exists but points to a different path, append a short hash (first 4 chars of path hash): `myapp-a3f2`
-- **Same folder re-run:** attaches to the existing window
-- **Agents** spawn as panes within the folder's window (unchanged)
-
-### Session Name Resolution
-
-```
-1. Get cwd = process.cwd()
-2. windowName = basename(cwd)
-3. Check if window `windowName` exists in "genie" session
- a. If exists AND same cwd -> attach
- b. If exists AND different cwd -> windowName = `${basename}-${hash(cwd).slice(0,4)}`
- c. If not exists -> create window with windowName, set cwd
-4. Store cwd association (tmux pane env var GENIE_CWD)
-```
-
-## Scope
-
-### IN
-
-#### 1. Hotfix: onboarding SKILL.md
-- Edit `skills/onboarding/SKILL.md` line 499: change `` `prefix + !` `` to `` `prefix` + `!` `` to break the executable interpolation trigger
-
-#### 2. Rename: tui -> session (full hit list)
-
-**File renames:**
-- `src/genie-commands/tui.ts` -> `src/genie-commands/session.ts`
-- `src/genie-commands/__tests__/tui.test.ts` -> `src/genie-commands/__tests__/session.test.ts`
-
-**Symbol renames in source:**
-| File | Old | New |
-|------|-----|-----|
-| `src/genie-commands/session.ts` (was tui.ts) | `TuiOptions` | `SessionOptions` |
-| `src/genie-commands/session.ts` | `tuiCommand()` | `sessionCommand()` |
-| `src/genie-commands/session.ts` | `createTuiSession()` | `createSession()` |
-| `src/genie-commands/session.ts` | comment "Genie TUI Command" | "Genie Session Command" |
-| `src/genie.ts` line 28 | `import { type TuiOptions, tuiCommand } from './genie-commands/tui.js'` | `import { type SessionOptions, sessionCommand } from './genie-commands/session.js'` |
-| `src/genie.ts` line 78 | `options: TuiOptions` | `options: SessionOptions` |
-| `src/genie.ts` line 80 | `tuiCommand(options)` | `sessionCommand(options)` |
-| `src/genie.ts` line 220 | comment `genie tui ` | `genie ` |
-| `src/lib/team-lead-command.ts` line 4 | comment `tui.ts` | `session.ts` |
-| `src/genie-commands/setup.ts` line 343 | `genie tui` | `genie` |
-| `src/term-commands/agents.ts` line 738 | `genie tui session` | `genie session` |
-| `src/lib/claude-native-teams.ts` line 385 | comment `genie tui` | `genie` |
-
-**Test file updates:**
-| File | Change |
-|------|--------|
-| `src/genie-commands/__tests__/session.test.ts` (was tui.test.ts) | Update comment, import path, test dir name |
-| `src/term-commands/msg.test.ts` lines 154-159 | Update comments and import path from `tui.js` to `session.js` |
-
-**Documentation updates:**
-| File | Lines | Change |
-|------|-------|--------|
-| `README.md` | 54, 93, 114, 157 | `genie tui` -> `genie` |
-| `skills/onboarding/SKILL.md` | 10, 18, 267 | `genie tui` -> `genie` |
-
-**Already-planned docs (informational, update references):**
-| File | Note |
-|------|------|
-| `.genie/wishes/fix-onboarding-prod-bugs/WISH.md` | References `tui.ts` — superseded wish, update for consistency |
-| `.genie/wishes/unify-install-kill-fragmentation/WISH.md` | References `tui.ts` — update for consistency |
-| `.genie/brainstorms/prompt-loading-arch/DESIGN.md` | References `tui.ts` — update for consistency |
-
-**Git cleanup:**
-- Delete stale branch `fix/tui-tmux-base-index` if merged
-
-#### 3. Remove `--team` global shortcut
-
-**Files to modify:**
-| File | Change |
-|------|--------|
-| `src/lib/team-shortcut.ts` lines 45-63 | Remove `--team` flag handling from `resolveTeamShortcut()` |
-| `src/lib/team-shortcut.ts` line 75 | Remove `--team` from error message showing valid syntax |
-| `src/lib/team-shortcut.test.ts` lines 103-123, 176-185 | Remove 6 `--team` test cases |
-
-**Keep unchanged:**
-- `src/term-commands/agents.ts` line 1136 — `--team` option on `genie agent spawn` (needed)
-- `src/term-commands/msg.ts` line 108 — `--team` option on `genie send` (needed)
-- `src/hooks/handlers/auto-spawn.ts` line 55 — internal `--team` usage (needed)
-
-#### 4. Session-per-folder
-- Change window naming: `basename(cwd)` instead of hardcoded `"genie"`
-- Add path disambiguation on collision (short hash suffix)
-- Store cwd->window mapping (via tmux pane env var `GENIE_CWD`)
-- Window lookup: check existing windows by name, verify cwd match
-- `genie` with no args -> creates/attaches window for current folder
-- Remove `DEFAULT_TEAM = 'main'` constant from `team-shortcut.ts` (no longer needed)
-
-### OUT
-- No changes to agent spawn/pane logic
-- No changes to `genie team ensure/list/delete` commands
-- No changes to build pipeline
-- No new CLI flags
-- No changes to Claude Code integration (system prompt, resume, etc.)
-- `--team` on subcommands (`agent spawn`, `send`) stays as-is
-
-## Decisions
-
-| Decision | Rationale |
-|----------|-----------|
-| Rename to `session.ts` / `sessionCommand` | Reflects the actual responsibility — managing tmux sessions and windows |
-| Single "genie" session, folder = window | One session is simpler to manage; windows are the natural unit for folder isolation |
-| Disambiguate with path hash on collision | Prevents silent cross-folder interference; keeps names readable |
-| Store cwd via tmux pane env var `GENIE_CWD` | No extra filesystem state needed; tmux env survives window lifetime |
-| Fix SKILL.md content, not SDK | SDK behavior is by design (executable interpolation); content must avoid the pattern |
-| Remove `--team` global shortcut only | Subcommands still need team context; global shortcut is dead weight now that sessions are folder-based |
-
-## Risks
-
-| Risk | Mitigation |
-|------|------------|
-| Existing sessions from old behavior won't match new naming | Graceful fallback — if "genie" session exists with old structure, attach normally |
-| Path hash collision (4 chars = 65k possibilities) | Extremely unlikely for realistic use; can increase to 6 chars if needed |
-| Renaming `tui` may break external references or user scripts | `_open` hidden command name stays the same; only internal naming changes |
-| Other SKILL.md files may have similar executable interpolation triggers | Scan confirmed: only onboarding SKILL.md is affected |
-| Removing `--team` global shortcut breaks muscle memory | Feature was undocumented; `genie ` routing still works |
-
-## Success Criteria
-
-- [ ] `/onboarding` skill loads without crashing
-- [ ] No file or function named `tui` remains in `src/`
-- [ ] All docs/skills reference `genie` not `genie tui`
-- [ ] `genie --team ` no longer routes to `_open` (removed from team-shortcut.ts)
-- [ ] `genie agent spawn --team X` still works (unchanged)
-- [ ] `genie` from ~/projects/myapp creates window "myapp" in session "genie"
-- [ ] `genie` again from ~/projects/myapp attaches to existing "myapp" window
-- [ ] `genie` from ~/projects/myapp2 creates separate "myapp2" window
-- [ ] Same-basename different-path folders get disambiguated window names
-- [ ] Agents spawn as panes within the folder's window
-- [ ] `bun run check` passes
-- [ ] `bun run build` succeeds
diff --git a/.genie/brainstorms/genie-default-command/DRAFT.md b/.genie/brainstorms/genie-default-command/DRAFT.md
deleted file mode 100644
index 4fa41cba2..000000000
--- a/.genie/brainstorms/genie-default-command/DRAFT.md
+++ /dev/null
@@ -1,40 +0,0 @@
-# Brainstorm: genie default command + tui rename + onboarding hotfix
-
-## Problem
-Three related issues:
-1. **Hotfix:** `/onboarding` skill crashes — `!` + backtick in SKILL.md triggers Claude SDK executable interpolation
-2. **Rename:** `tui` terminology persists in source, but the user-facing command is just `genie`
-3. **Session-per-folder:** Running `genie` from any directory should auto-create a tmux session named after the folder (or attach if it already exists)
-
-## Current State
-- `genie tui` is an internal hidden command (`_open`) — already routed via `resolveTeamShortcut()`
-- `genie` with no args → `_open main` → single "genie" tmux session, always
-- Session name is hardcoded to `options.name ?? "genie"` in `tui.ts`
-- Multiple projects share the same session — no folder isolation
-
-## Scope (draft)
-
-### IN
-- Fix onboarding SKILL.md line 499 (break `!` + backtick adjacency)
-- Rename `tui.ts` → something else (e.g. `session.ts` or `open.ts`)
-- Rename `tuiCommand` → `openCommand` or `sessionCommand`
-- Rename `TuiOptions` → `OpenOptions` or `SessionOptions`
-- Rename `createTuiSession` → `createSession`
-- Update all imports and references
-- Update docs, skills, README
-- Change session naming: use `basename(cwd)` as session name
-- Attach to existing session if one with that name exists (already works via `findSessionByName`)
-
-### OUT
-- TBD
-
-## Decisions (draft)
-- TBD: What to call the renamed file/function — `session.ts` vs `open.ts`?
-- TBD: Session name collision — two folders with same basename?
-- TBD: Should `genie ` create a team *window* in the folder-based session, or a separate session?
-
-## Risks
-- TBD
-
-## Criteria
-- TBD
diff --git a/.genie/brainstorms/prompt-loading-arch/DESIGN.md b/.genie/brainstorms/prompt-loading-arch/DESIGN.md
deleted file mode 100644
index 4989a94a8..000000000
--- a/.genie/brainstorms/prompt-loading-arch/DESIGN.md
+++ /dev/null
@@ -1,119 +0,0 @@
-# Design: Unify Installation & Kill Prompt Fragmentation
-
-## Problem
-
-Four redundant installers, three onboarding paths, orchestration prompt silently fails in production. User should do ONE thing (`curl | bash` or `genie` command given to Claude) and everything works.
-
-## Scope
-
-### IN
-- `install.sh` becomes the single zero-touch installer (no confirmations, just do it)
-- `install.sh` gains: tmux install, orchestration prompt injection, config defaults, tmux base-index
-- `install.sh` output: clear next steps mentioning `genie` command and `/onboarding`
-- `install.sh` never opens Claude Code — installs and prints instructions
-- `smart-install.js` becomes maintenance-only (version checks, re-inject rules if version changed)
-- New setting `promptMode: 'append' | 'system'` in `~/.genie/config.json`
-- `buildTeamLeadCommand` reads `promptMode` and uses correct flag
-- Orchestration prompt lives in `~/.claude/rules/genie-orchestration.md` (auto-loaded by CC)
-- `/onboarding` skill stays as optional workspace identity setup (AGENTS.md, name, role)
-
-### OUT
-- No changes to `/onboarding` skill internals (just remove infra concerns it shouldn't own)
-- No changes to session-context.cjs or first-run-check.cjs logic
-- No new CLI commands
-- No changes to AGENTS.md loading (works fine via process.cwd())
-- No changes to hooks dispatch system
-
-## Decisions
-
-| Decision | Rationale |
-|----------|-----------|
-| Kill `genie install` (install.ts) | Redundant with install.sh + smart-install.js |
-| Kill `install-genie-cli.sh` | Redundant with smart-install.js |
-| install.sh stops asking confirmations | One command, zero interaction. User already consented by running curl pipe |
-| Orchestration prompt in ~/.claude/rules/ | Auto-loaded by Claude Code, zero flags needed, survives bundles |
-| promptMode default is 'append' | Preserves CC default prompt. Power users switch to 'system' via genie setup |
-| install.sh never opens Claude Code | Often run by an agent or in CI. Output next steps for human/agent to follow |
-| /onboarding stays as skill, not command | Runs inside Claude, uses AskUserQuestion for identity. Not part of install |
-
-## Key Changes by File
-
-### install.sh (modify)
-- Remove all `confirm()` calls — just do everything
-- Add `install_tmux_if_needed()` using detected package manager (already has `install_package()`)
-- Add `inject_orchestration_prompt()`: write TEAM_LEAD_PROMPT content to `~/.claude/rules/genie-orchestration.md`
-- Add `create_default_config()`: write `~/.genie/config.json` with `promptMode: 'append'` if not exists
-- Add `configure_tmux_defaults()`: ensure `base-index 0` and `pane-base-index 0` in `~/.tmux.conf`
-- Update `print_success()`: output `genie` as entry point, mention `/onboarding`
-- Update `output_agent_prompt()`: same info for agent/pipe mode
-
-### smart-install.js (modify)
-- Add orchestration prompt injection (same as install.sh, for marketplace installs)
-- Add config defaults creation (same as install.sh)
-- Add tmux base-index check
-- Remove genie CLI global install (install.sh already did it, or marketplace install doesn't need it separately)
-- Keep: bun install, deps install, version marker
-
-### src/types/genie-config.ts (modify)
-- Add `promptMode: z.enum(['append', 'system']).default('append')` to GenieConfigSchema
-
-### src/lib/team-lead-command.ts (modify)
-- Remove `getTeamLeadPrompt()` function entirely (no more filesystem loading)
-- Remove `import.meta.url`, `dirname`, `fileURLToPath` imports
-- `persistSystemPrompt()` only handles AGENTS.md content (orchestration is in ~/.claude/rules/)
-- Read `promptMode` from config
-- Use `--append-system-prompt` or `--system-prompt` based on promptMode
-
-### src/genie-commands/install.ts (delete)
-- Remove entirely
-- Update CLI router to remove `genie install` command
-
-### plugins/genie/scripts/src/install-genie-cli.sh (delete)
-- Remove entirely — redundant with smart-install.js
-
-### src/genie-commands/tui.ts (modify)
-- Fix misleading warning: distinguish AGENTS.md (optional) from orchestration (now in rules/, always present)
-
-### src/genie-commands/setup.ts (modify)
-- Remove prerequisites check phase (install.sh/smart-install handles it)
-- Add promptMode configuration phase
-- Keep: session, terminal, shortcuts, worker profiles
-
-### TEAM_LEAD_PROMPT.md (keep, add header)
-- Add comment: "Source of truth. Injected to ~/.claude/rules/genie-orchestration.md by install.sh"
-- Content stays identical
-
-## Install Flow (after changes)
-
-```
-curl -fsSL .../install.sh | bash
- ├─ detect platform
- ├─ install bun (if missing)
- ├─ install tmux (if missing, via package manager)
- ├─ install genie CLI (bun install -g @automagik/genie)
- ├─ install Claude Code plugin (claude plugin marketplace add + install)
- ├─ write ~/.claude/rules/genie-orchestration.md
- ├─ write ~/.genie/config.json (if not exists, with promptMode: 'append')
- ├─ ensure tmux base-index 0 in ~/.tmux.conf
- └─ print:
- ✔ Genie installed successfully!
-
- Get started:
- genie Launch genie
-
- First time? Genie will suggest /onboarding to set up your workspace.
-```
-
-## Runtime Flow (after changes)
-
-```
-User runs: genie
- ├─ SessionStart hooks fire automatically:
- │ ├─ smart-install.js: version check, re-inject rules if updated
- │ ├─ first-run-check.cjs: suggest /onboarding if no AGENTS.md
- │ └─ session-context.cjs: show active wishes
- ├─ Orchestration prompt loaded from ~/.claude/rules/ (automatic, no flag)
- ├─ If AGENTS.md exists in cwd:
- │ └─ passed via --append-system-prompt (or --system-prompt per promptMode)
- └─ Claude knows about genie agent spawn, genie send, etc. (from rules/)
-```
diff --git a/.genie/brainstorms/prompt-loading-arch/DRAFT.md b/.genie/brainstorms/prompt-loading-arch/DRAFT.md
deleted file mode 100644
index 2baaca921..000000000
--- a/.genie/brainstorms/prompt-loading-arch/DRAFT.md
+++ /dev/null
@@ -1,6 +0,0 @@
-# Brainstorm: Unify Installation & Kill Prompt Fragmentation
-
-## Status: Crystallized → DESIGN.md
-## WRS: 100/100
-
-Crystallized into DESIGN.md. Ready for /wish.
diff --git a/.genie/brainstorms/report-skill-plugin-rename/DESIGN.md b/.genie/brainstorms/report-skill-plugin-rename/DESIGN.md
deleted file mode 100644
index 349d42bce..000000000
--- a/.genie/brainstorms/report-skill-plugin-rename/DESIGN.md
+++ /dev/null
@@ -1,187 +0,0 @@
-# Design: /report skill + plugin rename + debug->trace rename
-
-| Field | Value |
-|-------|-------|
-| **Slug** | `report-skill-plugin-rename` |
-| **Date** | 2026-03-10 |
-| **Status** | Ready for /wish |
-
-## Problem
-
-1. **Plugin verbosity:** Skills show as `automagik-genie:debug`, `automagik-genie:brainstorm` etc. The `automagik-genie` prefix is too long — should be just `genie`.
-2. **Name conflict:** `/debug` conflicts with Claude Code's built-in debug functionality. Rename to `/trace`.
-3. **Missing capability:** No skill exists to produce a comprehensive, evidence-rich bug report ready for GitHub issue creation. Currently `/trace` (debug) only investigates — it doesn't capture browser state, screenshots, video, console logs, network traces, or observability platform data.
-
-## Architecture
-
-### Skill Cascade: /report -> /trace
-
-```
-User: /report "login page shows blank after OAuth redirect"
- |
- v
-/report (orchestrator)
- |
- +-- 1. Run /trace (code-level investigation)
- | |-- Read source, grep for patterns
- | |-- Reproduce if possible
- | +-- Produce root cause report
- |
- +-- 2. Browser investigation (opportunistic)
- | |-- Auto-detect: URL provided? Dev server running?
- | |-- If yes: launch agent-browser
- | | |-- Navigate to affected page
- | | |-- Capture screenshot (before/after)
- | | |-- Record video of reproduction
- | | |-- Capture console logs
- | | |-- Capture network waterfall
- | | |-- Capture performance profile
- | | +-- Capture errors
- | +-- If no: skip, note in report
- |
- +-- 3. Observability data (project-dependent)
- | |-- Detect: SENTRY_DSN? PostHog? DataDog? LogRocket?
- | |-- If found: pull recent errors, events, traces
- | +-- If not: skip gracefully
- |
- +-- 4. Compile report + create GitHub issue
- |-- Title, description, reproduction steps
- |-- Attach all evidence (screenshots, logs, traces)
- |-- Labels: bug, priority, affected area
- +-- `gh issue create` with full body
-```
-
-### Evidence Collection Matrix
-
-| Source | Detection | Data Captured |
-|--------|-----------|---------------|
-| Code analysis | Always | Root cause, affected files, causal chain |
-| agent-browser | URL or dev server detected | Screenshots, video, console logs, network, perf, errors |
-| Sentry | SENTRY_DSN env or sentry.*.config.* | Recent errors, stack traces, breadcrumbs |
-| PostHog | POSTHOG_KEY or posthog config | Session recordings, error events |
-| DataDog | DD_API_KEY or datadog config | APM traces, error tracking |
-| Generic logs | Log files in project | Recent error entries |
-
-### GitHub Issue Template
-
-```markdown
-## Bug Report:
-
-### Summary
-<1-2 sentence description>
-
-### Reproduction Steps
-1.
-2.
-3.
-
-### Expected Behavior
-
-
-### Actual Behavior
-
-
-### Root Cause Analysis
-
-- **File:**
-- **Cause:**
-- **Causal chain:** root -> intermediate -> symptom
-- **Confidence:** high/medium/low
-
-### Evidence
-
-#### Screenshots
-
-
-#### Console Logs
-```
-
-```
-
-#### Network
-
-
-#### Performance
-
-
-#### Observability
-
-
-### Environment
-- OS:
-- Node/Bun:
-- Browser:
-- Relevant deps:
-
-### Suggested Fix
-
-
----
-Generated by genie /report
-```
-
-## Scope
-
-### IN
-
-#### Plugin rename: automagik-genie -> genie
-- `plugins/genie/.claude-plugin/plugin.json` line 2: `"name": "automagik-genie"` -> `"name": "genie"`
-- `cliff.toml` line 40-41: update contributor attribution
-- `plugins/genie/scripts/term.cjs`: update 3 occurrences (if in unminified source)
-- Verify `openclaw.plugin.json` already uses id `"genie"` (it does — no change needed)
-
-#### Skill rename: debug -> trace
-- Rename directory `skills/debug/` -> `skills/trace/`
-- Update `skills/trace/SKILL.md` frontmatter: `name: debug` -> `name: trace`
-- Update all SKILL.md files that reference `/debug` -> `/trace` (e.g., fix.md references debug handoff)
-- Update any agent definitions in `plugins/genie/agents/` that reference debug
-
-#### New skill: /report
-- Create `skills/report/SKILL.md` with the full investigation + issue creation flow
-- Skill cascades through `/trace` first for code-level analysis
-- Opportunistic browser investigation via agent-browser (screenshots, video, console, network, perf)
-- Project-dependent observability data extraction (Sentry, PostHog, DataDog, etc.)
-- Auto-creates GitHub issue via `gh issue create` with all evidence attached
-- Degrades gracefully when browser or observability tools are unavailable
-
-### OUT
-- No changes to agent-browser itself (use its existing capabilities)
-- No Sentry/PostHog MCP installation (just use their APIs/CLIs if project has them)
-- No changes to `/fix` skill (it already accepts /trace reports)
-- No new CLI commands (this is a skill, not a genie CLI command)
-- No changes to the plugin build system or openclaw config
-
-## Decisions
-
-| Decision | Rationale |
-|----------|-----------|
-| Rename plugin to "genie" (clean break) | Existing installs are few; clean break is better than alias complexity |
-| `/debug` -> `/trace` | Avoids Claude built-in conflict; "trace" implies following the evidence trail |
-| `/report` cascades through `/trace` | Reuse existing investigation logic; separation of concerns |
-| Browser investigation is opportunistic | Not every bug is UI-related; auto-detect avoids unnecessary browser launches |
-| Observability is project-dependent | Different projects use different tools; detect and use what's available |
-| Auto-create GitHub issue | Reduces friction; the whole point is a ready-to-action issue |
-| Degrade gracefully without browser | Code-level report is still valuable; don't block on missing browser |
-
-## Risks
-
-| Risk | Mitigation |
-|------|------------|
-| Plugin rename breaks existing installs | Clean break — users reinstall once. Few installs exist currently. |
-| `/trace` name might confuse with browser tracing | Context makes it clear — `/trace` is for root cause investigation, not browser devtools |
-| agent-browser may not be available in all environments | Graceful degradation — skip browser evidence, note in report |
-| GitHub issue creation may fail (no `gh` auth, no repo) | Check `gh auth status` before attempting; fall back to printing the report if issue creation fails |
-| Observability API tokens may be expired/invalid | Try-catch each integration; skip and note in report if auth fails |
-| Video recording produces large files for GH issues | Use screenshots as primary; video as optional attachment or link |
-
-## Success Criteria
-
-- [ ] Skills show as `genie:trace`, `genie:brainstorm`, etc. (not `automagik-genie:`)
-- [ ] `/trace` works identically to old `/debug` (just renamed)
-- [ ] `/debug` no longer appears in skill list
-- [ ] `/report` produces a comprehensive bug report from user-provided symptoms
-- [ ] `/report` captures screenshots when browser/URL is available
-- [ ] `/report` pulls Sentry data when SENTRY_DSN is configured in the project
-- [ ] `/report` creates a GitHub issue via `gh issue create`
-- [ ] `/report` degrades gracefully when browser or observability tools are missing
-- [ ] All cross-references between skills updated (e.g., /fix references /trace not /debug)
diff --git a/.genie/brainstorms/report-skill-plugin-rename/DRAFT.md b/.genie/brainstorms/report-skill-plugin-rename/DRAFT.md
deleted file mode 100644
index 0cac3da46..000000000
--- a/.genie/brainstorms/report-skill-plugin-rename/DRAFT.md
+++ /dev/null
@@ -1,19 +0,0 @@
-# Brainstorm: /report skill + plugin rename + debug rename
-
-## Problem
-1. Plugin name "automagik-genie" is verbose — should be just "genie"
-2. `/debug` skill conflicts with Claude Code's built-in debug
-3. Need a comprehensive `/report` skill that investigates bugs using all available tools (browser screenshots, video, console, network, perf, Sentry) and produces a GitHub-ready issue
-
-## Context gathered
-- Plugin name lives in `plugins/genie/.claude-plugin/plugin.json` line 2
-- OpenClaw id is already "genie" in `openclaw.plugin.json`
-- agent-browser has: screenshots, video recording, console capture, error capture, network monitoring, performance profiling, visual diffing
-- No Sentry MCP/integration currently installed — would need to be optional/discoverable
-- 13 skills total in the plugin
-
-## Debug rename candidates
-- TBD (user choosing)
-
-## /report skill design
-- TBD
diff --git a/.genie/wishes/deps-bump-readme-rewrite/WISH.md b/.genie/wishes/deps-bump-readme-rewrite/WISH.md
deleted file mode 100644
index 117979228..000000000
--- a/.genie/wishes/deps-bump-readme-rewrite/WISH.md
+++ /dev/null
@@ -1,118 +0,0 @@
-# Wish: Dependency Bump + README Rewrite
-
-| Field | Value |
-|-------|-------|
-| **Status** | APPROVED |
-| **Slug** | deps-bump-readme-rewrite |
-| **Date** | 2026-03-10 |
-| **Design** | [DESIGN.md](../../brainstorms/deps-bump-readme-rewrite/DESIGN.md) |
-
-## Summary
-
-Bump all safe dependencies to latest compatible versions and rewrite the README with cognitive-load-reduction positioning ("Wishes in, PRs out"), pain-first voice, and a streamlined ~120-line structure. The current README undersells the product with abstract jargon and insider terminology; the new one leads with developer pain and shows how Genie eliminates it.
-
-## Scope
-
-### IN
-- Bump safe dependency versions (patches, minors, and cautious majors per design D6)
-- Full README.md rewrite with new positioning, structure, and content blocks from design
-- CLI reference and configuration moved to collapsed `` sections
-
-### OUT
-- Plugin marketplace listing
-- Comparison pages vs competitors
-- Video/GIF/demo recording
-- Architecture diagram
-- Blog posts or content strategy
-- Zod v4, Biome v2, UUID v13, Inquirer v8, Commander v14 (breaking majors — separate wish)
-
-## Decisions
-
-1. **Positioning:** Cognitive load reduction — "Wishes in, PRs out"
-2. **Voice:** Third-person, pain-first. No first-person Genie voice.
-3. **Tagline:** Hero: "Wishes in, PRs out." Subtitle: "Describe the problem. Genie interviews you, plans the work, dispatches agents, and reviews the code. You approve and ship."
-4. **Dep strategy:** Safe bumps only. Stay on current majors for risky packages.
-5. **README structure:** Hero → What is Genie (3 sentences) → Right for you if → 3-step quickstart → Feature grid → Without/With pain table → Wish Pipeline → CLI (collapsed) → Config (collapsed) → Dev → Community
-
-## Success Criteria
-
-- [ ] All safe dependency bumps applied per design D6
-- [ ] `bun run check` passes (typecheck + lint + dead-code + test)
-- [ ] README body under 150 lines (excluding collapsed `` sections)
-- [ ] No first-person voice anywhere in README
-- [ ] 3-step quickstart present (install → launch → wish)
-- [ ] Feature grid present (3x3 or similar scannable format)
-- [ ] "Without/With" pain table present (6 rows)
-- [ ] No `--dangerously-skip-permissions` in any README example
-- [ ] CLI reference in collapsed `` section
-- [ ] Prerequisites listed explicitly
-
-## Execution Groups
-
-### Group 1: Dependency Bump
-
-**Goal:** Update all safe dependencies to latest compatible versions.
-
-**Deliverables:**
-- Updated `package.json` with bumped version ranges
-- Updated `bun.lock` via `bun install`
-- Any code changes needed for API differences (commander v13 if breaking)
-
-**Acceptance Criteria:**
-- [ ] @types/bun bumped to ^1.3.10
-- [ ] @types/node bumped to ^22.0.0
-- [ ] esbuild bumped to ^0.27.3
-- [ ] knip bumped to ^5.86.0
-- [ ] typescript bumped to ^5.8.0
-- [ ] zod bumped to ^3.25.0
-- [ ] No type errors after bump
-- [ ] All 527+ tests pass
-
-**Validation:**
-```bash
-bun install && bun run check
-```
-
----
-
-### Group 2: README Rewrite
-
-**Goal:** Rewrite README.md with cognitive-load positioning and pain-first structure.
-
-**Deliverables:**
-- New `README.md` following design D4 structure
-- Pre-written content blocks from design integrated
-- CLI reference and config in collapsed sections
-
-**Acceptance Criteria:**
-- [ ] Hero + badges + "Wishes in, PRs out" tagline
-- [ ] "What is Genie?" — 3 sentences
-- [ ] "Right for you if" — 6-item pain checklist
-- [ ] 3-step quickstart (install, launch, wish)
-- [ ] Feature grid (scannable, not a wall of text)
-- [ ] "Without/With" pain table (6 rows from design)
-- [ ] Wish Pipeline section (flow + descriptions)
-- [ ] CLI reference in `` (updated for current commands)
-- [ ] Config in ``
-- [ ] Community + License footer
-- [ ] Under 150 lines excluding collapsed sections
-- [ ] No first-person voice
-- [ ] No `--dangerously-skip-permissions`
-- [ ] Prerequisites listed (macOS/Linux, Bun 1.3.10+, Claude Code)
-
-**Validation:**
-```bash
-# Line count check (excluding collapsed sections)
-awk '/^/{next}1' README.md | wc -l
-# Must be under 150
-```
-
-## Assumptions & Risks
-
-- **R1:** Commander v13 may have breaking API changes — mitigated by test suite; if breaks, stay on v12
-- **R2:** "Wishes" is jargon to newcomers — mitigated by plain language in hero, term introduced in body
-- **R3:** Feature grid may undersell depth — mitigated by linking to docs/Discord for details
-
-## Dependencies
-
-- None (standalone wish)
diff --git a/.genie/wishes/fix-onboarding-prod-bugs/WISH.md b/.genie/wishes/fix-onboarding-prod-bugs/WISH.md
deleted file mode 100644
index c166748f1..000000000
--- a/.genie/wishes/fix-onboarding-prod-bugs/WISH.md
+++ /dev/null
@@ -1,153 +0,0 @@
-# Wish: Fix Onboarding Production Bugs (tmux defaults + silent prompt failure)
-
-| Field | Value |
-|-------|-------|
-| **Status** | SUPERSEDED by `unify-install-kill-fragmentation` |
-| **Slug** | `fix-onboarding-prod-bugs` |
-| **Date** | 2026-03-09 |
-
-## Summary
-
-Two bugs discovered during clean-machine onboarding testing. Bug 1 (low): `genie install` never writes base tmux settings, so users on distros with `mouse on` system defaults can't scroll. Bug 2 (critical): `TEAM_LEAD_PROMPT.md` is loaded via filesystem path that resolves correctly in dev (`src/lib/`) but breaks in the production flat bundle (`dist/genie.js`), causing Claude to launch without any orchestration instructions — silently.
-
-## Scope
-
-### IN
-
-- Inline `TEAM_LEAD_PROMPT.md` content as a TypeScript constant (eliminate filesystem dependency)
-- Add explicit CRITICAL-level warning when orchestration prompt is empty/null
-- Fix misleading `tui.ts` warning that only mentions `AGENTS.md`
-- Add sensible tmux base defaults to `generateTmuxConfig()` in shortcuts.ts
-- Keep `TEAM_LEAD_PROMPT.md` file for documentation/reference (add header noting it's inlined)
-
-### OUT
-
-- No changes to the build pipeline or bundler configuration
-- No changes to `AGENTS.md` loading logic (that works correctly via `process.cwd()`)
-- No tmux mouse-mode detection or auto-configuration beyond static defaults
-- No changes to `install.ts` prerequisite installation flow
-- No new CLI flags or user-facing options
-
-## Decisions
-
-| Decision | Rationale |
-|----------|-----------|
-| Inline prompt as TS constant (Option 1) | Eliminates entire class of "file not found at runtime" bugs. No bundler config needed. Content already ships with the package — just needs to be compiled in. |
-| Keep `TEAM_LEAD_PROMPT.md` file | Serves as human-readable documentation; easier to review/edit prompt content before copying into the constant. |
-| `set -g mouse off` as default | Users on clean machines expect terminal-native scroll. Power users who want mouse can override in their own config. Matches tmux's own default (pre-distro overrides). |
-| Add CRITICAL warning, not throw | Throwing would block `genie command` entirely. Warning lets it proceed degraded while making the failure visible. |
-
-## Success Criteria
-
-- [ ] `genie command` on a clean install injects `TEAM_LEAD_PROMPT.md` content into the system prompt
-- [ ] Running from `dist/genie.js` (production bundle) produces identical orchestration prompt as running from `src/genie.ts` (dev)
-- [ ] If orchestration prompt is somehow empty, a CRITICAL warning is logged to stderr
-- [ ] `generateTmuxConfig()` output includes `set -g mouse off` and `set -g base-index 0`
-- [ ] `tui.ts` warning distinguishes between missing `AGENTS.md` (optional) and missing orchestration prompt (critical)
-- [ ] `bun run check` passes (typecheck + lint + dead-code + tests)
-- [ ] No runtime `fs.readFileSync` or `fs.existsSync` calls for `TEAM_LEAD_PROMPT.md`
-
-## Execution Groups
-
-### Group 1: Inline orchestration prompt (CRITICAL fix)
-
-**Goal:** Eliminate filesystem dependency for TEAM_LEAD_PROMPT.md. Make the orchestration prompt a compile-time constant.
-
-**Deliverables:**
-1. Create a new constant `TEAM_LEAD_PROMPT` in `src/lib/team-lead-command.ts` containing the full content of `TEAM_LEAD_PROMPT.md`
-2. Replace `getTeamLeadPrompt()` filesystem-based function with a simple getter returning the constant
-3. Remove unused `fs` imports (`readFileSync`, `existsSync` for prompt loading — keep others if used elsewhere)
-4. Remove unused `path` imports (`dirname`, `join` for prompt path — keep if used elsewhere)
-5. Remove unused `url` import (`fileURLToPath` — keep if used elsewhere)
-
-**Acceptance criteria:**
-- `getTeamLeadPrompt()` returns the prompt content without any filesystem access
-- No `import.meta.url` usage remains for prompt resolution
-- The returned string matches `TEAM_LEAD_PROMPT.md` content exactly
-
-**Validation:**
-```bash
-# Verify no filesystem loading for the prompt
-grep -n 'import.meta.url' src/lib/team-lead-command.ts && echo "FAIL: import.meta.url still present" || echo "PASS"
-grep -n 'TEAM_LEAD_PROMPT' src/lib/team-lead-command.ts | head -5
-bun run typecheck
-```
-
-### Group 2: Add failure warnings + fix misleading tui.ts message
-
-**Goal:** Make prompt loading failures loud and distinguishable.
-
-**Deliverables:**
-1. In `persistSystemPrompt()` (`team-lead-command.ts`), add a `console.error('CRITICAL: ...')` if `getTeamLeadPrompt()` returns empty/null
-2. In `tui.ts`, update the warning at lines 198-201:
- - If `AGENTS.md` is missing, log it as informational (not a problem)
- - After `buildClaudeCommand` is called, if no `--system-prompt` flag was emitted, log a CRITICAL warning mentioning both AGENTS.md and orchestration prompt
-
-**Acceptance criteria:**
-- Warning text clearly distinguishes optional `AGENTS.md` from mandatory orchestration prompt
-- CRITICAL warning fires when orchestration prompt is null/empty
-- Warning does NOT fire during normal operation (prompt is inlined, so it should always be present)
-
-**Validation:**
-```bash
-grep -n 'CRITICAL' src/lib/team-lead-command.ts src/genie-commands/tui.ts
-bun run typecheck
-```
-
-### Group 3: tmux base defaults
-
-**Goal:** Ensure clean-machine tmux installs get sensible defaults.
-
-**Deliverables:**
-1. Prepend base settings to `generateTmuxConfig()` output in `src/term-commands/shortcuts.ts`:
- ```
- # Base settings (generated by genie-cli)
- set -g mouse off
- set -g base-index 0
- setw -g pane-base-index 0
- ```
-
-**Acceptance criteria:**
-- `generateTmuxConfig()` output starts with base settings before keyboard shortcuts
-- Existing keyboard shortcuts remain unchanged
-- The "generated by genie-cli" marker is present (used for install/uninstall detection)
-
-**Validation:**
-```bash
-grep -n 'mouse off' src/term-commands/shortcuts.ts && echo "PASS" || echo "FAIL"
-grep -n 'base-index' src/term-commands/shortcuts.ts && echo "PASS" || echo "FAIL"
-bun run typecheck
-```
-
-### Group 4: Update TEAM_LEAD_PROMPT.md + final validation
-
-**Goal:** Mark the file as documentation-only and run full quality gates.
-
-**Deliverables:**
-1. Add a header comment to `TEAM_LEAD_PROMPT.md`:
- ```
-
- ```
-2. Run full quality gates
-
-**Acceptance criteria:**
-- `bun run check` exits 0
-- `bun run build` succeeds
-- Built `dist/genie.js` contains the inlined prompt string
-
-**Validation:**
-```bash
-bun run check
-bun run build
-grep -c 'MANDATORY Agent Orchestration' dist/genie.js # should be >= 1
-```
-
-## Assumptions / Risks
-
-| Risk | Mitigation |
-|------|------------|
-| Inlined prompt constant becomes stale vs. TEAM_LEAD_PROMPT.md edits | Header comment in .md file warns to sync changes; could add a CI check later |
-| `set -g mouse off` may surprise users who expect mouse | Matches tmux's own compiled default; users can override in their own config block below genie's |
-| Large string constant in source may trigger linter warnings | Use template literal; biome doesn't flag long template strings |
diff --git a/.genie/wishes/genie-default-command/WISH.md b/.genie/wishes/genie-default-command/WISH.md
deleted file mode 100644
index f5002ad38..000000000
--- a/.genie/wishes/genie-default-command/WISH.md
+++ /dev/null
@@ -1,228 +0,0 @@
-# Wish: Session-per-folder, tui rename, --team cleanup, onboarding hotfix
-
-| Field | Value |
-|-------|-------|
-| **Status** | SHIPPED |
-| **Slug** | `genie-default-command` |
-| **Date** | 2026-03-10 |
-| **Design** | [DESIGN.md](../../brainstorms/genie-default-command/DESIGN.md) |
-
-## Summary
-
-Running `genie` from any folder should create a tmux window named after that folder (or attach to the existing one) inside a single `"genie"` session. Internal `tui` naming (59 occurrences across 14+ files) must be renamed to `session`. The `genie --team ` global shortcut must be removed (keep `--team` on subcommands). The `/onboarding` skill crash must be hotfixed.
-
-## Scope
-
-### IN
-
-- Fix onboarding SKILL.md line 499 (executable interpolation trigger)
-- Rename `tui.ts` -> `session.ts`, all symbols, imports, comments, docs, skills
-- Remove `--team` global shortcut from `team-shortcut.ts` + tests
-- Session-per-folder: window naming by `basename(cwd)`, hash disambiguation, cwd tracking
-- Update README.md, skills, wish docs, brainstorm docs for consistency
-
-### OUT
-
-- No changes to agent spawn/pane logic (agents still create panes in the current window)
-- No changes to `genie team ensure/list/delete` commands
-- No changes to build pipeline or bundler configuration
-- No new CLI flags or user-facing options
-- No changes to Claude Code integration (system prompt, resume, session ID)
-- `--team` on subcommands (`agent spawn`, `send`) stays as-is
-- No changes to hooks dispatch system
-
-## Decisions
-
-| Decision | Rationale |
-|----------|-----------|
-| Rename to `session.ts` / `sessionCommand` | Reflects the actual responsibility — managing tmux sessions and windows |
-| Single "genie" session, folder = window | One session is simpler to manage; windows are the natural unit for folder isolation |
-| Disambiguate with 4-char path hash on collision | Prevents silent cross-folder interference; keeps window names readable |
-| Store cwd via tmux pane env var `GENIE_CWD` | No extra filesystem state; tmux env survives window lifetime |
-| Fix SKILL.md content, not Claude SDK | SDK behavior is by design (executable interpolation); content must avoid the pattern |
-| Remove `--team` global shortcut only | Subcommands still need team context; global shortcut is dead weight with folder-based sessions |
-
-## Success Criteria
-
-- [ ] `/onboarding` skill loads without crashing
-- [ ] No file or function named `tui` remains in `src/`
-- [ ] No doc or skill references `genie tui` (all say `genie`)
-- [ ] `genie --team ` no longer routes to `_open`
-- [ ] `genie agent spawn --team X` still works
-- [ ] `genie` from ~/projects/myapp creates window "myapp" in session "genie"
-- [ ] `genie` again from ~/projects/myapp attaches to existing "myapp" window
-- [ ] `genie` from ~/projects/myapp2 creates separate "myapp2" window
-- [ ] Two folders with same basename but different paths get disambiguated names
-- [ ] Agents spawn as panes within the folder's window
-- [ ] `bun run check` passes (typecheck + lint + dead-code + tests)
-- [ ] `bun run build` succeeds
-
-## Execution Groups
-
-### Group 1: Hotfix — onboarding SKILL.md (P0)
-
-**Goal:** Fix the `/onboarding` skill crash caused by Claude SDK executable interpolation.
-
-**Deliverables:**
-1. Edit `skills/onboarding/SKILL.md` line 499: change `` `prefix + !` `` to `` `prefix` + `!` ``
-
-**Acceptance criteria:**
-- The `!` character is no longer adjacent to a backtick with preceding whitespace on that line
-- No other lines in any SKILL.md file contain the `!` + backtick pattern
-
-**Validation:**
-```bash
-# Verify no executable interpolation triggers remain
-grep -rn '!\`' skills/ && echo "FAIL: executable interpolation pattern found" || echo "PASS"
-```
-
-### Group 2: Rename tui -> session (source files)
-
-**Goal:** Eliminate all `tui` naming from source code.
-
-**Deliverables:**
-1. Rename `src/genie-commands/tui.ts` -> `src/genie-commands/session.ts`
-2. Rename `src/genie-commands/__tests__/tui.test.ts` -> `src/genie-commands/__tests__/session.test.ts`
-3. In `session.ts` (was tui.ts):
- - `TuiOptions` -> `SessionOptions`
- - `tuiCommand()` -> `sessionCommand()`
- - `createTuiSession()` -> `createSession()`
- - Comment "Genie TUI Command" -> "Genie Session Command"
-4. In `src/genie.ts` line 28:
- - Update import path and symbols: `import { type SessionOptions, sessionCommand } from './genie-commands/session.js'`
- - Update usage at lines 78, 80
- - Update comment at line 220
-5. In `src/lib/team-lead-command.ts` line 4: comment `tui.ts` -> `session.ts`
-6. In `src/genie-commands/setup.ts` line 343: `genie tui` -> `genie`
-7. In `src/term-commands/agents.ts` line 738: `genie tui session` -> `genie session`
-8. In `src/lib/claude-native-teams.ts` line 385: comment `genie tui` -> `genie`
-9. In `src/term-commands/msg.test.ts` lines 154-159: update comments and import path
-
-**Acceptance criteria:**
-- `grep -rn 'tui' src/` returns zero results (excluding node_modules)
-- All imports resolve correctly
-- `bun run typecheck` passes
-
-**Validation:**
-```bash
-grep -rn 'tui' src/ --include='*.ts' | grep -v node_modules | grep -v '.genie/' && echo "FAIL" || echo "PASS"
-bun run typecheck
-```
-
-### Group 3: Rename tui -> genie (docs, skills, wishes)
-
-**Goal:** Eliminate all `genie tui` references from documentation and planning files.
-
-**Deliverables:**
-1. `README.md` lines 54, 93, 114, 157: `genie tui` -> `genie`
-2. `skills/onboarding/SKILL.md` lines 10, 18, 267: `genie tui` -> `genie`
-3. `.genie/wishes/fix-onboarding-prod-bugs/WISH.md`: update `tui.ts` references to `session.ts`
-4. `.genie/wishes/unify-install-kill-fragmentation/WISH.md`: update `tui.ts` references to `session.ts`
-5. `.genie/brainstorms/prompt-loading-arch/DESIGN.md`: update `tui.ts` reference
-
-**Acceptance criteria:**
-- `grep -rn 'genie tui' .` returns zero results outside of git history
-- `grep -rn 'tui\.ts' .` returns zero results outside of git history and node_modules
-
-**Validation:**
-```bash
-grep -rn 'genie tui' README.md skills/ .genie/ && echo "FAIL" || echo "PASS"
-grep -rn 'tui\.ts' README.md skills/ .genie/ src/ && echo "FAIL" || echo "PASS"
-```
-
-### Group 4: Remove --team global shortcut
-
-**Goal:** Remove the `genie --team ` global routing. Keep `--team` on subcommands.
-
-**Deliverables:**
-1. In `src/lib/team-shortcut.ts`:
- - Remove lines 45-63 (`--team` flag handling in `resolveTeamShortcut()`)
- - Remove `--team` from the error message at line 75
-2. In `src/lib/team-shortcut.test.ts`:
- - Remove test cases for `--team` routing (lines 103-123, 176-185)
-3. Verify `--team` still works on `genie agent spawn` and `genie send`
-
-**Acceptance criteria:**
-- `genie --team foo` no longer routes to `_open foo`
-- `genie agent spawn --role implementor --team myteam` still works
-- `genie send "hello" --to agent1 --team myteam` still works
-- All remaining tests pass
-
-**Validation:**
-```bash
-grep -n '\-\-team' src/lib/team-shortcut.ts | wc -l # should be 0 or minimal
-bun test src/lib/team-shortcut.test.ts
-bun test src/term-commands/msg.test.ts
-```
-
-### Group 5: Session-per-folder
-
-**Goal:** Running `genie` from any folder creates/attaches a window named after that folder.
-
-**Deliverables:**
-1. In `session.ts` (was tui.ts), modify `sessionCommand()`:
- - Window name = `basename(process.cwd())` instead of hardcoded `"genie"`
- - On window lookup: check if existing window's `GENIE_CWD` matches current cwd
- - If basename collision with different cwd: append 4-char hash of full path
- - Store cwd as tmux pane environment variable: `tmux setenv -t GENIE_CWD `
-2. In `session.ts`, modify `createSession()`:
- - Session name stays `"genie"` (or `options.name`)
- - Window name = folder-derived name
- - Set `GENIE_CWD` env var on the pane
-3. In `src/lib/team-shortcut.ts`:
- - Remove `DEFAULT_TEAM = 'main'` constant (no longer needed)
- - Update default routing: `genie` with no args -> `_open` with cwd-based naming
-4. In `src/lib/tmux.ts` (if needed):
- - Add helper to read pane env var `GENIE_CWD`
- - Add helper to find window by name + verify cwd match
-
-**Acceptance criteria:**
-- `genie` from `/home/user/projects/myapp` creates window "myapp"
-- `genie` again from same folder attaches to "myapp"
-- `genie` from `/home/user/other/myapp` creates window "myapp-XXXX" (disambiguated)
-- `genie` from `/home/user/projects/api` creates window "api"
-- Session is always "genie" (single session for all folders)
-
-**Validation:**
-```bash
-# Manual test sequence:
-cd /tmp/test-folder-a && genie # creates window "test-folder-a"
-cd /tmp/test-folder-b && genie # creates window "test-folder-b" in same session
-cd /tmp/test-folder-a && genie # attaches to existing "test-folder-a"
-tmux list-windows -t genie # should show both windows
-```
-
-### Group 6: Final validation
-
-**Goal:** Full quality gates pass with all changes integrated.
-
-**Deliverables:**
-1. Run full check suite
-2. Run build
-3. Verify no stale references remain
-
-**Acceptance criteria:**
-- `bun run check` exits 0
-- `bun run build` succeeds
-- No `tui` references in source
-- No `genie tui` references in docs
-- No `--team` in team-shortcut.ts
-
-**Validation:**
-```bash
-bun run check
-bun run build
-grep -rn 'tui' src/ --include='*.ts' | grep -v node_modules && echo "FAIL: tui in source" || echo "PASS"
-grep -rn 'genie tui' README.md skills/ && echo "FAIL: genie tui in docs" || echo "PASS"
-grep -n '\-\-team' src/lib/team-shortcut.ts && echo "FAIL: --team in shortcut" || echo "PASS"
-```
-
-## Assumptions / Risks
-
-| Risk | Mitigation |
-|------|------------|
-| Existing "genie" sessions from old behavior have different window structure | Graceful fallback — if session exists with old structure, attach normally |
-| Path hash collision (4 chars = 65k namespace) | Extremely unlikely for realistic use; can increase to 6 chars if needed |
-| Renaming `tui` may break user scripts referencing internal functions | `_open` hidden command name stays the same; only internal naming changes |
-| `DEFAULT_TEAM = 'main'` removal may break code that imports it | Search for all imports before removing; replace with inline defaults if needed |
-| Removing `--team` global shortcut breaks existing workflows | Feature was never prominently documented; folder-based routing replaces it |
diff --git a/.genie/wishes/genie-v2-framework-redesign/WISH.md b/.genie/wishes/genie-v2-framework-redesign/WISH.md
deleted file mode 100644
index 5656b3a43..000000000
--- a/.genie/wishes/genie-v2-framework-redesign/WISH.md
+++ /dev/null
@@ -1,546 +0,0 @@
-# Wish: Genie CLI v2 — Complete Framework Redesign
-
-| Field | Value |
-|-------|-------|
-| **Status** | DRAFT |
-| **Slug** | `genie-v2-framework-redesign` |
-| **Date** | 2026-03-13 |
-| **Design** | [DESIGN.md](../../brainstorms/agent-directory/DESIGN.md) |
-| **Draft** | [DRAFT.md](../../brainstorms/agent-directory/DRAFT.md) |
-
-## Summary
-
-Redesign the entire genie CLI framework: replace 40+ commands with a streamlined command tree, introduce an agent directory for identity management, replace beads with a wish-native state machine, add team-based worktree collaboration with dynamic hire/fire, implement dispatch commands (brainstorm/wish/work/review) with context injection, and refine 10 skill prompts to align with the new orchestration model. Clean break — no backward compatibility.
-
-## Scope
-
-### IN
-
-- Agent directory module (`genie dir add/rm/ls/edit`) replacing profiles
-- Directory-based spawn (`genie spawn `) with `--system-prompt-file` / `--append-system-prompt-file`
-- Built-in roles and council members shipping with genie package
-- Team lifecycle (`genie team create/hire/fire/disband`) with git worktree management
-- Team name = branch name (conventional git prefixes)
-- Wish-native state machine (`genie work/done/status`) replacing beads
-- Dispatch commands with context injection (brainstorm/wish/work/review)
-- Flat messaging by name (`genie send/broadcast/chat`) scoped to own team
-- Auto-spawn on message to offline agent
-- Promote agent commands to top-level (`spawn`, `kill`, `stop`, `ls`, etc.)
-- `/refine` pass on 10 skills to align with new orchestration model
-- Council dual-mode: lightweight (skill) + full spawn (team hire)
-- Remove 25+ deprecated commands (beads, profiles, blueprints, task, old agent namespace)
-- `genie --session ` for named leader sessions
-
-### OUT
-
-- Changes to Claude Code's native teammate protocol
-- New messaging transport (still mailbox + native inbox)
-- Permission system / approve workflow (future sprint)
-- Watchdog replacement (future external service)
-- Sub-group task granularity (issue opened to monitor need)
-- Multi-project per agent
-- Changes to non-orchestration skills (brain, refine, learn, report)
-- Changes to build pipeline or bundler
-- `install.sh` review (separate effort)
-
-## Decisions
-
-| Decision | Rationale |
-|----------|-----------|
-| `--system-prompt-file` / `--append-system-prompt-file` | Hidden but confirmed working. Eliminates persistSystemPrompt + $(cat) pattern entirely |
-| One folder per agent | CWD = identity source. Simplest model. No home/project split |
-| Repo at team level, optional at agent level | Team repo overrides agent repo. All team members in same worktree |
-| Per-agent promptMode, model, roles in directory | Agent knows its own capabilities without relying on prompting |
-| No backward compat | Clean break. Old patterns replaced, not preserved alongside new |
-| Team name = branch name | `feat/agent-directory` is both the team name and the git branch. No translation |
-| Beads replaced by wish-native state file | Simpler, shared via worktree, no daemon/ledger/sync overhead |
-| State transitions via genie commands only | Agents never touch state file. Prevents abandonment. Leader tracks guarantees |
-| Agents ≠ Roles | Agents have identity. Roles are ephemeral built-ins. Dynamic orchestration decides who bosses whom |
-| Council: all or none | `genie team hire council` hires all 10. No per-member hiring |
-| Tasks die completely | Wish groups are the only unit of work. Monitor for sub-group need |
-| Naming: ls/rm/add consistently | Git-familiar conventions throughout |
-| `suspend` → `stop` | Clearer intent: stop current run, keep pane alive |
-| `close` + `ship` → `done` | Single state transition command |
-| Dispatch commands inject file path + extracted content | Agent gets full context without searching. Reduces token waste |
-
-## Success Criteria
-
-- [ ] `genie dir add/rm/ls/edit` fully operational, persists to `~/.genie/agent-directory.json`
-- [ ] `genie spawn ` resolves from directory, injects AGENTS.md via correct `--*-system-prompt-file` flag
-- [ ] `genie spawn implementor` works for built-in roles without directory registration
-- [ ] `genie team create feat/x --repo --branch dev` creates worktree, starts leader session
-- [ ] `genie team hire/fire` manages dynamic membership, `hire council` hires all 10
-- [ ] `genie team disband` kills members + cleans up worktree
-- [ ] `genie work #` checks deps → sets in_progress → spawns with context
-- [ ] `genie done #` transitions state, unblocks dependents
-- [ ] `genie status ` shows all groups with state/assignee/timestamps
-- [ ] `genie send` routes by name without `--team`, scoped to own team
-- [ ] `genie broadcast` delivers to all team members
-- [ ] `genie chat` / `genie chat read` posts to/reads team group channel
-- [ ] Message to offline registered agent triggers auto-spawn + delivery
-- [ ] 10 skill prompts updated to use `genie spawn` dispatch + acknowledge injected context
-- [ ] `/work` skill does NOT manage state — receives context, signals completion via message
-- [ ] `/council` supports lightweight (skill) and full spawn (team hire) modes
-- [ ] All `genie task *`, `genie profiles *`, `genie daemon *`, `genie ledger *` commands removed
-- [ ] `genie agent *` namespace removed — all promoted to top-level
-- [ ] `bun run check` passes
-- [ ] `bun run build` succeeds
-
-## Execution Groups
-
-### Group 1: Agent Directory Module
-
-**Goal:** Persistent agent registry with CRUD operations, replacing profiles.
-
-**Deliverables:**
-1. Create `src/lib/agent-directory.ts` — JSON registry at `~/.genie/agent-directory.json`
- - Schema: `{ name, dir, repo?, promptMode, model?, roles?, registeredAt }`
- - Public API: `add()`, `rm()`, `resolve()`, `ls()`, `edit()`, `loadIdentity()`
- - File-lock pattern (same as agent-registry.ts) for concurrent access
- - Path validation on `add` (dir must exist, AGENTS.md must exist in dir)
-2. Create built-in agents registry — `src/lib/builtin-agents.ts`
- - 10 built-in roles (implementor, tester, reviewer, debugger, verifier, investigator, reproducer, dreamer, critic, security)
- - Role prompts: derive from existing blueprint descriptions + Claude agent definitions in the codebase. Each role gets a short system prompt (1-2 paragraphs) defining its purpose, constraints, and output expectations.
- - 10 council members with default models and lens prompts (sourced from `skills/council/SKILL.md` member table)
- - Resolution: user directory > built-in registry
-3. Add CLI subcommands in new `src/term-commands/dir.ts`
- - `genie dir add --dir --repo --prompt-mode --model --roles`
- - `genie dir rm `
- - `genie dir ls []`
- - `genie dir edit --dir --repo --prompt-mode --model --roles`
-4. Remove `src/lib/team-manager.ts` blueprint system (BLUEPRINTS constant, getBlueprint, listBlueprints)
-5. Remove `genie profiles *` commands and related code (list, add, rm, show, default)
-6. Remove `genie team blueprints` command
-
-**Acceptance criteria:**
-- `genie dir add test-agent --dir /tmp/test --prompt-mode append` persists entry
-- `genie dir ls` lists all registered agents
-- `genie dir ls test-agent` shows entry details
-- `genie dir edit test-agent --model opus` updates entry
-- `genie dir rm test-agent` removes entry
-- `resolve("implementor")` returns built-in when no user override exists
-- `resolve("test-agent")` returns user entry (overrides built-in if same name)
-- Profiles commands no longer exist
-- `genie team blueprints` no longer exists
-
-**Validation:**
-```bash
-bun run typecheck
-bun test src/lib/agent-directory.test.ts
-bun test src/term-commands/dir.test.ts
-```
-
-**depends-on:** none
-
----
-
-### Group 2: Directory-Based Spawn
-
-**Goal:** `genie spawn ` resolves from directory, injects identity via native file flags.
-
-**Deliverables:**
-1. Modify `src/lib/provider-adapters.ts`
- - Add `systemPromptFile?: string` and `promptMode?: 'system' | 'append'` to `SpawnParams`
- - In `buildClaudeCommand()`: if `systemPromptFile` provided, add `--system-prompt-file` or `--append-system-prompt-file` based on `promptMode`
- - Add optional `model?: string` to SpawnParams, pass as `--model` flag
- - Remove `persistSystemPrompt()` from `team-lead-command.ts` and all callers
-2. Rewrite `genie spawn` in `src/term-commands/agents.ts`
- - Change signature: `genie spawn [--model] [--team]`
- - Resolution: directory.resolve(name) → if found, use entry. If not found, check built-in. If neither, error.
- - CWD: if agent in team → team worktree. If solo → entry.dir (or built-in default)
- - Identity: `loadIdentity(name)` → `--[append-]system-prompt-file /AGENTS.md`
- - Set `GENIE_AGENT_NAME=` in launch env
-3. Remove `--role` as required option (name is the primary arg)
-4. Update `src/lib/team-lead-command.ts` to use `--append-system-prompt-file` instead of `$(cat)` pattern
-
-**Acceptance criteria:**
-- `genie spawn test-agent` resolves from directory, CWD = dir, AGENTS.md injected via `--append-system-prompt-file`
-- `genie spawn test-agent --model opus` overrides directory default model
-- `genie spawn implementor` works for built-in roles (no registration needed)
-- Agent with `promptMode: 'system'` uses `--system-prompt-file`
-- Agent with `promptMode: 'append'` uses `--append-system-prompt-file`
-- `persistSystemPrompt()` and `$(cat)` pattern no longer exist in codebase
-
-**Validation:**
-```bash
-bun run typecheck
-grep -rn 'persistSystemPrompt\|\\$\\(cat' src/ && echo "FAIL: old pattern exists" || echo "PASS"
-bun test src/lib/provider-adapters.test.ts
-```
-
-**depends-on:** Group 1
-
----
-
-### Group 3: Team Lifecycle & Worktree Management
-
-**Goal:** Dynamic team creation with git worktree, hire/fire membership, disband with cleanup.
-
-**Deliverables:**
-1. Rewrite `src/lib/team-manager.ts`
- - New Team schema: `{ name, repo, baseBranch, worktreePath, leader, members[], createdAt }`
- - `createTeam(name, repo, baseBranch)`: git pull → git worktree add → persist team config
- - Worktree path: `/` (worktreeBase from config, default `.worktrees`)
- - Team name = branch name (e.g., `feat/agent-directory`)
- - `createTeam` is idempotent (re-running doesn't fail if team exists)
- - `hireAgent(teamName, agentName)`: add to members array. Special case: `council` hires all 10.
- - `fireAgent(teamName, agentName)`: remove from members, kill agent if running
- - `disbandTeam(teamName)`: kill all members, remove git worktree, delete team config
- - `getTeam()`, `listTeams()`, `listMembers()`
-2. Rewrite `src/term-commands/team.ts`
- - `genie team create --repo [--branch dev]`
- - `genie team hire [--team ]` — auto-detect team from leader context if no `--team`
- - `genie team hire council` — hire all 10 council members
- - `genie team fire [--team ]`
- - `genie team ls []` — no arg = teams, with arg = members
- - `genie team disband `
-3. Remove: `genie team ensure`, blueprint-related code
-4. Remove `genie _open [team]` hidden command (functionality absorbed by team create + session flow)
-5. Update genie config schema: ensure `terminal.worktreeBase` is supported (default: `.worktrees`)
-
-**Acceptance criteria:**
-- `genie team create feat/test --repo /path --branch dev` creates worktree at `/feat/test`, branch `feat/test` from `dev`
-- Re-running `team create` for existing team doesn't fail
-- `genie team hire agent-name` adds to team (auto-detects team from leader context)
-- `genie team hire council` adds all 10 council members
-- `genie team fire agent-name` removes from team
-- `genie team ls` lists all teams. `genie team ls feat/test` lists members
-- `genie team disband feat/test` kills members + removes worktree
-- `ensure` and `blueprints` commands no longer exist
-
-**Validation:**
-```bash
-bun run typecheck
-bun test src/lib/team-manager.test.ts
-bun test src/term-commands/team.test.ts
-```
-
-**depends-on:** Group 1
-
----
-
-### Group 4: Wish State Machine
-
-**Goal:** Replace beads with wish-native state file. Deterministic state transitions via genie commands only.
-
-**Deliverables:**
-1. Create `src/lib/wish-state.ts`
- - Schema: `WishState { wish, groups: Record }`
- - `GroupState { status: 'blocked'|'ready'|'in_progress'|'done', assignee?, dependsOn?, startedAt?, completedAt? }`
- - State file: `.genie/state/.json` in CWD (shared worktree)
- - `createState(slug, groups)`: initialize from wish group definitions
- - `startGroup(slug, group, assignee)`: check deps → set `in_progress` → write. Refuses if deps not met.
- - `completeGroup(slug, group)`: set `done` → recalculate dependent groups (blocked→ready)
- - `getState(slug)`: read current state
- - `getGroupState(slug, group)`: read single group
- - File-lock for concurrent access
-2. Add CLI commands (new `src/term-commands/state.ts` or inline in existing)
- - `genie done #` — calls `completeGroup()`
- - `genie status ` — pretty-prints all groups with status, assignee, timestamps
-3. Remove beads integration
- - Remove `genie daemon *` commands (start/stop/status/restart)
- - Remove `genie ledger *` commands (validate, work)
- - Remove `genie brainstorm crystallize` (beads JSONL integration)
- - Remove beads-related imports and references throughout codebase
- - Remove `bd` CLI calls from all commands (close, ship, work, etc.)
-
-**Acceptance criteria:**
-- State file created at `.genie/state/.json` with correct group structure
-- `startGroup` refuses when dependencies not met (returns error)
-- `startGroup` sets `in_progress` with timestamp and assignee
-- `completeGroup` sets `done`, recalculates dependent group statuses
-- `genie done slug#2` works from CLI
-- `genie status slug` shows readable state overview
-- No `bd` or beads references remain in codebase
-- `genie daemon *` and `genie ledger *` commands no longer exist
-
-**Validation:**
-```bash
-bun run typecheck
-bun test src/lib/wish-state.test.ts
-grep -rn '\bbd\b\|beads\|daemon\|ledger' src/ --include='*.ts' | grep -v test | grep -v '.genie/' && echo "FAIL: beads refs remain" || echo "PASS"
-```
-
-**depends-on:** none
-
----
-
-### Group 5: Dispatch Commands
-
-**Goal:** Context-injecting dispatch commands that bridge the state machine and agent spawn.
-
-**Deliverables:**
-1. Create `src/term-commands/dispatch.ts`
- - `genie brainstorm ` — reads `.genie/brainstorms//DRAFT.md`, spawns agent with content + file path injected, agent enters `/brainstorm`
- - `genie wish ` — reads `.genie/brainstorms//DESIGN.md`, spawns agent with design + file path, agent enters `/wish`
- - `genie work #` — reads `.genie/wishes//WISH.md`, extracts specific group, calls `wishState.startGroup()`, spawns agent with group context + wish file path
- - `genie review #` — reads wish group + git diff context, spawns agent with review scope
-2. Context injection pattern (shared utility):
- - Build prompt: file path to full document + extracted section content + wish-level context (summary, scope, decisions)
- - Pass via `--append-system-prompt` or temp file approach for long content
-3. Slug#group parsing utility: `parseRef("auth-bug#2")` → `{ slug: "auth-bug", group: "2" }`
-4. Integration with spawn: dispatch calls `spawn` internally after state check
-
-**Acceptance criteria:**
-- `genie brainstorm agent-name slug` spawns with DRAFT.md content + path injected
-- `genie wish agent-name slug` spawns with DESIGN.md content + path injected
-- `genie work agent-name slug#2` checks state → sets in_progress → spawns with group 2 content
-- `genie work agent-name slug#3` refuses if group 2 not done (dependency enforcement)
-- `genie review agent-name slug#2` spawns with group + diff context
-- All dispatch commands pass the file path so agent can read the full document
-
-**Validation:**
-```bash
-bun run typecheck
-bun test src/term-commands/dispatch.test.ts
-```
-
-**depends-on:** Group 2, Group 4
-
----
-
-### Group 6: Messaging Redesign
-
-**Goal:** Flat routing by name, team-scoped send, broadcast, group chat, auto-spawn.
-
-**Deliverables:**
-1. Rewrite `src/term-commands/msg.ts`
- - `genie send '' --to ` — resolve by name from directory (no `--team` needed)
- - Scope check: if sender is in a team, recipient must be in same team
- - Remove `--team` from send command
- - `genie broadcast ''` — leader sends to all team members (one-way)
- - `genie inbox [] [--unread]` — same functionality, improved resolution
-2. Create `src/lib/team-chat.ts`
- - Group channel per team: `/.genie/chat/.jsonl` (lives in shared worktree so all members can read)
- - `postMessage(team, sender, body)`: append to channel
- - `readMessages(team, since?)`: read channel history
-3. Add chat commands in `src/term-commands/msg.ts`
- - `genie chat '' [--team ]` — post to team channel (auto-detect team from context)
- - `genie chat read [--team ] [--since ]`
-4. Rewrite `src/lib/protocol-router.ts` for directory-first resolution
- - Resolution order: directory by name → built-in by name → worker registry fallback
- - Auto-spawn: if agent offline + in directory → spawn → deliver
-5. Update `src/hooks/handlers/auto-spawn.ts` for directory awareness
- - Check directory before templates for offline agent resolution
-
-**Acceptance criteria:**
-- `genie send 'hello' --to agent-name` delivers without `--team`
-- Send from team member to non-team-member is rejected (scope enforcement)
-- `genie broadcast 'update'` delivers to all members of sender's team
-- `genie chat 'discussion point'` posts to team channel
-- `genie chat read` shows channel history
-- Message to offline registered agent triggers auto-spawn + delivery
-- `--team` flag no longer exists on `send` command
-
-**Validation:**
-```bash
-bun run typecheck
-bun test src/term-commands/msg.test.ts
-bun test src/lib/protocol-router.test.ts
-bun test src/lib/team-chat.test.ts
-```
-
-**depends-on:** Group 1, Group 2, Group 3
-
----
-
-### Group 7: Command Promotion, Namespace Removal & Session
-
-**Goal:** Promote agent commands to top-level, remove `genie agent` namespace, add `--session`, implement `genie ls` smart view. Deprecated command removal is distributed across earlier groups (profiles in G1, blueprints/ensure/_open in G3, beads in G4). This group handles the remaining removals and the namespace restructure.
-
-**Deliverables:**
-1. Promote commands in `src/term-commands/agents.ts` and `src/genie.ts`
- - `genie spawn ` (was `genie agent spawn`) — already rewritten in G2
- - `genie kill ` (was `genie agent kill `)
- - `genie stop ` (was `genie agent suspend `) — rename suspend→stop
- - `genie history ` (was `genie agent history `)
- - `genie read ` (was `genie agent read `)
- - `genie answer ` (was `genie agent answer `)
- - All resolve by agent name, not pane ID or worker ID
-2. Remove remaining deprecated commands not handled by earlier groups
- - `genie agent dashboard`
- - `genie agent watchdog`
- - `genie agent approve`
- - `genie agent exec`
- - `genie agent ship`
- - `genie agent close`
- - `genie agent events` (keep internal module, remove CLI command)
- - `genie task *` (all 10: create, update, ship, close, ls, link, unlink, create-local, list-local, update-local)
- - `genie council` (old command — replaced by `genie team hire council` + skill)
-3. Remove `genie agent` namespace entirely — top-level commands only
-4. Add `genie --session ` to entry point for named leader sessions
- - Maintains name→UUID mapping internally
- - `genie --session mywork` starts a new named session
- - `genie --session mywork` again resumes it
-5. Implement `genie ls` smart view
- - Default: shows registered agents with runtime status (running/idle/offline) and current team
- - Output: `NAME | DIR | STATUS | TEAM | MODEL`
- - Built-in roles only shown when running (not in idle listing)
-
-**Acceptance criteria:**
-- All promoted commands work at top level: `genie kill`, `genie stop`, `genie history`, `genie read`, `genie answer`
-- `genie agent *` namespace no longer exists
-- `genie task *` namespace no longer exists
-- `genie --session mywork` starts a new named session
-- `genie --session mywork` again resumes the same session (identified by name, not UUID)
-- `genie ls` shows registered agents with runtime status and team membership
-- `genie stop ` stops current run but keeps pane alive
-- Old commands (dashboard, watchdog, approve, exec, ship, close, events, council) no longer exist
-
-**Validation:**
-```bash
-bun run typecheck
-grep -rn "command('agent')" src/ && echo "FAIL: agent namespace exists" || echo "PASS"
-grep -rn "command('task')" src/ && echo "FAIL: task namespace exists" || echo "PASS"
-grep -rn "command('profiles')" src/ && echo "FAIL: profiles namespace exists" || echo "PASS"
-```
-
-**depends-on:** Group 2, Group 3
-
----
-
-### Group 8: Council Refactor
-
-**Goal:** Council supports two modes — lightweight (skill in single session) and full spawn (real agents in team).
-
-**Deliverables:**
-1. Update built-in agents registry (`src/lib/builtin-agents.ts`) with council members
- - 10 members with: name, lens prompt (from current SKILL.md), default model
- - Smart routing table preserved (architecture, performance, security, etc.)
-2. Implement `genie team hire council` in team manager
- - Hires all 10 council members into the team
- - Each spawned with their lens prompt via `--append-system-prompt-file` (or inline for built-ins)
- - Default model per member (configurable at spawn)
-3. Update `/council` skill (SKILL.md) for dual-mode awareness
- - **Lightweight mode:** When run directly in a session, behaves as today (simulated perspectives)
- - **Full spawn mode:** When council members are hired in team, skill detects them and posts topic to team chat instead of simulating. Reads responses from chat. Leader makes final call.
-4. Remove old `genie council` command from `src/genie.ts` (replaced by team hire + skill)
-
-**Acceptance criteria:**
-- `genie team hire council` adds all 10 council members to team
-- Each council member spawns with correct lens prompt and default model
-- `/council` in lightweight mode works as before (simulated, single session)
-- `/council` in full spawn mode posts to team chat, council members respond independently
-- Old `genie council` command no longer exists
-
-**Validation:**
-```bash
-bun run typecheck
-bun test src/lib/builtin-agents.test.ts
-```
-
-**depends-on:** Group 1, Group 3, Group 6
-
----
-
-### Group 9: Skill Prompt Refinement
-
-**Goal:** Update 10 skill prompts to align with new orchestration model using `/refine`.
-
-**Deliverables:**
-Each skill gets a `/refine` pass to update:
-
-1. **brainstorm** — Multi-agent aware. Reads/writes shared worktree `.genie/`. Acknowledges injected context from dispatch. Handles concurrent editors.
-2. **wish** — Collaborative. Creates wish file + state group definitions in shared worktree. Back-and-forth via messaging.
-3. **work** — Does NOT manage state. Receives group context from dispatch. Signals completion to leader via `genie send`. Uses `genie spawn` for subagent dispatch. No `bd close`, no checkbox updates.
-4. **review** — Receives scope from dispatch. Council can participate via team chat. Uses `genie spawn` for dispatch.
-5. **fix** — Uses `genie spawn` for fixer/reviewer dispatch.
-6. **dream** — Uses new team/worktree model. Creates teams per wish. Uses `genie work` for dispatch. State machine for tracking.
-7. **council** — Dual-mode awareness (lightweight skill vs full spawn team).
-8. **trace** — Uses `genie spawn` for dispatch.
-9. **onboarding** — Update for new directory model, team model, session naming.
-10. **docs** — Uses `genie spawn` for dispatch.
-
-**Cross-cutting changes in all refined skills:**
-- Dispatch method: `genie spawn ` replaces `Task tool` / `genie agent spawn --role`
-- File paths: `.genie/` in shared worktree, not repo root
-- State management: skills do not manage state — transitions via `genie work`/`genie done`
-- Context injection: skills acknowledge injected context (file path + extracted section)
-- Role separation preserved: never combine implementor+reviewer, fixer+reviewer, tracer+fixer
-
-**Acceptance criteria:**
-- All 10 skill SKILL.md files updated
-- No skill references `genie agent spawn`, `Task tool`, `bd`, or beads
-- `/work` skill has zero state management logic (no checkboxes, no status writes)
-- `/brainstorm` and `/wish` reference shared worktree paths
-- `/council` skill documents both modes
-
-**Validation:**
-```bash
-grep -rn 'genie agent spawn\|Task tool\|\bbd\b\|beads' skills/ && echo "FAIL: old patterns" || echo "PASS"
-grep -rn 'checkbox\|Status.*SHIPPED\|bd close' skills/work/ && echo "FAIL: state mgmt in /work" || echo "PASS"
-```
-
-**depends-on:** Group 5, Group 7, Group 8
-
----
-
-### Group 10: Final Validation & Integration
-
-**Goal:** Full quality gates pass with all changes integrated.
-
-**Deliverables:**
-1. Run full check suite (`bun run check`)
-2. Run build (`bun run build`)
-3. Verify no stale references remain (beads, tui, old commands, old patterns)
-4. End-to-end smoke test: register agent → create team → hire → dispatch work → done → status
-5. Open GitHub issue: "Monitor need for sub-group task granularity"
-
-**Acceptance criteria:**
-- `bun run check` exits 0
-- `bun run build` succeeds
-- No beads/bd references in src/
-- No `genie agent` namespace in src/
-- No `persistSystemPrompt` or `$(cat)` pattern in src/
-- No profiles/blueprints code in src/
-- E2E flow works: dir add → team create → team hire → genie work → genie done → genie status
-
-**Validation:**
-```bash
-bun run check
-bun run build
-grep -rn 'persistSystemPrompt\|\\$\\(cat\|beads\|\bbd\b' src/ --include='*.ts' && echo "FAIL" || echo "PASS"
-grep -rn "command('agent')\|command('task')\|command('profiles')" src/ --include='*.ts' && echo "FAIL" || echo "PASS"
-```
-
-**depends-on:** Group 7, Group 8, Group 9
-
----
-
-## Dependency Graph
-
-```
-Group 1 (Directory) Group 4 (State Machine)
- │ │
- ├──→ Group 2 (Spawn) ──────┤
- │ │ │
- │ ├──→ Group 5 (Dispatch) ──→ Group 9 (Skills)
- │ │ │
- ├──→ Group 3 (Teams) ──→ Group 6 (Messaging) │
- │ │ │ │
- │ ├──→ Group 8 (Council) │
- │ │ │ │
- ├─────────┴──→ Group 7 (Promotion) ─────────┤
- │ │
- └───────────────────────────────→ Group 10 (Validation)
-```
-
-Parallelizable: Group 1 + Group 4 can start simultaneously.
-Group 2 + Group 3 can start once Group 1 is done.
-Group 5 can start once Group 2 + Group 4 are done.
-Group 6 can start once Group 1 + Group 2 + Group 3 are done.
-Group 7 can start once Group 2 + Group 3 are done (cleanup distributed to earlier groups).
-Group 8 can start once Group 1 + Group 3 + Group 6 are done.
-
-## Assumptions / Risks
-
-| Risk | Severity | Mitigation |
-|------|----------|------------|
-| `--system-prompt-file` undocumented, could break in Claude Code update | Medium | Test in CI. Confirmed working today. Fallback: `--system-prompt "$(cat)"` |
-| State file abandonment (agents don't run `genie done`) | High | State transitions are genie commands only. Orchestrator tracks at prompt level |
-| Concurrent worktree edits from multiple agents | Medium | Git handles conflicts. Wish groups scoped to non-overlapping files |
-| 10 skill prompts need /refine — high effort | Medium | Prioritize core chain (brainstorm→wish→work→review). Others incremental |
-| Council full spawn = 10 Claude sessions = cost | Low | Leader chooses subset via smart routing. Lightweight mode for cheap reviews |
-| Multi-team agent receives message — which context? | Medium | Send scoped to own team. Agent receives team context with dispatch |
-| Removing 25+ commands breaks existing agent workflows | Medium | Clean break is decided. No backward compat. Update all agent AGENTS.md |
-| beads removal leaves no task tracking for external integrations | Low | State file is the replacement. Issue opened for sub-group granularity if needed |
diff --git a/.genie/wishes/report-skill-plugin-rename/WISH.md b/.genie/wishes/report-skill-plugin-rename/WISH.md
deleted file mode 100644
index c749dcb2c..000000000
--- a/.genie/wishes/report-skill-plugin-rename/WISH.md
+++ /dev/null
@@ -1,218 +0,0 @@
-# Wish: Plugin rename, /debug -> /trace, new /report skill
-
-| Field | Value |
-|-------|-------|
-| **Status** | SHIPPED |
-| **Slug** | `report-skill-plugin-rename` |
-| **Date** | 2026-03-10 |
-| **Design** | [DESIGN.md](../../brainstorms/report-skill-plugin-rename/DESIGN.md) |
-| **depends-on** | `genie-default-command` (tui rename must land first to avoid double-editing files) |
-
-## Summary
-
-The plugin name `automagik-genie` is too verbose — skills show as `automagik-genie:brainstorm` instead of `genie:brainstorm`. The `/debug` skill conflicts with Claude Code's built-in debug. A new `/report` skill is needed that cascades through `/trace` (renamed `/debug`), opportunistically captures browser evidence (screenshots, video, console, network, perf), extracts observability data from project-configured tools (Sentry, PostHog, DataDog), and auto-creates a GitHub issue with all evidence attached.
-
-## Scope
-
-### IN
-
-- Rename plugin: `automagik-genie` -> `genie` in `plugin.json` and `cliff.toml`
-- Rename skill: `debug` -> `trace` (directory, SKILL.md frontmatter, all cross-references)
-- Rename agent: `plugins/genie/agents/debug.md` -> `plugins/genie/agents/trace.md`
-- Update `/fix` skill and agent references from `/debug` to `/trace`
-- Create new `/report` skill that cascades through `/trace` + browser + observability
-- `/report` auto-creates GitHub issues via `gh issue create`
-
-### OUT
-
-- No changes to agent-browser itself (use existing capabilities only)
-- No installation of Sentry/PostHog/DataDog SDKs or MCPs (use project-local config if present)
-- No changes to `/fix` skill logic (only update debug->trace references)
-- No changes to the plugin build system or openclaw.plugin.json (already uses id "genie")
-- No new CLI commands (these are skills, not genie CLI commands)
-- No changes to council agent definitions (council--tracer is a different concept)
-
-## Decisions
-
-| Decision | Rationale |
-|----------|-----------|
-| Plugin name: `genie` (clean break) | Few installs exist; clean break beats alias complexity |
-| `/debug` -> `/trace` | Avoids Claude built-in conflict; "trace" implies following evidence |
-| `/report` cascades through `/trace` | Reuse investigation logic; separation of concerns |
-| Browser investigation is opportunistic | Auto-detect URL/dev server; not every bug is UI-related |
-| Observability is project-dependent | Detect SENTRY_DSN, POSTHOG_KEY, DD_API_KEY, etc. and use what's available |
-| Auto-create GitHub issue | Reduces friction; the whole point is a ready-to-action issue |
-| Degrade gracefully without browser/observability | Code-level report is still valuable; don't block on missing tools |
-
-## Success Criteria
-
-- [ ] Skills show as `genie:trace`, `genie:brainstorm`, etc. (not `automagik-genie:`)
-- [ ] `/trace` works identically to old `/debug` (renamed, same behavior)
-- [ ] `/debug` no longer appears in skill list
-- [ ] `/fix` skill references `/trace` not `/debug`
-- [ ] `/report` produces a comprehensive bug report from user-provided symptoms
-- [ ] `/report` runs `/trace` as first step of investigation
-- [ ] `/report` captures screenshots when browser/URL is available
-- [ ] `/report` pulls observability data when project has Sentry/PostHog/DataDog configured
-- [ ] `/report` creates a GitHub issue via `gh issue create` with all evidence
-- [ ] `/report` degrades gracefully when browser or observability tools are missing
-- [ ] `bun run check` passes
-- [ ] No remaining references to `automagik-genie` in plugin files
-- [ ] No remaining references to `/debug` in any skill or agent definition
-
-## Execution Groups
-
-### Group 1: Plugin rename (automagik-genie -> genie)
-
-**Goal:** Skills show as `genie:*` instead of `automagik-genie:*`.
-
-**Deliverables:**
-1. Edit `plugins/genie/.claude-plugin/plugin.json` line 2: `"name": "automagik-genie"` -> `"name": "genie"`
-2. Edit `cliff.toml` line 40-41: update contributor attribution from `automagik-genie` to `genie`
-
-**Acceptance criteria:**
-- `grep -r 'automagik-genie' plugins/ cliff.toml` returns zero results
-- `openclaw.plugin.json` still has `"id": "genie"` (unchanged, already correct)
-
-**Validation:**
-```bash
-grep -rn 'automagik-genie' plugins/ cliff.toml && echo "FAIL" || echo "PASS"
-grep -n '"id": "genie"' openclaw.plugin.json && echo "PASS" || echo "FAIL"
-```
-
-### Group 2: Rename debug -> trace (skill + agent)
-
-**Goal:** Eliminate `/debug` naming, replace with `/trace` everywhere.
-
-**Deliverables:**
-1. Rename directory `skills/debug/` -> `skills/trace/`
-2. In `skills/trace/SKILL.md`:
- - Frontmatter: `name: debug` -> `name: trace`
- - Description: update to reference "trace" not "debug"
- - Title: `/debug` -> `/trace`
- - All internal references to "debug" -> "trace" where referring to this skill
- - Handoff text: "Hand off to `/fix`" (unchanged, but verify `/debug` isn't mentioned)
-3. Rename `plugins/genie/agents/debug.md` -> `plugins/genie/agents/trace.md`
- - Update agent name/description inside the file
-4. In `skills/fix/SKILL.md`:
- - Lines 12, 21: update `/debug` -> `/trace` references
- - Update any "debug subagent" -> "trace subagent" references
-5. In `plugins/genie/agents/fix.md`:
- - Line 3: update debug role reference to trace
-
-**Acceptance criteria:**
-- No directory `skills/debug/` exists
-- `grep -rn '/debug' skills/ plugins/genie/agents/` returns zero results (for skill references)
-- `/trace` skill frontmatter has `name: trace`
-- `/fix` skill references `/trace` for handoff
-
-**Validation:**
-```bash
-[ -d skills/debug ] && echo "FAIL: debug dir still exists" || echo "PASS"
-grep -rn '/debug' skills/ plugins/genie/agents/ | grep -v 'node_modules' && echo "FAIL" || echo "PASS"
-grep -n 'name: trace' skills/trace/SKILL.md && echo "PASS" || echo "FAIL"
-```
-
-### Group 3: Create /report skill
-
-**Goal:** New skill that produces comprehensive, evidence-rich bug reports and creates GitHub issues.
-
-**Deliverables:**
-1. Create `skills/report/SKILL.md` with the following structure:
-
-**Skill flow:**
-```
-Phase 1: Collect symptoms (user input — description, URL, error messages)
-Phase 2: Run /trace (code-level root cause investigation)
-Phase 3: Browser investigation (opportunistic)
- - Detect: URL provided? Dev server running on common ports (3000, 5173, 8080, etc.)?
- - If available: use agent-browser for:
- - Screenshot of affected page (annotated)
- - Full-page screenshot
- - Video recording of reproduction steps
- - Console log capture (errors, warnings)
- - Network waterfall (failed requests, timing)
- - Performance profile (if perf-related)
- - If unavailable: skip, note in report
-Phase 4: Observability data (project-dependent)
- - Detect project config for: Sentry (SENTRY_DSN, sentry.*.config.*),
- PostHog (POSTHOG_KEY), DataDog (DD_API_KEY), LogRocket, etc.
- - If found: use available API/CLI to pull recent errors, events, traces
- - If not found: skip gracefully
-Phase 5: Compile report
- - Merge /trace root cause analysis + browser evidence + observability data
- - Generate GitHub issue body with structured template
- - Attach screenshots/videos as assets
-Phase 6: Create GitHub issue
- - Verify gh auth status
- - gh issue create --title "" --body ""
- - If gh fails: print report to stdout as fallback
-```
-
-**GitHub issue template sections:**
-- Summary (1-2 sentences)
-- Reproduction Steps (numbered)
-- Expected vs Actual Behavior
-- Root Cause Analysis (from /trace: file, line, causal chain, confidence)
-- Evidence: Screenshots, Console Logs, Network, Performance, Observability
-- Environment (OS, runtime, browser, deps)
-- Suggested Fix (from /trace recommendation)
-- Labels: `bug`, plus auto-detected area labels
-
-**Degradation rules:**
-- No browser -> skip Phase 3, note "Browser evidence not available"
-- No observability tools -> skip Phase 4, note "No observability integrations detected"
-- No `gh` auth -> print report to stdout, suggest manual issue creation
-- No URL or dev server -> skip browser, rely on code-level trace only
-
-2. Add `report` to the skills index if one exists
-
-**Acceptance criteria:**
-- `skills/report/SKILL.md` exists with valid frontmatter (`name: report`)
-- Skill references `/trace` (not `/debug`) for code investigation
-- Skill references `agent-browser` for browser capabilities
-- Degradation paths documented for missing browser/observability/gh
-- GitHub issue template includes all evidence sections
-
-**Validation:**
-```bash
-[ -f skills/report/SKILL.md ] && echo "PASS" || echo "FAIL"
-grep -n 'name: report' skills/report/SKILL.md && echo "PASS" || echo "FAIL"
-grep -n '/trace' skills/report/SKILL.md && echo "PASS" || echo "FAIL"
-grep -n 'agent-browser' skills/report/SKILL.md && echo "PASS" || echo "FAIL"
-grep -n 'gh issue create' skills/report/SKILL.md && echo "PASS" || echo "FAIL"
-```
-
-### Group 4: Final validation
-
-**Goal:** All changes integrate cleanly.
-
-**Deliverables:**
-1. Verify no stale references remain
-2. Run quality gates
-
-**Acceptance criteria:**
-- No `automagik-genie` in plugin files
-- No `/debug` skill references in skills or agents
-- No `debug.md` agent file
-- `bun run check` passes
-
-**Validation:**
-```bash
-grep -rn 'automagik-genie' plugins/ cliff.toml && echo "FAIL: plugin name" || echo "PASS"
-grep -rn '/debug' skills/ plugins/genie/agents/ | grep -v node_modules && echo "FAIL: debug refs" || echo "PASS"
-[ -f plugins/genie/agents/debug.md ] && echo "FAIL: debug agent" || echo "PASS"
-bun run check
-```
-
-## Assumptions / Risks
-
-| Risk | Mitigation |
-|------|------------|
-| Plugin rename breaks existing installs | Clean break — users reinstall. Few installs currently. |
-| `/trace` name confusion with browser DevTools tracing | Context makes it clear — `/trace` = root cause investigation, not browser profiling |
-| agent-browser not available in all environments | Graceful degradation — skip browser evidence, note in report |
-| `gh` auth may not be configured | Fall back to printing report to stdout |
-| Observability API tokens may be expired/invalid | Try-catch each; skip and note in report |
-| Video recording produces large files for GH issues | Use screenshots as primary; video as supplementary |
-| `/report` SKILL.md is complex (multi-phase orchestration) | Keep each phase clearly documented with explicit detection + skip logic |
diff --git a/.genie/wishes/resolve-dev-desync/WISH.md b/.genie/wishes/resolve-dev-desync/WISH.md
deleted file mode 100644
index 56aef706a..000000000
--- a/.genie/wishes/resolve-dev-desync/WISH.md
+++ /dev/null
@@ -1,116 +0,0 @@
-# Wish: Resolve Dev Branch Desync After Worker→Agent Rename
-
-| Field | Value |
-|-------|-------|
-| **Status** | SHIPPED |
-| **Slug** | `resolve-dev-desync` |
-| **Date** | 2026-03-06 |
-
-## Summary
-
-Local dev branch has 9 uncommitted files from cascading dead-code cleanup (biome warning elimination round 2). Meanwhile, origin/dev advanced 8 commits including a major `Worker→Agent` type rename and `worker-registry.ts→agent-registry.ts` file rename. Need to commit local changes, rebase onto origin/dev, resolve conflicts, re-apply dead-code removals to renamed files, and verify all quality gates pass.
-
-## Scope
-
-### IN
-
-- Commit local dead-code cleanup changes on dev branch
-- Rebase onto origin/dev (8 commits behind)
-- Resolve conflict in `src/lib/beads-registry.ts` (local: dead-code removal + private heartbeat; upstream: Worker→Agent type rename)
-- Re-apply `countByTask` export removal to `src/lib/agent-registry.ts` (was `worker-registry.ts`)
-- Verify all cascading dead-code removals still apply after upstream changes
-- Run and pass all quality gates: typecheck, lint (0 warnings), dead-code (knip), tests (489/489)
-
-### OUT
-
-- No new feature work — this is purely a merge/sync operation
-- No additional refactoring beyond what's needed for the merge
-- No changes to upstream code that isn't part of conflict resolution
-
-## Decisions
-
-| Decision | Rationale |
-|----------|-----------|
-| Commit local changes first, then rebase | Preserves our work as a distinct commit; cleaner than stash-pop |
-| Rebase (not merge) | Keeps linear history on dev branch |
-| Re-apply dead-code removals to renamed files | `worker-registry.ts` → `agent-registry.ts` means our `countByTask` export removal needs to target the new filename |
-
-## Success Criteria
-
-- [ ] Local dev branch is up-to-date with origin/dev
-- [ ] All 9 local file changes are preserved (dead-code removals)
-- [ ] `bun run check` exits 0 (typecheck + lint + dead-code + tests)
-- [ ] `bunx biome check . --max-diagnostics=300` shows 0 warnings, 0 errors
-- [ ] `bun test` passes 489/489 (or more, if upstream added tests)
-- [ ] `git status` shows clean working tree
-- [ ] Changes are pushed to origin/dev
-
-## Execution Groups
-
-### Group 1: Commit & Rebase
-
-**Goal:** Get local dead-code cleanup committed and rebased onto origin/dev.
-
-**Deliverables:**
-1. Commit all 9 local file changes with descriptive message
-2. `git pull --rebase origin dev`
-3. Resolve conflicts:
- - `src/lib/beads-registry.ts`: Accept upstream Worker→Agent renames, keep local dead-code removals (delete `heartbeat` export, `listWorkers` function)
- - `src/lib/worker-registry.ts` → `src/lib/agent-registry.ts`: Apply `countByTask` export→private change to new filename
-
-**Acceptance criteria:**
-- Rebase completes without unresolved conflicts
-- `git log --oneline` shows local commit on top of upstream commits
-
-**Validation:**
-```bash
-git status # clean working tree
-git log --oneline -3 # local commit on top
-```
-
-### Group 2: Verify & Fix Cascading Issues
-
-**Goal:** Ensure all quality gates pass after rebase. Upstream changes may have introduced new dead code or broken our previous fixes.
-
-**Deliverables:**
-1. Run `bun run typecheck` — fix any type errors from merge
-2. Run `bunx biome check .` — fix any new warnings (upstream may have added code with warnings)
-3. Run `bun run dead-code` — fix any new dead exports
-4. Run `bun test` — all tests pass
-
-**Acceptance criteria:**
-- `bun run check` exits 0
-- 0 biome warnings
-- 0 knip findings
-
-**Validation:**
-```bash
-bun run check # exits 0
-bunx biome check . --max-diagnostics=300 2>&1 | grep -E 'warning|error' || echo "Clean"
-```
-
-### Group 3: Push
-
-**Goal:** Push resolved branch to remote.
-
-**Deliverables:**
-1. `git push origin dev`
-2. Verify `git status` shows up-to-date with origin
-
-**Acceptance criteria:**
-- Push succeeds
-- Branch is up-to-date with origin/dev
-
-**Validation:**
-```bash
-git status # "Your branch is up to date with 'origin/dev'"
-```
-
-## Assumptions / Risks
-
-| Risk | Mitigation |
-|------|------------|
-| Upstream may have re-introduced dead code we already cleaned | Group 2 re-runs knip and fixes new findings |
-| Worker→Agent rename may have broken imports we modified | Typecheck in Group 2 will catch this |
-| Upstream may have added new biome warnings | Group 2 re-runs biome and fixes |
-| Test count may have changed upstream | Accept whatever the new count is, as long as all pass |
diff --git a/.genie/wishes/unify-install-kill-fragmentation/WISH.md b/.genie/wishes/unify-install-kill-fragmentation/WISH.md
deleted file mode 100644
index c3b6b1ebc..000000000
--- a/.genie/wishes/unify-install-kill-fragmentation/WISH.md
+++ /dev/null
@@ -1,255 +0,0 @@
-# Wish: Unify Installation & Kill Prompt Fragmentation
-
-| Field | Value |
-|-------|-------|
-| **Status** | SHIPPED |
-| **Slug** | `unify-install-kill-fragmentation` |
-| **Date** | 2026-03-10 |
-
-## Summary
-
-Four redundant installers and three onboarding paths cause silent failures and confuse users. The orchestration prompt (`TEAM_LEAD_PROMPT.md`) silently fails to load in production bundles, causing Claude to launch without genie CLI knowledge. Unify everything so `curl | bash` does the complete install with zero interaction, the orchestration prompt lives in `~/.claude/rules/` (auto-loaded), and a new `promptMode` setting lets users choose between `--append-system-prompt` and `--system-prompt`.
-
-## Scope
-
-### IN
-
-- `install.sh`: remove all interactive confirmations, add tmux install, orchestration prompt injection, config defaults, tmux base-index config, plugin auto-install
-- `install.sh`: output clear next steps (`genie` command + `/onboarding`) without opening Claude Code
-- `smart-install.js`: add orchestration prompt injection + config defaults (for marketplace installs)
-- New setting `promptMode: 'append' | 'system'` in GenieConfigSchema
-- `buildTeamLeadCommand`: read `promptMode`, use correct CLI flag, stop loading TEAM_LEAD_PROMPT.md from filesystem
-- `session.ts`: fix misleading warning about missing system prompt
-- `setup.ts`: remove prereqs phase, add `promptMode` config phase
-- Delete `genie install` command (install.ts) and CLI router entry
-- Delete `install-genie-cli.sh`
-- Update `TEAM_LEAD_PROMPT.md` header to note it's source-of-truth for rules/ injection
-
-### OUT
-
-- No changes to `/onboarding` skill internals
-- No changes to `first-run-check.cjs` or `session-context.cjs`
-- No changes to hooks dispatch system (`src/hooks/`)
-- No changes to AGENTS.md loading logic (works via `process.cwd()`)
-- No new CLI commands
-- No changes to `genie uninstall` command
-
-## Decisions
-
-| Decision | Rationale |
-|----------|-----------|
-| Kill `genie install` (install.ts) | Redundant with install.sh + smart-install.js |
-| Kill `install-genie-cli.sh` | Redundant with smart-install.js |
-| install.sh stops asking confirmations | One command, zero interaction — user consented by piping curl to bash |
-| Orchestration prompt in `~/.claude/rules/` | Auto-loaded by Claude Code every session, zero flags, survives bundles |
-| `promptMode` default is `append` | Preserves CC default system prompt. `system` mode for personal assistant use cases |
-| install.sh never opens Claude Code | Often piped to Claude as a command. Outputs next steps for human/agent |
-| `/onboarding` stays as skill | Runs inside Claude via AskUserQuestion. Identity/workspace setup, not infra |
-
-## Success Criteria
-
-- [x] `curl -fsSL .../install.sh | bash` on a clean machine results in working genie with zero manual steps
-- [x] `~/.claude/rules/genie-orchestration.md` exists after install with TEAM_LEAD_PROMPT content
-- [x] `~/.genie/config.json` exists after install with `promptMode: 'append'`
-- [x] `~/.tmux.conf` has `base-index 0` and `pane-base-index 0` after install
-- [x] Claude Code plugin installed automatically (no confirmation prompt)
-- [x] tmux installed automatically if missing (via detected package manager)
-- [x] `genie command` launches Claude with orchestration knowledge (uses genie agent spawn, not Agent tool)
-- [x] `promptMode: 'system'` in config causes `--system-prompt` flag; `'append'` causes `--append-system-prompt`
-- [x] `genie install` command is gone (exits with deprecation message or doesn't exist)
-- [x] `install-genie-cli.sh` is deleted
-- [x] No `import.meta.url` path resolution for TEAM_LEAD_PROMPT.md remains anywhere
-- [x] `bun run check` passes (typecheck + lint + dead-code + tests)
-
-## Execution Groups
-
-### Group A: Delete dead code
-
-**Goal:** Remove redundant installers and the `genie install` CLI command.
-
-**Deliverables:**
-1. Delete `src/genie-commands/install.ts`
-2. Remove `genie install` command from CLI router in `src/genie.ts` (remove import + `.command('install')` block)
-3. Delete `plugins/genie/scripts/src/install-genie-cli.sh`
-4. Remove any imports/references to deleted files
-
-**Acceptance criteria:**
-- `genie install` is not a valid command (or prints deprecation)
-- No dangling imports
-- `bun run typecheck` passes
-
-**Validation:**
-```bash
-bun run typecheck
-grep -r 'install-genie-cli' src/ plugins/ && echo "FAIL: dangling ref" || echo "PASS"
-grep -r 'installCommand' src/genie.ts && echo "FAIL: still imported" || echo "PASS"
-```
-
-### Group B: Orchestration prompt to ~/.claude/rules/
-
-**Goal:** Move TEAM_LEAD_PROMPT content from filesystem-loaded .md to auto-injected rules file.
-
-**Deliverables:**
-1. In `install.sh`, add `inject_orchestration_prompt()` function that writes `TEAM_LEAD_PROMPT.md` content to `~/.claude/rules/genie-orchestration.md` (create `~/.claude/rules/` dir if needed)
-2. In `smart-install.js`, add same logic (for marketplace installs where install.sh wasn't used): write orchestration prompt to `~/.claude/rules/genie-orchestration.md`, re-write if plugin version changed
-3. In `src/lib/team-lead-command.ts`:
- - Remove `getTeamLeadPrompt()` function entirely
- - Remove `fileURLToPath`, `dirname` imports (if only used for prompt)
- - Update `persistSystemPrompt()` to only handle the AGENTS.md systemPrompt parameter (no more teamLeadPrompt concatenation)
-4. Update `TEAM_LEAD_PROMPT.md` with header comment noting it's source-of-truth, injected by install.sh/smart-install.js
-
-**Acceptance criteria:**
-- `getTeamLeadPrompt()` no longer exists
-- No `import.meta.url` usage for prompt loading
-- `persistSystemPrompt()` only writes AGENTS.md content
-- install.sh writes `~/.claude/rules/genie-orchestration.md`
-- smart-install.js writes same file on version change
-
-**Validation:**
-```bash
-grep -n 'import.meta.url' src/lib/team-lead-command.ts && echo "FAIL" || echo "PASS"
-grep -n 'getTeamLeadPrompt' src/lib/team-lead-command.ts && echo "FAIL" || echo "PASS"
-grep -n 'MANDATORY Agent Orchestration' install.sh && echo "PASS: prompt in install.sh" || echo "FAIL"
-bun run typecheck
-```
-
-### Group C: promptMode setting + buildTeamLeadCommand
-
-**Goal:** Add configurable prompt injection mode and wire it into the team-lead launch command.
-
-**Deliverables:**
-1. In `src/types/genie-config.ts`, add to GenieConfigSchema:
- ```typescript
- promptMode: z.enum(['append', 'system']).default('append'),
- ```
-2. In `src/lib/team-lead-command.ts`:
- - Import and load genie config
- - Read `promptMode` from config
- - Use `--append-system-prompt` when `promptMode === 'append'`
- - Use `--system-prompt` when `promptMode === 'system'`
-3. In `src/genie-commands/setup.ts`:
- - Remove prerequisites check phase
- - Add promptMode configuration phase (ask user, save to config)
-4. Update test expectations in `src/genie-commands/__tests__/tui.test.ts` (lines 58, 78) and `src/term-commands/msg.test.ts` (line 130): change `--system-prompt` assertions to `--append-system-prompt` for default promptMode. Add test case for `promptMode: 'system'` producing `--system-prompt` flag.
-
-**Acceptance criteria:**
-- `promptMode` is a valid field in GenieConfigSchema with default `'append'`
-- `buildTeamLeadCommand` output contains `--append-system-prompt` by default
-- `buildTeamLeadCommand` output contains `--system-prompt` when config has `promptMode: 'system'`
-- `genie setup` offers promptMode configuration
-- All existing tests updated and passing with new flag behavior
-
-**Validation:**
-```bash
-grep -n 'promptMode' src/types/genie-config.ts && echo "PASS" || echo "FAIL"
-grep -n 'append-system-prompt' src/lib/team-lead-command.ts && echo "PASS" || echo "FAIL"
-bun run typecheck
-bun test
-```
-
-### Group D: install.sh zero-touch upgrade
-
-**Goal:** Make install.sh do everything without asking. Add missing capabilities.
-
-**Deliverables:**
-1. Remove all `confirm()` / `confirm_no()` gated logic — just execute directly
-2. Add `install_tmux_if_needed()`: use `install_package tmux` (already has package manager detection)
-3. Add `create_default_config()`: write `~/.genie/config.json` with schema v2 defaults including `promptMode: 'append'` (skip if file already exists)
-4. Add `configure_tmux_defaults()`: append `set -g base-index 0` and `setw -g pane-base-index 0` to `~/.tmux.conf` if not already present
-5. In `offer_claude_plugin()`: remove confirmation, just install directly
-6. Update `print_success()`:
- ```
- ✔ Genie installed successfully!
-
- Get started:
- genie Launch genie
-
- First time? Genie will suggest /onboarding to set up your workspace.
- ```
-7. Update `output_agent_prompt()` with same next-steps info
-
-**Acceptance criteria:**
-- `install.sh` runs end-to-end with zero user prompts (no stdin reads)
-- tmux is installed if missing
-- `~/.tmux.conf` has base-index settings
-- `~/.genie/config.json` created with defaults
-- Claude Code plugin installed without confirmation
-- Output ends with `genie` command as next step
-
-**Validation:**
-```bash
-# Verify no interactive prompts remain
-grep -n 'confirm\|confirm_no\|read -r' install.sh | grep -v '^#' | grep -v 'function confirm' && echo "WARN: interactive reads found" || echo "PASS"
-grep -n 'genie-orchestration' install.sh && echo "PASS" || echo "FAIL"
-grep -n 'base-index' install.sh && echo "PASS" || echo "FAIL"
-grep -n 'promptMode' install.sh && echo "PASS" || echo "FAIL"
-```
-
-### Group E: smart-install.js maintenance mode + session.ts warning fix
-
-**Goal:** smart-install.js gains orchestration prompt injection for marketplace installs. Fix misleading session.ts warning.
-
-**Deliverables:**
-1. In `smart-install.js`:
- - Add function to write `~/.claude/rules/genie-orchestration.md` with the TEAM_LEAD_PROMPT content **inlined as a string constant** in the script (do NOT read from filesystem — the plugin root path varies by install method and the file may not be reachable)
- - Only rewrite if plugin version changed (use existing version marker)
- - Add function to create `~/.genie/config.json` with defaults if not exists
- - Add tmux base-index check/fix for `~/.tmux.conf`
-2. In `src/genie-commands/session.ts`:
- - Change warning at lines 199-200: AGENTS.md is informational, not a problem
- - Remove "Launching without --system-prompt" wording (orchestration is in rules/ now, always present)
-
-**Acceptance criteria:**
-- smart-install.js writes `~/.claude/rules/genie-orchestration.md` on first run or version change
-- smart-install.js creates default config if missing
-- session.ts warning no longer says "Launching without --system-prompt"
-- `bun run check` passes
-
-**Validation:**
-```bash
-grep -n 'genie-orchestration' plugins/genie/scripts/smart-install.js && echo "PASS" || echo "FAIL"
-grep -n 'without --system-prompt' src/genie-commands/session.ts && echo "FAIL: old warning" || echo "PASS"
-bun run check
-bun run build
-grep -c 'MANDATORY Agent Orchestration' dist/genie.js || true # Should be 0 (no longer inlined in bundle)
-```
-
-### Group F: Final validation
-
-**Goal:** Full quality gate pass and end-to-end verification.
-
-**Deliverables:**
-1. Run `bun run check` (typecheck + lint + dead-code + tests)
-2. Run `bun run build`
-3. Verify `~/.claude/rules/genie-orchestration.md` content matches TEAM_LEAD_PROMPT.md
-4. Verify install.sh runs without errors in dry-run
-
-**Acceptance criteria:**
-- `bun run check` exits 0
-- `bun run build` succeeds
-- No dead code flagged by knip for removed files
-- dist/genie.js does NOT contain `import.meta.url` path resolution for TEAM_LEAD_PROMPT
-
-**Validation:**
-```bash
-bun run check
-bun run build
-grep 'TEAM_LEAD_PROMPT' dist/genie.js && echo "WARN: still references file" || echo "PASS"
-```
-
-## Dependencies
-
-- `depends-on`: none
-- `blocks`: `fix-onboarding-prod-bugs` (supersedes — that wish is now obsolete)
-
-## Assumptions / Risks
-
-| Risk | Mitigation |
-|------|------------|
-| install.sh runs with sudo for tmux install — may fail in containers | Graceful fallback: warn but don't exit. tmux is needed for orchestration only |
-| Claude Code plugin install via `claude plugin` may fail if claude not in PATH | Check `command -v claude` first, skip with info message if not found |
-| `~/.claude/rules/` may not exist yet on fresh machines | `mkdir -p` before writing |
-| Existing `~/.genie/config.json` could have custom settings | Only write defaults if file doesn't exist — never overwrite |
-| smart-install.js runs on every session — must be fast | Guard with version marker — only do work if version changed |
-| Tests may reference `installCommand` or deleted files | Group A catches these via typecheck |
-| `--append-system-prompt` flag may not exist in older Claude Code versions | Check `claude --help` output or just use it — older CC ignores unknown flags gracefully |
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 1b0aee2fc..7faf8478e 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -67,3 +67,34 @@ jobs:
- name: Test
run: bun test || bun test
+
+ publish-next:
+ name: Publish @next
+ needs: [quality-gate]
+ if: github.event_name == 'push' && github.ref == 'refs/heads/dev'
+ runs-on: blacksmith-4vcpu-ubuntu-2404
+ timeout-minutes: 10
+ steps:
+ - uses: actions/checkout@v4
+
+ - uses: oven-sh/setup-bun@v2
+ with:
+ bun-version: "1.3.10"
+
+ - name: Install dependencies
+ run: bun install --frozen-lockfile
+
+ - name: Build
+ run: bun run build
+
+ - name: Publish to npm @next
+ env:
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
+ NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}
+ HUSKY: "0"
+ run: |
+ if [ -z "$NPM_TOKEN" ]; then
+ echo "NPM_TOKEN not set — skipping @next publish"
+ exit 0
+ fi
+ bun publish --tag next --access public
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index a7e33557c..e66611af5 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -11,7 +11,7 @@ permissions:
jobs:
release:
name: Create Release
- if: "!contains(github.event.head_commit.message, '[skip ci]')"
+ if: "!startsWith(github.event.head_commit.message, '[skip ci]')"
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 15
steps:
diff --git a/.github/workflows/rolling-pr.yml b/.github/workflows/rolling-pr.yml
index c9236c8af..2109621c1 100644
--- a/.github/workflows/rolling-pr.yml
+++ b/.github/workflows/rolling-pr.yml
@@ -39,10 +39,13 @@ jobs:
**Process:**
- This PR is automatically created and kept open
- - Agent monitors CI status and fixes issues
- Human reviews and merges when ready
- Label `ready-to-merge` added when all checks pass
+ > **IMPORTANT: Merge with "Create a merge commit" — NEVER squash.**
+ > Squash merging breaks history sync between dev and main,
+ > causing the next rolling PR to show all commits again.
+
> Human approval required for merge to production.
BODY
)"
diff --git a/.gitignore b/.gitignore
index 906c56ba3..0b8cca16e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -42,15 +42,22 @@ yarn-error.log*
.cache/
.temp/
-# Worker worktrees
-.genie/worktrees/
+# Legacy worktrees (now default to ~/.genie/worktrees/)
+.worktrees/
# Claude Code worktrees
.claude/worktrees/
+.worktrees/
# Worker registry (contains session IDs)
.genie/workers.json
+# Local genie state (not part of the package)
+.genie/agents.json
+.genie/teams/
+.genie/brainstorms/
+.genie/wishes/
+
# Team runtime state
.genie/mailbox/
.genie/tasks.json
diff --git a/.worktrees/.metadata.json b/.worktrees/.metadata.json
deleted file mode 100644
index e6f72cff0..000000000
--- a/.worktrees/.metadata.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "worktrees": {}
-}
\ No newline at end of file
diff --git a/.worktrees/feat-genie-cli-automation b/.worktrees/feat-genie-cli-automation
deleted file mode 160000
index 002cd2c6c..000000000
--- a/.worktrees/feat-genie-cli-automation
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 002cd2c6c1e13672cc19d3b4245480d135b3876b
diff --git a/.worktrees/workflow-rebrand b/.worktrees/workflow-rebrand
deleted file mode 160000
index 92c9a970c..000000000
--- a/.worktrees/workflow-rebrand
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 92c9a970c4c82a1173ba2323f9559929e8b8666b
diff --git a/CLAUDE.md b/CLAUDE.md
new file mode 100644
index 000000000..2e576dc89
--- /dev/null
+++ b/CLAUDE.md
@@ -0,0 +1,91 @@
+# Genie CLI
+
+## Commands
+
+```bash
+bun run check # Full gate: typecheck + lint + dead-code + test
+bun run build # Bundle to dist/genie.js (bun target, minified, single file)
+bun run typecheck # tsc --noEmit
+bun run lint # biome check .
+bun run dead-code # bunx knip (has pre-existing false positives for biome/commitlint/husky)
+bun test # All tests
+bun test src/lib/wish-state.test.ts # Single file
+```
+
+## Architecture
+
+```
+src/genie.ts CLI entry point (commander)
+src/lib/ Core modules (state, registry, locking, messaging, providers)
+src/term-commands/ CLI command handlers (agents, team, dispatch, msg, state, dir)
+src/hooks/ Git hook system (branch-guard, auto-spawn, identity-inject)
+src/genie-commands/ Setup/utility commands (setup, doctor, update, session)
+src/types/ Shared types (genie-config Zod schema)
+skills/ Skill prompt files (brainstorm, wish, work, review, etc.)
+```
+
+## State File Locations (CRITICAL — fragmented across 4 scopes)
+
+| State | Location | Scope | Format |
+|-------|----------|-------|--------|
+| Wish state | `/.genie/state/