feat(M-A Stage 5): install.sh K-1 companion-install prompts - #258
Merged
Conversation
…Stage 2 v3 design Implements Stage 2 v3 final design (PR #255 merged). New section after Phase 3 (AIF), before Phase 4 (Scripts). Per-companion prompts default [y/N]. COMPANIONS env var + --companions= flag + non-tty auto-default for headless. Idempotency via detect-and-skip with tool-availability guards. Warn-and-continue on failure. D1/D2/D3 deferred; D5=Option A (print + instruct); D6=Option A ONLY (passive pre-seed deferred to future M-A wave per Stage 2 v3 §4.8 maintainer decides escape). 3 companions: Superpowers + TaskMaster (CC plugin active install via claude plugin install --scope user); OhMyOpencode (print + instruct only per D5 Option A); aif-handoff informational note (Phase 3 auto). Stage 3 §4.2 OhMyOpencode escape hatch documented. Stage 3 §4.3 Cline/OpenCode gap deferred per D1/D2. Prior-art: prior-art-evaluations.md#84 (claude plugin install <plugin> --scope user — administrative subcommand, VERIFIED-FREE per Stage 2 v3 §4.8, verdict ADOPT).
9 tasks
artyhoo
added a commit
that referenced
this pull request
Aug 18, 2026
#1467) S2 of the skill-harmonization-mechanisms umbrella (spec §5.3, D-H5/P-5). Four parts, all four required — the diff is deliberately not prose-only. 1. Runtime-bridge split (`AifHandoffBackend`): `dispatch()` was create+unpause in one atomic call, so a lane became observable only AFTER the work started. Split into `claim()` (POST /tasks paused:true), `release()` (unpause) and `cancelClaim()` (DELETE), behind an optional `ClaimCapableBackend` interface + `supportsClaims()` guard. `dispatch()` is now literally claim+release with the original rollback, so the one-shot callers are behaviourally unchanged — all 227 pre-existing runtime-bridge tests pass untouched. New CLI entrypoint `cli/claim.ts` exposes the three verbs; unlike `dispatch.ts` it exits NON-zero and never falls back to ManualBackend, because a claim that silently failed is worse than no claim. 2. `/pipeline` §6 Step 3 reordered: claim-create fires BEFORE the Phase -1 window, release on GO, cancel on RED. Detail routed to `references/claim-machinery.md` + `references/stage-gates.md` so SKILL.md stays at 599 lines (the 600 gate). 3. `probe-inflight.sh` signal 6 (`claim`): the jq filter for signal 5 selects only done/verified tasks carrying a branch, so a fresh paused claim was invisible to ALL five existing signals. Matching is by slug in title+description — no claim marker field, because a second status vocabulary is what P-5 forbids. 4. Orphan expiry: a claim past `PROBE_CLAIM_TTL_MIN` (default 120min) reads `STALE-CLAIM` instead of blocking the stage forever (starvation mode TD-F5). Surfaced, never auto-cancelled — an automatic sweep would race the sessions it protects. Unparseable/missing createdAt counts as live (fails toward blocking). Also: `cli/claim.ts` + the split backend are added to the runtime-bridge vendor drop. The shipped `/pipeline` now instructs a consumer to run it, and the vendor README's own admitting criterion (PR #1432 precedent) is «vendor what a shipped skill instructs the consumer to run» — otherwise the promise is a documented lie. Install baselines regenerated (`SNAPSHOT_MODE=capture`); the reviewed delta is exactly 4 lines per JS fixture: the pipeline SKILL.md hash, the two new reference docs, and `.prettierignore` (the installer auto-adds shipped docs to its managed ignore block — reproduced and confirmed against a pristine staging checkout, which is 15/15 clean). Live proof (probe P4, spec §6) against the running aif queue, not the diff: FRESH → claim-create → CLAIMED (age=0m live) → cancel → 404 → FRESH; orphan branch proven on the real task's own createdAt with the clock advanced 3h → STALE-CLAIM; slug isolation and cwd-independence both confirmed. Own cold review of the diff before handoff (T19) caught three defects, all fixed here with regression tests: (a) the stale count was `grep -c ' stale '` over the whole detail line, so a claim titled "demo fix stale refs" counted as expired one minute after creation — the verdict then told the operator to cancel a lane somebody was actively holding. Counts now read the fixed field-3 state token, and titles are squashed to one line so they cannot inflate the count either. (b) `cancelClaim()` returned void, so the CLI printed "lane is free" even when the DELETE failed. It returns a boolean now and the CLI exits non-zero with an honest message — best-effort must not mean unreported. (c) the live proof then showed (b) firing on a REPEAT cancel: a 404 means the claim is already gone, i.e. success. 404 is now treated as cancelled, so an idempotent retry stops raising a false alarm. The kickoff §3 sanctioned a `Prior-art: skipped` escape hatch here; the pre-push gate rejected it, correctly — `cli/claim.ts` is 140 LOC under `packages/`, which is a capability commit by CLAUDE.md's own definition. The gate won, and the fresh context7 pass it forced (3 phrasings, `/lee-to/aif-handoff`, 2026-08-18) paid for itself twice. It CONFIRMED the design premise — «paused tasks are excluded from coordinator selection queries», so a claim really does occupy no lane — and it surfaced prior art the design had not accounted for: upstream already claims tasks atomically via `lockedBy`/`lockedUntil` with automatic stale-claim release. T16 check says that is a different problem class (mutual exclusion between poll cycles over an EXISTING row, vs. our intent registered BEFORE any row exists), so it is not the surface to reuse; its stale-claim vocabulary IS adopted for the orphan branch, with the auto-release half deliberately declined — our claim's owner may still be alive. Recorded as SSOT #258 (ADAPT) following the #125 precedent for re-evaluating a candidate against a different capability; #28 keeps its row and gets a `Last reviewed` bump. §1.7: forward-check applied — the new claim protocol is itself gated, not trusted: probe verdicts are asserted in packages/core/skills/dispatcher/probe-inflight.test.ts:1 (claim signal, orphan expiry, precedence) and the backend split in packages/runtime-bridge/test/aif-claim-split.test.ts:1, so the guard cannot silently regress to attention; backward-check sweep — every probe consumer enumerated by grep, not by memory: .claude/skills/dispatcher/SKILL.md:65 was the only surface documenting the signal table + verdict ladder and is updated (signal 6 + CLAIMED/STALE-CLAIM), the sibling CLI entrypoint guard in packages/runtime-bridge/test/dispatch-import-no-sideeffect.test.ts:69 was extended to claim.ts, the shipped vendor drop was re-vendored so the promise in .claude/skills/pipeline/SKILL.md:433 reaches a consumer, and CLAUDE.md's pre-dispatch section enumerates no verdicts so it needed no edit (surfaced, not silently skipped). Prior-art: prior-art-evaluations.md#258 (verdict ADAPT — the claim reuses the existing aif `paused` REST primitive rather than adding one; upstream's own `lockedBy`/`lockedUntil` claim is a T16 problem-class mismatch, vocabulary adopted for STALE-CLAIM, mechanism not). Prior-art: prior-art-evaluations.md#28 (verdict DEFER — its «pipeline automation requires machine-readable state without human presence» trigger fired; the capability-specific re-evaluation is #258, per the #125 precedent). Co-authored-by: Test <test@example.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
[y/N];COMPANIONS=none|all|csvenv var +--companions=flag for headless; non-tty auto-default; idempotency detect-and-skip; warn-and-continue on failureVerify-trace
grep -n "Optional companion installs" install.shshows line 332[Y/n]occurrences — verifiedgrep -E "\[Y/n\]" install.shEMPTYgrep -cE "should_install_(superpowers|taskmaster|omo)" install.sh= 18 references# ─── 3. AI Factory templates ───blockgit diff origin/staging -- prior-art-evaluations.mdshows single+line, zero-git diff origin/staging --statshows install.sh + prior-art-evaluations.md + 1 new verification logclaude plugin install ... --scope user(VERIFIED-FREE per Stage 2 v3 §4.8)bunx oh-my-openagent install)§1.7 Forward-check applied
claude plugin install --scope useris VERIFIED-FREE per Stage 2 v3 §4.8 (administrative subcommand;claude --helpscopes--max-budget-usdto--print/-ponly). No CI changes. Evidence: docs/meta-factory/research-patches/2026-05-27-stage-5-install-sh-k1-verification.md:158[y/N];COMPANIONS=noneor non-tty auto-default produces zero interactive prompts. No companion mandatory. Evidence: install.sh:332-462 (entire K-1 block)[Y/n]patterns. Evidence: install.sh:357 install.sh:397 install.sh:437 (all three prompts use[y/N])Falsifiers: wrong if
claude plugin install --scope useris NOT a valid shell-runnable CLI subcommand on the consumer machine — would be falsified byclaude plugin --helpnot listinginstallsubcommand. Wrong if Anthropic announces billing extension to administrative subcommands beyond--print/-pmode — would be falsified by re-running probes in Stage 2 v3 §4.8.§1.7 Backward-check applied
+line; zero deletions).clinerules/,.opencode/plugins/,.cursor/rules/,extraKnownMarketplacesartefacts. Evidence: install.sh:332 install.sh:462 (K-1 block scoped only to 3 active companions + aif-handoff info note)Conclusion: No silent supersession; no scope creep; AIF Phase 3 untouched; v1→v2→v3 design chain preserved through Stage 2 v3 §4.8 verify trace.