Construction Agent — Email → Project Management Pipeline skill

Construction company AI agent — orchestrates email (Google Workspace), project management (JobTread Pave API), and file routing for a construction business.

by hewi333·MIT license·★ 122 Stars on the repo·GitHub ↗

Use now

Inside this skill

SKILL.md · the author's own words
# Construction Agent — Email → Project Management Pipeline

## Overview

A reference implementation of an AI agent that runs the back-office of a construction company. The agent orchestrates between three systems…

1. **Email** (Google Workspace / Gmail) — where leads, estimates, and project documents arrive
2. **File storage** (Google Drive) — where email attachments are auto-dumped by an existing script
3. **Project management** (JobTread, or similar PM system) — where files and tasks need to end up

The agent bridges the gap: it monitors Drive for new files, downloads them, uploads them to the PM system, and notifies the owner — all thr…

**For who:** A construction or trades business (general contractor, remodeler, specialty trade) where:
- The owner gets project documents via email
- Email attachments are dumped to a Drive folder (by a separate script or filter)
- Files need to get into a PM system (JobTread, Procore, Buildertrend, etc.)

Word-for-word excerpt, not a result. Read the full SKILL.md ↓

Files of Construction Agent — Email → Project Management Pipeline

hewi333/main1 file shown
SKILL.md
Show the full text190 lines

Construction Agent — Email → Project Management Pipeline

Overview

A reference implementation of an AI agent that runs the back-office of a construction company. The agent orchestrates between three systems a construction business already uses:

  1. Email (Google Workspace / Gmail) — where leads, estimates, and project documents arrive
  2. File storage (Google Drive) — where email attachments are auto-dumped by an existing script
  3. Project management (JobTread, or similar PM system) — where files and tasks need to end up

The agent bridges the gap: it monitors Drive for new files, downloads them, uploads them to the PM system, and notifies the owner — all through text messages the owner already reads.

For who: A construction or trades business (general contractor, remodeler, specialty trade) where:

  • The owner gets project documents via email
  • Email attachments are dumped to a Drive folder (by a separate script or filter)
  • Files need to get into a PM system (JobTread, Procore, Buildertrend, etc.)
  • The owner doesn't want to manually download and re-upload everything

When to Use

  • A customer or subcontractor emails a project document (plans, permits, invoices, photos)
  • The owner asks "what's in the inbox?" or "what came in today?"
  • A scheduled cron checks for new files to route to the PM system
  • The owner wants a morning briefing: today's tasks, deadlines, new emails
  • The owner needs a project status check from the PM system

The Pattern

Every action follows the same philosophy as all Mom-n-Pop skills:

  1. Agent drafts — the agent reads email, prepares file uploads, drafts replies
  2. Owner approves — the owner gets a Telegram message, confirms before anything is sent
  3. Agent executes — only after approval does anything go out

The exception is file routing (Drive → PM system), which runs autonomously on a cron because it's non-destructive (files are moved, not deleted; originals are preserved). The owner still gets a notification of what was routed.

Core Workflows

1. Email → Drive → Project Management Pipeline

This is the main pipeline. Many construction businesses already have a script that dumps email attachments to a Drive "raw inbox" folder. The agent completes the circuit:

Email arrives → existing script dumps attachment to Drive →
Agent polls Drive folder (every 15 min via cron) →
Downloads attachment locally (temp) →
Uploads to PM system via API →
Deletes local temp file →
Moves Drive file to "processed" folder →
Sends Telegram notification to owner

Why the agent does this: The previous setup got files into Drive, but getting them from Drive into the PM system required manual download + upload. The agent automates that last mile.

2. Email Triage
  • Reads Gmail inbox (via Google API)
  • Summarizes unread emails
  • Drafts replies (dual-approval: agent drafts, owner approves via Telegram or Gmail)
  • Flags urgent items
3. Project Management Queries
  • Query projects, tasks, schedules from the PM system
  • Create/update tasks
  • Daily briefing: today's tasks, upcoming deadlines
  • Weekly summary: project progress, completed tasks
4. Daily Briefing (cron, 8 AM)
  • New emails from overnight
  • Today's tasks from the PM system
  • Upcoming deadlines
  • Files processed

API Integrations

