substituteTree(<configRoot>) rewrites the engine's own IDENTITY_PLACEHOLDERS table, and the Doctor fixCmd for #1813 is the command that does it
Follow-up to #1828 (payload guard) and #1813 (the new identity-placeholders probe). Both fixes are correct as far as they go. This is the gap between them.
Summary
The #1828 guard stops substituteTree from walking into skills/LifeOS/install/. It does not stop it from walking into skills/LifeOS/Tools/, where InstallEngine.ts holds the literal placeholder strings as source data:
const IDENTITY_PLACEHOLDERS = [
"{{DA_NAME}}", "{{DA_FULL_NAME}}", "{{PRINCIPAL_NAME}}", "{{PRINCIPAL_FULL_NAME}}",
"{{PRIMARY_VOICE_ID}}", "{{SECONDARY_VOICE_ID}}", "{{LIFEOS_VERSION}}",
] as const;
.ts is in TEMPLATE_EXTENSIONS, so running the documented substituteTree(<configRoot>, vars) rewrites that array in place. With a DA named Aria and a principal named Sam, it becomes:
const IDENTITY_PLACEHOLDERS = [
"Aria", "Aria", "Sam", "Sam",
"<primary-voice-id>", "<secondary-voice-id>", "7.40.4",
] as const;
The engine now searches for the principal's rendered name as though it were an unrendered placeholder. Workflows/Setup.md is corrupted the same way, since it is prose about the tokens.
Why this matters more in 7.40.4 than before
Two documented callers now tell a user to run exactly this command.
Setup.mdstep 9(d): "run the substitution pass the step-4 pass could not reach,substituteTree(<configRoot>, vars)over the deployed tree, thencheckSurvivingPlaceholders(<configRoot>)and requirepassed: true."- The new Doctor probe's own
fixCmd, shipped in 7.40.4 for #1813:
fixCmd: 'bun -e \'import {substituteTree} from "<configRoot>/skills/LifeOS/Tools/InstallEngine.ts"; ...\' — re-run Setup.md step 9d substitution',
So the remediation offered for a failing identity-placeholders probe is the command that corrupts the table the probe depends on.
The resulting failure loop
After corruption, checkSurvivingPlaceholders searches model-facing surfaces for the literal strings Sam and Aria. Those appear everywhere by design, because substitution just put them there. The probe therefore reports a large false failure:
Aria x2 <configRoot>/settings.json
Sam x1 <configRoot>/agents/GrokResearcher.md
Aria x6 <configRoot>/agents/Forge.md
...
A user reading that failure follows fixCmd, re-runs substituteTree, and the state does not improve. The probe stays red, and the suggested fix cannot clear it.
Secondary: the guard is asymmetric
entry.name === "install" appears exactly once in InstallEngine.ts, in substituteTree's walker at line 458. checkSurvivingPlaceholders has no equivalent, so a literal reading of Setup 9(d), checkSurvivingPlaceholders(<configRoot>) requiring passed: true, can never pass on a correctly substituted install. It reports the payload's own generic templates as survivors.
gh api "repos/danielmiessler/LifeOS/contents/LifeOS/Tools/InstallEngine.ts?ref=v7.40.4" \
--jq '.content' | base64 -d | grep -c 'entry.name === "install"'
# => 1
The Doctor probe sidesteps this correctly by passing seven narrow model-facing roots instead of configRoot, and its comment explains why. Setup.md still documents the whole-tree call.
Suggested fix
- Exclude the engine's own source from substitution. Skipping
skills/LifeOS/entirely (not justskills/LifeOS/install/) is the smallest change and matches intent: the installer must stay generic in every part, not only its redistribution copy. - Give
checkSurvivingPlaceholdersthe same skip assubstituteTree, so the two walkers agree. The docstring already asserts they share a traversal, which stopped being true when the #1828 guard landed on one side. - Update Setup 9(d) to document the narrow-root form the Doctor probe uses, rather than a whole-
configRootcall that cannot pass.
Reproduction
# from a working install, run the documented step 9(d) call, then:
grep -A3 "const IDENTITY_PLACEHOLDERS" <configRoot>/skills/LifeOS/Tools/InstallEngine.ts
# expected: the array now holds rendered values instead of {{TOKEN}} strings
Recovery is a file copy from the pristine payload, which the #1828 guard keeps clean:
cp <configRoot>/skills/LifeOS/install/skills/LifeOS/Tools/InstallEngine.ts \
<configRoot>/skills/LifeOS/Tools/InstallEngine.ts
cp <configRoot>/skills/LifeOS/install/skills/LifeOS/Workflows/Setup.md \
<configRoot>/skills/LifeOS/Workflows/Setup.md
Environment
macOS 26.6.1, Claude Code harness, configRoot ~/.claude, upgraded 7.28.3 to 7.40.4. Both files verified byte-identical to the pristine payload copies after recovery.
Fixed in source: both walkers now share one skip covering the installer's own Tools and Workflows (the engine can no longer rewrite its own placeholder table), checkSurvivingPlaceholders got the same guard so the pair agree again, and Doctor's fixCmd points at the narrow-roots invocation its own probe uses instead of the command that corrupted the table (skills/LifeOS/Tools/InstallEngine.ts, LIFEOS/TOOLS/Doctor.ts). The remediation-that-breaks-the-probe loop you traced was the sharpest finding in this cluster. Thanks.