ns-gs-restack-resolve
Drive the local `ns gs restack-resolve` conflict-resolution workflow.
- License 许可
- MIT
- 所属仓库
- nseng-ai/ns
- 最近更新
- 2026-10-02
- Stars
- ★ 2
- Forks
- 0
01 前言 Front Matter
- name
- ns-gs-restack-resolve
- description
- Drive the local `ns gs restack-resolve` conflict-resolution workflow.
- disable-model-invocation
- true
02 资源文件 1
- 参考文档agents/openai.yaml43 B
03 SKILL.md 正文
ns-gs-restack-resolve
Drive the local gh-stack restack-resolve workflow from the current worktree. Use downstack inter-branch scope by default; use full inter-branch scope only when the user explicitly asks for the whole stack.
This skill is the parent-session driver: it owns the initial CLI run, scope
narration, sequential subagent dispatch, interpretation of structured CLI and
repository evidence, final checks, and user-facing escalation. All resolution
policy for each conflict stop belongs to the engine,
code-resolve-merge-conflicts at
skills/incubating/code/code-resolve-merge-conflicts/SKILL.md, configured only
through the driver parameters in Conflict subagent prompt. The engine's safe
categories, verification gate, edit and staging rules, escalation payload, and
abort policy apply as written there.
Scope
- Generic or ambiguous restack intent means
RESTACK_SCOPE=downstack. - Explicit whole-stack intent means
RESTACK_SCOPE=full. - "Downstack" is the provider's narrower local inter-branch operation from the current branch (ancestors + current); "full" is its wider whole-stack local inter-branch operation. Neither fetches, updates, or integrates trunk, and neither pushes or reconciles GitHub state.
- Scope is selected once, before any mutation, and carried as narration for the rest of the run. After an interruption, keep the originally selected scope.
Mutation whitelist
The only mutations this workflow performs, all inside a conflict subagent:
- Stage an engine-accepted resolution.
- Run the continuation command,
ns gs restack-resolve --yes --format json, at most once per conflict stop.
Everything else — abort, raw git rebase --continue, provider-private
operations, Graphite, Slot release, a second start command — is outside the
workflow. When evidence is malformed, contradictory, ambiguous, or positively
identifies a conflict outside the selected scope, the correct move is to stop
and report; scope is never reconstructed by topology inspection.
The audit invariant:
one conflict stop = one engine run = one CLI continuation = one fresh same-worktree subagent
If a child's one continuation reaches another conflict stop, that new stop belongs to a fresh child launched by the parent.
Workflow
1. Select and state scope
Set RESTACK_SCOPE. Tell the user the selected scope is local inter-branch
only and leaves trunk, pushes, and GitHub state untouched.
2. Run the initial fast path
In the parent session, run exactly one structured command:
ns gs restack-resolve --yes --format json
# or, only for explicit whole-stack intent:
ns gs restack-resolve --full --yes --format json
Read the structured JSON envelope and branch on its data, not exit code
alone:
data.outcome=completed→ Completion.data.outcome=conflict-stoppedwithdata.currentOperation=rebaseand nonemptydata.unmergedPaths→ refresh withgit status, then Conflict loop.data.outcome=refused→ report the bounded diagnostic and final recovery instruction, and stop there.- Missing, malformed, or contradictory fields → stop as ambiguous, without mutation.
Two pre-existing-state branches: a recognized conflict stop can make this first
call a non-mutating refusal with recovery resolve-conflicts — once the
envelope and fresh git status agree the rebase is stopped at unresolved
paths, enter the conflict loop. A resolved-and-staged interruption may make the
first call the single continuation for that stop; treat its result normally. An
already-active operation is resumed through the conflict loop, not through a
second start command.
3. Conflict loop
Every continuation in this loop is ns gs restack-resolve --yes --format json
— continuation resumes provider state and never takes --full. For each
observed conflict stop:
- In the parent, reconcile the latest structured CLI result with fresh
git status. Require an active rebase and the same unresolved paths; if the evidence disagrees or cannot identify one current stop, escalate as ambiguous without mutation. - Launch exactly one fresh subagent in this same worktree with the prompt below, sequentially — one child per stop.
- When it returns, reread
git statusand the child's structured CLI evidence in the parent; the child's prose summary is not authority. - Classify the observed result:
- advanced: the child's one continuation reached a later conflict stop; launch one fresh child for that stop.
- completed: go to Completion.
- escalation: present the engine's escalation payload to the user and leave the operation stopped at this stop; the user's decision drives what happens next.
- bail or ambiguity: stop and report what is resolved, what remains, the original scope, and the exact repository/CLI state, leaving the operation stopped.
Carry any unverified behavior or pre-existing-failure label forward
unchanged in later prompts and reports until independently verified.
Conflict subagent prompt
Fill in RESTACK_SCOPE from the parent-selected original scope.
You are resolving exactly one conflict stop in an ns GS restack that is already
in progress in this same worktree.
Driver parameters (orchestrator-decided):
- Original RESTACK_SCOPE: <full|downstack> local inter-branch scope — narration
and safety context only; the continuation command does not encode it
- Continue command: ns gs restack-resolve --yes --format json
- Extra bail-out condition: repository/CLI evidence cannot unambiguously show
this same active rebase conflict stop or the continuation outcome, or it
positively identifies a conflict outside the original RESTACK_SCOPE
- Post-completion checks: return the complete structured CLI envelope plus
fresh git status to the parent; the parent owns final checks
- Escalation channel: return-to-parent
Follow skills/incubating/code/code-resolve-merge-conflicts/SKILL.md as the sole
conflict-resolution policy authority with those driver parameters.
Your mutation whitelist:
1. Stage a resolution the engine accepts.
2. Run the continue command at most once, and only when the engine permits
continuation.
Everything else — abort, skip, raw Git continue, a start command, `gh stack`,
provider-private operations, Graphite, Slot release — is outside your task. If
the continuation reaches a later conflict stop, leave it untouched and report
outcome=advanced. If state is ambiguous, stop without staging, continuing, or
aborting, and report outcome=bail.
Output contract: end with this delimited result block and fill every line:
--- GS CONFLICT SUBAGENT RESULT ---
outcome: advanced | completed | escalation | bail
original_scope: full | downstack
files_resolved: <paths or none>
continuation_ran: yes | no
cli_evidence: <complete structured envelope, or none with reason>
repository_evidence: <fresh git status summary>
engine_report: <per the engine's evidence rules: safe categories used,
verification commands and results, and any behavior or pre-existing-failure
claims with their observed/unverified labels>
summary: <concise summary>
For outcome=escalation, include the engine's complete escalation payload.
--- END GS CONFLICT SUBAGENT RESULT ---
Completion
Reread the completed structured CLI envelope in the parent and run:
git status
git log --oneline -5
Require data.outcome=completed, data.currentOperation=none, no unmerged
paths, and a clean git status. Report the original full/downstack local
inter-branch scope and whether any conflicts were resolved, and remind the
user that completion left trunk, pushes, and GitHub state untouched.
If generated files were accepted during conflict resolution, follow the engine's regeneration policy before calling the overall workflow done. If final CLI and repository evidence disagree, stop and report ambiguity.
Bail-out
Use the engine's bail-out policy plus this driver's ambiguity condition. Leave
the operation stopped and report: resolved files, remaining conflicts, original
scope, the last CLI invocation and structured outcome, and fresh git status.
Describe only the stopped or ambiguous state that is observed.
04 同仓库更多 Skills
pr-make-accountable
Interview a PR author to establish shared understanding of intent and design decisions, then co-author the What / Why / Changes PR body with opt-in Requested reviewer focus.
typescript-style
Opinionated style guide for strict, portable TypeScript. Use when writing, designing, or reviewing TypeScript: type design, boundary validation, error handling, module architecture, and review discipline.
typescript-fake-driven-testing
TypeScript fake-driven testing architecture. Use when writing or reviewing TS code with external dependencies, gateway interfaces, real adapters, in-memory fakes, or CLI scenario tests.
ns-typescript
TypeScript overlay for ns-style projects. Use when editing or reviewing TS in this repo: tsconfig baseline, pnpm/Vitest/oxlint/oxfmt/native tsc commands, relative .ts imports, workspace subpath exports, and the exactOptionalPropertyTypes spread idiom. Repo-specific enforcement (test lanes, time seams, style guard) lives in the host repo's AGENTS.md.
ns-typescript-style-tripwire
Invoke the ns TypeScript style Tripwire against a supplied diff or current branch.
skill-management
Manage skills with `npx skills`: add, edit, remove, rename, update, or list skills (local or GitHub), and the nested `skills/<disposition>/.../<name>/` / flat `.agents/skills/` layout conventions.