diff --git a/.gitignore b/.gitignore index 81f023c6..1a1cd688 100644 --- a/.gitignore +++ b/.gitignore @@ -3,34 +3,67 @@ __pycache__/ *.py[cod] *$py.class *.so +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# Virtual Environments venv/ env/ +ENV/ +env.bak/ +venv.bak/ +.venv/ -# Node +# Node.js node_modules/ -dist/ +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* +.pnpm-debug.log* -# Database -*.db -*.sqlite -*.sqlite3 - -# Environment -.env +# IDEs +.idea/ +.vscode/ +*.swp +*.swo .DS_Store -# Ollama -ollama_bin/ -.ollama/ - # Logs logs/ *.log -nohup.out -# Coverage -coverage/ +# Databases +*.db +*.sqlite3 -# Temporary -tmp/ -temp/ +# Large Files & Binaries +.ollama/ +ollama_bin/ +Pixelle-Video/ +*.dmg +*.zip +*.tar.gz +*.iso + +# Local Env +.env +.env.* +!.env.example diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 00000000..d6f50a7c --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,72 @@ +# PMFlow 开发 Agent Prompt + +你是一位资深的全栈工程师,精通 Python 3.11+、FastAPI、SQLAlchemy 2.0、LangChain、React 18、TypeScript、shadcn/ui、Tailwind CSS。 + +你正在为 **PMFlow** 开发代码:这是一款 AI 原生、人员能力驱动的项目管理操作系统,专为 10-50 人 AI 开发团队打造。 + +--- + +## 核心开发规范 + +1. **代码质量**:所有代码严格遵循 Python 与 TypeScript 最佳实践,代码清晰、注释完整、类型安全、可维护性强。 + +2. **后端接口规范**:使用 FastAPI 框架,所有接口必须带 Pydantic 类型校验,统一返回格式: + - 成功:`{ "code": 0, "message": "success", "data": {} }` + - 失败:`{ "code": 非0错误码, "message": "错误描述", "data": null }` + +3. **数据库规范**:使用 SQLAlchemy 2.0,所有模型继承 Base 基类,必须包含 `tenant_id` 字段,所有查询必须自动过滤 `tenant_id`(使用依赖注入实现)。 + +4. **AI 能力规范**:所有 AI 能力必须封装在独立的 service 层,使用 LangChain 实现,Prompt 放在 `./backend/app/config/ai_prompts.py` 独立管理,禁止硬编码。 + +5. **AI 调用规范**:所有 AI 调用必须: + - 记录日志到 `ai_call_logs` 表 + - 实现 Redis 结果缓存 + - 完善的错误重试机制 + - 降低成本 + +6. **鉴权规范**:所有接口必须实现 JWT 鉴权,使用 FastAPI `Depends` 依赖注入实现,自动从请求中提取 `tenant_id` 与 `user_id`。 + +7. **工程规范**: + - 完善的错误处理 + - 结构化日志(structlog) + - 从第一天就支持多租户、可扩展性 + - 模块化设计 + +8. **前端规范**:使用 React + TypeScript + shadcn/ui + Tailwind CSS,组件化开发,复用 shadcn 组件,美观响应式,支持暗色模式。 + +9. **核心约束**:人员能力图谱是 AI 智能任务分配的核心,所有任务拆解、分配逻辑必须优先调用该模块数据。 + +--- + +## 项目结构 + +``` +backend/ # Python FastAPI 后端 +├── app/ +│ ├── api/ # API 路由层,按模块分文件 +│ ├── core/ # 核心配置、安全、日志、数据库连接 +│ ├── models/ # SQLAlchemy ORM 模型 +│ ├── schemas/ # Pydantic 请求/响应模型 +│ ├── services/ # 业务逻辑层(含 ai_service.py、skill_service.py) +│ ├── dependencies/ # FastAPI 依赖注入(鉴权、租户过滤、分页等) +│ ├── config/ # 配置文件、AI Prompt 管理 +│ └── utils/ # 工具函数 +├── main.py # 项目入口 +├── pyproject.toml # Poetry 依赖配置 +└── Dockerfile + +frontend/ # React 前端 +├── src/ +│ ├── components/ # 通用组件 +│ ├── pages/ # 页面 +│ ├── api/ # API 调用封装 +│ ├── types/ # TypeScript 类型定义 +│ └── lib/ # 工具函数 +└── package.json +``` + +--- + +## 执行要求 + +根据用户的具体需求,生成高质量、可直接运行的代码。 diff --git a/CLAUDE.md b/CLAUDE.md index 0b3f5575..b35d2c02 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -4,156 +4,223 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co ## Project Overview -**Neural Sync** is an AI-native project management platform designed for small (10-person) AI/ML technical teams. Unlike traditional PM tools that manage static tasks, this system manages "Living Context" - external signals, AI experiments, and cognitive knowledge nodes with version tracking and semantic embedding. +**PMFlow / Neural Sync** is an AI-native project management platform designed for small (10-50 person) AI/ML technical teams. The system has evolved into a multi-tenant, role-based PM operating system with: -### Core Philosophy +- **Multi-tenant Architecture**: Complete data isolation with tenant_id filtering +- **RBAC**: Role-based access control with JWT authentication +- **Event-Driven Architecture**: Event bus with WebSocket real-time updates +- **AI-Native Features**: LangChain integration, skill management, intelligent task routing -The system operates on three pillars: -1. **Signals (Pulse)**: External triggers (market news, model releases, competitor updates) captured from sources like HackerNews -2. **Context Nodes (Cognitive Core)**: Atomic knowledge units with vector embeddings for semantic search - when these change, dependent experiments auto-flag as "outdated" -3. **Experiments (Lab)**: Evaluation-driven tasks where success is measured by metrics (accuracy, latency) rather than just completion +### Dual Frontend Architecture -## Technology Stack - -### Backend -- **FastAPI** with async/await patterns -- **SQLAlchemy 2.0** async with database-agnostic design (PostgreSQL with pgvector or SQLite fallback) -- **Alembic** for database migrations -- **Ollama** integration for local LLM operations (llama3, nomic-embed-text models) - -### Frontend -- **Vue 3** with Composition API and ` +
+