ns-flow-gs-autoslot
Experimentally move dirty work onto a github/gh-stack child, checkpoint it, then move the child into an ns Slot through the explicit `/ns:flow:gs:autoslot` Skill-Backed Command.
- License 许可
- MIT
- 所属仓库
- nseng-ai/ns
- 最近更新
- 2026-10-02
- Stars
- ★ 2
- Forks
- 0
01 前言 Front Matter
- name
- ns-flow-gs-autoslot
- description
- Experimentally move dirty work onto a github/gh-stack child, checkpoint it, then move the child into an ns Slot through the explicit `/ns:flow:gs:autoslot` Skill-Backed Command.
- allowed-tools
- [ "Bash(git status --porcelain=v1*)", "Bash(git symbolic-ref --quiet --short HEAD)", "Bash(git symbolic-ref --quiet --short refs/remotes/origin/HEAD)", "Bash(git rev-parse --verify*)", "Bash(git show-ref --verify --quiet*)", "Bash(git check-ref-format --branch*)", "Bash(git switch -c*)", "Bash(gh stack --version)", "Bash(gh stack view --json)", "Bash(gh stack add*)", "Bash(gh stack init*)", "Bash(ns flow cp*)", "Bash(ns slot checkout --current)" ]
- disable-model-invocation
- true
02 资源文件 1
- 参考文档agents/openai.yaml43 B
03 SKILL.md 正文
ns-flow-gs-autoslot
Experimental dirty-work autoslot for the official github/gh-stack provider (gs). Invocation explicitly selects GS and authorizes the scoped local mutations below. This skill contains the complete autobranch procedure; do not invoke, delegate to, or assume execution of /ns:flow:gs:autobranch. Only after that procedure has verified provider state, created a durable checkpoint, and proved a clean worktree does it compose ns slot checkout --current. This workflow can create a branch and commit, change gh-stack metadata, and move the child into a managed Slot. It does not delegate to an ns flow gs CLI.
Scope and hard boundaries
Support exactly two paths:
- dirty Git trunk → ordinary child → durable checkpoint → initialize that child as the first gh-stack branch → managed Slot checkout;
- dirty non-trunk already tracked as the current stack top → native
gh stack addchild → durable checkpoint → managed Slot checkout.
Never extract the latest commit, initialize an existing non-trunk branch, access .git/gh-stack, fetch, push, submit, retry, roll back, delete a branch, run gh stack unstack, or attempt a Slot checkout before the branch/provider/checkpoint postconditions are proven. Do not describe this prompt-driven workflow as atomic or transactional. Refuse before mutation unless every applicable preflight check passes.
Common preflight
- Run
gh stack --version; require exit status zero and output that reports version0.1.0. Refuse before any mutation on command failure, a missing version, version drift, or help output. - Run bounded probes and retain their exact facts:
git symbolic-ref --quiet --short HEADfor the attached current branch; refuse detached HEAD.git rev-parse --verify HEADfor the source SHA.git status --porcelain=v1 --untracked-files=allfor staged, unstaged, and untracked work; refuse empty output.git symbolic-ref --quiet --short refs/remotes/origin/HEAD; refuse if missing, then remove theorigin/prefix from its short output to obtain cached Git trunk.
- Accept an explicit child slug from the initial request or derive one semantic, conservative slug from the pending change. Validate it with
git check-ref-format --branch <child>. Refuse invalid names. - Require
git show-ref --verify --quiet refs/heads/<child>to report absence. Refuse an existing child ref. - Classify only by current branch versus cached trunk. Invocation is the provider selection; never infer provider choice from metadata.
- Before the first mutation, show the user: path, source/trunk SHA, concise dirty-status summary, child name, intended commands including the final conditional Slot checkout, and the forward-only failure boundary.
A clean invocation is refused. If the user selected Graphite, direct them to /ns:flow:gt:autoslot for ordinary autoslot behavior or /ns:flow:gt:branch-latest-commit for latest-commit extraction; do not offer or simulate GS latest-commit extraction.
Path A: dirty trunk bootstrap
- Record trunk SHA and porcelain status. Run
git switch -c <child>. - Re-probe current branch,
refs/heads/<trunk>,refs/heads/<child>, and porcelain status. Continue only when the child is current, trunk and child both equal the recorded source SHA, and dirty work remains observable. Otherwise inspect and stop without cleanup. - Run
ns flow cp. Verify the child advanced, trunk did not, andgit status --porcelain=v1 --untracked-files=allis empty. If checkpointing fails or cleanliness is unproven, preserve and report the dirty or ambiguously checkpointed child; do not initialize or run Slots. - Only after that durable clean checkpoint, run
gh stack init <child>. - Run
gh stack view --json. Require valid JSON with expectedtrunk,currentBranch === <child>, and exactly one matching current child inbranches. If init fails or the view is malformed/inconsistent, preserve the committed child and stop. Do not move work back, delete anything, or run Slots. - Re-probe the child SHA and clean porcelain status. Continue only if the verified provider child remains current at the checkpoint SHA and the worktree remains clean.
- Run exactly
ns slot checkout --currentand observe its exit status and bounded output. On success, report the returned Slot name, worktree path, checked-out branch, and navigation instruction when present; distinguish the original worktree from the destination. Do not infer absent facts. On failure, preserve the committed provider child and report a partial failure without undoing it.
Path B: dirty tracked-top extension
- Before mutation run
gh stack view --json. Require valid JSON withtrunk,currentBranch, and orderedbranchesrecords containingname,base, andisCurrent. - Require the current Git branch to occur exactly once, be marked current, equal provider
currentBranch, and be the last/topmost branch. Refuse an untracked non-trunk or tracked non-top branch; report the observed top. Never initialize either state. - Record source SHA and porcelain status, then run exactly
gh stack add <child>without-A,-u, or-m. - Regardless of exit status, re-probe current branch, source ref SHA, child ref SHA, porcelain status, and
gh stack view --json. Continue only if observations prove: source unchanged; child exists at the recorded source SHA; child is current; source and child are adjacent in the ordered provider branch list with the child directly above source and topmost; dirty work remains observable on the child. - If the command rejected the work or any fact is absent or ambiguous, stop. Do not retry, initialize, delete, unstack, edit metadata, improvise rollback, or run Slots.
- On verified attachment run
ns flow cp. Verify child advanced, source did not, andgit status --porcelain=v1 --untracked-files=allis empty. If checkpointing fails or cleanliness is unproven, preserve and report the attached dirty or ambiguously checkpointed child; do not run Slots. - Re-run
gh stack view --jsonand re-probe current branch, source and child SHAs, and porcelain status. Require the same direct topmost provider relationship, the source unchanged, the child at the durable checkpoint SHA, and a clean worktree. - Run exactly
ns slot checkout --currentand observe its exit status and bounded output. On success, report the returned Slot name, worktree path, checked-out branch, and navigation instruction when present; distinguish the original worktree from the destination. Do not infer absent facts. On failure, preserve the committed attached child and report a partial failure without undoing it.
Invocation report and lesson feedback
After every outcome, proactively give one terminal report with exactly these eight labeled fields:
- Outcome:
refused,completed,partial failure, orambiguous failure. Any Slot failure after verified provider/checkpoint success ispartial failure; record ambiguous Slot observations without undoing or downgrading the verified child/provider/checkpoint facts. - Path:
trunk bootstraportracked-top extension. - Mutations performed: only observed branches, commits, provider operations, and Slot operations.
- Preserved state: source/trunk SHA, child SHA/current branch, dirty/clean state, recovery location, and—when observed—Slot name, destination worktree path, checked-out branch, original worktree, and navigation instruction.
- Error/observation: failing step and bounded relevant evidence; do not dump logs. For completion, include the verified Slot/worktree/navigation facts.
- Recovery guidance: safest next inspection/action; separate verified facts from hypotheses. A Slot failure must start from the preserved committed provider child, not repeat autobranching.
- Potential improvements: concrete skill or future implementation improvements, including friction on success and Slot-composition evidence.
- Lesson disposition:
new-generalizable,already-covered, orenvironment-specific, with one reason.
Safety comes before lesson editing. After state is resolved and reported, turn a new evidence-backed general lesson into a compact normative change when repository mutation is authorized. Shared autobranch lessons must be synchronized in both canonical skills:
skills/incubating/flow/ns-flow-gs-autobranch/SKILL.mdskills/incubating/flow/ns-flow-gs-autoslot/SKILL.md
Autoslot-only Slot lessons belong only here. Sharpen checks, failure classes, recovery guidance, version caveats, Slot composition, or promotion requirements; do not add incident chronology, raw logs, secrets, branch-specific names, or speculation. If the effective skill is external or editing is not authorized, report a ready-to-apply proposed change and its authoritative path or paths instead of editing silently.
Known operational lessons
Preflight
- Cached trunk and child-ref absence are required facts; provider metadata never substitutes for explicit GS selection.
gh stack --versionis the verified version probe;gh stack versionis invalid in the verified 0.1.0 surface and may show help, which is never version evidence.- Slot composition does not relax autobranch eligibility. A clean invocation remains a refusal rather than becoming a latest-commit Slot move.
Dirty-state transfer
- An ordinary Git branch switch carries trunk work without a stash; native dirty
gh stack addremains empirical and requires post-command inspection even after nonzero exit.
Provider ambiguity
- Command exit is not authoritative. Preserve observed state and stop when Git and
gh stack view --jsondo not jointly prove postconditions.
Checkpointing
- Checkpoint only after the work is observed on the child; initialize a trunk child only after its commit is durable.
- Slot checkout is eligible only after the checkpoint SHA, provider relationship, current child, and clean porcelain status are all reverified.
Slot composition
ns slot checkout --currentis a final composition step, not part of provider preparation. Its failure cannot invalidate or roll back the already durable child/provider state.- Slot output is the authority for destination name, worktree path, checked-out branch, and navigation guidance. Report missing or ambiguous output as such rather than constructing paths or commands.
- Keep original-worktree and destination-worktree facts distinct: a successful Slot move changes where continued work should occur, while the committed branch remains the recovery anchor.
Recovery
- Forward-only preservation is safer than guessed repair because gh-stack offers no safe remove-one-layer rollback and owns private metadata.
- After Slot failure, inspect or retry only the Slot operation from the preserved clean child when safe; never rerun branch creation, provider initialization/addition, or checkpointing.
Prototype status and promotion
This skill is a temporary imperative executable specification and evidence collector for provider-specific Flow TypeScript. Happy paths are insufficient. Promotion requires evidence across staged, unstaged, untracked, and mixed dirtiness for both paths; stable typed eligibility/refusal and absent-versus-ambiguous mutation outcomes; bounded recovery data; verified Slot success, refusal, failure, and ambiguous-output scenarios; fake-driven tests for every retained autobranch and Slot-composition lesson; CLI danger-tier and machine-result review; and migration of command ownership without duplicate surfaces. Future GS orchestration may compose proven Git/provider/Slot mechanisms but must not create a universal GT/GS transaction, add a GS CLI route prematurely, or change GT behavior. Retain a thin skill only for guidance that still adds value after deterministic mutation moves into Flow.
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.