Google Workspace
  • Auth: OAuth2 (one-time browser flow, token persists at ~/.hermes/cache/google_token.json)
  • APIs: Gmail, Google Drive, Google Calendar
  • Scopes: gmail.readonly, gmail.send, drive.readonly, drive.file, calendar.readonly
  • Setup: See references/google-workspace-setup.md
JobTread (Pave API)

JobTread is a construction-specific PM system. The Pave API pattern applies to similar construction PM tools (Procore, Buildertrend, etc.) — adapt the query language to your specific system.

  • Endpoint: POST https://api.jobtread.com/pave
  • Auth: Grant key (from JobTread Settings → Integrations → API)
  • Query Language: Pave (similar to GraphQL, but not identical)
  • Grant keys expire after 3 months of inactivity — must use regularly
  • Setup: See references/jobtread-api-setup.md

Environment Variables

All set in ~/.hermes/.env (chmod 600):

# Google Workspace
GOOGLE_CLIENT_ID=your_client_id_here
GOOGLE_CLIENT_SECRET=your_client_secret_here
[email protected]

# JobTread (or your PM system)
JOBTREAD_GRANT_KEY=your_grant_key_here
JOBTREAD_ORG_ID=your_org_id_here

# Google Drive (for attachment pipeline)
GOOGLE_DRIVE_RAW_FOLDER_ID=your_raw_folder_id
GOOGLE_DRIVE_PROCESSED_FOLDER_ID=your_processed_folder_id

Cron Jobs

Name Schedule What
Daily Briefing 0 8 * * * Email summary, today's tasks, deadlines
Drive Poll */15 * * * * Check Drive for new attachments → upload to PM system
Weekly Summary 0 9 * * 1 Project progress, completed tasks, files processed

Key Scripts

Script Purpose Requires
scripts/google_mail.py Gmail read/draft/send (Google API) GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, GOOGLE_MAILBOX
scripts/jobtread_pave.py JobTread Pave API client JOBTREAD_GRANT_KEY, JOBTREAD_ORG_ID
scripts/drive_to_jobtread.py Email→Drive→PM pipeline Google Drive + JobTread credentials
scripts/daily_briefing.py Morning briefing generator All of the above

Adapting to Other PM Systems

If you use Procore, Buildertrend, CoConstruct, or another construction PM system instead of JobTread:

  1. Replace scripts/jobtread_pave.py with a client for your PM system's API
  2. Update the query/mutation structure in scripts/drive_to_jobtread.py to use your PM system's file upload endpoint
  3. Update scripts/daily_briefing.py to query your PM system's task/project schema
  4. Update the environment variables to match your PM system's auth method

The pipeline pattern (Drive → download → upload → move → notify) stays the same.

Pitfalls

  1. PM system API keys can expire — JobTread grant keys expire after 3 months of inactivity. A daily briefing cron that queries the API keeps it active. If your PM system has similar expiration, keep it active with scheduled calls.

  2. Google OAuth tokens refresh automatically but can fail if the refresh token is revoked (password change, admin revocation). Monitor for auth errors and re-run the authentication flow when needed.

  3. Pave is NOT GraphQL — it's similar but different syntax. Inputs are passed after the $ symbol, and empty braces {} mean "return this field." Check the API explorer for your PM system before assuming GraphQL syntax works.

  4. File routing is non-destructive — the pipeline moves Drive files to a "processed" folder rather than deleting them. This is intentional. If your pipeline deletes, add a confirmation step.

  5. Headless VPS auth — the one-time Google OAuth flow needs a browser. Use SSH port forwarding (ssh -L 8080:localhost:8080) to complete the flow from your local machine, or run the auth on your local machine and copy the token file to the VPS.

  6. Large file handling — construction documents (plans, permits) can be large. The Drive → PM upload uses a temp directory; ensure sufficient disk space. Clean up temp files after each run.

