ns-autonomous

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Code Autonomous

代码自主执行引擎

Harness-aware execution engine: decides planning depth, resolves doubts, dispatches multi-agent work, and closes the loop with a review gate — either as a standalone pipeline or as another skill's execution engine.
支持Harness的执行引擎:可自主决定规划深度,解决疑问,调度多Agent工作,并通过评审环节形成闭环——既可以作为独立流水线运行,也可作为其他技能的执行引擎。

Workflow mode (mandatory)

工作流模式(强制要求)

Fixed workflow — named skill handoffs or harness project bridges (
../../ns-harness/references/subagent-dispatch.md
). Review gate:
../ns-reviewer/references/review-gate-workflow.md
. MUST
reviewer-agent
when available (else
ns-reviewer
); no platform Task persona substitutes.
C2
(MUST
coder-agent
when available →
ns-coder
) must complete its full per-task cycle including the same review gate before a unit is considered done.
固定工作流——指定技能交接或Harness项目桥接(
../../ns-harness/references/subagent-dispatch.md
)。评审环节:
../ns-reviewer/references/review-gate-workflow.md
必须在可用时调用
reviewer-agent
(否则使用
ns-reviewer
);不允许使用平台任务角色替代。
C2
环节(必须在可用时调用
coder-agent
ns-coder
)必须完成完整的单任务周期,包括相同的评审环节,才算单元任务完成。

Isolation invariant (non-negotiable)

隔离不变规则(不可协商)

This skill never writes application code on the main product checkout, and never commits to
main
/
master
(or any base/
SOURCE_BRANCH
), unless the human has explicitly instructed "do not create a new branch / work in place on the current branch" for this run.
  • Standalone and Engine mode both require an isolated
    WORK_BRANCH
    +
    WORKTREE_ROOT
    before any implementation edit.
  • If worktree creation fails, or CWD/branch is still the main checkout / base branch → stop. Do not "continue on main to unlock the plan".
  • Sandbox restrictions (
    Operation not permitted
    , Cursor agent runtime paths under
    .cursor/
    ) are not permission to violate this invariant.
本技能绝不在主产品检出目录中编写应用代码,绝不提交到
main
/
master
(或任何基准/
SOURCE_BRANCH
)分支,除非人类明确指示本次运行「不要创建新分支/在当前分支原地工作」。
  • 独立模式和引擎模式都需要在进行任何实现编辑前创建独立的
    WORK_BRANCH
    +
    WORKTREE_ROOT
  • 如果工作树创建失败,或当前工作目录/分支仍为主检出目录/基准分支→停止运行。请勿「在主分支继续以解锁计划」。
  • 沙箱限制(如「操作不被允许」、Cursor代理运行路径位于
    .cursor/
    下)不能作为违反此规则的理由。

Session boot

会话启动

See
../../ns-harness/references/session-boot.md
. Complete Session boot (blocking) there before any other step in this skill.
详见
../../ns-harness/references/session-boot.md
。在执行本技能的任何其他步骤前,必须完成会话启动(阻塞式)

After session boot — Engine and Standalone

会话启动后——引擎模式与独立模式

Engine mode: caller may have already completed Session boot in Phase 0 — re-read
session-boot.md
only if context is missing. Standalone: you own Session boot before step 1 of the standalone pipeline.
引擎模式:调用方可能已在第0阶段完成会话启动——仅当上下文缺失时重新阅读
session-boot.md
独立模式:在独立流水线的第1步前,由自身负责完成会话启动。

Routing (read first)

路由规则(请先阅读)

Entry priority table:
../../ns-harness/references/code-skill-routing.md
. Standalone triggers:
references/entry-triggers.md
.
  1. Origin is a GitLab issue (
    ISSUE_URL
    or issue reference) → entry priority 1 — follow
    ns-execution-gitlab-issue
    end to end; this skill only runs as its Phase 2 engine (Engine mode below). Do not run the standalone pipeline, do not touch GitLab state, do not create a worktree.
  2. Standalone autonomous (local plan file, pasted text/plan, ad-hoc "implement this autonomously" without an issue) → entry priority 3 — run the standalone pipeline: own worktree, own state, own review loop.
