AI Engineer New York 2026
From Filesystems to Databases — Joe Zein, Soal Labs
Loading slides…
Read the talk
From Filesystems to Databases
Joe Zein walks through how Soal Labs turns twenty years of private equity files into a Postgres database that AI agents can query. The hardest part is working out which documents, people and companies are actually the same while preserving the evidence behind each decision.
From a talk by Joe Zein
At a glance
Ideas worth remembering
A fund’s rejected deals, objections and revised assumptions can be as informative as its portfolio metrics. Preserve the distinction between what partners asserted, what the firm prescribed and what later outcomes suggest.
Control processing costs at three levels. Classify files by value and origin, route pages according to their format, and escalate only the fields cheaper extractors leave empty.
Make provenance a database requirement. A typed relationship row can carry its source document, page, confidence and extraction run, giving reviewers a way to check the claim.
Keep candidate generation, match scoring, clustering and value selection distinct. Each can introduce a different identity error, so merges need a reversible history.
Project graphs from Postgres for neighborhood scoring and clustering. Write the results back so ordinary SQL queries, permissions and reporting tools can use them.
Give agents scoped reads and reviewed writes. Nightly processing, structured intake and corrections from daily work keep the initial backfill from becoming another stale archive.
What does the fund know that a model doesn’t?
A managing director who worked in credit at a large fund was looking at a deal. What would he notice immediately that a less experienced analyst might miss? His answer was customer concentration. He would want to know whether too much of the business depended on too few customers.
Joe Zein and his colleagues opened a clean session with a frontier model, described the deal and asked what a credit investor should be asking. The model had no access to the firm’s data. Customer concentration was one of the first risks it raised.
Both had identified a question worth investigating. Whether concentration actually threatened this business was still open. What surprised Zein was how readily the model reproduced an instinct the director thought he had accumulated over years. Much harder to reproduce was the history of when this particular fund had worried about concentration, what it had decided, whom it knew and where it had been wrong.
Zein, co-founder of Soal Labs, works with engineering teams embedded in private capital firms. His view of where to invest in software follows from that example. Firms can buy the agent interface, the model and the connectors. Even the playbooks packaged as agent skills are increasingly easy to copy. The fund’s own history is the part a competitor cannot rent.
The engineering problem is that much of that history lives in terabytes of folders, inboxes, spreadsheets and call transcripts. Giving an agent access to those files leaves it with twenty years of reconciliation work.
What retrieval and connectors leave unresolved
Early retrieval-augmented generation (RAG) systems split documents into chunks and embedded each chunk as a vector representing its meaning. At question time, the system fetched the most similar chunks and gave them to the model. This made it possible to ground an answer in a document. It also made the quality of the answer depend on which few passages won the similarity search.
In an archive full of duplicates, several versions of the same document can occupy those slots. The same question can retrieve different passages on different days. And finding the most relevant passages is a poor way to add up a figure across a thousand files. For that, you need to know which files count, which values belong together and which ones you have already counted.
The Model Context Protocol (MCP) gave agents live access to the customer relationship management system (CRM), file share and warehouse. But those systems were fragmented and often incomplete. The model ended up doing joins in its head on every request, spending tokens to rediscover relationships and sometimes missing obvious ones.
Three subsequent approaches addressed different parts of the problem.
- Context graphs record decision traces. Which inputs mattered? Which rule applied? Who approved an exception? Foundation Capital’s proposal appealed to Zein, but a firm starting today still needs a way to reconstruct yesterday’s decisions.
- Personal second brains let a model accumulate Markdown notes over time. A shared investment operation also needs permissions, consistent identities and a way to aggregate across people’s records.
- Agent harnesses such as Claude Code can plan, call tools, maintain memory and work across applications. Without a shared database, the agent still spends time opening files and searching for somewhere reliable to read or write a fact.
The opportunity Zein sees is to build industry-specific workflows on a shared system of record. Different funds have different histories, but enough of their work is similar that engineers can reuse much of the underlying schema.
Design the database around the deals the fund passed on, too
Where should a fact enter the system, and who can change it? Soal’s pipeline backfills the archive into Postgres, then runs nightly over new material. An intake interface can capture structured data as a document arrives. The agent reads the resulting records through MCP and submits proposed changes for human review.
The schema has five broad areas. People and accounts usually have a partial home in the CRM. Accounts include limited partners, sponsors, lenders and advisers. Deals sometimes live in a private capital CRM such as DealCloud. Industry classifications may come from data providers. Metrics and financials are often well covered by portfolio monitoring systems such as iLEVEL or Chronograph.
That last category has a particularly consequential gap. Portfolio monitoring covers the companies the fund owns. It misses the thousands of opportunities the fund examined and passed on. If you want to understand how its investors screen deals, some of the best evidence is sitting in rejection emails and screening notes.
Zein separates institutional knowledge into three tiers. The raw evidence is what someone wrote or said. The system of record contains extracted facts and relationships, with different mentions of the same person or company resolved to a common identity. Derived knowledge captures the firm’s judgment, processes and preferences. Each tier should remain traceable to the evidence below it.
Even within judgment, it pays to distinguish a thesis a partner asserts, a rule the firm deliberately adopts and a lesson inferred from past deals. An inference can be graded against its supporting evidence. Treating all three alike would make an observed pattern look like firm policy.
Investment frameworks and interviews help fill gaps, but much of the judgment is already in the files. An investment committee (IC) memo records the thesis and named risks. A meeting transcript, when one exists, preserves who objected and why. Changes between financial model drafts reveal which assumptions moved. Later board packs supply outcomes against which to judge the original thesis. The same extraction machinery can recover this history if its schema asks for judgments as well as numbers.
Find copies without throwing away the history
The pipeline has eight stages — crawl, deduplicate, classify, parse, extract, resolve, load and serve. At each stage, the cheapest suitable method gets the first attempt. A shared review screen lets people confirm duplicate groups, document classes, extracted fields and entity merges as the work progresses.
The first two stages make zero model calls. The crawler lists files through the storage provider’s metadata API. libmagic, the library behind the Unix file command, inspects the opening bytes to identify the actual format regardless of the extension. Even simple metadata carries useful clues. Sheet names can distinguish a financial model from a contact list. Folder size can help distinguish a full diligence exercise from an initial teaser.
Deduplication takes two passes.
- Identical files. Python’s
hashlibcomputes a SHA-256 fingerprint. Copies with identical bytes have the same fingerprint. Zein reports that this catches roughly 25–35% of files in the archives he describes. - Near duplicates. The pipeline represents each document as overlapping five-word snippets and uses MinHash through
datasketchto compress that set into a short signature. Locality-sensitive hashing puts similar signatures into common buckets, narrowing the expensive comparisons to likely matches.
File names and timestamps then order each cluster into a version history. Zein reports another roughly 25–40% in the near-duplicate pass. These are candidates for consolidation. If a later draft dropped material, the older version goes to review. The missing passage may be precisely what explains a change in the investment thesis.
The origin of a document determines what it can tell you
Classification makes three decisions before expensive extraction begins.
- Whether to read the file. Exclude code, binaries, Office logs, logos, empty templates and large virtual data room dumps from the model’s input.
- How much to extract. Give a teaser a light pass. Reserve deep extraction for confidential information memoranda (CIMs) and IC decks.
- Which fields to ask for. A received CIM is a source of financial information. An internal IC memo is evidence of the firm’s own judgment.
The distinction changes what an analyst can infer about the fund. A thousand received CIMs in a sector demonstrate deal flow. Ten internal IC decks may tell you considerably more about the expertise the team developed there.
Rules based on extension, path, file name and sheet names do most of the classification. A cheaper model reads one page of the remaining ambiguous files. The fund’s team helps define the categories. In Zein’s experience, ten mutually exclusive classes usually work better than fifty or a hundred that people struggle to distinguish.
Choose a parser for each page
A PDF can contain perfectly readable text, a scanned page and a chart whose numbers make sense only in their original layout. Sending every page through the same parser either wastes computation or loses information. The useful question is which pages actually need a model to see them.
PyMuPDF checks each page for a usable text layer and embedded images. If the page contains text and no images, the pipeline reads the text directly. When position matters, pdfplumber preserves the coordinates of individual characters. For other pages, a small vision-language model examines a thumbnail and decides what should happen next.
A scan needs optical character recognition. Tesseract is one option, and Zein favors PaddleOCR for messier layouts. Tables and charts warrant a stronger vision model such as Claude or Qwen, which transcribes them into Markdown to preserve the relationships among financial figures. Boilerplate can be skipped altogether.
Excel takes a separate path. openpyxl reads the workbook cell by cell, including sheet names and formulas. The workbook already exposes structure that a page image would force the system to reconstruct.
Which inputs need visual interpretation?
Read the diagram as text
- PDF page. PyMuPDF checks the text layer and embedded images.
- Read text directly. Use pdfplumber when character positions matter.
- Classify a thumbnail. A small vision-language model identifies the page type.
- Recognize text. Tesseract or PaddleOCR reads the scan.
- Transcribe to Markdown. A stronger vision model preserves table and chart information.
- Skip the page. Boilerplate needs no further extraction.
- Excel workbook. The input already has sheets and cells.
- Read cells with openpyxl. Keep sheet names and formulas.
- PDF page → Read text directly: Usable text, no images.
- PDF page → Classify a thumbnail: Other pages.
- Classify a thumbnail → Recognize text: Scan.
- Classify a thumbnail → Transcribe to Markdown: Table or chart.
- Classify a thumbnail → Skip the page: Boilerplate.
- Excel workbook → Read cells with openpyxl: Read workbook structure.
Escalate individual fields and keep their sources
Once a document is readable, the unit of work changes again. The pipeline now decides how to fill each field. Data already present in the CRM, iLEVEL or DealCloud maps directly through the relevant API. There is little reason to ask a language model to rediscover it.
For long documents, LangChain’s recursive splitter produces chunks of about 4,000 characters, roughly 1,000 tokens. It prefers paragraph boundaries, then lines, then words. Neighboring chunks overlap by 10% to reduce the risk of losing context at a split. These chunks are inputs to extraction. The eventual query will run over the resulting records.
The extraction cascade starts with spaCy, which runs on a CPU and tags standard entities such as people, organizations, places, dates and amounts of money. GLiNER handles custom labels such as sponsor, lender or covenant. Its zero-shot capability lets the team supply those labels at runtime without training a new model for each category.
Only fields that remain empty reach the large language model. A typed Python class in Pydantic defines the target. The pipeline passes its JSON Schema to Claude as a tool and requires a tool call, giving the application a structured result. What does that result look like for a relationship between a person and a company? The target row includes the person, company, role and start date, together with the source page and confidence score. The pipeline also records which run produced each field.
The relationship lives in a join table connecting people and companies. A NOT NULL constraint requires a source document reference. A foreign key requires that the referenced document exist. Those constraints make provenance mandatory even if the extraction code makes a mistake. They cannot establish that the person actually held the role, which is why retaining the page matters.
A conventional knowledge graph can represent a relationship as a subject, predicate and object. That open-ended form is useful when the team wants to discover relationships it has yet to specify. REBEL can propose such triples from sentences. The candidates still land in tables, where the team can inspect them alongside the explicitly modeled relationships.
Decide which mentions could refer to the same entity
Entity resolution consumes much of the engineering effort. Consider the errors a name-based rule would make. GS and The Goldman Sachs Group may refer to one organization. Two companies called Vertex may be entirely unrelated. Fund III and its co-investment vehicle have a real relationship and still need separate identities. Acquisitions introduce renamings, parents and subsidiaries.
The pipeline narrows the problem in three steps.
- Resolve references inside each document. Link a pronoun or a phrase such as the company to the name it refers to. Coreferee works as a spaCy plugin.
fastcorefoffers a neural alternative. - Normalize comparable fields.
cleancostrips legal suffixes such as Inc. and LLC.nameparserseparates the parts of a person’s name.libpostalstandardizes addresses. - Generate plausible pairs. Start with shared keys such as web domains, CRM IDs and the 20-character Legal Entity Identifier (LEI). Broaden the search with Postgres’s
pg_trgm, which compares three-character fragments, andpgvector, which supports meaning-based similarity.
That last step is called blocking. An all-against-all comparison can produce billions of pairs. Blocking makes scoring tractable by deciding which pairs deserve comparison. Finding a candidate on the strength of a similar name or shared domain leaves the identity decision open.
Use shared neighbors to score a match
When two names are inconclusive, look at the company they keep. A mention records one appearance of an entity in a document. From these rows, the pipeline builds a co-occurrence graph. Two entities get an edge if they appear in the same document. The edge weight counts how many documents they share. NetworkX then lets the pipeline compare the neighborhoods of two candidate records.
How much do the two neighborhoods overlap? In Zein’s example, both candidates appear alongside Acme Health, Project Falcon and R. Patel. Across the two neighborhoods there are five distinct neighbors. The Jaccard coefficient divides the size of the intersection by the size of the union.
The 0.6 measures neighborhood overlap. It does not mean there is a 60% probability that the records describe the same person. And some neighbors are more informative than others. Sharing an obscure portfolio company says more than sharing Goldman Sachs. Adamic–Adar is an alternative score that gives more weight to such rare shared neighbors.
From similarity to match probability
The neighborhood score becomes one input to Splink, an open-source record linkage library developed by the UK Ministry of Justice. For each comparison, such as name, domain or neighborhood agreement, the statistical matcher estimates how often that level of agreement occurs among genuine matches and how often it occurs by chance. Agreement that is common by chance supplies relatively little evidence. Combining the comparisons yields a match probability.
Splink learns those rates from the archive using expectation maximization, so the team can start without a hand-labeled training set. Jaro–Winkler similarity gives extra credit to names with matching beginnings. RapidFuzz provides fast fuzzy string comparisons and sorting. The matching job can run locally on DuckDB or at larger scale on Spark.
Soal uses explicit thresholds for the resulting probability.
- Above 0.95 — merge automatically and spot-check a sample.
- From 0.5 through 0.95 — send the pair to a person.
- Below 0.5 — keep the records separate.
From matched pairs to one record
Pairwise decisions create a second graph. Here an edge represents a match, whereas the earlier graph connected entities mentioned together. Connected components provide a first clustering. If A matches B and B matches C, all three land in the same component. One weak link can therefore join two otherwise unrelated groups. The pipeline uses Leiden to split oversized components into more tightly connected communities.
A final rule, called survivorship, chooses which values to keep when the merged records disagree. The CRM takes priority over internal documents, which take priority over received CIMs. Recency breaks ties within that ordering. The system logs every merge and can reverse it.
Keep the records in Postgres and compute graphs when needed
Both graphs do useful work, yet neither requires a second database. When an algorithm needs a graph, the pipeline projects the relevant Postgres rows into NetworkX or the faster C-based igraph library. It runs the computation and writes the scores or cluster results back as rows.
Postgres handles the operational concerns. An update can commit in full or roll back. Row-level security lets the deal team and investor relations see different rows in the same table. The data is available to dbt, the warehouse and business intelligence tools. Zein also finds models more familiar with SQL than with Cypher, a graph query language.
Even a common graph-shaped question fits comfortably in SQL. Who do we know at this company within two hops? A recursive common table expression (CTE) starts from the company, follows its relationships and joins again to find the next set of connections. For the traversals these funds need, maintaining another database would add synchronization work without buying a necessary capability.
Give the agent small queries and a way to propose changes
With a reliable database in place, the agent layer gets considerably smaller. Soal uses an existing MCP client and builds a few domain servers with the official MCP Python SDK. Deals, people, portfolio and documents have separate tools. Splitting them along permission boundaries keeps the menus short and lets investor relations and the deal team work with different information.
A skill supplies instructions for one job, such as screening a deal, preparing for an investment committee meeting, updating limited partners or watching covenants. The agent can pick up the current deal from the application where someone invokes it. Reads go directly to the system of record. A proposed write appears in a review screen for a person to confirm.
What does the two-hop question look like at the tool interface? The agent supplies a company ID and a hop limit of two. Behind that typed signature sits one SQL query. The agent receives the matching rows, compact enough to leave room in its context window for the actual task.
Given the same records and permissions, the query can return the same relationships each time. Nobody has to search through pages of meeting notes again to reconstruct them. Confirmed rows trace back to the reviewer, and another skill can reuse the query without reindexing the archive. The eventual output might be a risk flag, a task, a precedent, a follow-up question or a draft, each citing the records behind it.
Move the work to the moment the information arrives
The historical backfill gets the database started. Three ongoing inputs keep it useful.
- Nightly batches process new files. Where a few hours of latency are acceptable, Zein reports that model providers’ batch APIs can cut the price by as much as half.
- Intake interfaces capture structured information when a CIM first arrives, while someone is already working with it.
- Agent proposals bring corrections and newly learned information back from everyday work, with a person confirming the write.
Incoming extraction results also pass through a confidence check. High-confidence results can be accepted automatically with sampling. The middle band goes to a reviewer. Low-confidence results go back through extraction. This differs from the entity matcher’s low-probability outcome, where the sensible action is simply to leave two records apart.
Zein’s blunt rule of thumb is that a tool that is right 70% of the time gets used 0% of the time. That is why review belongs in the product. Someone who spots an incorrect relationship needs a way to fix the shared record so the next analyst gets the benefit of the correction.
Over time, the work shifts from excavating documents to capturing information at its source. A better model may help every credit investor recognize customer concentration as a potential risk. Only this fund can accumulate a usable history of the deals where it raised that concern, the decisions that followed and what happened afterward.
Full transcript
Loading transcript…