pub fn setup_worktree_agents_md(
repo_root: &Path,
worktree_root: &Path,
assignment: &WorktreeAssignment,
) -> Result<(), PawError>Expand description
Reads the root repo’s AGENTS.md, injects the worktree assignment section, writes the result to the worktree root, and protects it from being committed.
Uses two layers of protection:
.git/info/exclude— hides AGENTS.md fromgit statusgit update-index --assume-unchanged— preventsgit add -Afrom staging it
The second layer is critical for AI agents that run git add -A or
git add . to commit their work — without it, the injected session
content would be committed to the branch.