@johnnywu/pi-subagents 1.4.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 CHANGED
@@ -1,3 +1,21 @@
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
+
12
+ # [1.5.0](https://github.com/jwu/pi-subagents/compare/v1.4.0...v1.5.0) (2026-06-03)
13
+
14
+
15
+ ### Features
16
+
17
+ * support extended thinking levels ([0721713](https://github.com/jwu/pi-subagents/commit/07217133b20b37c5e2c5a4a3c262b7cf6cabc242))
18
+
1
19
  # [1.4.0](https://github.com/jwu/pi-subagents/compare/v1.3.0...v1.4.0) (2026-06-02)
2
20
 
3
21
 
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
- - `append`: the child process uses pi's default prompt and project context files, then appends the agent prompt.
69
- - `replace`: the child process replaces pi's default prompt with the agent prompt and skips project context files; pi-subagents reinjects the active `Available tools` and `Guidelines` blocks at agent-start time so custom replace prompts still expose the selected tool affordances.
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 mode, and pi-subagents' runtime `Available subagents` block when applicable.
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
 
@@ -93,8 +107,8 @@ Agents are Markdown files with YAML frontmatter.
93
107
  | `description` | no | — | Human-readable summary |
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
- | `thinking` | no | `off` | Reasoning level: `off`, `low`, `medium`, `high` |
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) |
110
+ | `thinking` | no | `off` | Reasoning level: `off`, `minimal`, `low`, `medium`, `high`, `xhigh` |
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.) |
@@ -2,8 +2,8 @@ import * as fs from 'node:fs/promises';
2
2
  import * as os from 'node:os';
3
3
  import * as path from 'node:path';
4
4
 
5
- export type ThinkingLevel = 'off' | 'low' | 'medium' | 'high';
6
- export type SystemPromptMode = 'replace' | 'append';
5
+ export type ThinkingLevel = 'off' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
6
+ export type SystemPromptMode = 'replace' | 'replace-all' | 'append';
7
7
  export type AgentSource = 'global' | 'project';
8
8
 
9
9
  export interface AgentConfig {
@@ -104,12 +104,12 @@ function parseAgentFile(content: string, filePath: string, source: AgentSource):
104
104
  if (!data.name) throw new Error('missing required field: name');
105
105
 
106
106
  const thinking = (data.thinking ?? 'off') as ThinkingLevel;
107
- if (!['off', 'low', 'medium', 'high'].includes(thinking)) {
107
+ if (!['off', 'minimal', 'low', 'medium', 'high', 'xhigh'].includes(thinking)) {
108
108
  throw new Error(`invalid thinking: ${data.thinking}`);
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
 
@@ -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
- return isSubagentProcess(env) && subagentSystemPromptMode(env) === 'replace';
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('Available tools:') || systemPrompt.includes('Guidelines:')) {
68
+ if (!block || systemPrompt.includes(block)) {
69
69
  return systemPrompt;
70
70
  }
71
71
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@johnnywu/pi-subagents",
3
- "version": "1.4.0",
3
+ "version": "2.0.0",
4
4
  "description": "Sub-agents extension for pi coding agent.",
5
5
  "homepage": "https://github.com/jwu/pi-subagents#readme",
6
6
  "repository": {