Skip to content

Context Reconstruction

Standard retrieval returns the top-K entities matching your query, but misses cross-cutting organizational signals: active predictions about where things are heading, unresolved conflicts between decisions, and the temporal spread of your results. Context reconstruction adds a supplementary signal layer after retrieval that gathers these signals in parallel and optionally synthesizes a one-paragraph briefing highlighting what needs attention.

Without context reconstructionWith context reconstruction
”Show me auth decisions” → 5 entities returnedSame 5 entities returned, plus: active prediction that “OAuth provider migration expected within 4 weeks”
You don’t know two decisions conflictConflict detected: “Use JWT for all services” vs “Adopt session-based auth for web” (similarity: 0.87)
No sense of time rangeResults span from 2025-11-15 to 2026-02-08 (85 days)
Raw results, no synthesisContext summary: “Your org has an active JWT-to-OAuth migration predicted by March…”

Context reconstruction runs after entity retrieval completes. Your raw entity results are always returned unchanged — context reconstruction is purely additive.

Four signals are gathered simultaneously using an error group:

  1. Active foresight — The query is embedded and compared against all FORESIGHT entities with status=active. Candidate similarities are calculated in a single batch query, and matches above 0.70 cosine similarity are included (up to 5). This surfaces predictions that are relevant to what you’re asking about.

  2. Unresolved conflicts — For each DECISION entity in the retrieval results, TeamLoop looks up unresolved conflicts via CONFLICTS_WITH relationships. Conflict pairs are deduplicated and the counterpart entity is loaded for display.

  3. Org profile traits — Active ORG_TRAIT entities are semantically matched using batch similarity calculation and included as standing organizational context. These are preferences, standards, and constraints inferred from decision patterns or declared explicitly. See Org Profile for details.

  4. Temporal span — The earliest and latest dates across all retrieved entities are computed (using event_date when available, falling back to created_at). This gives you a sense of how much time your results cover.

After signals are gathered, a context summary is generated only when both conditions are met:

  • At least 3 retrieved entities
  • At least 2 active signals (e.g., both foresight predictions and conflicts are present)

The summary is a 2-4 sentence paragraph synthesized by an LLM (temperature 0.3, max 512 tokens) with a 1-second timeout. It highlights cross-cutting concerns: predictions that may affect decisions, conflicts that need resolution, and how the temporal span provides historical context.

Each signal degrades independently. Context reconstruction never blocks or errors the main query.

ScenarioBehavior
Embedder not configuredForesight search skipped, conflicts and temporal span still gathered
Foresight search failsLogs warning, returns results without foresight signal
Conflict lookup failsLogs warning, returns results without conflict signal
LLM client not configuredAll signals gathered, summary skipped
LLM summary times out (>1s)Signals returned without summary paragraph
No DECISION entities in resultsConflict lookup skipped (no decisions to check)
Fewer than 3 entities retrievedSummary generation skipped
Only one signal activeSummary generation skipped (needs 2+)

Context reconstruction is controlled via the reconstruct parameter on teamloop_query.

ParameterTypeDefaultDescription
querystringrequiredThe search query
reconstructbooleantrueEnable context reconstruction with supplementary signals
agenticbooleantrueEnable agentic retrieval with sufficiency checking
sourcesstringallComma-separated list of sources to search
modestringcurrentQuery mode: current, as_of
as_ofstringDate in YYYY-MM-DD format for temporal queries
retrievalstringhybridRetrieval strategy: hybrid or standard

Default (reconstruction enabled):

Tool: teamloop_query
Input: {
"query": "What decisions have been made about the API architecture?"
}

Disable context reconstruction:

Tool: teamloop_query
Input: {
"query": "PROJ-1234",
"reconstruct": false
}

Disabling context reconstruction is useful for precise lookups where you only need the raw entities.

When context reconstruction is active, the response includes a ## Context section after the retrieval results:

## Context
### Active Predictions
- **gRPC migration expected within 6 weeks** (confidence: 85%, source: "Adopt gRPC for inter-service communication")
### Unresolved Conflicts
- **Use REST for all public APIs** conflicts with **Adopt GraphQL for frontend APIs** (similarity: 0.87)
### Temporal Span
Results span from 2025-11-15 to 2026-02-08 (85 days)
### Context Summary
Your org has an active decision to adopt gRPC with migration expected by March.
However, there is an unresolved conflict between maintaining REST for public APIs
and the newer GraphQL adoption proposal. The 85-day span of results suggests this
has been an evolving discussion.

Each subsection only appears if the corresponding signal has data. If no signals are present, the ## Context section is omitted entirely.

The dashboard query endpoint returns context data in the context_data field of the JSON response:

{
"results": [...],
"entities": [...],
"context_data": {
"active_foresight": [
{
"id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"name": "gRPC migration expected within 6 weeks",
"confidence": 0.85,
"status": "active",
"source_decision": "Adopt gRPC for inter-service communication",
"end_date": "2026-03-25"
}
],
"conflicts": [
{
"entity_a": "Use REST for all public APIs",
"entity_b": "Adopt GraphQL for frontend APIs",
"similarity": 0.87
}
],
"org_traits": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Prefer managed services over self-hosted",
"category": "preference",
"confidence": "medium",
"source": "inferred"
}
],
"temporal_span": {
"earliest": "2025-11-15",
"latest": "2026-02-08",
"days": 85
},
"context_summary": "Your org has an active decision to adopt gRPC..."
}
}
ParameterDefaultDescription
Foresight threshold0.70Min cosine similarity for foresight matches
Max foresight5Maximum foresight entities to include
Summary timeout1000msMax time for LLM summary generation
Min entities for summary3Min retrieved entities before summary is considered
Min signals for summary2Min active signal types required for summary
  • Context reconstruction adds minimal latency — Signal gathering runs in parallel and typically completes in under 50ms. The LLM summary adds 500-1000ms but only triggers when multiple signals are present with enough entities.
  • Works with all retrieval modes — Context reconstruction works with hybrid search, agentic retrieval, and standard vector-only search.
  • Foresight must be populated — Context reconstruction surfaces existing foresight predictions. If no FORESIGHT entities exist in your knowledge graph, the foresight signal will be empty. See Foresight for how predictions are generated.
  • Conflicts are per-decision — Only DECISION entities in your results are checked for conflicts. Other entity types (PERSON, PROJECT, etc.) are not checked.
  • Disable for speed — If you need the fastest possible response, set "reconstruct": false to skip all supplementary signal gathering.