agent-groupchat 0.1.0__tar.gz

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 (38) hide show
  1. agent_groupchat-0.1.0/LICENSE +21 -0
  2. agent_groupchat-0.1.0/PKG-INFO +231 -0
  3. agent_groupchat-0.1.0/README.md +210 -0
  4. agent_groupchat-0.1.0/agent_groupchat/__init__.py +2 -0
  5. agent_groupchat-0.1.0/agent_groupchat/__main__.py +3 -0
  6. agent_groupchat-0.1.0/agent_groupchat/adapters/__init__.py +77 -0
  7. agent_groupchat-0.1.0/agent_groupchat/adapters/aider.py +126 -0
  8. agent_groupchat-0.1.0/agent_groupchat/adapters/base.py +137 -0
  9. agent_groupchat-0.1.0/agent_groupchat/adapters/claude.py +164 -0
  10. agent_groupchat-0.1.0/agent_groupchat/adapters/codex.py +115 -0
  11. agent_groupchat-0.1.0/agent_groupchat/adapters/gemini.py +142 -0
  12. agent_groupchat-0.1.0/agent_groupchat/adapters/gemini_talk_policy.toml +6 -0
  13. agent_groupchat-0.1.0/agent_groupchat/adapters/openai_api.py +113 -0
  14. agent_groupchat-0.1.0/agent_groupchat/adapters/openai_stream.py +77 -0
  15. agent_groupchat-0.1.0/agent_groupchat/config.py +81 -0
  16. agent_groupchat-0.1.0/agent_groupchat/platform_support.py +159 -0
  17. agent_groupchat-0.1.0/agent_groupchat/roles.py +112 -0
  18. agent_groupchat-0.1.0/agent_groupchat/server.py +1612 -0
  19. agent_groupchat-0.1.0/agent_groupchat/skills.py +57 -0
  20. agent_groupchat-0.1.0/agent_groupchat/static/index.html +1128 -0
  21. agent_groupchat-0.1.0/agent_groupchat.egg-info/PKG-INFO +231 -0
  22. agent_groupchat-0.1.0/agent_groupchat.egg-info/SOURCES.txt +36 -0
  23. agent_groupchat-0.1.0/agent_groupchat.egg-info/dependency_links.txt +1 -0
  24. agent_groupchat-0.1.0/agent_groupchat.egg-info/entry_points.txt +2 -0
  25. agent_groupchat-0.1.0/agent_groupchat.egg-info/top_level.txt +1 -0
  26. agent_groupchat-0.1.0/pyproject.toml +41 -0
  27. agent_groupchat-0.1.0/setup.cfg +4 -0
  28. agent_groupchat-0.1.0/tests/test_adapter_interface.py +72 -0
  29. agent_groupchat-0.1.0/tests/test_agents.py +224 -0
  30. agent_groupchat-0.1.0/tests/test_aider.py +111 -0
  31. agent_groupchat-0.1.0/tests/test_api_adapter.py +187 -0
  32. agent_groupchat-0.1.0/tests/test_chat.py +144 -0
  33. agent_groupchat-0.1.0/tests/test_gemini.py +94 -0
  34. agent_groupchat-0.1.0/tests/test_http.py +188 -0
  35. agent_groupchat-0.1.0/tests/test_multi_agent.py +196 -0
  36. agent_groupchat-0.1.0/tests/test_platform.py +137 -0
  37. agent_groupchat-0.1.0/tests/test_roles.py +283 -0
  38. agent_groupchat-0.1.0/tests/test_settings.py +101 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 MohammedAtya
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,231 @@
1
+ Metadata-Version: 2.4
2
+ Name: agent-groupchat
3
+ Version: 0.1.0
4
+ Summary: A local group chat between you and your AI agents (Claude Code, Codex, Gemini CLI, Aider, any OpenAI-compatible API), with roles and real permissions.
5
+ Author: MohammedAtya
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/MohammedAtya/agent-groupchat
8
+ Project-URL: Issues, https://github.com/MohammedAtya/agent-groupchat/issues
9
+ Keywords: ai,agents,claude-code,codex,gemini-cli,aider,group-chat,multi-agent
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Environment :: Web Environment
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Topic :: Software Development
17
+ Requires-Python: >=3.10
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Dynamic: license-file
21
+
22
+ # agent-groupchat
23
+
24
+ [![tests](https://github.com/MohammedAtya/agent-groupchat/actions/workflows/tests.yml/badge.svg)](https://github.com/MohammedAtya/agent-groupchat/actions/workflows/tests.yml)
25
+
26
+ **A group chat between you and your AI agents, running on your own computer.** Bring the AIs you
27
+ already have (Claude Code, Codex, Gemini CLI, Aider, or any OpenAI-compatible chat API), run
28
+ several copies of the same one, and give each a **role** with **permissions its CLI really
29
+ enforces**.
30
+
31
+ ![A real chat: Claude 1 plans, you OK the plan, Claude 2 does the work, Codex finds a bug, Claude 2 fixes it, Codex says LGTM](https://raw.githubusercontent.com/MohammedAtya/agent-groupchat/main/docs/demo.gif)
32
+
33
+ *A real, unscripted run: Claude 1 plans, you press Go ahead, Claude 2 edits and tests, Codex finds a real bug (VERDICT: FIX), Claude 2 fixes it automatically, and Codex approves.*
34
+
35
+ - **Any mix of agents**: e.g. *Claude 1* (Opus) leads, *Claude 2* (a cheaper model) tests,
36
+ *Codex* reviews, and a local *Llama* via Ollama gives a second opinion.
37
+ - **Roles that act in order**: Planner + Critic → ⏸️ your OK → Lead → Tester → Reviewer, with
38
+ automatic fix rounds when the Tester or Reviewer finds problems.
39
+ - **Real permissions, never quietly loosened**: *Talk only*, *Read*, *Edit files*,
40
+ *Edit + run commands* (sandboxed to the project folder) or *Auto*. Each agent's level maps to
41
+ its CLI's own permission flags, and a level an AI can't enforce is greyed out.
42
+ - **Real sessions**: every agent is a real CLI session in your project folder, so CLAUDE.md /
43
+ AGENTS.md, skills, hooks and MCP servers work as usual, and you can continue any session from
44
+ a terminal.
45
+ - **Standard library only**: Python 3.10+, no dependencies. Runs on Linux, macOS and Windows.
46
+
47
+ ## Install
48
+
49
+ ```bash
50
+ pipx install agent-groupchat # or: uvx agent-groupchat
51
+ agent-groupchat # opens http://127.0.0.1:8765 in your browser
52
+ ```
53
+
54
+ You also need at least one AI: a CLI you're already logged into ([Claude Code](https://code.claude.com/docs/en/overview),
55
+ [Codex CLI](https://github.com/openai/codex), [Gemini CLI](https://github.com/google-gemini/gemini-cli),
56
+ [Aider](https://aider.chat)) or a chat API (see [Agents](#agents)).
57
+
58
+ From source: `git clone https://github.com/MohammedAtya/agent-groupchat && cd agent-groupchat && python3 -m agent_groupchat`.
59
+
60
+ Options: `--port 9000`, `--no-browser`, `--version`. If the port is taken it uses the next free
61
+ one; if agent-groupchat is already running, it just opens it. Stop it with Ctrl+C.
62
+
63
+ ## Quick start
64
+
65
+ 1. **+ New chat**: pick a project folder and the agents. For each one choose the AI, an optional
66
+ name and model, its **roles** and (optionally) a different **permission**. Or start from a
67
+ saved **Team**, and **💾 Save as team** to reuse a setup.
68
+ 2. Write a message. The hint above the box says who will answer, e.g.
69
+ `→ Claude 1 plans → ⏸️ your OK → Claude 2 works → Codex reviews`.
70
+ 3. **@name** asks one agent directly: `@claude-2`, `@codex`; `@claude` reaches every Claude copy.
71
+ 4. While they work you see what each one is doing (`✏️ editing app.py`, `$ pytest`). **■ Stop**
72
+ ends the turn; **▸ Diff** under a reply shows exactly what it changed.
73
+
74
+ ## Agents
75
+
76
+ | AI | What you need | Permission levels it can enforce |
77
+ |---|---|---|
78
+ | Claude Code | `claude`, logged in | all five |
79
+ | Codex CLI | `codex`, logged in | Talk*, Read, Edit + run commands, Auto |
80
+ | Gemini CLI | `gemini`, logged in | Talk, Read, Edit, Edit + run commands (needs Docker/Podman; Seatbelt on macOS) |
81
+ | Aider | `aider` + a model name (e.g. `sonnet`) | Talk*, Read, Edit |
82
+ | Chat API | an OpenAI-compatible endpoint | Talk only (it sees the chat, not your files) |
83
+
84
+ \* can't be stopped from reading files: it stays read-only and is told to only discuss.
85
+
86
+ **⚙ Settings → Agents** shows which CLIs are installed (with a **Test** button) and lets you add
87
+ chat APIs: OpenAI, Ollama, OpenRouter, Groq, LM Studio… They're saved in
88
+ `~/.agent-groupchat/config.json`:
89
+
90
+ ```json
91
+ {"apis": [
92
+ {"id": "llama", "name": "Llama", "base_url": "http://localhost:11434/v1", "model": "llama3.1"},
93
+ {"id": "gpt", "name": "GPT", "base_url": "https://api.openai.com/v1", "model": "gpt-4.1",
94
+ "key_env": "OPENAI_API_KEY"}
95
+ ]}
96
+ ```
97
+
98
+ `key_env` is the **name** of the environment variable holding the API key. The key itself is never
99
+ stored, and Settings refuses a value that looks like a key.
100
+
101
+ Aider runs with every prompt answered automatically, so everything risky it would agree to is
102
+ switched off: shell commands, git commits, `.gitignore` edits, self-updates. Its history files live
103
+ in `~/.agent-groupchat/sessions/`, not in your project.
104
+
105
+ ## Roles and the order of turns
106
+
107
+ | Role | Job | Default permission |
108
+ |---|---|---|
109
+ | **Planner** | breaks the request into steps and asks questions before any work starts | Read |
110
+ | **Critic** | challenges the idea, looks for what everyone missed | Read |
111
+ | **Lead** | does the work | Edit + run commands |
112
+ | **Tester** | writes and runs tests; must not change the code under test | Edit + run commands |
113
+ | **Reviewer** | checks the Lead's changes, says what to fix or LGTM | Read |
114
+ | **Participant** | no special job (agents without a role) | Edit + run commands |
115
+
116
+ - A plain message runs the roles in order: **Planner + Critic → ⏸️ your OK → Lead → Tester →
117
+ Reviewer**. Roles nobody holds are skipped; agents without a role answer directly.
118
+ - After the plan, the chat waits: press **▶ Go ahead**, or reply to change the plan.
119
+ - The Tester and Reviewer end with `VERDICT: LGTM` or `VERDICT: FIX`. On FIX the Lead fixes it
120
+ automatically (0–3 rounds, default 1), then it comes back to you.
121
+ - An agent can hold several roles (it gets the highest default); several agents can share a role.
122
+ The same agent can't be Lead *and* Reviewer of its own work (two copies of one AI can).
123
+ - **⚙ Settings → Roles**: copy a built-in role or write your own (name, job, default permission).
124
+
125
+ ## Permissions
126
+
127
+ | Permission | Claude Code | Codex | Gemini CLI | Aider | Chat API |
128
+ |---|---|---|---|---|---|
129
+ | Talk only | no tools at all | read-only sandbox, told to only discuss | every tool denied | ask mode, told to only discuss | ✓ |
130
+ | Read | read/search tools, `git diff/log/status`, tests (in the sandbox) | read-only sandbox | read/search tools | ask mode | – |
131
+ | Edit files | edit tools in the folder, **no** commands | – | `auto_edit`: edits, no shell | code mode, no shell, no commits | – |
132
+ | Edit + run commands | edits + commands, sandboxed to the folder | `workspace-write` sandbox | `yolo` inside Gemini's sandbox | – | – |
133
+ | Auto | auto mode: a classifier blocks risky actions | "approve for me": an automatic reviewer | – | – | – |
134
+
135
+ - Under **Team** you can raise or lower any agent's permission; ⚠ marks a raised one, and Auto
136
+ asks you to confirm.
137
+ - **🔒 Lock** drops every agent to *Talk only* at once, and unlocking restores them.
138
+ - Agents that can edit take turns (one at a time); read-only agents work in parallel.
139
+ - After every reply the folder is compared before and after: a read-only agent that changed files,
140
+ or a Tester that changed non-test code, gets a ⚠ under its reply.
141
+
142
+ ## Safety
143
+
144
+ - **It acts on your files.** *Edit* and *Edit + run commands* let agents change your project.
145
+ Use git, and start with the 🔒 Lock or read-only roles if you're unsure.
146
+ - **Auto** lets an agent decide on its own (risky actions are blocked by Claude Code's classifier
147
+ or Codex's reviewer). Use it in folders you can afford to have changed.
148
+ - **Sandboxes**: commands are confined to the project folder by the agents' own sandboxes. If a
149
+ sandbox isn't available, the affected levels drop down (the agent's chip says *(limited)*);
150
+ they never run unconfined.
151
+ - **More agents = more cost.** Every agent reads the chat on each turn. **Compact** summarizes a
152
+ long chat so fresh sessions continue from the summary.
153
+ - **Local only**: the server listens on 127.0.0.1, and only its own page can drive it (Host and
154
+ Origin checks plus a token that's new on every launch). Your chats stay in
155
+ `~/.agent-groupchat/`; nothing is sent anywhere except to the AIs you chose.
156
+
157
+ ## Platforms
158
+
159
+ | OS | What works |
160
+ |---|---|
161
+ | Linux | Everything. Commands run in a bubblewrap sandbox (see below). |
162
+ | macOS | Everything. Claude Code and Codex use the built-in macOS sandbox. |
163
+ | Windows, in WSL | Everything (it's Linux). |
164
+ | Windows, native | Talk, Read and Edit. Commands and Auto need a sandbox the agents don't have on native Windows, so they're greyed out and the page suggests WSL. |
165
+
166
+ ### Enable the sandbox (Linux)
167
+
168
+ Claude Code and Codex confine commands with `bubblewrap`. Install it if it's missing
169
+ (`sudo apt install bubblewrap`, `sudo dnf install bubblewrap`, …). On **Ubuntu 23.10+ / 24.04**
170
+ AppArmor also blocks it (`bwrap: setting up uid map: Permission denied`). The one-time fix:
171
+
172
+ ```bash
173
+ sudo tee /etc/apparmor.d/bwrap >/dev/null <<'EOF'
174
+ abi <abi/4.0>,
175
+ include <tunables/global>
176
+
177
+ profile bwrap /usr/bin/bwrap flags=(unconfined) {
178
+ userns,
179
+ include if exists <local/bwrap>
180
+ }
181
+ EOF
182
+ sudo apparmor_parser -r /etc/apparmor.d/bwrap
183
+ bwrap --ro-bind / / true && echo "sandbox OK"
184
+ ```
185
+
186
+ This lets `bwrap` (and only `bwrap`) create user namespaces again, which is the setup Ubuntu
187
+ documents for sandboxing tools. The page notices within about a minute.
188
+
189
+ ## More features
190
+
191
+ - **Discussion rounds**: after they all answer, agents can reply to each other for 1–3 rounds
192
+ (each stays quiet if it has nothing to add). **Hand-offs**: an agent that addresses another
193
+ (`@codex …`, `Claude 2, can you …`) gets an answer from it.
194
+ - **Skills**: type `/` for the skills your agents have; a skill runs on the agents that have it.
195
+ - **Live preview, reply stats** (time, ≈ cost, tokens, files changed), **↻ Retry** for failed
196
+ replies, **↩ Reply** to one agent, **Markdown** with Copy buttons, **Export** as Markdown.
197
+ - **Continue in a terminal**: the bottom of each chat shows `claude -r <id>`, `codex resume <id>`
198
+ or `gemini --resume <id>` for every agent.
199
+ - **Old chats**: if you used the earlier single-folder version (`~/groupchat`), the page offers
200
+ to import copies of its chats once.
201
+
202
+ ## Your data
203
+
204
+ Everything lives in `~/.agent-groupchat/` (set `AGENT_GROUPCHAT_HOME` to move it): `chats/`,
205
+ `sessions/` (chat-API and Aider history), `logs/` and `config.json` (chat APIs, your roles,
206
+ teams). Deleting a chat on the page doesn't delete the agents' own sessions.
207
+
208
+ ## Development
209
+
210
+ ```bash
211
+ python3 -m unittest discover -s tests -t . # ~140 tests, ~10 s, no AI calls
212
+ python3 -m agent_groupchat --no-browser # run from the source folder
213
+ ```
214
+
215
+ The tests use a fake agent CLI (`tests/bin/fake_agent.py`) that speaks each real CLI's output
216
+ format, so they cost nothing. GitHub Actions runs them on Linux, macOS and Windows (Python 3.10 and
217
+ 3.13) and installs the package with pipx on all three on every push.
218
+
219
+ Layout: `agent_groupchat/server.py` (chat engine + web server), `roles.py`, `config.py`,
220
+ `platform_support.py`, `adapters/` (one file per AI: `claude.py`, `codex.py`, `gemini.py`,
221
+ `aider.py`, `openai_api.py`), `static/index.html` (the page). Adding an AI means writing one
222
+ adapter (see `adapters/base.py`). The design is in [SPEC.md](https://github.com/MohammedAtya/agent-groupchat/blob/main/SPEC.md).
223
+
224
+ ## Credits
225
+
226
+ Works well with [Matt Pocock's skills](https://github.com/mattpocock/skills) (`/grill-me`,
227
+ `/tdd`, …): install them for your agents and type `/` in the chat.
228
+
229
+ ## License
230
+
231
+ [MIT](https://github.com/MohammedAtya/agent-groupchat/blob/main/LICENSE)
@@ -0,0 +1,210 @@
1
+ # agent-groupchat
2
+
3
+ [![tests](https://github.com/MohammedAtya/agent-groupchat/actions/workflows/tests.yml/badge.svg)](https://github.com/MohammedAtya/agent-groupchat/actions/workflows/tests.yml)
4
+
5
+ **A group chat between you and your AI agents, running on your own computer.** Bring the AIs you
6
+ already have (Claude Code, Codex, Gemini CLI, Aider, or any OpenAI-compatible chat API), run
7
+ several copies of the same one, and give each a **role** with **permissions its CLI really
8
+ enforces**.
9
+
10
+ ![A real chat: Claude 1 plans, you OK the plan, Claude 2 does the work, Codex finds a bug, Claude 2 fixes it, Codex says LGTM](https://raw.githubusercontent.com/MohammedAtya/agent-groupchat/main/docs/demo.gif)
11
+
12
+ *A real, unscripted run: Claude 1 plans, you press Go ahead, Claude 2 edits and tests, Codex finds a real bug (VERDICT: FIX), Claude 2 fixes it automatically, and Codex approves.*
13
+
14
+ - **Any mix of agents**: e.g. *Claude 1* (Opus) leads, *Claude 2* (a cheaper model) tests,
15
+ *Codex* reviews, and a local *Llama* via Ollama gives a second opinion.
16
+ - **Roles that act in order**: Planner + Critic → ⏸️ your OK → Lead → Tester → Reviewer, with
17
+ automatic fix rounds when the Tester or Reviewer finds problems.
18
+ - **Real permissions, never quietly loosened**: *Talk only*, *Read*, *Edit files*,
19
+ *Edit + run commands* (sandboxed to the project folder) or *Auto*. Each agent's level maps to
20
+ its CLI's own permission flags, and a level an AI can't enforce is greyed out.
21
+ - **Real sessions**: every agent is a real CLI session in your project folder, so CLAUDE.md /
22
+ AGENTS.md, skills, hooks and MCP servers work as usual, and you can continue any session from
23
+ a terminal.
24
+ - **Standard library only**: Python 3.10+, no dependencies. Runs on Linux, macOS and Windows.
25
+
26
+ ## Install
27
+
28
+ ```bash
29
+ pipx install agent-groupchat # or: uvx agent-groupchat
30
+ agent-groupchat # opens http://127.0.0.1:8765 in your browser
31
+ ```
32
+
33
+ You also need at least one AI: a CLI you're already logged into ([Claude Code](https://code.claude.com/docs/en/overview),
34
+ [Codex CLI](https://github.com/openai/codex), [Gemini CLI](https://github.com/google-gemini/gemini-cli),
35
+ [Aider](https://aider.chat)) or a chat API (see [Agents](#agents)).
36
+
37
+ From source: `git clone https://github.com/MohammedAtya/agent-groupchat && cd agent-groupchat && python3 -m agent_groupchat`.
38
+
39
+ Options: `--port 9000`, `--no-browser`, `--version`. If the port is taken it uses the next free
40
+ one; if agent-groupchat is already running, it just opens it. Stop it with Ctrl+C.
41
+
42
+ ## Quick start
43
+
44
+ 1. **+ New chat**: pick a project folder and the agents. For each one choose the AI, an optional
45
+ name and model, its **roles** and (optionally) a different **permission**. Or start from a
46
+ saved **Team**, and **💾 Save as team** to reuse a setup.
47
+ 2. Write a message. The hint above the box says who will answer, e.g.
48
+ `→ Claude 1 plans → ⏸️ your OK → Claude 2 works → Codex reviews`.
49
+ 3. **@name** asks one agent directly: `@claude-2`, `@codex`; `@claude` reaches every Claude copy.
50
+ 4. While they work you see what each one is doing (`✏️ editing app.py`, `$ pytest`). **■ Stop**
51
+ ends the turn; **▸ Diff** under a reply shows exactly what it changed.
52
+
53
+ ## Agents
54
+
55
+ | AI | What you need | Permission levels it can enforce |
56
+ |---|---|---|
57
+ | Claude Code | `claude`, logged in | all five |
58
+ | Codex CLI | `codex`, logged in | Talk*, Read, Edit + run commands, Auto |
59
+ | Gemini CLI | `gemini`, logged in | Talk, Read, Edit, Edit + run commands (needs Docker/Podman; Seatbelt on macOS) |
60
+ | Aider | `aider` + a model name (e.g. `sonnet`) | Talk*, Read, Edit |
61
+ | Chat API | an OpenAI-compatible endpoint | Talk only (it sees the chat, not your files) |
62
+
63
+ \* can't be stopped from reading files: it stays read-only and is told to only discuss.
64
+
65
+ **⚙ Settings → Agents** shows which CLIs are installed (with a **Test** button) and lets you add
66
+ chat APIs: OpenAI, Ollama, OpenRouter, Groq, LM Studio… They're saved in
67
+ `~/.agent-groupchat/config.json`:
68
+
69
+ ```json
70
+ {"apis": [
71
+ {"id": "llama", "name": "Llama", "base_url": "http://localhost:11434/v1", "model": "llama3.1"},
72
+ {"id": "gpt", "name": "GPT", "base_url": "https://api.openai.com/v1", "model": "gpt-4.1",
73
+ "key_env": "OPENAI_API_KEY"}
74
+ ]}
75
+ ```
76
+
77
+ `key_env` is the **name** of the environment variable holding the API key. The key itself is never
78
+ stored, and Settings refuses a value that looks like a key.
79
+
80
+ Aider runs with every prompt answered automatically, so everything risky it would agree to is
81
+ switched off: shell commands, git commits, `.gitignore` edits, self-updates. Its history files live
82
+ in `~/.agent-groupchat/sessions/`, not in your project.
83
+
84
+ ## Roles and the order of turns
85
+
86
+ | Role | Job | Default permission |
87
+ |---|---|---|
88
+ | **Planner** | breaks the request into steps and asks questions before any work starts | Read |
89
+ | **Critic** | challenges the idea, looks for what everyone missed | Read |
90
+ | **Lead** | does the work | Edit + run commands |
91
+ | **Tester** | writes and runs tests; must not change the code under test | Edit + run commands |
92
+ | **Reviewer** | checks the Lead's changes, says what to fix or LGTM | Read |
93
+ | **Participant** | no special job (agents without a role) | Edit + run commands |
94
+
95
+ - A plain message runs the roles in order: **Planner + Critic → ⏸️ your OK → Lead → Tester →
96
+ Reviewer**. Roles nobody holds are skipped; agents without a role answer directly.
97
+ - After the plan, the chat waits: press **▶ Go ahead**, or reply to change the plan.
98
+ - The Tester and Reviewer end with `VERDICT: LGTM` or `VERDICT: FIX`. On FIX the Lead fixes it
99
+ automatically (0–3 rounds, default 1), then it comes back to you.
100
+ - An agent can hold several roles (it gets the highest default); several agents can share a role.
101
+ The same agent can't be Lead *and* Reviewer of its own work (two copies of one AI can).
102
+ - **⚙ Settings → Roles**: copy a built-in role or write your own (name, job, default permission).
103
+
104
+ ## Permissions
105
+
106
+ | Permission | Claude Code | Codex | Gemini CLI | Aider | Chat API |
107
+ |---|---|---|---|---|---|
108
+ | Talk only | no tools at all | read-only sandbox, told to only discuss | every tool denied | ask mode, told to only discuss | ✓ |
109
+ | Read | read/search tools, `git diff/log/status`, tests (in the sandbox) | read-only sandbox | read/search tools | ask mode | – |
110
+ | Edit files | edit tools in the folder, **no** commands | – | `auto_edit`: edits, no shell | code mode, no shell, no commits | – |
111
+ | Edit + run commands | edits + commands, sandboxed to the folder | `workspace-write` sandbox | `yolo` inside Gemini's sandbox | – | – |
112
+ | Auto | auto mode: a classifier blocks risky actions | "approve for me": an automatic reviewer | – | – | – |
113
+
114
+ - Under **Team** you can raise or lower any agent's permission; ⚠ marks a raised one, and Auto
115
+ asks you to confirm.
116
+ - **🔒 Lock** drops every agent to *Talk only* at once, and unlocking restores them.
117
+ - Agents that can edit take turns (one at a time); read-only agents work in parallel.
118
+ - After every reply the folder is compared before and after: a read-only agent that changed files,
119
+ or a Tester that changed non-test code, gets a ⚠ under its reply.
120
+
121
+ ## Safety
122
+
123
+ - **It acts on your files.** *Edit* and *Edit + run commands* let agents change your project.
124
+ Use git, and start with the 🔒 Lock or read-only roles if you're unsure.
125
+ - **Auto** lets an agent decide on its own (risky actions are blocked by Claude Code's classifier
126
+ or Codex's reviewer). Use it in folders you can afford to have changed.
127
+ - **Sandboxes**: commands are confined to the project folder by the agents' own sandboxes. If a
128
+ sandbox isn't available, the affected levels drop down (the agent's chip says *(limited)*);
129
+ they never run unconfined.
130
+ - **More agents = more cost.** Every agent reads the chat on each turn. **Compact** summarizes a
131
+ long chat so fresh sessions continue from the summary.
132
+ - **Local only**: the server listens on 127.0.0.1, and only its own page can drive it (Host and
133
+ Origin checks plus a token that's new on every launch). Your chats stay in
134
+ `~/.agent-groupchat/`; nothing is sent anywhere except to the AIs you chose.
135
+
136
+ ## Platforms
137
+
138
+ | OS | What works |
139
+ |---|---|
140
+ | Linux | Everything. Commands run in a bubblewrap sandbox (see below). |
141
+ | macOS | Everything. Claude Code and Codex use the built-in macOS sandbox. |
142
+ | Windows, in WSL | Everything (it's Linux). |
143
+ | Windows, native | Talk, Read and Edit. Commands and Auto need a sandbox the agents don't have on native Windows, so they're greyed out and the page suggests WSL. |
144
+
145
+ ### Enable the sandbox (Linux)
146
+
147
+ Claude Code and Codex confine commands with `bubblewrap`. Install it if it's missing
148
+ (`sudo apt install bubblewrap`, `sudo dnf install bubblewrap`, …). On **Ubuntu 23.10+ / 24.04**
149
+ AppArmor also blocks it (`bwrap: setting up uid map: Permission denied`). The one-time fix:
150
+
151
+ ```bash
152
+ sudo tee /etc/apparmor.d/bwrap >/dev/null <<'EOF'
153
+ abi <abi/4.0>,
154
+ include <tunables/global>
155
+
156
+ profile bwrap /usr/bin/bwrap flags=(unconfined) {
157
+ userns,
158
+ include if exists <local/bwrap>
159
+ }
160
+ EOF
161
+ sudo apparmor_parser -r /etc/apparmor.d/bwrap
162
+ bwrap --ro-bind / / true && echo "sandbox OK"
163
+ ```
164
+
165
+ This lets `bwrap` (and only `bwrap`) create user namespaces again, which is the setup Ubuntu
166
+ documents for sandboxing tools. The page notices within about a minute.
167
+
168
+ ## More features
169
+
170
+ - **Discussion rounds**: after they all answer, agents can reply to each other for 1–3 rounds
171
+ (each stays quiet if it has nothing to add). **Hand-offs**: an agent that addresses another
172
+ (`@codex …`, `Claude 2, can you …`) gets an answer from it.
173
+ - **Skills**: type `/` for the skills your agents have; a skill runs on the agents that have it.
174
+ - **Live preview, reply stats** (time, ≈ cost, tokens, files changed), **↻ Retry** for failed
175
+ replies, **↩ Reply** to one agent, **Markdown** with Copy buttons, **Export** as Markdown.
176
+ - **Continue in a terminal**: the bottom of each chat shows `claude -r <id>`, `codex resume <id>`
177
+ or `gemini --resume <id>` for every agent.
178
+ - **Old chats**: if you used the earlier single-folder version (`~/groupchat`), the page offers
179
+ to import copies of its chats once.
180
+
181
+ ## Your data
182
+
183
+ Everything lives in `~/.agent-groupchat/` (set `AGENT_GROUPCHAT_HOME` to move it): `chats/`,
184
+ `sessions/` (chat-API and Aider history), `logs/` and `config.json` (chat APIs, your roles,
185
+ teams). Deleting a chat on the page doesn't delete the agents' own sessions.
186
+
187
+ ## Development
188
+
189
+ ```bash
190
+ python3 -m unittest discover -s tests -t . # ~140 tests, ~10 s, no AI calls
191
+ python3 -m agent_groupchat --no-browser # run from the source folder
192
+ ```
193
+
194
+ The tests use a fake agent CLI (`tests/bin/fake_agent.py`) that speaks each real CLI's output
195
+ format, so they cost nothing. GitHub Actions runs them on Linux, macOS and Windows (Python 3.10 and
196
+ 3.13) and installs the package with pipx on all three on every push.
197
+
198
+ Layout: `agent_groupchat/server.py` (chat engine + web server), `roles.py`, `config.py`,
199
+ `platform_support.py`, `adapters/` (one file per AI: `claude.py`, `codex.py`, `gemini.py`,
200
+ `aider.py`, `openai_api.py`), `static/index.html` (the page). Adding an AI means writing one
201
+ adapter (see `adapters/base.py`). The design is in [SPEC.md](https://github.com/MohammedAtya/agent-groupchat/blob/main/SPEC.md).
202
+
203
+ ## Credits
204
+
205
+ Works well with [Matt Pocock's skills](https://github.com/mattpocock/skills) (`/grill-me`,
206
+ `/tdd`, …): install them for your agents and type `/` in the chat.
207
+
208
+ ## License
209
+
210
+ [MIT](https://github.com/MohammedAtya/agent-groupchat/blob/main/LICENSE)
@@ -0,0 +1,2 @@
1
+ """agent-groupchat: a local group chat between you and your AI agents."""
2
+ __version__ = "0.1.0"
@@ -0,0 +1,3 @@
1
+ from .server import main
2
+
3
+ main()
@@ -0,0 +1,77 @@
1
+ """All available agent adapters, keyed by id: the built-in CLIs plus the chat APIs
2
+ configured in config.json ("apis"). ADAPTERS is updated in place by load_adapters(), so
3
+ modules that imported it see changes."""
4
+ import json
5
+ import os
6
+ import re
7
+
8
+ from .aider import AiderAdapter
9
+ from .base import Adapter, MissingAdapter, RunContext
10
+ from .claude import ClaudeAdapter
11
+ from .codex import CodexAdapter
12
+ from .gemini import GeminiAdapter
13
+ from .openai_api import OpenAIChatAdapter
14
+
15
+ BUILTIN = [ClaudeAdapter(), CodexAdapter(), GeminiAdapter(), AiderAdapter()]
16
+ ADAPTERS = {a.id: a for a in BUILTIN}
17
+ _loaded = {"file": None, "mtime": None}
18
+
19
+ ID_RE = re.compile(r"^[a-z0-9][a-z0-9-]{0,30}$")
20
+ URL_RE = re.compile(r"^https?://[^\s]+$")
21
+ ENV_RE = re.compile(r"^[A-Za-z_][A-Za-z0-9_]{0,80}$")
22
+
23
+
24
+ def parse_apis(items):
25
+ """Validate config.json "apis" -> [OpenAIChatAdapter]. Raises ValueError."""
26
+ out, seen = [], {a.id for a in BUILTIN}
27
+ for it in items or []:
28
+ if not isinstance(it, dict):
29
+ raise ValueError(f"Each API must be an object: {it!r}")
30
+ aid = str(it.get("id") or "").strip().lower()
31
+ name = str(it.get("name") or "").strip()
32
+ url, model = str(it.get("base_url") or "").strip(), str(it.get("model") or "").strip()
33
+ key_env = str(it.get("key_env") or "").strip()
34
+ if not ID_RE.match(aid) or aid in seen:
35
+ raise ValueError(f"API id {aid!r}: lowercase letters, digits and -, unique, "
36
+ "and not claude/codex/gemini/aider.")
37
+ if not name or len(name) > 30:
38
+ raise ValueError(f"API {aid}: a name of 1-30 characters is needed.")
39
+ if not URL_RE.match(url):
40
+ raise ValueError(f"API {aid}: base_url must start with http:// or https://")
41
+ if not model or len(model) > 100 or any(c.isspace() for c in model):
42
+ raise ValueError(f"API {aid}: a model name is needed (no spaces).")
43
+ if key_env and not ENV_RE.match(key_env):
44
+ raise ValueError(f"API {aid}: key_env is the NAME of an environment variable, "
45
+ "like OPENAI_API_KEY (never the key itself).")
46
+ seen.add(aid)
47
+ out.append(OpenAIChatAdapter(aid, name, url, model, key_env))
48
+ return out
49
+
50
+
51
+ def load_adapters(config_file=None, force=False):
52
+ """(Re)build ADAPTERS from the built-ins and config.json. Cheap when nothing changed.
53
+ A broken config keeps the built-ins and returns the error message."""
54
+ try:
55
+ mtime = os.path.getmtime(config_file) if config_file else None
56
+ except OSError:
57
+ mtime = None
58
+ if not force and _loaded["file"] == config_file and _loaded["mtime"] == mtime:
59
+ return ""
60
+ _loaded.update(file=config_file, mtime=mtime)
61
+ error, apis = "", []
62
+ if mtime is not None:
63
+ try:
64
+ with open(config_file, encoding="utf-8") as f:
65
+ apis = parse_apis(json.load(f).get("apis"))
66
+ except (OSError, ValueError, AttributeError) as e:
67
+ error = f"config.json: {e}"
68
+ ADAPTERS.clear()
69
+ ADAPTERS.update({a.id: a for a in BUILTIN + apis})
70
+ return error
71
+
72
+
73
+ def get(aid):
74
+ return ADAPTERS.get(aid) or MissingAdapter(aid)
75
+
76
+
77
+ __all__ = ["ADAPTERS", "Adapter", "RunContext", "load_adapters", "get", "parse_apis"]