Add core database support and enhance documentation

- Introduced `MYSQL_CORE_DATABASE` in `.env.example` and `settings.py` for core database configuration.
- Added `CoreReadOnlyRepository` for read-only access to the `jinrong_core` database.
- Updated `AGENTS.md`, `README.md`, and various documentation files to reflect new agent onboarding processes and project structure.
- Revised requirements in `requirements.txt` to include `langgraph` and `langchain-core`.
- Enhanced `FLOW.md` with local bootstrap instructions for setting up the core simulation environment.
- Added new scripts for database creation and seeding for the core simulation library.
- Improved overall documentation for clarity on project architecture and memory management.
- Updated `TODO.md` to reflect current development priorities and tasks.
This commit is contained in:
2026-09-05 17:39:16 +08:00
parent 0374010b37
commit 1ddd44a6cb
34 changed files with 1848 additions and 97 deletions
+79
View File
@@ -0,0 +1,79 @@
USE jinrong_core;
-- 持仓 as_of = 2026-09-04
INSERT INTO core_holding (customer_id, product_id, qty, cost_amount, market_value, pnl_pct, as_of) VALUES
-- CUST-9527 主 demo
('CUST-9527', 'PROD-005827', 50000.0000, 50000.00, 47500.00, -5.0000, '2026-09-04'),
('CUST-9527', 'PROD-110022', 80000.0000, 80000.00, 82400.00, 3.0000, '2026-09-04'),
('CUST-9527', 'PROD-000001', 20000.0000, 20000.00, 20040.00, 0.2000, '2026-09-04'),
-- CUST-1001 C1 保守
('CUST-1001', 'PROD-110022', 30000.0000, 30000.00, 30900.00, 3.0000, '2026-09-04'),
('CUST-1001', 'PROD-000001', 50000.0000, 50000.00, 50100.00, 0.2000, '2026-09-04'),
-- CUST-1002 接近阈值 -12%
('CUST-1002', 'PROD-005828', 40000.0000, 40000.00, 35200.00, -12.0000, '2026-09-04'),
('CUST-1002', 'PROD-110023', 25000.0000, 25000.00, 24500.00, -2.0000, '2026-09-04'),
-- CUST-1003 高龄 C2
('CUST-1003', 'PROD-110022', 120000.0000, 120000.00, 123600.00, 3.0000, '2026-09-04'),
('CUST-1003', 'PROD-005828', 30000.0000, 30000.00, 29100.00, -3.0000, '2026-09-04'),
-- CUST-1004 ~10087
('CUST-1004', 'PROD-161725', 60000.0000, 60000.00, 55800.00, -7.0000, '2026-09-04'),
('CUST-1004', 'PROD-510300', 40000.0000, 40000.00, 41200.00, 3.0000, '2026-09-04'),
-- CUST-1005
('CUST-1005', 'PROD-005827', 35000.0000, 35000.00, 36750.00, 5.0000, '2026-09-04'),
('CUST-1005', 'PROD-510300', 15000.0000, 15000.00, 15300.00, 2.0000, '2026-09-04'),
-- CUST-1006
('CUST-1006', 'PROD-110023', 90000.0000, 90000.00, 91800.00, 2.0000, '2026-09-04'),
('CUST-1006', 'PROD-000002', 40000.0000, 40000.00, 40200.00, 0.5000, '2026-09-04'),
-- CUST-1007
('CUST-1007', 'PROD-005828', 45000.0000, 45000.00, 43650.00, -3.0000, '2026-09-04'),
-- CUST-1008
('CUST-1008', 'PROD-161726', 20000.0000, 20000.00, 19000.00, -5.0000, '2026-09-04'),
('CUST-1008', 'PROD-510500', 10000.0000, 10000.00, 9800.00, -2.0000, '2026-09-04'),
-- CUST-1009 C1
('CUST-1009', 'PROD-000001', 150000.0000, 150000.00, 150300.00, 0.2000, '2026-09-04'),
('CUST-1009', 'PROD-110022', 80000.0000, 80000.00, 82400.00, 3.0000, '2026-09-04'),
-- CUST-1010 ~10087 跨权限测
('CUST-1010', 'PROD-003095', 55000.0000, 55000.00, 52250.00, -5.0000, '2026-09-04'),
('CUST-1010', 'PROD-005827', 30000.0000, 30000.00, 31500.00, 5.0000, '2026-09-04'),
-- CUST-1011
('CUST-1011', 'PROD-161725', 70000.0000, 70000.00, 73500.00, 5.0000, '2026-09-04'),
-- CUST-1012
('CUST-1012', 'PROD-510300', 65000.0000, 65000.00, 66950.00, 3.0000, '2026-09-04'),
('CUST-1012', 'PROD-110023', 35000.0000, 35000.00, 35700.00, 2.0000, '2026-09-04'),
-- CUST-1013
('CUST-1013', 'PROD-005828', 28000.0000, 28000.00, 27440.00, -2.0000, '2026-09-04'),
-- CUST-1014
('CUST-1014', 'PROD-510500', 90000.0000, 90000.00, 87300.00, -3.0000, '2026-09-04'),
('CUST-1014', 'PROD-161726', 40000.0000, 40000.00, 42000.00, 5.0000, '2026-09-04'),
-- CUST-1015
('CUST-1015', 'PROD-110022', 100000.0000, 100000.00, 103000.00, 3.0000, '2026-09-04'),
-- CUST-1016
('CUST-1016', 'PROD-005827', 42000.0000, 42000.00, 43260.00, 3.0000, '2026-09-04'),
('CUST-1016', 'PROD-003095', 18000.0000, 18000.00, 17100.00, -5.0000, '2026-09-04'),
-- CUST-1017
('CUST-1017', 'PROD-510300', 32000.0000, 32000.00, 32960.00, 3.0000, '2026-09-04'),
-- CUST-1018 C1
('CUST-1018', 'PROD-000001', 200000.0000, 200000.00, 200400.00, 0.2000, '2026-09-04'),
-- CUST-1019
('CUST-1019', 'PROD-110023', 48000.0000, 48000.00, 47040.00, -2.0000, '2026-09-04'),
('CUST-1019', 'PROD-005828', 22000.0000, 22000.00, 22440.00, 2.0000, '2026-09-04'),
-- CUST-1020
('CUST-1020', 'PROD-161725', 85000.0000, 85000.00, 89250.00, 5.0000, '2026-09-04'),
('CUST-1020', 'PROD-XYZ999', 15000.0000, 15000.00, 13500.00, -10.0000, '2026-09-04'),
-- CUST-1021
('CUST-1021', 'PROD-005827', 15000.0000, 15000.00, 15750.00, 5.0000, '2026-09-04'),
-- CUST-1022
('CUST-1022', 'PROD-510300', 72000.0000, 72000.00, 74160.00, 3.0000, '2026-09-04'),
('CUST-1022', 'PROD-110022', 48000.0000, 48000.00, 49440.00, 3.0000, '2026-09-04'),
-- CUST-1023
('CUST-1023', 'PROD-005828', 38000.0000, 38000.00, 37160.00, -2.2000, '2026-09-04'),
-- CUST-1024
('CUST-1024', 'PROD-161726', 95000.0000, 95000.00, 99750.00, 5.0000, '2026-09-04'),
-- CUST-3001 大额客户
('CUST-3001', 'PROD-510300', 200000.0000, 200000.00, 206000.00, 3.0000, '2026-09-04'),
('CUST-3001', 'PROD-005827', 150000.0000, 150000.00, 157500.00, 5.0000, '2026-09-04'),
-- CUST-4001 高龄+C5
('CUST-4001', 'PROD-XYZ999', 80000.0000, 80000.00, 72000.00, -10.0000, '2026-09-04'),
('CUST-4001', 'PROD-161725', 50000.0000, 50000.00, 52500.00, 5.0000, '2026-09-04'),
-- CUST-4002 C1 却持有 R4(适当性冲突测)
('CUST-4002', 'PROD-161725', 10000.0000, 10000.00, 9500.00, -5.0000, '2026-09-04');