feat: Genie CLI v2 — Complete Framework Redesign - #536
Conversation
Implements Group 1 of the genie v2 redesign: - Create src/lib/agent-directory.ts — JSON registry at ~/.genie/agent-directory.json with add/rm/resolve/ls/edit/loadIdentity API and file-lock pattern - Create src/lib/builtin-agents.ts — 10 built-in roles + 10 council members with default models, prompts, and descriptions - Create src/term-commands/dir.ts — genie dir add/rm/ls/edit CLI commands - Remove blueprint system from team-manager.ts (BLUEPRINTS, getBlueprint, listBlueprints) - Remove genie profiles commands from genie.ts - Remove genie team blueprints and genie team ensure commands - Resolution order: user directory > built-in registry
Files removed from genie.ts by Groups 1 and 4 but not yet deleted: profiles.ts, ledger/validate.ts, team-auto-spawn.ts, beads-validate.ts, daemon.ts, beads-registry.ts, wish-state.ts
Previous commit had stale linter changes from concurrent agents. This version starts from dev, adds only dir namespace registration while keeping all existing commands intact.
Group 4 deliverables: - Create src/lib/wish-state.ts with WishState schema, createState/ startGroup/completeGroup/getState API, and file-locked state file at .genie/state/<slug>.json - Add genie done <slug>#<group> and genie status <slug> CLI commands in src/term-commands/state.ts - Remove all beads integration: daemon commands, ledger commands, brainstorm crystallize, beads-registry, beads-issues-jsonl - Remove bd CLI calls from close, ship, work, and task commands - Clean beads/bd references from comments throughout codebase
- Add systemPromptFile, promptMode, model to SpawnParams in provider-adapters - buildClaudeCommand emits --system-prompt-file or --append-system-prompt-file - buildClaudeCommand emits --model flag when model is set - Rewrite genie agent spawn: positional <name> resolves from directory/built-ins - Remove --role as required option; name is the primary identifier - Agent CWD resolved from directory entry.dir, overridable with --cwd - Agent identity injected via --append-system-prompt-file <dir>/AGENTS.md - Replace persistSystemPrompt() + $(cat) pattern with --*-system-prompt-file - Update all tests to match new --*-file flag patterns
- Rewrite team-manager.ts: new schema with repo, baseBranch, worktreePath, leader, members[]; createTeam creates git worktree (idempotent); hireAgent/fireAgent for member management; disbandTeam removes worktree - Rewrite team.ts CLI: create (--repo, --branch), hire (council special case), fire, ls (teams or members), disband commands - Remove _open hidden command and team shortcut routing from genie.ts - Add comprehensive tests for both team-manager and team CLI
- Remove sessionCommand and SessionOptions exports (dead after _open removal) - Remove deprecated deleteTeam alias from team-manager - Remove unused GroupStatus type export from wish-state - Clean up knip config: remove stale ignores for profiles.ts and bd binary
- Remove export from getWindowEnv, setWindowEnv, killSession (only used by removed session functions) - Remove unused GroupStatus type alias from wish-state
- local-tasks.test.ts: save/restore TERM_USE_LOCAL_TASKS env var to prevent parallel test interference - work.test.ts: disable husky hooks in temp repos via core.hooksPath and use conventional commit messages
Implement Group 5 dispatch commands that bridge the wish state machine and agent spawn with context injection: - genie brainstorm <agent> <slug> — reads DRAFT.md, spawns with content - genie wish <agent> <slug> — reads DESIGN.md, spawns with content - genie dispatch-work <agent> <slug>#<group> — checks deps, starts group, spawns - genie review <agent> <slug>#<group> — spawns with group + git diff context Shared utilities: extractGroup(), extractWishContext(), buildContextPrompt(), writeContextFile() for temp file context injection via --append-system-prompt-file. Exports handleWorkerSpawn and SpawnOptions from agents.ts for reuse.
…nd team chat - Rewrite msg.ts: remove --team from send, add scope enforcement, broadcast, and chat commands (post/read via JSONL team channels) - Create team-chat.ts: JSONL-based group channel with postMessage/readMessages - Rewrite protocol-router.ts: directory-first resolution order (directory → built-in → worker registry), auto-spawn for directory agents - Update auto-spawn.ts: check agent directory before templates for offline agent resolution with expanded search candidates - Add comprehensive tests for team-chat, scope checking, and protocol-router
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces Genie CLI v2, a comprehensive redesign of the command-line interface aimed at simplifying multi-agent workflows and improving developer experience. The changes focus on establishing a robust framework for agent identity, team collaboration, and task orchestration, moving away from previous complexities and consolidating functionalities into a more intuitive and scalable system. The new architecture emphasizes clear separation of concerns, persistent agent configurations, and streamlined communication, laying the groundwork for more advanced AI-assisted development. Highlights
Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This is an impressive and comprehensive redesign of the Genie CLI framework. The move to a persistent agent directory, a simplified team and worktree management system, and a native state machine are all excellent architectural improvements that will significantly enhance usability and maintainability. The code changes are extensive but well-organized and align with the detailed design documents. I've found a few minor inconsistencies in the updated skill prompts where old command names are still referenced. These are low-risk but should be corrected to ensure the documentation and skill definitions are consistent with the new framework.
|
|
||
| Three-layer chain: OpenClaw -> genie -> Claude Code -> Teams. Use timeouts; fall back to sequential on failure. | ||
| # Create a team for this dream session | ||
| genie team ensure dream-<date> |
| 3. Cleanup: | ||
| - `git worktree remove <worktree_path>` for each wish. | ||
| - `TeamDelete` (Claude Code) or runtime-equivalent to tear down team context. | ||
| - `genie team delete dream-<date>` to tear down team context. |
There was a problem hiding this comment.
| ## Agent Commands (genie CLI) | ||
| - Spawn agent: `genie agent spawn --role <role>` | ||
| - Spawn agent: `genie spawn <role>` | ||
| - List agents: `genie agent list` |
| | Spawn agent | `genie spawn <role>` | ~~genie worker spawn~~ | | ||
| | List agents | `genie agent list` | ~~genie worker list~~ | | ||
| | Kill agent | `genie agent kill <id>` | ~~genie worker kill~~ | | ||
| | Agent history | `genie agent history <name>` | ~~genie worker history~~ | | ||
| | Send message | `genie send "<text>" --to <agent>` | ~~genie msg send~~ | | ||
| | Manage teams | `genie team ensure <name>` | (same) | | ||
| | Install hooks | `genie hook install` | (none) | |
There was a problem hiding this comment.
This command reference table contains a couple of outdated commands from the old framework:
genie agent listshould begenie ls.genie team ensure <name>should begenie team create <name>.
Please update the table to reflect the new, streamlined command structure.
| | Spawn agent | `genie spawn <role>` | ~~genie worker spawn~~ | | |
| | List agents | `genie agent list` | ~~genie worker list~~ | | |
| | Kill agent | `genie agent kill <id>` | ~~genie worker kill~~ | | |
| | Agent history | `genie agent history <name>` | ~~genie worker history~~ | | |
| | Send message | `genie send "<text>" --to <agent>` | ~~genie msg send~~ | | |
| | Manage teams | `genie team ensure <name>` | (same) | | |
| | Install hooks | `genie hook install` | (none) | | |
| | Spawn agent | `genie spawn <role>` | ~~genie worker spawn~~ | | |
| | List agents | `genie ls` | ~~genie worker list~~ | | |
| | Kill agent | `genie kill <name>` | ~~genie worker kill~~ | | |
| | Agent history | `genie history <name>` | ~~genie worker history~~ | | |
| | Send message | `genie send "<text>" --to <agent>` | ~~genie msg send~~ | | |
| | Manage teams | `genie team create <name>` | (same) | | |
| | Install hooks | `genie hook install` | (none) | |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ec90fa76b0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Start group in state machine (enforces dependencies) | ||
| try { | ||
| await wishState.startGroup(slug, group, agentName); |
There was a problem hiding this comment.
Initialize wish state before dispatching first work group
workDispatchCommand always calls wishState.startGroup(...), but there is no production path in this commit that creates .genie/state/<slug>.json beforehand (the only createState usages are in tests), so a fresh wish will fail with State file not found on the first dispatch-work invocation. This breaks the primary wish execution flow unless users manually seed state files.
Useful? React with 👍 / 👎.
| if (group.status === 'done') { | ||
| throw new Error(`Group "${groupName}" is already done`); | ||
| } | ||
|
|
||
| group.status = 'done'; |
There was a problem hiding this comment.
Block completing groups whose dependencies are unmet
completeGroup only rejects already-done groups and then unconditionally sets status = 'done', which allows a blocked group to be marked complete before its dependencies finish. That bypasses the dependency guarantees enforced by startGroup and can corrupt execution ordering (e.g., marking Group 2 done while Group 1 is still not done).
Useful? React with 👍 / 👎.
…s, add session management Group 7 of the Genie v2 Framework Redesign: - Promote agent subcommands to top-level: genie spawn, kill, stop, history, read, answer - Add `genie ls` smart view showing registered agents with runtime status (NAME|DIR|STATUS|TEAM|MODEL) - Add `genie --session <name>` for named leader sessions with name→UUID mapping - Remove `genie agent` namespace entirely (spawn, list, kill, suspend, dashboard, watchdog, approve, history, answer, events, close, ship, read, exec) - Remove `genie task` namespace entirely (create, update, ship, close, ls, link, unlink, create-local, list-local, update-local) - Remove `genie council` and `genie profiles` commands - Rename suspend→stop for consistency - All commands resolve by agent name (with role/suffix fallback) - Update all command references in target-resolver, work, history
…il skill
- Add systemPrompt field to SpawnParams for built-in agents without AGENTS.md
- Build --append-system-prompt flag in Claude adapter for inline prompts
- Resolve built-in system prompts in agent spawn flow via getBuiltin()
- Update /council skill with dual-mode awareness:
- Lightweight mode (default): simulated perspectives in single session
- Full spawn mode: detects hired council members, posts to team chat,
council members respond independently, leader synthesizes
…d remove old patterns Replace genie agent spawn --role with genie spawn across all 10 skill SKILL.md files. Remove Task tool, TeamCreate/TeamDelete/SendMessage references. Remove bd/beads/bd close references. Strip state management from /work (no checkboxes, no Status: SHIPPED). Add shared worktree context injection sections to brainstorm, wish, review, and work skills. Verify council dual-mode documentation. Also fix report skill dispatch.
…sign Delete 10 unused files (profiles, skill-loader, wish-tasks, close, council, create, exec, ship, task/commands, update) and remove 11 unused exports left over from groups 1-9 parallel work. Fix biome format, import-type, and unused-import errors.
ec90fa7 to
9bf6634
Compare
…sion-store - Set GENIE_AGENT_NAME env var before the native team conditional block so all spawns (not just native team ones) get the env var set - Native team path still overrides with the more specific agentName - Confirmed crypto.randomUUID() works as a Bun global (Web Crypto API), added clarifying comment in session-store.ts
- Replace `genie agent list/kill/spawn/read/history` with promoted top-level commands (`genie ls/kill/spawn/read/history`) - Replace `genie council <topic>` with `/council` skill reference - Update CO-ORCHESTRATION-GUIDE from beads/bd paradigm to wish state machine context - Update agent-profiles.md spawn references
- Fix import ordering in team-manager.ts - Remove unused exports and files flagged by knip: task-backend.ts, event-monitor.ts, updateState, generateWorkerId, findAllByTask, loadFullAutoApproveConfig, getSessionName, getDefaultWorkerProfile, getWorkerProfile, extractPermissionDetails, detectCompletion, executeCommand, WorkerProfile type - Update test to match new GENIE_AGENT_NAME behavior (always set from role)
Summary
Complete redesign of the genie CLI framework, replacing 40+ commands with a streamlined architecture:
genie dir add/rm/ls/edit) replacing profiles and blueprintsgenie spawn <name>resolves from directory, injects identity via--system-prompt-file/--append-system-prompt-filegenie team create/hire/fire/disbandwith git worktree management, team name = branch namegenie work/done/statusreplacing beads/daemon/ledgergenie brainstorm/wish/work/reviewwith context injectiongenie send/broadcast/chatscoped to own team, auto-spawn on message to offline agentspawn/kill/stop/history/read/answer/ls, removedgenie agentnamespacegenie --session <name>for named leader sessionsgenie team hire council)Design
Diff Stats
90 files changed, +7,281 / -5,861
Removed
genie agent *namespace (promoted to top-level)genie task *namespace (replaced by wish groups)genie profiles *(replaced by agent directory)genie daemon/ledger *(replaced by wish state machine)genie team blueprints/ensure(replaced by directory + hire)persistSystemPrompt()+$(cat)pattern (replaced by--system-prompt-file)bdCLI calls throughout)Test Plan
bun run checkpasses (typecheck + lint + dead-code + tests)bun run buildsucceedsgenie dir add/rm/ls/editworksgenie spawn <name>resolves from directory and built-insgenie team create/hire/fire/disbandmanages worktreesgenie work/done/statustracks wish group state