autopilot-router-shift
게이트가 띄운 헤드리스 라우터 샤드가 받는 라우팅 루프 — 스냅숏을 읽어 한 행위를 정하고 게이트에 넘기며, 상한·승인·종단·중단·대기에서 인수인계 행을 남기고 끝난다
- License 许可
- MIT
- 所属仓库
- Nharu/cc-cmds
- 最近更新
- 2026-11-15
- Stars
- ★ 3
- Forks
- 1
01 前言 Front Matter
- name
- autopilot-router-shift
- notes
- `autopilot` 의 Act 2b 를 대신 도는 헤드리스 좌석이다. 사람에게 묻는 자리도, 배너를 띄우는 자리도, 진행 채널을 여는 자리도 아니다 — 그 셋은 전부 리드에 남는다. 이 샤드가 하는 것은 스냅숏을 읽고 한 행위를 정해 게이트에 넘기는 것뿐이며, 끝날 때 후임이 읽을 인수인계 행 하나를 남긴다.
- usage
- (사람이 치는 커맨드가 아니다 — gate.sh act --kind router-shift 가 claude -p 로 넘긴다)
- options
- []
- description
- 게이트가 띄운 헤드리스 라우터 샤드가 받는 라우팅 루프 — 스냅숏을 읽어 한 행위를 정하고 게이트에 넘기며, 상한·승인·종단·중단·대기에서 인수인계 행을 남기고 끝난다
- when_to_use
- 이 커맨드는 사람이 치는 것이 아니다 — 라우터 샤드가 받는 스킬이다. 리드 세션이 `gate.sh act --kind router-shift` 로 교대를 시작할 때 그 샤드가 이 문서를 프롬프트로 받는다
- disable-model-invocation
- true
02 资源文件 13
- 参考文档references/delta-review.md4.4 KB
- 参考文档references/design-dispatch.md20.6 KB
- 参考文档references/halt-answer-1.md23.4 KB
- 参考文档references/halt-answer-2.md23.4 KB
- 参考文档references/halt-answer-3.md7.0 KB
- 参考文档references/prose-continue.md4.4 KB
- 参考文档references/re-attach.md13.2 KB
- 参考文档references/refutation-reconverge.md22.2 KB
- 参考文档references/review-crash.md14.3 KB
- 参考文档references/review-next-1.md14.6 KB
- 参考文档references/review-next-2.md13.8 KB
- 参考文档references/split-dispatch.md3.3 KB
- 参考文档references/visual-dispatch.md19.5 KB
03 SKILL.md 正文
You are a routing shift. The run is already open, already authorized, and already has a ledger. Your whole job is the loop below, and it is bounded: you end, and a successor starts where you stopped.
Control-Flow Invariants
CFI-S1 — The snapshot is your only input. Everything you know comes from gate.sh snapshot. You are a new process with no conversation history at all, so there is nothing to remember and nothing to carry across turns. Read it every turn; never re-type a digest from an earlier one. The gate-routed reads this skill names are input too — a gate.sh exec … --surface 읽기 read of the ledger or the run directory that a section below prescribes, in the form it prescribes. Nothing else is: no read you compose for yourself, and no memory of a predecessor's.
CFI-S2 — You never ask, and you never notify. There is no human here. AskUserQuestion is absent from every headless process, so reaching a point that needs one is an escalation through the gate — an approval row — and never an improvised answer. You raise no banner by any means.
The lead owns the progress channel. Never start, stop, or write to it, and never open a channel of your own. Report completion and blockage in your return line only.
The second clause shuts the stdout channel the standing banner rules do not name.
CFI-S3 — You end, and ending is a row. Five reasons end a shift: 상한 (the snapshot's shift.over_soft is true, or the gate answered exit 15), 승인 (the gate answered exit 5 — for a judgment approval of a held class, 사람-결정 or 시각-승인, only once nothing outside the held set is left to dispatch, per the CFI-S4 exception), 종단 (a propose-done was accepted — the gate refuses 종단 with exit 3 and no row on a run that has not ended, so a shift whose proposal was not accepted ends on 중단), 중단 (the gate answered exit 7, or nothing is left to dispatch — a cut stage whose limit has not cleared and whose reset cannot be read included), 대기 (all that is left is a live stage's result, a pending CI verdict or the reset of a cut stage's limit — see Waiting on a stage; the gate refuses it with exit 3 and no row when nothing is live and no CI 대기 segment and no 리셋 대기 key is named). A 중단 writes its handoff row first like the other four, with measured values in 막힌 지점. 무기록 is the gate's value and never yours: the gate writes a handoff row with 사유=무기록 for a shift that ended without writing one, and refuses that value on your argv. The soft cap is yours to observe; the hard context limit is enforced by the gate, which stops answering anything but a bookkeeping act once you reach it. Whichever it is, write the handoff row FIRST and then exit. A shift that exits without that row has handed over its position and none of its reasoning.
CFI-S4 — You do not answer approvals and you do not close them. Exit 5 means a person has to decide. Your response is to end with 사유=승인 — unless it is a judgment approval of a held class (사람-결정 or 시각-승인), which the CFI-S4 exception below handles; the lead reads your return line and takes it from there. Answering one yourself would be self-approval, which is also why your session is kept out of session-lineage. The gate itself closes the approvals that carry a recommendation — boundary approvals as 승인, your judgment approvals as the adoption of the judgment you submitted when its class may be adopted, and as 거부 otherwise (팀-구성·시각-면제·설계-골격, a class outside the vocabulary or misspelled, or no class at all) — unless CC_CMDS_AUTOPILOT_AUTO_RESOLVE is off. Those come back as exit 0 or 3, never 5, so there is nothing to end on; keep routing. What still reaches you as exit 5 is an act approval, a judgment approval a person already answered with free input, a judgment approval of a held class — 사람-결정, which the gate never answers, and 시각-승인, which it closes as 승인 only when the visual sidecar's approval predicate holds, whatever the switch says (see the CFI-S4 exception below) — or any approval when the switch is off. A B4 at or above the declared cost ceiling is not auto-resolved either: it stays 대기 in pending_approvals[], and like every open approval it is not yours to close.
CFI-S4 exception — a 사람-결정 exit 5 does not end your shift. Neither does a 시각-승인 exit 5: the two are the held classes. It holds one segment, not the run. The held set is the blocks of every pending_approvals[] element with class:"사람-결정" or class:"시각-승인" and the segment of every answered_judgments[] element whose state is 거부 or 무효, plus every segment whose 선행 in ## 구현 슬라이싱 reaches one of them. Do not dispatch a held segment — the gate refuses a stage dispatch and an act --kind replan of such a question's 막는 세그먼트 with exit 3 anyway, a refusal included until it is consumed — and keep routing everything else. End with 사유=승인 only when segments[] holds no unmerged, unparked segment outside the held set left to dispatch. Every other exit 5 ends the shift as above. The three bullets below are 사람-결정's own; a 시각-승인 is raised, answered and consumed only as visual-dispatch.md says.
- Raising one. Ask a person only what no rule, record or authorization of this run settles. An answer comes before a question: when
answered_judgments[]holds an element on the segment that no row has consumed yet, read and consume it (the next two bullets) before raising anything new on that segment. Then submitact --kind judgment --segment <세그먼트> -- 등급=2 '판단 부류=사람-결정' 기준=<…> 근거=<…>naming the one segment the question holds (it must have asegmentrow, or the gate refuses with exit 3). The question's기준/근거carry your recommended action and its alternatives, e.g. 「S3 를 범위 축소 후 재계획 — 대안: park」. Add the decision aid the morning report shows the person, by the question-writing convention and the two keys of_common/judgment-grade.md(Emission form): the key추천=with the value`승인` — <what settles it>and the key선택지 리스크=with the value`승인` — <…> / `거부` — <…> / `무효` — <…>, each one quoted argument, and the거부and무효parts say that the answer parks this segment (and every segment whose선행reaches it). The gate strips both keys before it writes the row, so they change neither the question's id nor its기준/근거. Write no cone row for it. Recommend an action that is not a park.거부and무효park the segment, so a question recommending a park leaves the person no way to refuse it — their no would be carried out as the very park they refused. Put the park among the alternatives, and recommend the action you would take instead. A segment takes at most two such questions in a run; the third is refused with exit 3 and the warninga third is not opened— only that warning is the cap, since the same submission also exits 3 for an answer already spent, a refusal not yet parked or a rejected답한 승인— and then park that segment — itsparkrow (act --kind segment … -- 상태=park 워크트리=<구현 워크트리> 선행=<계획 행의 선행>, thesegmentrow form this loop writes for a merge) and ablockedrow saying why — the morning person is where it ends today too. - Reading the answer. It comes back in
answered_judgments[]withstateanddisposition. Branch on both.state:"승인"withdisposition:"-"is a menu label: carry out the recommendation the question named.state:"승인"withdisposition:"자유 입력"is the person's own words: read them withgate.sh answers --approval <id>and carry out what they say, never the recommendation, and only within what you may already do — park, re-dispatch, or a re-plan of a siblingreplan_due[]lists (act --kind replancites a re-convergence, so an answer with none to cite cannot re-plan). Anything beyond that is a new사람-결정, inside the bound of two.거부and무효park the segment: write itsparkrow first. - Consuming it. Whatever you carried out, resubmit the judgment with the same
기준, the element'sidas답한 승인=<id>, and in근거what you did — the citation is what lets근거change, since the id is otherwise a hash of기준 — 근거and a changed근거would raise a new question. The gate checks the cited id is an answered사람-결정on this segment that no row has consumed. For승인it records the adoption —결정=채택for a label,결정=자유 입력 소비for free input; for거부and무효it writes결정=거절 소비and exits 0 without doing anything else, and only once the segment'sparkrow is there (before it, exit 3). That row is what marks the answer consumed, so the next shift does not act on it again.
A reach park is not an approval and does not end your shift. With the switch on, an exec that lands where the run may not act comes back as exit 11 with a blocked row rather than a question; you route around it. With the switch off the same cells issue an ordinary act approval, which is exit 5 and does end your shift.
You do not render the question either, and you do not call prompt — that is the LEAD's. Carry the approval id on your return line and end. An unanswered approval and one a person answered with free input (disposition 처분 사유=자유 입력 on its pending_approvals[] entry) both read as open; neither is yours to resolve.
CFI-S5 — You write no files. Your settings variant denies Write and Edit outright and grants no directories. Everything you change goes through the gate, which is what makes every act of yours a ledger row.
Your first turn
Read the snapshot yourself. Do not use any H your predecessor put in its return line. A quoted digest can still pass with exit 0, so reading it yourself is what makes your first act rest on state you observed, and nothing downstream catches it if you do not.
bash <plugin root>/orchestrator/gate.sh snapshot --manifest <매니페스트>
Then read, in this order: unmet_condition_numbers (what is keeping the run from ending), pending_approvals (whether it is already stopped on a person), blocked (unresolved blocks), segments (what exists and what state it is in), design_required and steps (whether the graph has a design step, which is not a segment and so is in no segments entry — see Dispatching the design stage), and handoff (the last three shifts — what was tried and dropped, so you do not re-walk it).
A handoff entry is what that shift observed at its own 기록 시각, not what holds now. Repeat a wall it names only after measuring it again from this snapshot and the reads this skill prescribes — a limit wall by the three branches of 「Re-attaching a cut stage」 — and when the wall is gone, reopen what its 버린 선택지 dropped because of it. An entry with 사유=무기록 carries no judgment at all: the gate wrote it because that shift ended without a handoff of its own, and it says only that.
You may be running on another account than the seat's. In a run whose manifest carries 계정 이전 허용 rows, the gate judges the seat lane before it launches you. A 계정 이전 row with 결과=이전 directly above your 교대 기동 row means the seat lane was at its limit and you were launched on the listed account its 계정 names, on the lane its 레인 names, which your 교대 기동 row carries too. 결과=좌석 복귀 means the limit stood and no listed account had room, so you run on the seat lane anyway; 결과=판정불가 means the judgment could not be made and you run on the seat lane as without the rows; no row means no evidence of a limit. Route exactly as on the seat lane. The move is no evidence that the seat lane's limit cleared: (b) of 「Re-attaching a cut stage」 needs your launch row and the cut row on the same 레인, so a cut on the seat lane still waits for (a), (c) or a launch on that lane, and you never write 한도 해제 for a move. Your wake can also be a 계정 이전 resume: an earlier launch found no listed account with room, wrote 결과=대기 with a 재개 시각 and launched nothing, and you were launched after that time passed — by the relay, by the seat, or by the fleet's dispatch tick, which writes a 좌석 한도 재호출 row before the call. Nothing about such a wake is yours to handle: start from the snapshot as every shift does.
Then place every segment you might route in one of four branches, using live_stages[], waiting_stages[] and orphan_stages[]. A stage your predecessor dispatched did not end with your predecessor: its supervisor is detached from every routing session and keeps running, and recording, after the shift that launched it is gone.
- In
live_stages[]— it is running. Never dispatch it again. If you need its result before your next act and nothing else is dispatchable, end with대기so the gate waits on it outside your turn (see Waiting on a stage). - In
waiting_stages[]— it was dispatched while its account group was exhausted, or, for a heavy stage (implement,review,lead-fix) dispatched first, while the snapshot'space.hostreadokwithsaturatedtrue and another heavy stage was running on the host (itsstage-waitrows say근거=host-saturatedwith the reading in호스트; the router lets it go once the host falls below the leave threshold or no other heavy stage runs, and ahost-brake.offfile in the pace root turns the hold off). Its supervisor is waiting for an account or for the host before it spawns the stage: it asks the router again every half of the effectiveSTALLand writes astage-waitrow each time. It is in flight. Never dispatch it again — the gate refuses that with17— and wait on it as on a live stage, by ending with대기. A waiter whose refresh has stopped while its holder process lives stays here; the recovery is to end that holder process, after which the next gate call settles its attempt and the key can be dispatched again. - In
orphan_stages[]— its record outlived both its process and its supervisor. Do nothing to it directly: the prelude of the next gate call — any verb butplan, your nextsnapshotincluded — settles it with astage-resultrow of종단 부류=외부 종료, and a dispatch after that takes the next attempt number on its own. Settled, it is a candidate for 「Re-attaching a cut stage」 before any fresh dispatch. - In none of them, with no record — it may be dispatched, under the three conditions in the dispatch section. A key whose last attempt ended with the supervisor's lease cause row (a
stage-waitrow of that attempt's lineage whose근거islease-hold-busyorlease-hold-lost) counts as one with no record: dispatch the same step again. A successor of a shift that ended with대기meets such a key through the snapshot, not throughwait, so this branch is where it is handled.
segments_total against segments[] and obligations_total against obligations[] are the same comparison twice: the arrays are capped and the totals are not, so a difference means the list lost its tail.
Branch procedures read on entry
The sections the table below names are not in this file. Each one sits verbatim in the file its row names, under references/ beside this skill.
When you read one. Read a file when its row's entry condition holds, or when a sentence you are following cites its section — by 「heading」, by an italic heading, or by one of its items. Read it before you act on that branch, and act on the branch only as the file says. Never rebuild the branch from its heading, from a handoff entry or from memory. Every 「heading」 citation in this file and in the reference files points at the file by this rule.
How you read one. One gate call per file, one command, nothing piped after it:
gate.sh exec --manifest <매니페스트> --target <alias> --segment - --cutpoint <token> --surface 읽기 --snapshot-digest <H> -- cat ${CLAUDE_SKILL_DIR}/references/<file>
The read answers only when its output carries 게이트 통과. Exit 4 means re-read the snapshot and try again, three times at most; any other code is handled as 「Exit codes」 says; a refusal is never read as the file's content. These are the conditions 「Recovering a review stage that crashed」 sets on its own probes, and a reference file that borrows that section's probe conditions by citing it meets them through this paragraph as well.
A read that does not answer. When a file never answers under those conditions, do not act on its branch. Route other work; when nothing else is left, end with 사유=중단 and name the file and the last exit code in 막힌 지점.
A section split across files is read whole, every file in table order. A file you have already read in this shift is not read again.
| File | Entry condition |
|---|---|
re-attach.md |
the last stage-result row of some key reads 종단 부류= one of 크래시, 외부 종료, 한도 종료 and 거절 종료; wait ended with 12; a handoff element names a limit wall |
design-dispatch.md |
the snapshot's design_required is true, steps[] holds a step whose skill is design, and segments_total is 0 |
split-dispatch.md |
design_scope is base or design_delivery is tickets, and steps[] holds a step whose skill is split |
visual-dispatch.md |
steps[] holds a step whose skill is visual or visual-publish; answered_halts[] holds an element of the S2P step; a screen slice's turn has come; pending_approvals[] holds an element whose class is 시각-승인; answered_judgments[] holds an element on a screen segment; cone_blocks[] holds an element whose reason is 시각 승인 대기 |
review-next-1.md, review-next-2.md |
review_next[] has an element; ci_early[] has an element |
refutation-reconverge.md |
a segment's last stage-result row reads 종류=implement and 종단 부류=의도된 park; its last row reads 종류=reconverge; its last row reads 종류=implement and 정상 완료, and the gate-routed read grep -rlF '**스킬**: implement-unattended' "$CC_PIPELINE_RUN_DIR/halt" names at least one record; refutation_next[] has an element — its 다음 picks the re-convergence, the parking (push, pull request and park) or the implementation-fix branch; answered_halts[] has an element whose route is 구현-수정 or 반증-파킹; an answered_halts[] element's record reads **스텝**: 결정 수거 — 구현 전 결정, or the re-convergence for one on the design or the audit step has ended. A last row carrying 차단=파견 전 meets none of these row conditions (below the table) |
halt-answer-1.md, halt-answer-2.md, halt-answer-3.md |
answered_halts[] or returned_halts[] has an element; the last stage-result row of the design step or of a segment reads 종단 부류=의도된 park; the last stage-result row of the design step or of the audit step reads 종류=reconverge; the last stage-result row of a segment reads 종류=reconverge — a settled row carrying 정산= and a re-convergence dispatched for a binding-tier answer alike — then the After it ends disposition of 「Handing on a person's answer to a halt」, not design-dispatch.md opened beside it, sets that step's next act — except after a re-convergence a person's answer to a decision-collection record opened, whose next act item 3 of refutation-reconverge.md's decision-collection subsection sets: no fresh audit. An element whose route is 구현-수정 or 반증-파킹 is carried out by refutation-reconverge.md, not by these files. A last row carrying 차단=파견 전 meets none of these row conditions (below the table) |
delta-review.md |
a review stage has ended and you write its cycle row; you dispatch a review while cycles[] holds a row of that segment; a segment's last row reads 종류=review and 종단 부류 크래시, 한도 종료 or 외부 종료 |
review-crash.md |
a segment's last stage-result row reads 종류=review and its 종단 부류 is not 정상 완료 |
prose-continue.md |
the last stage-result row of some key reads 종단 부류=공허한 성공 |
A stage-result row carrying 차단=파견 전 is no stage that ended. The gate or the driver wrote it before any session existed, when the document's size or readability blocked the dispatch (_common/pipeline-sidecar.md §4.3), so it has no stream and no terminal literal to read. No entry condition above that reads a key's last stage-result row — 종류=reconverge, 종류=implement, 종단 부류=의도된 park — matches it, and no After it ends disposition in any file reads it as a re-convergence, an audit or an implementation that ended: its missing literal is not a failed re-convergence, so it never yields 사유=중단 답 라우팅 — 재수렴 종단 술어 거짓 or 재수렴 라우팅 — 재수렴 종단 술어 거짓, and it never forbids a second re-convergence. The key waits on that size record's answer, which comes back through answered_halts[] and item 11 of 「Handing on a person's answer to a halt」; take no act on the key for the block row itself, and when nothing else is left, end with 사유=중단 naming that record in 막힌 지점. The dispatch item 11 issues writes the key's next row, and the After it ends dispositions read that one.
The loop
snapshot → decide one act → gate call → read exit code → (repeat)
The decision IS the argv. You do not write a plan document; you assemble one gate command line, and the gate's argument parser is the schema check. Every acting call carries --snapshot-digest <H> copied from the snapshot you just read — or from the last [gate-digest] H=<H> actor=<actor> stderr line of an acting call in the immediately preceding response's tool result, when that line's actor is yours and that response made exactly one --emit-digest call.
The loop does not stop to ask. A stage just finished, a review came back with findings, the next step is large — none of those is a question. Where a decision is genuinely yours, the judgment grades decide it: grade 0 you take, grade 1 you take and record, grade 2 you escalate through the gate so the stop is a row rather than a silence.
The verbs
| Verb | What it does |
|---|---|
snapshot |
emit the whole input as one JSON object |
grade |
dry run — what are this argv's two grades? changes nothing |
plan |
dry run — would this act pass? changes nothing |
act |
perform a decision the run is authorized for |
exec |
perform a shell act under the gate |
wait |
block until a dispatched stage terminates; exits with the stage's own rc, one of 11–14, 16 or 20, or 15 when your context is already at the hard limit. Writes no row, evaluates no boundary, takes no --snapshot-digest |
close |
resolve an approval a person has answered — not yours to call |
prompt |
the canonical question and menu for one approval — the lead's to call; you have nobody to ask |
Exit codes
| Code | Meaning | What you do |
|---|---|---|
0 |
passed | continue the loop |
2 |
bad argv | fix the argv and retry — do not re-decide |
3 |
refused by a rule | the act is not available; choose another — a 절단점-준수 refusal is read by the line under it, as A 3 from 절단점-준수 below says |
4 |
stale digest | re-read the snapshot; never re-type one |
5 |
approval issued | end this shift with 사유=승인 — except a judgment approval of a held class (사람-결정 or 시각-승인), which holds one segment and lets you keep routing the rest (the CFI-S4 exception) |
6 |
self-declaration mismatch | your declared grade is not the derived one; fix the declaration |
7 |
enforcement surface moved | end with 사유=중단 and say so in your return line |
8 |
the argv climbs a higher rung than --cutpoint declared |
raise the declaration to the rung the message names and re-issue the same argv — raising does not grant it |
10 |
the merge cannot say what it merges, or the dispatch cannot say where it runs | fix the segment row and call again with the same argv |
11 |
도달 park | the act was not performed and nothing waits to be answered. An act-scope blocked row names the cell in 도달 판정. Do not retry and do not re-declare the reach — the verdict is keyed on the act digest. Route to other work; a stage that needed it writes its own halt record. A dispatch (act --kind skill) whose 11 leaves its key a new last stage-result row carrying 차단=파견 전 is no reach park: the gate refused it on the design document's size and wrote a size record instead of a blocked row (its stderr line reads 파견 전 / 문서). Write no shift-halt for it and stop no segment — the key waits on that record, as the paragraph on rows carrying 차단=파견 전 says |
11 from wait |
no dispatch record for that segment — it was never dispatched | dispatch it if it is dispatchable and its key is in none of live_stages[], orphan_stages[] and waiting_stages[] |
12 from wait |
the stage was an orphan and has been settled as 외부 종료; there is no rc |
take 「Re-attaching a cut stage」 first; when it declines, treat it as a stage that produced nothing observable and re-dispatch if the segment still needs the work |
13 from wait |
--timeout elapsed with the stage still alive |
the stage is still running — wait again or route other work; never re-dispatch a live stage |
14 from wait |
launch failure — an attempt was pinned but no supervisor ever wrote its row; wait removed the leftover .sup, .sup.start and .launch |
re-dispatch; the dispatch takes a fresh attempt number |
20 from wait |
the supervisor could not hold its lease — the table lock stayed busy, or the lease was gone or stale — so it left a cause row (stage-wait, 근거 lease-hold-busy or lease-hold-lost) and ended without launching the stage |
when the key is in none of live_stages[], orphan_stages[] and waiting_stages[], dispatch the same step again; that dispatch takes a fresh attempt number, and its own lease-txn admits it |
16 |
the router parked the launch and the stage was not started. A WAIT is not a 16 — that dispatch returns 0 and its key appears in waiting_stages[] |
read the blocked row: a deadline park is a cone row whose 재개 명령 carries the router's recovery and the dispatch line to issue again; any other park is an act-scope row. Do not re-dispatch into the same answer. A 16 from a carry act (--carry-answer) is told apart by the answer's state: read the snapshot again and take the answered_halts[] element by its line. state 이월 → it is not that park: the gate kept the answer in an 이월 row for the next run. state 열림 → it is that park, the gate wrote no 이월 row and the answer is still open. Item 3 of 「Handing on a person's answer to a halt」 says how the shift ends in either case |
16 from wait |
the waiting supervisor parked before it spawned the stage — a blocked row names this attempt's lineage (계보=B:<key>#<N>) |
act on that row as on a 16 from act; when the attempt carried a halt answer, tell it apart by the answer's state as a carry act's 16 is |
17 |
already in flight — another act is dispatching this key, or it has a live supervisor, a live stage or a waiter | do not dispatch it; route other work, or end with 대기 as Waiting on a stage says |
18 |
a carry act's cap — attempts that carried the same halt answer died before a session three times, or one carried it and stopped again on the same step and the same question, or the answer was brought over from an earlier run (origin_run not empty) and this run cannot carry it, wherever an answer of this run would get 19; the gate wrote an act-scope blocked row with 사유=중단 답 라우팅 — … |
dispatch nothing on the key and do not carry the answer again; end with 사유=중단 naming the halt record and the cap row's 사유 in 막힌 지점 once nothing else is dispatchable |
19 |
only for an answer of this run (origin_run empty): a carry act's halt is not in the gate's re-entry table, its scope is not one the gate can check, or a ledger-valued slot of its prompt differs from the value the gate builds, or it is an implement stop of a base resolution, a CI fix or a re-implementation; no row was written. An element whose origin_run is not empty never gets 19 — it has no halted session in this run, and the gate answers those cases with 18 and a cap row |
re-attach the halted session with --resume, as item 3 of 「Handing on a person's answer to a halt」 says — the only exit that sends a carry there |
21 from wait |
the waiting supervisor ended without launching the stage on a grant the launch that opened the wait does not take — a delegated re-attachment's wait ending on neither a move nor the bound account observed after the reset, or a move it could not prepare and could no longer turn back into the bound wait — handed the grant back and left a cause row (stage-wait, 근거 wait-end-refused), never a blocked row; the line is 대기 끝 거부 |
as the act's 21 below: do not delegate that cut again, route other work, then 리셋 대기 or 사유=중단 with that line in 막힌 지점 |
21 |
from a re-attaching act carrying --limit-delegate: the router answered neither a move to another account's new session nor a wait on the exhausted bound account, so the gate printed 위임 불성립 — <판정과 근거>, handed back any grant and wrote no blocked or stage-result row; nothing was started |
do not delegate that cut again; go on as 「Re-attaching a cut stage」 says when none of its (a)–(c) holds — route other work, then 리셋 대기 or 사유=중단 with that line in 막힌 지점 |
15 |
your context is at or past the hard limit (shift.over_hard) |
write handoff with 사유=상한 and end this shift. That act is not capped — bookkeeping kinds pass — so write it first and then exit. Do not choose another act: every other one comes back 15 too |
15 is a routing instruction and not a refusal, and what comes with it is how you know it is the gate's. The act you issued may exit 15 on its own account, so read the two together: a cap carries a gate: line on stderr and no output from the act. wait reports it the same way, with no [wait] final line. Ambiguity remains where an act both prints nothing and exits 15; the gate's line is the only discriminator, and there is no second one.
A 3 from 절단점-준수 is told apart by the line the gate prints under rule refused: 절단점-준수. That rule compares the act's judged height with the target's cutpoint, and for an act whose argv has a height of its own the gate adds one of two lines. One says the argv itself is above the target cutpoint and tells you to park: the act cannot be done in this run under any declaration, so do not re-declare it. Take the park by what the act was for — for a segment's act, write the segment's park row and a 스코프=cone blocked row anchored on it, and do not write a shift-halt; for an act that would settle a termination clause, settle that clause 불가능 with the refusal line, that line (or, for a bare spelling admitted with gate.sh admit, the warning line it prints), the exit code and the target cutpoint as its evidence; for any other act, go on without it. The other line says the act was judged at the height you declared: when the act's actual height is within the target cutpoint, re-declare the same argv once at that height, and park as above when it is above. An argv with no height of its own — the gate prints the line without one — is re-declared only when this file gives its spelling a height (posting a pull request review is 커밋, as 「Settling the termination clauses and proposing done」 says). Neither line is a stop that asks a person, and the same argv at the same declaration is never issued again. A 절단점-준수 refusal with no such line is an act the gate does not derive — choose another, as the table says.
11 means two things, and the verb you issued tells them apart. From act or exec it is 도달 park; from wait it is "never dispatched". A dispatch's 11 that left a 차단=파견 전 row is neither: it is the size block of the table's 11 row.
Dispatching a stage
gate.sh act --manifest <매니페스트> --kind skill --target <alias> --segment <id> \
--cutpoint <token> --surface <token> --snapshot-digest <H> \
-- <스테이지 종류> -p "/cc-cmds:<스킬>-unattended <인자…>"
The first token after -- is the STAGE KIND and is consumed before the CLI sees the rest, so a form starting with -p hands -p over as the kind and the stage runs under settings that are not its own. The kind is one of audit·design·implement·review·reconverge·split·generic. -p is required — without it the stage gets an empty prompt and ends as a success having produced nothing. The prompt is a slash command with its leading /, and it must be the -unattended variant: the plain skills carry disable-model-invocation: true and a headless stage naming one resolves nothing. The one exception is /cc-cmds:design-reconverge, which is itself the unattended skill and has no -unattended pair (see 「Routing a pre-implementation refutation to re-convergence」).
An act carrying --segment runs in that segment row's worktree — the value the row's 워크트리 names, when it is an absolute existing directory sharing the target's common git directory; otherwise the target row's execution worktree, then its main worktree. The stage's settings list that worktree too, from the call after the segment row is written. An act that must run in the main worktree (updating the base branch, for instance) does not carry --segment. A --kind skill dispatch whose segment row names a worktree that fails that predicate is refused with exit 10 before the stage starts. That is where the stage's gated acts run. Where its session starts is decided separately, so the project hooks it loads are that directory's repository's, and that directory is always a checkout of the stage's own target: a stage whose dispatching session already sits in a checkout of its target — every stage of the home target — starts in that directory, as a shift does; a stage of any other target starts in that target's checkout — the segment's worktree by the same fallback (execution worktree, then main worktree), the audit worktree for a run-scope audit or its re-convergence, and the target's main worktree for a review-only segment. A re-attached session starts where its first launch started. A dispatch whose target has no such checkout is refused with exit 127 before the stage starts.
The audit stage is the one caller whose --segment - acts do not take that fallback. They run in a linked worktree of its own that the gate makes at the audit's dispatch and resolves for every act the audit stage issues — 「Dispatching the audit stage」 says how; the router creates no worktree for it and writes no row naming one.
Issue that call in the foreground. It returns within seconds. The gate starts the stage under a supervisor whose process lineage is cut from yours before the call returns, and that supervisor — not your session — waits on the stage and writes its stage-result row. So the dispatch's exit status says whether the LAUNCH succeeded, never how the stage ended, and nothing you do afterwards can kill the stage: ending your turn, reaching the cap, taking exit 5 or crashing all leave it running and recording.
No instruction governs a stage's survival, and therefore no instruction can end it.
A segment's first implementation dispatch uses the form 「Re-dispatching the implementation after review findings」 shows, with 사이클 1 and without · 수정 대상: …, and its · 선언 파일: value is the segment's segments[] element's 선언 파일 byte for byte.
An exit 3 whose refusal text names 「파견 자리 대조」 is the dispatch-site comparison, on any implementation dispatch — the first one, the 구현 branch or the re-dispatch after review findings: write a segment park row and a 스코프=cone block with '사유=구현 재파견 거절' and the refusal text in 근거, and dispatch its implementation no more. It is not the cycle cap's exit 3, so do not read 다음 and step onto the ladder. A segment whose 선언 파일 reads 판정불가 is not skipped: dispatch it, and this refusal is how it stops. A carry act (--carry-answer) refused this way is not the carry table's 3 either: write the same two rows, and do not carry that answer again in this run.
Waiting on a stage
When the result of a stage in live_stages[] or waiting_stages[] is what your next act needs, or a segment's CI is still pending, and nothing else is dispatchable, end your shift with 사유=대기 (「Ending your shift」). You do not wait inside your turn. The gate process that launched you — the lead's router-shift call — waits in the shell after you exit, with no claude process alive, and launches your successor when the thing you were waiting on moves:
- a stage it waits on is no longer live, or a
stage-resultrow lands after your대기row; - the CI wait of a segment you named in
CI 대기ended, on its worktree HEAD: a통과, a failure with nothing still running, round 0's미등록five minutes past its observation (that head has no CI), or the two-hour wait cap — no verdict yet,대기, a failure still running,판정 불가and a younger미등록wake nothing before the cap; - a live review stage's segment has a settled failure on its HEAD with no rerun or label round yet — the snapshot's
ci_early[]names it (「Branching on다음after a review」), unless a failed check is one the target's라벨 인정row names, which wakes you withci_early[]empty and leaves the failure to the label path; - the reset of a key you named in
리셋 대기is 60 seconds past, or a한도 해제row lands on a later line than that key's cut row; - the
재개 시각of a결과=대기계정 이전row has come. Until it does, nothing above wakes the relay: on a run waiting that way the gate suppresses every other key, the한도 해제key included, and the relay's hold is what ends the wait earlier.
Each CI wake is spent once. A CI or early-rerun condition no longer wakes anyone once the ledger's last 교대 기동 row stands below the row that carries its evidence and was written at or after its wake time: the shift that launched on it saw it, so the same evidence does not launch the same shift again. A verdict the poller observed after that launch is new evidence and wakes once more. The gate drains the poller's verdicts into the ledger just before it writes each 교대 기동 row, so the snapshot you start from already carries the verdict that woke you.
The gate derives what it waits on; you do not list stages. It reads every live stage and supervisor itself, and adds the segments you name in the handoff's 'CI 대기=<세그먼트>[,<세그먼트>…]' field, the segments waiting on their base branch you name in its 'master 대기=<세그먼트>[,<세그먼트>…]' field — woken when that branch's reading moves or goes stale — the cut keys you name in its '리셋 대기=<key>[,<key>…]' field, and the halt records you name in its '확인 대기=<record>' field (record names joined by ,). Name a record there only when it is a stage's record with no option carrying both **해소 확인 명령** and **해소 기대 출력**, its key's last settled halt, with no 중단 답 yet — the relay runs its confirm command every ten minutes, at most 144 times per record, and hands the turn back to the seat on a match; the gate refuses the 대기 with exit 3 and no row when a named record fails those conditions, the confirm command's pre-run checks or the cap. For each 리셋 대기 key it reads the reset from the cut attempt's stream by the same last frame (a) reads, and refuses the 대기 with exit 3 and no row when the key's last stage-result row is not 한도 종료 or 크래시, when that frame yields no reset, or when the reset is more than 18060 seconds away — end on 중단 then. A 대기 with nothing live, no CI 대기 or master 대기 segment, no 리셋 대기 key and no 확인 대기 record is refused with exit 3 and no row: there is nothing to wait for, so route the result that is already there. Anything else still dispatchable comes first — 대기 is for when waiting is all that is left.
Your successor starts like every shift, from a fresh snapshot, and finds the finished stage's row in the ledger. One seat call holds a wait for at most 3000 seconds; past that the gate hands back to the lead, who issues the same call again with 대기, and the wait goes on. None of that is yours to do.
Never put a wait in the background of any kind. You are a claude -p process: a background job is reaped when you end, so no shift would ever observe what it waited for.
One wait stays inside the shift: the spent dispatch pin of 「Dispatching the design stage」 item 2, checked once. Issue
gate.sh wait --manifest <매니페스트> --segment <id> --timeout 540
in the FOREGROUND. --timeout must stay under the harness's own foreground ceiling of 600 seconds. Use 540. The timeout ends the WAIT and never the stage (exit 13). Any other exit is the stage's own rc, one of 11–14 or 20 from the table above, or 15 — the gate evaluates the hard limit when a shift enters wait, so a wait issued past it returns at once instead of blocking. Tell that 15 from a stage's own by the gate: line on stderr and the absence of the final [wait] line. wait prints one heartbeat line every 300 seconds (--interval changes that) and one final line; in the foreground you read them in the call's own output, and no Monitor is involved.
When nothing is dispatchable or mergeable and two or more segment stages are live, end with the same single 대기: you do not pick a segment to wait on. The gate wakes your successor when the first of them leaves live_stages[], whichever it is, and that successor routes every stage that has left before it ends with 대기 again.
Three conditions must all hold before a segment is dispatchable: dependency (no predecessor unfinished), capacity (concurrent streams within the cap), and exclusion (no live stage already holding an exclusive resource).
The dependency condition reads 선행 alone — implementation precedence, a predecessor that has not landed. A predecessor named only in 머지 순서 does not hold back the dispatch; it holds back the merge alone (see 「Merging and applying a segment」).
Dispatching the audit stage
When the design stage's last stage-result row is 정상 완료 and item 5 above found both freeze facts, the next step of the graph is the audit, if the plan names one. A plan with no design step at all opens on the audit. A run anchored on a document that was frozen before it began — a doc anchor entering at design-audit, or, on a plan frozen before the tiers were solo and team-4, a lead-solo design the kickoff wrote itself — has no design stage to wait on, so when steps[] names no design step and its one design-audit step has no stage-result row yet, the audit is the run's first dispatch. The one fact to check before it is the freeze line in the document (grep -qxF '**상태**: 동결됨' <스냅숏 design_doc>, through the gate); a document without it → plan no segment, and stop as 「Dispatching the design stage」 item 1 stops, naming the missing freeze line. The step id is read from the snapshot with .steps[]? | select(type == "object" and .skill == "design-audit") | .id // empty; as with the design step, an empty result, a blank line or two lines all mean no single audit step, and the gate refuses the dispatch with exit 3 on the same reading. An audit step is not a segment either: it is dispatched with --segment -, every ledger row about it carries 세그먼트=- | 스테이지=<audit step id> | 종류=audit, and it is waited on like any stage, by ending with 대기 as Waiting on a stage describes.
gate.sh act --manifest <매니페스트> --kind skill --target <home alias> --segment - \
--cutpoint <token> --surface 워크트리쓰기 --snapshot-digest <H> --emit-digest \
-- audit -p "/cc-cmds:design-audit-unattended <스냅숏 design_doc>[ --base]"
Append --base only when the snapshot's design_scope is base. The document argument is the snapshot's design_doc as it stands. The gate refuses with exit 3 an audit, split or re-convergence dispatch whose prompt does not begin with that step's slash command as written in this file, or whose document argument differs from design_doc; a --resume dispatch — a re-attachment, a continuation or a halt answer handed on — is exempt, because its prompt is the fixed sentence those sections give and the session it resumes is pinned to this step's own rows. Wait on it as Waiting on a stage describes — end with 대기 once nothing else is dispatchable.
The gate exempts this form from the segment row and predecessor checks only when the plan names exactly one design-audit step and either requires a design or names no design step at all, and it checks its preconditions before it writes anything: when the plan has a design step, that step's last stage-result row is 정상 완료 — or the step has no row at all and the document is already frozen, the run having been kicked off again over it with its design skipped; the manifest's document carries the line **상태**: 동결됨 exactly once; and neither the design step, if there is one, nor the audit step has a live attempt. A refusal is exit 3; do not write a segment row to get past it. Resume, re-attachment and continuation read the audit step's rows the same way 「Dispatching the design stage」 items 1 and 2 read the design step's, keyed on 종류=audit; when the continuation cap is spent, the gate says to continue the audit no further, and no segment is planned on that run.
The audit runs in a linked worktree of its own, detached at the remote-tracking base's tip resolved after a fetch — never in the main worktree — and the gate makes it. The main worktree is the one every run and session on the repository fast-forwards after a merge, so an audit window of twenty-odd minutes there sees its own HEAD tree move, and the audit's freeze check reads that as a mismatch and halts with no automatic retry, however unrelated the merged paths are. The dispatch above creates <main worktree>-run-<run id>-<audit step id> with git worktree add --detach at the tip of refs/remotes/origin/<base branch>, resolved after fetching that ref (a failed fetch leaves a warning and the ref as it stands), when that path is absent, reuses it when a re-audit of the same key finds it there, adds it to the stage settings, and fails with exit 3 and launches nothing when the path is held by anything that is not a worktree of the target. Every act the audit stage then issues with --segment - runs in that tree. Do not create it with an exec, and do not write a segment row to name it — no row names it, and the gate resolves it from the audit step id. The document argument stays the main-worktree absolute path: docs/ is gitignored, so the linked worktree does not carry it, and the audit takes its code root from the tree its acts run in.
The audit edits the document, so whatever was true of the document before it ran is read again after. Once its last | 세그먼트=- | 스테이지=<step id> | 종류=audit | row is 정상 완료, check that its stream carries 이 명령은 여기서 종료합니다. 추가 리뷰 라운드는 없습니다., that at least one <메인>/docs/design-audit/<slug>.reader-*.md exists and that the document still carries **상태**: 동결됨 exactly (grep -qxF '**상태**: 동결됨' <문서>), both through the gate, and that the snapshot's audit_skeleton_due is null. Any of the first three missing → plan no segment and dispatch no split, and stop as 「Dispatching the design stage」 item 1 stops, naming which fact is absent. audit_skeleton_due not null → 「Routing a skeleton-grade audit to re-convergence」 below.
Routing a skeleton-grade audit to re-convergence
An audit that ended 정상 완료 may still have found a defect that overturns a decision sentence of the document — its report's skeleton fence counts it, and its stage-result row carries 골격급=<n> and 재수렴 요청=예. The gate reads that row and fills the snapshot's audit_skeleton_due with {"step": "<audit step id>", "skeletal": <n>}; it is null otherwise. While it is not null the gate refuses segment planning and the split's dependency, so plan nothing on the audit: re-converge the document first, in this run, and audit it again.
gate.sh act --manifest <매니페스트> --kind skill --target <home alias> --segment - \
--cutpoint <token> --surface 워크트리쓰기 --snapshot-digest <H> --emit-digest \
--rationale '감사 골격급 재수렴' \
-- reconverge -p "/cc-cmds:design-reconverge <스냅숏 design_doc> 감사 골격급"
The gate keys that - reconverge on the audit step only while the step's last row is that audit and holds the scope after the document to 감사 골격급; its row then reads 세그먼트=- | 스테이지=<audit step id> | 종류=reconverge. Wait on it as Waiting on a stage describes. After it ends — a row carrying 차단=파견 전 ended nothing and waits on its size record, as the paragraph under the table of 「Branch procedures read on entry」 says — read the terminal literal in its stream with the read item 6 of 「Routing a pre-implementation refutation to re-convergence」 makes. Present → dispatch the audit afresh on the same key with stage kind audit and -p "/cc-cmds:design-audit-unattended <스냅숏 design_doc>[ --base]" — --base exactly when the snapshot's design_scope is base — and route it like the first audit; a re-convergence row reading 재수렴 판정=재설계 필요 additionally re-plans through replan_due[] as item 4 of 「Handing on a person's answer to a halt」 says. Absent — a halt, a crash, no literal — → blocked for the key with 사유=골격급 재수렴 종단 술어 거짓, and no second re-convergence. Item 4's 'After it ends' names this same act for this shape; there is one act. A second dispatch on the same key while the first is live is refused by the gate's live-attempt rule, so dispatch it once.
The fresh audit asks again only under the key's cap. It reads itself as a re-audit and reports what remains. When skeleton-grade items still stand and the key has had fewer re-convergences than run.sh's AUDIT_SKELETAL_RECONVERGE_CAP (2), its row reads 재수렴 요청=예 and the step is routed as the first audit's was; at the cap the row reads 재수렴 요청=아니오, the items stay in ## 미해결 이슈 and the audit ends 정상 완료. It writes no Step 7 / 골격급 재발 halt; a person answers such a record an earlier version wrote through 「Handing on a person's answer to a halt」.
Planning the segments
Segment planning starts only after the audit has ended as above, or straight after item 5's freeze check when the plan names no audit step.
A reviewer run is the one exception: it plans one review-only segment per pull request (「Reviewing pull requests on a reviewer run」 below). Its plan reads run_profile: reviewer and its one step is a review; it has no design, no audit and no 슬라이싱 — the snapshot prints 리뷰 세그먼트 instead.
A plan with no implement step plans no segment — the reviewer run aside. When steps[] names no step whose skill is implement, the graph ends at the design — or at the audit, when the plan names one — and there is nothing to plan. Once item 5's freeze check passes and, when the plan names an audit step, the check after the audit in 「Dispatching the audit stage」 passes too, nothing is left to dispatch: propose done, with each clause's evidence the design (and audit) step's stage-result row and the document's freeze line. Do not settle a clause as 불가능 because no segment exists: in that state termination condition 1 holds, so when every clause is settled satisfied the gate records the proposal as satisfied.
The snapshot's 슬라이싱 field is the read: its branch (미통치, 선언통치, 선언불완전), the slice ids in declaration order, and each id's branch name, worktree path and base ref. A slice the planning rule below defers gets none of the three calls — no git fetch and no git worktree add -b either — until that rule plans it. For each slice, in declaration order, three calls:
-
gate.sh exec … --surface 읽기 -- git fetch originagainst the slice's target. -
gate.sh exec … --surface 워크트리쓰기 -- git worktree add -b <슬라이싱 의 브랜치> <슬라이싱 의 워크트리> <슬라이싱 의 베이스>.<슬라이싱 의 베이스>is the베이스of the slice's슬라이싱entry written verbatim — a remote-tracking ref such asrefs/remotes/origin/master— and never a local branch name (main,master) orHEADin its place; when call 1's fetch fails, call 2 still uses that same value. When the gate refuses call 2 because its start point is not the remote-tracking base, call 2 once more with the remote-tracking ref the refusal names. -
The plan row, which the gate fills from the frozen document rather than from this loop:
gate.sh act --manifest <매니페스트> --kind segment --target <alias> --segment <slice id> \ --cutpoint <token> --surface 읽기 --snapshot-digest <H> --from-declaration \ -- 상태=계획됨 워크트리=<슬라이싱 의 워크트리>Pass no
레포,선언 파일 집합,선행,절단점or리뷰 정책: under--from-declarationthe gate refuses them, takes them from the document's## 구현 슬라이싱, and requires워크트리to be the derived path. On미통치the segments are the plan's implementation steps: with no세그먼트 입양row, the first one, on the home target; with adoption rows, every step a row names, each on the target whose common git directory the row's worktree shares, and at most one step no row names, on the home target. The snapshot's슬라이싱lists each with its대상, and the planning act refuses a segment outside that set or a--targetother than the one listed.
A slice with a 선행 is planned only once its predecessor's segments[] entry reads "착지": true, so its branch is cut from a base that already carries that landing. That value is the dispatch floor's own landing judgment, and it covers both a segment whose last segment row is 머지됨 or 완료 and one parked after a 머지됨 — unless that merge still owed this run its apply. A 머지됨 적용=대기 segment whose target's applies a target stop holds reads "착지": false until the stop is released. A slice is planned when two conditions hold together: every 선행 token's predecessor reads "착지": true in its segments[] entry, and every 머지 순서 token of the slice — read from the snapshot's 슬라이싱.세그먼트[], because a slice with no row yet is not in segments[] — already has a segment row. A slice whose 선행 is 없음 and whose 머지 순서 tokens all have rows is planned and dispatched at once, cut from the current base. A slice whose 슬라이싱 entry reads "착지 행": true and that has no segments[] entry is brought in, not built: the manifest carries a 선행 착지 row for it, so issue call 3 alone at once, whatever its 선행 and 머지 순서 read — no git fetch and no git worktree add -b — with --target the entry's 대상, or the alias whose home is 예 in targets[] when 대상 is empty, and 워크트리= the entry's 워크트리, or - when it is empty; the act writes the slice's own 상태=머지됨 · 출처=매니페스트 row and no planned row, so do not dispatch it, and its dependents are planned by the rule above once its segments[] entry reads "착지": true. A refusal with exit 3 here ends the shift as the predecessor import's refusal below does. A 머지 순서 token with no row yet (that slice still waits on its own 선행) defers the slice until the row appears, and a slice carrying both lists follows the same product: with D 선행 A and D 머지 순서 C, D waits for C's row even after A has landed. Planned earlier, the slice is refused with exit 2 by the floor that requires every token to name a segment this ledger knows. The two imports below — a predecessor an earlier run already merged, and one the manifest's 선행 착지 row names — apply to a 머지 순서 token as well, and the planning act writes that predecessor's row itself; without them the row would never appear and the slice would never be planned. With C 머지 순서 B and B 선행 A, B is planned after A lands, and C is planned once B's row exists and runs alongside B. Pass no 머지 순서 on the planning row: the gate writes it from the declaration and carries it forward. A predecessor an earlier run of the same document already merged needs no row from this loop: the planning act above finds it in that run's ledger, checks its 머지 커밋 against the base branch, and writes its terminal row with 출처=<that run's id> before the slice's own row — so plan the dependent slice directly, and never hand-write a segment row for the predecessor (a caller's 출처= is refused). A predecessor no run ledger records is brought in the same way from the manifest's 선행 착지 row, which the kickoff froze after a person confirmed it — the row is written with 출처=매니페스트, and for a repository this run does not target the gate asks the remote whether the commit is on its default branch. When that check refuses with exit 3 (the earlier merge or the row's commit has not landed, cannot be judged, or still owes its apply, or the row's slug is not the slice's 레포), the refusal names where it looked; write nothing more and end the shift with a 사유=중단 handoff, as for the structural refusals below. A slice with no segment row has nothing a shift-halt can stop, so this stays a handoff. A refusal with exit 2 saying a token 「is declared in the frozen document and has no segment row on this ledger yet」 is a deferral, not an ending: write nothing, make no 사유=중단 handoff, say nothing of a new run, and plan the same slice again once that token has a row. Any other refusal with exit 2 naming a predecessor that no ledger shows landed — a slice the document does not declare, or one whose 레포 is not a target of this run — is the same ending: a run cannot gain a 선행 착지 row after its kickoff, so say in the handoff that a new run with that row is what plans the slice. When an earlier pass already made the slice's derived branch and worktree (the 슬라이싱 entry's branch and worktree), planning it again does not cut them a second time: skip calls 1 and 2 and issue call 3 alone. When a slice is planned, dispatch its implementation with the stage form above. Two refusals are structural: 선언불완전 (the refusal names the slice and the missing fields) and a resolved review policy other than 리뷰없음 on a plan that has no review step. The gate leaves the run-scope block for either inside the refusing act — this loop cannot create a run-scope block — so write nothing more and end the shift with a 사유=중단 handoff.
A slice whose 슬라이싱 entry carries 입양 is a segment an earlier run cut, handed to this run by the manifest's 세그먼트 입양 row: its 브랜치 and 워크트리 are that run's, and 입양 names the run — or is - for a branch a person cut outside any run, which has no earlier run, ledger or halt answer and is otherwise routed the same way. The branch and the worktree already exist, so skip calls 1 and 2 and issue call 3 alone, with 워크트리=<슬라이싱 의 워크트리> as for any slice. The gate plans it only when that worktree is the target's, has that branch checked out, the earlier run did not land the segment, and none of the earlier run's stages is still running on it; on its refusal (exit 3, naming which) write nothing more and end the shift with a 사유=중단 handoff — except a refusal ending in 거절 부류: on an entry that carries 머지 입양 too, which the next paragraph routes. An answer the earlier run took and never handed on comes first. When the earlier run's ledger holds a person's 중단 답 on the segment that no later stage-result row of it took up, and that answer is 재수렴 to an implement stage's binding-tier stop (CFI-U3 BT-STOP) or one an 이월 row of that ledger names (a carry act of that run found no account with room before its deadline and kept the answer for the next run), or — with no such row — a 좌석 실행 answer to an implement stage's seat-run stop (a step beginning Step 3 잔여 검증 좌석 실행 or Step 3 게이트 도달 좌석 실행) followed in that ledger by a 사유=마감 초과 — <segment> row and no stage-result row of the segment, the planning act copies the halt record under this run's halt/ and writes the answer as this run's own 중단 답 row with 출처 런 and 출처 기록; read the snapshot again and route the answered_halts[] element, whose origin_run names the run the person answered in, by 「Handing on a person's answer to a halt」 before the first stage below — a binding-tier 재수렴 by item 5, an answer an 이월 row named and a 좌석 실행 answer by item 3's carry act. Until that carry act takes the answer, the gate refuses every other dispatch on the segment, the first stage included, with exit 3 and names the --carry-answer line. Any other open answer stays with the earlier run — its route re-attaches the halted session, which is that run's — and the planning act names it in a warning; carry that warning into the handoff's 막힌 지점 so the seat can put the question to the person again, and go on with the first stage. A person's 승인 at the shift's 강제 표면 승인 stop is neither carried nor warned about when the earlier ledger vouches for it: its approval rides this run's manifest as 강제 표면 승인 rows. An adopted segment's first stage is a full review, not the implementation, when the entry's PR is a number — its code is already on the branch. Push the branch first (gate.sh exec … -- git push origin <슬라이싱 의 브랜치>) so that the pull request's head is the worktree's HEAD, then dispatch the review of the pull request the entry's PR names, the way a segment's first review is dispatched; its findings come back through 「Re-dispatching the implementation after review findings」. Open no pull request for it: PR is the segment's pull request, and the merge row carries that number. When the entry's PR is -, the earlier run stopped the segment before its pull request, and its first stage is the implementation. Push nothing. First read the remote once with gate.sh act --kind remote-check --target <alias> --segment <id> --cutpoint 커밋 --surface 읽기 --reach 협업 (nothing after --), so this run's ledger holds the segment's own 원격 판독 row — a run after this one reads its adoption evidence there. Then, with an answer brought in, its carry act above is the first stage; without one, dispatch the implementation in the stage form above, as for a slice no run cut. From there it is routed like any other slice: review, then the pull request opened on the ordinary path, then the merge.
A slice whose 슬라이싱 entry carries 머지 입양 is a pull request merged outside this run, handed to it by the manifest's 머지 입양 row for a review after the fact; 머지 입양 names the pull request. When the entry carries 입양 too, the open fix pull request an earlier run left comes first: route the segment by the paragraph above, in that row's branch and worktree, and its first review — of the fix pull request — covers the merge as well, because the fix branch was cut from a base past it. Otherwise plan it as any slice: calls 1 and 2 cut its branch and worktree from origin/<베이스>, and call 3 plans it. Pass no 리뷰 정책 on its planning row either way: the planning act resolves the policy to 선리뷰후머지 itself, and the gate refuses any first row of the segment other than that --from-declaration act or a park. The planning act reads the pull request on the remote again, fetches its head, and writes the segment's 리뷰 의무 row before its planned row. Its refusal (exit 3) parks the segment, not the shift, and its text ends with the refusal's class. When the entry carries 입양 too, its branch and worktree are the earlier run's and may hold that run's uncommitted or unpushed fix, so the refusal removes and deletes nothing: on 거절 부류: 재시도 가능 issue call 3 alone once more, and a refusal with no class, first or second, is the paragraph above's and ends the shift as that paragraph says. Otherwise, on 거절 부류: 재시도 가능 take call 1, gate.sh exec … --target <대상> --surface 워크트리쓰기 --destructive -- git worktree remove --force <워크트리>, gate.sh exec … --target <대상> --surface 워크트리쓰기 --destructive -- git branch -D <슬라이싱 의 브랜치>, call 2 and call 3 again once, in that order — the removal leaves the branch the first call 2 cut, which holds no commit of its own yet, and call 2's -b fails on a branch that exists. Either way, on a second refusal, on 거절 부류: 영구, or when call 1 or 2 fails, write act --kind segment --target <대상> --segment <id> -- 상태=park 워크트리=<워크트리> 선행=없음 and a blocked row saying why, and go on with the shift. The gate takes that park as the first row of a 머지 입양 segment with no planning row, as it does for a 리뷰 PR segment, and a refused planning act wrote no 리뷰 의무 row, so no open obligation holds the run on the parked segment. Its first stage is a review, not the implementation: while review_next[] reads 사후리뷰, write 상태=사후리뷰 and dispatch the line gate.sh review-line prints, unchanged, with --trigger '첫 리뷰', then record its cycle row with the report's 리뷰 HEAD, which is the line's --judge-head value. Then branch on review_next[] (「Branching on 다음 after a review」): 입양 종결 closes the segment with no push and no pull request, and a fix takes the ordinary 선리뷰후머지 path on the segment's own branch — record act --kind obligation once a passing review covers the fix, before that fix merges.
The decisions are collected before the first implementation plans. The gate's first process A implement dispatch of the run collects every 구현 전 결정 entry of the design document into one halt record, halt/decision-collect-<digest 12>.md, which lists each entry with its recommendation, and writes a 결정 수거 row naming the segments the entries reach. A process A dispatch of such a segment is refused with exit 3, the refusal naming the record, whether the record was answered or not. That refusal is not a park and needs no row: count the segment as waiting on a person, as the snapshot's decision_holds[] shows it, and go on dispatching the segments it does not hold. The record is a person's question — the seat asks it, and the answer comes back through 「Handing on a person's answer to a halt」 with route 구속-재수렴. When only held segments are left and nothing else can move, end with 사유=중단, naming the record in 막힌 지점.
Reviewing pull requests on a reviewer run
A reviewer run reviews pull requests other people wrote and posts one review on each. It never writes the author's branch: the gate refuses (exit 3) a git push or git commit on a review-only segment, an implement dispatch, a lead fix or --lead-fix review, a merge and gh pr create. Do not re-dispatch anything to fix a finding — the review's findings go to the author through the posted review and nowhere else.
The snapshot's 리뷰 세그먼트[] is the read: one element per 리뷰 PR row, in row order, with id (P<k>), 대상, PR, 슬러그, 베이스, 워크트리 and 상태 (미계획 before its planning act). Plan every 미계획 element in this shift, in order, with three calls, and dispatch its review at once — reviews of different pull requests run side by side within the lane bound:
-
gate.sh exec … --target <대상> --surface 워크트리쓰기 --reach 협업 -- git fetch origin +refs/pull/<PR>/head:refs/cc-review/<run id>/<id> +refs/heads/<베이스>:refs/cc-review/<run id>/<id>-base. -
gate.sh exec … --target <대상> --surface 워크트리쓰기 -- git worktree add --detach <워크트리> refs/cc-review/<run id>/<id>. -
The plan row, which pins the pull request's head:
gate.sh act --manifest <매니페스트> --kind segment --target <대상> --segment <id> \ --cutpoint 커밋 --surface 읽기 --snapshot-digest <H> --review-pr \ -- 상태=계획됨 워크트리=<워크트리>The gate reads the pull request's current head from the remote and writes
종류=리뷰전용 고정 헤드=<sha> 베이스 sha=<sha>only when it equals the worktree's HEAD. On exit 3 saying the head moved, take calls 1, the removal, 2 and 3 again once, in that order: call 1, thengate.sh exec … --target <대상> --surface 워크트리쓰기 --destructive -- git worktree remove --force <워크트리>, then call 2, then call 3. The fetch movesrefs/cc-review/<run id>/<id>, and the worktree is made again at it rather than moved: until the plan row is written the segment has no row, so the gate runs every call in the target's main worktree, a--segmentcall included, and a checkout issued there moves the person's main checkout instead of the review worktree. Nothing is lost by the removal — no review has started in that worktree yet. A segment that cannot be planned is parked, not halted — a second head-moved refusal, any other exit 3 of call 3, or a call 1 or 2 that fails (a pull request closed overnight leavesrefs/pull/<PR>/headunfetchable): writeact --kind segment --target <대상> --segment <id> -- 상태=park 워크트리=<워크트리> 선행=없음and ablockedrow saying why. The gate takes aparkas the first row of a리뷰 PRsegment that has no planning row, andshift-haltcannot stop a segment that has no row at all.
Dispatch the review from gate.sh review-line unchanged (「Spelling a review dispatch」), with --trigger '첫 리뷰'. For a review-only segment the line names the pull request's URL instead of a branch and carries --base-sha <베이스 sha> --pr-head <고정 헤드> --depth <깊이> --post-ready; the stage's session starts in the target's main worktree, and it reads the detached worktree through acts carrying --segment, which run there. Record its cycle row as for any review.
When 다음 reads 게시, post the review — the one value review_next[] has for a review-only segment whose review ended 정상 완료:
gate.sh act --manifest <매니페스트> --kind review-post --target <대상> --segment <id> \
--cutpoint 커밋 --surface 외부상태변경 --snapshot-digest <H> -- 게시
The gate renders the review from the report's ## 게시 항목 and the run's wording file, posts it once as the frozen 리뷰 게시 row says (보류 leaves it pending for a person to submit; 직접 submits it), reads it back and writes the 리뷰 게시 row. After 대조=일치, write act --kind segment --segment <id> -- 상태=완료 워크트리=<워크트리> 선행=없음. With no dedicated write credential the gate posts under this host's gh login, still checks it against the frozen account, and records 게시 자격=주변 on its rows. On exit 3 the refusal names one of three sites — 리뷰 게시 거절 (no write credential and no readable gh login, a login other than the frozen account, a 4xx, or an unknown outcome; the refusal line says which), 게시 대조, 보류 리뷰 선점 — so stop the segment there with shift-halt (「Stopping one segment for a person」) and go on with the others; never post the review another way, and never edit or delete a posted one.
Clean up once the segment is 완료 or park: gate.sh exec … --target <대상> --surface 워크트리쓰기 --destructive -- git worktree remove --force <워크트리>, then git update-ref -d refs/cc-review/<run id>/<id> and git update-ref -d refs/cc-review/<run id>/<id>-base the same way (워크트리쓰기). A segment whose call 2 never made the worktree (a call 1 or 2 that failed before the park) skips the git worktree remove — there is no worktree to remove, and the call fails on the missing path — and still takes both git update-ref -d calls, which pass on a ref that is not there. The gate takes propose-done on a reviewer run only when every P<k> segment's last row is 완료 or park; settle the clauses as 「Settling the termination clauses and proposing done」 says, citing each segment's 리뷰 게시 row as 리뷰 id=<id>.
Pushing and opening a pull request
No run skill opens a new segment's pull request; you do, from the snapshot. Every segments[] element carries 브랜치, HEAD, 원격 팁, PR (번호, 상태, HEAD), 원격 단계 and 리뷰 줄.
The target's cutpoint comes first, because 원격 단계 does not read it. It says what the remote lacks, not what this target may do. Below push (커밋, 브랜치) nothing is pushed and no pull request is opened: the commit is the product, so dispatch the segment's review with 리뷰 줄 straight away, whatever 원격 단계 reads, and issue no remote-check. At push, push on push 필요 as below, and where it then reads PR 필요 open none — dispatch the review with 리뷰 줄. From PR up, branch on 원격 단계:
push 필요→ push the segment branch:git push origin <브랜치>, at--cutpoint push --reach 협업.PR 필요→ open the pull request:gh pr create -R <원격 슬러그> --head <브랜치> --base <베이스 브랜치> --title '<제목>' --body '<본문>', at--cutpoint PR --reach 협업, with the gate's--segment <세그먼트>. Write the body as## 변경,## 검증and## 관련 이슈·티켓, and put the output ofgate.sh pr-links --manifest <매니페스트> --segment <세그먼트>under the last one verbatim, each line whole. The gate refuses with exit 3 a create on a run with출처 티켓rows whose body lacks one of those lines or that it cannot read —--fill,--template,--editor,--web,--recover,--body-file -or no body argument.PR 있음→ dispatch the review with리뷰 줄(「Spelling a review dispatch」), and carryPR.번호asPR=on the segment's머지됨row. Not on a선머지후리뷰segment whoseimplement_next[]orreview_next[]reads선머지or a CI value in its place: that segment merges before it is reviewed, so go on with The merge-first loop step 1 instead.머지됨→ 「Merging and applying a segment」 takes it from the record.불일치→ the remote tip is not an ancestor of the worktree HEAD, or the pull request's head is another commit, or two pull requests are open: stop the segment at sitepush원격불일치(「Stopping one segment for a person」) with the tip, the PR head and the worktree HEAD in관측.미상→ the last read is not of the live HEAD, or it failed: read the remote again, then the snapshot again. A second미상in a row is a failed read; route the other segments and come back next shift.
gate.sh act --manifest <매니페스트> --kind remote-check --target <alias> --segment <id> \
--cutpoint 커밋 --surface 읽기 --reach 협업 --snapshot-digest <H> --rationale '원격 판독 — <id>'
Nothing goes after --; the gate reads the branch's remote tip and pull request and writes a 원격 판독 row when either changed. Read it again after every push or pull request you issue, so the next element shows the step that follows.
How to issue the push or the pull request depends on the issuing root. When this session's root carries no Bash hook of its own, issue it through gate.sh exec as any other act. When it carries one — the instruction paragraph headed "Remote commands under this repository's own Bash hook" is in your instructions — issue the command bare, as the plain command itself. The run's hook refuses that first issue and records the bytes as a request; then call
gate.sh admit --request last --manifest <매니페스트> --target <alias> --segment <id> \
--surface 외부상태변경 --reach 협업 --snapshot-digest <H> --rationale '<왜>'
with no --cutpoint (the gate derives it from the recorded words) and nothing after it, and issue the same bytes once more, verbatim, from the same directory, within the three hundred seconds the gate prints. Do not put the command's words into --rationale. Exit 3 from admit names why: the target's hook refuses the command (a 대상 거절 row is written), the request expired or is another caller's, or the root is not the target's own checkout while the target is hooked. A push that takes its source from the checked-out branch — a HEAD or @ refspec, or no refspec at all — outside the segment worktree is refused too with exit 2: the bare command runs in this session's directory, so spell the remote and the branch (git push origin <브랜치>). A push with anything before git — env, command, nice and the like — is refused with exit 2 from any directory: issue it as the plain git command. A ticket for a push is honoured only while that repository's HEAD, refs (branches, tags, remote-tracking refs, FETCH_HEAD) and push settings are the ones the gate graded; after a commit, a fetch or a changed setting in between, issue the push bare and admit it again.
Read guard_refusals[] before you issue a remote act. Each element is a refusal by a target's own hook: 형태 (감쌈 a gate call, 맨 a bare command), 명령, 거절 문면 and 조건. While 조건 reads 같음 the gate refuses the same act in the same form with exit 3 — do not issue it again. It reads 바뀜 once one of the five elements moved — a commit on the segment worktree, an edit to the guard script or settings.local.json (never settings.json while the run is open — that file is part of the gate's enforcement surface and moving it voids the run), a remote tip or pull request a remote-check read, or a 재시도 answer to the segment's 대상 훅 거절 record — and then the act may be issued once more. When the refusal blocks an act the segment cannot do without and nothing you can do moves the condition, stop the segment at site 대상 훅 거절, naming in 관측 the element's 행위 다이제스트 and its 형태 — the 대상 거절 row that digest keys holds the command and the refusal for the person — and asking the person, in 질문, to change the guard file or settings.local.json, or the act, and never settings.json while the run is open. Never copy 명령 or 거절 문면 into any gate argument — 관측, 질문, --rationale or a dispatch prompt: a gate call is itself a Bash command the same guard judges, so a call carrying the words the guard refused is refused too, the stop included. An element appears only after the next gate act settles the refusal, so read the snapshot again before looking for it.
Merging and applying a segment
Whatever the review policy, merge a segment only when its snapshot 머지 대기 is empty. A non-empty 머지 대기 names the predecessors, by 선행 or 머지 순서, that have not landed yet: do other work, or wait as 「Waiting on a stage」 chooses. A refusal with exit 3 that names such a predecessor and its 상태 means the same — wait — whether the refused act was the merge or another act leaving the worktree whose grade the gate could not read; it is not Any other cause below, and nothing is written for it. A predecessor that was parked has already parked this segment through its cone.
A segment a 머지 입양 row adopted records act --kind obligation before it merges, and does not merge when that act is refused. The obligation is the one its planning act issued, and the passing review that covers the fix fulfils it; record it before the base check, the merge and any apply. The gate refuses a merge or an apply of such a segment while that obligation is open (exit 3). A refusal that says the obligation is already closed (this review obligation is already closed) is not a refusal to merge on: the segment fulfilled it on an earlier arrival at 머지 and came back after a base resolution, so do not record it again and go on to the base check and the merge — the gate's own refusal above still holds the merge while the obligation is open.
Below the 머지 cutpoint nothing is merged. 다음 does not read the target's cutpoint, so a segment whose target stops at 커밋, 브랜치, push or PR reads 머지 or 이월 머지 once its review passes all the same — at PR only once the pull request's CI has a verdict, so such a segment goes through CI 대기 first and ends on 완료 after it. For it, check no base, merge nothing and apply nothing — the gate refuses the merge above the cutpoint, and a 머지됨 for a tip that has not landed. End the segment instead with its 완료 row, carrying the worktree HEAD the review read as its full 40-character sha, and at PR the pull request's number as PR=<n> as well:
gate.sh act --manifest <매니페스트> --kind segment --target <alias> --segment <id> \
--cutpoint <token> --surface 읽기 --snapshot-digest <H> \
-- 상태=완료 커밋=<구현 워크트리 HEAD> 브랜치=<브랜치> 워크트리=<구현 워크트리> 선행=<계획 행의 선행>
Check the base before the merge. Under 선리뷰후머지, once review_next[] reads 머지 or 이월 머지, first issue the pre-authorized gate.sh exec … -- git fetch against the target, then write the base check — nothing after --, every field is the gate's:
gate.sh act --manifest <매니페스트> --kind base-check --target <alias> --segment <id> \
--cutpoint 커밋 --surface 읽기 --snapshot-digest <H> --rationale '베이스 판정 — <id>'
The gate asks the remote where the base is (git ls-remote, never the local tracking ref), merges the reviewed HEAD with it in an object directory of its own, and writes a 베이스 판정 row: 일치, 이동 or 충돌. Read 다음 again. 머지 or 이월 머지 → merge as below. 베이스 해소 or 베이스 해소 한도 → 「Branching on 다음 after a review」. Exit 3 naming a fetch → the base moved after your fetch; fetch once more and check once more, once. Any other exit 3 names why the gate did not judge; read 다음 again, which says what comes first. The same check twice writes one row, so a check that changes nothing costs nothing.
The merge. For a segment whose resolved review policy is 선리뷰후머지, merge once its review has passed — its snapshot review_next[] element reads 다음 머지 (P0 and P1 at zero, or findings a person dismissed at the seat with a 리뷰 기각 row the gate honours only while that cycle stays the segment's last) or 이월 머지 (its open P1 findings were carried over to issues; see 「Branching on 다음 after a review」) — On a routed run 다음 carries the segment's CI state too: 머지 and 이월 머지 mean the worktree HEAD's observed checks are not recorded as failed, not still running and not waiting on a rerun's result — on a target whose cutpoint is PR, 머지 or 배포 a HEAD with no checks row yet reads CI 대기, and only a 통과 or round 0's 미등록 five minutes old lets the merge through; below PR such a HEAD keeps the table's value — and only on those values do you check the base and merge. A failing check, required or not, reads as one of the fourteen CI values instead (「Branching on 다음 after a review」). Never send gh run rerun, a rerun or re-request REST path, or the rerequestCheckSuite mutation — the gate refuses every spelling of them; a rerun is act --kind ci-rerun. A label on a pull request is act --kind label-ack and nothing else — the gate refuses every other write of a pull request's labels. The merge is pinned to the implementation worktree's HEAD as its full 40-character sha with the REST merge: gh api -X PUT repos/<owner>/<repo>/pulls/<n>/merge -f sha=<구현 워크트리 HEAD> -f merge_method=merge. The gate refuses any other value (see Bind a remote merge below) — not the 리뷰 HEAD of the last cycle row, which may be recorded abbreviated; the review rule is what checks that the review read that HEAD. A gh pr merge without --admin is refused as unbound even with --match-head-commit, and the branch is not deleted in this argv. When the REST merge is refused with 405 — GitHub's "merge cannot be performed" — the status does not say why, so read the response body's message and gh pr view <n> --json state,headRefOid,mergeCommit,mergeStateStatus through the gate before writing anything, and branch on the cause:
- Already merged (
statereadsMERGEDandheadRefOidequals the implementation worktree's HEAD, all 40 characters — an earlier shift's merge whose record did not land, or a person's that merged what the review read): park nothing; go on to the상태=머지됨record below with thatmergeCommit.MERGEDwith any otherheadRefOid, or a상태=머지됨record the gate refuses, is the last bullet's case, not this one: a commit was added to the pull request after the review, or the merge rewrote the commits into ones the gate cannot match to the worktree's tip. Recording it would put a merge of unreviewed content down as reviewed, and leaving it unrecorded would send the same merge every shift, so take Any other cause withMERGEDand theheadRefOid(or the refusal) as its사유. - A required check not finished yet (the
messagenames a required status check as expected or not yet succeeded, andgh pr checks <n> --requiredshows it pending rather than failed): this is not a refusal of the merge and nothing terminal is written. Read the checks once (gh pr checks <n> --required, through the gate) and do not watch them inside your turn. Still pending → write no block and nopark; route other work, and when nothing else is dispatchable end with대기carrying'CI 대기=<id>'as Waiting on a stage describes. The gate wakes your successor when that segment's CI reaches a verdict, and the successor sends the same merge once more when the required checks read green. - A failed check, required or not → read
다음again and take its branch. Only when it still reads머지or이월 머지is it the next bullet's case, at site병합 거절. An exit 3 merge refusal that names the checks is read the same way: read다음again. - Any other cause — a base that requires a merge queue, a missing required review, a conflict: no bound merge passes the gate and that merge goes to a person: instead of ending the shift with a
사유=중단handoff, stop the segment at site병합 거절(「Stopping one segment for a person」), with the 405 and the response body'smessagein관측, and go on with the other segments. No shift sends the same merge again until the answer comes back. A conflict is the base check's first. A 405 whosemergeStateStatusreadsDIRTYgoes back to Check the base before the merge once — fetch,base-check, read다음— and takes this bullet only when다음still reads머지or이월 머지after it. Never merge or rebase the moved base into a branch yourself: only a베이스 해소dispatch does that, and what it adds is reviewed before it merges.
Under any other policy pin the same way. Under 선머지후리뷰 the merge comes before the review (The merge-first loop below) and the apply follows it as it does under 선리뷰후머지; under 리뷰없음 issue no apply act afterwards. Either way read gh pr view <n> --json mergeCommit and record it:
gate.sh act --manifest <매니페스트> --kind segment --target <alias> --segment <id> \
--cutpoint <token> --surface 읽기 --snapshot-digest <H> \
-- 상태=머지됨 PR=<n> '머지 커밋=<M>' 워크트리=<구현 워크트리> 선행=<계획 행의 선행>
Every segment row this loop writes for the segment, this one and a park alike, carries the plan row's 선행 again. The gate does not trust 머지 커밋; it checks it when the apply act runs.
The apply. After the 머지됨 row is written, read the snapshot again and look at 적용 on that segment's segments[] element. 없음 → the merge is the segment's end — it has no apply command, its cutpoint is below 배포, or its handover to a person is already recorded — so issue neither the fetch nor the apply act. 미정산 → the segment came in from an earlier run that merged it and never said how its apply ended: never issue act --kind apply on it. While it is in the snapshot's apply_unsettled, fetch and settle it with act --kind apply-settle and no answer, as for any segment in that list — the gate measures it once with the earlier run's ledger as evidence; once it is in apply_imported, the gate already measured it or its evidence did not stand, and a person settles it at site 들여온 적용 정산. 대기 or 인계 → first issue the pre-authorized gate.sh exec … -- git fetch once more: the merge happened on the remote, and until a fetch the local clone holds neither M nor an origin/<베이스> that contains it. Then:
gate.sh act --manifest <매니페스트> --kind apply --target <alias> --segment <id> \
--cutpoint 배포 --surface 외부상태변경 --snapshot-digest <H> -- 적용
The argv is the fixed token 적용; the gate checks five preconditions it does not let any rule switch off, writes 적용 준비 and returns, and a supervisor it starts runs the frozen apply command and writes the ending — 완료, or park with the gate's own blocked row. An exit 0 whose segment's last row reads 적용 준비 means the apply is running: read live_applies in the snapshot, route the other segments, and when that apply is all there is left to wait for, end with 대기. Do not write either state for a segment that still has an apply pending: the gate refuses both from act --kind segment. An apply act that reaches a segment owing no apply is answered with 적용 불필요 and exit 0, and the gate writes nothing: that too is the segment's end, not a refusal. A 선머지후리뷰 segment applies after its merge and before its deferred review: the gate takes the segment's open 리뷰 의무 row in place of a passing cycle and compares its 머지 커밋 with the merge commit's second parent, so issue the apply on its 머지됨 row without waiting for the review, and after a second merge issue it again on the second 머지됨 row. When the apply act is refused on a precondition: a missing or stale remote ref (precondition 4) → fetch and issue it once more, and only once. Any other precondition refusal → instead of ending the shift with a 사유=중단 handoff, stop the segment at site 적용 전제 거부 (「Stopping one segment for a person」), with the refused precondition number and the gate's wording in 관측, and go on with the other segments. No shift walks into the same refusal until the answer comes back. When the apply itself fails before its command ran, the supervisor has written the segment's park 적용=사전 실패 row and an act-scope blocked row — on a later snapshot, after an apply act that returned 0, so write no shift-halt for it: a park segment is terminal and no answer could retry its apply. It is act scope, and the other segments go on. An exit 11 on an act of a segment that the segment cannot do without — a push whose remote disagrees, or any other reach the gate refused — stops the segment at site push원격불일치 or 도달 거부, never retried by you. A dispatch's 11 that left the segment's key a last row carrying 차단=파견 전 stops nothing: it is a size block, not a reach the gate refused, and the gate refuses 도달 거부 on it.
A target whose applies are stopped. Before the fetch of the apply paragraph above, look the segment up in the snapshot's apply_target_stopped. A 대기 segment it lists → the target's applies are stopped on an earlier segment's target defect: issue neither the fetch nor the apply act and write no shift-halt — the apply act would only write the act-scope 대상 적용 정지 <별칭> row and return 0 — and go on with the other segments; the segment leaves that list when the stopping segment settles 완료 or a person answers it 세그먼트 park, and is applied then.
Settling an apply that did not say how it ended. When the supervisor cannot tell how far the command got, it writes park 적용=불명 and a run-scope blocked 사유=적용 불명 <id> row — except on a target defect (the command exited 0 and the post probe still reads 필요) of a target whose 폭발 반경 is not 런 and on which no other repository's segment waits: then the park row carries 고칠 곳=대상 레포 and no run-scope row is written, only that target's later applies stop, and a settlement that measures 필요 again opens no run-scope row either; when it was cut off, the last row stays 적용 준비 with no supervisor alive. Either way the segment appears in the snapshot's apply_unsettled, and that run-scope row is not a reason for a 사유=중단 handoff. For each such segment issue the pre-authorized gate.sh exec … -- git fetch first — the settlement reads M and origin/<베이스> from the local clone as the apply does, and a stale clone parks it as 측정 실패 — then:
gate.sh act --manifest <매니페스트> --kind apply-settle --target <alias> --segment <id> \
--cutpoint 배포 --surface 외부상태변경 --snapshot-digest <H> -- 정산
The argv is the fixed token 정산. The gate pins a fresh worktree at M, runs the frozen probe once, and writes 완료 적용=정산 when the probe says the apply is in, releasing the block and removing the apply worktrees. Exit 3 is a refusal that writes nothing — a supervisor still alive or just launched, or a segment that is not at a settlement entry — so route the others and read the snapshot again later. When the settlement ends in park … 정산 판정=필요|측정 실패, stop the segment at site 적용 정산 (「Stopping one segment for a person」); the gate measures the same park again only after that site's 재시도 answer. An imported segment — 머지됨 적용=미정산, brought in from an earlier run — is settled the same way while it is in apply_unsettled: fetch, then the same act with no answer; the gate reads the ledger of the run that did the work as evidence and measures once. When that settlement ends with the park exit code, read it neither as an exit 11 the segment cannot go on without (push원격불일치, 도달 거부) nor as the 적용 정산 site: the gate wrote a 들여온 정산 row and left the segment row as it was, so a stop at 적용 정산 is one the snapshot drops. Read the snapshot again — a segment now in apply_imported is stopped at 들여온 적용 정산, and one still in apply_unsettled (no verdict row was written) is read as 도달 거부 under the rule that applies now. Its exit 3 — an earlier run still alive, or a verdict already recorded — raises no stop: route the other segments, and a later shift opens it again as the snapshot says. A segment in apply_imported — one the gate already measured or whose evidence did not stand, with no 재시도 answer since — is stopped at site 들여온 적용 정산 at once, and a person's answer is carried out as 「Handing on a person's answer to a halt」 item 6 says.
The merge-first loop. A segment whose resolved review policy is 선머지후리뷰 and whose cutpoint is 머지 or 배포 merges first and is reviewed after, and the review it defers is recorded as a 리뷰 의무 row the merge issues. Its loop, in order:
implement_next[]reads선머지, or on a routed run one of the CI values its CI layer puts in that place (CI 대기and the rest) → first bring the branch to an open pull request, whatever the value: take 「Pushing and opening a pull request」 on원격 단계— push onpush 필요, open the pull request onPR 필요, read the remote again after each — until it readsPR 있음, which on this segment means go on here, not dispatch a review. The CI layer reads the checks of that pull request, the poller reads only an open one, and no stage opens it — the implementation and the lead fix commit and push only — so aCI 대기on a segment with no open pull request waits on checks nothing will start. Once원격 단계readsPR 있음, route a CI value as 「Branching on다음after a review」 routes it, and on선머지itself fetch andact --kind base-checkas Check the base before the merge says; the gate judges the worktree HEAD, since no review HEAD exists yet.- Merge with the REST merge bound to the worktree HEAD, as The merge above spells it — the binding is checked under
선머지후리뷰as under선리뷰후머지. Record상태=머지됨withPRand머지 커밋, then take The apply below when적용reads대기or인계. - Write
상태=사후리뷰(with워크트리and the plan row's선행) once the merge and any apply are recorded. The gate takes the row only on a선머지후리뷰segment that has a머지됨row and a리뷰 의무row; it reopens the segment, so condition 1 keeps the run open until the deferred review settles.review_next[]reads사후리뷰while nocyclerow follows the last머지됨row; when the segment's last row still reads머지됨, write the사후리뷰row first. - On
사후리뷰dispatch the review fromgate.sh review-lineunchanged: it carries--base-sha <분기점>— the fork point the segment's first merge recorded on its리뷰 의무row, since this path writes no베이스 sha— and--post-merge <커밋>, and the review re-runs the design's checks on that commit. The commit is the merge commit, or the worktree tip when the branch carries commits past the merged tip (a lead fix not merged yet). After a merge that follows the lastcyclerow, the gate dispatches this review even on the HEAD that cycle already read. Record itscyclerow, thenact --kind obligationagainst the obligation the merge issued. - Read
review_next[]again and take the table's value.머지or이월 머지→ do not merge again: the segment is done, so write상태=완료(the gate refuses it while an apply is still owed).선머지, or on a routed run a CI value in its place → a lead fix added commits after the merged tip; go back to step 1, which opens the new pull request before any CI wait.수정→ dispatch the re-implementation as 「Re-dispatching the implementation after review findings」 says; once it ends,implement_next[]reads선머지again.
A merged pull request takes no new commit. When the branch of a merged pull request gains commits — a re-implementation or a lead fix after the post-merge review — push them to the same branch, open a new pull request from it, and carry the new number as PR=<n> on the segment's next row; the second merge is bound and recorded as the first was. The gate refuses it while the earlier 리뷰 의무 is still unfulfilled, so record the post-merge review's obligation act first; the second merge then issues a new 리뷰 의무 row of its own.
Routing a segment after its implementation ends 정상 완료
A process A that only emitted its plan and a process B that carried it out both end 정상 완료, so the last stage's row cannot say whether the branch now has anything to review. The snapshot's implement_next[] says it: one element per segment whose last stage-result row is an implement stage that ended 정상 완료, with 다음, 단계, plan_sha256, 앞선 커밋 and 무커밋 구현. When a segment has an element and is in none of live_stages[], orphan_stages[] and waiting_stages[], this subsection decides its next act; an answered_halts[] element on the same key still comes first, through 「Handing on a person's answer to a halt」. Do not dispatch a review for a segment whose element reads a 다음 other than 리뷰. Such an element comes before the segment's review_next[] element too: after a re-implementation's process A, review_next[] already reads 확인 리뷰 while this element reads 구현, and the implementation goes first — the gate admits it past the cycle cap for that reason. The value is the gate's, derived from the ledger and the segment worktree, and no stream, memory or git probe of your own overturns it.
리뷰→ the last run carried a plan out and the branch is ahead of its base. Dispatch the review as 「Spelling a review dispatch」 says.선머지→ the same, on a segment whose resolved review policy is선머지후리뷰and whose cutpoint is머지or배포: the segment merges before it is reviewed. Dispatch no review; take The merge-first loop below. On a routed run the value carries the segment's CI state as머지does after a review — a HEAD with nochecksrow readsCI 대기, a failing check reads one of the CI values with the element'shead sha,PRand실패 체크beside it — and each CI value is routed as 「Branching on다음after a review」 routes it once the loop's step 1 has the pull request open; only선머지itself goes on to the merge.구현→ the last run only emitted its plan, or the branch has no commit over its base. Dispatch the implementation in the form 「Re-dispatching the implementation after review findings」 shows,<n>being the segment's lastcyclerow's사이클, or1when it has none, and· 수정 대상: …added only when the segment'sreview_next[]element reads수정orCI 합류 수정— with theCI 합류: <head sha>line as well on the latter. Write no phase into the prompt: the stage resolves A or B from the ledger itself. When the gate refuses the dispatch (exit 3), do not fall back to a review: write a segmentparkrow and a스코프=coneblock with'사유=구현 재파견 거절'and the refusal text in근거. An exit 3 whose refusal text names 「파견 자리 대조」 is the dispatch-site comparison, on any implementation dispatch — the first one, the구현branch or the re-dispatch after review findings: write a segmentparkrow and a스코프=coneblock with'사유=구현 재파견 거절'and the refusal text in근거, and dispatch its implementation no more. It is not the cycle cap's exit 3, so do not read다음and step onto the ladder. A segment whose선언 파일reads판정불가is not skipped: dispatch it, and this refusal is how it stops.사람→ three implementation runs after the segment's last void boundary left no commit. Write a segmentparkrow (with the plan row's선행) and a스코프=coneblock with원인=막힘and'사유=무커밋 구현 한도', whose근거names the element's무커밋 구현, itsplan_sha256and앞선 커밋 0, and go on with the other segments.판정 불가→ the segment worktree is gone or no base ref resolves, so whether the branch carries a commit cannot be read. Write a segmentparkrow and a스코프=coneblock with'사유=구현 산출 판정 불가'.
Spelling a review dispatch
Every review dispatch of a segment starts from the line the gate prints. gate.sh review-line --manifest <매니페스트> --segment <seg> [-- <flag>…] prints the whole prompt, built from the segment's rows the way the fixed-graph driver builds its own: /cc-cmds:review-unattended <브랜치> --report-path <abs>[ --slice <seg>][ --base-sha <sha>][ --post-merge <sha>][ --merged <sha>][ --declared-files "<집합>"][ --seat-commits "<목록>"][ --expand <값>][ --basis-cycle <n> --basis-review-head <sha> --basis-report-path <abs>][ <flag>…] "설계는 <문서 인자>" — --expand only when the frozen plan's review_expand opens a review field; --post-merge only on a 선머지후리뷰 segment past its merge, naming the merge commit its 머지됨 row recorded or, when the worktree carries commits past the merged tip, the worktree tip; on such a segment a missing 베이스 sha is filled from the fork point its first 리뷰 의무 row recorded. --merged only on a 선리뷰후머지 segment a person merged before a review covered it — its last 머지 대조 reads 위반(미포함) or 위반(카운트·미포함) — naming the merge commit its last 머지됨 row recorded; on such a segment a missing 베이스 sha is the merge-base of that merge commit's first parent and its recorded worktree's tip, unless the merge commit is that tip or one of its ancestors, or its first parent already holds that tip — a fast-forward merge, onto the tip or onto commits pushed to the branch past it, which the gate refuses with exit 3 — and the line carries the three --basis-* flags of its last full cycle when it has one, so the covering review runs as a delta of that cycle. Such a segment's line already carries its basis flags; add none after --. On a segment a 머지 입양 row adopted, while its worktree carries no commit over its base, the line names the adopted pull request's URL instead of a branch and carries --base-sha <분기점> --merged <머지 커밋> --judge-head <워크트리 HEAD> — the fork point and merge commit of the segment's 리뷰 의무 row and the tip of its worktree — before the same tail; the gate rebuilds those three values at the dispatch and refuses one that drops or changes any of them, and it prints no line (exit 3) while that commit count cannot be read. Once a fix commit is ahead, or once a fix of its own merged outside the run, the line is the branch line any 선리뷰후머지 segment gets, with no --post-merge. The branch and the declared set are the last values the segment's rows carried — a clipped set is read back whole from the file its row names — and the report path is the next cycle's, so a review sent again after a crash names the same report. The flags this dispatch adds go after --: --recheck <리포트 경로> for a re-check, the three --basis-* flags of a delta, the three --resolve-* flags of a resolution review, and --no-slice for the one review that answers a refused other-slice section, which drops --slice and never reaches the prompt. The gate puts them before the 설계는 directive, because the review reads its document argument from there to the end. Pass the printed line as the one argument after -p, in single quotes, under -- review -p '<line>', and change nothing in it: its --report-path is the cycle's canonical report, and the gate refuses a review dispatch naming any other (exit 2). Declare why the review goes with --trigger '<토큰>' before --, on the act and on its plan alike: one of 첫 리뷰, 리뷰 P0, 리뷰 P1, CI 실패, 베이스 충돌, 버전 경합, 리베이스, 해소 리뷰, 중단 답, 중단 인계 that the ledger stands behind for the segment, or 라우터 판단 together with --trigger-reason '<사유>' only when none of those holds. Anything else is exit 2 with no row, and the refusal prints the tokens that hold, so redeclare one of them; a recovery dispatch declares none. The lead fix takes only the line's branch and directive (「Branching on 다음 after a review」), and the recovery dispatch is spelled as 「Recovering a review stage that crashed」 says, with the report path of the review it recovers. Do not rebuild these arguments from an earlier stage's stream log or from memory: no row keeps an earlier prompt, and the grep that looks for one finds the skill's own text. Exit 3 means no row of the segment names a branch — there is nothing to review yet — or, on a segment that takes --merged, that the covering review's line cannot be built, which termination condition 11's exit 3 handling covers.
Re-dispatching the implementation after review findings
When a segment's review_next[] element reads 다음 수정, that review's stage-result row is 정상 완료, and the segment has no live stage, dispatch the implementation again with the review report as its fix target. The values are already in the snapshot's cycles[] and 문서 인자:
gate.sh act --manifest <매니페스트> --kind skill --target <alias> --segment <seg> \
--cutpoint <token> --surface 워크트리쓰기 --snapshot-digest <H> --emit-digest \
-- implement -p "/cc-cmds:implement-unattended <문서 인자> \"세그먼트 <seg> (사이클 <n>) · 선언 파일: <files> · 수정 대상: <리포트 절대 경로> 의 P0·P1\""
Carry the segment's enforcement-surface values into every implementation prompt. The snapshot's segments[] element of the segment carries 강제 표면 and 좌석 적용 커밋. Copy each into the prompt right after · 선언 파일: <files>, in the gate's spelling, as · 강제 표면: <값> and · 좌석 적용 커밋: <값> — in this form and in the first implementation a carried answer dispatches with 사이클 1 — and leave out the one whose value reads 없음. A carry act (--carry-answer <line>) is not such a prompt: its -p is the answer element's carry_prompt byte for byte, as 「Handing on a person's answer to a halt」 item 3 says, and you add neither value to it — the gate compares the prompt with its own build of the re-entry frame, which has neither. The re-attached stage reads them to know which declared paths only a seat-apply can commit and which edits a person already approved; do not write either value from memory or from an earlier prompt. · 선언 파일: <files> is the segment's segments[] element's 선언 파일, copied byte for byte — never a set from memory or from an earlier prompt. The gate compares the two on every fresh implementation dispatch of a segment planned with --from-declaration and refuses a phrase that differs, or a prompt without it, with exit 2 naming both values: copy the value again and dispatch once more.
<n> is that cycle row's 사이클 and the report path is made absolute as 「Dispatching a review cycle in delta mode」 item 2 says. When the element reads CI 합류 수정 instead, the same directive carries · CI 합류: <head sha> · 실패 체크: <…> · PR: <…> after 의 P0·P1, the three values the element's. The gate refuses a prompt whose document argument differs from the snapshot's 문서 인자. Once the fix ends, the next review is that subsection's to dispatch. The gate refuses (exit 3) a review while no implementation or lead fix followed the last cycle row and the segment's worktree HEAD is still that row's 리뷰 HEAD — the same HEAD is not reviewed twice. The gate caps the cycles: it counts the segment's cycle rows at every implementation dispatch and refuses with exit 3 once they reach REIMPL_CYCLE_CAP (2), unless 다음 reads 재구현, or reads 확인 리뷰 with a 정상 re-convergence after the last cycle row, no lead fix after it and the segment's implement_next[] element reading 구현 — the same re-implementation's run after its process A. On that refusal dispatch no implementation and read the segment's 다음 instead: past the cap it is a step of the segment's ladder — 리드 수정, 확인 리뷰, 재수렴, 재구현 — or a value that ends the review loop — 「Branching on 다음 after a review」 routes each. An exit 3 whose refusal text names 「파견 자리 대조」 is the dispatch-site comparison, on any implementation dispatch — the first one, the 구현 branch or the re-dispatch after review findings: write a segment park row and a 스코프=cone block with '사유=구현 재파견 거절' and the refusal text in 근거, and dispatch its implementation no more. It is not the cycle cap's exit 3, so do not read 다음 and step onto the ladder. A segment whose 선언 파일 reads 판정불가 is not skipped: dispatch it, and this refusal is how it stops.
Merging a segment and recording it
Bind a remote merge to the segment worktree's HEAD. Spell it as the REST merge gh api -X PUT repos/<owner>/<repo>/pulls/<n>/merge -f sha=<워크트리 HEAD> -f merge_method=<merge|squash|rebase>, with the full 40-character sha of the implementation worktree's HEAD; the branch is not deleted in this argv — the REST merge has no such argument, and deleting a branch is not a merge. It merges at once or is refused (409 when the pull request's head is another commit), so it merges what the rule approved. A gh pr merge without --admin is not a binding, --match-head-commit or not: on a base that requires a merge queue it enables auto-merge while required checks are pending and enters the queue once they have passed, comparing the head only at the request, and since the argv does not say whether the base requires a queue the gate refuses that spelling as unbound on every target. On a base that requires a merge queue the REST merge is refused with 405, so no bound merge passes the gate there: that merge goes to a person through the park ending The merge above gives a 405. Do not use auto-merge or the merge queue for a segment merge (gh pr merge --auto, GraphQL enablePullRequestAutoMerge, enqueuePullRequest): GitHub compares the head only when the request is made and merges later, so a commit pushed to the segment branch in between is what lands, and the gate reads them as merges with no binding whatever head they name. Under 선리뷰후머지 with 리뷰-후-머지 on, and under 선머지후리뷰 whether the rule is on or not, a merge argv for a segment that has a segment row is refused with exit 2 before the rules run when the binding is missing, names another commit, or the worktree HEAD cannot be read; the message names the argument and the HEAD. A merge-first segment is bound because the review obligation its merge issues names the worktree HEAD, and the deferred review reads that commit. The REST path is read with its ?query, #fragment and trailing / removed, and gh api's short options are read letter by letter as gh reads them, so -iXPUT is a PUT. Flags ahead of api (gh --hostname=github.com api …) are skipped the way gh skips them to find its command, and an argv whose api word may or may not be that command (after --, or taken as a flag's value) is read as a merge with no binding. A merge spelling with no binding argument (…/merges whatever fields it carries — a sha there binds nothing on the server — and mergeBranch), a REST merge whose query string carries a sha key, a gh call inside a find -exec whose words carry {} (judged at 머지), a GraphQL body in a file, and one carrying a # comment, a """ block string, a fragment, a directive, a second field or operation, or its input object passed whole as a variable are refused the same way; spell the merge as the REST merge above, and send any other GraphQL a segment act needs inline with -f query=. Any other non-GET GraphQL body is read as a base change with no binding unless every operation is a query or calls only mutations that move no ref (comments, reactions, labels, assignees, issues, reviews, pull request state, project items): updateRefs, updateRef, createCommitOnBranch and every mutation the gate does not know are judged at 머지, refused the same way, and are not on the collaboration surface — push to the segment branch and merge with the REST merge above instead. So are the REST writes that move a branch without a pull request — a non-GET …/git/refs…, …/contents/… (with or without branch; without it the commit goes to the default branch) and …/merge-upstream — and the background merge …/pulls/<n>/merge-async, which merges or enqueues after the request whatever sha it carries. Respell the merge that way and call again. A local git push to the base is bound by what it puts there: the gate strips wrappers and git's global options and runs git push --dry-run --porcelain with the same arguments where the push runs. A push that updates the base is judged at 머지 whatever you declared (below it is exit 8; 배포 is judged at 머지), and every commit it would put on the base must be the worktree HEAD, or it is refused with exit 2 naming the updated ref and the HEAD. This holds for every spelling the dry-run can reproduce — U:<base>, U:heads/<base>, git -c … push, git -C <dir> push, command git push, env git push, :, a glob, --all, --mirror, --branches, a configured remote.<name>.push — so a local base ref ahead of the reviewed HEAD is refused through all of them. A push it cannot reproduce is refused with exit 2 before the rules run, whatever you declared: on a target with a base branch, a push inside bash -c/sh -c, env -S or under sudo (and every such string the gate cannot show runs no push: one that names git, carries an expansion, a glob or a group, or whose command word is off the gate's short list of commands that run no text of their own — call the command directly instead), inside a find -exec whose words carry {}, behind an environment assignment other than LANG, LC_* or TZ (HOME= and XDG_CONFIG_HOME= included) or an env option, with a command-running -c key or --config-env, or with a push option outside the gate's allow-list (an abbreviation such as --no-dry or --exe= included). The allow-list passes -f, --force-with-lease, --force-if-includes, -u, -d, --all, --branches, --mirror, --tags, --follow-tags, --prune, --atomic, --repo, -o, -4/-6, --thin, and drops -q, -v, --progress, -n, --dry-run, --porcelain, --verify and their --no- forms; --receive-pack and --exec, in any prefix, are refused as a form on every push. Respell it as git push <remote> <refspec> without that wrapper or option. Push HEAD:<base> or <segment branch>:<base> (a segment's act runs in the segment worktree, so HEAD is that tree's HEAD). When the dry-run names no ref, the gate reads the refspecs and treats :, a glob, --all, --mirror and --branches as pushes of the local base ref. These checks run at 머지 and above, and first compare the segment's last segment and cycle rows as the review rule picks them (by substring) with the gate's picks (by field); when a sibling row's text carrying id=<segment> or 세그먼트=<segment> makes them differ, the merge is refused with exit 2 naming the series — write one more row of that series for this segment and call again.
머지 대조, 최종 사이클 and 수렴 are written by the gate and never passed by you — a segment row carrying any of them is refused with exit 2, with an empty value too (머지 대조=). id is the gate's too — it is carried from --segment — so a segment row carrying id= is refused with exit 2. A row of any kind whose field key has a space, a CR or a tab before or after it ( 상태=머지됨 on a segment row, P1=0 or 리뷰 HEAD=… on a cycle row) is refused with exit 2 whatever the key is — write every key bare. On a 상태=머지됨 row the gate compares the merge against the segment's last cycle row and writes both fields itself — 머지 대조 reads 충족, 이월 (a carry-over merge on 다음=이월 머지 whose review covers the merged tip), 기각 (a merge of a last cycle a person dismissed at the seat with a 리뷰 기각 row, P0 findings included, whose review covers the merged tip), 메타 해소 (a merge of the renumbering merge the gate proved), 패치 동일 (a merge of a resolution HEAD the gate proved carries the reviewed branch change unchanged by patch-id), 위반(카운트), 위반(미포함), 위반(카운트·미포함), 리뷰 없음, 판정 불가 or 정책 면제. The same row is refused with exit 2 when the worktree tip has not landed on the base. A 완료 or park row carrying a 커밋 that has already landed is refused with exit 2 too, unless the segment already has a 머지됨 row or the commit landed inside a sibling's 머지됨 row that carries a 커밋: if you merged, write 상태=머지됨; if the segment has no commit of its own, drop 커밋. A 머지됨, 완료 or park row whose 워크트리 differs from the segment's recorded worktree is refused with exit 2. The recorded worktree is the one named by the segment's first non-terminal row, written before its first 머지됨 row, that names the segment's own worktree — not the target's main checkout, the top level of its checkout when the directory exists and is inside a repository, and on the segment's branch: the 브랜치 of the first such row carrying one, compared with what each candidate's directory has checked out (a detached HEAD has no branch, so it pins none and matches none; the row's own 브랜치 stands in only when the directory is gone or outside a repository). A non-terminal row that leaves 브랜치 off gets it filled by the gate from the checkout it names; one you pass is kept. No row carrying 브랜치, or rows naming checkouts of two branches, leaves no record. A row naming the main checkout or a directory inside it, such as the 계획됨 row written before the segment's worktree exists, is not that row, and a non-terminal row written after a 머지됨 row never becomes the record. A tree another segment named earlier is not excluded — a segment inheriting a tree and its branch records that tree. So the segment's rows name the segment's own worktree, or the main checkout before that worktree exists — never a linked worktree on another branch. The gate reads the merged tip there, so a terminal row always carries the segment's own worktree, even after that directory has been removed — never the main checkout, and a later non-terminal row naming another checkout does not move it. When a terminal row is refused for naming a worktree other than the record, name the segment's own tree if that is where it worked; if the record was established on a tree the segment did not work in, do not name another checkout: instead of ending the shift with a 사유=중단 handoff, stop the segment at site 워크트리 기록 없음 (「Stopping one segment for a person」), with the refusal and the recorded worktree in 관측 — a park row would name a worktree too and meet the same refusal. A segment with no such row — its first row already terminal, every non-terminal row before its first merge on the main checkout, no row carrying 브랜치, or rows on two branches — has no recorded worktree: its 머지됨 row is accepted with the tip unread, so under 선리뷰후머지 it reads 판정 불가 (or 리뷰 없음 with no cycle row), which condition 11 holds; write a non-terminal row naming the segment's worktree before its terminal row. Once a 머지됨 row is written without a record, no record can be established: do not name another checkout — instead of ending the shift with a 사유=중단 handoff, stop the segment at site 워크트리 기록 없음 (「Stopping one segment for a person」), saying in 관측 that the segment has no recorded worktree (the 머지됨 row already makes the segment terminal). Pick 리뷰 정책 on the first row; a row that loosens it against the previous row's policy — the strict default when the previous row names none or there is no previous row — is refused with exit 2 on a 머지됨 row always, on any other row once the segment carries 머지 대조, and on any row once the segment has left planning: a loosening is accepted only while every earlier row of the segment reads 상태=계획됨, the segment has no cycle row, and no stage was dispatched for it (no 승인 or 자율 승인 row with kind=skill naming the segment, no stage-result row of the segment), because after execution starts the gate cannot tell whether the segment's code already reached the base outside it. A planning row that left the policy off is corrected on the 실행중 row. To recover from the refusal, restate the previous row's policy (or omit the field to inherit it). Restating or tightening it is accepted.
Termination condition 11 holds a segment under 선리뷰후머지 whose last row carrying 머지 대조 reads 위반(…), 리뷰 없음 or 판정 불가 — any value other than 충족, 정책 면제, 이월, 기각, 메타 해소 or 패치 동일, an empty one included — while 리뷰-후-머지 is not set to 끔. The violating row stays; the last row carrying 머지 대조 is the answer, and a later row without the field — a 완료 after the merge — does not clear it. The resolution is an appended second 상태=머지됨 row carrying the segment's recorded worktree (its own worktree, never the main checkout), and what goes before it depends on which half failed. A coverage violation (위반(미포함)): dispatch a review that covers the merged commit and write its cycle row first. Send the line gate.sh review-line prints as it is: on a segment a person merged before a review covered it, that line carries --merged <머지 커밋>, --base-sha and the three --basis-* flags of the segment's last full cycle, so add no flag to it and drop none. Write the cycle row in the review mode its report records, then the second 머지됨 row. A violation of both halves (위반(카운트·미포함)): dispatch the same covering review first and write its cycle row and the second 머지됨 row; when that row reads 위반(카운트), the count violation below follows, and when the covering review judged the basis findings resolved and it reads 충족, the segment is done. The trigger of either dispatch is the review dispatch rule's as it stands: a fact token the ledger stands behind, or 라우터 판단 with its reason. When review-line refuses with exit 3 — the merge commit is empty, the recorded worktree is gone or its tip unreadable, the merge was a fast-forward (onto the worktree tip or onto commits pushed to the branch past it), or the base cannot be derived — stop the segment at site 종료 조건 11 판독 불가 (「Stopping one segment for a person」), quoting the refusal in 관측. A count violation (위반(카운트)): a person looks at the merged last cycle's findings at the seat and writes its 리뷰 기각 row first, and the second row then reads 기각. You cannot write a dismissal — it is seat only — so a count violation holds the run under condition 11 until a person answers; do not dispatch another review as its cure. If that checkout has been removed, or the segment has no recorded worktree, the second row records 판정 불가 and condition 11 stays: do not repeat the review and do not name another checkout — instead of ending the shift with a 사유=중단 handoff, stop the segment at site 종료 조건 11 판독 불가 (「Stopping one segment for a person」), naming condition 11 and the unreadable tip in 관측 (the 머지됨 row already makes the segment terminal).
Termination condition 12 holds a 선머지후리뷰 segment that has a 리뷰 의무 row and whose last row is not park until its last cycle row covers the 머지 커밋 of its last 리뷰 의무 row and that cycle's review table value is 머지 or 이월 머지 (a person's 리뷰 기각 makes the table read 머지). A last row of 머지됨 or 완료 does not close it: P0 or P1 findings after the merge keep the run open, and so does a coverage reading of 판정 불가. ## 룰 설정 does not switch it off. A segment with no 리뷰 의무 row, and one that ends in park, is not held. The cure is the deferred review itself — write 상태=사후리뷰, dispatch the review review_next[] names, and when it reads 수정, implement on the same branch, merge again through a new pull request once the earlier obligation is paid, and review that merge. A segment a 머지 입양 row adopted is held the same way, whatever its review policy, from the moment it is planned: its planning act writes its 리뷰 의무 row, so the run stays open until a passing review covers the adopted merge commit — the review that reads 입양 종결, or the review of the fix that merges after it — and one that ends in park leaves condition 12 while condition 9 still holds its open obligation.
Stopping one segment for a person
A stop that belongs to one segment does not end the shift. At each site the table below names, the segment needs a person and its siblings do not: instead of ending the shift with a 사유=중단 handoff, stop that one segment with a halt record the gate writes, and go on routing the others.
gate.sh act --manifest <매니페스트> --kind shift-halt --target <alias> --segment <id> \
--cutpoint <token> --surface 읽기 --snapshot-digest <H> --site '<자리>' \
-- '질문=<사람에게 물을 것, 한 줄>' '관측=<본 것 — 줄 번호, 종료 코드, 게이트 문면>' \
['추천=<재시도 | 세그먼트 park | 근거 제출>' '추천 근거=<종류>:<인용>[ / <종류>:<인용>]']
근거 제출 is the recommendation of 종료 절 근거 alone; every other site whose recommendation reads allowed takes 재시도 or 세그먼트 park.
At 강제 표면 승인 the gate measures before it writes. It runs the provenance check itself and writes the record only when the check refuses and every refused path is one an approval can let through; the record then carries one **승인 대상**: <경로> | <분류> | <베이스 항목> | <승인 항목> line per path. A path changed on both the base and the branch, a path name no approval row can carry, a check that cannot decide, or an unanswered 강제 표면 승인 record already on the segment is refused with exit 3 and nothing written — then take the refusal's own path (the block row it wrote, or 병합 거절 for a merge) and route the others. Only a person answers 승인: the seat asks with the question line surface-approval-preview prints, the gate checks the shown paths against a fresh measurement and writes the approval rows with the answer.
자리 |
where it arises | recommendation |
|---|---|---|
적용 전제 거부 |
「Merging and applying a segment」: an apply precondition refusal other than the stale remote ref | allowed |
병합 거절 |
「Merging and applying a segment」: any other cause of a refused merge; 다음 reads CI 기존 실패 or CI 수정 한도 |
allowed |
push원격불일치 |
exit 11 on a push of the segment's branch whose remote disagrees with the worktree | never |
도달 거부 |
exit 11 on any other act of the segment the segment cannot do without; exit 11 on act --kind ci-rerun or act --kind label-ack — never a dispatch whose 11 left a 차단=파견 전 row |
never |
베이스 해소 한도 |
the segment's base cannot be resolved within its bound | never |
워크트리 기록 없음 |
「Merging a segment and recording it」: no recorded worktree, or one the segment did not work in | allowed |
종료 조건 11 판독 불가 |
termination condition 11 with the merged tip unreadable | allowed |
대상 훅 거절 |
「Pushing and opening a pull request」: the target's own Bash hook refuses an act the segment cannot do without, and the refusal is not one a commit, a remote read or another spelling moves | never |
master 수리 불가 |
references/review-next-2.md: 다음 reads master 수리 불가 — the segment waits on a base-branch failure no repair run could be started for, and holds that event's representative marker |
never |
적용 정산 |
「Merging and applying a segment」: act --kind apply-settle ended in park … 정산 판정=필요 or 측정 실패 |
never |
들여온 적용 정산 |
「Merging and applying a segment」: the segment is in the snapshot's apply_imported |
never |
종료 절 근거 |
「Settling the termination clauses and proposing done」: a termination clause whose evidence neither a read nor a clause-exec of this run produced |
근거 제출 only; a person answers |
리뷰 게시 거절 |
act --kind review-post exit 3: there is no dedicated write credential and this host's gh login could not be read either (not logged in, or expired), the posting account is not the frozen one, the review was already posted and matched, GitHub refused the post (a 4xx), or the post's outcome is unknown (no status line, a 5xx) and no post row was written — the gate's refusal line carried in 관측 says which |
never |
게시 대조 |
act --kind review-post exit 3: the review GitHub holds after the post does not match the rendered request, or cannot be read |
never |
보류 리뷰 선점 |
act --kind review-post exit 3: the posting account already holds a pending review on the pull request |
never |
강제 표면 승인 |
a review dispatch or the merge act exit 3 whose refusal names the enforcement-surface provenance check (강제 표면이 좌석 적용 밖에서 바뀜) — the segment branch changed a rule file, an instruction file, a hook or a project setting outside a seat apply, and no 강제 표면 승인 row lets it through. Use it instead of 병합 거절 for such a merge refusal |
never; a person answers |
The gate writes the record, and its options are the table's. It writes "$CC_PIPELINE_RUN_DIR/halt/shift/<id>#<n>.md" with two options at every site, 재시도 and 세그먼트 park, and at the two settlement sites the extra ones — 재실행 and 사람 확인 정산 at 적용 정산, 사람 확인 정산 at 들여온 적용 정산 — and 승인 at 강제 표면 승인, and a cone blocked row anchored on the segment that carries the record's path and digest and lists the segments that depend on it. The gate does not refuse acts on that cone — you hold it, and the snapshot tells every later shift what to hold: shift_halts[] has one element per shift stop no answer has reached yet, with its 세그먼트, 자리, 기록 and 보류 (the segments its cone holds now). Dispatch, merge or apply nothing on an element's 세그먼트 or on a segment in its 보류 until the answer comes back — the element then leaves shift_halts[] and the answer appears in answered_halts[] — and route every other segment as usual. Do not write a park row or a separate cone block for the same stop — the answer decides between those. A run-scope stop is not in the table: exit 7, a lane or limit wait, the design step's stop and a structural refusal still end the shift with 사유=중단. The one exception is 종료 절 근거, which stops no segment: it asks a person for one termination clause's evidence, and 「Settling the termination clauses and proposing done」 gives its form.
Recommend only from what a file says. Pass 추천 with 추천 근거 only when the interview record (인터뷰 기록), the manifest's authorization (매니페스트 인가) or the target's CLAUDE.md (상시 지침) settles the choice, each part quoting that file verbatim; the gate looks each quote up with a fixed-string search and refuses the act with exit 3 when one is not there, and it refuses 기기 사실 and any kind it does not know. On that exit 3 call again without the two fields. At a site whose recommendation reads never, the gate drops whatever you pass and the record reads (없음). At 종료 절 근거 the gate takes 근거 제출 and nothing else, and it refuses every answer to that record whose answerer is not a person — the recommendation tells the person which way the evidence points, and never lets the seat answer. Without a recommendation the seat asks a person.
When the gate cannot write the record — exit 3 because halt/shift is not a real directory at its place, or because a file already sits at the name — write act --kind blocked -- 스코프=cone 원인=막힘 '앵커 세그먼트=<id>' '사유=교대 정지 기록 불가 — <자리>' '근거=<게이트 문면>' and go on: that row is in shift_halts[] with an empty 기록, so it is held as above for the rest of the run, and the seat finds the stop in the ledger. Exit 2 is your argv (an unknown site, a missing 질문 or 관측, a field the gate writes itself); fix it and call once more. Never pass 중단 기록, 기록 다이제스트, 자리 or 교대 on a blocked row — those are the gate's, and the row is refused with exit 2.
End the shift only when nothing is left. After the act, read the snapshot again and route every other segment as usual. When no act remains to dispatch, end with 사유=중단 and put each record's absolute path in 막힌 지점. The answer comes back as an answered_halts[] element and 「Handing on a person's answer to a halt」 item 6 carries it out.
Settling the termination clauses and proposing done
The run ends only on an accepted act --kind propose-done, and the gate refuses it while any termination clause of the manifest is unsettled. A clause is settled by a row you write. These kinds take FIELDS after -- rather than a command, because what they perform is the ledger row itself — they are acts, not bookkeeping. clause-exec is the one kind in the block that takes a command after its 절= field; the gate runs that command and writes its result row:
act --kind segment -- 상태=<…> 워크트리=<path> 선행=<세그먼트 id CSV>|없음 '선언 파일 집합=<CSV>' [브랜치=<세그먼트 브랜치>] ['리뷰 정책=<선리뷰후머지|선머지후리뷰|리뷰없음>']
act --kind cycle -- 사이클=<n> P0=<n> P1=<n> '리뷰 HEAD=<sha>' '리포트 경로=<path>' ['모드=전체|델타'] ['기준 사이클=<n>']
act --kind problem -- 동일성=<…> '현재 단=<n>' '생성 등급=<축2 토큰>'
act --kind judgment -- 등급=1 '판단 부류=<열세 값>' 기준=<…> '되돌리는 법=<명령>' 근거=<…>
act --kind clause -- id=<절 id> 상태=<충족|불가능|보류> 근거=<…>
act --kind clause-exec --segment - -- 절=<절 id> <argv…>
act --kind blocked -- 스코프=run 원인=해소 사유=<선행 막힘의 사유> 근거=<…>
act --kind blocked -- 스코프=cone 원인=막힘 사유=<…> 근거=<…> '앵커 세그먼트=<id>' ['의존 세그먼트=<CSV>']
act --kind obligation -- '의무 id=<RO-…>' 근거=<…>
act --kind obligation-done -- 동일성=<problem 행의 동일성> 근거=<원장에서 찾을 수 있는 객체를 지목>
act --kind obligation-drop -- 동일성=<problem 행의 동일성> 근거=<원장에서 찾을 수 있는 객체를 지목>
A segment planned with --from-declaration takes no 선언 파일 집합 on any later row either. The gate writes that set on the planning row and again on a re-declaration row after a re-convergence moves it; a value you pass anyway is replaced with the gate's and leaves a warning. A segment planned without a declaration still carries the set you pass on its planning row.
The evidence a clause row carries depends on its state.
충족cites the ledger or an observable artifact — a row anchorA-<8 hex>, a merge commit's full sha, a PR number, a run-directory or document path with its line, or중단 답 줄 <n> · 첨부 <경로>— never prose alone. For grounds that cite no execution the gate checks only that근거is not empty and, when they name a posted review, that the review's리뷰 게시row reads대조=일치; the rest of keeping to this is yours. Grounds citing실행 A-…are checked by the gate: the row is this clause's종료 절 실행row and exited 0, and a트리밖쓰기or외부상태변경execution is followed by재조회 A-…— the same clause, graded읽기or워크트리쓰기, exit 0, after it, a different command; any miss is exit 3 with no row. A clause that has an execution of this run must cite실행 A-…or중단 답 줄. The gate adds자체 근거=예to a row that passed; never pass it yourself (exit 2).불가능cites what decided it — a residual issue URL, a design step'sstage-resultrow and halt record path, or the중단 답 줄 <n>of a불가능으로 정산answer. An act that passed the gate and then failed cites its ledger row anchorA-<8 hex>; an act the gate refused cites the refusal line, the exit code and the target cutpoint. The rules ofreferences/review-next-1.mdandreferences/design-dispatch.mdfor their own불가능rows stand as they are.보류names an open절단점=판단approval id, and one approval holds one clause unless the design step opened it.
Settle the termination clauses before you propose done. Enter this order when no unmerged, unparked segment is left to dispatch, no stage is alive, no shift_halts[] element holds a segment, and no segment parked by a 스코프=cone row reading 사유=시각 승인 대기 still has its 시각-승인 approval open in pending_approvals[]. While one is open, end with 사유=승인 as item 2 of 「Dispatching the visual stage」 says, and do not propose done. A plan with no implementation step (「Planning the segments」) and a design that stopped follow the same order.
- Read the snapshot's
clauses[]— one element per termination clause, with itsid,문면,상태(미정산,충족,불가능or보류),근거,요청(the evidence request still open on it),근거 실행(the execution shape the kickoff bound the clause to, ornull),실행(the last종료 절 실행row's앵커,종료 코드and축2, ornull) and실행 이력(every such row in order — take a write's anchor back from here after your context was compacted). - For each element whose
상태is미정산, find by gate reads the evidence its문면asks for — ledger rows, the run directory, a merge commit'sgit show --statorgit diff,gh pr view, each throughexec … --surface 읽기— and when you find it, writeact --kind clause. - For each clause whose evidence you cannot produce, write an evidence request (below) — one per such clause, all in this shift.
- Once every clause is settled, check with
plan --kind propose-doneand then takeact --kind propose-done. - While any evidence request is open, do not propose done: end with
사유=중단and put each record's absolute path in막힌 지점.
A clause that asks for a pull request review is settled by a review the gate posts for you — do not hand it to a stage, and do not post it yourself. Spell it gate.sh act … --kind review-post --segment <seg> --clause <절 id> --cutpoint 커밋 --surface 외부상태변경 -- 게시; the act posts POST repos/<owner>/<repo>/pulls/<n>/reviews once.
- The gate takes every value from the ledger: the pull request from the segment's branch,
commit_idfrom the리뷰 HEADof the segment's lastcyclerow (and the report's리뷰 HEADmust match it), the P0 and P1 counts from that row and the finding titles from its리포트 경로. The body comes from the run's wording file's정산 본문template — the리뷰 문면row's file, or the plugin's default — andeventisCOMMENTunless the clause's문면namesREQUEST_CHANGESorAPPROVE. When the segment has nocyclerow, the act is refused: settle the clause불가능saying so. - Posting a review any other way is refused in every run:
execrefuses a non-GETgh apiunderrepos/<owner>/<repo>/pulls/<n>/reviewsor…/comments,gh pr reviewand the GraphQL review mutations with exit 3, a사전 인가row notwithstanding. - The act reads before it posts: it checks the posting login, reads the pull request's review list, and when its own earlier attempt left a review on the same
commit_idit compares that one instead of posting again. - The
리뷰 게시row it writes is the충족evidence: cite it as리뷰 id=<id>. The gate takes a충족row whose근거names a review only when that review's리뷰 게시row reads대조=일치. - On exit 3 the act stops at one of three sites —
리뷰 게시 거절,게시 대조or보류 리뷰 선점— and the gate's refusal text says which: stop the segment there withshift-halt(「Stopping one segment for a person」). It is not retried in this shift. At리뷰 게시 거절the cause is one of those the site table lists — no dedicated write credential and no readableghlogin on this host, a login other than the frozen account, a 4xx, or an unknown outcome — and the refusal line carried in관측names it.
When a clause's 문면 asks for an execution — a paid or credentialed call, a local launch, a device, or a person's confirmation — and no ledger row, stage report or answer attachment shows it done, take one of three ways. Do not settle such a clause 불가능 without a question. Posting a pull request review is not such an execution: you issue it yourself through the gate, as above.
- Runnable — the execution is a read the grading table grades
읽기, or a사전 인가row names it whole, and when the element's근거 실행is notnullthe command starts with it. Issueact --kind clause-exec --segment - … -- 절=<id> <argv…>, where…is the--cutpoint,--surface,--reachand--snapshot-digestyou would give the same argv onexec, with the same values. The gate prints the output and one stderr line[clause-exec] 행 A-<8 hex>, the row's anchor. When that execution is트리밖쓰기or외부상태변경, read its result back with a secondclause-execof the same clause — graded읽기or워크트리쓰기, a different command. When every call exited 0 and the output (the re-read's, when there is one) shows the state the문면asks for, writeact --kind clause -- id=<id> 상태=충족 '근거=실행 A-…[ · 재조회 A-…]'. - Ran, and failed or did not match — ask with
shift-halt -- 절=<id> 실행=A-… 질문=… 관측=…. The gate writes the**실행 결과**line from that row. Do not run it again: the gate refuses a clause execution after a failed one, and the record's근거 제출is the person's checked result as an attachment, not a re-run. - Outside the authorization — ask with
shift-halt -- 절=<id> '명령 초안=<argv>' '기대 결과=<한 줄>' [추천=근거 제출 '추천 근거=…'] 질문=… 관측=…. Take this way too whenclause-execended without a new종료 절 실행row for the clause — a precondition or rule refusal (exit 3) or a reach park: put the argv you issued in명령 초안and the gate's exit code and refusal line in관측. An approval wait is handled as onexec: the clause stays미정산until that approval is answered.
Ask with shift-halt at site 종료 절 근거, which stops no segment: pass --segment - and name the clause in 절.
gate.sh act --manifest <매니페스트> --kind shift-halt --target <alias> --segment - \
--cutpoint <token> --surface 읽기 --snapshot-digest <H> --site '종료 절 근거' \
-- '절=<절 id>' ['실행=A-<8 hex>' | '명령 초안=<argv>' '기대 결과=<한 줄>'] \
'질문=<그 절이 요구하는 실행·확인, 한 줄>' '관측=<읽은 것과 왜 근거가 되지 않는가>'
The gate makes the key clause-<id> itself, writes "$CC_PIPELINE_RUN_DIR/halt/shift/clause-<id>#<n>.md" with the options 근거 제출 and 불가능으로 정산, the recommendation you passed (근거 제출 only) or (없음), and the **실행 결과**, **명령 초안** and **기대 결과** lines you asked for, and a cone blocked row anchored on that key alone — it holds no segment and does not count against termination condition 5, since condition 10 already holds the run. It refuses with exit 3 a clause the manifest does not declare, one whose last 종료 절 row reads 충족 or 불가능, and a second request on a clause whose earlier request still waits for its answer to be carried out; 절 at any other site, or a segment on this one, is exit 2. The element's 요청 names the open record, and 「Handing on a person's answer to a halt」 item 6 carries out its answer.
Do not end on 사유=중단 with a clause unsettled unless every unsettled clause has an open evidence request. A clause left with neither a row nor a request is a question nobody will be asked.
Ending your shift
Check shift.over_soft on every snapshot. When it is true — or when the gate answered 15, or you took exit 5 (a judgment approval of a held class, 사람-결정 or 시각-승인, only once nothing outside the held set is left to dispatch — the CFI-S4 exception), or a propose-done was accepted, or you are ending on 중단 (the gate answered exit 7, or no act is left to dispatch), or you are ending on 대기 (all that is left is a live stage's result, a pending CI verdict or the reset of a cut stage's limit), or you are ending on 이월 (all that is left is answers kept in 이월 rows for the next run) — write this and then exit:
gate.sh act --manifest <매니페스트> --kind handoff --target <alias> \
--cutpoint <token> --surface <token> --snapshot-digest <H> \
-- 교대=<n> 사유=<상한|승인|종단|중단|대기|이월> \
'버린 선택지=<시도했고 버린 것 · 무엇을 보고 버렸는가>' \
'막힌 지점=<지금 벽이 있는 자리>' \
'다음 후보=<후임이 먼저 볼 것>' \
['CI 대기=<세그먼트>[,<세그먼트>…]'] \
['master 대기=<세그먼트>[,<세그먼트>…]'] \
['리셋 대기=<key>[,<key>…]']
CI 대기 is for 대기 alone, and only for segments whose CI you read as pending. It is a comma-separated list of segment ids with no spaces, and the gate never clips it: clipping it would shrink what is waited on without a word. A row that cannot fit even with the free-text fields at their floor is refused with exit 2 and no row; end on 중단 then. 리셋 대기 is for 대기 alone too, and only for cut keys whose reset 「Re-attaching a cut stage」 (a) can judge and has not passed, in the same comma-separated form, never clipped. master 대기 is for 대기 alone as well, and only for segments whose 다음 reads master 대기 now — the gate refuses any other with exit 3 and no row — in the same form, never clipped.
교대=<n> is the snapshot's shift.n, and that is YOUR OWN launch number — the gate hands it down in CC_PIPELINE_SHIFT_ID and stamps the same value on every row you write. 0 is reserved for the lead's seat and means routing never left it, so it is never a number you write. The three free-text fields are clipped by the gate; write them anyway.
버린 선택지 is the field nothing else in the ledger can hold. The snapshot records what LANDED — never what was considered and dropped. Leave it empty and your successor pays again for every dead end you already walked.
종단 is written only after a termination proposal was accepted. The gate takes 사유=종단 only from a run that has ended — its done file exists or the ledger carries an ending row — and otherwise refuses it with exit 3 and writes no row. A run that has not ended is handed off with 중단, never 종단: "nothing is left to dispatch" is not the run ending, and a 종단 row on an open run leaves the watcher waiting on a run nothing will close.
이월 is written only when the next run is all that is left. The gate takes 사유=이월 when no stage or supervisor is live, no halt record is unanswered, at least one answered_halts[] element reads state 이월, the run has no ending row, and CI 대기 and 리셋 대기 are both empty; otherwise it refuses with exit 3 and no row — a live stage or a CI wait is 대기, an unanswered record is 중단, an ended run is 종단. Before the deadline the gate holds the wait until one second past it and launches your successor, whose first act ends the run with 마감. Past the deadline it takes 이월 only when nothing but those answers holds the run, and ends the run with 마감 in the same act; otherwise it refuses with exit 3 and no row, because something else still holds the run — hand off with the reason that names it: 대기 for a live stage or supervisor or a CI wait, 중단 for anything else, and the gate does not refuse that 중단. And the gate refuses 중단 when those answers are all that holds the run — the same judgment the ending past the deadline reads — or when 막힌 지점 names one of their records: the person already answered them.
On 중단, 막힌 지점 carries what you measured, not an instruction to wait — the line numbers, the lane, the resetsAt that has not passed. Your successor re-measures it either way, and a measurement tells it what to look at. 무기록 is never yours to write: it is the value the gate gives the row it writes for a shift that ended without one.
A live stage holds back none of the other four. Its supervisor is detached from your session, so ending on 상한, 승인, 종단 or 중단 while it runs costs the stage nothing: your successor finds it in live_stages[] or in the ledger. 대기 is the exception by design — it is the ending that exists for a live stage, and the gate holds the successor until that stage moves.
Your return line
One line to the lead. It says: the reason you ended, the shift number, and — if you ended on 승인 — the approval id and what it blocks. Nothing else. Blockage goes here too; there is no other channel you are permitted to use.