@lune_99/pi-subagent 0.0.0-stage → 0.1.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 +24 -0
- package/LICENSE +21 -0
- package/README.md +169 -2
- package/docs/capture.json +30 -0
- package/docs/previews.md +22 -0
- package/docs/reference.md +240 -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 +186 -0
- package/src/auto-model.ts +592 -0
- package/src/catalog.ts +111 -0
- package/src/definition-file.ts +112 -0
- package/src/definitions.ts +324 -0
- package/src/dock/dock-alert.ts +78 -0
- package/src/dock/dock-contribution.ts +318 -0
- package/src/extension-tools.ts +46 -0
- package/src/index.ts +168 -0
- package/src/inspector/details.ts +113 -0
- package/src/inspector/inspector.ts +653 -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 +54 -0
- package/src/notify/notification-box.ts +381 -0
- package/src/notify/notifier.ts +569 -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 +26 -0
- package/src/run/report-tool.ts +90 -0
- package/src/run/run-file.ts +193 -0
- package/src/run/run-manager.ts +838 -0
- package/src/run/run-session.ts +307 -0
- package/src/run/run.ts +681 -0
- package/src/run/session-start.ts +283 -0
- package/src/run/types.ts +167 -0
- package/src/run/worktree.ts +138 -0
- package/src/schema.ts +9 -0
- package/src/settings/agents-menu.ts +363 -0
- package/src/settings/panel.ts +179 -0
- package/src/settings/schema.ts +71 -0
- package/src/tools/format.ts +375 -0
- package/src/tools/subagent-tools.ts +467 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: create-lune-subagent
|
|
3
|
+
description: Create a reusable Lune Subagent definition with a user-approved scope, name, description and model, then recommend thinking, tools and isolation for its tasks. Use when the user asks to create a reusable Lune subagent, not merely to start a one-off run.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Create a Lune subagent
|
|
7
|
+
|
|
8
|
+
Create a reusable Markdown definition, not a running session. Follow the steps in order. Do not
|
|
9
|
+
write a definition until the user approves the complete draft. Use an available question tool for
|
|
10
|
+
user decisions; otherwise ask in the conversation and wait for an answer.
|
|
11
|
+
|
|
12
|
+
## 1. Ask for the scope first
|
|
13
|
+
|
|
14
|
+
If the user has not explicitly specified the scope, begin by asking:
|
|
15
|
+
|
|
16
|
+
> Should this subagent be global (user-level), or only available to the current project?
|
|
17
|
+
|
|
18
|
+
Wait for the answer before collecting the other fields. Never infer the scope from the working
|
|
19
|
+
directory. If the user already specified it, keep that choice without asking again.
|
|
20
|
+
|
|
21
|
+
- **Global (user-level):** `<agentDir>/lune-subagents/<name>.md`. Resolve Pi's actual agent directory,
|
|
22
|
+
respecting `PI_CODING_AGENT_DIR`; its default is `~/.pi/agent`.
|
|
23
|
+
- **Project:** `<cwd>/.pi/lune-subagents/<name>.md`, where `cwd` is the current Pi session's working
|
|
24
|
+
directory. Do not move the file to the Git root or search ancestor directories instead. Project
|
|
25
|
+
definitions load only when Pi trusts the project; do not change trust settings on the user's behalf.
|
|
26
|
+
|
|
27
|
+
Locate these paths with the shell and file tools already available to you:
|
|
28
|
+
|
|
29
|
+
- Read the session's working directory from the host context. If needed, verify it with the shell's
|
|
30
|
+
working-directory query without changing directories. Do not use the skill's own directory as `cwd`.
|
|
31
|
+
- For global scope, inspect `PI_CODING_AGENT_DIR` in the inherited environment. If set, use that path
|
|
32
|
+
and expand a leading `~` against the user's home directory. Otherwise inspect `~/.pi/agent`.
|
|
33
|
+
- If the local Pi setup is unclear, inspect its installed documentation or the path-resolution code
|
|
34
|
+
around `getAgentDir` using a targeted search. Do not scan the whole filesystem or choose the first
|
|
35
|
+
directory named `lune-subagents`. If the effective path still cannot be established, ask the user.
|
|
36
|
+
|
|
37
|
+
A missing `lune-subagents` directory is normal for a first definition; create it only after draft
|
|
38
|
+
approval. Do not switch to another scope or directory merely because it already exists. Only
|
|
39
|
+
Markdown files directly in the selected directory are definitions, not files in nested folders
|
|
40
|
+
such as `sessions/` or `worktrees/`. No helper script, new runtime, or extra Pi process is needed.
|
|
41
|
+
|
|
42
|
+
## 2. Confirm the identity, model and task
|
|
43
|
+
|
|
44
|
+
Ask for any missing decisions below. Accept values the user already supplied; do not ask them to
|
|
45
|
+
repeat the same information.
|
|
46
|
+
|
|
47
|
+
- **`name`:** Ask what the user wants to call the subagent. You may offer candidates, but do not
|
|
48
|
+
choose one without approval.
|
|
49
|
+
- **`description`:** Ask what it should do and when the main agent should select it. You may draft
|
|
50
|
+
or refine a concise routing description, but the user must approve the wording.
|
|
51
|
+
- **Model:** Ask the user to choose an exact `provider/id`, **Auto**, or explicitly choose **Follow
|
|
52
|
+
the main agent's model**. Use the current `subagent_start` tool schema's model choices rather than
|
|
53
|
+
a hardcoded list. A fixed model must be available within the current model scope. Auto writes
|
|
54
|
+
`model: auto`: the classifier in the Subagents settings rates each task, and the run uses the
|
|
55
|
+
model set for the task's tier in those settings. A tier without a model uses the next tier up,
|
|
56
|
+
then the main agent's model; without a selected classifier the run uses the main agent's model.
|
|
57
|
+
Following the main agent means omitting
|
|
58
|
+
`model`; explain that behavior instead of silently omitting the field.
|
|
59
|
+
|
|
60
|
+
Runs load no extensions for models. A model supplied only by an extension, including the
|
|
61
|
+
llama.cpp built-in, is unavailable to a run even if the parent lists it. If the requested model is
|
|
62
|
+
unavailable, explain the problem and ask for a supported choice or the necessary configuration;
|
|
63
|
+
never substitute another model silently. Do not read or print credentials to check availability.
|
|
64
|
+
|
|
65
|
+
Clarify only the task details that affect the design: expected inputs and outputs, responsibilities,
|
|
66
|
+
prohibited actions, whether it edits files or executes commands, external services, and whether it
|
|
67
|
+
needs the current uncommitted files. Reuse details already given. Do not ask the user to write the
|
|
68
|
+
system prompt or select every remaining field themselves.
|
|
69
|
+
|
|
70
|
+
## 3. Analyze and recommend the remaining configuration
|
|
71
|
+
|
|
72
|
+
Base recommendations on both the selected model and the task, not a fixed role preset. For every
|
|
73
|
+
field, show the proposed value or omission, why it fits, and the important tradeoff. Respect values
|
|
74
|
+
already requested by the user; explain conflicts rather than changing them silently.
|
|
75
|
+
|
|
76
|
+
### Thinking
|
|
77
|
+
|
|
78
|
+
Check the selected model's current Pi metadata and supported thinking levels. Use information
|
|
79
|
+
already exposed by the session, or inspect the relevant local model configuration and Pi support
|
|
80
|
+
code on demand; do not install a runtime or start another Pi session to obtain it. The definition
|
|
81
|
+
format accepts `off`, `minimal`, `low`, `medium`, `high`, `xhigh` and `max`, but an individual model does not
|
|
82
|
+
necessarily support all of them. Do not infer support from the model name or rely on Pi clamping an
|
|
83
|
+
unsupported recommendation.
|
|
84
|
+
|
|
85
|
+
Recommend a supported level based on the reasoning required and the latency or cost tradeoff. Do
|
|
86
|
+
not always recommend the highest level. If the user chose to follow the main model or Auto, analyze
|
|
87
|
+
the current model or the auto tier models, and explain that changing models can change which levels
|
|
88
|
+
are suitable. For Auto, explain that omitting `thinking` lets the classifier set the level for each
|
|
89
|
+
task, and that a set level replaces the classifier's choice. If capability
|
|
90
|
+
information cannot be verified, say so and resolve that uncertainty with the user before finalizing
|
|
91
|
+
the recommendation. Do not change the parent's model or thinking level merely to inspect it.
|
|
92
|
+
|
|
93
|
+
### Tools
|
|
94
|
+
|
|
95
|
+
Use the main agent's currently available tool declarations as the authoring catalog. Read the
|
|
96
|
+
names, descriptions and parameters already exposed to you. If more detail is needed, use existing
|
|
97
|
+
tool discovery, such as Codemode's `describeTool` when available. Do not add a dedicated query tool
|
|
98
|
+
or create a child session to inspect its catalog.
|
|
99
|
+
|
|
100
|
+
Recommend the smallest sufficient set for the work: reading and searching for exploration,
|
|
101
|
+
editing for changes, and a shell only when commands are needed. A shell can modify files even when
|
|
102
|
+
`edit` and `write` are absent; tool selection is not a security boundary.
|
|
103
|
+
|
|
104
|
+
- Use exact registered tool names, not display labels or code aliases. `tools` accepts a YAML list
|
|
105
|
+
or a comma-separated string. `+name` and `-name` are not supported.
|
|
106
|
+
- Select MCP tools by their actual names and descriptions from the main agent's tool declarations
|
|
107
|
+
or existing discovery results. Do not invent names from a placeholder or assume the same server
|
|
108
|
+
configuration is present in a different working directory.
|
|
109
|
+
- `report` is always added by the package. Do not list it as an optional task tool or claim that it
|
|
110
|
+
can be disabled.
|
|
111
|
+
- Omitting `tools` inherits Pi's `defaultTools`. `tools: []` deliberately selects no task tools;
|
|
112
|
+
it still receives `report`. Explain the distinction if recommending either option.
|
|
113
|
+
|
|
114
|
+
The main agent's catalog is the reference for authoring, not a guarantee of child availability.
|
|
115
|
+
A run gets Pi native tools, the codemode, tool-search and MCP built-ins, and the tools of the user's
|
|
116
|
+
extensions: for each selected extension tool, the run loads that extension with only the selected
|
|
117
|
+
tools. The subagent tools are never available, and an extension tool that needs the user interface
|
|
118
|
+
does not work in a run, which has none. Disclose this if a recommendation depends on such a tool. Do
|
|
119
|
+
not silently remove or substitute a tool the user chose.
|
|
120
|
+
|
|
121
|
+
### Isolation
|
|
122
|
+
|
|
123
|
+
Keep definition scope and workspace isolation separate: a project definition can use either mode.
|
|
124
|
+
|
|
125
|
+
- Recommend **`shared`** when the task must inspect the current uncommitted changes or intentionally
|
|
126
|
+
work in the main agent's working directory. Explain that files are shared with the parent and
|
|
127
|
+
other shared runs.
|
|
128
|
+
- Recommend **`worktree`** for independent parallel changes that must not touch the main checkout,
|
|
129
|
+
provided the current directory is in a usable Git repository. The run starts at the current
|
|
130
|
+
`HEAD`, without staged, unstaged, untracked or ignored files. Do not recommend it for reviewing
|
|
131
|
+
uncommitted changes. It is not a sandbox and does not isolate external services.
|
|
132
|
+
|
|
133
|
+
A worktree does not automatically install dependencies or copy local configuration. The package
|
|
134
|
+
never automatically merges, commits or deletes it. Do not create a worktree or install dependencies
|
|
135
|
+
just to create this definition.
|
|
136
|
+
|
|
137
|
+
### Definition body
|
|
138
|
+
|
|
139
|
+
Write durable role instructions covering its goal, boundaries, necessary workflow, evidence or
|
|
140
|
+
verification requirements, and expected deliverable. Runs start with a fresh conversation, so do not
|
|
141
|
+
refer to the parent's earlier discussion or assume it will be inherited. Leave task-specific inputs
|
|
142
|
+
for the start call unless the user explicitly wants them fixed in the role.
|
|
143
|
+
|
|
144
|
+
The body is appended to Pi's system prompt. The package then adds its own guide for reporting and
|
|
145
|
+
questions. Do not replace that protocol, duplicate its full instructions, instruct the run to ask
|
|
146
|
+
the user directly, or give it subagent-management tools.
|
|
147
|
+
|
|
148
|
+
## 4. Present the draft and obtain approval
|
|
149
|
+
|
|
150
|
+
Inspect existing definitions in both scopes before presenting the destination. Names must be unique
|
|
151
|
+
within a scope; two files with the same name in one folder are both rejected. A trusted project's
|
|
152
|
+
definition replaces a user definition of the same name. Point out any cross-scope shadowing and
|
|
153
|
+
obtain approval for that effect. An existing file or same-scope name requires an explicit decision
|
|
154
|
+
to update it or use a different name; do not overwrite it as part of creating a new definition.
|
|
155
|
+
|
|
156
|
+
Check the draft against the definition format:
|
|
157
|
+
|
|
158
|
+
- The YAML mapping has only `name`, `description`, `model`, `thinking`, `tools` and `isolation`.
|
|
159
|
+
Do not add fields such as `scope`, `skills`, `allowed-tools`, `permissionMode` or `systemPrompt`.
|
|
160
|
+
- `name` and `description` are non-empty strings. A name starts with a letter or digit, contains
|
|
161
|
+
only letters, digits, `.`, `_` or `-`, and is at most 64 characters. `run-<digits>` is reserved.
|
|
162
|
+
Use the approved name exactly; do not silently normalize or rename it.
|
|
163
|
+
- A fixed `model` is the approved `provider/id`, or `auto`. Quote YAML strings when necessary.
|
|
164
|
+
- Any `thinking` value is supported by the chosen model, tool names are exact, and `isolation` is
|
|
165
|
+
`shared` or `worktree`.
|
|
166
|
+
|
|
167
|
+
Explain any omitted optional fields: `model` follows the main model, `thinking` follows the main
|
|
168
|
+
thinking level subject to the selected model's support, `tools` inherits `defaultTools`, and
|
|
169
|
+
`isolation` defaults to `shared`. Start-call overrides take precedence over definition values.
|
|
170
|
+
|
|
171
|
+
Show the chosen scope, exact destination path, recommendation summary, and complete Markdown file
|
|
172
|
+
including its frontmatter and body. Ask the user to approve this draft or request changes. A request
|
|
173
|
+
to create a subagent is not approval of configuration the user has not seen. If a later choice
|
|
174
|
+
changes the recommendations, revise the draft and obtain approval before writing.
|
|
175
|
+
|
|
176
|
+
## 5. Save only the approved definition
|
|
177
|
+
|
|
178
|
+
After approval, recheck the destination and names for new conflicts, create the selected directory
|
|
179
|
+
if necessary, and write only the approved file. Do not change Pi settings, install extra packages,
|
|
180
|
+
copy the skill into a user directory, or start a run.
|
|
181
|
+
|
|
182
|
+
Report the saved path and summarize the approved role and configuration. Tell the user to run
|
|
183
|
+
`/reload` (or start a new session with `/new`) before selecting the new definition: the roster and
|
|
184
|
+
`agent` tool choices were built when the session started. Do not claim the definition is already
|
|
185
|
+
loaded or call `subagent_start` with its name before that reload. Include a concise usage example
|
|
186
|
+
with the approved agent name and a self-contained task, but do not execute it unless requested.
|