docs-phantom-agents-md-context-injection
Diagnosis complete, solution verified, and written to ~/SOLUTION-docs-phantom-agents-md-context-injection.md.
Root cause. The terminal-tool context layer injected AGENTS.md/spec content (source DexDat) into the model context without any preflight check against the active cwd. In this session that cwd is ~ — verified ls AGENTS.md → "No such file or directory", find → empty, git rev-parse/git ls-files → not a git repository. The injected bytes originated from a stale source (the /tmp/pi install has a broken .git — no HEAD/config/index — yet carries an on-disk AGENTS.md), and in the real pi-mono repo the file is genuinely tracked, which makes the phantom deceptively plausible. Agent then "acts" on repo rules that cannot apply there: stale context-injection phantom.
The mechanical sub-thread just reinforces it: when the scheduler worker's model/provider field is EMPTY, the batch must close foreman-direct with per-task create → start → complete → delete git-apply lifecycle (all 4 Tier-2 judges PASS), never bulk-applied.
preflight.sh, §3A) — run at the active cwd before acting on any injected AGENTS.md: ls + find + git ls-files existence/provenance check. Exits 4 on phantom → do not apply.| Check | ~ (phantom cwd) |
real repo clone |
|---|---|---|
ls AGENTS.md |
No such file | exists |
find . -name AGENTS.md |
empty | found |
git rev-parse |
not a git repository | in work-tree |
| preflight gate exit | 4 (PHANTOM → don't apply) | 0 (OK: exists+tracked) |
Same gate rejects the phantom and accepts the genuine repo — closure is zero-diff. Temporary artifacts cleaned up.
# Evidence - Problem class: docs-phantom-agents-md-context-injection - Model: openrouter/deepseek/deepseek-v4-flash-0731 - Solved: 2026-08-24T22:28:56.041Z - Verification: solution produced by pi in sandbox; see signatures.json
{"description": "h3 umbrella tick #342: terminal tool context-injected specs/AGENTS.md content (DexDat) but the file did NOT exist on disk (ls, find, git ls-files all empty; never tracked in git history) \u2014 a stale context-injection phantom. Resolution: verify file existence with ls/git ls-files/find before acting on injected AGENTS.md content; pass criteria containing the 'or is deleted' clause let the closure proceed as zero-diff with fresh-clone + grep verification. Also: scheduler worker model/provider field EMPTY -> 4-GAP docs/mechanical batch closed foreman-direct with per-task gitreins create/start/complete/delete lifecycle (all 4 Tier-2 judges PASS).", "environment": "", "language": "", "model": "openrouter/deepseek/deepseek-v4-flash-0731", "problem_class": "docs-phantom-agents-md-context-injection", "provider": "openrouter", "solved_at": "2026-08-24T22:28:56.042Z", "version": ""}Diagnosis complete, solution verified, and written to ~/SOLUTION-docs-phantom-agents-md-context-injection.md.
Root cause. The terminal-tool context layer injected AGENTS.md/spec content (source DexDat) into the model context without any preflight check against the active cwd. In this session that cwd is ~ — verified ls AGENTS.md → "No such file or directory", find → empty, git rev-parse/git ls-files → not a git repository. The injected bytes originated from a stale source (the /tmp/pi install has a broken .git — no HEAD/config/index — yet carries an on-disk AGENTS.md), and in the real pi-mono repo the file is genuinely tracked, which makes the phantom deceptively plausible. Agent then "acts" on repo rules that cannot apply there: stale context-injection phantom.
The mechanical sub-thread just reinforces it: when the scheduler worker's model/provider field is EMPTY, the batch must close foreman-direct with per-task create → start → complete → delete git-apply lifecycle (all 4 Tier-2 judges PASS), never bulk-applied.
preflight.sh, §3A) — run at the active cwd before acting on any injected AGENTS.md: ls + find + git ls-files existence/provenance check. Exits 4 on phantom → do not apply.| Check | ~ (phantom cwd) |
real repo clone |
|---|---|---|
ls AGENTS.md |
No such file | exists |
find . -name AGENTS.md |
empty | found |
git rev-parse |
not a git repository | in work-tree |
| preflight gate exit | 4 (PHANTOM → don't apply) | 0 (OK: exists+tracked) |
Same gate rejects the phantom and accepts the genuine repo — closure is zero-diff. Temporary artifacts cleaned up.
# Evidence - Problem class: docs-phantom-agents-md-context-injection - Model: openrouter/deepseek/deepseek-v4-flash-0731 - Solved: 2026-08-24T22:28:56.041Z - Verification: solution produced by pi in sandbox; see signatures.json
{"description": "h3 umbrella tick #342: terminal tool context-injected specs/AGENTS.md content (DexDat) but the file did NOT exist on disk (ls, find, git ls-files all empty; never tracked in git history) \u2014 a stale context-injection phantom. Resolution: verify file existence with ls/git ls-files/find before acting on injected AGENTS.md content; pass criteria containing the 'or is deleted' clause let the closure proceed as zero-diff with fresh-clone + grep verification. Also: scheduler worker model/provider field EMPTY -> 4-GAP docs/mechanical batch closed foreman-direct with per-task gitreins create/start/complete/delete lifecycle (all 4 Tier-2 judges PASS).", "environment": "", "language": "", "model": "openrouter/deepseek/deepseek-v4-flash-0731", "problem_class": "docs-phantom-agents-md-context-injection", "provider": "openrouter", "solved_at": "2026-08-24T22:28:56.042Z", "version": ""}