Repository navigation
Commit 326f9db
docs(os-dev): finished work the work branch cannot take is pushed to a no-PR backup branch by default (#38271)
<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} -->
_Requested by **Elon** · [project
thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DDypKu7B9nwbu5WuV7AEio8)_
Fixes #36920
Clause-②: no
Metadata-protocol: none
Rule-change: yes
## 维护者速读
- 用户无感:车队开发代理做完却暂时进不了正式分支的代码,以前只留在随时会被回收的云端容器里,现在默认立刻推到一条不开合并请求的远端备份分支。
- 把你在元数据列表视图那张卡上说的「避免代码丢失应该是技能的默认选项」落成规则文字,属于车队自身规则的维护。
- 出错时代理会多推或漏推一条备份分支,正式代码不受影响,规则文字可以直接撤回。
- 请审批这份规则文字:它新增了一类不用先问你就能推的分支,这一条只有你能批。
## 请维护者定夺
- **篇幅上限一处都没有上调。**
新增的规则文字已经靠删掉三份规则文件里重复的旧条文付清,三份文件都比原来略短;删了哪几处、为什么删了不丢规则,逐条列在下面的英文清单里,有你想留的请直接说。
- **备份分支落地后没有任何代理删得掉。**
云端容器无权删除远端分支,它们会一直堆在仓库里,直到你手动清理,或者另开一张卡由你裁定给中继加一条只删这类分支的能力。
- **卡片第四项归你。**
项目指令里的会话分支许可要写上这类备份分支的命名;在那之前,云端会话自带的「未经许可不得推其他分支」仍然压过这条规则,规则只是纸面许可。
## What changes
The rule has one home, `.claude/agents/os-dev.md`, and two pointers.
- `.claude/agents/os-dev.md`, 资源纪律 item 5, five lines directly under the
existing commit-and-push line:
1. **Backup branch by default.** Finished commits the work branch cannot
take (they would change the open PR on it, they are the held-back part
of a split, or work is paused on a decision or a review) are pushed at
once to a no-PR backup branch `claude/issue-N-SLUG-wip`. It is standing
permission: no question, no decision card. Never a PR from it, never
merged, deleted when its work lands.
2. **The worked example the card asks for:** a card thread whose
platform branch holds the open PR of the first part creates the local
branch of that name and pushes the second part, without asking, with
`git push -u origin claude/issue-N-SLUG-wip`. That is the one push shape
`.claude/settings.json` allows. The refspec form of the first head
matched no allow row there and is gone.
3. **No local-only work when a turn ends.** Before a turn stops to wait
on CI, a review, a decision or a merge, every commit is on a remote
branch and the report names it.
4. **Hand-offs, reports and memory name a remote branch and sha**, never
a local branch or a container path.
- `.claude/skills/pm-dispatch/references/area-lease.md`, 交接与换号: the
hand-off line now points to that rule for pushing and naming in-flight
work, and says every *work* branch leaves a draft PR, because a backup
branch never carries one.
- `.claude/skills/pm-dispatch/references/dispatch-runbook.md`, 卡线程: one
short pointer line. This section is where the repository says what a
card-thread order carries, and `execution-duties.md` already forbids
copying os-dev's general clauses into an order, so the order points and
does not restate.
- `scripts/pm/check-skill-line-ratchet.mjs`: **no change.** The first
head raised three ceiling rows by 1,031 bytes. Seat ruling 7238709377
withdrew that: a relay or a card body is not a ruling of record, and the
PR approval does not stand in for one. All three rows are back at their
values on main, and the new text is paid for by deletion (next section).
**Why `Rule-change: yes`.** The text makes the push of a new branch
class a standing permission and removes a decision card that went to the
maintainer in the case the card describes. The maintainer's words behind
the card state the principle and order a card:
「还有避免代码丢失的问题应该是技能的默认选项,是否建议优化技能」 (2026-11-24 08:49Z) and 「立 skills 卡」
(2026-11-24 08:50Z), said in the card thread of the metadata list-view
card and recorded in the body of this PR's card and in mailbox comment
7126641707. They do not name the branch class, the name pattern, the
standing permission or the dropped decision card. Those are the filing
seat's design, so this text is the maintainer's to approve here.
Item 4 of the card is not a repository file: **the maintainer owes it.**
The session-level branch allowance in the project instructions has to
name the pattern `claude/issue-N-SLUG-wip`. Until it does, a cloud
session's own "push to no other branch without explicit permission"
instruction can still stop rule 1.
## Paid by deletion: what was removed, and why each is safe
Nothing removed is the only statement of a rule. Each item is a copy of
text that stays somewhere else, and the place it stays is named.
`.claude/agents/os-dev.md` (new text +746 bytes, removed 755):
1. **The attribution-footer block** at the end of the file: the fenced
three-line block and the two lines that framed it, 399 bytes, replaced
by one pointer line of 152. It was a copy of the block in `AGENTS.md`
(Multi-agent working discipline, "Write the attribution footer in the
form the surface keeps"), which every dev reads in full before its first
edit. No script reads the os-dev copy (`git grep` over `scripts/`).
2. **资源纪律 item 6, 「没排到的调用把排位寄存,同名再来续原到达戳;不设它,每次离开都从队尾重排。」** (111 bytes).
It restates the line above it (take the lock again under the same slot
name, set before the first attempt) and item 1 (always set the slot).
The lock tool prints the same explanation on every queue timeout.
3. **干净收尾 item 4, 「自检是机械的,不看你怎么形容这次等待:终消息只能是报告 JSON 或 `blocked` 报告。」**
(112 bytes). It restates that item's own heading (a turn ends only with
a report, and there are two kinds) and its ① and ②. The self-check
question on the following line stays.
4. **本地验证范围, the line that shows the exit code read after a pipe into
tail** (80 bytes). It is the negative example of the two lines above it,
both kept: capture the exit code before any pipe, and the one immune
spelling.
5. **标准条款, the two lines listing what a git worktree shares** (206
bytes, replaced by one line of 82). They restated `AGENTS.md`
(Multi-agent working discipline), which is the more exact text: it names
four isolated ref namespaces where the os-dev line said only the work
tree and HEAD. The criterion 「配方不点名共享态才 worktree-safe」 is kept on the
new line, with the pointer.
6. **Definition of done, the clause 「门禁状态如实记录,`in_progress` 是诚实值」** (52
bytes). 干净收尾 item 4 ① says the same (an unconverged gate is reported as
`in_progress`). The ⛔ half of that line stays.
7. **资源纪律 item 1, the clause 「排队是常态,不是挂死」** (29 bytes). The heading of
item 6, 「排队不是停摆」, says it.
`.claude/skills/pm-dispatch/references/area-lease.md` (new text +46
bytes, removed 48):
8. **区内规则, the clause 「dev 推前照 os-dev.md〈本地验证范围〉」** on the 省耗 line. It
restates a standard clause of `os-dev.md`, which binds every dev whether
or not anything else mentions it. The rest of the line stays.
`.claude/skills/pm-dispatch/references/dispatch-runbook.md` (new text
+90 bytes, removed 93):
9. **结论当轮执行, 「⛔ 不许只留一条评论等人路过:评论不是任何人的收件箱,标签才是。」** It restates
`references/state-machine.md` (「交接即标签…收件箱只认标签」) and
`references/lanes/director.md`. The line above it in the same section
keeps the obligation itself: name who can act and move the state by
label in the same round.
## Byte table (ratcheted files, against origin/main e42520c)
| File | before | after | net | ceiling |
|---|---|---|---|---|
| `.claude/agents/os-dev.md` | 33500 | 33491 | -9 | 33500 (unchanged) |
| `.claude/skills/pm-dispatch/references/area-lease.md` | 6565 | 6563 |
-2 | 6586 (unchanged) |
| `.claude/skills/pm-dispatch/references/dispatch-runbook.md` | 20483 |
20480 | -3 | 20483 (unchanged) |
No ceiling row is raised or lowered; the three rows could each be
lowered by the net above. No volatile count is introduced.
## Tests
No tested behaviour changed (rule prose only), so there is no ablation.
`pnpm check:pm-skill-ratchet` runs the ratchet's own self-test.
## Acceptance notes
- **Deleting a backup branch is not something a cloud container can
do.** `references/readings-session.md` records both routes as refused
(`git push --delete` and the ref DELETE, each 403, not to be retried),
and the relay's only ref delete takes mailbox branches. So the rule
says: delete it when its work lands, and where the delete is refused the
report names the branch as owed. Not measured again here, because a
probe branch could not be removed either.
- `scripts/pm/dev-worktree.sh --resume-from=BRANCH@SHA` continues the
same branch name. A `Resume-from:` line that names a backup branch
therefore builds a tree on the `-wip` name. The rule still holds (no PR
from that name; the dev pushes to a work branch name), and the tool has
no form that starts a differently named branch from that sha. Noted, not
changed.
- The name keeps the `claude/issue-N-` prefix on purpose:
`scripts/pm/round-open.mjs` reads a push on such a head as activity on
card N, and the one-command pre-check in `AGENTS.md` finds it. A hit
there stays a hint and never a claim, as `AGENTS.md` already says.
- `AGENTS.md` is not touched. Its "one feature branch + one PR per task"
is read as unchanged: a backup branch carries no PR and is never merged.
- Seat-private order files in project storage are outside the
repository. The filing seat said it had added three lines to its own;
with this rule landed those lines repeat `os-dev.md`.
- Sibling PR in this area (the per-card count of the 3,000-line review
line) also edits `area-lease.md`, seven lines above item 8's hunk.
`overlap-check.mjs` reads the two heads as merging cleanly.
- No changeset: every path is on the fast track (`.claude/**`) and none
ships in a package's `files[]`. `skip-changeset` was applied with the
create.
## Follow-up notes (from the contract review, not built here)
- A second backup for the same card and slug whose history does not
descend from the first is a non-fast-forward push. The rule does not say
whether that takes a new slug or the lease-guarded force push of
`AGENTS.md` rule 3.
- After a squash merge a landed backup branch still shows commits ahead
of main and has no PR, so the two-read test in
`references/readings-session.md` cannot tell it from unlanded work. Only
the report line tells them apart. This belongs with the delete question
above.
- `AGENTS.md` does not name the backup class, so a reader of that file
alone learns nothing of it. A pointer there is for the maintainer to
weigh.
## Verification
<details><summary>Local gates at 2776b50</summary>
- `node scripts/pm/overlap-check.mjs
--branch=claude/issue-36920-wip-backup-branch`: `VERDICT clean exit 0`
(3 files; merges cleanly onto origin/main 73ec085 and onto the one
open PR head that shares `area-lease.md`).
- `node scripts/pm/dispatch-gates.mjs --commands`: 26 commands derived
from the merge base (the ratchet script is no longer in the change set,
so the 20 families that only it pulled in are gone). All 26 run, each
exit code captured before any pipe, all exit 0.
- `--ran` reconciliation: `26 derived famil(ies) accounted for — 26 run,
0 NOT-MEASURED`.
- `pnpm check:pm-skill-ratchet`: exit 0. `check-skill-line-ratchet
self-test: 116 cases pass`; `.claude/agents/os-dev.md is 33491 bytes
(ceiling 33500; headroom 9)`; `area-lease.md is 6563 bytes (ceiling
6586; headroom 23)`; `dispatch-runbook.md is 20480 bytes (ceiling 20483;
headroom 3)`.
- `pnpm check:pm-skill-id-lint`: exit 0, `134 file(s) clean`. `pnpm
check:pm-governed-merges`: exit 0, `972 assertions`. `pnpm
check:doc-authoring`, `pnpm check:nul-bytes`, `pnpm
check:commit-card-trailers`, `pnpm check:skill-frame-sync`: exit 0.
- `git diff --stat` of the merge base against this head: three files, 12
insertions and 19 deletions; `scripts/pm/check-skill-line-ratchet.mjs`
is not among them.
</details>
<details><summary>Earlier heads</summary>
- `49d0a25e48` (the rule, with three raised ceilings): 46 derived
commands run, 45 exit 0 on the first pass;
`check:doc-formula-expressions` exited 3 until formula and lint were
built, then 0. `pnpm check:pm-dispatch-gates` exit 0 (`fast tier: 2369
cases pass`).
- `f067818e59` (the example respelled at the same size): `pnpm
check:pm-skill-ratchet` and `pnpm check:pm-skill-id-lint` exit 0,
`overlap-check.mjs` clean. The full gate loop on that head was stopped
when the pay-by-deletion order arrived, so its remaining gates are NOT
MEASURED there.
</details>
Read first: the five new lines in `.claude/agents/os-dev.md` under 资源纪律
item 5 (the standing-permission line is the riskiest hunk), then the
nine removals listed above, each against the place named as keeping the
rule.
Two-minute check: `pnpm check:pm-skill-ratchet` prints
`.claude/agents/os-dev.md is 33491 bytes (ceiling 33500; headroom 9)`,
and `git diff origin/main...HEAD --stat` lists three files, none of them
the ratchet script.
---
_Generated by [Claude
Code](https://claude.ai/code/session_016WV4cxRDKprCtjpEdtiPFW)_
<!-- signed: repo:objectstack#1 · os-elon-musk ·
session_016WV4cxRDKprCtjpEdtiPFW -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent f28091a commit 326f9db
3 files changed
Lines changed: 12 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
| 92 | + | |
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
103 | 108 | | |
104 | 109 | | |
105 | 110 | | |
106 | 111 | | |
107 | 112 | | |
108 | | - | |
109 | 113 | | |
110 | 114 | | |
111 | 115 | | |
| |||
156 | 160 | | |
157 | 161 | | |
158 | 162 | | |
159 | | - | |
160 | 163 | | |
161 | 164 | | |
162 | 165 | | |
| |||
186 | 189 | | |
187 | 190 | | |
188 | 191 | | |
189 | | - | |
190 | | - | |
| 192 | + | |
191 | 193 | | |
192 | 194 | | |
193 | 195 | | |
| |||
257 | 259 | | |
258 | 260 | | |
259 | 261 | | |
260 | | - | |
| 262 | + | |
261 | 263 | | |
262 | 264 | | |
263 | 265 | | |
| |||
289 | 291 | | |
290 | 292 | | |
291 | 293 | | |
292 | | - | |
293 | 294 | | |
294 | 295 | | |
295 | 296 | | |
| |||
345 | 346 | | |
346 | 347 | | |
347 | 348 | | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
| 349 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
96 | 95 | | |
97 | 96 | | |
98 | 97 | | |
| |||
133 | 132 | | |
134 | 133 | | |
135 | 134 | | |
| 135 | + | |
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
| |||
0 commit comments