Bug
When updating the main agent identity or soul via the Settings UI, the files are written to data_dir/IDENTITY.md and data_dir/SOUL.md (root) instead of data_dir/agents/main/IDENTITY.md and data_dir/agents/main/SOUL.md.
However, both load_identity_for_agent("main") and load_soul_for_agent("main") check agents/main/ first and only fall back to root. So if the agent-level files already exist, the settings updates are silently ignored at runtime.
Root Cause
IDENTITY.md
The call chain for the main agent identity update:
- Settings UI (
identity-utils.js) calls updateIdentity(fields, { agentId: "main" })
- This sends RPC
agents.identity.update with agent_id: "main"
- If that fails (method not found fallback), it sends
agent.identity.update without agent_id
agent.identity.update handler (services.rs:322-330): for main agent, delegates to onboarding.identity_update()
onboarding.identity_update() (service.rs:271): calls moltis_config::save_identity(&identity) — writes to root data_dir/IDENTITY.md
But load_identity_for_agent("main") (loader.rs:374-380) reads from agents/main/IDENTITY.md first and only falls back to root:
pub fn load_identity_for_agent(agent_id: &str) -> Option<AgentIdentity> {
if agent_id == "main" {
let main_path = agent_workspace_dir("main").join("IDENTITY.md");
if let Some(identity) = load_identity_from_path(&main_path) {
return Some(identity);
}
return load_identity(); // fallback to root
}
// ...
}
SOUL.md (same pattern)
The save path for soul updates:
- Settings UI calls
agent.identity.update_soul
identity_update_soul() (service.rs:295): calls moltis_config::save_soul() — writes to root data_dir/SOUL.md
But load_soul_for_agent("main") (loader.rs:515-523) reads from agents/main/SOUL.md first:
pub fn load_soul_for_agent(agent_id: &str) -> Option<String> {
if agent_id == "main" {
let main_path = agent_workspace_dir("main").join("SOUL.md");
if let Some(soul) = load_workspace_markdown(main_path) {
return Some(soul);
}
return load_soul(); // fallback to root
}
// ...
}
Meanwhile, save_soul() writes to soul_path() which is data_dir()/SOUL.md (root).
Consequence
- Both root
IDENTITY.md and SOUL.md should not be primary write targets for the main agent
- If
agents/main/ versions exist, any changes through onboarding or the settings page are invisible
- The UI string "Saved to IDENTITY.md in your workspace root" is misleading
Suggested Fix
IDENTITY.md
In crates/onboarding/src/service.rs, both at line 110 and line 271, replace:
moltis_config::save_identity(&ws.identity)
with:
moltis_config::save_identity_for_agent("main", &ws.identity)
SOUL.md
In crates/onboarding/src/service.rs line 295, the identity_update_soul() method should call a new save_soul_for_agent("main", soul) function (analogous to save_identity_for_agent) that writes to agents/main/SOUL.md instead of root.
Alternatively, save_soul() could be updated to always write to the agent workspace when the agent_id is known.
The root files can remain as legacy fallbacks for installations that do not yet have agents/main/ versions.
Steps to Reproduce
- Ensure
data_dir/agents/main/IDENTITY.md and data_dir/agents/main/SOUL.md exist
- Edit agent name or soul text via Settings UI
- Observe root-level files are updated, but agent-level files are unchanged
- Runtime continues using the old agent-level files
Bug
When updating the main agent identity or soul via the Settings UI, the files are written to
data_dir/IDENTITY.mdanddata_dir/SOUL.md(root) instead ofdata_dir/agents/main/IDENTITY.mdanddata_dir/agents/main/SOUL.md.However, both
load_identity_for_agent("main")andload_soul_for_agent("main")checkagents/main/first and only fall back to root. So if the agent-level files already exist, the settings updates are silently ignored at runtime.Root Cause
IDENTITY.md
The call chain for the main agent identity update:
identity-utils.js) callsupdateIdentity(fields, { agentId: "main" })agents.identity.updatewithagent_id: "main"agent.identity.updatewithout agent_idagent.identity.updatehandler (services.rs:322-330): for main agent, delegates toonboarding.identity_update()onboarding.identity_update()(service.rs:271): callsmoltis_config::save_identity(&identity)— writes to rootdata_dir/IDENTITY.mdBut
load_identity_for_agent("main")(loader.rs:374-380) reads fromagents/main/IDENTITY.mdfirst and only falls back to root:SOUL.md (same pattern)
The save path for soul updates:
agent.identity.update_soulidentity_update_soul()(service.rs:295): callsmoltis_config::save_soul()— writes to rootdata_dir/SOUL.mdBut
load_soul_for_agent("main")(loader.rs:515-523) reads fromagents/main/SOUL.mdfirst:Meanwhile,
save_soul()writes tosoul_path()which isdata_dir()/SOUL.md(root).Consequence
IDENTITY.mdandSOUL.mdshould not be primary write targets for the main agentagents/main/versions exist, any changes through onboarding or the settings page are invisibleSuggested Fix
IDENTITY.md
In
crates/onboarding/src/service.rs, both at line 110 and line 271, replace:with:
SOUL.md
In
crates/onboarding/src/service.rsline 295, theidentity_update_soul()method should call a newsave_soul_for_agent("main", soul)function (analogous tosave_identity_for_agent) that writes toagents/main/SOUL.mdinstead of root.Alternatively,
save_soul()could be updated to always write to the agent workspace when the agent_id is known.The root files can remain as legacy fallbacks for installations that do not yet have
agents/main/versions.Steps to Reproduce
data_dir/agents/main/IDENTITY.mdanddata_dir/agents/main/SOUL.mdexist