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

43 lines
1.8 KiB
Markdown

---
status: resolved
claimed-by: "019fba91-eabf-76ae-b086-a37ac061d6e8"
claimed-at: "2026-08-01T14:36:01-04:00"
completed-at: "2026-08-01T14:44:11-04:00"
parent: "[[027-pi-subagents-implementation-spec-task]]"
blocked-by:
- "[[046-pi-subagents-minimal-tracer-bullet-task]]"
tags:
- 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
- [x] `fork` serializes the parent session header and active branch entries into a child-startable session.
- [x] The forked worker receives the parent active-branch context plus the delegated request wrapper.
- [x] `independent` workers still do not receive parent transcript context.
- [x] `allowedContexts` rejects disallowed context overrides.
- [x] 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`.