This file provides guidance to Claude Code (claude.ai/code) when working in
this repository. Keep this file aligned with AGENTS.md (same core rules);
update both in the same change.
Use contexts/README.md as the repository information
entry point for either development or library-usage work.
Pages under contexts/ are agent-facing references designed for progressive
disclosure:
- Read lines 1-80 first. The preview contains
Quick SummaryandContentssections that explain the page's purpose, authority, and scope. - Use that preview to decide whether the page applies. Do not preload sibling pages or follow unrelated links.
- When a page applies, read the entire page before changing code, contracts, or repository guidance. The preview routes work; it does not replace the detailed contract.
- Follow directly linked canonical sources only as the task requires. Avoid deep reference chains and duplicate guidance in working context.
QuantMind is a knowledge extraction and retrieval library for quantitative
finance, built on top of the OpenAI Agents SDK. It is a domain library,
not an agent framework: runtime, tracing, tool scaffolding, and multi-agent
handoff all come from openai-agents.
| Module | Role |
|---|---|
quantmind/knowledge/ |
Pydantic data standard (FlattenKnowledge / TreeKnowledge / GraphKnowledge) — dependency leaf |
quantmind/library/ |
Local persistence and semantic retrieval for canonical knowledge — depends only on knowledge |
quantmind/configs/ |
Operation cfg + typed input models or unions (BaseFlowCfg, NewsWindow, PaperInput) — depends only on knowledge |
quantmind/preprocess/ |
Deterministic fetch / format / clean / time utilities — depends only on utils |
quantmind/rag/ |
Opinionated LlamaIndex document chunking and retrieval — depends only on preprocess |
quantmind/flows/ |
Apex layer: public library operations (paper_flow, collect_news, batch_run) |
quantmind/magic.py |
resolve_magic_input: natural language → (input, cfg) |
quantmind/mind/ |
Cognitive layer (memory protocol); landing via the Agents SDK migration (#71) |
quantmind/utils/ |
Logger only — keep it that way |
The pre-migration agent runtime was removed and archived on the
archive/agent-runtime-final branch. Reference it for history; never
resurrect it into master.
uv venv && source .venv/bin/activate
uv pip install -e ".[dev]"
bash scripts/verify.sh # deterministic required verificationscripts/verify.sh runs five fast-fail steps (ruff format --check,
ruff check, basedpyright, lint-imports, pytest --cov) and must remain
network-free. .github/workflows/ci.yml is the required deterministic CI
workflow. Public-network integrations have separate bounded smoke tests;
.github/workflows/e2e.yml owns their scheduled, manual, and path-filtered
component jobs. Run each applicable smoke test when changing that component
and before publishing. External service availability must not block changes
outside that component. docs/README.md is the single catalog of component
commands; do not enumerate them in this file.
To extend live verification, add a component-specific
scripts/verify_<component>_e2e.py, add a named job to the existing e2e.yml,
extend its precise PR path filter, and add one catalog row. When a second live
job is added, use GitHub-native per-job change detection so PRs run only the
affected component jobs. Do not add another E2E workflow, a generic runner or
registry, or a base E2E class. Do not bypass pre-commit / pre-push hooks unless
the user explicitly authorizes it — fix the underlying issue instead.
- Library, not framework — functions over classes,
Protocolover ABC, no plugin registries, no hook discovery, no CLI. - RAG data plane, not framework — use LlamaIndex directly inside
quantmind.rag; keep upstream types private and do not add retriever, vector-store, provider, or backend registries. - Do not rebuild the agent runtime — use
openai-agentsdirectly; no QuantMind-side facades overfrom agents import .... - Schema models vs runtime evidence — user/LLM inputs and configs use
extra-forbid Pydantic models; knowledge adds
frozen=True; deterministic fetch, preprocessing, and collection values use frozen dataclasses when they do not need validation or JSON Schema (Fetched,NewsBatch). - Import boundaries are contracts —
import-linter(configured inpyproject.toml) pins the dependency graph; never work around a failing contract. - Absolute imports across module boundaries.
- No meaningless wrappers — a method must add logic, abstraction, or a side effect beyond the call it wraps; otherwise inline it.
- Name public operations by intent — follow
contexts/design/operations/naming.md; use stage verbs, and reservepipelinefor deliberate multi-stage composition.
A new feature ships with a unit test and a focused example:
- Tests:
tests/<module>/, subclassunittest.TestCase, mock external services, cover success and failure paths. - Examples:
examples/<module>/, one simple usage per file. - Public operations and sources: update the catalog in
docs/README.mdand follow thequantmind-devcomponent checklist.
- Commit messages: English, Conventional Commits.
- PR titles, PR bodies, and issue bodies: English.
- GitHub Issue, Pull Request, Discussion, and comment body formatting follows the GitHub writing style; never hard-wrap remote prose at 80 columns or another fixed width.
- Code comments and docstrings: English, Google style.
For commit, pull-request, or component-implementation tasks, load the
quantmind-dev skill and follow the matching reference:
.claude/skills/quantmind-dev/SKILL.md(Claude Code).agents/skills/quantmind-dev/SKILL.md(other agent toolchains)
The two copies are identical; when changing the skill, update both in the same change.