Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.git
.venv
node_modules
frontend/node_modules
frontend/dist
backend/data
backend/.env
*.log
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ build/
# 日志
*.log

# Local runtime state
backend/data/

# 系统文件
.DS_Store
Thumbs.db
Expand Down
4 changes: 2 additions & 2 deletions .txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# OpenAI API 配置(使用 DeepSeek)
OPENAI_API_KEY=sk-3acec92e29fe4df383224c493f044c67
OPENAI_API_KEY=your_api_key_here
OPENAI_BASE_URL=https://api.deepseek.com/v1
OPENAI_MODEL=deepseek-chat

# 服务器配置
HOST=0.0.0.0
PORT=8000

TAVILY_API_KEY=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
TAVILY_API_KEY=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
89 changes: 89 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Agent Handoff Notes

This project is a React 18 + FastAPI macroeconomic causal analysis app. The current active product surface is CausalFlow v2.

## Project Structure

Backend:

- v2 router: `backend/app/api/v2_router.py` mounted at `/api/v2`.
- v1 router: `backend/app/api/causal_router.py` mounted at `/api/v1`, legacy.
- v2 service: `backend/app/services/v2_analysis_service.py`.
- API version guide: `backend/API_VERSIONS.md` explains v1 vs v2.

Frontend:

- Main app: `frontend/src/App.jsx`.
- Production components: `frontend/src/components/`.
- Demo files, when present, belong under `frontend/src/demo/`.

Documentation:

- v2 docs: `docs/v2-architecture.md`, `docs/v2-api-guide.md`, `docs/v2-runbook.md`.
- Roadmaps: `CAUSAL_FLOW_ROADMAP.md` and `PROJECT_ROADMAP.md`.
- Cleanup report: `CLEANUP_REPORT.md` records the 2026-05-06 cleanup when present.

## Current v2 Entry Points

- Backend router: `backend/app/api/v2_router.py`, mounted at `/api/v2` from `backend/main.py`.
- v2 orchestration/session service: `backend/app/services/v2_analysis_service.py`.
- Frontend workspace: `frontend/src/App.jsx`.
- Multi-input form: `frontend/src/components/QueryPanel.jsx`.
- Graph presentation: `frontend/src/components/CausalGraph.jsx` and `frontend/src/components/CustomNode.jsx`.

## Run Commands

Backend:

```powershell
cd backend
python -m uvicorn main:app --host 127.0.0.1 --port 8000
```

Frontend:

```powershell
cd frontend
npm.cmd run dev -- --host 0.0.0.0 --port 5173
```

Build verification:

```powershell
cd frontend
npm.cmd run build
```

In the Codex sandbox, Vite/esbuild may require elevated execution because it starts a child process.

## Important Constraints

- Do not reintroduce hard-coded API keys in docs or code. Use `backend/.env` with `OPENAI_API_KEY`.
- The repository was cleaned on 2026-05-06: temporary/debug files were removed, obsolete components were deleted, and demo files were organized to `frontend/src/demo/`. Keep edits scoped to production files.
- v2 is designed to run without an LLM key by using deterministic macro fallback graphs. Search and LLM enrichment improve quality when keys are present.
- Generated runtime DB files under `backend/data/` are local state and should not be committed.
- SearchService duplication in `two_pass_causal_service.py` was fixed; shared search behavior should live in `search_service.py`.
- v1 is legacy/stateless and v2 is recommended/session-based. See `backend/API_VERSIONS.md` when available.

## Cross-Platform Shared Knowledge

<!-- super-neat-freak-sync: last=2026-05-07T00:00 direction=codex->claude -->

### Project Facts

- Product priority is CausalFlow v2: a session-based macroeconomic causal analysis workspace for multi-input synthesis, iterative deep expansion, node expansion, and real-time node enrichment.
- Recommended API surface is `/api/v2`; `/api/v1` remains legacy and stateless.
- v2 session state is persisted through SQLite by `backend/app/services/v2_analysis_service.py`; generated files under `backend/data/` are runtime state and should not be committed.
- The graph presentation was redesigned on 2026-05-07 to use layered lanes, cluster filters, and edge modes (`main`, `focus`, `all`) so dense macro graphs remain readable.
- The left input sidebar was fixed on 2026-05-07 with `min-h-0` and internal scrolling so many clues can be entered.

### Conventions

- Keep real API keys out of repository docs and code. Use `backend/.env` and placeholders in committed files.
- Prefer v2 docs for new work: `docs/v2-architecture.md`, `docs/v2-api-guide.md`, and `docs/v2-runbook.md`.
- Keep temporary smoke-test SQLite data out of git.

