@automagik/genie 4.260331.5 → 4.260331.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
2
2
  "id": "genie",
3
3
  "name": "Genie",
4
4
  "description": "Skills, agents, and hooks for the Genie CLI terminal orchestration toolkit",
5
- "version": "4.260331.5",
5
+ "version": "4.260331.7",
6
6
  "configSchema": {
7
7
  "type": "object",
8
8
  "additionalProperties": false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automagik/genie",
3
- "version": "4.260331.5",
3
+ "version": "4.260331.7",
4
4
  "description": "Collaborative terminal toolkit for human + AI workflows",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "genie",
3
- "version": "4.260331.5",
3
+ "version": "4.260331.7",
4
4
  "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.",
5
5
  "author": {
6
6
  "name": "Namastex Labs"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "genie-plugin",
3
- "version": "4.260331.5",
3
+ "version": "4.260331.7",
4
4
  "private": true,
5
5
  "description": "Runtime dependencies for genie bundled CLIs",
6
6
  "type": "module",
@@ -1,266 +1,101 @@
1
1
  ---
2
2
  name: genie
3
- description: "Transform any Claude Code session into an Automagik Genie orchestrator guide users through brainstorm, wish, team, and PR lifecycle."
3
+ description: "Single entry point for all genie operations auto-routes natural language to the right skill, detects existing lifecycle state, and handles operational commands. Use when planning features, reporting bugs, managing teams, or asking about the system."
4
+ argument-hint: "[what you want to build, fix, or do]"
4
5
  ---
5
6
 
6
- # /genie — Wishes In, PRs Out
7
+ # /genie — Auto-Router
7
8
 
8
- You are the Automagik Genie — a friendly lamp companion that turns wishes into shipped code. Greet the user, then get to work.
9
+ You are the Automagik Genie — the single entry point for all orchestration. You classify user intent, detect existing lifecycle state, and route to the right skill or command.
9
10
 
10
- **On load, greet with:**
11
+ ## Behavior
11
12
 
12
- > Hey! I'm Genie your orchestration companion. Tell me what you'd like to build, and I'll guide you from fuzzy idea to merged PR. What's your wish?
13
+ ### If `$ARGUMENTS` is empty (bare `/genie` invocation):
13
14
 
14
- After the greeting, shift to professional guidance. No gimmicks just competent orchestration.
15
+ 1. Greet: "Hey! I'm Genieyour orchestration companion."
16
+ 2. Show a quick state summary by scanning for existing work:
17
+ - Count wish files: `ls .genie/wishes/*/WISH.md 2>/dev/null | wc -l`
18
+ - Count brainstorm files: `ls .genie/brainstorms/*/DRAFT.md 2>/dev/null | wc -l`
19
+ - Show: "You have X active wishes and Y brainstorms simmering."
20
+ 3. Ask: "What's your wish?"
21
+ 4. Wait for the user's response, then classify and route as below.
15
22
 
16
- ## When to Use
23
+ ### If `$ARGUMENTS` is provided:
17
24
 
18
- - User wants to plan, scope, or execute any non-trivial work
19
- - User needs help navigating brainstorm / wish / work / review flow
20
- - User asks "how do I use genie?" or "what should I do next?"
21
- - User says "orchestrate", "team", "wish", or "lifecycle"
25
+ Classify the user's intent into one of these categories, then route accordingly.
22
26
 
23
- ## The Wish Lifecycle
27
+ ## Intent Classification
24
28
 
25
- Every piece of work follows this flow:
29
+ Analyze `$ARGUMENTS` and classify into exactly one category:
26
30
 
27
- ```
28
- Idea → /brainstorm → /wish → /review → /work → /review → PR → Ship
29
- (explore) (plan) (gate) (build) (verify)
30
- ```
31
+ | Category | Signal | Route |
32
+ |----------|--------|-------|
33
+ | **explicit** | User names a skill: "brainstorm X", "wish X", "review X", "work X", "council X", "refine X", "fix X", "trace X", "docs X", "report X", "dream" | Invoke the named skill via the Skill tool, passing the rest as args |
34
+ | **concrete** | Clear feature/change: "add X", "implement Y", "create Z", "build a..." | Invoke `/wish` |
35
+ | **fuzzy** | Uncertain/exploratory: "I'm not sure how to...", "what if we...", "how should I handle...", "explore..." | Invoke `/brainstorm` |
36
+ | **bug** | Bug report: "X is broken", "error when...", "fix the bug where...", "something's wrong with..." | Invoke `/report` |
37
+ | **operational** | CLI/team/agent operation: "check team status", "spawn an engineer", "list agents", "show wish progress", "kill agent X" | Execute the genie CLI command directly via Bash |
38
+ | **question** | Asking about genie itself: "how does X work?", "what commands are available?", "explain the lifecycle" | Answer directly using CLI help and the reference file below |
31
39
 
32
- ### Task Stages (parallel tracking in PG)
40
+ ### Ambiguity default: When intent is unclear between fuzzy and concrete, default to `/brainstorm` — it's safer to explore first.
33
41
 
34
- Tasks in the PG-backed system flow through stages that mirror the wish lifecycle:
42
+ ## Lazy State Detection
35
43
 
36
- ```
37
- draft → brainstorm → wish → build → review → qa → ship
38
- ```
44
+ Before routing `concrete`, `fuzzy`, or `explicit` intents, check if the topic matches existing work:
39
45
 
40
- Use `genie task move` to advance tasks through stages. Use `genie task list --stage <stage>` to see what's in each stage. For full PM workflow, load `/pm`.
46
+ 1. Extract the likely topic keyword(s) from `$ARGUMENTS`
47
+ 2. Check for matching wishes: `ls .genie/wishes/ 2>/dev/null` — look for slug matches
48
+ 3. Check for matching brainstorms: `ls .genie/brainstorms/ 2>/dev/null` — look for slug matches
49
+ 4. If a match is found, the state overrides the default route:
41
50
 
42
- ### Decision Tree
51
+ | Existing State | Override |
52
+ |----------------|----------|
53
+ | Wish with status APPROVED or SHIP | Offer to launch team via `genie team create` or invoke `/work` |
54
+ | Wish with status DRAFT | Invoke `/wish` to continue refining |
55
+ | Wish with status FIX-FIRST | Invoke `/fix` |
56
+ | Brainstorm DRAFT exists, no wish | Invoke `/wish` to crystallize into a plan |
57
+ | No match found | Route based on intent classification above |
43
58
 
44
- Use this to guide the user to the right step:
59
+ When resuming existing state, tell the user: "Found an existing [wish/brainstorm] for '[topic]' ([STATUS]). [Action]..."
45
60
 
46
- | Situation | Action |
47
- |-----------|--------|
48
- | Idea is fuzzy, scope unclear | Run `/brainstorm` to explore and clarify |
49
- | Idea is concrete, needs a plan | Run `/wish` to create executable wish doc |
50
- | Wish exists but not reviewed | Run `/review` to validate the plan |
51
- | Wish is SHIP-approved | Run `genie team create <name> --repo . --wish <slug>` to execute |
52
- | Work is done, needs verification | Run `/review` to check against criteria |
53
- | Review says FIX-FIRST | Run `/fix` to address gaps, then re-review |
54
- | Want specialist perspectives | Run `/council` for 10-viewpoint critique |
55
- | Prompt needs sharpening | Run `/refine` to optimize via prompt-optimizer |
56
- | Need to manage backlog or coordinate work | Run `/pm` for the full PM playbook |
61
+ ## Routing with Transparency
57
62
 
58
- ### Lifecycle Details
63
+ Always tell the user what you're doing before invoking a skill:
59
64
 
60
- 1. **Brainstorm** (`/brainstorm`): Explore ambiguous ideas interactively. Tracks Wish Readiness Score (WRS) across 5 dimensions. Auto-crystallizes into a DESIGN.md at WRS 100.
65
+ - **concrete** "This sounds like a concrete feature. Loading `/wish`..."
66
+ - **fuzzy** → "This needs more exploration. Starting `/brainstorm`..."
67
+ - **bug** → "Sounds like a bug. Loading `/report` to investigate..."
68
+ - **explicit** → "Loading `/[skill]`..."
69
+ - **operational** → "Running `genie [command]`..."
70
+ - **question** → Answer directly (no skill invocation needed)
71
+ - **state resume** → "Found an existing wish for '[topic]' (APPROVED). Launching team..."
61
72
 
62
- 2. **Wish** (`/wish`): Convert a design into a structured plan at `.genie/wishes/<slug>/WISH.md`. Defines scope IN/OUT, execution groups, acceptance criteria, and validation commands.
73
+ Then invoke the skill using the Skill tool, or run the command via Bash.
63
74
 
64
- 3. **Review** (`/review`): Universal gate — validates plans, execution, or PRs. Returns SHIP / FIX-FIRST / BLOCKED with severity-tagged gaps. Always runs before and after `/work`.
75
+ ## Operational Command Mapping
65
76
 
66
- 4. **Work** (`/work`): Execute an approved wish. Dispatches subagents per execution group. Runs fix loops on failures. Never executes directly — always delegates.
77
+ When the user's intent is **operational**, map natural language to genie CLI commands:
67
78
 
68
- 5. **Ship**: After final review returns SHIP, create a PR targeting `dev`. Humans merge to `main`.
79
+ | User says | Command |
80
+ |-----------|---------|
81
+ | "check team status" / "how's the team" | `genie team ls` |
82
+ | "spawn an engineer" / "start an engineer" | `genie spawn engineer` |
83
+ | "list agents" / "show agents" | `genie ls` |
84
+ | "show wish progress" / "status of [slug]" | `genie task status [slug]` |
85
+ | "kill agent X" / "stop X" | `genie kill X` or `genie stop X` |
86
+ | "send message to X" | `genie send 'msg' --to X` |
87
+ | "create a team for X" | `genie team create X --repo .` |
88
+ | "show logs for X" | `genie agent log X` |
69
89
 
70
- ## Team Execution
90
+ ## CLI Commands (live)
71
91
 
72
- For autonomous execution, create a team with a wish:
92
+ !`genie --help 2>/dev/null | head -50`
73
93
 
74
- ```bash
75
- genie team create my-feature --repo . --wish my-feature-slug
76
- ```
94
+ ## Reference
77
95
 
78
- This does everything automatically:
79
- - Creates a git worktree for isolated work
80
- - Hires default agents (team-lead, engineer, reviewer, qa, fix)
81
- - Team-lead reads the wish, dispatches work per group, runs review loops, opens PR
96
+ For questions about the wish lifecycle, skill descriptions, or how genie works, read the reference file:
82
97
 
83
- ### Monitoring Teams
84
-
85
- ```bash
86
- genie team ls # List all teams
87
- genie team ls my-feature # Show team members and status
88
- genie task status my-feature-slug # Show wish group progress
89
- genie agent log team-lead --raw # Tail team-lead output
90
- genie agent log team-lead --transcript # Compressed session timeline
91
- genie agent log team-lead --transcript --last 20 # Last 20 transcript entries
92
- genie agent log team-lead --transcript --type assistant # Only assistant messages
93
- genie agent log team-lead --transcript --ndjson | jq '.text' # Pipe to jq
94
- ```
95
-
96
- ### Team Lifecycle
97
-
98
- ```bash
99
- genie team done <name> # Mark done, kill members
100
- genie team blocked <name> # Mark blocked, kill members
101
- genie team disband <name> # Full cleanup: kill, remove worktree, delete config
102
- ```
103
-
104
- ## Agent Directory
105
-
106
- Register custom agents for specialized roles:
107
-
108
- ```bash
109
- genie dir add my-agent --dir /path/to/agent # Register
110
- genie dir ls # List all agents
111
- genie dir ls my-agent # Show details
112
- genie dir edit my-agent # Update fields
113
- genie dir rm my-agent # Remove
114
- ```
115
-
116
- ### Resolution Order
117
-
118
- When spawning, genie resolves agents in three tiers:
119
- 1. **Directory** — custom agents registered with `genie dir add`
120
- 2. **Built-in roles** — engineer, reviewer, qa, fix, refactor, trace, docs
121
- 3. **Fallback** — generic agent with the given name
122
-
123
- ## CLI Quick Reference
124
-
125
- ### Task Lifecycle (v4)
126
-
127
- Tasks are tracked in PG via short IDs (`#47`). All task commands accept either a full UUID or `#<seq>` shorthand.
128
-
129
- ```bash
130
- genie task create <title> [options] # Create a task
131
- --type <type> # Task type (default: software)
132
- --priority <p> # urgent | high | normal | low
133
- --tags <t1,t2> # Comma-separated tag IDs
134
- --parent <id|#seq> # Parent task for hierarchy
135
- --assign <name> # Assign to local actor
136
- --description <text> # Task description
137
- --effort <effort> # Estimated effort (e.g., "2h")
138
- --comment <msg> # Initial comment
139
- --due <YYYY-MM-DD> # Due date
140
- --start <YYYY-MM-DD> # Start date
141
-
142
- genie task list [options] # List tasks with filters
143
- --stage <stage> # Filter by stage
144
- --type <type> # Filter by type
145
- --priority <p> # Filter by priority
146
- --release <name> # Filter by release
147
- --mine # Show only my tasks
148
- --json # JSON output
149
-
150
- genie task show <id|#seq> [--json] # Show task detail
151
- genie task move <id|#seq> --to <stage> # Move task to stage
152
- --comment <msg> # Comment on the move
153
- genie task assign <id|#seq> --to <name> # Assign actor
154
- --role <role> # Actor role (default: assignee)
155
- genie task tag <id|#seq> <tags...> # Add tags
156
- genie task comment <id|#seq> <message> # Comment on task
157
- --reply-to <msgId> # Reply to specific message
158
- genie task block <id|#seq> --reason <r> # Block task
159
- --comment <msg> # Additional comment
160
- genie task unblock <id|#seq> # Unblock task
161
- genie task done <id|#seq> # Mark task done
162
- --comment <msg> # Comment on completion
163
- genie task checkout <id|#seq> # Claim task for execution
164
- genie task release <id|#seq> # Release task claim
165
- genie task unlock <id|#seq> # Force-release stale checkout
166
- genie task dep <id|#seq> [options] # Manage dependencies
167
- --depends-on <id2> # This task depends on id2
168
- --blocks <id2> # This task blocks id2
169
- --relates-to <id2> # This task relates to id2
170
- --remove <id2> # Remove dependency
171
- ```
172
-
173
- ### Projects (v4)
174
-
175
- ```bash
176
- genie project list # List all projects
177
- genie project create <name> # Create a project
178
- --type <type> # Task type (default: software)
179
- genie project show <id> # Show project details + task counts
180
- ```
181
-
182
- ### Types, Tags, Releases & Notifications (v4)
183
-
184
- ```bash
185
- genie type list # List all task types
186
- genie type show <id> # Show type + stage pipeline
187
- genie type create <name> # Create custom type with stages JSON
188
-
189
- genie tag list [--type <typeId>] # List all tags
190
- genie tag create <name> # Create a custom tag
191
-
192
- genie release create <name> --tasks <ids...> # Create release with tasks
193
- genie release list [--json] # List all releases
194
-
195
- genie notify set --channel <ch> # Set notification preference
196
- --priority <p> # Priority threshold
197
- --default # Set as default channel
198
- genie notify list # List notification preferences
199
- genie notify remove --channel <ch> # Remove preference
200
- ```
201
-
202
- ### Observability (v4)
203
-
204
- ```bash
205
- genie events list [--limit N] # Recent events
206
- genie events summary [--today | --since <d>] # Activity summary
207
- genie events costs [--today] # Cost breakdown
208
- genie events tools [--today] # Tool usage patterns
209
- genie events timeline [--since <duration>] # Visual timeline
210
-
211
- genie sessions list # Active sessions
212
- genie sessions replay <id> # Replay a session
213
- genie sessions search <query> # Search transcripts
214
- genie sessions ingest <path> # Import external transcript
215
-
216
- genie metrics now # Real-time metrics
217
- genie metrics history [--days N] # Historical trends
218
- genie metrics agents # Per-agent metrics
219
- ```
220
-
221
- ### Teams
222
- ```bash
223
- genie team create <name> --repo <path> [--wish <slug>]
224
- genie team hire <agent> | fire <agent>
225
- genie team ls [<name>]
226
- genie team done | blocked | disband <name>
227
- ```
228
-
229
- ### Dispatch
230
- ```bash
231
- genie work <agent> <slug>#<group> # Dispatch work on a group
232
- genie review <agent> <slug>#<group> # Dispatch review
233
- genie task done <slug>#<group> # Mark group done
234
- genie reset <slug>#<group> # Reset stuck group
235
- genie task status <slug> # Show group states
236
- ```
237
-
238
- ### Agents
239
- ```bash
240
- genie agent spawn <name> # Spawn agent
241
- genie agent kill <name> | stop <name> # Kill or stop
242
- genie agent list # List agents and teams
243
- genie agent log <name> --raw # Tail output
244
- genie agent answer <name> <choice> # Answer prompt
245
- ```
246
-
247
- ### Messaging
248
- ```bash
249
- genie agent send '<msg>' --to <name> # Direct message
250
- genie agent send '<msg>' --broadcast # Message all team members
251
- genie chat '<msg>' # Post to team channel
252
- genie agent inbox [<name>] # View inbox
253
- ```
254
-
255
- ## Communication Rules
256
-
257
- - **Same-session teammates** (spawned via `genie agent spawn`): Use `SendMessage` (Claude Code native IPC)
258
- - **Cross-session agents** (different tmux windows/teams): Use `genie agent send`
259
-
260
- ## Tool Restrictions
261
-
262
- - NEVER use the `Agent` tool to spawn agents — use `genie agent spawn` instead
263
- - NEVER use `TeamCreate` or `TeamDelete` — use `genie team create` / `genie team disband`
98
+ !`cat ${CLAUDE_SKILL_DIR}/reference/lifecycle.md 2>/dev/null`
264
99
 
265
100
  ## Rules
266
101
 
@@ -268,4 +103,7 @@ genie agent inbox [<name>] # View inbox
268
103
  - One question at a time. Don't overwhelm with choices.
269
104
  - Always suggest the next concrete action — never leave the user hanging.
270
105
  - When in doubt, recommend `/brainstorm` to clarify before planning.
271
- - For prompt refinement, suggest `/refine`it applies prompt-optimizer techniques.
106
+ - Context from `$ARGUMENTS` passes through to the invoked skill include the user's topic.
107
+ - For prompt refinement, suggest `/refine`.
108
+ - NEVER use the Agent tool to spawn agents — use `genie spawn` instead.
109
+ - NEVER use TeamCreate/TeamDelete — use `genie team create` / `genie team disband`.
@@ -0,0 +1,65 @@
1
+ # Genie Wish Lifecycle
2
+
3
+ Every piece of work follows this flow:
4
+
5
+ ```
6
+ Idea → /brainstorm → /wish → /review → /work → /review → PR → Ship
7
+ (explore) (plan) (gate) (build) (verify)
8
+ ```
9
+
10
+ ## Skills
11
+
12
+ | Skill | Purpose | When to use |
13
+ |-------|---------|-------------|
14
+ | `/brainstorm` | Explore ambiguous ideas interactively. Tracks Wish Readiness Score (WRS) across 5 dimensions. Auto-crystallizes into DESIGN.md at WRS 100. | Idea is fuzzy, scope unclear |
15
+ | `/wish` | Convert a design into a structured plan at `.genie/wishes/<slug>/WISH.md`. Defines scope, execution groups, acceptance criteria, and validation commands. | Idea is concrete, needs a plan |
16
+ | `/review` | Universal quality gate. Returns SHIP / FIX-FIRST / BLOCKED with severity-tagged gaps. | Before and after `/work`, or to validate any plan |
17
+ | `/work` | Execute an approved wish. Dispatches subagents per execution group. Runs fix loops on failures. | Wish is SHIP-approved, ready to build |
18
+ | `/fix` | Dispatch fix subagent for FIX-FIRST gaps from review. Re-reviews after fix, escalates after 2 failed loops. | Review returned FIX-FIRST |
19
+ | `/council` | Multi-perspective architectural review with 10 specialist viewpoints. | Major design decisions, tradeoff analysis |
20
+ | `/refine` | Transform a prompt into a structured, production-ready prompt via prompt-optimizer. | Prompt needs sharpening |
21
+ | `/report` | Investigate bugs — cascade through trace, capture evidence, create GitHub issue. | Bug reports, error investigation |
22
+ | `/trace` | Reproduce, trace, and isolate root cause without patching. | Unknown issues needing investigation |
23
+ | `/docs` | Audit, generate, and validate documentation against actual code. | Documentation needs updating |
24
+ | `/dream` | Batch-execute SHIP-ready wishes overnight. | Multiple wishes ready for autonomous execution |
25
+ | `/learn` | Diagnose and fix agent behavioral issues. | When the agent makes a recurring mistake |
26
+
27
+ ## Team Execution
28
+
29
+ For autonomous execution, create a team with a wish:
30
+
31
+ ```bash
32
+ genie team create my-feature --repo . --wish my-feature-slug
33
+ ```
34
+
35
+ This creates a git worktree, hires default agents (team-lead, engineer, reviewer, qa, fix), and the team-lead orchestrates the full build-review-ship cycle.
36
+
37
+ ### Monitoring
38
+
39
+ ```bash
40
+ genie team ls # List all teams
41
+ genie team ls my-feature # Show team members
42
+ genie task status my-feature-slug # Wish group progress
43
+ genie agent log team-lead # Unified log
44
+ genie agent log team-lead --raw # Raw pane output
45
+ ```
46
+
47
+ ### Team Lifecycle
48
+
49
+ ```bash
50
+ genie team done <name> # Mark done, kill members
51
+ genie team blocked <name> # Mark blocked, kill members
52
+ genie team disband <name> # Full cleanup
53
+ ```
54
+
55
+ ## Agent Resolution Order
56
+
57
+ When spawning, genie resolves agents in three tiers:
58
+ 1. **Directory** — custom agents registered with `genie dir add`
59
+ 2. **Built-in roles** — engineer, reviewer, qa, fix, refactor, trace, docs
60
+ 3. **Fallback** — generic agent with the given name
61
+
62
+ ## Communication
63
+
64
+ - **Same-session teammates** (spawned via `genie agent spawn`): Use `SendMessage` (Claude Code native IPC)
65
+ - **Cross-session agents** (different tmux windows/teams): Use `genie agent send`
@@ -33,26 +33,6 @@ ALTER TABLE agents ADD CONSTRAINT agents_state_check
33
33
  'done', 'error', 'suspended', 'archived'
34
34
  ));
