Skip to content

v0.4.1 β€” Incremental memory ingestion

Latest

Choose a tag to compare

@richard-peng-xia richard-peng-xia released this 11 Apr 20:04
· 1 commit to main since this release

Highlights

Incremental memory ingestion. The MetaClaw memory layer no longer waits until session end to extract and persist turns. Instead, turns
are buffered and flushed every N turns (default 5), shrinking the mid-session blackout window and eliminating the O(NΒ²) cost of
re-sending full history on every agent turn.

What's new

Memory layer (metaclaw/memory/manager.py)

  • New buffer_turn(session_id, turn, scope_id=None) β€” buffers a single turn, auto-flushes when flush_every is reached.
  • New flush_session(session_id, scope_id=None, final=True) β€” flushes buffered turns; only emits the working-summary unit and clears
    per-session state when final=True.
  • ingest_session_turns refactored into shared helpers (_extract_turns_to_units, _build_working_summary_unit, _persist_units).
  • Per-session state persists across flush boundaries; absolute turn indices preserved via a turn_offset parameter.

Config

  • metaclaw/config.py gains memory_flush_every (default 5).
  • Sidecar SidecarConfig forwards the same value.

Sidecar HTTP (openclaw-metaclaw-memory/sidecar)

  • New POST /buffer_turn β€” returns {flushed, added}.
  • New POST /flush_session β€” returns {added}.
  • Proxy now routes /v1/memory/buffer_turn and /v1/memory/flush_session.

OpenClaw plugin (openclaw-metaclaw-memory/src)

  • client.ts adds bufferTurn and flushSession.
  • types.ts adds BufferTurnResponse and FlushSessionResponse.
  • hooks/auto-capture.ts rewritten: tracks per-session turn count in a module-level Map, so agent_end only forwards the new delta via
    bufferTurn. session_end calls flushSession(final=true) and drops the tracker.

Upgrade notes

  • No migration required β€” the legacy /ingest endpoint and ingest_session_turns API are unchanged.
  • To opt in from the plugin, rebuild openclaw-metaclaw-memory (npm run build) and redeploy.
  • Tune memory_flush_every via SidecarConfig.flush_every if you want a different flush cadence.