@cad0p/pi-subagents-tintinweb 0.22.0-20261026.0 → 0.22.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 CHANGED
@@ -230,7 +230,7 @@ All fields are optional — sensible defaults for everything.
230
230
  | `max_turns` | unlimited | Max agentic turns before graceful shutdown. `0` or omit for unlimited |
231
231
  | `persist_session` | `false` | Keep this subagent's pi session file after it settles. Every run writes a session file while it runs (so a crashed run stays recoverable); without this flag the file is deleted when the agent record is removed — the 10-minute eviction or a session switch. The subagent's `.output` transcript is a separate knob, still written unless `output_transcript: false`. See [Session Persistence](#session-persistence) |
232
232
  | `output_transcript` | `true` (or `subagents.json` `outputTranscript`) | Write this subagent's `.output` transcript; when set, overrides the `subagents.json` `outputTranscript` default. Set `false` to write no transcript file or path. Governs only the transcript — independent of `persist_session`, `isolation: worktree`, and `memory:` |
233
- | `session_dir` | parent session's dir | Directory for this agent's pi session file (written during the run; retained after it only with `persist_session: true`). Omitted, the file goes in the parent session's directory (honours `--session-dir`, `PI_CODING_AGENT_SESSION_DIR` and the `sessionDir` setting, like the main session; a nested agent's spawner is its parent). Relative paths resolve from the agent's cwd before its own worktree isolation, never from that worktree, so the file survives its cleanup. A nested agent spawned by a worktree-isolated agent still resolves from its spawner's worktree ([#87](https://github.com/cad0p/pi-subagents-tintinweb/issues/87)) |
233
+ | `session_dir` | pi default | Directory for this agent's pi session file (written during the run; retained after it only with `persist_session: true`). Omitted uses pi's normal session location, and relative paths resolve from the agent cwd |
234
234
  | `prompt_mode` | `replace` | `replace`: body is the full system prompt (no AGENTS.md / CLAUDE.md inheritance). `append`: body appended to parent's prompt (agent acts as a "parent twin" — inherits parent's AGENTS.md / CLAUDE.md) |
235
235
  | `inherit_context` | `false` | Fork parent conversation into agent |
236
236
  | `isolated` | `false` | Hermetic specialist mode: forces `extensions: false` + `skills: false` + drops `ext:` selectors. Only built-in tools. Distinct from `isolation: worktree` (filesystem) |
@@ -380,7 +380,7 @@ Resumed runs (`resume`) are exempt: a resume starts immediately, occupies a pool
380
380
 
381
381
  ## Session Persistence
382
382
 
383
- Every subagent run is written to a normal pi session file while it runs — default agents included — so a crashed, killed, or interrupted run leaves a transcript pi's `/resume` can recover. The child's session header records the parent session file as `parentSession`, so subagent sessions nest under the run that spawned them in pi's `/resume` picker. A worktree-isolated child records its worktree as its cwd, so under a custom session directory (`--session-dir`, `PI_CODING_AGENT_SESSION_DIR`, the `sessionDir` setting) it shows only in `/resume`'s all-sessions scope ([#88](https://github.com/cad0p/pi-subagents-tintinweb/issues/88)).
383
+ Every subagent run is written to a normal pi session file while it runs — default agents included — so a crashed, killed, or interrupted run leaves a transcript pi's `/resume` can recover. The child's session header records the parent session file as `parentSession`, so subagent sessions nest under the run that spawned them in pi's `/resume` picker.
384
384
 
385
385
  Retention is decided when the run settles, not when the session is created:
386
386
 
@@ -389,7 +389,7 @@ Retention is decided when the run settles, not when the session is created:
389
389
  | `false` (default) | The session file is deleted when the agent record is removed: the 10-minute eviction after completion, `clearCompleted()` on session switch, or a clean shutdown once the run has settled. Until then the completed record can still `resume` the agent, which is why the file outlives the run itself. |
390
390
  | `true` | The session file is kept indefinitely. |
391
391
 
392
- Shutdown keeps an in-flight run's file — a run killed mid-flight is the case this exists for — and deletes a settled one's, because the manager's map is discarded and nothing would ever revisit it. `session_dir:` picks the directory the file is written to; omitted, it is the parent session's own directory, worktree children included, so the file stays beside the parent after the worktree is removed. On a host session with no file of its own (`--no-session`, or an SDK host using an in-memory session) subagent sessions are in-memory too and explicitly not recoverable. A resumed agent keeps the same session file and the same retention decision as its first run.
392
+ Shutdown keeps an in-flight run's file — a run killed mid-flight is the case this exists for — and deletes a settled one's, because the manager's map is discarded and nothing would ever revisit it. `session_dir:` picks the directory the file is written to. On a host session with no file of its own (`--no-session`, or an SDK host using an in-memory session) subagent sessions are in-memory too and explicitly not recoverable. A resumed agent keeps the same session file and the same retention decision as its first run.
393
393
 
394
394
  > **Migration — `persist_session` changed meaning.** It used to mean "persist this subagent at all" (without it, the run used an in-memory session and left nothing behind). It now means "retain this subagent's session file after it settles". An agent with `persist_session: false` — or no `persist_session` at all — now writes a session file *during* the run; that file is deleted when the agent record is removed, so completed runs still leave nothing behind unless pi crashes mid-run (which is the point). Agents with `persist_session: true` behave as before, plus the parent link.
395
395
 
@@ -14,7 +14,7 @@ Each of these is a guarantee. A port that breaks one is a regression, not a reba
14
14
 
15
15
  **`checkpoint`.** A separate tool a subagent calls at milestones to record a progress note — what it just did, what it is doing next — which the parent sees in the result report. It is not a resume marker: resume replays the session. Upstream has no equivalent.
16
16
 
17
- **Session retention model.** Every run writes a pi session file *while it runs*, so a crashed or killed run stays recoverable; retention is decided when the agent record is removed, and `persist_session: true` means "keep this file after the run settles". Upstream persists by default behind `rememberAgents` and lets `persist_session: false` keep an agent in memory. There is no `rememberAgents` here: one behaviour to reason about instead of two settings that interact. A run's file goes in the parent session's directory (worktree children included) unless `session_dir` names another, and a relative `session_dir` never resolves inside the agent's own isolation worktree (a nested agent of a worktree-isolated spawner still does: [#87](https://github.com/cad0p/pi-subagents-tintinweb/issues/87)).
17
+ **Session retention model.** Every run writes a pi session file *while it runs*, so a crashed or killed run stays recoverable; retention is decided when the agent record is removed, and `persist_session: true` means "keep this file after the run settles". Upstream persists by default behind `rememberAgents` and lets `persist_session: false` keep an agent in memory. There is no `rememberAgents` here: one behaviour to reason about instead of two settings that interact.
18
18
 
19
19
  **Parent-mirrored built-in activation.** Subagents load pi's built-in extensions (`codemode`, `tool-search`, `mcp`), but a `defaultActive: false` tool is declared in the child only when the parent session has it active or the agent names its extension with `ext:`. "As in the main session" means the main session's actual tool set, not everything that happens to be loaded.
20
20
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cad0p/pi-subagents-tintinweb",
3
- "version": "0.22.0-20261026.0",
3
+ "version": "0.22.0",
4
4
  "description": "A pi extension extension that brings smart Claude Code-style autonomous sub-agents to pi.",
5
5
  "author": "tintinweb",
6
6
  "publishConfig": {
@@ -993,15 +993,8 @@ export async function runAgent(
993
993
  !disallowed?.(name) &&
994
994
  (toolNames.includes(name) || nestedToolNames.has(name) || scopedExtensionTools(loader.getExtensions()).has(name)));
995
995
 
996
- // A relative `session_dir` resolves from the agent's cwd before worktree
997
- // isolation, never from the isolation worktree (deleted at cleanup).
998
- // `worktree.parentCwd` is that cwd: agent-manager sets it to the same
999
- // `baseCwd` it uses for the worktree copy. Without a worktree it is unset and
1000
- // `effectiveCwd` is already the agent's cwd.
1001
- const configuredSessionDir = resolveConfiguredSessionDir(
1002
- agentConfig?.sessionDir,
1003
- options.worktree?.parentCwd ?? effectiveCwd,
1004
- );
996
+ const configuredSessionDir = resolveConfiguredSessionDir(agentConfig?.sessionDir, effectiveCwd);
997
+ const defaultSessionDir = process.env.PI_CODING_AGENT_SESSION_DIR ?? settingsManager.getSessionDir?.();
1005
998
  // A subagent session is ALWAYS written to disk while it runs: a crashed or
1006
999
  // killed run must leave a transcript pi's /resume can recover. Retention
1007
1000
  // after the run settles is the manager's decision (`persist_session`), never a
@@ -1012,18 +1005,12 @@ export async function runAgent(
1012
1005
  // absence of a session file is the exact signal — an argv scan would miss the
1013
1006
  // SDK host and let an ephemeral session leave children on disk.
1014
1007
  // The same path is `parentSession`, which nests the child under its spawner.
1015
- //
1016
- // Without `session_dir`, the file goes in the parent session's own directory.
1017
- // pi already resolved `--session-dir`, `PI_CODING_AGENT_SESSION_DIR`, the
1018
- // `sessionDir` setting or `--session <file>` when it opened the parent, so the
1019
- // parent is asked rather than those sources being re-read here. A nested
1020
- // agent's parent is its spawner, so its child follows the spawner's directory.
1021
1008
  const parentSession = ctx.sessionManager.getSessionFile();
1022
1009
  const sessionManager = parentSession === undefined
1023
1010
  ? SessionManager.inMemory(effectiveCwd)
1024
1011
  : SessionManager.create(
1025
1012
  effectiveCwd,
1026
- configuredSessionDir ?? ctx.sessionManager.getSessionDir(),
1013
+ configuredSessionDir ?? defaultSessionDir,
1027
1014
  { parentSession },
1028
1015
  );
1029
1016