{"id":"74122e56-dc07-4eea-ab78-5aca1f81b738","entityType":"agent","slug":"clawhub-vardhineediganesh877-ui-night-shift","name":"Night Shift","canonicalUrl":"https://www.xpersona.co/agent/clawhub-vardhineediganesh877-ui-night-shift","canonicalPath":"/agent/clawhub-vardhineediganesh877-ui-night-shift","generatedAt":"2026-10-11T20:59:06.610Z","source":"CLAWHUB","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"editorial-content","verified":true,"confidence":"high","updatedAt":"2026-10-11T17:38:22.384Z","emptyReason":null},"description":"Queue coding plans during the day, approve them, execute later in isolated worktrees, and inspect reports. Background agentic execution requires an explicitl... Skill: Night Shift Owner: vardhineediganesh877-ui Summary: Queue coding plans during the day, approve them, execute later in isolated worktrees, and inspect reports. Background agentic execution requires an explicitl... Tags: latest:1.0.5 Version history: v1.0.5 | 2026-04-26T23:02:23.913Z | user Registry package hardening: exclude local ops watchdog/notification/test helpers from public package, keep core executor/pr","descriptionLabel":"Technical summary","evidenceSummary":"Capability contract not published. No trust telemetry is available yet. 1K downloads reported by the source. Last updated 10/11/2026.","installCommand":"clawhub skill install s174de6375a63p24r7c7yf857n85j8e3:night-shift","sourceUrl":"https://clawhub.ai/vardhineediganesh877-ui/night-shift","homepage":"https://clawhub.ai/vardhineediganesh877-ui/skills/night-shift","primaryLinks":[{"label":"View on ClawHub","url":"https://clawhub.ai/vardhineediganesh877-ui/night-shift","kind":"source"},{"label":"Homepage","url":"https://clawhub.ai/vardhineediganesh877-ui/skills/night-shift","kind":"homepage"}],"safetyScore":84,"overallRank":62,"popularityScore":60,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"Queue coding plans during the day, approve them, execute later in isolated worktrees, and inspect reports. Background agentic execution requires an explicitl..."},"coverage":{"evidence":{"source":"public-profile","verified":false,"confidence":"medium","updatedAt":"2026-10-11T17:38:22.384Z","emptyReason":null},"protocols":[{"protocol":"OPENCLEW","label":"OpenClaw","status":"self-declared","notes":"Declared in the public agent profile."}],"capabilities":[],"verifiedCount":0,"selfDeclaredCount":1,"capabilityMatrix":{"rows":[{"key":"OPENCLEW","type":"protocol","support":"unknown","confidenceSource":"profile","notes":"Listed on profile"}],"flattenedTokens":"protocol:OPENCLEW|unknown|profile"}},"adoption":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-11T17:38:22.384Z","emptyReason":null},"stars":null,"forks":null,"downloads":1017,"packageName":null,"latestVersion":"1.0.5","tractionLabel":"1K downloads"},"release":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-11T17:38:22.370Z","emptyReason":null},"lastUpdatedAt":"2026-10-11T17:38:22.384Z","lastCrawledAt":"2026-10-11T17:38:22.370Z","lastIndexedAt":null,"nextCrawlAt":"2026-10-12T17:38:22.370Z","lastVerifiedAt":null,"highlights":[{"version":"1.0.5","createdAt":"2026-04-26T23:02:23.913Z","changelog":"Registry package hardening: exclude local ops watchdog/notification/test helpers from public package, keep core executor/preflight/dry-run workflow, and reduce scanner noise while preserving local source/tests.","fileCount":22,"zipByteSize":56752},{"version":"1.0.4","createdAt":"2026-04-26T22:59:13.041Z","changelog":"Public package cleanup: exclude legacy/internal runner and BMAD helper paths from ClawHub package, keep core executor/preflight/dry-run flow, and reduce scanner surface while preserving tests.","fileCount":26,"zipByteSize":69647},{"version":"1.0.3","createdAt":"2026-04-26T22:47:50.863Z","changelog":"Scanner hardening: removed shell=True from verifier and phase shell runner, added allowlisted argv verification commands, retained read-only dry-run/preflight safeguards, and kept explicit capability metadata/docs.","fileCount":38,"zipByteSize":101434},{"version":"1.0.2","createdAt":"2026-04-26T22:41:57.586Z","changelog":"Trust and runner hardening: dry-run is read-only, added live preflight checks, declared runtime requirements/capabilities, documented security/install model, cleaned package artifacts, and improved systemd background environment.","fileCount":38,"zipByteSize":100983},{"version":"1.0.1","createdAt":"2026-04-26T17:54:14.188Z","changelog":"v1.0.1: add trust, permissions, and security scanner documentation explaining Night Shift's shell/git/subprocess automation model and safe first-run guidance.","fileCount":35,"zipByteSize":94750},{"version":"1.0.0","createdAt":"2026-04-26T17:31:39.480Z","changelog":"v1.0.0: initial public release of queued overnight coding workflow with isolated worktrees, phased execution, verification, checkpoints, reporting, and portable env-based configuration.","fileCount":35,"zipByteSize":93707}]},"execution":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No published capability contract is available yet."},"installCommand":"clawhub skill install s174de6375a63p24r7c7yf857n85j8e3:night-shift","setupComplexity":"low","setupSteps":["Setup complexity is classified as HIGH. You must provision dedicated cloud infrastructure or an isolated VM. Do not run this directly on your local workstation.","Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data."],"contract":{"contractStatus":"missing","authModes":[],"requires":[],"forbidden":[],"supportsMcp":false,"supportsA2a":false,"supportsStreaming":false,"inputSchemaRef":null,"outputSchemaRef":null,"dataRegion":null,"contractUpdatedAt":null,"sourceUpdatedAt":null,"freshnessSeconds":null},"invocationGuide":{"preferredApi":{"snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-vardhineediganesh877-ui-night-shift/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-vardhineediganesh877-ui-night-shift/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-vardhineediganesh877-ui-night-shift/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-vardhineediganesh877-ui-night-shift/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-vardhineediganesh877-ui-night-shift/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-vardhineediganesh877-ui-night-shift/trust\""],"jsonRequestTemplate":{"query":"summarize this repo","constraints":{"maxLatencyMs":2000,"protocolPreference":["OPENCLEW"]}},"jsonResponseTemplate":{"ok":true,"result":{"summary":"...","confidence":0.9},"meta":{"source":"CLAWHUB","generatedAt":"2026-10-11T20:59:06.607Z"}},"retryPolicy":{"maxAttempts":3,"backoffMs":[500,1500,3500],"retryableConditions":["HTTP_429","HTTP_503","NETWORK_TIMEOUT"]}},"endpoints":{"dossierUrl":"https://www.xpersona.co/api/v1/agents/clawhub-vardhineediganesh877-ui-night-shift/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-vardhineediganesh877-ui-night-shift/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-vardhineediganesh877-ui-night-shift/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-vardhineediganesh877-ui-night-shift/trust"}},"reliability":{"evidence":{"source":"runtime-metrics","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No trust, reliability, or runtime telemetry is available."},"trust":{"status":"unavailable","handshakeStatus":"UNKNOWN","verificationFreshnessHours":null,"reputationScore":null,"p95LatencyMs":null,"successRate30d":null,"fallbackRate":null,"attempts30d":null,"trustUpdatedAt":null,"trustConfidence":"unknown","sourceUpdatedAt":null,"freshnessSeconds":null},"decisionGuardrails":{"doNotUseIf":["Contract metadata is missing or unavailable for deterministic execution."],"safeUseWhen":[],"riskFlags":["missing_or_unavailable_contract","trust_data_unavailable","schema_references_missing"],"operationalConfidence":"low"},"executionMetrics":{"observedLatencyMsP50":null,"observedLatencyMsP95":null,"estimatedCostUsd":null,"uptime30d":null,"rateLimitRpm":null,"rateLimitBurst":null,"lastVerifiedAt":null,"verificationSource":null},"runtimeMetrics":{"successRate":null,"avgLatencyMs":null,"avgCostUsd":null,"hallucinationRate":null,"retryRate":null,"disputeRate":null,"p50Latency":null,"p95Latency":null,"lastUpdated":null}},"benchmarks":{"evidence":{"source":"no-benchmark-data","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No benchmark suites or observed failure patterns are available."},"suites":[],"failurePatterns":[]},"artifacts":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"high","updatedAt":"2026-10-11T17:38:22.384Z","emptyReason":null},"readme":"Skill: Night Shift\n\nOwner: vardhineediganesh877-ui\n\nSummary: Queue coding plans during the day, approve them, execute later in isolated worktrees, and inspect reports. Background agentic execution requires an explicitl...\n\nTags: latest:1.0.5\n\nVersion history:\n\nv1.0.5 | 2026-04-26T23:02:23.913Z | user\n\nRegistry package hardening: exclude local ops watchdog/notification/test helpers from public package, keep core executor/preflight/dry-run workflow, and reduce scanner noise while preserving local source/tests.\n\nv1.0.4 | 2026-04-26T22:59:13.041Z | user\n\nPublic package cleanup: exclude legacy/internal runner and BMAD helper paths from ClawHub package, keep core executor/preflight/dry-run flow, and reduce scanner surface while preserving tests.\n\nv1.0.3 | 2026-04-26T22:47:50.863Z | user\n\nScanner hardening: removed shell=True from verifier and phase shell runner, added allowlisted argv verification commands, retained read-only dry-run/preflight safeguards, and kept explicit capability metadata/docs.\n\nv1.0.2 | 2026-04-26T22:41:57.586Z | user\n\nTrust and runner hardening: dry-run is read-only, added live preflight checks, declared runtime requirements/capabilities, documented security/install model, cleaned package artifacts, and improved systemd background environment.\n\nv1.0.1 | 2026-04-26T17:54:14.188Z | user\n\nv1.0.1: add trust, permissions, and security scanner documentation explaining Night Shift's shell/git/subprocess automation model and safe first-run guidance.\n\nv1.0.0 | 2026-04-26T17:31:39.480Z | user\n\nv1.0.0: initial public release of queued overnight coding workflow with isolated worktrees, phased execution, verification, checkpoints, reporting, and portable env-based configuration.\n\nArchive index:\n\nArchive v1.0.5: 22 files, 56752 bytes\n\nFiles: INSTALL.md (1242b), REFERENCE.md (11234b), scripts/__init__.py (91b), scripts/budget.py (4875b), scripts/checkpoint.py (4018b), scripts/executor.py (24357b), scripts/failure_memory.py (3149b), scripts/git_manager.py (7783b), scripts/lock.py (1717b), scripts/models.py (9464b), scripts/phase_generator.py (12200b), scripts/phase_runner.py (14944b), scripts/preflight.py (7296b), scripts/queue.py (11475b), scripts/reporter.py (6783b), scripts/status.py (6537b), scripts/subagent_runner.py (7559b), scripts/verifier.py (12431b), SECURITY.md (3382b), skill-card.md (2444b), SKILL.md (16841b), _meta.json (130b)\n\nFile v1.0.5:SKILL.md\n\n---\nname: night-shift\nversion: 1.0.5\ndescription: \"Queue coding plans during the day, approve them, execute later in isolated worktrees, and inspect reports. Background agentic execution requires an explicitly configured non-interactive runner.\"\nmetadata:\n  {\n    \"openclaw\":\n      {\n        \"requires\": { \"bins\": [\"python3\", \"git\"] },\n        \"optional\":\n          {\n            \"bins\": [\"agent\", \"cursor\", \"claude\"],\n            \"env\":\n              [\n                \"OPENCLAW_WORKSPACE\",\n                \"NIGHT_SHIFT_DATA_DIR\",\n                \"NIGHT_SHIFT_MODEL\",\n                \"CURSOR_CLI\",\n                \"CURSOR_API_KEY\",\n                \"TELEGRAM_BOT_TOKEN\",\n                \"TELEGRAM_CHAT_ID\",\n                \"NIGHT_SHIFT_CHAT_ID\",\n              ],\n          },\n        \"capabilities\":\n          [\n            \"filesystem-read-write\",\n            \"git-worktrees\",\n            \"subprocess-execution\",\n            \"optional-cursor-cli\",\n            \"optional-claude-cli\",\n            \"optional-telegram-notifications\",\n            \"optional-model-provider-calls\",\n          ],\n      },\n  }\n---\n\n# Night Shift\n\nNight Shift is an autonomous queued-execution skill for engineering work.\n\nInstead of asking the agent to do one large coding task immediately, you build a queue of plans, review or approve them, then run them in a controlled batch window. Each plan is split into phases, executed in isolation, verified, checkpointed, and summarized in a report.\n\n**Mental model:**\n- Daytime: create and refine plans\n- Before execution: approve what is safe to run\n- Execution window: Night Shift runs plans phase by phase\n- Morning: inspect results, merge, retry, or continue\n\nThis is useful when you want:\n- deferred execution instead of immediate chat-time work\n- safer batching for multi-step changes\n- isolated worktrees per plan\n- retry and checkpoint behavior\n- a written report after execution\n\n---\n\n## When to Use\n\nUse Night Shift when the user asks for things like:\n- “good night”\n- “queue this for later”\n- “plan add …”\n- “run these approved plans overnight”\n- “night shift status”\n- “show my morning report”\n- “retry plan #3”\n- “merge that finished plan”\n\nPrefer Night Shift over immediate execution when:\n- the work is multi-phase\n- the task needs isolation from the main repo state\n- the user wants review/approval before execution\n- the work may take a long time\n- you want a queue of tasks rather than one interactive run\n\nDo **not** use Night Shift for:\n- tiny one-off edits better handled immediately\n- high-risk production actions without review\n- tasks that require constant human decisions mid-run\n- public/external actions that should be explicitly approved in the moment\n\n---\n\n## Core Concepts\n\n### 1. Plan\nA plan is the unit of queued work. It includes:\n- title\n- optional description\n- optional repo URL\n- priority\n- token/time budget hints\n- generated phases\n- status and execution metadata\n\n### 2. Phase\nEach plan is split into phases. A phase has:\n- a title\n- a prompt/instruction\n- an execution method\n- verification settings\n- retry state\n- status\n\n### 3. Execution Method\nEach phase chooses one of several execution methods:\n- `shell`\n- `cursor`\n- `claude-code`\n- `subagent`\n\nThis lets the framework mix deterministic shell work with agentic coding work.\n\n### 4. Worktree Isolation\nEach plan runs in its own git worktree under `data/night-shift/worktrees/`.\n\nThat means Night Shift can:\n- avoid trampling the main branch\n- keep plan-specific diffs separate\n- retry or inspect work in isolation\n- support safer merge/rollback flows\n\n### 5. Verification\nPhases can be checked after execution using one of several verification modes, including:\n- `files_exist`\n- `check_git_diff`\n- `run_tests`\n- `lint_check`\n- `smoke_test`\n- `import_check`\n- `integration_check`\n- `snapshot_diff`\n- `none`\n\n### 6. Reporting\nAfter execution, Night Shift writes a report so the next interaction starts from evidence instead of guesswork.\n\n---\n\n## Typical Workflow\n\n### During the day\n1. Add one or more plans\n2. Review phases\n3. Edit prompts or priorities if needed\n4. Approve the plans that are safe to run\n\n### At execution time\n5. Start Night Shift\n6. It acquires a lock, checks budgets, creates worktrees, and executes phases\n7. It verifies each phase, checkpoints progress, records failures, and logs results\n\n### After execution\n8. Read the report\n9. Inspect worktrees or diffs\n10. Merge successful work, retry failed work, or queue follow-up plans\n\n---\n\n## User-Facing Commands\n\nThese are the command patterns the skill is designed around.\n\n| Command | Purpose |\n|---|---|\n| `plan add <desc>` | Create a new plan with generated phases |\n| `plan steal <url> <desc>` | Queue work derived from an external repo/project |\n| `plan list [status]` | Show plans in the queue |\n| `plan show #<id>` | Show full details for one plan |\n| `plan approve #<id>` | Approve one plan |\n| `plan approve all` | Approve all queued plans |\n| `plan remove #<id>` | Remove a plan |\n| `plan priority #<id> <level>` | Change priority |\n| `plan edit #<id> phase <n> prompt <text>` | Refine a phase prompt |\n| `good night` | Start execution of approved plans |\n| `night shift status` | Show current state |\n| `night shift stop` | Request stop / halt execution |\n| `night shift dry-run` | Preview what would execute |\n| `morning` | Show the latest execution report |\n| `night shift merge #<id>` | Merge completed plan results |\n| `night shift inspect #<id>` | Inspect outputs/worktree |\n| `night shift retry #<id>` | Retry a failed or partial plan |\n\nIf your host agent uses a different natural-language wrapper, preserve the same intent and lifecycle.\n\n---\n\n## Architecture\n\nNight Shift is split into a few major parts.\n\n### Queue and Models\n- `models.py` — core plan/phase data models and enums\n- `queue.py` — CRUD, queue index, plan storage, approvals, updates\n- `phase_generator.py` — creates initial phases from plan input\n\n### Execution Engine\n- `executor.py` — main run loop, orchestration, locking, budget checks, reporting\n- `phase_runner.py` — executes individual phases using the chosen method\n- `subagent_runner.py` — helper for subagent-based execution\n\n### Safety and Recovery\n- `verifier.py` — phase verification logic\n- `checkpoint.py` — save/resume progress\n- `failure_memory.py` — track known failures and avoid blind repetition\n- `lock.py` — prevent overlapping runs\n- `budget.py` — per-phase/per-plan/night budget tracking\n- `memory_guard.py` — watchdog for memory/process hygiene\n\n### Repo / Git Operations\n- `git_manager.py` — worktree setup, commit/reset helpers\n\n### Visibility and Operations\n- `reporter.py` — morning-style summaries\n- `monitor.py` — notifications and health checks\n- `watchdog.py` — execution monitoring\n- `status.py` — status helpers\n- `cron_trigger.sh` / `ns-control.sh` — optional shell wrappers\n\n### Optional Extensions\nThe `bmad_*.py` files are advanced helpers for richer planning/PRD flows. They are **not required** for the core Night Shift lifecycle.\n\n---\n\n## Execution Flow\n\nA typical run looks like this:\n\n1. **Preflight**\n   - confirm no conflicting lock\n   - load queue\n   - check for approved plans\n   - initialize budget / logs / monitors\n\n2. **Plan selection**\n   - choose approved plans in queue order / priority order\n\n3. **Per-plan setup**\n   - create or prepare isolated worktree\n   - load checkpoint if resuming\n\n4. **Per-phase execution**\n   - build phase prompt\n   - dispatch via the selected execution method\n   - capture output, status, timing, and any token/cost metadata available\n\n5. **Verification**\n   - run configured verification step\n   - mark success/failure\n   - record failure memory if relevant\n\n6. **Persistence**\n   - update plan JSON\n   - update queue index\n   - save checkpoint/logs\n\n7. **Completion**\n   - finalize plan status\n   - generate report\n   - release lock\n\n---\n\n## Safety Model\n\nNight Shift is designed to be agentic, but not reckless.\n\n### Safety features\n- **approval gate** before execution\n- **worktree isolation** per plan\n- **execution lock** to prevent overlapping runs\n- **phase-by-phase progression** instead of one giant opaque run\n- **verification hooks** after phases\n- **checkpointing** for resumes/recovery\n- **failure memory** to reduce repeated mistakes\n- **budget caps** across phase/plan/night scopes\n- **watchdog/monitoring** support\n\n### What this protects against\n- clobbering the main branch\n- executing multiple Night Shift loops at once\n- losing progress on interruption\n- repeating the same failing step forever\n- oversized unattended execution sessions\n\n### What it does **not** guarantee\n- perfect code quality\n- correct architectural judgment for every task\n- safe production deployment by default\n- zero hallucination from external coding models\n\nYou still need sensible approval and review.\n\n### Trust, permissions, and security scanners\n\nNight Shift may be flagged by automated scanners because it intentionally includes operational automation primitives:\n\n- shell wrappers (`cron_trigger.sh`, `ns-control.sh`, `claude-wrapper.sh`)\n- Python subprocess execution for approved phases\n- git worktree, commit, reset, and diff helpers\n- optional Cursor CLI / Claude Code / subagent dispatch\n- optional Telegram notification support\n\nThese are expected for an unattended coding workflow, but they deserve review before use. Night Shift does **not** bundle private keys, hidden credentials, miners, persistence malware, or background network beacons. It only uses credentials and CLIs already available in the host environment.\n\nBefore running it in a new workspace:\n\n1. Review queued plans and phase prompts before approval.\n2. Run `night shift dry-run` first when available.\n3. Start with a disposable test repo or branch.\n4. Keep production deploys as explicit manual steps unless you intentionally add deploy phases.\n5. Inspect diffs/reports before merging completed work.\n\nFor non-interactive ClawHub installs, some registries may require `--force` after scanner warnings. Treat that as a prompt to review the code, not as a failure signal.\n\n---\n\n## Storage Layout\n\nNight Shift stores runtime state under:\n\n```text\ndata/night-shift/\n├── queue.json\n├── plans/\n├── worktrees/\n├── execution/\n├── reports/\n├── failure-memory.json\n├── budget.json\n└── execution.log\n```\n\n### Important files\n- `queue.json` — lightweight queue index\n- `plans/*.json` — full plan records\n- `worktrees/<plan_id>/` — isolated git worktree per plan\n- `failure-memory.json` — prior failed step fingerprints\n- `budget.json` — current budget tracking\n- `execution.log` — main execution log\n\n---\n\n## Environment Variables\n\nNight Shift now supports portable configuration instead of relying on hardcoded local paths.\n\n### Core\n- `OPENCLAW_WORKSPACE` — override workspace root\n- `NIGHT_SHIFT_MODEL` — preferred model hint for model-driven helpers\n- `CURSOR_CLI` — explicit path to Cursor CLI / `agent` binary\n\n### Notifications\n- `NIGHT_SHIFT_CHAT_ID` — target chat for Night Shift notifications\n- `TELEGRAM_CHAT_ID` — fallback notification target\n- `TELEGRAM_BOT_TOKEN` — Telegram Bot token for notifications\n\n### Execution environment\nNight Shift also inherits normal environment from the host runtime, including anything needed by:\n- git\n- Python\n- shell commands\n- coding harnesses / subagents\n\nIf a specific execution method requires additional auth or binaries, document that at the host level.\n\n---\n\n## Prerequisites\n\n### Required\n- Python 3\n- git\n- workspace write access\n- ability to create and modify files in `data/night-shift/`\n- a host environment that can run shell commands and Python scripts\n\n### Optional but useful\n- Cursor CLI / agent binary for `cursor` execution\n- Claude Code for `claude-code` execution\n- subagent support for delegated runs\n- Telegram bot setup for notifications\n\n### Strongly recommended\n- run inside a git-backed workspace\n- use approval before unattended execution\n- keep tests/lint scripts working in the target repo\n\n---\n\n## Examples\n\n### Example 1 — queue a feature for later\nUser intent:\n> Add OAuth login to the app, but do it overnight.\n\nNight Shift flow:\n1. `plan add add OAuth login to the app`\n2. inspect generated phases\n3. `plan approve #<id>`\n4. later: `good night`\n\n### Example 2 — multiple plans in one batch\nUser intent:\n> Queue three fixes now, run them all tonight.\n\nFlow:\n1. add three plans\n2. set priorities as needed\n3. approve the safe ones\n4. run Night Shift\n5. read the morning report\n\n### Example 3 — dry run before execution\nUser intent:\n> Show me what would run tonight.\n\nFlow:\n- `night shift dry-run`\n\n### Example 4 — retry a failed plan\nUser intent:\n> Retry the failed parser plan.\n\nFlow:\n- inspect plan/report\n- refine the phase prompt if needed\n- `night shift retry #<id>`\n\n### Example 5 — inspect before merge\nUser intent:\n> Show me what Night Shift changed before we merge.\n\nFlow:\n- `night shift inspect #<id>`\n- review diff/worktree/tests\n- `night shift merge #<id>` when satisfied\n\n---\n\n## How to Operate the Skill Well\n\n### Good plan inputs\nNight Shift works best when the plan title/description is concrete.\n\nBetter:\n- “Add retry logic to payment webhooks and verify with integration tests”\n- “Refactor dashboard query caching and run frontend smoke tests”\n\nWorse:\n- “make it better”\n- “fix the app somehow”\n\n### Good approval policy\nApprove unattended runs when:\n- the repo is in a sane state\n- the task is scoped\n- verification exists\n- you can tolerate isolated failures\n\nAvoid approval when:\n- the task is ambiguous\n- the run might touch production systems directly\n- the work needs live stakeholder decisions\n\n### Good execution method selection\nUse:\n- `shell` for deterministic scripted work\n- `cursor` / `claude-code` for coding-heavy phases\n- `subagent` for delegated structured work\n\n---\n\n## Limitations\n\nBe honest about these.\n\n- It is not a general scheduler for arbitrary business processes.\n- It is optimized for engineering work in a writable workspace.\n- Quality depends heavily on phase quality and verification quality.\n- If the underlying coding harness is weak or unavailable, outcomes degrade.\n- Worktree-based isolation assumes the repo supports normal git operations.\n- Some wrapper scripts and helpers are host-environment dependent.\n- Long unattended runs still need human review before high-trust deployment.\n\n---\n\n## Troubleshooting\n\n### “No approved plans found”\nApprove at least one plan before starting execution.\n\n### “Night Shift already running”\nA lock file or active run exists. Inspect status before forcing a restart.\n\n### “Worktree creation failed”\nCheck:\n- git repo health\n- branch/worktree permissions\n- existing conflicting worktrees\n\n### “Phase keeps failing”\n- inspect the plan’s phase prompt\n- review verification settings\n- check failure memory / logs\n- reduce scope and retry\n\n### “Notifications are not sent”\nCheck notification env vars:\n- `TELEGRAM_BOT_TOKEN`\n- `NIGHT_SHIFT_CHAT_ID` or `TELEGRAM_CHAT_ID`\n\n### “Cursor / Claude execution not found”\nSet the expected binary path explicitly or install the required tool:\n- `CURSOR_CLI`\n- whichever CLI your host maps to `claude-code`\n\n### “Execution stopped midway”\nInspect checkpoints, report output, logs, and plan status. Resume/retry instead of starting from scratch blindly.\n\n---\n\n## Publishing Notes\n\nNight Shift is publishable as a **power-user engineering skill**.\n\nIts strongest differentiators are:\n- queued plan lifecycle\n- isolated worktrees\n- phase verification\n- checkpointing and retry behavior\n- morning-report workflow\n\nIts biggest adoption caveats are:\n- requires a repo-aware writable environment\n- works best with supporting CLIs/tools already installed\n- more operational than a simple one-file prompt skill\n\nThat is fine. Don’t oversell it as “plug-and-play for everyone.” Sell it as a serious autonomous coding workflow for advanced users.\n\n---\n\n## Files\n\nCore engine files in `scripts/` include:\n- `models.py`\n- `queue.py`\n- `phase_generator.py`\n- `executor.py`\n- `phase_runner.py`\n- `verifier.py`\n- `checkpoint.py`\n- `failure_memory.py`\n- `budget.py`\n- `git_manager.py`\n- `lock.py`\n- `reporter.py`\n- `monitor.py`\n- `watchdog.py`\n- `subagent_runner.py`\n- `memory_guard.py`\n\nOptional/advanced helpers:\n- `bmad_batch.py`\n- `bmad_context.py`\n- `bmad_guardrails.py`\n- `bmad_phases.py`\n- `bmad_prd_evolve.py`\n- `bmad_queue.py`\n- `bmad_rollback.py`\n\nShell helpers:\n- `cron_trigger.sh`\n- `ns-control.sh`\n- `claude-wrapper.sh`\n\n---\n\n## See Also\n\n- `REFERENCE.md` — operational reference, setup notes, environment variables, and troubleshooting\n- `scripts/test_queue.py` — queue behavior checks\n- `scripts/test_integration.py` — end-to-end integration checks\n\nFile v1.0.5:_meta.json\n\n{\n  \"ownerId\": \"kn7380dt93q0wx6x1zx5b4y8z985kjww\",\n  \"slug\": \"night-shift\",\n  \"version\": \"1.0.5\",\n  \"publishedAt\": 1777244543913\n}\n\nFile v1.0.5:INSTALL.md\n\n# Night Shift Install and Setup\n\n## Install from ClawHub\n\n```bash\nopenclaw skills install vardhineediganesh877-ui/night-shift\n```\n\n## Verify local requirements\n\n```bash\ncd ~/.openclaw/workspace\npython3 skills/night-shift/scripts/preflight.py --json\n```\n\nRequired dependencies are `python3` and `git`. Cursor/Claude runners are optional, but any queued phase that uses them requires those CLIs to work non-interactively.\n\n## Recommended first run: disposable workspace\n\n```bash\nexport OPENCLAW_WORKSPACE=/tmp/night-shift-demo\nmkdir -p \"$OPENCLAW_WORKSPACE\"\npython3 ~/.openclaw/workspace/skills/night-shift/scripts/preflight.py --json\npython3 ~/.openclaw/workspace/skills/night-shift/scripts/executor.py dry-run\n```\n\nDry-run should write a preview report only. It should not mark plans complete or create success checkpoints.\n\n## Background/systemd setup\n\nDetached timers need explicit environment. Create a private env file if needed:\n\n```bash\ncp skills/night-shift/.night-shift.env.example ~/.openclaw/workspace/.night-shift.env\nchmod 600 ~/.openclaw/workspace/.night-shift.env\n```\n\nThen edit values for your environment. Do not commit real secrets.\n\nBefore enabling a timer, run preflight in the same user context that will run the service.\n\nFile v1.0.5:REFERENCE.md\n\n# Night Shift Reference\n\nThis file is the operational reference for the Night Shift skill.\n\nIt complements `SKILL.md` by focusing on setup, runtime expectations, file layout, and practical caveats.\n\n---\n\n## 1. What Night Shift Actually Is\n\nNight Shift is a queued autonomous execution framework for coding work.\n\nIt is **not** just a prompt pattern. It includes:\n- plan storage\n- phase generation\n- isolated worktrees\n- execution routing\n- verification\n- checkpointing\n- reporting\n- monitoring helpers\n\nThink of it as a lightweight unattended engineering operator.\n\n---\n\n## 2. Minimum Runtime Expectations\n\nNight Shift expects a host environment with:\n- Python 3\n- git\n- a writable workspace\n- permission to create directories/files under `data/night-shift/`\n- a repo or project context where worktrees and diffs make sense\n\nIf those are missing, the skill may still partially function, but the core value drops sharply.\n\n---\n\n## 3. Security Review Notes\n\nNight Shift is powerful by design. It can run shell commands, create git worktrees, call coding CLIs, and write reports/checkpoints. That means automated registries may classify it as suspicious even when the package is behaving as intended.\n\nExpected capabilities:\n- local file and directory writes under the configured workspace\n- git worktree / diff / commit / reset operations\n- subprocess execution for approved phase methods\n- optional calls to host-provided tools such as Cursor CLI, Claude Code, or subagents\n- optional Telegram notifications when notification environment variables are configured\n\nNot expected:\n- bundled secrets or private tokens\n- cryptocurrency mining\n- hidden persistence outside the configured workspace\n- unsolicited external network calls beyond host-configured tools/notifications\n- production deployment unless a user-approved phase explicitly performs it\n\nRecommended first-run posture:\n\n```bash\n# install into a disposable workspace first if reviewing a public copy\nclawhub install night-shift --force\n\n# inspect docs and scripts before use\nfind skills/night-shift -maxdepth 3 -type f | sort\n\n# run only approved test plans initially\n```\n\nIf your ClawHub client requires `--force`, it is usually because of these intentional automation primitives. Review before running, then proceed only in a workspace where unattended coding is acceptable.\n\n---\n\n## 4. Workspace Assumptions\n\nThe portable version of Night Shift uses workspace auto-detection.\n\nDefault behavior:\n- detect workspace from the skill location\n- store runtime data in `data/night-shift/`\n\nOverride with:\n\n```bash\nexport OPENCLAW_WORKSPACE=/path/to/workspace\n```\n\nThis controls where Night Shift reads/writes:\n- queue state\n- plan files\n- worktrees\n- logs\n- reports\n- budget / checkpoint / failure memory data\n\n---\n\n## 4. Important Environment Variables\n\n### Core\n\n```bash\nexport OPENCLAW_WORKSPACE=/path/to/workspace\nexport NIGHT_SHIFT_MODEL=auto\nexport CURSOR_CLI=/path/to/agent\n```\n\n### Notifications\n\n```bash\nexport TELEGRAM_BOT_TOKEN=...\nexport NIGHT_SHIFT_CHAT_ID=123456789\n# or fallback\nexport TELEGRAM_CHAT_ID=123456789\n```\n\n### Notes\n- `NIGHT_SHIFT_MODEL` is a hint used by some model-driven helpers.\n- `CURSOR_CLI` is useful if the `agent` binary is not discoverable on PATH.\n- Notification variables are optional.\n\n---\n\n## 5. Storage Layout\n\nRuntime state is stored under:\n\n```text\ndata/night-shift/\n├── queue.json\n├── plans/\n├── worktrees/\n├── execution/\n├── reports/\n├── failure-memory.json\n├── budget.json\n└── execution.log\n```\n\n### Recommended hygiene\n- back up `plans/` and `reports/` if they matter\n- prune stale worktrees periodically\n- inspect `failure-memory.json` if repeated failures feel suspicious\n- keep `queue.json` and `plans/` in sync by using the provided queue operations, not ad hoc edits\n\n---\n\n## 6. Execution Methods\n\nNight Shift supports multiple execution styles at the phase level.\n\n### `shell`\nUse for deterministic commands.\n\nBest for:\n- codegen via scripts\n- test runs\n- linters\n- file transforms\n- scripted maintenance\n\n### `cursor`\nUse for agentic coding via a Cursor/agent-style runner.\n\nBest for:\n- implementation-heavy code changes\n- multi-file refactors\n- coding tasks where a model benefits from repo context\n\n### `claude-code`\nUse for Claude Code based execution if your host supports it.\n\nBest for:\n- careful repo-aware coding work\n- structured implementation with strong text output\n\n### `subagent`\nUse when the host environment supports agent delegation.\n\nBest for:\n- isolated research or coding subtasks\n- delegated steps with separate context\n\n---\n\n## 7. Worktree Behavior\n\nNight Shift’s safety story depends heavily on worktree isolation.\n\nPer-plan worktrees help with:\n- safer concurrent plan handling\n- easier diff inspection\n- cleaner retry/reset behavior\n- less contamination of the main working tree\n\nOperational advice:\n- use Night Shift in repos with healthy git state\n- avoid starting with a dirty or half-merged repo if you can\n- inspect worktrees before merging if the task was complex\n\n---\n\n## 8. Verification Modes\n\nAvailable verification labels include:\n- `files_exist`\n- `check_git_diff`\n- `run_tests`\n- `lint_check`\n- `smoke_test`\n- `import_check`\n- `integration_check`\n- `snapshot_diff`\n- `none`\n\n### Practical guidance\n- use `run_tests` when repo tests are reliable\n- use `lint_check` for style/static checks\n- use `smoke_test` for lightweight runtime confidence\n- avoid `none` unless the phase is inherently non-testable or very small\n\nNight Shift is only as trustworthy as the verification attached to its phases.\n\n---\n\n## 9. Budget and Stop Conditions\n\nThe framework tracks budgets across multiple scopes.\n\nExamples mentioned in the implementation/docs include:\n- per-phase limits\n- per-plan limits\n- whole-night limits\n\nOperationally, budget checks are there to prevent:\n- endless unattended work\n- overconsumption of model/tool resources\n- a single bad plan dominating the whole run\n\nIf a plan is repeatedly too large, split it into smaller plans or improve the generated phases.\n\n---\n\n## 10. Checkpoints and Failure Memory\n\n### Checkpoints\nCheckpointing allows a run to resume or be inspected without pretending the whole night never happened.\n\nUse this when:\n- a run was interrupted\n- the system restarted\n- you want to retry after partial progress\n\n### Failure Memory\nFailure memory records prior failure fingerprints / patterns to reduce blind repetition.\n\nUse it as a signal, not an oracle.\nIf the same phase keeps failing:\n- simplify the phase\n- change the execution method\n- improve the prompt\n- tighten verification\n\n---\n\n## 11. Monitoring and Notifications\n\nNight Shift includes monitoring/reporting helpers.\n\nCapabilities may include:\n- execution logs\n- morning summaries\n- Telegram notifications\n- watchdog-style checks\n\nThese are useful, but optional. The core queue/executor flow should still make sense without notifications.\n\nIf you enable notifications, treat them as operational visibility — not as a replacement for review.\n\n---\n\n## 12. Optional BMAD Extensions\n\nThe `scripts/` folder may include BMAD-related helpers such as:\n- `bmad_batch.py`\n- `bmad_context.py`\n- `bmad_guardrails.py`\n- `bmad_phases.py`\n- `bmad_prd_evolve.py`\n- `bmad_queue.py`\n- `bmad_rollback.py`\n\nThese are advanced extensions.\n\nThey are **not** required for the baseline Night Shift lifecycle:\n- queue\n- approve\n- execute\n- verify\n- report\n\nIf you publish Night Shift, present BMAD as an optional advanced lane, not the first thing a new user must understand.\n\n---\n\n## 13. Shell Helpers\n\nShell wrappers in `scripts/` may include:\n- `cron_trigger.sh`\n- `ns-control.sh`\n- `claude-wrapper.sh`\n\nThese are convenience helpers, not the whole product.\n\nUse them when:\n- your environment wants cron-style launches\n- you prefer shell entrypoints\n- you want lightweight control wrappers\n\nAvoid making your documentation depend entirely on them.\n\n---\n\n## 14. Testing Notes\n\nIn the current skill-local portable version, the queue and integration checks have been exercised successfully.\n\nFiles of interest:\n- `scripts/test_queue.py`\n- `scripts/test_integration.py`\n\nWhen validating changes, prefer:\n1. queue tests\n2. integration checks\n3. a dry run\n4. a small real plan in a non-critical repo\n\nThat progression gives much better confidence than jumping straight to a large unattended batch.\n\n---\n\n## 15. Recommended Rollout Strategy for New Users\n\nIf someone installs this skill fresh, the safest adoption path is:\n\n### Stage 1 — Read and inspect\n- read `SKILL.md`\n- inspect `scripts/`\n- confirm required binaries and Python availability\n\n### Stage 2 — Dry run\n- create one simple plan\n- run `night shift dry-run`\n\n### Stage 3 — Small real run\n- approve one low-risk plan\n- run the executor\n- inspect report and worktree\n\n### Stage 4 — Multi-plan batch\n- queue several tasks\n- use priorities\n- review morning report quality\n\n### Stage 5 — Advanced automation\n- add notifications\n- add cron wrappers\n- experiment with BMAD extensions\n\n---\n\n## 16. Common Failure Modes\n\n### A. No plans execute\nLikely causes:\n- no approved plans\n- stale lock\n- queue/index mismatch\n\n### B. Worktree setup fails\nLikely causes:\n- broken git state\n- repo permissions\n- conflicting worktrees/branches\n\n### C. Model-backed phase fails repeatedly\nLikely causes:\n- vague phase prompt\n- wrong execution method\n- tool/harness missing\n- verification too strict for the phase shape\n\n### D. Reports are weak\nLikely causes:\n- low-quality phase structure\n- missing verification\n- oversized tasks crammed into one plan\n\n### E. Notifications never arrive\nLikely causes:\n- missing `TELEGRAM_BOT_TOKEN`\n- missing `NIGHT_SHIFT_CHAT_ID` / `TELEGRAM_CHAT_ID`\n- network or bot permissions issues\n\n---\n\n## 17. What to Be Honest About in a Public Listing\n\nNight Shift is powerful, but it is not beginner-simple.\n\nBe explicit that it is best for:\n- advanced OpenClaw / agent users\n- repo-centric engineering workflows\n- users who understand approval, git, and execution risk\n\nDo **not** market it like:\n- “set and forget magic coding forever”\n- “safe for any repo with zero setup”\n- “works equally well without verification or review”\n\nThe real pitch is better:\n> a structured autonomous execution framework for deferred engineering work\n\n---\n\n## 18. Good Public Positioning\n\nA strong public framing is:\n\n- **What it is:** queued overnight coding workflow\n- **Why it matters:** safe-ish deferred execution with worktrees and reports\n- **Who it’s for:** power users running multi-step repo tasks\n- **Why it stands out:** phase-based execution + isolation + verification + reporting\n\n---\n\n## 19. Suggested Setup Snippet\n\n```bash\nexport OPENCLAW_WORKSPACE=\"$HOME/.openclaw/workspace\"\nexport CURSOR_CLI=\"$(command -v agent)\"\nexport NIGHT_SHIFT_MODEL=\"auto\"\n# Optional notifications\nexport TELEGRAM_BOT_TOKEN=\"...\"\nexport NIGHT_SHIFT_CHAT_ID=\"123456789\"\n```\n\n---\n\n## 20. Final Advice\n\nNight Shift gets most of its value from discipline, not bravado.\n\nIf results are shaky:\n- shrink the plan\n- improve the phases\n- improve verification\n- inspect worktrees\n- retry surgically\n\nThe framework is strongest when it helps you run a calm engineering pipeline, not when it is treated like a slot machine.\n\nFile v1.0.5:SECURITY.md\n\n# Night Shift Security Model\n\nNight Shift is a powerful queued execution framework. Treat it like a coding agent runner, not a passive note-taking skill.\n\n## What Night Shift can do\n\nWhen you approve and run plans, Night Shift may:\n\n- read and write files inside the configured workspace\n- create git branches and worktrees under `data/night-shift/worktrees/`\n- run subprocesses for shell phases and verification commands\n- call optional coding runners such as Cursor CLI (`agent`/`cursor`) or Claude Code (`claude`)\n- run tests, linters, build commands, and smoke checks\n- write checkpoints, reports, logs, and failure-memory records\n- optionally send Telegram notifications if notification tokens are configured\n\n## What Night Shift should not do by default\n\nNight Shift should not:\n\n- run against production repositories without review\n- execute unreviewed public/external actions\n- send notifications unless recipients and tokens are explicitly configured\n- mark dry-runs as completed live work\n- continue through every plan after a shared runner/preflight failure\n\n## Required runtime dependencies\n\nRequired:\n\n- `python3` 3.11+\n- `git`\n- writable workspace/data directory\n\nOptional, depending on phase execution methods:\n\n- Cursor CLI: `agent` or `cursor`\n- Claude Code CLI: `claude`\n- Telegram notification env vars\n\n## Environment variables\n\nOptional variables read by the skill:\n\n- `OPENCLAW_WORKSPACE` — workspace root; defaults to the OpenClaw workspace that contains this skill\n- `NIGHT_SHIFT_DATA_DIR` — Night Shift state directory; defaults to `$OPENCLAW_WORKSPACE/data/night-shift`\n- `NIGHT_SHIFT_MODEL` — model hint for compatible runners\n- `CURSOR_CLI` — explicit path to Cursor/agent CLI\n- `CURSOR_API_KEY` — optional non-interactive Cursor auth, if supported by your CLI setup\n- `TELEGRAM_BOT_TOKEN`, `TELEGRAM_CHAT_ID`, `NIGHT_SHIFT_CHAT_ID` — optional notifications\n\nNever commit real tokens. Use a local env file such as `.night-shift.env` and keep it out of published packages.\n\n## Safe first run\n\nUse an isolated disposable workspace first:\n\n```bash\nexport OPENCLAW_WORKSPACE=/tmp/night-shift-demo\npython3 skills/night-shift/scripts/preflight.py --json\npython3 skills/night-shift/scripts/executor.py dry-run\n```\n\nDry-run is intended to be read-only. It should produce a preview report and must not mark plans complete or write success checkpoints.\n\n## Background runner warning\n\nDetached systemd/timer execution does not automatically inherit your interactive shell environment. Before live unattended execution, run preflight in the same user/service context. In particular, Cursor CLI phases need `HOME`, `PATH`, and a non-interactive auth strategy.\n\nIf preflight says Cursor/Claude is not ready, fix the environment or change the queued phases before running live execution.\n\n## Verification command policy\n\nVerification commands can execute subprocesses in the worktree. Prefer explicit, narrow commands such as:\n\n- `python3 -m pytest`\n- `npm test`\n- `npm run lint`\n- `ruff check .`\n\nAvoid arbitrary shell pipelines unless you have reviewed the plan and trust the repository.\n\n## Operational guidance\n\n- Review generated plans before approval.\n- Prefer dry-run before live execution.\n- Start with one low-risk plan in a disposable workspace.\n- Inspect reports and worktree diffs before merging.\n- Keep production credentials out of worktrees.\n\nFile v1.0.5:skill-card.md\n\n## Description:\n\nNight Shift queues coding plans for later approval and unattended execution in isolated worktrees, then verifies phases and produces reports.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[vardhineediganesh877-ui](https://clawhub.ai/user/vardhineediganesh877-ui)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nDevelopers and engineering power users use Night Shift to queue multi-step coding work, approve plans, run phases later in isolated git worktrees, and review reports or diffs before merging. It is best for deferred repo-centric work where verification and human review are part of the workflow.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Unattended child agents can receive broad host access during approved execution phases.\n\nMitigation: Install first in a disposable or dedicated workspace, keep production secrets out of the environment, and sandbox or restrict child runners before using sensitive repositories.\n\nRisk: Filesystem and verification weaknesses may allow generated changes to proceed without enough confidence.\n\nMitigation: Review plans immediately before execution, use dry-run first, prefer explicit tests or lint checks, and inspect diffs before merging.\n\nRisk: Optional model runners and notifications rely on credentials and CLIs provided by the host environment.\n\nMitigation: Configure tokens only in local private environment files, confirm notification recipients, and run preflight in the same user or service context used for live execution.\n\n## Reference(s):\n\n- [Night Shift ClawHub skill listing](https://clawhub.ai/vardhineediganesh877-ui/skills/night-shift)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, code, shell commands, configuration, guidance]\n\n**Output Format:** [Markdown reports, JSON queue state, and file or worktree changes from approved phases]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Requires Python 3, git, and a writable workspace; optional Cursor, Claude, and Telegram integrations depend on host configuration.]\n\n## Skill Version(s):\n\n1.0.5 (source: frontmatter and server release metadata)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nArchive v1.0.4: 26 files, 69647 bytes\n\nFiles: INSTALL.md (1242b), REFERENCE.md (11234b), scripts/__init__.py (91b), scripts/budget.py (4875b), scripts/checkpoint.py (4018b), scripts/executor.py (24357b), scripts/failure_memory.py (3149b), scripts/git_manager.py (7783b), scripts/lock.py (1717b), scripts/memory_guard.py (7764b), scripts/models.py (9464b), scripts/monitor.py (15702b), scripts/phase_generator.py (12200b), scripts/phase_runner.py (14944b), scripts/preflight.py (7296b), scripts/queue.py (11475b), scripts/reporter.py (6783b), scripts/status.py (6537b), scripts/subagent_runner.py (7559b), scripts/test_integration.py (6479b), scripts/test_queue.py (9262b), scripts/verifier.py (12431b), scripts/watchdog.py (3105b), SECURITY.md (3382b), SKILL.md (16841b), _meta.json (130b)\n\nFile v1.0.4:SKILL.md\n\n---\nname: night-shift\nversion: 1.0.2\ndescription: \"Queue coding plans during the day, approve them, execute later in isolated worktrees, and inspect reports. Background agentic execution requires an explicitly configured non-interactive runner.\"\nmetadata:\n  {\n    \"openclaw\":\n      {\n        \"requires\": { \"bins\": [\"python3\", \"git\"] },\n        \"optional\":\n          {\n            \"bins\": [\"agent\", \"cursor\", \"claude\"],\n            \"env\":\n              [\n                \"OPENCLAW_WORKSPACE\",\n                \"NIGHT_SHIFT_DATA_DIR\",\n                \"NIGHT_SHIFT_MODEL\",\n                \"CURSOR_CLI\",\n                \"CURSOR_API_KEY\",\n                \"TELEGRAM_BOT_TOKEN\",\n                \"TELEGRAM_CHAT_ID\",\n                \"NIGHT_SHIFT_CHAT_ID\",\n              ],\n          },\n        \"capabilities\":\n          [\n            \"filesystem-read-write\",\n            \"git-worktrees\",\n            \"subprocess-execution\",\n            \"optional-cursor-cli\",\n            \"optional-claude-cli\",\n            \"optional-telegram-notifications\",\n            \"optional-model-provider-calls\",\n          ],\n      },\n  }\n---\n\n# Night Shift\n\nNight Shift is an autonomous queued-execution skill for engineering work.\n\nInstead of asking the agent to do one large coding task immediately, you build a queue of plans, review or approve them, then run them in a controlled batch window. Each plan is split into phases, executed in isolation, verified, checkpointed, and summarized in a report.\n\n**Mental model:**\n- Daytime: create and refine plans\n- Before execution: approve what is safe to run\n- Execution window: Night Shift runs plans phase by phase\n- Morning: inspect results, merge, retry, or continue\n\nThis is useful when you want:\n- deferred execution instead of immediate chat-time work\n- safer batching for multi-step changes\n- isolated worktrees per plan\n- retry and checkpoint behavior\n- a written report after execution\n\n---\n\n## When to Use\n\nUse Night Shift when the user asks for things like:\n- “good night”\n- “queue this for later”\n- “plan add …”\n- “run these approved plans overnight”\n- “night shift status”\n- “show my morning report”\n- “retry plan #3”\n- “merge that finished plan”\n\nPrefer Night Shift over immediate execution when:\n- the work is multi-phase\n- the task needs isolation from the main repo state\n- the user wants review/approval before execution\n- the work may take a long time\n- you want a queue of tasks rather than one interactive run\n\nDo **not** use Night Shift for:\n- tiny one-off edits better handled immediately\n- high-risk production actions without review\n- tasks that require constant human decisions mid-run\n- public/external actions that should be explicitly approved in the moment\n\n---\n\n## Core Concepts\n\n### 1. Plan\nA plan is the unit of queued work. It includes:\n- title\n- optional description\n- optional repo URL\n- priority\n- token/time budget hints\n- generated phases\n- status and execution metadata\n\n### 2. Phase\nEach plan is split into phases. A phase has:\n- a title\n- a prompt/instruction\n- an execution method\n- verification settings\n- retry state\n- status\n\n### 3. Execution Method\nEach phase chooses one of several execution methods:\n- `shell`\n- `cursor`\n- `claude-code`\n- `subagent`\n\nThis lets the framework mix deterministic shell work with agentic coding work.\n\n### 4. Worktree Isolation\nEach plan runs in its own git worktree under `data/night-shift/worktrees/`.\n\nThat means Night Shift can:\n- avoid trampling the main branch\n- keep plan-specific diffs separate\n- retry or inspect work in isolation\n- support safer merge/rollback flows\n\n### 5. Verification\nPhases can be checked after execution using one of several verification modes, including:\n- `files_exist`\n- `check_git_diff`\n- `run_tests`\n- `lint_check`\n- `smoke_test`\n- `import_check`\n- `integration_check`\n- `snapshot_diff`\n- `none`\n\n### 6. Reporting\nAfter execution, Night Shift writes a report so the next interaction starts from evidence instead of guesswork.\n\n---\n\n## Typical Workflow\n\n### During the day\n1. Add one or more plans\n2. Review phases\n3. Edit prompts or priorities if needed\n4. Approve the plans that are safe to run\n\n### At execution time\n5. Start Night Shift\n6. It acquires a lock, checks budgets, creates worktrees, and executes phases\n7. It verifies each phase, checkpoints progress, records failures, and logs results\n\n### After execution\n8. Read the report\n9. Inspect worktrees or diffs\n10. Merge successful work, retry failed work, or queue follow-up plans\n\n---\n\n## User-Facing Commands\n\nThese are the command patterns the skill is designed around.\n\n| Command | Purpose |\n|---|---|\n| `plan add <desc>` | Create a new plan with generated phases |\n| `plan steal <url> <desc>` | Queue work derived from an external repo/project |\n| `plan list [status]` | Show plans in the queue |\n| `plan show #<id>` | Show full details for one plan |\n| `plan approve #<id>` | Approve one plan |\n| `plan approve all` | Approve all queued plans |\n| `plan remove #<id>` | Remove a plan |\n| `plan priority #<id> <level>` | Change priority |\n| `plan edit #<id> phase <n> prompt <text>` | Refine a phase prompt |\n| `good night` | Start execution of approved plans |\n| `night shift status` | Show current state |\n| `night shift stop` | Request stop / halt execution |\n| `night shift dry-run` | Preview what would execute |\n| `morning` | Show the latest execution report |\n| `night shift merge #<id>` | Merge completed plan results |\n| `night shift inspect #<id>` | Inspect outputs/worktree |\n| `night shift retry #<id>` | Retry a failed or partial plan |\n\nIf your host agent uses a different natural-language wrapper, preserve the same intent and lifecycle.\n\n---\n\n## Architecture\n\nNight Shift is split into a few major parts.\n\n### Queue and Models\n- `models.py` — core plan/phase data models and enums\n- `queue.py` — CRUD, queue index, plan storage, approvals, updates\n- `phase_generator.py` — creates initial phases from plan input\n\n### Execution Engine\n- `executor.py` — main run loop, orchestration, locking, budget checks, reporting\n- `phase_runner.py` — executes individual phases using the chosen method\n- `subagent_runner.py` — helper for subagent-based execution\n\n### Safety and Recovery\n- `verifier.py` — phase verification logic\n- `checkpoint.py` — save/resume progress\n- `failure_memory.py` — track known failures and avoid blind repetition\n- `lock.py` — prevent overlapping runs\n- `budget.py` — per-phase/per-plan/night budget tracking\n- `memory_guard.py` — watchdog for memory/process hygiene\n\n### Repo / Git Operations\n- `git_manager.py` — worktree setup, commit/reset helpers\n\n### Visibility and Operations\n- `reporter.py` — morning-style summaries\n- `monitor.py` — notifications and health checks\n- `watchdog.py` — execution monitoring\n- `status.py` — status helpers\n- `cron_trigger.sh` / `ns-control.sh` — optional shell wrappers\n\n### Optional Extensions\nThe `bmad_*.py` files are advanced helpers for richer planning/PRD flows. They are **not required** for the core Night Shift lifecycle.\n\n---\n\n## Execution Flow\n\nA typical run looks like this:\n\n1. **Preflight**\n   - confirm no conflicting lock\n   - load queue\n   - check for approved plans\n   - initialize budget / logs / monitors\n\n2. **Plan selection**\n   - choose approved plans in queue order / priority order\n\n3. **Per-plan setup**\n   - create or prepare isolated worktree\n   - load checkpoint if resuming\n\n4. **Per-phase execution**\n   - build phase prompt\n   - dispatch via the selected execution method\n   - capture output, status, timing, and any token/cost metadata available\n\n5. **Verification**\n   - run configured verification step\n   - mark success/failure\n   - record failure memory if relevant\n\n6. **Persistence**\n   - update plan JSON\n   - update queue index\n   - save checkpoint/logs\n\n7. **Completion**\n   - finalize plan status\n   - generate report\n   - release lock\n\n---\n\n## Safety Model\n\nNight Shift is designed to be agentic, but not reckless.\n\n### Safety features\n- **approval gate** before execution\n- **worktree isolation** per plan\n- **execution lock** to prevent overlapping runs\n- **phase-by-phase progression** instead of one giant opaque run\n- **verification hooks** after phases\n- **checkpointing** for resumes/recovery\n- **failure memory** to reduce repeated mistakes\n- **budget caps** across phase/plan/night scopes\n- **watchdog/monitoring** support\n\n### What this protects against\n- clobbering the main branch\n- executing multiple Night Shift loops at once\n- losing progress on interruption\n- repeating the same failing step forever\n- oversized unattended execution sessions\n\n### What it does **not** guarantee\n- perfect code quality\n- correct architectural judgment for every task\n- safe production deployment by default\n- zero hallucination from external coding models\n\nYou still need sensible approval and review.\n\n### Trust, permissions, and security scanners\n\nNight Shift may be flagged by automated scanners because it intentionally includes operational automation primitives:\n\n- shell wrappers (`cron_trigger.sh`, `ns-control.sh`, `claude-wrapper.sh`)\n- Python subprocess execution for approved phases\n- git worktree, commit, reset, and diff helpers\n- optional Cursor CLI / Claude Code / subagent dispatch\n- optional Telegram notification support\n\nThese are expected for an unattended coding workflow, but they deserve review before use. Night Shift does **not** bundle private keys, hidden credentials, miners, persistence malware, or background network beacons. It only uses credentials and CLIs already available in the host environment.\n\nBefore running it in a new workspace:\n\n1. Review queued plans and phase prompts before approval.\n2. Run `night shift dry-run` first when available.\n3. Start with a disposable test repo or branch.\n4. Keep production deploys as explicit manual steps unless you intentionally add deploy phases.\n5. Inspect diffs/reports before merging completed work.\n\nFor non-interactive ClawHub installs, some registries may require `--force` after scanner warnings. Treat that as a prompt to review the code, not as a failure signal.\n\n---\n\n## Storage Layout\n\nNight Shift stores runtime state under:\n\n```text\ndata/night-shift/\n├── queue.json\n├── plans/\n├── worktrees/\n├── execution/\n├── reports/\n├── failure-memory.json\n├── budget.json\n└── execution.log\n```\n\n### Important files\n- `queue.json` — lightweight queue index\n- `plans/*.json` — full plan records\n- `worktrees/<plan_id>/` — isolated git worktree per plan\n- `failure-memory.json` — prior failed step fingerprints\n- `budget.json` — current budget tracking\n- `execution.log` — main execution log\n\n---\n\n## Environment Variables\n\nNight Shift now supports portable configuration instead of relying on hardcoded local paths.\n\n### Core\n- `OPENCLAW_WORKSPACE` — override workspace root\n- `NIGHT_SHIFT_MODEL` — preferred model hint for model-driven helpers\n- `CURSOR_CLI` — explicit path to Cursor CLI / `agent` binary\n\n### Notifications\n- `NIGHT_SHIFT_CHAT_ID` — target chat for Night Shift notifications\n- `TELEGRAM_CHAT_ID` — fallback notification target\n- `TELEGRAM_BOT_TOKEN` — Telegram Bot token for notifications\n\n### Execution environment\nNight Shift also inherits normal environment from the host runtime, including anything needed by:\n- git\n- Python\n- shell commands\n- coding harnesses / subagents\n\nIf a specific execution method requires additional auth or binaries, document that at the host level.\n\n---\n\n## Prerequisites\n\n### Required\n- Python 3\n- git\n- workspace write access\n- ability to create and modify files in `data/night-shift/`\n- a host environment that can run shell commands and Python scripts\n\n### Optional but useful\n- Cursor CLI / agent binary for `cursor` execution\n- Claude Code for `claude-code` execution\n- subagent support for delegated runs\n- Telegram bot setup for notifications\n\n### Strongly recommended\n- run inside a git-backed workspace\n- use approval before unattended execution\n- keep tests/lint scripts working in the target repo\n\n---\n\n## Examples\n\n### Example 1 — queue a feature for later\nUser intent:\n> Add OAuth login to the app, but do it overnight.\n\nNight Shift flow:\n1. `plan add add OAuth login to the app`\n2. inspect generated phases\n3. `plan approve #<id>`\n4. later: `good night`\n\n### Example 2 — multiple plans in one batch\nUser intent:\n> Queue three fixes now, run them all tonight.\n\nFlow:\n1. add three plans\n2. set priorities as needed\n3. approve the safe ones\n4. run Night Shift\n5. read the morning report\n\n### Example 3 — dry run before execution\nUser intent:\n> Show me what would run tonight.\n\nFlow:\n- `night shift dry-run`\n\n### Example 4 — retry a failed plan\nUser intent:\n> Retry the failed parser plan.\n\nFlow:\n- inspect plan/report\n- refine the phase prompt if needed\n- `night shift retry #<id>`\n\n### Example 5 — inspect before merge\nUser intent:\n> Show me what Night Shift changed before we merge.\n\nFlow:\n- `night shift inspect #<id>`\n- review diff/worktree/tests\n- `night shift merge #<id>` when satisfied\n\n---\n\n## How to Operate the Skill Well\n\n### Good plan inputs\nNight Shift works best when the plan title/description is concrete.\n\nBetter:\n- “Add retry logic to payment webhooks and verify with integration tests”\n- “Refactor dashboard query caching and run frontend smoke tests”\n\nWorse:\n- “make it better”\n- “fix the app somehow”\n\n### Good approval policy\nApprove unattended runs when:\n- the repo is in a sane state\n- the task is scoped\n- verification exists\n- you can tolerate isolated failures\n\nAvoid approval when:\n- the task is ambiguous\n- the run might touch production systems directly\n- the work needs live stakeholder decisions\n\n### Good execution method selection\nUse:\n- `shell` for deterministic scripted work\n- `cursor` / `claude-code` for coding-heavy phases\n- `subagent` for delegated structured work\n\n---\n\n## Limitations\n\nBe honest about these.\n\n- It is not a general scheduler for arbitrary business processes.\n- It is optimized for engineering work in a writable workspace.\n- Quality depends heavily on phase quality and verification quality.\n- If the underlying coding harness is weak or unavailable, outcomes degrade.\n- Worktree-based isolation assumes the repo supports normal git operations.\n- Some wrapper scripts and helpers are host-environment dependent.\n- Long unattended runs still need human review before high-trust deployment.\n\n---\n\n## Troubleshooting\n\n### “No approved plans found”\nApprove at least one plan before starting execution.\n\n### “Night Shift already running”\nA lock file or active run exists. Inspect status before forcing a restart.\n\n### “Worktree creation failed”\nCheck:\n- git repo health\n- branch/worktree permissions\n- existing conflicting worktrees\n\n### “Phase keeps failing”\n- inspect the plan’s phase prompt\n- review verification settings\n- check failure memory / logs\n- reduce scope and retry\n\n### “Notifications are not sent”\nCheck notification env vars:\n- `TELEGRAM_BOT_TOKEN`\n- `NIGHT_SHIFT_CHAT_ID` or `TELEGRAM_CHAT_ID`\n\n### “Cursor / Claude execution not found”\nSet the expected binary path explicitly or install the required tool:\n- `CURSOR_CLI`\n- whichever CLI your host maps to `claude-code`\n\n### “Execution stopped midway”\nInspect checkpoints, report output, logs, and plan status. Resume/retry instead of starting from scratch blindly.\n\n---\n\n## Publishing Notes\n\nNight Shift is publishable as a **power-user engineering skill**.\n\nIts strongest differentiators are:\n- queued plan lifecycle\n- isolated worktrees\n- phase verification\n- checkpointing and retry behavior\n- morning-report workflow\n\nIts biggest adoption caveats are:\n- requires a repo-aware writable environment\n- works best with supporting CLIs/tools already installed\n- more operational than a simple one-file prompt skill\n\nThat is fine. Don’t oversell it as “plug-and-play for everyone.” Sell it as a serious autonomous coding workflow for advanced users.\n\n---\n\n## Files\n\nCore engine files in `scripts/` include:\n- `models.py`\n- `queue.py`\n- `phase_generator.py`\n- `executor.py`\n- `phase_runner.py`\n- `verifier.py`\n- `checkpoint.py`\n- `failure_memory.py`\n- `budget.py`\n- `git_manager.py`\n- `lock.py`\n- `reporter.py`\n- `monitor.py`\n- `watchdog.py`\n- `subagent_runner.py`\n- `memory_guard.py`\n\nOptional/advanced helpers:\n- `bmad_batch.py`\n- `bmad_context.py`\n- `bmad_guardrails.py`\n- `bmad_phases.py`\n- `bmad_prd_evolve.py`\n- `bmad_queue.py`\n- `bmad_rollback.py`\n\nShell helpers:\n- `cron_trigger.sh`\n- `ns-control.sh`\n- `claude-wrapper.sh`\n\n---\n\n## See Also\n\n- `REFERENCE.md` — operational reference, setup notes, environment variables, and troubleshooting\n- `scripts/test_queue.py` — queue behavior checks\n- `scripts/test_integration.py` — end-to-end integration checks\n\nFile v1.0.4:_meta.json\n\n{\n  \"ownerId\": \"kn7380dt93q0wx6x1zx5b4y8z985kjww\",\n  \"slug\": \"night-shift\",\n  \"version\": \"1.0.4\",\n  \"publishedAt\": 1777244353041\n}\n\nFile v1.0.4:INSTALL.md\n\n# Night Shift Install and Setup\n\n## Install from ClawHub\n\n```bash\nopenclaw skills install vardhineediganesh877-ui/night-shift\n```\n\n## Verify local requirements\n\n```bash\ncd ~/.openclaw/workspace\npython3 skills/night-shift/scripts/preflight.py --json\n```\n\nRequired dependencies are `python3` and `git`. Cursor/Claude runners are optional, but any queued phase that uses them requires those CLIs to work non-interactively.\n\n## Recommended first run: disposable workspace\n\n```bash\nexport OPENCLAW_WORKSPACE=/tmp/night-shift-demo\nmkdir -p \"$OPENCLAW_WORKSPACE\"\npython3 ~/.openclaw/workspace/skills/night-shift/scripts/preflight.py --json\npython3 ~/.openclaw/workspace/skills/night-shift/scripts/executor.py dry-run\n```\n\nDry-run should write a preview report only. It should not mark plans complete or create success checkpoints.\n\n## Background/systemd setup\n\nDetached timers need explicit environment. Create a private env file if needed:\n\n```bash\ncp skills/night-shift/.night-shift.env.example ~/.openclaw/workspace/.night-shift.env\nchmod 600 ~/.openclaw/workspace/.night-shift.env\n```\n\nThen edit values for your environment. Do not commit real secrets.\n\nBefore enabling a timer, run preflight in the same user context that will run the service.\n\nFile v1.0.4:REFERENCE.md\n\n# Night Shift Reference\n\nThis file is the operational reference for the Night Shift skill.\n\nIt complements `SKILL.md` by focusing on setup, runtime expectations, file layout, and practical caveats.\n\n---\n\n## 1. What Night Shift Actually Is\n\nNight Shift is a queued autonomous execution framework for coding work.\n\nIt is **not** just a prompt pattern. It includes:\n- plan storage\n- phase generation\n- isolated worktrees\n- execution routing\n- verification\n- checkpointing\n- reporting\n- monitoring helpers\n\nThink of it as a lightweight unattended engineering operator.\n\n---\n\n## 2. Minimum Runtime Expectations\n\nNight Shift expects a host environment with:\n- Python 3\n- git\n- a writable workspace\n- permission to create directories/files under `data/night-shift/`\n- a repo or project context where worktrees and diffs make sense\n\nIf those are missing, the skill may still partially function, but the core value drops sharply.\n\n---\n\n## 3. Security Review Notes\n\nNight Shift is powerful by design. It can run shell commands, create git worktrees, call coding CLIs, and write reports/checkpoints. That means automated registries may classify it as suspicious even when the package is behaving as intended.\n\nExpected capabilities:\n- local file and directory writes under the configured workspace\n- git worktree / diff / commit / reset operations\n- subprocess execution for approved phase methods\n- optional calls to host-provided tools such as Cursor CLI, Claude Code, or subagents\n- optional Telegram notifications when notification environment variables are configured\n\nNot expected:\n- bundled secrets or private tokens\n- cryptocurrency mining\n- hidden persistence outside the configured workspace\n- unsolicited external network calls beyond host-configured tools/notifications\n- production deployment unless a user-approved phase explicitly performs it\n\nRecommended first-run posture:\n\n```bash\n# install into a disposable workspace first if reviewing a public copy\nclawhub install night-shift --force\n\n# inspect docs and scripts before use\nfind skills/night-shift -maxdepth 3 -type f | sort\n\n# run only approved test plans initially\n```\n\nIf your ClawHub client requires `--force`, it is usually because of these intentional automation primitives. Review before running, then proceed only in a workspace where unattended coding is acceptable.\n\n---\n\n## 4. Workspace Assumptions\n\nThe portable version of Night Shift uses workspace auto-detection.\n\nDefault behavior:\n- detect workspace from the skill location\n- store runtime data in `data/night-shift/`\n\nOverride with:\n\n```bash\nexport OPENCLAW_WORKSPACE=/path/to/workspace\n```\n\nThis controls where Night Shift reads/writes:\n- queue state\n- plan files\n- worktrees\n- logs\n- reports\n- budget / checkpoint / failure memory data\n\n---\n\n## 4. Important Environment Variables\n\n### Core\n\n```bash\nexport OPENCLAW_WORKSPACE=/path/to/workspace\nexport NIGHT_SHIFT_MODEL=auto\nexport CURSOR_CLI=/path/to/agent\n```\n\n### Notifications\n\n```bash\nexport TELEGRAM_BOT_TOKEN=...\nexport NIGHT_SHIFT_CHAT_ID=123456789\n# or fallback\nexport TELEGRAM_CHAT_ID=123456789\n```\n\n### Notes\n- `NIGHT_SHIFT_MODEL` is a hint used by some model-driven helpers.\n- `CURSOR_CLI` is useful if the `agent` binary is not discoverable on PATH.\n- Notification variables are optional.\n\n---\n\n## 5. Storage Layout\n\nRuntime state is stored under:\n\n```text\ndata/night-shift/\n├── queue.json\n├── plans/\n├── worktrees/\n├── execution/\n├── reports/\n├── failure-memory.json\n├── budget.json\n└── execution.log\n```\n\n### Recommended hygiene\n- back up `plans/` and `reports/` if they matter\n- prune stale worktrees periodically\n- inspect `failure-memory.json` if repeated failures feel suspicious\n- keep `queue.json` and `plans/` in sync by using the provided queue operations, not ad hoc edits\n\n---\n\n## 6. Execution Methods\n\nNight Shift supports multiple execution styles at the phase level.\n\n### `shell`\nUse for deterministic commands.\n\nBest for:\n- codegen via scripts\n- test runs\n- linters\n- file transforms\n- scripted maintenance\n\n### `cursor`\nUse for agentic coding via a Cursor/agent-style runner.\n\nBest for:\n- implementation-heavy code changes\n- multi-file refactors\n- coding tasks where a model benefits from repo context\n\n### `claude-code`\nUse for Claude Code based execution if your host supports it.\n\nBest for:\n- careful repo-aware coding work\n- structured implementation with strong text output\n\n### `subagent`\nUse when the host environment supports agent delegation.\n\nBest for:\n- isolated research or coding subtasks\n- delegated steps with separate context\n\n---\n\n## 7. Worktree Behavior\n\nNight Shift’s safety story depends heavily on worktree isolation.\n\nPer-plan worktrees help with:\n- safer concurrent plan handling\n- easier diff inspection\n- cleaner retry/reset behavior\n- less contamination of the main working tree\n\nOperational advice:\n- use Night Shift in repos with healthy git state\n- avoid starting with a dirty or half-merged repo if you can\n- inspect worktrees before merging if the task was complex\n\n---\n\n## 8. Verification Modes\n\nAvailable verification labels include:\n- `files_exist`\n- `check_git_diff`\n- `run_tests`\n- `lint_check`\n- `smoke_test`\n- `import_check`\n- `integration_check`\n- `snapshot_diff`\n- `none`\n\n### Practical guidance\n- use `run_tests` when repo tests are reliable\n- use `lint_check` for style/static checks\n- use `smoke_test` for lightweight runtime confidence\n- avoid `none` unless the phase is inherently non-testable or very small\n\nNight Shift is only as trustworthy as the verification attached to its phases.\n\n---\n\n## 9. Budget and Stop Conditions\n\nThe framework tracks budgets across multiple scopes.\n\nExamples mentioned in the implementation/docs include:\n- per-phase limits\n- per-plan limits\n- whole-night limits\n\nOperationally, budget checks are there to prevent:\n- endless unattended work\n- overconsumption of model/tool resources\n- a single bad plan dominating the whole run\n\nIf a plan is repeatedly too large, split it into smaller plans or improve the generated phases.\n\n---\n\n## 10. Checkpoints and Failure Memory\n\n### Checkpoints\nCheckpointing allows a run to resume or be inspected without pretending the whole night never happened.\n\nUse this when:\n- a run was interrupted\n- the system restarted\n- you want to retry after partial progress\n\n### Failure Memory\nFailure memory records prior failure fingerprints / patterns to reduce blind repetition.\n\nUse it as a signal, not an oracle.\nIf the same phase keeps failing:\n- simplify the phase\n- change the execution method\n- improve the prompt\n- tighten verification\n\n---\n\n## 11. Monitoring and Notifications\n\nNight Shift includes monitoring/reporting helpers.\n\nCapabilities may include:\n- execution logs\n- morning summaries\n- Telegram notifications\n- watchdog-style checks\n\nThese are useful, but optional. The core queue/executor flow should still make sense without notifications.\n\nIf you enable notifications, treat them as operational visibility — not as a replacement for review.\n\n---\n\n## 12. Optional BMAD Extensions\n\nThe `scripts/` folder may include BMAD-related helpers such as:\n- `bmad_batch.py`\n- `bmad_context.py`\n- `bmad_guardrails.py`\n- `bmad_phases.py`\n- `bmad_prd_evolve.py`\n- `bmad_queue.py`\n- `bmad_rollback.py`\n\nThese are advanced extensions.\n\nThey are **not** required for the baseline Night Shift lifecycle:\n- queue\n- approve\n- execute\n- verify\n- report\n\nIf you publish Night Shift, present BMAD as an optional advanced lane, not the first thing a new user must understand.\n\n---\n\n## 13. Shell Helpers\n\nShell wrappers in `scripts/` may include:\n- `cron_trigger.sh`\n- `ns-control.sh`\n- `claude-wrapper.sh`\n\nThese are convenience helpers, not the whole product.\n\nUse them when:\n- your environment wants cron-style launches\n- you prefer shell entrypoints\n- you want lightweight control wrappers\n\nAvoid making your documentation depend entirely on them.\n\n---\n\n## 14. Testing Notes\n\nIn the current skill-local portable version, the queue and integration checks have been exercised successfully.\n\nFiles of interest:\n- `scripts/test_queue.py`\n- `scripts/test_integration.py`\n\nWhen validating changes, prefer:\n1. queue tests\n2. integration checks\n3. a dry run\n4. a small real plan in a non-critical repo\n\nThat progression gives much better confidence than jumping straight to a large unattended batch.\n\n---\n\n## 15. Recommended Rollout Strategy for New Users\n\nIf someone installs this skill fresh, the safest adoption path is:\n\n### Stage 1 — Read and inspect\n- read `SKILL.md`\n- inspect `scripts/`\n- confirm required binaries and Python availability\n\n### Stage 2 — Dry run\n- create one simple plan\n- run `night shift dry-run`\n\n### Stage 3 — Small real run\n- approve one low-risk plan\n- run the executor\n- inspect report and worktree\n\n### Stage 4 — Multi-plan batch\n- queue several tasks\n- use priorities\n- review morning report quality\n\n### Stage 5 — Advanced automation\n- add notifications\n- add cron wrappers\n- experiment with BMAD extensions\n\n---\n\n## 16. Common Failure Modes\n\n### A. No plans execute\nLikely causes:\n- no approved plans\n- stale lock\n- queue/index mismatch\n\n### B. Worktree setup fails\nLikely causes:\n- broken git state\n- repo permissions\n- conflicting worktrees/branches\n\n### C. Model-backed phase fails repeatedly\nLikely causes:\n- vague phase prompt\n- wrong execution method\n- tool/harness missing\n- verification too strict for the phase shape\n\n### D. Reports are weak\nLikely causes:\n- low-quality phase structure\n- missing verification\n- oversized tasks crammed into one plan\n\n### E. Notifications never arrive\nLikely causes:\n- missing `TELEGRAM_BOT_TOKEN`\n- missing `NIGHT_SHIFT_CHAT_ID` / `TELEGRAM_CHAT_ID`\n- network or bot permissions issues\n\n---\n\n## 17. What to Be Honest About in a Public Listing\n\nNight Shift is powerful, but it is not beginner-simple.\n\nBe explicit that it is best for:\n- advanced OpenClaw / agent users\n- repo-centric engineering workflows\n- users who understand approval, git, and execution risk\n\nDo **not** market it like:\n- “set and forget magic coding forever”\n- “safe for any repo with zero setup”\n- “works equally well without verification or review”\n\nThe real pitch is better:\n> a structured autonomous execution framework for deferred engineering work\n\n---\n\n## 18. Good Public Positioning\n\nA strong public framing is:\n\n- **What it is:** queued overnight coding workflow\n- **Why it matters:** safe-ish deferred execution with worktrees and reports\n- **Who it’s for:** power users running multi-step repo tasks\n- **Why it stands out:** phase-based execution + isolation + verification + reporting\n\n---\n\n## 19. Suggested Setup Snippet\n\n```bash\nexport OPENCLAW_WORKSPACE=\"$HOME/.openclaw/workspace\"\nexport CURSOR_CLI=\"$(command -v agent)\"\nexport NIGHT_SHIFT_MODEL=\"auto\"\n# Optional notifications\nexport TELEGRAM_BOT_TOKEN=\"...\"\nexport NIGHT_SHIFT_CHAT_ID=\"123456789\"\n```\n\n---\n\n## 20. Final Advice\n\nNight Shift gets most of its value from discipline, not bravado.\n\nIf results are shaky:\n- shrink the plan\n- improve the phases\n- improve verification\n- inspect worktrees\n- retry surgically\n\nThe framework is strongest when it helps you run a calm engineering pipeline, not when it is treated like a slot machine.\n\nFile v1.0.4:SECURITY.md\n\n# Night Shift Security Model\n\nNight Shift is a powerful queued execution framework. Treat it like a coding agent runner, not a passive note-taking skill.\n\n## What Night Shift can do\n\nWhen you approve and run plans, Night Shift may:\n\n- read and write files inside the configured workspace\n- create git branches and worktrees under `data/night-shift/worktrees/`\n- run subprocesses for shell phases and verification commands\n- call optional coding runners such as Cursor CLI (`agent`/`cursor`) or Claude Code (`claude`)\n- run tests, linters, build commands, and smoke checks\n- write checkpoints, reports, logs, and failure-memory records\n- optionally send Telegram notifications if notification tokens are configured\n\n## What Night Shift should not do by default\n\nNight Shift should not:\n\n- run against production repositories without review\n- execute unreviewed public/external actions\n- send notifications unless recipients and tokens are explicitly configured\n- mark dry-runs as completed live work\n- continue through every plan after a shared runner/preflight failure\n\n## Required runtime dependencies\n\nRequired:\n\n- `python3` 3.11+\n- `git`\n- writable workspace/data directory\n\nOptional, depending on phase execution methods:\n\n- Cursor CLI: `agent` or `cursor`\n- Claude Code CLI: `claude`\n- Telegram notification env vars\n\n## Environment variables\n\nOptional variables read by the skill:\n\n- `OPENCLAW_WORKSPACE` — workspace root; defaults to the OpenClaw workspace that contains this skill\n- `NIGHT_SHIFT_DATA_DIR` — Night Shift state directory; defaults to `$OPENCLAW_WORKSPACE/data/night-shift`\n- `NIGHT_SHIFT_MODEL` — model hint for compatible runners\n- `CURSOR_CLI` — explicit path to Cursor/agent CLI\n- `CURSOR_API_KEY` — optional non-interactive Cursor auth, if supported by your CLI setup\n- `TELEGRAM_BOT_TOKEN`, `TELEGRAM_CHAT_ID`, `NIGHT_SHIFT_CHAT_ID` — optional notifications\n\nNever commit real tokens. Use a local env file such as `.night-shift.env` and keep it out of published packages.\n\n## Safe first run\n\nUse an isolated disposable workspace first:\n\n```bash\nexport OPENCLAW_WORKSPACE=/tmp/night-shift-demo\npython3 skills/night-shift/scripts/preflight.py --json\npython3 skills/night-shift/scripts/executor.py dry-run\n```\n\nDry-run is intended to be read-only. It should produce a preview report and must not mark plans complete or write success checkpoints.\n\n## Background runner warning\n\nDetached systemd/timer execution does not automatically inherit your interactive shell environment. Before live unattended execution, run preflight in the same user/service context. In particular, Cursor CLI phases need `HOME`, `PATH`, and a non-interactive auth strategy.\n\nIf preflight says Cursor/Claude is not ready, fix the environment or change the queued phases before running live execution.\n\n## Verification command policy\n\nVerification commands can execute subprocesses in the worktree. Prefer explicit, narrow commands such as:\n\n- `python3 -m pytest`\n- `npm test`\n- `npm run lint`\n- `ruff check .`\n\nAvoid arbitrary shell pipelines unless you have reviewed the plan and trust the repository.\n\n## Operational guidance\n\n- Review generated plans before approval.\n- Prefer dry-run before live execution.\n- Start with one low-risk plan in a disposable workspace.\n- Inspect reports and worktree diffs before merging.\n- Keep production credentials out of worktrees.\n\nArchive v1.0.3: 38 files, 101434 bytes\n\nFiles: INSTALL.md (1242b), night_shift/SKILL.md (2455b), REFERENCE.md (11234b), scripts/__init__.py (91b), scripts/bmad_batch.py (18536b), scripts/bmad_context.py (4296b), scripts/bmad_guardrails.py (4717b), scripts/bmad_phases.py (6538b), scripts/bmad_prd_evolve.py (5470b), scripts/bmad_queue.py (9065b), scripts/bmad_rollback.py (6262b), scripts/budget.py (4875b), scripts/checkpoint.py (4018b), scripts/claude-wrapper.sh (1818b), scripts/cron_trigger.sh (1902b), scripts/executor.py (24357b), scripts/failure_memory.py (3149b), scripts/git_manager.py (7783b), scripts/lock.py (1717b), scripts/memory_guard.py (7764b), scripts/models.py (9464b), scripts/monitor.py (15702b), scripts/night-runner.py (25456b), scripts/ns-control.sh (7208b), scripts/phase_generator.py (12200b), scripts/phase_runner.py (14944b), scripts/preflight.py (7296b), scripts/queue.py (11475b), scripts/reporter.py (6783b), scripts/status.py (6537b), scripts/subagent_runner.py (7559b), scripts/test_integration.py (6479b), scripts/test_queue.py (9262b), scripts/verifier.py (12431b), scripts/watchdog.py (3105b), SECURITY.md (3382b), SKILL.md (16841b), _meta.json (130b)\n\nFile v1.0.3:night_shift/SKILL.md\n\n---\nname: night_shift\ndescription: \"Queue coding plans during day, execute autonomously overnight with morning report. Use when: user says 'plan add/list/show/approve', 'phase edit', 'good night', 'night status/stop'.\"\nmetadata: {\"openclaw\":{\"emoji\":\"🌙\"}}\nuser-invocable: true\n---\n\n# Night-Shift Skill — Queue & Overnight Execution\n\nQueue coding plans during day, execute overnight, morning report.\n\n## Command Handler\n\n| Command | Action |\n|---------|--------|\n| `plan add <title>` | Create plan with auto-generated phases |\n| `plan list [status]` | Show plans (queued/approved/executing/completed/failed) |\n| `plan show <id>` | Full plan with phases |\n| `plan approve <id>` / `plan approve all` | Mark ready for execution |\n| `plan remove <id>` | Delete plan |\n| `plan priority <id> <level>` | Set critical/high/medium/low |\n| `phase edit <plan_id> <phase_id> <prompt>` | Edit a phase |\n| `good night` | Start overnight execution (background) |\n| `night status` / `night stop` | Check/stop execution |\n\nPython API: `from scripts.night_shift.queue import add_plan, list_plans, get_plan, approve_plan, approve_all, remove_plan, set_priority, format_plan_list, format_plan_detail, edit_phase`\n\n## Architecture\n- **Queue**: `scripts/night_shift/queue.py` → `data/night_shift/queue.json` + `plans/*.json`\n- **Executor**: `scripts/night_shift/executor.py` → phases via Cursor CLI → git worktrees → checkpoints\n- **Verifier**: 9 methods (files_exist, tests_pass, build_succeeds, lint_clean, git_diff, function_wired, snapshot_match, content_valid, smoke_test)\n- **Budget**: 5min/phase, 30min/plan, 6hr/night\n- **Safety**: git worktree isolation, lock file, watchdog (*/30min), checkpoint resume\n\n## Execution Methods\n1. **claude-code** (default) — Claude Code CLI, `coder` user\n2. **cursor** — Unified-Router: GLM-5.1 → Cursor → Opus fallback\n3. **shell** — Single-line commands only\n4. **subagent** — OpenClaw subagent for complex tasks\n\n## Guardrails (MANDATORY)\n- G1: Update plan JSON phases/status after EVERY phase\n- G2: Produce proof file before marking complete\n- G3: Subagent context budget: lightContext, 2000 char cap, max 3 concurrent\n- G4: Structured reporting only (table format)\n- G5: Use the pipeline (queue.py → executor.py → verifier.py), don't route around it\n- G6: JSON file is source of truth — chat must match JSON status\n\nSee REFERENCE.md for full details on storage, testing, monitoring, and server setup.\n\nFile v1.0.3:SKILL.md\n\n---\nname: night-shift\nversion: 1.0.2\ndescription: \"Queue coding plans during the day, approve them, execute later in isolated worktrees, and inspect reports. Background agentic execution requires an explicitly configured non-interactive runner.\"\nmetadata:\n  {\n    \"openclaw\":\n      {\n        \"requires\": { \"bins\": [\"python3\", \"git\"] },\n        \"optional\":\n          {\n            \"bins\": [\"agent\", \"cursor\", \"claude\"],\n            \"env\":\n              [\n                \"OPENCLAW_WORKSPACE\",\n                \"NIGHT_SHIFT_DATA_DIR\",\n                \"NIGHT_SHIFT_MODEL\",\n                \"CURSOR_CLI\",\n                \"CURSOR_API_KEY\",\n                \"TELEGRAM_BOT_TOKEN\",\n                \"TELEGRAM_CHAT_ID\",\n                \"NIGHT_SHIFT_CHAT_ID\",\n              ],\n          },\n        \"capabilities\":\n          [\n            \"filesystem-read-write\",\n            \"git-worktrees\",\n            \"subprocess-execution\",\n            \"optional-cursor-cli\",\n            \"optional-claude-cli\",\n            \"optional-telegram-notifications\",\n            \"optional-model-provider-calls\",\n          ],\n      },\n  }\n---\n\n# Night Shift\n\nNight Shift is an autonomous queued-execution skill for engineering work.\n\nInstead of asking the agent to do one large coding task immediately, you build a queue of plans, review or approve them, then run them in a controlled batch window. Each plan is split into phases, executed in isolation, verified, checkpointed, and summarized in a report.\n\n**Mental model:**\n- Daytime: create and refine plans\n- Before execution: approve what is safe to run\n- Execution window: Night Shift runs plans phase by phase\n- Morning: inspect results, merge, retry, or continue\n\nThis is useful when you want:\n- deferred execution instead of immediate chat-time work\n- safer batching for multi-step changes\n- isolated worktrees per plan\n- retry and checkpoint behavior\n- a written report after execution\n\n---\n\n## When to Use\n\nUse Night Shift when the user asks for things like:\n- “good night”\n- “queue this for later”\n- “plan add …”\n- “run these approved plans overnight”\n- “night shift status”\n- “show my morning report”\n- “retry plan #3”\n- “merge that finished plan”\n\nPrefer Night Shift over immediate execution when:\n- the work is multi-phase\n- the task needs isolation from the main repo state\n- the user wants review/approval before execution\n- the work may take a long time\n- you want a queue of tasks rather than one interactive run\n\nDo **not** use Night Shift for:\n- tiny one-off edits better handled immediately\n- high-risk production actions without review\n- tasks that require constant human decisions mid-run\n- public/external actions that should be explicitly approved in the moment\n\n---\n\n## Core Concepts\n\n### 1. Plan\nA plan is the unit of queued work. It includes:\n- title\n- optional description\n- optional repo URL\n- priority\n- token/time budget hints\n- generated phases\n- status and execution metadata\n\n### 2. Phase\nEach plan is split into phases. A phase has:\n- a title\n- a prompt/instruction\n- an execution method\n- verification settings\n- retry state\n- status\n\n### 3. Execution Method\nEach phase chooses one of several execution methods:\n- `shell`\n- `cursor`\n- `claude-code`\n- `subagent`\n\nThis lets the framework mix deterministic shell work with agentic coding work.\n\n### 4. Worktree Isolation\nEach plan runs in its own git worktree under `data/night-shift/worktrees/`.\n\nThat means Night Shift can:\n- avoid trampling the main branch\n- keep plan-specific diffs separate\n- retry or inspect work in isolation\n- support safer merge/rollback flows\n\n### 5. Verification\nPhases can be checked after execution using one of several verification modes, including:\n- `files_exist`\n- `check_git_diff`\n- `run_tests`\n- `lint_check`\n- `smoke_test`\n- `import_check`\n- `integration_check`\n- `snapshot_diff`\n- `none`\n\n### 6. Reporting\nAfter execution, Night Shift writes a report so the next interaction starts from evidence instead of guesswork.\n\n---\n\n## Typical Workflow\n\n### During the day\n1. Add one or more plans\n2. Review phases\n3. Edit prompts or priorities if needed\n4. Approve the plans that are safe to run\n\n### At execution time\n5. Start Night Shift\n6. It acquires a lock, checks budgets, creates worktrees, and executes phases\n7. It verifies each phase, checkpoints progress, records failures, and logs results\n\n### After execution\n8. Read the report\n9. Inspect worktrees or diffs\n10. Merge successful work, retry failed work, or queue follow-up plans\n\n---\n\n## User-Facing Commands\n\nThese are the command patterns the skill is designed around.\n\n| Command | Purpose |\n|---|---|\n| `plan add <desc>` | Create a new plan with generated phases |\n| `plan steal <url> <desc>` | Queue work derived from an external repo/project |\n| `plan list [status]` | Show plans in the queue |\n| `plan show #<id>` | Show full details for one plan |\n| `plan approve #<id>` | Approve one plan |\n| `plan approve all` | Approve all queued plans |\n| `plan remove #<id>` | Remove a plan |\n| `plan priority #<id> <level>` | Change priority |\n| `plan edit #<id> phase <n> prompt <text>` | Refine a phase prompt |\n| `good night` | Start execution of approved plans |\n| `night shift status` | Show current state |\n| `night shift stop` | Request stop / halt execution |\n| `night shift dry-run` | Preview what would execute |\n| `morning` | Show the latest execution report |\n| `night shift merge #<id>` | Merge completed plan results |\n| `night shift inspect #<id>` | Inspect outputs/worktree |\n| `night shift retry #<id>` | Retry a failed or partial plan |\n\nIf your host agent uses a different natural-language wrapper, preserve the same intent and lifecycle.\n\n---\n\n## Architecture\n\nNight Shift is split into a few major parts.\n\n### Queue and Models\n- `models.py` — core plan/phase data models and enums\n- `queue.py` — CRUD, queue index, plan storage, approvals, updates\n- `phase_generator.py` — creates initial phases from plan input\n\n### Execution Engine\n- `executor.py` — main run loop, orchestration, locking, budget checks, reporting\n- `phase_runner.py` — executes individual phases using the chosen method\n- `subagent_runner.py` — helper for subagent-based execution\n\n### Safety and Recovery\n- `verifier.py` — phase verification logic\n- `checkpoint.py` — save/resume progress\n- `failure_memory.py` — track known failures and avoid blind repetition\n- `lock.py` — prevent overlapping runs\n- `budget.py` — per-phase/per-plan/night budget tracking\n- `memory_guard.py` — watchdog for memory/process hygiene\n\n### Repo / Git Operations\n- `git_manager.py` — worktree setup, commit/reset helpers\n\n### Visibility and Operations\n- `reporter.py` — morning-style summaries\n- `monitor.py` — notifications and health checks\n- `watchdog.py` — execution monitoring\n- `status.py` — status helpers\n- `cron_trigger.sh` / `ns-control.sh` — optional shell wrappers\n\n### Optional Extensions\nThe `bmad_*.py` files are advanced helpers for richer planning/PRD flows. They are **not required** for the core Night Shift lifecycle.\n\n---\n\n## Execution Flow\n\nA typical run looks like this:\n\n1. **Preflight**\n   - confirm no conflicting lock\n   - load queue\n   - check for approved plans\n   - initialize budget / logs / monitors\n\n2. **Plan selection**\n   - choose approved plans in queue order / priority order\n\n3. **Per-plan setup**\n   - create or prepare isolated worktree\n   - load checkpoint if resuming\n\n4. **Per-phase execution**\n   - build phase prompt\n   - dispatch via the selected execution method\n   - capture output, status, timing, and any token/cost metadata available\n\n5. **Verification**\n   - run configured verification step\n   - mark success/failure\n   - record failure memory if relevant\n\n6. **Persistence**\n   - update plan JSON\n   - update queue index\n   - save checkpoint/logs\n\n7. **Completion**\n   - finalize plan status\n   - generate report\n   - release lock\n\n---\n\n## Safety Model\n\nNight Shift is designed to be agentic, but not reckless.\n\n### Safety features\n- **approval gate** before execution\n- **worktree isolation** per plan\n- **execution lock** to prevent overlapping runs\n- **phase-by-phase progression** instead of one giant opaque run\n- **verification hooks** after phases\n- **checkpointing** for resumes/recovery\n- **failure memory** to reduce repeated mistakes\n- **budget caps** across phase/plan/night scopes\n- **watchdog/monitoring** support\n\n### What this protects against\n- clobbering the main branch\n- executing multiple Night Shift loops at once\n- losing progress on interruption\n- repeating the same failing step forever\n- oversized unattended execution sessions\n\n### What it does **not** guarantee\n- perfect code quality\n- correct architectural judgment for every task\n- safe production deployment by default\n- zero hallucination from external coding models\n\nYou still need sensible approval and review.\n\n### Trust, permissions, and security scanners\n\nNight Shift may be flagged by automated scanners because it intentionally includes operational automation primitives:\n\n- shell wrappers (`cron_trigger.sh`, `ns-control.sh`, `claude-wrapper.sh`)\n- Python subprocess execution for approved phases\n- git worktree, commit, reset, and diff helpers\n- optional Cursor CLI / Claude Code / subagent dispatch\n- optional Telegram notification support\n\nThese are expected for an unattended coding workflow, but they deserve review before use. Night Shift does **not** bundle private keys, hidden credentials, miners, persistence malware, or background network beacons. It only uses credentials and CLIs already available in the host environment.\n\nBefore running it in a new workspace:\n\n1. Review queued plans and phase prompts before approval.\n2. Run `night shift dry-run` first when available.\n3. Start with a disposable test repo or branch.\n4. Keep production deploys as explicit manual steps unless you intentionally add deploy phases.\n5. Inspect diffs/reports before merging completed work.\n\nFor non-interactive ClawHub installs, some registries may require `--force` after scanner warnings. Treat that as a prompt to review the code, not as a failure signal.\n\n---\n\n## Storage Layout\n\nNight Shift stores runtime state under:\n\n```text\ndata/night-shift/\n├── queue.json\n├── plans/\n├── worktrees/\n├── execution/\n├── reports/\n├── failure-memory.json\n├── budget.json\n└── execution.log\n```\n\n### Important files\n- `queue.json` — lightweight queue index\n- `plans/*.json` — full plan records\n- `worktrees/<plan_id>/` — isolated git worktree per plan\n- `failure-memory.json` — prior failed step fingerprints\n- `budget.json` — current budget tracking\n- `execution.log` — main execution log\n\n---\n\n## Environment Variables\n\nNight Shift now supports portable configuration instead of relying on hardcoded local paths.\n\n### Core\n- `OPENCLAW_WORKSPACE` — override workspace root\n- `NIGHT_SHIFT_MODEL` — preferred model hint for model-driven helpers\n- `CURSOR_CLI` — explicit path to Cursor CLI / `agent` binary\n\n### Notifications\n- `NIGHT_SHIFT_CHAT_ID` — target chat for Night Shift notifications\n- `TELEGRAM_CHAT_ID` — fallback notification target\n- `TELEGRAM_BOT_TOKEN` — Telegram Bot token for notifications\n\n### Execution environment\nNight Shift also inherits normal environment from the host runtime, including anything needed by:\n- git\n- Python\n- shell commands\n- coding harnesses / subagents\n\nIf a specific execution method requires additional auth or binaries, document that at the host level.\n\n---\n\n## Prerequisites\n\n### Required\n- Python 3\n- git\n- workspace write access\n- ability to create and modify files in `data/night-shift/`\n- a host environment that can run shell commands and Python scripts\n\n### Optional but useful\n- Cursor CLI / agent binary for `cursor` execution\n- Claude Code for `claude-code` execution\n- subagent support for delegated runs\n- Telegram bot setup for notifications\n\n### Strongly recommended\n- run inside a git-backed workspace\n- use approval before unattended execution\n- keep tests/lint scripts working in the target repo\n\n---\n\n## Examples\n\n### Example 1 — queue a feature for later\nUser intent:\n> Add OAuth login to the app, but do it overnight.\n\nNight Shift flow:\n1. `plan add add OAuth login to the app`\n2. inspect generated phases\n3. `plan approve #<id>`\n4. later: `good night`\n\n### Example 2 — multiple plans in one batch\nUser intent:\n> Queue three fixes now, run them all tonight.\n\nFlow:\n1. add three plans\n2. set priorities as needed\n3. approve the safe ones\n4. run Night Shift\n5. read the morning report\n\n### Example 3 — dry run before execution\nUser intent:\n> Show me what would run tonight.\n\nFlow:\n- `night shift dry-run`\n\n### Example 4 — retry a failed plan\nUser intent:\n> Retry the failed parser plan.\n\nFlow:\n- inspect plan/report\n- refine the phase prompt if needed\n- `night shift retry #<id>`\n\n### Example 5 — inspect before merge\nUser intent:\n> Show me what Night Shift changed before we merge.\n\nFlow:\n- `night shift inspect #<id>`\n- review diff/worktree/tests\n- `night shift merge #<id>` when satisfied\n\n---\n\n## How to Operate the Skill Well\n\n### Good plan inputs\nNight Shift works best when the plan title/description is concrete.\n\nBetter:\n- “Add retry logic to payment webhooks and verify with integration tests”\n- “Refactor dashboard query caching and run frontend smoke tests”\n\nWorse:\n- “make it better”\n- “fix the app somehow”\n\n### Good approval policy\nApprove unattended runs when:\n- the repo is in a sane state\n- the task is scoped\n- verification exists\n- you can tolerate isolated failures\n\nAvoid approval when:\n- the task is ambiguous\n- the run might touch production systems directly\n- the work needs live stakeholder decisions\n\n### Good execution method selection\nUse:\n- `shell` for deterministic scripted work\n- `cursor` / `claude-code` for coding-heavy phases\n- `subagent` for delegated structured work\n\n---\n\n## Limitations\n\nBe honest about these.\n\n- It is not a general scheduler for arbitrary business processes.\n- It is optimized for engineering work in a writable workspace.\n- Quality depends heavily on phase quality and verification quality.\n- If the underlying coding harness is weak or unavailable, outcomes degrade.\n- Worktree-based isolation assumes the repo supports normal git operations.\n- Some wrapper scripts and helpers are host-environment dependent.\n- Long unattended runs still need human review before high-trust deployment.\n\n---\n\n## Troubleshooting\n\n### “No approved plans found”\nApprove at least one plan before starting execution.\n\n### “Night Shift already running”\nA lock file or active run exists. Inspect status before forcing a restart.\n\n### “Worktree creation failed”\nCheck:\n- git repo health\n- branch/worktree permissions\n- existing conflicting worktrees\n\n### “Phase keeps failing”\n- inspect the plan’s phase prompt\n- review verification settings\n- check failure memory / logs\n- reduce scope and retry\n\n### “Notifications are not sent”\nCheck notification env vars:\n- `TELEGRAM_BOT_TOKEN`\n- `NIGHT_SHIFT_CHAT_ID` or `TELEGRAM_CHAT_ID`\n\n### “Cursor / Claude execution not found”\nSet the expected binary path explicitly or install the required tool:\n- `CURSOR_CLI`\n- whichever CLI your host maps to `claude-code`\n\n### “Execution stopped midway”\nInspect checkpoints, report output, logs, and plan status. Resume/retry instead of starting from scratch blindly.\n\n---\n\n## Publishing Notes\n\nNight Shift is publishable as a **power-user engineering skill**.\n\nIts strongest differentiators are:\n- queued plan lifecycle\n- isolated worktrees\n- phase verification\n- checkpointing and retry behavior\n- morning-report workflow\n\nIts biggest adoption caveats are:\n- requires a repo-aware writable environment\n- works best with supporting CLIs/tools already installed\n- more operational than a simple one-file prompt skill\n\nThat is fine. Don’t oversell it as “plug-and-play for everyone.” Sell it as a serious autonomous coding workflow for advanced users.\n\n---\n\n## Files\n\nCore engine files in `scripts/` include:\n- `models.py`\n- `queue.py`\n- `phase_generator.py`\n- `executor.py`\n- `phase_runner.py`\n- `verifier.py`\n- `checkpoint.py`\n- `failure_memory.py`\n- `budget.py`\n- `git_manager.py`\n- `lock.py`\n- `reporter.py`\n- `monitor.py`\n- `watchdog.py`\n- `subagent_runner.py`\n- `memory_guard.py`\n\nOptional/advanced helpers:\n- `bmad_batch.py`\n- `bmad_context.py`\n- `bmad_guardrails.py`\n- `bmad_phases.py`\n- `bmad_prd_evolve.py`\n- `bmad_queue.py`\n- `bmad_rollback.py`\n\nShell helpers:\n- `cron_trigger.sh`\n- `ns-control.sh`\n- `claude-wrapper.sh`\n\n---\n\n## See Also\n\n- `REFERENCE.md` — operational reference, setup notes, environment variables, and troubleshooting\n- `scripts/test_queue.py` — queue behavior checks\n- `scripts/test_integration.py` — end-to-end integration checks\n\nFile v1.0.3:_meta.json\n\n{\n  \"ownerId\": \"kn7380dt93q0wx6x1zx5b4y8z985kjww\",\n  \"slug\": \"night-shift\",\n  \"version\": \"1.0.3\",\n  \"publishedAt\": 1777243670863\n}\n\nFile v1.0.3:INSTALL.md\n\n# Night Shift Install and Setup\n\n## Install from ClawHub\n\n```bash\nopenclaw skills install vardhineediganesh877-ui/night-shift\n```\n\n## Verify local requirements\n\n```bash\ncd ~/.openclaw/workspace\npython3 skills/night-shift/scripts/preflight.py --json\n```\n\nRequired dependencies are `python3` and `git`. Cursor/Claude runners are optional, but any queued phase that uses them requires those CLIs to work non-interactively.\n\n## Recommended first run: disposable workspace\n\n```bash\nexport OPENCLAW_WORKSPACE=/tmp/night-shift-demo\nmkdir -p \"$OPENCLAW_WORKSPACE\"\npython3 ~/.openclaw/workspace/skills/night-shift/scripts/preflight.py --json\npython3 ~/.openclaw/workspace/skills/night-shift/scripts/executor.py dry-run\n```\n\nDry-run should write a preview report only. It should not mark plans complete or create success checkpoints.\n\n## Background/systemd setup\n\nDetached timers need explicit environment. Create a private env file if needed:\n\n```bash\ncp skills/night-shift/.night-shift.env.example ~/.openclaw/workspace/.night-shift.env\nchmod 600 ~/.openclaw/workspace/.night-shift.env\n```\n\nThen edit values for your environment. Do not commit real secrets.\n\nBefore enabling a timer, run preflight in the same user context that will run the service.\n\nFile v1.0.3:REFERENCE.md\n\n# Night Shift Reference\n\nThis file is the operational reference for the Night Shift skill.\n\nIt complements `SKILL.md` by focusing on setup, runtime expectations, file layout, and practical caveats.\n\n---\n\n## 1. What Night Shift Actually Is\n\nNight Shift is a queued autonomous execution framework for coding work.\n\nIt is **not** just a prompt pattern. It includes:\n- plan storage\n- phase generation\n- isolated worktrees\n- execution routing\n- verification\n- checkpointing\n- reporting\n- monitoring helpers\n\nThink of it as a lightweight unattended engineering operator.\n\n---\n\n## 2. Minimum Runtime Expectations\n\nNight Shift expects a host environment with:\n- Python 3\n- git\n- a writable workspace\n- permission to create directories/files under `data/night-shift/`\n- a repo or project context where worktrees and diffs make sense\n\nIf those are missing, the skill may still partially function, but the core value drops sharply.\n\n---\n\n## 3. Security Review Notes\n\nNight Shift is powerful by design. It can run shell commands, create git worktrees, call coding CLIs, and write reports/checkpoints. That means automated registries may classify it as suspicious even when the package is behaving as intended.\n\nExpected capabilities:\n- local file and directory writes under the configured workspace\n- git worktree / diff / commit / reset operations\n- subprocess execution for approved phase methods\n- optional calls to host-provided tools such as Cursor CLI, Claude Code, or subagents\n- optional Telegram notifications when notification environment variables are configured\n\nNot expected:\n- bundled secrets or private tokens\n- cryptocurrency mining\n- hidden persistence outside the configured workspace\n- unsolicited external network calls beyond host-configured tools/notifications\n- production deployment unless a user-approved phase explicitly performs it\n\nRecommended first-run posture:\n\n```bash\n# install into a disposable workspace first if reviewing a public copy\nclawhub install night-shift --force\n\n# inspect docs and scripts before use\nfind skills/night-shift -maxdepth 3 -type f | sort\n\n# run only approved test plans initially\n```\n\nIf your ClawHub client requires `--force`, it is usually because of these intentional automation primitives. Review before running, then proceed only in a workspace where unattended coding is acceptable.\n\n---\n\n## 4. Workspace Assumptions\n\nThe portable version of Night Shift uses workspace auto-detection.\n\nDefault behavior:\n- detect workspace from the skill location\n- store runtime data in `data/night-shift/`\n\nOverride with:\n\n```bash\nexport OPENCLAW_WORKSPACE=/path/to/workspace\n```\n\nThis controls where Night Shift reads/writes:\n- queue state\n- plan files\n- worktrees\n- logs\n- reports\n- budget / checkpoint / failure memory data\n\n---\n\n## 4. Important Environment Variables\n\n### Core\n\n```bash\nexport OPENCLAW_WORKSPACE=/path/to/workspace\nexport NIGHT_SHIFT_MODEL=auto\nexport CURSOR_CLI=/path/to/agent\n```\n\n### Notifications\n\n```bash\nexport TELEGRAM_BOT_TOKEN=...\nexport NIGHT_SHIFT_CHAT_ID=123456789\n# or fallback\nexport TELEGRAM_CHAT_ID=123456789\n```\n\n### Notes\n- `NIGHT_SHIFT_MODEL` is a hint used by some model-driven helpers.\n- `CURSOR_CLI` is useful if the `agent` binary is not discoverable on PATH.\n- Notification variables are optional.\n\n---\n\n## 5. Storage Layout\n\nRuntime state is stored under:\n\n```text\ndata/night-shift/\n├── queue.json\n├── plans/\n├── worktrees/\n├── execution/\n├── reports/\n├── failure-memory.json\n├── budget.json\n└── execution.log\n```\n\n### Recommended hygiene\n- back up `plans/` and `reports/` if they matter\n- prune stale worktrees periodically\n- inspect `failure-memory.json` if repeated failures feel suspicious\n- keep `queue.json` and `plans/` in sync by using the provided queue operations, not ad hoc edits\n\n---\n\n## 6. Execution Methods\n\nNight Shift supports multiple execution styles at the phase level.\n\n### `shell`\nUse for deterministic commands.\n\nBest for:\n- codegen via scripts\n- test runs\n- linters\n- file transforms\n- scripted maintenance\n\n### `cursor`\nUse for agentic coding via a Cursor/agent-style runner.\n\nBest for:\n- implementation-heavy code changes\n- multi-file refactors\n- coding tasks where a model benefits from repo context\n\n### `claude-code`\nUse for Claude Code based execution if your host supports it.\n\nBest for:\n- careful repo-aware coding work\n- structured implementation with strong text output\n\n### `subagent`\nUse when the host environment supports agent delegation.\n\nBest for:\n- isolated research or coding subtasks\n- delegated steps with separate context\n\n---\n\n## 7. Worktree Behavior\n\nNight Shift’s safety story depends heavily on worktree isolation.\n\nPer-plan worktrees help with:\n- safer concurrent plan handling\n- easier diff inspection\n- cleaner retry/reset behavior\n- less contamination of the main working tree\n\nOperational advice:\n- use Night Shift in repos with healthy git state\n- avoid starting with a dirty or half-merged repo if you can\n- inspect worktrees before merging if the task was complex\n\n---\n\n## 8. Verification Modes\n\nAvailable verification labels include:\n- `files_exist`\n- `check_git_diff`\n- `run_tests`\n- `lint_check`\n- `smoke_test`\n- `import_check`\n- `integration_check`\n- `snapshot_diff`\n- `none`\n\n### Practical guidance\n- use `run_tests` when repo tests are reliable\n- use `lint_check` for style/static checks\n- use `smoke_test` for lightweight runtime confidence\n- avoid `none` unless the phase is inherently non-testable or very small\n\nNight Shift is only as trustworthy as the verification attached to its phases.\n\n---\n\n## 9. Budget and Stop Conditions\n\nThe framework tracks budgets across multiple scopes.\n\nExamples mentioned in the implementation/docs include:\n- per-phase limits\n- per-plan limits\n- whole-night limits\n\nOperationally, budget checks are there to prevent:\n- endless unattended work\n- overconsumption of model/tool resources\n- a single bad plan dominating the whole run\n\nIf a plan is repeatedly too large, split it into smaller plans or improve the generated phases.\n\n---\n\n## 10. Checkpoints and Failure Memory\n\n### Checkpoints\nCheckpointing allows a run to resume or be inspected without pretending the whole night never happened.\n\nUse this when:\n- a run was interrupted\n- the system restarted\n- you want to retry after partial progress\n\n### Failure Memory\nFailure memory records prior failure fingerprints / patterns to reduce blind repetition.\n\nUse it as a signal, not an oracle.\nIf the same phase keeps failing:\n- simplify the phase\n- change the execution method\n- improve the prompt\n- tighten verification\n\n---\n\n## 11. Monitoring and Notifications\n\nNight Shift includes monitoring/reporting helpers.\n\nCapabilities may include:\n- execution logs\n- morning summaries\n- Telegram notifications\n- watchdog-style checks\n\nThese are useful, but optional. The core queue/executor flow should still make sense without notifications.\n\nIf you enable notifications, treat them as operational visibility — not as a replacement for review.\n\n---\n\n## 12. Optional BMAD Extensions\n\nThe `scripts/` folder may include BMAD-related helpers such as:\n- `bmad_batch.py`\n- `bmad_context.py`\n- `bmad_guardrails.py`\n- `bmad_phases.py`\n- `bmad_prd_evolve.py`\n- `bmad_queue.py`\n- `bmad_rollback.py`\n\nThese are advanced extensions.\n\nThey are **not** required for the baseline Night Shift lifecycle:\n- queue\n- approve\n- execute\n- verify\n- report\n\nIf you publish Night Shift, present BMAD as an optional advanced lane, not the first thing a new user must understand.\n\n---\n\n## 13. Shell Helpers\n\nShell wrappers in `scripts/` may include:\n- `cron_trigger.sh`\n- `ns-control.sh`\n- `claude-wrapper.sh`\n\nThese are convenience helpers, not the whole product.\n\nUse them when:\n- your environment wants cron-style launches\n- you prefer shell entrypoints\n- you want lightweight control wrappers\n\nAvoid making your documentation depend entirely on them.\n\n---\n\n## 14. Testing Notes\n\nIn the current skill-local portable version, the queue and integration checks have been exercised successfully.\n\nFiles of interest:\n- `scripts/test_queue.py`\n- `scripts/test_integration.py`\n\nWhen validating changes, prefer:\n1. queue tests\n2. integration checks\n3. a dry run\n4. a small real plan in a non-critical repo\n\nThat progression gives much better confidence than jumping straight to a large unattended batch.\n\n---\n\n## 15. Recommended Rollout Strategy for New Users\n\nIf someone installs this skill fresh, the safest adoption path is:\n\n### Stage 1 — Read and inspect\n- read `SKILL.md`\n- inspect `scripts/`\n- confirm required binaries and Python availability\n\n### Stage 2 — Dry run\n- create one simple plan\n- run `night shift dry-run`\n\n### Stage 3 — Small real run\n- approve one low-risk plan\n- run the executor\n- inspect report and worktree\n\n### Stage 4 — Multi-plan batch\n- queue several tasks\n- use priorities\n- review morning report quality\n\n### Stage 5 — Advanced automation\n- add notifications\n- add cron wrappers\n- experiment with BMAD extensions\n\n---\n\n## 16. Common Failure Modes\n\n### A. No plans execute\nLikely causes:\n- no approved plans\n- stale lock\n- queue/index mismatch\n\n### B. Worktree setup fails\nLikely causes:\n- broken git state\n- repo permissions\n- conflicting worktrees/branches\n\n### C. Model-backed phase fails repeatedly\nLikely causes:\n- vague phase prompt\n- wrong execution method\n- tool/harness missing\n- verification too strict for the phase shape\n\n### D. Reports are weak\nLikely causes:\n- low-quality phase structure\n- missing verification\n- oversized tasks crammed into one plan\n\n### E. Notifications never arrive\nLikely causes:\n- missing `TELEGRAM_BOT_TOKEN`\n- missing `NIGHT_SHIFT_CHAT_ID` / `TELEGRAM_CHAT_ID`\n- network or bot permissions issues\n\n---\n\n## 17. What to Be Honest About in a Public Listing\n\nNight Shift is powerful, but it is not beginner-simple.\n\nBe explicit that it is best for:\n- advanced OpenClaw / agent users\n- repo-centric engineering workflows\n- users who understand approval, git, and execution risk\n\nDo **not** market it like:\n- “set and forget magic coding forever”\n- “safe for any repo with zero setup”\n- “works equally well without verification or review”\n\nThe real pitch is better:\n> a structured autonomous execution framework for deferred engineering work\n\n---\n\n## 18. Good Public Positioning\n\nA strong public framing is:\n\n- **What it is:** queued overnight coding workflow\n- **Why it matters:** safe-ish deferred execution with worktrees and reports\n- **Who it’s for:** power users running multi-step repo tasks\n- **Why it stands out:** phase-based execution + isolation + verification + reporting\n\n---\n\n## 19. Suggested Setup Snippet\n\n```bash\nexport OPENCLAW_WORKSPACE=\"$HOME/.openclaw/workspace\"\nexport CURSOR_CLI=\"$(command -v agent)\"\nexport NIGHT_SHIFT_MODEL=\"auto\"\n# Optional notifications\nexport TELEGRAM_BOT_TOKEN=\"...\"\nexport NIGHT_SHIFT_CHAT_ID=\"123456789\"\n```\n\n---\n\n## 20. Final Advice\n\nNight Shift gets most of its value from discipline, not bravado.\n\nIf results are shaky:\n- shrink the plan\n- improve the phases\n- improve verification\n- inspect worktrees\n- retry surgically\n\nThe framework is strongest when it helps you run a calm engineering pipeline, not when it is treated like a slot machine.\n\nFile v1.0.3:SECURITY.md\n\n# Night Shift Security Model\n\nNight Shift is a powerful queued execution framework. Treat it like a coding agent runner, not a passive note-taking skill.\n\n## What Night Shift can do\n\nWhen you approve and run plans, Night Shift may:\n\n- read and write files inside the configured workspace\n- create git branches and worktrees under `data/night-shift/worktrees/`\n- run subprocesses for shell phases and verification commands\n- call optional coding runners such as Cursor CLI (`agent`/`cursor`) or Claude Code (`claude`)\n- run tests, linters, build commands, and smoke checks\n- write checkpoints, reports, logs, and failure-memory records\n- optionally send Telegram notifications if notification tokens are configured\n\n## What Night Shift should not do by default\n\nNight Shift should not:\n\n- run against production repositories without review\n- execute unreviewed public/external actions\n- send notifications unless recipients and tokens are explicitly configured\n- mark dry-runs as completed live work\n- continue through every plan after a shared runner/preflight failure\n\n## Required runtime dependencies\n\nRequired:\n\n- `python3` 3.11+\n- `git`\n- writable workspace/data directory\n\nOptional, depending on phase execution methods:\n\n- Cursor CLI: `agent` or `cursor`\n- Claude Code CLI: `claude`\n- Telegram notification env vars\n\n## Environment variables\n\nOptional variables read by the skill:\n\n- `OPENCLAW_WORKSPACE` — workspace root; defaults to the OpenClaw workspace that contains this skill\n- `NIGHT_SHIFT_DATA_DIR` — Night Shift state directory; defaults to `$OPENCLAW_WORKSPACE/data/night-shift`\n- `NIGHT_SHIFT_MODEL` — model hint for compatible runners\n- `CURSOR_CLI` — explicit path to Cursor/agent CLI\n- `CURSOR_API_KEY` — optional non-interactive Cursor auth, if supported by your CLI setup\n- `TELEGRAM_BOT_TOKEN`, `TELEGRAM_CHAT_ID`, `NIGHT_SHIFT_CHAT_ID` — optional notifications\n\nNever commit real tokens. Use a local env file such as `.night-shift.env` and keep it out of published packages.\n\n## Safe first run\n\nUse an isolated disposable workspace first:\n\n```bash\nexport OPENCLAW_WORKSPACE=/tmp/night-shift-demo\npython3 skills/night-shift/scripts/preflight.py --json\npython3 skills/night-shift/scripts/executor.py dry-run\n```\n\nDry-run is intended to be read-only. It should produce a preview report and must not mark plans complete or write success checkpoints.\n\n## Background runner warning\n\nDetached systemd/timer execution does not automatically inherit your interactive shell environment. Before live unattended execution, run preflight in the same user/service context. In particular, Cursor CLI phases need `HOME`, `PATH`, and a non-interactive auth strategy.\n\nIf preflight says Cursor/Claude is not ready, fix the environment or change the queued phases before running live execution.\n\n## Verification command policy\n\nVerification commands can execute subprocesses in the worktree. Prefer explicit, narrow commands such as:\n\n- `python3 -m pytest`\n- `npm test`\n- `npm run lint`\n- `ruff check .`\n\nAvoid arbitrary shell pipelines unless you have reviewed the plan and trust the repository.\n\n## Operational guidance\n\n- Review generated plans before approval.\n- Prefer dry-run before live execution.\n- Start with one low-risk plan in a disposable workspace.\n- Inspect reports and worktree diffs before merging.\n- Keep production credentials out of worktrees.\n\nArchive v1.0.2: 38 files, 100983 bytes\n\nFiles: INSTALL.md (1242b), night_shift/SKILL.md (2455b), REFERENCE.md (11234b), scripts/__init__.py (91b), scripts/bmad_batch.py (18536b), scripts/bmad_context.py (4296b), scripts/bmad_guardrails.py (4717b), scripts/bmad_phases.py (6538b), scripts/bmad_prd_evolve.py (5470b), scripts/bmad_queue.py (9065b), scripts/bmad_rollback.py (6262b), scripts/budget.py (4875b), scripts/checkpoint.py (4018b), scripts/claude-wrapper.sh (1818b), scripts/cron_trigger.sh (1902b), scripts/executor.py (24357b), scripts/failure_memory.py (3149b), scripts/git_manager.py (7783b), scripts/lock.py (1717b), scripts/memory_guard.py (7764b), scripts/models.py (9464b), scripts/monitor.py (15702b), scripts/night-runner.py (25456b), scripts/ns-control.sh (7208b), scripts/phase_generator.py (12200b), scripts/phase_runner.py (14674b), scripts/preflight.py (7296b), scripts/queue.py (11475b), scripts/reporter.py (6783b), scripts/status.py (6537b), scripts/subagent_runner.py (7559b), scripts/test_integration.py (6479b), scripts/test_queue.py (9262b), scripts/verifier.py (11041b), scripts/watchdog.py (3105b), SECURITY.md (3382b), SKILL.md (16841b), _meta.json (130b)\n\nFile v1.0.2:night_shift/SKILL.md\n\n---\nname: night_shift\ndescription: \"Queue coding plans during day, execute autonomously overnight with morning report. Use when: user says 'plan add/list/show/approve', 'phase edit', 'good night', 'night status/stop'.\"\nmetadata: {\"openclaw\":{\"emoji\":\"🌙\"}}\nuser-invocable: true\n---\n\n# Night-Shift Skill — Queue & Overnight Execution\n\nQueue coding plans during day, execute overnight, morning report.\n\n## Command Handler\n\n| Command | Action |\n|---------|--------|\n| `plan add <title>` | Create plan with auto-generated phases |\n| `plan list [status]` | Show plans (queued/approved/executing/completed/failed) |\n| `plan show <id>` | Full plan with phases |\n| `plan approve <id>` / `plan approve all` | Mark ready for execution |\n| `plan remove <id>` | Delete plan |\n| `plan priority <id> <level>` | Set critical/high/medium/low |\n| `phase edit <plan_id> <phase_id> <prompt>` | Edit a phase |\n| `good night` | Start overnight execution (background) |\n| `night status` / `night stop` | Check/stop execution |\n\nPython API: `from scripts.night_shift.queue import add_plan, list_plans, get_plan, approve_plan, approve_all, remove_plan, set_priority, format_plan_list, format_plan_detail, edit_phase`\n\n## Architecture\n- **Queue**: `scripts/night_shift/queue.py` → `data/night_shift/queue.json` + `plans/*.json`\n- **Executor**: `scripts/night_shift/executor.py` → phases via Cursor CLI → git worktrees → checkpoints\n- **Verifier**: 9 methods (files_exist, tests_pass, build_succeeds, lint_clean, git_diff, function_wired, snapshot_match, content_valid, smoke_test)\n- **Budget**: 5min/phase, 30min/plan, 6hr/night\n- **Safety**: git worktree isolation, lock file, watchdog (*/30min), checkpoint resume\n\n## Execution Methods\n1. **claude-code** (default) — Claude Code CLI, `coder` user\n2. **cursor** — Unified-Router: GLM-5.1 → Cursor → Opus fallback\n3. **shell** — Single-line commands only\n4. **subagent** — OpenClaw subagent for complex tasks\n\n## Guardrails (MANDATORY)\n- G1: Update plan JSON phases/status after EVERY phase\n- G2: Produce proof file before marking complete\n- G3: Subagent context budget: lightContext, 2000 char cap, max 3 concurrent\n- G4: Structured reporting only (table format)\n- G5: Use the pipeline (queue.py → executor.py → verifier.py), don't route around it\n- G6: JSON file is source of truth — chat must match JSON status\n\nSee REFERENCE.md for full details on storage, testing, monitoring, and server setup.\n\nFile v1.0.2:SKILL.md\n\n---\nname: night-shift\nversion: 1.0.2\ndescription: \"Queue coding plans during the day, approve them, execute later in isolated worktrees, and inspect reports. Background agentic execution requires an explicitly configured non-interactive runner.\"\nmetadata:\n  {\n    \"openclaw\":\n      {\n        \"requires\": { \"bins\": [\"python3\", \"git\"] },\n        \"optional\":\n          {\n            \"bins\": [\"agent\", \"cursor\", \"claude\"],\n            \"env\":\n              [\n                \"OPENCLAW_WORKSPACE\",\n                \"NIGHT_SHIFT_DATA_DIR\",\n                \"NIGHT_SHIFT_MODEL\",\n                \"CURSOR_CLI\",\n                \"CURSOR_API_KEY\",\n                \"TELEGRAM_BOT_TOKEN\",\n                \"TELEGRAM_CHAT_ID\",\n                \"NIGHT_SHIFT_CHAT_ID\",\n              ],\n          },\n        \"capabilities\":\n          [\n            \"filesystem-read-write\",\n            \"git-worktrees\",\n            \"subprocess-execution\",\n            \"optional-cursor-cli\",\n            \"optional-claude-cli\",\n            \"optional-telegram-notifications\",\n            \"optional-model-provider-calls\",\n          ],\n      },\n  }\n---\n\n# Night Shift\n\nNight Shift is an autonomous queued-execution skill for engineering work.\n\nInstead of asking the agent to do one large coding task immediately, you build a queue of plans, review or approve them, then run them in a controlled batch window. Each plan is split into phases, executed in isolation, verified, checkpointed, and summarized in a report.\n\n**Mental model:**\n- Daytime: create and refine plans\n- Before execution: approve what is safe to run\n- Execution window: Night Shift runs plans phase by phase\n- Morning: inspect results, merge, retry, or continue\n\nThis is useful when you want:\n- deferred execution instead of immediate chat-time work\n- safer batching for multi-step changes\n- isolated worktrees per plan\n- retry and checkpoint behavior\n- a written report after execution\n\n---\n\n## When to Use\n\nUse Night Shift when the user asks for things like:\n- “good night”\n- “queue this for later”\n- “plan add …”\n- “run these approved plans overnight”\n- “night shift status”\n- “show my morning report”\n- “retry plan #3”\n- “merge that finished plan”\n\nPrefer Night Shift over immediate execution when:\n- the work is multi-phase\n- the task needs isolation from the main repo state\n- the user wants review/approval before execution\n- the work may take a long time\n- you want a queue of tasks rather than one interactive run\n\nDo **not** use Night Shift for:\n- tiny one-off edits better handled immediately\n- high-risk production actions without review\n- tasks that require constant human decisions mid-run\n- public/external actions that should be explicitly approved in the moment\n\n---\n\n## Core Concepts\n\n### 1. Plan\nA plan is the unit of queued work. It includes:\n- title\n- optional description\n- optional repo URL\n- priority\n- token/time budget hints\n- generated phases\n- status and execution metadata\n\n### 2. Phase\nEach plan is split into phases. A phase has:\n- a title\n- a prompt/instruction\n- an execution method\n- verification settings\n- retry state\n- status\n\n### 3. Execution Method\nEach phase chooses one of several execution methods:\n- `shell`\n- `cursor`\n- `claude-code`\n- `subagent`\n\nThis lets the framework mix deterministic shell work with agentic coding work.\n\n### 4. Worktree Isolation\nEach plan runs in its own git worktree under `data/night-shift/worktrees/`.\n\nThat means Night Shift can:\n- avoid trampling the main branch\n- keep plan-specific diffs separate\n- retry or inspect work in isolation\n- support safer merge/rollback flows\n\n### 5. Verification\nPhases can be checked after execution using one of several verification modes, including:\n- `files_exist`\n- `check_git_diff`\n- `run_tests`\n- `lint_check`\n- `smoke_test`\n- `import_check`\n- `integration_check`\n- `snapshot_diff`\n- `none`\n\n### 6. Reporting\nAfter execution, Night Shift writes a report so the next interaction starts from evidence instead of guesswork.\n\n---\n\n## Typical Workflow\n\n### During the day\n1. Add one or more plans\n2. Review phases\n3. Edit prompts or priorities if needed\n4. Approve the plans that are safe to run\n\n### At execution time\n5. Start Night Shift\n6. It acquires a lock, checks budgets, creates worktrees, and executes phases\n7. It verifies each phase, checkpoints progress, records failures, and logs results\n\n### After execution\n8. Read the report\n9. Inspect worktrees or diffs\n10. Merge successful work, retry failed work, or queue follow-up plans\n\n---\n\n## User-Facing Commands\n\nThese are the command patterns the skill is designed around.\n\n| Command | Purpose |\n|---|---|\n| `plan add <desc>` | Create a new plan with generated phases |\n| `plan steal <url> <desc>` | Queue work derived from an external repo/project |\n| `plan list [status]` | Show plans in the queue |\n| `plan show #<id>` | Show full details for one plan |\n| `plan approve #<id>` | Approve one plan |\n| `plan approve all` | Approve all queued plans |\n| `plan remove #<id>` | Remove a plan |\n| `plan priority #<id> <level>` | Change priority |\n| `plan edit #<id> phase <n> prompt <text>` | Refine a phase prompt |\n| `good night` | Start execution of approved plans |\n| `night shift status` | Show current state |\n| `night shift stop` | Request stop / halt execution |\n| `night shift dry-run` | Preview what would execute |\n| `morning` | Show the latest execution report |\n| `night shift merge #<id>` | Merge completed plan results |\n| `night shift inspect #<id>` | Inspect outputs/worktree |\n| `night shift retry #<id>` | Retry a failed or partial plan |\n\nIf your host agent uses a different natural-language wrapper, preserve the same intent and lifecycle.\n\n---\n\n## Architecture\n\nNight Shift is split into a few major parts.\n\n### Queue and Models\n- `models.py` — core plan/phase data models and enums\n- `queue.py` — CRUD, queue index, plan storage, approvals, updates\n- `phase_generator.py` — creates initial phases from plan input\n\n### Execution Engine\n- `executor.py` — main run loop, orchestration, locking, budget checks, reporting\n- `phase_runner.py` — executes individual phases using the chosen method\n- `subagent_runner.py` — helper for subagent-based execution\n\n### Safety and Recovery\n- `verifier.py` — phase verification logic\n- `checkpoint.py` — save/resume progress\n- `failure_memory.py` — track known failures and avoid blind repetition\n- `lock.py` — prevent overlapping runs\n- `budget.py` — per-phase/per-plan/night budget tracking\n- `memory_guard.py` — watchdog for memory/process hygiene\n\n### Repo / Git Operations\n- `git_manager.py` — worktree setup, commit/reset helpers\n\n### Visibility and Operations\n- `reporter.py` — morning-style summaries\n- `monitor.py` — notifications and health checks\n- `watchdog.py` — execution monitoring\n- `status.py` — status helpers\n- `cron_trigger.sh` / `ns-control.sh` — optional shell wrappers\n\n### Optional Extensions\nThe `bmad_*.py` files are advanced helpers for richer planning/PRD flows. They are **not required** for the core Night Shift lifecycle.\n\n---\n\n## Execution Flow\n\nA typical run looks like this:\n\n1. **Preflight**\n   - confirm no conflicting lock\n   - load queue\n   - check for approved plans\n   - initialize budget / logs / monitors\n\n2. **Plan selection**\n   - choose approved plans in queue order / priority order\n\n3. **Per-plan setup**\n   - create or prepare isolated worktree\n   - load checkpoint if resuming\n\n4. **Per-phase execution**\n   - build phase prompt\n   - dispatch via the selected execution method\n   - capture output, status, timing, and any token/cost metadata available\n\n5. **Verification**\n   - run configured verification step\n   - mark success/failure\n   - record failure memory if relevant\n\n6. **Persistence**\n   - update plan JSON\n   - update queue index\n   - save checkpoint/logs\n\n7. **Completion**\n   - finalize plan status\n   - generate report\n   - release lock\n\n---\n\n## Safety Model\n\nNight Shift is designed to be agentic, but not reckless.\n\n### Safety features\n- **approval gate** before execution\n- **worktree isolation** per plan\n- **execution lock** to prevent overlapping runs\n- **phase-by-phase progression** instead of one giant opaque run\n- **verification hooks** after phases\n- **checkpointing** for resumes/recovery\n- **failure memory** to reduce repeated mistakes\n- **budget caps** across phase/plan/night scopes\n- **watchdog/monitoring** support\n\n### What this protects against\n- clobbering the main branch\n- executing multiple Night Shift loops at once\n- losing progress on interruption\n- repeating the same failing step forever\n- oversized unattended execution sessions\n\n### What it does **not** guarantee\n- perfect code quality\n- correct architectural judgment for every task\n- safe production deployment by default\n- zero hallucination from external coding models\n\nYou still need sensible approval and review.\n\n### Trust, permissions, and security scanners\n\nNight Shift may be flagged by automated scanners because it intentionally includes operational automation primitives:\n\n- shell wrappers (`cron_trigger.sh`, `ns-control.sh`, `claude-wrapper.sh`)\n- Python subprocess execution for approved phases\n- git worktree, commit, reset, and diff helpers\n- optional Cursor CLI / Claude Code / subagent dispatch\n- optional Telegram notification support\n\nThese are expected for an unattended coding workflow, but they deserve review before use. Night Shift does **not** bundle private keys, hidden credentials, miners, persistence malware, or background network beacons. It only uses credentials and CLIs already available in the host environment.\n\nBefore running it in a new workspace:\n\n1. Review queued plans and phase prompts before approval.\n2. Run `night shift dry-run` first when available.\n3. Start with a disposable test repo or branch.\n4. Keep production deploys as explicit manual steps unless you intentionally add deploy phases.\n5. Inspect diffs/reports before merging completed work.\n\nFor non-interactive ClawHub installs, some registries may require `--force` after scanner warnings. Treat that as a prompt to review the code, not as a failure signal.\n\n---\n\n## Storage Layout\n\nNight Shift stores runtime state under:\n\n```text\ndata/night-shift/\n├── queue.json\n├── plans/\n├── worktrees/\n├── execution/\n├── reports/\n├── failure-memory.json\n├── budget.json\n└── execution.log\n```\n\n### Important files\n- `queue.json` — lightweight queue index\n- `plans/*.json` — full plan records\n- `worktrees/<plan_id>/` — isolated git worktree per plan\n- `failure-memory.json` — prior failed step fingerprints\n- `budget.json` — current budget tracking\n- `execution.log` — main execution log\n\n---\n\n## Environment Variables\n\nNight Shift now supports portable configuration instead of relying on hardcoded local paths.\n\n### Core\n- `OPENCLAW_WORKSPACE` — override workspace root\n- `NIGHT_SHIFT_MODEL` — preferred model hint for model-driven helpers\n- `CURSOR_CLI` — explicit path to Cursor CLI / `agent` binary\n\n### Notifications\n- `NIGHT_SHIFT_CHAT_ID` — target chat for Night Shift notifications\n- `TELEGRAM_CHAT_ID` — fallback notification target\n- `TELEGRAM_BOT_TOKEN` — Telegram Bot token for notifications\n\n### Execution environment\nNight Shift also inherits normal environment from the host runtime, including anything needed by:\n- git\n- Python\n- shell commands\n- coding harnesses / subagents\n\nIf a specific execution method requires additional auth or binaries, document that at the host level.\n\n---\n\n## Prerequisites\n\n### Required\n- Python 3\n- git\n- workspace write access\n- ability to create and modify files in `data/night-shift/`\n- a host environment that can run shell commands and Python scripts\n\n### Optional but useful\n- Cursor CLI / agent binary for `cursor` execution\n- Claude Code for `claude-code` execution\n- subagent support for delegated runs\n- Telegram bot setup for notifications\n\n### Strongly recommended\n- run inside a git-backed workspace\n- use approval before unattended execution\n- keep tests/lint scripts working in the target repo\n\n---\n\n## Examples\n\n### Example 1 — queue a feature for later\nUser intent:\n> Add OAuth login to the app, but do it overnight.\n\nNight Shift flow:\n1. `plan add add OAuth login to the app`\n2. inspect generated phases\n3. `plan approve #<id>`\n4. later: `good night`\n\n### Example 2 — multiple plans in one batch\nUser intent:\n> Queue three fixes now, run them all tonight.\n\nFlow:\n1. add three plans\n2. set priorities as needed\n3. approve the safe ones\n4. run Night Shift\n5. read the morning report\n\n### Example 3 — dry run before execution\nUser intent:\n> Show me what would run tonight.\n\nFlow:\n- `night shift dry-run`\n\n### Example 4 — retry a failed plan\nUser intent:\n> Retry the failed parser plan.\n\nFlow:\n- inspect plan/report\n- refine the phase prompt if needed\n- `night shift retry #<id>`\n\n### Example 5 — inspect before merge\nUser intent:\n> Show me what Night Shift changed before we merge.\n\nFlow:\n- `night shift inspect #<id>`\n- review diff/worktree/tests\n- `night shift merge #<id>` when satisfied\n\n---\n\n## How to Operate the Skill Well\n\n### Good plan inputs\nNight Shift works best when the plan title/description is concrete.\n\nBetter:\n- “Add retry logic to payment webhooks and verify with integration tests”\n- “Refactor dashboard query caching and run frontend smoke tests”\n\nWorse:\n- “make it better”\n- “fix the app somehow”\n\n### Good approval policy\nApprove unattended runs when:\n- the repo is in a sane state\n- the task is scoped\n- verification exists\n- you can tolerate isolated failures\n\nAvoid approval when:\n- the task is ambiguous\n- the run might touch production systems directly\n- the work needs live stakeholder decisions\n\n### Good execution method selection\nUse:\n- `shell` for deterministic scripted work\n- `cursor` / `claude-code` for coding-heavy phases\n- `subagent` for delegated structured work\n\n---\n\n## Limitations\n\nBe honest about these.\n\n- It is not a general scheduler for arbitrary business processes.\n- It is optimized for engineering work in a writable workspace.\n- Quality depends heavily on phase quality and verification quality.\n- If the underlying coding harness is weak or unavailable, outcomes degrade.\n- Worktree-based isolation assumes the repo supports normal git operations.\n- Some wrapper scripts and helpers are host-environment dependent.\n- Long unattended runs still need human review before high-trust deployment.\n\n---\n\n## Troubleshooting\n\n### “No approved plans found”\nApprove at least one plan before starting execution.\n\n### “Night Shift already running”\nA lock file or active run exists. Inspect status before forcing a restart.\n\n### “Worktree creation failed”\nCheck:\n- git repo health\n- branch/worktree permissions\n- existing conflicting worktrees\n\n### “Phase keeps failing”\n- inspect the plan’s phase prompt\n- review verification settings\n- check failure memory / logs\n- reduce scope and retry\n\n### “Notifications are not sent”\nCheck notification env vars:\n- `TELEGRAM_BOT_TOKEN`\n- `NIGHT_SHIFT_CHAT_ID` or `TELEGRAM_CHAT_ID`\n\n### “Cursor / Claude execution not found”\nSet the expected binary path explicitly or install the required tool:\n- `CURSOR_CLI`\n- whichever CLI your host maps to `claude-code`\n\n### “Execution stopped midway”\nInspect checkpoints, report output, logs, and plan status. Resume/retry instead of starting from scratch blindly.\n\n---\n\n## Publishing Notes\n\nNight Shift is publishable as a **power-user engineering skill**.\n\nIts strongest differentiators are:\n- queued plan lifecycle\n- isolated worktrees\n- phase verification\n- checkpointing and retry behavior\n- morning-report workflow\n\nIts biggest adoption caveats are:\n- requires a repo-aware writable environment\n- works best with supporting CLIs/tools already installed\n- more operational than a simple one-file prompt skill\n\nThat is fine. Don’t oversell it as “plug-and-play for everyone.” Sell it as a serious autonomous coding workflow for advanced users.\n\n---\n\n## Files\n\nCore engine files in `scripts/` include:\n- `models.py`\n- `queue.py`\n- `phase_generator.py`\n- `executor.py`\n- `phase_runner.py`\n- `verifier.py`\n- `checkpoint.py`\n- `failure_memory.py`\n- `budget.py`\n- `git_manager.py`\n- `lock.py`\n- `reporter.py`\n- `monitor.py`\n- `watchdog.py`\n- `subagent_runner.py`\n- `memory_guard.py`\n\nOptional/advanced helpers:\n- `bmad_batch.py`\n- `bmad_context.py`\n- `bmad_guardrails.py`\n- `bmad_phases.py`\n- `bmad_prd_evolve.py`\n- `bmad_queue.py`\n- `bmad_rollback.py`\n\nShell helpers:\n- `cron_trigger.sh`\n- `ns-control.sh`\n- `claude-wrapper.sh`\n\n---\n\n## See Also\n\n- `REFERENCE.md` — operational reference, setup notes, environment variables, and troubleshooting\n- `scripts/test_queue.py` — queue behavior checks\n- `scripts/test_integration.py` — end-to-end integration checks\n\nFile v1.0.2:_meta.json\n\n{\n  \"ownerId\": \"kn7380dt93q0wx6x1zx5b4y8z985kjww\",\n  \"slug\": \"night-shift\",\n  \"version\": \"1.0.2\",\n  \"publishedAt\": 1777243317586\n}\n\nFile v1.0.2:INSTALL.md\n\n# Night Shift Install and Setup\n\n## Install from ClawHub\n\n```bash\nopenclaw skills install vardhineediganesh877-ui/night-shift\n```\n\n## Verify local requirements\n\n```bash\ncd ~/.openclaw/workspace\npython3 skills/night-shift/scripts/preflight.py --json\n```\n\nRequired dependencies are `python3` and `git`. Cursor/Claude runners are optional, but any queued phase that uses them requires those CLIs to work non-interactively.\n\n## Recommended first run: disposable workspace\n\n```bash\nexport OPENCLAW_WORKSPACE=/tmp/night-shift-demo\nmkdir -p \"$OPENCLAW_WORKSPACE\"\npython3 ~/.openclaw/workspace/skills/night-shift/scripts/preflight.py --json\npython3 ~/.openclaw/workspace/skills/night-shift/scripts/executor.py dry-run\n```\n\nDry-run should write a preview report only. It should not mark plans complete or create success checkpoints.\n\n## Background/systemd setup\n\nDetached timers need explicit environment. Create a private env file if needed:\n\n```bash\ncp skills/night-shift/.night-shift.env.example ~/.openclaw/workspace/.night-shift.env\nchmod 600 ~/.openclaw/workspace/.night-shift.env\n```\n\nThen edit values for your environment. Do not commit real secrets.\n\nBefore enabling a timer, run preflight in the same user context that will run the service.\n\nFile v1.0.2:REFERENCE.md\n\n# Night Shift Reference\n\nThis file is the operational reference for the Night Shift skill.\n\nIt complements `SKILL.md` by focusing on setup, runtime expectations, file layout, and practical caveats.\n\n---\n\n## 1. What Night Shift Actually Is\n\nNight Shift is a queued autonomous execution framework for coding work.\n\nIt is **not** just a prompt pattern. It includes:\n- plan storage\n- phase generation\n- isolated worktrees\n- execution routing\n- verification\n- checkpointing\n- reporting\n- monitoring helpers\n\nThink of it as a lightweight unattended engineering operator.\n\n---\n\n## 2. Minimum Runtime Expectations\n\nNight Shift expects a host environment with:\n- Python 3\n- git\n- a writable workspace\n- permission to create directories/files under `data/night-shift/`\n- a repo or project context where worktrees and diffs make sense\n\nIf those are missing, the skill may still partially function, but the core value drops sharply.\n\n---\n\n## 3. Security Review Notes\n\nNight Shift is powerful by design. It can run shell commands, create git worktrees, call coding CLIs, and write reports/checkpoints. That means automated registries may classify it as suspicious even when the package is behaving as intended.\n\nExpected capabilities:\n- local file and directory writes under the configured workspace\n- git worktree / diff / commit / reset operations\n- subprocess execution for approved phase methods\n- optional calls to host-provided tools such as Cursor CLI, Claude Code, or subagents\n- optional Telegram notifications when notification environment variables are configured\n\nNot expected:\n- bundled secrets or private tokens\n- cryptocurrency mining\n- hidden persistence outside the configured workspace\n- unsolicited external network calls beyond host-configured tools/notifications\n- production deployment unless a user-approved phase explicitly performs it\n\nRecommended first-run posture:\n\n```bash\n# install into a disposable workspace first if reviewing a public copy\nclawhub install night-shift --force\n\n# inspect docs and scripts before use\nfind skills/night-shift -maxdepth 3 -type f | sort\n\n# run only approved test plans initially\n```\n\nIf your ClawHub client requires `--force`, it is usually because of these intentional automation primitives. Review before running, then proceed only in a workspace where unattended coding is acceptable.\n\n---\n\n## 4. Workspace Assumptions\n\nThe portable version of Night Shift uses workspace auto-detection.\n\nDefault behavior:\n- detect workspace from the skill location\n- store runtime data in `data/night-shift/`\n\nOverride with:\n\n```bash\nexport OPENCLAW_WORKSPACE=/path/to/workspace\n```\n\nThis controls where Night Shift reads/writes:\n- queue state\n- plan files\n- worktrees\n- logs\n- reports\n- budget / checkpoint / failure memory data\n\n---\n\n## 4. Important Environment Variables\n\n### Core\n\n```bash\nexport OPENCLAW_WORKSPACE=/path/to/workspace\nexport NIGHT_SHIFT_MODEL=auto\nexport CURSOR_CLI=/path/to/agent\n```\n\n### Notifications\n\n```bash\nexport TELEGRAM_BOT_TOKEN=...\nexport NIGHT_SHIFT_CHAT_ID=123456789\n# or fallback\nexport TELEGRAM_CHAT_ID=123456789\n```\n\n### Notes\n- `NIGHT_SHIFT_MODEL` is a hint used by some model-driven helpers.\n- `CURSOR_CLI` is useful if the `agent` binary is not discoverable on PATH.\n- Notification variables are optional.\n\n---\n\n## 5. Storage Layout\n\nRuntime state is stored under:\n\n```text\ndata/night-shift/\n├── queue.json\n├── plans/\n├── worktrees/\n├── execution/\n├── reports/\n├── failure-memory.json\n├── budget.json\n└── execution.log\n```\n\n### Recommended hygiene\n- back up `plans/` and `reports/` if they matter\n- prune stale worktrees periodically\n- inspect `failure-memory.json` if repeated failures feel suspicious\n- keep `queue.json` and `plans/` in sync by using the provided queue operations, not ad hoc edits\n\n---\n\n## 6. Execution Methods\n\nNight Shift supports multiple execution styles at the phase level.\n\n### `shell`\nUse for deterministic commands.\n\nBest for:\n- codegen via scripts\n- test runs\n- linters\n- file transforms\n- scripted maintenance\n\n### `cursor`\nUse for agentic coding via a Cursor/agent-style runner.\n\nBest for:\n- implementation-heavy code changes\n- multi-file refactors\n- coding tasks where a model benefits from repo context\n\n### `claude-code`\nUse for Claude Code based execution if your host supports it.\n\nBest for:\n- careful repo-aware coding work\n- structured implementation with strong text output\n\n### `subagent`\nUse when the host environment supports agent delegation.\n\nBest for:\n- isolated research or coding subtasks\n- delegated steps with separate context\n\n---\n\n## 7. Worktree Behavior\n\nNight Shift’s safety story depends heavily on worktree isolation.\n\nPer-plan worktrees help with:\n- safer concurrent plan handling\n- easier diff inspection\n- cleaner retry/reset behavior\n- less contamination of the main working tree\n\nOperational advice:\n- use Night Shift in repos with healthy git state\n- avoid starting with a dirty or half-merged repo if you can\n- inspect worktrees before merging if the task was complex\n\n---\n\n## 8. Verification Modes\n\nAvailable verification labels include:\n- `files_exist`\n- `check_git_diff`\n- `run_tests`\n- `lint_check`\n- `smoke_test`\n- `import_check`\n- `integration_check`\n- `snapshot_diff`\n- `none`\n\n### Practical guidance\n- use `run_tests` when repo tests are reliable\n- use `lint_check` for style/static checks\n- use `smoke_test` for lightweight runtime confidence\n- avoid `none` unless the phase is inherently non-testable or very small\n\nNight Shift is only as trustworthy as the verification attached to its phases.\n\n---\n\n## 9. Budget and Stop Conditions\n\nThe framework tracks budgets across multiple scopes.\n\nExamples mentioned in the implementation/docs include:\n- per-phase limits\n- per-plan limits\n- whole-night limits\n\nOperationally, budget checks are there to prevent:\n- endless unattended work\n- overconsumption of model/tool resources\n- a single bad plan dominating the whole run\n\nIf a plan is repeatedly too large, split it into smaller plans or improve the generated phases.\n\n---\n\n## 10. Checkpoints and Failure Memory\n\n### Checkpoints\nCheckpointing allows a run to resume or be inspected without pretending the whole night never happened.\n\nUse this when:\n- a run was interrupted\n- the system restarted\n- you want to retry after partial progress\n\n### Failure Memory\nFailure memory records prior failure fingerprints / patterns to reduce blind repetition.\n\nUse it as a signal, not an oracle.\nIf the same phase keeps failing:\n- simplify the phase\n- change the execution method\n- improve the prompt\n- tighten verification\n\n---\n\n## 11. Monitoring and Notifications\n\nNight Shift includes monitoring/reporting helpers.\n\nCapabilities may include:\n- execution logs\n- morning summaries\n- Telegram notifications\n- watchdog-style checks\n\nThese are useful, but optional. The core queue/executor flow should still make sense without notifications.\n\nIf you enable notifications, treat them as operational visibility — not as a replacement for review.\n\n---\n\n## 12. Optional BMAD Extensions\n\nThe `scripts/` folder may include BMAD-related helpers such as:\n- `bmad_batch.py`\n- `bmad_context.py`\n- `bmad_guardrails.py`\n- `bmad_phases.py`\n- `bmad_prd_evolve.py`\n- `bmad_queue.py`\n- `bmad_rollback.py`\n\nThese are advanced extensions.\n\nThey are **not** required for the baseline Night Shift lifecycle:\n- queue\n- approve\n- execute\n- verify\n- report\n\nIf you publish Night Shift, present BMAD as an optional advanced lane, not the first thing a new user must understand.\n\n---\n\n## 13. Shell Helpers\n\nShell wrappers in `scripts/` may include:\n- `cron_trigger.sh`\n- `ns-control.sh`\n- `claude-wrapper.sh`\n\nThese are convenience helpers, not the whole product.\n\nUse them when:\n- your environment wants cron-style launches\n- you prefer shell entrypoints\n- you want lightweight control wrappers\n\nAvoid making your documentation depend entirely on them.\n\n---\n\n## 14. Testing Notes\n\nIn the current skill-local portable version, the queue and integration checks have been exercised successfully.\n\nFiles of interest:\n- `scripts/test_queue.py`\n- `scripts/test_integration.py`\n\nWhen validating changes, prefer:\n1. queue tests\n2. integration checks\n3. a dry run\n4. a small real plan in a non-critical repo\n\nThat progression gives much better confidence than jumping straight to a large unattended batch.\n\n---\n\n## 15. Recommended Rollout Strategy for New Users\n\nIf someone installs this skill fresh, the safest adoption path is:\n\n### Stage 1 — Read and inspect\n- read `SKILL.md`\n- inspect `scripts/`\n- confirm required binaries and Python availability\n\n### Stage 2 — Dry run\n- create one simple plan\n- run `night shift dry-run`\n\n### Stage 3 — Small real run\n- approve one low-risk plan\n- run the executor\n- inspect report and worktree\n\n### Stage 4 — Multi-plan batch\n- queue several tasks\n- use priorities\n- review morning report quality\n\n### Stage 5 — Advanced automation\n- add notifications\n- add cron wrappers\n- experiment with BMAD extensions\n\n---\n\n## 16. Common Failure Modes\n\n### A. No plans execute\nLikely causes:\n- no approved plans\n- stale lock\n- queue/index mismatch\n\n### B. Worktree setup fails\nLikely causes:\n- broken git state\n- repo permissions\n- conflicting worktrees/branches\n\n### C. Model-backed phase fails repeatedly\nLikely causes:\n- vague phase prompt\n- wrong execution method\n- tool/harness missing\n- verification too strict for the phase shape\n\n### D. Reports are weak\nLikely causes:\n- low-quality phase structure\n- missing verification\n- oversized tasks crammed into one plan\n\n### E. Notifications never arrive\nLikely causes:\n- missing `TELEGRAM_BOT_TOKEN`\n- missing `NIGHT_SHIFT_CHAT_ID` / `TELEGRAM_CHAT_ID`\n- network or bot permissions issues\n\n---\n\n## 17. What to Be Honest About in a Public Listing\n\nNight Shift is powerful, but it is not beginner-simple.\n\nBe explicit that it is best for:\n- advanced OpenClaw / agent users\n- repo-centric engineering workflows\n- users who understand approval, git, and execution risk\n\nDo **not** market it like:\n- “set and forget magic coding forever”\n- “safe for any repo with zero setup”\n- “works equally well without verification or review”\n\nThe real pitch is better:\n> a structured autonomous execution framework for deferred engineering work\n\n---\n\n## 18. Good Public Positioning\n\nA strong public framing is:\n\n- **What it is:** queued overnight coding workflow\n- **Why it matters:** safe-ish deferred execution with worktrees and reports\n- **Who it’s for:** power users running multi-step repo tasks\n- **Why it stands out:** phase-based execution + isolation + verification + reporting\n\n---\n\n## 19. Suggested Setup Snippet\n\n```bash\nexport OPENCLAW_WORKSPACE=\"$HOME/.openclaw/workspace\"\nexport CURSOR_CLI=\"$(command -v agent)\"\nexport NIGHT_SHIFT_MODEL=\"auto\"\n# Optional notifications\nexport TELEGRAM_BOT_TOKEN=\"...\"\nexport NIGHT_SHIFT_CHAT_ID=\"123456789\"\n```\n\n---\n\n## 20. Final Advice\n\nNight Shift gets most of its value from discipline, not bravado.\n\nIf results are shaky:\n- shrink the plan\n- improve the phases\n- improve verification\n- inspect worktrees\n- retry surgically\n\nThe framework is strongest when it helps you run a calm engineering pipeline, not when it is treated like a slot machine.\n\nFile v1.0.2:SECURITY.md\n\n# Night Shift Security Model\n\nNight Shift is a powerful queued execution framework. Treat it like a coding agent runner, not a passive note-taking skill.\n\n## What Night Shift can do\n\nWhen you approve and run plans, Night Shift may:\n\n- read and write files inside the configured workspace\n- create git branches and worktrees under `data/night-shift/worktrees/`\n- run subprocesses for shell phases and verification commands\n- call optional coding runners such as Cursor CLI (`agent`/`cursor`) or Claude Code (`claude`)\n- run tests, linters, build commands, and smoke checks\n- write checkpoints, reports, logs, and failure-memory records\n- optionally send Telegram notifications if notification tokens are configured\n\n## What Night Shift should not do by default\n\nNight Shift should not:\n\n- run against production repositories without review\n- execute unreviewed public/external actions\n- send notifications unless recipients and tokens are explicitly configured\n- mark dry-runs as completed live work\n- continue through every plan after a shared runner/preflight failure\n\n## Required runtime dependencies\n\nRequired:\n\n- `python3` 3.11+\n- `git`\n- writable workspace/data directory\n\nOptional, depending on phase execution methods:\n\n- Cursor CLI: `agent` or `cursor`\n- Claude Code CLI: `claude`\n- Telegram notification env vars\n\n## Environment variables\n\nOptional variables read by the skill:\n\n- `OPENCLAW_WORKSPACE` — workspace root; defaults to the OpenClaw workspace that contains this skill\n- `NIGHT_SHIFT_DATA_DIR` — Night Shift state directory; defaults to `$OPENCLAW_WORKSPACE/data/night-shift`\n- `NIGHT_SHIFT_MODEL` — model hint for compatible runners\n- `CURSOR_CLI` — explicit path to Cursor/agent CLI\n- `CURSOR_API_KEY` — optional non-interactive Cursor auth, if supported by your CLI setup\n- `TELEGRAM_BOT_TOKEN`, `TELEGRAM_CHAT_ID`, `NIGHT_SHIFT_CHAT_ID` — optional notifications\n\nNever commit real tokens. Use a local env file such as `.night-shift.env` and keep it out of published packages.\n\n## Safe first run\n\nUse an isolated disposable workspace first:\n\n```bash\nexport OPENCLAW_WORKSPACE=/tmp/night-shift-demo\npython3 skills/night-shift/scripts/preflight.py --json\npython3 skills/night-shift/scripts/executor.py dry-run\n```\n\nDry-run is intended to be read-only. It should produce a preview report and must not mark plans complete or write success checkpoints.\n\n## Background runner warning\n\nDetached systemd/timer execution does not automatically inherit your interactive shell environment. Before live unattended execution, run preflight in the same user/service context. In particular, Cursor CLI phases need `HOME`, `PATH`, and a non-interactive auth strategy.\n\nIf preflight says Cursor/Claude is not ready, fix the environment or change the queued phases before running live execution.\n\n## Verification command policy\n\nVerification commands can execute subprocesses in the worktree. Prefer explicit, narrow commands such as:\n\n- `python3 -m pytest`\n- `npm test`\n- `npm run lint`\n- `ruff check .`\n\nAvoid arbitrary shell pipelines unless you have reviewed the plan and trust the repository.\n\n## Operational guidance\n\n- Review generated plans before approval.\n- Prefer dry-run before live execution.\n- Start with one low-risk plan in a disposable workspace.\n- Inspect reports and worktree diffs before merging.\n- Keep production credentials out of worktrees.\n\nArchive v1.0.1: 35 files, 94750 bytes\n\nFiles: night_shift/SKILL.md (2455b), REFERENCE.md (11234b), scripts/__init__.py (91b), scripts/bmad_batch.py (18536b), scripts/bmad_context.py (4296b), scripts/bmad_guardrails.py (4717b), scripts/bmad_phases.py (6538b), scripts/bmad_prd_evolve.py (5470b), scripts/bmad_queue.py (9065b), scripts/bmad_rollback.py (6262b), scripts/budget.py (4875b), scripts/checkpoint.py (4018b), scripts/claude-wrapper.sh (1818b), scripts/cron_trigger.sh (1902b), scripts/executor.py (22217b), scripts/failure_memory.py (3149b), scripts/git_manager.py (7783b), scripts/lock.py (1717b), scripts/memory_guard.py (7764b), scripts/models.py (9464b), scripts/monitor.py (15702b), scripts/night-runner.py (25456b), scripts/ns-control.sh (7208b), scripts/phase_generator.py (12142b), scripts/phase_runner.py (14674b), scripts/queue.py (11306b), scripts/reporter.py (6550b), scripts/status.py (6537b), scripts/subagent_runner.py (7559b), scripts/test_integration.py (6479b), scripts/test_queue.py (9262b), scripts/verifier.py (11041b), scripts/watchdog.py (3105b), SKILL.md (16038b), _meta.json (130b)\n\nFile v1.0.1:night_shift/SKILL.md\n\n---\nname: night_shift\ndescription: \"Queue coding plans during day, execute autonomously overnight with morning report. Use when: user says 'plan add/list/show/approve', 'phase edit', 'good night', 'night status/stop'.\"\nmetadata: {\"openclaw\":{\"emoji\":\"🌙\"}}\nuser-invocable: true\n---\n\n# Night-Shift Skill — Queue & Overnight Execution\n\nQueue coding plans during day, execute overnight, morning report.\n\n## Command Handler\n\n| Command | Action |\n|---------|--------|\n| `plan add <title>` | Create plan with auto-generated phases |\n| `plan list [status]` | Show plans (queued/approved/executing/completed/failed) |\n| `plan show <id>` | Full plan with phases |\n| `plan approve <id>` / `plan approve all` | Mark ready for execution |\n| `plan remove <id>` | Delete plan |\n| `plan priority <id> <level>` | Set critical/high/medium/low |\n| `phase edit <plan_id> <phase_id> <prompt>` | Edit a phase |\n| `good night` | Start overnight execution (background) |\n| `night status` / `night stop` | Check/stop execution |\n\nPython API: `from scripts.night_shift.queue import add_plan, list_plans, get_plan, approve_plan, approve_all, remove_plan, set_priority, format_plan_list, format_plan_detail, edit_phase`\n\n## Architecture\n- **Queue**: `scripts/night_shift/queue.py` → `data/night_shift/queue.json` + `plans/*.json`\n- **Executor**: `scripts/night_shift/executor.py` → phases via Cursor CLI → git worktrees → checkpoints\n- **Verifier**: 9 methods (files_exist, tests_pass, build_succeeds, lint_clean, git_diff, function_wired, snapshot_match, content_valid, smoke_test)\n- **Budget**: 5min/phase, 30min/plan, 6hr/night\n- **Safety**: git worktree isolation, lock file, watchdog (*/30min), checkpoint resume\n\n## Execution Methods\n1. **claude-code** (default) — Claude Code CLI, `coder` user\n2. **cursor** — Unified-Router: GLM-5.1 → Cursor → Opus fallback\n3. **shell** — Single-line commands only\n4. **subagent** — OpenClaw subagent for complex tasks\n\n## Guardrails (MANDATORY)\n- G1: Update plan JSON phases/status after EVERY phase\n- G2: Produce proof file before marking complete\n- G3: Subagent context budget: lightContext, 2000 char cap, max 3 concurrent\n- G4: Structured reporting only (table format)\n- G5: Use the pipeline (queue.py → executor.py → verifier.py), don't route around it\n- G6: JSON file is source of truth — chat must match JSON status\n\nSee REFERENCE.md for full details on storage, testing, monitoring, and server setup.\n\nFile v1.0.1:SKILL.md\n\n---\nname: night-shift\nversion: 1.0.1\ndescription: \"Queue coding plans during the day, execute them later in a controlled overnight batch, and wake up to a report. Use when the u\n\nArchive v1.0.0: 35 files, 93707 bytes\n\nFiles: night_shift/SKILL.md (2455b), REFERENCE.md (9819b), scripts/__init__.py (91b), scripts/bmad_batch.py (18536b), scripts/bmad_context.py (4296b), scripts/bmad_guardrails.py (4717b), scripts/bmad_phases.py (6538b), scripts/bmad_prd_evolve.py (5470b), scripts/bmad_queue.py (9065b), scripts/bmad_rollback.py (6262b), scripts/budget.py (4875b), scripts/checkpoint.py (4018b), scripts/claude-wrapper.sh (1818b), scripts/cron_trigger.sh (1902b), scripts/executor.py (22217b), scripts/failure_memory.py (3149b), scripts/git_manager.py (7783b), scripts/lock.py (1717b), scripts/memory_guard.py (7764b), scripts/models.py (9464b), scripts/monitor.py (15702b), scripts/night-runner.py (25456b), scripts/ns-control.sh (7208b), scripts/phase_generator.py (12142b), scripts/phase_runner.py (14674b), scripts/queue.py (11306b), scripts/reporter.py (6550b), scripts/status.py (6537b), scripts/subagent_runner.py (7559b), scripts/test_integration.py (6479b), scripts/test_queue.py (9262b), scripts/verifier.py (11041b), scripts/watchdog.py (3105b), SKILL.md (14789b), _meta.json (130b)","readmeExcerpt":"Skill: Night Shift Owner: vardhineediganesh877-ui Summary: Queue coding plans during the day, approve them, execute later in isolated worktrees, and inspect reports. Background agentic execution requires an explicitl... Tags: latest:1.0.5 Version history: v1.0.5 | 2026-04-26T23:02:23.913Z | user Registry package hardening: exclude local ops watchdog/notification/test helpers from public package, keep core executor/pr","codeSnippets":[],"executableExamples":[{"language":"text","snippet":"data/night-shift/\n├── queue.json\n├── plans/\n├── worktrees/\n├── execution/\n├── reports/\n├── failure-memory.json\n├── budget.json\n└── execution.log"},{"language":"bash","snippet":"openclaw skills install vardhineediganesh877-ui/night-shift"},{"language":"bash","snippet":"cd ~/.openclaw/workspace\npython3 skills/night-shift/scripts/preflight.py --json"},{"language":"bash","snippet":"export OPENCLAW_WORKSPACE=/tmp/night-shift-demo\nmkdir -p \"$OPENCLAW_WORKSPACE\"\npython3 ~/.openclaw/workspace/skills/night-shift/scripts/preflight.py --json\npython3 ~/.openclaw/workspace/skills/night-shift/scripts/executor.py dry-run"},{"language":"bash","snippet":"cp skills/night-shift/.night-shift.env.example ~/.openclaw/workspace/.night-shift.env\nchmod 600 ~/.openclaw/workspace/.night-shift.env"},{"language":"bash","snippet":"# install into a disposable workspace first if reviewing a public copy\nclawhub install night-shift --force\n\n# inspect docs and scripts before use\nfind skills/night-shift -maxdepth 3 -type f | sort\n\n# run only approved test plans initially"}],"parameters":null,"dependencies":[],"permissions":[],"extractedFiles":[{"path":"SKILL.md","content":"---\nname: night-shift\nversion: 1.0.5\ndescription: \"Queue coding plans during the day, approve them, execute later in isolated worktrees, and inspect reports. Background agentic execution requires an explicitly configured non-interactive runner.\"\nmetadata:\n  {\n    \"openclaw\":\n      {\n        \"requires\": { \"bins\": [\"python3\", \"git\"] },\n        \"optional\":\n          {\n            \"bins\": [\"agent\", \"cursor\", \"claude\"],\n            \"env\":\n              [\n                \"OPENCLAW_WORKSPACE\",\n                \"NIGHT_SHIFT_DATA_DIR\",\n                \"NIGHT_SHIFT_MODEL\",\n                \"CURSOR_CLI\",\n                \"CURSOR_API_KEY\",\n                \"TELEGRAM_BOT_TOKEN\",\n                \"TELEGRAM_CHAT_ID\",\n                \"NIGHT_SHIFT_CHAT_ID\",\n              ],\n          },\n        \"capabilities\":\n          [\n            \"filesystem-read-write\",\n            \"git-worktrees\",\n            \"subprocess-execution\",\n            \"optional-cursor-cli\",\n            \"optional-claude-cli\",\n            \"optional-telegram-notifications\",\n            \"optional-model-provider-calls\",\n          ],\n      },\n  }\n---\n\n# Night Shift\n\nNight Shift is an autonomous queued-execution skill for engineering work.\n\nInstead of asking the agent to do one large coding task immediately, you build a queue of plans, review or approve them, then run them in a controlled batch window. Each plan is split into phases, executed in isolation, verified, checkpointed, and summarized in a report.\n\n**Mental model:**\n- Daytime: create and refine plans\n- Before execution: approve what is safe to run\n- Execution window: Night Shift runs plans phase by phase\n- Morning: inspect results, merge, retry, or continue\n\nThis is useful when you want:\n- deferred execution instead of immediate chat-time work\n- safer batching for multi-step changes\n- isolated worktrees per plan\n- retry and checkpoint behavior\n- a written report after execution\n\n---\n\n## When to Use\n\nUse Night Shift when the user asks for things like:\n- “good night”\n- “queue this for later”\n- “plan add …”\n- “run these approved plans overnight”\n- “night shift status”\n- “show my morning report”\n- “retry plan #3”\n- “merge that finished plan”\n\nPrefer Night Shift over immediate execution when:\n- the work is multi-phase\n- the task needs isolation from the main repo state\n- the user wants review/approval before execution\n- the work may take a long time\n- you want a queue of tasks rather than one interactive run\n\nDo **not** use Night Shift for:\n- tiny one-off edits better handled immediately\n- high-risk production actions without review\n- tasks that require constant human decisions mid-run\n- public/external actions that should be explicitly approved in the moment\n\n---\n\n## Core Concepts\n\n### 1. Plan\nA plan is the unit of queued work. It includes:\n- title\n- optional description\n- optional repo URL\n- priority\n- token/time budget hints\n- generated phases\n- status and execution metadata\n\n### 2. Phase\nEach plan is split into phases. A phase has:\n- a title\n- a prom"},{"path":"_meta.json","content":"{\n  \"ownerId\": \"kn7380dt93q0wx6x1zx5b4y8z985kjww\",\n  \"slug\": \"night-shift\",\n  \"version\": \"1.0.5\",\n  \"publishedAt\": 1777244543913\n}"},{"path":"INSTALL.md","content":"# Night Shift Install and Setup\n\n## Install from ClawHub\n\n```bash\nopenclaw skills install vardhineediganesh877-ui/night-shift\n```\n\n## Verify local requirements\n\n```bash\ncd ~/.openclaw/workspace\npython3 skills/night-shift/scripts/preflight.py --json\n```\n\nRequired dependencies are `python3` and `git`. Cursor/Claude runners are optional, but any queued phase that uses them requires those CLIs to work non-interactively.\n\n## Recommended first run: disposable workspace\n\n```bash\nexport OPENCLAW_WORKSPACE=/tmp/night-shift-demo\nmkdir -p \"$OPENCLAW_WORKSPACE\"\npython3 ~/.openclaw/workspace/skills/night-shift/scripts/preflight.py --json\npython3 ~/.openclaw/workspace/skills/night-shift/scripts/executor.py dry-run\n```\n\nDry-run should write a preview report only. It should not mark plans complete or create success checkpoints.\n\n## Background/systemd setup\n\nDetached timers need explicit environment. Create a private env file if needed:\n\n```bash\ncp skills/night-shift/.night-shift.env.example ~/.openclaw/workspace/.night-shift.env\nchmod 600 ~/.openclaw/workspace/.night-shift.env\n```\n\nThen edit values for your environment. Do not commit real secrets.\n\nBefore enabling a timer, run preflight in the same user context that will run the service."},{"path":"REFERENCE.md","content":"# Night Shift Reference\n\nThis file is the operational reference for the Night Shift skill.\n\nIt complements `SKILL.md` by focusing on setup, runtime expectations, file layout, and practical caveats.\n\n---\n\n## 1. What Night Shift Actually Is\n\nNight Shift is a queued autonomous execution framework for coding work.\n\nIt is **not** just a prompt pattern. It includes:\n- plan storage\n- phase generation\n- isolated worktrees\n- execution routing\n- verification\n- checkpointing\n- reporting\n- monitoring helpers\n\nThink of it as a lightweight unattended engineering operator.\n\n---\n\n## 2. Minimum Runtime Expectations\n\nNight Shift expects a host environment with:\n- Python 3\n- git\n- a writable workspace\n- permission to create directories/files under `data/night-shift/`\n- a repo or project context where worktrees and diffs make sense\n\nIf those are missing, the skill may still partially function, but the core value drops sharply.\n\n---\n\n## 3. Security Review Notes\n\nNight Shift is powerful by design. It can run shell commands, create git worktrees, call coding CLIs, and write reports/checkpoints. That means automated registries may classify it as suspicious even when the package is behaving as intended.\n\nExpected capabilities:\n- local file and directory writes under the configured workspace\n- git worktree / diff / commit / reset operations\n- subprocess execution for approved phase methods\n- optional calls to host-provided tools such as Cursor CLI, Claude Code, or subagents\n- optional Telegram notifications when notification environment variables are configured\n\nNot expected:\n- bundled secrets or private tokens\n- cryptocurrency mining\n- hidden persistence outside the configured workspace\n- unsolicited external network calls beyond host-configured tools/notifications\n- production deployment unless a user-approved phase explicitly performs it\n\nRecommended first-run posture:\n\n```bash\n# install into a disposable workspace first if reviewing a public copy\nclawhub install night-shift --force\n\n# inspect docs and scripts before use\nfind skills/night-shift -maxdepth 3 -type f | sort\n\n# run only approved test plans initially\n```\n\nIf your ClawHub client requires `--force`, it is usually because of these intentional automation primitives. Review before running, then proceed only in a workspace where unattended coding is acceptable.\n\n---\n\n## 4. Workspace Assumptions\n\nThe portable version of Night Shift uses workspace auto-detection.\n\nDefault behavior:\n- detect workspace from the skill location\n- store runtime data in `data/night-shift/`\n\nOverride with:\n\n```bash\nexport OPENCLAW_WORKSPACE=/path/to/workspace\n```\n\nThis controls where Night Shift reads/writes:\n- queue state\n- plan files\n- worktrees\n- logs\n- reports\n- budget / checkpoint / failure memory data\n\n---\n\n## 4. Important Environment Variables\n\n### Core\n\n```bash\nexport OPENCLAW_WORKSPACE=/path/to/workspace\nexport NIGHT_SHIFT_MODEL=auto\nexport CURSOR_CLI=/path/to/agent\n```\n\n### Notifications\n\n```bash\nexport TELEGRAM_BOT_TOKEN=...\nex"},{"path":"SECURITY.md","content":"# Night Shift Security Model\n\nNight Shift is a powerful queued execution framework. Treat it like a coding agent runner, not a passive note-taking skill.\n\n## What Night Shift can do\n\nWhen you approve and run plans, Night Shift may:\n\n- read and write files inside the configured workspace\n- create git branches and worktrees under `data/night-shift/worktrees/`\n- run subprocesses for shell phases and verification commands\n- call optional coding runners such as Cursor CLI (`agent`/`cursor`) or Claude Code (`claude`)\n- run tests, linters, build commands, and smoke checks\n- write checkpoints, reports, logs, and failure-memory records\n- optionally send Telegram notifications if notification tokens are configured\n\n## What Night Shift should not do by default\n\nNight Shift should not:\n\n- run against production repositories without review\n- execute unreviewed public/external actions\n- send notifications unless recipients and tokens are explicitly configured\n- mark dry-runs as completed live work\n- continue through every plan after a shared runner/preflight failure\n\n## Required runtime dependencies\n\nRequired:\n\n- `python3` 3.11+\n- `git`\n- writable workspace/data directory\n\nOptional, depending on phase execution methods:\n\n- Cursor CLI: `agent` or `cursor`\n- Claude Code CLI: `claude`\n- Telegram notification env vars\n\n## Environment variables\n\nOptional variables read by the skill:\n\n- `OPENCLAW_WORKSPACE` — workspace root; defaults to the OpenClaw workspace that contains this skill\n- `NIGHT_SHIFT_DATA_DIR` — Night Shift state directory; defaults to `$OPENCLAW_WORKSPACE/data/night-shift`\n- `NIGHT_SHIFT_MODEL` — model hint for compatible runners\n- `CURSOR_CLI` — explicit path to Cursor/agent CLI\n- `CURSOR_API_KEY` — optional non-interactive Cursor auth, if supported by your CLI setup\n- `TELEGRAM_BOT_TOKEN`, `TELEGRAM_CHAT_ID`, `NIGHT_SHIFT_CHAT_ID` — optional notifications\n\nNever commit real tokens. Use a local env file such as `.night-shift.env` and keep it out of published packages.\n\n## Safe first run\n\nUse an isolated disposable workspace first:\n\n```bash\nexport OPENCLAW_WORKSPACE=/tmp/night-shift-demo\npython3 skills/night-shift/scripts/preflight.py --json\npython3 skills/night-shift/scripts/executor.py dry-run\n```\n\nDry-run is intended to be read-only. It should produce a preview report and must not mark plans complete or write success checkpoints.\n\n## Background runner warning\n\nDetached systemd/timer execution does not automatically inherit your interactive shell environment. Before live unattended execution, run preflight in the same user/service context. In particular, Cursor CLI phases need `HOME`, `PATH`, and a non-interactive auth strategy.\n\nIf preflight says Cursor/Claude is not ready, fix the environment or change the queued phases before running live execution.\n\n## Verification command policy\n\nVerification commands can execute subprocesses in the worktree. Prefer explicit, narrow commands such as:\n\n- `python3 -m pytest`\n- `npm test`\n- `npm run lint`\n- `ruff"}],"languages":[],"docsSourceLabel":"CLAWHUB","editorialOverview":"Queue coding plans during the day, approve them, execute later in isolated worktrees, and inspect reports. Background agentic execution requires an explicitl... Skill: Night Shift Owner: vardhineediganesh877-ui Summary: Queue coding plans during the day, approve them, execute later in isolated worktrees, and inspect reports. Background agentic execution requires an explicitl... Tags: latest:1.0.5 Version history: v1.0.5 | 2026-04-26T23:02:23.913Z | user Registry package hardening: exclude local ops watchdog/notification/test helpers from public package, keep core executor/pr","editorialQuality":{"score":100,"threshold":65,"status":"ready","wordCount":1483,"uniquenessScore":46,"reasons":[]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-10-11T17:38:22.384Z","emptyReason":"No screenshots, media assets, or demo links are available."},"primaryImageUrl":null,"mediaAssetCount":0,"assets":[],"demoUrl":null},"ownerResources":{"evidence":{"source":"unclaimed","verified":false,"confidence":"low","updatedAt":"2026-10-11T17:38:22.384Z","emptyReason":"This page has not been claimed by the agent owner."},"hasCustomPage":false,"customPageUpdatedAt":null,"customLinks":[],"structuredLinks":{"docsUrl":null,"demoUrl":null,"supportUrl":null,"pricingUrl":null,"statusUrl":null},"customPage":null},"relatedAgents":{"evidence":{"source":"protocol-neighbors","verified":false,"confidence":"medium","updatedAt":"2026-10-11T20:59:06.610Z","emptyReason":null},"items":[{"id":"8ebccd8e-3863-4187-8355-c3f14e1f9edf","entityType":"agent","canonicalPath":"/agent/iofficeai-aionui","slug":"iofficeai-aionui","name":"AionUi","description":"Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!","url":"https://github.com/iOfficeAI/AionUi","homepage":"https://www.aionui.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-10-09T19:11:12.944Z","createdAt":"2026-02-25T03:38:16.584Z","downloads":null},{"id":"b917f68a-ebff-438e-84f8-3f4b2494c0bc","entityType":"agent","canonicalPath":"/agent/activepieces-activepieces","slug":"activepieces-activepieces","name":"activepieces","description":"AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents","url":"https://github.com/activepieces/activepieces","homepage":"https://www.activepieces.com","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-15T02:22:12.426Z","createdAt":"2026-02-25T03:38:12.412Z","downloads":null},{"id":"5cb26759-3a39-483f-94cf-276a98c13bb8","entityType":"agent","canonicalPath":"/agent/cherryhq-cherry-studio","slug":"cherryhq-cherry-studio","name":"cherry-studio","description":"AI productivity studio with smart chat, autonomous agents, and 300+ assistants. Unified access to frontier LLMs","url":"https://github.com/CherryHQ/cherry-studio","homepage":"https://cherry-ai.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-11T14:38:40.986Z","createdAt":"2026-02-25T03:38:19.379Z","downloads":null},{"id":"6f6582d0-5d76-4f0f-b81d-86520247950b","entityType":"agent","canonicalPath":"/agent/copilotkit-copilotkit","slug":"copilotkit-copilotkit","name":"CopilotKit","description":"The Frontend for Agents & Generative UI. React + Angular","url":"https://github.com/CopilotKit/CopilotKit","homepage":"https://docs.copilotkit.ai","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-03-25T09:50:57.846Z","createdAt":"2026-02-25T03:39:14.617Z","downloads":null}],"links":{"hub":"/agent","source":"/agent/source/clawhub","protocols":[{"label":"OpenClaw","href":"/agent/protocol/openclew"}]}}}