diff --git a/docs/design/architecture-v2.6.md b/docs/design/architecture-v2.6.md index 6c78f81..b29a5cf 100644 --- a/docs/design/architecture-v2.6.md +++ b/docs/design/architecture-v2.6.md @@ -275,14 +275,17 @@ CREATE TABLE IF NOT EXISTS comments ( id INTEGER PRIMARY KEY AUTOINCREMENT, task_id TEXT NOT NULL, author TEXT NOT NULL, -- agent id 或 'user' + comment_type TEXT NOT NULL DEFAULT 'general', -- general/handoff/observation/rebuttal/rebuttal_response/debate_argument/debate_rebuttal/debate_judgment body TEXT NOT NULL, mentions TEXT, -- JSON array: ["zhangfei-dev", "guanyu-dev"] created_at TEXT NOT NULL DEFAULT (datetime('now')), - FOREIGN KEY (task_id) REFERENCES tasks(id) + FOREIGN KEY (task_id) REFERENCES tasks(id), + CHECK (comment_type IN ('general', 'handoff', 'observation', 'rebuttal', 'rebuttal_response', 'debate_argument', 'debate_rebuttal', 'debate_judgment')) ); CREATE INDEX IF NOT EXISTS idx_comments_task ON comments(task_id); +CREATE INDEX IF NOT EXISTS idx_comments_type ON comments(task_id, comment_type); CREATE INDEX IF NOT EXISTS idx_comments_author ON comments(author); -- 注意:mentions 是 JSON 数组,无法直接建索引。daemon tick 查询用 json_each(mentions)。 -- 数据量小时够用,后续可拆 comment_mentions 关联表优化。