pi-multi-agent-skill 0.0.0-stage → 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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Milan Glacier
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,148 @@
1
- # Temporary Holding Version
1
+ # pi-multi-agent-skill
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A minimal, lightweight multi-agent skill and CLI for [pi](https://pi.dev). It
4
+ needs no extension and adds no tools. Your agent starts other agents, runs
5
+ them in parallel or in the background, and waits for, steers, stops or
6
+ resumes them. Any harness or agent that has a shell can use it.
7
+
8
+ It aims to be minimal while keeping subagents as useful as an extension and
9
+ tool based approach. A subagent extension adds its tool definitions to every
10
+ request, while this skill adds only a few dozen tokens of description to your
11
+ agent's context until it decides to delegate.
12
+
13
+ ## Install
14
+
15
+ Install the skill as a pi package from npm:
16
+
17
+ ```bash
18
+ pi install npm:pi-multi-agent-skill
19
+ ```
20
+
21
+ Or install directly from GitHub:
22
+
23
+ ```bash
24
+ pi install git:github.com/milanglacier/pi-multi-agent-skill
25
+ ```
26
+
27
+ You can also install the skill with the open skills CLI:
28
+
29
+ ```bash
30
+ npx skills install milanglacier/pi-multi-agent-skill --global --agent pi
31
+ ```
32
+
33
+ The CLI copies the skill to `~/.agents/skills/multi-agent`, which pi reads.
34
+ You can also link it into pi's skills directory yourself:
35
+
36
+ ```bash
37
+ ln -s "$PWD/skills/multi-agent" ~/.pi/agent/skills/multi-agent
38
+ ```
39
+
40
+ Requirements: pi and Python 3.9 or later. Nothing else to install.
41
+
42
+ Agents run `pi` by default. To run another build of pi, such as pi-bolt, set
43
+ `PI_MULTI_AGENT_PI_BIN` in the environment that starts it. Your agent's shell
44
+ inherits the variable, and so do the agents it starts:
45
+
46
+ ```bash
47
+ alias pi-bolt='PI_MULTI_AGENT_PI_BIN=pi-bolt pi-bolt'
48
+ ```
49
+
50
+ ## Features
51
+
52
+ - **Small token cost.** A subagent extension adds its tool definitions to
53
+ every request, whether or not your agent delegates anything. With this
54
+ skill, your agent's context holds only the skill's description, a few
55
+ dozen tokens, until it decides to delegate. Then it loads SKILL.md, which
56
+ is about 1.2K tokens and is all it needs for a fully working multi-agent
57
+ setup. The details of each command stay in separate references that it
58
+ reads only when needed.
59
+ - **Everything a subagent tool does, without the tool.** Your agent gets the
60
+ same controls a dedicated extension would give it: start agents, wait for
61
+ them, `steer` one with a correction, `abort` it and keep what it has so
62
+ far, `resume` a finished job with a follow-up task, and see what each job
63
+ is doing. You can run the same commands yourself from a terminal.
64
+ - **Foreground agents.** Run a quick question and wait for the answer. A
65
+ foreground agent is tied to the command that started it: press Esc, cancel
66
+ the tool call or close the session, and the agent and the commands it was
67
+ running stop with it, at every level of nesting.
68
+ - **Parallel and background agents.** Start several jobs at once and collect
69
+ their results later. A background job is independent of your session: it
70
+ keeps running after the session that started it ends, until it finishes
71
+ or times out, and you can collect its result from a later session.
72
+ - **Your full pi setup.** Each agent loads the same extensions, MCP servers,
73
+ skills and settings as an interactive pi, and uses your model unless its
74
+ profile picks another.
75
+ - **Profiles.** They work as in other subagent tools: each one sets an
76
+ agent's system prompt, model, thinking level and tools.
77
+ - **Fork your conversation.** `--fork` hands the agent everything you have
78
+ discussed so far, for tasks that need that context.
79
+ - **Works outside pi.** Claude Code, Codex or any other agent with a shell
80
+ can run the same commands to delegate work to pi agents.
81
+
82
+ ## Non-goals
83
+
84
+ These are deliberate non-goals, to keep the skill small and free of bloat.
85
+ Each is better as a separate extension or skill that you pick to match your
86
+ own workflow. This follows the minimalism of pi itself and the Unix
87
+ philosophy: do one thing well and compose.
88
+
89
+ - **Memory.** Agents do not share or keep memory between jobs. Use a memory
90
+ extension, or have agents write handoff notes.
91
+ - **Scheduling.** There are no cron-style or recurring agents. Use cron,
92
+ `systemd` timers or a scheduler extension to run the commands.
93
+ - **Worktrees.** Agents are not isolated in git worktrees. Just prompt the
94
+ agent to use a worktree.
95
+ - **Dynamic workflows.** There is no scripting layer for orchestration such
96
+ as pipelines, parallel fan-out with gates, or phases. Your agent can
97
+ already start, wait for and chain jobs with plain commands. For
98
+ deterministic scripts, use an extension such as
99
+ [pi-dynamic-workflow](https://github.com/milanglacier/pi-dynamic-workflow).
100
+
101
+ ## Usage
102
+
103
+ Your agent drives the skill on its own, but the commands also work by hand:
104
+
105
+ ```bash
106
+ multi_agent.py run --profile Explore "Where is the retry policy defined?"
107
+ multi_agent.py run --background --name review "Review the error handling in src/server/"
108
+ multi_agent.py wait review --timeout 120
109
+ multi_agent.py steer review "Skip generated files"
110
+ multi_agent.py resume review "Now check the client side"
111
+ multi_agent.py list
112
+ ```
113
+
114
+ See [`skills/multi-agent/references/`](skills/multi-agent/references/) for
115
+ every command and option, how jobs start and stop, the profile format, where
116
+ state is kept and troubleshooting.
117
+
118
+ ## Profiles
119
+
120
+ A profile is a Markdown file with frontmatter that sets an agent's system
121
+ prompt, model, thinking level and tools. `--profile NAME` selects one;
122
+ `multi_agent.py profiles` lists the available ones.
123
+
124
+ ```markdown
125
+ ---
126
+ model: anthropic/claude-sonnet-5
127
+ thinking: high
128
+ tools: read, grep, find
129
+ ---
130
+ You review code changes and report bugs.
131
+ ```
132
+
133
+ Profiles are looked up in `<cwd>/.pi/agents/*.md`, then
134
+ `$PI_CODING_AGENT_DIR/agents/*.md` (`~/.pi/agent/agents/` by default); when
135
+ names collide, the local profile wins. Two profiles are built in:
136
+ `general-purpose` (the default) and `Explore`, a read-only search agent.
137
+ Supported fields are `name`, `description`, `model`, `thinking`, `tools`,
138
+ `disallowed_tools`, `prompt_mode` and `enabled`. Fields do not merge across
139
+ files, so a local profile replaces the profile it overrides as a whole and
140
+ must supply the entire profile; `enabled: false` is the exception and hides
141
+ the name on its own. Unknown fields are ignored, and nested YAML is not
142
+ supported. See
143
+ [`references/profiles.md`](skills/multi-agent/references/profiles.md) for the
144
+ field details.
145
+
146
+ ## License
147
+
148
+ MIT
package/package.json CHANGED
@@ -1,6 +1,34 @@
1
1
  {
2
2
  "name": "pi-multi-agent-skill",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.0",
4
+ "description": "A minimal multi-agent skill+cli for pi. It adds no extension or tools, so it uses only a few dozen tokens of the context window until the main agent delegates, yet it gives the same controls as a subagent extension. Background agents keep running after the session closes, and any later session can collect their results.",
5
+ "license": "MIT",
6
+ "author": "Milan Glacier",
7
+ "homepage": "https://github.com/milanglacier/pi-multi-agent-skill#readme",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/milanglacier/pi-multi-agent-skill.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/milanglacier/pi-multi-agent-skill/issues"
14
+ },
15
+ "keywords": [
16
+ "pi-package",
17
+ "pi",
18
+ "agent-skill",
19
+ "multi-agent"
20
+ ],
21
+ "files": [
22
+ "skills/multi-agent/SKILL.md",
23
+ "skills/multi-agent/profiles/*.md",
24
+ "skills/multi-agent/references/*.md",
25
+ "skills/multi-agent/scripts/*.py",
26
+ "README.md",
27
+ "LICENSE"
28
+ ],
29
+ "pi": {
30
+ "skills": [
31
+ "./skills"
32
+ ]
33
+ }
34
+ }
@@ -0,0 +1,140 @@
1
+ ---
2
+ name: multi-agent
3
+ description: Start other pi agents and delegate work to them. Use it when a task benefits from a multi-agent workflow, such as splitting work across agents, running it in parallel or in the background, or keeping a side task out of your own context.
4
+ ---
5
+
6
+ # Multi-agent
7
+
8
+ This skill starts other agents and manages each one as a named job. An agent
9
+ does not see your conversation unless you start it with `--fork`, and you see
10
+ only its final message.
11
+
12
+ `SKILL_DIR` below is the directory that contains this SKILL.md. Every command
13
+ has the form:
14
+
15
+ ```bash
16
+ python3 "$SKILL_DIR/scripts/multi_agent.py" <command> ...
17
+ ```
18
+
19
+ ## Pick a profile
20
+
21
+ A profile sets an agent's system prompt, model, thinking level and tools. Run
22
+ this once per session to see the available profiles:
23
+
24
+ ```bash
25
+ python3 "$SKILL_DIR/scripts/multi_agent.py" profiles
26
+ ```
27
+
28
+ There are two built-in profiles. `general-purpose` (the default) has your
29
+ tools and settings. `Explore` is a read-only search agent. Pass a profile
30
+ with `--profile NAME`.
31
+
32
+ ## Run an agent
33
+
34
+ For a short single task, run it in the foreground. The command blocks until
35
+ the agent finishes and prints its result:
36
+
37
+ ```bash
38
+ python3 "$SKILL_DIR/scripts/multi_agent.py" run --profile Explore "Where is the retry policy for HTTP calls defined?"
39
+ ```
40
+
41
+ Pass a prompt longer than one line through `-` and a heredoc:
42
+
43
+ ```bash
44
+ python3 "$SKILL_DIR/scripts/multi_agent.py" run --name auth-review - <<'EOF'
45
+ Read src/auth/ and list every place that ...
46
+ EOF
47
+ ```
48
+
49
+ Write prompts that are self-contained: give the goal, the relevant paths and
50
+ what the answer should contain. When the task builds on your conversation so
51
+ far, add `--fork` instead: the agent starts from a copy of it.
52
+
53
+ For a long task, or several tasks in parallel:
54
+
55
+ - If your harness has a tool that runs a shell command in the background, run
56
+ the foreground `run` command with it. The job then stops when your session
57
+ ends. The command prints `multi-agent: started job NAME` first; use that
58
+ name for `steer` and `abort`. If the tool can wake you on each output line,
59
+ turn that off and wait for the command to exit. If the tool has its own
60
+ timeout, see "Timeouts" below.
61
+ - Otherwise, or when the work must continue after your session ends, add
62
+ `--background`. The command prints the job name and returns at once. A
63
+ background job runs until it finishes or reaches its timeout (one hour by
64
+ default). Tell the user the job's name.
65
+ - Never put the command in the background with `&`; use `--background`.
66
+
67
+ Run only as many jobs at once as the task needs.
68
+
69
+ ## Timeouts
70
+
71
+ - A foreground `run` or `resume` has no timeout unless you pass
72
+ `--timeout S`. It stops when the agent finishes or when the command ends,
73
+ for example when your tool call is cancelled or your session ends.
74
+ - A `--background` job stops after one hour unless you pass `--timeout S`.
75
+ `--timeout 0` removes the limit.
76
+ - When a background tool of your harness runs the foreground command and the
77
+ tool has its own timeout, pass a shorter `--timeout`, leaving a grace
78
+ period so the job stops the agent and records its result before the tool
79
+ kills it. If you disable the tool's timeout instead, the job runs until
80
+ the agent finishes or your session ends.
81
+
82
+ ## Wait for a result
83
+
84
+ ```bash
85
+ python3 "$SKILL_DIR/scripts/multi_agent.py" wait NAME --timeout 120
86
+ ```
87
+
88
+ Exit code 2 means the job is still running; run the same command again in a
89
+ new tool call. Wait for one job per tool call and do not chain several `wait`
90
+ commands in one call: a message that steers you arrives only after your
91
+ current tool call returns.
92
+
93
+ The output is the agent's final message followed by a `--- multi-agent ---`
94
+ footer. The footer is for you. Report the agent's findings to the user in your
95
+ own words.
96
+
97
+ Exit code 0 means the job ended with status `done`; 1 means it ended another
98
+ way (`failed`, `aborted`, `timeout`, `killed`, `died`), and the output says
99
+ why.
100
+
101
+ ## Correct or continue a job
102
+
103
+ ```bash
104
+ python3 "$SKILL_DIR/scripts/multi_agent.py" steer NAME "Skip the tests directory"
105
+ python3 "$SKILL_DIR/scripts/multi_agent.py" abort NAME
106
+ python3 "$SKILL_DIR/scripts/multi_agent.py" kill NAME
107
+ python3 "$SKILL_DIR/scripts/multi_agent.py" resume NAME "Now check the callers too"
108
+ ```
109
+
110
+ - `steer` adds a message that the agent reads before its next step.
111
+ - `abort` stops the agent and keeps its last message as the result.
112
+ - `kill` stops a job that does not respond to `abort`.
113
+ - `resume` continues a finished job's conversation with a new prompt.
114
+
115
+ `kill --all` stops every running job of the current project. Use it only when
116
+ the user asks.
117
+
118
+ ## Inspect jobs
119
+
120
+ ```bash
121
+ python3 "$SKILL_DIR/scripts/multi_agent.py" list
122
+ python3 "$SKILL_DIR/scripts/multi_agent.py" status NAME
123
+ python3 "$SKILL_DIR/scripts/multi_agent.py" peek NAME
124
+ ```
125
+
126
+ `peek` shows the job's recent tool calls.
127
+
128
+ ## References
129
+
130
+ The `references/` directory next to this file has the details. Read a file
131
+ only when you need it:
132
+
133
+ - `commands.md`: every command and option, output formats and exit codes.
134
+ - `lifecycle.md`: statuses, how a run stops, foreground and background
135
+ lifetime, timeouts, dialogs and nesting.
136
+ - `profiles.md`: writing a profile, where profiles are looked up, and how the
137
+ model, tools and system prompt are chosen.
138
+ - `state.md`: where jobs and conversations are stored, and the agent's
139
+ environment.
140
+ - `troubleshooting.md`: error messages and what to do about them.
@@ -0,0 +1,34 @@
1
+ ---
2
+ description: "Fast read-only search agent for locating code. Use it to find files by pattern (eg. \"src/components/**/*.tsx\"), grep for symbols or keywords (eg. \"API endpoints\"), or answer \"where is X defined / which files reference Y.\" Do NOT use it for code review, design-doc auditing, cross-file consistency checks, or open-ended analysis — it reads excerpts rather than whole files and will miss content past its read window. When calling, specify search breadth: \"quick\" for a single targeted lookup, \"medium\" for moderate exploration, or \"very thorough\" to search across multiple locations and naming conventions."
3
+ tools: read, bash, grep, find, ls
4
+ prompt_mode: replace
5
+ ---
6
+
7
+ # CRITICAL: READ-ONLY MODE - NO FILE MODIFICATIONS
8
+ You are a file search specialist. You excel at thoroughly navigating and exploring codebases.
9
+ Your role is EXCLUSIVELY to search and analyze existing code. You do NOT have access to file editing tools.
10
+
11
+ You are STRICTLY PROHIBITED from:
12
+ - Creating new files
13
+ - Modifying existing files
14
+ - Deleting files
15
+ - Moving or copying files
16
+ - Creating temporary files anywhere, including /tmp
17
+ - Using redirect operators (>, >>, |) or heredocs to write to files
18
+ - Running ANY commands that change system state
19
+
20
+ Use Bash ONLY for read-only operations: ls, git status, git log, git diff, find, cat, head, tail.
21
+
22
+ # Tool Usage
23
+ - Use the find tool for file pattern matching (NOT the bash find command)
24
+ - Use the grep tool for content search (NOT bash grep/rg command)
25
+ - Use the read tool for reading files (NOT bash cat/head/tail)
26
+ - Use Bash ONLY for read-only operations
27
+ - Make independent tool calls in parallel for efficiency
28
+ - Adapt search approach based on thoroughness level specified
29
+
30
+ # Output
31
+ - Use absolute file paths in all references
32
+ - Report findings as regular messages
33
+ - Do not use emojis
34
+ - Be thorough and precise
@@ -0,0 +1,3 @@
1
+ ---
2
+ description: General-purpose agent for research, broad searches and multi-step tasks. It has the caller's tools and settings.
3
+ ---
@@ -0,0 +1,218 @@
1
+ # Commands
2
+
3
+ Every command runs as `python3 "$SKILL_DIR/scripts/multi_agent.py" <command>`.
4
+ A PROMPT or MESSAGE of `-` is read from stdin, without its trailing newlines.
5
+ An empty prompt or message is a usage error. `--help` prints a usage summary.
6
+
7
+ | Command | What it does |
8
+ |---|---|
9
+ | `run [options] (PROMPT \| -)` | Start a new job. |
10
+ | `resume NAME [--background] [--timeout S] (PROMPT \| -)` | Start a new run of a finished job, in the same conversation. |
11
+ | `wait NAME [--timeout S]` | Block until the job is no longer running, then print its result. |
12
+ | `result NAME` | Print the result of a job that is not running. |
13
+ | `steer NAME (MESSAGE \| -)` | Give a running agent a message to read before its next step. |
14
+ | `abort NAME` | Ask a running agent to stop, keeping its last message as the result. |
15
+ | `kill NAME` / `kill --all` | Stop one job, or every running job of the current project. |
16
+ | `status NAME` | Print the job's settings and state. |
17
+ | `peek NAME [-n N]` | Print the last N lines (default 20) of the job's progress log. |
18
+ | `list [--all]` | List the jobs of the current project. |
19
+ | `profiles` | List the available profiles. |
20
+ | `rm NAME` / `rm --all` | Delete one job that is not running, or every such job of the current project, with their conversations. |
21
+
22
+ ## Projects and job names
23
+
24
+ A job belongs to the project of the directory where `run` was called. `run`,
25
+ `list`, `kill --all` and `rm --all` work on the current directory's project only.
26
+
27
+ The other commands look for NAME in the current project first. If the project
28
+ has no job of that name, they search every project and use the job when
29
+ exactly one project has it, so they also work from another directory. When
30
+ several projects have a job of that name, the command fails and lists them;
31
+ run it from the job's project.
32
+
33
+ ## run
34
+
35
+ | Option | Meaning |
36
+ |---|---|
37
+ | `--profile P` | Profile name, matched case-insensitively. Default `general-purpose`. |
38
+ | `--name N` | Job name. Default: the profile name in lowercase, `-`, and 4 hex digits, such as `explore-3f9a`. |
39
+ | `--background` | Return as soon as the job has started. |
40
+ | `--timeout S` | Wall-clock limit for the run in seconds. Default 3600 for a background run and no limit for a foreground run. `0` means no limit. |
41
+ | `--fork` | Start the agent from a copy of the caller's conversation. |
42
+ | `--model M` | Model pattern passed to `pi --model`. |
43
+ | `--thinking L` | Thinking level passed to `pi --thinking`. |
44
+ | `--cwd DIR` | Working directory for the agent, relative to the current directory. Default: the current directory. |
45
+
46
+ A job name contains letters, digits, `.`, `_` and `-`, starts and ends with a
47
+ letter or digit, and has at most 64 characters. `run` refuses a name that
48
+ already exists in the project and reports its status and age. Pick another
49
+ `--name`. Use `resume` or `rm` only for a job you started or the user asked
50
+ about.
51
+
52
+ `--cwd` changes where the agent works and where project profiles are looked
53
+ up (`DIR/.pi/agents/`). The job still belongs to the current directory's
54
+ project.
55
+
56
+ `--fork` copies the conversation in `$PI_SESSION_FILE`, which pi sets for the
57
+ commands it runs. It fails when that variable is unset or the file does not
58
+ exist. Only the job's first run starts from the copy; later runs continue the
59
+ job's own conversation.
60
+
61
+ When `--model` and `--thinking` are omitted, the profile and then the caller's
62
+ settings decide; see `profiles.md`.
63
+
64
+ A foreground `run` writes `multi-agent: started job NAME` to stderr as soon as
65
+ the job starts, then blocks and prints the result when the run ends. If the
66
+ command receives SIGINT, SIGTERM or SIGHUP, the job stops with status `killed`
67
+ and the command still prints the result. A second signal ends the command at
68
+ once.
69
+
70
+ A background `run` prints the following and exits with code 0. `timeout_s`
71
+ is `none` when the run has no limit.
72
+
73
+ ```
74
+ job: explore-3f9a
75
+ status: running
76
+ timeout_s: 3600
77
+ ```
78
+
79
+ ## resume
80
+
81
+ `resume` starts a new run of a job that is not running. The agent continues
82
+ the job's conversation, with the profile, model, thinking level, tools, system
83
+ prompt and working directory that the job was created with. Editing the
84
+ profile afterwards does not change an existing job.
85
+
86
+ Only `--background` and `--timeout` can be given. They apply to the new run
87
+ alone and have the same defaults as for `run`, so a resumed run does not
88
+ inherit the previous run's timeout. Output is the same as for `run`.
89
+
90
+ The job's status, result and duration always describe its latest run. If the
91
+ job has no saved conversation, for example because pi failed during start-up,
92
+ `resume` prints a note to stderr and the agent starts a new conversation.
93
+
94
+ ## wait and result
95
+
96
+ `wait` blocks until the job is no longer running and prints its result.
97
+ Without `--timeout` it waits as long as the job runs. When `--timeout`
98
+ expires first, it prints the following and exits with code 2; the
99
+ `last_progress` line is missing when the progress log is empty.
100
+
101
+ ```
102
+ job: explore-3f9a
103
+ status: running
104
+ waited_s: 120
105
+ last_progress: 14:02:11 grep retry policy
106
+ ```
107
+
108
+ `result` prints the result of a job that is not running and fails with `job
109
+ NAME is still running; use wait` otherwise.
110
+
111
+ `run` in the foreground, `wait` and `result` print the result as the agent's
112
+ final message followed by a footer:
113
+
114
+ ```
115
+ <final assistant text>
116
+
117
+ --- multi-agent ---
118
+ name: explore-3f9a
119
+ status: done
120
+ profile: Explore
121
+ model: anthropic/claude-sonnet-5
122
+ duration_s: 84
123
+ ```
124
+
125
+ The text is `(no output)` when the run produced none. For a `failed` run it
126
+ ends with an `error:` line. `model` is the model that wrote the latest
127
+ message, or the requested model when none did, or `(pi default)` when no
128
+ model was requested. `duration_s` covers the latest run. `lifecycle.md`
129
+ explains what the text holds for each status.
130
+
131
+ ## steer
132
+
133
+ `steer` sends a message to the running agent, which reads it before its next
134
+ step. It prints `job: NAME` and `steer: queued` once pi has accepted the
135
+ message, and the message appears in the progress log. It fails with `job is
136
+ not running; use resume` when the run has ended or is ending.
137
+
138
+ ## abort
139
+
140
+ `abort` asks the agent to stop and prints `job: NAME` and `abort: requested`
141
+ without waiting for it. Steering messages that the agent has not read yet are
142
+ discarded. The run ends with status `aborted`; use `wait` to get the result.
143
+ `abort` fails with `job is not running; use resume` when the run has ended or
144
+ is ending.
145
+
146
+ ## kill
147
+
148
+ `kill NAME` stops the run at once and returns after the job's runner has
149
+ exited, which takes at most about 20 seconds. It prints the job name and the
150
+ status the run ended with:
151
+
152
+ ```
153
+ job: explore-3f9a
154
+ status: killed
155
+ ```
156
+
157
+ When the run had already ended, or was ending on its own, `kill` changes
158
+ nothing, prints that status followed by `(not running)`, and exits with code
159
+ 0.
160
+
161
+ `kill --all` stops every running job of the current project in parallel and
162
+ prints one such block per job. For a job it could not stop, the block has an
163
+ `error:` line instead of the status, and the command exits with code 1. With
164
+ no running job it prints `no running jobs in this project`.
165
+
166
+ ## status
167
+
168
+ `status` prints `key: value` lines: `name`, `status`, `mode` (`foreground` or
169
+ `background`), `profile`, `model`, `parent`, `cwd`, `started_at`, `ended_at`,
170
+ `runs`, `exit_code`, `output_file`, `session_file` and `session_cmd`. A `-`
171
+ marks a missing value. Timestamps are UTC and describe the latest run.
172
+
173
+ `session_cmd` opens the job's conversation in interactive pi. While the job
174
+ runs, `status` adds a `note:` line as a reminder not to open it yet, because
175
+ two processes would then write the same conversation file.
176
+
177
+ ## peek
178
+
179
+ `peek` prints the last N lines of the job's progress log, which spans all of
180
+ its runs. Each line starts with the local time. The log records each run's
181
+ start and end, every tool call with a short excerpt of its main argument,
182
+ retries, compactions, cancelled dialogs (`denied:`), steering messages, abort
183
+ requests and timeouts. It does not hold the agent's text; read that with
184
+ `wait` or `result`.
185
+
186
+ ## list
187
+
188
+ `list` prints a table with the columns `NAME`, `STATUS`, `MODE`, `PARENT` and
189
+ `AGE`, oldest first. It shows running jobs and jobs that ended in the last 24
190
+ hours; `--all` shows every job of the project. `AGE` is the time since the
191
+ run started for a running job and since it ended otherwise. `PARENT` is the
192
+ job that started this one, or `-`.
193
+
194
+ ## profiles
195
+
196
+ `profiles` lists each enabled profile with its description and source file.
197
+ It looks up project profiles in the current directory.
198
+
199
+ ## rm
200
+
201
+ `rm NAME` deletes a job that is not running: its state directory and its
202
+ conversation file. It prints `removed: NAME` and fails with `job NAME is
203
+ running; kill it first` while the job runs.
204
+
205
+ `rm --all` deletes every job of the current project that is not running,
206
+ with its conversation, and leaves running jobs alone.
207
+
208
+ ## Exit codes
209
+
210
+ | Code | Meaning |
211
+ |---|---|
212
+ | 0 | The job ended with status `done`, or the command succeeded. |
213
+ | 1 | The job ended with another status, or the command failed. |
214
+ | 2 | `wait` timed out and the job is still running. |
215
+ | 64 | Usage error, such as an unknown option or a missing prompt. |
216
+
217
+ The job's status decides the exit code of a foreground `run` or `resume`, of
218
+ `wait` and of `result`. The other commands exit with 0 when they succeed.