Key Takeaway: Most retail equity screeners stop at surface-level P/E multiples, while generic LLM chatbots hallucinate financial numbers when asked to analyze stocks. The Equity Research AI Agent combines deterministic PyKX / KDB-X columnar scoring, official NSE XBRL Ind-AS 108 segment parsing, 5-year FCFF DCF & IRR/MOIC modeling, and PyMuPDF forensic annual report auditing under a strict Actual-Data-Only invariant—strictly for financial education and quantitative research.
Doing systematic fundamental research on Indian equities requires stitching together scattered primary sources: annual financial statements, quarterly earnings surprises, Ind-AS 108 segment disclosures buried in NSE XBRL filings, Screener shareholding patterns, and 300-page annual reports containing Independent Auditor's Reports and CARO disclosures.
The Equity Research AI Agent (ca-manmohan/Equity-Research-AI-Agent) packages this institutional diligence pipeline into an open-source, MIT-licensed Python toolkit, CLI, and JSON-RPC 2.0 MCP Server compatible with Claude Code, ChatGPT/Codex, Cursor, Windsurf, and Antigravity.
The 4-Stage Institutional Research Pipeline
The agent moves systematically from investor mandate configuration to forensic verification and standardized reporting without fabricating missing data points:
Maps return expectations and drawdown tolerance onto 6 quantitative archetypes, then computes cross-sectional Z-scores and a 100-point 6-pillar grade using PyKX binary .kdb tables.
Parses uploaded Annual Reports and Independent Auditor's Reports (PDF) with page-level citations for Adverse/Going-Concern opinions, CARO/ICFR flags, RPTs, and pledge risks.
Compiles 5Y FCFF DCF, IRR/MOIC attribution, 5Y trailing P/E bands, 4Q EPS surprises, Ind-AS 108 XBRL segment mix, and a full data provenance table.
Stage 0: Investor Goal Intake & Strategy Weighting
Maps return targets (2x_3x, 3x_5x, 5x_10x_plus), drawdown tolerance, investment horizon, market (IN, CA, US, GLOBAL), and market-cap focus onto six quantitative archetypes: balanced_institutional, compounder_growth, deep_value, policy_capex, conservative_income, and multibagger_hunter.
Stage 1: KDB-X / PyKX Columnar Screening & 100-Point Framework
Financial statements and market histories are cached locally as native .kdb columnar tables (kx.serialize / kx.deserialize), computing sector percentile ranks and Z-scores across six transparent pillars:
| Scoring Pillar | Core Metrics Evaluated | Analytical Purpose |
|---|---|---|
| 1. Balance Sheet & Cash Conversion | CFO/EBITDA, FCF/PAT, Net Debt/EBITDA, Interest Coverage |
Distinguishes real cash compounders from accounting profit inflation |
| 2. Business Quality & Capital Efficiency | ROIC, Incremental ROIC, ROIC–WACC spread, Sales/PAT CAGR |
Measures sustainable value creation above cost of capital |
| 3. Valuation & Margin of Safety | EV/NOPAT, FCF Yield, Reverse-DCF implied growth |
Checks what future growth is already priced into the current market cap |
| 4. Governance, Audit & Litigation | Auditor qualifications, RPT intensity, promoter pledges | Screens for governance red flags and hard-veto triggers |
| 5. Macro, Geopolitical & External Risk | Policy/contract dependency, FX sensitivity, cyclicality | Contextualizes external headwinds and order-book concentration |
| 6. Market Scale & Trading Liquidity | Average Daily Traded Value (ADTV), market capitalization |
Ensures institutional liquidity and execution feasibility |
Stage 2: Forensic Annual Report & Risk Auditor
When supplied with an Annual Report or Independent Auditor's Report PDF (--pdf), forensic_agent.py extracts page-cited risk disclosures via pymupdf (fitz), checking for Adverse or Going-Concern audit opinions, CARO/ICFR internal control flags, contingent liabilities, consortium bank loans, related-party transactions (RPTs), promoter share pledges, and government contract dependencies.
Stage 3: 8-Section Research Memo & HTML Dashboard
Both <SYMBOL>_memo.md and <SYMBOL>_dashboard.html follow a unified eight-section structure:
- Section 0 — Introduction: Company profile, multi-year scale trajectory, Annual Report outlook, capex and order-book briefing with clickable source pills.
- Section 1 — Executive Summary: Composite quality verdict, material disclosure briefing, and integrated forensic audit & solvency summary.
- Section 2 — Price Trend, 5Y Returns Analysis & Valuation Bands: 52W / 50-DMA / 200-DMA chart, 5-year IRR / MOIC Returns Scenario Model & Value Attribution (EBITDA growth vs. multiple shift vs. cash/dividends), 2-way sensitivity matrix, and 5-year monthly Trailing P/E Bands (±1 SD).
- Section 3 — Latest Earnings Highlights: 4-quarter EPS Beat/Miss Surprise %, 30-day forward EPS revisions, YoY/QoQ variance table, and source-attributed earnings release briefings.
- Section 4 — Multi-Year Financial Track Record & Segment Mix: 4Y Annual & 4Q Quarterly tables plus conditional NSE Ind-AS 108 XBRL Operating Segment Breakdown (revenue mix, EBIT margin, QoQ/YoY momentum, annualized segment ROCE).
- Section 5 — Intrinsic Cash-Flow Valuation (DCF) & Equity Bridge: 5-year Unlevered FCFF projection, WACC × Terminal Growth sensitivity grid, and EV/EBITDA SOTP check.
- Section 6 — Ownership Flow, Consensus & Competitive Moat Matrix: Screener.in FII/DII/Promoter shareholding trends, NSE Form C insider disclosures, analyst consensus, relative performance vs. Nifty 50 / S&P 500 / TSX, a 2×2 Competitive Positioning Matrix, and a 4-Pillar Structural Moat Scorecard.
- Section 7 — Analytical Conclusion, Rating Framework & Data Provenance: Key analytical drivers, composite Grade (A+ to D), 6-pillar scoring reconciliation table, live Data Sources & Strict Actual-Data Verification, and SEBI Disclaimer.
100% Public Data Feeds & Strict Actual-Data Policy
Every data pipeline relies strictly on free public exchange and regulatory sources—zero paid API keys required—and enforces an Actual Data Only invariant:
| Data Stream | Provider / Source | Coverage |
|---|---|---|
| Financial Statements & Quotes | Yahoo Finance (yfinance) |
Annual & Quarterly Income Statement, Balance Sheet, Cash Flow, Market Cap, 1Y/5Y Price History, EPS Surprises & Analyst Estimates |
| Statutory Segment Breakdown | NSE India Integrated Filings | Ind-AS 108 / Banking quarterly Segment Revenue, EBIT, Capital Employed, Ann. ROCE & QoQ/YoY deltas parsed directly from official XBRL XML filings |
| Indian Ratios & Shareholding | Screener.in Consolidated Pages | Quarterly Promoter / FII / DII / Public shareholding shifts, 5Y ROCE trend, Debtor / Inventory / Payable Days & Cash Conversion Cycle |
| Exchange & Media Disclosures | Google News RSS + NSE Announcements | Dated corporate filings, credit rating actions, concall notices, order-book disclosures & insider PIT disclosures |
| Local Columnar Cache | KDB-X / PyKX (.kdb) |
High-speed binary cache of verified historical pulls (TTL: 12h default; force_refresh supported) |
| Primary Filings (Optional) | User-Supplied PDFs / Screener .xlsx |
Independent Auditor's Reports, Annual Reports (--pdf), or 10-year Screener Excel exports |
To guarantee analytical integrity across quantitative scoring and valuation:
- Zero Synthetic / Mock Fallbacks: Missing statements, unavailable XBRL segments, or unpopulated ratios are never fabricated; unavailable cells render transparently as
—. - No Unfounded Balance-Sheet Zeroing: Missing debt or cash lines default to
NaN(not0.0) unless verified in an actual balance sheet. - Strict DCF & Returns Gating: 5Y FCFF DCF and 5Y IRR/MOIC scenarios run only when verified revenue, positive trailing EBIT/EBITDA, shares outstanding, CMP, and observed CAGR exist.
- Zero Look-Ahead EPS Imputation: 5-year trailing P/E bands map historical prices strictly against matching or previously reported fiscal EPS—never backfilling future EPS onto earlier periods.
Multi-Agent Compatibility & Quick Start
Clone the repository once and use it via CLI, deterministic offline mode (--offline), OpenAI function calling, or as a native MCP Server:
| Agent / IDE | Auto-Discovered Files | Integration Mode |
|---|---|---|
| Claude Code / Anthropic Plugins | CLAUDE.md, .mcp.json, .claude-plugin/plugin.json, skills/*/SKILL.md |
Loads indian-investor-mcp via .mcp.json and slash skills (/dcf-india, /earnings-india, etc.) |
| OpenAI Codex / ChatGPT Agents | AGENTS.md, skills/registry.json, agent_tools.py |
Discovers and invokes all 12 tools + list_skills via OpenAI function schemas or MCP |
| Antigravity / Cursor / Windsurf / Gemini CLI | AGENTS.md, .mcp.json, skills/*/SKILL.md, agents/*.md |
Reads universal instructions & spawns stdio MCP tools or CLI commands cleanly |
Installation & Essential Commands
# 1. Install dependencies
git clone https://github.com/ca-manmohan/Equity-Research-AI-Agent.git
cd Equity-Research-AI-Agent
pip install -r requirements.txt
# 2. Generate a single-stock institutional dashboard & memo
python cli.py dashboard RELIANCE.NS --open
# 3. Attach an Annual Report / Independent Auditor's Report PDF for forensic citations
python cli.py dashboard BEL.NS --pdf path/to/AnnualReport.pdf --open
# 4. Run the autonomous multi-step research agent deterministically (zero LLM key needed)
python cli.py run "Find Indian defense or IT compounders, inspect BEL.NS for govt contract risk, and save memo" --offline --open
# 5. Start interactive Stage 0 -> Stage 3 session or launch the MCP server
python cli.py chat --offline
python mcp_server.py
# 6. Run the verification test suite
python -m pytest test_agent.py -v
Open-Source Repository
Access the full source code, documentation, and issue tracker on GitHub:
SEBI Regulatory & Educational Disclaimer
- Not Investment Advice: All quantitative scores, Grades (
A+throughD), Reverse-DCF estimates, 5-year IRR/MOIC scenario models, competitive moat scorecards, and commentary produced by this software are strictly for financial education, software research, and public-filing data synthesis. - Regulatory Status: Neither this utility nor its contributors act as a SEBI-registered Research Analyst under SEBI (Research Analysts) Regulations, 2014 or a SEBI-registered Investment Adviser under SEBI (Investment Advisers) Regulations, 2013.
- No Recommendations: The agent explicitly prohibits Buy/Sell/Hold ratings, target price calls, or personalized portfolio allocation instructions. Always verify primary exchange filings (
nseindia.com,bseindia.com) and consult a SEBI-registered adviser before making any financial decision.