Skip to main content
Build Blog

Build log: the morning stack

aiosagents
A steel tray holding colored metal cards in a fixed order, a steel coffee cup beside it.

The morning stack is the run I start the day with. A briefing, the meetings, the mail, and a check that the machines I depend on are up. I built it because I was re-deciding the shape every morning, and a morning note I cannot trust is worse than no note.

The code below is from the skill files as they stood on the day, cut down to the part that matters. Client names, the name of the task system and my town are swapped for brackets. Nothing else is changed.

The week of January 12

The first fix was not about content. The briefing skills wrote to a notes database at the end, and when a long session compacted in the middle, everything gathered so far was gone. So every briefing skill got the same gate at the top.

briefing skill, Jan 14
## ⛔ MANDATORY: SAVE BEFORE COMPLETING

This skill is NOT complete until data is SAVED to Notion.
DO NOT return success until notion_update_page_properties succeeds.
Unsaved data WILL BE LOST on context compaction.

The week of January 19

The briefing got a fixed section order: weather, summary, calendar, chat, mail, tasks, actions. Action items became checkboxes instead of bullets, and the skill got a validation step that checks the order before it saves. I am not picking the sections again each day. The same weekend I added the skills that write a task, log the planning note, save a session, and log time. The briefing is what those skills feed.

The week of February 2

A week later the briefing was still skipping things, so I wrote down the five failures I kept seeing and put them at the top of the skill, with what the failure looks like.

daily-briefing skill, Feb 2
## 5 Blocking Requirements

| # | Requirement | Failure Without It |
|---|-------------|-------------------|
| 1 | Weather via WebSearch | Weather section skipped entirely |
| 2 | Email SUBJECTS listed | Only shows "15 unread" with no details |
| 3 | [Task system] CLICKABLE LINKS | Task titles are plain text |
| 4 | Action Items as CHECKBOXES | Uses bullet points user can't check off |
| 5 | Teams section ALWAYS present | Section omitted when no results |

That table is a list of the ways the model took the easy path. It did not stop the easy path. It made it easier to see.

The week of February 9

The briefing started reading yesterday's recap first, so anything I left open the night before shows up in the morning as a follow-up. If there is no recap, it says so and moves on.

On February 13 the separate skills became one run. The order, and where each piece saves:

start-the-day skill, Feb 13
| Step | Skill                                 | Save To                      | Context Save |
|------|---------------------------------------|------------------------------|--------------|
| 1    | /daily-briefing                       | Notion Daily Briefing DB     | Yes          |
| 2    | /standup-prep --save                  | Notion Progress Reports DB   | Yes          |
| 3    | /health-dashboard --add-to-briefing   | Appended to today's briefing | Yes          |
| 4    | /meeting-prep --all                   | Displayed in conversation    | Yes          |

A session save between every step. The run is long enough that the session will compact somewhere in the middle, and I wanted it to pick up from the last save instead of starting over.

The week of February 16

Mail, calendar, chat and notes each got a short command-line tool that returns a summary instead of the raw response, and on February 20 nine skills moved over to them. The session should see a summary. Mail also learned whose move a thread is, so a thread I am waiting on does not look like one I ignored.

The week of April 20

On April 20 the morning run produced an audit with about 20 failures across 5 phases, and they came down to 4 causes. A phase did the work inline instead of calling the skill that already does it. A task link was invented from a placeholder, and only one of those links was real. Sources were skipped, including a certificate check that was only a search of the inbox. And the run had none of its own guardrails: no saves between steps, no handoff, no budget check.

I do not want a morning note I have to distrust, so I started a second version that same day. It was 18 files, about 3,500 lines, in 11 commits. The first version stayed. I already had a morning that depended on it.

The center of the second version is one loop every phase ends with. Check that what it was supposed to produce exists and is shaped right. If not, fetch again without the cache and check again. After 3 tries, say DEGRADED and keep going. Do not pretend.

workflow-contract.md, Apr 20
for attempt in 1..3:
    artifacts = collect_emitted_artifacts()
    missing = []
    malformed = []
    for required in contract:
        if not artifacts.has(required.path):
            missing.append(required)
        elif not required.validate(artifacts[required.path]):
            malformed.append(required)
    if missing == [] and malformed == []:
        return PhaseResult(status=OK, attempt=attempt)
    if attempt < 3:
        for src in this_phase.data_sources:
            src.refresh(no_cache=True)  # bypass any cache
        continue
