About ns-code-autonomous
ns-code-autonomous is a skill for coding agents that executes implementation plans either independently or as an engine called by ns-execution-gitlab-issue. It combines planning, doubt handling, isolated worktrees, multi-agent dispatch, and a mandatory review loop.
Key features
- 01Standalone and engine execution modes
- 02Planning depth based on incoming work
- 03Structured handling of unresolved doubts
- 04Parallel dispatch for independent work units
- 05Isolated worktrees and checkpoint commits
- 06Mandatory review and fix loop
Use cases
- 01Implementing a local plan without a GitLab issue
- 02Executing the implementation phase of a GitLab issue flow
- 03Splitting independent implementation units across agents
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ nextstage-brasil/ skills --skill ns-code-autonomousAfter installing, type/ns-code-autonomousin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
evals/evals.jsonreferences/doubt-resolution.mdentry-triggers.mdmulti-agent-dispatch.mdplanning-decision.mdrouting.mdstandalone-pipeline.mdDetails
From the project READMECode 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.
Workflow mode (mandatory)
Fixed workflow — named skill handoffs or harness project bridges (../ns-harness/references/subagent-dispatch.md). Review gate: ../ns-harness/references/review-gate-workflow.md. MUST reviewer-agent when available (else ns-code-reviewer); no platform Task persona substitutes. C2 (MUST coder-agent when available → ns-code-coder) must complete its full per-task cycle including the same review gate before a unit is considered done.
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_ROOTbefore 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.
Harness discovery
See ../ns-harness/references/harness-discovery.md. Complete Session boot (blocking) there before any other step in this skill.
After session boot — Engine and Standalone
Engine mode: caller may have already completed Session boot in Phase 0 — re-read harness-discovery.md only if context is missing.
Standalone: you own Session boot before step 1 of the standalone pipeline.
Routing (read first)
Entry priority table: ../ns-harness/references/code-skill-routing.md. Standalone triggers: references/entry-triggers.md.
- Origin is a GitLab issue (
ISSUE_URLor issue reference) → entry priority 1 — followns-execution-gitlab-issueend 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. - 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.
Engine mode (invoked by ns-execution-gitlab-issue)
Inputs (already resolved by the caller — this skill never creates them): issue payload, {product_root}, WORKTREE_ROOT, WORK_BRANCH, SOURCE_BRANCH.
- Planning-depth self-decision — evaluate the issue payload and decide single work unit vs. light
requirements.md+tasks/task-NNN-*.md+execution-plan.mdunderdocs/versions/{version_san}/. Seereferences/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
coder-agentwhen available (elsens-code-coder) workers, parallel only across units with no DAG edge and disjoint file scopes, sequential otherwise. Every subagent works insideWORKTREE_ROOT, never the main checkout. Seereferences/multi-agent-dispatch.mdand../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
Rejectedverdict, treat the reviewer findings as a new work unit (or units) and repeat step 3 for those only. - Return to caller: unit statuses, files changed, any open destructive doubt, and (first invocation only) a plan-based
estimate_secondshint — the caller appliesset_issue_estimateonly when the issue estimate is empty and the value is ≥ 60 (see../ns-execution-gitlab-issue/references/time-tracking.md).
Standalone pipeline (non-GitLab origin)
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
change_kind(fix/feat), allocate{version_san}, createdocs/versions/{version_san}/. - Create its own worktree:
{product_root}/.worktrees/{version_san}/+ branchwork/{version_san}from the resolved base branch, following../ns-harness/references/worktree-setup.md. Path is under the product root, never under.cursor/. On failure → abort (do not fall back to the main checkout) — seereferences/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 —
../ns-harness/references/review-gate-workflow.md: MUST invokereviewer-agentwhen available (elsens-code-reviewer) (version-closure mode) only; max 3 rounds;Approvedrequires score ≥9/10 (ideal 10); fix units onRejected(Criticals or score ≤8), then mandatory re-review; stop onBlockedor rounds exhausted. - Report per
review-gate-workflow.mdFinal report fields plus{version_san}, worktree path, commit(s), and follow-ups. No GitLab board, no MR — unlessdocs/context/gitlab-sync-config.mdexists 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.
Stop 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 {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 unresolved | Stop — 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 given | Stop — this is a caller contract violation, not a doubt |
Related skills
| Skill | Role |
|---|---|
ns-execution-gitlab-issue | GitLab flow owner — calls this skill for Phase 2 |
ns-code-coder | Subagent implementation via coder-agent (MUST when available) |
ns-code-reviewer | Review gate via reviewer-agent (MUST when available) |
ns-harness | Artifact layout, worktree mechanics, discovery |
References
| File | When |
|---|---|
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 |
Forbidden
- Review substitutes (
senior-tech-lead-reviewer,bugbot,security-review, or any non-ns-code-reviewergate) — harnessreviewer-agentis allowed; see../ns-harness/references/review-gate-workflow.md - Reporting success without a passing
ns-code-reviewerverdict or explicit blocked state - Skipping re-review after a
Rejectedfix before closure