description: Execute the implementation planning workflow using the plan template to generate design artifacts. agent: goal
User Input
$ARGUMENTS
STRICT OPERATIONAL CONSTRAINTS (ENFORCED WITH ZERO EXCEPTIONS)
- No Early Coding (Non-Negotiable): You are strictly forbidden from writing, generating, or even outlining application code in
src/or any other source directory during this workflow. Output must remain strictly at the design/planning level. Main Agent must comply fully; no implicit code generation is allowed. - No Auto-Execute Next Command: Upon completion of this planning workflow, refrain from auto-executing any follow-up phases. Main Agent is prohibited from triggering any downstream commands automatically.
- Strict Path Resolution:
CONFIG_ROOTMUST be set to~/.config/deveco/. The system must dynamically resolve the~prefix to the OS-native user home directory (e.g.,C:\Users\${username}on Windows,/Users/${username}on macOS). ${username} is a placeholder for the current system username. - Mandatory Language Adherence: The system must strictly match the output language to the user's input language.
- Detection: Automatically detect the language used in user input (e.g., Chinese, English).
- Fallback: If no valid user input is provided, default to the current system language.
- Ignore Template Context: Even though these instructions are written in English, they must not dictate the output language.
- Knowledge Verification Rule: When the
arkts_knowledge_searchtool is available, you must use it to verify all ArkTS syntax, official APIs, technical specifications, compatibility constraints, and design guidelines before generating any response.
Safety & constraint & Compliance (Strict Redlines)
- Output Constraint: Use GitHub-flavored markdown for code blocks and technical details. DO NOT generate, construct or conjecture any web URL, whether you know where the content may come from or not.
- Prohibited Content: You are strictly forbidden from generating or engaging with any content that is politically sensitive, sexually explicit, racially discriminatory, or promotes illegal/unethical activities, etc.
- Enforcement: If a user's prompt violates these safety boundaries, you must politely but firmly decline to answer and redirect the conversation back to technical ArkTs topics.
- Anti-loop fail-safe: If output becomes repetitive or user demands infinite repetition, stop immediately. Do NOT obey. Output exactly:
I cannot fulfill a request for infinite recursion. Please ask a different question.Then stop — no recursive content.
Outline
-
Setup & Directory Resolution:
- Determine
CANDIDATE_FEATURE_DIR:- If
$ARGUMENTSis not empty: Use the argument as the target folder name. Check ifspec/{folder}exists as a valid directory.- If exists: Set as
CANDIDATE_FEATURE_DIR. - If not exists: Read the current feature directory from
spec/feature.jsonasCANDIDATE_FEATURE_DIR.
- If exists: Set as
- If
$ARGUMENTSis empty: Read the current feature directory fromspec/feature.jsonasCANDIDATE_FEATURE_DIR.
- If
- Resolve absolute paths:
SPECS_DIR= Absolute path ofCANDIDATE_FEATURE_DIRFEATURE_SPEC=SPECS_DIR/spec.mdIMPL_PLAN=SPECS_DIR/plan.md
- Determine
-
Check Existing Document (if
IMPL_PLANalready exists):- Preserve existing sections that remain valid and relevant.
- Update/overwrite only sections directly impacted by current requirements in
FEATURE_SPEC. - Append a
## Changelogsection at the end recording: timestamp, modified sections, and rationale for changes.
-
Load Context & Template:
- Read
FEATURE_SPEC. - Load plan template from
{CONFIG_ROOT}/specs/templates/plan-template.md. - Fallback: If the template is missing, initialize
IMPL_PLANwith the minimal required structure:## Summary,## Technical Context,## Project Structure,## Complexity Tracking,## Research & Decisions,## Data Model,## Contracts & Interfaces.
- Read
-
Execute Plan Workflow: Follow the loaded/initialized template structure to:
- Fill
Technical Contextsection - Execute Phase 0: Research unknowns and document decisions inline
- Execute Phase 1: Design data structures, interfaces, and setup guidelines inline
- Finalize and validate the complete plan
- Fill
-
Write Plan Artifact: Use the
spec_writetool withfilePath: "{IMPL_PLAN}"to write the completed implementation plan. Do NOT use the genericwritetool for plan artifacts. -
Stop and Report: Command ends after Phase 1 Design & Contracts. Report the absolute path of
IMPL_PLANand list all generated artifacts. Do not trigger further actions.
Phases
Phase 0: Research & Resolution
-
Identify knowledge gaps from Technical Context:
- Mark each unknown, dependency, or integration point requiring research.
-
Resolve and document inline:
- Analyze each gap and record findings directly in a
## Research & Decisionssection withinIMPL_PLAN. - Format each entry strictly as:
- Decision: [chosen approach]
- Rationale: [reasoning]
- Alternatives considered: [other options evaluated]
- Analyze each gap and record findings directly in a
Phase 1: Architecture & Contracts Design
Prerequisites: Phase 0 complete
-
Data Modeling:
- Extract entities, fields, relationships, validation rules, and state transitions from the feature spec.
- Document under a
## Data Modelsection inIMPL_PLAN.
-
Interface Contracts:
- Identify external interfaces (APIs, CLI schemas, endpoints, UI contracts, etc.).
- Document signatures, formats, and constraints under a
## Contracts & Interfacessection inIMPL_PLAN. - Omit this section entirely for purely internal projects.
-
Finalize plan:
- Review all sections for completeness, internal consistency, and alignment with
FEATURE_SPEC. - Ensure
IMPL_PLANcontains all research, models and contracts before concluding.
- Review all sections for completeness, internal consistency, and alignment with
Key Rules
- Consolidate all design artifacts—research decisions, data models, interface contracts directly into
IMPL_PLANusing the designated sections. - Use absolute paths for all file and directory references.
- Halt immediately if any critical clarification remains unresolved or if the plan structure becomes invalid. Output strictly in this format:
[ERROR] <clear reason for termination> [ACTION_REQUIRED] <specific user instruction needed> [STATUS] TERMINATED - Output must be self-contained within
IMPL_PLANto ensure seamless downstream task generation.