Persistent Reasoning Engine for Evolving Enterprise Knowledge Models

By Amar Kumar

A proposed persistent reasoning engine that ingests evolving public documents — SEC filings, annual reports, shareholder letters, earnings transcripts, and news — and maintains a continuous enterprise knowledge model over time. Each new document would update existing enterprise state rather than produce an isolated summary. Version 1 would validate the architecture on multi-year Microsoft and Amazon annual reports using Python, FastAPI, PostgreSQL, and LLM-driven structured extraction.

Proposed outcome: A working prototype that extracts doctrine, capabilities, obligations, risks, management decisions, and causal relationships into a versioned enterprise graph — with year-over-year diffs and trajectory views, not stock recommendations.

Scenario

This brief describes a proposed solution — not a delivered engagement. It maps a pattern for builders who need organizational continuity across documents, not per-document RAG answers.

Problem

Document summarization and RAG pipelines fail the continuity requirement:

Summarization vs persistent reasoning

DimensionDocument summarizationPersistent reasoning engine
Unit of outputPer-document summaryEvolving enterprise state
On new inputGenerate new textMerge, supersede, or extend existing objects
MemoryStateless or retrieval-onlyAuthoritative state store with provenance
QueriesWhat does this filing say?What changed in obligations since last year?
TimeImplicit in document dateFirst-class versioning and trajectory

Requirements

Functional

Non-functional

Architecture

Four layers: ingestion normalizes source documents; extraction produces candidate objects; reconciliation merges into authoritative enterprise state; temporal API serves state snapshots and diffs.

flowchart TB classDef ingest fill:#dbeafe,stroke:#2563eb,color:#1e3a8a classDef process fill:#ede9fe,stroke:#7c3aed,color:#5b21b6 classDef data fill:#ccfbf1,stroke:#0d9488,color:#115e59 classDef api fill:#f1f5f9,stroke:#64748b,color:#334155 classDef ext fill:#f8fafc,stroke:#475569,color:#334155 EDGAR["SEC EDGAR\n10-K · 10-Q · 8-K"]:::ext PDF["PDF / HTML\nletters · transcripts"]:::ext ING["Ingestion service\nparse · sectionize"]:::ingest EDGAR --> ING PDF --> ING EXT["Extraction agent\nLLM structured output"]:::process REC["Reconciliation engine\nmerge · supersede"]:::process ING --> EXT EXT --> REC PG[("PostgreSQL\nenterprise_objects · versions\nprovenance · snapshots")]:::data GRAPH[("Graph layer\nAGE or Neo4j\ncausal edges")]:::data REC --> PG REC --> GRAPH DIFF["Temporal diff service"]:::process API["FastAPI\nstate · diff · graph"]:::api PG --> DIFF GRAPH --> DIFF DIFF --> API

Architecture — ingestion, extraction, reconciliation into versioned enterprise state, temporal diff API

sequenceDiagram autonumber participant S as Scheduler participant I as Ingestion participant E as Extraction participant R as Reconciliation participant DB as PostgreSQL participant G as Graph participant API as FastAPI S->>I: new 10-K available I->>I: parse PDF sections I->>DB: store document + spans I->>E: section batches + state context E->>E: LLM extract candidates E->>R: validated objects R->>DB: load current snapshot R->>R: merge plan R->>DB: apply version + provenance R->>G: upsert causal edges R->>DB: freeze snapshot API->>DB: diff vs prior year API-->>API: trajectory response

Ingestion sequence — each filing updates authoritative state rather than appending a summary

Component map by layer (count of major services)

End-to-end flow

Happy-path flow from new public document to updated enterprise model and year-over-year comparison

Enterprise model object categories (illustrative relative volume per multi-year corpus)

Recommendation: FastAPI and PostgreSQL as the core, LLM structured extraction for candidate objects, Apache AGE or Neo4j for causal graphs, and pgvector only for evidence retrieval during reconciliation.

LayerTechnologyWhy
APIFastAPI (Python 3.11)Async ingestion jobs, OpenAPI, Pydantic models
LLMOpenAI / Anthropic structured outputsReliable JSON schema extraction at scale
System of recordPostgreSQLRelational enterprise objects, versions, provenance
Graph (causal edges)Apache AGE on PostgreSQL or Neo4jTraversal for causal relationships; AGE avoids second ops stack
Vectors (optional)pgvectorEvidence retrieval for reconciliation context, not primary memory
ParsingUnstructured, pdfplumber, BeautifulSoupPDF tables, HTML SEC exhibits
SEC sourceEDGAR full-text search APIOfficial filing metadata and URLs
QueueCelery + Redis or ARQAsync multi-document ingestion
ObservabilityOpenTelemetry + structured logsTrace extraction and merge decisions

