| composition | {"steps":[{"id":"clarify_intent","kind":"llm_chat","with":{"system":"You are the intent gate for meta-skill-creator. Do not inspect\nworkspace files, history, memory, or external sources. Decide only\nfrom the explicit user request and activation context.\n","task":"Clarify whether the user wants a meta-skill, not a normal standalone\nskill. If the request is generic skill creation, return\nROUTE: normal-skill. If it requires orchestrating multiple existing\nskills, return ROUTE: meta-skill. Also summarize desired inputs,\noutputs, trigger phrases, and whether a human preference branch is\nneeded. Set NEEDS_CLARIFICATION: yes only when the workflow goal,\noutput shape, trigger boundary, or human preference branch is\ngenuinely ambiguous and the request is an interactive user request.\nFor unattended auto-propose, dream, or cron activation, set\nNEEDS_CLARIFICATION: no and continue from available context.\n\nUser request:\n{{ inputs.user_message | xml_escape | truncate(1200) }}\n\nOuter system / activation context:\n{{ inputs.system_prompt | default(\"\") | xml_escape | truncate(1200) }}\n\nReturn:\nROUTE: <normal-skill|meta-skill>\nWORKFLOW_GOAL: <goal or unclear>\nOUTPUT_SHAPE: <deliverable or unclear>\nTRIGGERS: <phrases or unclear>\nHUMAN_PREFERENCE_BRANCH: <yes|no|unclear>\nNEEDS_CLARIFICATION: <yes|no>\nMISSING_FIELDS:\n - <workflow_goal|output_shape|trigger_boundary|human_preference_branch|none>\nCLARIFY_REASON: <one concise reason, or none>\n"}},{"id":"creator_clarify","kind":"user_input","depends_on":["clarify_intent"],"when":"'route: meta-skill' in (outputs.clarify_intent | lower) and 'needs_clarification: yes' in (outputs.clarify_intent | lower)","clarify":{"mode":"form","extract_natural_language":true,"fields":[{"name":"workflow_goal","type":"string","required":true,"max_length":300},{"name":"output_shape","type":"string","required":true,"max_length":200},{"name":"trigger_boundary","type":"string","max_length":300},{"name":"human_preference_branch","type":"boolean","default":false}],"cancel_words":["算了","取消","cancel","stop","abort"],"timeout_seconds":86400}},{"id":"normal_skill_exit","kind":"tool_call","depends_on":["clarify_intent"],"when":"'route: normal-skill' in (outputs.clarify_intent | lower)","tool":"emit_text","tool_args":{"text":"This request was classified as a normal standalone skill request, not\na meta-skill composition request. The meta-skill creator stopped\nbefore proposal assembly or persistence.\n"}},{"id":"creator_mode","kind":"llm_classify","depends_on":["clarify_intent","creator_clarify"],"when":"'route: meta-skill' in (outputs.clarify_intent | lower)","output_choices":["PREVIEW_ONLY","PERSISTED_PROPOSAL","FULL_GATED"],"with":{"text":"Classify how far the creator workflow should go.\n\nUser request:\n{{ inputs.user_message | xml_escape | truncate(1200) }}\n\nOuter system / activation context:\n{{ inputs.system_prompt | default(\"\") | xml_escape | truncate(1200) }}\n\nClarified intent:\n{{ outputs.clarify_intent | truncate(1200) }}\n\nClarification answers (may be empty when not needed):\n{{ outputs.creator_clarify | default('{}') }}\n\nDecision rules:\n- PREVIEW_ONLY: user asks for an example, template, plan, draft,\n or wants to inspect before writing/persisting anything.\n- PERSISTED_PROPOSAL: user asks to create/save/write/propose a\n meta-skill but does not ask for exhaustive smoke testing.\n- FULL_GATED: user asks for a production-ready, accepted, tested,\n validated, or fully gated meta-skill.\n- FULL_GATED: unattended auto-propose, dream, or cron activation\n requires preserving all creator gates before any auto-enable\n decision.\n"}},{"id":"harvest","kind":"skill_exec","skill":"history-explorer","skill_exec_entrypoint":"scripts/explore.py","depends_on":["clarify_intent","creator_clarify"],"when":"'route: meta-skill' in (outputs.clarify_intent | lower)","on_failure":"harvest_empty","skill_exec_stdin":"{\n \"id\": \"{{ inputs.session_id }}\",\n \"history\": {{ inputs.session_history | default('[]') }},\n \"metaRunHistory\": {{ inputs.session_meta_runs | default('[]') }}\n}\n","with":{"query":"Co-occurring skill chains and meta-skill usage for: {{ outputs.clarify_intent | truncate(1000) }}\nClarification answers:\n{{ outputs.creator_clarify | default('{}') }}\n","window_days":30,"include":["turns","tools","meta_runs","co_occurrences"]}},{"id":"harvest_empty","kind":"tool_call","tool":"emit_text","tool_args":{"text":"no history available; downstream should rely on user intent only"}},{"id":"pick_pattern","kind":"llm_classify","depends_on":["creator_mode","harvest"],"when":"'route: meta-skill' in (outputs.clarify_intent | lower)","output_choices":["p1_sequential","p2_fan_out_merge","p3_condition_gated"],"with":{"history_summary":"{{ outputs.harvest | truncate(2000) }}","user_intent":"Raw user request:\n{{ inputs.user_message | xml_escape | truncate(1200) }}\n\nClarified intent:\n{{ outputs.clarify_intent | truncate(1000) }}\n"}},{"id":"fill_slots","kind":"tool_call","depends_on":["pick_pattern"],"when":"'route: meta-skill' in (outputs.clarify_intent | lower)","tool":"meta_skill_fill_slots","tool_args":{"pattern_id":"{{ outputs.pick_pattern }}","history_summary":"{{ outputs.harvest | truncate(2000) }}","user_intent":"Raw user request:\n{{ inputs.user_message | xml_escape | truncate(1200) }}\n\nClarified intent:\n{{ outputs.clarify_intent | truncate(1000) }}\n"}},{"id":"assemble","kind":"tool_call","depends_on":["fill_slots"],"when":"'route: meta-skill' in (outputs.clarify_intent | lower)","tool":"meta_skill_assemble","tool_args":{"pattern_id":"{{ outputs.pick_pattern }}","slots_json":"{{ outputs.fill_slots }}"}},{"id":"collision_check","kind":"llm_chat","depends_on":["assemble"],"when":"'route: meta-skill' in (outputs.clarify_intent | lower)","with":{"system":"You are a trigger-collision reviewer for meta-skill-creator. Use only\nthe candidate SKILL.md provided in the task and the bundled creator\nboundaries named there. Do not call tools or inspect the workspace.\n","task":"Review this generated meta-skill proposal for trigger collisions with\nexisting bundled skills. Flag generic triggers, overlaps with\nmeta-skill-creator, and broad phrases that would steal unrelated user\nintent. Return PASS or REVISE_NEEDED plus reasons.\n\nCandidate SKILL.md:\n{{ outputs.assemble | truncate(8000) }}\n"}},{"id":"lint","kind":"tool_call","depends_on":["collision_check"],"when":"'route: meta-skill' in (outputs.clarify_intent | lower)","tool":"meta_skill_lint_run","tool_args":{"skill_md":"{{ outputs.assemble }}","gates":"G1,G2"}},{"id":"risk_classify","kind":"llm_chat","depends_on":["lint"],"when":"'route: meta-skill' in (outputs.clarify_intent | lower)","with":{"system":"You are an operational-risk classifier for generated meta-skills. Use\nonly the candidate SKILL.md and lint result in the task. Do not call\ntools or inspect the workspace.\n","task":"Classify operational risk for the generated meta-skill. Consider file\nwrites, network access, GitHub/gh actions, shell commands, memory\nwrites, and destructive operations. Return:\nRISK: low|medium|high\nCAPABILITIES:\n - <capability>\nREQUIRED_GATES:\n - <gate>\n\nCandidate SKILL.md:\n{{ outputs.assemble | truncate(8000) }}\n\nLint result:\n{{ outputs.lint | truncate(2000) }}\n"}},{"id":"single_model_baseline","kind":"llm_chat","depends_on":["creator_mode"],"when":"'route: meta-skill' in (outputs.clarify_intent | lower) and outputs.creator_mode == 'FULL_GATED'","with":{"system":"You are the highest-tier baseline model for meta-skill authoring.\nSolve the same task directly in one pass under the same outer\nassistant system prompt and user request, but without history\nmining, intent clarification output, deterministic slot filling,\nlint tools, smoke tools, persistence, or sub-skill orchestration.\nProduce the strongest standalone SKILL.md candidate you can from\nthat full prompt context.\n","task":"Same task as the orchestrated meta-skill creator workflow, but solve\nit as a standalone highest-tier model response. Use the outer system\nprompt and raw user request below; do not rely on any meta-skill\nintermediate output.\n\nOuter system prompt:\n{{ inputs.system_prompt | xml_escape | truncate(12000) }}\n\nUser request:\n{{ inputs.user_message | xml_escape | truncate(1600) }}\n\nReturn:\n- proposed meta-skill name\n- triggers\n- inputs\n- step graph\n- gates\n- collision risks\n- SKILL.md preview\n\nBoundary rule:\nCreator validation, proposal persistence, auto-enable decisions,\nand gate execution are handled by the outer meta-skill-creator\nworkflow. Do not require the generated candidate SKILL.md itself to\ncontain steps for saving proposals, running creator gates, comparing\nagainst baselines, or deciding auto-enable. The candidate SKILL.md\nshould describe only the reusable business workflow that will run\nlater when the new meta-skill is invoked.\n"}},{"id":"acceptance_compare","kind":"llm_chat","depends_on":["assemble","single_model_baseline"],"when":"'route: meta-skill' in (outputs.clarify_intent | lower) and outputs.creator_mode == 'FULL_GATED'","with":{"system":"You are an acceptance reviewer. Compare an orchestrated candidate\nagainst a single-model baseline that used the highest-tier model on\nthe same task. Reward verifiable skill composition, trigger safety,\ngates, operational risk handling, and reusable SKILL.md quality.\nKeep the boundary strict: proposal persistence, gate execution,\nruntime E2E, acceptance comparison, and auto-enable decisions belong\nto the outer meta-skill-creator workflow. Do not penalize a candidate\nSKILL.md for omitting creator-workflow steps that should not run when\nthe generated meta-skill is invoked later.\n","task":"User request:\n{{ inputs.user_message | xml_escape | truncate(1200) }}\n\nOrchestrated candidate:\n{{ outputs.assemble | truncate(7000) }}\n\nSingle-model baseline:\n{{ outputs.single_model_baseline | truncate(7000) }}\n\nReturn this exact structure:\nWINNER: orchestrated|single-model|tie\nQUALITY_SCORE: <0.00-1.00 weighted final product quality score>\nREASONS:\n- <specific evidence>\nREGRESSIONS:\n- <what the orchestrated candidate lacks versus the baseline>\nREQUIRED_IMPROVEMENTS:\n- <blocking edit required before acceptance, or \"none\">\n\nTreat REQUIRED_IMPROVEMENTS as a hard acceptance gate. Do not list\noptional nice-to-have enhancements there. If the orchestrated\ncandidate is production-acceptable and any baseline advantages are\nnon-blocking, put those advantages under REGRESSIONS and set\nREQUIRED_IMPROVEMENTS to \"none\".\nScore final product quality with high weight: 40% usefulness and\ncompleteness of the generated SKILL.md, 25% trigger/input/output\nspecificity, 20% gate/risk/collision coverage, and 15% reusable\nworkflow generality. Scores below 0.80 are not acceptable for\nFULL_GATED persistence even when WINNER is orchestrated.\nNever make proposal persistence, auto-enable state, acceptance\ncomparison, or runtime E2E execution a REQUIRED_IMPROVEMENT for the\ncandidate SKILL.md; those are already performed by this outer creator\nworkflow and are evaluated from the creator's gate outputs.\n"}},{"id":"smoke","kind":"tool_call","depends_on":["risk_classify"],"when":"'route: meta-skill' in (outputs.clarify_intent | lower) and outputs.creator_mode != 'PREVIEW_ONLY'","tool":"meta_skill_smoke_run","tool_args":{"skill_md":"{{ outputs.assemble }}","fixture_gen_model":"openai/gpt-4o-mini","classifier_model":"openrouter/auto"}},{"id":"runtime_e2e","kind":"tool_call","depends_on":["assemble","smoke"],"when":"'route: meta-skill' in (outputs.clarify_intent | lower) and outputs.creator_mode == 'FULL_GATED'","tool":"meta_skill_runtime_e2e_run","tool_args":{"skill_md":"{{ outputs.assemble }}","eval_prompts":""}},{"id":"preview","kind":"llm_chat","depends_on":["smoke","acceptance_compare","runtime_e2e"],"when":"'route: meta-skill' in (outputs.clarify_intent | lower)","with":{"system":"You are the final preview writer for meta-skill-creator. Produce only\na concise operator-facing proposal preview from the supplied step\noutputs. Do not call tools, inspect files, or invent persistence IDs.\n","task":"Produce a concise proposal preview for the user/operator before\npersistence. Include proposed name, triggers, DAG summary, collision\nresult, risk classification, lint status, smoke status, baseline\ncomparison status, and whether it appears eligible for acceptance.\nDo not invent paths or proposal IDs.\n\nCandidate SKILL.md:\n{{ outputs.assemble | truncate(8000) }}\n\nCollision check:\n{{ outputs.collision_check | truncate(1200) }}\n\nRisk:\n{{ outputs.risk_classify | truncate(1200) }}\n\nCreator mode:\n{{ outputs.creator_mode }}\n\nLint:\n{{ outputs.lint | truncate(2000) }}\n\nSmoke:\n{{ outputs.smoke | truncate(2000) }}\n\nBaseline comparison:\n{{ outputs.acceptance_compare | truncate(2000) }}\n\nRuntime E2E:\n{{ outputs.runtime_e2e | truncate(2000) }}\n"}},{"id":"persist","kind":"tool_call","depends_on":["preview"],"when":"'route: meta-skill' in (outputs.clarify_intent | lower) and outputs.creator_mode != 'PREVIEW_ONLY'","tool":"meta_skill_persist_proposal","tool_args":{"skill_md":"{{ outputs.assemble }}","lint_result":"{{ outputs.lint }}","smoke_result":"{{ outputs.smoke }}","creator_mode":"{{ outputs.creator_mode }}","acceptance_result":"{{ outputs.acceptance_compare }}","runtime_e2e_result":"{{ outputs.runtime_e2e }}","collision_result":"{{ outputs.collision_check }}","risk_result":"{{ outputs.risk_classify }}"}},{"id":"final_response","kind":"tool_call","depends_on":["preview","normal_skill_exit"],"tool":"emit_text","tool_args":{"text":"{% if outputs.normal_skill_exit %}\n{{ outputs.normal_skill_exit }}\n{% else %}\n{{ outputs.preview }}\n{% endif %}\n"}}]} |