@johnnywu/pi-subagents 1.5.0 → 2.0.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 +11 -0
- package/README.md +19 -5
- package/extensions/agent-loader.ts +2 -2
- package/extensions/env-utils.ts +4 -3
- package/extensions/subagent-executor.ts +1 -1
- package/extensions/subagent-prompt.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
# [2.0.0](https://github.com/jwu/pi-subagents/compare/v1.5.0...v2.0.0) (2026-06-16)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
* feat!: clarify systemPrompt replace semantics ([5cdb603](https://github.com/jwu/pi-subagents/commit/5cdb603e814b966f43fa0537dae5ac90799233b7))
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
### BREAKING CHANGES
|
|
8
|
+
|
|
9
|
+
* systemPrompt: replace now preserves pi context files.
|
|
10
|
+
Use systemPrompt: replace-all for the previous isolated behavior.
|
|
11
|
+
|
|
1
12
|
# [1.5.0](https://github.com/jwu/pi-subagents/compare/v1.4.0...v1.5.0) (2026-06-03)
|
|
2
13
|
|
|
3
14
|
|
package/README.md
CHANGED
|
@@ -63,10 +63,24 @@ Available subagents:
|
|
|
63
63
|
- test-writer
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
-
The prompt file passed to the child process contains only the agent prompt plus skills. Runtime prompt assembly then depends on `systemPrompt` mode
|
|
66
|
+
The prompt file passed to the child process contains only the agent prompt plus skills. Runtime prompt assembly then depends on `systemPrompt` mode.
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
### What goes into the sub-agent system prompt
|
|
69
|
+
|
|
70
|
+
| Component | `append` | `replace` | `replace-all` |
|
|
71
|
+
|------|----------|-----------|---------------|
|
|
72
|
+
| pi default system prompt | ✅ kept | ❌ replaced | ❌ replaced |
|
|
73
|
+
| Project context files (AGENTS.md/CLAUDE.md, etc.) | ✅ included | ✅ included | ❌ skipped |
|
|
74
|
+
| Agent body (.md file body) | ✅ appended | ✅ becomes the prompt | ✅ becomes the prompt |
|
|
75
|
+
| Skills XML block | ✅ appended | ✅ appended | ✅ appended |
|
|
76
|
+
| Available tools / Guidelines block | from default prompt | re-injected by `before_agent_start` hook | re-injected by `before_agent_start` hook |
|
|
77
|
+
| Available subagents block | injected at agent start | injected at agent start | injected at agent start |
|
|
78
|
+
|
|
79
|
+
`append` keeps pi's full default prompt (with project context) and adds the agent body at the end.
|
|
80
|
+
`replace` swaps out pi's default prompt for the agent body while keeping pi context files.
|
|
81
|
+
`replace-all` is the fully isolated mode: it swaps out pi's default prompt and skips pi context files, then the runtime hook re-injects tool and guideline blocks to preserve tool visibility.
|
|
82
|
+
|
|
83
|
+
Breaking change: the old `replace` behavior is now `replace-all`. Existing agents that need to keep skipping AGENTS.md/CLAUDE.md should change `systemPrompt: replace` to `systemPrompt: replace-all`.
|
|
70
84
|
|
|
71
85
|
The `Available subagents` block is injected by the child process at agent-start time, after `PI_SUBAGENT_ALLOWED` and recursion depth filtering are applied.
|
|
72
86
|
|
|
@@ -81,7 +95,7 @@ debug: true
|
|
|
81
95
|
---
|
|
82
96
|
```
|
|
83
97
|
|
|
84
|
-
The child process writes `debug-system-prompt.md` in the project cwd. The file contains the prompt visible during `before_agent_start`, including `systemPrompt` append/replace behavior, tools/guidelines, skills, project context files in append
|
|
98
|
+
The child process writes `debug-system-prompt.md` in the project cwd. The file contains the prompt visible during `before_agent_start`, including `systemPrompt` append/replace/replace-all behavior, tools/guidelines, skills, project context files in append and replace modes, and pi-subagents' runtime `Available subagents` block when applicable.
|
|
85
99
|
|
|
86
100
|
## Agent configuration
|
|
87
101
|
|
|
@@ -94,7 +108,7 @@ Agents are Markdown files with YAML frontmatter.
|
|
|
94
108
|
| `tools` | no | _none_ | Comma-separated tool whitelist (`read, write, bash, grep`, etc.) |
|
|
95
109
|
| `model` | no | parent's model | Provider/model-id (`anthropic/claude-sonnet-4-6`) |
|
|
96
110
|
| `thinking` | no | `off` | Reasoning level: `off`, `minimal`, `low`, `medium`, `high`, `xhigh` |
|
|
97
|
-
| `systemPrompt` | no | `append` | How the body is applied: `append` (append to pi default system prompt and project context) or `replace` (replace default prompt and skip project context) |
|
|
111
|
+
| `systemPrompt` | no | `append` | How the body is applied: `append` (append to pi default system prompt and project context), `replace` (replace pi default prompt while keeping project context), or `replace-all` (replace pi default prompt and skip project context) |
|
|
98
112
|
| `skills` | no | _none_ | Comma-separated skill names or simple wildcard patterns (`*`, `obsidian-*`) to load (resolved from project `.agents/skills/`, `.pi/skills/`, global `~/.pi/agent/skills/`, or npm packages) |
|
|
99
113
|
| `allowedAgents` | no | _all_ | Comma-separated list of sub-agents this agent may spawn |
|
|
100
114
|
| `maxDepth` | no | `10` | Maximum recursion depth (`0` = no sub-agents, `1` = one level, etc.) |
|
|
@@ -3,7 +3,7 @@ import * as os from 'node:os';
|
|
|
3
3
|
import * as path from 'node:path';
|
|
4
4
|
|
|
5
5
|
export type ThinkingLevel = 'off' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
|
|
6
|
-
export type SystemPromptMode = 'replace' | 'append';
|
|
6
|
+
export type SystemPromptMode = 'replace' | 'replace-all' | 'append';
|
|
7
7
|
export type AgentSource = 'global' | 'project';
|
|
8
8
|
|
|
9
9
|
export interface AgentConfig {
|
|
@@ -109,7 +109,7 @@ function parseAgentFile(content: string, filePath: string, source: AgentSource):
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
const systemPromptMode = (data.systemPrompt ?? 'append') as SystemPromptMode;
|
|
112
|
-
if (!['replace', 'append'].includes(systemPromptMode)) {
|
|
112
|
+
if (!['replace', 'replace-all', 'append'].includes(systemPromptMode)) {
|
|
113
113
|
throw new Error(`invalid systemPrompt: ${data.systemPrompt}`);
|
|
114
114
|
}
|
|
115
115
|
|
package/extensions/env-utils.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type SystemPromptModeEnv = 'replace' | 'append';
|
|
1
|
+
export type SystemPromptModeEnv = 'replace' | 'replace-all' | 'append';
|
|
2
2
|
|
|
3
3
|
export type RecursionEnv = Partial<
|
|
4
4
|
Record<
|
|
@@ -41,10 +41,11 @@ export function isSubagentProcess(env: RecursionEnv): boolean {
|
|
|
41
41
|
|
|
42
42
|
export function subagentSystemPromptMode(env: RecursionEnv): SystemPromptModeEnv | undefined {
|
|
43
43
|
const mode = env?.PI_SUBAGENT_SYSTEM_PROMPT_MODE;
|
|
44
|
-
if (mode === 'replace' || mode === 'append') return mode;
|
|
44
|
+
if (mode === 'replace' || mode === 'replace-all' || mode === 'append') return mode;
|
|
45
45
|
return undefined;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
export function isSubagentReplaceSystemPrompt(env: RecursionEnv): boolean {
|
|
49
|
-
|
|
49
|
+
const mode = subagentSystemPromptMode(env);
|
|
50
|
+
return isSubagentProcess(env) && (mode === 'replace' || mode === 'replace-all');
|
|
50
51
|
}
|
|
@@ -461,7 +461,7 @@ export async function runSubagent(options: RunSubagentOptions): Promise<AgentRes
|
|
|
461
461
|
);
|
|
462
462
|
const args = [pi.entryPoint, '--mode', 'json', '-p', '--no-skills', '--no-prompt-templates'];
|
|
463
463
|
|
|
464
|
-
if (options.agent.systemPromptMode === 'replace') args.push('--no-context-files');
|
|
464
|
+
if (options.agent.systemPromptMode === 'replace-all') args.push('--no-context-files');
|
|
465
465
|
if (options.agent.model) args.push('--model', options.agent.model);
|
|
466
466
|
args.push('--thinking', options.agent.thinking);
|
|
467
467
|
if (options.agent.tools.length > 0) args.push('--tools', options.agent.tools.join(','));
|
|
@@ -65,7 +65,7 @@ export function appendAvailableToolsAndGuidelinesBlock(
|
|
|
65
65
|
options: ToolGuidelinePromptOptions,
|
|
66
66
|
): string {
|
|
67
67
|
const block = formatAvailableToolsAndGuidelinesBlock(options);
|
|
68
|
-
if (!block || systemPrompt.includes(
|
|
68
|
+
if (!block || systemPrompt.includes(block)) {
|
|
69
69
|
return systemPrompt;
|
|
70
70
|
}
|
|
71
71
|
|