This is the agent-side lifecycle skill. Dispatcher-host setup and launch orchestration live in the separate PREQ CLI/OpenClaw runtime package.
Environment
Recommended MCP mode:
- Register the remote MCP endpoint from the PREQSTATION
projects-manager service:
- Claude Code:
claude mcp add -s user --transport http preqstation https://<your-domain>/mcp
- Codex:
codex mcp add preqstation --url https://<your-domain>/mcp
- Gemini CLI:
gemini mcp add --scope user --transport http preqstation https://<your-domain>/mcp
- OAuth starts when the client first makes a real request to
/mcp
- Codex often triggers login during
add because it probes the server immediately
- Gemini CLI may also prompt for auth during MCP registration or first real tool call. If
gemini mcp list still shows preqstation as Disconnected, open an interactive Gemini session and run /mcp auth preqstation.
- Claude Code usually stores the config first and may show
Needs authentication until first use or claude mcp get preqstation
- Prefer one user-scoped Claude Code PREQ registration so you do not accumulate duplicate project-local entries
- Verify MCP registration with
claude mcp list, codex mcp list, or gemini mcp list
- Complete the browser login flow when prompted by the client
Optional shell helper mode:
PREQSTATION_API_URL: PREQSTATION API base URL (example: https://mypreqstation.vercel.app)
PREQSTATION_TOKEN: PREQSTATION Bearer token (generated in PREQSTATION /api-keys)
PREQSTATION_ENGINE (optional): fallback engine (claude-code | codex | gemini-cli) when client auto-detection is unavailable
Agent Identity & Engine Mapping
Each agent must identify itself and use the corresponding engine value in all task operations (list, create, plan, start, update status, complete, review, block):
| If you are... |
Use engine= |
| Claude (Anthropic) |
claude-code |
| GPT / Codex (OpenAI) |
codex |
| Gemini (Google) |
gemini-cli |
Always include your engine value when listing, creating, planning, starting, completing, reviewing, or blocking tasks.
Gemini CLI workers can run interactively with gemini or headless with gemini -p "<prompt>".
If your installed Gemini environment does not expose remote HTTP MCP, use the shell helper fallback instead of this MCP path.
MCP Plugin Mode (Recommended)
If MCP is available, prefer the remote /mcp endpoint exposed by the PREQSTATION service.
All mutation tools accept an optional engine parameter and always send an engine value using this order:
- explicit tool arg
- existing task engine (when available)
- MCP
initialize.clientInfo.name auto-detection
PREQSTATION_ENGINE
codex fallback
| Tool |
engine usage |
preq_list_projects |
Read-only, no engine needed (list PREQ projects for setup and local repo mapping) |
preq_list_project_activity |
Read-only, no engine needed; date-range activity feed for sync/cron consumers, not task execution lifecycle |
preq_list_tasks |
Read-only, no engine needed |
preq_get_task |
Read-only, no engine needed |
preq_get_project_settings |
Read-only, no engine needed (fetch project deploy settings by key) |
preq_list_task_comments |
Read-only; for comment objectives, fetch task comments as conversation history/reference around the target comment |
preq_get_task_comment |
Read-only; fetch the exact comment being handled before replying or changing comment state |
preq_update_qa_run |
Read-only from task lifecycle perspective; updates branch-level QA run status/report without task transitions |
preq_plan_task |
Assign engine, send lifecycle action plan, backend moves inbox task to todo and clears run_state |
preq_create_task |
Assign engine to new inbox task |
preq_start_task |
Record engine claiming the task; backend marks run_state=working |
preq_update_task_note |
Record engine while replacing the task note markdown without changing workflow status |
preq_update_task_status |
Record engine while updating workflow status-only endpoint (/api/tasks/:id/status) |
preq_update_task_comment_state |
Record engine while marking a task comment working, done, or failed without changing task workflow status |
preq_reply_task_comment |
Record engine while replying to a task comment; backend creates work logs for comment replies/failures automatically |
preq_list_dispatch_requests |
Read-only; inspect explicit dispatch requests used by launcher runtimes for ask parity and project-level insight |
preq_update_dispatch_request |
Launcher runtime only; mark an explicit dispatch request as dispatched or failed after launch succeeds or fails |
preq_complete_task |
Record engine in work log result, send lifecycle action complete; backend moves → ready and clears run_state |
preq_review_task |
Record engine running verification, send lifecycle action review; backend moves → done and clears run_state |
preq_block_task |
Record engine reporting the block, send lifecycle action block; backend moves → hold and clears run_state |
preq_delete_task |
Permanently delete a task by ticket number or UUID |
This gives deterministic task-id based execution and result upload.
Execution Flow (Mandatory)
You must follow this execution flow exactly.
Do not skip, reorder, combine, or substitute lifecycle actions.
PREQ launcher-driven runs are non-interactive by default.
You may use process skills such as brainstorming or writing-plans only as internal guidance while continuing the PREQ lifecycle in the same run.
Do not stop to ask the user for approval, clarifications, or design feedback mid-run unless PREQ tools are unavailable or the prompt/worktree/task state is invalid.
Project deploy settings are explicit operator authorization for this PREQ run. When deploy_strategy requires commit, push, or PR work, perform those git/GitHub actions without asking for separate approval.
Load -> Initialize -> Execute -> Finalize
Load:
Load the .preqstation-prompt.txt in this worktree/branch
Initialize:
- When Task ID is present, MUST call
preq_get_task once at the start to fetch task details, acceptance criteria, workflow status, run_state, and the initial engine.
- If
preq_get_task returns latest_preq_result, read it before substantive work and treat it as previous execution context, especially for resumed or previously blocked tasks.
- When Task ID is present and the task is active, MUST call
preq_start_task, except for comment objectives where task claiming is explicitly forbidden.
- When Task ID is absent for project-level objectives such as
insight, skip task lifecycle reads/writes and treat the prompt metadata plus project key as the source of truth.
- In
debug mode, create or refresh preqstation-progress.md after preq_get_task and update it after each major checkpoint.
- Resolve the task-facing content language once near the start of the run by inspecting the current task note and any temporary trailing
Ask: helper block first, then acceptance criteria, and only using the task title as a weak tie-breaker.
- Use the dominant language of that note-centric task content for PREQ-facing written updates such as plan markdown, rewritten task notes, completion summaries and notes, review notes, block reasons, QA reports, and newly created task content.
- Use project
agent_instructions only as a final tie-breaker when the task note, Ask: block, and acceptance criteria are still mixed or ambiguous. The current task content takes precedence.
- If no dominant language is clear, default PREQ-facing written updates to English.
- Do not create Markdown checkbox task-list syntax such as
- [ ] or - [x] in AI-generated task notes, plan markdown, acceptance criteria, QA reports, descriptions, or newly created task content unless the user explicitly requests checkboxes. Preserve user-authored checkboxes when rewriting existing content; otherwise use plain bullets or numbered lists.
- Execute the user objective
user objective is in the
.preqstation-prompt.txt
- If user objective start with
plan:
- Start to plan using the local code.
- Planning means plan generation only. You may inspect local code, but you must not implement product changes, run deploy steps, or run tests, build, lint, or other verification commands.
- Before blocking for missing code, inspect the primary checkout as well as the current worktree. If the worktree is in a bootstrap repo state, such as only
.gitignore being tracked, but the primary checkout contains the real app files, treat that as repo recovery rather than a missing project.
- During bootstrap repo recovery, ensure
origin exists and matches the PREQ repo URL. If origin is missing and the repo URL is known, add it with git remote add origin <repo_url>.
- Commit the baseline project files on
main, push origin/main, recreate or refresh the worktree, and continue planning after the code becomes inspectable.
- Block the run only when the primary checkout is the wrong repo, the repo URL is unavailable or mismatched, or the bootstrap recovery push to
origin/main fails.
- Call
preq_plan_task with plan markdown and plain verification criteria. Do not format those criteria as Markdown checkboxes unless preserving user-authored checkboxes or the user explicitly requested checkbox items.
- Process skills are allowed only as internal guidance. This run must stay non-interactive and end at
preq_plan_task.
- Else If user objective start with
ask:
- Rewrite or update the existing task note. Keep the workflow status unchanged.
- Treat the current task note plus any temporary trailing
Ask: helper block as the source material for the rewrite.
- If the ask clearly requests a prototype or reviewable artifact, local artifact generation is allowed.
- Artifact publishing is best-effort, but it is mandatory to attempt when a safe artifact provider is already available. Use the provider already authenticated in the current agent session; Fast.io is one supported provider, not the only valid target.
- If the current agent already has an authenticated Fast.io MCP session or another authenticated provider, treat that provider as already available and attempt publication without waiting for extra provider instructions.
- Durable artifact links must use a
private-or-skip policy. Authenticated workspace targets, member-restricted shares, and registered-account shares count as acceptable private access. Skip non-expiring anyone with the link URLs or other public-link-only modes.
- If the provider can create temporary external share or quickshare links, create 7-day expiring reviewer links for the published artifacts. Mark them with
access=quickshare or the provider's equivalent and include expires=...; do not create non-expiring public links.
- If the local artifact is an HTML prototype or HTML mockup, generate at least one screenshot PNG for review, then attempt to publish both the HTML source and screenshot artifact when an authenticated provider is available.
- Do not write artifact metadata into an
Artifacts: markdown block. Keep the task note focused on durable task context.
- Record published links or skipped/local artifacts in the
artifacts array passed to preq_update_task_note. Use objects with type, title, url, provider, access, expires, localPath, reason, and optional metadata as applicable.
- For prototype or reviewable artifact asks, include the artifact publishing result or skip reason in
artifacts. If publishing is skipped, include the local artifact path and a concise reason such as provider unavailable, unauthenticated, or no safe target.
- Treat localhost and
127.0.0.1 URLs as local-only diagnostics. Do not present them as the only review link; either publish a private artifact URL or explicitly mark the artifact as local-only with the skip reason.
- Persist the rewritten markdown with
preq_update_task_note(noteMarkdown=..., artifacts=[...]), passing any published artifact URLs or artifact publishing skip/local records through the structured artifacts field.
- Clear execution state by calling
preq_update_task_status with the current workflow status from preq_get_task.
- The final saved note must not include the temporary
Ask: helper block.
- Else If user objective start with
comment:
- Handle the referenced task comment only; preserve the task workflow status for the entire run.
- Treat comments as a conversational request channel, not as implementation source of truth. A comment affects future implementation only if this comment objective explicitly promotes it into the task note/spec with
preq_update_task_note.
- MUST call
preq_get_task, preq_get_task_comment, and preq_list_task_comments at the start to fetch task details, the current note, workflow status, existing run state, the exact comment being handled, and the surrounding task-scoped comment conversation.
- Treat the referenced
comment_id as the primary request for this run. Other user, agent, and system comments are conversation history/reference only, including prior AI replies; use them to understand flow and avoid contradictory or context-blind responses.
- Do not treat non-target comments as independent actionable requirements. They affect future implementation only after the current target comment explicitly or unambiguously asks you to promote the conversational decision into the task note/spec with
preq_update_task_note.
- MUST NOT call
preq_start_task; comments use comment state rather than task run_state claiming.
- Mark the original comment
working with preq_update_task_comment_state before substantive work.
- Inspect the current task note, target comment, and comment history before deciding how to respond.
- Optionally call
preq_update_task_note only when the comment explicitly requests a note, plan, or specification change. This is the only “promote comment to notes” path: convert the requested change into canonical note/spec language, then mention that the note was updated in the reply. Do not rewrite the note for a normal answer, acknowledgement, or implementation-review comment.
- Reply with
preq_reply_task_comment and set noteUpdated accurately to indicate whether preq_update_task_note was used.
- Mark the original comment
done with preq_update_task_comment_state after the reply succeeds.
- Never call
preq_complete_task, preq_review_task, preq_plan_task, or preq_block_task for a comment objective.
- Do not create a separate work log for comment handling. The backend creates work logs automatically for comment replies and failure updates.
- On failure, preserve task workflow status, reply with the failure details using
preq_reply_task_comment if possible, then mark the original comment failed with preq_update_task_comment_state. If replying is impossible, still mark the comment failed with the most concrete failure reason available.
- Else If user objective start with
insight:
- Task ID may be absent for this branch. Do not invent one and do not call task lifecycle mutations when no task exists.
- Inspect the local project from the current worktree and use the provided Insight Prompt only as task-generation guidance.
- Call
preq_list_tasks with the current projectKey and detail=full before creating anything so you can avoid duplicates in inbox, todo, hold, and ready.
- Create multiple Inbox tasks with
preq_create_task.
- Title each created task with a short shared topical prefix derived from the user intent or current work area.
- Keep
description detailed, but keep acceptanceCriteria to plain verification criteria without Markdown checkbox syntax.
- Do not mutate existing tasks and do not produce a long-form implementation plan instead of task creation.
- Else If user objective start with
qa:
- Task ID may be absent for this branch. Do not invent one and do not call task lifecycle mutations when no task exists.
- Resolve
qa_run_id from .preqstation-prompt.txt and use preq_update_qa_run to mark the run running as soon as the local target URL is known.
- Resolve
qa_task_keys from .preqstation-prompt.txt when present. If listed, call preq_get_task for each task key before browser testing and treat those tasks' titles, descriptions, and acceptance criteria as the QA scope.
- If the current agent has access to the
dogfood skill, use it as the default QA workflow for browser testing and report generation.
- Start the current project from the current worktree/branch, determine the local target URL, and run browser QA against that URL.
- Limit QA to the scoped Ready tasks and the minimal navigation or sanity checks needed to reach and verify them. Do not expand into unrelated full-app exploratory QA. Report unrelated findings only when they block scoped verification or prevent the app from starting.
- QA reports may include optional artifact references for screenshots, videos, and documents. Use the same
private-or-skip policy when a safe provider is available.
- If QA artifact publishing is skipped after generating local artifacts, record the artifact publishing result or skip reason in the structured
artifacts array, not the markdown report body.
- When QA finishes, call
preq_update_qa_run again with final status (passed or failed), target_url, markdown report, summary counts, and artifacts=[...] when artifacts were generated.
- Do not call
preq_complete_task, preq_review_task, or preq_block_task unless this run is also handling a real PREQ task.
- Else If user objective start with
implement or resume:
- Implement code changes and run task-level tests.
- Use task notes, acceptance criteria, and explicit PREQ result context as the implementation source of truth. Do not fetch or interpret task comments as hidden requirements or conversation context; comments affect implementation only after a prior comment objective updated the canonical task note/spec.
- If
latest_preq_result is present, use it to understand the latest blocked reason, prior summary, and most recent PREQ execution context before making changes.
- Resolve deploy strategy via the Deployment Strategy Contract.
- Perform the required git/deploy steps for
direct_commit, feature_branch, or none. Follow the Deployment Strategy Contract section.
- Do not stop for user approval or separate conversational design/spec loops mid-run.
- Else If user objective start with
review:
- Run verification (
tests, build, lint).
- Review against task notes and acceptance criteria, not raw task comments. Do not fetch or interpret task comments as conversational context during review; comments matter to review only after a prior comment objective promoted them into the note/spec.
- Call
preq_review_task with review notes.
- Do not request additional user approval or switch into a separate conversational workflow mid-run.
On any failure in an active task branch, call preq_block_task with the blocking reason and stop. This does not apply to comment objectives; use the comment failure lifecycle instead.
On any failure in a QA branch, update the QA run to failed with a concise markdown report and stop.
- Finalize:
On success for implementation/review branches, call
preq_complete_task with summary, branch, and pr_url when applicable.
On success for ask branches, do not call preq_complete_task; the successful note rewrite ends after preq_update_task_note plus preq_update_task_status using the unchanged workflow status.
On success for comment branches, do not call task completion, review, plan, or block tools; the successful comment response ends after preq_reply_task_comment plus marking the original comment done.
On success for insight branches, stop after the Inbox tasks are created; do not call preq_complete_task or mutate existing task workflow state.
Deployment Strategy Contract (required)
Before any git action, resolve deployment strategy through MCP:
- Call
preq_get_task <task_id>.
- Read
task.deploy_strategy from the response.
- If missing, call
preq_get_project_settings <project_key> and resolve from:
settings.deploy_strategy
settings.deploy_default_branch
settings.deploy_auto_pr
settings.deploy_commit_on_review
settings.deploy_squash_merge
Expected values from PREQSTATION backend:
strategy: direct_commit | feature_branch | none
default_branch: string (usually main)
auto_pr: boolean (feature_branch only)
commit_on_review: boolean
squash_merge: boolean (direct_commit only)
Default when absent/invalid:
strategy=none
default_branch=main
auto_pr=false
commit_on_review=true
squash_merge=true
Behavior by strategy:
none: do not run git commit/push/PR. Only code changes + task update result.
direct_commit and feature_branch are authorized git-operation modes. Do not block solely because general coding-agent defaults discourage autonomous commits, pushes, or PRs; the PREQ project deploy strategy is the approval source for this run.
Git-facing artifacts must default to English even when PREQ-facing task updates use another language. This includes commit messages, PR titles, PR bodies, branch names, and other repository-facing metadata.
direct_commit: merge worktree commits into default_branch and push. No PR.
After completing work in the worktree:
# In primary checkout: update and merge
git -C <project_cwd> checkout <default_branch>
git -C <project_cwd> pull origin <default_branch>
# squash_merge=true (default): single commit
git -C <project_cwd> merge --squash <worktree_branch>
git -C <project_cwd> commit -m "<task_id>: <summary>"
# squash_merge=false: regular merge
git -C <project_cwd> merge <worktree_branch>
# Push to remote
git -C <project_cwd> push origin <default_branch>
feature_branch: push worktree branch to remote. Create PR only when auto_pr=true (requires GitHub access on the agent such as gh auth or GitHub MCP).
git -C <project_cwd> push origin <worktree_branch>
# if auto_pr=true: create PR via GitHub MCP or gh CLI and capture the PR URL
PR creation rule for feature_branch + auto_pr:
- Default to a non-draft PR.
- Do not create a draft PR unless the user explicitly asked for a draft PR, or the task is intentionally being handed off in an incomplete/blocked state.
- If the available GitHub tool or CLI flow creates a draft PR by default, immediately convert it to "ready for review" before calling
preq_complete_task.
- Always capture the final non-draft PR URL that will actually be reviewed.
Rule for commit_on_review:
- if
true and strategy is direct_commit or feature_branch, do not move task to ready until remote push is verified.
- if
false, ready transition is allowed without mandatory remote push.
Required completion rule for feature_branch + auto_pr + commit_on_review:
- Treat both the pushed branch name and the PR URL as required before
preq_complete_task.
- Preferred order:
- push
worktree_branch
- create a non-draft PR
- if a draft PR was created implicitly, convert it to ready for review
- capture the PR URL
- call
preq_complete_task with both branchName and prUrl
- If GitHub access is unavailable, branch push fails, PR creation fails, or the PR URL cannot be captured, call
preq_block_task with the exact missing prerequisite and the next operator action.
- Good block reasons are concrete, for example:
Auto PR required before ready, but gh is not authenticated on the coding agent. Run gh auth login or configure GitHub MCP, then resume.
Auto PR required before ready, but gh pr create failed after pushing task/proj-123/example. Fix the GitHub error and resume.
Auto PR required before ready, but the PR is still a draft. Mark it ready for review, capture the final PR URL, then resume.
Shell Helper Mode (Optional)
If MCP is unavailable, source scripts/preqstation-api.sh and use the shell helpers documented in docs/shell-helper-mode.md.
Keep SKILL.md focused on lifecycle rules; use the helper reference doc for function signatures and jq/curl notes.
Debug Progress Mode (Optional)
Use this only when the caller explicitly asks for debug mode or requests progress visibility.
- File path:
<worktree>/preqstation-progress.md
- Purpose: local human-readable progress artifact for the current run
- Scope: current run only; refresh it at run start instead of appending infinite history
- Safety: do not use it as lifecycle source of truth, and do not commit or push it unless the user explicitly asks
Write down the current execution flow steps
For example:
# PREQ Progress
- Task: PROJ-123
- Objective: implement
- Status: todo
- Run State: working
- Current Step: running task-level tests
- Last Updated: 2026-03-13T14:30:00Z
## Timeline
- 2026-03-13T14:10:00Z fetched task details using `preq_get_task`
- 2026-03-13T14:11:00Z called preq_start_task using `preq_start_task`
- 2026-03-13T14:18:00Z finished local code inspection
- 2026-03-13T14:30:00Z running task-level tests
...
1---2name: preqstation3description: Fetch tasks from PREQSTATION, execute work, and push updates/results back to PREQSTATION APIs. Use when asked to run a PREQ task, fetch todo tasks, or update execution status. Prefer the remote MCP endpoint at /mcp with OAuth login. Shell helper mode still uses PREQSTATION_API_URL and PREQSTATION_TOKEN. Tasks carry an `engine` field (`claude-code` | `codex` | `gemini-cli`) indicating which AI agent should execute them.4---56This is the agent-side lifecycle skill. Dispatcher-host setup and launch orchestration live in the separate PREQ CLI/OpenClaw runtime package.78## Environment910Recommended MCP mode:1112- Register the remote MCP endpoint from the PREQSTATION `projects-manager` service:13 - Claude Code: `claude mcp add -s user --transport http preqstation https://<your-domain>/mcp`14 - Codex: `codex mcp add preqstation --url https://<your-domain>/mcp`15 - Gemini CLI: `gemini mcp add --scope user --transport http preqstation https://<your-domain>/mcp`16- OAuth starts when the client first makes a real request to `/mcp`17- Codex often triggers login during `add` because it probes the server immediately18- Gemini CLI may also prompt for auth during MCP registration or first real tool call. If `gemini mcp list` still shows `preqstation` as `Disconnected`, open an interactive Gemini session and run `/mcp auth preqstation`.19- Claude Code usually stores the config first and may show `Needs authentication` until first use or `claude mcp get preqstation`20- Prefer one user-scoped Claude Code PREQ registration so you do not accumulate duplicate project-local entries21- Verify MCP registration with `claude mcp list`, `codex mcp list`, or `gemini mcp list`22- Complete the browser login flow when prompted by the client2324Optional shell helper mode:2526- `PREQSTATION_API_URL`: PREQSTATION API base URL (example: `https://mypreqstation.vercel.app`)27- `PREQSTATION_TOKEN`: PREQSTATION Bearer token (generated in PREQSTATION `/api-keys`)28- `PREQSTATION_ENGINE` (optional): fallback engine (`claude-code` | `codex` | `gemini-cli`) when client auto-detection is unavailable2930## Agent Identity & Engine Mapping3132Each agent must identify itself and use the corresponding `engine` value in **all** task operations (list, create, plan, start, update status, complete, review, block):3334| If you are... | Use `engine=` |35| -------------------- | ------------- |36| Claude (Anthropic) | `claude-code` |37| GPT / Codex (OpenAI) | `codex` |38| Gemini (Google) | `gemini-cli` |3940Always include your `engine` value when listing, creating, planning, starting, completing, reviewing, or blocking tasks.4142Gemini CLI workers can run interactively with `gemini` or headless with `gemini -p "<prompt>"`.43If your installed Gemini environment does not expose remote HTTP MCP, use the shell helper fallback instead of this MCP path.4445## MCP Plugin Mode (Recommended)4647If MCP is available, prefer the remote `/mcp` endpoint exposed by the PREQSTATION service.48All mutation tools accept an optional `engine` parameter and always send an engine value using this order:49501. explicit tool arg512. existing task engine (when available)523. MCP `initialize.clientInfo.name` auto-detection534. `PREQSTATION_ENGINE`545. `codex` fallback5556| Tool | engine usage |57| --------------------------- | -------------------------------------------------------------------------------------------------------------------- |58| `preq_list_projects` | Read-only, no engine needed (list PREQ projects for setup and local repo mapping) |59| `preq_list_project_activity` | Read-only, no engine needed; date-range activity feed for sync/cron consumers, not task execution lifecycle |60| `preq_list_tasks` | Read-only, no engine needed |61| `preq_get_task` | Read-only, no engine needed |62| `preq_get_project_settings` | Read-only, no engine needed (fetch project deploy settings by key) |63| `preq_list_task_comments` | Read-only; for `comment` objectives, fetch task comments as conversation history/reference around the target comment |64| `preq_get_task_comment` | Read-only; fetch the exact comment being handled before replying or changing comment state |65| `preq_update_qa_run` | Read-only from task lifecycle perspective; updates branch-level QA run status/report without task transitions |66| `preq_plan_task` | Assign `engine`, send lifecycle action `plan`, backend moves inbox task to `todo` and clears `run_state` |67| `preq_create_task` | Assign `engine` to new inbox task |68| `preq_start_task` | Record `engine` claiming the task; backend marks `run_state=working` |69| `preq_update_task_note` | Record `engine` while replacing the task note markdown without changing workflow status |70| `preq_update_task_status` | Record `engine` while updating workflow status-only endpoint (`/api/tasks/:id/status`) |71| `preq_update_task_comment_state` | Record `engine` while marking a task comment `working`, `done`, or `failed` without changing task workflow status |72| `preq_reply_task_comment` | Record `engine` while replying to a task comment; backend creates work logs for comment replies/failures automatically |73| `preq_list_dispatch_requests` | Read-only; inspect explicit dispatch requests used by launcher runtimes for ask parity and project-level insight |74| `preq_update_dispatch_request` | Launcher runtime only; mark an explicit dispatch request as `dispatched` or `failed` after launch succeeds or fails |75| `preq_complete_task` | Record `engine` in work log result, send lifecycle action `complete`; backend moves → `ready` and clears `run_state` |76| `preq_review_task` | Record `engine` running verification, send lifecycle action `review`; backend moves → `done` and clears `run_state` |77| `preq_block_task` | Record `engine` reporting the block, send lifecycle action `block`; backend moves → `hold` and clears `run_state` |78| `preq_delete_task` | Permanently delete a task by ticket number or UUID |7980This gives deterministic task-id based execution and result upload.8182## Execution Flow (Mandatory)8384You must follow this execution flow exactly.85Do not skip, reorder, combine, or substitute lifecycle actions.86PREQ launcher-driven runs are non-interactive by default.87You may use process skills such as `brainstorming` or `writing-plans` only as internal guidance while continuing the PREQ lifecycle in the same run.88Do not stop to ask the user for approval, clarifications, or design feedback mid-run unless PREQ tools are unavailable or the prompt/worktree/task state is invalid.89Project deploy settings are explicit operator authorization for this PREQ run. When `deploy_strategy` requires commit, push, or PR work, perform those git/GitHub actions without asking for separate approval.9091Load -> Initialize -> Execute -> Finalize92931. Load:94 Load the `.preqstation-prompt.txt` in this worktree/branch95962. Initialize:9798- When Task ID is present, MUST call `preq_get_task` once at the start to fetch task details, acceptance criteria, workflow status, `run_state`, and the initial engine.99- If `preq_get_task` returns `latest_preq_result`, read it before substantive work and treat it as previous execution context, especially for resumed or previously blocked tasks.100- When Task ID is present and the task is active, MUST call `preq_start_task`, except for `comment` objectives where task claiming is explicitly forbidden.101- When Task ID is absent for project-level objectives such as `insight`, skip task lifecycle reads/writes and treat the prompt metadata plus project key as the source of truth.102- In `debug` mode, create or refresh `preqstation-progress.md` after `preq_get_task` and update it after each major checkpoint.103- Resolve the task-facing content language once near the start of the run by inspecting the current task note and any temporary trailing `Ask:` helper block first, then acceptance criteria, and only using the task title as a weak tie-breaker.104- Use the dominant language of that note-centric task content for PREQ-facing written updates such as plan markdown, rewritten task notes, completion summaries and notes, review notes, block reasons, QA reports, and newly created task content.105- Use project `agent_instructions` only as a final tie-breaker when the task note, `Ask:` block, and acceptance criteria are still mixed or ambiguous. The current task content takes precedence.106- If no dominant language is clear, default PREQ-facing written updates to English.107- Do not create Markdown checkbox task-list syntax such as `- [ ]` or `- [x]` in AI-generated task notes, plan markdown, acceptance criteria, QA reports, descriptions, or newly created task content unless the user explicitly requests checkboxes. Preserve user-authored checkboxes when rewriting existing content; otherwise use plain bullets or numbered lists.1081093. Execute the user objective110 user objective is in the `.preqstation-prompt.txt`111112- If user objective start with `plan`:113 - Start to plan using the local code.114 - Planning means plan generation only. You may inspect local code, but you must not implement product changes, run deploy steps, or run tests, build, lint, or other verification commands.115 - Before blocking for missing code, inspect the primary checkout as well as the current worktree. If the worktree is in a bootstrap repo state, such as only `.gitignore` being tracked, but the primary checkout contains the real app files, treat that as repo recovery rather than a missing project.116 - During bootstrap repo recovery, ensure `origin` exists and matches the PREQ repo URL. If `origin` is missing and the repo URL is known, add it with `git remote add origin <repo_url>`.117 - Commit the baseline project files on `main`, push `origin/main`, recreate or refresh the worktree, and continue planning after the code becomes inspectable.118 - Block the run only when the primary checkout is the wrong repo, the repo URL is unavailable or mismatched, or the bootstrap recovery push to `origin/main` fails.119 - Call `preq_plan_task` with plan markdown and plain verification criteria. Do not format those criteria as Markdown checkboxes unless preserving user-authored checkboxes or the user explicitly requested checkbox items.120 - Process skills are allowed only as internal guidance. This run must stay non-interactive and end at `preq_plan_task`.121- Else If user objective start with `ask`:122 - Rewrite or update the existing task note. Keep the workflow status unchanged.123 - Treat the current task note plus any temporary trailing `Ask:` helper block as the source material for the rewrite.124 - If the ask clearly requests a prototype or reviewable artifact, local artifact generation is allowed.125 - Artifact publishing is best-effort, but it is mandatory to attempt when a safe artifact provider is already available. Use the provider already authenticated in the current agent session; Fast.io is one supported provider, not the only valid target.126 - If the current agent already has an authenticated Fast.io MCP session or another authenticated provider, treat that provider as already available and attempt publication without waiting for extra provider instructions.127 - Durable artifact links must use a `private-or-skip` policy. Authenticated workspace targets, member-restricted shares, and registered-account shares count as acceptable private access. Skip non-expiring `anyone with the link` URLs or other public-link-only modes.128 - If the provider can create temporary external share or quickshare links, create 7-day expiring reviewer links for the published artifacts. Mark them with `access=quickshare` or the provider's equivalent and include `expires=...`; do not create non-expiring public links.129 - If the local artifact is an HTML prototype or HTML mockup, generate at least one screenshot PNG for review, then attempt to publish both the HTML source and screenshot artifact when an authenticated provider is available.130 - Do not write artifact metadata into an `Artifacts:` markdown block. Keep the task note focused on durable task context.131 - Record published links or skipped/local artifacts in the `artifacts` array passed to `preq_update_task_note`. Use objects with `type`, `title`, `url`, `provider`, `access`, `expires`, `localPath`, `reason`, and optional `metadata` as applicable.132 - For prototype or reviewable artifact asks, include the artifact publishing result or skip reason in `artifacts`. If publishing is skipped, include the local artifact path and a concise `reason` such as provider unavailable, unauthenticated, or no safe target.133 - Treat localhost and `127.0.0.1` URLs as local-only diagnostics. Do not present them as the only review link; either publish a private artifact URL or explicitly mark the artifact as local-only with the skip reason.134 - Persist the rewritten markdown with `preq_update_task_note(noteMarkdown=..., artifacts=[...])`, passing any published artifact URLs or artifact publishing skip/local records through the structured `artifacts` field.135 - Clear execution state by calling `preq_update_task_status` with the current workflow status from `preq_get_task`.136 - The final saved note must not include the temporary `Ask:` helper block.137- Else If user objective start with `comment`:138 - Handle the referenced task comment only; preserve the task workflow status for the entire run.139 - Treat comments as a conversational request channel, not as implementation source of truth. A comment affects future implementation only if this comment objective explicitly promotes it into the task note/spec with `preq_update_task_note`.140 - MUST call `preq_get_task`, `preq_get_task_comment`, and `preq_list_task_comments` at the start to fetch task details, the current note, workflow status, existing run state, the exact comment being handled, and the surrounding task-scoped comment conversation.141 - Treat the referenced `comment_id` as the primary request for this run. Other user, agent, and system comments are conversation history/reference only, including prior AI replies; use them to understand flow and avoid contradictory or context-blind responses.142 - Do not treat non-target comments as independent actionable requirements. They affect future implementation only after the current target comment explicitly or unambiguously asks you to promote the conversational decision into the task note/spec with `preq_update_task_note`.143 - MUST NOT call `preq_start_task`; comments use comment state rather than task `run_state` claiming.144 - Mark the original comment `working` with `preq_update_task_comment_state` before substantive work.145 - Inspect the current task note, target comment, and comment history before deciding how to respond.146 - Optionally call `preq_update_task_note` only when the comment explicitly requests a note, plan, or specification change. This is the only “promote comment to notes” path: convert the requested change into canonical note/spec language, then mention that the note was updated in the reply. Do not rewrite the note for a normal answer, acknowledgement, or implementation-review comment.147 - Reply with `preq_reply_task_comment` and set `noteUpdated` accurately to indicate whether `preq_update_task_note` was used.148 - Mark the original comment `done` with `preq_update_task_comment_state` after the reply succeeds.149 - Never call `preq_complete_task`, `preq_review_task`, `preq_plan_task`, or `preq_block_task` for a comment objective.150 - Do not create a separate work log for comment handling. The backend creates work logs automatically for comment replies and failure updates.151 - On failure, preserve task workflow status, reply with the failure details using `preq_reply_task_comment` if possible, then mark the original comment `failed` with `preq_update_task_comment_state`. If replying is impossible, still mark the comment `failed` with the most concrete failure reason available.152- Else If user objective start with `insight`:153 - Task ID may be absent for this branch. Do not invent one and do not call task lifecycle mutations when no task exists.154 - Inspect the local project from the current worktree and use the provided Insight Prompt only as task-generation guidance.155 - Call `preq_list_tasks` with the current `projectKey` and `detail=full` before creating anything so you can avoid duplicates in `inbox`, `todo`, `hold`, and `ready`.156 - Create multiple Inbox tasks with `preq_create_task`.157 - Title each created task with a short shared topical prefix derived from the user intent or current work area.158 - Keep `description` detailed, but keep `acceptanceCriteria` to plain verification criteria without Markdown checkbox syntax.159 - Do not mutate existing tasks and do not produce a long-form implementation plan instead of task creation.160- Else If user objective start with `qa`:161 - Task ID may be absent for this branch. Do not invent one and do not call task lifecycle mutations when no task exists.162 - Resolve `qa_run_id` from `.preqstation-prompt.txt` and use `preq_update_qa_run` to mark the run `running` as soon as the local target URL is known.163 - Resolve `qa_task_keys` from `.preqstation-prompt.txt` when present. If listed, call `preq_get_task` for each task key before browser testing and treat those tasks' titles, descriptions, and acceptance criteria as the QA scope.164 - If the current agent has access to the `dogfood` skill, use it as the default QA workflow for browser testing and report generation.165 - Start the current project from the current worktree/branch, determine the local target URL, and run browser QA against that URL.166 - Limit QA to the scoped Ready tasks and the minimal navigation or sanity checks needed to reach and verify them. Do not expand into unrelated full-app exploratory QA. Report unrelated findings only when they block scoped verification or prevent the app from starting.167 - QA reports may include optional artifact references for screenshots, videos, and documents. Use the same `private-or-skip` policy when a safe provider is available.168 - If QA artifact publishing is skipped after generating local artifacts, record the artifact publishing result or skip reason in the structured `artifacts` array, not the markdown report body.169 - When QA finishes, call `preq_update_qa_run` again with final status (`passed` or `failed`), `target_url`, markdown report, summary counts, and `artifacts=[...]` when artifacts were generated.170 - Do not call `preq_complete_task`, `preq_review_task`, or `preq_block_task` unless this run is also handling a real PREQ task.171- Else If user objective start with `implement` or `resume`:172 - Implement code changes and run task-level tests.173 - Use task notes, acceptance criteria, and explicit PREQ result context as the implementation source of truth. Do not fetch or interpret task comments as hidden requirements or conversation context; comments affect implementation only after a prior comment objective updated the canonical task note/spec.174 - If `latest_preq_result` is present, use it to understand the latest blocked reason, prior summary, and most recent PREQ execution context before making changes.175 - Resolve deploy strategy via the Deployment Strategy Contract.176 - Perform the required git/deploy steps for `direct_commit`, `feature_branch`, or `none`. Follow the `Deployment Strategy Contract` section.177 - Do not stop for user approval or separate conversational design/spec loops mid-run.178- Else If user objective start with `review`:179 - Run verification (`tests`, `build`, `lint`).180 - Review against task notes and acceptance criteria, not raw task comments. Do not fetch or interpret task comments as conversational context during review; comments matter to review only after a prior comment objective promoted them into the note/spec.181 - Call `preq_review_task` with review notes.182 - Do not request additional user approval or switch into a separate conversational workflow mid-run.183184On any failure in an active task branch, call `preq_block_task` with the blocking reason and stop. This does not apply to `comment` objectives; use the comment failure lifecycle instead.185On any failure in a QA branch, update the QA run to `failed` with a concise markdown report and stop.1861874. Finalize:188 On success for implementation/review branches, call `preq_complete_task` with summary, branch, and `pr_url` when applicable.189 On success for ask branches, do not call `preq_complete_task`; the successful note rewrite ends after `preq_update_task_note` plus `preq_update_task_status` using the unchanged workflow status.190 On success for comment branches, do not call task completion, review, plan, or block tools; the successful comment response ends after `preq_reply_task_comment` plus marking the original comment `done`.191 On success for insight branches, stop after the Inbox tasks are created; do not call `preq_complete_task` or mutate existing task workflow state.192193## Deployment Strategy Contract (required)194195Before any git action, resolve deployment strategy through MCP:1961971. Call `preq_get_task <task_id>`.1982. Read `task.deploy_strategy` from the response.1993. If missing, call `preq_get_project_settings <project_key>` and resolve from:200 - `settings.deploy_strategy`201 - `settings.deploy_default_branch`202 - `settings.deploy_auto_pr`203 - `settings.deploy_commit_on_review`204 - `settings.deploy_squash_merge`205206Expected values from PREQSTATION backend:207208- `strategy`: `direct_commit` | `feature_branch` | `none`209- `default_branch`: string (usually `main`)210- `auto_pr`: boolean (feature_branch only)211- `commit_on_review`: boolean212- `squash_merge`: boolean (direct_commit only)213214Default when absent/invalid:215216- `strategy=none`217- `default_branch=main`218- `auto_pr=false`219- `commit_on_review=true`220- `squash_merge=true`221222Behavior by `strategy`:223224- `none`: do not run git commit/push/PR. Only code changes + task update result.225226- `direct_commit` and `feature_branch` are authorized git-operation modes. Do not block solely because general coding-agent defaults discourage autonomous commits, pushes, or PRs; the PREQ project deploy strategy is the approval source for this run.227228- Git-facing artifacts must default to English even when PREQ-facing task updates use another language. This includes commit messages, PR titles, PR bodies, branch names, and other repository-facing metadata.229230- `direct_commit`: merge worktree commits into `default_branch` and push. No PR.231 After completing work in the worktree:232233 ```bash234 # In primary checkout: update and merge235 git -C <project_cwd> checkout <default_branch>236 git -C <project_cwd> pull origin <default_branch>237238 # squash_merge=true (default): single commit239 git -C <project_cwd> merge --squash <worktree_branch>240 git -C <project_cwd> commit -m "<task_id>: <summary>"241242 # squash_merge=false: regular merge243 git -C <project_cwd> merge <worktree_branch>244245 # Push to remote246 git -C <project_cwd> push origin <default_branch>247 ```248249- `feature_branch`: push worktree branch to remote. Create PR only when `auto_pr=true` (requires GitHub access on the agent such as `gh auth` or GitHub MCP).250 ```bash251 git -C <project_cwd> push origin <worktree_branch>252 # if auto_pr=true: create PR via GitHub MCP or gh CLI and capture the PR URL253 ```254255PR creation rule for `feature_branch + auto_pr`:256257- Default to a non-draft PR.258- Do not create a draft PR unless the user explicitly asked for a draft PR, or the task is intentionally being handed off in an incomplete/blocked state.259- If the available GitHub tool or CLI flow creates a draft PR by default, immediately convert it to "ready for review" before calling `preq_complete_task`.260- Always capture the final non-draft PR URL that will actually be reviewed.261262Rule for `commit_on_review`:263264- if `true` and strategy is `direct_commit` or `feature_branch`, do not move task to `ready` until remote push is verified.265- if `false`, ready transition is allowed without mandatory remote push.266267Required completion rule for `feature_branch + auto_pr + commit_on_review`:268269- Treat both the pushed branch name and the PR URL as required before `preq_complete_task`.270- Preferred order:271 1. push `worktree_branch`272 2. create a non-draft PR273 3. if a draft PR was created implicitly, convert it to ready for review274 4. capture the PR URL275 5. call `preq_complete_task` with both `branchName` and `prUrl`276- If GitHub access is unavailable, branch push fails, PR creation fails, or the PR URL cannot be captured, call `preq_block_task` with the exact missing prerequisite and the next operator action.277- Good block reasons are concrete, for example:278 - `Auto PR required before ready, but gh is not authenticated on the coding agent. Run gh auth login or configure GitHub MCP, then resume.`279 - `Auto PR required before ready, but gh pr create failed after pushing task/proj-123/example. Fix the GitHub error and resume.`280 - `Auto PR required before ready, but the PR is still a draft. Mark it ready for review, capture the final PR URL, then resume.`281282## Shell Helper Mode (Optional)283284If MCP is unavailable, source `scripts/preqstation-api.sh` and use the shell helpers documented in `docs/shell-helper-mode.md`.285Keep SKILL.md focused on lifecycle rules; use the helper reference doc for function signatures and `jq`/curl notes.286287## Debug Progress Mode (Optional)288289Use this only when the caller explicitly asks for `debug` mode or requests progress visibility.290291- File path: `<worktree>/preqstation-progress.md`292- Purpose: local human-readable progress artifact for the current run293- Scope: current run only; refresh it at run start instead of appending infinite history294- Safety: do not use it as lifecycle source of truth, and do not commit or push it unless the user explicitly asks295296Write down the current execution flow steps297298For example:299300```md301# PREQ Progress302303- Task: PROJ-123304- Objective: implement305- Status: todo306- Run State: working307- Current Step: running task-level tests308- Last Updated: 2026-03-13T14:30:00Z309310## Timeline311312- 2026-03-13T14:10:00Z fetched task details using `preq_get_task`313- 2026-03-13T14:11:00Z called preq_start_task using `preq_start_task`314- 2026-03-13T14:18:00Z finished local code inspection315- 2026-03-13T14:30:00Z running task-level tests316 ...317```