Why not RAG-only? Retrieval returns chunks; it does not maintain authoritative merged state. Vectors support evidence lookup during reconciliation, not replace the enterprise record.

Why PostgreSQL-first? Enterprise objects are relational — obligations reference capabilities; decisions reference risks. Temporal versioning maps cleanly to snapshot tables. A graph extension adds causal edges without abandoning SQL operations.

Component design

1 — Ingestion service

2 — Extraction agent

3 — Reconciliation engine

4 — Temporal diff service

Core reconciliation event schema — merge actions are explicit and auditable:

from enum import Enum
from pydantic import BaseModel

class MergeAction(str, Enum):
    CREATE = "create"
    UPDATE = "update"
    SUPERSEDE = "supersede"
    RETIRE = "retire"

class ReconciliationEvent(BaseModel):
    object_id: str
    category: str
    action: MergeAction
    prior_version_id: str | None
    evidence_doc_id: str
    evidence_span: tuple[int, int]

Suggested phase timeline (weeks) for V1 prototype

Implementation plan

Phase 1 — Schema and ingestion (week 1–2)

PostgreSQL schemas for organizations, documents, enterprise objects, versions, provenance. EDGAR fetch and PDF parse for 10-K on MSFT and AMZN (two years each).

Risk: PDF table extraction quality — benchmark parsers on sample filings early. Rollback: HTML-only path for EDGAR exhibits where available.

Phase 2 — Extraction pipelines (week 3–4)

Pydantic enterprise schemas, per-section LLM prompts, structured output validation, golden-section eval set for Risk Factors and MD&A.

Risk: Schema drift across filing years — version extraction schemas independently. Rollback: manual JSON correction UI for prototype demos.

Phase 3 — Reconciliation and versioning (week 5–6)

Merge engine, object ID stability, snapshot on each ingestion, supersession logic for doctrine and obligations.

Risk: False merges across similar labels — require evidence span overlap threshold. Rollback: flag conflicts for human review instead of auto-merge.

Phase 4 — Temporal diff API (week 7)

FastAPI endpoints: GET /enterprise/{id}/state, GET /enterprise/{id}/diff, causal graph export as JSON.

Risk: Large diff payloads — paginate by category. Rollback: category-scoped diff endpoints only.

Phase 5 — Expanded sources (week 8)

8-K, shareholder letters, earnings transcripts; cross-document entity linking for management decisions.

Risk: Transcript speaker attribution errors — diarization QA sample. Rollback: SEC filings only until transcript quality meets bar.

Phase 6 — Evals and prototype hardening (week 9–10)

Regression suite, ingestion idempotency tests, architecture documentation, V1 demo script for MSFT and AMZN trajectories.

Risk: Eval flakiness from model updates — pin model version in CI. Rollback: human-reviewed golden set as release gate.

Reporting & ops

MetricSourceCadence
Extraction schema pass ratevalidation logsPer document
Merge conflict ratereconciliation audit tablePer ingestion
Object provenance coverageDB constraint checksDaily
Ingestion latencyjob tracesPer run
Eval regressionCI suitePer PR
Snapshot count per orgversions tableWeekly

Prototype dashboard: extraction failures by section, merge action distribution, obligation and risk count trends per fiscal year.

Illustrative build effort split across engine components (% of engineering time)

Proposed deliverables

Following the phased plan above, a V1 build would ship these artifacts:

Effort estimate

Indicative engineering effort for the V1 prototype (assumes two companies × three or more years of 10-K as validation corpus; human review of merge rules during the first month):

ScopeHours (range)
V1 prototype (phases 1–6)200–280 hrs
Ongoing schema tuning, new filing types15–25 hrs/month

The first milestone is a working prototype, not a polished application — scope is deliberately bounded to prove persistent state updates across years.

Glossary

TermMeaning
Enterprise stateAuthoritative structured model of an organization at a point in time
DoctrineStated principles, values, or strategic beliefs expressed by leadership
Active obligationCommitment or constraint the enterprise is bound to fulfill
SupersessionNew object replaces prior version while preserving lineage
ProvenanceSource document, section, and text span supporting an extracted fact
Temporal diffStructured comparison between two enterprise snapshots
EDGARSEC Electronic Data Gathering, Analysis, and Retrieval system
Causal edgeGraph link representing that one enterprise fact influences another