Enhance suitability assessment and documentation

- Implemented `check_suitability` method in `CoreReadOnlyRepository` for suitability determination based on customer and product risk levels.
- Added `build_suitability_log_row` function in `suitability.py` for mapping suitability check results to `risk_suitability_log`.
- Updated `AGENTS.md`, `ENVIRONMENT.md`, and `FLOW.md` to reflect changes in suitability assessment processes and documentation.
- Revised `FRAMEWORK.md` and `MEMORY.md` to clarify project structure and data flow related to suitability checks.
- Expanded `TODO.md` with tasks related to logging and auditing suitability assessments.
This commit is contained in:
2026-09-07 11:15:30 +08:00
parent 1ddd44a6cb
commit 3fb0ceb334
44 changed files with 7479 additions and 250 deletions
+10 -8
View File
@@ -9,7 +9,7 @@
**项目是什么:** 金融四 Agent(客户财富 / 代理人 / 数据分析 / 风控)共用数据层与合规底座;**不**互调 LLM,跨 Agent 走 L1/L2/L3 画像与预警表。
**当前进度:** 需求与表设计已定 · 后端 **脚手架 + Core 模拟库脚本** 已落地 · **业务 API / JWT / LangGraph 图尚未实现**(多为空壳模块)。
**当前进度:** 需求与表设计已定 · **Core 模拟库 + L0 KYC/适当性矩阵 + R-02 计算与 log 契约** 已落地 · **业务 API / JWT / LangGraph 图尚未实现**(多为空壳模块)。
**仓库地图:**
@@ -18,12 +18,13 @@
| `app/main.py` | 可跑 | 仅 `/health`;路由未挂载 |
| `app/api/*.py` | 空壳 | chat / knowledge / admin 待实现 |
| `app/service/*.py` | 空壳 | agent / rag / memory 待实现 |
| `app/repository/core_ro.py` | **已实现** | Core 只读 SELECT(jinrong_core) |
| `app/repository/core_ro.py` | **已实现** | Core 只读 + `check_suitability`(R-02 计算) |
| `app/model/suitability.py` | **已实现** | R-02 → `risk_suitability_log` 行映射 |
| `app/config/settings.py` | **已实现** | 双库 `jinrong_agent` + `jinrong_core` |
| `scripts/core/*.sql` + `reset.ps1` | **已实现** | Core 模拟库 DDL + 种子 |
| `scripts/core/*.sql` + `reset.ps1` | **已实现** | Core 模拟库 DDL + 种子(33 客户 / 14 产品) |
| `scripts/sync/*.py` | **已实现** | 归属同步 + Neo4j 全图 |
| `docs/需求拆解/` | 已定 | 场景 P0、矩阵、合规原文 |
| `docs/项目框架设计/表设计/` | 已定 | Agent 共用 11 表 + agent 专用 SQL |
| `docs/项目框架设计/表设计/` | 已定 | Agent 共用 11 表 + 画像/适当性说明 06/07 |
| `docs/项目框架设计/Core模拟底座/` | 已定 | 无真实 Core 时的 L0 方案 |
| `web/` | **不存在** | 前端 React 待 init |
@@ -41,7 +42,7 @@
**下一步开发(见 TODO):** T-01 JWT 中间件 → 挂载 api → LangGraph agent_service → Wave 0 验收。
**禁止(改代码前必记):** Core 正式 C1~C5 不可被画像覆盖 · 审计表只 INSERT · 代理人草稿不外发 · 仅 R-02 可阻断交易 · 四 Agent 不互调 LLM。
**禁止(改代码前必记):** Core 正式 C1~C5 不可被画像覆盖 · 审计表只 INSERT · 代理人草稿不外发 · 仅 R-02 可阻断交易 · 四 Agent 不互调 LLM · **客户 Agent 可做适当性匹配说明,禁止营销式推荐/买卖指导**。
------
@@ -95,8 +96,8 @@ audit_log 等审计表(只 INSERT)
```text
四 Agent 不互调 LLM;跨 Agent 走 L1/L2/L3 画像与预警表
客户 Agent:无投资建议/收益承诺/自动下单
代理人:不对 C 端直发
客户 Agent:允许按 C1~C5 与产品 R 等级做「是否匹配」说明(C-07/C-11,联动 R-02);禁止营销推荐、买卖指导、收益承诺、自动下单
代理人:不对 C 端直发;禁止对比优劣、推荐产品(A-02)
数据分析:仅 SELECT,不处置预警
画像不得覆盖 L0 正式测评
```
@@ -106,8 +107,9 @@ audit_log 等审计表(只 INSERT)
## 4. 入口与运行
```text
后端入口:app/main.py · 配置 app/config/settings.py · Core 只读 app/repository/core_ro.py
后端入口:app/main.py · 配置 app/config/settings.py · Core 只读 app/repository/core_ro.py · 适当性映射 app/model/suitability.py
Agent 库 SQL:docs/项目框架设计/表设计/01-mysql-共用底座.sql
画像/适当性:表设计/06-用户画像L1-L3设计.md · 表设计/07-risk_suitability_log说明.md
Core 模拟:scripts/core/reset.ps1 · 文档 docs/项目框架设计/Core模拟底座/
依赖:requirements.txt(LangGraph + langchain-core/openai + FastAPI + SQLAlchemy)
启动:uvicorn app.main:app --reload → GET /health