Inspiration

Sales teams already have valuable context, but it is scattered across spreadsheets, draft emails, delivery tools, and follow-up notes. A language model can improve outreach, yet giving it permission to choose recipients or send autonomously creates a trust problem. We built SalesView AI Operator as a human-controlled closed loop from sales judgment to delivery, engagement, and the next decision.

What it does

  1. SalesView reads the selected account, value hypothesis, campaign status, and current draft from Google Sheets.
  2. GPT-5.6 Sol uses the OpenAI Responses API with Structured Outputs to propose a subject and body, explain the reasoning, and surface risks or missing context.
  3. A human reviews and approves the exact content.
  4. Deterministic code verifies the approved-content hash, recipient, and idempotency key before a test delivery.
  5. Mail Engagement sends through Gmail and owns delivery state, idempotent retries, estimated opens, CTA clicks, reply synchronization, and owner verification.
  6. It returns only the delivery ID, state, human engagement signals, reply time, retriability, and a detail link—not the recipient, subject, or body.
  7. SalesView feeds those signals back to GPT-5.6 so it can propose the next action for human review.

The current product is deliberately human-in-the-loop. It does not claim that autonomous sending is complete.

Architecture

We separated responsibilities across two private repositories:

  • SalesView is the decision and approval cockpit. It owns Google Sheets context, GPT-5.6 proposals, content review, approval hashes, engagement feedback, and next-action suggestions.
  • Mail Engagement is the deterministic delivery and engagement system of record. It owns Gmail delivery, retries, tracking, reply sync, and ownership checks. It does not make AI decisions.

SalesView calls POST /api/codex/v1/messages/send with the mail:send scope and GET /api/codex/v1/deliveries/{deliveryId} with mail:lookup. GPT-5.6 runs only in SalesView.

How we built it

  • SvelteKit, Svelte 5, and TypeScript for both services
  • OpenAI Responses API with GPT-5.6 Sol and Structured Outputs
  • Google Sheets as the sales operations source of truth
  • Gmail API plus Mail Engagement for idempotent delivery and engagement tracking
  • Auth.js with Google OAuth for owner-only production access
  • Vercel for deployment
  • Vitest and Playwright for regression and end-to-end coverage

How we used Codex

Codex collaborated across both repositories: understanding the existing architecture, turning product boundaries into an implementation plan, implementing and reviewing the cross-service contract, writing regression tests, addressing review findings, deploying, and verifying the production flow. It also helped create the sanitized demo and submission documentation.

Challenges we ran into

The hardest problem was preserving human authority across two systems. We separated test and live delivery IDs, used deterministic idempotency keys, stored a hash of the approved content, and failed closed when the content or recipient changed. We also had to keep Mail Engagement privacy-preserving: lookup responses expose operational metadata, never the message content.

A second challenge was integrating with an existing Google Sheet without overwriting legacy sales data. Production verification surfaced a legacy blank timestamp and missing AI operator columns. We traced the failures from the live API response back to the Sheet contract, added regression coverage, deployed the fixes, and completed the approval-to-test-send loop with an operator-owned address.

Accomplishments that we're proud of

  • GPT-5.6 proposes; deterministic code enforces safety; a human retains final authority.
  • Demo mode cannot send to the selected organization's real address.
  • SalesView and Mail Engagement have explicit, independently scoped responsibilities.
  • Latest local verification passed: SalesView 362 tests plus 10 Playwright scenarios; Mail Engagement 637 tests, 19 add-on tests, 11 plugin tests, and 4 Playwright scenarios, along with type checks, lint, and production builds.
  • The demo uses sanitized synthetic data and does not contact a real sales prospect.

What we learned

The most useful AI workflow was not full autonomy. It was a narrow, inspectable contract where the model explains a proposal, deterministic software constrains side effects, and an operator remains accountable. Structured Outputs made that division testable.

What's next

We will evaluate guarded automation only after multiple successful operator-approved runs. Any future automation will require separate environment and Sheet switches, per-campaign permission, daily limits, a global lock, and a one-recipient canary. Real-recipient sending will remain disabled until explicitly approved.

Built With

  • auth.js
  • codex
  • email-tracking
  • gmail-api
  • google-sheets-api
  • gpt-5.6-sol
  • human-in-the-loop
  • mail-engagement
  • openai-responses-api
  • playwright
  • structured-outputs
  • svelte-5
  • sveltekit
  • typescript
  • vercel
  • vitest
Share this project:

Updates