See
references/routing.md
for Engine-mode I/O and anti-cycle rules with
ns-execution-gitlab-issue
.
入口优先级表:
../../ns-harness/references/code-skill-routing.md
。独立模式触发条件:
references/entry-triggers.md
  1. 来源为GitLab议题
    ISSUE_URL
    或议题引用)→入口优先级1——全程遵循
    ns-execution-gitlab-issue
    的流程;本技能仅作为其第二阶段引擎(下文的引擎模式)运行。请勿运行独立流水线,请勿修改GitLab状态,请勿创建工作树。
  2. 独立自主运行(本地计划文件、粘贴的文本/计划、无议题的临时「自主实现此需求」请求)→入口优先级3——运行独立流水线:自行管理工作树、状态和评审循环。
关于引擎模式的输入输出,以及与
ns-execution-gitlab-issue
的防循环规则,详见
references/routing.md

Engine mode (invoked by
ns-execution-gitlab-issue
)

引擎模式(由
ns-execution-gitlab-issue
调用)

Inputs (already resolved by the caller — this skill never creates them): issue payload,
WORKTREE_ROOT
,
WORK_BRANCH
,
SOURCE_BRANCH
.
  1. Planning-depth self-decision — evaluate the issue payload and decide single work unit vs. light
    requirements.md
    +
    tasks/task-NNN-*.md
    +
    execution-plan.md
    under
    docs/versions/{version_san}/
    . See
    references/planning-decision.md
    .
  2. Doubt protocol — self-ask, docs-first lookup, self-answer non-destructive doubts, escalate destructive ones as a structured event to the caller instead of mutating GitLab state; pause dependent units until resumed. See
    references/doubt-resolution.md
    .
  3. Multi-agent dispatch — parse work units (or the single unit) and MUST dispatch
    coder-agent
    when available (else
    ns-coder
    ) workers, parallel only across units with no DAG edge and disjoint file scopes, sequential otherwise. Every subagent works inside
    WORKTREE_ROOT
    , never the main checkout. See
    references/multi-agent-dispatch.md
    and
    ../../ns-harness/references/subagent-dispatch.md
    .
  4. Checkpoint commits — one commit per completed sequential unit or per completed parallel batch, inside the worktree; the caller squashes at delivery.
  5. Fix-loop entry point — when re-invoked after a
    Rejected
    verdict, treat the reviewer findings as a new work unit (or units) and repeat step 3 for those only.
  6. Return to caller: unit statuses, files changed, any open destructive doubt, and (first invocation only) a plan-based
    estimate_seconds
    hint — the caller applies
    set_issue_estimate
    only when the issue estimate is empty and the value is ≥ 60 (see
    ../ns-execution-gitlab-issue/references/time-tracking.md
    ).
输入(已由调用方解析完成——本技能绝不创建这些输入):议题 payload、
WORKTREE_ROOT
WORK_BRANCH
SOURCE_BRANCH
  1. 自主决定规划深度——评估议题payload,决定采用单个工作单元,还是在
    docs/versions/{version_san}/
    下生成精简版
    requirements.md
    +
    tasks/task-NNN-*.md
    +
    execution-plan.md
    。详见
    references/planning-decision.md
  2. 疑问处理协议——自行提问、优先查阅文档、以非破坏性方式自行解答疑问,将破坏性疑问作为结构化事件上报给调用方而非修改GitLab状态;暂停依赖单元直到恢复运行。详见
    references/doubt-resolution.md
  3. 多Agent调度——解析工作单元(或单个单元),必须在可用时调度
    coder-agent
    (否则使用
    ns-coder
    )执行任务;仅在无DAG依赖且文件范围不重叠的单元间并行执行,否则按顺序执行。所有子代理均在
    WORKTREE_ROOT
    内工作,绝不进入主检出目录。详见
    references/multi-agent-dispatch.md
    ../../ns-harness/references/subagent-dispatch.md
  4. ** checkpoint提交**——每个完成的顺序单元或每个完成的并行批次对应一次提交,提交在工作树内完成;调用方在交付时进行压缩合并。
  5. 修复循环入口——当收到「拒绝」 verdict后被重新调用时,将评审意见视为新的工作单元(或多个单元),仅针对这些单元重复步骤3。
  6. 返回给调用方:单元状态、修改的文件、未解决的破坏性疑问,以及(仅首次调用时)基于计划的
    estimate_seconds
    提示——仅当议题估算为空且数值≥60时,调用方才执行
    set_issue_estimate
    (详见
    ../ns-execution-gitlab-issue/references/time-tracking.md
    )。

