feat(workflow-util-agent): prompt restructure + scope focus — RFC #351 Phase 3 #354
Reference in New Issue
Block a user
Delete Branch "feat/351-phase3-prompt-focus"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Auto-inject output format instructions and scope constraints into agent prompts.
Why
RFC #351 Phase 3 — prevent agent scope creep via prompt engineering, and guide agents to output frontmatter markdown format.
Changes
workflow-util-agent/src/build-output-format-instruction.ts— generates deliverable format section from Zod schemaworkflow-util-agent/src/create-agent-adapter.ts— prepends format instruction before systemPromptworkflow-util-agent/src/build-agent-prompt.ts— reorder: Task → Steps → Parent → Toolsworkflow-util-agent/__tests__/build-output-format-instruction.test.ts— 8 testsHow it works
buildOutputFormatInstruction(schema)introspects the Zod schema to list expected meta fieldsRef
Closes #351
LGTM ✅ RFC #351 完美收官。
Phase 3 亮点:
buildOutputFormatInstruction— 从 schema 自动提取字段列表注入 prompt,支持 ZodObject / ZodUnion / ZodDiscriminatedUnion,primitive 优雅降级buildThreadInput重构:steps.length === 0 && parentState === null的 early return 逻辑更清晰三个 Phase 整体质量一致,RFC #351 可以关了 🎉