arbitration router, and a scoped override mechanism. The architecture moves conflict resolution out of the LLM's implicit reasoning and into explicit, auditable code.
Step 1: Define the Authority Schema
Every memory record must carry structured metadata that describes its provenance, certainty level, and operational status. This schema replaces vague prompt instructions with machine-readable directives.
export type ProvenanceClass =
| 'live_check'
| 'primary_source'
| 'correction'
| 'operational_state'
| 'active_decision'
| 'unresolved_gate'
| 'compressed_summary'
| 'preference'
| 'archive';
export type EpistemicStatus =
| 'settled'
| 'inferred'
| 'contested'
| 'unresolved'
| 'verification_required'
| 'superseded';
export type ResolutionDirective =
| 'answer'
| 'context_only'
| 'warn'
| 'verify_first'
| 'block'
| 'archive_only';
export interface MemoryRecord {
id: string;
content: string;
provenance: ProvenanceClass;
epistemic: EpistemicStatus;
scope?: string;
expiresAt?: string;
riskLevel: 'low' | 'medium' | 'high';
}
Step 2: Implement the Pre-Generation Router
The router evaluates retrieved records against a policy before they reach the generation model. It computes a ResolutionDirective for each record based on provenance hierarchy, epistemic status, and risk tolerance.
export class ContextArbiter {
private readonly hierarchy: ProvenanceClass[] = [
'live_check',
'primary_source',
'correction',
'operational_state',
'active_decision',
'unresolved_gate',
'compressed_summary',
'preference',
'archive'
];
resolve(records: MemoryRecord[]): Map<string, ResolutionDirective> {
const directives = new Map<string, ResolutionDirective>();
const highestAuthority = this.findHighestAuthority(records);
for (const record of records) {
const directive = this.computeDirective(record, highestAuthority);
directives.set(record.id, directive);
}
return directives;
}
private findHighestAuthority(records: MemoryRecord[]): ProvenanceClass {
return records.reduce((best, current) => {
return this.hierarchy.indexOf(current.provenance) < this.hierarchy.indexOf(best)
? current.provenance
: best;
}, records[0].provenance);
}
private computeDirective(
record: MemoryRecord,
topTier: ProvenanceClass
): ResolutionDirective {
if (record.epistemic === 'verification_required') return 'verify_first';
if (record.epistemic === 'unresolved') return 'warn';
if (record.provenance === 'correction' && record.riskLevel === 'high') return 'block';
if (record.provenance === 'archive') return 'archive_only';
if (record.provenance === this.hierarchy.indexOf(topTier) === 0) return 'answer';
if (record.provenance === 'compressed_summary') return 'context_only';
return 'answer';
}
}
Step 3: Handle Dynamic Overrides
Operational contexts shift. During an incident, a runbook must temporarily outrank a product roadmap. During legal review, compliance language must override stylistic preferences. The system supports scoped elevation with explicit expiry.
export interface AuthorityOverride {
mode: string;
elevatedSource: ProvenanceClass;
outranks: ProvenanceClass;
scope: string;
expiresAt: string;
}
export class ScopeManager {
private activeOverrides: AuthorityOverride[] = [];
registerOverride(override: AuthorityOverride): void {
this.activeOverrides.push(override);
}
applyOverrides(records: MemoryRecord[]): MemoryRecord[] {
const now = new Date().toISOString();
const validOverrides = this.activeOverrides.filter(o => o.expiresAt > now);
return records.map(record => {
const match = validOverrides.find(o =>
o.mode === record.scope &&
record.provenance === o.elevatedSource
);
if (match) {
return { ...record, provenance: 'live_check' }; // Temporary elevation
}
return record;
});
}
}
Architecture Decisions & Rationale
- Pre-Generation Routing: Conflict resolution happens before the LLM sees the context. This prevents the model from averaging contradictory records or inventing compromise answers that satisfy neither source.
- Decoupled Epistemic Status: Separating
epistemic from provenance allows the system to distinguish between what a record is (a summary, a correction, a log) and how certain we are about it (settled, contested, verification-required). This enables nuanced routing without bloating the hierarchy.
- Runtime Directive Computation:
ResolutionDirective is calculated at retrieval time, not hardcoded. A record that could answer yesterday may require verification today if system state changes or a new correction is logged.
- Scoped Overrides with Expiry: Temporary authority elevation prevents permanent hierarchy corruption. By binding overrides to a
scope and expiresAt, the system avoids loophole accumulation where emergency rules become default behavior.
Pitfall Guide
1. Recency Heuristic Trap
Explanation: The system defaults to the most recently ingested record, assuming newer equals more accurate. This causes stale summaries or outdated preferences to override current source files or live checks.
Fix: Enforce a strict provenance hierarchy where live_check and primary_source always outrank compressed_summary and preference, regardless of ingestion timestamp.
2. Summary-First Bias
Explanation: Compressed summaries are fast to retrieve and tokenize, so the router prioritizes them to save context window space. This leads to lossy information steering critical decisions.
Fix: Route summaries to context_only by default. Require explicit promotion to answer only when no primary source or correction conflicts with the claim.
3. Unbounded Override Loopholes
Explanation: Temporary authority elevations are registered without scope or expiry. Over time, emergency rules accumulate and permanently distort the hierarchy.
Fix: Mandate scope and expiresAt fields for every override. Implement a background cleanup job that purges expired overrides and logs them for audit.
4. Static Threshold Rigidity
Explanation: The routing policy uses fixed risk thresholds. Low-risk, settled queries get blocked because they barely miss the verification requirement, causing unnecessary latency and user friction.
Fix: Implement a risk-adjusted routing function that evaluates riskLevel alongside epistemic status. Allow settled records with low risk to bypass verification gates.
5. Policy Drift
Explanation: The authority rules are treated as static configuration. As workflows evolve, the hierarchy becomes misaligned with actual operational needs, but no one updates it.
Fix: Version the policy itself. Track last_changed_because, review_trigger, and active_since. Tie policy updates to measurable failure patterns (e.g., repeated overblocking or false certainty).
6. Ignoring Verification Gates
Explanation: Unresolved or verification-required records are treated as low-priority noise and filtered out entirely. This removes critical safety checks from the generation pipeline.
Fix: Route unresolved records to warn or verify_first. Treat them as gates that limit certainty, not as discardable artifacts.
Production Bundle
Action Checklist
Decision Matrix
| Scenario | Recommended Approach | Why | Cost Impact |
|---|
| Short-term prototype or creative drafting | Flat retrieval with permissive routing | Low stakes, fast iteration, human supervision present | Minimal token overhead, faster latency |
| Multi-session autonomous agent | Risk-adjusted balanced routing with strict hierarchy | Prevents stale context drift, maintains long-term continuity | Moderate token cost for metadata routing, higher reliability |
| Production incident or compliance review | Dynamic override mode with live checks elevated | Emergency state must outrank normal roadmap, legal language must override preferences | Higher latency for verification, critical for risk mitigation |
| Research or archival analysis | Primary source > citation > summary hierarchy | Provenance integrity matters more than operational speed | Increased storage/metadata cost, higher factual accuracy |
Configuration Template
authority_policy:
version: "1.0"
default_profile: "multi_session_agent"
active_since: "2024-11-01"
last_changed_because: "Adjusted risk thresholds to reduce overblocking on low-risk settled queries"
review_trigger: "Two repeated hierarchy failures or one high-risk false certainty event"
hierarchy:
- live_check
- primary_source
- correction
- operational_state
- active_decision
- unresolved_gate
- compressed_summary
- preference
- archive
routing_rules:
verification_required: verify_first
unresolved: warn
correction_high_risk: block
archive: archive_only
compressed_summary: context_only
default: answer
risk_adjustment:
enabled: true
low_risk_settled_bypass: true
max_verification_latency_ms: 1500
audit:
log_directives: true
retain_traces_days: 30
expose_to_user: false
Quick Start Guide
- Ingest Metadata: Update your memory storage layer to attach
provenance, epistemic, riskLevel, and scope fields to every record during ingestion.
- Deploy the Arbiter: Integrate the
ContextArbiter class into your retrieval pipeline. Run it immediately after vector search and before prompt assembly.
- Configure Overrides: Register domain-specific authority elevations (e.g., incident mode, legal review) using the
ScopeManager. Ensure all overrides include expiresAt.
- Route Directives: Map the computed
ResolutionDirective values to your prompt construction logic. Filter out archive_only and block records. Attach verify_first records to a pre-generation validation step.
- Monitor & Tune: Track directive distribution, overblocking rates, and false certainty incidents. Adjust risk thresholds and hierarchy weights based on audit logs. Version the policy when failure patterns emerge.