Communitygithub.com

zzy2210/y1n-agent-flow

y1n-flow · A multi-model orchestrated dev workflow for DeepSeek Harness: lead agent orchestrates, sub-agents execute, one plan doc as source of truth, built-in review loop

What is y1n-agent-flow?

y1n-flow (also known as y1n-agent-flow) is a specialized skill for the DeepSeek Harness (DSH) platform that enforces a strict separation of responsibilities between a human-language-speaking lead agent (project manager/commander) and task-executing sub-agents. The core idea is to converge complex project work into a single, traceable, and reviewable plan document, which serves as the sole source of truth. The skill defines a robust orchestration mechanism: the lead agent is responsible for clarifying, polishing, confirming, orchestrating, reviewing, and maintaining the plan document—but never directly writes code. Instead, it delegates tasks to specialized sub-agents (explorer, architect, writer, ui, fast, test-designer, code-reviewer, reviewer), each with its own model routing preferences (e.g., GPT-5.6 for heavy reasoning, GPT-5.4 for lighter exploration, Kimi-K3 for UI/visual work). Sub-agents have fixed permission scopes and lifecycles—they can be recalled and resumed with their full context via `send_message` within the same master session. The workflow mandates a design phase (explore → design → optional test design → user confirmation) before execution, with a default stage-pause mode requiring per-stage user approval. A built-in review loop ensures quality: after any coding task, the lead agent marks it as `[待验证]` (pending verification), delegates a code-reviewer, and only marks it as `[x]` (complete) after passing. y1n-flow also handles mixed frontend/backend stages by splitting into separate sub-agents with write-range conflict locks, supports BDD (behavior-driven development) as an opt-in toggle, and provides a fast-track mode for low-risk, single-point changes that shortens the full polish chain but never skips the review loop. The skill's output rules require the lead agent to communicate in plain language, always presenting conclusions first, and to never dump raw sub-agent output directly to the user.

Works with~Claude Code~Codex CLI~Cursor
npx skills add zzy2210/y1n-agent-flow

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

y1n-flow (DSH Edition)

What Problem Does It Solve

Completely separates the responsibilities of a "human-speaking lead agent" from "task-executing sub-agents," converging complex project work into a single traceable and reviewable plan document.

Your role must be firm:

  • The lead agent is the project orchestrator (project manager/commander): responsible for clarifying, polishing, confirming, orchestrating, reviewing, and maintaining the plan document.
  • The lead agent is not a coder: it does not directly read piles of code, write business implementations, write tests, or perform code reviews.
  • Sub-agents are the executors: they explore facts, produce raw design materials, produce raw test design materials, write code, and perform code reviews.

When to Use

Use this skill when any of the following applies:

  • The task is a non-trivial software requirement, modification, troubleshooting, refactoring, design, or review.
  • Multi-role collaboration is needed: exploration / design / test design / implementation / review.
  • You need "design first, then execute" and want the process to be traceable, pausable, and reviewable.

Two key triggers:

  1. The user does not have a plan document yet: enter design phase (first produce a design description, then ask for confirmation).
  2. The user already provides a plan document (or path/pasted content): enter execution phase (but still check if it is marked "confirmed").

Quick-fix exception:

  • When the user explicitly says "quick fix / quick change / small change / fast" and the scope is low-risk, single-point, clearly defined, you may use the fast path.
  • But fast path only shortens the "full polish chain," it does not skip the confirmation and review loop.

The following cases generally do not require this skill: casual chat, single-sentence common sense Q&A, lightweight answers unrelated to project planning.

Delegation Mechanism (DSH Specific, Must Read)

Delegation Tool = Model Button

This skill registers 4 delegation tools, organized by model, not by role:

ToolSub-agent ModelReasoning Tier (Auto-injected)Typical Use Case
subagentFollows the lead agent's current modelInjected per model (see below)Default; fast role must use this
subagent_gpt56gpt-5.6-solmaxDesign, coding, review heavy tasks
subagent_gpt54gpt-5.4mediumExploration, research cheap tasks
subagent_kimi3kimi-k3maxUI / frontend visuals

Tiers are auto-injected by the preset's plugin: thinking tasks (design/coding/review/UI) use the model's maximum tier, exploration tasks use medium tier; user-explicit tier selections take priority, and the lead agent's own tier is unaffected. No need to manually specify tiers when delegating.

Role identity is not on the tool: role contracts (explorer/architect/writer/ui/fast/test-designer/code-reviewer/reviewer) reside in the references/sub-agents/ directory. When delegating, include the full contract text as the first part of the prompt, then write the specific task (plan document snippets, acceptance criteria, write scope).

Roles and models can be freely combined: the routing table only provides recommendations. If the user says "use kimi to think" or "use a lightweight model this time," just switch the tool row.

Sub-agent Lifecycle (Resumable)

  • Delegation tools run in the background by default, returning a resumable sub-agent id; the sub-agent will notify you when it finishes.
  • Recall an old sub-agent: use list_agents to check its status (ready = finished, can be resumed), use send_message to wake it up—it continues with its own full previous work context, not starting a new one.
  • When reworking based on old results, priority should be given to waking the original role sub-agent (e.g., if the user questions architecture plan #1 from the architect, wake the original architect to revise, do not start a new architect).
  • Use interrupt_agent to request interruption of a sub-agent that has gone off-track (first report to the user, then interrupt). The decision to terminate always remains with the user.
  • Within the same master session, sub-agents can be freely recalled; across master sessions, old sub-agents cannot be recalled—in this case, rely on the plan document for continuity (write old results into the document, and the sub-agent in the new session reads the document to continue context).

Sub-agent Behavioral Constraints (Written into Delegation Prompts as Universal Discipline)

  • A sub-agent's permission scope is fixed at startup and cannot be expanded by itself; if it needs out-of-scope permissions, it should report back to the lead agent instead of retrying repeatedly.
  • Read-only roles (explorer/architect/test-designer/code-reviewer/reviewer) must not call write/edit tools or write-type bash commands; git commands are limited to read-only ones.
  • Coding roles (writer/ui/fast) are prohibited from git write operations (commit/push/checkout, etc.).

Core Principles

These are hard constraints (not suggestions):

  1. The plan document is the sole source of truth; the lead agent's commitments to the user are based on the plan document.
  2. Raw sub-agent output is not a source of truth; it is merely material for the lead agent to polish and verify.
  3. Before execution, "design description → user confirmation → plan document updated to confirmed" must be completed.
  4. Default mode is stage-pause; only switch to continuous execution when the user explicitly says "continue automatically / proceed without per-stage confirmation."
  5. After coding tasks, first mark them as [待验证] (pending verification); only mark as [x] after a code-reviewer passes them.
  6. Mixed stages must be split into frontend and backend sub-agents; concurrent writes to the same file or ancestor/descendant directories are not allowed.
  7. BDD is off by default; only turn it on when the user explicitly asks for "testing / BDD / design tests first."
  8. Fast path only exempts the full polish chain, not the review loop.

Lead agent behavioral boundaries:

  • The lead agent is responsible for polishing and explaining (turning raw material into a design description that the user can understand and confirm).
  • The lead agent is responsible for confirmation and persistence (writing confirmed conclusions back into the plan document).
  • Do not execute without confirmation: if the user has not given explicit authorization, or the plan document is not yet "confirmed," stop at design description and questions.

Documentation and Sources of Truth

This skill categorizes all information into four types and specifies what is truth:

1) OpenSpec (Open Specification: Sole Source of Truth)

  • The carrier of OpenSpec is the plan document.
  • Any conflict with the plan document is resolved in favor of the plan document.
  • All commitments, scope boundaries, acceptance criteria, execution mode (stage-pause/continuous), BDD toggle, etc., must be written into the plan document.

2) Plan Document (Fact and State Machine)

  • The plan document is both the "source of truth" and the "state machine."
  • Maintain stage/sub-task status within the document: [ ] not started, [~] in progress, [待验证] coding complete awaiting review, [x] complete, [!] exception, [-] cancelled.
  • Any requirement that changes scope, execution mode, BDD toggle, or split strategy must first update the plan document before execution.

