feat(agent): L3 记忆注入——子任务带父任务拆解意图 + 兄弟状态
- types.TaskContext + Task.context(daemon 装配、不持久化) - store.taskContextOf(taskId):父 plan + 同层兄弟概览(标题/状态/复杂度,排除自身) - orchestrator.claimOne:executor 子任务填充 context 下发(planner 跑在父任务上不需要) - runner.buildPrompt 注入「## 拆解背景」段(顺序:规范→背景→任务内容) - 仅 DB 读,不做 git/RAG 检索(成本控制) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -887,6 +887,23 @@ export class Store {
|
||||
return row?.error ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* L3 拆解背景:取某任务的父任务拆解意图(parent.plan)+ 同层兄弟任务概览(标题/状态/复杂度)。
|
||||
* 无 parentId → null。仅做便宜的 DB 读,不做 git/RAG 检索。
|
||||
*/
|
||||
taskContextOf(taskId: string): import('../model/types.js').TaskContext | null {
|
||||
const row = this.getTaskRow(taskId);
|
||||
if (!row || !row.parent_id) return null;
|
||||
const parent = this.db.prepare(`SELECT plan FROM tasks WHERE id = ?`).get(row.parent_id) as { plan?: string | null } | undefined;
|
||||
const sibs = this.db.prepare(
|
||||
`SELECT title, status, complexity FROM tasks WHERE parent_id = ? AND id != ? ORDER BY created_at`,
|
||||
).all(row.parent_id, taskId) as Array<{ title: string; status: string; complexity: string }>;
|
||||
return {
|
||||
parentPlan: parent?.plan ?? null,
|
||||
siblings: sibs,
|
||||
};
|
||||
}
|
||||
|
||||
/** 列出所有处于审批闸状态(plan_review/spec_review/exec_review)的任务。 */
|
||||
pendingApprovals(projectId?: string): Task[] {
|
||||
// 包含 needs_attention:让审核区展示失败任务供人工确认/重排
|
||||
|
||||
Reference in New Issue
Block a user