chore: merge dev into main (resolve session.ts conflict) - #539
Conversation
tmux uses '.' as a pane separator in targets (session:window.pane), so folder names like 'ravi.bot' cause "can't find pane: bot" errors. Sanitize dots to dashes in deriveWindowName.
Covers the fix for tmux "can't find pane" error when folder names contain dots (e.g. ravi.bot). Tests sanitizeWindowName as a pure function — no mock.module needed.
Replace `const { basename } = require('node:path')` with top-level
ESM import for consistency with the rest of the file.
…ests Bun's mock.module replaces the entire module cache process-wide. When a mock only provides a subset of exports, unrelated test files that import the same module get "Export named 'X' not found" errors. Add stubs for all agent-registry and tmux exports to prevent cache corruption causing flaky CI failures.
Bun's mock.module corrupts the global module cache process-wide, causing "Export named 'X' not found" errors in unrelated test files. Refactored idle-timeout to accept dependencies via optional IdleDeps parameter (defaults to real implementations). Tests inject mocks directly — no mock.module needed anywhere in the codebase now.
Dotted folder names (e.g. `foo.bar`) bypassed collision detection because `resolveWindowName` searched for the unsanitized basename while existing windows were stored with sanitized names (`foo-bar`). This caused `focusTeamWindow` to attach to an unrelated window running a different project. Move `sanitizeWindowName()` call inside `resolveWindowName` so the tmux lookup matches what's actually stored. The outer `sanitizeWindowName` in `deriveWindowName` is now a harmless no-op (idempotent). Adds regression tests for idempotency and dot-dash collision equivalence.
Apply sanitizeWindowName to teamName in team-auto-spawn.ts before passing to ensureTeamWindow and constructing tmux target strings. Prevents "can't find pane" errors when team names contain dots.
sanitizeTeamName lowercases + strips non-alnum, while the tmux window is created with sanitizeWindowName (dots only). Return the actual window name so callers target the correct tmux window.
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
…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.
…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)
feat: Genie CLI v2 — Complete Framework Redesign
fix(hooks): update auto-spawn to use top-level genie spawn command
The v2 redesign gutted session.ts to only export helpers. Main still had the full session command. Dev is correct.
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThis PR implements a comprehensive architectural redesign replacing the beads task system with a wish-based state machine, introducing a persistent agent directory with CRUD operations, adding context-injected dispatch commands for orchestrating multi-agent workflows, and refactoring team lifecycle management around git worktrees. Changes
Sequence Diagram(s)sequenceDiagram
participant CLI as CLI / Entrypoint
participant Dir as Agent Directory
participant SM as Wish State Machine
participant Dispatch as Dispatch Commands
participant Spawn as Spawn Handler
participant Chat as Team Chat
CLI->>Dir: resolve agent by name
Dir-->>CLI: DirectoryEntry (with systemPrompt path)
CLI->>SM: initialize wish state (groups + deps)
SM-->>CLI: WishState (groups: ready/blocked)
CLI->>Dispatch: dispatch work (slug#group)
Dispatch->>SM: validate group & start
SM-->>Dispatch: GroupState (in_progress)
Dispatch->>Spawn: spawn agent with context
Spawn->>Dir: resolve agent + load identity
Dir-->>Spawn: agent entry + AGENTS.md path
Spawn-->>Dispatch: worker spawned
CLI->>Chat: broadcast to team members
Chat->>Chat: write message to team JSONL
Chat-->>CLI: message posted
Dispatch->>SM: complete group
SM->>SM: recalculate dependents (blocked→ready)
SM-->>Dispatch: dependent groups unblocked
Estimated Code Review Effort🎯 5 (Critical) | ⏱️ ~120 minutes Rationale: This PR introduces heterogeneous, interdependent architectural changes across multiple subsystems (agent directory, state machine, team management, dispatch, messaging, and legacy removal). High logic density in core modules (agent-directory.ts, wish-state.ts, dispatch.ts), breaking changes to CLI surface, file-backed concurrency safeguards, and extensive public API surface modifications require meticulous validation of state transitions, dependency graph handling, message routing, and cross-module integration points. Possibly Related PRs
✨ Finishing Touches
🧪 Generate unit tests (beta)
|
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 integrates the extensive Genie CLI v2 framework redesign into the main branch. The core purpose is to modernize agent orchestration, task management, and inter-agent communication by introducing a robust agent directory, a new wish-based state machine, and a simplified command structure. The changes significantly enhance the CLI's capabilities for multi-agent workflows and improve overall developer experience, while also addressing a specific merge conflict in the session management module. Highlights
Changelog
Activity
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 pull request merges the dev branch into main, bringing in the comprehensive v2 framework redesign. The changes are substantial, replacing the beads-based task management with a new wish-native state machine, and introducing a persistent agent directory to replace profiles. The command-line interface has been significantly streamlined, with many commands removed and others promoted to the top level for better usability. Key improvements include git worktree integration for team collaboration, directory-first agent resolution, and a new set of context-aware dispatch commands (brainstorm, wish, work, review). The codebase is significantly simplified and more maintainable with the removal of many complex and fragile components. The addition of a branch guard hook is a notable security enhancement. Overall, this is an excellent and well-executed redesign that modernizes the entire framework.
Summary
Resolves merge conflict between
devandmaininsrc/genie-commands/session.ts.The v2 framework redesign (PR #536) gutted
session.tsto only export helpers (getAgentsSystemPrompt,buildClaudeCommand,sanitizeWindowName). Main still had the full session command with all the old tmux session management code. Dev's version is correct.Conflict Resolution
src/genie-commands/session.ts: Keep dev version (cleaned-up helpers only)Context
This replaces the rolling PR #537 which had the same conflict.
Summary by CodeRabbit
New Features
Documentation
Removals