return PhaseResult(status=DEGRADED, missing=missing, malformed=malformed, attempts=3)

The check caught its own contract the same afternoon. The audit step told the model to look a task up with a flag the task tool does not have. The live run failed on it, and the fix was to check every link against the task data already fetched in that session instead.

Two days later, on April 22, the meeting prep invented 4 calendar events and attached real meeting quotes to them. That one was not a missing check. A newer model was making things up more often, and other people were reporting the same thing. So I added a hook that remembers every ID a tool actually returned in the session, and warns when a note I am writing contains one it never saw.

fabrication guard hook, Apr 22
"""
PostToolUse hook: anti-fabrication ID guard.

1. Session presence: every tool result that contains ID-shaped tokens
   gets its IDs added to a session-scoped set. On writes the content is
   scanned for the same token shapes and any ID not previously seen
   this session is flagged.

2. Shape check: fields named meeting_id, calendar_id, event_id,
   task_id, page_id must contain values that match a known ID shape.
   Human-readable placeholders ([name]-16:00) trip this check
   regardless of session history.

Warnings go to stderr. Exit code is always 0.
"""
RE_NOTION_UUID = re.compile(r"\b([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\b")

It warns. It does not block. The verify loop is what blocks.

The week of April 27

On April 28 the new briefing came back OK. The calendars, the mail, the meetings and the task list were actually read, and the task links were real.

The whole stack did not. The second version wrote 5 verify reports, April 20 to April 28, and all 5 say DEGRADED overall. On the 28th it was the standup and the health check. The verify loop did what I built it to do. It said so.

The week of July 20

Twice in 8 days a chat or mail call hung for 30 minutes until the session gave up. On July 20 it was a chat read. On July 28 it was a mail lookup. The tool layer underneath had no timeout that worked, and the morning stack makes the same calls. I still need the messages. I do not need them on a path that can sit there for half an hour.

I planned it on July 28: move those reads into the command-line tool, which has its own timeout, and stop depending on the call that hangs. It shipped on August 16, with the write side too. The commit says it removes the last hard dependency on the call that hangs.

The week of September 7

On September 13 three of the morning skills, the health check, the news note and the daily reading, ran on a cheaper model. Each one runs in its own copy of the session, so the cheaper model stays inside that skill and does not carry into the steps after it.

skill frontmatter, Sep 13
model: sonnet
effort: high
context: fork
background: false

It lasted one live run for the health check. The cheaper model skipped the certificate check, miscounted errors, called untracked items tracked, pulled a stale number from a week before, and wrote 59 lines against 112 on the session model. The run had to check everything again and add a correction table, so it cost more than it saved. That came out the same evening. The next morning I ended the whole pilot. Output I have to review and correct costs my time, and my time costs more than tokens. The rule now is no cheaper model unless it is shown to match the one it replaces.

What I kept were two fixes the pilot found. The health check did not say how to find today's briefing, and the reading skill read a briefing draft that only existed in the calling conversation. Both read from disk now.

The week of October 5

On October 9 I built the morning by hand, then ran it again through every skill, and compared the two.

The skills were better on the standup and the health check. My hand-built page said one mail failed to send. It was 12. It said three code reviews were waiting on me. Two of them already had a closed response.

I was better on the mail. The triage tool read 105 of 249 messages and found one action item, and that one was an advertisement. It missed all 5 real ones. The mail tool reads the newest 50 messages per account and has no way to ask for more. The work-item query never sent the version the server asks for, so every call came back bad, and a second project tree was invisible. The standup said I had made no changes.

The verify gate passed both versions. It cannot tell them apart. A check that something exists is not a check that it is right.

The skill text was fixed that morning. Triage results now have to match a count against a full pull, the cap that cut 10 real action items is gone, and a day with no meetings says so instead of writing nothing. The two tools themselves were not changed in the repos as of this post.

Where it is

The briefing has a fixed shape. The second version checks itself and says DEGRADED when it should. The hang is closed. The cheaper model is gone. What is still open is the October 9 finding: two tools return a wrong answer without failing, and a verify gate that only checks that a file exists will pass them. The next step is a gate that checks a count against the source.

Built Something with AI?

I'll spend 30 minutes telling you what my production-readiness review would flag.