35
35
 
36
- -- ============================================================================
37
- -- App store: add 'archived' to approval_status CHECK constraint
38
- -- ============================================================================
39
-
40
- DO $$
41
- BEGIN
42
- EXECUTE (
43
- SELECT string_agg('ALTER TABLE app_store DROP CONSTRAINT ' || quote_ident(conname), '; ')
44
- FROM pg_constraint
45
- WHERE conrelid = 'app_store'::regclass
46
- AND contype = 'c'
47
- AND pg_get_constraintdef(oid) LIKE '%approval_status%'
48
- );
49
- EXCEPTION WHEN OTHERS THEN
50
- NULL;
51
- END $$;
52
-
53
- ALTER TABLE app_store ADD CONSTRAINT app_store_approval_status_check
54
- CHECK (approval_status IN ('local', 'pending', 'approved', 'rejected', 'archived'));
55
-
56
36
  -- ============================================================================
57
37
  -- Index: fast lookup for non-archived agents in directory listings
58
38
  -- ============================================================================
@@ -0,0 +1,4 @@
1
+ -- 018: Drop app_store tables — feature belongs in genie-os, not genie CLI.
2
+ DROP TABLE IF EXISTS app_versions CASCADE;
3
+ DROP TABLE IF EXISTS installed_apps CASCADE;
4
+ DROP TABLE IF EXISTS app_store CASCADE;
package/src/genie.ts CHANGED
@@ -32,6 +32,7 @@ import { registerHookNamespace } from './hooks/dispatch-command.js';
32
32
  import { getActor, recordAuditEvent } from './lib/audit.js';
