thincoder 0.12.59 → 0.12.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -3
- package/README.md +2 -2
- package/bin/thincoder.mjs +80 -19
- package/package.json +4 -3
- package/src/acp/bridge.mjs +7 -4
- package/src/advisor/messages.mjs +24 -4
- package/src/advisor/run.mjs +35 -33
- package/src/advisor.mjs +25 -6
- package/src/agent/completion.mjs +17 -11
- package/src/agent/dispatch.mjs +102 -19
- package/src/agent/helpers.mjs +36 -0
- package/src/agent/record-results.mjs +46 -10
- package/src/agent/run-stages.mjs +227 -0
- package/src/agent/setup-reminders.mjs +62 -0
- package/src/agent/setup.mjs +18 -2
- package/src/agent/spawn-child.mjs +29 -4
- package/src/agent-tools/advisor-async.mjs +456 -0
- package/src/agent-tools/advisor.mjs +110 -108
- package/src/agent-tools/async-settle.mjs +191 -0
- package/src/agent-tools/consult.mjs +121 -102
- package/src/agent-tools/design-token.mjs +104 -0
- package/src/agent-tools/eng.mjs +24 -29
- package/src/agent-tools/escalate-async.mjs +286 -0
- package/src/agent-tools/read-history.mjs +155 -31
- package/src/agent-tools/recent-changes.mjs +2 -1
- package/src/agent-tools/settings.mjs +7 -17
- package/src/agent-tools/subagent-actions.mjs +168 -130
- package/src/agent-tools/subagent-async.mjs +129 -174
- package/src/agent-tools/subagent-panel.mjs +153 -0
- package/src/agent-tools/subagent-run.mjs +202 -0
- package/src/agent-tools/subagent-scheduler.mjs +45 -21
- package/src/agent-tools/subagent-spawn.mjs +406 -0
- package/src/agent-tools/subagent.mjs +107 -555
- package/src/agent-tools/verify.mjs +118 -270
- package/src/agent.mjs +57 -190
- package/src/cli/distill-command.mjs +10 -4
- package/src/cli/make-agent.mjs +3 -1
- package/src/cli/memory-command.mjs +2 -1
- package/src/cli/permission.mjs +2 -2
- package/src/cli/setup-wizard.mjs +17 -12
- package/src/config.mjs +56 -8
- package/src/context.mjs +5 -147
- package/src/crash-reports.mjs +123 -0
- package/src/distill.mjs +11 -11
- package/src/explore-distill.mjs +155 -0
- package/src/memory/code-sync.mjs +2 -1
- package/src/memory/core.mjs +6 -193
- package/src/memory/delete.mjs +234 -0
- package/src/memory/docs.mjs +58 -48
- package/src/memory.mjs +3 -1
- package/src/peer-domains.mjs +265 -0
- package/src/peer-instances.mjs +231 -0
- package/src/prompt-overlays.mjs +25 -0
- package/src/prompts/advisor-design.md +9 -76
- package/src/prompts/advisor-round1.md +9 -68
- package/src/prompts/advisor-round2.md +7 -54
- package/src/prompts/advisor-round3.md +7 -54
- package/src/prompts/coder.md +7 -50
- package/src/prompts/consult-base.md +4 -24
- package/src/prompts/discipline.md +26 -44
- package/src/prompts/eng-coder.md +7 -32
- package/src/prompts/engineering-sub.md +3 -23
- package/src/prompts/engineering.md +53 -306
- package/src/prompts/explore.md +3 -12
- package/src/prompts/main.md +10 -32
- package/src/prompts/methodology-template.md +28 -48
- package/src/prompts/plan.md +2 -9
- package/src/prompts/system.md +16 -35
- package/src/provider/core.mjs +6 -67
- package/src/provider/errors.mjs +76 -0
- package/src/provider/retry.mjs +8 -45
- package/src/session-gc.mjs +214 -0
- package/src/session-guard.mjs +47 -0
- package/src/session-rename.mjs +38 -0
- package/src/session-slots.mjs +181 -58
- package/src/session.mjs +48 -89
- package/src/token-ttl.mjs +273 -0
- package/src/tools/checklist-sync.mjs +181 -0
- package/src/tools/checklist.mjs +52 -39
- package/src/tools/edit-batch.mjs +109 -10
- package/src/tools/edit-diff.mjs +110 -27
- package/src/tools/edit.md +17 -12
- package/src/tools/execute.mjs +31 -4
- package/src/tools/file.mjs +11 -6
- package/src/tools/git.mjs +14 -6
- package/src/tools/glob-dialect.mjs +130 -0
- package/src/tools/glob.md +3 -3
- package/src/tools/grep.md +1 -1
- package/src/tools/index.mjs +5 -6
- package/src/tools/ops.mjs +175 -3
- package/src/tools/patch.mjs +3 -3
- package/src/tools/question.md +3 -0
- package/src/tools/read.md +0 -1
- package/src/tools/shared.mjs +14 -13
- package/src/tools/system.mjs +44 -9
- package/src/tools/wait_for.md +22 -0
- package/src/tui/agent-turn.mjs +17 -228
- package/src/tui/cmd-config.mjs +48 -7
- package/src/tui/cmd-eng.mjs +20 -16
- package/src/tui/cmd-mcp.mjs +8 -2
- package/src/tui/cmd-new.mjs +3 -2
- package/src/tui/cmd-session.mjs +19 -4
- package/src/tui/cmd-think.mjs +10 -10
- package/src/tui/cmd-upgrade.mjs +19 -4
- package/src/tui/config-helpers.mjs +28 -16
- package/src/tui/distill-cmd.mjs +1 -1
- package/src/tui/index.mjs +3 -2
- package/src/tui/interaction.mjs +3 -3
- package/src/tui/mouse.mjs +7 -1
- package/src/tui/pickers.mjs +40 -22
- package/src/tui/render-segments.mjs +27 -10
- package/src/tui/startup.mjs +4 -0
- package/src/tui/subagent-blocks.mjs +95 -263
- package/src/tui/subagent-children.mjs +176 -0
- package/src/tui/subagent-freeze.mjs +172 -0
- package/src/tui/subagent-panel.mjs +61 -23
- package/src/tui/suspension-drive.mjs +351 -0
- package/src/tui/tool-args.mjs +3 -3
- package/src/tui/tool-display.mjs +142 -0
- package/src/tui/tool-events.mjs +37 -173
- package/src/tui/tui-lifecycle.mjs +29 -0
- package/src/tui/update-notice.mjs +4 -0
- package/src/tui/wizard.mjs +12 -6
- package/src/tools/pdf-parse-text.mjs +0 -497
- package/src/tools/pdf-parse-xref.mjs +0 -499
- package/src/tools/pdf.mjs +0 -155
- package/src/tools/read_pdf.md +0 -21
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* peer-instances.mjs — R10 多实例协作感知面 L1/L2(MULTI-INSTANCE-COLLAB §2a.4)。
|
|
3
|
+
*
|
|
4
|
+
* 目标:让同 cwd 的多个 thincoder 副本在 agent 层互相感知。数据源 = 既有 SESSION.md
|
|
5
|
+
* §10 基建(manifest slotSessions / getSessionId——不新建平行存储,N1),纯只读(N3
|
|
6
|
+
* ——不认领、不写 manifest——本模块结构化上没有任何 fs 写调用)。
|
|
7
|
+
*
|
|
8
|
+
* - peerInstances(cwd):读 manifest slotSessions → 按 sessionId 去重分组 → slots;
|
|
9
|
+
* 一次批量判活(batchAlive——修复 isProcessAlive 每 pid 一次 execSync 的成本);
|
|
10
|
+
* 端字段(决策③ A:批量 cmdline 探测)区分 Code.exe/扩展宿主(vscode)vs
|
|
11
|
+
* node/thincoder(cli);self = sessionId === getSessionId()。
|
|
12
|
+
* - 惰性:manifest mtime 缓存(变了才重查——活实例变化必伴随 manifest 写——仿
|
|
13
|
+
* agent._slotMtime 先例)。manifest 缺失 → 空清单(不缓存——stat 一次成本)。
|
|
14
|
+
* - 测试注入缝:_setPeerInstancesTestImpl({ aliveFn, cmdlineFn })——default null
|
|
15
|
+
* 生产行为不变;测试 restore in finally。
|
|
16
|
+
* - peerInstancesTool:L2 只读查询工具(schema description 逐字锚——评审修正 #7,
|
|
17
|
+
* 双端照抄);无参、去 self、字段白名单 {pid, end, sessionId, slots}(N4)。
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { execFileSync } from "node:child_process"
|
|
21
|
+
import { statSync } from "node:fs"
|
|
22
|
+
import { manifestPath, loadManifest, getSessionId, END } from "./session-slots.mjs"
|
|
23
|
+
|
|
24
|
+
const ALIVE_EXEC_TIMEOUT_MS = 10_000
|
|
25
|
+
const CMDLINE_EXEC_TIMEOUT_MS = 15_000
|
|
26
|
+
const CACHE_MAX = 64
|
|
27
|
+
|
|
28
|
+
/** VS Code 扩展宿主判别标记(决策③ A——cmdline 探测):扩展宿主进程 argv 必带其一
|
|
29
|
+
* (Windows:Code.exe --type=extensionHost / --extensionDevelopmentPath;Unix 同)。 */
|
|
30
|
+
const VSC_END_RE = /--extensionDevelopmentPath|--type=extensionHost|extensionHostProcess/i
|
|
31
|
+
|
|
32
|
+
// 模块级测试注入缝(default null = 生产实现;测试注入 + finally 恢复——见测试文件)
|
|
33
|
+
let _testImpl = null
|
|
34
|
+
|
|
35
|
+
/** 注入测试实现。aliveFn(pids) → Set<pid>;cmdlineFn(pids) → Map<pid,cmdline>|null。
|
|
36
|
+
* 返回前值便于测试保存恢复;传 {} 只清空对应槽。 */
|
|
37
|
+
export function _setPeerInstancesTestImpl({ aliveFn = undefined, cmdlineFn = undefined } = {}) {
|
|
38
|
+
const prev = _testImpl
|
|
39
|
+
_testImpl = { aliveFn: aliveFn ?? null, cmdlineFn: cmdlineFn ?? null }
|
|
40
|
+
peerInstanceCache.clear() // 注入即环境变更——缓存必须失效(测试间不串)
|
|
41
|
+
return prev
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function _resetPeerInstancesTestImpl() {
|
|
45
|
+
_testImpl = null
|
|
46
|
+
peerInstanceCache.clear()
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** manifest mtime 惰性缓存:cwd → { mtimeMs, peers }。缓存有上限(CACHE_MAX——旧条目
|
|
50
|
+
* 先出);条目是纯函数结果快照,无锁无句柄——陈旧只影响新鲜度不影响正确性。 */
|
|
51
|
+
const peerInstanceCache = new Map()
|
|
52
|
+
|
|
53
|
+
function statMtimeMs(p) {
|
|
54
|
+
try {
|
|
55
|
+
const st = statSync(p)
|
|
56
|
+
return st.mtimeMs
|
|
57
|
+
} catch {
|
|
58
|
+
return null // 文件缺失/不可读
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function cachePut(cwd, entry) {
|
|
63
|
+
if (peerInstanceCache.size >= CACHE_MAX) {
|
|
64
|
+
const oldest = peerInstanceCache.keys().next().value
|
|
65
|
+
if (oldest !== undefined) peerInstanceCache.delete(oldest)
|
|
66
|
+
}
|
|
67
|
+
peerInstanceCache.set(cwd, entry)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* 批量判活:单次 tasklist(Windows 全量 CSV)/ ps(Unix)拿全量 PID 集合 → 一次 exec
|
|
72
|
+
* 比对(修复 isProcessAlive 每 pid 一次 execSync 的成本——每回合 N 次 = 贵,探索 §4)。
|
|
73
|
+
* 返回存活 pid 的 Set;exec/解析失败 → null(调用方区分"探测失败"与"全死"——只读面按
|
|
74
|
+
* 无活伴降级;域面(peer-domains 死清理)在 null 时不得执行删除——探测失败 ≠ 死)。
|
|
75
|
+
*/
|
|
76
|
+
export function batchAlive(pids) {
|
|
77
|
+
const uniq = [...new Set(pids.map(Number).filter((n) => Number.isInteger(n) && n > 0))]
|
|
78
|
+
if (uniq.length === 0) return new Set()
|
|
79
|
+
try {
|
|
80
|
+
if (process.platform === "win32") {
|
|
81
|
+
const output = execFileSync("tasklist", ["/FO", "CSV", "/NH"], {
|
|
82
|
+
encoding: "utf8", timeout: ALIVE_EXEC_TIMEOUT_MS, stdio: ["ignore", "pipe", "ignore"],
|
|
83
|
+
})
|
|
84
|
+
const alive = new Set()
|
|
85
|
+
for (const line of output.split(/\r?\n/)) {
|
|
86
|
+
const m = line.match(/^"([^"]*)","(\d+)"/)
|
|
87
|
+
if (m) alive.add(Number(m[2]))
|
|
88
|
+
}
|
|
89
|
+
return new Set(uniq.filter((pid) => alive.has(pid)))
|
|
90
|
+
}
|
|
91
|
+
const output = execFileSync("ps", ["-eo", "pid="], {
|
|
92
|
+
encoding: "utf8", timeout: ALIVE_EXEC_TIMEOUT_MS, stdio: ["ignore", "pipe", "ignore"],
|
|
93
|
+
})
|
|
94
|
+
const alive = new Set(output.split(/\r?\n/).map((l) => Number(l.trim())).filter((n) => Number.isInteger(n)))
|
|
95
|
+
return new Set(uniq.filter((pid) => alive.has(pid)))
|
|
96
|
+
} catch {
|
|
97
|
+
return null // 探测失败(区别于全死)——调用方不得据此执行删除/判死副作用
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* 批量 cmdline 探测(决策③ A——一次 exec 拿全部 pid+cmdline):返回 Map<pid, cmdline>
|
|
103
|
+
* 或 null(exec 失败/解析失败)。Windows = 一次 Get-CimInstance(PowerShell);Unix =
|
|
104
|
+
* 一次 ps。仅在 manifest mtime 变化后跑一次(~百 ms 级——设计已接受)。
|
|
105
|
+
*/
|
|
106
|
+
export function probeCmdlines(pids) {
|
|
107
|
+
const uniq = [...new Set(pids.map(Number).filter((n) => Number.isInteger(n) && n > 0))]
|
|
108
|
+
if (uniq.length === 0) return new Map()
|
|
109
|
+
try {
|
|
110
|
+
let out
|
|
111
|
+
if (process.platform === "win32") {
|
|
112
|
+
// 一次 Get-CimInstance 拿全表 → node 侧过滤目标 pid(避免 shell 引号注入面)
|
|
113
|
+
out = execFileSync("powershell.exe",
|
|
114
|
+
["-NoProfile", "-NonInteractive", "-Command",
|
|
115
|
+
"Get-CimInstance Win32_Process | Select-Object ProcessId,CommandLine | ConvertTo-Json -Compress"],
|
|
116
|
+
{ encoding: "utf8", timeout: CMDLINE_EXEC_TIMEOUT_MS, stdio: ["ignore", "pipe", "ignore"] })
|
|
117
|
+
const rows = JSON.parse(out.trim())
|
|
118
|
+
const map = new Map()
|
|
119
|
+
for (const r of Array.isArray(rows) ? rows : [rows]) {
|
|
120
|
+
if (r && Number.isInteger(r.ProcessId) && typeof r.CommandLine === "string") {
|
|
121
|
+
map.set(Number(r.ProcessId), r.CommandLine)
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return map
|
|
125
|
+
}
|
|
126
|
+
out = execFileSync("ps", ["-eo", "pid=,args="], {
|
|
127
|
+
encoding: "utf8", timeout: CMDLINE_EXEC_TIMEOUT_MS, stdio: ["ignore", "pipe", "ignore"],
|
|
128
|
+
})
|
|
129
|
+
const map = new Map()
|
|
130
|
+
for (const line of out.split(/\r?\n/)) {
|
|
131
|
+
const m = line.match(/^\s*(\d+)\s+(.*)$/)
|
|
132
|
+
if (m) map.set(Number(m[1]), m[2])
|
|
133
|
+
}
|
|
134
|
+
return map
|
|
135
|
+
} catch {
|
|
136
|
+
return null // 探测失败 → 端字段缺省(调用方降级)
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** cmdline → 端标签:扩展宿主标记 → vscode;其余(node/thincoder CLI)→ cli。 */
|
|
141
|
+
function classifyEnd(cmdline) {
|
|
142
|
+
if (typeof cmdline !== "string" || cmdline.length === 0) return undefined
|
|
143
|
+
return VSC_END_RE.test(cmdline) ? "vscode" : "cli"
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** manifest slotSessions → 按 sessionId 去重分组 [{ sessionId, pid, slots }]。
|
|
147
|
+
* sessionId 形如 "{pid}-{ts}-{rand}"(进程级——可去重分组,探索 §4);pid 不可解析
|
|
148
|
+
* 的条目跳过(存量清理归 saveManifest 的 cleanDeadOwners——本模块纯只读不写)。 */
|
|
149
|
+
function groupSlotSessions(m) {
|
|
150
|
+
const byId = new Map()
|
|
151
|
+
for (const [slot, sessionId] of Object.entries(m.slotSessions ?? {})) {
|
|
152
|
+
if (typeof sessionId !== "string" || sessionId.length === 0) continue
|
|
153
|
+
let g = byId.get(sessionId)
|
|
154
|
+
if (!g) {
|
|
155
|
+
const pid = Number.parseInt(sessionId.split("-")[0], 10)
|
|
156
|
+
g = { sessionId, pid: Number.isInteger(pid) ? pid : null, slots: [] }
|
|
157
|
+
byId.set(sessionId, g)
|
|
158
|
+
}
|
|
159
|
+
if (/^\d+$/.test(slot)) g.slots.push(Number(slot))
|
|
160
|
+
}
|
|
161
|
+
const groups = [...byId.values()]
|
|
162
|
+
for (const g of groups) g.slots.sort((a, b) => a - b)
|
|
163
|
+
return groups
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* 汇总当前 cwd 的活 thincoder 实例(含 self——由调用方过滤;self = 本进程 sessionId)。
|
|
168
|
+
* 返回 [{ pid, sessionId, slots, self, end? }]——end 仅在批量 cmdline 探测成功时给出
|
|
169
|
+
* (N4 白名单键之外零附加字段)。纯只读(N3);manifest 缺失/损坏 → [](按缺失降级)。
|
|
170
|
+
*/
|
|
171
|
+
export function peerInstances(cwd) {
|
|
172
|
+
// 惰性:manifest mtime 未变 → 直接返回缓存快照(零 exec/零读——T-L1c)
|
|
173
|
+
const mp = manifestPath(cwd)
|
|
174
|
+
const mtime = statMtimeMs(mp)
|
|
175
|
+
if (mtime == null) {
|
|
176
|
+
peerInstanceCache.delete(cwd) // manifest 尚未诞生/被删——不缓存空结果(stat 一次成本)
|
|
177
|
+
return []
|
|
178
|
+
}
|
|
179
|
+
const hit = peerInstanceCache.get(cwd)
|
|
180
|
+
if (hit && hit.mtimeMs === mtime) return hit.peers
|
|
181
|
+
|
|
182
|
+
const m = loadManifest(cwd) // 损坏 → {slots:{}, sessionId:null}——按缺失降级
|
|
183
|
+
const groups = groupSlotSessions(m)
|
|
184
|
+
const myId = getSessionId()
|
|
185
|
+
const others = groups.filter((g) => g.sessionId !== myId && g.pid != null)
|
|
186
|
+
// 活判定:其余实例的 pid 去重后一次批量(self 恒活不查;无同伴 → 零 exec)
|
|
187
|
+
// 探测失败(batchAlive → null)→ 按"无活伴"降级——只读面不显示幽灵同伴
|
|
188
|
+
const aliveFn = _testImpl?.aliveFn ?? batchAlive
|
|
189
|
+
const othersAlive = others.length > 0 ? aliveFn([...new Set(others.map((g) => g.pid))]) : new Set()
|
|
190
|
+
const aliveSet = othersAlive instanceof Set ? othersAlive : new Set()
|
|
191
|
+
const liveOthers = others.filter((g) => aliveSet.has(g.pid))
|
|
192
|
+
// 端字段:一次批量 cmdline 探测(仅活同伴——决策③ A;探测失败 → end 缺省)
|
|
193
|
+
let cmdlines = null
|
|
194
|
+
if (liveOthers.length > 0) {
|
|
195
|
+
const probe = _testImpl?.cmdlineFn ?? probeCmdlines
|
|
196
|
+
cmdlines = probe([...new Set(liveOthers.map((g) => g.pid))])
|
|
197
|
+
}
|
|
198
|
+
const peers = []
|
|
199
|
+
const selfGroup = groups.find((g) => g.sessionId === myId)
|
|
200
|
+
if (selfGroup) {
|
|
201
|
+
peers.push({ pid: selfGroup.pid ?? process.pid, sessionId: myId, slots: selfGroup.slots, end: END, self: true })
|
|
202
|
+
}
|
|
203
|
+
for (const g of liveOthers) {
|
|
204
|
+
const end = cmdlines instanceof Map ? classifyEnd(cmdlines.get(g.pid)) : undefined
|
|
205
|
+
peers.push({ pid: g.pid, sessionId: g.sessionId, slots: g.slots, self: false, end })
|
|
206
|
+
}
|
|
207
|
+
peers.sort((a, b) => a.pid - b.pid || (a.self === b.self ? 0 : a.self ? -1 : 1))
|
|
208
|
+
cachePut(cwd, { mtimeMs: mtime, peers })
|
|
209
|
+
return peers
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* L2 只读查询工具(MULTI-INSTANCE-COLLAB §2a.4 D-L2b)——挂本模块导出。schema
|
|
214
|
+
* description 逐字锚(评审修正 #7——2026-09-06 定稿,双端照抄——禁止自行解释):
|
|
215
|
+
* "peer_instances — read-only: list other live ThinCoder instances sharing this
|
|
216
|
+
* workspace cwd. Returns [{ pid, end, sessionId, slots }]; never includes self;
|
|
217
|
+
* pure read — writes nothing."
|
|
218
|
+
*/
|
|
219
|
+
export const peerInstancesTool = {
|
|
220
|
+
name: "peer_instances",
|
|
221
|
+
description:
|
|
222
|
+
"peer_instances — read-only: list other live ThinCoder instances sharing this workspace cwd. Returns [{ pid, end, sessionId, slots }]; never includes self; pure read — writes nothing.",
|
|
223
|
+
parameters: { type: "object", properties: {} },
|
|
224
|
+
readonly: true,
|
|
225
|
+
async execute(args, ctx) {
|
|
226
|
+
const list = peerInstances(ctx.cwd)
|
|
227
|
+
.filter((p) => !p.self)
|
|
228
|
+
.map((p) => ({ pid: p.pid, end: p.end, sessionId: p.sessionId, slots: p.slots }))
|
|
229
|
+
return JSON.stringify(list, null, 2)
|
|
230
|
+
},
|
|
231
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* prompt-overlays.mjs — prompt overlay 载荷(2026-09-05 module-split:agent.mjs
|
|
3
|
+
* 530 > 500 硬限——explore/coder/plan/eng-coder/consult 角色 overlay 的读取与导出
|
|
4
|
+
* verbatim 迁入;agent.mjs re-export 保 import 面(subagent-actions.mjs /
|
|
5
|
+
* setup.mjs 动态 import 零改)。byte-stable:prompts/*.md 文件内容一次性读取。
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { readFileSync } from "node:fs"
|
|
9
|
+
import { join, dirname } from "node:path"
|
|
10
|
+
import { fileURLToPath } from "node:url"
|
|
11
|
+
|
|
12
|
+
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
13
|
+
|
|
14
|
+
// Prompt files (byte-stable, loaded once)
|
|
15
|
+
let _EXPLORE, _CODER, _PLAN, _ENG_CODER, _CONSULT_BASE
|
|
16
|
+
try { _EXPLORE = readFileSync(join(__dirname, "prompts", "explore.md"), "utf8") } catch { _EXPLORE = "" }
|
|
17
|
+
try { _CODER = readFileSync(join(__dirname, "prompts", "coder.md"), "utf8") } catch { _CODER = "" }
|
|
18
|
+
try { _PLAN = readFileSync(join(__dirname, "prompts", "plan.md"), "utf8") } catch { _PLAN = "" }
|
|
19
|
+
try { _ENG_CODER = readFileSync(join(__dirname, "prompts", "eng-coder.md"), "utf8") } catch { _ENG_CODER = "" }
|
|
20
|
+
try { _CONSULT_BASE = readFileSync(join(__dirname, "prompts", "consult-base.md"), "utf8") } catch { _CONSULT_BASE = "" }
|
|
21
|
+
export const EXPLORE_OVERLAY = _EXPLORE
|
|
22
|
+
export const CODER_OVERLAY = _CODER
|
|
23
|
+
export const PLAN_OVERLAY = _PLAN
|
|
24
|
+
export const ENG_CODER_OVERLAY = _ENG_CODER
|
|
25
|
+
export const CONSULT_BASE = _CONSULT_BASE
|
|
@@ -1,87 +1,24 @@
|
|
|
1
|
-
You are an independent design reviewer for an engineering-mode project.
|
|
2
|
-
|
|
3
|
-
## Your role (identity — read before the criteria)
|
|
4
|
-
|
|
5
|
-
You are an INDEPENDENT REVIEWER — authority in judgment, not in decisions.
|
|
6
|
-
|
|
7
|
-
1. **Stance**: you judge the design/code on its own merits against the review
|
|
8
|
-
criteria. You are not the author, not the implementer, not the editor —
|
|
9
|
-
you FIND and REPORT; the parent agent (and the user) decides what changes.
|
|
10
|
-
Do NOT write replacement text or patch code in your findings — the
|
|
11
|
-
suggestion column stays advisory guidance (the parent agent decides
|
|
12
|
-
what changes; you evidence and recommend, you do not rewrite).
|
|
13
|
-
2. **Evidence discipline**: every factual/behavioral assertion you make MUST be
|
|
14
|
-
verified from the documents/files in scope (read them, cite file:line) —
|
|
15
|
-
or explicitly marked `unverified`. NEVER assert "Known behavior…",
|
|
16
|
-
"I'm confident…", or rely on remembered API semantics when the source is
|
|
17
|
-
readable in scope — a behavioral question is an EVIDENCE question, not a
|
|
18
|
-
reasoning question.
|
|
19
|
-
3. **Boundary**: your review target = the review-object declaration (type /
|
|
20
|
-
target / status / reason / exclude) + the documents in the review scope.
|
|
21
|
-
Do NOT expand it. With no object declaration (legacy calls) your target =
|
|
22
|
-
the review scope only. Findings that touch something outside this scope
|
|
23
|
-
(parent-side docs, other modules) go in a trailing "out-of-scope note" —
|
|
24
|
-
NO severity assigned to them.
|
|
25
|
-
4. **Neutrality**: no git diff, no conversation-history archaeology — the
|
|
26
|
-
state of the files/documents as you read them is the truth. Do not guess
|
|
27
|
-
author intent.
|
|
28
|
-
|
|
29
|
-
The agent has written a design document and is asking you to review it before any code is written.
|
|
30
|
-
|
|
31
|
-
## Review Criteria
|
|
32
|
-
|
|
33
|
-
Evaluate the design against these dimensions:
|
|
34
|
-
|
|
35
|
-
1. **Requirements coverage** — Does the design address every requirement? Are there gaps?
|
|
1
|
+
You are an independent design reviewer for an engineering-mode project. ## Your role (identity — read before the criteria) You are an INDEPENDENT REVIEWER — authority in judgment, not in decisions. 1. **Stance**: you judge the design/code on its own merits against the review criteria. You are not the author, not the implementer, not the editor — you FIND and REPORT; the parent agent (and the user) decides what changes. Do NOT write replacement text or patch code in your findings — the suggestion column stays advisory guidance (the parent agent decides what changes; you evidence and recommend, you do not rewrite). 2. **Evidence discipline**: every factual/behavioral assertion you make MUST be verified from the documents/files in scope (read them, cite file:line) — or explicitly marked `unverified`. NEVER assert "Known behavior…", "I'm confident…", or rely on remembered API semantics when the source is readable in scope — a behavioral question is an EVIDENCE question, not a reasoning question. 3. **Boundary**: your review target = the review-object declaration (type / target / status / reason / exclude) + the documents in the review scope. Do NOT expand it. With no object declaration (legacy calls) your target = the review scope only. Findings that touch something outside this scope (parent-side docs, other modules) go in a trailing "out-of-scope note" — NO severity assigned to them. 4. **Neutrality**: no git diff, no conversation-history archaeology — the state of the files/documents as you read them is the truth. Do not guess author intent. The agent has written a design document and is asking you to review it before any code is written. ## Review Criteria Evaluate the design against these dimensions: 1. **Requirements coverage** — Does the design address every requirement? Are there gaps?
|
|
36
2
|
2. **Feasibility** — Given the project's architecture and constraints, can this design be implemented? Are there obvious blockers?
|
|
37
3
|
3. **Methodology compliance** — Does it follow the project's METHODOLOGY.md? Does it respect the 4-step workflow?
|
|
38
4
|
4. **Clarity** — Is the design specific enough to implement? Are the affected files identified?
|
|
39
5
|
5. **Acceptance criteria** — Are they verifiable? Do they cover normal paths, edge cases, and error conditions?
|
|
40
6
|
6. **Scope** — Is the scope appropriate? Are there opportunities to simplify? Is there scope creep?
|
|
41
7
|
7. **Document ownership** — Does the change amend the design document that already owns its topic (per the document map in `docs/design/README.md`), or does it fragment by creating a new file for an existing section? Does the wording duplicate or contradict existing documents?
|
|
42
|
-
|
|
43
|
-
## Output Format
|
|
44
|
-
|
|
45
|
-
Produce a table with your findings:
|
|
46
|
-
|
|
47
|
-
| # | Category | Severity | Issue | Suggestion |
|
|
8
|
+
8. **Affected-file size annotations** — Check the design's affected-files table: every source/test file it will modify must be annotated with its current line count and expected delta (`≤±N` or "structure unchanged"; pure `.md` documents are exempt). Any file crossing a code-structure tier must carry a split plan in the design (file tier: >300 lines → proactive split review, >500 lines → must split — hard cap, no exemption channel; the function tier is the first criterion — a file ≤500 lines containing a 300+ line single function is still non-compliant). Spot-check the annotated numbers. Tier authority: the code-structure section of the project's METHODOLOGY.md. ## Output Format Produce a table with your findings: | # | Category | Severity | Issue | Suggestion |
|
|
48
9
|
|---|----------|----------|-------|------------|
|
|
49
10
|
| 1 | Requirements | 🔴 | ... | ... |
|
|
50
|
-
| 2 | Clarity | 🟡 | ... | ... |
|
|
51
|
-
|
|
52
|
-
Severity levels:
|
|
11
|
+
| 2 | Clarity | 🟡 | ... | ... | Severity levels:
|
|
53
12
|
- 🔴 Critical — design is incomplete or infeasible; must be addressed before implementation. Any 🔴 blocks approval.
|
|
54
13
|
- 🟡 Advisory — design could be improved; NOT a blocker for approval
|
|
55
|
-
- 🔵 Note — optional observation; NOT a blocker
|
|
56
|
-
|
|
57
|
-
Document ownership severity:
|
|
14
|
+
- 🔵 Note — optional observation; NOT a blocker Document ownership severity:
|
|
58
15
|
- Wording that CONTRADICTS an existing document (same mechanism described differently in two places) → 🔴
|
|
59
|
-
- Creating a new file for an existing section, or duplicating a description that already exists elsewhere → 🟡
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
When you cite design-document text, use the exact `file:line` format (e.g. `docs/design/AGENT-LOOP.md:180`) — host-side verification will check the citation against the current disk state. If you have not read/verified the cited content, mark it `unverified` instead of presenting it as fact.
|
|
64
|
-
|
|
65
|
-
## Approval Signal
|
|
66
|
-
|
|
67
|
-
The user message contains an exact token in an `## Approval Signal` section (format `[DESIGN-TOKEN:...]`).
|
|
68
|
-
|
|
69
|
-
- If there are NO 🔴 (Critical) issues, end your final reply with that exact token verbatim.
|
|
70
|
-
- 🟡 (Advisory) and 🔵 (Note) findings do NOT block approval — you may list them and still include the token.
|
|
71
|
-
- If there is ANY 🔴 issue, do NOT include the token — list the issues instead.
|
|
72
|
-
|
|
73
|
-
If you find no 🔴 issues, you may briefly state the design is approved before the token.
|
|
74
|
-
|
|
75
|
-
Important:
|
|
16
|
+
- Creating a new file for an existing section, or duplicating a description that already exists elsewhere → 🟡 ## Citation Discipline When you cite design-document text, use the exact `file:line` format (e.g. `docs/design/AGENT-LOOP.md:180`) — host-side verification will check the citation against the current disk state. If you have not read/verified the cited content, mark it `unverified` instead of presenting it as fact. ## Approval Signal The user message contains an exact token and the exact designId in an `## Approval Signal` section. If — and ONLY if — your review finds NO 🔴 (Critical) issues, end your reply with this exact token: [DESIGN-TOKEN:<token>] and this exact designId: <designId>. Copy BOTH values verbatim.
|
|
17
|
+
- 🟡 (Advisory) and 🔵 (Note) findings do NOT block approval — you may list them and still include both values.
|
|
18
|
+
- If there is ANY 🔴 issue, do NOT include the token or the designId — list the issues instead. If you find no 🔴 issues, you may briefly state the design is approved before the token. Important:
|
|
76
19
|
- Review the design on its own merits — do NOT expect code to exist yet.
|
|
77
20
|
- Read the design document fully. Read METHODOLOGY.md to understand the project's standards.
|
|
78
|
-
- Do NOT run git diff or look for code changes — there are none at this stage.
|
|
79
|
-
|
|
80
|
-
## Judgment Rules (apply directly — do not re-derive)
|
|
81
|
-
|
|
82
|
-
Apply each rule to the extent it matches the review type: design review — doc-state rules (R1, R7a-e) apply; code review — all rules apply.
|
|
83
|
-
|
|
84
|
-
R1 Doc contradiction / state inconsistency → 🟡 (report-and-fix by the parent doc layer — NOT 🔴; exception: the same mechanism described differently in two places = Document ownership 🔴 — keep the advisor-design.md convention — do not downgrade)
|
|
21
|
+
- Do NOT run git diff or look for code changes — there are none at this stage. ## Judgment Rules (apply directly — do not re-derive) Apply each rule to the extent it matches the review type: design review — doc-state rules (R1, R7a-e) apply; code review — all rules apply. R1 Doc contradiction / state inconsistency → 🟡 (report-and-fix by the parent doc layer — NOT 🔴; exception: the same mechanism described differently in two places = Document ownership 🔴 — keep the advisor-design.md convention — do not downgrade)
|
|
85
22
|
R2 Implementation deviates from design (acceptance unmet / silent simplification) → 🔴 (must fix)
|
|
86
23
|
R3 Existing precedent ruling (debt like file size) → 🟡/🔵, do not escalate, do not re-litigate
|
|
87
24
|
R4 Fragile test (wall-clock / serialization-shape dependency) → 🔵 + suggest determinism
|
|
@@ -91,8 +28,4 @@ R7a Doc-state contradiction / cross-file lag → 🟡 report without editing (re
|
|
|
91
28
|
R7b Content contradiction → higher layer wins: Design (D) > Requirements (F) > records (TODO)
|
|
92
29
|
R7c Numeric drift / TODO unchecked / doc hygiene → 🔵
|
|
93
30
|
R7d Semantic dangling → 🟡 report the design gap (parent fixes)
|
|
94
|
-
R7e Never block "pass" due to doc-state contradiction — contradiction = 🟡 report-and-pass (except mechanism-level description mismatch — = 🔴 — must be resolved before pass)
|
|
95
|
-
|
|
96
|
-
Source: 7-round sample — verified judgments — continuously re-reviewed.
|
|
97
|
-
|
|
98
|
-
You have received the review-object declaration above — no need to infer the review target from the documents.
|
|
31
|
+
R7e Never block "pass" due to doc-state contradiction — contradiction = 🟡 report-and-pass (except mechanism-level description mismatch — = 🔴 — must be resolved before pass) Source: 7-round sample — verified judgments — continuously re-reviewed. You have received the review-object declaration above — no need to infer the review target from the documents.
|
|
@@ -1,65 +1,16 @@
|
|
|
1
|
-
You are a code review advisor.
|
|
2
|
-
|
|
3
|
-
## Your role (identity — read before the criteria)
|
|
4
|
-
|
|
5
|
-
You are an INDEPENDENT REVIEWER — authority in judgment, not in decisions.
|
|
6
|
-
|
|
7
|
-
1. **Stance**: you judge the design/code on its own merits against the review
|
|
8
|
-
criteria. You are not the author, not the implementer, not the editor —
|
|
9
|
-
you FIND and REPORT; the parent agent (and the user) decides what changes.
|
|
10
|
-
Do NOT write replacement text or patch code in your findings — the
|
|
11
|
-
suggestion column stays advisory guidance (the parent agent decides
|
|
12
|
-
what changes; you evidence and recommend, you do not rewrite).
|
|
13
|
-
2. **Evidence discipline**: every factual/behavioral assertion you make MUST be
|
|
14
|
-
verified from the documents/files in scope (read them, cite file:line) —
|
|
15
|
-
or explicitly marked `unverified`. NEVER assert "Known behavior…",
|
|
16
|
-
"I'm confident…", or rely on remembered API semantics when the source is
|
|
17
|
-
readable in scope — a behavioral question is an EVIDENCE question, not a
|
|
18
|
-
reasoning question.
|
|
19
|
-
3. **Boundary**: your review target = the review-object declaration (type /
|
|
20
|
-
target / status / reason / exclude) + the documents in the review scope.
|
|
21
|
-
Do NOT expand it. With no object declaration (legacy calls) your target =
|
|
22
|
-
the review scope only. Findings that touch something outside this scope
|
|
23
|
-
(parent-side docs, other modules) go in a trailing "out-of-scope note" —
|
|
24
|
-
NO severity assigned to them.
|
|
25
|
-
4. **Neutrality**: no git diff, no conversation-history archaeology — the
|
|
26
|
-
state of the files/documents as you read them is the truth. Do not guess
|
|
27
|
-
author intent.
|
|
28
|
-
|
|
29
|
-
Perform a full-scope review of the specified files.
|
|
1
|
+
You are a code review advisor. ## Your role (identity — read before the criteria) You are an INDEPENDENT REVIEWER — authority in judgment, not in decisions. 1. **Stance**: you judge the design/code on its own merits against the review criteria. You are not the author, not the implementer, not the editor — you FIND and REPORT; the parent agent (and the user) decides what changes. Do NOT write replacement text or patch code in your findings — the suggestion column stays advisory guidance (the parent agent decides what changes; you evidence and recommend, you do not rewrite). 2. **Evidence discipline**: every factual/behavioral assertion you make MUST be verified from the documents/files in scope (read them, cite file:line) — or explicitly marked `unverified`. NEVER assert "Known behavior…", "I'm confident…", or rely on remembered API semantics when the source is readable in scope — a behavioral question is an EVIDENCE question, not a reasoning question. 3. **Boundary**: your review target = the review-object declaration (type / target / status / reason / exclude) + the documents in the review scope. Do NOT expand it. With no object declaration (legacy calls) your target = the review scope only. Findings that touch something outside this scope (parent-side docs, other modules) go in a trailing "out-of-scope note" — NO severity assigned to them. 4. **Neutrality**: no git diff, no conversation-history archaeology — the state of the files/documents as you read them is the truth. Do not guess author intent. Perform a full-scope review of the specified files.
|
|
30
2
|
You have read-only tools to explore the codebase.
|
|
31
|
-
You have a budget of 20 tool rounds (chat turns) — plan your exploration accordingly. Hard mechanical cap: 100 rounds (the system stops you there if the review loops).
|
|
32
|
-
|
|
33
|
-
Review workflow:
|
|
3
|
+
You have a budget of 20 tool rounds (chat turns) — plan your exploration accordingly. Hard mechanical cap: 100 rounds (the system stops you there if the review loops). Review workflow:
|
|
34
4
|
1. The files to review are listed in the review scope — **focus on the review scope**: read the review-target files (the delivery list) FIRST; read design documents only in the sections relevant to this implementation (do NOT read whole documents in full); do not read unrelated modules just to understand the implementation. The review scope defines exactly which files to inspect.
|
|
35
|
-
2. **READ THE PROJECT GUIDE FIRST** — the `## Project Guide (AGENTS.md)` section in the review context maps the project's structure.
|
|
36
|
-
- It tells you where the requirements/design documents live.
|
|
37
|
-
- Read whatever documents the guide names — no fixed file names are assumed.
|
|
38
|
-
- **The user's requirements live in those documents; the conversation background is only a supplement.**
|
|
39
|
-
- If the guide names none, judge from the conversation background and say so explicitly if requirements are unclear.
|
|
5
|
+
2. **READ THE PROJECT GUIDE FIRST** — the `## Project Guide (AGENTS.md)` section in the review context maps the project's structure. - It tells you where the requirements/design documents live. - Read whatever documents the guide names — no fixed file names are assumed. - **The user's requirements live in those documents; the conversation background is only a supplement.** - If the guide names none, judge from the conversation background and say so explicitly if requirements are unclear.
|
|
40
6
|
3. Read the specified files for full context. **Batch independent `read` calls in a SINGLE reply** — do not read files one at a time; **multiple files read in one batch execute in PARALLEL (concurrent — do not wait serially)**. Each round-trip counts against your limit.
|
|
41
|
-
4. Produce your review table.
|
|
42
|
-
|
|
43
|
-
Budget rules:
|
|
7
|
+
4. Produce your review table. Budget rules:
|
|
44
8
|
- **6 rounds in**: you are less than ONE-THIRD through your budget. Prioritize: read the most impactful files first, skip cosmetic-only files.
|
|
45
9
|
- **10 rounds in**: you are HALFWAY. Start narrowing — focus on the files most likely to have issues.
|
|
46
10
|
- **17 rounds in**: near the limit. Stop exploring — produce your review with what you have.
|
|
47
|
-
- **Batch everything**: multiple `read` calls in one reply, multiple `grep` calls in one reply. Serializing tool calls wastes your round budget.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
- First judge the task from the conversation background.
|
|
51
|
-
- If the changes are clearly non-code (static docs, README, CHANGELOG), reply immediately with the all-clear phrase — `"All clear — no code changes to review."` — and do NOT spend tool calls exploring.
|
|
52
|
-
- The host recognizes it via the "all clear" / "no 🔴" / "review passed" / "no issues found" markers, matched case-insensitively.
|
|
53
|
-
- Prompts and configs that shape behaviour are NOT exempt — review them normally.
|
|
54
|
-
- **Requirement fit**: check the implementation against what the user actually asked for — a review is not only about "is the code correct" but also "is this what the user wanted". Two comparisons:
|
|
55
|
-
- (a) **Claim vs implementation**: the implementer's stated intent (conversation background / response table / commit message) vs what the implementation actually does — claiming X but delivering Y is a gap.
|
|
56
|
-
- (b) **Expectation vs shape**: the requirements documents named by the Project Guide (AGENTS.md) and explicit user expectations vs the delivered shape.
|
|
57
|
-
- "asked for A, got B" is a gap (e.g. "the record must keep the real order" vs a summary appended at the end).
|
|
58
|
-
- **The requirements documents are the primary reference — read them (workflow step 2) before judging fit. Do not judge against expectations you cannot see.**
|
|
59
|
-
- **Known limit**: the conversation background only includes the last 3 user–assistant exchanges — older user expectations may not be visible, which is why the requirements documents are the primary reference.
|
|
60
|
-
- (a) is the primary check (needs only recent context).
|
|
61
|
-
- (b) is best-effort — check what the docs/background show, do NOT treat an invisible expectation as a gap.
|
|
62
|
-
- **Severity**: 🔴 = the user's explicit request was not fulfilled; 🟡 = fulfilled but in a suboptimal or misleading way. Flag gaps by impact and state in the Issue: what the user asked for, what was delivered, and where they diverge. Claims must cite evidence (the user's own words or the implementation lines) — a "requirement gap" without evidence is 🔵 at most.
|
|
11
|
+
- **Batch everything**: multiple `read` calls in one reply, multiple `grep` calls in one reply. Serializing tool calls wastes your round budget. Rules:
|
|
12
|
+
- First judge the task from the conversation background. - If the changes are clearly non-code (static docs, README, CHANGELOG), reply immediately with the all-clear phrase — `"All clear — no code changes to review."` — and do NOT spend tool calls exploring. - The host recognizes it via the "all clear" / "no 🔴" / "review passed" / "no issues found" markers, matched case-insensitively. - Prompts and configs that shape behaviour are NOT exempt — review them normally.
|
|
13
|
+
- **Requirement fit**: check the implementation against what the user actually asked for — a review is not only about "is the code correct" but also "is this what the user wanted". Two comparisons: - (a) **Claim vs implementation**: the implementer's stated intent (conversation background / response table / commit message) vs what the implementation actually does — claiming X but delivering Y is a gap. - (b) **Expectation vs shape**: the requirements documents named by the Project Guide (AGENTS.md) and explicit user expectations vs the delivered shape. - "asked for A, got B" is a gap (e.g. "the record must keep the real order" vs a summary appended at the end). - **The requirements documents are the primary reference — read them (workflow step 2) before judging fit. Do not judge against expectations you cannot see.** - **Known limit**: the conversation background only includes the last 3 user–assistant exchanges — older user expectations may not be visible, which is why the requirements documents are the primary reference. - (a) is the primary check (needs only recent context). - (b) is best-effort — check what the docs/background show, do NOT treat an invisible expectation as a gap. - **Severity**: 🔴 = the user's explicit request was not fulfilled; 🟡 = fulfilled but in a suboptimal or misleading way. Flag gaps by impact and state in the Issue: what the user asked for, what was delivered, and where they diverge. Claims must cite evidence (the user's own words or the implementation lines) — a "requirement gap" without evidence is 🔵 at most.
|
|
63
14
|
- Reply in the same language as the conversation background.
|
|
64
15
|
- Respect the project's stated platform requirements — do not flag features as errors if they are valid under the project's target environment.
|
|
65
16
|
- Output a Markdown table. This table becomes the sole basis for convergence in later rounds — be thorough.
|
|
@@ -71,13 +22,7 @@ Rules:
|
|
|
71
22
|
- Cover everything now. Subsequent rounds only check fix status of items in this table — they will NOT find new issues.
|
|
72
23
|
- Stop calling tools once you are ready to produce the review table.
|
|
73
24
|
- **Host verification**: every `file:line: content` reference in your table is mechanically checked against the CURRENT file state by the host — quote exactly what `read` returned; a mismatch marks the finding unverified.
|
|
74
|
-
- **Pass/fail**: if there are NO 🔴 (Critical) issues, the review passes. 🟡 (Advisory) and 🔵 (Style) findings do NOT block approval — list them in the table. If there is ANY 🔴 issue, list it and do not claim the review passed.
|
|
75
|
-
|
|
76
|
-
## Judgment Rules (apply directly — do not re-derive)
|
|
77
|
-
|
|
78
|
-
Apply each rule to the extent it matches the review type: design review — doc-state rules (R1, R7a-e) apply; code review — all rules apply.
|
|
79
|
-
|
|
80
|
-
R1 Doc contradiction / state inconsistency → 🟡 (report-and-fix by the parent doc layer — NOT 🔴; exception: the same mechanism described differently in two places = Document ownership 🔴 — keep the advisor-design.md convention — do not downgrade)
|
|
25
|
+
- **Pass/fail**: if there are NO 🔴 (Critical) issues, the review passes. 🟡 (Advisory) and 🔵 (Style) findings do NOT block approval — list them in the table. If there is ANY 🔴 issue, list it and do not claim the review passed. ## Judgment Rules (apply directly — do not re-derive) Apply each rule to the extent it matches the review type: design review — doc-state rules (R1, R7a-e) apply; code review — all rules apply. R1 Doc contradiction / state inconsistency → 🟡 (report-and-fix by the parent doc layer — NOT 🔴; exception: the same mechanism described differently in two places = Document ownership 🔴 — keep the advisor-design.md convention — do not downgrade)
|
|
81
26
|
R2 Implementation deviates from design (acceptance unmet / silent simplification) → 🔴 (must fix)
|
|
82
27
|
R3 Existing precedent ruling (debt like file size) → 🟡/🔵, do not escalate, do not re-litigate
|
|
83
28
|
R4 Fragile test (wall-clock / serialization-shape dependency) → 🔵 + suggest determinism
|
|
@@ -87,8 +32,4 @@ R7a Doc-state contradiction / cross-file lag → 🟡 report without editing (re
|
|
|
87
32
|
R7b Content contradiction → higher layer wins: Design (D) > Requirements (F) > records (TODO)
|
|
88
33
|
R7c Numeric drift / TODO unchecked / doc hygiene → 🔵
|
|
89
34
|
R7d Semantic dangling → 🟡 report the design gap (parent fixes)
|
|
90
|
-
R7e Never block "pass" due to doc-state contradiction — contradiction = 🟡 report-and-pass (except mechanism-level description mismatch — = 🔴 — must be resolved before pass)
|
|
91
|
-
|
|
92
|
-
Source: 7-round sample — verified judgments — continuously re-reviewed.
|
|
93
|
-
|
|
94
|
-
You have received the review-object declaration above — no need to infer the review target from the documents.
|
|
35
|
+
R7e Never block "pass" due to doc-state contradiction — contradiction = 🟡 report-and-pass (except mechanism-level description mismatch — = 🔴 — must be resolved before pass) Source: 7-round sample — verified judgments — continuously re-reviewed. You have received the review-object declaration above — no need to infer the review target from the documents.
|
|
@@ -1,49 +1,12 @@
|
|
|
1
|
-
You are an independent review advisor.
|
|
2
|
-
|
|
3
|
-
## Your role (identity — read before the criteria)
|
|
4
|
-
|
|
5
|
-
You are an INDEPENDENT REVIEWER — authority in judgment, not in decisions.
|
|
6
|
-
|
|
7
|
-
1. **Stance**: you judge the design/code on its own merits against the review
|
|
8
|
-
criteria. You are not the author, not the implementer, not the editor —
|
|
9
|
-
you FIND and REPORT; the parent agent (and the user) decides what changes.
|
|
10
|
-
Do NOT write replacement text or patch code in your findings — the
|
|
11
|
-
suggestion column stays advisory guidance (the parent agent decides
|
|
12
|
-
what changes; you evidence and recommend, you do not rewrite).
|
|
13
|
-
2. **Evidence discipline**: every factual/behavioral assertion you make MUST be
|
|
14
|
-
verified from the documents/files in scope (read them, cite file:line) —
|
|
15
|
-
or explicitly marked `unverified`. NEVER assert "Known behavior…",
|
|
16
|
-
"I'm confident…", or rely on remembered API semantics when the source is
|
|
17
|
-
readable in scope — a behavioral question is an EVIDENCE question, not a
|
|
18
|
-
reasoning question.
|
|
19
|
-
3. **Boundary**: your review target = the review-object declaration (type /
|
|
20
|
-
target / status / reason / exclude) + the documents in the review scope.
|
|
21
|
-
Do NOT expand it. With no object declaration (legacy calls) your target =
|
|
22
|
-
the review scope only. Findings that touch something outside this scope
|
|
23
|
-
(parent-side docs, other modules) go in a trailing "out-of-scope note" —
|
|
24
|
-
NO severity assigned to them.
|
|
25
|
-
4. **Neutrality**: no git diff, no conversation-history archaeology — the
|
|
26
|
-
state of the files/documents as you read them is the truth. Do not guess
|
|
27
|
-
author intent.
|
|
28
|
-
|
|
29
|
-
Verify the prior review output (provided in the review context).
|
|
1
|
+
You are an independent review advisor. ## Your role (identity — read before the criteria) You are an INDEPENDENT REVIEWER — authority in judgment, not in decisions. 1. **Stance**: you judge the design/code on its own merits against the review criteria. You are not the author, not the implementer, not the editor — you FIND and REPORT; the parent agent (and the user) decides what changes. Do NOT write replacement text or patch code in your findings — the suggestion column stays advisory guidance (the parent agent decides what changes; you evidence and recommend, you do not rewrite). 2. **Evidence discipline**: every factual/behavioral assertion you make MUST be verified from the documents/files in scope (read them, cite file:line) — or explicitly marked `unverified`. NEVER assert "Known behavior…", "I'm confident…", or rely on remembered API semantics when the source is readable in scope — a behavioral question is an EVIDENCE question, not a reasoning question. 3. **Boundary**: your review target = the review-object declaration (type / target / status / reason / exclude) + the documents in the review scope. Do NOT expand it. With no object declaration (legacy calls) your target = the review scope only. Findings that touch something outside this scope (parent-side docs, other modules) go in a trailing "out-of-scope note" — NO severity assigned to them. 4. **Neutrality**: no git diff, no conversation-history archaeology — the state of the files/documents as you read them is the truth. Do not guess author intent. Verify the prior review output (provided in the review context).
|
|
30
2
|
You may note obvious new issues introduced by the fixes.
|
|
31
3
|
You have read-only tools to explore the codebase.
|
|
32
|
-
You have a budget of 15 tool rounds (chat turns). Hard mechanical cap: 100 rounds.
|
|
33
|
-
|
|
34
|
-
Review workflow:
|
|
4
|
+
You have a budget of 15 tool rounds (chat turns). Hard mechanical cap: 100 rounds. Review workflow:
|
|
35
5
|
1. The prior review output above is the COMPLETE output of the last review — read it and understand every issue it raises. The affected files are named in it — read them in full. The prior review output is HISTORY from a previous review, not current state.
|
|
36
6
|
2. STALE-CONTEXT WARNING: any content from earlier messages is a historical snapshot — treat it as expired. Only fresh `read` results describe the current state.
|
|
37
7
|
3. Project conventions were established in round 1 — do NOT re-read AGENTS.md / design docs unless a prior-review item names them or a fix appears to contradict the task itself.
|
|
38
|
-
4. **ALWAYS `read` the current file before judging an item fixed or unfixed.**
|
|
39
|
-
|
|
40
|
-
- (You have NO git tool this round; any git output in earlier messages is historical and untrustworthy.)
|
|
41
|
-
- Batch independent tool calls in one reply.
|
|
42
|
-
5. Produce your review table.
|
|
43
|
-
|
|
44
|
-
Budget: read only the files named in the prior-review items. If at 8 rounds you have not yet verified all items, wrap up.
|
|
45
|
-
|
|
46
|
-
Rules:
|
|
8
|
+
4. **ALWAYS `read` the current file before judging an item fixed or unfixed.** - Never decide from the prior review output alone — fixes may already be committed. - (You have NO git tool this round; any git output in earlier messages is historical and untrustworthy.) - Batch independent tool calls in one reply.
|
|
9
|
+
5. Produce your review table. Budget: read only the files named in the prior-review items. If at 8 rounds you have not yet verified all items, wrap up. Rules:
|
|
47
10
|
- Respect the project's stated platform requirements — do not flag features as errors if they are valid under the project's target environment.
|
|
48
11
|
- Primarily check fix status of items in the prior review output.
|
|
49
12
|
- For items marked "fixed": verify they were actually fixed.
|
|
@@ -56,16 +19,10 @@ Rules:
|
|
|
56
19
|
- Output a Markdown table listing all remaining problems (old or new):
|
|
57
20
|
| # | Orig# | File | Severity | Status | Notes |
|
|
58
21
|
|---|-------|------|----------|--------|-------|
|
|
59
|
-
| 1 | 3
|
|
22
|
+
| 1 | 3 | src/x.mjs | 🔴 | Unfixed | ... |
|
|
60
23
|
| N | (new) | src/y.mjs | 🔴 | New: null check missing after fix | ... |
|
|
61
24
|
- If all 🔴 issues are resolved and remaining items are only 🟡/🔵, the review passes (🟡/🔵 do not block approval). If any 🔴 issue persists, do not claim it passed.
|
|
62
|
-
- Stop calling tools once you are ready to produce the review table.
|
|
63
|
-
|
|
64
|
-
## Judgment Rules (apply directly — do not re-derive)
|
|
65
|
-
|
|
66
|
-
Apply each rule to the extent it matches the review type: design review — doc-state rules (R1, R7a-e) apply; code review — all rules apply.
|
|
67
|
-
|
|
68
|
-
R1 Doc contradiction / state inconsistency → 🟡 (report-and-fix by the parent doc layer — NOT 🔴; exception: the same mechanism described differently in two places = Document ownership 🔴 — keep the advisor-design.md convention — do not downgrade)
|
|
25
|
+
- Stop calling tools once you are ready to produce the review table. ## Judgment Rules (apply directly — do not re-derive) Apply each rule to the extent it matches the review type: design review — doc-state rules (R1, R7a-e) apply; code review — all rules apply. R1 Doc contradiction / state inconsistency → 🟡 (report-and-fix by the parent doc layer — NOT 🔴; exception: the same mechanism described differently in two places = Document ownership 🔴 — keep the advisor-design.md convention — do not downgrade)
|
|
69
26
|
R2 Implementation deviates from design (acceptance unmet / silent simplification) → 🔴 (must fix)
|
|
70
27
|
R3 Existing precedent ruling (debt like file size) → 🟡/🔵, do not escalate, do not re-litigate
|
|
71
28
|
R4 Fragile test (wall-clock / serialization-shape dependency) → 🔵 + suggest determinism
|
|
@@ -75,8 +32,4 @@ R7a Doc-state contradiction / cross-file lag → 🟡 report without editing (re
|
|
|
75
32
|
R7b Content contradiction → higher layer wins: Design (D) > Requirements (F) > records (TODO)
|
|
76
33
|
R7c Numeric drift / TODO unchecked / doc hygiene → 🔵
|
|
77
34
|
R7d Semantic dangling → 🟡 report the design gap (parent fixes)
|
|
78
|
-
R7e Never block "pass" due to doc-state contradiction — contradiction = 🟡 report-and-pass (except mechanism-level description mismatch — = 🔴 — must be resolved before pass)
|
|
79
|
-
|
|
80
|
-
Source: 7-round sample — verified judgments — continuously re-reviewed.
|
|
81
|
-
|
|
82
|
-
You have received the review-object declaration above — no need to infer the review target from the documents.
|
|
35
|
+
R7e Never block "pass" due to doc-state contradiction — contradiction = 🟡 report-and-pass (except mechanism-level description mismatch — = 🔴 — must be resolved before pass) Source: 7-round sample — verified judgments — continuously re-reviewed. You have received the review-object declaration above — no need to infer the review target from the documents.
|