@pify/subagent 0.2.0 → 0.3.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/README.md +5 -1
- package/extensions/subagent.ts +9 -2
- package/package.json +1 -1
- package/src/frontmatter.ts +11 -0
- package/src/types.ts +8 -0
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ Part of the [Pify suite](https://github.com/pifydev). Install with [`pify instal
|
|
|
9
9
|
- **`agent_run`** — delegate a task to a child pi session (in-process, isolated in-memory transcript). Foreground blocks and returns the child's report; `background: true` returns an id immediately (up to 4 concurrent) with a live widget showing spinners, token counts, and elapsed time.
|
|
10
10
|
- **`agent_result`** — collect a background run's report; completed results survive `/reload`.
|
|
11
11
|
- **Three builtin agent types**: `reviewer` (read-only, thinking high — findings with evidence), `scout` (read-only exploration — paths + excerpts), `worker` (full tools — scoped implementation, verifies before finishing).
|
|
12
|
-
- **Custom agent types**, Claude Code-compatible: drop `.pi/agents/<name>.md` (project) or `<agentDir>/agents/<name>.md` (global) with frontmatter — `description`, `tools`, `model` (`provider/id`), `thinking`, `max_turns` — and a system-prompt body. Project overrides global overrides builtin; a def without `tools:` defaults to read-only.
|
|
12
|
+
- **Custom agent types**, Claude Code-compatible: drop `.pi/agents/<name>.md` (project) or `<agentDir>/agents/<name>.md` (global) with frontmatter — `description`, `tools`, `model` (`provider/id`), `thinking`, `max_turns`, and (v0.3) `system_prompt_mode` / `inherit_skills` — and a system-prompt body. Project overrides global overrides builtin; a def without `tools:` defaults to read-only.
|
|
13
13
|
- **Guardrails**: tool allowlists are enforced at session creation; children are aborted at their turn cap; children cannot spawn children.
|
|
14
14
|
- `/agents` lists types and this session's runs.
|
|
15
15
|
|
|
@@ -26,12 +26,16 @@ tools: read, grep, find, ls
|
|
|
26
26
|
model: anthropic/claude-haiku-4-5-20251001
|
|
27
27
|
thinking: low
|
|
28
28
|
max_turns: 15
|
|
29
|
+
system_prompt_mode: replace
|
|
30
|
+
inherit_skills: false
|
|
29
31
|
---
|
|
30
32
|
|
|
31
33
|
You are a security auditor. Scan for hardcoded secrets, injection flaws,
|
|
32
34
|
and overly broad permissions. Report file:line with remediation notes.
|
|
33
35
|
```
|
|
34
36
|
|
|
37
|
+
`system_prompt_mode: replace` (default `append`) drops the session's own system prompt, so a specialist is not also told to be this project's coding assistant. `inherit_skills: false` (default `true`) keeps a narrow child out of the project's whole skill surface. Both are unset in the builtins, which behave exactly as before.
|
|
38
|
+
|
|
35
39
|
## License
|
|
36
40
|
|
|
37
41
|
MIT © [Pify maintainers](https://github.com/pifydev)
|
package/extensions/subagent.ts
CHANGED
|
@@ -129,9 +129,16 @@ export default function subagent(pi: ExtensionAPI) {
|
|
|
129
129
|
noExtensions: true,
|
|
130
130
|
noPromptTemplates: true,
|
|
131
131
|
noThemes: true,
|
|
132
|
-
|
|
132
|
+
// system_prompt_mode: replace drops the parent's prompt so a
|
|
133
|
+
// specialist is not also told to be this project's coding
|
|
134
|
+
// assistant; inherit_skills: false keeps a focused child out of
|
|
135
|
+
// the project's whole skill surface.
|
|
136
|
+
noSkills: !def.inheritSkills,
|
|
137
|
+
...(def.systemPromptMode === "replace" ? {} : { systemPrompt: promptOptions.customPrompt }),
|
|
133
138
|
appendSystemPrompt: [
|
|
134
|
-
...(
|
|
139
|
+
...(def.systemPromptMode === "replace" || !promptOptions.appendSystemPrompt
|
|
140
|
+
? []
|
|
141
|
+
: [promptOptions.appendSystemPrompt]),
|
|
135
142
|
def.systemPrompt,
|
|
136
143
|
CHILD_FRAMING,
|
|
137
144
|
],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pify/subagent",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Spawn scoped subagents from within a pi session: agent_run/agent_result tools, Claude Code-compatible agent types, turn caps and tool allowlists",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
package/src/frontmatter.ts
CHANGED
|
@@ -44,6 +44,9 @@ export function parseAgentFile(
|
|
|
44
44
|
: DEFAULT_MAX_TURNS;
|
|
45
45
|
|
|
46
46
|
const model = fields.get("model") || null;
|
|
47
|
+
const promptMode = fields.get("system_prompt_mode")?.toLowerCase();
|
|
48
|
+
const systemPromptMode = promptMode === "replace" ? "replace" : "append";
|
|
49
|
+
const inheritSkills = !isFalse(fields.get("inherit_skills"));
|
|
47
50
|
|
|
48
51
|
return {
|
|
49
52
|
name: name.toLowerCase(),
|
|
@@ -53,10 +56,18 @@ export function parseAgentFile(
|
|
|
53
56
|
thinking,
|
|
54
57
|
maxTurns,
|
|
55
58
|
systemPrompt: match[2]!.trim(),
|
|
59
|
+
systemPromptMode,
|
|
60
|
+
inheritSkills,
|
|
56
61
|
source,
|
|
57
62
|
};
|
|
58
63
|
}
|
|
59
64
|
|
|
65
|
+
/** Frontmatter booleans, written the handful of ways people write them. */
|
|
66
|
+
function isFalse(raw: string | undefined): boolean {
|
|
67
|
+
if (raw === undefined) return false;
|
|
68
|
+
return ["false", "no", "off", "0"].includes(raw.trim().toLowerCase());
|
|
69
|
+
}
|
|
70
|
+
|
|
60
71
|
/** Read-only default keeps a def missing `tools:` from mutating anything. */
|
|
61
72
|
function parseTools(raw: string | undefined): ValidTool[] {
|
|
62
73
|
if (!raw) return ["read", "grep", "find", "ls"];
|
package/src/types.ts
CHANGED
|
@@ -38,6 +38,14 @@ export interface AgentDef {
|
|
|
38
38
|
maxTurns: number;
|
|
39
39
|
/** Markdown body appended to the child's system prompt. */
|
|
40
40
|
systemPrompt: string;
|
|
41
|
+
/**
|
|
42
|
+
* "append" (default) puts the body after the session's own system prompt;
|
|
43
|
+
* "replace" drops the parent's prompt so a specialist is not also told to
|
|
44
|
+
* be this project's coding assistant.
|
|
45
|
+
*/
|
|
46
|
+
systemPromptMode: "append" | "replace";
|
|
47
|
+
/** Whether the child loads the project's skills (default true). */
|
|
48
|
+
inheritSkills: boolean;
|
|
41
49
|
source: "builtin" | "global" | "project";
|
|
42
50
|
}
|
|
43
51
|
|