From 98dce5ded49f7635324cff9085ccc8238d5b3869 Mon Sep 17 00:00:00 2001 From: Felipe Date: Sun, 5 Jul 2026 01:16:36 -0300 Subject: [PATCH 1/2] fix(plugin): register genie mcp server, stop stale v4 rules injection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit plugins/genie/.mcp.json (new) registers the stdio server 'genie mcp' — tools/list verified: genie_board, genie_wish_status, genie_worktree_context, genie_task, genie_active. smart-install.js no longer injects v4-era orchestration rules into ~/.claude/rules on SessionStart (this fought genie install's v4 cleanup and resurrected the stale file); rules/genie-orchestration.md rewritten lean-v5 plugin-native (59->20, zero dead verbs); review-criteria dead skill names fixed; tmux error string modernized. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01N1FLEV2Qse3jbX5Wz1sjWE --- plugins/genie/.mcp.json | 8 +++ plugins/genie/references/review-criteria.md | 4 +- plugins/genie/rules/genie-orchestration.md | 69 +++++-------------- plugins/genie/scripts/smart-install.js | 74 ++------------------- 4 files changed, 32 insertions(+), 123 deletions(-) create mode 100644 plugins/genie/.mcp.json diff --git a/plugins/genie/.mcp.json b/plugins/genie/.mcp.json new file mode 100644 index 000000000..7c395c898 --- /dev/null +++ b/plugins/genie/.mcp.json @@ -0,0 +1,8 @@ +{ + "mcpServers": { + "genie": { + "command": "genie", + "args": ["mcp"] + } + } +} diff --git a/plugins/genie/references/review-criteria.md b/plugins/genie/references/review-criteria.md index 6f2f4f9c9..eb1678cbd 100644 --- a/plugins/genie/references/review-criteria.md +++ b/plugins/genie/references/review-criteria.md @@ -60,8 +60,8 @@ For PASS criteria, evidence includes: ``` /wish → creates plan -/plan-review → validates plan structure -/make → executes plan +/review (plan mode) → validates plan structure +/work → executes plan /review → final validation → SHIP / FIX-FIRST / BLOCKED ``` diff --git a/plugins/genie/rules/genie-orchestration.md b/plugins/genie/rules/genie-orchestration.md index 939b06f82..07e1b4592 100644 --- a/plugins/genie/rules/genie-orchestration.md +++ b/plugins/genie/rules/genie-orchestration.md @@ -1,59 +1,20 @@ -# Genie CLI — Agent Orchestration +# Genie — Agent Orchestration (v5) +Genie is zero-daemon: docs live in git, task state in SQLite. Load `/genie` for full guidance. -Automagik Genie is installed. Load `/genie` to activate full orchestration guidance. - -## Essential Commands - -```bash -genie team create --repo --wish # Launch autonomous team -genie spawn # Spawn agent (engineer, reviewer, qa, fix) -genie send '' --to # Message cross-session agent -genie wish status # Check wish progress -genie events list --since 5m # Recent structured events -genie events timeline # Full entity event history -genie ls --json # Agent state from PG -``` - -## Tool Restrictions - -NEVER use `Agent` to spawn agents — use `genie spawn` instead. -NEVER use `TeamCreate` or `TeamDelete` — use `genie team create` / `genie team disband` instead. - -## Spawn Session Rule - -NEVER pass `--session ` to `genie spawn`. The team config already stores the correct `tmuxSessionName` (resolved at team creation from the parent session). Passing `--session` overrides this and creates a separate tmux session, breaking the topology. +## Dispatch — native teams +- Spawn workers with the **Agent tool**: one call per execution group, all groups in a single message for parallel waves; workers run in the background and notify on completion. +- Follow-ups via **SendMessage**; each worker's final report returns as its Agent tool result. Push, not poll. +- Multi-session cockpit: `genie launch [--groups ]` — one pane per ready group. +## Task DB — the shared truth ```bash -# WRONG — creates separate session -genie spawn reviewer --team my-team --session my-team - -# CORRECT — uses team's configured session -genie spawn reviewer --team my-team +genie task checkout --worker # worker atomically claims its task +genie task status # task detail + stage log +genie task list --json # all task state +genie board --wish --json # wish progress +genie task done # ORCHESTRATOR marks done, after review + validation ``` -The `--session` flag is for rare manual overrides only. When `--team` is set, let genie resolve the session from the team config. - -## Post-Dispatch Monitoring - -After `genie team create` or `genie spawn`, use ONLY structured primitives. A hook enforces this automatically. - -### DO — Structured monitoring -| Need | Command | -|------|---------| -| Wish progress | `genie wish status ` | -| Worker state | `genie ls --json` | -| Send instructions | `genie send '' --to ` | -| Event timeline | `genie events timeline ` | -| Error patterns | `genie events errors` | - -### NEVER — Terminal scraping -- `tmux capture-pane` to check worker progress (BLOCKED by hook) -- `sleep` + poll loops to watch terminal output (BLOCKED by hook) -- Raw terminal text parsing for workflow decisions - -### Post-dispatch flow -1. **Dispatch** — `genie team create` or `genie spawn` -2. **Trust** — workers execute autonomously, report via PG events -3. **Check** — `genie wish status ` for progress -4. **Communicate** — `genie send` for instructions -5. **Review** — when workers report done, review output +## Never +- Terminal-scrape (`tmux capture-pane`) or sleep-poll workers — use the primitives above; a hook nudges this. +- Workers marking their own tasks done — `done` is the orchestrator's verb, post-review. diff --git a/plugins/genie/scripts/smart-install.js b/plugins/genie/scripts/smart-install.js index 6cf745cc5..05910f09f 100644 --- a/plugins/genie/scripts/smart-install.js +++ b/plugins/genie/scripts/smart-install.js @@ -239,60 +239,10 @@ function genieCliNeedsInstall() { } -/** - * Read the current marker version (before installDeps overwrites it). - * Returns the version string or null if not found. - */ -function getMarkerVersion() { - try { - if (existsSync(MARKER)) { - const marker = JSON.parse(readFileSync(MARKER, 'utf-8')); - return marker.version || null; - } - } catch { - // Ignore - } - return null; -} - -/** - * Inject the orchestration prompt into ~/.claude/rules/genie-orchestration.md - * Reads from the rules file in the plugin directory. - * Only writes/rewrites if the plugin version changed. - * @param {string|null} oldVersion - marker version captured before installDeps ran - */ -function injectOrchestrationPrompt(oldVersion) { - const rulesDir = join(homedir(), '.claude', 'rules'); - const destFile = join(rulesDir, 'genie-orchestration.md'); - - if (!existsSync(rulesDir)) { - mkdirSync(rulesDir, { recursive: true }); - } - - let pluginVersion = null; - try { - const pkg = JSON.parse(readFileSync(join(ROOT, 'package.json'), 'utf-8')); - pluginVersion = pkg.version || null; - } catch { - // Ignore - } - - const fileExists = existsSync(destFile); - const versionChanged = !fileExists || oldVersion !== pluginVersion; - - if (versionChanged) { - const sourceFile = join(ROOT, 'rules', 'genie-orchestration.md'); - if (existsSync(sourceFile)) { - const content = readFileSync(sourceFile, 'utf-8'); - writeFileSync(destFile, content, 'utf-8'); - console.error(`Orchestration rules installed: ${destFile}`); - } else { - // Fallback: write minimal inline message - writeFileSync(destFile, '# Genie CLI\n\nUse `genie` CLI for all agent operations. Never use native Agent/SendMessage tools.\n', 'utf-8'); - console.error(`Orchestration rules installed (fallback): ${destFile}`); - } - } -} +// NOTE: this script used to copy rules/genie-orchestration.md into +// ~/.claude/rules/ on version change. That injection is gone: the rules file +// is plugin-native (loaded from the plugin itself), and the copy kept +// resurrecting a file that `genie install`'s v4 cleanup deletes. /** * Create default ~/.genie/config.json with schema v2 defaults if missing. @@ -456,7 +406,7 @@ try { if (!isTmuxInstalled()) { console.error(''); console.error('WARNING: tmux is not installed.'); - console.error('tmux is required for agent orchestration (genie spawn, teams, etc.).'); + console.error('tmux is required for the genie launch cockpit and TUI integration.'); console.error('Non-interactive features still work without it.'); console.error(''); console.error('Install tmux:'); @@ -474,30 +424,20 @@ try { // Don't exit — let the rest of the chain run } - // Capture marker version BEFORE installDeps overwrites it - const oldVersion = getMarkerVersion(); - // 3. Install plugin dependencies if needed if (needsInstall()) { installDeps(); console.error('Dependencies installed'); } - // 3a. Inject orchestration prompt (idempotent — checks version marker) - try { - injectOrchestrationPrompt(oldVersion); - } catch (e) { - console.error(`Warning: Could not write orchestration prompt: ${e.message}`); - } - - // 3b. Create default config if missing (idempotent — never overwrites) + // 3a. Create default config if missing (idempotent — never overwrites) try { createDefaultConfig(); } catch (e) { console.error(`Warning: Could not create default config: ${e.message}`); } - // 3c. Configure tmux TUI (scripts + config on first run) + // 3b. Configure tmux TUI (scripts + config on first run) try { configureTmux(); } catch (e) { From cced8b5edee48ec387950067b448693a13ac60f3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 5 Jul 2026 04:18:32 +0000 Subject: [PATCH 2/2] chore(version): bump to 5.260705.5 [auto-version] --- .claude-plugin/marketplace.json | 2 +- package.json | 2 +- plugins/genie/.claude-plugin/plugin.json | 2 +- plugins/genie/package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index ebc6c0422..5d54b282b 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -10,7 +10,7 @@ "plugins": [ { "name": "genie", - "version": "5.260705.4", + "version": "5.260705.5", "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/package.json b/package.json index ecc956af8..7a9756991 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@automagik/genie", - "version": "5.260705.4", + "version": "5.260705.5", "description": "Collaborative terminal toolkit for human + AI workflows. NOTE: npm distribution discontinued 2026-05-09 — install via `curl -fsSL https://raw.githubusercontent.com/automagik-dev/genie/main/install.sh | bash` (cosign + SLSA verified). See https://automagik.dev/genie/release-process", "type": "module", "bin": { diff --git a/plugins/genie/.claude-plugin/plugin.json b/plugins/genie/.claude-plugin/plugin.json index b83cd19a0..130d54621 100644 --- a/plugins/genie/.claude-plugin/plugin.json +++ b/plugins/genie/.claude-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "genie", - "version": "5.260705.4", + "version": "5.260705.5", "description": "Human-AI partnership for Claude Code. Share a terminal, orchestrate workers, evolve together. Brainstorm ideas, turn them into wishes, execute with /work, validate with /review, and ship as one team.", "author": { "name": "Namastex Labs" diff --git a/plugins/genie/package.json b/plugins/genie/package.json index 2be1c9e5f..eed282b13 100644 --- a/plugins/genie/package.json +++ b/plugins/genie/package.json @@ -1,6 +1,6 @@ { "name": "genie-plugin", - "version": "5.260705.4", + "version": "5.260705.5", "private": true, "description": "Runtime dependencies for genie bundled CLIs", "type": "module",