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.
Why Context Reconstruction?
Section titled “Why Context Reconstruction?”| Without context reconstruction | With context reconstruction |
|---|---|
| ”Show me auth decisions” → 5 entities returned | Same 5 entities returned, plus: active prediction that “OAuth provider migration expected within 4 weeks” |
| You don’t know two decisions conflict | Conflict detected: “Use JWT for all services” vs “Adopt session-based auth for web” (similarity: 0.87) |
| No sense of time range | Results span from 2025-11-15 to 2026-02-08 (85 days) |
| Raw results, no synthesis | Context summary: “Your org has an active JWT-to-OAuth migration predicted by March…” |
How It Works
Section titled “How It Works”Context reconstruction runs after entity retrieval completes. Your raw entity results are always returned unchanged — context reconstruction is purely additive.
Signal gathering (parallel)
Section titled “Signal gathering (parallel)”Four signals are gathered simultaneously using an error group:
-
Active foresight — The query is embedded and compared against all
FORESIGHTentities withstatus=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. -
Unresolved conflicts — For each
DECISIONentity in the retrieval results, TeamLoop looks up unresolved conflicts viaCONFLICTS_WITHrelationships. Conflict pairs are deduplicated and the counterpart entity is loaded for display. -
Org profile traits — Active
ORG_TRAITentities 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. -
Temporal span — The earliest and latest dates across all retrieved entities are computed (using
event_datewhen available, falling back tocreated_at). This gives you a sense of how much time your results cover.
Conditional LLM summary
Section titled “Conditional LLM summary”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.
Graceful Degradation
Section titled “Graceful Degradation”Each signal degrades independently. Context reconstruction never blocks or errors the main query.
| Scenario | Behavior |
|---|---|
| Embedder not configured | Foresight search skipped, conflicts and temporal span still gathered |
| Foresight search fails | Logs warning, returns results without foresight signal |
| Conflict lookup fails | Logs warning, returns results without conflict signal |
| LLM client not configured | All signals gathered, summary skipped |
| LLM summary times out (>1s) | Signals returned without summary paragraph |
| No DECISION entities in results | Conflict lookup skipped (no decisions to check) |
| Fewer than 3 entities retrieved | Summary generation skipped |
| Only one signal active | Summary generation skipped (needs 2+) |
MCP Tool
Section titled “MCP Tool”Context reconstruction is controlled via the reconstruct parameter on teamloop_query.
teamloop_query
Section titled “teamloop_query”| Parameter | Type | Default | Description |
|---|---|---|---|
query | string | required | The search query |
reconstruct | boolean | true | Enable context reconstruction with supplementary signals |
agentic | boolean | true | Enable agentic retrieval with sufficiency checking |
sources | string | all | Comma-separated list of sources to search |
mode | string | current | Query mode: current, as_of |
as_of | string | — | Date in YYYY-MM-DD format for temporal queries |
retrieval | string | hybrid | Retrieval strategy: hybrid or standard |
Default (reconstruction enabled):
Tool: teamloop_queryInput: { "query": "What decisions have been made about the API architecture?"}Disable context reconstruction:
Tool: teamloop_queryInput: { "query": "PROJ-1234", "reconstruct": false}Disabling context reconstruction is useful for precise lookups where you only need the raw entities.
Response format
Section titled “Response format”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 SpanResults span from 2025-11-15 to 2026-02-08 (85 days)
### Context SummaryYour org has an active decision to adopt gRPC with migration expected by March.However, there is an unresolved conflict between maintaining REST for public APIsand the newer GraphQL adoption proposal. The 85-day span of results suggests thishas 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.
Dashboard
Section titled “Dashboard”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..." }}Configuration Defaults
Section titled “Configuration Defaults”| Parameter | Default | Description |
|---|---|---|
| Foresight threshold | 0.70 | Min cosine similarity for foresight matches |
| Max foresight | 5 | Maximum foresight entities to include |
| Summary timeout | 1000ms | Max time for LLM summary generation |
| Min entities for summary | 3 | Min retrieved entities before summary is considered |
| Min signals for summary | 2 | Min 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
DECISIONentities 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": falseto skip all supplementary signal gathering.
Next Steps
Section titled “Next Steps”- Foresight — How predictions are generated and tracked
- Agentic Retrieval — The sufficiency-checking retrieval that runs before context reconstruction
- Hybrid Search — The underlying search pipeline
- Query Playground — Try context reconstruction in the dashboard