Skip to main content

Leave Agent

Code location: product/mr-people-agents/leave/ (build) + MadisonReed/mr-people automations/leave-feed/ and automations/leave-notify/ (live components) Status: Partially live. Some components have migrated to the mr-people repo. Uses AI: Limited. One Claude call per certification document, and it's disabled by default.

The absolute rule

This agent has the highest sensitivity of the three. Leave of absence touches pay, benefits, job protection, and legal compliance (FMLA, ADA, state-specific leave laws). One wrong decision can create litigation.

The hard floor: Entitlement decisions, ADA accommodation decisions, certification sufficiency judgments, approval/denial, COBRA benefit elections — these are human-owned, always. The agent prepares, surfaces, routes, and reconciles. It never decides.

Four components

1a. Legion merge (weekly)

What it does: Merges three weekly Legion scheduling reports into a single consolidated leave file. This combined file is what PulpStream needs to calculate FMLA eligibility (12-month lookback) and Oregon-specific leave (6-month lookback).

Status: Superseded. This component now lives in the mr-people repo as automations/leave-feed/. The implementation:

  • An Apps Script (running as cmprssn@madison-reed.com) consolidates the three Legion reports weekly
  • A GitHub Action (leave-feed-sftp) couriers the file to PulpStream's SFTP server
  • First live upload happened July 13, 2026

The version in product/mr-people-agents/leave/ is kept for reference but isn't the live code.

1b. Leave reconciliation (weekly)

What it does: Compares leave status between PulpStream (the leave management system) and Paylocity (the employee database). If an employee is on leave in PulpStream but shows as active in Paylocity (or vice versa), the agent flags it. The comparison is direction-agnostic: mismatches in either direction get flagged, and a human decides which system is correct and where to make the fix.

Data source: CSV exports from both PulpStream and Paylocity. The agent reads files, not APIs. The code isolates the PulpStream data-fetch in a function called fetchPulpRows_ so it can be swapped to an API call later if PulpStream ever opens one up (Q11 decision).

Status: Ready (file-based, deterministic).

1c. Return-to-work (RTW) reminders (daily)

What it does: Every day, the agent scans leave records for:

  • Upcoming RTW dates — employee is returning from leave soon; managers and HR need to prepare (system access restoration, schedule updates, fitness-for-duty clearance if required)
  • Overdue RTW dates — employee was supposed to return but hasn't; needs follow-up

Reminders route to the relevant manager and HR contact. The human confirms the return-to-work and handles any extensions.

Status: Ready (deterministic, no AI).

1d. Certification pre-screen (on-demand)

What it does: When an employee submits an FMLA or ADA certification document (medical documentation from their healthcare provider), this component checks if the form is complete. It looks at each required field and marks it as present, missing, or blank.

It makes one Claude API call per document to read the form and extract a completeness checklist. The prompt is narrow: just check if fields are filled in. The agent explicitly cannot and does not:

  • Judge whether the medical condition qualifies for leave
  • Decide if the certification is sufficient
  • Approve or deny anything
  • Assess the validity of what a doctor wrote

The completeness checklist routes to a leave specialist who makes the actual sufficiency determination.

Status: Disabled by default. The PRESCREEN_ENABLED flag is false. It's gated on Q15: an evaluation of whether the bounded Claude call behaves reliably enough on real certification documents. Until that evaluation is done and passed, this component stays off.

Live components (in mr-people repo)

These have already migrated from the build repo to the team's own repo:

Leave feed (automations/leave-feed/)

  • Apps Script consolidates 3 Legion reports weekly
  • GitHub Action couriers to PulpStream SFTP
  • All secrets set, end-to-end tested, running live since July 13

Leave tracker ingest (automations/leave-feed/ — PulpStream ingest)

  • PulpStream emails two daily exports (LOA + ADA cases) to cmprssn@madison-reed.com
  • Apps Script runPulpstreamIngest (9:30am trigger) parses emails and syncs into Grecia's tracker spreadsheet
  • Snapshot-override contract: Grecia's manual edits always win. Closed rows freeze. Stale history never appends.
  • Live since July 20, running autonomously each morning

Leave notifications (automations/leave-notify/)

  • 15-minute watcher cycle monitors the leave tracker for status changes
  • Routes notifications to the right managers (GM, District Manager, Regional Manager, HR Business Partner) via Slack DMs
  • Uses Grecia's own notification templates (encoded from her "Slack LOA Templates" document)
  • Extension notifications included
  • Slack app: "People Team Notifications" / @peopleteambot
  • Live in rehearsal since July 21: daily previews to a private test channel. Waiting on Grecia walkthrough (week of July 27) for:
    • Live tracker share + ID swap
    • Fitness-for-duty rule confirmation
    • Denial notification policy
    • DM membership rules
    • Status vocabulary alignment
    • Two go-live property flips

Data flow

Legion (scheduling system)
↓ 3 weekly CSV reports
Apps Script (leave-feed) consolidates
↓ Combined leave file
PulpStream SFTP (via GitHub Action courier)

PulpStream
↓ 2 daily email exports (LOA + ADA)
Apps Script (ingest) parses emails
↓ Syncs to Grecia's tracker spreadsheet (her edits preserved)

Leave tracker
↓ 15-minute watcher detects status changes
Slack DMs to relevant managers
(GM, DM, RM, HRBP resolved from census email to Slack accounts)

PulpStream + Paylocity CSV exports
↓ Leave reconciliation agent
↓ Diffs status between systems
Exception Queue (direction-agnostic mismatches)
↓ Human decides which system is correct

Open items

ItemStatusNotes
Grecia walkthroughScheduled week of July 27Go-live for notifications depends on this. Need her sign-off on tracker share, FFD rule, denial policy, DM membership, status vocab
Q11: PulpStream data sourcePendingFile-based vs API. PulpStream has no public API, so file-based is likely the long-term answer. fetchPulpRows_ is the isolated swap point if this changes
Q15: Cert pre-screen evalPendingBlocks enabling the certification completeness checker. Need to evaluate if the Claude call is reliable enough on real medical forms
Legion merge schemaGapReport names, merge keys, LOA system file format, SFTP target identity need to be documented in the spreadsheet tabs
Cert checklist fieldsNeeds compliance ownerRequired-field list per certification type is a compliance/legal decision, not a technical one

Key files (build repo)

FileWhat it does
leave_lib.jsPure logic: Legion merge, leave-status diff (PulpStream vs Paylocity), RTW upcoming/overdue calculations, pre-screen summary construction
prescreen.jsCompleteness checklist schema and prompt for the bounded Claude call
Code.gsI/O: reads CSVs, calls Claude (when enabled), writes exceptions and audit log

Audit logging

DOL-survivable (Department of Labor). Every plumbing read, merge, reconciliation delta, RTW reminder sent, pre-screen invocation, and missed/failed run is logged. Retention: never delete (pending legal confirmation on exact policy).