Skip to content

Repository files navigation

Synth

Evidence-backed AI diligence for mixed legal and financial document packets.

CI

Warning: Synth is not legal advice or financial advice. It is a document review aid built as a portfolio project. Consult a qualified professional before making decisions based on this software.

Synth is a local-first, CLI-driven diligence system for contract and spreadsheet packets. Drop contracts, cap tables, payment schedules, or vendor invoices into documents/inbox/, run the pipeline, and Synth writes structured JSON, Markdown, HTML, CSV/XLSX exports, PDF reports when Playwright Chromium is installed, and an issue log backed by an evidence ledger.

Live Demo | Artifact Gallery | Case Study

Mock Mode vs AI Mode

Synth runs in mock mode by default, so the repo is cloneable and demoable without an API key. Mock mode is useful for portfolio review, command verification, fixture-backed demos, and deterministic evals. It is illustrative and should not be treated as document-specific legal or financial analysis.

AI mode is enabled only when OPENAI_API_KEY is set in .env.local. The provider layer supports OpenAI-compatible endpoints, validates AI outputs with Zod schemas, and falls back to mock mode when parsing or schema validation fails.

Quickstart

git clone https://github.com/dcablayan/Synth
cd synth
npm install
npx playwright install chromium  # optional, required only for local PDF generation

npm run doctor
npm run demo
npm run dataroom
npm run triage
npm run export
npm run compare
npm run eval
npm run build

Core Workflow

npm run dataroom  # mixed contract + spreadsheet packet analysis
npm run triage    # issue log + evidence ledger
npm run export    # CSV exports + multi-sheet XLSX workbook
npm run compare   # compare two data room runs

The main handoff artifacts are:

Artifact Generated by Path
Data room report npm run dataroom reports/dataroom/
Issue log npm run triage reports/issues/
Evidence ledger npm run triage reports/evidence/
CSV exports npm run export reports/exports/issues.csv, evidence.csv, payments.csv, cap-table.csv
XLSX workbook npm run export reports/exports/dataroom-summary.xlsx
Compare report npm run compare reports/compare/
PDF reports npm run demo or npm run pdf reports/pdfs/ when Playwright Chromium is available
Static portfolio artifacts npm run seed-demo public/demo-artifacts/

Commands

Command What it does
npm run doctor Checks setup, directories, sample docs, mock mode, scripts, and Playwright availability
npm run verify Verifies expected files and scripts exist
npm run demo Runs review, financial extraction, memo, revision, HTML, and PDF attempts on 3 sample contracts
npm run analyze Analyzes documents in documents/inbox/
npm run memo Generates executive memo output for latest analysis
npm run revise Generates revision packet output for latest analysis
npm run pdf Generates PDFs from HTML reports when Playwright Chromium is installed
npm run packet Runs the contract packet pipeline: analyze -> memo -> revise -> pdf
npm run ingest Parses supported contract and spreadsheet files in the inbox
npm run spreadsheet Analyzes CSV/XLSX files into reports/tables/
npm run dataroom Builds a mixed-packet data room report
npm run triage Converts reports into an issue log and evidence ledger
npm run export Writes issue, evidence, payment, cap table, and workbook exports
npm run compare Diffs two data room runs and issue logs
npm run seed-demo Refreshes static /demo fixtures and /artifacts downloads
npm run eval Runs deterministic checks across contract, spreadsheet, data room, issue, export, and compare paths
npm run dashboard Starts the local Next.js dashboard
npm run build Builds the Next.js portfolio site
npm run type-check Runs TypeScript without emitting files

Supported Inputs

Format Extension Use
Plain text .txt Contract review
Markdown .md Contract review
PDF .pdf Text-based contract review
Word .docx Contract review
CSV .csv Spreadsheet and data room analysis
Excel .xlsx Spreadsheet and data room analysis

Scanned image-only PDFs, complex pivot tables, and heavily merged workbook layouts are outside the current scope.

Why Not Just Chat With PDF

Chat-with-PDF tools are useful for ad hoc questions. Synth is built around repeatable diligence artifacts:

  • Schema-validated JSON is the source of truth.
  • Reports, exports, and dashboards render from the same structured data.
  • Every issue has at least one linked evidence item.
  • Missing values use explicit "Not found in the document." style sentinels instead of invented facts.
  • The CLI path can be rerun, audited, and compared across data room versions.

Evidence Ledger

npm run triage creates an IssueLog and an evidence ledger from the latest reports. Each issue includes severity, category, status, source files, recommendation, evidence IDs, and supporting quotes or row references. Evidence items include the source filename, quote or spreadsheet row, verification status, and verification notes when direct evidence is unavailable.

The eval harness checks that every issue has evidence and that every evidence item links back to a valid issue.

Claim Map

Claim Backing command, route, or artifact
Mixed legal and financial packet review npm run dataroom, documents/inbox/*.txt, *.csv, reports/dataroom/
Evidence-backed issue triage npm run triage, reports/issues/, reports/evidence/
CSV/XLSX handoff npm run export, reports/exports/
Run comparison npm run compare, reports/compare/
Static portfolio demo /demo, src/data/demo/, public/demo-artifacts/
Artifact gallery /artifacts, public/demo-artifacts/
Case study /case-study, docs/portfolio-case-study.md
Deterministic checks npm run eval, reports/evals/
Local-first default No API key required; providerMode: "mock" in generated fixtures
AI provider support src/lib/ai-provider.ts, .env.local variables below

Project Structure

src/
  app/                 Next.js routes: /, /demo, /artifacts, /dashboard, /case-study
  cli/                 CLI entrypoints for review, data room, triage, export, compare, eval
  data/demo/           Static fixture data for /demo
  lib/                 Provider, parser, renderer, issue, export, and compare engines
  prompts/             Prompt modules for AI mode
  schemas/             Zod schemas for all structured outputs
documents/
  inbox/               Sample contracts and spreadsheets
public/
  demo-artifacts/      Static downloadable portfolio artifacts
reports/
  reviews/             Contract reviews
  financials/          Financial extraction outputs
  memos/               Executive memos
  revisions/           Suggested revision packets
  html/                Rendered HTML reports
  pdfs/                Rendered PDF reports when Playwright Chromium is installed
  tables/              Spreadsheet analysis
  dataroom/            Mixed-packet data room reports
  issues/              Issue logs
  evidence/            Evidence ledgers
  exports/             CSV and XLSX handoff files
  compare/             Run comparison reports
  evals/               Eval reports
  errors/              Raw AI parsing or validation errors
docs/
  portfolio-case-study.md
  recruiter-summary.md

Using a Real AI Provider

Create .env.local:

OPENAI_API_KEY=your-key-here
OPENAI_BASE_URL=https://api.openai.com/v1  # optional
OPENAI_MODEL=gpt-4o                         # optional

Any OpenAI-compatible endpoint can be used if it follows the expected chat completion contract.

Limitations

  • Synth is a portfolio project and document review aid, not legal, financial, compliance, or production diligence software.
  • Mock mode is illustrative and deterministic; it is not a substitute for live document-specific analysis.
  • AI mode can still be wrong. Outputs should be reviewed against the source documents by qualified professionals.
  • PDF generation requires Playwright Chromium.
  • Text-based PDFs are supported; scanned image-only PDFs are not.
  • Spreadsheet support targets standard tables, not complex workbooks with pivot tables, merged cells, or macros.

Warning: Synth is not legal advice or financial advice. It is a document review aid. Consult a qualified professional before making decisions.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages