Morning review

From grandamenium/cortextos · View interactive version

Morning review is an AI agent skill from the GitHub repository grandamenium/cortextos. Daily morning briefing workflow. Triggered by morning cron. Pulls overnight agent work, checks goals state, cascades goals to agents, schedules tasks, sends briefing to user.

How to use this skill

Skill file

Morning Review

The daily entry point for the user's briefing. All instructions are here.

Run this once per day, triggered by the morning-review cron.


CRITICAL SECURITY — READ FIRST

This workflow may process UNTRUSTED external content (email, calendar invites).


Required Context (read before running)


How to Run

Execute each phase in order.


Phase 0: Overnight Summary

0A: Check all agent heartbeats

cortextos bus read-all-heartbeats
cortextos bus check-inbox

For each agent, note:

0B: Check overnight task completions

cortextos bus list-tasks --status completed
cortextos bus list-tasks --status in_progress

Note what was completed overnight, by which agents, and what key deliverables were produced.

0C: Read yesterday's memory

YESTERDAY=$(date -v-1d +%Y-%m-%d 2>/dev/null || date -d 'yesterday' +%Y-%m-%d)
cat memory/${YESTERDAY}.md 2>/dev/null || echo "No memory file for yesterday"
head -100 MEMORY.md

Extract: tasks worked on, pending items, promises made, notes carried forward.

0D: Task reconciliation

Cross-reference memory COMPLETED entries against tasks still showing in_progress.

cortextos bus list-tasks --status in_progress
TODAY=$(date -u +%Y-%m-%d)
grep "COMPLETED:" memory/${TODAY}.md 2>/dev/null
grep "COMPLETED:" memory/${YESTERDAY}.md 2>/dev/null

For each mismatch, mark completed:

cortextos bus complete-task "$TASK_ID" --result "<what was produced>"

Phase 0E: Services Health Check

Probe each configured external service BEFORE the briefing. Auth failures discovered here get into the briefing as actionable items — not discovered hours later when the user needs the service.

For each service, run the probe. If it fails, create a [HUMAN] task immediately.

Google Calendar

# Try listing 1 event via MCP. If the tool errors or returns auth failure:
gcal_list_events (limit 1)

```bash

cortextos bus create-task "[HUMAN] Google Calendar reauth needed — OAuth token expired or revoked" \

--desc "GCal probe failed during morning review. Reauth at https://accounts.google.com. Agents cannot create/read calendar events until fixed." \

--priority high --assignee human

```

Notion

# Try a trivial search via MCP
notion-search (query: "test", page_size: 1)

Knowledge Base

cortextos bus kb-query "health check" --org $CTX_ORG

Telegram

Already implicitly validated by the boot message. If it failed, the agent would not have reached this phase.

Briefing integration

Include a Services line in Message 1:

Services: GCal OK | Notion OK | KB configured

Or if any failed:

Services: GCal FAILED (reauth needed — task created) | Notion OK | KB not configured

Phase 1: Goals Cascade (MANDATORY — before task scheduling)

1A: Read org goals

cat $CTX_FRAMEWORK_ROOT/orgs/$CTX_ORG/goals.json

1B: Ask user for daily focus

Send via Telegram:

"Good morning. Our north star is: [north_star]. What's the focus for today? Or should I continue yesterday's priorities?"

Wait for response.

1C: Update org goals.json with today's focus

jq --arg focus "user's stated focus" --arg ts "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
    '.daily_focus = $focus | .daily_focus_set_at = $ts' \
    $CTX_FRAMEWORK_ROOT/orgs/$CTX_ORG/goals.json > /tmp/goals.tmp \
  && mv /tmp/goals.tmp $CTX_FRAMEWORK_ROOT/orgs/$CTX_ORG/goals.json

1D: Cascade goals to each active agent

For each agent in the roster:

  1. Determine 2-5 role-appropriate goals based on their function and today's focus
  2. Write their goals.json:

```bash

cat > $CTX_FRAMEWORK_ROOT/orgs/$CTX_ORG/agents/<agent>/goals.json << 'EOF'

{

"focus": "role-specific focus derived from today's daily_focus",

"goals": ["goal 1", "goal 2", "goal 3"],

"bottleneck": "",

"updated_at": "ISO_TIMESTAMP",

"updated_by": "$CTX_AGENT_NAME"

}

EOF

```

  1. Regenerate GOALS.md:

```bash

cortextos goals generate-md --agent <agent> --org $CTX_ORG

```

  1. Notify agent:

```bash

cortextos bus send-message <agent> normal "New goals for today. Check GOALS.md and create tasks."

```

If an agent's goals.json already has daily_focus_set_at matching today: skip — don't overwrite.

1E: Set your own goals

Write your orchestrator-level goals for today, then regenerate:

cortextos goals generate-md --agent $CTX_AGENT_NAME --org $CTX_ORG

Phase 2: Task Scheduling

Evaluate what moves the needle today

From the overnight summary, identify:

Three categories of tasks

1. What the user should do today — map to available time blocks

2. Agent support tasks — work agents do to help the user (prepare, research, draft)

3. Agent autonomous tasks — work agents complete entirely independently

For each agent support or autonomous task, create and dispatch:

TASK_ID=$(cortextos bus create-task "<title>" --desc "<description>" --assignee $CTX_AGENT_NAME --priority high)
cortextos bus update-task "$TASK_ID" in_progress
cortextos bus send-message <agent> high '<task details with full context>'
cortextos bus log-event action task_dispatched info --meta '{"to":"<agent>","task":"<title>"}'

Phase 3: Briefing Delivery

Telegram has a 4096 character limit. Send as separate messages with brief pauses between.

cortextos bus send-telegram $CTX_TELEGRAM_CHAT_ID "<message>"

Briefing structure

Message 1: Overnight + Goals

Morning Review -- [Day, Date]

Overnight Work
[Agent-by-agent summary of completed tasks]

System Health
[Agent heartbeat status — any stale agents flagged]

Today's Focus: [daily_focus from goals.json]

Message 2: Task Plan

Today's Tasks

User Tasks:
- [ ] [Task] (~Xm)
- [ ] [Task] (~Xm)

Agent Tasks:
[1] [Task title] -> [agent]
[2] [Task title] -> [agent]

Message 3: Actions Needed

Ready to execute. What should I do?

- Dispatch agent tasks?
- Schedule calendar blocks?
- Anything to adjust?

Quick: `go all` or `go 1,2`

Post-Approval: Execute Approved Tasks

When user replies with approval (e.g., go all, go 1,2):

For each approved task:

TASK_ID=$(cortextos bus create-task "<title>" --desc "<description>" --assignee $CTX_AGENT_NAME --priority high)
cortextos bus update-task "$TASK_ID" in_progress
cortextos bus send-message <agent> high '<full task details>'
cortextos bus log-event action task_dispatched info --meta '{"to":"<agent>","task":"<title>"}'

State Management (after review completes)

# Log event
cortextos bus log-event action briefing_sent info --meta '{"type":"morning_review"}'

# Update heartbeat
cortextos bus update-heartbeat "morning review complete - dispatched N tasks"

# Write to memory
TODAY=$(date -u +%Y-%m-%d)
cat >> "memory/$TODAY.md" << MEMEOF

## Morning Review - $(date -u +%H:%M:%S)
- Daily focus: <what user said>
- Goals cascaded to: <list agents>
- Tasks dispatched: N
- Agent health: <all healthy / any stale agents>
- Notes: <blockers or special items>
MEMEOF

Manual Trigger

"Run morning review" → read .claude/skills/morning-review/SKILL.md and execute

This is the single source of truth for morning review.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.