Market sentiment & panic interceptor
About this agent
Market Sentiment & Panic Interceptor watches for macro market shocks โ a Nifty drop, a VIX spike, a crude oil shock, a rate decision โ and tries to get a reassuring, personalised message in front of a client's advisor before the client panics and redeems or cancels a SIP. When a threshold breaches, it pulls that client's long-term behavioural history from project memory and segments them as Panic-Prone, Goal-Focused or Opportunistic from keyword markers in past anxiety, goal or dip-buying language; segmentation is non-fatal, so a cold-start client with no history yet falls back to Unclassified rather than blocking the run. That segment steers the tone of a single LLM call that drafts a 3-paragraph advisor-to-client message plus a 2-sentence shareable summary, with connectedDB pulling in macro news and the client's holdings and passMemory pulling in their prior anxiety history. The shareable summary is wrapped into a branded, forward-ready 'Market Insight Card' carrying a referral link, so a reassured client can pass it to an anxious friend without exposing any personal portfolio detail. The drafting prompt explicitly tells the model not to give directive investment advice and not to fabricate numbers it wasn't given. A session is opened for the duration of one interception and closed afterwards, which promotes its memory into the firm's CLIENT_HISTORY project; an audit-trail entry is written for every draft, and post-send client feedback can be logged back atomically. The real market feed and event categorisation are left as extension points โ the shipped categoriser is a keyword heuristic over the snapshot, not a live news classifier.
What changed with Zenmem?
The same agent, built twice against the same contract โ once on Zenmem, once on MongoDB + LangChain/LangGraph.
Before โ after
Before With Zenmem
What the team gained
- Anxiety markers, past panic logs and goal timelines live in one client scope, so the next market event reads a behavioural picture built over years rather than starting cold.
- The audit-trail entry for a drafted intervention is written into the same scope it was drafted from, so what was sent and why it was sent are never two stores apart.
- A session brackets one interception for lifecycle tracking while reads and writes go straight to the durable scope, which keeps a client's history from depending on a session that failed to close.
- Referral stats accumulate against the same client record without a separate analytics table.
- A new event type is a value, not a migration across every client's history.
How memory is scoped
A session is opened for the duration of one interception and closed at the end, so its lifecycle is tracked โ but the actual reads and writes go straight to project scope, projectId CLIENT_HISTORY: fetching a client's anxiety markers and goal timelines, drafting the message, and logging the audit-trail entry all target that project directly rather than staging through session scope first. CLIENT_HISTORY is where anxiety markers, past panic logs, goal timelines and referral stats live long-term across every future event.
How it works
From a market snapshot to a client-ready message and a referral card.
Detect the trigger
A market snapshot โ Nifty, VIX, crude oil, rate decisions โ is checked against configurable thresholds and the breach is categorised.
Segment the client
Project memory is fetched and the client is classified as Panic-Prone, Goal-Focused, Opportunistic or Unclassified from keyword markers in their history.
Draft the message
callLLM drafts a 3-paragraph advisor-to-client message plus a 2-sentence shareable summary, with tone guidance matched to the client's segment.
Build the referral card
The shareable summary is wrapped in a branded forward-to-friend text card carrying a referral link back to the advisor.
Log and close
An audit-trail entry is written to project memory and the session ends; client feedback after the message is sent can be logged back atomically.
What it does
The trigger engine, profiler and drafter behind one CLI run.
Capabilities
- Evaluates a market snapshot against configurable thresholds: Nifty single-session drop (default 1.5%), VIX spike (default 15%), crude oil shock (default 5%), or a rate-decision headline.
- Categorises each triggered event as Geopolitical, Monetary Policy, Sectoral Shock or Unknown from the shape of the breach.
- Segments each client into Panic-Prone, Goal-Focused, Opportunistic or Unclassified by matching keyword markers against their fetched project-memory history.
- Adapts the drafting prompt's tone to that segment โ extra reassurance and explicit guardrails for Panic-Prone clients, goal-timeline anchoring for Goal-Focused ones.
- Drafts a 3-paragraph advisor-to-client message plus a 2-sentence shareable summary in one callLLM call, with connectedDB and passMemory pulling in macro news, the client's holdings and their anxiety history.
- Wraps the shareable summary in a forward-to-friend 'Market Insight Card' carrying a referral link tied to the client's id.
- Records an audit-trail entry for every draft generated, and can log post-send client feedback atomically via a transaction.
- Runs as a CLI against a client-list JSON file and a manually supplied market snapshot, or as a continuous polling loop via the optional scheduler.