@lune_99/pi-subagent 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/CHANGELOG.md +57 -0
- package/LICENSE +21 -0
- package/README.md +185 -2
- package/docs/capture.json +30 -0
- package/docs/previews.md +22 -0
- package/docs/reference.md +264 -0
- package/docs/subagent-auto-tiers.png +0 -0
- package/docs/subagent-inspector.png +0 -0
- package/docs/subagent-overview.png +0 -0
- package/package.json +82 -5
- package/skills/create-lune-subagent/SKILL.md +190 -0
- package/src/auto-model.ts +601 -0
- package/src/catalog.ts +111 -0
- package/src/definition-file.ts +147 -0
- package/src/definitions.ts +330 -0
- package/src/dock/dock-alert.ts +78 -0
- package/src/dock/dock-contribution.ts +328 -0
- package/src/extension-tools.ts +46 -0
- package/src/index.ts +194 -0
- package/src/inspector/details.ts +119 -0
- package/src/inspector/inspector.ts +677 -0
- package/src/inspector/layout.ts +119 -0
- package/src/inspector/transcript.ts +735 -0
- package/src/inspector/viewport.ts +62 -0
- package/src/inspector/wrap.ts +136 -0
- package/src/models.ts +69 -0
- package/src/notify/notification-box.ts +408 -0
- package/src/notify/notifier.ts +586 -0
- package/src/paths.ts +34 -0
- package/src/render/lune-theme.ts +68 -0
- package/src/render/text.ts +121 -0
- package/src/run/guide.ts +31 -0
- package/src/run/report-tool.ts +90 -0
- package/src/run/run-file.ts +194 -0
- package/src/run/run-manager.ts +935 -0
- package/src/run/run-session.ts +307 -0
- package/src/run/run.ts +773 -0
- package/src/run/session-start.ts +283 -0
- package/src/run/types.ts +175 -0
- package/src/run/worktree.ts +138 -0
- package/src/schema.ts +9 -0
- package/src/settings/agents-menu.ts +376 -0
- package/src/settings/panel.ts +221 -0
- package/src/settings/schema.ts +75 -0
- package/src/settings/thinking-choices.ts +92 -0
- package/src/tools/format.ts +397 -0
- package/src/tools/subagent-tools.ts +355 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes follow [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
4
|
+
|
|
5
|
+
## [Unreleased]
|
|
6
|
+
|
|
7
|
+
## [0.2.0] - 2026-11-28
|
|
8
|
+
|
|
9
|
+
> **⚠️ Breaking: `subagent_start` now requires `task` and starts one run per call.**
|
|
10
|
+
|
|
11
|
+
### Removed
|
|
12
|
+
|
|
13
|
+
- **Batch starts.** Remove the `tasks` parameter and batch-specific progress and results from `subagent_start`. Start independent runs with separate calls, which can run in parallel.
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- **Allowed subagent models.** Select multiple models from Pi's scoped models under `/lune-core-settings subagents`. A nonempty selection replaces the session's default allowed list for new runs, including explicit models and auto tiers; clear it to restore Pi's scope. Changes update the tool's model options immediately, without changing existing runs or main-model inheritance.
|
|
18
|
+
- **Run titles.** An optional `title` on `subagent_start` labels a run in the `/agents` inspector, the Dock and its end-of-turn notice. The subagent tools still take a run's ID, never its title or name, and the results and notices name the run only by that ID; passing a title or name fails, and the error lists the branch's run IDs.
|
|
19
|
+
- **Auto mode only.** A Subagents setting that removes the `model` and `thinking` parameters from `subagent_start`, so every inline run routes both automatically. An inline call that still names another model or supplies thinking starts nothing. Custom agents keep their definition's model.
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- **Agent runs keep their definition.** A `subagent_start` call that names an agent takes only `task` and `title`, and the definition's model, thinking, tools and isolation always apply. A call that also sets one of them starts nothing. Edit the definition to change a role's settings.
|
|
24
|
+
- **Classifier model label.** The **Auto classifier** setting is now **Classifier model**, with copy that matches Compaction's classifier selection. Unavailable-classifier errors point to `/lune-core-settings → Subagents → Classifier model`; behavior is unchanged.
|
|
25
|
+
- **Turns without a report.** The Dock, notifications, `/agents` and `subagent_status` no longer label such a turn `unreported`, because the word suggested that its result never reached the main agent. A turn that ended normally shows as `done` in the Dock, notifications and `/agents`. A turn whose last reply hit the token limit or left no text shows no task status, only its state. The main agent still gets the run's last message, marked as having no task status. A turn now goes by its own last reply, even one that Pi dropped to recover, so a failed request shows as `failed` with its error, its message is never an older reply, and an earlier failure no longer carries into a later turn.
|
|
26
|
+
- **BREAKING: Auto routes model and thinking together.** Remove `thinking` from calls and definitions using `model: auto`; conflicting values now fail instead of overriding the router. Auto mode only hides both parameters, and selecting auto in Custom agents removes a saved thinking override while keeping its comments. Fixed or inherited models retain explicit thinking levels.
|
|
27
|
+
- **Your messages to a run reach the main agent.** When you write to a run in `/agents`, the main agent gets your message with that turn's report, and `subagent_status` shows it while the turn runs.
|
|
28
|
+
- **Clearer `/agents` selection.** The selected run has an accent `›` and a bold title, and reopening the inspector returns to that run for the rest of the session. Each row of the run list shows one whole status at the right and cuts only the title. Running runs come first in each branch group, and the selection stays on its run when the order changes.
|
|
29
|
+
- **Higher auto thinking for hard tasks.** The thinking rating starts at the least level that is clearly enough and rises for correctness that cannot be checked by running the result, so a demanding task uses the model's top level. A model whose levels stop below `max` gives its highest level to the tasks that a higher level would take.
|
|
30
|
+
- **Core 0.2.1 dependency.** Require `@lune_99/pi-lune-extensions-core@^0.2.1`, the same range as the other Lune packages, so an installation shares one Core copy. Publish Core 0.2.1 before Subagent.
|
|
31
|
+
|
|
32
|
+
### Fixed
|
|
33
|
+
|
|
34
|
+
- **Full replies after truncation.** When a turn ends without a report and its last message exceeds 20,000 characters, save the complete reply as a Markdown file in the system temporary directory. The truncation hint in the notice and run status includes its path, so the main agent can read the omitted text.
|
|
35
|
+
- **Supported thinking choices.** Custom agents limit selectable levels to a fixed or inherited model's support, while auto models route thinking for each task. The automatic default is labeled correctly, invalid fixed model selections report errors, and unsupported saved levels stay visible as disabled entries.
|
|
36
|
+
- **Dock counts kept runs.** A run that you keep running when you leave its branch now counts in the Agents Dock while it works. Before, it appeared only when its finished turn waited for its branch.
|
|
37
|
+
|
|
38
|
+
## [0.1.0] - 2026-10-28
|
|
39
|
+
|
|
40
|
+
### Added
|
|
41
|
+
|
|
42
|
+
- **Subagent runs.** The main agent delegates a task with `subagent_start` and continues while the run works in its own Pi session with a fresh context. With `tasks`, one call starts several runs at the same time, and an entry that fails to start does not stop the others. `subagent_send`, `subagent_status` and `subagent_stop` steer, read and stop runs, and each ended turn reaches the main agent as a batched steer message with the run's report. When a message continues a turn after its report, the earlier reports reach the main agent with the turn's last report. Each report message is confirmed in the main session and sent again when it is missing; after you interrupt the main agent, it goes with your next message.
|
|
43
|
+
- **Agent definitions.** Markdown files in `lune-subagents/` in Pi's agent directory, and in `.pi/lune-subagents/` of a trusted project, define reusable roles with their tools, model, thinking level and isolation. A project definition replaces a user definition of the same name. The loaded agents appear in the system prompt's `subagents` section, with project agents marked, and invalid or replaced files are reported instead of loaded.
|
|
44
|
+
- **Runs per branch and session.** A run belongs to the branch that started it, and its reports wait while another branch is active, then arrive when you return. Leaving a branch with running runs asks once whether to keep or stop them. Runs come back from their own session files when you resume the session, and runs that arrive through `/fork` or `/clone` are read-only.
|
|
45
|
+
- **Extension tools in runs.** A run can select a tool that one of your user or project extensions registers. The run loads that extension in its own session with only the selected tools, also on resume. Names that runs have on their own stay Pi's, the subagent tools stay unavailable, and an extension that fails to load or does not register the tool fails the start.
|
|
46
|
+
- **Worktree isolation.** A run can work in its own detached Git worktree at the current `HEAD` commit. The package keeps the worktree for later turns and never merges or deletes it.
|
|
47
|
+
- **Dock entry and `/agents` inspector.** The Dock counts runs by status, and its full level names the run that changed last. Without runs it shows only `○ Agents` at every display level, matching Shell and Ask. A narrow Dock cell leaves out complete parts, the least urgent first, and never cuts the line. A failed or blocked turn shows a red `✕` for 10 seconds, or until you open the run in the inspector; then a gray `●` remains. The inspector shows each run's live transcript as a compact log, with one row per tool call and per finished thought and a report call marked `writing` until the run records it, and the model and thinking level that its requests use. It lets you write to a run or stop it, and shows its start values, workspace and token usage.
|
|
48
|
+
- **Built-in definition-creation skill.** `create-lune-subagent` asks for the global or project scope, name, description and model, then recommends thinking, tools, isolation and role instructions for the task. It saves only the definition and destination you approve, without starting a run.
|
|
49
|
+
- **Auto model.** `model: auto` in `subagent_start` or a definition lets a Pi classifier rate the task's tier. The run uses the model set for that tier, or for the next tier up that has one, with the main agent's model as the ceiling. When the call and the definition set no thinking level, the classifier also rates the thinking among the levels that Pi reports for the run's model, in the same request when the possible models support the same levels and in a second request otherwise. A separate high-risk question asks whether a mistake in the task could seriously harm security, privacy, data, money or production; at the configured threshold, the model comes from at least the configured floor tier, while the rated tier stays as it is. An unsure answer moves one level up. A long task and the agent's instructions are cut in the middle so that the request fits the classifier's context window, counted in UTF-8 bytes. When the classifier fails, the run uses the main agent's model and thinking, and the start values and the inspector show the error. Without a selected classifier, auto runs use the main agent's model and thinking. The start values show the rating, and the inspector shows it in the model row and at the top of the run's log.
|
|
50
|
+
- **Subagents settings.** `/lune-core-settings subagents` selects the auto classifier, its Auto tiers menu selects one model per task tier and the high-risk floor and threshold, and its Custom agents menu edits each definition's name, description, model, thinking, tools and isolation in its file. Start values apply to the next run; names and descriptions apply after `/reload`.
|
|
51
|
+
- **Startup agent list.** When Lune Core Theme is enabled, the session's loaded agent names appear under `[Agents]` below Pi's other startup resources. The list uses the same validated, trusted-scope definitions as the tools and prompt, and refreshes with the session.
|
|
52
|
+
|
|
53
|
+
### Changed
|
|
54
|
+
|
|
55
|
+
- **Package presentation.** Introduce the package with native Pi screenshots, installation steps and a shorter feature guide. Keep detailed contracts in a bundled reference, and declare the package image and public npm access for its first release.
|
|
56
|
+
- **Core dependency.** Require `@lune_99/pi-lune-extensions-core@^0.2.0` for the Auto tiers and Custom agents menus. Publish Core 0.2.0 before Subagent so registry installations receive the required Panel API.
|
|
57
|
+
- **Delegation guidance.** Clarify delegation boundaries, task context, editing ownership and minimal tool selection. Prompt agents to return concise evidence-backed reports and validate results before integration.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nouvelle-Lune
|
|
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,186 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Lune Subagent
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@lune_99/pi-subagent) [](https://www.npmjs.com/package/@lune_99/pi-subagent) [](LICENSE)
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
**Background agents for [Pi](https://pi.dev), with live transcripts, reusable roles and optional Git worktrees.**
|
|
8
|
+
|
|
9
|
+
Hand a review, investigation or implementation task to a subagent while the main agent continues.
|
|
10
|
+
Each run gets a fresh Pi session, reports back when its turn ends and keeps its context for follow-up
|
|
11
|
+
work. Open `/agents` to read the transcript, send a message or stop the run.
|
|
12
|
+
|
|
13
|
+
## Quick start
|
|
14
|
+
|
|
15
|
+
Requires Node.js **22.19.0 or newer**, Pi **1.3.0 or newer**, and a model configured in Pi.
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pi install npm:@lune_99/pi-subagent
|
|
19
|
+
pi
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Ask for delegated work:
|
|
23
|
+
|
|
24
|
+
```text
|
|
25
|
+
Start two subagents: one to review the retry policy, and one to find its call sites.
|
|
26
|
+
Keep working on the documentation while they investigate.
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The main agent starts both runs and receives their reports automatically. Run `/agents` to follow
|
|
30
|
+
their progress. A reusable agent definition is optional; the main agent can describe a one-off run
|
|
31
|
+
directly.
|
|
32
|
+
|
|
33
|
+
## What it does
|
|
34
|
+
|
|
35
|
+
- **Work in parallel.** Start one run or several in one tool call. Each gets its own conversation
|
|
36
|
+
and only the task you delegate; reports arrive when turns end, without status polling.
|
|
37
|
+
- **Give each run a title.** A short title such as `Review retry policy` labels the run in
|
|
38
|
+
`/agents`, the Dock and its end-of-turn notice. The agent still addresses runs by ID.
|
|
39
|
+
- **Keep control of a run.** Read its live transcript, steer it while it works, or continue it after
|
|
40
|
+
a completed, failed or interrupted turn. Questions return to the main agent for coordination.
|
|
41
|
+
- **Choose where changes happen.** Share the current working directory or give a run a detached
|
|
42
|
+
Git worktree. Worktrees stay available for review and later turns; integration remains explicit.
|
|
43
|
+
- **Reuse a role.** Save Markdown definitions with instructions, tools, a model and isolation, or
|
|
44
|
+
use the included `create-lune-subagent` skill to write one with you.
|
|
45
|
+
- **Route models automatically.** Use Jev or another Pi classifier as a task router with `model: auto`.
|
|
46
|
+
It selects the subagent's model from four configured tiers and chooses a supported thinking level.
|
|
47
|
+
A configurable floor raises the model tier for tasks rated high risk.
|
|
48
|
+
- **Stay with the session.** Runs survive resume in their own session files. Reports belong to
|
|
49
|
+
the Pi conversation branch that started the run; inherited runs in a fork or clone are read-only.
|
|
50
|
+
|
|
51
|
+
## Follow the work
|
|
52
|
+
|
|
53
|
+

|
|
54
|
+
|
|
55
|
+
The inspector puts runs on the left and the selected transcript on the right. Running runs move to
|
|
56
|
+
the top of the list, and the selection stays on its run when the order changes. Tool calls and
|
|
57
|
+
finished thinking occupy compact rows; messages and reports remain readable in full. The heading
|
|
58
|
+
shows the run's state, model and thinking level. Press `d` for start values, token usage and workspace
|
|
59
|
+
details. It reopens on the run you had selected.
|
|
60
|
+
|
|
61
|
+
| Action | Keys |
|
|
62
|
+
| ------------------------------ | ---------------------------------- |
|
|
63
|
+
| Select a run | `↑` / `↓` or `k` / `j` |
|
|
64
|
+
| Scroll the transcript | `Shift+↑` / `Shift+↓` or `K` / `J` |
|
|
65
|
+
| Jump to oldest / follow newest | `Home` / `End` |
|
|
66
|
+
| Write to the selected run | `Enter`, type, `Enter` to send |
|
|
67
|
+
| Show details / stop the turn | `d` / `x` |
|
|
68
|
+
| Close | `Esc` |
|
|
69
|
+
|
|
70
|
+
[Lune Dock](https://www.npmjs.com/package/@lune_99/pi-dock) adds an **Agents** entry with run counts
|
|
71
|
+
and states. Without Dock, the same status appears below the editor with an `/agents` hint.
|
|
72
|
+
|
|
73
|
+
## Reusable agents
|
|
74
|
+
|
|
75
|
+
Save a definition in `~/.pi/agent/lune-subagents/` for your own use, or `.pi/lune-subagents/` for a
|
|
76
|
+
project. A project definition of the same name takes precedence. Pi's agent directory follows
|
|
77
|
+
`PI_CODING_AGENT_DIR`.
|
|
78
|
+
|
|
79
|
+
For example, `~/.pi/agent/lune-subagents/reviewer.md`:
|
|
80
|
+
|
|
81
|
+
```markdown
|
|
82
|
+
---
|
|
83
|
+
name: reviewer
|
|
84
|
+
description: Reviews a diff and reports actionable problems.
|
|
85
|
+
tools: read, grep, find, ls, bash
|
|
86
|
+
thinking: high
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
Review the diff named in the task. Do not change files. Report problems with their file,
|
|
90
|
+
line and reason, most severe first. If there are none, report that explicitly.
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
This role follows the main agent's model. Add `model: provider/id` to choose one, or `model: auto`
|
|
94
|
+
to use task tiers. Add `isolation: worktree` for a role that should change files separately.
|
|
95
|
+
Run `/reload` after saving a definition.
|
|
96
|
+
|
|
97
|
+
The main agent starts a role with only a task and a title. The definition's model, thinking, tools
|
|
98
|
+
and isolation always apply; the main agent cannot change them in the call.
|
|
99
|
+
|
|
100
|
+
To create a role interactively:
|
|
101
|
+
|
|
102
|
+
```text
|
|
103
|
+
/skill:create-lune-subagent Create a reusable code-review subagent.
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
The skill asks for scope, name, description and model, then recommends tools, thinking, isolation
|
|
107
|
+
and instructions. You review the complete definition and destination before it writes the file.
|
|
108
|
+
|
|
109
|
+
## Models and settings
|
|
110
|
+
|
|
111
|
+

|
|
112
|
+
|
|
113
|
+
Install Core's Pi entry to use the settings command:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
pi install npm:@lune_99/pi-lune-extensions-core
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Then restart Pi and open `/lune-core-settings subagents`. **Allowed models** is a multi-select
|
|
120
|
+
list from Pi's scoped models: Space toggles a model and Enter saves. A nonempty selection replaces
|
|
121
|
+
the session's default allowed model list for new runs; clear it to follow Pi's scope again. Saved
|
|
122
|
+
models remain allowed outside a later session's scope while available in Pi. Existing runs keep
|
|
123
|
+
their model, and inheriting the main agent's model is unchanged.
|
|
124
|
+
|
|
125
|
+
**Custom agents** edits saved definitions; **Classifier model** and **Auto tiers** configure runs
|
|
126
|
+
started with `model: auto`. **Auto mode only** removes the `model` and `thinking` parameters from
|
|
127
|
+
`subagent_start`, so every inline run routes both automatically; custom agents keep their own model.
|
|
128
|
+
Model choices in Custom agents and Auto tiers follow the subagent allowed list.
|
|
129
|
+
|
|
130
|
+
| Tier | Intended work |
|
|
131
|
+
| -------- | -------------------------------------------------- |
|
|
132
|
+
| Light | Lookups, extraction and explicitly specified steps |
|
|
133
|
+
| Standard | Routine changes and checks with clear requirements |
|
|
134
|
+
| Complex | Analysis or implementation across components |
|
|
135
|
+
| Deep | Design decisions, unclear failures and subtle bugs |
|
|
136
|
+
|
|
137
|
+
Automatic routing supports Pi's classifier models, including TypeSafe's **Jev**. The classifier
|
|
138
|
+
rates the task; you choose the models for the tiers. It also selects a thinking level supported
|
|
139
|
+
by the chosen model. Auto calls and definitions must omit `thinking`; a fixed level requires a
|
|
140
|
+
fixed or inherited model. Empty tiers use the next configured tier, then the main agent's model.
|
|
141
|
+
With no classifier selected, `auto` uses the main agent's model and thinking.
|
|
142
|
+
|
|
143
|
+
The **High-risk floor** defaults to Deep and applies when the high-risk probability reaches the
|
|
144
|
+
configured threshold, initially 40%. It changes model selection; tool permissions and approvals
|
|
145
|
+
still apply independently. Classifier errors are shown in the run's start values and inspector,
|
|
146
|
+
and the run uses the main agent's model. See the [full auto-model behavior](docs/reference.md#auto-model).
|
|
147
|
+
|
|
148
|
+
## Tools and lifecycle
|
|
149
|
+
|
|
150
|
+
| Tool | Purpose |
|
|
151
|
+
| ----------------- | ------------------------------------------------------- |
|
|
152
|
+
| `subagent_start` | Start one task in a new Pi session |
|
|
153
|
+
| `subagent_send` | Steer an active run or continue it with another message |
|
|
154
|
+
| `subagent_status` | Read states, usage and reports on the current branch |
|
|
155
|
+
| `subagent_stop` | Stop the turn while keeping its session and worktree |
|
|
156
|
+
|
|
157
|
+
Issue separate `subagent_start` calls to start independent runs in parallel. Each call requires `task`.
|
|
158
|
+
|
|
159
|
+
A run reports `done`, `blocked` or `needs_input`. Stopping it preserves its conversation. Closing
|
|
160
|
+
the main session interrupts active runs; resume the session and use `subagent_send` to continue.
|
|
161
|
+
|
|
162
|
+
Runs start with Pi's native tools and its codemode, tool-search and MCP built-ins. Selected tools
|
|
163
|
+
from user or trusted project extensions load their owning extensions. Runs cannot start other
|
|
164
|
+
runs. A model supplied only by an unloaded extension is unavailable to a run. A worktree starts
|
|
165
|
+
at committed `HEAD`, so it does not include uncommitted or untracked files.
|
|
166
|
+
|
|
167
|
+
See the [reference](docs/reference.md) for definition fields, tool parameters, project trust,
|
|
168
|
+
extension-tool constraints, report delivery, worktrees and branch behavior.
|
|
169
|
+
|
|
170
|
+
## Development
|
|
171
|
+
|
|
172
|
+
From the repository root:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
npm ci
|
|
176
|
+
npm run build
|
|
177
|
+
npm test --workspace=@lune_99/pi-subagent
|
|
178
|
+
npm run typecheck --workspace=@lune_99/pi-subagent
|
|
179
|
+
npm run check
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
The [preview notes](docs/previews.md) describe how the native screenshots were captured.
|
|
183
|
+
|
|
184
|
+
## License
|
|
185
|
+
|
|
186
|
+
MIT
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"method": "Native Ghostty window captured with macOS screencapture",
|
|
3
|
+
"model": "Scripted loopback HTTP endpoint; real Pi sessions, tools, reports and panels",
|
|
4
|
+
"terminal": {
|
|
5
|
+
"ok": true,
|
|
6
|
+
"columns": 131,
|
|
7
|
+
"rows": 45,
|
|
8
|
+
"font": "Menlo",
|
|
9
|
+
"fontSize": 12
|
|
10
|
+
},
|
|
11
|
+
"sources": {
|
|
12
|
+
"pi-lune-extensions-core": {
|
|
13
|
+
"version": "0.2.0",
|
|
14
|
+
"entrySha256": "3a4c791b6958cb5f32ad0b9409944d239045d4a3439c106d6da10ff22cef9435"
|
|
15
|
+
},
|
|
16
|
+
"pi-core-theme": {
|
|
17
|
+
"version": "0.1.0",
|
|
18
|
+
"entrySha256": "30c3353cdf56cc0950b35fcf4eb6eb3d553b5912d203e0bae76c2cb5216aad98"
|
|
19
|
+
},
|
|
20
|
+
"pi-dock": {
|
|
21
|
+
"version": "0.1.0",
|
|
22
|
+
"entrySha256": "30ef1080a2bac3b4133cd237787ab973523d108bd5c7fc55e58a78e865833783"
|
|
23
|
+
},
|
|
24
|
+
"pi-subagent": {
|
|
25
|
+
"version": "0.1.0",
|
|
26
|
+
"entrySha256": "a1ea0cc74181f6e7c102b4848158f66423d051b09225ad34a2201eae81d9d03f"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"artifacts": ["subagent-overview.png", "subagent-inspector.png", "subagent-auto-tiers.png"]
|
|
30
|
+
}
|
package/docs/previews.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Preview notes
|
|
2
|
+
|
|
3
|
+
[Back to the README](../README.md)
|
|
4
|
+
|
|
5
|
+
The README images are native screenshots of Pi 1.3.0 running in Ghostty with Lune Core, Core
|
|
6
|
+
Theme, Dock and Subagent. The coordinator starts two real subagent sessions. The sessions read
|
|
7
|
+
sample files with Pi's tools, record a report and appear in the production Dock and `/agents`
|
|
8
|
+
inspector. The settings image is the production Auto tiers menu.
|
|
9
|
+
|
|
10
|
+
Only the model endpoint is scripted. A temporary HTTP server on the loopback interface returns
|
|
11
|
+
predefined responses without calling a model service. The explorer's final response waits while
|
|
12
|
+
the screenshots are taken, leaving a running agent beside a completed reviewer. These are
|
|
13
|
+
illustrative tasks, not model-quality or timing benchmarks. The tier models shown are local
|
|
14
|
+
preview models, not recommendations; the capture does not exercise automatic classification.
|
|
15
|
+
|
|
16
|
+
The capture uses separate temporary settings, definitions, sessions and a sample Git repository.
|
|
17
|
+
It does not load personal extensions or credentials. PNGs come from macOS `screencapture` of the
|
|
18
|
+
native terminal window. The capture scripts and working logs are local release-preparation
|
|
19
|
+
artifacts under the repository's ignored `.scratch/` directory.
|
|
20
|
+
|
|
21
|
+
`capture.json` records the terminal dimensions, package versions and extension entry hashes for
|
|
22
|
+
`subagent-overview.png`, `subagent-inspector.png` and `subagent-auto-tiers.png`.
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
# Subagent reference
|
|
2
|
+
|
|
3
|
+
[Back to the README](../README.md)
|
|
4
|
+
|
|
5
|
+
## Agent definitions
|
|
6
|
+
|
|
7
|
+
Definitions are Markdown files directly in one of two folders. The package ships no definitions.
|
|
8
|
+
|
|
9
|
+
- **User definitions** are in `~/.pi/agent/lune-subagents/`: the `lune-subagents` folder in Pi's agent directory, which follows `PI_CODING_AGENT_DIR`.
|
|
10
|
+
- **Project definitions** are in `.pi/lune-subagents/` in the directory where you start Pi. They load only when Pi trusts the project.
|
|
11
|
+
|
|
12
|
+
When a project definition and a user definition have the same name, the project definition is used and the user file is reported as not loaded.
|
|
13
|
+
|
|
14
|
+
Pi asks whether to trust a project only when the project has resources that Pi itself guards, such as `.pi/settings.json` or `.pi/extensions/`. A project whose only `.pi` content is `lune-subagents/` counts as trusted without a prompt, the same as its `AGENTS.md`. Read the definitions of a project you did not write before you use them.
|
|
15
|
+
|
|
16
|
+
| Field | Required | Meaning |
|
|
17
|
+
| ------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
18
|
+
| `name` | Yes | Unique name. The main agent uses it to pick the agent. |
|
|
19
|
+
| `description` | Yes | When to use the agent. Shown in the system prompt's agent list. |
|
|
20
|
+
| `tools` | No | Tool names, extension tools included, as a comma-separated string or a list. Default: `defaultTools`. |
|
|
21
|
+
| `model` | No | `provider/id`, or `auto` for the model of the task's tier. Default: the main agent's model. |
|
|
22
|
+
| `thinking` | No | `off`, `minimal`, `low`, `medium`, `high`, `xhigh` or `max`. Default: the main agent's level. Omit with `model: auto`, which routes both model and thinking. |
|
|
23
|
+
| `isolation` | No | `shared` or `worktree`. Default: `shared`. |
|
|
24
|
+
|
|
25
|
+
The body is added to the end of Pi's system prompt; it does not replace it. Definitions load when a session starts, so a new or changed file takes effect after `/new` or `/reload`. Edits in the [settings panel](#settings) are the exception: their model, thinking, tools and isolation apply to the next run at once. A file with invalid frontmatter, an unknown field, a missing field or a name that another file in the same folder uses is reported and not loaded.
|
|
26
|
+
|
|
27
|
+
The main agent sees the loaded agents as a `subagents` section of its system prompt, one `- name: description` line each, in name order. A project definition shows as `- name (project): description`.
|
|
28
|
+
|
|
29
|
+
With Lune Core Theme enabled, the same loaded names also appear in an `[Agents]` section below Pi's startup resource lists. No section is shown when no definitions are loaded.
|
|
30
|
+
|
|
31
|
+
### Create a definition with the built-in skill
|
|
32
|
+
|
|
33
|
+
The package includes `create-lune-subagent`. Pi can select it when you ask to create a reusable
|
|
34
|
+
subagent, or you can invoke it directly:
|
|
35
|
+
|
|
36
|
+
```text
|
|
37
|
+
/skill:create-lune-subagent Create a reusable code-review subagent.
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The skill first asks whether the definition should be global (user-level) or project-level, unless
|
|
41
|
+
you already specified the scope. It asks you to choose the name, description and model, then uses
|
|
42
|
+
the model's capabilities and your task details to recommend thinking, tools, isolation and role
|
|
43
|
+
instructions. Following the main agent's model is an explicit choice, not an assumed default.
|
|
44
|
+
|
|
45
|
+
It locates the definition directory with existing shell and file tools and uses the main agent's
|
|
46
|
+
tool declarations as its authoring reference, without an extra query tool or helper script. A run
|
|
47
|
+
that selects a tool of one of your extensions loads that extension; see
|
|
48
|
+
[Extension tools](#extension-tools).
|
|
49
|
+
|
|
50
|
+
You review the complete definition and destination before it writes the file. The skill does not
|
|
51
|
+
start a run; use `/reload` after saving to make the definition available.
|
|
52
|
+
|
|
53
|
+
### Examples
|
|
54
|
+
|
|
55
|
+
These examples have no `model` field, so they use the main agent's model.
|
|
56
|
+
|
|
57
|
+
`~/.pi/agent/lune-subagents/reviewer.md`:
|
|
58
|
+
|
|
59
|
+
```markdown
|
|
60
|
+
---
|
|
61
|
+
name: reviewer
|
|
62
|
+
description: Reviews a diff in a clean context and reports problems.
|
|
63
|
+
tools: read, grep, find, ls, bash
|
|
64
|
+
thinking: high
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
Review the diff named in the task. Do not change files. Report each problem with its file,
|
|
68
|
+
line and reason, most severe first. Report "done" with an empty list when you find nothing.
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
`~/.pi/agent/lune-subagents/explorer.md`:
|
|
72
|
+
|
|
73
|
+
```markdown
|
|
74
|
+
---
|
|
75
|
+
name: explorer
|
|
76
|
+
description: Finds where something lives in the codebase and explains how it works.
|
|
77
|
+
tools: read, grep, find, ls
|
|
78
|
+
thinking: medium
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
Answer the question in the task from the code. Name the files and symbols you used. Keep the
|
|
82
|
+
summary short; quote only the lines that matter.
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
`~/.pi/agent/lune-subagents/test-writer.md`:
|
|
86
|
+
|
|
87
|
+
```markdown
|
|
88
|
+
---
|
|
89
|
+
name: test-writer
|
|
90
|
+
description: Writes and runs tests for agreed behavior in an isolated worktree.
|
|
91
|
+
tools: read, grep, find, ls, edit, write, bash
|
|
92
|
+
isolation: worktree
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
Write tests for the behavior the task names. Follow the project's existing test style. Run
|
|
96
|
+
the tests and report the commands, the results and the files you changed.
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Starting a run
|
|
100
|
+
|
|
101
|
+
`subagent_start` starts one run per call. It requires `task` and accepts an optional `title`, plus either an agent or the settings of an inline run. A call that names an agent gives only `task` and `title`: the agent runs with the model, thinking, tools and isolation of its definition, and the main agent cannot change them. A call that names an agent and sets `model`, `thinking`, `tools` or `isolation` starts nothing. To change a role's settings, edit its definition.
|
|
102
|
+
|
|
103
|
+
With **Auto mode only** on in [settings](#settings), the schema has no `model` or `thinking` parameters, and every inline run routes both automatically through `model: auto`. An inline call that still sets another model or a thinking level starts nothing. Agent runs keep the model of their definition.
|
|
104
|
+
|
|
105
|
+
For fixed or inherited models, each value comes from the first source that sets it. With `model: auto`, the router owns both model and thinking, and explicit thinking is invalid:
|
|
106
|
+
|
|
107
|
+
| Value | Agent run | Inline run |
|
|
108
|
+
| --------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
|
|
109
|
+
| Model | The definition, the main agent's current model | The call, `auto` with Auto mode only, the main agent's current model |
|
|
110
|
+
| Thinking | The classifier for `auto`; otherwise the definition, then the main agent's level | The classifier for `auto`; otherwise the call, then the main agent's level |
|
|
111
|
+
| Tools | The definition, the `defaultTools` setting | The call, the `defaultTools` setting |
|
|
112
|
+
| Isolation | The definition, `shared` | The call, `shared` |
|
|
113
|
+
|
|
114
|
+
- The `model` parameter accepts the **Allowed models** selection in [settings](#settings), when nonempty, and `auto`. Otherwise, it accepts the models of your scope (`--models` or `enabledModels`), or every available model when no scope is set. The same allowed set checks explicit models in definitions and auto tiers; inheriting the main agent's current model remains allowed even outside that set.
|
|
115
|
+
- The run always gets the `report` tool as well. A selected tool that the run does not have fails the start; MCP tools are waited for until their server connects.
|
|
116
|
+
- A run started from a definition shows with the definition's name. Inline runs are named `run-1`, `run-2` and so on.
|
|
117
|
+
- The optional `title` labels a run in the `/agents` inspector, the Dock and its end-of-turn notice. The inspector and Dock show the title in place of the name.
|
|
118
|
+
- The task is the run's first message, unchanged. The run's system prompt is Pi's own, then the definition body, then a short fixed guide for subagents.
|
|
119
|
+
|
|
120
|
+
### Auto model
|
|
121
|
+
|
|
122
|
+
`model: auto`, in the call or in a definition, lets a Pi classifier rate the task. The run then uses the model that you set for the task's tier, and the thinking level that the task needs among the levels this model supports. Set it up in the [Subagents settings](#settings).
|
|
123
|
+
|
|
124
|
+
The classifier answers three separate questions: how difficult the task is, how much reasoning it needs, and whether a mistake in it could do serious harm. It reads the task, the agent's name, description and instructions, the tool access and the workspace. It does not see model names or prices: you map the tiers to models.
|
|
125
|
+
|
|
126
|
+
| Question | Options | Result |
|
|
127
|
+
| --------- | ---------------------------------------------------------------------------- | ---------------------------- |
|
|
128
|
+
| Tier | light, standard, complex, deep | The model set for that tier |
|
|
129
|
+
| Thinking | Pi's levels `off` to `max` that the run's model supports, as Pi reports them | The run's thinking level |
|
|
130
|
+
| High risk | Yes or no, as a probability | A floor for the model's tier |
|
|
131
|
+
|
|
132
|
+
The tier and high-risk questions always go in the first request. The thinking options depend on the run's model, and the model depends on the tier. When every model that the tier can lead to supports the same levels, the first request also asks the thinking question. Otherwise, a second request asks it after the model is known. A model with only one level gets no thinking question.
|
|
133
|
+
|
|
134
|
+
- **Tier models.** A tier without a model uses the next tier up that has one. When no tier from the rated one up has a model, the run uses the main agent's model, so the main agent's model is the ceiling. With no tier set, every auto run uses the main agent's model with the rated thinking.
|
|
135
|
+
- **Thinking.** Auto always selects a supported thinking level together with the model. Auto calls and definitions must omit `thinking`; specifying it fails before any classifier request. A model with only one supported level uses that level without a thinking question.
|
|
136
|
+
- **High risk.** A task is high risk when the classifier's probability reaches the High-risk threshold (default 0.4). The threshold is below one half because a missed high-risk task usually costs more than a false alarm; adjust it with your own tasks. A high-risk task gets at least the model of the High-risk floor tier (default Deep, which falls back to the main agent's model). The rated tier stays as it is, and a tier above the floor is not lowered. The risk does not change the thinking level. It is a model choice only: tool permissions, approvals and the other checks of a run stay the same.
|
|
137
|
+
- **Unsure answers.** When the classifier's confidence in an answer is below 50%, the run uses the next level up.
|
|
138
|
+
- **Long tasks.** The request must fit the classifier's context window, and the package does not know the classifier's tokenizer. It therefore counts UTF-8 bytes, because a token always has at least one byte. The request gets at most 32 KB, and at most the window less 512 tokens for the classifier's own prompt; Pi's llama.cpp classifier shows the request twice, so it gets half. When the task and the agent's instructions do not fit, the instructions get at most a quarter of the room, and each is cut in the middle: the start and the end stay, with a note of how many characters are left out. When less than 1 KB is left for them, the classifier is not called and the run falls back as when the classifier fails.
|
|
139
|
+
- **No classifier selected:** the run uses the main agent's model and thinking. This is the default.
|
|
140
|
+
|
|
141
|
+
When the classifier fails, the run uses the main agent's model and thinking. This covers an unavailable classifier, a failed request, an invalid answer and a window that is too small. A cancelled start still stops. A tier model that the subagent allowed set no longer permits is a settings error and fails the start; select another model under Auto tiers. For an inline run, the main agent can name a model instead; an agent run takes its model only from its definition. The start values show the choice and any error, for example `Model: anthropic/claude-haiku-5-5 (auto from call: the classifier cls/judge rated the task complex (71%), not high risk (8%); the complex tier's model)` and `Thinking: high (auto: the classifier rated the thinking high (64%))`. The [inspector](#dock-and-agents) shows the rating at the top of the run's log.
|
|
142
|
+
|
|
143
|
+
### Extension tools
|
|
144
|
+
|
|
145
|
+
A run can select a tool that one of your user or project extensions registers in the main session. The run then loads the file of that extension in its own session, with only the tools it selected. The `tools` parameter of `subagent_start` lists these tools with the others; a tool that an extension registers after the session started is missing from the list, but a run can still select it.
|
|
146
|
+
|
|
147
|
+
- The extension runs in the run, not in the main session, and its event handlers run too. An extension that adds to the system prompt or blocks tool calls does the same in the run.
|
|
148
|
+
- Pi reuses a loaded extension module for the sessions in the same working directory. A `shared` run can therefore use the same module as the main session and as other `shared` runs. An extension that keeps session state at module level, and not in the state that its factory creates, shares that state with them.
|
|
149
|
+
- The run has no UI, so a tool that needs your input does not work in a run. A tool that checks for the interactive UI returns an error. A dialog that an extension opens is answered as dismissed and shows as a run diagnostic.
|
|
150
|
+
- Names that the run has on its own stay Pi's. An extension that replaces `bash` in the main session does not replace it in the run, and an extension loaded for one tool adds none of its other tools.
|
|
151
|
+
- A tool that works together with a replaced built-in tool is therefore incomplete in a run. For example, Lune Shell Inspector's `background_shell` shows background jobs, but only its `bash` starts them, so a run has no jobs to show.
|
|
152
|
+
- The subagent tools are never available, so runs cannot start runs. Tools of project extensions are available only while Pi trusts the project.
|
|
153
|
+
- An extension that fails to load, or that does not register the selected tool in the run's working directory, fails the start.
|
|
154
|
+
- A run that continues after you resume the session loads the extensions of its tools again, as the main session has them at that time. When the main session no longer has one of its tools, the run cannot continue.
|
|
155
|
+
|
|
156
|
+
### Parallel starts
|
|
157
|
+
|
|
158
|
+
Issue a separate `subagent_start` call for each independent task. These calls can run in parallel, each with its own run ID, progress and result. A failed start does not stop another call or undo a run that started.
|
|
159
|
+
|
|
160
|
+
### Workspace isolation
|
|
161
|
+
|
|
162
|
+
- **`shared`** uses the main agent's working directory. The run sees uncommitted changes and shares files with the main agent.
|
|
163
|
+
- **`worktree`** creates a Git worktree for the run, detached at the current `HEAD` commit, in `~/.pi/agent/lune-subagents/worktrees/`. It does not contain uncommitted, untracked or ignored files. A run in a repository subdirectory works in the same subdirectory of the worktree.
|
|
164
|
+
|
|
165
|
+
The package never merges, commits or deletes a worktree. Its changes stay there until the main agent or you review and integrate them. Remove a worktree with `git worktree remove` once you no longer need the run.
|
|
166
|
+
|
|
167
|
+
## Tools
|
|
168
|
+
|
|
169
|
+
Every tool that takes a run addresses it by the ID that `subagent_start` returned: eight hexadecimal characters, such as `8416992c`. A run's title and name identify it only in the inspector, the Dock and notices; a tool given either one fails, and the error lists the branch's run IDs.
|
|
170
|
+
|
|
171
|
+
| Tool | Parameters | Effect |
|
|
172
|
+
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
|
|
173
|
+
| `subagent_start` | required `task`; optional `agent`, `title`; for inline runs `model`, `thinking` (both absent with Auto mode only; `thinking` is invalid with `model: auto`), `tools`, `isolation` | Creates one run and returns its ID, workspace and start values. |
|
|
174
|
+
| `subagent_send` | `runId`, `message` | Steers a running run, or starts a new turn in an idle, failed or interrupted run. |
|
|
175
|
+
| `subagent_status` | optional `runId` | Reads one run, or every run on the current branch, with token usage and the last report. |
|
|
176
|
+
| `subagent_stop` | `runId` | Stops the current turn. The run becomes `interrupted`; its session and worktree stay. |
|
|
177
|
+
|
|
178
|
+
## Reports and states
|
|
179
|
+
|
|
180
|
+
A run ends each turn with the `report` tool:
|
|
181
|
+
|
|
182
|
+
| Status | Meaning |
|
|
183
|
+
| ------------- | -------------------------------------------------------------------------------------- |
|
|
184
|
+
| `done` | The task is complete. |
|
|
185
|
+
| `blocked` | The run cannot finish, for example because it declined the task or finished only part. |
|
|
186
|
+
| `needs_input` | The run needs something before it can continue. Its question goes to the main agent. |
|
|
187
|
+
|
|
188
|
+
A turn that ends normally without a report shows as `done` in the Dock, notifications and `/agents`. A turn whose last reply hit the token limit or left no text shows no task status, only its state, because its work may not be finished. The main agent still gets the run's last message, marked as having no task status. A run never asks you directly: the main agent answers a question when it can and asks you when only you can.
|
|
189
|
+
|
|
190
|
+
If that last message exceeds 20,000 characters, the notice and `subagent_status` for that run keep the first 20,000 and append the omitted count and the absolute path to a Markdown copy of the full reply. The main agent can read that file to recover the rest. Copies live in `pi-lune-subagent-responses/` under the system temporary directory, with a separate filename for each run and reply content; they remain available until the system cleans them up. If writing a copy fails, the truncation hint says the file is unavailable and the run records an error diagnostic.
|
|
191
|
+
|
|
192
|
+
A message that reaches a run while it reports, for example a steer message from the main agent or from you, continues the same turn, and the run reports again. The last report is the turn's report. The main agent also gets the earlier reports of the turn in the same message, and `subagent_status` shows them.
|
|
193
|
+
|
|
194
|
+
Each report message is confirmed in the main session. A message that is still missing after a run of the main agent ended is sent again. When you interrupt the main agent in Pi's interactive mode, Pi clears the queued messages, so a report message that waited in the queue goes with your next message instead, and a notification says so. After two retries without success, an error notification says that `subagent_status` still returns the results.
|
|
195
|
+
|
|
196
|
+
The run state describes the session, not the task: `running`, `idle`, `failed` (the last turn ended with an error after Pi's retries) or `interrupted` (stopped, or the main session shut down). An `idle` run can be `blocked`.
|
|
197
|
+
|
|
198
|
+
## Dock and `/agents`
|
|
199
|
+
|
|
200
|
+
The Dock counts the runs of the current branch by status, for example `◐ Agents · 2 running · 1 needs input`. The statuses are `running`, `needs input`, `blocked`, `failed`, `interrupted`, `done` and `idle`. A run of another branch counts too while it runs, for example after you kept it running when you left its branch, and while its report waits for that branch. The line says how many such runs there are. The full Dock level also names the run that changed last, for example `latest: reviewer done`. Without runs every level shows only `○ Agents`, as Shell and Ask do.
|
|
201
|
+
|
|
202
|
+
The Dock never cuts its line. When the cell is too narrow, it leaves out complete parts, the least urgent first, so the `failed`, `blocked` and `needs input` counts stay longest. Then only `◐ Agents` shows, then only the marker.
|
|
203
|
+
|
|
204
|
+
The marker shows the most urgent state: a red `✕` for a failed or blocked turn, `?` when a run needs input, `◐` while a run works, a gray `●` when runs are failed or blocked, a green `●` for other runs, and `○` without runs. The red `✕` shows for 10 seconds after the turn ends, or until you open the run in the inspector; a later failed turn shows it again. Without the Lune Dock host, the same line shows as a row below the editor, followed by `/agents to open`.
|
|
205
|
+
|
|
206
|
+
Run `/agents` to open the inspector. The current branch's runs are on the left, followed by dimmed runs of other branches. Each row shows the run's title and one status at the right, as the Dock counts it: the report of an idle run (`done`, `needs_input` or `blocked`), and otherwise its state. A narrow list cuts only the title. An accent `›` and a bold title mark the selected run. The inspector reopens on the run that was selected when it closed; a new session starts on the first run. The selected run's live transcript is on the right, below the run's heading. The heading shows the run's name, ID, state and report, and `read-only` for a run that cannot be continued. Below them, it shows the model and thinking level that the run's requests use, for example `Model anthropic/claude-opus-5-5 · high`. For a live run, the model and level come from its session, where Pi limits the level to what the model supports. Otherwise, they are the run's start values. A narrow pane leaves out heading parts or wraps the model; it never cuts them.
|
|
207
|
+
|
|
208
|
+
For a run with `model: auto`, the model row ends with the tier and its share, for example `Model anthropic/claude-haiku-5-5 · medium · auto complex 71%`. When the classifier was unsure and the run used a higher tier, the row shows that tier without a share. A task rated high risk adds `high risk` to the row. When the classifier failed, the row ends with `auto failed`, and the top of the log shows the error. The top of the run's log shows the classifier's answer: the share of each tier, the chosen tier and its model, the high-risk probability with its threshold and any floor it set, and the rated thinking level. This block scrolls with the log.
|
|
209
|
+
|
|
210
|
+
| Action | Keys |
|
|
211
|
+
| --------------------------------- | ---------------------------------- |
|
|
212
|
+
| Select run | `↑` / `↓` or `k` / `j` |
|
|
213
|
+
| Scroll transcript | `Shift+↑` / `Shift+↓` or `K` / `J` |
|
|
214
|
+
| Jump to oldest / follow newest | `Home` / `End` |
|
|
215
|
+
| Write to the run | `Enter`, type, `Enter` to send |
|
|
216
|
+
| Show details | `d` |
|
|
217
|
+
| Stop the run's turn | `x` |
|
|
218
|
+
| Copy a report from another branch | `c` |
|
|
219
|
+
| Close | `Esc` |
|
|
220
|
+
|
|
221
|
+
A message you write reaches the run marked as coming from you. A running run gets it as a steer message; otherwise it starts a new turn. The main agent does not get your message when you send it. It gets your messages, in order, with that turn's report, so it can read the report as an answer to you. A message longer than 20,000 characters is cut in the middle there; the run itself gets all of it. Until the turn ends, `subagent_status` shows the messages of the turn in progress.
|
|
222
|
+
|
|
223
|
+
The details view shows the start values and where each came from, the workspace, the token usage and the run's diagnostics. A run's tokens are not added to the main session's totals.
|
|
224
|
+
|
|
225
|
+
The transcript is a compact log. Each tool call takes one row with its status and time, and an edit also shows the lines it added and removed, for example `● edit src/a.ts · +12 −3 · 0.2s`. A failed call adds the first lines of its error, and a running call the last lines of its output. A finished thought takes one row, for example `Thinking · 42 lines`. Assistant text, your messages, the main agent's messages and reports show in full. A report call shows `writing` while its arguments stream and until the run records it, and `not sent` when it was stopped first. Until then its status and summary are dimmed. A recorded report still reaches the main agent only when the turn ends.
|
|
226
|
+
|
|
227
|
+
With the Lune theme on, the report messages in the main transcript render as its activity cards. Without it, the package renders them itself.
|
|
228
|
+
|
|
229
|
+
## Settings
|
|
230
|
+
|
|
231
|
+
Run `/lune-core-settings subagents` to open the Subagents section of Lune settings. It needs Lune Core's extension; settings are saved per scope, global or project, like other Lune settings.
|
|
232
|
+
|
|
233
|
+
| Setting | Meaning |
|
|
234
|
+
| ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
235
|
+
| Allowed models | A multi-select list from Pi's scoped models. A nonempty selection replaces the session's default allowed list for new runs; an empty list follows Pi's scope. |
|
|
236
|
+
| Classifier model | The Pi classifier for `model: auto`. None: auto runs use the main agent's model and thinking. |
|
|
237
|
+
| Auto mode only | Off by default. On: `subagent_start` has no `model` or `thinking` parameters, and inline runs route both automatically. Custom agents keep their definition's model. |
|
|
238
|
+
| Auto tiers | A menu with one model per task tier, Light, Standard, Complex and Deep, from the subagent allowed set. A tier without a model uses the next tier up, then the main agent's model. The menu also sets the High-risk floor (Off, Standard, Complex or Deep) and the High-risk threshold. |
|
|
239
|
+
| Custom agents | A menu of agent definitions: your user agents at global scope, the project's at project scope. |
|
|
240
|
+
|
|
241
|
+
In **Allowed models**, Space toggles a model and Enter saves. Changes update the `subagent_start`
|
|
242
|
+
model options for new runs immediately. A saved selection replaces the
|
|
243
|
+
session's list rather than intersecting it, so an available saved model remains allowed when a
|
|
244
|
+
later session has a different scope. Saved models outside the current scope or no longer available
|
|
245
|
+
stay listed for removal; unavailable models cannot start new runs, and a selection containing only
|
|
246
|
+
unavailable models does not fall back to Pi's list. Clear the selection to restore Pi's default.
|
|
247
|
+
The main agent's inherited model and the model of an existing or resumed run are unchanged.
|
|
248
|
+
|
|
249
|
+
In **Custom agents**, Enter opens an agent, and its page edits the name, description, model, thinking level, tools and isolation. Each change is written to the definition file at once; comments and the body stay. Ctrl+R removes an optional field, so the run's default applies again. Renaming an agent renames a file named after it. Model, thinking, tools and isolation apply to the next run; the name and description reach the main agent after `/reload`, because its agent list stays fixed for the session. MCP tools are not listed in the tools menu, but selected MCP tools stay in the file. A file that does not load is listed with its problem and must be fixed by hand.
|
|
250
|
+
|
|
251
|
+
The **Thinking** selector offers only levels supported by a fixed or inherited model. With
|
|
252
|
+
`model: auto`, only the automatic default is offered: the classifier chooses a supported level for
|
|
253
|
+
each task, or the run uses the main model and thinking when no classifier is selected. Selecting
|
|
254
|
+
**auto** in the Model field removes any saved `thinking` override in the same write. Definitions
|
|
255
|
+
edited by hand must also omit `thinking` with `model: auto`; otherwise they are reported as invalid.
|
|
256
|
+
For fixed or inherited models, saved thinking values remain intact when changing models; an
|
|
257
|
+
unsupported saved level stays visible as a disabled entry until replaced or reset.
|
|
258
|
+
|
|
259
|
+
## Sessions and branches
|
|
260
|
+
|
|
261
|
+
- **Shutdown.** When the main session ends, for any reason, running runs stop and become `interrupted`. `subagent_send` continues them later from their session file, in the same working directory. A missing worktree fails the continuation.
|
|
262
|
+
- **Branches.** A run belongs to the branch that started it. When you leave a branch with running runs, Pi asks once whether to keep or stop them. A report from a run on another branch waits until you return to that branch.
|
|
263
|
+
- **Fork and clone.** Runs of the original session show read-only after `/fork` or `/clone`. Start a new run to continue that work.
|
|
264
|
+
- **Storage.** Run sessions are in `~/.pi/agent/lune-subagents/sessions/<session ID>/`, outside Pi's sessions folder, so `/resume` does not list them.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|