Site search

Find architecture, research, and terms

Start typing to search the editorial index.

Editorial guidanceAdvanced

Memory, Context, and Lineage for MIR

Attributable context packages, governed memory records, assembly sequence, contamination controls, lineage, and provider-neutral C# ports.

Context package

Each selected source record carries source identity/type, content hash, provenance, captured and valid-through UTC instants, permission scope, data classification, confidence/status, citation metadata, selection reason, and material exclusion reason.

These files are conceptual MiRuntime editorial references, not a product SDK or certification profile.

Memory record

A durable memory record identifies owner, scope, provenance, creation/update triggers, retention or TTL, correction/deletion paths, promotion status, and access policy. Memory is not an unbounded transcript; it is a governed projection.

Context assembly

DiscoverAuthorizeRankDeduplicateValidate freshnessFit budgetRedactSeal provenanceInject

Contamination controls

  • Label untrusted content and separate instructions from data.
  • Require provenance, TTL, correction, deletion, and promotion review.
  • Enforce cross-tenant isolation and replayable context selection.
  • Record excluded sources when exclusion materially affects the result.

Lineage

Connect model version, prompt-contract version, source snapshot, context transformation, tool schema, policy version, and evidence event. Lineage should make a reviewer able to answer both “what influenced this result?” and “which release changed the behavior?”

C# contracts

using System.ComponentModel.DataAnnotations;

/// <summary>Contains the sealed context delivered to a model adapter.</summary>
public sealed record ContextPackage
{
    /// <summary>Gets the package version.</summary>
    [Display(Name = "Package Version")]
    public required string PackageVersion { get; init; }

    /// <summary>Gets the selected source records.</summary>
    [Display(Name = "Sources")]
    public required IReadOnlyList<ContextSourceRecord> Sources { get; init; }

    /// <summary>Gets when the package was sealed.</summary>
    [Display(Name = "Sealed At Utc")]
    public required DateTimeOffset SealedAtUtc { get; init; }
}

/// <summary>Describes one attributable context source.</summary>
public sealed record ContextSourceRecord
{
    /// <summary>Gets the stable source identifier.</summary>
    [Display(Name = "Source")]
    public required string SourceId { get; init; }

    /// <summary>Gets the content hash.</summary>
    [Display(Name = "Content Hash")]
    public required string ContentHash { get; init; }

    /// <summary>Gets why the source was selected.</summary>
    [Display(Name = "Selection Reason")]
    public required string SelectionReason { get; init; }
}

/// <summary>Assembles authorized context for a run step.</summary>
public interface IContextAssembler
{
    /// <summary>Builds and seals a context package.</summary>
    /// <param name="runId">The stable run identifier.</param>
    /// <param name="cancellationToken">Signals cancellation of retrieval and validation.</param>
    /// <returns>The sealed context package.</returns>
    Task<ContextPackage> AssembleAsync(string runId, CancellationToken cancellationToken);
}

/// <summary>Represents a governed durable memory projection.</summary>
public sealed record MemoryRecord
{
    /// <summary>Gets the memory scope.</summary>
    [Display(Name = "Scope")]
    public required string Scope { get; init; }

    /// <summary>Gets when the record expires, when configured.</summary>
    [Display(Name = "Expires At Utc")]
    public DateTimeOffset? ExpiresAtUtc { get; init; }
}

/// <summary>Stores governed memory projections.</summary>
public interface IMemoryProjectionStore
{
    /// <summary>Upserts one authorized memory record.</summary>
    /// <param name="record">The governed memory projection.</param>
    /// <param name="cancellationToken">Signals cancellation of storage I/O.</param>
    Task UpsertAsync(MemoryRecord record, CancellationToken cancellationToken);
}

Source record

References

Suggest a correction
  1. National Institute of Standards and Technology. NIST. Published 2024-07-26; last reviewed 2026-06-20 UTC. Government profile.

  2. OWASP GenAI Security Project. OWASP. Published 2025; last reviewed 2026-06-20 UTC. Security guidance.

  3. OpenTelemetry project. Cloud Native Computing Foundation. Published Current specification repository; last reviewed 2026-06-24 UTC. Official specification.