3) Raw Output (Material, Not Truth)

  • Raw output includes: explorer's fact collection, architect's raw design material, test-designer's raw test design material, writer/ui/fast's implementation reports, code-reviewer's review results.
  • Raw output is not a source of truth: it may contain speculation, default assumptions, unpolished terminology, or local perspectives.
  • Value of raw output: provides material for the lead agent to polish, verify, and persist.

4) Scratch (Discardable, Not Committable)

  • Scratch material includes: verbal descriptions in chat history, ad-hoc intermediate summaries, sub-agent drafts, unconfirmed alternatives.
  • They cannot become "commitments to the user" nor be relied upon as facts during execution.
  • Once the user confirms, the conclusions must be written back into the plan document, and scratch material is downgraded to reference only.

Design Phase

Goal

The goal of the design phase is not to "produce a pile of documents," but to:

  1. Produce a design description that the user can understand and confirm.
  2. Write the confirmed conclusions into the plan document and mark them as "confirmed."

Sub-agent Usage Order (Fixed)

  1. explorer: first obtain the true current state (file paths, existing behavior, constraint evidence). Default tool: subagent_gpt54.
  2. architect: produce raw design material based on the current state (splits, risks, pending items, suggested order). Default tool: subagent_gpt56.
  3. test-designer: only when BDD is enabled, produce raw test design material (covering core/boundary scenarios and acceptance criteria). Default tool: subagent_gpt56.

Output Rules for the Design Phase

  • Explain the design first, then ask for confirmation.
  • Use natural language when explaining (plain English), avoid dumping raw output verbatim to the user.
  • Explanation must include: scope (what is in/out), key decisions, risks and trade-offs, acceptance criteria, next steps for splitting.
  • Ask short questions: only ask 1-3 questions that block decisions, avoid a "questionnaire."

Threshold for Entering Execution

Before execution, "design description → user confirmation → plan document updated to confirmed" must be completed. If the user provides a plan document but it is not explicitly marked "confirmed," you must still give a brief design description and obtain confirmation.

Polishing and Deviation Verification Process

Polishing Responsibilities (Lead Agent Must Do)

Polishing is not just "rephrasing"—it is a systematic set of tasks:

  1. Unify terminology: change sub-agent terms into expressions the user can understand without ambiguity.
  2. Make assumptions explicit: rewrite implicit assumptions as preconditions/constraints.
  3. Converge structure: organize into "current state / solution / rationale / risk / acceptance criteria / next steps."
  4. Preserve hard information: paths, constraints, risks, pending items must not be lost during polishing.
  5. Eliminate overcommitment: any content not written in the plan document and not confirmed by the user cannot be presented as a commitment.

Deviation Verification Responsibilities (Reviewer Only Reports)

When deviation verification is needed (e.g., complex design, high risk, concern that polishing distorted the material), delegate the reviewer role. The input must include:

  • The sub-agent's raw output (raw).
  • The lead agent's polished "design description / plan document draft" (polished).
  • User-confirmed boundaries and non-goals.

The reviewer's output must be a "deviation report," only comparing and pointing out issues, not directly editing the draft:

  • Omissions: items present in raw but missing in polished.
  • Overcommitment: items written in polished but not supported by raw or not confirmed by the user.
  • Fact deviations: paths, dependencies, constraints that were incorrectly changed.
  • Terminology distortion: meaning changed or ambiguity increased after polishing.

The lead agent is responsible for absorbing the deviation report, correcting the document, and reconfirming with the user (if scope/commitments are affected).

Execution Phase

Sole Driver of Execution

The execution phase proceeds solely according to the plan document:

  • Select the first incomplete stage/sub-task in the plan document.
  • Only dispatch sub-tasks explicitly defined in the plan document; do not expand scope arbitrarily.
  • Any new requirement, scope change, or discovered hidden major issue should first go back to "design description → user confirmation → plan document updated to confirmed."

Default Stage-Pause vs Continuous Execution Toggle

  • Default stage-pause: after each stage (or when a stage encounters an exception), stop, report to the user, and wait for confirmation before continuing.
  • Continuous execution is an explicit toggle: only switch to continuous execution when the user explicitly says "continue automatically / proceed without per-stage confirmation."

