Architecture

Traces and memory evolution

Graph-resident traces, reflection, elaboration, consolidation, and semantic response reuse.

Spectron stores three trace kinds as first-class nodes in the substrate, linked by real edges to entities, attributes, passages, and model calls. Traces are inputs to future ranking and consolidation – not only external telemetry.

TraceEmitted byHolds (conceptually)Typical edges
retrieval_traceEvery /query and ranked readQuery text, candidate sets per index, fused scores, returned subset, model metadataconsidered, returned, parent_trace
decision_traceEvery reconciliationInput extraction, confidence, trust, per-record outcome (created, updated, superseded, flagged), plus the acting principal, any on-behalf-of delegation target, and the session scope under which the write ranconsidered, created, superseded, flagged, parent_trace
response_trace/chat and /reflectUser message, assembled prompt, model response, tokens, cost, latencyused_retrieval, produced_decision, wrote, parent_session

Traces are queryable (for example GET /api/v1/{ctx}/traces and GET /api/v1/{ctx}/traces/{id}) and inspectable from the CLI (spectron inspect trace:…). Trace listing respects the same access model as memory: holders of manage can see every trace in a Context; other callers see only traces whose session scope falls within their read grant. See Surface, models, and security for HTTP and CLI detail.

Feedback loops (examples):

  • The ranker uses aggregated retrieval_trace.returned similarity – entities that helped similar queries get boosted; records tied to corrections get demoted.

  • Elaboration uses decision_trace.considered co-occurrence to propose links between entities that were examined together but never connected.

  • Consolidation reinforces facts that response_trace shows were actually used in successful answers; untouched records can age out.

  • Calibration uses repeated decision_trace.superseded lineage as a negative trust signal on the original source.

That is the difference between “we logged what happened” and “we remember what happened – and it changes what we do next.”

Three mechanisms create new memory; they answer different questions and run at different times.

MechanismTriggerWhenOutput
ReflectionCaller asks a synthesis questionOn-demand (POST /reflect)Answer plus optional new facts (source.kind = "reflect")
ElaborationBackground sweep (default); also ingest-time or targetedAsync / periodicNew relations and attributes (source.kind = "elaboration") linking previously disconnected material
ConsolidationAsync job; sometimes every few hundred writesCron-style and triggeredObservation records (source.kind = "consolidation") with history, derived_from, proof_count
  • Reflection is the active path: it runs when something asks.

  • Elaboration and consolidation are passive: they evolve memory between user interactions.

All write through the same reconciler as turns and documents, so supersession and uncertainty rules stay identical.

Prior response_trace records can answer new questions when:

  • The new question is the same or very similar (embedding similarity) within the same Context and scope, and

  • Every entity and attribute cited via used_retrieval → retrieval_trace.returned is still current (no superseding writes, no new contradicting uncertainty).

Then Spectron can return the stored answer and link a fresh response_trace with reused_from pointing at the original trace.

This is semantic response caching with entity-aware invalidation – the cache key is not a raw string hash; it is the query plus the set of facts the prior answer depended on. When any cited fact moves, dependent responses invalidate automatically.

Operational notes:

  • Reuse is conservative by default; similarity, freshness, and trust thresholds are tuneable per Context.

  • A reuse still emits a new response_trace so the graph distinguishes “answered from cache” from “fresh LLM call”, and reinforcement continues to attribute to the original.

The REST API and MCP tools reference exercise these paths.

Was this page helpful?