A tiny Node.js CLI that orchestrates Agent Teams (Codex, Claude Code, Gemini CLI) autonomously in a headless, tightly-coupled architecture.
Note: This is aiteam v2. We have migrated away from the legacy Python/tmux screen-scraping architecture to a robust Node.js WebSocket Hub with stdio JSON-RPC IPC.
It’s designed for workflows like:
- Lead Agent (Human or Mock UI) coordinates the team.
- Claude Adapter (
claudeheadless stream mode) for architectural review and refactoring. - Gemini Adapter (
geminiheadless stream mode) for log analysis and task implementation. - Codex Adapter (
codex app-serverJSON-RPC mode) for test execution and OS operations.
…and it allows agents to autonomously @agent_name route messages to each other without human intervention.
- Node.js v20+
pnpm(via corepack)- Any “agent CLI” commands you want to run (examples:
claude,gemini,codex)
On Windows/macOS/Linux:
corepack enable
pnpm installcd tmux-ai-team-tool-repo
pnpm run buildTo run aiteam from anywhere on your system:
# Link globally via pnpm (or use: npm install -g .)
pnpm link --globalWhen you pull new changes, re-install globally so aiteam outside the repo uses the latest dist/cli.js:
pnpm run build
npm install -g . --forceNow you can start the Hub from any directory:
aiteam
aiteam codex
aiteam claudenode dist/cli.jsStart the Central Hub. It will automatically spawn the Codex, Claude, and Gemini adapters in the background and present an interactive prompt.
node dist/cli.jsaiteam starts Codex via codex app-server. Make sure your ~/.codex/config.toml has necessary capabilities enabled.
[profiles.aiteam]
model = "gpt-5.3-codex"
model_reasoning_effort = "high"
personality = "pragmatic"
approval_policy = "never"
sandbox_mode = "danger-full-access"The core of v2 is the Inter-Agent Router with a single visible main agent.
You(codex)> Run the test suite and summarize failures.
The human input line is routed to the selected main agent automatically (default: codex).
Background agents stay headless and communicate through the Hub.
An agent can autonomously delegate by outputting:
@codex echo 'HELO'
The Hub intercepts this and routes it natively.
aiteam -h is optimized for AI operators and includes:
- main/peer role model (
lead,main,peers) - state model (
connected/disconnected) - inter-agent delegation contract (
@<agent> <task>) - autonomy policy (prefer agent-to-agent collaboration before reporting to lead)
Runtime status snapshot:
/status
Port 4501 is in use:- Expected fallback behavior:
aiteamauto-selects another free port.
- Expected fallback behavior:
aiteamoutput looks like old@agent-only UX:- Rebuild and reinstall globally (
npm install -g . --force) so global shim points to latest build.
- Rebuild and reinstall globally (
- Claude asks permission before command/tool execution:
- Default adapter mode is
--permission-mode bypassPermissions. - Override with
AITEAM_CLAUDE_PERMISSION_MODEif needed.
- Default adapter mode is
- Codex is slow or appears to hang on simple prompts:
- Adapter now starts Codex with
approval_policy="never"andmodel_reasoning_effort="high"by default. - Override with
AITEAM_CODEX_APPROVAL_POLICY/AITEAM_CODEX_REASONING_EFFORT. - Use
inheritto defer to your global Codex profile config.
- Adapter now starts Codex with
- Claude command execution on Windows hits
bash ... dofork ... 0xC0000142:- By default, Claude
Bashis allowed. - If your environment is unstable, disable only Bash with
AITEAM_CLAUDE_ALLOW_BASH=0.
- By default, Claude
- Gemini on Windows shows
AttachConsole failed:- Adapter runs Gemini with
-pone-shot prompts and Windows Node entrypoint fallback. - Adapter stderr is hidden by default to avoid log noise; enable it with
AITEAM_GEMINI_LOG_STDERR=1.
- Adapter runs Gemini with
[sys:n] waiting for codex...frequency tuning:- Adjust with
AITEAM_SYS_PROGRESS_INTERVAL_MS(default:5000ms). - Waiting banner includes elapsed seconds and blocks new prompts until the current target replies.
- Adjust with
We use Vitest for unit tests (Hub/Adapters) and full E2E Workflow tests.
E2E tests are driven through wezterm cli (Windows). They require:
- WezTerm installed (
wezterm.exe) codexCLI available in PATH- built artifacts (
pnpm run build)
# Run all tests
pnpm run test
# Run E2E tests only
pnpm run test src/__tests__/e2e/- Active Node/Vitest tests:
src/__tests__/ - Manual adapter probe scripts (not auto-run by Vitest):
src/__tests__/probes/
The following examples map directly to existing E2E specs.
Run the spec only:
pnpm exec vitest run src/__tests__/e2e/headless-workflow.spec.ts --reporter verboseManual interactive equivalent:
aiteam
/status
Hello, are you there?
exit
Expected:
/statusshows- codex: connected- A
[codex] ...reply appears Shutting down...appears onexit
Run the spec only:
pnpm exec vitest run src/__tests__/e2e/inter-agent.spec.ts --reporter verboseManual interactive equivalent (send this as one message after aiteam starts):
You are codex main coordinator. Hard constraint: do NOT run shell commands or terminal tools yourself. Focus only on agent-to-agent delegation and synthesis. Do NOT use internal collab tools like spawnAgent/wait/closeAgent. Only delegate using literal @claude and @gemini lines. Never ask claude to read/write files. Claude must answer in plain text only. Do not skip delegation. You MUST delegate to claude and gemini first. First output exactly two delegation lines (one per line) before any explanation: @claude Provide a plain-text GROWI semantic-search architecture overview (Elasticsearch vector backend + OpenAI embeddings). Do not use file/tools. @gemini /generate "GROWI semantic search architecture diagram manual_token_20260223" --count=1 Then continue autonomous multi-agent workflow: 1) delegate to claude for GROWI semantic search overview design (Elasticsearch vector backend + OpenAI embeddings). 2) delegate to gemini with an actual /generate command that includes token manual_token_20260223. 3) produce codex impact scope. 4) perform mutual review among claude/codex/gemini and resolve disagreements. Return concise updates while work is running. Do not ask lead for extra steps unless blocked.
Then send:
Provide final consolidated overview with sections: CLAUDE_DESIGN, CODEX_IMPACT, GEMINI_DIAGRAM, MUTUAL_REVIEW.
Expected:
/statusrouted pairs include bothcodex->claudeandcodex->gemini- a new PNG is generated in
nanobanana-output/ - debug log includes
fromConnection=geminiwitheventType=gemini_text
Manual reproduction:
$listener = [System.Net.Sockets.TcpListener]::new([System.Net.IPAddress]::Loopback, 4501)
$listener.Start()
aiteamExpected startup line:
[aiteam] Port 4501 is in use. Using port <another-port>.
Cleanup:
$listener.Stop()The repository includes a git submodule pointing to weseek/growi to evaluate complex Agent Teams collaboration (e.g. semantic search implementation). See e2e-dataset/growi-semantic-search-task/TASK_SPEC.md for details.