Verification Checklist

  • Google Cloud Project created with Gmail, Drive, Calendar APIs enabled
  • OAuth credentials created (Desktop app type)
  • Environment variables set: GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, GOOGLE_MAILBOX
  • One-time OAuth authentication completed (token saved)
  • Test: google_mail.py read --count 5 returns inbox
  • JobTread (or PM system) grant key obtained
  • Environment variables set: JOBTREAD_GRANT_KEY, JOBTREAD_ORG_ID
  • Test: jobtread_pave.py projects returns project list
  • Drive folder IDs identified (raw + processed)
  • Test: drive_to_jobtread.py --dry-run shows pending files
  • Test: drive_to_jobtread.py processes one file end-to-end
  • Daily briefing cron configured and sending
  • Drive poll cron configured and running
  • outlook-graph — Microsoft 365 email alternative (if the business uses Outlook instead of Google Workspace)
  • crm-lite — lightweight CRM if the PM system doesn't handle lead tracking
  • lead-to-payment — full sales pipeline orchestration
  • references/google-workspace-setup.md — step-by-step Google OAuth setup
  • references/jobtread-api-setup.md — JobTread Pave API guide
1---
2name: construction-agent
3description: "Construction company AI agent — orchestrates email (Google Workspace), project management (JobTread Pave API), and file routing for a construction business. Handles email triage, attachment routing to JobTread, project status, task management, and daily briefings via Telegram. Reference implementation for a construction/trades business with an existing email→Drive→PM pipeline."
4version: "1.0.0"
5author: Hermes Agent
6license: MIT
7metadata:
8 hermes:
9 tags: [construction, trades, jobtread, google-workspace, email, project-management, small-business]
10 related_skills: [outlook-graph, crm-lite, lead-to-payment]
11---
12 
13# Construction Agent — Email → Project Management Pipeline
14 
15## Overview
16 
17A reference implementation of an AI agent that runs the back-office of a construction company. The agent orchestrates between three systems a construction business already uses:
18 
191. **Email** (Google Workspace / Gmail) — where leads, estimates, and project documents arrive
202. **File storage** (Google Drive) — where email attachments are auto-dumped by an existing script
213. **Project management** (JobTread, or similar PM system) — where files and tasks need to end up
22 
23The agent bridges the gap: it monitors Drive for new files, downloads them, uploads them to the PM system, and notifies the owner — all through text messages the owner already reads.
24 
25**For who:** A construction or trades business (general contractor, remodeler, specialty trade) where:
26- The owner gets project documents via email
27- Email attachments are dumped to a Drive folder (by a separate script or filter)
28- Files need to get into a PM system (JobTread, Procore, Buildertrend, etc.)
29- The owner doesn't want to manually download and re-upload everything
30 
31## When to Use
32 
33- A customer or subcontractor emails a project document (plans, permits, invoices, photos)
34- The owner asks "what's in the inbox?" or "what came in today?"
35- A scheduled cron checks for new files to route to the PM system
36- The owner wants a morning briefing: today's tasks, deadlines, new emails
37- The owner needs a project status check from the PM system
38 
39## The Pattern
40 
41Every action follows the same philosophy as all Mom-n-Pop skills:
42 
431. **Agent drafts** — the agent reads email, prepares file uploads, drafts replies
442. **Owner approves** — the owner gets a Telegram message, confirms before anything is sent
453. **Agent executes** — only after approval does anything go out
46 
47The exception is file routing (Drive → PM system), which runs autonomously on a cron because it's non-destructive (files are moved, not deleted; originals are preserved). The owner still gets a notification of what was routed.
48 
49## Core Workflows
50 
51### 1. Email → Drive → Project Management Pipeline
52 
53This is the main pipeline. Many construction businesses already have a script that dumps email attachments to a Drive "raw inbox" folder. The agent completes the circuit:
54 
55```
56Email arrives → existing script dumps attachment to Drive →
57Agent polls Drive folder (every 15 min via cron) →
58Downloads attachment locally (temp) →
59Uploads to PM system via API →
60Deletes local temp file →
61Moves Drive file to "processed" folder →
62Sends Telegram notification to owner
63```
64 
65**Why the agent does this:** The previous setup got files into Drive, but getting them from Drive into the PM system required manual download + upload. The agent automates that last mile.
66 
67### 2. Email Triage
68 
69- Reads Gmail inbox (via Google API)
70- Summarizes unread emails
71- Drafts replies (dual-approval: agent drafts, owner approves via Telegram or Gmail)
72- Flags urgent items
73 
74### 3. Project Management Queries
75 
76- Query projects, tasks, schedules from the PM system
77- Create/update tasks
78- Daily briefing: today's tasks, upcoming deadlines
79- Weekly summary: project progress, completed tasks
80 
81### 4. Daily Briefing (cron, 8 AM)
82 
83- New emails from overnight
84- Today's tasks from the PM system
85- Upcoming deadlines
86- Files processed
87 
88## API Integrations
89 
90### Google Workspace
91 
92- **Auth:** OAuth2 (one-time browser flow, token persists at `~/.hermes/cache/google_token.json`)
93- **APIs:** Gmail, Google Drive, Google Calendar
94- **Scopes:** `gmail.readonly`, `gmail.send`, `drive.readonly`, `drive.file`, `calendar.readonly`
95- **Setup:** See `references/google-workspace-setup.md`
96 
97### JobTread (Pave API)
98 
99JobTread is a construction-specific PM system. The Pave API pattern applies to similar construction PM tools (Procore, Buildertrend, etc.) — adapt the query language to your specific system.
100 
101- **Endpoint:** `POST https://api.jobtread.com/pave`
102- **Auth:** Grant key (from JobTread Settings → Integrations → API)
103- **Query Language:** Pave (similar to GraphQL, but not identical)
104- **Grant keys expire after 3 months of inactivity** — must use regularly
105- **Setup:** See `references/jobtread-api-setup.md`
106 
107## Environment Variables
108 
109All set in `~/.hermes/.env` (chmod 600):
110 
111```bash
112# Google Workspace
113GOOGLE_CLIENT_ID=your_client_id_here
114GOOGLE_CLIENT_SECRET=your_client_secret_here
115[email protected]
116 
117# JobTread (or your PM system)
118JOBTREAD_GRANT_KEY=your_grant_key_here
119JOBTREAD_ORG_ID=your_org_id_here
120 
121# Google Drive (for attachment pipeline)
122GOOGLE_DRIVE_RAW_FOLDER_ID=your_raw_folder_id
123GOOGLE_DRIVE_PROCESSED_FOLDER_ID=your_processed_folder_id
124```
125 
126## Cron Jobs
127 
128| Name | Schedule | What |
129|------|----------|------|
130| Daily Briefing | `0 8 * * *` | Email summary, today's tasks, deadlines |
131| Drive Poll | `*/15 * * * *` | Check Drive for new attachments → upload to PM system |
132| Weekly Summary | `0 9 * * 1` | Project progress, completed tasks, files processed |
133 
134## Key Scripts
135 
136| Script | Purpose | Requires |
137|--------|---------|----------|
138| `scripts/google_mail.py` | Gmail read/draft/send (Google API) | `GOOGLE_CLIENT_ID`, `GOOGLE_CLIENT_SECRET`, `GOOGLE_MAILBOX` |
139| `scripts/jobtread_pave.py` | JobTread Pave API client | `JOBTREAD_GRANT_KEY`, `JOBTREAD_ORG_ID` |
140| `scripts/drive_to_jobtread.py` | Email→Drive→PM pipeline | Google Drive + JobTread credentials |
141| `scripts/daily_briefing.py` | Morning briefing generator | All of the above |
142 
143## Adapting to Other PM Systems
144 
145If you use Procore, Buildertrend, CoConstruct, or another construction PM system instead of JobTread:
146 
1471. Replace `scripts/jobtread_pave.py` with a client for your PM system's API
1482. Update the query/mutation structure in `scripts/drive_to_jobtread.py` to use your PM system's file upload endpoint
1493. Update `scripts/daily_briefing.py` to query your PM system's task/project schema
1504. Update the environment variables to match your PM system's auth method
151 
152The pipeline pattern (Drive → download → upload → move → notify) stays the same.
153 
154## Pitfalls
155 
1561. **PM system API keys can expire** — JobTread grant keys expire after 3 months of inactivity. A daily briefing cron that queries the API keeps it active. If your PM system has similar expiration, keep it active with scheduled calls.
157 
1582. **Google OAuth tokens refresh automatically** but can fail if the refresh token is revoked (password change, admin revocation). Monitor for auth errors and re-run the authentication flow when needed.
159 
1603. **Pave is NOT GraphQL** — it's similar but different syntax. Inputs are passed after the `$` symbol, and empty braces `{}` mean "return this field." Check the API explorer for your PM system before assuming GraphQL syntax works.
161 
1624. **File routing is non-destructive** — the pipeline moves Drive files to a "processed" folder rather than deleting them. This is intentional. If your pipeline deletes, add a confirmation step.
163 
1645. **Headless VPS auth** — the one-time Google OAuth flow needs a browser. Use SSH port forwarding (`ssh -L 8080:localhost:8080`) to complete the flow from your local machine, or run the auth on your local machine and copy the token file to the VPS.
165 
1666. **Large file handling** — construction documents (plans, permits) can be large. The Drive → PM upload uses a temp directory; ensure sufficient disk space. Clean up temp files after each run.
167 
168## Verification Checklist
169 
170- [ ] Google Cloud Project created with Gmail, Drive, Calendar APIs enabled
171- [ ] OAuth credentials created (Desktop app type)
172- [ ] Environment variables set: `GOOGLE_CLIENT_ID`, `GOOGLE_CLIENT_SECRET`, `GOOGLE_MAILBOX`
173- [ ] One-time OAuth authentication completed (token saved)
174- [ ] Test: `google_mail.py read --count 5` returns inbox
175- [ ] JobTread (or PM system) grant key obtained
176- [ ] Environment variables set: `JOBTREAD_GRANT_KEY`, `JOBTREAD_ORG_ID`
177- [ ] Test: `jobtread_pave.py projects` returns project list
178- [ ] Drive folder IDs identified (raw + processed)
179- [ ] Test: `drive_to_jobtread.py --dry-run` shows pending files
180- [ ] Test: `drive_to_jobtread.py` processes one file end-to-end
181- [ ] Daily briefing cron configured and sending
182- [ ] Drive poll cron configured and running
183 
184## Related
185 
186- [outlook-graph](../outlook-graph/) — Microsoft 365 email alternative (if the business uses Outlook instead of Google Workspace)
187- [crm-lite](../crm-lite/) — lightweight CRM if the PM system doesn't handle lead tracking
188- [lead-to-payment](../lead-to-payment/) — full sales pipeline orchestration
189- `references/google-workspace-setup.md` — step-by-step Google OAuth setup
190- `references/jobtread-api-setup.md` — JobTread Pave API guide

