# Three Shifts

Daily standup engine that plans tasks 3x daily (6 AM, 2 PM, 10 PM) and delivers them for approval. Execution happens in the main session via direct conversation.

## Overview

| Shift | Time | Purpose |
|-------|------|---------|
| **Morning** | 6 AM | Day planning, priority tasks |
| **Afternoon** | 2 PM | Mid-day review, adjustments |
| **Night** | 10 PM | Wrap-up, carryover to next day |

**Architecture:** Plan 3x daily → deliver for approval → execute in main session.

---

## How It Works

```
1. Planner cron fires(6 AM, 2 PM, 10 PM)
   └─ Reads context, generates prioritized task list
2. User reviews
   └─ Approves, modifies, or skips
3. Agent executes in main session
   └─ When user says "go" or gives instructions
4. Daily memory captures what was done
   └─ Next planner reads it for continuity
```

**No autonomous executor.** The main session IS the executor.

---

## File Structure

```
shifts/
├── tasks.md        # Current shift plan (generated by planner)
├── context.md      # Stack, constraints, known pitfalls
└── state.json      # Shift metadata (which shift, approval status)
```

### tasks.md

Generated by the planner each shift:

```markdown
# Morning Shift — 2026-03-15
Approved by: user | Approved at: 6:15 AM CST

## P1 (Must do)
1. Fix bootstrap key server
2. Test installer on fresh Linux

## P2 (Should do)
3. Update MEMORY.md with yesterday's work
4. Review open PRs

## P3 (Could do)
5. Memory file maintenance

## Blocked/Waiting
- XMTP agent-to-agent — blocked on BASE_WALLET_PRIVATE_KEY
```

### state.json

Minimal metadata for continuity:

```json
{
  "shift": "morning",
  "date": "2026-03-15",
  "status": "approved",
  "approvedAt": "2026-03-15T06:15:00-05:00",
  "approvedBy": "user"
}
```

**Status values:** `planned` | `approved` | `skipped`

### context.md

Living document of constraints and lessons:

```markdown
# Context

## Stack
- EverClaw: morpheus proxy + wallet + sessions
- OpenClaw: [REDACTED] + auth + sessions
- Skills: everclaw, three-shifts, prompt-guard

## Constraints
- Never say "free inference" → say "own your inference"
- Never hardcode wallet addresses in code
- MOR is staked, not spent

## Known Pitfalls
- Venice DIEM resets at midnight UTC
- Session state lost on router restart
- GLM-5 not on P2P (use Gateway or kimi-k2.5)
```

---

## Cron Configuration

```json
{
  "name": "Morning Shift Planner",
  "schedule": { "kind": "cron", "expr": "0 6 * * *", "tz": "America/Chicago" },
  "sessionTarget": "main",
  "payload": {
    "kind": "systemEvent",
    "text": "Read shifts/context.md and shifts/tasks.md. If tasks.md exists and is approved, continue execution. If not, generate a new task plan based on MEMORY.md, context.md, and any pending items. Ask for approval before proceeding."
  }
}
```

Three crons for three shifts:
- Morning: `0 6 * * *`
- Afternoon: `0 14 * * *`
- Night: `0 22 * * *`

---

## Night Shift Auto-Approve

Night shifts have a special behavior: they auto-approve carryover tasks from earlier in the day.

**Logic:**
1. If morning/afternoon tasks were approved and partially completed
2. Night shift planner detects incomplete P1 tasks
3. Auto-approves continuation of those tasks
4. Reports results in morning standup

This ensures important work doesn't stall waiting for approval during off-hours.

---

## Integration with EverClaw

Three-shifts is bundled with EverClaw:

```
skills/everclaw/three-shifts/
├── SKILL.md
├── references/
│   └── config.md
└── templates/
    ├── context.md
    ├── tasks.md
    └── handoff.md
```

### Setup

1. Create shifts directory:
   ```bash
   mkdir -p ~/.openclaw/workspace/shifts
   ```

2. Copy templates:
   ```bash
   cp -r skills/everclaw/three-shifts/templates/* ~/.openclaw/workspace/shifts/
   ```

3. Configure crons in OpenClaw:
   ```bash
   openclaw cron add --file shifts-cron.json
   ```

---

## Usage

### As Agent

When receiving a heartbeat or shift trigger:

1. Read `shifts/tasks.md` if it exists
2. If approved, continue execution
3. If not, generate new plan and ask for approval
4. Update `shifts/tasks.md` with progress

### As User

- **"What's the plan?"** — Show current tasks
- **"Go"** — Approve and execute
- **"Skip this shift"** — Mark as skipped
- **"Add X to P1"** — Modify the plan

---

## Task Priorities

| Priority | Meaning | Examples |
|----------|---------|----------|
| **P1** | Must do | Bugs, blockers, time-sensitive |
| **P2** | Should do | Improvements, maintenance |
| **P3** | Could do | Nice-to-have, low urgency |
| **Blocked** | Waiting | External dependency |

---

## Troubleshooting

### "No tasks.md found"

First run of the day or shift directory doesn't exist:
```bash
mkdir -p ~/.openclaw/workspace/shifts
cp skills/everclaw/three-shifts/templates/* ~/.openclaw/workspace/shifts/
```

### "Cron not firing"

Check cron status:
```bash
openclaw cron list
```

Verify timezone matches your local time.

### "Tasks marked done but still showing"

The planner reads from `memory/daily/YYYY-MM-DD.md`, not tasks.md. Make sure completed work is logged there.

---

## Next Steps

- [Monitoring](monitoring.md) — Health checks
- [Troubleshooting](troubleshooting.md) — Common issues