Work documentation
How to run and operate the pearing-work agent orchestrator.
Overview
pearing-work is an event-driven orchestrator for external coding agents.
It runs one shared pearing-cli tail-events subprocess, filters matching events for each configured agent,
and dispatches event batches to agent commands through stdin prompts.
Each agent runs at most one invocation at a time. Events that arrive while an agent is already working are queued and delivered in the next batch when that agent becomes idle again.
Startup and environment
pearing-work reads a pearing-work.toml file and uses the existing pearing API environment:
PEARING_API_URLpoints at the pearing API base URL.PEARING_API_TOKENprovides the bearer token for the sharedpearing-clisubprocess.
Those variables are passed through to pearing-cli tail-events, but not to agent subprocesses.
export PEARING_API_URL="https://example.com/api"
export PEARING_API_TOKEN="your-token"
pearing-work -c pearing-work.toml
pearing-work -c /etc/pearing-work/pearing-work.toml --retry 5m --limit 1
pearing-work init
pearing-work init --config /path/pearing-work.toml
pearing-work --tui
The init subcommand writes a fully commented example config and refuses to overwrite an existing file.
Config file
The config file has one global [pearing-work] section and one or more [agents.NAME] sections.
Relative paths are resolved from the config file directory.
[pearing-work]
agent_prompt_file = "prompt.j2"
retry = "5m"
limit = 1
[agents.codex]
cmd = ["codex"]
username = "codex"
workdir = "."
logdir = "logs/codex"
event_scopes = ["team:pearing", "repo:teams/pearing/pearing", "user:codex"]
event_kinds = ["user-mention", "pull-review-created", "pull-review-updated", "pull-review-deleted"]
- Global prompt settings can be inline or file-backed with Jinja2 rendering.
- Each agent defines its command, pearing username, working directory, and event subscription.
- Optional resume commands and session ID capture patterns support resumable agents.
- Optional per-agent log directories keep stdout and stderr archives per invocation.
Dispatch model
- One shared event stream is consumed from
pearing-cli tail-events. - Each enabled agent receives only events matching its configured scopes and kinds.
- Agents do not process their own self-events because the configured pearing username is used to filter them out.
--limitor[pearing-work].limitcan cap how many agents are inworkingstate at once.--retryor[pearing-work].retrysets the bounded retry window for tail-events restarts.
TUI
Run pearing-work --tui to get a terminal dashboard over the orchestrator state.
The screen shows:
- a header with config path, limit, retry window, and overall health
- an agent strip with current status for each configured agent
- attention, events, and log panes
- an expanded selected-agent view when requested
Key controls:
qorCtrl-C: quitTab: cycle panesLeft/Right: change selected agentUp/Down: scroll the focused paneEnter: toggle expanded selected-agent view/: start event filteringEsc: clear filter or exit expanded viewk: send SIGTERM to the selected working agent on Unixr: trigger config reload viaSIGHUPon Unix
Operational patterns
- Run
pearing-workunder an external supervisor such assystemd,supervisord, or a container restart policy. - Use
SIGHUPto reload the same config file without interrupting already-running agent work. - Expect CLI overrides to win over config file values, including across reloads.
- Watch stderr or the TUI for compact status lines like agent state transitions and retry scheduling.
Related docs
- Use API docs for endpoint behavior and event payloads.
- Use CLI docs for the individual
pearing-clicommands that agents and operators call. - Use Skills docs for the thread-centric collaboration workflow that agents follow once `pearing-work` has routed an event.