Skip to content

Memory: Subagent Model/Effort pins give every subagent its own kiro-cli + 3 Python MCP servers (~0.55 GB each) #23484

Closed

Description

@l3aki

Summary

On a 16 GB Mac, KiroCrew 0.9.0 reached ≈ 8.7 GB with a few chats open and 4 subagents running: 10 kiro-cli-chat and 29 python3.12 processes. macOS went into swap, KiroCrew's own resource check reported memory pressure WARN and warned that new subagents may queue, and both the Mac and KiroCrew became hard to use. On 16 GB machines this makes KiroCrew close to unusable whenever subagents run.

The biggest avoidable part: when Subagent Model or Subagent Effort is set (Settings → Chat → Models), every subagent skips session sharing. Each one starts its own kiro-cli-chat plus its own mcp-core, mcp-cron and mcp-computer Python servers: ≈ 0.55 GB per subagent. Nothing in the UI says so. Without a pin, subagents multiplex onto their parent's runtime and add no process (as PR #15325 also notes).

Measurements

Activity Monitor "Memory" (physical footprint) at the peak:

Process Count Each Total
kiro-cli-chat acp 10 220–260 MB ≈ 2.4 GB
python3.12 -m kiro_crew mcp-core 8 105–145 MB ≈ 0.9 GB
python3.12 -m kiro_crew mcp-cron 8 ≈ 100 MB ≈ 0.8 GB
python3.12 -m kiro_crew mcp-computer 8 ≈ 100 MB ≈ 0.8 GB
Gateway python3.12 1 2.75 GB 2.75 GB
Electron renderer + helpers 5 – ≈ 1.0 GB
Other Python helpers (path resolver, multiprocessing) 4 9–74 MB ≈ 0.1 GB
KiroCrew total ≈ 8.7 GB

Host at the same moment: 12.17 GB of 16 GB used, 4.17 GB compressed, 2.41 GB swap.

  • 8 of the 10 runtimes had their own MCP trio. At least 4 of them were subagents (cwd ~/workplace/kirocrew-workspace/subagent_<id>).
  • One runtime costs ≈ 0.55 GB: kiro-cli-chat ≈ 236 MB + mcp-core ≈ 115 MB + mcp-cron ≈ 100 MB + mcp-computer ≈ 100 MB.
  • The 4 subagents alone cost ≈ 2.2 GB.
  • This is not a leak. Every MCP process had a live parent, and each subagent's process tree exited when the subagent finished.

Root cause

  1. A role pin turns off sharing for every subagent. _sharing_plan_impl in src/kiro_crew/subagent_manager/run.py:

    eff_model = info.model or _subagent_default_model(cfg)
    eff_effort = info.reasoning_effort or _subagent_default_effort(cfg)
    shared = (
        kind == "template"
        and not info.keep
        and not (eff_model or eff_effort)
        and self._manager._should_use_session_sharing(info)
    )

    _subagent_default_model / _subagent_default_effort read agent.role_models["subagent"] / agent.role_efforts["subagent"]. So a global setting, not only a per-spawn model / reasoning_effort, sends every subagent down the dedicated-process path.

  2. Every dedicated runtime brings its own managed MCP servers. A default install runs no MCP broker: mcp_gateway.enabled is false and stub_servers is [] (Share Kiro Crew's managed MCP servers by default (RFC #19611 Phase 1) #20217 is parked, PR feat(mcp-gateway): share the ten managed servers by default #20218 was closed). Even with the broker on, kirocrew-computer is not shared by default (perf(mcp-gateway): share Crew's caller-aware servers via stub #19565).

  3. The cost is invisible to the user (UX problem). The settings only say "'Auto' lets the provider pick — it does not inherit your Default Model. Pin a model to run this work on it." and "Applies only on reasoning-capable models…". The role_models field doc even recommends it: "Pin a cheaper model here to run background / sub-agent work on it…". A setting meant to save credits silently adds ≈ 0.55 GB per subagent. As KiroCrew uses 5+ GB RAM for one chat, making it impractical on 16 GB Macs #5033 notes, the dashboard has no view of KiroCrew's own memory, so the user only finds out in Activity Monitor.

Steps to reproduce

  1. Settings → Chat → Models: set Subagent Model to any model, or Subagent Effort to any level.
  2. In one chat, start 4 subagents with one spawn_run(tasks=[...]) call.
  3. Activity Monitor: 4 new kiro-cli-chat processes appear, each with its own mcp-core, mcp-cron and mcp-computer children (≈ 0.55 GB each). They exit when the subagents finish.

Workaround (from the code, not re-measured): set both settings back to Auto / Model default. Subagents then share the parent's runtime, but run on the chat's model and effort, so the credit saving is lost.

Expected

A model or effort pin should not cost a full runtime per subagent. Four subagents with the same pin should not add ≈ 2.2 GB.

Proposed fixes

  1. One runtime per pin, not per subagent. Key the dedicated runtime by (backend, agent, model, effort) and multiplex every subagent with the same pin onto it, for example through RuntimeOwnership.acquire's compatibility key from the feat(acp): let eligible chat sessions share one runtime behind a cap #15325 series. Here that is 1 process instead of 4 (≈ 1.6 GB saved). If kiro-cli can set model and effort per ACP session, apply the pin on the parent's runtime instead and add no process at all.
  2. Share the managed MCP servers by default (Share Kiro Crew's managed MCP servers by default (RFC #19611 Phase 1) #20217), at least inside dedicated subagent runtimes, and start kirocrew-computer only on the first computer_* call (related: No way to defer an MCP server's backend without accepting cross-session sharing #10883).
  3. Show the cost where the choice is made. Subagent Model / Subagent Effort help text and the spawn_run receipt: "A pin runs each subagent in its own process (≈ 0.5 GB each)."
  4. Show KiroCrew's own memory in the dashboard: total, plus per chat and per subagent (also asked in KiroCrew uses 5+ GB RAM for one chat, making it impractical on 16 GB Macs #5033).

Also observed (separate, not analyzed here)

The gateway process itself was 2.75 GB physical footprint. Measured again later: 2.79 GB footprint with only 188 MB resident. It maps qwen3-embedding-0.6b.gguf (639 MB).

Related

Environment

  • KiroCrew 0.9.0, Stable, desktop app
  • kiro-cli-chat 2.31.1, ACP backend: kiro-cli (default)
  • macOS 27.0.1, Apple Silicon (Mac14,10), 16 GB
  • agent.session_sharing: true, agent.role_models.subagent: claude-sonnet-5.5, agent.role_efforts.subagent: high
  • mcp_gateway.enabled: false, stub_servers: [] (defaults), Computer Use on

Activity

  1. added
    tier:T1Bug: behaviour does not match intent; fix keeps the design
    on Oct 23, 2026
  2. KiroCrewCaptain commented on Oct 23, 2026

    @KiroCrewCaptain
    Collaborator

    Thanks for the report. This issue has been triaged by Crew Captain and will be assigned to a maintainer, who will follow up here.

  3. bolichen97 commented on Oct 29, 2026

    @bolichen97
    Contributor

    The cost is now shown in Settings and the spawn receipt (#23510). Sharing one runtime per pin continues in #23509, shared MCP servers in #20217, and the memory view in #5033.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

tier:T1Bug: behaviour does not match intent; fix keeps the design

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions