Building the Accumulated Context Graph: The Five Governed State Domains, Temporal Validity Controls, and Postgres Implementation Architecture
Why Is Semantic Similarity Structurally Insufficient for Enterprise Autonomy?
Most enterprise agentic architectures equate retrieving similar text with understanding institutional rules. When engineering teams build autonomous systems using basic Retrieval-Augmented Generation (RAG) or vector memory buffers, they optimize for semantic relevance: a query is embedded, cosine distance is computed across a vector index, and the top-$k$ text fragments are injected into the agent's prompt window. In high-consequence enterprise workflows such as commercial underwriting, clinical healthcare, or regulatory compliance, semantic retrieval alone cannot verify whether a retrieved rule is still in force or legally applicable.
| Retrieval Dimension | Basic Semantic RAG | Accumulated Context Graph (ACG) |
|---|---|---|
| Operational Goal | Maximize semantic similarity ($k$-NN vector match) | Enforce deterministic institutional admissibility |
| Evaluation Query | "Does this text chunk look similar to the prompt?" | "Is this precedent authorized, active, unrevoked, and in scope?" |
| Temporal Awareness | Blind to timestamp expiration and policy revisions | Hard TTLs, review intervals, and supersession gates |
| Authority Boundary | Ingests all indexed text equally regardless of author role | Verifies authorizer role tier against structural hierarchy |
| Failure Mode | Hallucinated compliance via outdated or unverified text | Deterministic rejection of inadmissible context before prompt assembly |
In a governed architecture, semantic search handles initial candidate discovery while the Accumulated Context Graph enforces admissibility:
RAG discovers candidate context. The Accumulated Context Graph determines what is admissible. Policy and authority determine what is permitted. Execution and outcome records determine what the organization learns next.
Unverified material can inform discovery or hypothesis generation, while every consequential state transition requires verified, admissible governing precedent.
What Are the Five Governed State Domains in an Accumulated Context Graph?
Enterprise decision-making spans reporting hierarchies, operating policies, execution logs, approved exceptions, and real-world outcomes. To govern agent autonomy across these boundaries, an ACG structures persistent institutional context into five governed state domains:
flowchart TD
subgraph ACG["ACCUMULATED CONTEXT GRAPH (Governed State Domains)"]
direction TB
subgraph S1["1. STRUCTURAL STATE (Topology & IAM)"]
A1["Entities, Account Hierarchies, Roles & Effective Authority Context"]
end
subgraph S2["2. EPISODIC & OUTCOME STATE (Execution Ledger)"]
A2["Append-Only Inferences, Tool Calls, Rollback Logs & Observed Results"]
end
subgraph S3["3. PRECEDENT STATE (The Compounding Asset)"]
A3["Authorized Overrides, Scoped Exceptions & Revalidation Triggers"]
end
subgraph S4["4. POLICY STATE (Machine-Executable Rules)"]
A4["Policy-as-Code Declarations, Hard Limit Invariants & Versioned ASTs"]
end
subgraph S5["5. ADJUDICATION STATE (Dispute Workflow)"]
A5["Escalation Records, Contested Judgments & Committee Workflows"]
end
S1 <--> S4
S2 --> S3
S4 --> S3
S3 <--> S5
S2 -. "Observed Outcomes Validate Precedents" .-> S3
end
style ACG fill:#09090b,stroke:#10b981,stroke-width:2px,color:#ffffff
style S1 fill:#18181b,stroke:#3b82f6,stroke-width:1.5px,color:#ffffff
style S2 fill:#18181b,stroke:#64748b,stroke-width:1.5px,color:#ffffff
style S3 fill:#064e3b,stroke:#10b981,stroke-width:2px,color:#ffffff
style S4 fill:#1e1b4b,stroke:#8b5cf6,stroke-width:1.5px,color:#ffffff
style S5 fill:#451a03,stroke:#f97316,stroke-width:1.5px,color:#ffffff
1. Structural State (Organizational Topology & Identity)
Structural State models the baseline topology of the enterprise: entities, account hierarchies, customer risk tiers, department structures, and role-based authority ceilings. When engineers bind relational tables directly to enterprise IAM providers, this layer establishes who holds authority in each context and prevents a junior analyst's override from being recorded as an executive policy waiver.
2. Episodic & Outcome State (Execution & Verification Ledger)
Episodic and Outcome State maintains an append-only event ledger of every inference call, tool mutation, agent proposal, user override, and rollback payload, paired with observed real-world outcomes (such as loan repayment history, audit findings, or downstream system errors). Immutable timestamps, run IDs, and mutation snapshots provide forensic traceability and verify whether past decisions succeeded in production.
3. Precedent State (Governed Overrides & Scoped Exceptions)
Precedent State is the structured repository of human-authorized exceptions and overrides that have cleared the Classification Gate, forming the primary compounding asset of the system. When an authorized supervisor overrides an agent and classifies the correction as a scoped precedent, versioned relational tables bound to parent policy revisions record the exact applicability condition envelope (e.g., ARR > \$500k AND Tenure > 3 years), the authorizing role and user ID, the temporal validity interval with dynamic revalidation triggers, and cohort-controlled outcome metrics across subsequent reuses.
4. Policy State (Machine-Executable Constraints)
Policy State stores the formal, machine-readable rules of the enterprise (Policy as Code) inside a versioned policy registry of declarative schemas and immutable revision records. These rules enforce hard operational limits, deterministic calculation formulas, and statutory regulatory requirements that probabilistic LLMs cannot override.
5. Adjudication State (Active Disputes & Committee Resolutions)
Adjudication State tracks active escalations where an agent's proposal is contested, where two organizational policies conflict, or where a human override requires multi-stakeholder sign-off (such as Credit Committee reviews or Ethics Board deliberations). State-machine workflow records track the audit timestamps and approval signatures until the committee resolves the case into a formal Precedent State node or Policy revision.
What Is the Production PostgreSQL Blueprint for an Accumulated Context Graph?
An ACG can begin in PostgreSQL as the governed transactional system of record, with specialized stores (object stores, event streams, search indexes) added only where telemetry scale or specialized workflows justify them.
| Relational Table | State Domain | Immutability & Lifecycle | Core System Role & Access Pattern |
|---|---|---|---|
entities |
Layer 1: Structural | Mutable (IAM Sync) | Entity topology, risk ratings, and organizational authority boundaries. |
policies |
Layer 4: Policy | Mutable Metadata | Root policy registry, ownership metadata, and functional domains. |
policy_revisions |
Layer 4: Policy | Immutable AST | Versioned Policy-as-Code definitions; enforced via UNIQUE(policy_id, version). |
precedents |
Layer 3: Precedent | Governed Mutation | Human-authorized overrides, applicability scope, and review triggers. |
precedent_revocations |
Layer 3: Precedent | Append-Only | Immutable audit trail for instant global exception invalidation. |
precedent_evidence |
Layer 3: Precedent | Immutable Ledger | Cryptographic content hashes (SHA-256) and source URI citations. |
precedent_embeddings |
Layer 3: Precedent | Synchronized Vector | pgvector HNSW index for candidate discovery before gating. |
execution_events |
Layer 2: Episodic | Append-Only | Run-level tool mutations, structured proposals, and rollback payloads. |
decision_outcomes |
Layer 2: Outcome | Governed Append | Cohort tracking, empirical performance metrics, and audit verification. |
adjudication_cases |
Layer 5: Adjudication | State Machine Workflow | Disputed exceptions, committee sign-offs, and escalation resolutions. |
Production Relational Schema (PostgreSQL DDL)
-- Enable pgvector extension for candidate precedent discovery
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
CREATE EXTENSION IF NOT EXISTS vector;
-- ============================================================================
-- 1. STRUCTURAL STATE: Topology, Entities & Authority Boundaries (Layer 1)
-- ============================================================================
CREATE TABLE entities (
entity_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
external_identifier VARCHAR(128) NOT NULL UNIQUE,
-- e.g., "commercial_borrower", "healthcare_provider"
entity_type VARCHAR(64) NOT NULL,
risk_tier VARCHAR(32) NOT NULL DEFAULT 'standard',
-- "active", "suspended", "under_review"
status VARCHAR(32) NOT NULL DEFAULT 'active',
attributes JSONB NOT NULL DEFAULT '{}'::jsonb,
created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX idx_entities_type_tier ON entities (entity_type, risk_tier);
-- ============================================================================
-- 2. POLICY STATE: Machine-Executable Rules & Versioned ASTs (Layer 4)
-- ============================================================================
CREATE TABLE policies (
policy_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
name VARCHAR(255) NOT NULL,
domain VARCHAR(128) NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE policy_revisions (
policy_revision_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
policy_id UUID NOT NULL REFERENCES policies(policy_id) ON DELETE RESTRICT,
version VARCHAR(32) NOT NULL,
-- Machine-executable JSON Schema / AST
rules_schema JSONB NOT NULL,
is_active BOOLEAN NOT NULL DEFAULT TRUE,
effective_from TIMESTAMPTZ NOT NULL,
effective_until TIMESTAMPTZ,
approved_by UUID NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT uq_policy_version UNIQUE (policy_id, version)
);
CREATE INDEX idx_policy_revisions_active
ON policy_revisions (policy_id, is_active)
WHERE is_active = TRUE;
-- ============================================================================
-- 3. PRECEDENT STATE: Governed Overrides & Scoped Exceptions (Layer 3)
-- ============================================================================
CREATE TABLE precedents (
precedent_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
parent_policy_revision_id UUID NOT NULL
REFERENCES policy_revisions(policy_revision_id),
authorizer_id UUID NOT NULL,
authorizer_role VARCHAR(128) NOT NULL,
authorization_tier VARCHAR(64) NOT NULL,
-- e.g., {"tier": "commercial", "min_dscr": 1.15}
scope_conditions JSONB NOT NULL,
-- Parameter override permitted by human supervisor
rule_mutation JSONB NOT NULL,
valid_from TIMESTAMPTZ NOT NULL,
-- Nullable if strictly governed by review triggers
valid_until TIMESTAMPTZ,
next_review_at TIMESTAMPTZ,
-- e.g., "quarterly_macro_review", "policy_revision_change"
revalidation_trigger VARCHAR(128),
superseded_by UUID REFERENCES precedents(precedent_id),
created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX idx_precedents_temporal
ON precedents (valid_from, valid_until, parent_policy_revision_id);
CREATE TABLE precedent_revocations (
revocation_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
precedent_id UUID NOT NULL
REFERENCES precedents(precedent_id) ON DELETE RESTRICT,
revoked_by UUID NOT NULL,
revoked_by_role VARCHAR(128) NOT NULL,
revoked_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
reason TEXT NOT NULL,
evidence_ref VARCHAR(512)
);
CREATE INDEX idx_revocations_lookup
ON precedent_revocations (precedent_id);
CREATE TABLE precedent_evidence (
evidence_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
precedent_id UUID NOT NULL
REFERENCES precedents(precedent_id) ON DELETE CASCADE,
evidence_type VARCHAR(64) NOT NULL,
source_uri VARCHAR(512) NOT NULL,
-- SHA-256 cryptographic digest of source doc
content_hash VARCHAR(128) NOT NULL,
retrieved_at TIMESTAMPTZ NOT NULL
);
CREATE TABLE precedent_embeddings (
embedding_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
precedent_id UUID NOT NULL
REFERENCES precedents(precedent_id) ON DELETE CASCADE,
-- pgvector embedding for semantic discovery
embedding vector(1536) NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX idx_precedent_embeddings_hnsw
ON precedent_embeddings USING hnsw (embedding vector_cosine_ops);
-- ============================================================================
-- 4. EPISODIC & OUTCOME STATE: Execution Ledger & Verifications (Layer 2)
-- ============================================================================
CREATE TABLE execution_events (
event_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
workflow_id VARCHAR(128) NOT NULL,
agent_id VARCHAR(128) NOT NULL,
entity_id UUID NOT NULL REFERENCES entities(entity_id) ON DELETE RESTRICT,
applied_precedent_id UUID REFERENCES precedents(precedent_id),
applied_policy_revision_id UUID REFERENCES policy_revisions(policy_revision_id),
proposal JSONB NOT NULL,
mutation_payload JSONB NOT NULL,
rollback_payload JSONB,
-- "executed", "compensated", "rolled_back"
status VARCHAR(64) NOT NULL,
executed_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX idx_execution_events_entity
ON execution_events (entity_id, executed_at DESC);
CREATE TABLE decision_outcomes (
outcome_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
event_id UUID NOT NULL REFERENCES execution_events(event_id) ON DELETE RESTRICT,
observed_at TIMESTAMPTZ NOT NULL,
-- "performing", "defaulted", "covenant_breached"
outcome_status VARCHAR(64) NOT NULL,
metrics_snapshot JSONB NOT NULL,
-- "automated_pipeline", "human_audit", "external_feed"
verification_type VARCHAR(64) NOT NULL,
verified_by_id VARCHAR(128) NOT NULL,
verification_timestamp TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX idx_decision_outcomes_event
ON decision_outcomes (event_id, observed_at);
-- ============================================================================
-- 5. ADJUDICATION STATE: Dispute Lifecycle & Committee Escalations (Layer 5)
-- ============================================================================
CREATE TABLE adjudication_cases (
case_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
event_id UUID REFERENCES execution_events(event_id),
entity_id UUID NOT NULL REFERENCES entities(entity_id),
initiator_id UUID NOT NULL,
-- "pending", "in_committee", "resolved", "dismissed"
status VARCHAR(64) NOT NULL DEFAULT 'pending',
disputed_issue TEXT NOT NULL,
-- "promoted_to_precedent", "policy_updated", "rejected"
resolution_type VARCHAR(64),
resolved_precedent_id UUID REFERENCES precedents(precedent_id),
resolved_at TIMESTAMPTZ,
created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX idx_adjudication_status ON adjudication_cases (status);
How Do You Prevent State Decay? The Temporal Validity Engine
Organizational state decays continuously after an authorized human approves it. Fixed time windows expire when temporary emergency exceptions lapse; policy versions are superseded when the Risk Committee publishes Policy Rev 5.0 and invalidates waivers granted under Rev 4.2; authority delegations shift when an approving executive changes roles; and dynamic revalidation triggers fire when a borrower's risk tier drops or source financial statements are restated.
flowchart TD
A["Agent Query Triggered"] --> B["Semantic Discovery via pgvector"]
B --> C["Candidate Precedent Nodes Identified"]
C --> D{"Deterministic Admissibility Filter"}
D -- "Check 1: Temporal Window" --> E{"valid_from <= NOW() <= valid_until?"}
E -- "Expired" --> F["Node INADMISSIBLE (Pruned)"]
E -- "Valid" --> G{"Check 2: Active Policy Revision"}
G -- "Policy Revision Active?" --> H{"Parent Policy Revision Active?"}
H -- "Superseded" --> F
H -- "Active" --> I{"Check 3: Append-Only Revocation"}
I -- "Revocation Record Exists?" --> J{"precedent_revocations exists?"}
J -- "Yes (Revoked)" --> F
J -- "No" --> K{"Check 4: Applicability Predicate"}
K -- "Scope & Context Match?" --> L{"Applies(N, E, C, t) = True?"}
L -- "False" --> F
L -- "True" --> M["Node ADMISSIBLE"]
M --> N["Inject into Agent Context Window with Provenance Metadata"]
style A fill:#18181b,stroke:#64748b,stroke-width:1.5px,color:#ffffff
style B fill:#18181b,stroke:#3b82f6,stroke-width:1.5px,color:#ffffff
style C fill:#18181b,stroke:#3b82f6,stroke-width:1.5px,color:#ffffff
style D fill:#1e1b4b,stroke:#8b5cf6,stroke-width:2px,color:#ffffff
style E fill:#18181b,stroke:#f59e0b,stroke-width:1.5px,color:#ffffff
style F fill:#450a0a,stroke:#ef4444,stroke-width:2px,color:#ffffff
style G fill:#18181b,stroke:#f59e0b,stroke-width:1.5px,color:#ffffff
style H fill:#18181b,stroke:#f59e0b,stroke-width:1.5px,color:#ffffff
style I fill:#18181b,stroke:#f59e0b,stroke-width:1.5px,color:#ffffff
style J fill:#18181b,stroke:#f59e0b,stroke-width:1.5px,color:#ffffff
style K fill:#18181b,stroke:#f59e0b,stroke-width:1.5px,color:#ffffff
style L fill:#18181b,stroke:#f59e0b,stroke-width:1.5px,color:#ffffff
style M fill:#064e3b,stroke:#10b981,stroke-width:2px,color:#ffffff
style N fill:#064e3b,stroke:#10b981,stroke-width:2px,color:#ffffff
Evaluating Precedent Admissibility
A candidate precedent node $N$ is evaluated as admissible for target entity $E$ in current context $C$ at time $t$ under active policy revisions $\mathcal{P}_t$ using deterministic logic:
$$ \text{Admissible}(N, E, C, t, \mathcal{P}_t) \iff \begin{cases} \text{TemporalValid}(N, t) & \iff t_{\text{from}} \le t \le t_{\text{until}} \land t \le t_{\text{review}} \\ \text{Applies}(N, E, C, t) & \iff \text{Scope}(N) \sqsubseteq (E, C) \\ \text{PolicyActive}(N, \mathcal{P}_t) & \iff \text{ParentPolicyRevision}(N) \in \mathcal{P}_t \\ \text{AuthorityValid}(N, t) & \iff \text{RoleTier}(N.\text{authorizer}) \ge \text{ReqTier}(N) \\ \neg\text{Revoked}(N) & \iff \text{COUNT}(\text{precedent_revocations}) = 0 \\ \text{EvidenceSufficient}(N) & \iff \forall e \in N.\text{evidence}: \text{Available}(e) \end{cases} $$
This check runs in deterministic application code or SQL before context assembly. The system prevents inadmissible organizational state from ever governing an agent action.
How Does the Classification Gate Prevent Human Overrides From Corrupting State?
When a human supervisor overrides an agent's proposal, naive systems write the correction directly into a vector store or append it to a few-shot prompt. That habit pollutes shared state with personal idiosyncrasies and one-off compromises.
Institutional state must update only from human corrections that have been classified, scoped, authorized, and validated.
The Classification Gate forces every human intervention through an explicit categorization schema:
flowchart TD
A["Human Override Event"] --> B["Classification Gate"]
B --> C1["1. Case-Specific Adjustment"]
B --> C2["2. Reusable Precedent"]
B --> C3["3. Policy Change"]
B --> C4["4. Data Correction"]
B --> C5["5. Contested Judgment"]
C1 --> D1["Layer 2: Episodic Ledger<br/>(Local run only; zero propagation)"]
C2 --> D2["Layer 3: Precedents<br/>(Scoped entity envelope + TTL)"]
C3 --> D3["Layer 4: Policy Revisions<br/>(Governance review & unit tests)"]
C4 --> D4["Layer 1: Structural State<br/>(Entity record mutation)"]
C5 --> D5["Layer 5: Adjudication State<br/>(Quorum & committee review)"]
style A fill:#18181b,stroke:#f59e0b,stroke-width:1.5px,color:#ffffff
style B fill:#1e1b4b,stroke:#8b5cf6,stroke-width:2px,color:#ffffff
style C1 fill:#18181b,stroke:#64748b,stroke-width:1.5px,color:#ffffff
style C2 fill:#064e3b,stroke:#10b981,stroke-width:2px,color:#ffffff
style C3 fill:#1e1b4b,stroke:#8b5cf6,stroke-width:1.5px,color:#ffffff
style C4 fill:#18181b,stroke:#3b82f6,stroke-width:1.5px,color:#ffffff
style C5 fill:#451a03,stroke:#f97316,stroke-width:1.5px,color:#ffffff
style D1 fill:#09090b,stroke:#64748b,stroke-width:1px,color:#cbd5e1
style D2 fill:#09090b,stroke:#10b981,stroke-width:1.5px,color:#cbd5e1
style D3 fill:#09090b,stroke:#8b5cf6,stroke-width:1.5px,color:#cbd5e1
style D4 fill:#09090b,stroke:#3b82f6,stroke-width:1px,color:#cbd5e1
style D5 fill:#09090b,stroke:#f97316,stroke-width:1.5px,color:#cbd5e1
The Gate Authority Matrix: Who Governs the Gate?
| Action | Permitted Role | Verification Required | Propagation Scope |
|---|---|---|---|
| Case-Specific Override | Line Operator / Underwriter | IAM Identity + Run ID | Local run only; zero global propagation |
| Create Scoped Precedent | Senior Officer / Lead Architect | Authority Tier $\ge 3$ + Evidence Hash | Scoped entity category with mandatory TTL |
| Extend Precedent TTL | Risk Committee / Department Head | Revalidation Trigger Review + Outcome Audit | Extends valid_until by fixed review window |
| Promote Precedent $\rightarrow$ Policy | Policy Committee / Head of Function | Formal Governance Sign-Off & AST Unit Test | Replaces baseline policy across all runs |
| Revoke Precedent | Compliance Officer / Auditor | Append to precedent_revocations |
Immediate global invalidation |
| Adjudicate Contested Override | Oversight Board / Multi-Sig Review | Quorum Approval + Adjudication Record | Resolves into Precedent or Policy Revision |
How Do Precedents and Observed Outcomes Form a Compounding Flywheel?
The true defensibility of the ACG is that it turns static exception tracking into a compounding intelligence flywheel.
flowchart LR
A["1. Policy Revision Active"] --> B["2. Agent Proposal"]
B --> C["3. Supervisor Override & Classification"]
C --> D["4. Governed Precedent in ACG"]
D --> E["5. Autonomous Future Executions"]
E --> F["6. Observed Real-World Outcomes"]
F -. "Empirical Evidence Validates Precedent" .-> D
F -. "Automated Promotion Recommendation" .-> A
style A fill:#1e1b4b,stroke:#8b5cf6,stroke-width:1.5px,color:#ffffff
style B fill:#18181b,stroke:#64748b,stroke-width:1.5px,color:#ffffff
style C fill:#18181b,stroke:#f59e0b,stroke-width:1.5px,color:#ffffff
style D fill:#064e3b,stroke:#10b981,stroke-width:2px,color:#ffffff
style E fill:#18181b,stroke:#3b82f6,stroke-width:1.5px,color:#ffffff
style F fill:#09090b,stroke:#10b981,stroke-width:2px,color:#ffffff
Causality and Cohort Controls in Outcome Tracking
When teams link precedents to real-world outcomes, they need strict cohort controls so the system does not mistake macroeconomic tailwinds for rule quality. Fifty performing loans approved under an exception may reflect a benign credit cycle or borrower selection bias instead of the safety of the exception rule itself, and in domains like commercial credit or clinical care, severe failures often take months or years to surface. Empirical outcome telemetry should generate automated promotion recommendations for governance committees to review, while baseline policy revisions always require explicit human sign-off.
What Governs State Transitions in Autonomous Delegations?
Before an autonomous agent executes a consequential state mutation, the ACG control plane enforces an explicit Seven-Point Contract for State Transitions:
| # | Contract Dimension | Invariant Verified | Governing Domain | Hard Enforcement Rule |
|---|---|---|---|---|
| 1 | Current Actor Authority | Actor identity, active session, and delegated authority | Structural State (L1) | RoleTier(Actor) >= RequiredTier(Action) |
| 2 | Target Entity Scope | Target entity exists and falls within tenant/account boundary | Structural State (L1) | Entity.status == 'ACTIVE' AND InScope(Entity) |
| 3 | Active Policy Revision | Governing Policy-as-Code revision is active and in effect | Policy State (L4) | PolicyRevision.is_active == TRUE |
| 4 | Precedent Admissibility | Applied override is within temporal validity and unrevoked | Precedent State (L3) | TemporalValid(N) AND NOT Revoked(N) |
| 5 | Evidence Sufficiency | Mandatory evidence hashes are available and verifiable | Precedent State (L3) | COUNT(Evidence) >= RequiredEvidenceCount |
| 6 | Authority Ceiling Check | Proposed financial/risk mutation within delegated ceiling | Policy State (L4) | Mutation.amount <= Role.authorized_limit |
| 7 | Reversibility & Rollback | Mutation payload contains defined compensating action | Episodic State (L2) | rollback_payload IS NOT NULL |
This directly implements the Delegations-to-be-Supervised (DTBS) lifecycle across the five state domains:
| DTBS Stage | ACG State Domain Mapping | Governance Capability |
|---|---|---|
| Bound | Structural State + Policy State | Enforces role authority limits, entity scope, and policy invariants. |
| Detect | Episodic State + Outcome State | Monitors runtime execution events, outcome metrics, and revalidation triggers. |
| Verify | Precedent State + Evidence Bindings | Executes deterministic pre-assembly admissibility and provenance checks. |
| Recover | Execution Events (Rollback) + Adjudication State | Executes compensating actions, reverts mutations, and routes contested states. |
The PM's State Domain Audit Matrix: 5 Verification Gates for Sprint & PRD Reviews
To ensure product managers can evaluate whether their autonomous agent architecture maintains state integrity across sprints, run this diagnostic checklist:
| State Domain | Architectural Verification Check | Red Flag Condition (State Failure) | PM Mandate & Action |
|---|---|---|---|
| 1. Structural State (L1) | Are user roles, authority ceilings, and account scopes linked to IAM identity tokens? | Agent evaluates policy without verifying if the user has approval authority. | Block PRD. Enforce IAM role validation in application middleware before prompt creation. |
| 2. Episodic State (L2) | Does every tool mutation serialize an immutable rollback payload and execution snapshot? | Tool mutations write directly to production DB without a compensating rollback path. | Require explicit rollback definitions in tool schemas; store in execution_events. |
| 3. Precedent State (L3) | Do overrides include bounded applicability scopes, mandatory TTLs, and review triggers? | Overrides written as open-ended text in vector stores without expiration dates. | Reject PRD; mandate structured precedent schemas with automated TTL pruning. |
| 4. Policy State (L4) | Are business rules compiled into executable ASTs and decoupled from prompts? | Business policies updated by editing system prompt markdown files in Git. | Mandate Policy-as-Code schema registry; execute policy invariants deterministically. |
| 5. Adjudication State (L5) | Do contested agent judgments and multi-stakeholder disputes enter structured workflows? | Disputed agent actions resolved via informal Slack conversations or manual DB patches. | Route disputed actions to adjudication_cases with multi-signature sign-off requirements. |
How Does an Underwriting Agent Execute Against Governed State in Production?
To see the five state domains, the Temporal Validity Engine, and the Classification Gate in action, trace an execution cycle:
sequenceDiagram
autonumber
participant Human as Senior Credit Officer
participant Gate as Classification Gate
participant Agent as Underwriting Agent
participant DB as PostgreSQL State Store
participant TVE as Temporal Validity Filter
Agent->>DB: Query Precedents for Borrower X
DB->>TVE: Run Admissibility Query (TTL, Scope, Policy Rev 4.2)
TVE-->>DB: Filter Expired and Revoked Records, Retain Active Precedent
DB-->>Agent: Ingest Admissible Precedent and Evidence Metadata
Agent->>Agent: Generate Compliant Proposal with Proof Dossier
Agent->>Human: Present Recommendation with Linked Evidence
alt Human Confirms Recommendation
Human->>Gate: Approve
Gate->>DB: Log Execution Event and Rollback Payload
else Human Refines Terms
Human->>Gate: Adjust Covenant - Require Monthly Cash Flow Audit
Gate->>Gate: Verify Senior Officer Authority Tier
Gate->>DB: Update Precedent Scope and Log Execution Event
else Human Disputes Exception Applicability
Human->>Gate: Reject Exception Precedent
Gate->>DB: Route to Adjudication State for Committee Hearing
end
The Execution Trace:
- The Ingestion Query: The Underwriting Agent queries PostgreSQL for applicable precedents matching
Borrower X(\$10M facility, DSCR 1.18x). - Admissibility Filtering: The database query filters candidate records through the Temporal Validity conditions (
valid_until > NOW() AND parent_policy_revision_id = 'pol_rev_4_2' AND NOT EXISTS (SELECT 1 FROM precedent_revocations WHERE precedent_id = p.precedent_id)). Stale pandemic exceptions and revoked precedents are excluded at the SQL layer. - Inference Under Proof: The agent receives the valid precedent and generates an approval recommendation that explicitly references the active policy waiver, linked evidence hashes, and required covenants.
- Supervised Human Review: The Senior Credit Officer reviews the structured proposal. Because the system presents the exact authorizer, policy dependency, and evidence chain together, supervisory verification friction is eliminated.
- Compounding Mutation: The officer confirms the override with a minor covenant refinement. The Classification Gate validates the officer's role tier, updates the precedent's scope in
precedents, and records the execution and rollback payload inexecution_events.
Which Architectural Anti-Patterns Destroy State Integrity?
When engineering teams implement persistent state for AI agents, they frequently commit five predictable architecture mistakes:
| # | Anti-Pattern | Root Architectural Flaw | Operational Consequence | Engineering Correction |
|---|---|---|---|---|
| 1 | The Vector Dumping Ground | Conflating similarity with legal admissibility. | Hallucination compounding; outdated overrides leak into prompts. | Isolate Layer 2 event logs from Layer 3 precedents with deterministic SQL admissibility filters. |
| 2 | The Perpetual Precedent | Missing TTLs and dynamic review triggers. | Emergency exceptions become immortal shadow operating policies. | Enforce mandatory valid_until timestamps and parent policy revision foreign-key bindings. |
| 3 | Ambient Authority Leakage | Storing overrides without role verification. | Junior analyst workarounds propagate company-wide as binding precedent. | Enforce IAM role hierarchy checks in the Classification Gate before persisting any precedent mutation. |
| 4 | The Graph Database Dogma | Over-engineering storage before validating workflows. | Distributed transaction overhead, consistency breaks, and slowed velocity. | Build relational topology in PostgreSQL with JSONB columns, foreign keys, and pgvector. |
| 5 | Hardcoded Prompt Logic | Embedding business rules in natural language prompts. | Fragile prompt rewrites and evaluation regressions on every policy update. | Decouple Policy State (L4) from LLM prompts; execute business rules as compiled code. |
The Adversarial Stress-Test: Five Critical Inquiries
1. What is the strongest argument against this approach?
Relational and temporal governance of state introduces substantial engineering overhead compared to standard vector RAG pipelines. Maintaining schemas across five distinct state domains with foreign-key constraints, TTL sweeps, and classification gates demands experienced engineering talent and slows initial prototype velocity. For organizations where operational decisions carry low liability, the development cost of an ACG may outweigh its defensive benefits.
The Practical Resolution: Adopt a progressive implementation path. Start with PostgreSQL as a unified transactional store using standard relational foreign keys and pgvector. Implement Structural State (Layer 1) and Policy State (Layer 4) first to enforce basic authority boundaries, and graduate to Precedent State (Layer 3) once human override volume justifies structured exception indexing.
2. Under what circumstances would this fail?
The architecture fails if human operators routinely misclassify interventions at the Classification Gate. If senior reviewers experience approval fatigue and designate ad-hoc, case-specific compromises as reusable enterprise precedents, the precedent layer accumulates contradictory heuristics. Furthermore, if database query latency spikes due to unindexed recursive traversals or oversized JSONB payloads during live inference, agent execution will breach operational SLAs and fall back to defaults.
The Practical Resolution: Decouple precedent persistence from synchronous human review interfaces. When an operator records an override, route the entry to an asynchronous review queue staffed by domain leads before promoting it to active Precedent State. To protect runtime SLAs, store compiled precedent evaluations in materialized denormalized caches with sub-millisecond retrieval keys and run complex graph resolutions out of band.
3. What would a skeptical customer, client, or colleague object to?
A skeptical engineering leader will argue that building a custom state architecture inside PostgreSQL reinvents mature knowledge management platforms or distributed graph databases without their specialized tooling, creating schema migration overhead.
The Practical Resolution: An ACG operates as a transactional state machine governing autonomous agent authority. General-purpose knowledge bases lack transactional rollback guarantees, cryptographic audit hashes, and fine-grained temporal TTL enforcement. When teams keep the ACG in PostgreSQL, they use existing disaster recovery, point-in-time recovery, and ACID transaction isolation without distributed synchronization lag.
4. Which alternative deserves more consideration?
Externalized Policy Engines paired with hybrid lexical-vector retrieval. An enterprise could standardize on Open Policy Agent (OPA) or Cedar for deterministic rule validation instead of maintaining custom precedent tables and classification gates inside the operational database, leaving contextual memory in an enterprise search layer (such as Elasticsearch). This separates governance from application state and relies on established policy compilers.
The Practical Resolution: OPA and Cedar excel at evaluating deterministic boolean permissions, whereas historical episodic outcomes, evolving case-law precedents, and temporal exception decay require relational state tracking. Teams can run OPA or Cedar as the runtime policy compiler for Policy State (Layer 4) while anchoring Precedent State (Layer 3) and Outcome State (Layer 2) in PostgreSQL to preserve causal lineage between exceptions and observed business results.
5. What am I assuming that may not be true?
This architecture assumes that institutional knowledge and human exceptions can be factored into machine-evaluable conditional logic and relational schemas, whereas expert human judgment often relies on tacit domain context that resists structured parameterization.
The Practical Resolution: Design the Precedent State schema with explicit escape hatches. When a human override relies on tacit, non-quantifiable context, classify it as an isolated "Case-Specific Adjustment" (Type 1) so it stays local to that run. When engineers restrict Precedent State to formalizable decision rules, they preserve deterministic integrity while keeping nuanced judgment calls with human reviewers.
One-Line Synthesis
Enterprise AI defensibility compounds when institutional knowledge is governed across relational state domains in PostgreSQL that turn isolated human overrides into auditable, reusable precedent.
This post is part of the systems architecture series on Architecture of Proof. The strategic thesis was established in State Is the Moat in the AI World. This post established the concrete architectural blueprints for building the state layer. The next post examines runtime enforcement: Policy as Code: The Infrastructure Layer Between AI Governance Documents and Enforcement.
Frequently Asked Questions
What is an Accumulated Context Graph (ACG)?
An Accumulated Context Graph is a permissioned, temporal data architecture that represents organizational entities, historical decisions, authorized exceptions, machine-executable policies, and execution outcomes. Connected by immutable provenance and updated through classified human corrections, the ACG ensures that an AI agent acts only on verified, admissible institutional precedents instead of ungoverned semantic memory.
How does an ACG differ from vector search or RAG?
A basic vector-retrieval pipeline optimizes primarily for semantic relevance: retrieving text chunks that look similar to a prompt regardless of whether the information is legally authorized, current, or scoped to the target entity. An ACG establishes admissibility: it verifies that candidate context is attached to an active policy version, authorized by proper institutional authority, within its temporal validity window, and supported by unrevoked evidence.
What are the five governed state domains in an ACG?
The five governed state domains are: (1) Structural State (organizational topology, entities, and effective authority context), (2) Episodic & Outcome State (immutable execution ledger, tool mutations, rollbacks, and observed real-world results), (3) Precedent State (authorized overrides, scoped exception rules, and revalidation triggers), (4) Policy State (machine-executable constraints and policy-as-code definitions), and (5) Adjudication State (active escalations, contested judgments, and committee workflows).
How does an ACG track real-world outcomes without false causality?
An ACG links decisions to observed real-world outcomes (e.g., loan repayment history, error rates) across controlled cohorts. Because correlation does not equal causation, empirical performance generates automated promotion recommendations for governance committees instead of silently rewriting baseline policy without human review.
What is the Classification Gate in human-in-the-loop workflows?
The Classification Gate is an architectural boundary that prevents unvetted human feedback from polluting shared state. When a human supervisor overrides an agent, the gate classifies the intervention into one of five destinations: an isolated case-specific adjustment, a reusable scoped precedent, a formal policy change, an underlying data fix, or a contested judgment routed to Adjudication State.
Does building an ACG require a dedicated graph database like Neo4j?
No. 'Graph' refers to the relational, temporal, and provenance topology of organizational knowledge, not a mandatory database engine. An ACG can begin in PostgreSQL as the governed transactional system of record, using relational tables, JSONB, foreign-key provenance pointers, pgvector for discovery, and recursive queries, with specialized stores added only as scale requires.
Subscribe to the Architecture of Proof Dispatch
Rigorous, decision-forcing systems engineering and AI governance monographs for technical leaders. Delivered periodically, zero spam.