Skip to content

[Feature]: Subagents inherit full workspace context even for narrow tasks - no way to scope what's injected [BIG TOKEN REDUCING IMPROVMENT ON SUBAGENTS SPAWN] #56029

@AtlantisZero007

Description

@AtlantisZero007

Summary

Problem

When spawning subagents via sessions_spawn, each subagent automatically receives ALL workspace files (AGENTS.md, SOUL.md, USER.md, MEMORY.md, HEARTBEAT.md, TOOLS.md, IDENTITY.md, etc.) as context — even when the subagent is doing a narrow, stateless task like scanning database rows or running shell commands.

There's no way to opt out of or scope the workspace injection.

Impact

For workflows that spawn many short-lived subagents (e.g., parallel audit workers, code fixers, data processors), the overhead adds up fast:

  • Each subagent loads ~5-10k tokens of workspace context it never uses
  • A typical audit cycle spawns 4-5 workers → 25-50k wasted tokens per cycle
  • Running 10+ cycles per day → 250-500k tokens/day burned on irrelevant context
  • On subscription-based plans (Claude Pro/Max), this directly eats into rate limits

Expected behavior

Ability to control what workspace context a subagent receives. Options could include:

  1. A workspace: false or workspace: "none" flag on sessions_spawn to skip workspace injection entirely
  2. A workspace: ["AGENTS.md"] allowlist to select specific files
  3. A lightweight: true mode that skips personality/memory files and only injects essential runtime config
  4. Agent-level config in openclaw.json to define workspace scope per agent type

Current workaround

None. The injection is automatic and not configurable. The only option is to keep workspace files small, which conflicts with using them for memory/context (their intended purpose).

Environment

  • OpenClaw 2026.3.22
  • Subagents spawned via sessions_spawn with runtime: "subagent"

=================================================================

So in short my agent spawns sub-agents for task like reading something and spawning 1 worker/theard per something
Instead of just giving instructions to worker like:
Do this and this here and here and tell me whats that and that
every time it sends whole memory,project etc. There should be option if we need to send soul etc to sub worker as if it have to do just small things and return X for main worker?

Problem to solve

Provided in summary

Proposed solution

Provided in summary

Alternatives considered

No response

Impact

Consumption of tokens

Evidence/examples

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions