agentleFS
afain12afain12/coo-twin/.claude/skills/start-day/SKILL.md

start-day

Skill0 starsChanged 6 months agoMITView on GitHub

Daily briefing skill: pulls Google Calendar, Notion databases, Obsidian vault, and Google Tasks into a prioritized morning plan. Scores top outcomes, flags stale items and delegation candidates, and optionally writes an Obsidian daily note. Run every morning to replace opening four apps.

  • Sends data out

4 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

54 rules. 0 are common, 17 are distinctive, and 37 are very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 17

    Distinctive

    This author's own choices. Worth a look.

  • 37

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read-first, write-on-approval: Never write to any system without explicit approval at the trust gate.

    line 21
  2. Very specific:

    Run scripts/check_mode.sh and capture stdout + exit code:

    line 38
  3. Very specific:

    If MODE == "observe": set SKIP_WRITES=1.

    line 48
  4. Very specific:

    If MODE == "draft" (default): proceed normally.

    line 51
  5. Very specific:

    If MODE == "approved": trust gate auto-approves any action_id whose prefix matches state/coo_mode.yaml :: approved_action_prefixes.

    line 53
  6. Very specific:

    Read ${CONFIG} (config/sources.yaml) to get:

    line 63
  7. Very specific:

    If N_BLOCKING > 0, add a stream config drift warning to the briefing header in Step 7 (don't block the run.

    line 83
  8. Very specific:

    Read ${STATE}/priorities.yaml and scan for any item whose notes mention an explicit upcoming meeting time, day, or phrase like "potentially …

    line 95
  9. Very specific:

    If the field is set to pending, awaiting_approval, or denied → add to pending_writes with category confirmed.

    line 113
  10. Very specific:

    If no status field exists → add to pending_writes with category unverified and the note "verify push status — file may already be applied." …

    line 115
  11. Distinctive:

    Do not assert it is unwritten.

    line 117
  12. Very specific:

    If the field is set to applied, done, completed → ignore.

    line 118
  13. Very specific:

    If .context/ doesn't exist, skip silently.

    line 127
  14. Very specific:

    Read ${STATE}/sync-sweep-retry-queue.yaml if present.

    line 131
  15. Distinctive:

    If the file does not exist → no flag emitted.

    line 137
  16. Very specific:

    If queue is empty → no flag emitted.

    line 150
  17. Very specific:

    If queue is non-empty:

    line 151
  18. Very specific:

    If M >= 3: emit warning sync-sweep DLQ: N items, oldest M days

    line 154
  19. Very specific:

    Read ${VAULT}/daily/{YESTERDAY}.md.

    line 173
  20. Very specific:

    Read today's log file ${LOGS_DIR}/{TODAY}.md if it already exists — if a ### Catch-up Sync section is present from an earlier run, skip …

    line 182
  21. Very specific:

    If both pull_completions and push_completions are empty → skip silently.

    line 197
  22. Very specific:

    Failure handling: If Google Tasks or Notion is unreachable for the Step 5 pull, mark every ID from that system as unverifiable and continue.

    line 200
  23. Very specific:

    Parent-task implication: if a Notion page_id is suppressed AND the live Master Tasks query returns subtasks whose Parent task relation …

    line 239
  24. Very specific:

    Use the gws CLI to fetch calendar events via Bash tool.

    line 264
  25. Very specific:

    Use the Notion REST API via curl.

    line 301
  26. Very specific:

    Add it to .claude/settings.local.json under env." Continue with other sources.

    line 318
  27. Distinctive:

    IMPORTANT: Do NOT inherit a stream assignment from a Notion parent task name.

    line 359
  28. Very specific:

    Check for contacts needing follow-up: Last Contact > provider_followup_days (14d)

    line 375
  29. Distinctive:

    Check pipeline items by stage field

    line 376
  30. Distinctive:

    Do NOT auto-tag in read mode — only suggest.

    line 426
  31. Distinctive:

    Confidence requirement (BOUNDED + GROUNDED): Every triage suggestion includes a 0.0–1.0 confidence score:

    line 428
  32. Distinctive:

    If the search returns 0 results AND the Meeting Notes DB also has no match → declare "Sync gap" and suggest pushing from the source app.

    line 473
  33. Distinctive:

    If the search returns >=1 result → the meeting IS in Notion as an appended section.

    line 476
  34. Very specific:

    Handle pagination: If has_more is true, make additional requests with start_cursor from next_cursor.

    line 483
  35. Very specific:

    Read the local vault at ${VAULT} using the Read and Glob tools.

    line 488
  36. Very specific:

    Look up your default tasklist ID once via gws tasks tasklists list and store it in config/sources.yaml.

    line 508
  37. Very specific:

    Before composing the briefing, query all three Notion databases for pages edited in the last 24 hours (use last_edited_time timestamp …

    line 575
  38. Very specific:

    Every item gets a markdown checkbox - [ ] for completion tracking

    line 680
  39. Distinctive:

    Keep it scannable. Bullet points, not paragraphs.

    line 694
  40. Distinctive:

    Use relative dates: "2 days overdue", "stale 12 days"

    line 696
  41. Distinctive:

    After displaying the briefing, use AskUserQuestion to present options:

    line 701
  42. Distinctive:

    Default recommendation: Option A.

    line 710
  43. Very specific:

    If push_completions is non-empty, prompt AFTER Gate 1 completes:

    line 732
  44. Very specific:

    Write to ${VAULT}/daily/{TODAY}.md using this template:

    line 778
  45. Distinctive:

    If the file already exists, append a new timestamped section:

    line 832
  46. Very specific:

    Read mobile_briefing_page_id from ${CONFIG}.

    line 858
  47. Very specific:

    Read the just-written ${VAULT}/daily/{TODAY}.md.

    line 859
  48. Very specific:

    If the Notion call fails (5xx / 401 / timeout) → append a one-line ### Mobile Mirror entry to ${LOGS_DIR}/{TODAY}.md noting the failure …

    line 870
  49. Distinctive:

    If the Notion MCP is not loaded in the current session: skip silently.

    line 874
  50. Very specific:

    Write the briefing to ${LOGS_DIR}/{TODAY}.md:

    line 877
  51. Distinctive:

    If the log file already exists (re-run), append a new timestamped section instead of overwriting.

    line 891
  52. Very specific:

    After all writes complete, emit one JSONL row to logs/_telemetry.jsonl:

    line 896
  53. Very specific:

    Notion API timeout: Use --max-time 60 to timeout after 60 seconds, skip that source.

    line 930
  54. Distinctive:

    Empty database response: Not an error — display "No items found in {database name}".

    line 932

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

/start-day — Daily Briefing

You are acting as the user's Chief of Staff. Your job is to read every connected source, synthesize what matters, and propose a plan for the day.

Read-first, write-on-approval. Never write to any system without explicit approval at the trust gate.

Constants

REPO_DIR = <your repo root>
CONFIG   = "${REPO_DIR}/config/sources.yaml"
LOGS_DIR = "${REPO_DIR}/logs"
VAULT    = "${REPO_DIR}/vault"
STATE    = "${REPO_DIR}/state"
TODAY    = <current date in YYYY-MM-DD format>
RUN_ID   = "sd-${TODAY//-/}-$(date +%H%M)"

Step 0: Mode Check (GOVERNED)

Run scripts/check_mode.sh and capture stdout + exit code:

MODE=$(scripts/check_mode.sh) || {
  echo "Agent is locked (state/coo_mode.yaml). Refusing to run /start-day."
  echo "To unlock: edit state/coo_mode.yaml and set mode: draft."
  exit 0
}

If MODE == "observe": set SKIP_WRITES=1. Step 8 and Step 9 will display proposed writes but never execute. Step 8 trust gate becomes informational only.

If MODE == "draft" (default): proceed normally.

If MODE == "approved": trust gate auto-approves any action_id whose prefix matches state/coo_mode.yaml :: approved_action_prefixes. Other writes still gated.

Record the mode in the briefing header (Mode: draft) so the operating posture is visible at a glance.

Capture RUN_START_MS=$(date +%s%3N 2>/dev/null || python -c "import time; print(int(time.time()*1000))") for telemetry at Step 10.

Step 1: Load Configuration

Read ${CONFIG} (config/sources.yaml) to get:

  • Obsidian vault path and folder structure
  • Notion database definitions with field mappings
  • Google Tasks settings
  • Calendar business keywords
  • Team members and delegation tags
  • Staleness threshold (default: 7 days)

Also read ${REPO_DIR}/config/streams.yaml — the generic stream definitions. Skills are mid-migration from hardcoded stream names to iterating this file; for now /start-day loads it for visibility + runs a consistency check.

Streams ↔ sources consistency check (non-blocking)

DRIFT=$(python scripts/streams_check.py --json 2>/dev/null)
N_BLOCKING=$(echo "$DRIFT" | jq -r '.n_blocking // 0')
N_INFO=$(echo "$DRIFT" | jq -r '.n_info // 0')

If N_BLOCKING > 0, add a stream config drift warning to the briefing header in Step 7 (don't block the run; surface so the user can fix). If only INFO items, mention briefly and move on — this is expected when Notion has workspace-option drift relative to sources.yaml.

Full drift detail (if surfaced) lives in state/streams-drift-${TODAY}.json for inspection.

Step 1b: Pre-flight Validation (before pulling sources)

Calendar ↔ memory consistency check

Read ${STATE}/priorities.yaml and scan for any item whose notes mention an explicit upcoming meeting time, day, or phrase like "potentially Friday", "tomorrow", "this week".

For each flagged meeting, run a quick gws calendar +agenda --week --format json search and check whether a calendar event matches by title keyword AND falls within the implied window. If no match, add the item to a memory_calendar_gaps list. Do NOT block the briefing — show the gaps as a warning at the top of the briefing in Step 7.

Pending-writes audit

Glob ${REPO_DIR}/.context/*.json (top-level only — explicitly skip ${REPO_DIR}/.context/applied/, which holds files whose writes have already landed) and ${REPO_DIR}/.context/pending/*.json if that subdir exists.

For each file, read the top-level intent / pending / status field:

  • If the field is set to pending, awaiting_approval, or denied → add to pending_writes with category confirmed.
  • If no status field exists → add to pending_writes with category unverified and the note "verify push status — file may already be applied." Do not assert it is unwritten.
  • If the field is set to applied, done, completed → ignore.

Render in Step 7's briefing as "Pending writes from prior session", with the two categories visually distinguished. Suggest moving applied files to .context/applied/<name>-<YYYY-MM-DD>.json to silence future false positives.

The absence of a status field is not evidence of an unwritten payload — always treat as unverified, not unwritten.

If .context/ doesn't exist, skip silently.

Sync-sweep DLQ depth (optional)

Read ${STATE}/sync-sweep-retry-queue.yaml if present. This is the dead-letter queue for PATCH failures (5xx, 429, network) that have exhausted in-run retries.

Procedure:

  1. If the file does not exist → no flag emitted. Skip silently.
  2. Parse the file as YAML. Expected schema:
    queue:
      - entity_name: str
        notion_page_id: str
        payload: object
        attempts: int            # 1..3
        last_status: str         # 5xx | 429 | network | other
        first_failed: str        # ISO timestamp of first failure
  3. Malformed YAML graceful skip: log a one-line warning to today's log, continue with no flag. Do NOT crash, do NOT block the briefing.
  4. If queue is empty → no flag emitted.
  5. If queue is non-empty:
    • N = len(queue)
    • M = max(today - first_failed) in days
    • If M >= 3: emit warning sync-sweep DLQ: N items, oldest M days
    • Else: emit info sync-sweep DLQ: N items, oldest M days

Step 1c: Yesterday Catch-up Sync (bidirectional reconcile)

User checkboxes and the source systems (Google Tasks, Notion) drift apart in both directions. The dominant pattern is that the user closes tasks in the Google Tasks UI nightly and never ticks the daily-note [ ]. The inverse — daily-note [x] with the source still open — happens too but is rarer. Step 1c reconciles both directions, with gtasks / Notion treated as the authoritative source.

This direction matters for resilience: the dominant pull path (API → daily note) is a local file edit, which never fails. Only the rare push path (daily note → API) is exposed to API failures.

Procedure:

  1. Compute YESTERDAY = today minus 1 day (YYYY-MM-DD).
  2. Read ${VAULT}/daily/{YESTERDAY}.md. If it doesn't exist, skip this step.
  3. Scan every line matching ^- \[[ xX]\] (BOTH unchecked and checked). For each match, extract:
    • The visible task text
    • The checkbox state (checked or unchecked)
    • Any trailing HTML comment of the form <!-- gtask:<ID> --> or <!-- notion:<ID> --> — these are durable source IDs written by Step 9 when the daily note was created. Build a map: {source_id → {state, line_number, line_text}}.
  4. Read today's log file ${LOGS_DIR}/{TODAY}.md if it already exists — if a ### Catch-up Sync section is present from an earlier run, skip this step.
  5. Pull authoritative state once per source system:
    • gtask: one call gws tasks tasks list --params '{"tasklist":"<DEFAULT_TASKLIST_ID>","showCompleted":true,"showHidden":true,"updatedMin":"<YESTERDAY-1d>T00:00:00.000Z","maxResults":100}' --format json.
    • notion: GET https://api.notion.com/v1/pages/<ID> per ID.
  6. Reconcile each pair into one of four buckets:
    • pull_completions — source is completed/Done AND daily-note is [ ]. Action: mirror to [x] in YESTERDAY's daily note (local file edit, no API write). Dominant case.
    • push_completions — source is open AND daily-note is [x]. Action: PATCH source to completed. Rare; only path exposed to API failures.
    • both_match — no-op.
    • unverifiable — source unreachable (5xx, 401, timeout).
  7. For [x] items WITHOUT an embedded ID: record as manual_completions_no_source — informational only.
  8. If both pull_completions and push_completions are empty → skip silently. Otherwise surface separately in Step 7 and gate writes at Step 8b.

Failure handling: If Google Tasks or Notion is unreachable for the Step 5 pull, mark every ID from that system as unverifiable and continue. Never block the briefing on a sync check.

Step 1d: Build the Suppression Set (deprioritized / back-burner / snoozed)

Deprioritization decisions live in state/priorities.yaml and as free-text annotations inside the previous daily-note. They are NOT reflected in the source-system Status fields — a dropped Notion subtask is usually still Status: "Not started". Without an explicit suppression step, Step 3 and Step 5 will resurface them as actionable items.

Build a single SUPPRESSED_IDS set with the union of:

  1. priorities.yaml :: dropped_<recent-dates> — read every key matching dropped_YYYYMMDD whose date is within the last 14 days. Extract any bare UUID AND any embedded gtask: / notion: markers.
  2. priorities.yaml :: back_burner[] — each entry has a source and source_id. If source_id is non-null, add with reason back_burner since <moved_at>.
  3. priorities.yaml :: dormant_snooze[] — each entry has a page_id and until. If today <= until, add page_id. Else skip (expired).
  4. Yesterday's daily-note free-text annotations. For each line containing a <!-- gtask:ID --> or <!-- notion:ID --> comment, scan ±2 lines for any of these case-insensitive phrases:
    • off main status
    • back burner / backburned / back-burner
    • deprioritized / deprio
    • out of the picture
    • dropped / drop (whole-word)
    • snooze / snoozed
    • track-only / track only
    • not focusing on / not a focus
    • parked / park it
    • kill it
  5. Parent-task implication: if a Notion page_id is suppressed AND the live Master Tasks query returns subtasks whose Parent task relation points to that page_id, those subtask page_ids are ALSO suppressed transitively.

How SUPPRESSED_IDS is used downstream:

  • Step 3 (Notion query): filter out any page whose id is in SUPPRESSED_IDS.
  • Step 5 (Google Tasks): filter out any task whose id is in SUPPRESSED_IDS.
  • Step 6 (Top 3 scoring): suppressed items are excluded from the score pool entirely.
  • Step 7 (briefing): render a footer "Suppressed N items" with a one-line-per-bucket summary so the audit trail stays visible.

Failure modes:

  • Suppression should never throw. If priorities.yaml is malformed, log a one-line warning and proceed with whatever IDs were successfully extracted.
  • Phrase-matching is conservative on purpose. False positives (suppressing something that should be actionable) are the worse failure mode. When in doubt, do NOT suppress.

Step 2: Pull Google Calendar

Use the gws CLI to fetch calendar events via Bash tool.

gws calendar +agenda --today --format json
gws calendar +agenda --tomorrow --format json

Response shape:

{
  "count": N,
  "events": [
    {
      "calendar": "email@gmail.com",
      "start": "YYYY-MM-DDTHH:MM:SS-04:00",
      "end": "YYYY-MM-DDTHH:MM:SS-04:00",
      "summary": "Event title",
      "location": "optional address"
    }
  ]
}

Processing:

  • Tag each event with a stream using config/streams.yaml:
    • For each event, walk streams[] in declaration order and case-insensitively substring-match the event summary against each stream's keywords list. First-match-wins.
    • Events matching no keyword fall through to the stream with is_default: true.
  • Detect conflicts: overlapping timed events on the same day.

If gws calendar fails: Skip this section. Add "Google Calendar" to the skipped sources list. Continue with other sources.

Step 3: Pull Notion Databases

Use the Notion REST API via curl. The notion-api skill is installed with full reference docs at .agents/skills/notion-api/.

Authentication: The token is in $NOTION_API_TOKEN env var. All requests need:

-H "Authorization: Bearer $NOTION_API_TOKEN" \
-H "Notion-Version: 2025-09-03" \
-H "Content-Type: application/json"

After every Notion database query in this step: filter out any result page whose id appears in SUPPRESSED_IDS (built in Step 1d). Track the suppressed count per database for the Step 7 footer.

If $NOTION_API_TOKEN is empty or unset: Skip all Notion sections. Add "Notion" to the skipped sources list with message: "NOTION_API_TOKEN not set. Add it to .claude/settings.local.json under env." Continue with other sources.

For each database in notion_databases:

Master Tasks (primary)

curl -s -X POST "https://api.notion.com/v1/data_sources/{master_tasks_ds_id}/query" \
  -H "Authorization: Bearer $NOTION_API_TOKEN" \
  -H "Notion-Version: 2025-09-03" \
  -H "Content-Type: application/json" \
  -d '{
    "filter": {
      "and": [
        {"property": "Status", "status": {"does_not_equal": "Done"}}
      ]
    },
    "sorts": [{"property": "Due", "direction": "ascending"}],
    "page_size": 50
  }'

From the response results array, parse each page's properties:

  • Status: properties.Status.status.name — values: "Not started", "In progress", "Waiting", "Done"
  • Due date: properties.Due.date.start
  • Workspace: properties.Workspace.select.name
  • Assignee: properties.Assignee.people[].name
  • Task (Title): properties.Task.title[0].plain_text (the title property is called "Task", not "Name")
  • Updated: last_edited_time on the page object

Identify items by status:

  • In progress / Not started / Waiting — from Status
  • Overdue: Due in the past AND Status != "Done"
  • Stale: last_edited_time older than staleness_days (7d) AND Status != "Done"

Tag each item by stream using the Workspace field value matched against streams[].workspace_values in config/streams.yaml. A page's Workspace string belongs to stream S if it appears in S.workspace_values. Walk streams in declaration order; first match wins. Unmatched / null Workspace falls through to the stream with is_default: true.

IMPORTANT: Do NOT inherit a stream assignment from a Notion parent task name. Check the actual Workspace field on each item. If Workspace is null, infer from item context against streams[].keywords the same way calendar tagging does (first-match-wins in declaration order). Parent-task names can mislead — always check each item individually.

Provider CRM (secondary)

curl -s -X POST "https://api.notion.com/v1/data_sources/{provider_crm_ds_id}/query" \
  -H "Authorization: Bearer $NOTION_API_TOKEN" \
  -H "Notion-Version: 2025-09-03" \
  -H "Content-Type: application/json" \
  -d '{"page_size": 50}'
  • Check for contacts needing follow-up: Last Contact > provider_followup_days (14d)
  • Check pipeline items by stage field

Activity Log (secondary)

curl -s -X POST "https://api.notion.com/v1/data_sources/{activity_log_ds_id}/query" \
  -H "Authorization: Bearer $NOTION_API_TOKEN" \
  -H "Notion-Version: 2025-09-03" \
  -H "Content-Type: application/json" \
  -d '{
    "filter": {
      "property": "Date",
      "date": {"on_or_after": "<3 days ago in YYYY-MM-DD>"}
    },
    "page_size": 20
  }'
  • Recent activities (last 3 days) for context
  • Note any items with a non-empty "Next Action" field

Meeting Notes (secondary)

curl -s -X POST "https://api.notion.com/v1/data_sources/{meeting_notes_ds_id}/query" \
  -H "Authorization: Bearer $NOTION_API_TOKEN" \
  -H "Notion-Version: 2025-09-03" \
  -H "Content-Type: application/json" \
  -d '{
    "filter": {
      "timestamp": "last_edited_time",
      "last_edited_time": {"on_or_after": "<yesterday in YYYY-MM-DD>"}
    },
    "sorts": [{"property": "Date", "direction": "descending"}],
    "page_size": 20
  }'

For each result:

  • Meeting name: properties["Meeting name"].title[0].plain_text
  • Date: properties.Date.date.start
  • Summary: properties.Summary.rich_text[0].plain_text (preview first 200 chars)
  • Workspace: properties.Workspace.select.name — null = needs triage
  • Related Tasks: properties["Related Tasks"].relation[] — count of linked Master Tasks

Surface in the briefing under "Recent Meeting Recaps (24h)", grouped by Workspace. Any meeting with Workspace = null goes under "Untagged — needs triage" with the suggestion to run /capture-meeting on it.

Triage hint: infer likely Workspace from attendee names + title keywords. Do NOT auto-tag in read mode — only suggest.

Confidence requirement (BOUNDED + GROUNDED): Every triage suggestion includes a 0.0–1.0 confidence score:

  • 1.0 if a single workspace keyword matches title AND attendee list is single-stream
  • 0.8 if attendee list strongly implies one stream
  • 0.5 if title keyword weak match OR attendees span 2 streams
  • < 0.5 → render as "low confidence — verify manually" with NO suggested workspace

Display format: suggested: **{workspace}** (conf {0.85}) — based on {evidence summary}.

Action-item extraction status (per meeting):

For each Meeting Notes row, check Related Tasks relation count and the titles of the linked tasks:

  • Related Tasks count = 0 → untreated: recap exists but no Master Tasks wrapped from it. Surface under "Meetings needing action-item extraction" with → /capture-meeting <page-id> hint.
  • Related Tasks count > 0 but no linked task title starts with [Meeting] → partially treated: action items exist but no parent-task wrapper.
  • Related Tasks includes a [Meeting] … row → wrapped: show subtask completion progress like 5/8 subtasks done.

The "Meetings needing action-item extraction" list should also expand to recurring topic-page appends if their last ## YYYY-MM-DD — block is newer than the most recent [Meeting] parent task that links to them.

Coverage check (workspace-wide, not just Meeting Notes DB):

Meeting recaps can land in two patterns:

  1. As new Meeting Notes DB entries (one meeting → one DB row).
  2. As appended sections inside existing topic pages — the recap URL appears as block content inside the topic page, not as a DB row.

For each meeting URL referenced in state/priorities.yaml (or in the prior day's log) that is NOT already represented in the Meeting Notes DB query above, run a workspace-wide search before declaring a sync gap:

curl -s -X POST "https://api.notion.com/v1/search" \
  -H "Authorization: Bearer $NOTION_API_TOKEN" \
  -H "Notion-Version: 2025-09-03" \
  -H "Content-Type: application/json" \
  -d '{"query":"<8-char-fragment>","page_size":10}'

If the search returns 0 results AND the Meeting Notes DB also has no match → declare "Sync gap" and suggest pushing from the source app.

If the search returns >=1 result → the meeting IS in Notion as an appended section. Note its parent page in the briefing; do NOT flag a sync gap.

If a specific database returns 404 object_not_found: The database likely isn't shared with the integration. Warn: "Database {name} not accessible — share it with your Notion integration." Continue with others.

Handle pagination: If has_more is true, make additional requests with start_cursor from next_cursor. Limit to 3 pages max per database.

Step 4: Scan Obsidian Vault

Read the local vault at ${VAULT} using the Read and Glob tools.

Inbox items: Glob ${VAULT}/inbox/ and list each file as unprocessed.

Notes tagged #review: Grep for #review across ${VAULT}/notes/ and ${VAULT}/ (frontmatter tags: or inline #review).

Recent notes: Glob ${VAULT}/notes/ modified in the last 3 days.

If the vault path doesn't exist or folders are missing: Report what was expected vs. found. Add "Obsidian" to skipped sources if vault is completely inaccessible.

Step 5: Pull Google Tasks

gws tasks tasklists list
gws tasks tasks list --params '{"tasklist":"<TASKLIST_ID>"}'

Look up your default tasklist ID once via gws tasks tasklists list and store it in config/sources.yaml.

Processing:

  • Filter to tasks with status: "needsAction" (incomplete)
  • Filter out any task whose id appears in SUPPRESSED_IDS (Step 1d).
  • Flag tasks with a due date that is today or in the past as overdue
  • Note parent-child relationships (subtasks have a parent field)
  • Sort by: overdue first, then by position

If gws CLI fails or is not found: Skip this section. Add "Google Tasks" to skipped sources.

Step 6: Score and Rank Top 3 Outcomes

Collect all actionable items from Steps 2-5 and score each:

SignalPoints
Has due date today or is overdue+3
Marked high-priority (if priority_field exists in config)+2
Has a related calendar event today (title keyword match)+2
Stale: not updated in 7+ days+1
Blocks someone else (has a non-owner assignee)+2

Ranking rules:

  • Sort by score descending
  • Pick top 3
  • Break ties by rotating through streams[].key (in declaration order from config/streams.yaml) to prevent one stream from dominating
  • Include the score breakdown for each item so reasoning is visible

Stream starvation guard (deterministic):

STREAM_KEYS is the list of streams[].key values read from config/streams.yaml in declaration order:

1. raw_top3 = first 3 items after sort-by-score-desc
2. raw_top3_streams = set of stream keys in raw_top3
3. for each stream key S in STREAM_KEYS:
     oldest_stale[S] = max(item.days_stale for item in all_items
                            where item.stream == S and item.days_stale >= 7)
4. starved = streams where oldest_stale[S] is defined AND S not in raw_top3_streams
5. if starved is non-empty:
     pick S_starved = argmax(oldest_stale[S] for S in starved)
     candidate = highest-score item in all_items where stream == S_starved
     final_top3 = [raw_top3[0], raw_top3[1], candidate]
   else:
     final_top3 = raw_top3
6. include reason in Step 7: "Slot #3 promoted from {S_starved} (stale {N}d)"

This is deterministic code, not LLM judgment. Do NOT improvise.

The starvation guard exists because pure score-only ranking can starve streams that lack due dates — those tasks never win on the +3 due-date signal. The guard injects them on age alone.

Items that can be scored:

  • Notion Master Tasks items
  • Google Tasks items
  • Provider CRM follow-ups (stale contact = overdue signal)
  • Calendar prep items (upcoming meeting = urgency signal)

Step 6b: Notion 24-Hour Change Audit

Before composing the briefing, query all three Notion databases for pages edited in the last 24 hours (use last_edited_time timestamp filter with on_or_after set to yesterday's date). Also run a workspace-wide search sorted by last_edited_time descending (page_size 20) to catch changes in databases not explicitly configured.

Categorize changes as:

  • Completed: items whose Status changed to Done
  • Created: new pages (created_time within last 24 hours)
  • Edited: existing pages that were modified

Extract actionable items from these changes: missing next steps, new tasks without due dates, completed work that triggers follow-up actions.

Step 7: Compose and Display Briefing

Output the briefing to the terminal in this format:

# Daily Briefing — {TODAY} ({day of week})

_Run: {RUN_ID} · Mode: {MODE}_

{If catchup_sync is non-empty:}
## Catch-up sync from yesterday
{Items checked off in yesterday's daily note that are still open in their source system.}
- {task text} — {Google Tasks | Notion} still open. Will close on approval.

{If memory_calendar_gaps is non-empty:}
## Memory ↔ Calendar Gaps
- {item} — promised meeting not on calendar in {window}.

{If pending_writes is non-empty:}
## Pending writes from prior session

**Confirmed pending:**
- {file path} — {intent summary}.

**Unverified (status field absent — may already be applied):**
- {file path} — {payload summary}. Search for matching content; if found, move to `.context/applied/`.

## Awaiting Others
{Items from priorities.yaml `awaiting:` section}
- {title} — waiting on {person} since {first_carried} ({N} days).

## Calendar
{Today's events with times, stream tags, and conflict flags}
{If no events: "No events scheduled today."}

## Top 3 Outcomes
1. {item} — score: {N} ({breakdown}) [{stream}] {source_marker}
2. {item} — score: {N} ({breakdown}) [{stream}] {source_marker}
3. {item} — score: {N} ({breakdown}) [{stream}] {source_marker}

{If slot #3 was promoted by the starvation guard:}
   _Slot #3 promoted from {starved_stream} (stale {N}d)._

{source_marker format (GROUNDED — every fact must trace to a source):
  - Notion item: render as `[notion:ABCD…]` where ABCD is the first 4 chars of the page_id
  - Google Task: render as `[gtask:XYZW…]`
  - Calendar prep: `[cal]`
  - Derived/manual: `[derived]`
  Full ID is also embedded as an HTML comment for /end-day Step 4b parsing.}

## Actionable Items by Stream

{Iterate `streams[]` from `config/streams.yaml` in declaration order. For each
stream, render a `### {stream.display_name}` header followed by the items
tagged with that stream's key. Omit streams with no items.}

### {streams[].display_name}
- [ ] {each actionable item with context}

## Recent Meeting Recaps (24h)
{Meetings synced in the last 24 hours, grouped by Workspace.}

### {Workspace}
- {Meeting name} ({Date}) — {Summary preview...} | {N} linked tasks | [page](url)

### Untagged — needs triage
- {Meeting name} ({Date}) — suggested: **{inferred workspace}** — run `/capture-meeting <page-id>`

### Meetings needing action-item extraction
- {Meeting name} ({Date}) — **untreated, no Master Tasks linked** — `/capture-meeting <page-id>`

### Meetings already wrapped (subtask progress)
- {Meeting name} ({Date}) — `[Meeting] {parent title}` — {completed}/{total} subtasks done

## Notion Changes (Last 24 hrs)
**Completed:** {items marked Done}
**Created:** {new pages}
**Edited:** {modified pages}

## Provider Follow-ups Needed
{Contacts not reached in 14+ days from CRM}

## Skipped Sources
{List any sources that were unavailable with reason}

## Suppressed (audit trail — Step 1d)
{Render only if SUPPRESSED_IDS is non-empty. Group by reason bucket.}
- {item title} — {reason}

Actionable items rules:

  • Every item gets a markdown checkbox - [ ] for completion tracking
  • Group ALL actionable items by stream
  • Tag items with source in parentheses when helpful: (Notion), (Tasks), (CRM)
  • Embed durable source IDs as HTML comments at end of each line. Obsidian hides them, but /end-day and the next day's catch-up sync use them for exact-ID matching:
    • Google Tasks: - [ ] Run errand (Tasks, due today) <!-- gtask:62ViTSu0nQnqrwPl -->
    • Notion: - [ ] Draft proposal (Notion) <!-- notion:abc-123-def -->
    • Derived items (calendar prep, manual additions): no comment.
    • One ID per checkbox.
  • Items with no clear stream tag go under the is_default: true stream
  • Overdue and stale items go into their stream section, not a separate section

Formatting rules:

  • Keep it scannable. Bullet points, not paragraphs.
  • Bold the stream tag on each item using the stream's key
  • Use relative dates: "2 days overdue", "stale 12 days"
  • Calendar conflicts get a warning marker

Step 8: Trust Gate

After displaying the briefing, use AskUserQuestion to present options:

Question: "What would you like to do with this briefing?"

Options:

  • A) Create Obsidian daily note — Write today's briefing to ${VAULT}/daily/{TODAY}.md
  • B) Just the briefing — No writes
  • C) Both daily note + mark items in progress — Write daily note AND ask which Top 3 items to mark "In progress" in Notion

Default recommendation: Option A.

Step 8b: Catch-up sync confirmation (only if Step 1c produced reconcile work)

Two trust gates can fire here, presented separately and in order.

Gate 1 — Pull mirror (file edit only, no API risk):

If pull_completions is non-empty:

Question: "{M} items closed in gtasks/Notion are still [ ] in yesterday's daily note. Mirror to [x]?"

Options:

  • Yes, mirror all — in-place edit YESTERDAY's daily note: replace - [ ] with - [x] on each matching line. No API call.
  • Pick which — checkbox list, mirror only confirmed.
  • Skip — leave the daily note as-is.

Mirroring is a pure local file edit and cannot fail on API issues.

Gate 2 — Push completions (API writes, fallible):

If push_completions is non-empty, prompt AFTER Gate 1 completes:

Question: "Yesterday's daily note has {N} [x]'d items still open in their source. Push completions now?"

Options:

  • Yes, sync all — execute writes
  • Pick which to sync — checkbox list
  • Skip — leave them; they'll resurface in today's briefing

Execute approved syncs before Step 9's daily-note write.

For each Google Tasks item (use gws tasks tasks patch):

gws tasks tasks patch \
  --params '{"tasklist":"<DEFAULT_TASKLIST_ID>","task":"<gtask_id>"}' \
  --json '{"status":"completed"}' \
  --format json

For each Notion page:

curl -s -X PATCH "https://api.notion.com/v1/pages/<notion_id>" \
  -H "Authorization: Bearer $NOTION_API_TOKEN" \
  -H "Notion-Version: 2025-09-03" \
  -H "Content-Type: application/json" \
  --max-time 60 \
  -d '{"properties": {"Status": {"status": {"name": "Done"}}}}'

Log every sync attempt in today's log under ### Catch-up Sync so re-runs are idempotent.

Failure handling on push path (gtasks 500):

  1. First attempt fails with HTTP 500 → wait 15 seconds, retry once.
  2. Second attempt also 500 → record the gtask ID in state/gtask-retry-queue.yaml under pending_retries:.
  3. Next /start-day's Step 1c drains the queue at the start of Step 5.
  4. Other failures (404, 401, non-500 4xx, timeout): report once, do not retry.

The retry budget is intentionally small — start-day must not block on a flaky API.

Step 9: Execute Approved Actions

If creating Obsidian daily note (Option A or C):

Write to ${VAULT}/daily/{TODAY}.md using this template:

---
date: {TODAY}
day: {day of week}
tags: [daily, briefing]
---

# Daily Briefing — {TODAY} ({day of week})

## Calendar
{events}

## Top 3 Outcomes
{scored items}

---

## Actionable Items by Stream

### {streams[].display_name}
- [ ] {item with context} <!-- gtask:<task_id> -->
- [ ] {item with context} <!-- notion:<page_id> -->
- [ ] {derived/manual item with no source ID — no comment}

---

## Recent Meeting Recaps (24h)
{Meeting recaps, grouped by Workspace, with action-item link counts.}

---

## Notion Changes (Last 24 hrs)
**Completed:** {items}
**Created:** {items}
**Edited:** {items}

---

## End of Day Review

_Fill in at EOD — what got done, what carries forward._

**Completed:**
- [ ] _(move completed items here)_

**Carries forward to tomorrow:**
- [ ] _(move incomplete items here)_

**Notes / Decisions made today:**
-

If the file already exists, append a new timestamped section:


---

## Afternoon Briefing ({current time})
{new briefing content}

If marking items in progress (Option C):

For each Top 3 item that came from Notion, update its Status:

curl -s -X PATCH "https://api.notion.com/v1/pages/{page_id}" \
  -H "Authorization: Bearer $NOTION_API_TOKEN" \
  -H "Notion-Version: 2025-09-03" \
  -H "Content-Type: application/json" \
  -d '{"properties": {"Status": {"status": {"name": "In progress"}}}}'

Confirm each update with the user before executing.

Optional: Mirror daily note to a Notion page

This gives you a phone-readable copy of today's briefing. Page is overwritten wholesale on every run — last writer wins.

  1. Read mobile_briefing_page_id from ${CONFIG}. If unset, skip silently.
  2. Read the just-written ${VAULT}/daily/{TODAY}.md.
  3. Strip the YAML frontmatter block.
  4. Replace the page's content using the Notion MCP:
    mcp__claude_ai_Notion__notion-update-page
      page_id: <mobile_briefing_page_id>
      command: "replace_content"
      new_str: <stripped markdown body>
      properties: {}
      content_updates: []
  5. If the Notion call fails (5xx / 401 / timeout) → append a one-line ### Mobile Mirror entry to ${LOGS_DIR}/{TODAY}.md noting the failure reason. Do not retry. Do not block.

If the Notion MCP is not loaded in the current session: skip silently.

Always: Save to logs

Write the briefing to ${LOGS_DIR}/{TODAY}.md:

---
date: {TODAY}
sources_available: [{list of sources that responded}]
sources_skipped: [{list of sources that failed or were unavailable}]
---

## Morning Briefing ({current time})

{full briefing content from Step 7}

If the log file already exists (re-run), append a new timestamped section instead of overwriting.

Step 10: Emit Telemetry (OBSERVED)

After all writes complete, emit one JSONL row to logs/_telemetry.jsonl:

DURATION_MS=$(( $(date +%s%3N 2>/dev/null || python -c "import time; print(int(time.time()*1000))") - RUN_START_MS ))

scripts/telemetry.sh start-day "${RUN_ID}" "${DURATION_MS}" "${STATUS}" "$(python -c "
import json
print(json.dumps({
    'mode': '${MODE}',
    'sources_ok': ${SOURCES_OK_JSON},
    'sources_skipped': ${SOURCES_SKIPPED_JSON},
    'top3_scores': ${TOP3_SCORES_JSON},
    'starvation_swap': ${STARVATION_SWAP_FLAG},
    'pending_writes_count': ${PENDING_WRITES_COUNT},
    'pull_completions': ${PULL_COMPLETIONS_COUNT},
    'push_completions': ${PUSH_COMPLETIONS_COUNT},
    'meetings_needing_extraction': ${MEETINGS_UNTREATED_COUNT},
    'note_written': ${NOTE_WRITTEN_BOOL},
})
")"

STATUS is ok (all sources responded), partial (>=1 source skipped), or failed (no briefing rendered).

This row enables /weekly-review and future health dashboards. Never edit or delete telemetry rows — append-only.

Error Handling

  • scripts/check_mode.sh exits 1 (locked): Refuse to run. Do NOT emit telemetry.
  • scripts/check_mode.sh exits 2 (unreadable): Fail closed — treat as locked.
  • gws CLI not found or auth expired: Skip Calendar and/or Tasks gracefully. Suggest gws auth login --scopes calendar,tasks.
  • gws API not enabled (403): Warn user to enable the API in Google Cloud Console, skip source.
  • Notion API timeout: Use --max-time 60 to timeout after 60 seconds, skip that source.
  • Notion API auth failure (401): Warn user to check NOTION_API_TOKEN, skip source.
  • Empty database response: Not an error — display "No items found in {database name}".
  • Bad database ID: Warn "Database {name} not found — check data_source ID in config/sources.yaml".
  • Never retry automatically. Report clearly and continue with available sources.
  • Never crash on a missing source. The briefing runs with whatever is available. Telemetry status = partial.

Success Criterion

Running /start-day in draft mode produces a single briefing that:

  • Cites every Top 3 item with a source marker (notion / gtask / cal / derived)
  • Groups actionable items by stream from config/streams.yaml
  • Surfaces any pending writes, calendar/memory gaps, and suppressed items
  • Optionally writes a daily note containing source-ID HTML comments so the next morning's catch-up sync can reconcile against the source systems.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.