1. Main Agent Role
Only does: maintains the plan, calls the harness, manages the subagent lifecycle, validates Gates, and interacts with the user.
Does not do: write any formal artifact on behalf of others; hand-write subagent prompts; inline-execute any content production; replace validator with verbal judgment.
Red line for fully outsourcing content production: all formal artifacts of P2A/P2B/P3/P3.5/P4 (search.txt, source-brief.txt, outline.txt, style.json, planningN.json, slide-N.html, etc.)must and can onlybe generated by the corresponding subagent. The main agent writing out the content of these artifacts itself = contract violation. The only "writing" behavior allowed for the main agent is generating prompt files through the harness and validating artifacts through the validator.
2. Global Rules
2.1 Step Control
- CLI fixed step lock (mandatory): must strictly follow the main chain of the Canonical Plan
P0 → P1 → (P2A|P2B) → P3 → P3.5 → P4 → P5for execution; adding, deleting, or renaming is prohibited. - Branch choice of two: after entering P2A, P2B must absolutely not be run again, and vice versa.
- Gatekeeping rule (Gate): before entering the next Step, the preceding Gate must pass; only after the current step's command has finished executing and the Gate
exit=0can it be marked ascompleted。 - When it fails, only two actions are allowed:
RETRY_CURRENT_STEPor roll backROLLBACK→StepID。Strictly prohibited to "jump to a later step and try it out"。 WAIT_USER/WAIT_AGENTis a hard waiting point; before receiving input/FINALIZE,executing subsequent steps is prohibited。- Manual audit breakpoint: whether to enable it, which nodes to intervene in, and which materials can be viewed must be written into
requirements-interview.txtduring the Step 0 interview. Breakpoints can only be attached within existing main-chain Steps, and only the main agent is allowed to control them; subagents must not ask the user questions on their own. As long asmanual_audit_mode != off,reviewafter completion, the "whether it passes manual diagram review" is amandatory release point, the main agent must stop and ask the user, and only after receiving an explicit "pass" may it enter the full-page final inspection.
2.2 Mandatory Subagent Scheduling (Core Constraint)
General lifecycle:create(--model SUBAGENT_MODEL) → RUN(prompt路径) → STATUS… → FINALIZE → close; close upon completion, do not reuse. By default, for Step 4, first create one PageAgent-N per page to complete the first round of Planning → HTML → Review; if the user enables manual audit and at review the release point is not passed, or rework is requested during operation, then the main agent creates a phase-based PageAgent or PagePatchAgent-N to continue rework. At creation timemustexplicitly pass --model SUBAGENT_MODEL, omitting it is prohibited.SUBAGENT_MODEL is specified by the user during the Step 0 interview (see 3.1.0 and 6.2 for details).
Context isolation (mandatory): regardless of whether the CLI environment by default lets subagents inherit the main agent's context, this skill requires all subagents to run inisolated mode——the only context visible to a subagent is the content explicitly passed by the main agent through the prompt file. If the CLI supports isolation parameters (such as --no-context, sandbox mode, etc.), must be recorded in the "Subagent Operation Manual" and included in the invocation template. The main agent's conversation history, SKILL.md content, environment variables, etc.must notbe leaked to the subagent.
Subagent Mandatory Dispatch Table (each row = one subagent that must be created):
| Step | Subagent Type | Responsibility | Artifact | Main Agent Behavior Boundary |
|---|---|---|---|---|
| P2A | ResearchSynth | Online retrieval + material organization | search.txt, search-brief.txt | Only harness generates prompt → creates subagent → collects and validates |
| P2B | SourceSynth | Dimensionality reduction and integration of user materials | source-brief.txt | Same as above |
| P3 | Outline | Outline construction (including internal self-review loop) | outline.txt | Same as above; forbidden to intervene in the subagent's internal self-review |
| P3.5 | Style | Global style locking | style.json | Same as above |
| P4 | PageAgent-N (one per page) | Page planning + HTML + review | planningN.json, slide-N.html, slide-N.png | Same as above; orchestrator progressively orchestrates the three phases |
Red lines:
- The artifact of each Step in the table aboveMay only be generated by the corresponding subagent; the main agent producing any artifact inline = contract violation
- Even if a subagent fails, the main agent may only recreate the subagent and rerun it, and must not "patch-write" the artifact itself
- Image mode
generateand when the user needs text-to-image, additionally create theImageGensubagent; PageAgent does not handle text-to-image - If the user proposes a change order at a manual audit breakpoint, especially when giving a "fail" at the
reviewmandatory release point, the main agentmustrework through the phased PageAgent orPagePatchAgent-N; by default, restart fromreview, letting the subagent continue with image review + HTML fixing; the main agent is strictly forbidden from directly hand-editing the formal artifact
Adaptive Invocation Protocol (mandatory at every business node):
When the main agent reaches any Step in the table above, it must explicitly assemble the subagent invocation command according to the following process:
- Look up : Look up the "Subagent Operation Manual" output in Section 3.1.1, and retrieve theinvocation template(model slots use
SUBAGENT_MODEL) - Variable substitution: Replace the
{{SUBAGENT_NAME}}、{{PROMPT_PATH}}、{{MODEL}}in the template with the actual values of the current step ({{MODEL}}=SUBAGENT_MODEL) - Explicit output: Output the assembled complete command into the conversation (not executed in the mind, but explicitly written out)
- Execute: According to the output command, execute subagent creation, RUN, polling, and collection
Ambiguous references such as "create according to the operation manual" are forbidden; the assembly result must be explicitly displayed.
2.3 Prompt Generation
- All subagent prompts must be generated from templates via
prompt_harness.py; handwriting is forbidden - All
{{VAR}}must be filled in; any residue is an ERROR; output is fixed toOUTPUT_DIR/runtime/ - Templates/playbooks are injected only via
--inject-file; the main agent does not manually pre-read the body - Step 0 is templated by default and mandatory: The main agent must first generate
prompt_harness.pyviaOUTPUT_DIR/runtime/prompt-interview.md, then ask the user based on the rendered result; the runtime interview template must, according to capability, choose betweentpl-interview-structured-ui.mdandtpl-interview-text-fallback.md, and must not degrade into a casually written short and crude set of questions. - Step 0 Prioritize structured interview UI: As long as the current CLI provides any native questioning capability equivalent to
AskUserQuestion/request_user_input, the main agent must prioritize using it; determine the capability by whether it supports structured question objects such asquestion/header/id/options, not by fixed tool names. - Step 0 Text fallback must also be structured: If the current CLI does not support a structured interview UI, the main agent must fall back to a clearly grouped Markdown interview form; it must not degrade into a one-line fill-in-the-blank or a scattered string of questions.
- Step 0 Sole Exception: Only when
prompt_harness.pyexperiences a real script interface failure at Step 0, and it has been determined thatBLOCKED_SCRIPT_INTERFACE, is the main agent allowed to ask questions directly; however, the coverage dimensions must not be lower than the final requirements oftpl-interview.md.
2.4 Communication Protocol
| Instruction | Direction | Content |
|---|---|---|
| RUN | Main→Sub | prompt file path (one line, do not send the body) |
| STATUS | Sub→Main | Progress, blockers, next action |
| FINALIZE | Sub→Main | Completion signal + list of artifact paths |
Milestone communication only; for any fix, directly modify the file and return the path.
Multi-stage orchestrator supplementary protocol: For phase1 → phase2 [→ phase3] progressive sub-agents,non-final stages are only allowed to output --- STAGE n COMPLETE: {artifact_path} --- as the stage completion marker;only the final stage is allowed to send FINALIZE。
2.5 Dual Validation Safeguard
The subagent self-reviews before FINALIZE; after the main agent collects it, it runs the same validator again for recheck. Passing self-review does not mean the main chain is cleared.
2.6 Execution Discipline
- Execution-first strategy: After reaching a certain step, directly execute that step's harness/CLI command; do not engage in unrelated exploration without authorization.
- Interview pre-lock: After completing 3.1 environment awareness,
update_planandcli-cheatsheetreading, the firstuser-facing business interactionmust be the Step 0 interview questions; it is allowed to compress## 模型感知结果/## Subagent 操作手册/## 采访 UI 能力into a preceding status block in the same message, butmust not first do research, material exploration, or report reading。 - Reading isolation boundary: When the corresponding step has not been reached, reading the corresponding stage file is prohibited; the main agent may only read:
OUTPUT_DIR/**, user input materials, andcli-cheatsheet.md。 - Treat scripts as black-box tools:
scripts/*.pyis an execution target, not a reading target!Onlypython3 ...execution is allowed; running--helpon scripts to fumble for parameters is strictly prohibited, andcatscript source code is strictly prohibited! All required parameters are incli-cheatsheet.md. - If a command fails: first check the parameter form against the cheatsheet; if it cannot be resolved, immediately mark
BLOCKED_SCRIPT_INTERFACEand call on the user for a decision. - Reporting discipline: Only report "target action, execution result, Gate feedback"; long-winded "Explored files..." pre-reading lists are strictly prohibited.
2.7 Dual-layer Resource Consumption
Resource file structure:# 标题 + > 一句话定位(引用层) + body layer. Consumption rules:
- planning stage:
resource_loader.py menuload the title + reference layer to form the menu - In the planning phase, the main chain must first save a copy of the menu result as a
runtime/page-planning-menu-N.mdbackup, then have PageAgent read this snapshot - html phase:
resource_loader.py resolvedynamically load the body layer according to the planning JSON fields - Field routing:
layout_hint→layouts/、page_type→page-templates/、card_type→blocks/、chart_type→charts/
For commands, see the resource routing section of the cheatsheet.
3. Environment, Paths, and Artifact Contract
3.1 Environment Awareness (Critical, Mandatory Before Step 0)
Before entering any business step, the main agent must perform environment awareness in the following order, and record the resultsexplicitly classified into the conversation or plan log. This determines the tool floor for the entire task. If the current interface will be directly exposed to the user, it is allowed to compress these results into a pre-status block in the interview message; it is forbidden to expand into lengthy explanations before Step 0.
Pre-operations:
- First call
update_planto create the canonical plan. - Must read
references/cli-cheatsheet.mdto establish precise memory of all CLI interfaces.
3.1.0 Model & Thinking Effort Perception
To absolutely guarantee that content quality does not degrade, the main agent must confirm who it is at the start, and during the interview phase confirm the model and thinking level used by the subagent:
- Force identification of the large model version currently used by the main agent(for example Claude-3.5, Gemini-1.5, etc.; if it cannot be confirmed, ask the user directly).
- Explicitly solidify it in mind as the
MAIN_MODELglobal variable, and output## 模型感知结果in the conversation. At the same time, it is also necessary to detect whether the current environment API/tools support passing the "thinking depth/reasoning effort" level option to the model. SUBAGENT_MODELandSUBAGENT_THINKING_EFFORTbinding: The Step 0 interview phase will not only confirm with the user the model used by the subagent, but also ask for the requiredthinking depth level(see 6.2 for details). After the user answers, explicitly solidify them as theSUBAGENT_MODELandSUBAGENT_THINKING_EFFORTglobal variables, and output them synchronously in## 模型感知结果.- Global anti-degradation red line: Once these two variables are confirmed, when creating any Subagent in the subsequent process, they must be forcibly brought into the construction parameters (falling back to the default configuration is absolutely forbidden).
3.1.1 Subagent Operation Manual Generation
There are multiple execution tools in the environment, and the main agent must sort out the rules for itself:
-
Self-check the skills or APIs in the environment used to create and manage agents/subagents.
-
Check whether these tools support model override parameters (corresponding to 3.1.0).
-
Sort out the support status and output it to the conversation, with the title fixed as
## Subagent 操作手册, and it must include the following content:- Tool name: the subagent creation tools available in the current environment
- Invocation template (must contain variable slots): a parameterizable command template, containing
{{SUBAGENT_NAME}}、{{PROMPT_PATH}}、{{MODEL}}and, when deep thinking is supported,{{THINKING_EFFORT}}and other four slots. - Example invocation: an instance filling the slots with concrete values
Invocation template example (the main agent must generate a similar format according to the actual environment,
{{MODEL}}=SUBAGENT_MODEL,{{THINKING_EFFORT}}=SUBAGENT_THINKING_EFFORT):# 模板(槽位用 {{}} 标记,MODEL 取自 SUBAGENT_MODEL,THINKING_EFFORT 取自 SUBAGENT_THINKING_EFFORT) <tool> --model {{MODEL}} --reasoning-effort {{THINKING_EFFORT}} --message "Read {{PROMPT_PATH}} and execute all instructions" --name {{SUBAGENT_NAME}} -
thereafter, each time a business node calls a subagent, it must look back at this template, replace variables, andExplicitly output the fully assembled command into the conversation, then execute it. Vague references such as "according to the operation manual" are prohibited.
3.1.2 Interview UI Capability Detection
Since Step 0 directly determines the user interaction experience:
- The main agent must self-check whether the current CLI provides a native structured questioning UI.
- Judgment criteria: whether there exists a capability to submit
question/header/id/optionsand similar structured fields, and to let the user directly click/select or fill them in; the name is not limited and may appear asAskUserQuestion、request_user_input、ask_user_question、ui.form, etc. - Output the conclusion as
## 采访 UI 能力into the conversation, including at least:- Whether a structured interview UI is supported
- Tool name or capability form
- Whether single-select / multi-select / free-form supplementation is supported
- Actual execution strategy for Step 0:
structured-ui/text-fallback
- Before Step 0 asks questions, this conclusion must be checked back first; if supported, use
tpl-interview-structured-ui.md, if not supported, usetpl-interview-text-fallback.md。
3.1.3 Search Tool Inventory Detection
Since the Research branch relies extremely heavily on web retrieval capability:
- The main agent self-checks all system tools and custom skills that have web search or direct URL reading functionality.
- Sort out the supported items and output a table named
## Search 工具清单into the conversation. - The inventory generated in this step will be fed directly to the retrieval sub-agent in Step 2A via the
TOOLS_AVAILABLEvariable, so it must be clear and detailed.
3.1.4 Fallback Capability Check
If basic capabilities are missing, you must proactively stop and report an error:
- File read/write, Python, planning:must be available, otherwise stop the process directly.
- Information retrieval: available if possible; if not, you may proactively suggest that the user only proceed with Step 2B to modify local materials.
- Image generation: if there is no actual tool support, forcibly downgrade the subsequent image strategy to
manual_slotordecorate。
3.2 Path Variables
| Variable | Value |
|---|---|
SKILL_DIR |
Current skill root directory (for example:../skills/ppt-agent-workflow-san,must be a relative path) |
ROOT_OUTPUT_DIR |
ppt-output/(must be relative to CWD, jumping out is prohibited) |
RUN_ID |
YYYYMMDD-HHMMSS-topic(with a timestamp to distinguish outputs of different tasks in the same directory) |
OUTPUT_DIR |
ROOT_OUTPUT_DIR/runs/{RUN_ID} |
RUN_ID Uniqueness Constraint: For the same PPT task, only one RUN_ID is allowed throughout the entire process. After it is created in Step 0, it is locked and reused; retries/rollbacks/checkpoint recovery all reuse the same one, and it is prohibited to repeatedly create one for the same task. Different PPT tasks (different topics) each have their own independent RUN_ID. When resuming an old task, bind the old RUN_ID.
⚠️ Cross-environment portability red line (to prevent runtime path pollution): When assembling and passing variables used for sub-agent guidance to
prompt_harness.py, the main Agent is absolutely prohibitedfrom expanding them into the host's hard-coded absolute paths (such as/home/xxxxxxxx/...), and should also avoid extremely fragile outbound paths as much as possible (such as../../../.gemini/...)。The smartest ultimate solution:
- For engine code paths (such as
--var SKILL_DIR=or--var REFS_DIR=), the main agent should directly passthe string itself containing environment variable literals(such as--var SKILL_DIR='$SKILL_DIR'、--var REFS_DIR='$SKILL_DIR/references')。- In this way, the finally generated
OUTPUT_DIR/runtime/prompt-*.mdtemplate content will directly retainpython3 $SKILL_DIR/scripts/...this kind of placeholder. The child model will also obediently use such environment variables to request execution from the terminal, and any terminal, as long as it is configured with$SKILL_DIRcan instantly run our artifacts!- For business pipeline locations (
OUTPUT_DIRrelated), it must degrade to a clean CWD-based relative path.
3.3 Formal Artifact Chain
interview-qa.txt → requirements-interview.txt
→ search.txt + search-brief.txt(research)| source-brief.txt(非 research)
→ outline.txt → style.json
→ planning/planningN.json → slides/slide-N.html → png/slide-N.png
→ preview.html → presentation-{png,svg}.pptx → delivery-manifest.json
Runtime prompt falls to OUTPUT_DIR/runtime/prompt-*.md。
4. Canonical Plan
!Force the use of the CLI's original plan list tool to manage all tasks
P0.01 采访问题组装
P0.02 [WAIT_USER] 获取回答
P0.03 写入 interview-qa.txt
P0.04 归一化 → requirements-interview.txt
P1.01 输入识别
P1.02 [WAIT_USER] 分支选择(research / 非research)
P2A.01 harness → phase1 + phase2 + orchestrator prompt
P2A.02 创建 ResearchSynth subagent(发 orchestrator,subagent 内部自主渐进:搜索 → 格式化+自审)
P2A.03 [WAIT_AGENT] FINALIZE
P2A.04 回收校验(search.txt + search-brief.txt)
P2A.05 [可选] 回退 P2A.01 扩搜重跑
P2A.06 关闭
P2B.01 [如 pptx][WAIT_USER] 模式确认
P2B.02 资料初读与方向提炼(梳理 3-5 个可能的陈述切入方向)
P2B.03 [WAIT_USER] 强制展示方向并获取用户选择
P2B.04 将用户选定方向写入 requirements-interview.txt
P2B.05 harness → phase1 + phase2 + orchestrator prompt
P2B.06 创建 SourceSynth subagent(发 orchestrator,subagent 内部自主渐进:提炼 → 自审)
P2B.07 [WAIT_AGENT] FINALIZE
P2B.08 回收校验(source-brief.txt)
P2B.09 关闭
P3.01 harness → phase1 + phase2 + orchestrator prompt
P3.02 创建 Outline subagent(发 orchestrator,subagent 内部自主渐进:编写 → 自审+修复)
P3.03 [WAIT_AGENT] FINALIZE
P3.04 回收校验 outline.txt
P3.05 关闭
P3.5.01 harness → phase1 + phase2 + orchestrator prompt
P3.5.02 创建 Style subagent(发 orchestrator,subagent 内部自主渐进:决策 → 自审)
P3.5.03 [WAIT_AGENT] FINALIZE
P3.5.04 回收校验 style.json
P3.5.05 关闭
P4.NN.01 生成 Step 4 planning 菜单快照 + runtime prompt
P4.NN.02 创建当前轮 subagent(首轮:PageAgent-NN;断点返工:阶段型 PageAgent 或 PagePatchAgent-NN)
P4.NN.03 [WAIT_AGENT] 回收当前轮 FINALIZE(拿到最新 planning/html/png)
P4.NN.04 [如 manual_audit_mode != off][WAIT_USER] 展示最新 slide-N.png,询问是否通过人工图审
P4.NN.05 [如未通过] 创建 `PagePatchAgent-NN`(默认 `START_STAGE=review, END_STAGE=review`)执行图审 + HTML 修复,然后回到 `P4.NN.03`
P4.NN.06 整页终检(产物校验 + visual_qa + 主 agent 看图)
P4.NN.07 关闭当前页 subagent
(所有页并行推进)
P5.01 生成 preview.html
P5.02 PNG 导出 → presentation-png.pptx
P5.03 SVG 导出 → presentation-svg.pptx
P5.04 写入 delivery-manifest.json
Plan Update Rules: update only on status changes; track parallel pages page by page without merging; split create/wait/close; split generate/validate; explicitly mark rollback ROLLBACK→StepID。
5. Scheduling Skeleton and Source of Truth
5.1 Unified Subagent Scheduling Skeleton (shared by P2A/P2B/P3/P3.5/P4)
- Look up the corresponding step in the cheatsheet → harness generates phase prompt files (phase1 + phase2 [+ phase3])
- harness generates the orchestrator prompt (lightweight scheduling, containing only phase paths + progressive execution protocol)
- Create a subagent according to the "Subagent Operation Manual" (must pass
--model SUBAGENT_MODEL) - Send
RUN(orchestrator prompt path) → the subagent autonomously reads each phase progressively → receives FINALIZE - The main agent performs gate re-check; if it is Step 4 and
manual_audit_mode != off, then after FINALIZE it must first pass throughreviewafter[WAIT_USER]release point, then enter the full-page final check → close immediately when no longer reused
5.2 Source of Truth Index
| Category | Path | Consumption Method |
|---|---|---|
| Prompt Template | references/prompts/tpl-*.md |
Pass the path to harness, do not pre-read manually |
| Execution Details | references/playbooks/*-playbook.md |
--inject-file injection |
| Style Source of Truth | references/styles/runtime-style-*.md |
Step 3.5 injection |
| Outline/Interview/Delivery Contract | scripts/contract_validator.py |
P0 / P3 / P5 Gate |
| Step 4 schema source of truth | scripts/planning_validator.py |
P4 planning Gate |
| Step 4 image review and structural validation | scripts/visual_qa.py |
P4 PNG + planning + HTML dual-layer Gate |
| CLI Commands | references/cli-cheatsheet.md |
Read before Step 0, reference directly afterward |
CURRENT_BRIEF_PATH:research → search-brief.txt; non-research → source-brief.txt(shared by Step 3/4).
5.3 Single Source of Truth and Automatic Checks
- workflow / schema version source of truth:
scripts/workflow_versions.py(currentWORKFLOW_VERSION = 2026.04.09-v4.1) - Step 4 schema source of truth:
scripts/planning_validator.py - outline density contract source of truth:
scripts/contract_validator.py - Step 4 structural/pixel dual-layer validation source of truth:
scripts/visual_qa.py - prompt variable source of truth: each
references/prompts/tpl-*.mdin the template{{VAR}} - resource ID source of truth:
references/layouts/、references/blocks/、references/charts/、references/principles/the real file stem ofscripts/resource_loader.pyand the normalization rules of - multi-phase completion signal source of truth: the phase protocol in each orchestrator template
- automatic check entry point: after modifying prompt/playbook/cheatsheet/Step 4 schema examples, run
python3 SKILL_DIR/scripts/check_skill.py
6. Main Process State Machine
6.1 Step Panorama Table
| Step | Core Action | Key Artifact | Gate | Failure Rollback |
|---|---|---|---|---|
| P0 | Interview and normalize requirements | interview-qa.txt / requirements-interview.txt | contract_validator interview + requirements-interview |
Ask follow-up questions, do not enter P1 |
| P1 | Identify input and determine branch | Branch written to requirements-interview.txt | Logical judgment | WAIT_USER |
| P2A | Retrieve and compress materials | search.txt / search-brief.txt | contract_validator search + search-brief |
Fall back P2A.01 Rebuild ResearchSynth (expand search budget/dimensions) |
| P2B | Compress the user's existing materials | source-brief.txt | contract_validator source-brief |
Return to P2B and rewrite |
| P3 | Generate outline (internal self-review) | outline.txt | contract_validator outline(including density_bias / density_curve / 单页密度窗口) |
Fall back P3.01 Rebuild the Outline subagent, up to 2 rounds; if it still fails, BLOCKED_OUTLINE call the user for a decision |
| P3.5 | Fix the global style | style.json | contract_validator style |
Return to P3.5 |
| P4 | Produce each page in parallel | planningN.json / slide-N.html / slide-N.png | planning_validator + existence of the three-piece set + visual_qa(PNG + planning + HTML) + main agent reviews the images + (if enabled) user manual image review passes |
Only roll back that page; when manual image review does not pass, by default restart from review ; if the same type of P0/P1 does not converge for 2 consecutive rounds, force rollback to planning |
| P5 | Export and deliver | preview.html / dual pptx / delivery-manifest.json | contract_validator delivery-manifest |
Only roll back the export |
For the complete parameters of all commands, see
cli-cheatsheet.md。
6.2 Step 0 Interview (core starting point, cannot be skipped)
Even if the user provides a huge amount of information in the very first sentence,it is strictly forbidden to skip the interview stage。
- Efficient advancement: The interview directly collects the required field information and does not generate explanatory analysis or background descriptions.
- Default execution method: Prioritize generating and using a structured interview UI according to environment capabilities (
tpl-interview-structured-ui.md); if unsupported, use clear text Q&A with options (tpl-interview-text-fallback.md)。 - Structured output constraints: Provide users with clear preset options through prompts. The final collected field combination must be highly structured and data-rich, able to be output directly to
requirements-interview.txtand 100% parsed and consumed by downstream validators (Gate) and subsystems (Subagent), without the need for inference or processing. - Dimensions that must be covered but may be abbreviated (if already known): scenario, audience, core communication goal, expected page count and density, style preference, brand specifications, image strategy, scope of material usage, and whether to participate in intermediate manual audits.
- Density normalization convention (must be fixed at Step 0): What the user enters in
page_densityonly indicates the overall tendency of the entire deck and does not equal a fixed density for each page. Internally it is uniformly mapped todensity_bias:少而精 -> relaxed适中 -> balanced容量极大 -> ultra_dense
- Subsequent single-page differences are determined by the
outlineproduced bydensity_curve, not left tohtmlto improvise on the spot. - subagent model and thinking depth (must ask): Directly ask the user to choose "what model should subsequent subsystems use, and what level of thinking depth is needed?" (such as low/medium/high, or normal/deep thinking, depending on the current model ecosystem). After selection, fix them respectively into the
SUBAGENT_MODELandSUBAGENT_THINKING_EFFORTglobal variables. If the user does not care, you may default toSUBAGENT_MODEL = MAIN_MODELand use a medium thinking level. - Manual audit participation method (must ask): At least fix the
manual_audit_mode、manual_audit_scope、manual_audit_assetsthese 3 fields; the specific options and question format are maintained in the interview template and are not expanded inSKILL.md. - Only after all important options are collected and fixed into
requirements-interview.txt(which must include the model, thinking depth, and manual audit parameters) can you proceed to Step 1.
6.3 Step 1 Branch Determination
This is the watershed of the process.
- Identify and classify user input (large block of text, single file, multiple files, ready-made pptx).
- Mandatorily confirm the branch with the user: whether they need "online re-retrieval and expansion (Research branch)" or "limited to using only the current local materials (non-Research branch)".
- After receiving the answer, write the branch into
requirements-interview.txt。
6.4 Step 2A Search-Lite (exclusive to the Research branch)
At this stage, two extremes are highly likely to occur: thin content or unlimited searching that burns tokens.
Search depth estimation (the main agent must complete this before generating the prompt):
- Richness first: the primary goal of searching is to provide sufficiently rich material (data, cases, citations) for each page; it is better to search one extra round than to have thin content.
- Based on topic complexity and target page count, estimate the upper limit of search rounds (
MAX_SEARCH_ROUNDS) and write it into the prompt variable:- Simple/familiar topics (company introduction, product presentation, etc.):2 rounds
- Medium complexity (industry trends, technical solutions, etc.):3 rounds
- High complexity (in-depth research reports, multi-dimensional competitive analysis, etc.):4 rounds
- After each round of searching, the subagent must self-assess coverage: if the data types already cover the target page count requirements and the material is abundant, it may terminate early; if a certain dimension is clearly lacking, it should continue searching until the upper limit is reached.
MAX_SEARCH_ROUNDSis a hard upper limit rather than a target—it is encouraged to search as comprehensively as possible within the limit, but after reaching the limit it must converge into a brief, and unlimited additional searching is prohibited.
Mandatory check item: the produced search-brief.txt must include an independent structured data package block designed specifically for PPTX. It must contain at least 3 different data types (Metrics, Comparisons, Timelines, etc.).
- If search quality is low and
MAX_SEARCH_ROUNDShas not been reached, the main agent shouldfall back toP2A.01rebuild a new ResearchSynth prompt and subagent, expand the search budget/dimensions, and rerun the entire step; do not continue supplementary searching on a session that has already been FINALIZE. - If the upper limit has been reached and it is still unsatisfactory, mark
SEARCH_QUALITY_LOWand explain the gap to the user, letting the user decide whether to supplement materials or lower expectations.
6.5 Step 2B Local Material Compression (non-Research branch)
The pile of materials the user throws over must be processed properly before running the outline.This step also uses the subagent mode(SourceSynth subagent), but in order to avoid a black box deciding the direction and to ensure the direction fits the business, user decision-making must be introduced at this stage. The main agent is prohibited from inline-executing formal content production, but shallow preliminary exploration is allowed.
- [Special case] pptx mode confirmation: if the user directly passes
.pptx, the main agent mustfirstmandatorily ask about the expected processing mode (beautify layout only / completely restructure the outline / beautify layout and restructure content). - [Anti-black-box] Initial material reading and direction distillation: the main agent (or by calling other lightweight parsing tools) must do a quick preliminary read-through of the user's existing materials, and distill 3-5 possiblecore PPT statement directions/entry perspectives(For example: focusing on technical mechanisms vs focusing on business value).
- Mandatory direction confirmation: via
[WAIT_USER]mandatorily ask the user: "Based on the materials you provided, I have outlined the following narrative directions. Which one do you prefer, or do you have anything else to add?". After receiving the user's explicit reply, append this business direction torequirements-interview.txt. - The main agent generates the SourceSynth prompt via the harness (see cheatsheet Step 2B for the command).
- Create the SourceSynth subagent according to the "Subagent Operations Manual" (must pass
--model SUBAGENT_MODEL)。 - SourceSynth is responsible for:Multi-file dimensionality reduction(doc/excel/pdf/code → plain text),upfront understanding(following the mandatory direction in file
requirements-interview.txtto extract topics), consolidated outputsource-brief.txt。 - After the main agent retrieves FINALIZE, it performs Gate validation.
6.6 Step 3 Outline construction (internal closed loop)
Core discipline: The main agent should not try to be clever and explicitly start the subsequent review-and-validate loop. The Outline subagent is designed with a built-in closed-loop property; internally it follows the infinite loop of [draft → rigorously self-check for defects → cover and fix] until it reaches a perfect state, and only then will it hand over the final outline.txt。
This step is not just about ordering pages; it is also about setting the entire density rhythm first:
outlinemust explicitly produce a deck-leveldensity_biasand the entire set ofdensity_curve- Each page must write the complete
密度下限 / 密度目标 / 密度上限 / 节奏动作 / 信息姿态 / 锚点类型 - Common hard rules:
cover / section / enddoes not allowdashboard; 3 consecutive pages ofhigh / dashboard;dashboardmust be preceded and followed by at least 1 page of non-dashboardtransition contract_validator outlinewill directly check these fields; it is not allowed to leave the "page gap" to be decided on the fly at Step 4
6.7 Step 3.5 Style lock (global checkpoint)
Overall style tone-setting. Style is determined only after the outline produced from the requirements text is clear. Style judgment depends not only on the requirements, but even more on runtime-style-rules.md. Output: a precise style.json。
6.8 Step 4 Single-page parallel production (orchestrator progressive disclosure)
To prevent the large model from simultaneously juggling layout, image-text reasoning, and HTML coding in a single prompt, which causes "attention collapse", the task of each single page in this stage is split into a three-level prompt (4A Planning -> 4B HTML -> 4C Review).
The density contract here is a frozen point, not a suggestion:
planningmust freeze the density window given by the outline intodensity_label、density_reason、density_contractdensity_contractmust at least includedeck_bias、page_lower_bound、page_upper_bound、max_cards、max_charts、min_body_font_px、max_lines_per_card、image_policy、decoration_budget、overflow_strategycontent_budgetis a card-level hard budget; if missing, it counts as failure; it must continue to obey the page-leveldensity_contract- Starting from this step,
htmlis only responsible for execution and is not allowed to raise or lower this page's density on its own
Execution modes
Step 4 keeps only two modes:
- Automatic pass-through: The main agent generates the standard orchestrator prompt, and PageAgent runs Planning → HTML → Review in one go.
- Manual audit: If
manual_audit_mode != off, the main agent can set a breakpoint at theplanning、htmlnode; and at thereviewnode, user release is amandatory task node, not an optional bypass.
Mandatory release point after review
- As long as
manual_audit_mode != off. Each time PageAgent / PagePatchAgent completes one round ofreviewand writes the latestslide-N.png, the main agent must immediately[WAIT_USER]。 - At this point the question target is fixed as:whether the manual diagram review is passed. Only after obtaining an explicit "pass" from the user is that page allowed to enter full-page final inspection.
- If the user answers "fail / keep revising / run another review round", the main agent must by default create
PagePatchAgent-N, restarting withSTART_STAGE=review、END_STAGE=review, so the subagent continues diagram review + HTML fixes while preserving the existing planning and HTML. - Only when the user explicitly requests redoing the structure or content layout is the rework starting point allowed to restart from
htmlorplanning.
Rework Principles
- When the user proposes a change request at a breakpoint, or explicitly says "fail" at the forced release point after
review, the main agent may onlyrework through a phased PageAgent orPagePatchAgent-N, and cannot modify the official artifacts itself. - The rework starting point may only be one of the three:
planning/html/review; among them, when the manual diagram review afterreviewfails, by default restart fromreview; only when the user explicitly requests redoing the structure may it fall back tohtmlorplanning。 - The breakpoint materials, the external orchestrator assembly method, and the call template for
PagePatchAgent-Nare all maintained in Step 4 ofcli-cheatsheet.md.
Common Rules
- Pages can and shouldadvance in parallel。
HTMLmust fully comply withplanning:low / mid_lowmay have a high degree of freedom,mediumhas a medium degree of freedom,high / dashboardhas a low degree of freedom. High-density pages uniformly prioritize steady-stategrid / flex, phrasal copy, tables/matrices/micro-charts; prohibithero image, prohibit heavy decoration, prohibit multiple primary anchors in parallel, and prohibit cramming content via complex absolute positioning.reviewmust first checkdensity_contract, then look at PNG visual quality.- If the same
P0 / P1category still does not converge in 2 consecutive rounds of new screenshots, it means the problem has returned to the budget or skeleton layer, and you must stop continuing to fix HTML and forcibly roll backplanning, rewriting at least one item indensity_label / density_contract / layout_hint / cards 分配. - Stage Release Conditions: the trio (planningN.json + slide-N.html + slide-N.png) must be complete,
planning_validatormust pass; after full-page FINALIZE collection, the main agent must also additionally runvisual_qa --htmland personally inspect the image; if manual audit is enabled, it must also obtain the user's explicit "pass" afterreview. Only when these conditions are simultaneously satisfied is that page released. - subagent death = context completely gone. On any error retry, the old session loses its value,the entire page must be sent back and rerun (see Section 7 for details)。
6.9 Step 5 Delivery
Dual pipeline (PNG/SVG) in parallel; export failure only rolls back the export, not content production. For commands, see cheatsheet Step 5.
7. Retry and Recovery
Principle: trust only files and Gate validation, not verbal memory or session state.
7.1 Step 4 Retry (two steps)
Step one: reconnaissance — scan all pages and collect the page numbers with trigger conditions (any one holds true):
planningN.jsondoes not exist, is empty, orplanning_validatordoes not passslide-N.htmldoes not exist or is emptyslide-N.pngdoes not exist or is emptyvisual_qa.pyexit code is 1 (fatal defect)- The main agent personally inspects the images and finds an obvious visual problem
- After the user
reviewforcibly enforces the manual image review checkpoint and explicitly states it has not passed - The same type of
P0 / P1issue does not converge for 2 consecutive rounds, and it is necessary to roll back toplanning
Step 2: Parallel rerun — After collection is complete, launch all failed pages in parallel at once: clear the three-piece set and residual review images → start rerunning from P4.NN.01 (first generate the prompt, then create the PageAgent, and then RUN the orchestrator).
If the source of failure is only review that the manual image review did not pass afterward, the main agent should by default not rerun the entire page from scratch, but instead keep the existing planning/html and explicitly switch to PagePatchAgent-N restarting from review ; only if the user explicitly requests a structural change, or multiple rounds of review fixes are still ineffective, should it fall back to html/planning or rerun the entire page. If the condition "the same type of P0 / P1 does not converge for 2 consecutive rounds" has already been triggered, then patching is no longer allowed, and it must fall back to planning to re-freeze the budget and skeleton. The final release criteria remain completely consistent with the full Step 4.
A single page fails 3 consecutive times → mark it as BLOCKED_PAGE_N, skip it first and proceed with the remaining pages, and handle it collectively at the end.
Final-state handling of BLOCKED pages: After all non-BLOCKED pages are complete, the main agent must:
- Report to the user the page numbers that were BLOCKED and a summary of the Gate error for each failure
- The user decides:Manual fix(the user edits the HTML themselves) / Simplify and retry(reduce the design complexity of that page and rerun) / Skip this page(remove it from the outline and final delivery)
- It is forbidden to silently swallow BLOCKED pages and continue delivery
7.2 Cross-conversation breakpoint recovery
Trigger: the user says "continue/resume" and provides a RUN_ID (or by default takes the latest directory).
update_planRebuild the canonical plan; bind the old RUN_ID- Milestone detection (from high to low, the first exit=0 is the highest automatic pass point):
contract_validator.py delivery-manifest ... # P5
planning_validator.py ... # P4 自动下限(恢复后仍需补跑 visual_qa + 看图)
contract_validator.py style ... # P3.5
contract_validator.py outline ... # P3
contract_validator.py search-brief ... | source-brief ... # P2
contract_validator.py requirements-interview ... # P0/P1
- Continue from the next unfinished step; if a preceding Gate failed, fall back and redo it
- Step 4: Read
outline.txtto confirm the total number of pages → scout the three-piece set of all pages +planning_validator+visual_qa→ rerun failed pages in parallel; after the automatic items pass, the main agent still needs to inspect the images again to confirm (all old sessions are invalidated) - If
requirements-interview.txtrecords that manual audit is enabled, then when restoring to Step 4, the most recently available runtime prompt, final PNG, andreview/roundXarchive must also be included in the breakpoint materials; if after the most recent roundreviewthere is still no record of the user explicitly "passing the manual image review," then it must first restore to this mandatory[WAIT_USER]checkpoint before deciding whether to release or go throughPagePatchAgent-N
Forbidden: relying on old sessions, skipping scouting, processing pages serially one by one, and creating a new RUN_ID during recovery (unless the user requests a completely fresh start).