Discussion

Alternatives

⚡ NEXUS Quick-Start Guide> Get from zero to orchestrated multi-agent pipeline in 5 minutes.Business & ops · MITclean-cut — the step-1 cut pipelineStep 1 of the AI Video Editor pipeline — turn raw talking-head footage into a clean master cut. Use when the user wants to "clean cut", "cut the raw footage", "remove filler / dead air / bad takes", "tighten the pacing", produce cuts.json, run the cut editor, or render a cleaned preview/master for a video-N project in this repo. Covers audio extraction, AssemblyAI transcription, authoring cuts.json (keeps/cuts/fluff categorized), the cut policy (content-aggressive, pause-natural ~0.5s), QA + review docs, the local cut-editor UI, tight/natural previews, the final 4K60 render, and producing edited-transcript.json as the handoff to /make-tsx. Not for building TSX overlays (that is /make-tsx) or the raw TSX authoring rules (that is vidtsx-2d-generator).Sales & ecommerce · MITVocaloid-style MV pipeline (手書き / 文字PV)Make an original animated music video (MV / PV) for a song from its audio file plus lyrics, in the Vocaloid / J-pop lyric-video tradition: 手書き/tegaki (V家手书, 手描きMV, ボカロPV), 文字PV and kinetic typography (リリックモーション, リリックビデオ, 歌詞動画, 歌词视频, 动态歌词), anime-illustration MVs with an original character — for any mood, from dark ballads to bright upbeat summer pop. Renders to MP4 with a deterministic Canvas2D/WebGL2 engine in a headless browser: JIZURA lyric motion, AI-generated art, optional Blender toon 3D, beat-locked editing, 9:16 vertical/Shorts version. Use it whenever the user wants a music video, MV, PV, lyric video or beat-synced animation for a song, e.g. make an MV for my song", "turn this track into a lyric video", "给这首歌做个MV/PV", "做个V家手书", "この曲のMVを作って", ボカロPV作って", "縦型ショートも" — even if they only give a .wav/.mp3 and say "make a cool video for it". Not for editing existing footage or clip compilations.Sales & ecommerce · MITCRM-Lite — Lightweight SQLite CRM for Small BusinessUse when tracking customer interactions, managing leads, or building a lightweight CRM for small businesses without dedicated CRM software. Stores contacts, leads, activities, estimates, and communications in local SQLite.Sales & ecommerce · MIT