agentleFS
kbhujbalkbhujbal/AlphaAnalyst-open-source-autonomous-equity-research-agent/CLAUDE.md

AlphaAnalyst-open-source-autonomous-equity-research-agent

CLAUDE.md48 starsChanged 7 months agoApache-2.0View on GitHub

You are building "AlphaAnalyst" — an open-source autonomous equity research agent. Given a US stock ticker, it produces a research memo with DCF valuation, news analysis, and full citations. This file pins the architecture. Do not deviate. ========================== MONOREPO STRUCTURE ========================== alpha-analyst/ ├── backend/ Python FastAPI service │ ├── pyproject.toml │ ├── alembic/ │ ├── config/models.yaml │ ├── src/ │ │ ├── settings.py │ │ ├── clients/ external API wrappers │ │ ├── llm/ LiteLLM wrapper + cost tracking │…

The file

We split this CLAUDE.md into the rules it gives an agent

10 rules. About 0 are common, 8 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    All LLM calls go through backend/src/llm/client.py::AnalystLLM.

    line 66
  2. Distinctive:

    Every fact passed to an LLM must include a source identifier.

    line 72
  3. Distinctive:

    If a required input is missing, raise an exception.

    line 73
  4. Distinctive:

    Do not invent API endpoints, SDK methods, library functions, env var names, or shadcn/ui components.

    line 74
  5. Very specific:

    Do not add libraries not in pyproject.toml or package.json.

    line 75
  6. Distinctive:

    All numerical computation happens in Python — NEVER inside an LLM prompt.

    line 76
  7. Distinctive:

    Stop at listed deliverables.

    line 88
  8. Distinctive:

    Ask before: adding dependencies, restructuring, expanding scope.

    line 90
  9. Distinctive:

    No comments unless the WHY is non-obvious.

    line 99
  10. Distinctive:

    No emoji in code, UI, or output.

    line 100

≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

You are building "AlphaAnalyst" — an open-source autonomous equity research agent. Given a US stock ticker, it produces a research memo with DCF valuation, news analysis, and full citations. This file pins the architecture. Do not deviate.

========================== MONOREPO STRUCTURE

alpha-analyst/ ├── backend/ Python FastAPI service │ ├── pyproject.toml │ ├── alembic/ │ ├── config/models.yaml │ ├── src/ │ │ ├── settings.py │ │ ├── clients/ external API wrappers │ │ ├── llm/ LiteLLM wrapper + cost tracking │ │ ├── models/ Pydantic data models │ │ ├── fetchers/ orchestrate clients + cache │ │ ├── agents/ LLM-driven analysis units │ │ ├── modeler/ DCF + comps (pure Python) │ │ ├── orchestrator/ wires agents into pipeline │ │ └── api/ FastAPI routes │ └── tests/ ├── frontend/ Next.js app │ ├── package.json │ ├── app/ App Router pages │ ├── components/ │ ├── lib/ api client, utils, hooks │ ├── types/ generated from backend OpenAPI │ └── public/ ├── docker-compose.yml postgres + redis + (optional) services └── README.md

========================== LOCKED BACKEND STACK

  • Python 3.11+ with uv
  • FastAPI + uvicorn
  • Postgres 16 + pgvector
  • Redis 7
  • LiteLLM (NEVER call provider SDKs directly)
  • Pydantic v2, SQLAlchemy 2.x async + asyncpg, Alembic
  • pytest + pytest-asyncio + respx

========================== LOCKED FRONTEND STACK

  • Next.js 14+ with App Router (NOT Pages Router)
  • TypeScript strict mode (NO any types unless justified in a comment)
  • Tailwind CSS v3 (NO CSS-in-JS, NO styled-components)
  • shadcn/ui for primitives (canary CLI; install components on demand only)
  • TanStack Query v5 for server state (NOT SWR, NOT Redux)
  • Tremor for charts/dashboard components (NOT Chart.js, NOT D3 directly)
  • Lucide React for icons (NOT Heroicons, NOT Font Awesome)
  • Zod for runtime validation
  • next-themes for dark mode
  • openapi-typescript to generate API types from backend OpenAPI schema

========================== LOCKED EXTERNAL APIS (do not invent endpoints)

SEC EDGAR, sec-api.io, Polygon.io, Financial Modeling Prep, Finnhub, MarketAux, Google News RSS, FRED, Voyage AI (voyage-finance-2)

========================== LLM ABSTRACTION RULE

All LLM calls go through backend/src/llm/client.py::AnalystLLM. Never call provider SDKs directly. Tasks map to models in backend/config/models.yaml. Never hardcode a model name in agent code.

========================== ANTI-HALLUCINATION RULES (MOST IMPORTANT)

  1. The LLM is a writer, not a knower. Numbers come from APIs ONLY. LLMs synthesize narrative; they NEVER type numerical facts from memory.
  2. Every fact passed to an LLM must include a source identifier. LLM output must include these citations.
  3. If a required input is missing, raise an exception. Do NOT default-and-pretend. Do NOT fabricate.
  4. Do not invent API endpoints, SDK methods, library functions, env var names, or shadcn/ui components.
  5. Do not add libraries not in pyproject.toml or package.json. Ask first.
  6. All numerical computation happens in Python — NEVER inside an LLM prompt.
  7. Frontend never invents data. If the API doesn't return a field, do NOT default it to "—" or "N/A" silently — show a typed empty state.

========================== API CONTRACT RULE

Backend exposes OpenAPI schema at /openapi.json. Frontend types are generated from this schema with npm run codegen. Frontend NEVER hand-writes types for backend responses. If the frontend needs a field that doesn't exist, update the backend Pydantic model first.

========================== SCOPE DISCIPLINE

  • Implement ONLY what the current phase prompt requests.
  • Stop at listed deliverables.
  • TODOs use # TODO Phase N: ... (Python) or // TODO Phase N: ... (TS).
  • Ask before: adding dependencies, restructuring, expanding scope.

========================== CODING RULES

  • Backend: all I/O async, no blocking calls in routes.
  • Backend: tests for every fetcher and agent; mock external APIs with respx.
  • Frontend: server components by default; "use client" only when needed (state, effects, browser APIs).
  • Frontend: data fetching via TanStack Query hooks in frontend/lib/api/; never fetch in components directly.
  • No comments unless the WHY is non-obvious.
  • No emoji in code, UI, or output.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.