groove-dev 0.8.0

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.
Files changed (84) hide show
  1. package/CLAUDE.md +197 -0
  2. package/LICENSE +40 -0
  3. package/README.md +115 -0
  4. package/docs/GUI_DESIGN_SPEC.md +402 -0
  5. package/favicon.png +0 -0
  6. package/groove-logo-short.png +0 -0
  7. package/groove-logo.png +0 -0
  8. package/package.json +70 -0
  9. package/packages/cli/bin/groove.js +98 -0
  10. package/packages/cli/package.json +15 -0
  11. package/packages/cli/src/client.js +25 -0
  12. package/packages/cli/src/commands/agents.js +38 -0
  13. package/packages/cli/src/commands/approve.js +50 -0
  14. package/packages/cli/src/commands/config.js +35 -0
  15. package/packages/cli/src/commands/kill.js +15 -0
  16. package/packages/cli/src/commands/nuke.js +19 -0
  17. package/packages/cli/src/commands/providers.js +40 -0
  18. package/packages/cli/src/commands/rotate.js +16 -0
  19. package/packages/cli/src/commands/spawn.js +91 -0
  20. package/packages/cli/src/commands/start.js +31 -0
  21. package/packages/cli/src/commands/status.js +38 -0
  22. package/packages/cli/src/commands/stop.js +15 -0
  23. package/packages/cli/src/commands/team.js +77 -0
  24. package/packages/daemon/package.json +18 -0
  25. package/packages/daemon/src/adaptive.js +237 -0
  26. package/packages/daemon/src/api.js +533 -0
  27. package/packages/daemon/src/classifier.js +126 -0
  28. package/packages/daemon/src/credentials.js +121 -0
  29. package/packages/daemon/src/firstrun.js +93 -0
  30. package/packages/daemon/src/index.js +208 -0
  31. package/packages/daemon/src/introducer.js +238 -0
  32. package/packages/daemon/src/journalist.js +600 -0
  33. package/packages/daemon/src/lockmanager.js +58 -0
  34. package/packages/daemon/src/pm.js +108 -0
  35. package/packages/daemon/src/process.js +361 -0
  36. package/packages/daemon/src/providers/aider.js +72 -0
  37. package/packages/daemon/src/providers/base.js +38 -0
  38. package/packages/daemon/src/providers/claude-code.js +167 -0
  39. package/packages/daemon/src/providers/codex.js +68 -0
  40. package/packages/daemon/src/providers/gemini.js +62 -0
  41. package/packages/daemon/src/providers/index.js +38 -0
  42. package/packages/daemon/src/providers/ollama.js +94 -0
  43. package/packages/daemon/src/registry.js +89 -0
  44. package/packages/daemon/src/rotator.js +185 -0
  45. package/packages/daemon/src/router.js +132 -0
  46. package/packages/daemon/src/state.js +34 -0
  47. package/packages/daemon/src/supervisor.js +178 -0
  48. package/packages/daemon/src/teams.js +203 -0
  49. package/packages/daemon/src/terminal/base.js +27 -0
  50. package/packages/daemon/src/terminal/generic.js +27 -0
  51. package/packages/daemon/src/terminal/tmux.js +64 -0
  52. package/packages/daemon/src/tokentracker.js +124 -0
  53. package/packages/daemon/src/validate.js +122 -0
  54. package/packages/daemon/templates/api-builder.json +18 -0
  55. package/packages/daemon/templates/fullstack.json +18 -0
  56. package/packages/daemon/templates/monorepo.json +24 -0
  57. package/packages/gui/dist/assets/index-BO95Rm1F.js +73 -0
  58. package/packages/gui/dist/assets/index-CPzm9ZE9.css +1 -0
  59. package/packages/gui/dist/favicon.png +0 -0
  60. package/packages/gui/dist/groove-logo-short.png +0 -0
  61. package/packages/gui/dist/groove-logo.png +0 -0
  62. package/packages/gui/dist/index.html +13 -0
  63. package/packages/gui/index.html +12 -0
  64. package/packages/gui/package.json +22 -0
  65. package/packages/gui/public/favicon.png +0 -0
  66. package/packages/gui/public/groove-logo-short.png +0 -0
  67. package/packages/gui/public/groove-logo.png +0 -0
  68. package/packages/gui/src/App.jsx +215 -0
  69. package/packages/gui/src/components/AgentActions.jsx +347 -0
  70. package/packages/gui/src/components/AgentChat.jsx +479 -0
  71. package/packages/gui/src/components/AgentNode.jsx +117 -0
  72. package/packages/gui/src/components/AgentPanel.jsx +115 -0
  73. package/packages/gui/src/components/AgentStats.jsx +333 -0
  74. package/packages/gui/src/components/ApprovalQueue.jsx +156 -0
  75. package/packages/gui/src/components/EmptyState.jsx +100 -0
  76. package/packages/gui/src/components/SpawnPanel.jsx +515 -0
  77. package/packages/gui/src/components/TeamSelector.jsx +162 -0
  78. package/packages/gui/src/main.jsx +9 -0
  79. package/packages/gui/src/stores/groove.js +247 -0
  80. package/packages/gui/src/theme.css +67 -0
  81. package/packages/gui/src/views/AgentTree.jsx +148 -0
  82. package/packages/gui/src/views/CommandCenter.jsx +620 -0
  83. package/packages/gui/src/views/JournalistFeed.jsx +149 -0
  84. package/packages/gui/vite.config.js +19 -0