Standalone pipeline (non-GitLab origin)

独立流水线(非GitLab来源)

Same internals as Engine mode, but this skill owns the whole run:
  1. Resolve the descriptor — local plan path or pasted text. No MCP calls.
  2. Infer
    change_kind
    (fix/feat), allocate
    {version_san}
    , create
    docs/versions/{version_san}/
    .
  3. Create its own worktree:
    .worktrees/{version_san}/
    + branch
    work/{version_san}
    from the resolved base branch, following
    ../../ns-harness/references/worktree-setup.md
    . Path is under the repo root, never under
    .cursor/
    . On failure → abort (do not fall back to the main checkout) — see
    references/standalone-pipeline.md
    .
  4. Planning-depth self-decision, doubt protocol (destructive doubt → chat-only gate, no GitLab actions available), multi-agent dispatch — identical logic to Engine mode.
  5. Internal review loop
    ../ns-reviewer/references/review-gate-workflow.md
    : MUST invoke
    reviewer-agent
    when available (else
    ns-reviewer
    ) (version-closure mode) only; max 3 rounds;
    Approved
    requires score ≥9/10 (ideal 10); fix units on
    Rejected
    (Criticals or score ≤8), then mandatory re-review; stop on
    Blocked
    or rounds exhausted.
  6. Report per
    review-gate-workflow.md
    Final report fields plus
    {version_san}
    , worktree path, commit(s), and follow-ups. No GitLab board, no MR — unless
    docs/context/gitlab-sync-config.md
    exists and the human explicitly asked for one (out of scope for v1; standalone stays local-only otherwise).
See
references/standalone-pipeline.md
for the full flow.
内部逻辑与引擎模式相同,但本技能负责整个运行流程:
  1. 解析描述符——本地计划路径或粘贴的文本。无需调用MCP。
  2. 推断
    change_kind
    (修复/新增功能),分配
    {version_san}
    ,创建
    docs/versions/{version_san}/
    目录。
  3. 创建自身工作树:在仓库根目录下创建
    .worktrees/{version_san}/
    + 从解析后的基准分支创建
    work/{version_san}
    分支,遵循
    ../../ns-harness/references/worktree-setup.md
    。路径必须位于仓库根目录下,绝不能在
    .cursor/
    下。创建失败→终止运行(请勿回退到主检出目录)——详见
    references/standalone-pipeline.md
  4. 自主决定规划深度、疑问处理协议(破坏性疑问→仅通过聊天环节确认,无GitLab操作权限)、多Agent调度——逻辑与引擎模式完全一致。
  5. 内部评审循环——
    ../ns-reviewer/references/review-gate-workflow.md
    必须在可用时调用**
    reviewer-agent
    (否则使用
    ns-reviewer
    )(仅版本闭环模式);最多3轮评审;「通过」要求评分≥9/10(理想为10);收到「拒绝」 verdict(严重问题或评分≤8)时修复单元,然后必须重新评审**;收到「阻塞」 verdict或评审轮次耗尽时停止运行。
  6. 按照
    review-gate-workflow.md
    最终报告字段要求提交报告,附加
    {version_san}
    、工作树路径、提交记录和后续事项。无GitLab看板,无合并请求——除非
    docs/context/gitlab-sync-config.md
    存在且人类明确要求创建(v1版本不支持此功能;否则独立模式仅保留本地内容)。
完整流程详见
references/standalone-pipeline.md

Stop and ask the human

停止运行并询问人类