### References

- Claude memory path inspected for this project: `C:\Users\28203\.claude\projects\X--vibe-coding-6-----\memory`.
- Existing Claude project memories cover product vision, search pipeline fixes, and the 2026-05-06 cleanup.
4 changes: 4 additions & 0 deletions CAUSAL_FLOW_ROADMAP.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# 因果推演引擎 - 系统架构文档 (SSOT)

> **文档范围:** 本文档专注于 v2 版本的系统架构、技术实现和开发路线图。
>
> **相关文档:** 如需了解整体项目规划和长期愿景,请参考 `PROJECT_ROADMAP.md`

## 核心愿景

构建一个全自动因果推断引擎,将碎片化的宏观经济、地缘政治新闻转化为由"节点"和"有向边"构成的知识图谱。通过 AI 驱动的因果关系抽取,实现从非结构化文本到结构化因果链的自动化转换,为金融市场宏观分析提供可视化、可追溯的推理依据。
Expand Down
82 changes: 82 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Claude Handoff Notes

This file mirrors the project-level instructions in `AGENTS.md` for Claude Code. Keep these two files synchronized when project facts, routes, environment variables, or run commands change.

## Current Project

This is a React 18 + FastAPI macroeconomic causal analysis app. The current active product surface is CausalFlow v2.

## Project Structure

Backend:

- v2 router: `backend/app/api/v2_router.py` mounted at `/api/v2`.
- v1 router: `backend/app/api/causal_router.py` mounted at `/api/v1`, legacy.
- v2 service: `backend/app/services/v2_analysis_service.py`.
- API version guide: `backend/API_VERSIONS.md`.

Frontend:

- Main app: `frontend/src/App.jsx`.
- Multi-input panel: `frontend/src/components/QueryPanel.jsx`.
- Graph view: `frontend/src/components/CausalGraph.jsx`.
- Node card: `frontend/src/components/CustomNode.jsx`.
- Demo files, when present, belong under `frontend/src/demo/`.

Documentation:

- v2 docs: `docs/v2-architecture.md`, `docs/v2-api-guide.md`, `docs/v2-runbook.md`.
- Roadmaps: `CAUSAL_FLOW_ROADMAP.md` and `PROJECT_ROADMAP.md`.

## Run Commands

Backend:

```powershell
cd backend
python -m uvicorn main:app --host 127.0.0.1 --port 8000
```

Frontend:

```powershell
cd frontend
npm.cmd run dev -- --host 0.0.0.0 --port 5173
```

Frontend build:

```powershell
cd frontend
npm.cmd run build
```

## Important Constraints

- Do not commit API keys. Use `backend/.env` with `OPENAI_API_KEY`.
- v2 can run without an LLM key by using deterministic macro fallback graphs. LLM/search keys improve quality when present.
- Generated runtime DB files under `backend/data/` are local state and should not be committed.
- Keep edits scoped; the repository has historical docs and pre-existing dirty files.

## Cross-Platform Shared Knowledge

<!-- super-neat-freak-sync: last=2026-05-07T00:00 direction=codex->claude -->

### Project Facts

- Product priority is CausalFlow v2: a session-based macroeconomic causal analysis workspace for multi-input synthesis, iterative deep expansion, node expansion, and real-time node enrichment.
- Recommended API surface is `/api/v2`; `/api/v1` remains legacy and stateless.
- v2 session state is persisted through SQLite by `backend/app/services/v2_analysis_service.py`; generated files under `backend/data/` are runtime state and should not be committed.
- The graph presentation was redesigned on 2026-05-07 to use layered lanes, cluster filters, and edge modes (`main`, `focus`, `all`) so dense macro graphs remain readable.
- The left input sidebar was fixed on 2026-05-07 with `min-h-0` and internal scrolling so many clues can be entered.

### Conventions

- Keep real API keys out of repository docs and code. Use `backend/.env` and placeholders in committed files.
- Prefer v2 docs for new work: `docs/v2-architecture.md`, `docs/v2-api-guide.md`, and `docs/v2-runbook.md`.
- Keep temporary smoke-test SQLite data out of git.

### References

- Claude memory path inspected for this project: `C:\Users\28203\.claude\projects\X--vibe-coding-6-----\memory`.
- Existing Claude project memories cover product vision, search pipeline fixes, and the 2026-05-06 cleanup.
Loading