[shepherding] Pi `/tree` branch isolation via `tdai-memory/branch@1` marker
Is this feature related to a problem? | 该功能需求是否与某个问题相关?请描述
Shepherding issue split out of #1070. Follow-up PR author: @kbob3687-hub. Targets
feat/server_team.
Background
Pi is a git-native tool. Developers routinely have multiple worktrees or
branches open in parallel — a bugfix on hotfix/x and a feature on
feature/y should not contaminate each other's memory. Today the Pi
adapter treats one repo as one memory identity, which means switching
branches silently mixes context.
#1070 introduced a tdai-memory/branch@1 marker convention to give each
Pi branch its own memory identity. We want to reintroduce this as an
independent PR because the concept doesn't exist anywhere in the current
codebase and is genuinely additive to #1126.
In scope
- Marker convention
tdai-memory/branch@1documented and versioned - Per-branch memory identity derivation (deterministic, no per-machine drift)
- Migration/fallback behavior when the marker is absent (must not break existing Pi sessions post-#1126)
- Wire-in point:
MemoryProxy/src/agent-adapters/pi.ts
Out of scope
- Durable delivery (that's the outbox shepherding issue)
- Cross-branch merge / memory reconciliation UX
- Non-Pi clients (Cursor's session-id problem is tracked separately in #1138)
Acceptance criteria
- Same repo + different branches → different memory identities (integration test)
- Missing marker → falls back to current per-repo behavior with a warning log, not a hard error
- Marker version bump path documented (
@1implies@2will exist) - No writes to
handler.tsorsession/codebuddy/init.ts - Docs updated: how a Pi user opts into or out of branch isolation
Related
- Closes down the
/treeisolation portion of #1070 - Independent of #1126, #1142, and the other three shepherding issues
Suggested branching
Branch name: pi-adapter/tree-branch-isolation against feat/server_team.
Describe the solution you'd like | 描述你期望的解决方案
/
Describe alternatives you've considered | 描述你考虑过的其他方案
No response
Additional context | 补充说明
No response
Source: TencentCloud/TencentDB-Agent-Memory