diff --git a/.yoi/workflow/multi-agent-workflow.md b/.yoi/workflow/multi-agent-workflow.md index 706be104..94627508 100644 --- a/.yoi/workflow/multi-agent-workflow.md +++ b/.yoi/workflow/multi-agent-workflow.md @@ -106,7 +106,7 @@ reviewer には coder の実装方針ではなく、この intent packet と dif 2. worktree 作成 - `$user/worktree-workflow` に従い `./.worktree/` を作る。 - - `.yoi` を sparse checkout で除外する。 + - `.yoi` 自体は除外しない。tracked project records は child worktree に存在してよく、`.yoi/memory` と local/runtime/log/lock/secret-like paths だけを sparse checkout で除外する。 3. coder Pod spawn - read scope: main workspace 全体。 @@ -117,6 +117,8 @@ reviewer には coder の実装方針ではなく、この intent packet と dif - intent packet - Bash は必ず child worktree に `cd` すること - main workspace の `TODO.md` / `tickets/` / `docs/report/` / `.yoi` は編集しないこと + - child worktree 内の tracked `.yoi` project records は実装対象に必要な branch-local artifacts/dossiers として編集してよいが、`.yoi/memory` や local/runtime/secret-like files は作らないこと + - active orchestration progress と最終 review/approval/close は main workspace の責任として残すこと - 範囲外事項 - 実行すべき build / test / format - 完了報告項目 @@ -155,6 +157,8 @@ reviewer には coder の実装方針ではなく、この intent packet と dif - child worktree 内でのみ実装する。 - main workspace の管理ファイルを書かない。 +- child worktree 内の tracked `.yoi` project records は ticket 要件に必要な branch-local artifact/dossier として扱ってよい。 +- `.yoi/memory`、local/runtime state、logs、locks、secret-like files を child worktree に作らない。 - intent / requirements / invariants / non-goals を読んでから実装する。 - 指定された build / test / format を実行する。 - ticket 要件外の設計変更、依存関係追加、scope / permission / history persistence / prompt context 加工原則に触れる変更が必要なら止めて orchestrator に報告する。 @@ -191,7 +195,7 @@ coder Pod には child worktree 内での commit を許可してよい。 - commit は ticket 内で意味のある粒度にする。 - 例: `feat: ...`、`fix: ...`、`test: ...`、`docs: ...` - coder Pod は merge / push / branch deletion / worktree remove をしない。 -- coder Pod は `TODO.md` / ticket の完了処理 commit をしない。 +- coder Pod は main workspace の Ticket 完了処理 commit、最終 review/approval/close をしない。child worktree 側には branch-local dossier や実装証跡を残してよい。 - orchestrator は review 時に commit 粒度も確認する。 - 必要な修正は、原則追加 commit として積む。履歴改変や squash は人間の明示指示がある時だけ行う。 diff --git a/.yoi/workflow/worktree-workflow.md b/.yoi/workflow/worktree-workflow.md index a0688b7c..a8bdeec3 100644 --- a/.yoi/workflow/worktree-workflow.md +++ b/.yoi/workflow/worktree-workflow.md @@ -8,7 +8,7 @@ requires: [] yoi プロジェクトで実装差分を main workspace から分離するため、`./.worktree/` に child git worktree を作る。これは **worktree の扱い方だけ** を定める Workflow であり、ticket 選定、coder / reviewer sibling の起動、外部レビュー、merge の運用は `$user/multi-agent-workflow` 側で扱う。 -yoi では Pod の write scope が排他的に委譲されるため、child worktree に `.yoi` を置かない。main workspace は orchestration / ticket / docs / memory / workflow 管理の場所として残し、child worktree はコード差分専用の作業面として扱う。 +yoi では Pod の write scope が排他的に委譲されるため、child Pod の write scope は child worktree に限定する。child worktree は Yoi project records marker として tracked `.yoi` records を含んでよいが、generated/personal memory root `.yoi/memory`、local override、runtime state、logs、locks、secret-like files は出さない。main workspace は active orchestration progress と最終 review/approval/close の authority として残す。 ## 適用範囲 @@ -17,7 +17,8 @@ yoi では Pod の write scope が排他的に委譲されるため、child work - coder Pod にこの Workflow を渡して worktree を作らせない。 - coder Pod は、orchestrator が作成済みの child worktree を受け取り、その中で実装・build・test・報告を行う。 - reviewer Pod は、coder Pod の子ではなく orchestrator 配下の sibling として、原則 read-only で main workspace と child worktree を読む。 -- ticket 作成、TODO 更新、review artifact、docs/report は main workspace 側で扱う。 +- ticket 作成、active orchestration progress、最終 review/approval/close は main workspace 側で扱う。 +- branch-local artifacts / dossiers / docs/report / tracked `.yoi` project records は、実装対象に必要なら child worktree 内で扱ってよい。 ## 原則 @@ -25,8 +26,9 @@ yoi では Pod の write scope が排他的に委譲されるため、child work - 複数 ticket を下位 orchestrator に任せる場合も、実装差分は ticket / bounded task ごとに worktree を分ける。 - worktree path は `./.worktree/`。 - branch 名は原則 `` と同じ kebab-case。 -- child worktree には `.yoi` を出さない。 -- child worktree は実装差分用。`TODO.md` / `tickets/` / `docs/report/` / workflow / memory は原則 main workspace 側で扱う。 +- child worktree には `.yoi` project records を出してよい。 +- child worktree では `.yoi/memory`、local/runtime/log/lock/secret-like paths を sparse checkout で除外する。 +- active orchestration progress と最終 review/approval/close は main workspace 側で扱う。branch-local artifacts/dossiers は child worktree 内に置いてよい。 - push はしない。 ## 事前確認 @@ -52,17 +54,62 @@ git worktree add .worktree/ -b git -C .worktree/ sparse-checkout init --no-cone git -C .worktree/ sparse-checkout set --no-cone \ '/*' \ - '!/.yoi/' \ - '!/.yoi/**' + '!/.yoi/memory/' \ + '!/.yoi/memory/**' \ + '!/.yoi/logs/' \ + '!/.yoi/logs/**' \ + '!/.yoi/_logs/' \ + '!/.yoi/_logs/**' \ + '!/.yoi/locks/' \ + '!/.yoi/locks/**' \ + '!/.yoi/**/*.log' \ + '!/.yoi/**/*.lock' \ + '!/.yoi/**/.lock' \ + '!/.yoi/override.local.toml' \ + '!/.yoi/**/*.local' \ + '!/.yoi/**/*.local.*' \ + '!/.yoi/local/' \ + '!/.yoi/local/**' \ + '!/.yoi/runtime/' \ + '!/.yoi/runtime/**' \ + '!/.yoi/pods/' \ + '!/.yoi/pods/**' \ + '!/.yoi/sessions/' \ + '!/.yoi/sessions/**' \ + '!/.yoi/sockets/' \ + '!/.yoi/sockets/**' \ + '!/.yoi/tmp/' \ + '!/.yoi/tmp/**' \ + '!/.yoi/cache/' \ + '!/.yoi/cache/**' \ + '!/.yoi/secrets/' \ + '!/.yoi/secrets/**' \ + '!/.yoi/**/*.secret' \ + '!/.yoi/**/*.secret.*' ``` +この sparse-checkout は `.yoi` 自体を除外しない。`.yoi/memory` は generated/personal memory marker として child worktree から外す。memory root detection の実装変更はこの Workflow では扱わない。 + 確認する。 ```bash git -C .worktree/ status --short --branch -test ! -e .worktree//.yoi +test ! -e .worktree//.yoi/memory +if test -d .worktree//.yoi; then + test ! -e .worktree//.yoi/override.local.toml + test -z "$(find .worktree//.yoi \ + \( -path '*/_logs' -o -path '*/logs' -o -path '*/locks' \ + -o -path '*/local' -o -path '*/runtime' -o -path '*/pods' \ + -o -path '*/sessions' -o -path '*/sockets' -o -path '*/tmp' \ + -o -path '*/cache' -o -path '*/secrets' -o -name '*.log' \ + -o -name '*.lock' -o -name '.lock' -o -name '*.local' \ + -o -name '*.local.*' -o -name '*.secret' -o -name '*.secret.*' \) \ + -print -quit)" +fi ``` +この確認は `.yoi` project records の存在を失敗扱いしない。`.yoi/memory` と local/runtime/log/lock/secret-like paths が出ていないことを確認する。 + 失敗した場合は、worktree / branch / lock の状態を確認し、勝手に cleanup せず人間へ報告する。 ## Pod へ渡す scope @@ -89,8 +136,11 @@ reviewer は原則 write scope を持たない。review artifact を書かせる ## child worktree 内の禁止事項 -- `.yoi` を作らない / コピーしない。 -- main workspace の `TODO.md` / `tickets/` / `docs/report/` を編集しない。 +- `.yoi/memory` を作らない / コピーしない / 復元しない。 +- local overrides、runtime sockets/state、Pod session mirrors、cache/tmp、logs、locks、secret-like files を作らない / コピーしない / commit しない。 +- main workspace の `TODO.md` / `tickets/` / `docs/report/` / `.yoi` を編集しない。 +- active orchestration progress と最終 review/approval/close を child worktree 内だけで完結させない。 +- 実装対象に必要な tracked `.yoi` project records、branch-local artifacts / dossiers / docs/report は child worktree 内で扱ってよい。 - merge / push / branch deletion / worktree remove をしない。 - scope / permission / history persistence / prompt context 加工原則に関わる設計変更を無断で行わない。 diff --git a/crates/client/src/ticket_role.rs b/crates/client/src/ticket_role.rs index 01ed8c2a..10fd3f4e 100644 --- a/crates/client/src/ticket_role.rs +++ b/crates/client/src/ticket_role.rs @@ -548,9 +548,9 @@ fn append_orchestrator_agent_routing_guidance(out: &mut String) { out.push_str("\nOrchestrator worktree + agent routing guidance:\n"); out.push_str("- Treat `ticket-orchestrator-routing` as the routing gate. Read the Ticket and workspace state first; `ready -> queued` authorizes routing, not implementation side effects.\n"); out.push_str("- Create worktrees or spawn coder/reviewer Pods only after `workflow_state = inprogress` is already recorded and accepted. If the Ticket is still queued and unblocked, record `queued -> inprogress` before any worktree/SpawnPod side effect.\n"); - out.push_str("- Use `worktree-workflow` for the mechanical worktree plan: create `.worktree/`, exclude `.yoi` from the child worktree, and keep the main workspace as the authority for Ticket, workflow, docs, and memory records.\n"); + out.push_str("- Use `worktree-workflow` for the mechanical worktree plan: create `.worktree/`, keep tracked `.yoi` project records visible in the child worktree, exclude `.yoi/memory` plus local/runtime/log/lock/secret-like `.yoi` paths, and keep active orchestration progress plus final review/approval/close in the main workspace unless explicitly designed otherwise.\n"); out.push_str("- Use `multi-agent-workflow` for the sibling loop: coder and reviewer are siblings under this Orchestrator; coder gets narrow write scope to the child worktree; reviewer is read-only by default.\n"); - out.push_str("- Give the coder an intent packet, child worktree/branch, validation commands, and report expectations; require Bash commands to `cd` into the child worktree and prohibit editing main-workspace `.yoi`/Ticket/workflow/docs records.\n"); + out.push_str("- Give the coder an intent packet, child worktree/branch, validation commands, and report expectations; require Bash commands to `cd` into the child worktree, prohibit editing main-workspace `.yoi`/Ticket/workflow/docs records, and prohibit creating generated memory/local/runtime/secret-like files in the child worktree.\n"); out.push_str("- Give the reviewer the Ticket intent, diff/commits, validation evidence, and blocker/non-blocker criteria; keep branch-local reviewer verdicts in the review report or merge-ready dossier rather than recording them as final main-branch Ticket approval.\n"); out.push_str("- Ticket thread progress may record worktree plan, coder delegated/completed/blocked, reviewer delegated, blocker/fix-loop summaries, and merge-ready dossier pointer; do not merge, close, or record final main approval in this routing/branch-review phase.\n"); out.push_str("- Stop at a merge-ready dossier for `orchestrator-merge-completion` containing Ticket id/slug, branch/worktree, commits, intent/invariant check, implementation summary, coder/reviewer Pods, blockers fixed or rejected findings with reasons, validation performed, residual risks, dirty state, and parent/human decision needs if any.\n"); @@ -567,7 +567,8 @@ fn append_orchestrator_agent_routing_guidance(out: &mut String) { fn append_coder_agent_routing_guidance(out: &mut String) { out.push_str("\nCoder worktree routing guidance:\n"); - out.push_str("- Implement only in the provided child worktree/branch. Use `cd ` before Bash commands and do not edit main-workspace `.yoi`, Ticket, workflow, docs, or memory records.\n"); + out.push_str("- Implement only in the provided child worktree/branch. Use `cd ` before Bash commands and do not edit main-workspace `.yoi`, Ticket, workflow, docs, or memory records; child-worktree `.yoi` project records may be visible when they are part of the branch.\n"); + out.push_str("- Do not create `.yoi/memory`, local/runtime state, logs, locks, caches, sockets, or secret-like files in the child worktree.\n"); out.push_str("- Treat the intent packet, invariants, non-goals, validation expectations, and report expectations as the contract. Escalate to Orchestrator rather than expanding scope when design, permission, history, prompt-context, dependency, or Ticket-boundary questions appear.\n"); out.push_str("- Report worktree path, branch, commits/status, changed files, implementation summary, validation run, unresolved notes, and whether the branch is ready for external review. Do not merge, push, close Tickets, or delete worktrees.\n"); } @@ -1077,6 +1078,12 @@ workflow = "ticket-review-workflow" assert!(orchestrator_text.contains("cargo check --workspace --all-targets")); assert!(orchestrator_text.contains("workflow_state = inprogress")); assert!(orchestrator_text.contains("worktree-workflow")); + assert!(orchestrator_text.contains("keep tracked `.yoi` project records visible")); + assert!(orchestrator_text.contains("exclude `.yoi/memory`")); + assert!( + orchestrator_text + .contains("prohibit creating generated memory/local/runtime/secret-like files") + ); assert!(orchestrator_text.contains("multi-agent-workflow")); assert!(orchestrator_text.contains("coder and reviewer are siblings")); assert!(orchestrator_text.contains("branch-local reviewer verdicts")); @@ -1097,6 +1104,8 @@ workflow = "ticket-review-workflow" assert!(coder_text.contains("cargo test -p client ticket_role")); assert!(coder_text.contains("provided child worktree/branch")); assert!(coder_text.contains("do not edit main-workspace `.yoi`")); + assert!(coder_text.contains("child-worktree `.yoi` project records may be visible")); + assert!(coder_text.contains("Do not create `.yoi/memory`")); assert!(coder_text.contains("Do not merge, push, close Tickets, or delete worktrees")); let mut reviewer = TicketRoleLaunchContext::new(temp.path(), TicketRole::Reviewer); diff --git a/crates/tui/src/multi_pod.rs b/crates/tui/src/multi_pod.rs index b5a24d94..21122d94 100644 --- a/crates/tui/src/multi_pod.rs +++ b/crates/tui/src/multi_pod.rs @@ -1539,7 +1539,7 @@ fn orchestrator_queue_notification_message( ) -> String { let title = ticket.title.replace(['\r', '\n'], " "); format!( - "Workspace panel Queue for Ticket `{}` (`{}`), title `{}`: human authorized Orchestrator routing; this is not an unattended scheduler. Read the Ticket and inspect current workspace state. If unblocked, record routing and transition workflow_state queued -> inprogress before any worktree/SpawnPod implementation side effects. After inprogress acceptance, use worktree-workflow for `.worktree/` creation with `.yoi` excluded, then use multi-agent-workflow to run sibling coder/reviewer Pods (coder narrow child-worktree write scope, reviewer read-only by default) and stop at a merge-ready dossier without merge/close/final approval. If blocked, record a concise reason and leave the Ticket queued or explicitly defer it.", + "Workspace panel Queue for Ticket `{}` (`{}`), title `{}`: human authorized Orchestrator routing; this is not an unattended scheduler. Read the Ticket and inspect current workspace state. If unblocked, record routing and transition workflow_state queued -> inprogress before any worktree/SpawnPod implementation side effects. After inprogress acceptance, use worktree-workflow for `.worktree/` creation with tracked `.yoi` project records visible and `.yoi/memory` plus local/runtime/log/lock/secret-like `.yoi` paths excluded, then use multi-agent-workflow to run sibling coder/reviewer Pods (coder narrow child-worktree write scope, reviewer read-only by default) and stop at a merge-ready dossier without merge/close/final approval. If blocked, record a concise reason and leave the Ticket queued or explicitly defer it.", ticket.slug, ticket.id, title.trim() @@ -2598,7 +2598,10 @@ mod tests { assert!(message.contains("After inprogress acceptance")); assert!(message.contains("worktree-workflow")); assert!(message.contains("`.worktree/`")); - assert!(message.contains("`.yoi` excluded")); + assert!(message.contains("tracked `.yoi` project records visible")); + assert!(message.contains( + "`.yoi/memory` plus local/runtime/log/lock/secret-like `.yoi` paths excluded" + )); assert!(message.contains("multi-agent-workflow")); assert!(message.contains("sibling coder/reviewer Pods")); assert!(message.contains("coder narrow child-worktree write scope"));