nav-task-mode

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Navigator Task Mode Skill

Navigator Task Mode Skill

Unified workflow orchestration that coordinates between skills, loop mode, and direct execution based on task complexity and type.
针对任务复杂度与类型,协调Skill、循环模式与直接执行的统一工作流编排工具。

Why This Exists

设计初衷

Navigator had three disconnected workflow systems:
  1. Skills (frontend-component, etc.) - have mini-workflows (Step 1 → Step 7)
  2. Loop Mode - separate phase system (INIT → COMPLETE)
  3. CLAUDE.md - documents workflow nobody enforces
Result: Conflicts when multiple systems try to run.
Solution: Task Mode acts as a coordinator - detecting when skills should handle workflow vs when to provide standalone phase guidance.
Navigator 曾存在三个相互独立的工作流系统:
  1. Skill(如frontend-component等)- 具备小型工作流(步骤1→步骤7)
  2. Loop Mode(循环模式)- 独立的阶段系统(INIT→COMPLETE)
  3. CLAUDE.md - 记录工作流但无强制执行机制
问题:多个系统同时运行时会产生冲突。
解决方案:Task Mode 作为协调者,判断何时由Skill处理工作流,何时提供独立的阶段指导。

How It Works

工作原理

User Request
TASK MODE (this skill)
    ├─ Simple task? → Direct execution (no overhead)
    ├─ Skill matches? → Let skill run (it has workflow)
    └─ Substantial, no skill? → Task Mode phases
User Request
TASK MODE (this skill)
    ├─ Simple task? → Direct execution (no overhead)
    ├─ Skill matches? → Let skill run (it has workflow)
    └─ Substantial, no skill? → Task Mode phases

When to Invoke

触发时机

Auto-invoke when:
  • User starts substantial work (3+ steps expected)
  • No obvious skill match (not "create component", "add endpoint", etc.)
  • Request involves planning, refactoring, or multi-file changes
  • Loop mode is disabled but structured execution needed
DO NOT invoke if:
  • Trivial task (typo fix, single line change)
  • Skill will clearly handle it (component creation, endpoint, migration, etc.)
  • User says "quick", "just do", "simple fix"
  • Already in Task Mode or Loop Mode
自动触发场景:
  • 用户启动大型工作(预计需3步及以上)
  • 无明确匹配的Skill(非“创建组件”“添加接口”等场景)
  • 请求涉及规划、重构或多文件修改
  • 循环模式已禁用但需要结构化执行
禁止触发场景:
  • 琐碎任务(拼写修复、单行代码修改)
  • Skill可明确处理的场景(组件创建、接口开发、迁移等)
  • 用户提及“快速”“直接做”“简单修复”
  • 已处于Task Mode或Loop Mode

Configuration

配置说明

Task Mode settings in
.agent/.nav-config.json
:
json
{
  "task_mode": {
    "enabled": true,
    "auto_detect": true,
    "defer_to_skills": true,
    "complexity_threshold": 0.5,
    "show_phase_indicator": true
  }
}
Options:
  • enabled
    : Master switch for Task Mode
  • auto_detect
    : Auto-detect complexity (vs explicit invocation only)
  • defer_to_skills
    : Let matching skills handle their own workflow
  • complexity_threshold
    : Score (0-1) required to activate
  • show_phase_indicator
    : Show phase banners during execution
Task Mode 的配置文件位于
.agent/.nav-config.json
:
json
{
  "task_mode": {
    "enabled": true,
    "auto_detect": true,
    "defer_to_skills": true,
    "complexity_threshold": 0.5,
    "show_phase_indicator": true
  }
}
配置选项:
  • enabled
    : Task Mode的总开关
  • auto_detect
    : 自动检测任务复杂度(替代仅手动触发)
  • defer_to_skills
    : 优先让匹配的Skill处理自身工作流
  • complexity_threshold
    : 触发Task Mode的复杂度分数阈值(0-1)
  • show_phase_indicator
    : 执行过程中显示阶段标识

Execution Steps

执行步骤

Step 1: Analyze Request

步骤1:分析请求

Run complexity detection:
bash
python3 functions/complexity_detector.py \
  --request "{USER_REQUEST}" \
  --context "{RECENT_CONTEXT}"
