← Blog·March 25, 2026·12 min read·Engineering

Engineering Focus Time: How We Built an AI System That Actually Protects Deep Work

The research on focus time is unambiguous. Cal Newport's work on deep work, Gloria Mark's studies on context switching at UC Irvine, and Microsoft's own Work Trend Index all converge on the same finding: uninterrupted blocks of 2+ hours are where meaningful cognitive work happens, and the average knowledge worker gets fewer than 2 of them per week.

The typical response from productivity tools is a "focus mode" toggle. Block notifications for an hour. Put a status on Slack. Hope nobody schedules over your blocked time.

This doesn't work because it treats focus time as a one-time decision rather than an ongoing resource to be managed. We built Planck's focus time system around a different premise: focus time is a budget, and the AI agent is the budget enforcer.

The focus time model

Planck tracks focus time across three dimensions:

Goal: How many hours of focus time the user wants per week. Defaults to 10, configurable from 5 to 25. This is the target the agent optimizes toward.

Achievement: How many focus hours the user actually got. Tracked daily in the focus_time_daily table with goal_hours, achieved_hours, block_count, and fragmentation_score.

Fragmentation: Not all focus time is equal. Three 40-minute blocks don't substitute for one 2-hour block. The fragmentation score penalizes interruptions and short blocks, giving the agent (and the user) a quality metric alongside the quantity metric.

Fragmentation scoring

The fragmentation score is calculated as:

fragmentation = (interruptions / total_focus_hours) * weight_interruptions
              + (short_blocks / total_blocks) * weight_short_blocks

Where:

  • interruptions = number of meetings that fall within or adjacent to focus blocks
  • short_blocks = blocks under 45 minutes
  • Weights are tuned to produce a 0-100% score

A score under 30% is green (healthy). 30-60% is amber (fragmented). Over 60% is red (focus time exists on paper but is too chopped up to be useful).

This matters because most calendar tools count a 20-minute gap between meetings as "free time." It's not. It's recovery time. The fragmentation score captures this reality.

How the agent protects focus time

The protection system operates at three layers: proactive creation, defensive alerts, and active rescheduling.

Layer 1: Proactive block creation

When a user sets a focus goal (say, 15 hours/week) and a preference (say, mornings), the agent:

  1. Scans the upcoming week for available morning slots
  2. Creates focus blocks that sum to the weekly goal
  3. Distributes blocks to minimize fragmentation (prefer 2-3 hour contiguous blocks over many small ones)
  4. Respects existing constraints: working hours, lunch period, existing meetings

The agent doesn't just find empty slots. It finds optimal slots. A 3-hour block on Tuesday morning scores higher than three 1-hour blocks scattered across the week, even though both total 3 hours.

The scoring function considers:

  • Contiguity: Longer unbroken blocks score higher
  • Time preference: Morning blocks score higher for "morning" preference users
  • Distribution: Spreading focus across the week scores higher than clustering it all on one day
  • Buffer zones: Blocks with 30+ minutes of buffer before the next meeting score higher

Layer 2: Defensive alerts

When a new meeting request comes in, the proactive alert system evaluates it against the user's focus time:

Conflict detection: Does this meeting overlap with a focus block? If yes, flag it.

Focus risk assessment: Even if the meeting doesn't directly overlap, does it fragment an adjacent focus block? A 30-minute meeting at 10am between two focus blocks (8-10am and 10:30am-12pm) effectively destroys 4 hours of focus time by breaking it into two sub-optimal blocks with a context switch in the middle.

Goal impact: If the user has achieved 8 of their 15-hour weekly goal and it's Thursday, how much does accepting this meeting jeopardize hitting the target? The agent calculates remaining required focus hours vs. remaining available slots.

Overload detection: More than 6 hours of meetings in a single day triggers an overload alert regardless of focus time impact. Research from Microsoft's Human Factors Lab shows that cognitive performance drops sharply after 5-6 hours of meetings, making any remaining "focus time" that day effectively useless.

Layer 3: Active rescheduling

This is where the trust level matters most. At trust levels 2-3, the agent can actively rearrange the schedule to protect focus time:

  1. Identify meetings marked as "flexible" (movable within day, week, or any time)
  2. Calculate whether rescheduling them would improve the focus time outcome
  3. Propose (trust level 2) or execute (trust level 3) the reschedule
  4. Update all affected calendars and notify attendees

