Files
ai-artifacts/projects/dotfiles/050-pi-subagents-fork-context-task.md

1.8 KiB

status, claimed-by, claimed-at, completed-at, parent, blocked-by, tags
status claimed-by claimed-at completed-at parent blocked-by tags
resolved 019fba91-eabf-76ae-b086-a37ac061d6e8 2026-08-01T14:36:01-04:00 2026-08-01T14:44:11-04:00 027-pi-subagents-implementation-spec-task
046-pi-subagents-minimal-tracer-bullet-task
ticket/task/afk

Implement fork context mode

Question

Add fork context mode so a spawn can give the worker the parent active-branch transcript snapshot and delegated-role wrapper while independent context remains clean by default.

What to build

Implement the second version-one context mode. A forked worker should start from the active branch session snapshot and receive a small delegated-role wrapper with the per-call prompt. Independent workers should remain transcript-clean. Named agents that declare allowedContexts should reject disallowed spawn overrides.

Acceptance criteria

  • fork serializes the parent session header and active branch entries into a child-startable session.
  • The forked worker receives the parent active-branch context plus the delegated request wrapper.
  • independent workers still do not receive parent transcript context.
  • allowedContexts rejects disallowed context overrides.
  • Tests or manual checks distinguish forked and independent context visibility.

Implementation Notes

Do not summarize, strip tool output, or compact before spawning. Let child Pi handle normal compaction.

Resolved in branch pi-subagents-tracer-bullet, commit e7a700f. Fork mode passes the parent session file to child Pi with --fork and uses a delegated fork-context wrapper; independent mode keeps its transcript-clean wrapper. allowedContexts rejection is covered by spawn resolution. Verified with live Pi RPC fork smoke where a forked child recovered parent marker fork-visible-123, plus tests and nix flake check.