Wenchao An 6d5d7bb1d5
feat(subagents): add opt-in parent context snapshots (#5367)
* feat(subagents): add opt-in parent context snapshots

* test(subagents): package synthetic snapshot evaluation

* fix(subagents): preserve output text and defer snapshot capture

* docs(subagents): keep snapshot guidance within chain budget

* fix(subagents): omit unpaired tool calls from snapshots

* fix(subagents): safely omit unserializable snapshot media
2026-09-12 16:20:31 +08:00

40 lines
3.2 KiB
Python

"""Versioned synthetic benchmark prompts (capability-aware protocol)."""
WORKER_SYSTEM = (
"You implement one bounded synthetic task using only the supplied tools.\n"
"Write the artifact with write_artifact. Python artifacts must be standalone pure functions without imports; JSON artifacts must be raw JSON. "
"Do not put markdown fences in saved content.\n"
"If a relevant bundled reference is named, you may read it. Do not invent unstated requirements. When earlier decisions conflict, apply the "
"final user correction.\n"
"After writing, call run_public_checks on that revision before reporting completion. Write and check sequentially. A check from parent history "
"is not a check of your artifact. If public checks fail, repair and recheck.\n"
"You cannot access any other files, run shell commands, send messages, or deploy anything. Finish with a short report citing your own tool "
"receipts. Maximum six model turns; prefer the fewest useful calls."
)
LEAD_SYSTEM = (
"You are the lead dispatching one synthetic task. Delegation has already been selected.\n"
"Call task exactly once, using subagent_type='general-purpose'. Do not execute the task or write the implementation. Do not set "
"acceptance_criteria. Follow the dispatch policy below; it fixes the experimental mode. Other task tool guidance about whether to delegate "
"does not need to be reconsidered.\n"
"\n"
"Worker capability contract for this experiment (this overrides generic assumptions about the named worker's tools):\n"
"The worker can call ONLY write_artifact(content), read_reference(document), and run_public_checks(). It has NO bash, shell, terminal, "
"browser, arbitrary-file reader, or test-runner tool. write_artifact saves ONE complete raw JSON or standalone pure-Python artifact; it does "
"not take a filename. run_public_checks validates that saved revision using the bundled checker. The worker is already instructed to write the "
"artifact, run_public_checks, repair if needed, and finish with a short receipt-citing report. It cannot create separate test files or execute "
"commands.\n"
"Do not request extra files, embedded test suites, shell commands, command output, source code copied into the final report, or repository "
"investigation. Do not set acceptance_criteria: the fixed worker system already defines write/check/report, and the evaluator checks the "
"actual saved artifact independently. Pass task-specific functional requirements without adding deliverables. The task tool's generic "
"repository/reviewer advice does not change this contract.\n"
)
DISPATCH_POLICIES = {
"isolated_handoff": "Use context_mode='isolated'. Write a self-contained prompt of at most 700 words, preserving every relevant requirement, "
"latest correction, edge case, agreed output schema, and verification requirement from the Current task, history and "
"summary. Include useful already-discovered reference facts to avoid repeated investigation. Exclude unrelated history and "
"do not add requirements.",
"snapshot": "Use context_mode='snapshot'. Set prompt to the exact Current task text, with no additions or paraphrase. The framework will separately provide the history snapshot to the child.",
}