kata-execute-quick-task
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese<objective>
Execute small, ad-hoc tasks with Kata guarantees (atomic commits, STATE.md tracking) while skipping optional agents (research, plan-checker, verifier).
Quick mode is the same system with a shorter path:
- Spawns kata-planner (quick mode) + kata-executor(s)
- Skips kata-phase-researcher, kata-plan-checker, kata-verifier
- Quick tasks live in separate from planned phases
.planning/quick/ - Updates STATE.md "Quick Tasks Completed" table (NOT ROADMAP.md)
Use when: You know exactly what to do and the task is small enough to not need research or verification.
</objective>
<execution_context>
Orchestration is inline - no separate workflow file. Quick mode is deliberately simpler than full Kata.
</execution_context>
<context>
@.planning/STATE.md
</context>
<process>
**Step 0: Resolve Model Profile**
Read model profile for agent spawning:
bash
MODEL_PROFILE=$(cat .planning/config.json 2>/dev/null | grep -o '"model_profile"[[:space:]]*:[[:space:]]*"[^"]*"' | grep -o '"[^"]*"$' | tr -d '"' || echo "balanced")Default to "balanced" if not set.
Model lookup table:
| Agent | quality | balanced | budget |
|---|---|---|---|
| kata-planner | opus | opus | sonnet |
| kata-executor | opus | sonnet | sonnet |
Store resolved models for use in Task calls below.
Step 1: Pre-flight validation
Check that an active Kata project exists:
bash
if [ ! -f .planning/ROADMAP.md ]; then
echo "Quick mode requires an active project with ROADMAP.md."
echo "Run /kata-new-project first."
exit 1
fiIf validation fails, stop immediately with the error message.
Quick tasks can run mid-phase - validation only checks ROADMAP.md exists, not phase status.
Step 1.5: Parse issue argument (optional)
Check for issue file path argument:
bash
ISSUE_FILE=""
ISSUE_NUMBER=""
ISSUE_TITLE=""
ISSUE_PROBLEM=""<objective>
在Kata的保障下执行小型临时任务(原子提交、STATE.md追踪),同时跳过可选Agent(research、plan-checker、verifier)。
快速模式是路径更短的同一系统:
- 启动kata-planner(快速模式)+ kata-executor(s)
- 跳过kata-phase-researcher、kata-plan-checker、kata-verifier
- 快速任务存储在目录中,与规划阶段的任务分开
.planning/quick/ - 更新STATE.md中的“Quick Tasks Completed”表格(不更新ROADMAP.md)
适用场景:你清楚知道要做什么,且任务足够小,无需研究或验证。
</objective>
<execution_context>
编排是内联式的 - 无需单独的工作流文件。快速模式故意设计得比完整Kata更简单。
</execution_context>
<context>
@.planning/STATE.md
</context>
<process>
**步骤0:解析模型配置文件**
读取用于启动Agent的模型配置文件:
bash
MODEL_PROFILE=$(cat .planning/config.json 2>/dev/null | grep -o '"model_profile"[[:space:]]*:[[:space:]]*"[^"]*"' | grep -o '"[^"]*"$' | tr -d '"' || echo "balanced")如果未设置,默认使用“balanced”。
模型查找表:
| Agent | quality | balanced | budget |
|---|---|---|---|
| kata-planner | opus | opus | sonnet |
| kata-executor | opus | sonnet | sonnet |
存储解析后的模型,供后续Task调用使用。
步骤1:预验证
检查是否存在活跃的Kata项目:
bash
if [ ! -f .planning/ROADMAP.md ]; then
echo "Quick mode requires an active project with ROADMAP.md."
echo "Run /kata-new-project first."
exit 1
fi如果验证失败,立即停止并显示错误信息。
快速任务可在阶段执行中途运行 - 验证仅检查ROADMAP.md是否存在,不检查阶段状态。
步骤1.5:解析议题参数(可选)
检查是否提供议题文件路径参数:
bash
ISSUE_FILE=""
ISSUE_NUMBER=""
ISSUE_TITLE=""
ISSUE_PROBLEM=""Check for --issue flag
Check for --issue flag
if echo "$ARGUMENTS" | grep -q -- "--issue"; then
ISSUE_FILE=$(echo "$ARGUMENTS" | grep -oE '--issue [^ ]+' | cut -d' ' -f2)
if [ -f "$ISSUE_FILE" ]; then
# Extract issue metadata
ISSUE_TITLE=$(grep "^title:" "$ISSUE_FILE" | cut -d':' -f2- | xargs)
PROVENANCE=$(grep "^provenance:" "$ISSUE_FILE" | cut -d' ' -f2)
if echo "$PROVENANCE" | grep -q "^github:"; then
ISSUE_NUMBER=$(echo "$PROVENANCE" | grep -oE '#[0-9]+' | tr -d '#')
fi
# Extract problem section for context
ISSUE_PROBLEM=$(sed -n '/^## Problem/,/^## /p' "$ISSUE_FILE" | tail -n +2 | head -n -1)fi
fi
If `ISSUE_FILE` provided but file not found: error and exit.
If `ISSUE_FILE` provided and valid: Use issue title as description (skip Step 2 prompt).
---
**Step 2: Get task description**
**If `$ISSUE_FILE` is set (issue-driven quick task):**
```bash
DESCRIPTION="$ISSUE_TITLE"
echo "Using issue title: $DESCRIPTION"Skip the AskUserQuestion prompt — use the issue title as the description.
If no issue context (standard quick task):
Prompt user interactively for the task description:
AskUserQuestion(
header: "Quick Task",
question: "What do you want to do?",
followUp: null
)Store response as .
$DESCRIPTIONIf empty, re-prompt: "Please provide a task description."
Generate slug from description (both paths):
Generate slug from description:
bash
slug=$(echo "$DESCRIPTION" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/--*/-/g' | sed 's/^-//;s/-$//' | cut -c1-40)Step 3: Calculate next quick task number
Ensure directory exists and find the next sequential number:
.planning/quick/bash
undefinedif echo "$ARGUMENTS" | grep -q -- "--issue"; then
ISSUE_FILE=$(echo "$ARGUMENTS" | grep -oE '--issue [^ ]+' | cut -d' ' -f2)
if [ -f "$ISSUE_FILE" ]; then
# Extract issue metadata
ISSUE_TITLE=$(grep "^title:" "$ISSUE_FILE" | cut -d':' -f2- | xargs)
PROVENANCE=$(grep "^provenance:" "$ISSUE_FILE" | cut -d' ' -f2)
if echo "$PROVENANCE" | grep -q "^github:"; then
ISSUE_NUMBER=$(echo "$PROVENANCE" | grep -oE '#[0-9]+' | tr -d '#')
fi
# Extract problem section for context
ISSUE_PROBLEM=$(sed -n '/^## Problem/,/^## /p' "$ISSUE_FILE" | tail -n +2 | head -n -1)fi
fi
如果提供了`ISSUE_FILE`但文件不存在:报错并退出。
如果提供了`ISSUE_FILE`且有效:使用议题标题作为任务描述(跳过步骤2的提示)。
---
**步骤2:获取任务描述**
**如果已设置`$ISSUE_FILE`(基于议题的快速任务):**
```bash
DESCRIPTION="$ISSUE_TITLE"
echo "Using issue title: $DESCRIPTION"跳过AskUserQuestion提示 — 使用议题标题作为描述。
如果没有议题上下文(标准快速任务):
交互式提示用户输入任务描述:
AskUserQuestion(
header: "Quick Task",
question: "What do you want to do?",
followUp: null
)将响应存储为。
$DESCRIPTION如果为空,重新提示:“请提供任务描述。”
根据描述生成slug(两种路径通用):
根据描述生成slug:
bash
slug=$(echo "$DESCRIPTION" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/--*/-/g' | sed 's/^-//;s/-$//' | cut -c1-40)步骤3:计算下一个快速任务编号
确保目录存在,并找到下一个连续编号:
.planning/quick/bash
undefinedEnsure .planning/quick/ exists
Ensure .planning/quick/ exists
mkdir -p .planning/quick
mkdir -p .planning/quick
Find highest existing number and increment
Find highest existing number and increment
last=$(ls -1d .planning/quick/[0-9][0-9][0-9]-* 2>/dev/null | sort -r | head -1 | xargs -I{} basename {} | grep -oE '^[0-9]+')
if [ -z "$last" ]; then
next_num="001"
else
next_num=$(printf "%03d" $((10#$last + 1)))
fi
---
**Step 4: Create quick task directory**
Create the directory for this quick task:
```bash
QUICK_DIR=".planning/quick/${next_num}-${slug}"
mkdir -p "$QUICK_DIR"Report to user:
Creating quick task ${next_num}: ${DESCRIPTION}
Directory: ${QUICK_DIR}Store for use in orchestration.
$QUICK_DIRStep 4.5: Read context files
Read files before spawning agents using the Read tool. The syntax does not work across Task() boundaries - content must be inlined.
@Read these files:
- (required) — store as
.planning/STATE.mdSTATE_CONTENT - (cross-skill reference) — store as
skills/kata-plan-phase/references/planner-instructions.mdplanner_instructions_content - (cross-skill reference) — store as
skills/kata-execute-phase/references/executor-instructions.mdexecutor_instructions_content
Store content for use in Task prompts below.
Step 5: Spawn planner (quick mode)
Spawn kata-planner with quick mode context:
Task(
prompt="<agent-instructions>\n{planner_instructions_content}\n</agent-instructions>\n\n" +
"<planning_context>
**Mode:** quick
**Directory:** ${QUICK_DIR}
**Description:** ${DESCRIPTION}
**Project State:**
${STATE_CONTENT}
**Issue Context (if from issue):**
${ISSUE_FILE:+Issue File: $ISSUE_FILE}
${ISSUE_NUMBER:+GitHub Issue: #$ISSUE_NUMBER}
${ISSUE_PROBLEM:+
Problem:
$ISSUE_PROBLEM}
</planning_context>
<constraints>
- Create a SINGLE plan with 1-3 focused tasks
- Quick tasks should be atomic and self-contained
- No research phase, no checker phase
- Target ~30% context usage (simple, focused)
</constraints>
<output>
Write plan to: ${QUICK_DIR}/${next_num}-PLAN.md
Return: ## PLANNING COMPLETE with plan path
</output>
",
subagent_type="general-purpose",
model="{planner_model}",
description="Quick plan: ${DESCRIPTION}"
)After planner returns:
- Verify plan exists at
${QUICK_DIR}/${next_num}-PLAN.md - Extract plan count (typically 1 for quick tasks)
- Report: "Plan created: ${QUICK_DIR}/${next_num}-PLAN.md"
If plan not found, error: "Planner failed to create ${next_num}-PLAN.md"
Step 6: Spawn executor
Read the plan content before spawning using the Read tool:
${QUICK_DIR}/${next_num}-PLAN.md
Spawn kata-executor with inlined plan (use the STATE_CONTENT from step 4.5):
Task(
prompt="<agent-instructions>\n{executor_instructions_content}\n</agent-instructions>\n\n" +
"Execute quick task ${next_num}.
<plan>
${PLAN_CONTENT}
</plan>
<project_state>
${STATE_CONTENT}
</project_state>
<constraints>
- Execute all tasks in the plan
- Commit each task atomically
- Create summary at: ${QUICK_DIR}/${next_num}-SUMMARY.md
- Do NOT update ROADMAP.md (quick tasks are separate from planned phases)
</constraints>
",
subagent_type="general-purpose",
model="{executor_model}",
description="Execute: ${DESCRIPTION}"
)After executor returns:
- Verify summary exists at
${QUICK_DIR}/${next_num}-SUMMARY.md - Extract commit hash from executor output
- Report completion status
If summary not found, error: "Executor failed to create ${next_num}-SUMMARY.md"
Note: For quick tasks producing multiple plans (rare), spawn executors in parallel waves per phase-execute patterns.
Step 7: Update STATE.md
Update STATE.md with quick task completion record.
7a. Check if "Quick Tasks Completed" section exists:
Read STATE.md and check for section.
### Quick Tasks Completed7b. If section doesn't exist, create it:
Insert after section:
### Blockers/Concernsmarkdown
undefinedlast=$(ls -1d .planning/quick/[0-9][0-9][0-9]-* 2>/dev/null | sort -r | head -1 | xargs -I{} basename {} | grep -oE '^[0-9]+')
if [ -z "$last" ]; then
next_num="001"
else
next_num=$(printf "%03d" $((10#$last + 1)))
fi
---
**步骤4:创建快速任务目录**
为此快速任务创建目录:
```bash
QUICK_DIR=".planning/quick/${next_num}-${slug}"
mkdir -p "$QUICK_DIR"向用户报告:
Creating quick task ${next_num}: ${DESCRIPTION}
Directory: ${QUICK_DIR}存储供编排使用。
$QUICK_DIR步骤4.5:读取上下文文件
在启动Agent前使用Read工具读取文件。语法无法跨Task()边界工作 - 内容必须内联。
@读取以下文件:
- (必填)— 存储为
.planning/STATE.mdSTATE_CONTENT - (跨技能参考)— 存储为
skills/kata-plan-phase/references/planner-instructions.mdplanner_instructions_content - (跨技能参考)— 存储为
skills/kata-execute-phase/references/executor-instructions.mdexecutor_instructions_content
存储内容供后续Task提示使用。
步骤5:启动规划器(快速模式)
在快速模式上下文下启动kata-planner:
Task(
prompt="<agent-instructions>\n{planner_instructions_content}\n</agent-instructions>\n\n" +
"<planning_context>
**Mode:** quick
**Directory:** ${QUICK_DIR}
**Description:** ${DESCRIPTION}
**Project State:**
${STATE_CONTENT}
**Issue Context (if from issue):**
${ISSUE_FILE:+Issue File: $ISSUE_FILE}
${ISSUE_NUMBER:+GitHub Issue: #$ISSUE_NUMBER}
${ISSUE_PROBLEM:+
Problem:
$ISSUE_PROBLEM}
</planning_context>
<constraints>
- Create a SINGLE plan with 1-3 focused tasks
- Quick tasks should be atomic and self-contained
- No research phase, no checker phase
- Target ~30% context usage (simple, focused)
</constraints>
<output>
Write plan to: ${QUICK_DIR}/${next_num}-PLAN.md
Return: ## PLANNING COMPLETE with plan path
</output>
",
subagent_type="general-purpose",
model="{planner_model}",
description="Quick plan: ${DESCRIPTION}"
)规划器返回后:
- 验证计划是否存在于
${QUICK_DIR}/${next_num}-PLAN.md - 提取计划任务数量(快速任务通常为1个)
- 报告:“Plan created: ${QUICK_DIR}/${next_num}-PLAN.md”
如果未找到计划,报错:“Planner failed to create ${next_num}-PLAN.md”
步骤6:启动执行器
在启动前使用Read工具读取计划内容:
${QUICK_DIR}/${next_num}-PLAN.md
使用内联的计划启动kata-executor(使用步骤4.5中的STATE_CONTENT):
Task(
prompt="<agent-instructions>\n{executor_instructions_content}\n</agent-instructions>\n\n" +
"Execute quick task ${next_num}.
<plan>
${PLAN_CONTENT}
</plan>
<project_state>
${STATE_CONTENT}
</project_state>
<constraints>
- Execute all tasks in the plan
- Commit each task atomically
- Create summary at: ${QUICK_DIR}/${next_num}-SUMMARY.md
- Do NOT update ROADMAP.md (quick tasks are separate from planned phases)
</constraints>
",
subagent_type="general-purpose",
model="{executor_model}",
description="Execute: ${DESCRIPTION}"
)执行器返回后:
- 验证摘要是否存在于
${QUICK_DIR}/${next_num}-SUMMARY.md - 从执行器输出中提取提交哈希值
- 报告完成状态
如果未找到摘要,报错:“Executor failed to create ${next_num}-SUMMARY.md”
注意:对于生成多个计划的快速任务(罕见情况),按照阶段执行模式并行启动执行器。
步骤7:更新STATE.md
在STATE.md中记录快速任务完成情况。
7a. 检查“Quick Tasks Completed”章节是否存在:
读取STATE.md并检查是否存在章节。
### Quick Tasks Completed7b. 如果章节不存在,创建它:
在章节后插入:
### Blockers/Concernsmarkdown
undefinedQuick Tasks Completed
Quick Tasks Completed
| # | Description | Date | Commit | Directory |
|---|
**7c. Append new row to table:**
```markdown
| ${next_num} | ${DESCRIPTION} | $(date +%Y-%m-%d) | ${commit_hash} | [${next_num}-${slug}](./quick/${next_num}-${slug}/) |7d. Update "Last activity" line:
Find and update the line:
Last activity: $(date +%Y-%m-%d) - Completed quick task ${next_num}: ${DESCRIPTION}Use Edit tool to make these changes atomically
Step 7.5: Create PR with issue closure (if issue-driven)
Check pr_workflow config:
bash
PR_WORKFLOW=$(cat .planning/config.json 2>/dev/null | grep -o '"pr_workflow"[[:space:]]*:[[:space:]]*[^,}]*' | grep -o 'true\|false' || echo "false")If is set (issue-driven quick task):
$ISSUE_NUMBERIf :
PR_WORKFLOW=truebash
undefined| # | Description | Date | Commit | Directory |
|---|
**7c. 向表格中添加新行:**
```markdown
| ${next_num} | ${DESCRIPTION} | $(date +%Y-%m-%d) | ${commit_hash} | [${next_num}-${slug}](./quick/${next_num}-${slug}/) |7d. 更新“Last activity”行:
找到并更新该行:
Last activity: $(date +%Y-%m-%d) - Completed quick task ${next_num}: ${DESCRIPTION}使用Edit工具原子性地完成这些修改
步骤7.5:创建PR并关闭议题(如果是基于议题的任务)
检查pr_workflow配置:
bash
PR_WORKFLOW=$(cat .planning/config.json 2>/dev/null | grep -o '"pr_workflow"[[:space:]]*:[[:space:]]*[^,}]*' | grep -o 'true\|false' || echo "false")如果已设置(基于议题的快速任务):
$ISSUE_NUMBER如果:
$PR_WORKFLOW=truebash
undefinedCreate branch for this quick task
Create branch for this quick task
BRANCH="fix/quick-${next_num}-${slug}"
git checkout -b "$BRANCH"
BRANCH="fix/quick-${next_num}-${slug}"
git checkout -b "$BRANCH"
Push branch
Push branch
git push -u origin "$BRANCH"
git push -u origin "$BRANCH"
Build PR body
Build PR body
cat > /tmp/quick-pr-body.md << PR_EOF
cat > /tmp/quick-pr-body.md << PR_EOF
Summary
Summary
Completes issue #${ISSUE_NUMBER}: ${ISSUE_TITLE}
Completes issue #${ISSUE_NUMBER}: ${ISSUE_TITLE}
Changes
Changes
Quick task ${next_num}: ${DESCRIPTION}
See: ${QUICK_DIR}/${next_num}-SUMMARY.md
Closes #${ISSUE_NUMBER}
PR_EOF
Quick task ${next_num}: ${DESCRIPTION}
See: ${QUICK_DIR}/${next_num}-SUMMARY.md
Closes #${ISSUE_NUMBER}
PR_EOF
Create PR
Create PR
gh pr create
--title "fix: ${ISSUE_TITLE}"
--body-file /tmp/quick-pr-body.md
--title "fix: ${ISSUE_TITLE}"
--body-file /tmp/quick-pr-body.md
echo "PR created with Closes #${ISSUE_NUMBER}"
**If `PR_WORKFLOW=false`:**
```bashgh pr create
--title "fix: ${ISSUE_TITLE}"
--body-file /tmp/quick-pr-body.md
--title "fix: ${ISSUE_TITLE}"
--body-file /tmp/quick-pr-body.md
echo "PR created with Closes #${ISSUE_NUMBER}"
**如果`$PR_WORKFLOW=false`:**
```bashClose issue directly (no PR workflow)
Close issue directly (no PR workflow)
gh issue close "$ISSUE_NUMBER" --comment "Completed via quick task ${next_num}"
echo "Issue #${ISSUE_NUMBER} closed directly (pr_workflow=false)"
**If no `$ISSUE_NUMBER`:**
Skip PR creation (standard quick task, not issue-driven).
---
**Step 8: Final commit and completion**
Stage and commit quick task artifacts:
```bashgh issue close "$ISSUE_NUMBER" --comment "Completed via quick task ${next_num}"
echo "Issue #${ISSUE_NUMBER} closed directly (pr_workflow=false)"
**如果未设置`$ISSUE_NUMBER`:**
跳过PR创建(标准快速任务,非基于议题)。
---
**步骤8:最终提交与完成**
暂存并提交快速任务产物:
```bashStage quick task artifacts
Stage quick task artifacts
git add ${QUICK_DIR}/${next_num}-PLAN.md
git add ${QUICK_DIR}/${next_num}-SUMMARY.md
git add .planning/STATE.md
git add ${QUICK_DIR}/${next_num}-PLAN.md
git add ${QUICK_DIR}/${next_num}-SUMMARY.md
git add .planning/STATE.md
Commit with quick task format
Commit with quick task format
git commit -m "$(cat <<'EOF'
docs(quick-${next_num}): ${DESCRIPTION}
Quick task completed.
Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com
EOF
)"
Get final commit hash:
```bash
commit_hash=$(git rev-parse --short HEAD)Display completion output:
---
Kata > QUICK TASK COMPLETE
Quick Task ${next_num}: ${DESCRIPTION}
Summary: ${QUICK_DIR}/${next_num}-SUMMARY.md
Commit: ${commit_hash}
---
Ready for next task: /kata-execute-quick-task<success_criteria>
- ROADMAP.md validation passes
- User provides task description (or uses issue title if --issue flag)
- Slug generated (lowercase, hyphens, max 40 chars)
- Next number calculated (001, 002, 003...)
- Directory created at
.planning/quick/NNN-slug/ - created by planner
${next_num}-PLAN.md - created by executor
${next_num}-SUMMARY.md - STATE.md updated with quick task row
- Artifacts committed
- Issue context parsed from --issue flag (if provided)
- PR created with (if issue-driven and pr_workflow=true)
Closes #X - Issue closed directly (if issue-driven and pr_workflow=false) </success_criteria>
git commit -m "$(cat <<'EOF'
docs(quick-${next_num}): ${DESCRIPTION}
Quick task completed.
Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com
EOF
)"
获取最终提交哈希值:
```bash
commit_hash=$(git rev-parse --short HEAD)显示完成输出:
---
Kata > QUICK TASK COMPLETE
Quick Task ${next_num}: ${DESCRIPTION}
Summary: ${QUICK_DIR}/${next_num}-SUMMARY.md
Commit: ${commit_hash}
---
Ready for next task: /kata-execute-quick-task<success_criteria>
- ROADMAP.md验证通过
- 用户提供任务描述(或使用--issue参数时的议题标题)
- 生成slug(小写、连字符分隔、最多40字符)
- 计算出下一个编号(001、002、003...)
- 在路径下创建目录
.planning/quick/NNN-slug/ - 规划器创建
${next_num}-PLAN.md - 执行器创建
${next_num}-SUMMARY.md - STATE.md中添加快速任务记录行
- 产物已提交
- 从--issue参数中解析议题上下文(如果提供)
- 创建包含的PR(如果是基于议题且pr_workflow=true)
Closes #X - 直接关闭议题(如果是基于议题且pr_workflow=false) </success_criteria>