npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

zerg-ztc

v0.1.76

Published

Zerg Terminal Client - CLI agent for continual AI systems

Readme

ZTC — Zerg Terminal Client

An autonomous AI agent for the terminal. ZTC combines Claude-style conversational coding with native computer control, multi-agent orchestration, and a Voyager-inspired routine system for autonomous operation in graphical applications.

  ╭─ ZTC v0.1.57 ─────────────────────────────────────────────────────╮
  │ Provider: Anthropic  Model: claude-sonnet-4-20250514             │
  │ Working directory: ~/projects/my-app  Branch: main                │
  ╰───────────────────────────────────────────────────────────────────╯

❯ Build a house in Luanti using the saved routines

◆ I'll use the Voyager routine system to build the house.
  ⚙ computer_list_routines [0.1s]
    → 10 saved routines
  ⚙ computer_run_routine [216s]
    → build_house completed: 7x5x3 cobblestone house

  House built successfully — cobblestone walls, wood roof, door and window.

● Ready                                          [████████░░] 42%

Quick Start

# Install dependencies and build
npm install && npm run build

# On macOS, npm install also creates ZTC Desktop.app in Applications.
# Set ZTC_SKIP_DESKTOP_APP=1 to skip that best-effort launcher install.

# Build native Rust binaries (screen capture, input injection)
npm run build:rust

# Run in development mode
npm run dev

# Or run the built version
npm start

Requirements

  • Node.js >= 18
  • Rust toolchain (for native binaries — cargo)
  • Anthropic API key (set via ANTHROPIC_API_KEY env var or /config key)
  • macOS, Linux, or Windows

Features

Terminal AI Agent

  • Agentic tool use — file I/O, shell commands, code search, LSP integration
  • Streaming responses with real-time tool execution traces
  • Context management — automatic compaction at configurable thresholds, manual /compact
  • Session persistence — auto-save, resume with ztc resume or --resume, per-project session storage
  • Mux-aware resumeztc resume restores the saved conversation and, when present, the prior zmux layout plus child ZTC panes
  • Sub-agent delegation — spawn isolated agents for context-heavy research
  • Plan mode — read-only codebase exploration, then structured implementation

Computer Use

  • Native input injection — keyboard, mouse, and relative mouse movement at the hardware level
  • Screen capture — native PNG screenshots via the ztc-computer Rust binary
  • Routine system — save, version, and replay JavaScript routines in a sandboxed subprocess
  • Application harnesses — app-specific configs, reference docs, and automated setup (Luanti built-in)
  • Voyager loop — autonomous multi-round task completion with auto-continuation

Multi-Agent Orchestration (zmux)

  • Terminal multiplexer — fullscreen split-pane environment for parallel agent instances
  • Swarm mode — conductor agent delegates tasks across child ZTC panes
  • Plugin orchestrators — external sibling projects (e.g. /tycoon/, /cybersim/) register via .ztc/plugin.yaml and self-attach to ZTC's orchestrator registry
  • Message bus — inter-agent communication across panes

ZTerm Desktop

On macOS, npm install creates ZTC Desktop.app in /Applications when that directory is writable, otherwise in ~/Applications. Opening the app launches ztc --desktop --cwd "$HOME" so the native ZTerm surface starts from your home folder. Set ZTC_SKIP_DESKTOP_APP=1 to skip app creation during install, or ZTC_DESKTOP_APP_DIR=/path to install the app bundle somewhere else.

Voice & Media

  • Voice dictation — native Whisper transcription (Ctrl+R)
  • TTS synthesis — multiple backends (macOS say, Parler, OpenAI, ElevenLabs)
  • Image support — paste from clipboard (Ctrl+I), screenshot compression

Computer Use

ZTC can autonomously control graphical applications through native keyboard/mouse injection and screen capture. The system follows a Voyager-style approach: observe the screen, plan an action, execute it, verify the result, and save successful routines for reuse.

Enabling Computer Use

# Interactive mode with computer control
npm run dev -- --computer-use

# Headless mode with Voyager loop
node dist/cli_main.js --headless --computer-use \
  --voyager-loop --voyager-task "Build a house in Luanti" \
  --voyager-max-rounds 15 --timeout 1800000

Computer Use Tools

| Tool | Description | |------|-------------| | computer_screenshot | Native PNG screenshot of the entire screen | | computer_key | Inject keyboard press/release events | | computer_type_text | Type a string with keystroke simulation | | computer_mouse_move | Move mouse to absolute coordinates | | computer_mouse_move_relative | Relative mouse delta (works with FPS games) | | computer_mouse_click | Click at current or specified position |

