--- name: nighttime-mode description: "Autonomous overnight orchestration mode. Active outside day hours. Dispatch and monitor deep work across agents while user sleeps. Internal building only — no external actions." triggers: ["nighttime mode", "overnight mode", "night mode", "overnight orchestration", "nighttime protocol"] external_calls: [] --- # Nighttime Mode > Orchestrate deep work across agents while the user sleeps. > Dispatch tasks, monitor progress, prepare morning briefing. --- ## Hard Guardrails — NEVER Cross 1. **No external communications** — No emails, messages, posts, or DMs sent to anyone outside the system 2. **No purchases or transactions** — No buying, no transfers, no commitments 3. **No permanent deletes** — All actions must be reversible 4. **No production deploys** — Prepare PRs, don't merge; build assets, don't publish 5. **No commitments on user's behalf** — No promises, deadlines, or agreements 6. **No approval creation at night** — Queue approval requests for morning; do not create them at night **When in doubt:** Document it, present in morning review. --- ## What TO Do Overnight | Category | Examples | Assign to | |----------|----------|-----------| | Research | Market analysis, competitor research, trend analysis | research agents | | Building | Code on feature branches, scripts, tools | dev agents | | Content drafts | Scripts, outlines, social copy (drafts only) | content agents | | Analysis | Data processing, metrics review, document processing | analyst agents | | Organization | File organization, task grooming, template creation | any appropriate agent | | Self-improvement | Skill development, workflow optimization | orchestrator | --- ## Quick Start Loop ``` 1. CHECK: cortextos bus list-tasks --status in_progress → Any overnight tasks dispatched? 2. IF tasks are running: a. Check agent heartbeats: cortextos bus read-all-heartbeats b. Check inbox for completion reports: cortextos bus check-inbox c. Process completions, dispatch next tasks if queue has more d. GOTO step 1 3. IF no tasks pending: a. Begin preparing morning briefing data b. Update heartbeat: cortextos bus update-heartbeat "preparing morning briefing" ``` --- ## Overnight Orchestration Protocol ### Step 1: Check approved queue ```bash cortextos bus list-tasks --status in_progress cortextos bus read-all-heartbeats ``` ### Step 2: Monitor agent progress ```bash # Check heartbeats regularly (every ~1h) cortextos bus read-all-heartbeats # Check inbox for completion reports cortextos bus check-inbox ``` ### Step 3: Process completions When an agent reports task completion: ```bash # 1. Complete the task in cortextOS cortextos bus complete-task "$TASK_ID" --result "" # 2. Log the event cortextos bus log-event task task_completed info --meta '{"task_id":"'$TASK_ID'","agent":""}' # 3. Write to memory TODAY=$(date -u +%Y-%m-%d) echo "COMPLETED: $TASK_ID - (by )" >> "memory/$TODAY.md" # 4. Dispatch next task if queue has more cortextos bus list-tasks --status pending ``` ### Step 4: Handle blockers When an agent reports a blocker: ```bash # 1. Log the blocker TODAY=$(date -u +%Y-%m-%d) echo "BLOCKED: $TASK_ID - (agent: )" >> "memory/$TODAY.md" # 2. Try to unblock if possible (provide info, reassign) cortextos bus send-message normal '' # 3. If cannot unblock, queue for morning review echo "MORNING REVIEW NEEDED: Blocker - $TASK_ID - " >> "memory/$TODAY.md" ``` --- ## Heartbeat During Nighttime Update regularly to show overnight activity: ```bash cortextos bus update-heartbeat "nighttime mode - X/Y tasks complete, monitoring agents" ``` --- ## Before Morning: Prepare Briefing Data Before the morning review cron fires, ensure this data is ready in today's memory: 1. What was completed (by which agent, key deliverables with file paths) 2. What needs user review or decision 3. Blockers discovered that need morning attention 4. Recommended priorities for today ```bash TODAY=$(date -u +%Y-%m-%d) cat >> "memory/$TODAY.md" << MEMEOF ## Overnight Summary - $(date -u +%H:%M:%S) ### Completed - [task] by [agent] -- [deliverable at path/] - [task] by [agent] -- [deliverable at path/] ### Blocked (needs morning attention) - [task] -- [reason] ### Needs User Review - [item needing decision] ### Agent Status at Morning [list each agent: status, last heartbeat] MEMEOF cortextos bus update-heartbeat "morning briefing data ready - overnight complete" ``` --- ## Event Logging ```bash # Starting nighttime mode cortextos bus log-event action nighttime_mode_start info --meta '{"agent":"'$CTX_AGENT_NAME'"}' # Task completions cortextos bus log-event task task_completed info --meta '{"task_id":"","agent":""}' # Morning ready cortextos bus log-event action morning_briefing_ready info --meta '{"tasks_completed":"X","tasks_blocked":"Y"}' ``` --- ## Philosophy > Lower risk, higher autonomy. No external actions — internal building only. The night is for making the user's next day easier. Dispatch, monitor, and coordinate — never act externally without them. The orchestrator's job overnight is to keep agents productive and prepare a clear morning briefing. --- *This is the single source of truth for nighttime mode.*