Complexity signals:
  • Multi-file changes expected (+0.3)
  • Planning language ("implement", "refactor", "add feature") (+0.2)
  • Vague requirements needing research (+0.2)
  • Cross-system changes (frontend+backend) (+0.3)
  • Testing requirements mentioned (+0.1)
Simple task signals:
  • Single file mentioned (-0.3)
  • Fix/typo/update language (-0.2)
  • Specific location given (-0.2)
  • "Quick" or "simple" mentioned (-0.3)
Decision:
IF complexity_score < threshold:
  → Direct execution (exit Task Mode)
运行复杂度检测:
bash
python3 functions/complexity_detector.py \
  --request "{USER_REQUEST}" \
  --context "{RECENT_CONTEXT}"
复杂度判断信号:
  • 预计需修改多文件 (+0.3)
  • 包含规划类表述(“实现”“重构”“新增功能”)(+0.2)
  • 需求模糊需调研 (+0.2)
  • 跨系统修改(前端+后端)(+0.3)
  • 提及测试需求 (+0.1)
简单任务判断信号:
  • 仅涉及单个文件 (-0.3)
  • 包含修复/拼写更新类表述 (-0.2)
  • 指定具体修改位置 (-0.2)
  • 提及“快速”或“简单” (-0.3)
决策逻辑:
IF complexity_score < threshold:
  → 直接执行(退出Task Mode)

Step 2: Check Skill Match

步骤2:匹配Skill

Run skill detection:
bash
python3 functions/skill_detector.py \
  --request "{USER_REQUEST}" \
  --available-skills "{SKILLS_LIST}"
Skill matching rules:
  • "create component" → frontend-component
  • "add endpoint" → backend-endpoint
  • "database migration" → database-migration
  • "write test" → backend-test/frontend-test
  • etc.
Decision:
IF matching_skill AND defer_to_skills:
  → Show: "Detected: {SKILL_NAME} skill will handle this"
  → Exit Task Mode (skill has workflow)
运行Skill检测:
bash
python3 functions/skill_detector.py \
  --request "{USER_REQUEST}" \
  --available-skills "{SKILLS_LIST}"
Skill匹配规则:
  • “create component” → frontend-component
  • “add endpoint” → backend-endpoint
  • “database migration” → database-migration
  • “write test” → backend-test/frontend-test
  • 其他匹配规则
决策逻辑:
IF matching_skill AND defer_to_skills:
  → 提示: "已检测到: {SKILL_NAME} skill将处理此任务"
  → 退出Task Mode(Skill自带工作流)

Step 3: Initialize Task Mode

步骤3:初始化Task Mode

If substantial task, no skill match:
Display activation:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
TASK MODE ACTIVATED
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Task: {TASK_SUMMARY}
Complexity: {SCORE} (threshold: {THRESHOLD})
Skills matched: None (Task Mode will orchestrate)

Phases:
  ○ RESEARCH - Understand requirements
  ○ PLAN - Create implementation strategy
  ○ IMPL - Execute changes
  ○ VERIFY - Test and validate
  ○ COMPLETE - Commit and document

Starting RESEARCH phase...
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
若为大型任务且无匹配Skill:
显示激活信息:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
TASK MODE ACTIVATED
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

任务: {TASK_SUMMARY}
复杂度: {SCORE}(阈值: {THRESHOLD})
匹配Skill: 无(将由Task Mode编排执行)

阶段:
  ○ RESEARCH - 理解需求
  ○ PLAN - 制定实现方案
  ○ IMPL - 执行修改
  ○ VERIFY - 测试验证
  ○ COMPLETE - 提交并文档化

启动RESEARCH阶段...
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Step 4: Execute Phases

步骤4:执行阶段流程

RESEARCH Phase:
  • Use Task agent for codebase exploration
  • Identify affected files
  • Find existing patterns
  • Document unknowns
Show phase transition:
bash
python3 functions/phase_indicator.py \
  --phase "RESEARCH" \
  --status "complete" \
  --next "PLAN"
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
PHASE: RESEARCH → PLAN
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Research completed:
  ✓ Found {N} related files
  ✓ Identified patterns in {LOCATION}
  ✓ Dependencies mapped

Moving to PLAN phase...
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
PLAN Phase:
  • Create TodoWrite items
  • Identify order of changes
  • Document approach
IMPL Phase:
  • Execute planned changes
  • Follow project patterns
  • Write tests as appropriate
VERIFY Phase:
  • Run tests
  • Type check
  • Build validation
  • Run nav-simplify (if enabled)
COMPLETE Phase:
  • Commit changes
  • Update documentation
  • Close tickets (if PM configured)
  • Suggest compact
RESEARCH阶段:
  • 借助Task Agent探索代码库
  • 确定受影响文件
  • 梳理现有代码模式
  • 记录未知问题
显示阶段切换:
bash
python3 functions/phase_indicator.py \
  --phase "RESEARCH" \
  --status "complete" \
  --next "PLAN"
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
PHASE: RESEARCH → PLAN
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

调研完成:
  ✓ 找到{N}个相关文件
  ✓ 识别{LOCATION}处的代码模式
  ✓ 梳理依赖关系

进入PLAN阶段...
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
PLAN阶段:
  • 创建TodoWrite任务项
  • 确定修改顺序
  • 文档化实现方案
IMPL阶段:
  • 执行规划的修改
  • 遵循项目代码规范
  • 按需编写测试
VERIFY阶段:
  • 运行测试
  • 类型检查
  • 构建验证
  • 运行nav-simplify(若已启用)
COMPLETE阶段:
  • 提交代码修改
  • 更新文档
  • 关闭工单(若配置了PM系统)
  • 建议代码简化

Step 5: Complete Task Mode

步骤5:完成Task Mode

Display completion:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
TASK MODE COMPLETE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Task: {TASK_SUMMARY}
Phases:
  ✓ RESEARCH - {DURATION}
  ✓ PLAN - {DURATION}
  ✓ IMPL - {DURATION}
  ✓ VERIFY - {DURATION}
  ✓ COMPLETE

Summary:
- {FILES_CHANGED} files changed
- {TESTS_ADDED} tests added
- Committed: {COMMIT_SHA}

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

显示完成信息:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
TASK MODE COMPLETE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

任务: {TASK_SUMMARY}
阶段执行情况:
  ✓ RESEARCH - {DURATION}
  ✓ PLAN - {DURATION}
  ✓ IMPL - {DURATION}
  ✓ VERIFY - {DURATION}
  ✓ COMPLETE

总结:
- 修改了{FILES_CHANGED}个文件
- 新增{TESTS_ADDED}个测试
- 提交哈希: {COMMIT_SHA}

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Predefined Functions

预定义函数

functions/complexity_detector.py

functions/complexity_detector.py

Analyzes request to determine complexity score.
Usage:
bash
python3 functions/complexity_detector.py \
  --request "Refactor the auth system to use JWT" \
  --context "Working on user management"
Returns:
json
{
  "complexity_score": 0.7,
  "signals": {
    "multi_file": true,
    "planning_language": true,
    "cross_system": false
  },
  "recommendation": "task_mode",
  "reason": "Refactoring task with multi-file scope"
}
分析请求以确定复杂度分数。
使用方式:
bash
python3 functions/complexity_detector.py \
  --request "Refactor the auth system to use JWT" \
  --context "Working on user management"
返回结果:
json
{
  "complexity_score": 0.7,
  "signals": {
    "multi_file": true,
    "planning_language": true,
    "cross_system": false
  },
  "recommendation": "task_mode",
  "reason": "Refactoring task with multi-file scope"
}

functions/skill_detector.py

functions/skill_detector.py

Checks if a skill should handle this request.
Usage:
bash
python3 functions/skill_detector.py \
  --request "Add a login component" \
  --available-skills '["frontend-component", "backend-endpoint", "database-migration"]'
Returns:
json
{
  "matching_skill": "frontend-component",
  "confidence": 0.95,
  "triggers": ["create component", "add component"],
  "defer": true,
  "reason": "Request matches frontend-component skill triggers"
}
检查是否有合适的Skill处理当前请求。
使用方式:
bash
python3 functions/skill_detector.py \
  --request "Add a login component" \
  --available-skills '["frontend-component", "backend-endpoint", "database-migration"]'
返回结果:
json
{
  "matching_skill": "frontend-component",
  "confidence": 0.95,
  "triggers": ["create component", "add component"],
  "defer": true,
  "reason": "Request matches frontend-component skill triggers"
}

functions/phase_indicator.py

functions/phase_indicator.py

Generates phase transition displays.
Usage:
bash
python3 functions/phase_indicator.py \
  --phase "IMPL" \
  --status "in_progress" \
  --progress 60 \
  --details '{"files_changed": 3, "tests_written": 2}'
Returns: Formatted phase indicator block.

生成阶段切换展示信息。
使用方式:
bash
python3 functions/phase_indicator.py \
  --phase "IMPL" \
  --status "in_progress" \
  --progress 60 \
  --details '{"files_changed": 3, "tests_written": 2}'
返回结果: 格式化的阶段标识块。

Integration with Navigator

与Navigator的集成

With Loop Mode

与Loop Mode的集成

Task Mode is lighter weight than Loop Mode:
  • Loop Mode: Strict iteration control, stagnation detection, EXIT_SIGNAL
  • Task Mode: Phase guidance, skill coordination, no strict gates
When to use which:
  • Loop Mode: "Run until done", autonomous iteration
  • Task Mode: Substantial task, need structure but not strict iteration
Can coexist: Loop Mode wraps Task Mode phases if both active.
Task Mode 比 Loop Mode 更轻量化:
  • Loop Mode: 严格的迭代控制、停滞检测、EXIT_SIGNAL机制
  • Task Mode: 阶段指导、Skill协调、无严格关卡
适用场景对比:
  • Loop Mode: “持续执行直至完成”、自主迭代
  • Task Mode: 大型任务、需要结构化执行但无需严格迭代
共存模式: 若两者同时启用,Loop Mode可包裹Task Mode的阶段流程。

With Skills

与Skill的集成

Task Mode defers to skills by default:
  • Skill has its own workflow (Steps 1-7)
  • Task Mode doesn't add overhead
  • Just shows "Skill X will handle this"
Override: Set
defer_to_skills: false
to always use Task Mode phases.
Task Mode 默认优先适配Skill:
  • Skill自带工作流(步骤1-7)
  • Task Mode不增加额外开销
  • 仅显示“Skill X将处理此任务”提示
强制覆盖: 设置
defer_to_skills: false
可强制始终使用Task Mode的阶段流程。

With nav-simplify

与nav-simplify的集成

Simplification runs during VERIFY phase:
  • After tests pass
  • Before committing
  • Respects simplification.enabled config
代码简化在VERIFY阶段执行:
  • 测试通过后
  • 代码提交前
  • 遵循simplification.enabled配置

With Autonomous Completion

与自主完成机制的集成

COMPLETE phase triggers autonomous protocol:
  • Commit changes
  • Archive documentation
  • Close tickets
  • Create markers

COMPLETE阶段触发自主执行协议:
  • 提交代码修改
  • 归档文档
  • 关闭工单
  • 创建标记

Comparison Table

对比表格

AspectDirect ExecutionTask ModeLoop Mode
ComplexityLowMedium-HighHigh
Phase trackingNoneVisual phasesStrict phases
Iteration controlNoneNoneEXIT_SIGNAL
Skill coordinationNoneDefersIndependent
Best forQuick fixesFeaturesAutonomous work

维度直接执行Task ModeLoop Mode
复杂度中-高
阶段追踪可视化阶段严格阶段控制
迭代控制EXIT_SIGNAL机制
Skill协调优先适配独立运行
最佳场景快速修复功能开发自主化工作

Examples

示例

Example 1: Simple Fix (Direct Execution)

示例1:简单修复(直接执行)

User: "Fix the typo in README"

→ Complexity: 0.1 (below threshold)
→ Direct execution (no Task Mode overhead)
用户: "修复README中的拼写错误"

→ 复杂度: 0.1(低于阈值)
→ 直接执行(无Task Mode开销)

Example 2: Component Creation (Skill Defers)

