Problem
The yard() function in packages/guardrails/profile/plugins/team.ts:225-227 creates team worktree directories in the parent directory of the project:
function yard(dir: string) {
return path.join(path.dirname(dir), `.${path.basename(dir)}-opencode-team`)
}
This causes directories like the following to be created at ~/Developer/ level:
.BenevolentDirector-opencode-team
.engineer-cafe-navigator2025-opencode-team
.milaos-realtime-avatar-spec-opencode-team
.opencode-opencode-team
Each contains UUID-named subdirectories with nested .opencode/ directories.
Expected Behavior
Team worktrees should be stored in a project-scoped location, following the upstream Worktree pattern:
// Upstream worktree pattern (packages/opencode/src/worktree/index.ts:227)
const root = pathSvc.join(Global.Path.data, "worktree", ctx.project.id)
// → ~/.local/share/opencode/worktree/<project-id>/
Proposed Fix
Option A: Store inside project directory
function yard(dir: string) {
return path.join(dir, ".opencode", "team")
}
Option B: Use central XDG storage (aligned with upstream worktree pattern)
function yard(dir: string) {
return path.join(Global.Path.data, "team", path.basename(dir))
}
Impact
- User's Developer directory gets cluttered with hidden project-named directories
- Directories are not cleaned up when project is deleted
- Violates the principle that opencode state should be contained within
.opencode/ or ~/.local/share/opencode/
Cross-Review Notes
- Upstream
worktree/index.ts correctly uses ~/.local/share/opencode/worktree/
- Upstream has no memory/hooks/guardrails (fork-only features)
- Upstream latest:
v1.4.3, divergence is 1160 lines in memory/hook directories
- Upstream branches
kit/dev-memory-observe and perf/tool-memory may introduce future conflicts
Related
- Part of the 7-layer memory architecture implementation (branch:
feat/memory-v2-schema)
- Memory system correctly uses
Instance.directory + .opencode/memory/ (not affected)
Problem
The
yard()function inpackages/guardrails/profile/plugins/team.ts:225-227creates team worktree directories in the parent directory of the project:This causes directories like the following to be created at
~/Developer/level:.BenevolentDirector-opencode-team.engineer-cafe-navigator2025-opencode-team.milaos-realtime-avatar-spec-opencode-team.opencode-opencode-teamEach contains UUID-named subdirectories with nested
.opencode/directories.Expected Behavior
Team worktrees should be stored in a project-scoped location, following the upstream
Worktreepattern:Proposed Fix
Option A: Store inside project directory
Option B: Use central XDG storage (aligned with upstream worktree pattern)
Impact
.opencode/or~/.local/share/opencode/Cross-Review Notes
worktree/index.tscorrectly uses~/.local/share/opencode/worktree/v1.4.3, divergence is 1160 lines in memory/hook directorieskit/dev-memory-observeandperf/tool-memorymay introduce future conflictsRelated
feat/memory-v2-schema)Instance.directory + .opencode/memory/(not affected)