ns-autonomous
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCode 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 (). Review gate: . MUST when available (else ); no platform Task persona substitutes. (MUST when available → ) must complete its full per-task cycle including the same review gate before a unit is considered done.
../../ns-harness/references/subagent-dispatch.md../ns-reviewer/references/review-gate-workflow.mdreviewer-agentns-reviewerC2coder-agentns-coder固定工作流——指定技能交接或Harness项目桥接()。评审环节:。必须在可用时调用(否则使用);不允许使用平台任务角色替代。环节(必须在可用时调用→)必须完成完整的单任务周期,包括相同的评审环节,才算单元任务完成。
../../ns-harness/references/subagent-dispatch.md../ns-reviewer/references/review-gate-workflow.mdreviewer-agentns-reviewerC2coder-agentns-coderIsolation invariant (non-negotiable)
隔离不变规则(不可协商)
This skill never writes application code on the main product checkout, and never commits to / (or any base/), unless the human has explicitly instructed "do not create a new branch / work in place on the current branch" for this run.
mainmasterSOURCE_BRANCH- Standalone and Engine mode both require an isolated +
WORK_BRANCHbefore any implementation edit.WORKTREE_ROOT - 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 (, Cursor agent runtime paths under
Operation not permitted) are not permission to violate this invariant..cursor/
本技能绝不在主产品检出目录中编写应用代码,绝不提交到/(或任何基准/)分支,除非人类明确指示本次运行「不要创建新分支/在当前分支原地工作」。
mainmasterSOURCE_BRANCH- 独立模式和引擎模式都需要在进行任何实现编辑前创建独立的+
WORK_BRANCH。WORKTREE_ROOT - 如果工作树创建失败,或当前工作目录/分支仍为主检出目录/基准分支→停止运行。请勿「在主分支继续以解锁计划」。
- 沙箱限制(如「操作不被允许」、Cursor代理运行路径位于下)不能作为违反此规则的理由。
.cursor/
Session boot
会话启动
See . Complete Session boot (blocking) there before any other step in this skill.
../../ns-harness/references/session-boot.md详见。在执行本技能的任何其他步骤前,必须完成会话启动(阻塞式)。
../../ns-harness/references/session-boot.mdAfter session boot — Engine and Standalone
会话启动后——引擎模式与独立模式
Engine mode: caller may have already completed Session boot in Phase 0 — re-read only if context is missing.
Standalone: you own Session boot before step 1 of the standalone pipeline.
session-boot.md引擎模式:调用方可能已在第0阶段完成会话启动——仅当上下文缺失时重新阅读。
独立模式:在独立流水线的第1步前,由自身负责完成会话启动。
session-boot.mdRouting (read first)
路由规则(请先阅读)
Entry priority table: . Standalone triggers: .
../../ns-harness/references/code-skill-routing.mdreferences/entry-triggers.md- Origin is a GitLab issue (or issue reference) → entry priority 1 — follow
ISSUE_URLend 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.ns-execution-gitlab-issue - 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 for Engine-mode I/O and anti-cycle rules with .
references/routing.mdns-execution-gitlab-issue入口优先级表:。独立模式触发条件:。
../../ns-harness/references/code-skill-routing.mdreferences/entry-triggers.md- 来源为GitLab议题(或议题引用)→入口优先级1——全程遵循
ISSUE_URL的流程;本技能仅作为其第二阶段引擎(下文的引擎模式)运行。请勿运行独立流水线,请勿修改GitLab状态,请勿创建工作树。ns-execution-gitlab-issue - 独立自主运行(本地计划文件、粘贴的文本/计划、无议题的临时「自主实现此需求」请求)→入口优先级3——运行独立流水线:自行管理工作树、状态和评审循环。
关于引擎模式的输入输出,以及与的防循环规则,详见。
ns-execution-gitlab-issuereferences/routing.mdEngine mode (invoked by ns-execution-gitlab-issue
)
ns-execution-gitlab-issue引擎模式(由ns-execution-gitlab-issue
调用)
ns-execution-gitlab-issueInputs (already resolved by the caller — this skill never creates them): issue payload, , , .
WORKTREE_ROOTWORK_BRANCHSOURCE_BRANCH- Planning-depth self-decision — evaluate the issue payload and decide single work unit vs. light +
requirements.md+tasks/task-NNN-*.mdunderexecution-plan.md. Seedocs/versions/{version_san}/.references/planning-decision.md - 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 - Multi-agent dispatch — parse work units (or the single unit) and MUST dispatch when available (else
coder-agent) workers, parallel only across units with no DAG edge and disjoint file scopes, sequential otherwise. Every subagent works insidens-coder, never the main checkout. SeeWORKTREE_ROOTandreferences/multi-agent-dispatch.md.../../ns-harness/references/subagent-dispatch.md - Checkpoint commits — one commit per completed sequential unit or per completed parallel batch, inside the worktree; the caller squashes at delivery.
- Fix-loop entry point — when re-invoked after a verdict, treat the reviewer findings as a new work unit (or units) and repeat step 3 for those only.
Rejected - Return to caller: unit statuses, files changed, any open destructive doubt, and (first invocation only) a plan-based hint — the caller applies
estimate_secondsonly when the issue estimate is empty and the value is ≥ 60 (seeset_issue_estimate).../ns-execution-gitlab-issue/references/time-tracking.md
输入(已由调用方解析完成——本技能绝不创建这些输入):议题 payload、、、。
WORKTREE_ROOTWORK_BRANCHSOURCE_BRANCH- 自主决定规划深度——评估议题payload,决定采用单个工作单元,还是在下生成精简版
docs/versions/{version_san}/+requirements.md+tasks/task-NNN-*.md。详见execution-plan.md。references/planning-decision.md - 疑问处理协议——自行提问、优先查阅文档、以非破坏性方式自行解答疑问,将破坏性疑问作为结构化事件上报给调用方而非修改GitLab状态;暂停依赖单元直到恢复运行。详见。
references/doubt-resolution.md - 多Agent调度——解析工作单元(或单个单元),必须在可用时调度(否则使用
coder-agent)执行任务;仅在无DAG依赖且文件范围不重叠的单元间并行执行,否则按顺序执行。所有子代理均在ns-coder内工作,绝不进入主检出目录。详见WORKTREE_ROOT和references/multi-agent-dispatch.md。../../ns-harness/references/subagent-dispatch.md - ** checkpoint提交**——每个完成的顺序单元或每个完成的并行批次对应一次提交,提交在工作树内完成;调用方在交付时进行压缩合并。
- 修复循环入口——当收到「拒绝」 verdict后被重新调用时,将评审意见视为新的工作单元(或多个单元),仅针对这些单元重复步骤3。
- 返回给调用方:单元状态、修改的文件、未解决的破坏性疑问,以及(仅首次调用时)基于计划的提示——仅当议题估算为空且数值≥60时,调用方才执行
estimate_seconds(详见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:
- Resolve the descriptor — local plan path or pasted text. No MCP calls.
- Infer (fix/feat), allocate
change_kind, create{version_san}.docs/versions/{version_san}/ - Create its own worktree: + branch
.worktrees/{version_san}/from the resolved base branch, followingwork/{version_san}. Path is under the repo root, never under../../ns-harness/references/worktree-setup.md. On failure → abort (do not fall back to the main checkout) — see.cursor/.references/standalone-pipeline.md - Planning-depth self-decision, doubt protocol (destructive doubt → chat-only gate, no GitLab actions available), multi-agent dispatch — identical logic to Engine mode.
- Internal review loop — : MUST invoke
../ns-reviewer/references/review-gate-workflow.mdwhen available (elsereviewer-agent) (version-closure mode) only; max 3 rounds;ns-reviewerrequires score ≥9/10 (ideal 10); fix units onApproved(Criticals or score ≤8), then mandatory re-review; stop onRejectedor rounds exhausted.Blocked - Report per Final report fields plus
review-gate-workflow.md, worktree path, commit(s), and follow-ups. No GitLab board, no MR — unless{version_san}exists and the human explicitly asked for one (out of scope for v1; standalone stays local-only otherwise).docs/context/gitlab-sync-config.md
See for the full flow.
references/standalone-pipeline.md内部逻辑与引擎模式相同,但本技能负责整个运行流程:
- 解析描述符——本地计划路径或粘贴的文本。无需调用MCP。
- 推断(修复/新增功能),分配
change_kind,创建{version_san}目录。docs/versions/{version_san}/ - 创建自身工作树:在仓库根目录下创建+ 从解析后的基准分支创建
.worktrees/{version_san}/分支,遵循work/{version_san}。路径必须位于仓库根目录下,绝不能在../../ns-harness/references/worktree-setup.md下。创建失败→终止运行(请勿回退到主检出目录)——详见.cursor/。references/standalone-pipeline.md - 自主决定规划深度、疑问处理协议(破坏性疑问→仅通过聊天环节确认,无GitLab操作权限)、多Agent调度——逻辑与引擎模式完全一致。
- 内部评审循环——:必须在可用时调用**
../ns-reviewer/references/review-gate-workflow.md(否则使用reviewer-agent)(仅版本闭环模式);最多3轮评审;「通过」要求评分≥9/10(理想为10);收到「拒绝」 verdict(严重问题或评分≤8)时修复单元,然后必须重新评审**;收到「阻塞」 verdict或评审轮次耗尽时停止运行。ns-reviewer - 按照的最终报告字段要求提交报告,附加
review-gate-workflow.md、工作树路径、提交记录和后续事项。无GitLab看板,无合并请求——除非{version_san}存在且人类明确要求创建(v1版本不支持此功能;否则独立模式仅保留本地内容)。docs/context/gitlab-sync-config.md
完整流程详见。
references/standalone-pipeline.mdStop and ask the human
停止运行并询问人类
| Condition | Action |
|---|---|
| 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 | Stop unless explicit resume |
| Abort — report path attempted; never fall back to main checkout or |
Still on | 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 |
| Base branch for standalone worktree unresolved | Stop — ask once |
Review | Stop, report as blocked — do not fabricate success |
| Engine mode invoked with a GitLab origin but no worktree/branch given | Stop — this is a caller contract violation, not a doubt |
| 条件 | 操作 |
|---|---|
| 破坏性疑问(引擎模式) | 向调用方上报升级事件——此处不暂停聊天 |
| 破坏性疑问(独立模式) | 在聊天中停止运行,询问人类,获取答案后恢复运行 |
同一 | 停止运行,除非收到明确的恢复指令 |
| 终止运行——上报尝试的路径;绝不回退到主检出目录或 |
即将编辑代码时仍处于 | 终止运行——缺少隔离环境;请勿执行实现操作 |
| 人类明确指示「不要创建新分支/在当前分支原地工作」 | 仅在此情况下可编辑当前分支;仍不得自行创建 |
| 独立模式工作树的基准分支未解析 | 停止运行——询问一次 |
| 评审结果为「阻塞」或3轮评审耗尽 | 停止运行,上报阻塞状态——不得伪造成功结果 |
| 引擎模式被调用时来源为GitLab,但未提供工作树/分支信息 | 停止运行——这属于调用方违反契约,不属于疑问范畴 |
Related skills
相关技能
| Skill | Role |
|---|---|
| GitLab flow owner — calls this skill for Phase 2 |
| Subagent implementation via |
| Review gate via |
| Artifact layout, worktree mechanics, discovery |
| 技能名称 | 角色说明 |
|---|---|
| GitLab流程所有者——调用本技能作为第二阶段执行引擎 |
| 子代理实现(必须在可用时调用 |
| 评审环节(必须在可用时调用 |
| 工件布局、工作树机制、发现功能 |
References
参考文档
| File | When |
|---|---|
| Issue vs. standalone; Engine-mode I/O and anti-cycle with |
| Priority 3 standalone entry phrases |
| Self-evaluation heuristic: single unit vs. requirements+tasks+plan |
| Self-ask, docs-first lookup, destructive criteria, escalation shape |
| DAG + disjoint-scope parallel rule, subagent prompt, checkpoint commits |
| Full non-GitLab flow: version alloc, own worktree, review loop |
| 文件路径 | 使用场景 |
|---|---|
| 区分议题来源与独立模式;引擎模式的输入输出及与 |
| 优先级3的独立模式触发语句 |
| 自主评估规则:单个工作单元 vs. 需求+任务+计划文档 |
| 自行提问、优先查阅文档、破坏性疑问判定标准、升级事件格式 |
| DAG+无重叠范围并行规则、子代理提示语、checkpoint提交规则 |
| 完整非GitLab流程:版本分配、自建工作树、评审循环 |
Forbidden
禁止操作
- Review substitutes (,
senior-tech-lead-reviewer,bugbot, or any non-security-reviewgate) — harnessns-revieweris allowed; seereviewer-agent../ns-reviewer/references/review-gate-workflow.md - Reporting success without a passing verdict or explicit blocked state
ns-reviewer - Skipping re-review after a fix before closure
Rejected
- 使用评审替代方案(如、
senior-tech-lead-reviewer、bugbot或任何非security-review的评审环节)——允许使用Harness的ns-reviewer;详见reviewer-agent../ns-reviewer/references/review-gate-workflow.md - 未获得的通过 verdict或明确的「阻塞」状态就上报成功
ns-reviewer - 修复「拒绝」问题后跳过重新评审直接闭环