示例2:组件创建(适配Skill)

User: "Create a UserProfile component"

→ Complexity: 0.6
→ Skill match: frontend-component (0.95 confidence)
→ Task Mode defers: "frontend-component skill will handle this"
→ Skill executes its own Step 1-7 workflow
用户: "创建UserProfile组件"

→ 复杂度: 0.6
→ 匹配Skill: frontend-component(置信度0.95)
→ Task Mode适配: "frontend-component skill将处理此任务"
→ Skill执行自身的步骤1-7工作流

Example 3: Refactoring (Task Mode Active)

示例3:重构任务(Task Mode激活)

User: "Refactor auth to use JWT instead of sessions"

→ Complexity: 0.8
→ Skill match: None
→ Task Mode activates
→ RESEARCH: Explore current auth implementation
→ PLAN: Document JWT migration steps
→ IMPL: Execute changes across files
→ VERIFY: Run tests, simplify code
→ COMPLETE: Commit, document
用户: "重构认证系统以使用JWT替代会话"

→ 复杂度: 0.8
→ 无匹配Skill
→ 激活Task Mode
→ RESEARCH: 调研当前认证实现
→ PLAN: 文档化JWT迁移步骤
→ IMPL: 跨文件执行修改
→ VERIFY: 运行测试、简化代码
→ COMPLETE: 提交代码、更新文档

Example 4: With Loop Mode

示例4:与Loop Mode结合

User: "Run until done: implement user roles"

→ Loop Mode activated (explicit trigger)
→ Task Mode phases guide each iteration:
    Iteration 1: RESEARCH phase
    Iteration 2: PLAN + IMPL phases
    Iteration 3: IMPL + VERIFY phases
    Iteration 4: COMPLETE + EXIT_SIGNAL

用户: "持续执行直至完成:实现用户角色功能"

→ 激活Loop Mode(明确触发)
→ Task Mode阶段指导每次迭代:
    迭代1: RESEARCH阶段
    迭代2: PLAN + IMPL阶段
    迭代3: IMPL + VERIFY阶段
    迭代4: COMPLETE + EXIT_SIGNAL

Error Handling

错误处理

Config not found:
Task Mode config not found in .nav-config.json.
Using defaults: auto_detect=true, threshold=0.5
Skill detection fails:
  • Fall back to Task Mode (conservative)
  • Log warning but continue
Phase detection ambiguous:
  • Default to current or next logical phase
  • Show reasoning for user

未找到配置文件:
未在.nav-config.json中找到Task Mode配置。
使用默认配置: auto_detect=true, threshold=0.5
Skill检测失败:
  • 回退至Task Mode(保守策略)
  • 记录警告但继续执行
阶段检测模糊:
  • 默认使用当前或下一个逻辑阶段
  • 向用户展示决策原因

Success Criteria

成功标准

Task Mode succeeds when:
  • Simple tasks execute without overhead
  • Skills handle their matched requests
  • Substantial tasks get phase structure
  • No conflicts between systems
  • User sees clear progress indicators

Task Mode 达成以下目标即为成功:
  • 简单任务无额外开销直接执行
  • Skill处理匹配的请求
  • 大型任务获得结构化阶段指导
  • 多系统间无工作流冲突
  • 用户可清晰查看进度标识

Verification Checklist

验证清单

After implementation:
  • "Add login component" → frontend-component runs (not Task Mode)
  • "Refactor auth system" → Task Mode runs (no matching skill)
  • "Fix typo" → Direct execution (not substantial)
  • Phase indicators show during Task Mode
  • Skills continue working unchanged
  • Loop Mode can wrap Task Mode phases

This skill provides unified workflow orchestration, resolving conflicts between Navigator's multiple workflow systems.
实现后需验证:
  • "添加登录组件" → frontend-component执行(非Task Mode)
  • "重构认证系统" → Task Mode执行(无匹配Skill)
  • "修复拼写错误" → 直接执行(非大型任务)
  • Task Mode执行过程中显示阶段标识
  • Skill可正常工作不受影响
  • Loop Mode可包裹Task Mode阶段流程

本Skill提供统一的工作流编排,解决Navigator多工作流系统之间的冲突。