Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion plugins/genie/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
8 changes: 8 additions & 0 deletions plugins/genie/.mcp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"mcpServers": {
"genie": {
"command": "genie",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use a non-PATH-dependent MCP command

On installs where genie is not on the non-interactive PATH, this static plugin MCP config registers a server that Claude cannot spawn. The existing project registration path explicitly avoids bare genie and writes process.execPath because the binary may only live under ~/.genie/bin (src/term-commands/init.ts lines 156-165, README lines 115-120), so users can have a valid install while this plugin-level server still fails. Use an absolute or shell-resolved command here, or rely on the genie init/launch generated MCP configs.

Useful? React with 👍 / 👎.

"args": ["mcp"]
Comment on lines +4 to +5

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Use the absolute executable path here.

Hard-coding genie makes this config PATH-dependent and breaks the same contract that registerMcpConfigs() and its tests enforce: the MCP server should launch via an absolute executable path, not a bare name.

Suggested fix
-      "command": "genie",
+      "command": "<absolute genie path>",

As per path instructions, verify plugin manifest updates are consistent.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugins/genie/.mcp.json` around lines 4 - 5, The MCP config is still using a
PATH-dependent bare command name instead of an absolute executable path. Update
the genie MCP entry in the manifest to use the full executable path for the
command while keeping the existing args, and make sure the plugin manifest stays
consistent with the contract enforced by registerMcpConfigs() and its tests.

Source: Path instructions

}
}
}
2 changes: 1 addition & 1 deletion plugins/genie/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 2 additions & 2 deletions plugins/genie/references/review-criteria.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down
69 changes: 15 additions & 54 deletions plugins/genie/rules/genie-orchestration.md
Original file line number Diff line number Diff line change
@@ -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 <name> --repo <path> --wish <slug> # Launch autonomous team
genie spawn <role> # Spawn agent (engineer, reviewer, qa, fix)
genie send '<msg>' --to <agent> # Message cross-session agent
genie wish status <slug> # Check wish progress
genie events list --since 5m # Recent structured events
genie events timeline <entity-id> # 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 <team-name>` 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 <slug> [--groups <csv>]` — 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 <id> --worker <name> # worker atomically claims its task
genie task status <id> # task detail + stage log
genie task list --json # all task state
genie board --wish <slug> --json # wish progress
genie task done <id> # 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 <slug>` |
| Worker state | `genie ls --json` |
| Send instructions | `genie send '<msg>' --to <agent>` |
| Event timeline | `genie events timeline <id>` |
| 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 <slug>` 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.
74 changes: 7 additions & 67 deletions plugins/genie/scripts/smart-install.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Comment on lines +242 to +245

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Remove stale global orchestration rules during upgrade

When a user upgrades the plugin from the previous release without re-running genie install, this removal leaves the previously injected ~/.claude/rules/genie-orchestration.md in place. That file was written by this hook and contains the old genie spawn/genie team create/“NEVER use Agent” guidance; the cleanup this comment relies on is only in the genie install finisher (src/genie-commands/install.ts lines 2-7), not in SessionStart. In that upgrade path Claude keeps loading a stale global rule that conflicts with the new plugin-native v5 guidance, so the hook should delete marker-matched rules or invoke the cleanup instead of only stopping the copy.

Useful? React with 👍 / 👎.


/**
* Create default ~/.genie/config.json with schema v2 defaults if missing.
Expand Down Expand Up @@ -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:');
Expand All @@ -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) {
Expand Down
Loading