openclaw - 💡(How to fix) Fix Proposal: Integrate Claude Code harness architecture — multi-agent协作 + 三层context压缩 + KAIROS长期规划 [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#62490Fetched 2026-04-08 03:03:35
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants
RAW_BUFFERClick to expand / collapse

Motivation

Claude Code's "harness" architecture represents a mature, production-tested multi-agent system that addresses several pain points OpenClaw users experience today. Key features are worth integrating.

Key Harness Features to Consider

1. Lead Agent + Specialist Agents (协作分工)

Claude Code evolved from a single monolithic agent to a Lead Agent + Specialist Agents architecture:

  • Lead Agent: plans and delegates, doesn't execute directly
  • Specialist Agents: parallel workers, each owning a domain (bug-fixing / code-reading / testing / verification)
  • Shared Task System: agents communicate through a coordination layer, each with isolated context windows

OpenClaw's multi-agent design is currently channel-based (different agents for different messaging platforms) rather than task-based (collaborating on the same task). A Lead Agent pattern would complement the existing architecture.

2. Three-Layer Context Compaction

Claude Code uses progressive compaction rather than waiting for a crisis:

LayerTriggerAction
MicroCompactContext 60%Write running notes to memory/ files, keep cached
AutoCompactContext 75%Trigger LCM compaction, circuit breaker (max 3 consecutive)
FullCompactContext 90%Immediate save + force compaction + notify user

This is more robust than waiting for the context window to fill. OpenClaw already has compaction.memoryFlush but lacks layered thresholds.

3. Subagent Prompt Cache Inheritance

When Claude Code forks a subagent, the child inherits a byte-level copy of the parent's prompt cache. Using Anthropic's Prompt Caching API, cached tokens are 90% cheaper. Spawning 5 parallel workers costs nearly nothing if the parent context is cached.

OpenClaw's sessions_spawn could benefit from similar cache inheritance behavior.

4. KAIROS (Long-Horizon Planning)

An unpublished Claude Code architecture ("KAIROS") operates on hours-long timescales rather than minutes, enabling multi-session task decomposition and persistent subgoals across days.

5. Tools Deferral (按需加载)

Claude Code splits tools into "loaded" and "deferred". MCP servers can expose 50+ tools — throwing them all at the LLM is catastrophic. Claude Code only loads tools on demand when triggered by user intent.

This is directly relevant to OpenClaw's skill loading — skills could be marked as deferred by default and activated only when relevant.

Integration Ideas

  1. Config agents.defaults.compaction.thresholds — layered compaction triggers (e.g., micro: 0.6, auto: 0.75, full: 0.9)
  2. Lead Agent modeagents.defaults.role: "lead" + agents.named.<specialist>.scope for task decomposition
  3. Skill deferral — add activation: "deferred" to skill interfaces, activate on trigger match
  4. Prompt cache for spawnsessions_spawn inherits parent prompt cache when inheritCache: true
  5. KAIROS-inspired persistence — store subgoals in memory/ with task IDs, resume on next session

References


Proposal based on Claude Code harness architecture research. Happy to help prototype or test.

extent analysis

TL;DR

Integrate Claude Code's harness architecture features, such as Lead Agent, layered context compaction, and prompt cache inheritance, into OpenClaw to improve its multi-agent system.

Guidance

  • Introduce a Lead Agent mode by setting agents.defaults.role: "lead" and defining agents.named.<specialist>.scope for task decomposition.
  • Implement layered compaction triggers by configuring agents.defaults.compaction.thresholds (e.g., micro: 0.6, auto: 0.75, full: 0.9).
  • Add skill deferral by marking skills as deferred by default and activating them only when relevant, using activation: "deferred" in skill interfaces.
  • Enable prompt cache inheritance for spawned sessions by setting inheritCache: true in sessions_spawn.
  • Consider implementing KAIROS-inspired persistence by storing subgoals in memory/ with task IDs and resuming on next session.

Example

// Example configuration for Lead Agent mode
const agents = {
  defaults: {
    role: "lead",
    compaction: {
      thresholds: {
        micro: 0.6,
        auto: 0.75,
        full: 0.9
      }
    }
  },
  named: {
    specialist1: {
      scope: "bug-fixing"
    },
    specialist2: {
      scope: "code-reading"
    }
  }
};

Notes

The integration of Claude Code's features into OpenClaw may require significant changes to the existing architecture. It is essential to carefully evaluate and test each feature to ensure seamless integration and optimal performance.

Recommendation

Apply the proposed workaround by integrating Claude Code's harness architecture features into OpenClaw, as this will likely improve the multi-agent system's performance and robustness.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING