Skip to content
Draft
4 changes: 2 additions & 2 deletions .claude/agents/os-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ model: opus

1. **重活串行,共享验证锁只有一个入口。** 每次 build/test 都从这里走。
- `bash scripts/pm/os-verify-lock.sh -c '<command>'`(或 `-- <argv>`);⛔ 永不手搓 `flock`/lockfile。
- 一次前台调用领全部等待预算,阻塞到拿锁或 99;⛔ 不轮询重试,恒设 `OS_VERIFY_LOCK_SLOT`。
- 一次前台调用领全部等待预算,阻塞到拿锁或 99;⛔ 不轮询重试。
- 它不保证机器空闲:`check:*` 门禁、install、dev server 不走它,与持锁同核并跑。
- 超前台上限者(`check:pm-dispatch-gates`、全量 dogfood):`nohup … > LOG 2>&1 &` 后 `tail --pid`。
- 锁下墙钟绝对值是共享盒读数;只包命令本身,不包你的阅读与判断。
Expand Down Expand Up @@ -270,7 +270,7 @@ model: opus

- 全文 ⛔ 不出现 HTML 注释:sanitizer 落库后吃短尖括号片段,连反引号里的也吃。
- 例外二:harness 自写 PR 正文首行归属注释原样留、只报,`Fixes #<n>` 紧随;派发令要求才独占
末个非空行写 `<!-- signed: LANE#N · ACCOUNT · SESSION -->`(`PR_BODY_TRAILER_SHAPE`);其余 dev 自写仍禁。
末个非空行写 `<!-- signed: LANE#N · ACCOUNT · SESSION -->`(`PR_BODY_TRAILER_SHAPE`,读方亦认 `LANE@ACCOUNT`);其余 dev 自写仍禁。
- 凡要上 GitHub 的文本,尖括号形状片段一律改占位词拼写(`FIELD`、`IDENT.MEMBER` 一类)。
- 各派发模式(`mode:subagent`、`mode:cloud`、`mode:thread`)下 GitHub 都是报告的权威源。
- 评论、PR 正文都读回到尾:只认首行标记保不住正文,sanitizer 可从首个 tag 形片段吃到尾。
Expand Down
4 changes: 2 additions & 2 deletions .claude/skills/pm-dispatch/references/seat-post-protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
- 会话座位查最新产出评论的时间戳;回收 = 改正文 + 审计评论。
- 可跑读法:本车道 `pm:dispatched` 卡按 `updated_at` 降序一搜,或读最新认领评论。
- 写侧刷新三时刻:派发、收班、暂停或交接前;时间戳恒取自 `post-stamped.mjs`。
- 帖与卡正文首行恒为署名 `LANE#N · ACCOUNT · SESSION`;缺即写工具拒发(`post-stamped.mjs` 头注)。
- 帖与卡正文首行恒为署名 `LANE#N · ACCOUNT · SESSION`(读方亦认 `LANE@ACCOUNT`);缺即写工具拒发(`post-stamped.mjs` 头注)。
- PR 正文末非空行署 `<!-- signed: LANE#N · ACCOUNT · SESSION -->`,整篇经 `dispatch.mjs` 的 `issue_patch`。
- 刷新前回执敲门;`--body` 拦截:评论晚于末次戳 ⇒ `--ack-through=ID`;空座欠账无卡号 ⇒ 拒写。
- 耐久状态只住正文或以 App 写入;正文守中继上限 60,000 字节,超大贴由半状态巡查浮出。
Expand All @@ -43,7 +43,7 @@
- 巡查改绑 = 继任自建自绑并删旧,`Patrol:` 换号;前任笔迹归继任不自退,旧会话即结束。
- 上下文读数:`get_session`(无参)`external_metadata.context_usage.used_tokens`;读不到或 0 归协调者读。

## 交接收尾清单(漏一步就是留残缺现场)
## 交接收尾清单

1. 立即停止新派发。
2. 认领卡落地,或同笔 `Release:`+`Resume-from:`+清 assignee 交回 `pm:queue`;`needs_decision` 进决策箱。
Expand Down
24 changes: 17 additions & 7 deletions scripts/pm/card-pick.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ import {
labelNames,
markerMatches,
readSignatureLine,
seatIdOf,
seatMark,
subIssueParentPath,
} from './check-half-states.mjs';
import { ghApi, readAllPages } from './gh-pages.mjs';
Expand Down Expand Up @@ -181,13 +183,14 @@ export function parseOrder(text) {

/**
* `--seat LANE#N` parsed by the seat signature's own grammar (`SEAT_SIGNATURE_LINE`, borrowed, never re-spelled), so
* every lane a signature can carry is accepted, an epic seat's `epic:#N#1` included. Pure.
* every lane a signature can carry is accepted, an epic seat's `epic:#N#1` included — and both seat marks:
* `LANE@ACCOUNT` names the seat by its account (`seat` is then `@account`, `seatMark`'s reading). Pure.
*/
export function parseSeat(text) {
const v = String(text ?? '');
if (/\s/.test(v)) return null;
const m = SEAT_SIGNATURE_LINE.exec(`${v}${SEAT_SIGNATURE_SEPARATOR}seat${SEAT_SIGNATURE_SEPARATOR}session_parseseat`);
return m ? { lane: m[1], seat: Number(m[2]), name: `${m[1]}#${m[2]}` } : null;
return m ? { lane: m[1], seat: seatMark(m[2]), name: seatIdOf(m[1], seatMark(m[2])) } : null;
}

const GRADE_NAMES = Object.freeze(['p0', 'p1', 'p2', 'p3']);
Expand Down Expand Up @@ -309,7 +312,8 @@ export function claimReason(comments, seat) {
if (own === null || own.kind === 'release') return null;
const sig = own.signature;
if (!sig) return 'Claim: (unsigned) — another session holds it unless the claim names you';
const who = `${sig.lane}#${sig.seat}`;
// Lane AND mark: a `#N` claim is that numbered seat's, an `@ACCOUNT` claim that account's — never each other's.
const who = seatIdOf(sig.lane, sig.seat);
if (seat && seat.name === who) return `Claim: by this seat (${who}) — already yours, not a new pick`;
return `Claim: by ${who}`;
}
Expand Down Expand Up @@ -588,7 +592,7 @@ export function fixtureGet(fixture, repo) {
const USAGE = [
'card-pick — which ready cards a seat takes next (read-only; the claim re-read still arbitrates).',
'',
' node scripts/pm/card-pick.mjs --order epic:#N,area:NAME,… [--seat LANE#N] [--repo OWNER/NAME]',
' node scripts/pm/card-pick.mjs --order epic:#N,area:NAME,… [--seat LANE#N|LANE@ACCOUNT] [--repo OWNER/NAME]',
' [--limit N] [--why] [--json] [--fixture FILE] [--now ISO]',
' node scripts/pm/card-pick.mjs --self-test',
'',
Expand Down Expand Up @@ -620,7 +624,7 @@ export function parseArgs(argv) {
} else if (flag === '--seat') {
const v = take();
opts.seat = parseSeat(v);
if (!opts.seat) return { error: `--seat must be LANE#N (a seat signature's first part), got \`${v}\`` };
if (!opts.seat) return { error: `--seat must be LANE#N or LANE@ACCOUNT (a seat signature's first part), got \`${v}\`` };
} else if (flag === '--limit') {
const v = take();
if (!/^[1-9][0-9]*$/.test(String(v ?? ''))) return { error: `--limit must be a positive integer, got \`${v}\`` };
Expand Down Expand Up @@ -682,9 +686,9 @@ const SELF_TEST_BATTERIES = Object.freeze({
"p3: an area's close-out after every p2 of that item; an epic's children keep their child order": 7,
'Blocked-by: an open target holds, a closed-unmerged PR holds, a merged PR and a closed issue release, cross-repo is read': 7,
'the same-grade order and the epic child order': 5,
'the candidate definition: label reasons, claims and the triage audit': 9,
'the candidate definition: label reasons, claims and the triage audit': 12,
'the walk: every page, the count checked, the limit and --why': 11,
'the CLI: usage, exits and the footer': 13,
'the CLI: usage, exits and the footer': 14,
});
const SELF_TEST_BATTERY_FLOOR = 8;
const UNATTRIBUTED_BATTERY = '(unattributed)';
Expand Down Expand Up @@ -859,6 +863,11 @@ export async function selfTest() {
t('⭐ another seat\'s Claim: excludes', claimReason([claim(SIG)], parseSeat('repo:objectstack#5')), 'Claim: by repo:objectstack#1');
t('this seat\'s own Claim: reads as already yours', claimReason([claim(SIG)], parseSeat('repo:objectstack#1')), 'Claim: by this seat (repo:objectstack#1) — already yours, not a new pick');
t('a Release: after the Claim: frees the card', claimReason([claim(SIG), { body: 'Release: session gone · back to queue', created_at: '2026-11-18T05:00:00Z' }], null), null);
// The second seat mark (ruling record 7249169754): a seat is its lane AND its mark, `#N` or `@ACCOUNT`.
const ACC = 'repo:objectstack@os-bill · os-bill · session_01ABCDEFGH';
t('⭐ a claim signed `LANE@ACCOUNT` reads as that account\'s seat: already yours for it, another seat\'s for everyone else', [claimReason([claim(ACC)], parseSeat('repo:objectstack@os-bill')), claimReason([claim(ACC)], parseSeat('repo:objectstack@OS-Bill')), claimReason([claim(ACC)], parseSeat('repo:objectstack#5'))], ['Claim: by this seat (repo:objectstack@os-bill) — already yours, not a new pick', 'Claim: by this seat (repo:objectstack@os-bill) — already yours, not a new pick', 'Claim: by repo:objectstack@os-bill']);
t('⛔ account X\'s claim is not read as account Y\'s seat of the same lane — and X signing Y\'s seat is no signature at all', [claimReason([claim(ACC)], parseSeat('repo:objectstack@os-warren')), claimReason([claim('repo:objectstack@os-bill · os-warren · session_01ABCDEFGH')], parseSeat('repo:objectstack@os-bill'))], ['Claim: by repo:objectstack@os-bill', 'Claim: (unsigned) — another session holds it unless the claim names you']);
t('⭐ CONTROL — a `#1` claim by a vacant seat still reads as seat 1\'s: ⛔ not as the account seat of the login on it, nor of any other account', [claimReason([claim(SIG)], parseSeat('repo:objectstack@os-warren')), claimReason([claim(SIG)], parseSeat('repo:objectstack@os-bill')), claimReason([claim(SIG)], parseSeat('repo:objectstack#1'))], ['Claim: by repo:objectstack#1', 'Claim: by repo:objectstack#1', 'Claim: by this seat (repo:objectstack#1) — already yours, not a new pick']);
const fleetCard = card(['area:ux', 'priority:p2'], { user: APP });
const r = await run({ issues: [fleetCard], comments: { [fleetCard.number]: [{ body: 'just a note' }] } });
t('⭐ a fleet card with no triage audit record is not a candidate', r.others[0]?.reasons, ['no triage audit — knock triage']);
Expand Down Expand Up @@ -902,6 +911,7 @@ export async function selfTest() {
t('both spellings of an option are read', [parseArgs(['--order=area:ux', '--limit=2']).opts.limit, parseArgs(['--order', 'epic:#7']).opts.order[0].number], [2, 7]);
t('--order as the last argument with no value is a usage error; --order "" is the p0/p1-only order', [Boolean(parseArgs(['--order']).error), parseArgs(['--order', '']).opts?.order], [true, []]);
t('--seat reads every lane a seat signature carries, an epic seat\'s epic:#N included', [parseSeat('epic:#35205#1')?.name, parseSeat('domain:ui#2')?.name, parseSeat('area:ux#1'), parseSeat('repo:objectstack#5 x')], ['epic:#35205#1', 'domain:ui#2', null, null]);
t('--seat reads both seat marks: `LANE@ACCOUNT` names the seat by its account, lower-cased, an epic seat\'s included; `LANE@` and both marks at once are refused', [parseSeat('repo:objectstack@OS-Bill'), parseSeat('epic:#35205@os-bill')?.name, parseSeat('repo:objectstack#5')?.seat, parseSeat('repo:objectstack@'), parseSeat('repo:objectstack#5@os-bill'), Boolean(parseArgs(['--order', 'area:ux', '--seat', 'repo:objectstack@os-bill']).opts?.seat), parseArgs(['--order', 'area:ux', '--seat', 'os-bill']).error?.includes('LANE#N or LANE@ACCOUNT')], [{ lane: 'repo:objectstack', seat: '@os-bill', name: 'repo:objectstack@os-bill' }, 'epic:#35205@os-bill', 5, null, null, true, true]);
t('⭐ the footer names lane ownership and the sub-epic an area item holds, beside the five legs it named before', [UNREAD_LEGS.length, UNREAD_LEGS.some((l) => l.startsWith('lane ownership — ')), UNREAD_LEGS.some((l) => l.startsWith('an area item that holds a sub-epic — '))], [7, true, true]);
t('⛔ the lane-ownership leg reads `domain:*` as file ownership, never as the seat\'s lane: lanes are seats and epics', [UNREAD_LEGS.some((l) => /outside this seat's lane|against your lane/.test(l)), UNREAD_LEGS.some((l) => l.startsWith('lane ownership — ') && l.includes('file ownership only'))], [false, true]);
const c = card(['area:ux', 'priority:p2', 'domain:ui']);
Expand Down
Loading
Loading