@kushalkhemka/opensec-pi-subagents 0.19.10 → 0.20.1
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 +23 -0
- package/LICENSE +196 -21
- package/NOTICE +32 -0
- package/README.md +73 -3
- package/dist/agent-manager.d.ts +197 -33
- package/dist/agent-manager.js +817 -195
- package/dist/agent-runner.d.ts +66 -12
- package/dist/agent-runner.js +182 -120
- package/dist/custom-agents.d.ts +3 -1
- package/dist/custom-agents.js +19 -4
- package/dist/default-agents.js +21 -15
- package/dist/env.js +24 -1
- package/dist/exec-tree.d.ts +40 -0
- package/dist/exec-tree.js +150 -0
- package/dist/index.js +462 -169
- package/dist/mention-clone.d.ts +5 -0
- package/dist/mention-clone.js +27 -1
- package/dist/nested-tools.d.ts +21 -1
- package/dist/nested-tools.js +49 -28
- package/dist/output-file.js +12 -8
- package/dist/project-trust.d.ts +41 -0
- package/dist/project-trust.js +76 -0
- package/dist/prompts.js +1 -1
- package/dist/schedule-store.d.ts +24 -2
- package/dist/schedule-store.js +98 -38
- package/dist/schedule.d.ts +19 -2
- package/dist/schedule.js +90 -38
- package/dist/session-file.d.ts +10 -0
- package/dist/session-file.js +25 -0
- package/dist/settings.d.ts +15 -10
- package/dist/settings.js +9 -5
- package/dist/skill-loader.d.ts +7 -1
- package/dist/skill-loader.js +17 -6
- package/dist/status-note.d.ts +10 -5
- package/dist/status-note.js +12 -5
- package/dist/types.d.ts +69 -12
- package/dist/ui/agent-widget.d.ts +46 -4
- package/dist/ui/agent-widget.js +175 -108
- package/dist/ui/conversation-viewer.d.ts +45 -8
- package/dist/ui/conversation-viewer.js +206 -88
- package/dist/ui/fleet-list.d.ts +14 -2
- package/dist/ui/fleet-list.js +38 -16
- package/dist/ui/refresh-ticker.d.ts +25 -0
- package/dist/ui/refresh-ticker.js +69 -0
- package/dist/ui/schedule-menu.js +8 -1
- package/dist/usage.d.ts +18 -0
- package/dist/usage.js +49 -0
- package/dist/workflow/host.js +79 -15
- package/dist/workflow/progress.d.ts +4 -0
- package/dist/workflow/runtime.d.ts +8 -0
- package/dist/workflow/runtime.js +2 -0
- package/dist/workflow/saved.d.ts +15 -6
- package/dist/workflow/saved.js +41 -18
- package/dist/workflow/task.d.ts +11 -0
- package/dist/workflow/task.js +34 -0
- package/dist/worktree.d.ts +73 -5
- package/dist/worktree.js +444 -28
- package/docs/workflows.md +10 -3
- package/examples/workflows/gated-fix.js +3 -2
- package/package.json +5 -5
- package/src/agent-manager.ts +858 -179
- package/src/agent-runner.ts +217 -130
- package/src/custom-agents.ts +24 -4
- package/src/default-agents.ts +21 -15
- package/src/env.ts +24 -1
- package/src/exec-tree.ts +159 -0
- package/src/index.ts +485 -203
- package/src/mention-clone.ts +28 -1
- package/src/nested-tools.ts +73 -32
- package/src/output-file.ts +10 -8
- package/src/project-trust.ts +80 -0
- package/src/prompts.ts +2 -1
- package/src/schedule-store.ts +101 -38
- package/src/schedule.ts +86 -35
- package/src/session-file.ts +24 -0
- package/src/settings.ts +17 -11
- package/src/skill-loader.ts +17 -6
- package/src/status-note.ts +13 -5
- package/src/types.ts +65 -9
- package/src/ui/agent-widget.ts +165 -102
- package/src/ui/conversation-viewer.ts +211 -83
- package/src/ui/fleet-list.ts +33 -8
- package/src/ui/refresh-ticker.ts +69 -0
- package/src/ui/schedule-menu.ts +7 -1
- package/src/usage.ts +55 -0
- package/src/workflow/host.ts +85 -15
- package/src/workflow/progress.ts +4 -0
- package/src/workflow/runtime.ts +10 -0
- package/src/workflow/saved.ts +44 -16
- package/src/workflow/task.ts +32 -0
- package/src/worktree.ts +460 -30
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.20.1] - 2026-10-16
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- **Resume.** A finished, stopped or failed agent stays resumable by the model as long as its session file exists, not 10 minutes: the Agent tool, `@handle`, nested and workflow `agent({resume})` reopen it from the file under the same id, with its own model, thinking level, working directory, worktree and `isolated` setting. Agents are rebuilt after a restart, `/resume`, `/fork` or `/reload`. A worktree agent resumes in its worktree, recreated from its branch. `max_turns`, grace turns and the tool watchdog apply to resumed runs. Foreground results give the model the agent id. A resume waits for a stopped run to finish.
|
|
15
|
+
- **Stopping.** An agent whose tool ignores the abort signal is still stopped: its slot is freed and queued agents start, a foreground call returns, and the watchdog gives up on it instead of waiting forever. Agents stopped while queued or while their worktree is made complete like any other stop.
|
|
16
|
+
- **Crashes.** An `@mention` racing `/new`, `/resume` or `/reload`, an error in a completion handler, and scheduler fires can no longer end Pi's process; the schedule lock no longer blocks Pi.
|
|
17
|
+
- **Project trust.** Subagents follow Pi's decision about a project folder: in an untrusted folder they load none of its extensions or settings, and the extension ignores its agents, skills, workflows and `subagents.json`. A project agent that replaces a built-in is shown.
|
|
18
|
+
- **Explore and Plan** are read-only by their tools (`read`, `grep`, `find`, `ls`), not only by their prompt.
|
|
19
|
+
- **Worktrees.** Cleanup no longer deletes ignored output, nested repositories or stashes while reporting "no changes"; worktrees left by a crash are committed to a `-recovered` branch; workflows report every child's branch. Gate commands and git calls end their whole process tree on a timeout.
|
|
20
|
+
- **Usage.** Workflow resumes are not counted twice; background, workflow and nested spend reaches the parent.
|
|
21
|
+
|
|
22
|
+
### Performance
|
|
23
|
+
|
|
24
|
+
- The widget and fleet list share one refresh timer, which stops while nothing runs; the transcript viewer builds incrementally (500 messages: 85 ms to 0.6 ms a frame without a JIT); the widget formats only the rows it shows; foreground progress is sent once a frame, not per token; per-tool-call scope checks and git environment checks are cached; finished agents' sessions are released 60 s after they settle; transcript writes are batched.
|
|
25
|
+
- Tests clean up their temporary folders.
|
|
26
|
+
|
|
27
|
+
## [0.19.11] - 2026-10-07
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
|
|
31
|
+
- **The main agent's commands had no time limit either.** Pi's `bash` has no default timeout, so an unbounded `grep -r … /` or a server started in the foreground held the main agent's turn until someone noticed. A main-agent `bash` call that sets no timeout now gets `toolTimeoutSeconds` (default 1200 s, `0` = off) and is killed at it, with the timeout reported to the model. A timeout the main agent supplies, even a longer one, is kept; subagents stay capped at the limit.
|
|
32
|
+
|
|
10
33
|
## [0.19.10] - 2026-10-07
|
|
11
34
|
|
|
12
35
|
### Fixed
|
package/LICENSE
CHANGED
|
@@ -1,27 +1,202 @@
|
|
|
1
|
-
Copyright (c) 2026 OpenSec. All rights reserved.
|
|
2
|
-
This software is proprietary. No permission is granted to redistribute it.
|
|
3
1
|
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
1. Definitions.
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
in the Software without restriction, including without limitation the rights
|
|
14
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
-
furnished to do so, subject to the following conditions:
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
17
12
|
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
20
15
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
OpenSec Subagents for Pi (opensec-pi-subagents)
|
|
2
|
+
Copyright 2026 OpenSec
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (see LICENSE).
|
|
5
|
+
|
|
6
|
+
This product includes software developed by others, under the licences below.
|
|
7
|
+
|
|
8
|
+
--------------------------------------------------------------------------------
|
|
9
|
+
@tintinweb/pi-subagents (https://github.com/tintinweb/pi-subagents)
|
|
10
|
+
This package is a modified version of it.
|
|
11
|
+
|
|
12
|
+
MIT License
|
|
13
|
+
|
|
14
|
+
Copyright (c) 2026 tintinweb
|
|
15
|
+
|
|
16
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
17
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
18
|
+
in the Software without restriction, including without limitation the rights
|
|
19
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
20
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
21
|
+
furnished to do so, subject to the following conditions:
|
|
22
|
+
|
|
23
|
+
The above copyright notice and this permission notice shall be included in all
|
|
24
|
+
copies or substantial portions of the Software.
|
|
25
|
+
|
|
26
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
27
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
28
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
29
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
30
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
31
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
32
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -70,25 +70,95 @@ Agent({ subagent_type: "Explore", prompt: "Find authentication code", descriptio
|
|
|
70
70
|
| Command | What it does |
|
|
71
71
|
|---|---|
|
|
72
72
|
| `/agents` | Inspect and manage agents: live conversations, settings, workflows, and scheduled jobs (`/agents → Scheduled jobs`). |
|
|
73
|
-
| `@<agent> <message>` | With agent mentions enabled, sends a message to that agent, e.g. `@explore check the RPC path`. A finished agent
|
|
73
|
+
| `@<agent> <message>` | With agent mentions enabled, sends a message to that agent, e.g. `@explore check the RPC path`. A finished agent is resumed (see [Resuming agents](#resuming-agents)). |
|
|
74
|
+
|
|
75
|
+
### Resuming agents
|
|
76
|
+
|
|
77
|
+
Every agent result names the agent: `Agent ID: <id>` (foreground and background results alike). Pass it back to continue
|
|
78
|
+
the same conversation instead of starting a fresh agent:
|
|
79
|
+
|
|
80
|
+
```text
|
|
81
|
+
Agent({ resume: "<id>", prompt: "Now check the tests too", description: "Continue audit", subagent_type: "Explore" })
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
- `resume` accepts the id or the agent's handle (`explore`, `explore-2`, or its `name`). It runs detached unless
|
|
85
|
+
`run_in_background: false`; `subagent_type` is ignored. A running agent cannot be resumed: steer it instead.
|
|
86
|
+
- The resumed run keeps what the agent ran with: its model, the thinking level saved in its session, its working
|
|
87
|
+
directory, `isolated`, and its turn limit (`max_turns` on the resume call replaces it), with the same grace turns and
|
|
88
|
+
tool timeout as a first run.
|
|
89
|
+
- A worktree agent resumes in its worktree: it is restored at the same path from the agent's branch, and the new work
|
|
90
|
+
is committed to that branch afterwards. If the branch is gone the resume is refused and nothing runs.
|
|
91
|
+
- How long: a finished agent stays in memory for about ten minutes; after that it is reopened from its saved session
|
|
92
|
+
file, under the same id, for as long as that file exists. Sessions are saved by default (`rememberAgents`; turn it
|
|
93
|
+
off and agents are resumable only for those ten minutes).
|
|
94
|
+
- What survives a restart, `/resume`, `/fork` or `/reload`: finished agents of that session (on its branch, for a fork)
|
|
95
|
+
stay resumable by the model and by `@handle`. Agents still running are stopped, as before, and recorded as stopped
|
|
96
|
+
and resumable. `/new` starts with none. Nested agents can be resumed by their parent while their parent's manager
|
|
97
|
+
lives; across a restart only top-level agents are rebuilt.
|
|
98
|
+
- In workflows, `agent(prompt, { resume: label })` continues a child of the same run the same way, also after its record
|
|
99
|
+
was evicted.
|
|
74
100
|
|
|
75
101
|
### Custom agents
|
|
76
102
|
|
|
77
103
|
Put custom definitions in `.pi/agents/<name>.md` or the global Pi agents directory. Agents inherit the current parent's
|
|
78
104
|
model and thinking level unless their definition or call overrides them.
|
|
79
105
|
|
|
106
|
+
`isolated: true` (on a call or in an agent file) removes extension and MCP tools, skills, `ext:` selectors and nested
|
|
107
|
+
delegation. It is not a sandbox: the agent still inherits Pi's environment variables (including provider keys its
|
|
108
|
+
`bash` can read), the parent's model registry and auth, global and trusted project settings (shell, command prefix,
|
|
109
|
+
retry, compaction), and, for append-mode agents such as `general-purpose`, the parent's whole system prompt.
|
|
110
|
+
|
|
111
|
+
`tools:` limits built-in tools only. Tools registered by extensions stay available unless the file sets
|
|
112
|
+
`extensions: false` (or names the extensions to load), or lists `ext:` selectors in `tools:`, which turns extension
|
|
113
|
+
tools into an allowlist. The built-in `Explore` and `Plan` agents get `read`, `grep`, `find` and `ls` and no extension
|
|
114
|
+
tools, so they cannot write files or run commands; a file named `Explore.md` or `Plan.md` replaces them if you want
|
|
115
|
+
them to have more.
|
|
116
|
+
|
|
117
|
+
### Project trust
|
|
118
|
+
|
|
119
|
+
Subagents follow Pi's project trust decision for the parent session.
|
|
120
|
+
|
|
121
|
+
- In a folder Pi does not trust, subagents load none of the project's `.pi/extensions`, `.pi/settings.json` (for
|
|
122
|
+
example `shellCommandPrefix`), skills or prompts, exactly like the parent. This extension also ignores the project's
|
|
123
|
+
`.pi/agents`, `.agents/agents`, `.pi/skills`, `.agents/skills`, `.pi/subagents.json`,
|
|
124
|
+
`.pi/agent-tool-description.md` and saved workflows there. A trusted project behaves as before.
|
|
125
|
+
- Code the project ships for this extension needs a recorded decision: saved workflows in `.pi/workflows` or
|
|
126
|
+
`.agents/workflows`, and path entries in a project agent's `extensions:`. Pi trusts a folder without asking when
|
|
127
|
+
it holds nothing Pi gates (agent and workflow folders are not gated), so these run only when the folder was trusted
|
|
128
|
+
at Pi's prompt, by `defaultProjectTrust` or a CLI flag, or recorded with `/trust`. Otherwise the workflow is refused
|
|
129
|
+
and the extension path is skipped with a warning; the rest of the agent file still applies.
|
|
130
|
+
- A project agent file named `general-purpose`, `Explore` or `Plan` replaces the built-in agent. A warning names the
|
|
131
|
+
file, and the `Agent` tool's type list marks the type as defined by the project.
|
|
132
|
+
- The extension starts before Pi asks about trust. A folder you trust at the prompt gets its project agents and settings
|
|
133
|
+
for that session, but the `Agent` tool's description, built at startup, lists them from the next session on.
|
|
134
|
+
|
|
80
135
|
## Configuration
|
|
81
136
|
|
|
82
137
|
| Setting | Default | Meaning |
|
|
83
138
|
|---|---|---|
|
|
84
139
|
| Background concurrency (`/agents → Settings`) | `10` | How many background agents run at once. |
|
|
85
|
-
| Tool timeout (`/agents → Settings`, `toolTimeoutSeconds`) | `1200` | Seconds one subagent tool call may run (`0` = no limit). A `bash` call is killed at the limit and the agent sees the timeout; any other tool still running a minute later is stopped and the agent is told to continue another way (up to 3 times per run). |
|
|
140
|
+
| Tool timeout (`/agents → Settings`, `toolTimeoutSeconds`) | `1200` | Seconds one subagent tool call may run (`0` = no limit). A `bash` call is killed at the limit and the agent sees the timeout; any other tool still running a minute later is stopped and the agent is told to continue another way (up to 3 times per run). The main agent's `bash` calls get the same timeout when they set none; a timeout the main agent asks for is kept. |
|
|
86
141
|
|
|
87
142
|
## Notes
|
|
88
143
|
|
|
89
144
|
- Schedules: interval schedules must be at least `1m` (stored shorter intervals are raised to one minute); intervals and
|
|
90
145
|
relative delays are capped at `3650d`.
|
|
91
|
-
- Worktree isolation is optional and commits an isolated agent's changes to its branch on completion.
|
|
146
|
+
- Worktree isolation is optional and commits an isolated agent's changes to its branch on completion. The worktree is
|
|
147
|
+
removed afterwards unless that would delete work a branch cannot carry: files git ignores that the agent created
|
|
148
|
+
(dependency, cache and build directories such as `node_modules`, `dist`, `build` and `coverage` do not count), or git
|
|
149
|
+
repositories it created or changed inside the worktree. Then the worktree is kept and the result names its path and
|
|
150
|
+
the reason; remove it with `git worktree remove --force <path>` when you are done. Stash entries made while the
|
|
151
|
+
agent ran are reported too, since they are not on the branch.
|
|
152
|
+
- A running agent's worktree is locked (`git worktree lock`) with its process id. When pi starts in a repository, a
|
|
153
|
+
worktree whose process is gone (pi was killed or crashed) has its uncommitted work committed to
|
|
154
|
+
`pi-agent-<id>-recovered` and is removed unless it holds work a branch cannot carry; you are told either way.
|
|
155
|
+
Worktrees of agents running in another pi are left alone, and unlocked agent worktrees that still hold changes or
|
|
156
|
+
ignored files are only reported. At the same start, `pi-agent-*` branches already merged into `HEAD` whose last
|
|
157
|
+
commit is more than 7 days old are deleted (`git branch -d`); resuming such an agent afterwards is refused.
|
|
158
|
+
- A workflow `gate` on an isolated agent runs after the agent's changes are committed; whatever the gate changes
|
|
159
|
+
(snapshots, coverage, build output) is discarded and never reaches the branch.
|
|
160
|
+
- A worktree agent's `memory: project` and `memory: local` directories are in the real project, not the copy, so
|
|
161
|
+
they outlast the worktree.
|
|
92
162
|
- Review `/agents → Settings` before enabling delegation or isolation for write-capable agents.
|
|
93
163
|
|
|
94
164
|
## Security
|