← ClaudeAtlas

mycoworktree-aware-request-contextlisted

Implement callerRoot vs projectRoot separation in MycoRequestContext, design filesystem API patterns with proper root classification, establish request context propagation, and architect worktree-bleed prevention. Covers request context design, filesystem root classification, API boundary patterns, and worktree-bleed prevention architecture. Essential for maintaining proper separation between project identity and caller locality in worktree environments.
goondocks-co/myco · ★ 13 · AI & Automation · score 79
Install: claude install-skill goondocks-co/myco
# Worktree-Aware Request Context and Filesystem Root Management MycoRequestContext separates project identity from caller locality through dual filesystem roots. This prevents worktree-bleed bugs where operations meant for the caller's actual working directory incorrectly use the canonical project root instead. All context-switching headers require bearer token authentication to prevent unauthorized cross-project access. ## Prerequisites - Understanding of MycoRequestContext structure and flow - Familiarity with Grove registration and project identity concepts - Knowledge of worktree patterns and potential bleed scenarios - Access to `packages/myco/src/grove/request-context.ts` and related request handling code - Understand that context-switching headers require daemon authentication tokens ## Procedure A: Implement callerRoot vs projectRoot Separation When designing or modifying request context handling: 1. **Preserve both roots in MycoRequestContext**: ```typescript interface MycoRequestContext { projectRoot: string; // Canonical, registered project identity callerRoot: string | null; // Caller's actual cwd, preserved untouched projectId: string; // Sole identity for DB operations tenancySource: TenancySource; // How this context was established // ... other fields } ``` **TenancySource tri-value model** (defined in `packages/myco/src/grove/request-context.ts`): - `'caller'` — context established by an authentica