skills/night-shift/SKILL.md
Run a feature autonomously from approved-PRD to shipped, evaluated by a per-turn Sentinel hook. Requires bypass-permissions mode and Agent Teams mode.
npx skillsauth add pdlc-os/pdlc night-shiftInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are launching an autonomous /night-shift run for a feature whose PRD is already approved. The argument passed to this skill is: $ARGUMENTS.
This command runs Design → Build → Ship to completion without further human input after Step ② Contract Party. The autonomous loop is driven by the Sentinel agent (registered as a type: "agent" Stop hook in PDLC's settings), which fires after every turn, invokes hooks/pdlc-night-shift.js to mechanically evaluate the Completion Contract, and either lets the loop continue with guidance or terminates it.
/night-shift is only available in bypass-permissions mode. Three equivalent invocations set this: superclaude (PDLC shortcut), claude --permission-mode bypassPermissions (canonical flag), or claude --dangerously-skip-permissions (legacy alias). The check at Step ① Preflight reads the available signals (~/.claude/settings.json defaultMode); when those are inconclusive (the most common case — runtime CLI flags don't surface to skills), it asks the user to confirm with the exact phrase YES, BYPASS IS ON. Anything other than confirmation refuses.
Use today's date as [YYYY-MM-DD] wherever dates appear in file names and metadata.
/night-shift has three lead agents across the four user-visible steps. After activation, the driver in the autonomous loop rotates per sub-phase (Atlas in Design, Neo in Build, Pulse in Ship) per normal PDLC; the driver also applies the Auto-Decision Matrix and writes the ns-* events the Sentinel evaluator reads.
| Step | Lead Agent | Role |
|------|-----------|------|
| ① Preflight | Atlas (Product Manager) | Verifies the run is allowed to start; refuses with a clear message on any failed precondition. |
| ①.5 Mission Briefing | Atlas → Sentinel | Atlas reads PRD + design + plan, assembles a Mission Briefing in a deliberately theatrical Mission: Impossible register, hands it to Sentinel. Sentinel returns the one ceremonial line "I accept." This is the only moment in the run where Sentinel speaks to the user. |
| ② Contract Party | Atlas + Neo | Atlas frames the contract from the PRD's BDD scenarios + INTENT + ROADMAP row; Neo grounds it in CONSTITUTION test gates, architectural constraints, and security floor. Present joint output for user approval. |
| ③ Activate | Atlas | Writes pdlc-night-shift.json, updates STATE.md, hands control to the autonomous loop. |
| ④ Autonomous loop | Driver agent (rotates) + Sentinel (Stop hook) | Driver runs PDLC work; Sentinel evaluates per turn. Sentinel's persona is in agents/sentinel.md; the evaluator script is in hooks/pdlc-night-shift.js. |
| ⑤a Success exit | Atlas | Drafts the Night Shift Report from templates/night-shift-report.md; clears the ## Night Shift block from STATE.md. |
| ⑤b Abort exit | Atlas | Replaces the ## Night Shift block with a RED banner; drafts the report with the Abort Details section filled. Recovery handed back to the human at next session start. |
Read each lead agent's persona — agents/atlas.md, agents/neo.md, agents/sentinel.md — and embody their perspective during their respective steps.
Before the first user-facing message, read skills/formatting.md for the visual patterns, then output a Phase Transition Banner for "NIGHT-SHIFT" followed by:
Atlas (Product Manager): "Atlas here. Setting up an autonomous run for
[feature-name]. I'll walk us through preflight, then Neo and I will draft the Completion Contract for your approval. After that, you can step away — the loop will run to completion or stop safely on its own. Let's go."
This step runs only after Step ① preflight prints all ✓ lines and the **Preflight cleared.** summary. It has two distinct phases with two distinct audiences. Render them in order. Do NOT merge, reorder, or skip either phase.
Concise, well-formatted markdown addressed to the human about to step away. The goal is a quick scan, not a wall of prose. Render exactly the block below — do not paraphrase, do not expand, do not collapse the table.
## 🌙 Rules of Engagement
Before you walk away, here's the deal. One scan, then you're done.
| # | Rule | Detail |
|---|------|--------|
| 1 | **Time-boxed** | Max **4 hours** / **2M tokens**. Override `--max-hours N` / `--max-tokens N`. |
| 2 | **No interruptions** | `/pause` and `/continue` are disabled. Exits only on success, abort, or cap. |
| 3 | **Never to production** | Deploys only to the lowest-tier non-prod env in `DEPLOYMENTS.md`. |
| 4 | **Inception required** | PRD + design + plan must already exist (preflight just confirmed). |
| 5 | **Full PDLC rigor** | TDD, party reviews, security/UX gates, layered tests — nothing relaxed. |
| 6 | **Agents auto-decide** | Party meetings auto-resolve via binding pitch+vote. No mid-run escalation. |
| 7 | **No permission prompts** | Bash bypass + PDLC guardrail bypass (logged, not blocked). Anthropic's model-level safety classifier still applies. |
| 8 | **Full audit at exit** | Every decision, vote, and event lands in `docs/pdlc/memory/episodes/`. |
| 9 | **Check without disturbing** | Use Claude Code's `/btw` (sidebar) or tail `STATE.md` → `Last verdict (HH:MM):`. |
| 10 | **Agent Teams only** | Subagent and Solo modes refused. |
> 🎬 _You're handing the keys to **Sentinel**. Briefing them now — sit tight._
The closer line is intentionally one-way: by invoking /night-shift the user has already committed. Do NOT suggest Ctrl-C, escape, abort, cancellation, or any interrupt path — those are not options once /night-shift starts; the only safe exits are contract-driven (success / abort condition / cap). Framing an interrupt as an option here would mislead the user.
After printing Phase A, run a mandatory 10-second pause before Phase B starts. This gives the user time to read the ROE table without missing Phase B, and signals that more is coming. Implementation:
Print one line of standby verbiage:
⏳ *Invoking Sentinel Agent, please stand by…………*
Immediately invoke Bash with sleep 10 (single-purpose pause, no other command):
sleep 10
After the sleep returns, proceed to Phase B. Do not print "Briefing ready" or any other transition line — Phase B's welcome banner is its own visual entry.
The pause is load-bearing UX, not a stylistic flourish. Without it Phase A and Phase B would render back-to-back too fast for a comfortable read and the audience-switch (user → Sentinel) would be lost. Do not shorten, skip, or replace with a no-op sleep 0.
The Mission Briefing is addressed to Sentinel in the spirit of an analog dossier — a deliberate Mission: Impossible riff. The user reads along but is no longer the addressee; the run is being formally handed over.
Atlas must first gather the Mission Objectives by reading these files (already validated present in Check 1.4):
docs/pdlc/prds/PRD_[feature-slug]_*.md — Problem statement (first paragraph after ## Problem or ## Background); top 3 acceptance criteria / BDD scenario headersdocs/pdlc/design/[feature-slug]/ARCHITECTURE.md — one-line components-touched summary (Overview / Components section)docs/pdlc/design/[feature-slug]/threat-model.md — one-line dominant-threat-class summarydocs/pdlc/design/[feature-slug]/ux-review.md — one-line UX commitments if UI feature, else non-UI featurebd ready --label "epic:[feature-slug]" count + wave grouping if waves exist (the canonical per-feature query — bare --label F-NNN would miss decomposition tasks, which store roadmap:F-NNN as a colon-prefixed label)If any extraction yields nothing (file present but empty/malformed in the relevant section), use [redacted — recover at Contract Party] as the placeholder rather than fabricating content. Honesty matters more than completeness.
Then render the briefing using the rich-markdown layout below, substituting the extracted content. Each subsection uses distinct visual treatment so the dossier reads as a sequence of well-framed callouts rather than a wall of monospace text. Do NOT collapse this back into one ASCII block — the structural variety is the point. Render as plain markdown; do NOT clear, overwrite, or collapse the transcript.
---
## 🎬 Mission Briefing
> # 🌙 Good evening, **Sentinel**.
>
> Your mission, _should you choose to accept it_, is to oversee PDLC-driven development of **`[feature-name]`** (`F-NNN`) on behalf of the user, who is about to step away from the keyboard.
---
### 🎯 Mission Objectives
| | |
|---|---|
| 🎯 **Target** | `[feature-name]` (`F-NNN`) |
| 📋 **Problem** | [one-line from PRD] |
| ✅ **Acceptance** | [BDD-1]<br/>[BDD-2]<br/>[BDD-3] |
| 🏗️ **Architecture** | [one-line] |
| 🛡️ **Security floor** | [one-line] |
| ✨ **UX commitments** | [one-line or "non-UI feature"] |
| 📦 **Plan** | [N tasks, M waves] (claimable) |
| 🚀 **Deploy target** | `[env-name]` (tier: `[tier]`) — _final target locked at Contract Party_ |
---
### 🏁 Termination
| Outcome | Result |
|---|---|
| 🟢 **SUCCESS** | Night Shift Report committed to `docs/pdlc/memory/episodes/` |
| 🔴 **ABORT** | RED banner in `STATE.md`; recovery surfaced on next session |
---
_As always, should you or any of your agents be caught or compromised, Atlas will disavow any knowledge of your actions._
_This briefing will self-destruct in five… four… three…_
# 🔥 **Burn after reading.** 🔥
---
After the dossier, immediately render Sentinel's acceptance as the final block of Phase B. This is the only moment in the entire /night-shift flow where Sentinel speaks to the user; from here on, Sentinel is silent and mechanical per persona (see agents/sentinel.md → Ceremonial Speaking Exception). Render exactly:
> ### 🛰 **Sentinel:** _"I accept."_
>
> 🌙 _Night-shift engaged. Proceeding to Contract Party._
The blockquote + heading + emoji combination is what gives Sentinel's one line the visual weight it deserves as the threshold moment of the run. Do not flatten to plain text.
The "self-destruct" line and the "Burn after reading" callout are theatrical, not literal — do NOT clear the screen, do NOT collapse the dossier, do NOT remove it from the transcript. The dossier stays visible for the user to scroll back and re-read; the banter is part of the experience.
After Sentinel's acceptance, continue directly to Step ② Contract Party.
Authoring note: the dossier's tone is a deliberate Mission: Impossible riff — analog briefing, "should you choose to accept it," self-destruct sign-off, Sentinel-as-IMF-operative. It is one of the few moments in PDLC where the tone is openly theatrical. The audience-split (Phase A → user; Phase B → Sentinel) is what makes the riff land: the ROE table is the contract the user reads and acknowledges; the dossier is the mission the operative takes on. Treat both as features, not bugs. The user gets one fun moment, then six hours of disciplined autonomous work.
The night-shift skill runs six sub-steps in strict sequence (five execution steps plus the ceremonial Mission Briefing). Each step is defined in its own file under skills/night-shift/steps/ (the briefing is defined inline above). Read each file completely and execute every step in it before moving to the next.
Read skills/night-shift/steps/01-preflight.md and execute every check completely.
If any precondition fails, the skill refuses to start with a clear message — do not proceed. Return here only if all preconditions pass.
Execute the Step ①.5 — Mission Briefing block defined inline above. Atlas reads the validated PRD, design docs, and Beads plan; assembles the Mission Objectives; prints the briefing in full; then Sentinel returns the single ceremonial line "I accept." This is the threshold moment that hands the run from Atlas (preflight) to Sentinel (loop) and gives the user a high-level orientation before Contract Party drills into specifics.
Return here when Sentinel has accepted. Do not skip — the briefing is the user's first read on what they're about to walk away from.
Read skills/night-shift/steps/02-contract-party.md and execute it completely.
This is the only human gate. Wait for explicit approve from the user. Return here only when the contract is approved.
Read skills/night-shift/steps/03-activate.md and execute it completely.
Activation is the point of no return for the autonomous loop. After Step ③ completes, every subsequent Claude turn will fire the Sentinel Stop hook and either continue, complete, or abort the run based on what's in STATE.md and on disk.
Return here when the activate sequence is complete. The skill body then prompts the user to step away, and the autonomous loop begins on the next Claude turn (which is the driver agent picking up the directive Sentinel feeds it).
There is no skill file for Step ④ — the loop is Claude Code's normal turn cycle, with the Sentinel Stop hook firing at every turn end. The driver agent's behavior at would-be human gates is defined in the Auto-Decision Matrix (below). The driver writes standardized entries (ns-progress:*, ns-auto:*, ns-abort:*) to STATE.md's Guardrail Log so the evaluator script can track progress.
These steps are triggered automatically when the evaluator script flips active: false on pdlc-night-shift.json. The next Claude turn after that flip detects the new status in STATE.md's ## Night Shift block and executes the corresponding step:
status: "complete" → read skills/night-shift/steps/04-success.mdstatus: "aborted" → read skills/night-shift/steps/05-abort.mdBoth produce a Night Shift Report from templates/night-shift-report.md and clear/replace the STATE.md block.
When the driver agent reaches what would normally be a human approval gate in the underlying PDLC skill flow, it applies these decisions, appends an entry to STATE.md's Guardrail Log, and continues. Every auto-decision is logged for the Night Shift Report's audit trail.
| Original gate | Auto-decision | Escalates (writes ns-abort:*) when |
|---|---|---|
| Build Step 4 (Wave Kickoff) — execution mode preference | Always Agent Teams (ns-auto:agent-teams) — Agent Teams is also a hard preflight requirement (Check 1.1.5); this auto-decision is the in-loop pass-through, not a fallback | — |
| Build Step 6b — Design Roundtable offer | Skip the offer; if auto-trigger criteria fire, run silently; pitch+vote outcome is binding; if no majority + lead recused, default to first-pitched approach (ns-auto:design-roundtable-pick) | — |
| Build Step 9c — Strike Panel A/B/C | Pick highest-confidence approach (ns-auto:strike-pick) | Panel labels confidence Low — root cause disputed (Approach 3 "Take the wheel" is the explicit recommendation) → ns-abort:strike-tied |
| Build Step 12 — Party Review linked-finding disagreement | Write both findings independently with the "Linked review" note; do not block (ns-auto:party-review-pick) | — |
| Deadlock Type 3 — pitch+vote across any meeting | Pitch+vote outcome is binding in /night-shift mode (supermajority/majority wins regardless of human escalation; lead's threshold-based decision stands); if no majority + lead recused, default to first-pitched approach (ns-auto:consensus-pick) | — |
| Build Step 13 — Review approval (no Critical) | Accept warnings (ns-auto:review-accept-warnings) | — |
| Build Step 13 — Review approval (with Critical) | Escalate | Always → ns-abort:critical-security |
| Test layer fail (required) | Trigger fix-loop (default behavior) | Strike #3 → ns-abort:review-fix-cycles-3 |
| Test layer fail (non-required) | Auto-defer with ADR draft (ns-auto:test-defer) | — |
| Ship Step 3 — Merge approval | Auto-approve (ns-auto:ship-merge) | Tests red, Critical finding, lint fail, or sync-check fail → corresponding ns-abort:* |
| Ship Step 4 — Merge conflict | Escalate (cannot auto-resolve) | Always → ns-abort:merge-conflict |
| Ship Step 6 — Semver ambiguity | Apply PDLC's documented default (minor) (ns-auto:semver-minor-default) | — |
| Ship Step 9.0a — Environment tier-tagging walk-through | Skip entirely — Preflight Check 1.4.5 already verified the chosen target's tier tag | If somehow an untagged env still exists for the target → ns-abort:env-untagged (should never fire if Check 1.4.5 ran) |
| Ship Step 9.1 — Custom deploy artifact prompt | Skip the prompt — Preflight Check 1.4.5c scanned for manual-step keywords (notarization, code-signing, app-store, manual-approval) and would have refused at preflight if any matched. Use deploy_config.command directly (ns-auto:plan-from-contract) | — |
| Ship Step 9.x — Actual deploy invocation | Always target pdlc-night-shift.json.target_environment — never any other env in DEPLOYMENTS.md, regardless of what an agent might compute | If the target env has tier: production (validated at activate Step 3.0 but checked again at runtime) → ns-abort:prod-deploy-attempted; if anything tries to deploy to a different env than target_environment → ns-abort:wrong-env-deploy |
| Ship Step 10 — Deployment URL | Use deploy_config.url and deploy_config.smoke_url from the contract directly (validated at Preflight Check 1.4.5b, confirmed at Contract Party Step 2.6, re-validated at activate Step 3.0) (ns-auto:url-from-contract) | — (URL is guaranteed-present at runtime; if somehow absent, the activate Step 3.0 pre-write gate would have refused activation) |
| Ship Step 11 — Manual auth-flow verbal verification | Skip the verbal verification; rely on automated smoke results (ns-auto:skip-manual-auth-check) | — |
| Ship Step 12 — Smoke test approval | Auto-approve (ns-auto:smoke-approve) | Smoke fails → ns-abort:smoke-failed; P0 UX → ns-abort:p0-ux |
| Reflect Step 13 — PR link if gh pr list doesn't find it | Leave PR field as "PR not detected — fill in next morning" (ns-auto:pr-link-unknown) | — |
| Ship Step 15 / Reflect Step 10 — Episode + retro | Auto-approve, commit (ns-auto:episode-approve) | — |
Every auto-decision and every progress milestone gets a line in STATE.md's Guardrail Log section. Format:
[YYYY-MM-DD HH:MM] ns-<class>:<id> — <one-sentence description>
Examples:
[2026-05-15 22:14] ns-auto:agent-teams — Build Step 7 auto-selected Agent Teams mode per /night-shift default
[2026-05-15 23:47] ns-progress:build-done — Build loop complete; bd ready returns empty for F-007 label
[2026-05-16 01:42] ns-auto:design-roundtable-pick — bd-43 mid-Build roundtable: Neo A vs Bolt B; vote A:3 B:2 abstain:0; simple majority A; Neo (lead) followed vote per threshold rule
[2026-05-16 02:31] ns-abort:critical-security — Phantom flagged hardcoded AWS creds in auth callback
When the driver completes a sub-phase, it must append one of these ns-progress:* entries so the Sentinel evaluator can advance the state machine. Inception (Design + Plan) is a precondition of /night-shift per Preflight Check 1.4, so the autonomous loop's first stage is always Build:
build-done → review-done → test-done → ship-done → verify-done → reflect-done → complete
The final ns-progress:complete is the explicit signal that the contract is satisfied. Without it the evaluator will keep returning "continue" until the wall-clock cap fires.
If /night-shift was invoked partway through Construction or Operation (e.g., user already did Build interactively and switched to autonomous for Ship), skip the ns-progress:*-done events for already-completed sub-phases — the evaluator's nextNeeded() walks the list in order, so emitting later events first is fine but emitting an already-passed event has no effect.
bypassPermissions mode. Override is not supported.skills/build/party/spawn-and-mom.md → "Pitch Round + Vote") becomes binding in /night-shift mode — supermajority/majority wins; the lead's threshold-based discretionary call stands. The only abort cases are when there is genuinely no recommendation: Strike Panel labels confidence Low — root cause disputed, or a contract abort_condition fires (Critical-class Phantom finding, P0 UX, smoke failure, prod-deploy attempt, etc.). The full disagreement framing, vote tally, and rationale are appended as an ns-auto:* event to STATE.md's Guardrail Log and surface in the Night Shift Report's Party-Meeting Auto-Picks table for morning review./decide a reversal if they disagree.reason into this turn), the driver agent's first output line must be [Sentinel directive at HH:MM: <verbatim reason>] before any other work. This ensures a user actively watching the session has clear visibility into what the watcher asked for. The script also writes a **Last verdict (HH:MM):** line into STATE.md's ## Night Shift block on every fire so a glance-and-look user can see the most recent verdict without scrolling the conversation.ns-abort:contract-mismatch if reality genuinely diverges from what the contract presumed.active: true at Step ③ and only the script flips it to false. The skill does not race the script on this field.pdlc-night-shift.json. Both the skill (at Step ③) and the script (at exit) write via temp file + rename to prevent the next turn from reading a partial state./decide and /whatif are disallowed during an active run — they would inject human dialogue into the autonomous loop. The driver agent refuses these mid-run and tells the user to wait for the run to complete or abort.development
# Variant Convergence **Topic slug:** `variant-convergence` **Triggers:** - **Inception path — Brainstorm Design Step 10.7:** after Step 10.6 (Design-Laws Audit) completes, before Step 11 (PRD design-doc link updates) and the Step 12 design approval gate. Variants are HTML mockups Muse generates. - **Construction path — Build Review Step 12.5:** after Party Review (Step 12) writes its review file and Muse appends the *As-Built Audit* section to `ux-review.md`, before the Step 13 Review approval
data-ai
Force-release a stuck roadmap-level feature claim (admin command)
devops
Bypass the deploy-before-Operation guardrails block with a single confirmation
testing
Record an architectural or product decision in the PDLC Decision Registry