Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ECHO: Forensic Promise Tracker

Deterministic Auditing for Executive Commitments

“Wall Street trades on numbers. ECHO trades on the drift between the promise and the reality.”

ECHO is a stateful forensic engine designed to track, audit, and verify corporate commitments over time (earnings calls, transcripts, SEC filings). Unlike generic RAG systems that summarize, ECHO emphasizes temporal linking, contradiction detection, and a glass-box audit trail you can inspect end-to-end.


The Problem: the “Goldfish Memory” of AI

Most LLM workflows are stateless: they retrieve “similar” chunks from different quarters and treat them as isolated paragraphs. They rarely answer the real investor question:

“Did management keep the promise — or did it drift?”

ECHO approaches this as a pipeline:

  • Extraction (LLM / embeddings): turn messy executive language into structured entities and evidence.
  • Evaluation (code + rules): compare across time and compute alerts/flags consistently.

Architecture: the 5-layer forensic pipeline

ECHO follows a split-brain model: Right Brain for semantic extraction, Left Brain for deterministic evaluation.

1) High-fidelity indexing (metadata-preserving)

We don’t just chunk text; we preserve pointers needed for auditability (speaker/section/quarter/paragraph where possible).

2) Semantic layer (FIBO-lite)

Unstructured language is projected into a strict-ish schema (“FIBO-lite”) for:

  • Financial targets (revenue, margins, EPS, OpEx, CapEx)
  • Tech milestones (process nodes, product timelines)
  • Guidance statements (forward-looking commitments + confidence language)
  • Risk factors (hedges, uncertainty, warnings)

3) State layer (temporal entity resolution)

Entities are linked across quarters (the “same promise” becomes the “same object” across time), enabling differential analysis instead of “fresh summarization” each quarter.

4) Logic layer (deterministic evaluation)

ECHO uses rules and computed signals to flag issues (examples):

if delta_days > 90:
    return "TIMELINE_SLIPPAGE"
if hedge_density > 0.15:
    return "CONFIDENCE_EROSION"

5) Validation layer (glass box)

To reduce “black box anxiety”, ECHO emits a JSON audit trail that includes:

  • the extracted entities + linked occurrences
  • contradiction vectors / slippage metrics (when available)
  • confidence components and why the UI shows a risk banner

Key features

  • Promise timeline: visualize how a commitment evolves quarter-to-quarter (commit → hedge → omission).
  • Contradiction alerts: structured contradictions (timeline shifts, conflicting numbers, silence/omission).
  • Audit mode: a “glass box” JSON viewer that exposes the reasoning / computed signals.
  • Cache warmup for demos: pre-compute a curated Intel query set for instant UX.
  • Live market context (optional): integrate real-time analyst consensus (e.g., via Perplexity) alongside internal management claims.

Tech stack

  • Backend: FastAPI (app/), async PostgreSQL (asyncpg), optional Redis caching
  • Search / RAG: embeddings + hybrid search (langchain, sentence-transformers), reranking (where enabled)
  • LLMs: used for extraction/analysis (Cerebras + OpenAI in this repo’s configuration)
  • Frontend: Vite + React (frontend/), Framer Motion, Lucide icons, custom CSS

Project structure (high level)

echo/
├── agent/                  # Agent & RAG system
│   ├── rag/               # RAG implementation + services
│   │   ├── echo_reasoning.py
│   │   ├── question_analyzer.py
│   │   ├── search_engine.py
│   │   ├── cache_manager.py
│   │   ├── finance_postprocessor.py
│   │   └── data_ingestion/      # Data pipelines (SEC filings, transcripts, etc.)
│   └── prompts.py         # Extraction prompts / schemas
├── app/                   # FastAPI application
│   ├── routers/           # API routes (ECHO endpoints live here)
│   ├── schemas/           # Pydantic models (FIBO-lite)
│   └── websocket/         # WebSocket handlers
├── db/                    # Database utilities
├── frontend/              # Vite + React UI
└── config.py              # Centralized configuration + env accessors

Quick start (local)

Prerequisites

  • Python 3.9+
  • Node.js 16+
  • PostgreSQL (recommended) + pgvector extension if you want vector search in Postgres

1) Install backend

pip install -r requirements.txt

2) Configure environment

Create a local .env (ignored by git) and set at least:

DATABASE_URL=postgresql://username:password@localhost:5432/echo
OPENAI_API_KEY=...
CEREBRAS_API_KEY=...

# Optional (for live market context)
PERPLEXITY_API_KEY=...

# Optional (if you enable redis caching)
REDIS_URL=redis://localhost:6379/0

3) Initialize database tables

python -c "from app.utils.database_init import init_database; import asyncio; import os; asyncio.run(init_database(os.getenv('DATABASE_URL')))"

4) Run backend API

uvicorn app:app --host 0.0.0.0 --port 8000

API docs:

  • Swagger UI: http://localhost:8000/docs
  • ReDoc: http://localhost:8000/redoc

5) Run the frontend

cd frontend
npm install
npm run dev

Open: http://localhost:5173


API highlights

Common endpoints (see /docs for the authoritative list):

  • GET /echo/config: dynamic tickers/quarters for the UI
  • POST /echo/analyze: run the ECHO verification flow
  • GET /echo/cache/list: list cached queries
  • GET /echo/cache/query/{hash}: retrieve a cached result
  • POST /echo/cache/warmup: precompute a demo cache set

Example request:

curl -X POST http://localhost:8000/echo/analyze \
  -H "Content-Type: application/json" \
  -d '{
    "question": "Did Intel deliver on their 18A process node promise from Q4 2024?",
    "company_id": "INTC",
    "anchor_quarter": "Q4 2024",
    "verification_quarters": ["Q1 2025"]
  }'

Data ingestion

See agent/rag/data_ingestion/README.md for the full guide. Useful entry points:

# Create tables
python agent/rag/data_ingestion/create_tables.py

# Ingest SEC filings / transcripts (see scripts in agent/rag/data_ingestion/)
python agent/rag/data_ingestion/ingest_sp500_10k.py --max-tickers 5

Intel demo helpers (optional):

  • agent/rag/data_ingestion/ingest_8k_filings.py
  • agent/rag/data_ingestion/fetch_yahoo_financials.py
  • agent/rag/data_ingestion/download_all_intel.sh

License

MIT License

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages