Whether the working tree carries changes beyond the Git HEAD (unstaged or untracked content) — the CB-12A follow-up exact-separability oracle. A clean worktree at the boundary means the turn's recorded content equals the commit tree exactly (no remainder), so the verified capture's HEAD→index delta IS the recorded delta. Read-only; any git failure is conservatively a remainder (never claims exactn
(repo_root: &Path)
| 917 | /// HEAD→index delta IS the recorded delta. Read-only; any git failure is |
| 918 | /// conservatively a remainder (never claims exactness). |
| 919 | fn worktree_has_remainder(repo_root: &Path) -> bool { |
| 920 | let Ok(output) = std::process::Command::new("git") |
| 921 | .args(["status", "--porcelain"]) |
| 922 | .current_dir(repo_root) |
| 923 | .output() |
| 924 | else { |
| 925 | return true; |
| 926 | }; |
| 927 | if !output.status.success() { |
| 928 | return true; |
| 929 | } |
| 930 | // Atomic-owned state (.atomic/, .vault/) is never content remainder. |
| 931 | let stdout = String::from_utf8_lossy(&output.stdout).into_owned(); |
| 932 | let remainder_lines: Vec<&str> = stdout |
| 933 | .lines() |
| 934 | .filter(|line| { |
| 935 | let path = line.get(3..).unwrap_or(line); |
| 936 | !(path.starts_with(".atomic/") || path.starts_with(".vault/")) |
| 937 | }) |
| 938 | .collect(); |
| 939 | !remainder_lines.is_empty() |
| 940 | } |
| 941 | |
| 942 | /// Build a `ChangeHeader` for an agent turn./// |
| 943 | /// The message is built from the file changes and prompt context: |