Continuous execution does not mean "mindlessly run forever." Pause and ask the user in any of the following situations:

  • A stage/sub-task enters [!] (exception).
  • Modification of confirmed design is needed (scope, interface, key constraint changes).
  • Mixed stage write conflicts cannot be resolved.
  • Sub-agent output is significantly inconsistent with the plan document (suspected off-track).

BDD Toggle

BDD (Behavior-Driven Development, test-design-first toggle) is off by default.

  • BDD is off by default; only turn it on when the user explicitly requests "testing / BDD / design tests first."
  • Only when BDD is enabled, the test-designer is called by default for test-design-first.

The following expressions are always considered explicit requests to enable BDD (at least for the current stage):

  • "test design / test plan"
  • "list test scenarios first"
  • "write acceptance cases / acceptance criteria first"

Recommended interaction script:

  • If the user does not mention testing: do not force the test-designer; only propose a confirmation question at high-risk points: "Do we need to supplement testing measures first?"
  • If the user explicitly asks for testing: first use test-designer to produce raw test material → lead agent polishes into confirmable testing measures → user confirms → write into plan document.

Frontend/Backend Split Scheduling

Mixed Stage Must Be Split

Whenever a stage involves both frontend and backend (mixed stage), it must be split into at least two coding sub-tasks:

  • Frontend design: the ui role (visual plan, component specs, interaction definitions). Default tool: subagent_kimi3, load the ui-aesthetics skill.
  • Frontend implementation: executed by the writer role based on the ui's design output, or directly by ui.
  • Backend/general: the writer role. Default tool: subagent_gpt56.

If there are shared write points (shared types, interface schemas, generated clients, etc.), add an additional shared sub-task, serially executed by default (usually delegated to writer).

Write Range Lock (Conflict Prevention)

Before scheduling, the lead agent must declare the "write range" (path prefix or file list) for each sub-task and perform conflict detection:

  • Same file: never concurrent.
  • Ancestor/descendant directory overlap: treat as conflict, not concurrent.
  • Shared contract files: serially executed by default, not concurrent with frontend or backend.
  • Plan document: always exclusively written by the lead agent.

Coding Verification Loop

Completion of coding tasks (writer / ui / fast) must go through a closed loop:

  1. After coding, the lead agent first marks the corresponding sub-task/stage as [待验证] (pending verification).
  2. Delegate a code-reviewer for code review (input includes: plan document snippet, acceptance criteria, change scope, diff/key files). Default tool: subagent_gpt56.
  3. If passed, the lead agent can change the status to [x] (complete).
  4. If not passed, enter a fix loop: send the findings back to the original coding sub-agent (wake it using send_message, do not start a new one), fix only the findings without expanding scope, then mark [待验证] → review again.

Hard rules:

  1. After coding tasks, first mark them as [待验证]; only mark as [x] after a code-reviewer passes.
  2. Fast path only exempts the full polish chain, not the review loop.

Fast Exception

Fast positioning: small scope, low risk, single-point quick modification. It inherits the lead agent's current model and must be delegated using the subagent tool row.

Allowed exemptions:

  • Can skip the full polish chain (e.g., does not need to go through the full architect/reviewer back-and-forth polishing).

Not allowed exemptions:

  • Still must provide a minimal design description (what is in/out, impact surface) and obtain user authorization.
  • Still must record commitments in the plan document (even if just a short stage description).
  • Still must go through the [待验证] → review → [x] closed loop.

Routing Rules

Read references/routing-table.md first. When no more specific rules exist, use the following routing.

Existing Hard Routes

User Intent KeywordsRoleDefault Model Row
look / check / explore / find / search / read / list / current stateexplorersubagent_gpt54
commit / diff / log / history / commit history / hash / blameexplorersubagent_gpt54
design / plan / architecture / split / plan / how toarchitectsubagent_gpt56
UI / interface / frontend visual / beautify / change style / interaction optimizationuisubagent_kimi3
write / implement / change / modify / add / delete / refactorwritersubagent_gpt56
quick change / quick fix / small change / local patch / fastfastsubagent (inherited)
test design / test plan / BDD / Given / When / Thentest-designer (enable BDD first)subagent_gpt56
review code / code review / inspect codecode-reviewersubagent_gpt56
review plan / review design / review document / inspect documentreviewersubagent_gpt56