ConditionAction
Destructive doubt (Engine mode)Return escalation event to caller — no chat pause here
Destructive doubt (standalone)Stop in chat, ask, resume with the answer as context
Worktree conflict for the same
{run_id}
(standalone)
Stop unless explicit resume
git worktree add
failed (permissions/sandbox/path)
Abort — report path attempted; never fall back to main checkout or
.cursor/
Still on
main
/
master
/base branch when about to edit code
Abort — isolation missing; do not implement
Human explicitly said "do not create a new branch / work in place"Only then may edit the current branch; still never invent a
.cursor/
path
Base branch for standalone worktree unresolvedStop — ask once
Review
Blocked
or 3 rounds exhausted
Stop, report as blocked — do not fabricate success
Engine mode invoked with a GitLab origin but no worktree/branch givenStop — this is a caller contract violation, not a doubt
条件操作
破坏性疑问(引擎模式)向调用方上报升级事件——此处不暂停聊天
破坏性疑问(独立模式)在聊天中停止运行,询问人类,获取答案后恢复运行
同一
{run_id}
出现工作树冲突(独立模式)
停止运行,除非收到明确的恢复指令
git worktree add
执行失败(权限/沙箱/路径问题)
终止运行——上报尝试的路径;绝不回退到主检出目录或
.cursor/
即将编辑代码时仍处于
main
/
master
/基准分支
终止运行——缺少隔离环境;请勿执行实现操作
人类明确指示「不要创建新分支/在当前分支原地工作」仅在此情况下可编辑当前分支;仍不得自行创建
.cursor/
路径
独立模式工作树的基准分支未解析停止运行——询问一次
评审结果为「阻塞」或3轮评审耗尽停止运行,上报阻塞状态——不得伪造成功结果
引擎模式被调用时来源为GitLab,但未提供工作树/分支信息停止运行——这属于调用方违反契约,不属于疑问范畴

Related skills

相关技能

SkillRole
ns-execution-gitlab-issue
GitLab flow owner — calls this skill for Phase 2
ns-coder
Subagent implementation via
coder-agent
(MUST when available)
ns-reviewer
Review gate via
reviewer-agent
(MUST when available)
ns-harness
Artifact layout, worktree mechanics, discovery
技能名称角色说明
ns-execution-gitlab-issue
GitLab流程所有者——调用本技能作为第二阶段执行引擎
ns-coder
子代理实现(必须在可用时调用
coder-agent
ns-reviewer
评审环节(必须在可用时调用
reviewer-agent
ns-harness
工件布局、工作树机制、发现功能

References

参考文档

FileWhen
references/routing.md
Issue vs. standalone; Engine-mode I/O and anti-cycle with
ns-execution-gitlab-issue
references/entry-triggers.md
Priority 3 standalone entry phrases
references/planning-decision.md
Self-evaluation heuristic: single unit vs. requirements+tasks+plan
references/doubt-resolution.md
Self-ask, docs-first lookup, destructive criteria, escalation shape
references/multi-agent-dispatch.md
DAG + disjoint-scope parallel rule, subagent prompt, checkpoint commits
references/standalone-pipeline.md
Full non-GitLab flow: version alloc, own worktree, review loop
文件路径使用场景
references/routing.md
区分议题来源与独立模式;引擎模式的输入输出及与
ns-execution-gitlab-issue
的防循环规则
references/entry-triggers.md
优先级3的独立模式触发语句
references/planning-decision.md
自主评估规则:单个工作单元 vs. 需求+任务+计划文档
references/doubt-resolution.md
自行提问、优先查阅文档、破坏性疑问判定标准、升级事件格式
references/multi-agent-dispatch.md
DAG+无重叠范围并行规则、子代理提示语、checkpoint提交规则
references/standalone-pipeline.md
完整非GitLab流程:版本分配、自建工作树、评审循环

Forbidden

禁止操作

  • Review substitutes (
    senior-tech-lead-reviewer
    ,
    bugbot
    ,
    security-review
    , or any non-
    ns-reviewer
    gate) — harness
    reviewer-agent
    is allowed; see
    ../ns-reviewer/references/review-gate-workflow.md
  • Reporting success without a passing
    ns-reviewer
    verdict or explicit blocked state
  • Skipping re-review after a
    Rejected
    fix before closure
  • 使用评审替代方案(如
    senior-tech-lead-reviewer
    bugbot
    security-review
    或任何非
    ns-reviewer
    的评审环节)——允许使用Harness的
    reviewer-agent
    ;详见
    ../ns-reviewer/references/review-gate-workflow.md
  • 未获得
    ns-reviewer
    的通过 verdict或明确的「阻塞」状态就上报成功
  • 修复「拒绝」问题后跳过重新评审直接闭环