package/CLAUDE.md ADDED
@@ -0,0 +1,197 @@
1
+ # GROOVE — Agent Orchestration Layer
2
+
3
+ > Spawn fast. Stay aware. Never lose context.
4
+
5
+ ## What This Is
6
+
7
+ GROOVE is a lightweight, open-source agent orchestration layer for AI coding tools. It is a **process manager** — it spawns, coordinates, and monitors AI coding agents. It does NOT wrap, proxy, or impersonate any AI API.
8
+
9
+ ## Architecture
10
+
11
+ ```
12
+ groove/
13
+ ├── packages/
14
+ │ ├── daemon/ — Node.js daemon (port 31415) — the brain
15
+ │ ├── cli/ — `groove` CLI commands (17 commands)
16
+ │ └── gui/ — React + Vite GUI (served by daemon on :31415)
17
+ ├── CLAUDE.md — this file
18
+ ├── README.md — public docs
19
+ └── LICENSE — FSL-1.1-Apache-2.0
20
+ ```
21
+
22
+ ### Daemon Components (packages/daemon/src/)
23
+
24
+ **Core:**
25
+ - **Registry** (`registry.js`) — in-memory agent state store, EventEmitter, prototype-pollution-safe updates
26
+ - **API** (`api.js`) — REST endpoints + WebSocket broadcasts, CORS restricted to localhost, input validation
27
+ - **ProcessManager** (`process.js`) — spawn/kill agent processes, stdout capture, log file permissions 0o600
28
+ - **StateManager** (`state.js`) — persist/recover state across daemon restarts
29
+ - **Validate** (`validate.js`) — centralized input validation (agent config, scope patterns, team names, markdown escaping)
30
+ - **FirstRun** (`firstrun.js`) — first-run detection, provider scan, config initialization
31
+
32
+ **Coordination:**
33
+ - **Introducer** (`introducer.js`) — generates AGENTS_REGISTRY.md, injects GROOVE section into CLAUDE.md, team context for new agents
34
+ - **LockManager** (`lockmanager.js`) — file scope ownership via glob patterns, conflict detection with minimatch
35
+ - **Supervisor** (`supervisor.js`) — QC approval routing, conflict recording, GROOVE_CONFLICTS.md, auto-QC at 4+ agents
36
+ - **Teams** (`teams.js`) — save/load/import/export agent configurations, auto-save on changes
37
+
38
+ **Intelligence:**
39
+ - **Journalist** (`journalist.js`) — AI-powered context synthesis (headless claude -p), log filtering (stream-json parsing), GROOVE_PROJECT_MAP.md, GROOVE_DECISIONS.md, per-agent session logs, handoff brief generation
40
+ - **Rotator** (`rotator.js`) — context rotation engine (kill + respawn with fresh context), auto-rotation at adaptive threshold, rotation history
41
+ - **Adaptive** (`adaptive.js`) — per-provider per-role rotation thresholds, session scoring 0-100, threshold adjustment (+2%/-5%), convergence detection
42
+ - **TokenTracker** (`tokentracker.js`) — per-agent token accounting, savings calculator (rotation/conflict/cold-start savings)
43
+ - **Classifier** (`classifier.js`) — task complexity classification (light/medium/heavy) via sliding window pattern matching
44
+ - **Router** (`router.js`) — adaptive model routing (Fixed/Auto/Auto-with-floor modes), cost tracking
45
+
46
+ **Credentials:**
47
+ - **CredentialStore** (`credentials.js`) — AES-256-GCM encrypted API key storage, machine-specific key derivation, 0o600 file permissions
48
+
49
+ ### Providers (packages/daemon/src/providers/)
50
+
51
+ Each provider implements: `isInstalled()`, `buildSpawnCommand()`, `buildHeadlessCommand()`, `parseOutput()`.
52
+
53
+ | Provider | File | Auth | Models | Hot-Swap |
54
+ |----------|------|------|--------|----------|
55
+ | Claude Code | `claude-code.js` | Subscription | Opus/Sonnet/Haiku | Yes |
56
+ | Codex | `codex.js` | API Key | o3/o4-mini | No |
57
+ | Gemini CLI | `gemini.js` | API Key | Pro/Flash | No |
58
+ | Aider | `aider.js` | API Key | Any | Yes |
59
+ | Ollama | `ollama.js` | Local | Any | No |
60
+
61
+ ### Terminal Adapters (packages/daemon/src/terminal/)
62
+
63
+ - `base.js` — interface
64
+ - `generic.js` — fallback (background processes)
65
+ - `tmux.js` — tmux pane management (execFileSync, paneId validation)
66
+
67
+ ### Team Templates (packages/daemon/templates/)
68
+
69
+ Bundled starter teams: `fullstack.json`, `api-builder.json`, `monorepo.json`
70
+
71
+ ## Tech Stack
72
+
73
+ - Node.js 20+ (ESM, `"type": "module"`)
74
+ - npm workspaces (monorepo)
75
+ - Express + ws (daemon, bound to 127.0.0.1)
76
+ - React 19 + Vite 6 (GUI)
77
+ - Zustand (GUI state + WebSocket sync)
78
+ - React Flow / @xyflow/react (agent tree visualization)
79
+ - commander + chalk (CLI)
80
+ - AES-256-GCM + scrypt (credential encryption)
81
+
82
+ ## CLI Commands
83
+
84
+ ```
85
+ groove start — start daemon (first-run wizard on first use)
86
+ groove stop — stop daemon
87
+ groove spawn --role <r> — spawn an agent
88
+ groove kill <id> — kill an agent
89
+ groove agents — list agents
90
+ groove status — daemon status
91
+ groove nuke — kill all + stop
92
+ groove rotate <id> — context rotation (kill + respawn with handoff brief)
93
+ groove team save <name> — save current agents as a team
94
+ groove team load <name> — load and spawn a saved team
95
+ groove team list — list saved teams
96
+ groove team delete <name> — delete a team
97
+ groove team export <name> — export team as JSON
98
+ groove team import <file> — import team from JSON
99
+ groove providers — list available AI providers
100
+ groove set-key <p> <key> — set API key for a provider
101
+ groove config show — show configuration
102
+ groove config set <k> <v> — set a config value
103
+ groove approvals — list pending approvals
104
+ groove approve <id> — approve a request
105
+ groove reject <id> — reject a request
106
+ ```
107
+
108
+ ## API Endpoints
109
+
110
+ All endpoints on `http://localhost:31415/api/`. CORS restricted to localhost.
111
+
112
+ | Method | Path | Description |
113
+ |--------|------|-------------|
114
+ | GET | /api/health | Health check |
115
+ | GET/POST/DELETE | /api/agents | Agent CRUD |
116
+ | POST | /api/agents/:id/rotate | Context rotation |
117
+ | GET/POST/DELETE | /api/teams | Team management |
118
+ | GET/POST/DELETE | /api/credentials | API key management |
119
+ | GET | /api/providers | Provider listing |
120
+ | GET/PATCH | /api/config | Configuration |
121
+ | GET | /api/tokens/summary | Token usage + savings |
122
+ | GET/POST | /api/approvals | Approval queue |
123
+ | GET | /api/journalist | Journalist status |
124
+ | GET | /api/rotation | Rotation stats |
125
+ | GET | /api/routing | Model routing status |
126
+
127
+ ## GUI (packages/gui/)
128
+
129
+ React app served by daemon at `http://localhost:31415`:
130
+ - **AgentTree** — React Flow visualization, click-to-select, animated edges for running agents
131
+ - **SpawnModal** — role presets, dynamic provider/model selector
132
+ - **AgentDetail** — sidebar with info, activity log, context bar, rotate/kill buttons
133
+ - **JournalistFeed** — synthesis results, history, manual trigger
134
+ - **TokenDashboard** — usage stats, savings breakdown
135
+ - **ApprovalQueue** — pending approvals with approve/reject
136
+ - **TeamSelector** — save/load/delete teams from header dropdown
137
+ - **Notifications** — toast system for events
138
+
139
+ ## Security
140
+
141
+ - Server bound to `127.0.0.1` only (not network-accessible)
142
+ - CORS restricted to localhost origins
143
+ - WebSocket origin verification
144
+ - AES-256-GCM credential encryption with machine-specific key derivation
145
+ - Input validation on all API endpoints (role, name, scope, prompt)
146
+ - Prototype pollution protection (whitelisted keys on Object.assign)
147
+ - Log files created with 0o600 permissions
148
+ - Command injection prevention (execFileSync with array args in tmux)
149
+ - Scope patterns validated (no absolute paths, no traversal)
150
+ - 137 automated tests across 14 suites
151
+
152
+ ## Conventions
153
+
154
+ - All files use ESM (`import`/`export`)
155
+ - License header on every source file: `// FSL-1.1-Apache-2.0 — see LICENSE`
156
+ - Port 31415 for daemon (REST + WebSocket + GUI)
157
+ - `.groove/` directory in project root for runtime state (gitignored)
158
+ - Generated markdown files: `AGENTS_REGISTRY.md`, `GROOVE_PROJECT_MAP.md`, `GROOVE_DECISIONS.md`
159
+
160
+ ## Compliance (CRITICAL)
161
+
162
+ GROOVE is a process manager, NOT a harness. Hard rules:
163
+ 1. **Never touch OAuth tokens** — each `claude` process manages its own auth
164
+ 2. **Never impersonate Claude Code** — GROOVE doesn't send HTTP requests to Anthropic
165
+ 3. **Never proxy API calls** — all AI requests flow directly from provider CLI to provider servers
166
+ 4. **The Journalist uses API key auth** for headless `claude -p` calls
167
+ 5. **One subscription = one user** — never share subscriptions
168
+
169
+ ## Distribution
170
+
171
+ - **npm:** `npm i -g groove-dev` (published as `groove-dev`)
172
+ - **GitHub:** `github.com/grooveai-dev/groove`
173
+ - **Website:** groovedev.ai
174
+ - **Docs:** docs.groovedev.ai
175
+
176
+ ## Current Status (v0.7.1)
177
+
178
+ Fully functional multi-agent orchestration system. Tested end-to-end: planner → Quick Launch → 4 agents → working app.
179
+
180
+ **Key capabilities:**
181
+ - Quick Launch: planner recommends team, one-click spawns all agents
182
+ - AI Project Manager: reviews risky operations in Auto permission mode
183
+ - Chat continuation: reply to completed agents, streaming text, markdown rendering
184
+ - Context chain: planner output flows automatically to builders
185
+ - Journalist: zero cold-start, synthesis on completion, 40K char budget
186
+ - Infinite Sessions: adaptive rotation, degradation detection (file churn, error trends)
187
+ - Token tracking: wired end-to-end, savings data real
188
+ - Unity-style nodes: rounded, Bezier spline connections, role badges
189
+ - Command Center: gauge charts, live telemetry, persistent across tab switches
190
+ - Coordination: knock protocol, task negotiation, memory containment
191
+
192
+ **Next steps:**
193
+ - Dashboard polish (Grafana-level wow factor)
194
+ - Monitor/QC agent mode (stay active, loop)
195
+ - Remote access (--host 0.0.0.0 + token auth)
196
+ - Semantic degradation detection
197
+ - Distribution: demo video, HN launch, Twitter content
package/LICENSE ADDED
@@ -0,0 +1,40 @@
1
+ Functional Source License, Version 1.1, Apache 2.0 Future License
2
+
3
+ Abbreviation
4
+
5
+ FSL-1.1-Apache-2.0
6
+
7
+ Notice
8
+
9
+ Copyright 2026 Rok (GROOVE)
10
+
11
+ Terms and Conditions
12
+
13
+ Licensor: Rok (GROOVE)
14
+ Software: GROOVE — Agent Orchestration Layer
15
+ Use Limitation: Any use that competes with the Software, including
16
+ offering a commercial product or service whose value
17
+ derives, entirely or substantially, from the Software's
18
+ functionality.
19
+
20
+ License Grant. Subject to the Use Limitation, Licensor grants you a
21
+ non-exclusive, worldwide, royalty-free license to use, copy, modify, and
22
+ distribute the Software.
23
+
24
+ Change License. Apache License, Version 2.0
25
+ Change Date: Two years from the date of each version release.
26
+
27
+ On the Change Date, or the fourth anniversary of the first publicly available
28
+ distribution of a specific version of the Software under this License,
29
+ whichever comes first, the above license grant and Use Limitation will be
30
+ replaced with the Change License.
31
+
32
+ You must conspicuously display this License on each copy of the Software or
33
+ a portion thereof, and the following notice:
34
+
35
+ This software is licensed under the Functional Source License, Version 1.1,
36
+ Apache 2.0 Future License. See LICENSE for details.
37
+
38
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
39
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
40
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
package/README.md ADDED
@@ -0,0 +1,115 @@
1
+ # GROOVE
2
+
3
+ **Orchestrate your AI coding agents. Stop losing context.**
4
+
5
+ The open-source orchestration layer for AI coding tools. Spawn teams of agents, coordinate their work, and never lose context — with a full GUI dashboard.
6
+
7
+ [![npm](https://img.shields.io/npm/v/groove-dev)](https://www.npmjs.com/package/groove-dev)
8
+ [![License](https://img.shields.io/badge/license-FSL--1.1--Apache--2.0-blue)](LICENSE)
9
+
10
+ ```bash
11
+ npm i -g groove-dev
12
+ groove start
13
+ ```
14
+
15
+ Open `http://localhost:31415` — your command center is ready.
16
+
17
+ ---
18
+
19
+ ## The Problem
20
+
21
+ AI coding agents waste your money and lose their way:
22
+
23
+ - **Cold starts** — every new agent spends thousands of tokens re-learning your codebase
24
+ - **Context degradation** — long sessions lead to hallucinations, circular refactors, lost direction
25
+ - **No coordination** — multiple agents edit the same files, create conflicts, duplicate work
26
+ - **Blind spending** — no visibility into token usage, no way to optimize costs
27
+
28
+ ## The Solution
29
+
30
+ GROOVE sits between you and your AI coding agents. It doesn't replace them — it makes them work together.
31
+
32
+ ### Zero Cold-Start (The Journalist)
33
+
34
+ A background AI continuously watches all agent activity and synthesizes it into a living project map. When any agent spawns or restarts, it reads one file and knows everything. No re-explaining your codebase. No wasted tokens on orientation.
35
+
36
+ ### Infinite Sessions (Context Rotation)
37
+
38
+ Instead of letting agents fill their context window until they degrade, GROOVE detects quality decline — error spikes, circular refactors, file churn — and automatically rotates: kill the session, spawn fresh, feed it the Journalist's context. The agent picks up exactly where it left off with a clean window. No compaction. No drift. Works at any codebase scale.
39
+
40
+ ### AI Project Manager
41
+
42
+ Agents in Auto mode knock on the PM before risky operations (creating files, deleting, modifying config). The PM reviews against the project plan and scope rules, then approves or rejects with reasoning. Full audit trail in the GUI.
43
+
44
+ ### Quick Launch
45
+
46
+ Spawn a planner, describe your project. The planner writes a detailed plan and recommends a team. Click **Launch Team** — all agents spawn with proper roles, scopes, and prompts. One click from idea to a full team building your app.
47
+
48
+ ### Multi-Agent Coordination
49
+
50
+ - **Introduction protocol** — every agent knows its teammates, their files, and their work
51
+ - **Scope ownership** — agents stay in their lane (backend touches `src/api/**`, frontend owns `src/components/**`)
52
+ - **Task negotiation** — duplicate roles get assigned non-overlapping work
53
+ - **Knock protocol** — agents signal before shared/destructive actions
54
+
55
+ ## Works With Everything
56
+
57
+ | Provider | Auth | Models |
58
+ |----------|------|--------|
59
+ | **Claude Code** | Subscription | Opus, Sonnet, Haiku |
60
+ | **Codex** | API Key | o3, o4-mini |
61
+ | **Gemini CLI** | API Key | 2.5 Pro, 2.5 Flash |
62
+ | **Aider** | API Key | Any |
63
+ | **Ollama** | Local | Any |
64
+
65
+ GROOVE is a process manager — it spawns actual AI tool binaries. It never proxies API calls, never touches OAuth tokens, never impersonates any client. Your AI tools talk directly to their servers.
66
+
67
+ Works in any terminal, any IDE, any OS. Technical and non-technical users alike.
68
+
69
+ ## The GUI
70
+
71
+ Open `http://localhost:31415` after starting the daemon:
72
+
73
+ - **Agent Tree** — visual node graph with Bezier spline connections, role badges, live status
74
+ - **Chat** — instruct agents, query without disrupting, continue completed agents, streaming text
75
+ - **Command Center** — gauge charts, live telemetry, token savings, model routing, adaptive thresholds
76
+ - **Quick Launch** — planner recommends team, one-click to spawn all
77
+ - **PM Review Log** — full audit trail of AI Project Manager decisions
78
+ - **Team Management** — save, load, export, import agent configurations
79
+
80
+ ## Adaptive Model Routing
81
+
82
+ GROOVE routes tasks to the cheapest model that can handle them. Planners get Opus (deep reasoning). Backends get Sonnet (balanced). Docs get Haiku (fast and cheap). The classifier learns from agent activity and adjusts over time.
83
+
84
+ | Tier | Cost | Used For |
85
+ |------|------|----------|
86
+ | Heavy (Opus) | $0.045/1K | Planning, architecture, complex refactors |
87
+ | Medium (Sonnet) | $0.009/1K | Backend, frontend, testing |
88
+ | Light (Haiku) | $0.002/1K | Docs, synthesis, simple queries |
89
+
90
+ ## Architecture
91
+
92
+ ```
93
+ ┌─────────────────────────────────────────┐
94
+ │ GROOVE DAEMON (:31415) │
95
+ │ │
96
+ │ Registry · Introducer · Lock Manager │
97
+ │ Journalist · Rotator · Adaptive │
98
+ │ Classifier · Router · PM · Teams │
99
+ │ │
100
+ │ REST API · WebSocket · GUI Server │
101
+ └─────────────────┬───────────────────────┘
102
+
103
+ ┌──────────────────────▼──────────────────────┐
104
+ │ Claude Code · Codex · Gemini · Aider · Ollama │
105
+ └─────────────────────────────────────────────┘
106
+ ```
107
+
108
+ ## Links
109
+
110
+ - **Website:** [groovedev.ai](https://groovedev.ai)
111
+ - **Documentation:** [docs.groovedev.ai](https://docs.groovedev.ai)
112
+ - **Changelog:** [docs.groovedev.ai/changelog](https://docs.groovedev.ai/changelog)
113
+ - **GitHub:** [github.com/grooveai-dev/groove](https://github.com/grooveai-dev/groove)
114
+ - **npm:** [npmjs.com/package/groove-dev](https://www.npmjs.com/package/groove-dev)
115
+ - **License:** [FSL-1.1-Apache-2.0](LICENSE) — source-available, converts to Apache 2.0 after 2 years