Summary
After the #60 prompt migration moves agent.build.prompt → top-level instructions[], the now-empty agent.build / agent.plan blocks (containing only mode + model) are intentionally preserved. Those default-equivalent shells then prevent dm-agent-sync.ts from registering DM agent prompts into build/plan, so new sessions launch as the bare build agent without AGENTS.md, SOUL.md, MEMORY.md, etc.
Repro
- Fresh install of wp-coding-agents 0.8.1 with
--chat-bridge=kimaki on a site with multiple DM agents.
- Inspect the generated
opencode.json. (On this VPS — /var/www/extrachill.com/opencode.json — it contained:)
"agent": {
"build": { "mode": "primary", "model": "anthropic/claude-opus-4-7" },
"plan": { "mode": "primary", "model": "anthropic/claude-opus-4-7" }
}
- Start a Kimaki session in that project.
- Ask the agent what's in its system prompt. It will not be aware of
AGENTS.md, SOUL.md, MEMORY.md, or the WordPress runtime / Data Machine handoff sections that dm-context-filter injects.
Root cause
lib/repair-opencode-json.py::apply_prompt_migration (lines 190–221) deliberately leaves agent.build / agent.plan in place after stripping prompt:
# Clean up empty dicts.
for sub in ("build", "plan"):
if sub in agent and isinstance(agent[sub], dict) and not agent[sub]:
pass # keep mode/model keys
Combined with dm-agent-sync.ts line 129:
if (config.agent.build && config.agent.plan && agents.length === 1) {
// ... only updates prompt for the single-agent case
}
…multi-agent installs (10 agents on this site) skip the prompt-injection branch entirely. The orphaned shells "win" because they look like user config to the plugin, even though they only carry default-equivalent keys.
Why it matters
This is the second-order regression of #60. The original fix correctly moved memory loading out of agent.build.prompt (preserving Claude Max OAuth), but didn't reconcile that agent.build / agent.plan entries with only mode + model are now no-ops at best and footguns at worst. They serve no purpose — mode: primary and the top-level model are already the OpenCode defaults.
Result on this VPS: every Kimaki session for a month has launched without AGENTS.md in context, despite the file being 9.7 KB of curated Data Machine / Homeboy / Extra Chill CLI documentation.
Proposed fix
In apply_prompt_migration (or a new clean_orphaned_agents step), after stripping prompt, also remove the build / plan entries entirely if they only contain default-equivalent keys (mode: primary and/or a model that matches the top-level model):
top_model = data.get("model")
for sub in ("build", "plan"):
block = agent.get(sub)
if not isinstance(block, dict):
continue
keys = set(block.keys())
is_default_only = keys <= {"mode", "model"} and \
block.get("mode", "primary") == "primary" and \
block.get("model", top_model) == top_model
if is_default_only:
del agent[sub]
if not agent:
data.pop("agent", None)
runtime_generate_config() in runtimes/opencode.sh should also stop emitting these blocks for new installs — they're already removed from runtime_generate_config per #60, but this needs a confirmation pass.
Test plan
Related
Environment
- wp-coding-agents
0.8.1 (commit b7e5acb)
- VPS:
/var/www/extrachill.com, 10 DM agents, Kimaki bridge
- Discovered while investigating why an OpenCode session was not aware of the project's
AGENTS.md
Summary
After the #60 prompt migration moves
agent.build.prompt→ top-levelinstructions[], the now-emptyagent.build/agent.planblocks (containing onlymode+model) are intentionally preserved. Those default-equivalent shells then preventdm-agent-sync.tsfrom registering DM agent prompts intobuild/plan, so new sessions launch as the barebuildagent withoutAGENTS.md,SOUL.md,MEMORY.md, etc.Repro
--chat-bridge=kimakion a site with multiple DM agents.opencode.json. (On this VPS —/var/www/extrachill.com/opencode.json— it contained:)AGENTS.md,SOUL.md,MEMORY.md, or the WordPress runtime / Data Machine handoff sections thatdm-context-filterinjects.Root cause
lib/repair-opencode-json.py::apply_prompt_migration(lines 190–221) deliberately leavesagent.build/agent.planin place after strippingprompt:Combined with
dm-agent-sync.tsline 129:…multi-agent installs (10 agents on this site) skip the prompt-injection branch entirely. The orphaned shells "win" because they look like user config to the plugin, even though they only carry default-equivalent keys.
Why it matters
This is the second-order regression of #60. The original fix correctly moved memory loading out of
agent.build.prompt(preserving Claude Max OAuth), but didn't reconcile thatagent.build/agent.planentries with onlymode+modelare now no-ops at best and footguns at worst. They serve no purpose —mode: primaryand the top-levelmodelare already the OpenCode defaults.Result on this VPS: every Kimaki session for a month has launched without
AGENTS.mdin context, despite the file being 9.7 KB of curated Data Machine / Homeboy / Extra Chill CLI documentation.Proposed fix
In
apply_prompt_migration(or a newclean_orphaned_agentsstep), after strippingprompt, also remove thebuild/planentries entirely if they only contain default-equivalent keys (mode: primaryand/or amodelthat matches the top-levelmodel):runtime_generate_config()inruntimes/opencode.shshould also stop emitting these blocks for new installs — they're already removed fromruntime_generate_configper #60, but this needs a confirmation pass.Test plan
opencode.jsonwithagent: { build: { mode, model }, plan: { mode, model } }→--additiveremoves the orphaned blocks, prompt migration unchanged.agent.build(e.g. with customtoolsor non-defaultmode) → preserved untouched.AGENTS.md+ agent identity files viadm-agent-sync.Related
dm-agent-sync.tsuser-override detection (link will follow)Environment
0.8.1(commitb7e5acb)/var/www/extrachill.com, 10 DM agents, Kimaki bridgeAGENTS.md