Skip to content

Feature request / design discussion: task-scoped memory prefetch by ID for subagent delegation #449

Description

@G0-0000

Feature request / design discussion: task-scoped memory prefetch by ID for subagent delegation

Motivation: users are forced to maintain private patches

I use magic-context for multi-agent orchestration. When a parent agent delegates a task, it often already knows exactly which memories the child needs. There is currently no task-scoped prefetch-by-ID capability, so I maintain several local patches to simulate it. Every upstream upgrade requires rebasing and re-adapting those patches. This is costly and fragile.

I am not opening this issue to define the cross-harness contract, and I am not pushing a specific syntax. I want to describe the use case and its user cost. The design shape is for maintainers to decide.

How I use it now, and where it hurts

My current options are roughly:

  • the parent pastes memory bodies into the delegation message;
  • the child is asked to call ctx_memory get itself;
  • a local patch injects by ID.

None are good:

  • Pasting bodies: duplicates bytes, drifts from the memory store, and makes delegation output tokens and latency very high.
  • Child calls ctx_memory get: adds tool-round-trip latency, and the child may not know it needs to.
  • Local patches: every upgrade requires rebasing; costly and conflict-prone.

This is especially visible with defaultContext=fresh children: they share the project memory store but have no parent conversation, so there is no stable channel for IDs the parent already knows.

What I want

A parent can request memories by ID at delegation time, and the child receives the full content before its first token:

  • delegation messages carry only the goal and IDs, not pasted bodies;
  • the child gets the original memory-store content, not a parent paraphrase;
  • no embedding, retrieval ranking, or tool round-trip;
  • unaffected by the automatic injection budget — the IDs the parent names may be exactly what the budget excluded;
  • users no longer need to maintain private patches.

For typical SOP / config payloads, this can reduce parent output by hundreds to over a thousand tokens per delegation, with corresponding output-latency savings. Exact numbers depend on memory size and task shape.

What I am not trying to decide

These are yours to define, not mine:

  • the cross-harness contract across OpenCode / Pi/OMP / Rust lane;
  • whether IDs travel through a structured orchestration API, task-text markers, or both;
  • the exact syntax;
  • whether a new persisted namespace or schema migration is needed;
  • which layer owns frozen delivery, capacity checks, and policy consistency.

My earlier prototype only validated the Pi path. It is not a claim for a single-harness design. If the final design only needs part of it, I can adapt to whatever shape you define.

Existing prototype (material only, not an implementation request)

On the Pi path I validated the core mechanics: primary-key reads, no embedding, opaque Unavailable for invisible IDs, snapshot freezing, replay, and explicit capacity refusal. Tests covered parsing boundaries, invisible IDs, replay, and transient-fault retry.

But this is only material. Whether to use it, how much, and in which layer, is up to you.

One question I would like to discuss

Is this use case worth including in the cross-harness design discussion?

  • If yes: would you prefer IDs to travel through a structured orchestration API, or task-text markers? I can provide material or implement part of it in whatever direction you define.
  • If no: please tell me, so I at least know I need to keep maintaining patches.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions