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:
wangjia
2026-06-24 22:32:21 +08:00
parent fe7923a618
commit 74be3ecec1
5 changed files with 79 additions and 1 deletions
+8
View File
@@ -65,6 +65,12 @@ export interface TaskResult {
mergeTaskId: string | null; // 自动合并失败时建的最高优先级补救任务 id(幂等标记)
}
/** L3 拆解背景:父任务拆解意图 + 同层兄弟任务概览(daemon 装配,注入子任务执行 prompt) */
export interface TaskContext {
parentPlan?: string | null;
siblings?: Array<{ title: string; status: string; complexity: string }>;
}
export interface Task {
id: Id;
projectId: Id;
@@ -85,6 +91,8 @@ export interface Task {
retryBaseline: number; // 上次手动重投时已有的失败 run 数(重置重试计数用)
nextEligibleAt: string | null; // 持久化退避:早于此时间不被领取(重试退避,重启不丢);null=即刻可领
lastRunError?: string | null; // needs_attention 时:最近一次失败 run 的错误信息(供审核区展示)
/** L3 拆解背景:daemon 在 claimOne 时装配进 job(父任务意图 + 兄弟任务状态),仅注入 prompt,不持久化 */
context?: TaskContext | null;
attachments?: Attachment[]; // 随任务提交的图片/文件(存 <data>/tasks/<id>/attachments/
createdAt: string;
updatedAt: string;