Zenmem
Login
๐Ÿ”

Portfolio diagnostic & overlap engineer

WealthProspectingPython 3.14 ยท CLIzenmem-open/portfolio-diagnostic-engine

View source

About this agent

Portfolio Diagnostic & Overlap Engineer is a prospecting and first-look audit tool for Mutual Fund Distributors and SEBI Registered Investment Advisers. An advisor uploads a prospect's CAS statement โ€” a CAMS/KFintech PDF, a CSV export, or a mobile screenshot โ€” and the agent turns it into a diagnostic conversation: which stocks are duplicated across the prospect's funds, what staying in Regular Plans instead of Direct Plans is costing them over 5, 10 and 15 years, and what goals or anxieties surface in the accompanying chat. The overlap and expense-drag numbers are computed deterministically against a scheme database, never by the LLM โ€” the model's job is turning already-correct figures into plain English for the advisor to read out to the lead, not doing the arithmetic itself. A cheap keyword pass tags psychographic signals (children's education, retirement, home purchase, market-volatility anxiety) alongside the model's own extraction, so something is always captured even if free-text parsing misses a cue. Session memory holds one diagnostic conversation; closing it promotes the findings into a per-firm LEAD_PIPELINE project, so a prospect who returns weeks later with a spouse's statement gets a combined household view rather than a fresh start. Once an onboarding decision is made, the dossier โ€” goal dates, risk tolerance, overlap and drag summaries, pain points โ€” is copied atomically into a separate CLIENT_RECORDS project.

RUNTIMEPython 3.14 ยท CLI
MEMORY TYPESession + project, per lead
SDKzenmem 0.4.4
INTERFACECLI

What changed with Zenmem?

The same agent, built twice against the same contract โ€” once on Zenmem, once on MongoDB + LangChain/LangGraph.

Before โ†’ after

Code for CAS ingestionโˆ’32%

Code for the diagnostic narrativeโˆ’59%

New infrastructure to stand upnone

New dependencies to install0

Schema, collection and index worknone

Pipeline and client book kept aparttwo scopes

Onboarding a lead's whole dossierone transaction

Before With Zenmem

What the team gained

  • The lead pipeline and the active client book are different project scopes on purpose, so a prospect's dossier does not sit in the client record until onboarding actually happens.
  • Onboarding copies that dossier atomically, so a half-copied client cannot exist.
  • One diagnostic run โ€” overlap report, expense drag, psychographic signals, the narrative โ€” is written against one session id and promoted on close.
  • A returning lead's combined history is fetched from project scope for the follow-up, without replaying the original run.
  • Deterministic overlap arithmetic stays outside the model; memory carries the narrative and the signals around it.

How memory is scoped

Session scope holds one diagnostic run โ€” the deterministic overlap report, the expense-drag report, any psychographic signals, and the LLM's narrative โ€” all written against the same sessionId as they're produced. Closing the session (endSession) promotes those facts into project scope, projectId LEAD_PIPELINE, where a returning lead's combined history is fetched for follow-ups. Onboarding a lead copies the dossier again, atomically, into a separate CLIENT_RECORDS project โ€” the prospecting pipeline and the active client book are kept in different projects on purpose.

How it works

One first-look audit, from upload to advisor handoff.

Ingest the statement

A CAS PDF, CSV export or mobile screenshot is parsed into the same holdings model regardless of format.

Compute overlap and drag

Deterministic math against the scheme database โ€” which stocks repeat across funds, and what Regular Plans are costing in rupees over 5/10/15 years.

Tag the psychology

A keyword pass flags goals and anxieties in the lead's chat text; the audit prompt asks the LLM to note them too.

Narrate for the advisor

callLLM turns the already-computed numbers into a plain-English first-look audit, pulling in scheme data and prior session history.

Promote or follow up

Closing the session promotes it to the lead pipeline; a returning lead gets a follow-up drafted from that combined history, or the dossier is copied atomically into client records on onboarding.

What it does

The pipeline behind the `agent1` CLI.

Capabilities

  • Parses CAMS/KFintech CAS PDFs (pdfplumber), CSV portfolio exports (pandas), or mobile screenshots (pytesseract OCR) into a common holdings model.
  • Cross-references holdings against the scheme database to flag stocks held in common across multiple funds, scored 0โ€“100.
  • Calculates the rupee cost of staying in Regular Plans over 5, 10 and 15 year horizons against an assumed pre-cost growth rate.
  • Runs a keyword pass over chat text to tag goals (education, retirement, home, wedding) and anxieties (volatility, underperformance, cost) as they come up.
  • Calls the LLM with the deterministic overlap and expense-drag numbers already computed, so it only narrates them rather than recalculating.
  • Builds an Advisor Handoff Dossier โ€” goal dates, risk-tolerance note, overlap summary, expense-drag summary, recommended next action.
  • Fetches a returning lead's combined project memory to draft a personalised follow-up when new information arrives, such as a spouse's statement.
  • Promotes a lead to client status by atomically copying the dossier and an LLM-written summary into a separate CLIENT_RECORDS project.

Other agents

View all