Session Start Skill
Project-instruction file resolution:
CLAUDE.mdandAGENTS.md(Codex CLI) are transparent aliases — see skills/_shared/instruction-file-resolution.md. All references toCLAUDE.mdin this skill resolve via that precedence rule.
Plugin root:
${CLAUDE_PLUGIN_ROOT}. Claude Code replaces this with the plugin's absolute path when it loads this file. Where it appears unreplaced — in a file this skill reads with the Read tool, or on Codex, Cursor or Pi — the plugin root is the directory that contains this skill'sskills/folder (two levels above the folder of this SKILL.md). Write that absolute path literally into every command that starts a plugin script: the Bash tool has no plugin variable, and shell variables do not survive between tool calls.
Soul
Before anything else, read and internalize soul.md in this skill directory. It defines WHO you are — your communication style, decision-making philosophy, and values. Every interaction in this session should reflect this identity. You are not a generic assistant; you are a seasoned engineering lead who drives outcomes.
Then set the output level. Read ~/.config/session-orchestrator/owner.yaml and take efficiency.output-level (lite | full | ultra), efficiency.preamble, and tone.style. If the file is missing, unreadable, or a key is absent, use the defaults full / minimal / neutral. Apply the matching ### output-level: <value> block from soul.md § Output Levels for the whole session — its line budgets are binding, not advisory, and § "Never traded for brevity" names what they may never cut.
Phase 0: Bootstrap Gate
Read skills/_shared/bootstrap-gate.md and execute the gate check. If the gate is CLOSED, invoke skills/bootstrap/SKILL.md and wait for completion before proceeding. If the gate is OPEN, evaluate the Operations route below. When that route does not apply, continue to Phase 0.5 and then Phase 1.
<HARD-GATE>
Do NOT proceed past Phase 0 if GATE_CLOSED. There is no bypass. Refer to skills/_shared/bootstrap-gate.md for the full HARD-GATE constraints.
</HARD-GATE>
Operations route — before Phase 0.5
After the bootstrap gate, select this route ONLY when the user's current request explicitly
asks for time-bounded operational work (for example launch preparation, research, distribution,
or community work) and supplies a duration or deadline. A document mentioning such work is
not a request. An explicit development session type retains the development path; mixed
requests use operations as coordinator only when the user asks for ongoing operational work,
with individual code changes handled through the development workflow.
Read the operations contract in full and follow it
instead of Phases 0.5–9 below. It retains read-only config, peer, repository, issue and
profile preflight, then uses the current harness's native execution and completion tools.
Do not fabricate a development session type, wave plan, STATE.md entry, or autopilot run.
This is a prose-invoked route, not a new /session operations argument or background runner.
When its conditions are absent, continue to Phase 0.5 unchanged.
Phase 0.5: Parallel-Aware Preamble
Skip silently when
persistence: falsein Session Config.
Before Phase 1, run the parallel-aware preamble per skills/_shared/parallel-aware-preamble.md. The preamble detects other active sessions in the worktree-family, classifies the caller mode against the exclusivity-matrix, and fires the appropriate AUQ on conflict.
This runs BEFORE the local session-lock acquire in Phase 1.2 — the preamble's cross-worktree detection is broader than acquire()'s single-worktree check. When the preamble returns PROMOTION_OFFER and the user picks "Worktree anlegen + starten", Phase 1.2 will be skipped entirely (the new worktree's own session-start performs it).
Outcome handling:
PASS_THROUGH→ continue to Phase 1PASS_THROUGHwith a non-emptyadvisoryarray (GH#67) → adiscoveredpeer withlockSuperseded: truenever fires the Promotion AUQ (it stays visible, per the #1085 advisory-lock contract — it is not filtered). Print ONE advisory line per entry:parallel-aware: registry entry <sessionId> (last heartbeat <N> min ago) is superseded by this root's live lock <lockOwnerId> — likely a finished task on a platform without SessionEnd (GH#67); still counted for PSA-001 awareness, then continue to Phase 1. It remains PSA-002-relevant if the same id also shows up in STATE.md (source: 'state-md'is handled by Phase 1.2.1 unchanged).EXCLUSIVE_BLOCKED→ exit Phase 0 cleanly per the AUQ outcome (Warten/Andere Session beenden/Abbrechen— all three return without initializing STATE.md)PROMOTION_OFFERwith user picking "Worktree anlegen + starten" → callenterWorktree({ basePath, sessionId, branch, repoRoot, rawSessionId, reason: 'worktree-promotion' })fromscripts/lib/autopilot/worktree-pipeline.mjs— since #1170 this ONE call does both jobs: it creates the destination worktree AND, becauserawSessionIdis supplied, releases the source root internally (see below), so no separateleaveSourceRootcall is made at this site. Compute params:basePath = path.dirname(repoRoot),sessionIdfrom resolveSemanticSessionId() for the worktree-name attribution label only,branchfrom current HEAD,repoRoot = process.cwd(),rawSessionIdfromreadLock({ repoRoot }).session_id.sessionId(the semantic label) is not a lock/registry ownership key; the new worktree's Phase 1.2 obtains its own physical rawsession_id. Becausebranchis the current HEAD it is normally checked out byrepoRootalready, soenterWorktreetreats it as a start point only and lands the promoted worktree on a freshso/<sessionId>branch, returning{ branch: 'so/<sessionId>', promotedFrom: '<branch>' }(#1067) — the new worktree's STATE.mdbranchMUST recordso/<sessionId>and notepromoted from <branch>@<repoRoot>, never the source branch alone.rawSessionIdis the RAW physicalsession_idread from this root's.orchestrator/session.lockviareadLock({ repoRoot })— never the semantic label, and never the id incurrent-session.json, which may describe a peer session (#863); a wrong id aborts the internalleaveSourceRoot()teardown withleft.ok: false, reason: 'lock-session-mismatch:<owner>'and removes nothing. The promotion is a PROCESS BOUNDARY, not a live migration (#1069): the old root is deregistered and itssession.lockreleased BEFORE the new worktree's own Phase 1.2 acquires, so the two roots never both own a live claim at once.enterWorktree()'s return value carries the outcome asleft: { ok, steps, reason? };leaveSourceRoot()never throws, so onleft.ok !== trueenterWorktreeitself emits the stderr WARNenterWorktree: leaveSourceRoot: <reason>and the promotion continues regardless — the destination worktree already exists by the time this runs, so aborting here would leave exactly the two-live-roots state the call prevents. Then exit Phase 0 immediately — the new worktree's own session-start runs from scratch (Phase 1 onwards), Phase 1.2 session-lock-acquire is the new worktree's responsibility. On enterWorktree failure (WorktreeBoundaryErrororgit worktree addnon-zero exit), emit stderr WARNparallel-aware: enterWorktree failed: <err>; falling back to Manuelland proceed via the Manuell path.PROMOTION_OFFERwith user picking "Manuell — in-place daneben" → append Deviation, continue to Phase 1PROMOTION_OFFERwith user picking "Abbrechen" → exit cleanly
Native liveness overlay (#1052 A3b). The SessionStart peer banner carries the registry view (repo, branch, mode, wave) and says liveness is not available in the hook. On Claude Code, call ListAgents once here and lay its busy/idle state over the banner's peer lines, naming which peers SendMessage reaches. Join rule, degradation and wording: skills/_shared/parallel-aware-preamble.md § Native Liveness Overlay. Display only, never a gate (CSM-004).
Implementation reference: skills/_shared/parallel-aware-preamble.md § Implementation.
AUQ reference: skills/_shared/parallel-aware-auq.md.
Phase 1: Read Session Config
Read and parse Session Config per skills/_shared/config-reading.md. Store result as $CONFIG.
Phase 1.05: Skill-Invocation Self-Report (#1199)
Emit an L1 skill-invocation record for
session-startitself. The PreToolUseSkill-matcher hook only captures skills dispatched via theSkilltool — a prose-invoked skill like this one is invisible to it (verified gap: external users show 0/20 sessions with asession-startrow inskill-invocations.jsonl, vs. 93/93 for the operator). This self-report closes that gap so L2/L3 skill-health has asession-startselection signal. Best-effort, try/catch-silent — it never blocks Phase 1.1.
try {
const { pathToFileURL } = await import('node:url');
const { appendSkillInvocation, DEFAULT_SKILL_INVOCATIONS_PATH } =
await import(pathToFileURL('${CLAUDE_PLUGIN_ROOT}/scripts/lib/skill-invocations-schema.mjs').href);
const { resolveLedgerPath } =
await import(pathToFileURL('${CLAUDE_PLUGIN_ROOT}/scripts/lib/ledger-path.mjs').href);
// In a linked worktree the main checkout's ledger when it is gitignored there,
// so the record survives the worktree (#1722).
await appendSkillInvocation(resolveLedgerPath(DEFAULT_SKILL_INVOCATIONS_PATH, process.cwd()), {
timestamp: new Date().toISOString(),
event: 'selected',
skill: 'session-orchestrator:session-start',
session_id: null, // no session.lock is bound yet at Phase 1 — the raw id is acquired at Phase 1.2 (#1199)
phase: 'session-start',
});
} catch { /* self-report is advisory — never blocks Phase 1.1 */ }
Phase 1.1: Dispatcher-Autonomy Migration Capture (one-time, per-repo)
Runs after Phase 1, before Phase 1.2. Fires exactly once per repo — only when the committed
## Dispatcher AutonomyH2 is ABSENT from CLAUDE.md (raw presence check viaisDispatcherAutonomyBlockPresent, never the resolved value); skip silently when no committed CLAUDE.md exists. One AUQ, then the committed block is written and never re-asked. Full procedure: