Can you check if the openclaw imports is also importing sub-agents, since we now have…
- User
Can you check if the openclaw imports is also importing sub-agents, since we now have subagents features
Assistant
Now let me check the types to see the OpenClaw config structure and whether there's a sub-agents concept, plus check what the "subagents" feature looks like in the moltis codebase.
Assistant
Now let me check what the "subagents" feature looks like in the moltis codebase — specifically the
spawn_agenttool and theOpenClawAgentEntryto see if OpenClaw has a sub-agents concept.Assistant
Let me look at the relevant section in
lib.rsand the subagents feature in the codebase.Assistant
So the moltis codebase does have a working sub-agent system (
crates/tools/src/spawn_agent.rs), but the openclaw import atcrates/openclaw-import/src/lib.rs:506-509still has a hardcoded TODO saying:code"Sub-agents", "OpenClaw's agent delegation/sub-agent spawning is not yet supported in Moltis.",This is outdated — Moltis now has sub-agent support via
SpawnAgenttool. Let me check what OpenClaw's sub-agent config looks like and whether the import could handle it.Assistant
Here's what I found:
The openclaw import does NOT import sub-agents, and the TODO message in
crates/openclaw-import/src/lib.rs:506-509is now outdated:rustreport.add_todo( "Sub-agents", "OpenClaw's agent delegation/sub-agent spawning is not yet supported in Moltis.", );Moltis does have sub-agent support now via
crates/tools/src/spawn_agent.rs(theSpawnAgenttool with nesting depth up to 3, delegate toolsets, agent presets, etc.). But the openclaw import still:- Doesn't parse sub-agent config from OpenClaw — the
OpenClawAgentEntrytype intypes.rshas no fields for sub-agent/delegation settings - Hardcodes a TODO telling users sub-agents aren't supported, which is no longer accurate
The import handles agents (multi-agent extraction from
agents.list[]), but that's top-level agents — not sub-agent delegation/spawning config.To fix this, the TODO message should at minimum be updated or removed, and ideally the import should map any OpenClaw sub-agent configuration to Moltis's / system. Would you like me to look into what OpenClaw's sub-agent config format looks like and update the import accordingly?
- Doesn't parse sub-agent config from OpenClaw — the
- User
Please proceed
Assistant
Let me first understand both sides — the Moltis agent preset system and what OpenClaw's sub-agent config looks like.
Assistant
Now let me check the OpenClaw docs reference for their sub-agent format.
Assistant
Now let me look at what OpenClaw actually has for sub-agents. Let me check the OpenClaw docs reference and the
AGENTS.mdworkspace file pattern.Assistant
Now I have a clear picture. Let me also check the full
AgentPresetstruct and theOpenClawAgentEntryto see what fields could map.Assistant
Now let me see how the import function continues and how the existing agents are handled in the main import, plus the
AgentIdentitytype.Assistant
Now I have the full picture. Here's the situation:
- The import extracts top-level agents from OpenClaw (multi-agent configs in
agents.list[]) and maps them into Moltis agent identities - But it does NOT create agent presets (
AgentsConfig.presets) from these non-default agents, which is what would be needed for thespawn_agenttool to delegate to them - The TODO at line 506-509 says sub-agents aren't supported, but they are — via
SpawnAgent+AgentPreset
The right fix is to:
- Convert non-default imported OpenClaw agents into Moltis
AgentPresetentries inmoltis.toml - Remove the outdated TODO
- Update the test
Let me also check how the
MoltisConfigstores the agents config.- The import extracts top-level agents from OpenClaw (multi-agent configs in
Assistant
Good.
MoltisConfig.agentsis anAgentsConfigwithpresets: HashMap<String, AgentPreset>. Now let me implement this. The plan:- In
import()inlib.rs, after extracting agents, convert non-default agents intoAgentPresetentries and persist them tomoltis.toml - Remove the "Sub-agents" TODO from
add_todos() - Update the test that asserts the TODO exists
Let me also check the
ImportedAgentfields to see what can map toAgentPreset.Looking at the mapping:
ImportedAgent.name→AgentPreset.identity.nameImportedAgent.theme→AgentPreset.identity.themeImportedAgent.moltis_id→ preset key nameOpenClawAgentEntry.model→AgentPreset.model
The agent entry also has a model field. Let me check if
import_agentspreserves the model info.- In
Assistant
The model field from
OpenClawAgentEntryisn't being extracted intoImportedAgent. Let me add it. Let me now implement the changes.Assistant
Now extract the model in
extract_from_config_list:Assistant
Now add a public function to convert imported agents to Moltis agent presets:
Assistant
Now let me check what imports we need for the preset types. The
agents.rsdoesn't depend onmoltis_configyet. Let me check the crate'sCargo.toml.Assistant
Good,
moltis-configis already a dependency. Now I'll add the conversion function inagents.rsand then updatelib.rsto use it.Assistant
Now update
lib.rsto persist the presets and remove the outdated TODO.Assistant
Now remove the outdated Sub-agents TODO:
Assistant
Now add the
persist_agent_presetsfunction. Let me place it nearpersist_identityandpersist_channels:Assistant
Now update the test that asserts the Sub-agents TODO exists:
Assistant
Now let me also check that the full import test has multi-agent data so we can verify presets are persisted. Let me find
setup_full_openclaw:Assistant
The test setup only has a single agent (
"main"), so no presets would be generated. I should add a test with multiple agents that verifies presets are created. But first let me add the non-default agent to the existing test setup to verify both the preset creation and TODO removal. Let me add a dedicated test instead.Assistant
Now let me find the end of the test module to add a new test:
Assistant
Good, I found the end of the test module at line 1176. Now let me add a test for agent preset import:
Assistant
Now let me also add a test in
agents.rsfor the newagents_to_presetsfunction and the model extraction:Assistant
Let me find the end of the agents tests:
Assistant
Now let's build and test:
Assistant
The
synthesize_from_detectionfunction also needs themodelfield. Let me fix it:Assistant
Compiles. Now let's run the tests:
Assistant
All 131 tests pass, including the 3 new ones. Let me also quickly check the rest of the codebase compiles since we changed a public struct:
Assistant
Full workspace compiles cleanly. Now let me run the formatter:
Assistant
Let me verify everything still passes:
Assistant
All 131 tests pass. Here's a summary of the changes:
crates/openclaw-import/src/agents.rs:- Added
model: Option<String>field toImportedAgentto capture per-agent model overrides from OpenClaw - Extract model from
OpenClawAgentEntry.model(supports bothSimple("model-id")andFull({primary, fallbacks})variants) - Added
agents_to_presets()function that converts non-default imported agents into MoltisAgentPresetentries (mapping name → identity.name, theme → identity.theme, model → model) - Added tests:
import_agents_extracts_model,agents_to_presets_skips_default
crates/openclaw-import/src/lib.rs:- After agent extraction in
import(), callagents_to_presets()and persist results tomoltis.tomlvia newpersist_agent_presets()function persist_agent_presets()merges with existing presets without overwriting (re-imports are safe)- Removed the outdated "Sub-agents not supported" TODO from
- Added
- User
Anything else to add?
Assistant
The docs should be updated to reflect this — CLAUDE.md requires keeping docs in sync with code changes. Let me check what needs updating.
Assistant
Two things to update:
- Add a row to the "What Gets Imported" table for sub-agent presets
- Update the "Multi-agent support" section to mention preset creation
Assistant
That covers it. The docs now reflect the new behavior, and the idempotency section already covers presets (existing ones are preserved on re-import). Nothing else to add.
- User
Did you add a test to test subagent imports?
Assistant
Yes — there are 4 new tests across two files:
crates/openclaw-import/src/agents.rs:import_agents_extracts_model— verifies the model field is extracted fromOpenClawAgentEntryagents_to_presets_skips_default— verifies only non-default agents become presets, with correct name/theme/model mapping
crates/openclaw-import/src/lib.rs:import_creates_agent_presets_for_non_default_agents— end-to-end: multi-agent OpenClaw config → presets persisted tomoltis.tomlimport_does_not_overwrite_existing_presets— idempotency: existing user-customized presets are preserved on re-import
These test the conversion logic, the persistence, and the merge behavior. Is there a specific scenario you'd like covered that isn't here?
- User
commit and push
Assistant
Pushed. The dependabot alerts are pre-existing and unrelated to this change.