Documentation Index
Fetch the complete documentation index at: https://labs.prompthon.io/llms.txt
Use this file to discover all available pages before exploring further.
Summary
This starter extends the customer-support case study into a connector-first local workflow: read Gmail through the Codex Gmail connector, classify customer issues with deterministic rules first, persist them in SQLite, and review or approve replies through a local dashboard.Status
starter
Source code: case-studies/examples/customer-email-assist-starter
Why It Exists
The earlier Customer Support Email Agent Starter shows the safer draft-only boundary. This follow-on starter keeps the same local-first posture, but adds the operational surfaces teams usually need next: Gmail connector import, local SQLite state, customer review queues, and a deterministic dashboard.Related Lab Pages
Folder Structure
Quick Start
Install dependencies and run the local dashboard:Connect Gmail button after creating the Google OAuth client:
approved_to_send for the Codex Gmail connector runner. If local OAuth is
connected, the dashboard can execute the deterministic send path immediately
after the undo countdown.
Minimal-Token Boundary
This starter is designed to minimize model usage.- Hard logic handles Gmail connector import shaping, HTML stripping, signature trimming, quoted history removal, customer matching, SQLite persistence, analytics, and queue state.
- The intended skill workflow reserves model usage for only two JSON-only
surfaces:
- understanding cleaned inbound customer messages
- generating template-field JSON for reply drafts
- The rendered reply text and HTML are produced locally from fixed templates, not from free-form model output.
Included Sample Files
skill/SKILL.md: Codex workflow for the two model-backed steps plus the deterministic CLI commandssrc/lib/email-processing.ts: HTML cleanup, quoted-history trimming, and heuristic classification helperssrc/lib/repository.ts: SQLite queries for issues, customers, analytics, and review actionssrc/lib/sync.ts: deterministic inbound batch import, draft preparation, and draft rendering coordinationapp/page.tsx: Next.js App Router dashboard with issues, analysis, customer review, and customer managementREADME.md: direct Gmail OAuth setup, dashboard connection flow, and optional runtime variables
Constraints
- Gmail authentication is expected to happen through the Codex Gmail connector in the normal workflow.
- Direct Gmail OAuth exists as an advanced adapter for standalone local runs.
Its required values are
GOOGLE_CLIENT_IDandGOOGLE_CLIENT_SECRET; the dashboard connection flow stores the refresh token in local state. - Attachments and inline images are ignored in v1.
- The dashboard is single-operator and local-machine oriented.
import-prepared-batchuses deterministic fallback understanding and drafting so the starter remains runnable without a live model call.npm run setup-localresets the local SQLite database to an empty state.
Verification
npm run lintnpm run testnpm run build
Next Steps
- Insert a real model-backed
understandstep betweenprepare-inbound-batchandpersist-understanding. - Insert a model-backed
draft-fieldsstep betweenprepare-draft-batchandrender-save-drafts. - Add a fixture-driven Gmail replay suite with sample labeled threads.