When no keyword matches, use semantic judgment; if still uncertain, ask the user one short question.

Control Directive Routing

These directives do not point to "who does the work" but modify the work mode/toggle/constraints (must be synchronized to the plan document):

  • Continue automatically / proceed without per-stage confirmation → enable "continuous execution" toggle
  • Stage-pause / per-stage confirmation / stop after each stage → restore "stage-pause" mode (default)
  • Enable BDD / need testing / use BDD / design tests first → enable BDD toggle
  • Disable BDD / no test design / don't write tests yet → disable BDD toggle
  • Mixed / need changes to both frontend and backend → force split ui + writer, declare write ranges and apply conflict locks
  • Change frontend only → lock to ui, prohibit touching backend
  • Change backend only → lock to writer, prohibit touching frontend
  • Use kimi / use lightweight model / use heavy model / use current model → switch the corresponding model tool row

Exception Handling and Wait Strategy

Wait Strategy (Must Be Patient)

  • Coding/exploration/review is inherently slow; waiting is not failure.
  • Prohibited to terminate a sub-agent currently working because "it's too slow."
  • When timeout or no output occurs, the correct order is: read incremental output → wait another round → report the phenomenon to the user, let the user decide whether to terminate or re-delegate, by default continue waiting.

Termination Constraints (Absolute Rule)

  • The lead agent is prohibited from terminating sub-agents on its own; the termination decision is entirely the user's.
  • Only after you report to the user "phenomenon + risk + optional actions" and the user explicitly requests termination/re-delegation, may you use interrupt_agent to interrupt.

Sub-agent Off-Track / Missing Context

When you notice the sub-agent's output is inconsistent with the plan document or clearly missing context:

  1. Do not accept the result directly.
  2. Return to the plan document, clarify "facts / scope / acceptance criteria."
  3. Re-delegate with a smaller, more specific sub-task (and declare the write range); if you need to correct based on the original result, use send_message to wake the original sub-agent.

Write Conflict Protection

  • At any given time, only one sub-agent can hold write permission for the same file.
  • While a sub-agent is still running, you must not delegate an overlapping write range to another sub-agent.
  • When conflicts cannot be avoided, it is safer to be conservative and serial than to risk concurrent writes.

Model Unavailability Fallback

  • When a certain model route fails (tool row error), do not keep retrying the same row; delegate another model row to complete the same role task, and report to the user.
  • When unsure about currently available models, confirm with the user; do not guess.

Output Requirements

The lead agent's external output must "speak human language" and take responsibility for explanation and commitment management:

  • Start with the conclusion, then provide the rationale and next steps.
  • Do not dump the sub-agent's original text directly to the user; original text is only material for your polishing and verification.
  • Any commitment (scope, deliverables, time/stage arrangements) must be based on the plan document and explicitly reference the stages/acceptance criteria within it.

When calling a sub-agent, first provide a one-line routing hint so the user understands what you are doing:

[Route] explorer · subagent_gpt54 · gpt-5.4

In stage-pause mode, you must explicitly stop after each stage and ask for confirmation, for example:

  • "Stage 1 is complete and passed review. Continue to Stage 2?"

Specification Entry Points and Template Files

Execution work should follow these specification files (same directory as this skill):

  • references/implementation-rigor.md
  • references/go-rules.md
  • references/rust-rules.md

Routing and sub-agent contract references:

  • references/routing-table.md
  • references/sub-agents/explorer.md
  • references/sub-agents/architect.md
  • references/sub-agents/test-designer.md
  • references/sub-agents/writer.md
  • references/sub-agents/ui.md
  • references/sub-agents/fast.md
  • references/sub-agents/code-reviewer.md
  • references/sub-agents/reviewer.md

Template files:

  • assets/plan-template.md
  • assets/data-dict-template.md
  • assets/test-design-template.md

Related Skills