Routine System

Routines are JavaScript scripts executed in a sandboxed subprocess with access to native input APIs. They run at native speed — no LLM round-trip per keystroke.

# The agent can save and reuse routines:
computer_save_routine    # Save a verified routine
computer_list_routines   # List saved routines
computer_run_routine     # Execute a routine (with optional timeout)
computer_delete_routine  # Remove a routine

Routine sandbox globals:

// Mouse control
mouse.move(x, y)              // Absolute move
mouse.move_relative(dx, dy)   // Relative move (camera rotation)
mouse.click("left"|"right")   // Click
mouse.click("left", x, y)     // Click at position
mouse.down("left") / mouse.up("left")

// Keyboard control
key.press("W")                // Press and release
key.down("W") / key.up("W")  // Hold/release
key.type("hello", 20)         // Type string (20ms between keys)
key.combo("Ctrl", "C")        // Key combination

// Screen
screen.dimensions()           // { width, height }
screen.shot()                 // Take screenshot (returns base64 PNG)

// Utilities
sleep(ms)                     // Wait
log("message")                // Log to routine output
runRoutine("name", args)      // Call another saved routine

Routines are stored in ~/.ztc/computer_use/routines/ and persist across sessions.

Application Harnesses

Harnesses provide app-specific configuration, reference documentation, and setup automation. They're loaded with computer_load_harness.

Built-in harness: Luanti (Minetest)

  • Flat world with frozen noon, creative mode, all privileges
  • Comprehensive reference doc with controls, building strategies, item aliases
  • Auto-setup: writes minetest.conf, creates world, configures fullscreen
# Create custom harnesses in:
~/.ztc/computer_use/harnesses/<name>/
  config.json    # Launch config, window size, env vars
  harness.md     # Reference doc injected into agent context
  setup.ts       # Optional setup automation

Voyager Loop Mode

For long-running autonomous tasks, the Voyager loop auto-continues across multiple agent rounds. Between rounds, the agent is prompted to screenshot current state, review saved routines, and proceed — naturally recovering from context compaction.

node dist/cli_main.js --headless --computer-use \
  --voyager-loop \
  --voyager-task "Build a cobblestone house with a roof" \
  --voyager-max-rounds 15 \
  --timeout 1800000

| Flag | Description | Default | |------|-------------|---------| | --voyager-loop | Enable auto-continuation loop | — | | --voyager-task <text> | Task description (alternative to --prompt) | — | | --voyager-max-rounds <n> | Maximum continuation rounds | 20 | | --timeout <ms> | Wall-clock timeout | 1800000 (30 min) |

The loop exits when the agent says "Task completed" (detected via regex patterns) or the round/time budget is exhausted.

Native Input Injection (macOS)

ZTC uses hardware-level input injection for compatibility with games and fullscreen apps:

  • Keyboard: CGEvent injection — works with all applications including SDL/game engines
  • Mouse clicks: CGEvent with embedded position — avoids async cursor race conditions
  • Relative mouse: IOHIDPostEvent (IOKit layer) — works with SDL native relative mouse mode, indistinguishable from real hardware input

zmux — Terminal Multiplexer

zmux provides a fullscreen split-pane environment for running multiple terminal processes and ZTC agent instances simultaneously. It is the default interactive renderer for ZTC; use --no-mux to disable it.

# Launch the default interactive mux
npm run dev

# With auto-created agent panes (3 columns)
npm run dev -- --num-zergs 3

# Grid layout (2 columns x 3 rows)
npm run dev -- --num-zergs 2x3

# Disable mux explicitly
npm run dev -- --no-mux

Pane Tools

When running in zmux, the agent gains access to terminal pane management:

| Tool | Description | |------|-------------| | create_terminal_pane | Spawn a process in a new pane (shell, server, child ZTC) | | read_terminal_pane | Read current terminal buffer contents | | write_terminal_pane | Send keystrokes to a pane | | close_terminal_pane | Close a pane and kill its process | | list_terminal_panes | List all panes with status |

Scrollback

