Add plan format validator hook to detect malformed task labels

- Strengthen Prometheus plan template with FORMAT constraint
- Add task label format check to Oracle phase-2 (N/6 → N/7)
- Add format checks to self-review checklist
- New plan-format-validator hook: compares raw checkbox count
  against getPlanProgress() after plan writes, warns agent when
  labels are malformed (0/0 or partial skip scenarios)
This commit is contained in:
heunghingwan
2026-05-21 05:17:54 +08:00
parent a6e4691fcc
commit 73b5a7eb0e
8 changed files with 153 additions and 1 deletions
@@ -20,6 +20,7 @@ import {
createTeamToolGating,
createFsyncSkipWarningHook,
createNotepadWriteGuardHook,
createPlanFormatValidatorHook,
} from "../../hooks"
import {
getOpenCodeVersion,
@@ -47,6 +48,7 @@ export type ToolGuardHooks = {
fsyncSkipWarning: ReturnType<typeof createFsyncSkipWarningHook> | null
teamToolGating: ReturnType<typeof createTeamToolGating> | null
notepadWriteGuard: ReturnType<typeof createNotepadWriteGuardHook> | null
planFormatValidator: ReturnType<typeof createPlanFormatValidatorHook> | null
}
export function createToolGuardHooks(args: {
@@ -147,6 +149,10 @@ export function createToolGuardHooks(args: {
? safeHook("fsync-skip-warning", () => createFsyncSkipWarningHook())
: null
const planFormatValidator = isHookEnabled("plan-format-validator")
? safeHook("plan-format-validator", () => createPlanFormatValidatorHook(ctx))
: null
const notepadWriteGuard = isHookEnabled("notepad-write-guard")
? safeHook("notepad-write-guard", () => createNotepadWriteGuardHook())
: null
@@ -169,5 +175,6 @@ export function createToolGuardHooks(args: {
fsyncSkipWarning,
teamToolGating,
notepadWriteGuard,
planFormatValidator,
}
}
+1
View File
@@ -170,6 +170,7 @@ export function createToolExecuteAfterHandler(args: {
await hooks.webfetchRedirectGuard?.["tool.execute.after"]?.(hookInput, output)
await hooks.fsyncSkipWarning?.["tool.execute.after"]?.(hookInput, output)
await hooks.jsonErrorRecovery?.["tool.execute.after"]?.(hookInput, output)
await hooks.planFormatValidator?.["tool.execute.after"]?.(hookInput, output)
}
if (input.tool === "extract" || input.tool === "discard") {