EN 中文

# Goal — Unattended Multi-Turn Tasks

# Goal — 无人值守多轮任务

Run seek across multiple turns toward a completion condition, unattended.

自动多轮工作直到某个条件满足，无需逐轮确认。

Goal runs seek unattended across multiple turns toward a completion CONDITION. A cheap DeepSeek model judges after each turn whether the condition is satisfied. Use it for tasks like "fix all TODOs", "run test suite green", or "migrate all API calls".

Goal 让 seek 自动多轮工作直到某个条件满足。适合"改完所有 TODO"、"跑通所有测试"、"迁移完这个目录的 API 调用"这类长时间任务。

## Quick Start

## 快速开始

    $ /goal 修复 internal/bgjob/ 下所有测试           # TUI
    $ seek goal run "把 docs/ 下所有 .md 中的 V3 改为 V4"  # CLI

## How It Works

## 工作方式

1. You set a condition — e.g. "fix all lint errors"
2. 你给一个"完成条件"（condition）
3. The agent works autonomously — reading, editing, running commands
4. agent 每轮自主调用工具
5. A cheap judge model (DeepSeek) checks if the condition is met after each turn
6. 一个廉价模型（DeepSeek）每轮判断条件是否满足
7. The run stops when: met / max_turns / timeout / stalled / token_budget / canceled / error
8. 满足停止条件时终止

### Stop Reasons

### 终止原因

Reason | 原因 | Description | 说明
--- | --- | --- | ---
`met` | Judge confirmed condition satisfied | 判定条件已满足
`max_turns` | Reached turn cap (default 25) | 达到轮数上限
`timeout` | Wall-clock timeout | 超时
`stalled` | No progress for N turns (default 3) | 连续多轮无进展
`token_budget` | Token budget exhausted | Tokens 预算耗尽
`canceled` | User canceled (Esc / SIGINT) | 用户取消
`error` | A turn execution failed | 某轮执行出错

## Safety Boundaries

## 安全边界

Note: these protections apply only to the unattended paths (`seek goal run` and `cron --goal`). The TUI `/goal` uses your current permission posture — Ask prompts fire normally and remote push is not auto-blocked (you are present to supervise).

注意：以下保护只在无人值守路径（`seek goal run` 和 `cron --goal`）启用。TUI 里的 `/goal` 走你当前的权限姿态——Ask 模式会逐次弹确认，push 也不会被自动拦（你在旁边，由你把关）。

In unattended mode (`goal run` / cron), seek automatically enables these protections:

无人值守时（goal run / cron），自动启用以下保护：

- Remote commits blocked — `git push`, `gh pr`, `gh api` are refused
- 禁止远程提交——`git push`、`gh pr`、`gh api` 等远程改动操作被拒绝
- Auto-yolo — elevated to unattended mode (no one is there to click "allow")
- 权限提升——自动进入 yolo 模式
- Same workspace, not sandboxed — unlike autopilot, goal does not open a separate worktree and does not apply an OS sandbox. Remote push is blocked, but local writes (even outside cwd under yolo) are not kernel-confined. Verify the blast radius before running long unattended tasks.
- 在工作目录里干活，但不是沙箱隔离——与 autopilot 不同，goal 不开独立 worktree、也不上 OS 沙箱。远程 push 被挡，但本地写入（yolo 下甚至可能在工作区之外）不受内核级限制。无人值守跑长任务前，请确认作用范围。

Remote-mutating commands (`git push`, `gh pr`, `gh api`, etc.) are blocked even in yolo mode during an unattended goal run. 远程提交操作（`git push`、`gh pr`、`gh api` 等）即使在 yolo 模式下也被禁止。

## TUI Usage

## TUI 使用

    $ /goal <condition>

- Status bar shows current/limit turns and progress (`🎯 goal N/M` badge)
- 状态栏显示当前轮/上限和进度（`🎯 goal N/M` 徽章）
- Press `Esc` at any time to cancel
- 随时按 Esc 取消
- Auto-resumes unfinished goals on session restart
- 会话重启后自动恢复未完成的 goal

## CLI Reference

## CLI 参考

    $ seek goal run "<condition>"  # Unattended run until condition met

### Caps (code defaults — no CLI / env switches yet)

### 上限参数（当前为内置默认，暂无 CLI / 环境变量开关）

Param | 参数 | Default | 默认 | Description | 说明
--- | --- | --- | --- | --- | ---
Max turns | 25 | Stops with max_turns reason | 达到后以 max_turns 停止
Stall limit | 3 | N turns with no tool calls → stalled | 连续 N 轮无工具调用时停止
Timeout | 30 min (headless `goal run`); none (TUI `/goal`) | headless goal run 30 分钟；TUI /goal 无 | Stops with timeout reason | 到点以 timeout 停止
Token budget | None | Reserved — no tracker wired yet | 预留（接入需 tracker，见 PRD 后续项）

## Goal vs Autopilot

## Goal 与 Autopilot 的区别

| Goal | Goal | Autopilot | Autopilot
--- | --- | --- | --- | ---
Architecture 架构 | Single agent, same conversation, multiple turns | 单 agent，同一对话多轮 | Multiple agents, isolated worktrees, parallel | 多 agent，独立 worktree 并行
Use case 适用场景 | Linear tasks (edit → compile → test) | 线性任务（改代码 → 编译 → 测试） | Exploratory (parallel experiments) | 探索性任务（多方案并行实验）
Isolation 隔离 | Same workspace | 同一工作区 | Per-agent worktree | 每个 subagent 独立 worktree
Judge 判決器 | Cheap DeepSeek call per turn | DeepSeek 廉价模型每轮判断 | Orchestrator aggregates results | 由 orchestrator 汇总结果

## See Also

## 相关功能

- Autopilot — multi-agent parallel exploration
- Autopilot——多 agent 并行探索
- Cron / Background Jobs — scheduled execution
- 定时任务——定时执行