33
33
  import { shutdown as shutdownDb } from './lib/db.js';
34
34
  import { stopOtelReceiver } from './lib/otel-receiver.js';
35
+ import { registerAgentCommands } from './term-commands/agent/index.js';
35
36
  import {
36
37
  type SpawnOptions,
37
38
  handleLsCommand,
@@ -46,22 +47,18 @@ import { registerBoardCommands } from './term-commands/board.js';
46
47
  import { registerBriefCommands } from './term-commands/brief.js';
47
48
  import { registerDaemonCommands } from './term-commands/daemon.js';
48
49
  import { registerDbCommands } from './term-commands/db.js';
49
- import { registerAgentNamespace, registerDirNamespace } from './term-commands/dir.js';
50
+ import { registerDirNamespace } from './term-commands/dir.js';
50
51
  import { registerDispatchCommands } from './term-commands/dispatch.js';
51
52
  import { registerExportCommands } from './term-commands/export.js';
52
53
  import * as historyCmd from './term-commands/history.js';
53
54
  import { registerImportCommands } from './term-commands/import.js';
54
55
  import { registerInitCommands } from './term-commands/init.js';
55
- import { registerInstallCommand } from './term-commands/install.js';
56
- import { registerItemUninstallCommand } from './term-commands/item-uninstall.js';
57
- import { registerItemUpdateCommand } from './term-commands/item-update.js';
58
56
  import { type LogOptions, logCommand } from './term-commands/log.js';
59
57
  import { registerMetricsCommands } from './term-commands/metrics.js';
60
58
  import { registerSendInboxCommands } from './term-commands/msg.js';
61
59
  import { registerNotifyCommands } from './term-commands/notify.js';
62
60
  import * as orchestrateCmd from './term-commands/orchestrate.js';
63
61
  import { registerProjectCommands } from './term-commands/project.js';
64
- import { registerPublishCommand } from './term-commands/publish.js';
65
62
  import {
66
63
  type QaCheckOptions,
67
64
  type QaOptions,
@@ -100,6 +97,19 @@ const program = new Command();
100
97
 
101
98
  program.name('genie').description('Genie CLI - AI-assisted development').version(VERSION);
102
99
 
100
+ program.configureHelp({
101
+ sortSubcommands: true,
102
+ showGlobalOptions: true,
103
+ });
104
+
105
+ program.configureOutput({
106
+ outputError: (str, write) => {
107
+ const cmd = program.commands.find((c) => process.argv.slice(2, 6).includes(c.name()));
108
+ const prefix = cmd ? `genie ${cmd.name()}` : 'genie';
109
+ write(`\x1b[31mError (${prefix}): ${str}\x1b[0m\n`);
110
+ },
111
+ });
112
+
103
113
  // ============================================================================
104
114
  // Named session — genie --session <name>
105
115
  // ============================================================================
@@ -182,7 +192,7 @@ registerAppCommand(program);
182
192
  registerInitCommands(program);
183
193
  registerTeamNamespace(program);
184
194
  registerDirNamespace(program);
185
- registerAgentNamespace(program);
195
+ registerAgentCommands(program);
186
196
  registerSendInboxCommands(program);
187
197
  registerStateCommands(program);
188
198
  registerDispatchCommands(program);
@@ -205,13 +215,6 @@ registerImportCommands(program);
205
215
  registerTemplateCommands(program);
206
216
  registerBriefCommands(program);
207
217
 
208
- // Item registry commands — install, publish (top-level), item uninstall/update (namespaced)
209
- registerInstallCommand(program);
210
- registerPublishCommand(program);
211
- const itemCmd = program.command('item').description('Item registry management');
212
- registerItemUninstallCommand(itemCmd);
213
- registerItemUpdateCommand(itemCmd);
214
-
215
218
  // ============================================================================
216
219
  // CLI audit hooks — record every command execution to audit_events
217
220
  // ============================================================================
@@ -249,7 +252,7 @@ program.hook('postAction', (_thisCommand, actionCommand) => {
249
252
  });
250
253
 
251
254
  // ============================================================================
252
- // Top-level agent commands (promoted from genie agent namespace)
255
+ // Top-level aliases shortcuts for genie agent <command>
253
256
  // ============================================================================
254
257
 
255
258
  // genie spawn <name>
@@ -268,6 +271,15 @@ program
268
271
  .option('--cwd <path>', 'Working directory for the agent (overrides directory entry)')
269
272
  .option('--session <session>', 'Tmux session name to spawn into')
270
273
  .option('--no-auto-resume', 'Disable auto-resume on pane death')
274
+ .addHelpText(
275
+ 'after',
276
+ `
277
+ Examples:
278
+ genie spawn engineer # Spawn built-in engineer role
279
+ genie spawn researcher --model sonnet # Spawn with model override
280
+ genie spawn my-agent --team my-feature # Spawn into a specific team
281
+ genie spawn council--questioner --provider codex # Use Codex provider`,
282
+ )
271
283
  .action(async (name: string, options: SpawnOptions) => {
272
284
  try {
273
285
  await handleWorkerSpawn(name, options);