Example: You have a focus block from 9am-12pm. A teammate schedules a flexible 1:1 at 10am. The agent detects the conflict, finds that your teammate is also free at 2pm, and moves the 1:1 to the afternoon. Your 3-hour focus block is preserved.

The flexible events system

Not all meetings are equal. A board meeting can't move. A casual 1:1 probably can. Planck lets users (or the agent) tag events with flexibility levels:

  • day: Can move within the same day
  • week: Can move within the same week
  • any: Can move to any available time

When the agent needs to protect focus time, it considers flexible events as candidates for rescheduling. The agent won't move a non-flexible event, and it respects the flexibility boundary (a "day" event won't get pushed to the next day).

This creates a simple but powerful prioritization: fixed events anchor the schedule, flexible events flow around them, and focus blocks are treated as semi-fixed (the agent defends them but will yield to genuinely important conflicts).

Cross-calendar focus propagation

For users with multiple calendar accounts (common for contractors, consultants, or people with separate work/personal calendars), focus time on one calendar needs to be visible on others.

Planck's cross-calendar sync handles this via sync rules. A user can create a rule like:

When Calendar A has a focus block, mark that time as "busy" on Calendar B.

This prevents the classic problem of protecting focus time on your work calendar while your personal calendar still shows you as available. The sync is bidirectional if configured that way, handling events are created as "mirror" entries with a reference back to the source.

What the data shows

After implementing this system, the patterns we observed:

Users who set a focus goal achieve 70-85% of it. Without the goal-tracking system, self-reported focus time achievement is around 40-50%. The difference isn't the AI doing magic. It's the combination of proactive block creation (making focus time the default) and defensive alerts (making it harder to unconsciously erode).

Fragmentation scores drop 40-50% within two weeks. As the agent learns the user's patterns and the user marks more events as flexible, the schedule naturally consolidates. Fewer short gaps, more contiguous blocks.

Meeting count doesn't change significantly. This surprised us. We expected the focus time system to reduce total meetings. It doesn't. It reshapes when meetings happen, concentrating them into meeting-dense windows and leaving clean focus blocks. Total meeting hours stay roughly the same, but they're distributed better.

Design decisions and trade-offs

Why a weekly goal, not daily?

Daily goals are too rigid. Some days are naturally meeting-heavy (Monday standups, Friday reviews). A weekly goal lets the agent compensate: if Monday has zero focus time, it can add extra blocks on Tuesday and Wednesday.

Why not auto-decline?

Some calendar tools auto-decline meetings that conflict with focus blocks. We chose not to do this by default because the social cost of declining meetings is real. Instead, the agent flags the conflict and proposes alternatives. The user (or the agent at trust level 3) makes the final call with full context.

Why fragmentation matters more than hours

A user who hits 15 hours of "focus time" but in 20-minute fragments between meetings got zero deep work done. The fragmentation score ensures the system optimizes for quality of focus time, not just quantity. This is the metric that actually correlates with the user feeling like they had a productive week.

Why the agent creates blocks proactively

The default state of an empty calendar is "available for meetings." This is the wrong default. If the agent pre-creates focus blocks at the start of the week, the default becomes "focused unless overridden." Meetings still happen, but they require conscious trade-offs rather than passive accumulation.

Building this yourself

The core components:

  1. Focus time tracker: A table that records daily goal, achieved hours, block count, and fragmentation score. Update it via a nightly job or real-time as events change.

  2. Availability calculator with focus awareness: Your availability endpoint should treat focus blocks as "busy" by default, with an option to override for high-priority requests.

  3. Alert system: Check every new/modified event against focus blocks. Flag conflicts, fragmentation risks, and goal impact.

  4. Flexible event metadata: A simple tag on events indicating whether and how far they can move. Store this alongside the event, not in a separate system.

  5. Rescheduling engine: Given a set of flexible events and a focus time goal, find the arrangement that maximizes contiguous focus blocks. This is a constraint satisfaction problem, not an AI problem. You can solve it with straightforward heuristics.

The AI agent orchestrates these components. It doesn't replace them. The intelligence is in knowing when to invoke each component and how to communicate the trade-offs to the user. The components themselves are deterministic.

Focus time isn't a feature. It's a resource. Treat it like one.