Because zmux runs in the terminal alternate screen, outer terminal scrollback is not the right primitive once mux is always on. Instead, zmux keeps pane-local history and exposes a tmux-style inner scroll mode:

  • Mouse wheel scrolls the pane under the pointer by default
  • Panes with scrollable history show a live scrollbar gutter on the right edge
  • Clicking the scrollbar gutter jumps to that point in history
  • Ctrl+B g rebalances the current layout into an even grid
  • Ctrl+B v rebuilds the current panes as evenly sized columns
  • Ctrl+B r rebuilds the current panes as evenly sized rows
  • Ctrl+B m makes the focused pane primary and stacks the rest beside it
  • Ctrl+B t opens the workspace tree
  • Ctrl+P opens the fuzzy file picker
  • Ctrl+B w opens the pane picker
  • Ctrl+B : or Ctrl+K opens the command palette
  • Ctrl+B [ enters scroll mode for the focused pane
  • Ctrl+B e opens the focused pane output in $VISUAL / $EDITOR
  • Ctrl+B R restarts the focused restartable pane
  • Ctrl+B i toggles pinning on the focused pane
  • Ctrl+B A toggles close-on-exit for the focused command/process pane
  • PgUp / PgDn page through history
  • Up / Down or j / k move by line
  • / opens a scrollback search prompt
  • n / N moves between scrollback search matches
  • g / Home jumps to the top
  • e opens the current pane history in $VISUAL / $EDITOR while in scroll mode
  • G / End jumps back to live output
  • q, Esc, or Enter exits scroll mode

The TUI file surfaces stay native to the terminal instead of trying to emulate the web view:

  • The fuzzy file picker opens files into doc panes and Ctrl+E opens the selected file in $EDITOR
  • The workspace tree supports h / l folding plus direct file open
  • The pane picker shows pane status, pin markers, and exit codes
  • The command palette exposes layouts, pane lifecycle actions, and workspace navigation

Swarm Mode

Conductor mode for orchestrating multiple agents in parallel:

/swarm    — Enter conductor mode
/swarm-status  — Check agent progress
/swarm-stop    — Exit conductor mode

The conductor agent delegates tasks to child ZTC panes, monitors progress, and coordinates results.

Mirror Mode

Browser-based UI that mirrors the terminal session:

/mirror       — Start mirror at http://localhost:3940
--mirror      — Enable on startup
--mirror-port — Custom port

In zmux mode the browser mirror can now focus panes, switch layout presets, toggle zoom, create ZTC or shell panes, close panes, and drive pane scroll position through the same mux state machine as the terminal client.

Conductor Branches

Launch the ZTC build from a running Conductor workspace branch:

ztc --branch sydney-v1
ztc --branch sydney-v1 --mirror
ztc --branch=sydney-v1 resume my-session

--branch resolves the workspace under CONDUCTOR_WORKSPACES_ROOT, defaulting to ~/conductor/workspaces/zerg, reads that branch's .conductor/ports.env, and re-execs the branch-local ztc/dist/cli_main.js with your original working directory.


Modes

Modes modify ZTC's behavior by restricting tools, injecting system prompts, and producing artifacts.

| Mode | Command | Description | |------|---------|-------------| | Normal | (default) | Full tool access with approval prompts | | Auto-accept | Shift+Tab | Skip tool approval — fast execution | | Plan | /plan | Read-only exploration, structured planning | | Swarm | /swarm | Multi-agent conductor (zmux) | | Manifest | /manifest | YAML manifest creation with validation | | Strict | — | Minimal output, exact constraint following | | Zerg | — | Cloud agent delegation via Zerg API |

Custom Modes

Create YAML mode definitions in ~/.ztc/modes/:

name: my_mode
version: "1.0"
label: My Mode
description: Custom operational mode
auto_accept: false
tools:
  blocked: [run_command]    # Tools to disable
system_prompt: |
  Additional instructions for the agent...
artifact:
  enabled: true
  type: markdown
  path_template: "./output-{timestamp}.md"
commands:
  - name: my_cmd
    description: Custom command
on_enter_questions:
  - name: target
    question: "What should we work on?"
    type: text

Headless Mode

Run ZTC without a TUI for automation, CI, and scripting:

# Single prompt, exit when done
node dist/cli_main.js --headless --prompt "Refactor auth module"

# JSON protocol (structured I/O)
node dist/cli_main.js --headless --json

# With timestamps and file output
node dist/cli_main.js --headless --prompt "Fix the tests" \
  --timestamps --output result.txt --timeout 300000

| Flag | Description | Default | |------|-------------|---------| | --headless | Enable headless mode | — | | --prompt <text> | Single prompt to execute | — | | --json | JSON protocol for I/O | — | | --max-iterations <n> | Max agent iterations | 50 | | --timeout <ms> | Operation timeout | 300000 | | --output <file> | Save response to file | — | | --timestamps | Show timestamps in output | — | | --quiet / -q | Suppress build output | — | | --session-id <id> | Use or create a specific session ID | — |


CLI Flags Reference

General

--help, -h              Show help
--version, -v           Show version
--cwd <path>            Start in directory
--branch <name>         Launch the ZTC build from a Conductor workspace branch

Sessions

resume [id]             Resume session (latest or by ID)
--resume [id], -c       Resume session (latest or by ID)
--session-id <id>       Use or create a specific session ID
--list-sessions         List saved sessions

When a saved session includes zmux state, ztc resume restores the pane layout, focus, zoom state, and relaunch metadata for child panes as part of the resumed session. Child ZTC panes launched from mux now receive stable session IDs automatically, so nested agent conversations resume too.

Modes & Features

--plan                  Start in plan mode
--mode <path>           Load mode from YAML file
--agent-domain <name>   Inject tools from an external domain YAML into the agent
--domain-paths <dirs>   Extra search roots for external domains (colon-separated)
--mux                   Explicitly enable zmux multiplexer (default for interactive ZTC)
--no-mux                Disable zmux and use the single-pane renderer
--pane                  Pane mode (for zmux children)
--computer-use          Enable computer control tools
--ml                    Enable ML inference/training tools
--mirror                Enable browser mirror
--mirror-port <n>       Mirror port (default: 3940)

zmux Options

--new-window            Open new terminal window
--fullscreen            Maximize terminal window
--num-zergs <n|CxR>     Auto-create agent panes

Commands

Configuration

| Command | Description | |---------|-------------| | /config show | View configuration | | /config key <key> | Set API key | | /config model <name> | Set model | | /model <name> | Alias for config model | | /models | List available models | | /permissions | View/update tool permissions |

Session & Context

| Command | Description | |---------|-------------| | /clear | Clear message history | | /sessions | List/manage saved sessions | | /status | Show current status | | /context | Detailed context window usage | | /compact [%] | Compact conversation (default: 50%) | | /retry | Retry last request |

Modes

| Command | Description | |---------|-------------| | /mode [name] | Show or enter a mode | | /modes | List available modes | | /exit-mode | Return to normal | | /plan [desc] | Enter plan mode | | /execute | Execute plan |

Shell & Files

| Command | Description | |---------|-------------| | /shell <cmd> or !<cmd> | Run shell command | | /cd <path> | Change directory | | /clipboard | Copy conversation |

Voice

| Command | Description | |---------|-------------| | /dictation | Manage dictation (devices, model) | | /voice | Manage TTS synthesis |

zmux & Orchestration

| Command | Description | |---------|-------------| | /swarm | Enter conductor mode | | /swarm-status | Check agent progress | | /swarm-stop | Exit conductor mode | | /mirror [port] | Start browser mirror |

Meta

| Command | Description | |---------|-------------| | /help | Show commands | | /update | Update ZTC | | /debug | Toggle debug mode | | /keybindings | Show keyboard shortcuts | | /emulation | Prompt emulation profiles | | /exit | Exit ZTC |


Keyboard Shortcuts

| Shortcut | Action | |----------|--------| | Enter | Submit message | | Shift+Enter | Insert newline | | Ctrl+C | Exit | | Ctrl+L | Clear screen | | Ctrl+R | Toggle voice dictation | | Ctrl+I | Paste image from clipboard | | Ctrl+O | Expand/collapse last tool output | | Ctrl+Shift+O | Toggle all tool outputs | | Ctrl+G | Open plan file in editor | | Ctrl+T | Toggle task list | | Shift+Tab | Cycle modes | | Tab | Path completion | | Up/Down | Command history | | Ctrl+A / Ctrl+E | Start / end of line | | Ctrl+U | Clear input line | | Ctrl+W | Delete word before cursor | | Ctrl+K | Kill to end of line |


Agent Tools

File System

  • read_file — Read file contents
  • write_file — Write/modify files (with diff display)
  • list_directory — List directory contents
  • search — Regex code search (ripgrep-style)

Shell & Execution

  • run_command — Execute shell commands with timeout
  • run_and_monitor — Long-running command monitoring

Development (LSP)

  • goto_definition — Jump to symbol definition
  • find_references — Find all references to a symbol
  • hover — Get type info and documentation
  • diagnostics — Compiler errors and warnings
  • lsp_status — Check language server status

Supported: Rust (rust-analyzer), TypeScript, Python (pyright), C/C++ (clangd), Go (gopls)

Agent Orchestration

  • delegate_task — Spawn sub-agent for isolated research
  • plan_mode / submit_plan / ask_user — Planning workflow tools
  • todo_write — Task list management
  • ztc_command — Execute slash commands programmatically

ML Tools (--ml)

  • ml_load_model — Load model from safetensors weights
  • ml_infer — Run inference on images
  • ml_train — Train on session data
  • ml_status — GPU device and model status

Architecture

Rendering

ZTC uses a Rust/Ratatui terminal renderer communicating with the TypeScript agent via Unix domain socket IPC. The renderer operates in inline viewport mode — content scrolls above while the input area stays fixed at the bottom.

Agent Loop

User Input → Agent → Claude API → Tool Use? → Execute → Continue
                ↑                      │            │
                └──────────────────────┴────────────┘

Standard ReAct loop with streaming, automatic retry (429/529/5xx), and configurable max iterations.

Native Binaries (Rust)

  • ztc-computer — Screen capture (CoreGraphics/X11/Win32), hardware-level input injection (IOHIDPostEvent/CGEvent), process management
  • ztc-ml — GPU-accelerated ML inference and training (candle framework)

Built with npm run build:rust — cross-compiled per platform.

Project Structure

ztc/
├── src/
│   ├── cli_ratatui.ts         # Main CLI entry point
│   ├── headless.ts            # Headless/automation mode
│   ├── agent/
│   │   ├── factory.ts         # Agent creation (model, tools, capabilities)
│   │   ├── runtime/           # Agent execution engine
│   │   ├── tools/             # Tool definitions (file, shell, computer, ml, ...)
│   │   └── commands/          # Slash command handlers
│   ├── modes/
│   │   ├── types.ts           # Mode definition types
│   │   ├── registry.ts        # Mode discovery and loading
│   │   └── builtin/           # Built-in mode YAML definitions
│   ├── computer_use/
│   │   ├── routine_runner.ts  # Sandboxed routine subprocess executor
│   │   └── harnesses/         # Application-specific harness configs
│   │       └── luanti/        # Luanti (Minetest) harness
│   ├── utils/
│   │   ├── computer_native.ts # ztc-computer binary bridge
│   │   ├── ml_native.ts       # ztc-ml binary bridge
│   │   ├── compaction.ts      # Context compaction
│   │   └── shell.ts           # Shell utilities
│   └── web/                   # Mirror mode web UI
├── packages/
│   ├── ztc-computer/          # Rust: screen capture + input injection
│   └── ztc-ml/                # Rust: ML inference + training
├── tbench/                    # Terminal-Bench evaluation harness
└── scripts/
    └── build-rust.sh          # Native binary build script

Data Directories

~/.ztc/
├── config.json                # User configuration
├── sessions/                  # Saved conversation sessions
├── todos/                     # Per-project todo lists (<projectHash>.json)
├── plans/                     # Plan mode artifacts
├── modes/                     # User custom modes
├── models/                    # Downloaded ML/TTS models
├── logs/                      # Session logs
└── computer_use/
    ├── routines/              # Saved Voyager routines
    └── harnesses/             # User application harnesses

External Domains (custom tools)

ZTC's simulation/emulation layer can be extended by a host app with its own YAML-declared tools (DB queries, REST calls, business logic) without forking. This is how products like ca_org plug reconciliation tools into ZTC while still running through the npm-published binary.

Layout

<project>/.ztc/domains/<name>/
  <name>.yaml          # Tool metadata — names, descriptions, JSON schemas
  handlers.mjs         # (optional) ES module — exports { handlers: { key: fn } }
  handlers.js          # (optional) CommonJS — same shape
  handlers.cjs         # (optional) CommonJS — same shape, explicit ext

Discovery order (first match wins)

  1. ZTC_DOMAIN_PATHS env — colon-separated (: on *nix, ; on Windows) list of explicit roots.
  2. {cwd}/.ztc/domains — project-local, works cleanly as a k8s ConfigMap or Docker volume mount.
  3. ~/.ztc/domains — user-global.
  4. The builtin src/simulation/domains/ shipped with ZTC.

Example: domain YAML

# .ztc/domains/ca_org/ca_org.yaml
name: ca_org
event_artifact_map: {}
sentiment_by_type: {}
event_descriptions: {}
variable_mappings: {}
tools:
  - name: reconcile_lookup
    handler: "ca_org:reconcile_lookup"
    description: Look up a person by name in the ca_org employees table.
    parameters:
      name: { type: string, description: Full or partial name to match }
    required: [name]

Example: handler bundle

A sibling handlers.{mjs,js,cjs} file is auto-imported when the domain loads.

Extension matters. Prefer handlers.mjs (always ESM) or handlers.cjs (always CommonJS). handlers.js is classified by the nearest package.json#type field — inside a "type": "module" project it's ESM and won't load through the sync path; pick the explicit extension to avoid that ambiguity.

The example below is pseudocode. db is referenced from outer scope, which doesn't exist in a Node module. In practice either (a) import your deps at the top of the file (import { Pool } from 'pg'), or (b) use the library API path below to share DB pools / HTTP clients / auth context from your host process — that's the recommended pattern for anything non-trivial since createRequire resolves from <domain-dir>/node_modules and your home-dir domain folder won't have one.

// .ztc/domains/ca_org/handlers.mjs — pseudocode
import { getDbPool } from './your-own-db-module.mjs';

export const handlers = {
  'ca_org:reconcile_lookup': async (args) => {
    const db = await getDbPool();
    const rows = await db.query('SELECT id, name FROM employees WHERE name ILIKE $1', [`%${args.name}%`]);
    return JSON.stringify(rows);
  },
};

Wiring tools into the agent

# CLI: point ZTC at the domain + enable it for the active agent
ztc --domain-paths ./.ztc/domains --agent-domain ca_org --headless

The --agent-domain flag (or ZTC_AGENT_DOMAIN env) injects the domain's tools into any agent session — not just sim/mux panes. The existing ZTC_SIM_DOMAIN behavior is preserved for the swarm coordinator.

Security: --agent-domain loads and executes the domain's sibling handlers.{mjs,js,cjs} file with full process.env at startup. Only use with domain bundles you trust. A shared .ztc/domains/ repo checked into a team repo is equivalent to committing arbitrary startup code — review handler files the same way you would review CI scripts.

Mode interaction: domain tools bypass the mode-level tool allowlist (including plan mode, which is otherwise read-only-ish). If you inject a domain with a write_file-style tool, it runs in every mode your agent enters. For capability-gated flows, prefer registering sensitive handlers conditionally from the library API (see below) rather than shipping them in a YAML that any mode can invoke.

Shadowing builtins is unsupported. Because the builtin directory is last in the search order, a user-supplied YAML named the same as a builtin domain (e.g. sim-pane) will take precedence. This can break swarm-coordinator contracts and shouldn't be relied on — rename your domain if you notice the collision.

Library API

The zerg-ztc/domain entry point exposes the external-domain surface for hosts that want to register handlers programmatically (e.g. a Nuxt server that holds a DB connection pool and wants its handlers to share it):

import {
  registerAgentHandler,
  buildAgentToolsFromDomainAsync,
  DomainFactory,
} from 'zerg-ztc/domain';

// Option A: register handlers imperatively before creating an agent.
registerAgentHandler('ca_org:reconcile_lookup', async (args) => { ... });

// Option B: let ZTC auto-import the handlers.mjs sibling at domain-load time.
const tools = await buildAgentToolsFromDomainAsync('ca_org');

Development

npm run build          # Compile TypeScript + copy assets
npm run build:rust     # Build native Rust binaries
npm run dev            # Development mode (tsx + rust build)
npm run dev:ink        # Legacy Ink renderer
npm run web            # Web UI at http://localhost:3000
npm start              # Production entry point

Environment Variables

| Variable | Description | |----------|-------------| | ANTHROPIC_API_KEY | Anthropic API key | | ZTC_DEBUG | Enable debug logging | | ZTC_SUBAGENT_DEBUG | Log sub-agent execution | | ZTC_DISABLE_AUTO_COMPACT | Disable automatic compaction | | ZTC_DICTATION_FILTER | Disable filler word filter (set to 0) | | ZTC_DOCKER_CONTAINER | Route file tools through Docker | | ZTC_WEB_MIRROR | Enable web mirror mode | | ZTC_TODO_STORE | Override path to the todo JSON file (defaults to ~/.ztc/todos/<projectHash>.json) | | ZTC_DOMAIN_PATHS | Extra roots for external domain YAML (colon-separated on *nix, ; on Windows) | | ZTC_AGENT_DOMAIN | Domain whose tools get injected into the normal agent | | ZTC_SIM_DOMAIN | Domain for simulation/swarm child panes (mux/pane mode only) | | SDL_MOUSE_RELATIVE_MODE_WARP | Force SDL warp mode (computer use fallback) |


License

MIT


Part of the Zerg autonomous AI framework.