← Back to all projects
Ready

Wilmington Agent Interface — Build Plan

Objective

A simple, single-purpose web chat where a non-technical employee (Caleb, Mary, Brett, Matt) asks questions about the Wilmington / MM Fab acquisition and gets analysis back, with the underlying PDFs and Excel accessible. Backed by Claude over the private DD corpus. Reuses the existing rb.alpineanalytica.com stack. Private (Anthropic no-train / ZDR).

Requirements (from Cole)

  • Employee-facing chat: ask questions, get analysis (not just document lookup)
  • Handles PDFs and Excel (real number analysis on the .xlsx files)
  • Easy for non-technical users incl. Mary (no Claude seat) → shared-password login, just a URL
  • Simple, single purpose — NOT the multi-tenant Outpost product yet
  • Private / confidential

Corpus (already built — done today)

  • Google Drive private folder "Wilmington — Data Room (working copy)" (1UIv-9f5OGnaLSG4TlXsuJ7sstjYT_ojm): 347 files / 47 folders (PDF, Excel, docx) + full zip backup. Owner-only (cole@alpineanalytica.com).

  • Local copy for ingestion: ~/Downloads/wilmington_dr_extract/Sent-Due Diligence List

  • Fast-follow sources: Gmail Wilmington label (~42 threads), signed LOI, employee roster sheet, Spero DD plan, CA 86-272 / nexus analysis.

Options considered

  • A. NotebookLM — zero build, but weak at Excel/number analysis and caps at ~300 sources (<347). Rejected.
  • B. Claude Project (Team) — good analysis, but needs a seat per user (Mary has none). Rejected.
  • C. Custom single-purpose chat on rb.alpineanalytica.com — meets all reqs, reuses stack, seeds the Outpost product later. CHOSEN.

Architecture (v1 — minimal)

  • Ingestion (offline): parse docs → text → chunk → embed → index.
  • PDF: pdfplumber (text) + pytesseract OCR fallback for scanned/image PDFs.
  • Excel: pandas/openpyxl → markdown/CSV so Claude can actually read the numbers.
  • docx: python-docx.
  • Embeddings: local sentence-transformers (keeps index build fully on-machine — no extra vendor).
  • Store: SQLite + FAISS. Manifest maps chunk → source file → Drive link.
  • Backend: FastAPI (matches financials dashboard / reorder tool).
  • /login shared password → signed session cookie.
  • /chat question → retrieve top-k chunks + relevant full docs → Claude API (default claude-sonnet-4-6, escalate to claude-opus-4-8 for heavy analysis) with the Wilmington goal prompt as system → answer + citations + Drive links.

  • /sources browse the docs.

  • Frontend: minimal React (mirror reorder-tool). Login → chat → answers with clickable source links.
  • Privacy: Anthropic API no-train; enable ZDR on the org key before go-live; corpus + index stay on your infra; HTTPS + shared password.

  • Deploy: rb.alpineanalytica.com/wilmington/ behind existing reverse proxy; systemd service like the other two tools.

Non-goals (v1)

  • Multi-tenant / other customers (Outpost product — later)
  • Per-user accounts (shared password for now)
  • Writing/sending anything — read-only, PREP only
  • Live email ingestion (fast-follow)

Implementation plan ([step] → verify)

  1. Scaffold ~/ai-projects-local/wilmington-agent/ (backend/ frontend/ ingest/ .gitignore incl .claude/, README) → verify: tree exists
  2. Ingestion parse: all 347 local docs → text w/ OCR fallback → verify: parsed count + per-type log, list failures
  3. Chunk + embed + index → verify: sample semantic query returns relevant chunks
  4. Backend /chat (retrieval + Claude + goal prompt) → verify: curl a question, get cited answer
  5. Auth (shared password) → verify: unauth blocked, auth passes
  6. Minimal React frontend → verify: browser ask→answer round-trip
  7. Deploy to rb.alpineanalytica.com/wilmington + systemd + proxy → verify: live URL, login, ask works
  8. Hand password to Cole → he distributes to Caleb/Mary/Brett/Matt

Risks / open items

  • Scanned PDFs — many DD docs are likely image-only; need Tesseract OCR. Flag unparseable ones.
  • Excel analysis depth — feed parsed sheet data; add a code-execution tool later if heavy math needed.
  • Embeddings — local (private, chosen) vs Voyage (better quality, +vendor). Start local, revisit.
  • Model cost — default Sonnet; Opus for complex asks. Configurable.
  • ZDR — enable on the Anthropic org key before go-live.
  • Deploy details — reuse financials/reorder deploy steps.

Execution log

  • 2026-07-21: Corpus copied to private Drive (347 files verified byte-for-byte). Plan written. Scaffolding + ingestion pipeline started.

  • 2026-07-21 (build complete, local):

  • Ingestion: all 347 docs parsed; 116 image-only PDFs OCR'd (only 1 truly blank — Demetria Hayward.pdf sig page).
  • Index rebuilt with OCR content: 33,943 chunks (faiss.idx 52 MB + chunks.jsonl 46 MB). Retrieval verified against OCR-only sales agreements.
  • Web layer smoke-tested over HTTP: unauth chat -> 401; shared-password login -> signed cookie; authed chat -> cited, data-integrity-aware answer.
  • Frontend made subpath-portable (API base derived from page URL) so it runs at /wilmington/, a subdomain, or root.
  • Deploy artifacts written: deploy/wilmington-agent.service, deploy/wilmington.conf (Apache subpath snippet), backend/.env.example, deploy/DEPLOY.md.
  • Status: functionally done + verified locally. Remaining = production deploy (needs Cole's server go-ahead) + set password/SESSION_SECRET + enable ZDR + hand off password.