|
|
@@ -1,6 +1,6 @@
|
|
|
# P6 Implementation Brief Index
|
|
|
|
|
|
-状态:本目录是 P6 游走策略实施前的短实施简报集合。它不是新的产品计划,也不是替代 `tech_documents/游走策略/` 的设计文档;长期事实仍以 `tech_documents/工程落地/04_V1阶段开发计划.md`、`tech_documents/游走策略/`、`product_documents/抖音游走策略/douyin_walk_strategy.v1.json`、`product_documents/规则包/douyin_rule_packs.v1.json`、当前代码和真实 DB validator 为准。
|
|
|
+状态:本目录最初是 P6 游走策略实施前的短实施简报集合;当前已完成 P6 落地后的状态收敛。本目录只保留实施路径和验收口径,当前事实以 `tech_documents/工程落地/04_V1阶段开发计划.md`、`tech_documents/游走策略/`、`product_documents/抖音游走策略/douyin_walk_strategy.v1.json`、`product_documents/规则包/douyin_rule_packs.v1.json`、当前代码和真实 DB validator 为准。
|
|
|
|
|
|
## 目标
|
|
|
|
|
|
@@ -33,30 +33,30 @@ P6 只处理:
|
|
|
|
|
|
## 现有证据
|
|
|
|
|
|
-- `content_agent/graph.py`:`build_run_graph()` 当前是固定 DAG:`load_source -> plan_queries -> search_platform -> build_discovered_content -> recall_pattern -> load_policy -> evaluate_rules -> plan_walk -> record_run -> commit_results -> review_strategy`,没有 bounded walk loop。
|
|
|
-- `content_agent/business_modules/walk_strategy.py`:当前 `run()` 只把 `rule_decisions` 映射为建议性的 `walk_actions` 和 `source_path_record_basis`,没有执行分页、作者作品或 tag query,也没有 `walk_action_id`。
|
|
|
-- `content_agent/models.py`:`RunState.walk_actions` 只是 `list[dict]`,没有独立 WalkAction 模型或状态合同。
|
|
|
-- `content_agent/run_service.py`:`RunService.start_run()` 只调用一次 graph,没有子 run,也没有 bounded loop。
|
|
|
-- `content_agent/business_modules/run_record/recorder.py`:`run()` 写 `run_events / source_path_records / search_clues`,但没有 `walk_actions.jsonl`。
|
|
|
-- `content_agent/integrations/runtime_files.py`:`RUNTIME_FILENAMES` 当前不包含 `walk_actions.jsonl`。
|
|
|
-- `content_agent/integrations/database_runtime.py`:当前没有 `walk_actions.jsonl -> content_agent_walk_actions` 映射。
|
|
|
+- `content_agent/graph.py`:P6 已在同一 `run_id / policy_run_id` 内接入 bounded walk loop,保留 P1-P5 主链路并循环执行可执行 edge。
|
|
|
+- `content_agent/business_modules/walk_strategy.py`:当前 `run()` 已能生成带 `walk_action_id` 的结构化 walk actions,并支持分页、作者和 tag 边的行动规划 / 结果记录。
|
|
|
+- `content_agent/models.py`:`RunState.walk_actions` 承载 P6 walk action 状态合同。
|
|
|
+- `content_agent/run_service.py`:`RunService.start_run()` 仍使用同一 run,不创建子 run;P6 loop 在 graph 内完成。
|
|
|
+- `content_agent/business_modules/run_record/recorder.py`:`run()` 写 `run_events / source_path_records / search_clues / walk_actions.jsonl`。
|
|
|
+- `content_agent/integrations/runtime_files.py`:`RUNTIME_FILENAMES` 已包含 `walk_actions.jsonl`。
|
|
|
+- `content_agent/integrations/database_runtime.py`:已包含 `walk_actions.jsonl -> content_agent_walk_actions` 映射。
|
|
|
- `content_agent/integrations/policy_json.py`:当前仍读取 `product_documents/抖音游走策略/douyin_available_walk_strategy.v1.json` 参与 `policy_bundle_hash` 和 source ref;P6A 迁移前旧 JSON 不能直接删除。
|
|
|
- `content_agent/integrations/douyin.py`:`CrawapiDouyinClient.search()` 是关键词搜索入口,使用默认 cursor 拉第一页并保留 `has_more / next_cursor`;当前没有独立分页方法、作者作品方法或 tag query 方法。
|
|
|
-- `sql/content_agent_schema.sql`:当前没有 `content_agent_walk_actions`。
|
|
|
+- `sql/content_agent_schema.sql`:已包含 `content_agent_walk_actions`。
|
|
|
- `sql/content_agent_schema.sql`:`content_agent_search_clues` 使用 `clue_id`,不是历史草案里写错的 `search_clue_id`。
|
|
|
-- `tech_documents/数据库字段总览/content_agent_schema_registry.json`:当前 schema registry 仍是 15 张正式表、12 个 runtime 文件的当前态。
|
|
|
-- `tech_documents/数据库字段总览/content_agent_schema_registry_count_report.json` 和 `.md`:当前仍是旧计数报告,不能作为 P6B 后的验收依据;P6B 升级 runtime / table count 后必须重新生成或明确废弃旧报告。
|
|
|
-- `product_documents/抖音游走策略/douyin_walk_strategy.v1.json`:P6 draft runtime source,`strategy_version=V1.0`,包含 13 个 section,`walk_fact_contract` 中 `search_clues` unique key 仍有 `search_clue_id` 草案错误,P6A/P6B 必须修正。
|
|
|
-- `tech_documents/游走策略/05_content_agent_walk_actions_DDL草案.md`:DDL 草案当前把 DB `schema_version` 默认写成 `runtime_record.v1`,P6B 必须修为 `content_agent.v1`;runtime 行才使用 `record_schema_version=runtime_record.v1`。
|
|
|
-- `tech_documents/工程落地/04_V1阶段开发计划.md`:已拍板 `douyin_walk_strategy.v1.json` 是 P6 runtime 配置目标,旧 JSON 只作历史参考;P6 代码阶段再接第 16 表。
|
|
|
-- 真实 DB validator 当前仍显示 15/15 表、`schema_ready=true`;本轮 brief 不改变真实 DB。
|
|
|
+- `tech_documents/数据库字段总览/content_agent_schema_registry.json`:当前 schema registry 已是 21 张正式表、13 个 runtime 文件的当前态。
|
|
|
+- `tech_documents/数据库字段总览/content_agent_schema_registry_count_report.json` 和 `.md`:当前计数报告已与 21 表合同对齐。
|
|
|
+- `product_documents/抖音游走策略/douyin_walk_strategy.v1.json`:P6 active runtime source,`strategy_version=V1.0`,包含 13 个 section,`walk_fact_contract.search_clues.unique_key` 使用正式 `clue_id`。
|
|
|
+- `tech_documents/游走策略/05_content_agent_walk_actions_DDL记录.md`:DDL 记录已明确 DB `schema_version=content_agent.v1`,runtime 行使用 `record_schema_version=runtime_record.v1`。
|
|
|
+- `tech_documents/工程落地/04_V1阶段开发计划.md`:已收敛为当前 P6 21 表已接入口径,旧 JSON 只作历史参考。
|
|
|
+- 真实 DB validator 当前应显示 21/21 表、`schema_ready=true`。
|
|
|
|
|
|
sub-agent 交叉验证结论:
|
|
|
|
|
|
-- 代码侧 sub-agent 确认:当前 P6 只有“建议动作”,没有 Walk Engine、WalkAction fact layer、分页 edge、作者 edge 或 tag edge execution。
|
|
|
+- 代码侧 sub-agent 确认:P6 已有 Walk Engine、WalkAction fact layer、分页 edge、作者 edge 和 tag edge execution。
|
|
|
- 文档 / JSON sub-agent 确认:P6 已拍板为独立游走策略配置体系,P9 / P10 已归并;旧 JSON 仍有引用,不能在 P6A 前直接删除。
|
|
|
-- DB / schema sub-agent 确认:当前 15 表 schema ready;第 16 表必须作为 P6B 独立小阶段同步升级 SQL、registry、runtime、DB store、validator 和测试。
|
|
|
-- DB / schema sub-agent 确认:旧 count report 有漂移风险,P6B 不得拿旧报告证明新 schema ready。
|
|
|
+- DB / schema sub-agent 确认:当前 21 表 schema ready;`content_agent_walk_actions` 已同步 SQL、registry、runtime、DB store、validator 和测试。
|
|
|
+- DB / schema sub-agent 确认:计数报告应按当前 21 表合同使用,旧计数口径不得再作为 P6 当前证据。
|
|
|
|
|
|
## 修改范围
|
|
|
|
|
|
@@ -86,7 +86,7 @@ sub-agent 交叉验证结论:
|
|
|
- 本轮不执行 DDL。
|
|
|
- 本轮不修改真实 DB。
|
|
|
- 本轮不修改 `scripts/validate_content_agent_db.py`。
|
|
|
-- 本轮不把 strict DB validator 从 15 表改成 16 表。
|
|
|
+- 本轮不改 strict DB validator;当前 validator 已是 21 表口径。
|
|
|
- 本轮不删旧 `douyin_available_walk_strategy.v1.json`。
|
|
|
- 本轮不启用 Author / Hashtag / Path / Budget runtime dispatch。
|
|
|
- 本轮不把 Excel 作为 runtime source。
|
|
|
@@ -120,7 +120,7 @@ sub-agent 交叉验证结论:
|
|
|
- `product_documents/抖音游走策略/runtime_v1_records_schema.md`
|
|
|
- `tech_documents/游走策略/01_游走策略体系说明.md`
|
|
|
- `tech_documents/游走策略/04_P6阶段开发计划.md`
|
|
|
-- `tech_documents/游走策略/05_content_agent_walk_actions_DDL草案.md`
|
|
|
+- `tech_documents/游走策略/05_content_agent_walk_actions_DDL记录.md`
|
|
|
- `product_documents/规则包/douyin_rule_packs.v1.json`
|
|
|
- `tech_documents/工程落地/04_V1阶段开发计划.md`
|
|
|
- `tech_documents/工程落地/05_阶段验收清单.md`
|
|
|
@@ -141,7 +141,7 @@ P6 全局合同:
|
|
|
- `RuleDecision` 基础格式继续沿用,但 `decision_target_type` 可以是 `Content / Author / Hashtag / Path / Budget`。
|
|
|
- 单条 edge 失败只写 `walk_status=failed`;只有核心 runtime / DB / schema 写入失败才让 run 失败。
|
|
|
|
|
|
-P6 planned runtime:
|
|
|
+P6 active runtime:
|
|
|
|
|
|
- `walk_actions.jsonl`
|
|
|
- `content_agent_walk_actions`
|
|
|
@@ -149,7 +149,7 @@ P6 planned runtime:
|
|
|
- `search_clues.jsonl` 继续使用 `clue_id`。
|
|
|
- `final_output.author_assets` 只在作者沉淀条件满足时写入。
|
|
|
|
|
|
-P6 planned edge:
|
|
|
+P6 active edge:
|
|
|
|
|
|
- `query_next_page`
|
|
|
- `search_page_to_content`
|
|
|
@@ -164,7 +164,7 @@ P6 planned edge:
|
|
|
## 实施步骤
|
|
|
|
|
|
1. P6A 先做配置读取和 JSON validator,不改 DB、不执行 edge。
|
|
|
-2. P6B 再接 `walk_actions.jsonl` 和第 16 表,作为独立 DDL / validator 小阶段。
|
|
|
+2. P6B 已接 `walk_actions.jsonl` 和 `content_agent_walk_actions`,并纳入当前 21 表 DDL / validator 合同。
|
|
|
3. P6C 先做最小 planner,再改 bounded walk loop。
|
|
|
4. P6D 接分页 edge。
|
|
|
5. P6E 接作者 edge 和作者作品判断。
|
|
|
@@ -200,7 +200,7 @@ uv run pytest -q
|
|
|
- P6 brief 中没有固定 section:brief 格式问题。
|
|
|
- 敏感赋值命中:brief 内容问题,应只写 env key 名和脱敏要求。
|
|
|
- `validate_schema_registry.py` 失败:当前 registry / SQL / runtime 文件漂移,不能归因 P6 brief。
|
|
|
-- DB validator 不是 15/15:真实 DB 或 validator 当前态被提前改动,说明 P6B 边界被破坏。
|
|
|
+- DB validator 不是 21/21:真实 DB、schema registry 或 validator 当前态漂移。
|
|
|
- `jq` 输出 `walk_fact_contract` 仍含 `search_clue_id`:P6A/P6B 待修复项,brief 应明确不得沿用。
|
|
|
- 旧 JSON 被 P6A 后仍读取:runtime source 迁移未完成。
|
|
|
- P6 新 run 无法追溯 `walk_action_id`:source path 合同未实现。
|
|
|
@@ -208,12 +208,12 @@ uv run pytest -q
|
|
|
|
|
|
## sub-agent 交叉验证要点
|
|
|
|
|
|
-- 代码侧确认:graph 仍是线性固定 DAG。
|
|
|
-- 代码侧确认:`walk_strategy.py` 只产生建议动作,不执行 edge。
|
|
|
-- 代码侧确认:runtime / DB store 当前没有 `walk_actions.jsonl`。
|
|
|
+- 代码侧确认:graph 已包含 bounded walk loop。
|
|
|
+- 代码侧确认:`walk_strategy.py` 已产生结构化 walk actions 并支持 P6 edge 执行结果。
|
|
|
+- 代码侧确认:runtime / DB store 已包含 `walk_actions.jsonl`。
|
|
|
- 文档 / JSON 侧确认:新 JSON 是 P6 runtime source,旧 JSON 是 historical reference。
|
|
|
- 文档 / JSON 侧确认:P9 / P10 已归并到 P6。
|
|
|
-- DB 侧确认:当前 15 表 strict validator 必须继续通过。
|
|
|
+- DB 侧确认:当前 21 表 strict validator 必须继续通过。
|
|
|
- DB 侧确认:`search_clues` 正式唯一键使用 `clue_id`。
|
|
|
- DB 侧确认:旧 count report 不得作为 P6B 后验收证据。
|
|
|
- 测试侧确认:P6 后续必须新增 config、runtime、graph loop、pagination、author、tag、budget、drift guard 测试。
|