agent-council 0.1.0 → 0.2.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.
- checksums.yaml +4 -4
- data/DESIGN.md +126 -51
- data/INSTALL.md +14 -5
- data/README.md +525 -176
- data/RELEASE_NOTES.md +130 -18
- data/RUNAWAY_AGENTS.md +181 -0
- data/USE_CASES.md +135 -0
- data/examples/configs/consolidated.yml +13 -7
- data/examples/configs/mixed-harness.yml +24 -0
- data/examples/configs/single.yml +2 -1
- data/examples/prompts/recommend-model-ensemble-prompt.md +3 -1
- data/examples/prompts/review-docs-prompt.md +1 -1
- data/examples/prompts/review-latest-commit-prompt.md +4 -1
- data/examples/prompts/review-pull-request-prompt.md +1 -1
- data/examples/prompts/state-of-the-code-base-prompt.md +0 -7
- data/examples/prompts/test-coverage-analysis-prompt.md +24 -37
- data/exe/agent-council +4 -0
- data/lib/agent_council/harnesses/claude_code_harness.rb +205 -0
- data/lib/agent_council/harnesses/pi_harness.rb +23 -45
- data/lib/agent_council/harnesses/scaffold.rb +44 -0
- data/lib/agent_council/harnesses.rb +58 -0
- data/lib/agent_council/pi_models.rb +1 -1
- data/lib/agent_council/templates/analyst_format.md +2 -2
- data/lib/agent_council/templates/consolidate_prompt.md +12 -8
- data/lib/agent_council/version.rb +1 -1
- data/lib/agent_council/worker_pool.rb +6 -4
- data/lib/agent_council.rb +391 -148
- metadata +15 -9
- data/code-review-agents.md +0 -28
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 751f5a003739afdc2ba0e6abcd22f9707e79e728afe1e6f35e1a136c52702ad1
|
|
4
|
+
data.tar.gz: 657e7acddaa861b9c4e7833dd04143c7ca9338e39dfbbe4e7d3b865e77c1ec0d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 997f29373d301c1ca163544d77ae9326a70085ee843f98414b8348f486acfccb7395b892e6016b79d88f59e715f4f5a578ee4d1448d85fec59d2553a95d3a000
|
|
7
|
+
data.tar.gz: dd10b7039737ded71e0b34f4efdf6aaa4e5ba11a5f8975d0bb7a6533d7eec7e6174fef947aaf58f316c22d08aef5c3e7540cc1f6f3f95ed15c8331182854c2a1
|
data/DESIGN.md
CHANGED
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
The long-term goal is to collect genuinely different viewpoints on the same question from multiple harness/model instances, and, because every instance gets the identical task, to compare those instances against each other on speed, token usage, cost, and quality.
|
|
6
6
|
|
|
7
|
-
This repository is the first step: it varies
|
|
7
|
+
This repository is the first step: it varies the models and, per agent, the harness, which is Pi (for any provider's models) or Claude Code (for Anthropic's). More harnesses may follow (§18).
|
|
8
8
|
|
|
9
9
|
It is packaged as a gem for easy installation, but it is intentionally not a general-purpose framework.
|
|
10
10
|
|
|
11
|
-
agent-council is a small Ruby CLI that runs the **same prompt** through several AI
|
|
11
|
+
agent-council is a small Ruby CLI that runs the **same prompt** through several AI harness/provider/model combinations, under the Pi or Claude Code coding-agent harness, and saves each final response to a deterministic Markdown file.
|
|
12
12
|
|
|
13
13
|
The objective is utility, not completeness. Given a config (§5), one command:
|
|
14
14
|
|
|
@@ -51,7 +51,8 @@ For example:
|
|
|
51
51
|
+-------------+-------------+
|
|
52
52
|
| | |
|
|
53
53
|
v v v
|
|
54
|
-
Pi +
|
|
54
|
+
Pi + Kimi Pi + GLM Claude Code
|
|
55
|
+
+ Opus
|
|
55
56
|
| | |
|
|
56
57
|
v v v
|
|
57
58
|
report report report
|
|
@@ -61,17 +62,19 @@ For example:
|
|
|
61
62
|
|
|
62
63
|
## 4. Architecture
|
|
63
64
|
|
|
64
|
-
|
|
65
|
+
There are two harnesses, pi and Claude Code, and the orchestration is harness-agnostic: it looks up each agent's harness module by its config entry's `harness` key (§5) in `AgentCouncil::Harnesses::BY_NAME` (`lib/agent_council/harnesses.rb`), so another harness is another such module, added there. Every config entry names its harness (§5); reports and `run.json` entries always record theirs, and one that gives none (hand-edited, or older than 0.1.0, when every agent ran under pi) is read as pi's. Each module is a plain namespace with the same functions (`NAME`, `argv`, `usage`, `error_message`, `exit_detail`, `warnings`, `final_response`, `assistant_messages`); `NAME` is both the config value and the executable that `argv` runs, which the startup check looks for on `PATH`, and goes into filenames unsanitized, so it must be filename-safe. Claude Code takes no provider argument, so a Claude Code entry's provider only labels the agent. The scaffolding text (§10) is shared.
|
|
65
66
|
|
|
66
|
-
The
|
|
67
|
+
**Labels.** The short labels (`#1 provider / model`) don't show the harness. They appear in progress lines, result tables, the consolidation prompt, and a consolidated report's `### Sources` table and `sources` front matter. The startup agent list, each report's byline table, and the findings file's legend (`#1 pi / provider / model`) do show it. Short labels don't need the harness to stay unique: the only ones used as lookup keys are the analysts', which match reports to their `run.json` entries and to the configured agents, and each carries its agent number. Nor does the consolidator need it in the labels, since each report it reads states its harness in its byline (§12). So they stay as they are, and a mixed run's output reads the same as before.
|
|
68
|
+
|
|
69
|
+
The Ruby program owns orchestration and invokes the harness once per configured agent.
|
|
67
70
|
|
|
68
71
|
```text
|
|
69
72
|
Ruby CLI
|
|
70
73
|
|
|
|
71
74
|
+-- Pi + model A
|
|
72
75
|
+-- Pi + model B
|
|
73
|
-
+--
|
|
74
|
-
+--
|
|
76
|
+
+-- Claude Code + model C
|
|
77
|
+
+-- Claude Code + model D
|
|
75
78
|
```
|
|
76
79
|
|
|
77
80
|
---
|
|
@@ -84,24 +87,35 @@ Example:
|
|
|
84
87
|
|
|
85
88
|
```yaml
|
|
86
89
|
agents:
|
|
87
|
-
-
|
|
90
|
+
- harness: pi
|
|
91
|
+
provider: anthropic
|
|
92
|
+
model: MODEL_ID_HERE
|
|
93
|
+
|
|
94
|
+
- harness: pi
|
|
95
|
+
provider: openai
|
|
88
96
|
model: MODEL_ID_HERE
|
|
89
97
|
|
|
90
|
-
-
|
|
98
|
+
- harness: pi
|
|
99
|
+
provider: opencode-go
|
|
91
100
|
model: MODEL_ID_HERE
|
|
92
101
|
|
|
93
|
-
-
|
|
102
|
+
- harness: pi
|
|
103
|
+
provider: zai
|
|
94
104
|
model: MODEL_ID_HERE
|
|
95
105
|
|
|
96
|
-
-
|
|
106
|
+
- harness: claude # Claude Code; the provider only labels the agent
|
|
107
|
+
provider: anthropic
|
|
97
108
|
model: MODEL_ID_HERE
|
|
98
109
|
|
|
99
110
|
consolidator: # optional; synthesizes the agents' reports (§12)
|
|
111
|
+
harness: pi
|
|
100
112
|
provider: anthropic
|
|
101
113
|
model: MODEL_ID_HERE
|
|
102
114
|
```
|
|
103
115
|
|
|
104
|
-
|
|
116
|
+
Every entry gives `harness`, `provider`, and `model`, each a nonblank string; there are no defaults, and no `defaults:` section supplying them (one was considered and rejected). A default harness or provider would go stale as harnesses change (pi is the right default only as long as it is), and a `defaults:` section's provider would apply across harnesses whose providers differ. `harness` is `pi` or `claude`; an unknown one is rejected at startup (with `--consolidate`, only the consolidator's, since no analysts run). A `claude` entry's provider is not passed to Claude Code (§4) and only labels the agent (e.g. `bedrock`, for a `claude` set up to use it). A config error lists every bad entry, each named by its key (`'agents' entry #2`, `'consolidator'`) with every problem it has, so one edit fixes them all; when an entry gives no harness, a line saying what every entry needs follows, and, if no entry gives one (as in a 0.1.0 config, which ran everything under pi), a hint to add `harness: pi`. A run made by 0.1.0, when every entry ran under pi, has a config copy without `harness`; `--consolidate` rejects its consolidator like any other entry, with a hint to add `harness: pi`, while its reports and `run.json` are still read as pi's.
|
|
117
|
+
|
|
118
|
+
Exact provider and model identifiers must be verified against the installed harness: `pi --list-models` for pi, and the names and aliases `claude --model` accepts for Claude Code.
|
|
105
119
|
|
|
106
120
|
They belong in configuration because available models and names change frequently.
|
|
107
121
|
|
|
@@ -121,7 +135,7 @@ document the arguments, options, and `AGENT_COUNCIL_OPTS`. The command:
|
|
|
121
135
|
|
|
122
136
|
1. reads the prompt;
|
|
123
137
|
2. reads the configuration;
|
|
124
|
-
3. launches all configured
|
|
138
|
+
3. launches all configured analysts;
|
|
125
139
|
4. saves each successful result as its agent finishes;
|
|
126
140
|
5. waits for all of them, then prints a concise success/failure summary;
|
|
127
141
|
6. runs the consolidator, if one is configured, over the saved reports.
|
|
@@ -134,12 +148,12 @@ config copies, found through its reports' front matter (§12).
|
|
|
134
148
|
|
|
135
149
|
## 7. Parallel Execution
|
|
136
150
|
|
|
137
|
-
Agents run concurrently, one Ruby thread per agent, each driving one
|
|
151
|
+
Agents run concurrently, one Ruby thread per agent, each driving one harness process.
|
|
138
152
|
|
|
139
153
|
`AgentCouncil::WorkerPool` (`lib/agent_council/worker_pool.rb`) also handles signals, keeping the main thread free to take them. The README's [Stopping a run](README.md#stopping-a-run) section describes what Ctrl-C and the other signals do; the reasons behind that behavior are:
|
|
140
154
|
|
|
141
155
|
- **Each agent leads its own process group**, so the terminal's signals reach only agent-council, which then stops the agents itself, in an orderly way, and Ctrl-Z suspends agent-council without suspending the agents under it.
|
|
142
|
-
- **Agents get SIGTERM and a shared grace period before being killed**, so
|
|
156
|
+
- **Agents get SIGTERM and a shared grace period before being killed**, so the harness can stop the commands it started (pi and Claude Code do; checked for Claude Code 2.1.325: a command its Bash tool was running, in the foreground or with `run_in_background`, ran in a process group of its own, which agent-council's SIGTERM to the agent's group doesn't reach, and ended when `claude` got SIGTERM); a second signal skips the wait for a user who doesn't want to.
|
|
143
157
|
- **agent-council then dies by the signal** rather than exiting normally, so a shell (e.g. one running it in a loop) sees it was killed and stops too. SIGQUIT exits 131 instead, since a core dump is no use here.
|
|
144
158
|
- **Extra SIGHUPs are ignored**, since a closing terminal can send them in pairs, and **signals agent-council was started ignoring stay ignored**, so `nohup` works.
|
|
145
159
|
- **SIGQUIT isn't trapped under JRuby**, where the JVM reserves it for thread dumps.
|
|
@@ -157,13 +171,13 @@ agent-council does not:
|
|
|
157
171
|
- ask models to identify themselves;
|
|
158
172
|
- add model-specific output instructions.
|
|
159
173
|
|
|
160
|
-
Execution metadata stays outside the substantive prompt: the
|
|
174
|
+
Execution metadata stays outside the substantive prompt: the scratch dir is referred to only as `$TMPDIR` in the system-prompt scaffolding, which is identical for every agent, and model identity is in the report's front matter.
|
|
161
175
|
|
|
162
176
|
---
|
|
163
177
|
|
|
164
178
|
## 9. Prompt Delivery
|
|
165
179
|
|
|
166
|
-
The prompt is piped to
|
|
180
|
+
The prompt is piped to the harness on stdin, never interpolated into a command line, so it may be large and contain:
|
|
167
181
|
|
|
168
182
|
- Markdown;
|
|
169
183
|
- source code;
|
|
@@ -172,7 +186,7 @@ The prompt is piped to pi on stdin, never interpolated into a command line, so i
|
|
|
172
186
|
- Unicode;
|
|
173
187
|
- long analytical instructions.
|
|
174
188
|
|
|
175
|
-
|
|
189
|
+
The harness is started with an argv array, not through a shell.
|
|
176
190
|
|
|
177
191
|
---
|
|
178
192
|
|
|
@@ -180,17 +194,21 @@ pi is started with an argv array, not through a shell.
|
|
|
180
194
|
|
|
181
195
|
Agents are analyzers, not modifiers.
|
|
182
196
|
|
|
183
|
-
The scaffolding appended to
|
|
197
|
+
The scaffolding appended to each agent's system prompt (`Harnesses.scaffold_text` in `lib/agent_council/harnesses/scaffold.rb`, shared by every harness) states the rules agents get, and the README's [How it works](README.md#how-it-works-and-what-the-agents-are-told) section summarizes them. They are instructions, not enforced restrictions: each harness's tool limit (pi's `--tools` allowlist, which activates only the tools it lists; Claude Code's `--tools`) and its MCP setting (§11) are the only restrictions agent-council enforces (Claude Code's own sandbox can also restrict Claude Code agents if Claude Code's settings enable it, and the analyzed repository's settings can enable or disable it; §11), and the shell tool remains a full shell running as the user (see the README's [Safety and privacy](README.md#safety-and-privacy)). A shell is kept because investigation (`git log`, dependency inspection, running a documented command) is much of what makes an analysis useful.
|
|
184
198
|
|
|
185
199
|
The rules follow from agents running concurrently in the user's own working tree:
|
|
186
200
|
|
|
187
201
|
- **No modifying project files, git state, software, or configuration, and no persistent services**, since the agents analyze the user's real repository and environment, not a copy. If testing a proposed change would need a modified file, the agent should describe the experiment instead (this follows from the rule; the scaffolding doesn't state it separately).
|
|
188
|
-
- **Each agent gets its own disposable scratch directory** (
|
|
202
|
+
- **Each agent gets its own disposable scratch directory** (its `TMPDIR`, which the scaffolding names rather than giving a path: under Claude Code's sandbox the dir itself is read-only and `TMPDIR` is a writable dir inside it, §11), so agents that need temporary files don't collide with each other or leave files in the project.
|
|
189
203
|
- **No test suites, builds, coverage tools, application servers, or database tasks unless the prompt permits them**, since such commands can collide through shared resources a per-agent scratch directory doesn't isolate: shared databases, Redis, fixed ports, Docker resources, hard-coded temporary paths, or other process-global state. Running tests and reproducing defects can make an analysis much stronger, so a prompt may lift the rule (as `examples/prompts/review-latest-commit-prompt.md` does for tests and linters); agents then still skip commands needing shared services. Where a command is not permitted but would help, the agent describes what it would run and why.
|
|
190
204
|
|
|
191
205
|
---
|
|
192
206
|
|
|
193
|
-
## 11.
|
|
207
|
+
## 11. Harness Context Behavior
|
|
208
|
+
|
|
209
|
+
Useful real-world analysis matters more than establishing a laboratory benchmark, so each harness behaves as it normally would when analyzing a repository, except as listed below. There is no configurable controlled-comparison mode.
|
|
210
|
+
|
|
211
|
+
### Pi
|
|
194
212
|
|
|
195
213
|
Pi may automatically load project-specific context such as:
|
|
196
214
|
|
|
@@ -202,16 +220,51 @@ Pi may automatically load project-specific context such as:
|
|
|
202
220
|
|
|
203
221
|
The analyzed repository's own `.pi` resources load only if pi already trusts the project, since agent-council passes no `--approve`.
|
|
204
222
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
Therefore Pi behaves as it normally would when analyzing a repository, except that:
|
|
223
|
+
Pi's exceptions to normal behavior:
|
|
208
224
|
|
|
209
|
-
- each
|
|
210
|
-
- no conversation/session state leaks between
|
|
225
|
+
- each agent is independent;
|
|
226
|
+
- no conversation/session state leaks between agents (`--no-session`);
|
|
227
|
+
- pi's built-in MCP support is off (`--no-mcp`), so configured MCP servers don't start, which keeps any from doing something merely by starting, and agents have no MCP tools; an extension providing its own MCP support isn't affected, and extensions load as usual;
|
|
211
228
|
- the tool list is restricted and the scaffolding appended to the system prompt (§10);
|
|
212
229
|
- the report-format addendum is appended to each analyst's prompt.
|
|
213
230
|
|
|
214
|
-
|
|
231
|
+
### Claude Code
|
|
232
|
+
|
|
233
|
+
**Invocation.** One `claude` process per agent, the prompt on stdin, started from an argv array (§9):
|
|
234
|
+
|
|
235
|
+
```text
|
|
236
|
+
claude -p --output-format stream-json --verbose
|
|
237
|
+
--no-session-persistence
|
|
238
|
+
--tools Read,Grep,Glob,Bash --allowedTools Read,Grep,Glob,Bash
|
|
239
|
+
--permission-mode manual
|
|
240
|
+
--strict-mcp-config
|
|
241
|
+
--model MODEL
|
|
242
|
+
--append-system-prompt SCAFFOLDING
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
The flags were checked with Claude Code 2.1.325, and again with 2.1.327 (and, for the comparison with pi's allowlist, pi 1.5.2):
|
|
246
|
+
|
|
247
|
+
- `--tools` limits the built-in tools as pi's allowlist does: Edit and Write are absent, not merely refused.
|
|
248
|
+
- `--allowedTools` is required. Without it, Bash commands Claude Code doesn't consider read-only (`git log` and `ls` are; `ruby -e ...` isn't) are refused, since `-p` mode can't ask, and the agent still ends as a success, with the refusal recorded only in the `result` event's `permission_denials`. With it, a call can still be refused, by a `permissions.deny` rule in the user's or the analyzed project's settings (checked: a project rule denying `Bash(cat:*)` was recorded the same way). A nonempty `permission_denials` is reported as a warning naming the refused calls (`ClaudeCodeHarness.warnings`), printed under the agent's progress line, shown in the report's byline table (which the consolidator reads, and which its template asks it to take into account), and recorded in its `run.json` entry, not a failure: the report is kept, but may lack what the call would have found. An agent that fails anyway (say, by running out of turns after refusals) gets the warning too, since the refusals may be why; it follows the failure reason on the console, in `run.json`, and in the reason the consolidation prompt gives for the missing report.
|
|
249
|
+
- `--permission-mode manual` makes the outcome the same for every user; without it the user's own `defaultMode` (e.g. `auto`, or `plan`, which would run nothing) applies (checked: with `defaultMode` set to `plan`, the `init` event reports `plan` without the flag and `default` with it). `manual` is the name `claude --help` lists for the mode the stream reports as `default`; `default` is still accepted but no longer listed, so it isn't used.
|
|
250
|
+
- `--strict-mcp-config` with no `--mcp-config` loads no MCP servers: `init` reports `mcp_servers: []` even for a user with servers configured, and a plugin that provides MCP tools doesn't load, while other plugins do (checked). Not tested: an enterprise `managed-mcp.json`, under which Claude Code's binary has the message "You cannot use --strict-mcp-config when an enterprise MCP config is present", so Claude Code agents would presumably fail there; the README notes it.
|
|
251
|
+
|
|
252
|
+
**Context.** Claude Code behaves as in an interactive session started in the analyzed repository, as pi does (above): it loads `CLAUDE.md` (and whatever it imports, such as `@AGENTS.md`), user and project settings, hooks, and plugins, and its auto memory for the project. Auto memory is kept deliberately (checked: the system prompt names the project's memory directory, shows its `MEMORY.md` index, and says to write memory files there; `CLAUDE_CODE_DISABLE_AUTO_MEMORY=1` removes all of it): the notes are context an interactive session would have, and leaving them out would make agents worse at the user's project. An agent may still write a memory file with `Bash`, as an interactive session may (the scaffolding's "strictly read-only" rules argue against it, but don't name memory); that is accepted, and the README says so. `--bare` is not used: it skips `CLAUDE.md` and permits only API-key authentication. Nor is `--safe-mode`, which keeps subscription authentication but also skips `CLAUDE.md`, along with skills, plugins, hooks, and other customizations (permission rules and admin-managed settings still apply); nor is `--restricted`, which ignores the user, project, and local settings files altogether, permission rules included, and so would drop both the user's own setup and a project's deny rules (untested); a user who wants that can set `CLAUDE_CODE_SAFE_MODE=1` (its environment form) when running agent-council, and the README's Safety section says so (checked: with it, a project's hooks didn't run and a subscription login still worked). So the user's hooks and plugins run for every Claude Code agent, and so do hooks in the analyzed repository's own `.claude` settings: `-p` mode skips the trust prompt an interactive session shows first in a new folder (checked: a never-trusted repository's `SessionStart` and `PreToolUse` hooks ran). The README's Safety section says so.
|
|
253
|
+
|
|
254
|
+
**Sandbox.** agent-council neither enables nor disables Claude Code's Bash sandbox; Claude Code's settings decide, including settings committed to the analyzed repository, which can enable it or disable one the user enabled (only `--settings` or managed settings take precedence). Commands matching `sandbox.excludedCommands`, which the repository's settings can add to, run outside it. The README's [Claude Code's sandbox](README.md#claude-codes-sandbox) gives users the details.
|
|
255
|
+
|
|
256
|
+
- Checked with Claude Code 2.1.325 on Ubuntu with AppArmor restricting unprivileged user namespaces: the distribution's `/usr/bin/bwrap` makes every Bash call fail with a `setgroups` error; a copy of `bwrap` at another path with its own AppArmor profile granting `userns` works (a copy without one fails). Claude Code's docs give a profile for `/usr/bin/bwrap` or a sysctl as the fixes. Claude Code runs the first `bwrap` on the `PATH` it inherits, and `claude` is run directly, not through a shell (§9), so a shell alias doesn't reach agents.
|
|
257
|
+
- Checked: a `TMPDIR` long enough to push the sandbox's Unix socket paths past about 108 bytes makes the sandbox fail to start and commands run unsandboxed. `Dir.mktmpdir` adds about 36 bytes to the user's temporary directory.
|
|
258
|
+
- Checked: with the sandbox enabled and its other settings at their defaults, network access and writes to the home directory outside the working directory were blocked.
|
|
259
|
+
- From Claude Code's sandboxing docs, not checked: the working directory stays writable apart from protected files (the `.claude` settings files, `.git/hooks`, and others); `sandbox.failIfUnavailable` makes Claude Code refuse to run commands unsandboxed when the sandbox is unavailable.
|
|
260
|
+
- Checked with 2.1.327, with agent-council's argv and the sandbox enabled: inside the sandbox `TMPDIR` is `<scratch>/claude-<uid>`, which is writable, while a write to the scratch path itself fails with "read-only file system". So the scaffolding names the scratch dir as `$TMPDIR`, not by path; `$TMPDIR` is the scratch dir itself for pi and unsandboxed Claude Code, and a dir inside it under the sandbox, so cleanup covers both. The sandbox makes that dir under `CLAUDE_CODE_TMPDIR` if set, so agent-council sets it to the scratch dir too; otherwise a user's own setting would put the dir outside, shared between agents and never removed (checked: with both set, the sandboxed `TMPDIR` was `<scratch>/claude-<uid>`). (`--add-dir` with the scratch path was the alternative; it would widen what Claude Code allows, and wasn't tried.) An unsandboxed retry (`dangerouslyDisableSandbox: true`) of a blocked home-directory write was refused ("Run outside of the sandbox") and reported in `permission_denials`, so agent-council warns of it, although the docs say an allow rule matching a command approves such a retry. Why agent-council's `--allowedTools Read,Grep,Glob,Bash` didn't approve it isn't known.
|
|
261
|
+
- agent-council doesn't detect other sandbox trouble: `ClaudeCodeHarness.warnings` reads only `permission_denials`.
|
|
262
|
+
|
|
263
|
+
**Billing.** agent-council leaves authentication and billing entirely to Claude Code: it passes no option and sets no environment variable for them (the only variables it sets for an agent are `TMPDIR` and `CLAUDE_CODE_TMPDIR`, both to its scratch dir, §10). An agent bills however `claude` would at the user's terminal: a subscription login, or an API key if one is configured. One caveat, which the README gives: interactive Claude Code asks before using an `ANTHROPIC_API_KEY` found in the environment, but `-p` mode doesn't ask, so a key exported for another tool may bill council runs to the API. Subscription runs also share the user's usage limits with their interactive work; a limit hit while an agent is working is expected to end it as an ordinary agent failure, but that hasn't been observed (§13). The reported cost is recorded unadjusted (only rounded to six decimal places); like other subscription providers' figures it is notional (the stream gives its `costBasis` as `list`). Telling billing sources apart in `run.json` is not built (§18); the sources for it are the `init` event's `apiKeySource` (`none` for a login), `claude auth status --json` (`subscriptionType`, e.g. `pro`), and the stream's `rate_limit_event`s, which give the plan's utilization of its 5-hour and weekly windows.
|
|
264
|
+
|
|
265
|
+
### No MCP, in either harness
|
|
266
|
+
|
|
267
|
+
Agents get no MCP servers, so neither harness offers MCP tools (their built-in tools differ, as listed above), and no agent can reach a server that writes (posting to chat, commenting on an issue), which a council would do once per agent. Pi is passed `--no-mcp` (above), which turns off its built-in MCP support (an extension providing its own is unaffected) and in a test kept a project's server from starting; before that, its `--tools` allowlist already kept agents from calling MCP tools, but pi still started the user's servers. There is no setting to turn MCP on. If one is wanted later, it goes in the config, not on the command line, and names the servers to allow rather than switching all of them on, since enabling means per-harness work: pi's allowlist would have to name the MCP tools, and Claude Code would need them in `--allowedTools`.
|
|
215
268
|
|
|
216
269
|
---
|
|
217
270
|
|
|
@@ -219,24 +272,26 @@ There is no configurable controlled-comparison mode.
|
|
|
219
272
|
|
|
220
273
|
The models don't write their own report files.
|
|
221
274
|
|
|
222
|
-
|
|
275
|
+
The harness returns the final response to the Ruby process, which writes that text (minus any leading top-level heading), under front matter and a metadata table, to a deterministic, self-describing filename (see below).
|
|
223
276
|
|
|
224
277
|
Each run gets its own directory, a day bucket, and an `hh-mm-ss` time, created atomically with a `-2`, `-3`, ... suffix if that name is already taken, and printed when the run starts, so an in-progress or interrupted run is easy to find. [The README's "What you get" section](README.md#what-you-get) specifies the layout, filenames, query slug, and front matter; the decisions behind them are:
|
|
225
278
|
|
|
226
|
-
- **Inputs are copied into the run dir** (the prompt, config, and `analyst_format.md`, each under its own file name), so an analyst
|
|
279
|
+
- **Inputs are copied into the run dir** (the prompt, config, and `analyst_format.md`, each under its own file name), so an analyst's inputs are recoverable later. The orchestrator is versioned in git and deliberately not copied; the harness and agent-council versions, the scaffolding text, and the consolidation template are not recorded.
|
|
227
280
|
- **Only analysts' reports go in `reviews/`.** The consolidator's reports (normally a findings and a meta file) and the input copies sit at the run dir root.
|
|
228
|
-
- **Filenames are self-describing.** They carry the full timestamp, query slug, agent index (`consolidated` for the consolidator), harness, provider, and model, so a report still says what it is when copied out of the tree. The agent index keeps names unique when a provider/model is configured more than once (e.g. to get several independent analyses from one model) and sits before the harness, so filenames sort in agent order
|
|
281
|
+
- **Filenames are self-describing.** They carry the full timestamp, query slug, agent index (`consolidated` for the consolidator), harness, provider, and model, so a report still says what it is when copied out of the tree. The agent index keeps names unique when a provider/model is configured more than once (e.g. to get several independent analyses from one model) and sits before the harness, so filenames sort in agent order with more than one harness. Provider and model are sanitized like the slug but keep their case.
|
|
229
282
|
- **Metadata is YAML front matter written by the orchestrator**, never by the model: it gives tools structured provenance, stays readable in the terminal, and is how reports are identified, so nothing parses filenames (a consolidation's findings file, meant to be pasted elsewhere, has identifying lines in place of front matter instead). Timestamps are unquoted ISO 8601, so they parse directly as `Time` objects. Beyond the `provider` and `model` every report needs to be recognized, `--consolidate` needs the analysts' `prompt_file`, `config_file`, `run_stamp`, and `query`, and their `agent_index` to tell which configured agents have no report.
|
|
230
|
-
- **Measurements go in `run.json`, not front matter.** Front matter identifies a document;
|
|
231
|
-
|
|
232
|
-
The optional consolidator (a top-level `consolidator:`
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
283
|
+
- **Measurements go in `run.json`, not front matter.** Front matter identifies a document; an agent's duration and token usage are data about the agent, wanted for analysis across many runs, and most tools can't read front matter without tripping over the Markdown after it. So they go in one JSON file per run dir, readable by any language's standard library or `jq`; the byline table still shows a report's own duration and usage to its readers.
|
|
284
|
+
|
|
285
|
+
The optional consolidator (a top-level `consolidator:` entry in the
|
|
286
|
+
config, with a harness, provider, and model like an agent's; §5) runs
|
|
287
|
+
after all agents finish, as one more agent, under its own entry's harness,
|
|
288
|
+
with the tools and scaffolding an analyst gets under that harness. Its
|
|
289
|
+
prompt is `lib/agent_council/templates/consolidate_prompt.md` followed
|
|
290
|
+
by the original prompt, every analyst report labeled with its source,
|
|
291
|
+
and the agents without a report, each with its harness and its failure
|
|
292
|
+
reason and warnings (with `--consolidate`, as `run.json` records them,
|
|
293
|
+
else a note that the reason wasn't recorded). A consolidation failure is
|
|
294
|
+
reported but does not change a normal run's exit status
|
|
240
295
|
(`--consolidate`'s exit status is the consolidation's).
|
|
241
296
|
|
|
242
297
|
**The consolidated report is split into two files.** The consolidator is asked to write its findings, then a line containing only `=== META ===`, then the sections that describe the consultation (`Agent Consultants`, `Agent performance`), and the orchestrator splits the report at that line. The findings file has no front matter or orchestration tables (the consolidator's own findings may still contain tables), so it can be pasted into an AI chat without spending tokens on the rest; it carries a legend of agent number, harness, provider, and model, since the findings cite agents by number. The rest goes to a meta file. A marker line was chosen over parsing headings, which depended on the model's exact section names and on code fences, and over a JSON or YAML wrapper, where one unescaped quote or bad indent in thousands of tokens of Markdown would lose the whole report. If the marker is missing, repeated, inside a code fence, or not followed by the `Agent Consultants` heading (which makes a quoted one unlikely to be taken for the real one), or if the report no longer starts with the header written to it, the report is left unsplit, with a warning that says why, rather than guessed at, and so it is if a split file can't be written; the original single file is not kept after a successful split, to avoid duplicate text. The findings file has no front matter, so it opens with a few lines identifying its run instead, and `run.json` records the meta file, which has the front matter, next to it. The consolidator's report is first written under the meta file's name, which, being created exclusively, keeps the configuration taken against a concurrent consolidation, and then rewritten in place; a report that can't be split is renamed to the unsuffixed name, which releases the meta name, so that guard covers split reports only. Each report in the consolidator's prompt states its harness, so findings can be attributed to harness, provider, and model.
|
|
@@ -245,17 +300,33 @@ The orchestrator already knows model identity, so analysts aren't asked to repor
|
|
|
245
300
|
|
|
246
301
|
---
|
|
247
302
|
|
|
248
|
-
## 13.
|
|
303
|
+
## 13. Harness Output Parsing
|
|
304
|
+
|
|
305
|
+
Each harness reads its own event stream and decides what counts as a failure; the orchestrator reports a failure, and saves nothing for it, whichever harness found it.
|
|
306
|
+
|
|
307
|
+
### Pi
|
|
249
308
|
|
|
250
309
|
agent-council reads pi's JSONL event stream (`--mode json`) rather than scraping human-oriented terminal output. Pi documents `message_end` as the authoritative final message of a turn, so the final response is the text of the last assistant `message_end` event that has text (a trailing text-less message doesn't hide an earlier report). Pi exits 0 even when the provider rejects the request, so a non-blank `errorMessage`, or a `stopReason` of `length`, `aborted`, or `error` (output cut off, cancelled, or failed without an `errorMessage`), counts as a failure. Only the last assistant message and the one that would be saved are checked, so an error in a turn that a later turn recovered from is not a failure. Failures are reported, not saved as reports.
|
|
251
310
|
|
|
252
311
|
Parsing extracts only that; there is no generic Pi protocol library.
|
|
253
312
|
|
|
254
|
-
The parser and the pi CLI invocation for
|
|
255
|
-
(`lib/agent_council/harnesses/pi_harness.rb`), the single home of
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
313
|
+
The parser and the pi CLI invocation for agents live in `AgentCouncil::Harnesses::PiHarness`
|
|
314
|
+
(`lib/agent_council/harnesses/pi_harness.rb`), the single home of pi-specific
|
|
315
|
+
behavior for agents (the separate `pi-models` helper also talks to pi); see §4
|
|
316
|
+
for how the orchestration finds it.
|
|
317
|
+
|
|
318
|
+
### Claude Code
|
|
319
|
+
|
|
320
|
+
agent-council reads Claude Code's `stream-json` output. The stream's final `result` event carries everything needed, so parsing is simpler than pi's:
|
|
321
|
+
|
|
322
|
+
- the report is its `result` text;
|
|
323
|
+
- the agent failed if there is no `result` event, `is_error` is true, or the text is blank. Every failure observed (not logged in, an unknown model, output over the token limit, the turn limit) exited 1 with `is_error` true, but `subtype` was `success` for all but the turn limit (`error_max_turns`), and a cut-off output reported no `max_tokens` stop reason, so neither is checked;
|
|
324
|
+
- the failure's reason is the `result` event's `errors`, if any (e.g. "Reached maximum number of turns (1)", with an empty `result`), otherwise its `result` text (e.g. "Not logged in · Please run /login"). Stderr was empty in all but one case, so unlike pi's, a nonzero exit is explained from the stream, with stderr only as a fallback;
|
|
325
|
+
- usage is read from the `result` event alone, which totals the agent's whole session; the per-message `assistant` events carry partial snapshots that undercount output (in one recorded case, 16 output tokens where the `result` event gave 184). So an agent that ends without a `result` event, as when its `claude` is killed, reports no usage rather than a misleading partial count, unlike a pi agent, whose completed messages each report their full usage. It maps `input_tokens`, `output_tokens`, `cache_read_input_tokens`, and `cache_creation_input_tokens` to `input`, `output`, `cache_read`, and `cache_write` (as with pi, `input` excludes cache reads and writes), and `total_cost_usd` to `cost`.
|
|
326
|
+
|
|
327
|
+
So `exit_detail`, which explains a nonzero exit, reads the stream first for Claude Code and stderr for pi. The parser and the invocation live in `AgentCouncil::Harnesses::ClaudeCodeHarness` (`lib/agent_council/harnesses/claude_code_harness.rb`). The specs read streams recorded from real `claude` invocations (`spec/fixtures/claude_code/`), trimmed to a few event types and fields, with local paths, tool call IDs, and commit hashes replaced by placeholders; the spec's header says how each was recorded.
|
|
328
|
+
|
|
329
|
+
Not yet observed: an agent that hits a usage limit, and one billed to an API key.
|
|
259
330
|
|
|
260
331
|
---
|
|
261
332
|
|
|
@@ -282,17 +353,17 @@ no run management is implemented.
|
|
|
282
353
|
|
|
283
354
|
## 15. Basic Failure Handling
|
|
284
355
|
|
|
285
|
-
Failure handling is simple. If a
|
|
356
|
+
Failure handling is simple. If a harness invocation fails, agent-council:
|
|
286
357
|
|
|
287
358
|
- prints a useful error;
|
|
288
359
|
- writes no report for it;
|
|
289
|
-
- lets the other
|
|
360
|
+
- lets the other agents finish.
|
|
290
361
|
|
|
291
362
|
One failed model doesn't discard successful results from others. The
|
|
292
363
|
README's [What you get](README.md#what-you-get) section shows how
|
|
293
364
|
failures are reported.
|
|
294
365
|
|
|
295
|
-
There are no retries of agent-council's own (
|
|
366
|
+
There are no retries of agent-council's own (the harnesses may retry transient provider failures), error taxonomies, fallback models, semantic report validation, or separate process/report status systems.
|
|
296
367
|
|
|
297
368
|
---
|
|
298
369
|
|
|
@@ -301,12 +372,12 @@ There are no retries of agent-council's own (pi may retry transient provider fai
|
|
|
301
372
|
```text
|
|
302
373
|
README.md
|
|
303
374
|
INSTALL.md
|
|
375
|
+
USE_CASES.md
|
|
304
376
|
DESIGN.md
|
|
305
377
|
RELEASE_NOTES.md
|
|
306
378
|
LICENSE.txt
|
|
307
379
|
REVIEW_NOTES.md # settled review findings; not shipped in the gem
|
|
308
380
|
CONTRIBUTING.md # contribution process; not shipped in the gem
|
|
309
|
-
code-review-agents.md # sample code-review ensemble recommendation
|
|
310
381
|
agent-council.gemspec
|
|
311
382
|
exe/ # executable entry points; nearly all code lives in lib/
|
|
312
383
|
agent-council
|
|
@@ -318,8 +389,11 @@ lib/
|
|
|
318
389
|
platform.rb # windows? and the native-Windows abort (WSL is required)
|
|
319
390
|
pi_models.rb # backs exe/pi-models
|
|
320
391
|
worker_pool.rb # worker threads, agent processes, and Ctrl-C handling
|
|
392
|
+
harnesses.rb # harnesses by name (AgentCouncil::Harnesses)
|
|
321
393
|
harnesses/
|
|
394
|
+
scaffold.rb # the read-only scaffolding every harness appends
|
|
322
395
|
pi_harness.rb # pi-specific behavior (AgentCouncil::Harnesses::PiHarness)
|
|
396
|
+
claude_code_harness.rb # Claude Code-specific behavior (ClaudeCodeHarness)
|
|
323
397
|
templates/ # runtime data files (resolved via __dir__, shipped in the gem)
|
|
324
398
|
consolidate_prompt.md # instructions template for the consolidator
|
|
325
399
|
analyst_format.md # report-format addendum for analysts
|
|
@@ -337,6 +411,7 @@ examples/ # pure, non-runtime samples (prompts/ and configs/ ship
|
|
|
337
411
|
configs/
|
|
338
412
|
single.yml
|
|
339
413
|
consolidated.yml
|
|
414
|
+
mixed-harness.yml
|
|
340
415
|
results/ # sample output; not shipped in the gem
|
|
341
416
|
|
|
342
417
|
agent-council-reports/ # created on demand; gitignored in this repository
|
|
@@ -363,7 +438,7 @@ New gems are added only if they solve a meaningful problem that would otherwise
|
|
|
363
438
|
|
|
364
439
|
## 18. Status and Future Work
|
|
365
440
|
|
|
366
|
-
agent-council is at an early stage (0.x), so it does only what its core job needs. Features we hope to add include support for more harnesses
|
|
441
|
+
agent-council is at an early stage (0.x), so it does only what its core job needs. Features we hope to add include support for more harnesses (such as Codex) and telling a Claude Code agent's billing source (subscription or API key) apart in `run.json` (§11). A missing feature is usually just not built yet.
|
|
367
442
|
|
|
368
443
|
`REVIEW_NOTES.md` separately tracks review findings that were considered and don't need to be re-raised: accepted risks and non-issues.
|
|
369
444
|
|
data/INSTALL.md
CHANGED
|
@@ -3,14 +3,15 @@
|
|
|
3
3
|
This guide is for developers comfortable with the command line who have
|
|
4
4
|
never used Ruby. It takes you from a bare machine to a working
|
|
5
5
|
`agent-council` command. Already have Ruby 3.3+ (or JRuby 10+) and
|
|
6
|
-
`pi
|
|
6
|
+
`pi` (or Claude Code)? Just run `gem install agent-council`; see the
|
|
7
7
|
[README](README.md#quick-start).
|
|
8
8
|
|
|
9
9
|
## 1. Prepare your system
|
|
10
10
|
|
|
11
11
|
- **macOS and Linux:** any terminal works. Linux needs `curl` installed.
|
|
12
12
|
- **Windows:** native Windows is **not supported**. Everything, including
|
|
13
|
-
Ruby, Pi,
|
|
13
|
+
Ruby, the harness CLIs you use (Pi, Claude Code, or both), and
|
|
14
|
+
agent-council, must be installed and run inside
|
|
14
15
|
[WSL](https://learn.microsoft.com/windows/wsl/install) with Ubuntu. In
|
|
15
16
|
an administrator PowerShell, run `wsl --install -d Ubuntu`, restart if
|
|
16
17
|
asked, then open an Ubuntu terminal and follow the Linux steps below
|
|
@@ -73,15 +74,23 @@ For other install methods and details, see the
|
|
|
73
74
|
[Mise documentation](https://mise.jdx.dev/getting-started.html) and its
|
|
74
75
|
[Ruby page](https://mise.jdx.dev/lang/ruby.html).
|
|
75
76
|
|
|
76
|
-
## 3. Install Pi
|
|
77
|
+
## 3. Install a harness: Pi, Claude Code, or both
|
|
77
78
|
|
|
78
|
-
agent-council drives AI models through
|
|
79
|
-
|
|
79
|
+
agent-council drives AI models through a coding-agent harness, which
|
|
80
|
+
each config entry names. Most samples use the
|
|
81
|
+
[Pi](https://github.com/earendil-works/pi) coding agent, version 1.0.4
|
|
82
|
+
or later. To use it, install Pi by
|
|
80
83
|
following its [installation instructions](https://github.com/earendil-works/pi),
|
|
81
84
|
and configure it with credentials for **at least one AI model provider**
|
|
82
85
|
(see [Pi's documentation](https://pi.dev/docs/latest)). Under WSL, do both
|
|
83
86
|
inside WSL.
|
|
84
87
|
|
|
88
|
+
Agents can also run under [Claude Code](https://code.claude.com/docs)
|
|
89
|
+
(see the README's [Choosing a harness](README.md#choosing-a-harness)).
|
|
90
|
+
For those, install the `claude` CLI and log in (under WSL, inside WSL).
|
|
91
|
+
A config needs Pi only if some agent, or the consolidator, runs under it
|
|
92
|
+
(`harness: pi`).
|
|
93
|
+
|
|
85
94
|
## 4. Install agent-council
|
|
86
95
|
|
|
87
96
|
```bash
|