Get more out of the AI subscriptions you already pay for.
If you're on Claude Max + Gemini Plus + ChatGPT Pro + GLM Pro (or any mix), you usually have one main agent doing most of the work while the others sit idle — Codex at 100% this week, Gemini with headroom under its hidden rate limits, GLM barely touched. AgenTalk offers two patterns for putting that slack to work:
Gather Claude, Codex, Gemini, ZCode into a shared panel. Pick a mode: discuss in parallel rounds, debate in turns, panel-first-then-debate, brainstorm for divergence, challenge adversarially, deepen root causes. For decisions that benefit from multiple expert perspectives — architecture, stress-testing proposals, root-cause analysis — you're not stuck asking one model. The room debates, a moderator converges, you read the transcript.
Let your main AI agent (typically Claude Code) quietly hand off a sub-task to another CLI — reading a 60-page spec, translating bulk text, generating a shell script, scanning a big codebase. The main agent decides WHAT and WHO; a deterministic supervisor executes, observes quota signals, returns structured findings. Spreads load across all your subscriptions, preserves main-model context budget, and the main agent reports back to you transparently ("Used Gemini to read the spec, saved ~40k tokens of context").
The two are independent binaries and can be used separately:
| Pattern | Binary | Metaphor | Best when |
|---|---|---|---|
| Committee | agentalk |
Multiple experts in a room | High-stakes decision with real trade-offs |
| Colleague | agentalk-delegate |
Handing off a well-scoped task | Routine sub-task a specialist does better (or cheaper) |
- 6 discussion modes — from parallel brainstorming to adversarial review to depth-first drilling (see table below)
- Moderator-led sessions — every plain message gets routed through a moderator that selects the right mode, fetches URLs/files mentioned in the topic, synthesizes a briefing, then runs the session
- API model agents — plug in any OpenAI-compatible model (OpenRouter, DeepSeek, Groq, etc.) via
/agents add-model - Token usage tracking — per-agent token counts shown at the end of every discussion; real counts for API agents, estimates for CLI agents
- Moderator placement — moderator defaults to the last active agent; new agents auto-insert at second-to-last
- 22-agent registry — 3 enabled by default (Codex, Gemini, ZCode). OpenCode is shipped disabled in favor of ZCode (both run the GLM Coding Plan; ZCode is z.ai's native harness) — enable with
/agents enable opencode. Claude is shipped disabled to avoid double-billing when agentalk runs inside Claude Code (theclaudeCLI shares the host's quota); enable with/agents enable claudefrom a plain terminal, or pass--include-claudefor a one-off override. Enable Aider, Ollama, Amazon Q, Goose, SWE-agent and more via/agents enable - Shared context — all agents see the same conversation history (up to 512k tokens, auto-compressed via moderator summary)
- Moderator pre-flight — detects URLs in your topic, fetches them, reads mentioned files, synthesizes a
[BRIEFING]injected into context before round 1 - Headless mode — all six mode flags run a session and exit;
--verbosestreams output in real time - Persistent sessions — save and resume conversations per directory with
-c
- Deterministic supervisor kernel — code, not an LLM. Owns task lifecycle state, observes quota signals (parses 429/rate-limit/auth from real CLI stderr), executes delegations. Main model is the policy generator; kernel is the mechanism.
- Rate-limit storm fast-fail — a batch agent stuck in its provider's rate-limit retry loop (e.g.
zcode→ z.ai1302) produces only rate-limit errors on stderr and never any output, which would otherwise keep the child alive until the full timeout (we'd seen 23-minute silent hangs). The kernel detects that storm — sustained rate-limit stderr with zero stdout — and kills it in ~60s, returning a cleanquota_exceededwith a suggested alternative agent. A run that hits a transient rate-limit but then recovers with real output is untouched. Match task weight to the agent: heavy multi-file / adversarial reviews go tocodex;zcode(GLM Coding Plan) is for bounded coding sub-tasks and gets rate-limited on bursts, especially at peak (14:00–18:00 UTC+8, when GLM-5.2 costs 3× quota). - Brief-in/brief-out protocol — structured task + files + context + budget → structured findings + artifacts + unknowns + diagnostics
- Persistent task state at
~/.agentalk/tasks/{id}.json— written before delegation executes, so any model can resume if the main agent dies - Project-level memory at
.agentalk/memory.jsonl(append-only JSONL, survives sessions) - Skill+CLI integration — default path, zero extra setup. The
/agentalk-delegateClaude Code skill invokes the CLI via Bash; no MCP registration required.
- Claude Code skills —
/agentalk,/agentalk-delegateauto-installed on postinstall (and re-installable viaagentalk-delegate init) - MCP Server (optional, secondary) —
agentalk-mcpexposesask,discuss,debate,delegate,list_quotas,list_capabilities,remember,recall,task_statusfor MCP-based clients. Most users don't need this; skills use CLI directly.
| Command | Structure | Best for |
|---|---|---|
/discuss |
Parallel rounds, converge | Multi-perspective exploration |
/debate |
Serial turns, converge | Decisions, tradeoffs, structured argument |
/panel |
Blind opening round → serial debate | Unanchored deep debate (everyone states position independently first) |
/brainstorm |
Parallel rounds, diverge | New directions, possibility enumeration — agents told to maximize unique perspectives |
/challenge |
Serial turns, adversarial | Code review, proposal evaluation, red-teaming — agents find flaws others missed |
/deepen |
Serial turns, depth-first | Root cause analysis, complex problem decomposition — each agent drills one layer deeper |
All modes support @mentions to select participants, --rounds/--turns N, and headless flags.
- Node.js 18+ (uses native
fetch) - At least one CLI installed and authenticated:
claude # Claude Code → claude.ai/code
codex # OpenAI Codex CLI → github.com/openai/codex
gemini # Google Gemini CLI → github.com/google-gemini/gemini-cli
zcode # ZCode (GLM) → zcode.z.ai (see "ZCode setup" below)
opencode # OpenCode CLI → opencode.ai (disabled by default)AgenTalk works with any subset of the above — inactive CLIs are automatically skipped.
npm install -g agentalkOr from source:
git clone https://github.com/agent3-666/agentalk.git
cd agentalk
npm install
npm link # makes `agentalk`, `agentalk-mcp`, `agentalk-model`, `agentalk-delegate` available globallyThe postinstall script automatically installs the three Claude Code skills (/agentalk, /agentalk-delegate) into ~/.claude/skills/. Run agentalk-delegate init at any time to re-install and see setup status.
agentalk # start interactive REPL
agentalk -c # continue last session (per directory)
agentalk --from-claude # set Claude Code as context source for this session
# Headless (single-shot, then exit)
agentalk --discuss "topic" # parallel discussion, prints conclusion
agentalk --debate "topic" # serial debate, prints conclusion
agentalk --panel "topic" # blind round + serial debate
agentalk --brainstorm "topic" # divergent parallel rounds
agentalk --challenge "topic" # adversarial review
agentalk --deepen "topic" # depth-first serial drilling
agentalk --debate "topic" --verbose # stream all output in real time
agentalk --deepen --stdin < prompt.txt # long headless topic
agentalk --challenge --file prompt.txt # long headless topic from a file
# Pass a one-off message without entering the REPL
agentalk "What's the best caching strategy for this project?"Do not pipe multi-line prompt files into the interactive REPL (cat prompt.txt | agentalk). Use --stdin / --file for headless discussion topics, and use agentalk-delegate for direct implementation sub-tasks assigned to one agent.
# Plain text → moderator decides discussion mode, fetches materials if needed
Should we use microservices or a monolith?
# @mention → send directly to specific agent(s), skip moderator
@claude explain this architecture
@codex @gemini review this diff
# Discussion modes
/discuss Should we adopt TypeScript?
/debate Functional vs OOP in the AI era?
/panel Should we rewrite the auth layer?
/brainstorm What are all the ways this could fail?
/challenge Review this architecture proposal
/deepen Why is our cache hit rate dropping?
# Options
/discuss @codex @claude --rounds 5 What's the best error handling pattern?
/debate --turns 8 Microservices vs monolith?
# Explicit moderator-led session
/mod Redesign our auth flow — see https://our-spec.com/auth
# Broadcast — no moderator, pure parallel fan-out
/broadcast Summarise the last 3 commits
/bc @claude @gemini What do you think of this design?
# During a running discussion
s + Enter graceful stop (generates summary)
Ctrl+C interrupt
/add <info> inject supplemental info into the next round
# Context management
/context show token and message count
/from interactive picker to set context source agent
/from claude set Claude Code as context source
/from none clear context source
/export export session to ~/.agentalk/exports/ as Markdown
/last show the last conclusion
/clear clear shared context
/save / /load persist or restore session
# Agent management
/agents list all agents with status and model
/agents enable <key> enable an agent
/agents disable <key> disable an agent
/agents model <key> <model> set model for an agent (e.g. claude-opus-4-5)
/agents model <key> reset to default model
/agents moderator show current moderator
/agents moderator <key> set moderator (default: last active agent)
/agents order <k1> <k2> ... set discussion order
/agents timeout show global timeout (seconds)
/agents timeout <s> set global timeout
/agents timeout <key> [<s>] set per-agent timeout
/agents add add a custom agent (interactive wizard)
/agents add-model <model-id> register an API model as an agent
/agents set-key <provider> <key> save an API key for a provider
/agents remove <key> remove a custom agent
/agents reset restore factory defaults
# Other
/lang en|zh switch interface language
/help full help
/quit exit
Any OpenAI-compatible model can be added as an agent. A model only needs an id and an API key — the endpoint is auto-resolved for known providers (openai, deepseek, groq, moonshot, zhipu, zai, mistral, together, xai, cursor). For an unknown provider, also set a base URL with /agents set-endpoint <provider> <url>.
GLM has two billing pools. A glm-* id resolves to the Zhipu open platform (open.bigmodel.cn, pay-per-token). A GLM Coding Plan key from z.ai is a subscription on a separate pool — using it on the Zhipu endpoint returns 1113 余额不足或无可用资源包. For a Coding Plan key, prefix the model with the zai provider so it routes to z.ai's coding endpoint:
/agents set-key zai <your-z.ai-coding-plan-key>
/agents add-model zai/glm-4.6zcode is enabled by default and runs the GLM Coding Plan through ZCode, z.ai's own coding agent. Unlike the zai/... route above (a raw OpenAI-compatible API call), ZCode is a full agent harness with its own tools, retries, and skills, so it handles flaky networks and multi-step tasks better.
The ZCode CLI ships inside the ZCode desktop app, not as a standalone npm package:
-
Install the ZCode app from zcode.z.ai. The CLI lands at
…/ZCode.app/Contents/Resources/glm/zcode.cjs. -
It needs a Node runtime with the built-in
node:sqlitemodule (Node 22.5+); the system default node may be older. Put azcodewrapper on yourPATHthat pins a new-enough node:#!/bin/sh ZCODE_CJS="/Applications/ZCode.app/Contents/Resources/glm/zcode.cjs" exec "${ZCODE_NODE:-$(command -v node)}" "$ZCODE_CJS" "$@"
-
Set the model and key once in
~/.zcode/cli/config.json. Notemodel.mainis a"providerId/modelId"string, and the provider's key/URL live in a separateprovidermap:{ "provider": { "zai-coding-plan": { "kind": "anthropic", "options": { "baseURL": "https://api.z.ai/api/anthropic", "apiKey": "<your-z.ai-coding-plan-key>" } } }, "model": { "main": "zai-coding-plan/glm-5.2" } }(Or run
zcode loginonce to sign in with Z.AI OAuth instead of an API key.)
AgenTalk calls it headlessly as zcode --prompt "<task>" --mode yolo --verbose. If which zcode fails, the agent is auto-skipped like any other missing CLI. (ZCode's headless mode is batch, not streaming — it works silently and prints the answer only at the end. AgenTalk runs it with --verbose and a generous inactivity window so a quiet-but-working zcode isn't mistaken for a hang, and a run that hits a transient 1302 but recovers with a valid answer is reported ok, not failed.)
Know what to send it. The GLM Coding Plan is a quota-capped subscription, so zcode shines on bounded coding sub-tasks (a few files, a bug fix, tests, Chinese text) and has two limits worth respecting:
- Don't send it heavy multi-file or long agentic reviews. A burst of internal calls trips z.ai's
1302rate-limit, and ZCode's own retry loop then spins on it producing empty output. AgenTalk detects this 1302 storm — sustained rate-limit errors on stderr with zero stdout — and fast-fails the run in ~60s with aquota_exceededsignal, instead of letting it burn the full--timeout(we'd seen 23-minute silent timeouts before this guard). Route large or adversarial multi-file reviews tocodexinstead.1302is not a normal429— it has noRetry-Afterand flaps — so when zcode comes back rate-limited, switch agents rather than retrying. - Coding tasks only. z.ai actively detects and bans non-coding use of the Coding Plan (throttle first, permanent ban on repeat). Keep strategy / prose / brainstorming off
zcode— send those tocodexorgemini. - GLM-5.2 costs 3× quota during peak hours (14:00–18:00 UTC+8);
opencoderuns the same GLM quota pool, so it is not a fallback when zcode is rate-limited.
agentalk-delegate capabilities prints this guidance per agent at call time, so a delegating agent sees it before choosing a target.
# OpenRouter
/agents set-key openrouter sk-or-v1-...
/agents add-model openrouter/qwen/qwen3.6-plus
/agents add-model openrouter/anthropic/claude-opus-4-5
# DeepSeek
/agents set-key deepseek sk-...
/agents add-model deepseek/deepseek-chat
# Groq
/agents set-key groq gsk_...
/agents add-model groq/llama-3.3-70b-versatile
# Cursor (uses your Pro/Business subscription quota)
/agents set-key cursor <your-cursor-api-key>
/agents enable cursor
# Get key from: cursor.com/settings → API Keys
# Switch model: /agents model cursor cursor/gpt-4oAdded ≠ enabled. A newly added model (or any agent added via /agents add) lands disabled — these are usually pay-per-call APIs, and adding one should never silently start billing. Set the key, then /agents enable <key> to turn it on. This matches the built-in pay-per-call agents, which also ship disabled.
New API agents are automatically placed second-to-last so the CLI-based moderator (default: last agent) stays at the end of the debate order.
The same flow is available without the interactive REPL, so an AI client (or a delegate) can provision a model when you just tell it the model id and key:
agentalk-delegate add-model deepseek/deepseek-chat --key sk-... --enable
agentalk-delegate set-key <provider> <api-key> # store/replace a provider key
agentalk-delegate enable <agent-key> # turn on a disabled agentadd-model prints [STATUS] ok plus [AGENT_KEY], [ENABLED], [KEY_SET], and a [NEXT_STEPS] block listing exactly what's left (set key / enable / set endpoint), so the caller can finish provisioning deterministically. Without --enable the model is added disabled.
Agents self-terminate by writing [STOP] in their response. The moderator confirms convergence at cycle boundaries. Press s + Enter for a graceful stop that asks the moderator to summarise progress.
After every discussion, AgenTalk prints a per-agent token breakdown:
── Token Usage ──
Codex ~2,340 · 3 turns (est.)
Gemini ~1,890 · 3 turns (est.)
Qwen3-Plus (↑1,890 ↓1,566) 3,456 · 3 turns
Claude ~4,120 · 3 turns (est.)
──────────────────────────────────────────────
Total ~11,806
Real token counts (prompt + completion breakdown) are shown for API agents added via /agents add-model. CLI agents show character-based estimates marked with ~. Token data is also included in exported Markdown reports.
When a discussion topic contains URLs or file references, the moderator runs a pre-flight phase before round 1:
- Plan — moderator reads the topic and outputs
FORMAT:,AGENTS:,ROUNDS:,FETCH:,FILES:lines - Gather — AgenTalk fetches each URL (15s timeout, HTML stripped, 20k char cap) and reads each file (50k char cap)
- Synthesise — moderator compresses all gathered content into a
[SOURCES]/[KEY FACTS]/[DISCUSSION FOCUS]briefing - Inject — briefing is added to context as
[BRIEFING]so all agents see it in round 1
If any fetch fails the discussion proceeds without that material — no crash.
AgenTalk ships with 22 pre-defined agent slots. Enable any of them:
/agents enable aider
/agents enable ollama
/agents model ollama llama3.3
/agents enable q # Amazon Q Developer CLI
/agents enable goose # Goose (Block)
/agents enable sweagent # SWE-agent
# Cursor (API-based, requires Pro/Business subscription)
/agents set-key cursor <your-cursor-api-key>
/agents enable cursorOr add a completely custom agent via the interactive wizard:
/agents add
# walks you through: key, name, cmd, args, color, output format, noteAgent args support {prompt} and {model} placeholders, plus a model_flag for automatic model injection.
AgenTalk installs two skills into Claude Code automatically on npm install:
Recall what the panel decided for the current project:
/agentalk # summarize all conclusions
/agentalk what did we decide about rate limiting
For users paying for multiple AI subscriptions (Claude Max + Gemini Plus + ChatGPT Pro + GLM Pro...) who want their main agent to distribute sub-tasks across all of them — spreading load, preserving main-model quota, and using all paid plans.
This is a separate mode from agentalk discussions. The main agent (e.g. Claude Code) invokes the agentalk-delegate CLI via the Bash tool — no MCP registration required. The skill lives at ~/.claude/skills/agentalk-delegate.md (auto-installed).
agentalk-delegate <agent> "<task>" \
--files "path1,path2" \
--context "background" \
--output "desired format" \
--budget "length hint" \
--timeout 600 # default 600s; bump for >10-file surveys
--resume-step <task-id>:<step-id> # prepend prior stdout as context
agentalk-delegate quotas # observed quota state (real signals, not predicted)
agentalk-delegate capabilities # per-agent strengths + cost tier + priority/billing badges
agentalk-delegate remember "fact" # persist a project-level learning
agentalk-delegate recall # read back project memory
agentalk-delegate task <id> # inspect a delegation task
agentalk-delegate tail <id> # stream task stdout events ([--follow] for live)
agentalk-delegate review # per-agent performance from delegations.jsonl
agentalk-delegate init # setup status + next-step hintsCross-session delegation — message another Claude Code session that has its own accumulated context:
agentalk-delegate sessions # list aliases + every project auto-discovered
# from ~/.claude/projects/
agentalk-delegate @clawplus "what's the API contract for /sessions?"
agentalk-delegate @hub "do you have a key for X?"
agentalk-delegate note @maria "heads-up: ..." # leave a message in a session's inbox
# (same alias/basename resolution as @name)
agentalk-delegate inbox # delegations received by this cwd (local-time stamps)
agentalk-delegate inbox-hook --peek # diagnostic: view unseen WITHOUT marking read
agentalk-delegate install-hook # install/repair the delivery hooks (idempotent)@<name> resolves in this order: registered alias → exact basename of any cwd under ~/.claude/projects/ → unique substring match. No pre-registration needed — every project you've ever opened in Claude Code is addressable by its basename. Use register-session <alias> --cwd <path> only when you want a memorable short alias (e.g. @hub) or to disambiguate. note uses the same resolution, so anything sessions lists as addressable can also receive notes.
Notes and receipts reach a running session through hooks in ~/.claude/settings.json (SessionStart + UserPromptSubmit invoke inbox-hook, which injects unseen records as context). That chain is self-checking: agentalk-delegate doctor has an "Inbox delivery" section that verifies the hooks are installed, checks the absolute paths inside them still exist (a Node version bump moves them), and flags projects whose unseen backlog is days old — a sign the hook isn't firing there. If anything is broken, install-hook repairs it in place (backs up settings.json first, safe to run repeatedly). For troubleshooting, inbox-hook --peek shows exactly what would be injected without advancing the seen-cursor, so diagnosing a delivery problem never destroys the unread state you're inspecting.
Output is structured [MARKER] lines on stdout so skills/scripts parse deterministically:
[STATUS] ok
[AGENT] gemini
[TASK] /Users/.../.agentalk/tasks/t_xxx.json
[TOKENS] 749 (est)
[ELAPSED_MS] 38474
[FINDINGS]
...
[END_FINDINGS]
Architecture: an external supervisor (deterministic code, ~500 LOC in lib/supervisor.js) owns task lifecycle state, observes quota signals, and executes delegations. The main model is the policy generator — it decides WHAT to delegate; the supervisor reliably executes and persists state. If the main model hits quota mid-task, task state lives in ~/.agentalk/tasks/{id}.json so any model can resume.
State layout (mirrors Claude Code's session storage pattern — one JSONL per task, event-stream format):
~/.agentalk/
├── tasks/{id}.jsonl — event stream for one task: task_created, step_added,
│ stdout chunks, stderr chunks, step_completed.
│ Append-only. Current state derived by folding events.
│ One file per task (not per step).
├── quota.json — observed quota state per agent
├── capability.json — capability profile per agent (editable — priority/billing/note fields)
└── delegations.jsonl — append-only log of every delegation (for debug & learning)
{cwd}/.agentalk/
└── memory.jsonl — project-level facts/decisions (append-only)
Why JSONL event stream instead of separate state/log files: mirrors Claude Code's ~/.claude/projects/<key>/<session>.jsonl pattern. Single source of truth, append is atomic per line (no torn-write risk), stdout/stderr chunks are first-class events that enable (1) live tail --follow, (2) automatic partial-output preservation on timeout, (3) --resume-step session continuity by replaying prior stdout as new-brief context.
Example flow: user asks main agent to review an 80-page design doc. Main agent runs agentalk-delegate quotas → sees Gemini available. Runs agentalk-delegate gemini "summarize 15 key decisions" --files ./doc.md. Gemini reads the doc with its 2M context, CLI prints [FINDINGS]. Main agent synthesizes opinion without burning its own context on the raw document — and tells the user what happened: "I used Gemini to read the spec, saved ~40k tokens of my context."
The same primitives are also exposed as MCP tools in agentalk-mcp for MCP-based clients, but the default path is Skill+CLI.
Claude Code can autonomously call the AgenTalk panel mid-task when it faces real uncertainty, or retrieve past discussion conclusions on demand. The single /agentalk skill handles both.
The skill maps uncertainty type to the right discussion mode:
| Situation | Mode used |
|---|---|
| Architecture decision with trade-offs | --panel |
| Proposal you want stress-tested | --challenge |
| Complex bug / root cause analysis | --deepen |
| Exploring all possible approaches | --brainstorm |
| Binary A vs B choice | --debate |
| Open design question | --discuss |
When invoked, Claude frames the question as a well-scoped topic, runs the appropriate headless mode, then tells you the conclusion and how it's applying it:
"I consulted the AgenTalk panel on the rate limiting approach. Consensus: start with in-process token bucket, add a Redis flag from day one so migration is a config change not a rewrite. Applying that now..."
The skill installs to ~/.claude/skills/ on postinstall. To reinstall manually:
node scripts/install-skill.jsAgenTalk exposes itself as an MCP server so other AI tools can run panel discussions:
agentalk-mcp # starts the MCP server over stdioNine tools available:
| Tool | Description |
|---|---|
ask |
Send a message to one or all agents and get responses |
discuss |
Run a parallel multi-round discussion, returns conclusion + transcript |
debate |
Run a serial debate, returns conclusion + transcript |
delegate |
Main agent delegates a sub-task to another CLI; structured brief-in/out + observed quota |
list_quotas |
Observed quota state per agent (available / quota_exceeded / auth_failed / timeout / unknown) |
list_capabilities |
Per-agent strengths, context window, cost tier, recommended use cases |
remember |
Append a fact/decision/learning to .agentalk/memory.jsonl (survives sessions) |
recall |
Read recent memory entries for this project |
task_status |
Query a delegation task's current state and all step progress |
Add to your MCP client config:
{
"mcpServers": {
"agentalk": {
"command": "agentalk-mcp"
}
}
}AgenTalk never calls LLM APIs directly for CLI agents. It spawns each agent's CLI in non-interactive (print) mode:
claude -p "..."
codex exec --skip-git-repo-check "..."
gemini -p "..."
zcode --prompt "..." --mode yolo
opencode run "..." --format json
API model agents (/agents add-model) are called directly via the OpenAI-compatible /chat/completions endpoint — no subprocess needed.
A shared messages[] context is prepended to every prompt, so all agents share the same conversation history regardless of their own session state.
Sessions are saved to ~/.agentalk/sessions/ keyed by the working directory. Discussion summaries are saved both globally (~/.agentalk/summaries/) and to .agentalk/ in the project directory (including a latest.md and latest.json that coding agents can reference).
MIT