HKPhase 1

Technical Implementation Plan

Implementation Plan

Download Markdown

This document defines the recommended plan for the Headkount Build and Launch phase.

The estimated delivery period is 12 weeks. The schedule starts after contract signature, kickoff payment, and required access.

Build target

The Build phase will deliver one production application for scheduling and daily operations.

Users
  |
  v
Next.js application on Vercel
  |
  +----> Typed commands through oRPC and Effect
  |
  v
Postgres on AWS RDS
  |
  +----> Electric Sync ----> TanStack DB ----> Live interface
  |
  +----> Schedule Optimizer
  |
  +----> Ingestion and retailer workers on AWS
  |
  +----> Activity history and observability

Technology

AreaTechnologyPurpose
Web applicationNext.js, React, and Tailwind CSSProvides the Headkount interface.
Web hostingVercelBuilds and serves the web application.
DatabaseAWS RDS Postgres and DrizzleStores all durable application records.
Live dataElectric Sync and TanStack DBSends committed records to the interface.
CommandsoRPC and EffectValidates access, input, errors, and business rules.
AuthenticationBetter AuthManages accounts, sessions, invitations, and roles.
Schedule generationDeterministic TypeScript OptimizerCreates Schedule Versions from approved inputs and rules.
AI AgentAI SDK and typed toolsReads records and prepares approved commands.
Background workAWS workersRuns imports, portal providers, reconciliation, and alerts.
FilesAmazon S3Stores protected imports and source evidence.
MonitoringOpenTelemetry, Loki, Tempo, and GrafanaConnects logs and traces to Users, commands, and workers.

Environments

EnvironmentPurposeExternal access
LocalDevelopment with an isolated Postgres and Electric stackLocal test data only
StagingAcceptance, migration rehearsal, portal reads, and dry-run actionsRead-only or approved test access
ProductionLive Headkount operationsApproved production access

Staging and Production use separate databases, credentials, storage, and worker queues.

Delivery phases

Phase 1: Foundation and migration tools

Weeks 1–2

  • Create the production and staging environments.
  • Finish the canonical database schema and migrations.
  • Configure authentication, roles, secrets, logs, and backups.
  • Build repeatable import tools for the current database and source files.
  • Load a reviewed staging data set.

Result: Headkount can sign in to staging and review the migrated business records.

Phase 2: Core records and Schedule

Weeks 3–5

  • Finish Users, Beauty Educators, Brands, Markets, Retailers, and Doors.
  • Finish Contracts, commitments, and required work.
  • Finish the Month, Week, and Day calendar.
  • Add the Market, Beauty Educator, Brand, and Door filters.
  • Add Schedule generation, versions, gaps, warnings, and approval.

Result: A Scheduler can generate, review, filter, and approve a complete Schedule Version.

Phase 3: Integrations and daily operations

Weeks 6–8

  • Finish Connecteam and Slack ingestion.
  • Finish file imports and source-health views.
  • Build the shared retailer-provider system.
  • Build Sephora reads, dry-run booking, confirmation, and manual fallback.
  • Build the Ulta Event adapter under the same provider boundary.
  • Add bookings, draft Connecteam shifts, tickets, and activity history.

Result: Staging shows the full path from source data to booking confirmation and draft shift.

Phase 4: AI Agent and launch candidate

Weeks 9–10

  • Add the Agent to the Schedule and business record screens.
  • Add read tools and approval-gated write tools.
  • Add Schedule Instructions and generation requests.
  • Add undo commands, activity history, and permission tests.
  • Complete the production launch candidate.

Result: A User can ask for a change, review the proposal, approve it, and see the committed result.

Phase 5: Pilot and launch

Weeks 11–12

  • Rehearse the final data migration.
  • Complete User acceptance testing with Headkount.
  • Train Admins and Schedulers.
  • Run a controlled production pilot.
  • Reconcile Schedule, portal, and Connecteam results.
  • Move the approved application to production.

Result: Headkount operates the approved production system with monitoring and manual fallback.

Data migration

The migration uses the same repeatable process for every source.

  1. Save a read-only source copy.
  2. Standardize identifiers, names, dates, times, and status values.
  3. Link source records to the canonical Headkount records.
  4. Load valid records into staging.
  5. Compare source counts, required work, scheduled work, and unmatched records.
  6. Rehearse the production migration.
  7. Pause legacy changes during the final cutover window.
  8. Apply the final migration and repeat the reconciliation.

The legacy sources remain available as evidence. The production application uses the canonical records after cutover.

Testing

TestPurpose
Unit testsProve business rules, calculations, and state changes.
Contract testsProve each external response matches the expected data contract.
Database testsProve constraints, migrations, transactions, and duplicate protection.
Integration testsProve complete flows across the application, database, and workers.
Browser testsProve the main User workflows in supported browsers.
Security testsProve roles, sessions, secret handling, and restricted data access.
Migration testsProve source counts, mappings, totals, and repeatability.
Failure testsProve retries, stale-source behavior, alerts, recovery, and manual fallback.
User acceptance testsProve that Headkount can complete the agreed operating workflows.

Each external write starts in dry-run mode. Production writes begin only after a reviewed staging result and explicit approval.

Deployment

  1. Build and test one immutable release candidate.
  2. Deploy the candidate to Staging.
  3. Complete automated tests and User acceptance tests.
  4. Review the database migration and infrastructure changes.
  5. Apply the approved production migration.
  6. Deploy the same tested application version to Production.
  7. Complete sign-in, data, schedule, integration, and monitoring checks.
  8. Keep the prior application and manual workflows available during the pilot.

A failed release check stops the launch. The team corrects the release in Staging before another production attempt.

Launch criteria

  • Authorized Users can sign in with the correct roles.
  • Migrated record counts and work totals match the approved reconciliation report.
  • The Schedule shows the expected Month, Week, and Day data.
  • The four calendar filters return the correct cards.
  • The Optimizer produces repeatable Schedule Versions.
  • Every write records the User, reason, and activity history.
  • Connecteam, Slack, files, and retailer connectors report their health.
  • Retailer actions require approval and read-back confirmation.
  • The AI Agent cannot bypass approval or application rules.
  • Backups, logs, traces, alerts, and recovery steps operate in Production.
  • Headkount accepts the pilot results.

Dependencies

  • Headkount provides one project owner with decision authority.
  • Headkount provides authorized access to source systems and retailer portals.
  • Headkount provides the final source files and approved business records.
  • Headkount reviews milestone results within two business days.
  • Thinair receives access to the required AWS, Vercel, DNS, and email accounts.
  • Retailer writes remain off until Headkount gives explicit production approval.

An access or review delay moves the delivery dates by the same amount. A scope change uses the change process in the MSA.

Main risks and controls

RiskControl
Source records conflictKeep source evidence and route the conflict to a User.
A retailer changes its portalStop the provider, alert the team, and use the manual workflow.
A credential expiresPause that connector and show a credential alert.
A booking result is unclearRead the retailer state before any retry.
The Optimizer leaves work unfilledShow each gap and its reason before approval.
The Agent proposes an invalid actionReject it through deterministic command rules.
A migration produces different totalsStop cutover and return to the prior application.
A production service stopsAlert the team and use the documented recovery process.

Result

This plan delivers the full system in five controlled phases, with acceptance evidence at the end of each phase.