MirrorNeuron Developer Manual

Keep model context bounded

Handle long-running evidence, context limits, and uncertain model calls.

Use this guide when a workflow accumulates more evidence than fits in one model request. The Python SDK's ContextSession uses Membrane working memory to select bounded evidence and verify it against immutable source artifacts.

Prepare a model turn

  1. Preserve tool results and evidence as source artifacts.
  2. Declare the decision focus, required fields, evidence references, and topics.
  3. Select a bounded packet of supporting and opposing evidence.
  4. Verify source ranges and count the complete model request, including instructions, schemas, current input, and output reserve.
  5. Dispatch only after the full request fits; preserve the response and completion receipt.

Generated summaries help navigate records; citations must resolve to source bytes. Context selection reads existing evidence and does not dispatch domain tools or change the workflow graph.

Budget the full request

input_budget = window_tokens - output_reserve - safety_tokens

SDK defaults are a 16,384-token window, 2,048 output tokens, and a 512-token safety reserve. These are policy defaults, not proof of a selected model's capacity. Configure the model's supported window and retain final gateway admission checks. Required inputs must not be silently truncated to fit.

Handle failures explicitly

SignalApplication action
NeedsPartitionSplit the decision into smaller calls and carry verified results forward
AmbiguousInvocationA prior dispatch has no durable response; resolve the uncertainty or use an explicit new retry identity
Source hash or range mismatchReject the evidence and investigate its provenance
Storage, call, or deadline budget exceededStop or return a workflow-defined incomplete result
Membrane or model unavailableReport the dependency failure; do not fabricate an answer

A completed event can replay its durable result. Reusing the same identity with different content fails. An uncertain model call is not automatically repeated because it may already have incurred a charge or produced an external effect.

Diagnose a runtime dependency

With the CLI installed:

mn runtime status
mn runtime doctor
mn blueprint doctor ./my-blueprint

Replace ./my-blueprint with the local package path. Check the reported context service and model requirements before rerunning. See Troubleshooting.

Protect evidence

Keep the context service on the trusted runtime network and configure MN_CONTEXT_AUTH_TOKEN when bearer protection is required. Job, run, and principal identity belong to the application boundary, outside model-controlled arguments. Do not put private source text into public progress or logs.

See Python SDK for package integration and Author a blueprint for the mn.context extension.

On this page