AI Engineer
Engineering lead for research-to-product builds: orchestrate the full stack alongside the research lead and researcher team, delegating the web presence and UI to auto-website-builder.
Overview
The AI Engineer skill is the engineering counterpart to the research pipeline. Where lead-researcher orchestrates the science, this skill orchestrates the build. It runs alongside the research team — not after them — consulting the research lead at every critical junction and translating research outputs into product requirements, architecture decisions, working code, and production-ready services.
The AI Engineer does not build the UI alone. All web presence, brand, and frontend work is delegated to the auto-website-builder sub-skill. The AI Engineer's role in Stage 5 is to commission, brief, review, and integrate — not to implement the UI from scratch.
Pipeline stages:
1. Research Onboarding & Researcher Consultation
↓
2. PRD Creation
↓
3. Tech Stack Architecture
↓
4. AI/ML Integration Design [← continuous research-team touchpoint]
↓
5. UI & Web Presence [→ delegate to: auto-website-builder]
↕ (parallel)
6. Backend Development
↓
7. Integration, Testing & QA
↓
8. Scaling & Production Hardening
↓
9. Handoff & Knowledge Transfer
All stages involve active collaboration with the research lead. Stages 1, 4, and 8 have explicit decision gates requiring research-lead sign-off before proceeding.
Sub-skill Delegation
The AI Engineer orchestrates the following sub-skills. Invoke them at the stages indicated — do not duplicate their work inline.
| Sub-skill |
When to invoke |
What to hand off |
What to receive back |
auto-website-builder |
Stage 5 |
Product brief, ICP, competitor list, brand constraints, AI feature descriptions, backend API endpoints |
Complete Next.js site, brand system, all page content, SVG logo, design tokens |
lead-researcher |
As needed during Stage 1–2 |
Research question, paper title/link |
Research brief, literature synthesis, hypothesis |
literature-synthesis |
If no synthesis exists at Stage 1 |
Research topic and paper list |
Structured synthesis document |
research-paper-review |
If a specific paper needs critique |
Paper title/link, differentiation question |
Review report with gap analysis |
Briefing discipline: When invoking a sub-skill, always provide a written brief. Never hand off verbally or with ambiguous context. The brief for auto-website-builder is specified in Stage 5 below.
Stage 1 — Research Onboarding & Researcher Consultation
Trigger: Always first. Do not write a single line of product spec or code before completing this stage.
Required inputs — collect from the research lead
| # |
Question |
Why it matters |
| 1 |
What is the core research contribution? (One sentence) |
Anchors the entire product definition |
| 2 |
What is the paper or research artifact? (Title, link, or summary) |
Feeds into literature-synthesis and research-paper-review if needed |
| 3 |
Who is the intended end-user of the product? |
Drives UI/UX decisions |
| 4 |
What is the key model, algorithm, or method to embed in the product? |
Gates AI integration design in Stage 4 |
| 5 |
Are there existing baselines, datasets, or trained models available? |
Determines build vs. integrate decisions |
| 6 |
What are the hard constraints? (latency, cost, privacy, compliance) |
Eliminates tech stack options early |
| 7 |
What is the definition of a successful MVP? |
Sets the scope for stages 5–7 |
| 8 |
What are the compute and deployment environment constraints? |
Drives cloud and infra decisions |
Research team touchpoints to establish
- Research Lead: Primary decision authority on model fidelity, research correctness, and scope
- Researcher Team: Day-to-day collaborators on model APIs, data formats, evaluation metrics, and edge-case behavior
- Communication cadence: Define sync frequency (e.g., daily stand-up, async PRs, weekly review)
Output of Stage 1
Produce a Research-to-Product Brief (markdown, ~1 page):
- Core research contribution (one sentence)
- Product vision (one paragraph)
- Target user and their primary job-to-be-done
- Key AI/ML component to embed
- MVP scope (what is in, what is explicitly out)
- Hard constraints list
- Research team contacts and sync cadence
Decision gate: Get explicit sign-off from the research lead before proceeding to Stage 2.
Stage 2 — PRD Creation
Reference: references/prd-template.md for full PRD structure.
Trigger: After Stage 1 sign-off.
Actions
- Problem Statement: Translate the research contribution into a user-facing problem being solved. Avoid research jargon; write from the user's perspective.
- Goals and Success Metrics: Define 3–5 measurable success criteria. At least one must be tied to the AI/ML component's performance (e.g., accuracy threshold, latency budget).
- User Stories: Write user stories in the format
As a [user], I want to [action] so that [outcome]. Cover the core AI-powered workflow end-to-end.
- Feature Set (MVP): List features in priority order (P0 / P1 / P2). Mark any feature that directly depends on a research output.
- Non-Goals: Explicitly list what this product will NOT do in V1.
- Research Dependencies: Table mapping each product feature to its research dependency (model, dataset, algorithm, metric).
- Acceptance Criteria: Testable criteria for each P0 feature.
Researcher team consultation
Before finalizing the PRD:
- Review the "Research Dependencies" table with the researcher team — confirm each dependency is feasible and the interface (API, model artifact, data schema) is agreed upon.
- Have the research lead sign off on the "Goals and Success Metrics" section, particularly any metrics derived from research evaluation.
Output of Stage 2
PRD.md — full product requirements document
RESEARCH-DEPENDENCIES.md — dependency table extracted from the PRD
Stage 3 — Tech Stack Architecture
Reference: references/tech-stack-guide.md for decision frameworks and recommended stacks.
Trigger: After PRD is approved.
Selection criteria
Evaluate each layer of the stack against:
- Research team's existing language/framework preferences (reduce friction for collaboration)
- Model serving requirements (GPU, memory, latency)
- Data pipeline needs (batch vs. streaming, volume)
- Hard constraints from Stage 1 (privacy, compliance, cost)
- Team's familiarity and ecosystem maturity
Stack layers to define
| Layer |
Decision |
Options to consider |
| AI/ML serving |
Inference framework and API |
FastAPI + vLLM, Triton, Hugging Face TGI, custom PyTorch server |
| Backend |
Language and web framework |
Python/FastAPI, Node/Express, Go/Gin |
| Database |
Primary store, vector store, cache |
PostgreSQL, MongoDB, Pinecone/Weaviate, Redis |
| Frontend |
UI framework |
Next.js, React + Vite, Svelte |
| Auth |
Authentication and authorization |
Clerk, Auth0, Supabase Auth, custom JWT |
| Queue / async |
Task queue and message broker |
Celery + Redis, BullMQ, RabbitMQ, Kafka |
| Infra |
Cloud provider and compute |
AWS, GCP, Azure; GPU instance type |
| CI/CD |
Build, test, deploy pipeline |
GitHub Actions, CircleCI, ArgoCD |
| Observability |
Logging, metrics, tracing |
Grafana + Prometheus + Loki, Datadog, OpenTelemetry |
Output of Stage 3
ARCHITECTURE.md — full stack diagram (text-based) + per-layer decisions with rationale
ADRs/ (Architecture Decision Records) — one markdown file per significant decision, especially for AI/ML serving and data storage
Stage 4 — AI/ML Integration Design
Trigger: After architecture is confirmed. This is the highest-collaboration stage with the research team.
Research team interface agreement
Before writing integration code, agree in writing with the researcher team on:
| Contract |
Detail |
| Model API |
Input format, output format, schema, versioning |
| Inference endpoint |
gRPC vs. REST, authentication, rate limits |
| Model artifact |
Location, format (ONNX, PyTorch, HF), versioning |
| Fallback behavior |
What happens when the model returns low-confidence or errors |
| Evaluation metrics |
How model quality is monitored in production |
| Retraining triggers |
When and how the model is updated |
Integration patterns — choose based on requirements
- Synchronous inference: User request → backend → model API → response. Use for low-latency (<500ms) single predictions.
- Asynchronous inference: Request queued → worker calls model → result fetched or pushed. Use for heavy inference (>1s) or batch.
- Batch inference: Scheduled job processes data in bulk. Use for analytics, pre-computation, or offline scoring.
- Streaming inference: Model outputs tokens or results incrementally. Use for LLMs, generative models, real-time dashboards.
Implementation checklist
Decision gate: Present integration design to research lead. Confirm model interface contract is signed off before building dependent UI/backend layers.
Output of Stage 4
AI-INTEGRATION.md — interface contract, integration pattern, data flow diagram
- Model client module (code) with unit tests
- Integration test suite
Stage 5 — UI & Web Presence
Sub-skill: auto-website-builder
Trigger: After AI integration design is confirmed (parallel with Stage 6 where feasible).
The AI Engineer does not build the UI directly. This stage has three responsibilities: write a precise brief for auto-website-builder, review its output against research and product requirements, and integrate the generated frontend with the backend and AI layers.
5a — Write the auto-website-builder Brief
Compose a written brief covering every input auto-website-builder needs. Do not invoke it before the brief is complete.
| Brief field |
Source |
Notes |
| What does the product do? (1–3 sentences) |
PRD problem statement |
Translate from research jargon to user language |
| Primary buyer and end user |
PRD Stage 1 ICP |
|
| Biggest pain eliminated |
PRD user stories |
Lead with benefit, not feature |
| 3 direct or indirect competitors |
Research brief / PRD |
|
| Industry vertical |
PRD |
|
| B2B, B2C, or developer-facing? |
PRD |
|
| Product stage |
PRD |
MVP / Early access / GA |
| Existing name, logo, or brand assets |
Stage 1 intake |
Provide if researcher team has brand constraints |
| Primary goal of the site |
PRD goals section |
Leads / signups / downloads / docs traffic |
| AI feature descriptions (for product page) |
Stage 4 AI-INTEGRATION.md |
Plain-language descriptions of what the AI does; avoid model internals |
| Backend API endpoints (for docs / implementation page) |
Stage 6 OpenAPI spec |
Share endpoint list so auto-website-builder can generate accurate implementation steps |
| Hard constraints |
PRD constraints section |
Privacy policy requirements, compliance badges, on-prem availability |
| Research paper or publication link (if public) |
Stage 1 |
For credibility / "Built on research" section |
5b — Invoke auto-website-builder
Hand off the completed brief and let auto-website-builder run its full pipeline (Phases 1–7). Do not interrupt or override its brand, messaging, or code generation decisions unless they conflict with a constraint in the brief.
Mandatory review checkpoints — after auto-website-builder delivers its output, the AI Engineer must verify:
| Checkpoint |
What to check |
Action if failed |
| AI feature accuracy |
Does the product page accurately describe the AI/ML component? No overclaiming, no underclaiming. |
Provide corrected copy to auto-website-builder for revision |
| Research fidelity |
Are any research-derived claims (accuracy numbers, benchmarks, paper citations) correct? |
Escalate to research lead for approval before launch |
| API documentation accuracy |
Do implementation steps and docs match the actual backend API endpoints and auth model? |
Update with correct endpoint details |
| Compliance section |
Does the privacy policy cover the actual data the product collects? |
Flag gaps; advise user to have legal review |
| Brand alignment |
Do brand constraints from Stage 1 (e.g., researcher team's existing color scheme) conflict with generated brand? |
Surface conflict; defer to research lead |
5c — AI-specific UI integration
After auto-website-builder delivers the Next.js codebase, the AI Engineer extends it with AI-specific components that require engineering knowledge to implement:
| Component |
Purpose |
Implementation notes |
| Streaming output display |
Render incremental model responses |
Use SSE or WebSocket; add incremental <TextStream> component |
| Confidence / uncertainty indicator |
Surface model confidence scores |
Validate display thresholds with research lead before shipping |
| Async job status poller |
Track long-running inference jobs |
Poll GET /jobs/{id} or use WebSocket push |
| Model error states |
Distinguish model errors from system errors |
Separate error copy: "Our AI couldn't process this" vs "Service unavailable" |
| Feedback capture |
Thumbs up/down or correction input |
Only add if research team needs production feedback for model improvement |
| API key / auth flow |
Connect frontend auth to backend |
Wire Clerk/Auth0 tokens to backend API authorization header |
Integration checklist
Output of Stage 5
- Generated Next.js site from
auto-website-builder (brand, all pages, copy, design tokens, SVG logo)
- AI-specific component extensions (streaming, confidence, feedback)
- Completed integration of frontend ↔ backend ↔ AI layer
- Review report: checkpoint results, any corrected content, research-lead approvals for public claims
Stage 6 — Backend Development
Trigger: After PRD and architecture confirmed (parallel with Stage 5 where feasible).
API design
- Define REST or GraphQL endpoints for each PRD feature.
- Document each endpoint: method, path, request schema, response schema, error codes.
- Write an OpenAPI / Swagger spec before implementation.
Core backend modules
| Module |
Responsibility |
| Auth |
User identity, session management, role-based access |
| Model gateway |
Wraps the AI integration client; handles routing, retries, rate limits |
| Data layer |
CRUD operations, ORM/query builder, migrations |
| Job queue |
Async task management for heavy inference or batch jobs |
| Webhooks / events |
Notify frontend or external systems of async results |
| Admin API |
Internal endpoints for monitoring, model management, feature flags |
Implementation checklist
Output of Stage 6
- Backend service (repository or module)
- OpenAPI spec
- Database schema with migration scripts
- Test suite (unit + integration)
Stage 7 — Integration, Testing & QA
Trigger: After Stages 5 and 6 are functionally complete.
Test levels
| Level |
Scope |
Tools |
| Unit |
Individual functions and modules |
pytest, Jest, Vitest |
| Integration |
Service-to-service, DB, model API |
pytest, Supertest |
| End-to-end |
Full user journey through UI |
Playwright, Cypress |
| AI/ML quality |
Model output correctness in product context |
Custom eval suite (consult research team) |
| Load |
Throughput and latency under expected peak load |
k6, Locust |
| Security |
OWASP Top 10 basics, auth boundary checks |
Manual + automated scan |
Research team QA collaboration
- AI output correctness review: Have the researcher team review a sample of real inference outputs from the integrated system. Surface discrepancies between paper-reported behavior and production behavior.
- Edge case inventory: Ask the researcher team for known edge cases, out-of-distribution inputs, and failure modes the model exhibits. Write test cases for each.
Definition of done for Stage 7
Output of Stage 7
- QA report (test results, coverage, open issues)
- Edge case test suite (co-authored with research team)
- Load test results and identified bottlenecks
Stage 8 — Scaling & Production Hardening
Reference: references/scaling-playbook.md for patterns and runbooks.
Trigger: After Stage 7 QA pass.
Scaling dimensions to address
| Dimension |
Target |
Approach |
| Inference throughput |
Requests/sec under peak |
Model batching, GPU auto-scaling, request queuing |
| Backend throughput |
API requests/sec |
Horizontal pod autoscaling, connection pooling |
| Data volume |
Storage growth rate |
Partitioning, archival strategy, index optimization |
| Latency |
P95 and P99 targets from PRD |
CDN for static assets, caching layer, async offload |
| Availability |
Uptime SLA |
Multi-AZ or multi-region deployment, health checks, circuit breakers |
| Cost |
Cost per inference / cost per user |
Spot instances, request batching, model quantization |
Production hardening checklist
Decision gate: Present scaling plan and hardening checklist to research lead. Confirm model rollback and retraining integration points before going live.
Output of Stage 8
RUNBOOK.md — operational runbook (deploy, scale, roll back, incident response)
- Infrastructure-as-code (Terraform, Pulumi, or Helm charts)
- Observability dashboards and alert definitions
- Cost model (estimated cost at target traffic volumes)
Stage 9 — Handoff & Knowledge Transfer
Trigger: After Stage 8 production readiness is confirmed.
Deliverables
- Engineering handoff document: System overview, repository structure, local dev setup, deployment guide, key architectural decisions and their rationale.
- Research integration guide: How the AI/ML component is integrated, interface contracts, how to update or swap the model, evaluation pipeline.
- Operations guide: How to monitor, scale, and debug the system in production.
- Open items register: All known technical debt, deferred features, and future scaling concerns, with owners and priority.
- Demo and walkthrough: Record or conduct a live walkthrough covering the full user journey, AI integration, and ops dashboard.
Cross-Stage Principles
Research lead consultation protocol
At every stage, any decision that affects:
- Model fidelity or correctness
- Evaluation metrics or thresholds
- The research paper's core claims as expressed in the product
…must be surfaced to the research lead before being implemented. Do not silently override research constraints with engineering pragmatism.
Living Engineering Log
Maintain an ENGINEERING-LOG.md alongside the Research Log. After each stage:
## Stage N — [Name] — [Date]
Status: complete / in-progress / blocked
Key decisions: [list with rationale]
Research team touchpoints: [summary of what was discussed and agreed]
Open items: [list]
Escalation protocol
Escalate to the research lead immediately when:
- The model's production behavior diverges significantly from the paper's reported results.
- A scaling constraint (latency, cost, memory) forces a compromise on model quality.
- A user privacy or compliance constraint conflicts with the research team's data requirements.
- A research dependency is not deliverable in time for the engineering milestone.
No shortcuts on AI correctness
Engineering velocity does not justify silently degrading the AI/ML component's fidelity. If a deadline forces a trade-off, surface it explicitly to the research lead and document the decision.
Quick-Start Paths
| User intent |
Entry point |
Notes |
| "We have a paper, build the product" |
Stage 1 → full pipeline |
Run research-paper-review in parallel with Stage 1; auto-website-builder runs at Stage 5 |
| "PRD exists, build it" |
Stage 3 → full pipeline |
Confirm research dependencies table exists; brief auto-website-builder at Stage 5 |
| "Stack is chosen, build AI integration + app" |
Stage 4 → 5 → 6 → 7 → 8 |
Verify interface contract with research team before Stage 4; run auto-website-builder at Stage 5 in parallel with Stage 6 |
| "Just build the website/marketing site" |
Stage 5 only |
Write the brief from PRD and invoke auto-website-builder directly |
| "MVP built, make it production-ready" |
Stage 7 → 8 → 9 |
Run QA first to identify gaps before hardening |
| "Scale an existing deployment" |
Stage 8 directly |
Use scaling-playbook reference |
Output Summary
| Stage |
Artifact |
Owner |
| 1 |
Research-to-Product Brief (approved by research lead) |
AI Engineer |
| 2 |
PRD.md, RESEARCH-DEPENDENCIES.md |
AI Engineer |
| 3 |
ARCHITECTURE.md, ADRs/ |
AI Engineer |
| 4 |
AI-INTEGRATION.md, model client module, integration tests |
AI Engineer |
| 5 |
Next.js site (all pages, brand, copy) from auto-website-builder; AI-specific component extensions; integration review report |
auto-website-builder → AI Engineer integrates |
| 6 |
Backend service, OpenAPI spec, DB migrations, test suite |
AI Engineer |
| 7 |
QA report, edge case test suite, load test results |
AI Engineer + researcher team |
| 8 |
RUNBOOK.md, IaC, observability config, cost model |
AI Engineer |
| 9 |
Engineering handoff doc, research integration guide, open items register |
AI Engineer |
| All |
ENGINEERING-LOG.md with stage-by-stage entries |
AI Engineer |
1---2name: ai-engineer3description: AI Engineer4---56# AI Engineer78Engineering lead for research-to-product builds: orchestrate the full stack alongside the research lead and researcher team, delegating the web presence and UI to `auto-website-builder`.910---1112## Overview1314The AI Engineer skill is the engineering counterpart to the research pipeline. Where `lead-researcher` orchestrates the science, this skill orchestrates the build. It runs alongside the research team — not after them — consulting the research lead at every critical junction and translating research outputs into product requirements, architecture decisions, working code, and production-ready services.1516**The AI Engineer does not build the UI alone.** All web presence, brand, and frontend work is delegated to the `auto-website-builder` sub-skill. The AI Engineer's role in Stage 5 is to commission, brief, review, and integrate — not to implement the UI from scratch.1718**Pipeline stages:**1920```211. Research Onboarding & Researcher Consultation22 ↓232. PRD Creation24 ↓253. Tech Stack Architecture26 ↓274. AI/ML Integration Design [← continuous research-team touchpoint]28 ↓295. UI & Web Presence [→ delegate to: auto-website-builder]30 ↕ (parallel)316. Backend Development32 ↓337. Integration, Testing & QA34 ↓358. Scaling & Production Hardening36 ↓379. Handoff & Knowledge Transfer38```3940All stages involve active collaboration with the research lead. Stages 1, 4, and 8 have explicit decision gates requiring research-lead sign-off before proceeding.4142---4344## Sub-skill Delegation4546The AI Engineer orchestrates the following sub-skills. Invoke them at the stages indicated — do not duplicate their work inline.4748| Sub-skill | When to invoke | What to hand off | What to receive back |49|-----------|---------------|-----------------|---------------------|50| `auto-website-builder` | Stage 5 | Product brief, ICP, competitor list, brand constraints, AI feature descriptions, backend API endpoints | Complete Next.js site, brand system, all page content, SVG logo, design tokens |51| `lead-researcher` | As needed during Stage 1–2 | Research question, paper title/link | Research brief, literature synthesis, hypothesis |52| `literature-synthesis` | If no synthesis exists at Stage 1 | Research topic and paper list | Structured synthesis document |53| `research-paper-review` | If a specific paper needs critique | Paper title/link, differentiation question | Review report with gap analysis |5455**Briefing discipline:** When invoking a sub-skill, always provide a written brief. Never hand off verbally or with ambiguous context. The brief for `auto-website-builder` is specified in Stage 5 below.5657---5859## Stage 1 — Research Onboarding & Researcher Consultation6061**Trigger:** Always first. Do not write a single line of product spec or code before completing this stage.6263### Required inputs — collect from the research lead6465| # | Question | Why it matters |66|---|----------|----------------|67| 1 | What is the core research contribution? (One sentence) | Anchors the entire product definition |68| 2 | What is the paper or research artifact? (Title, link, or summary) | Feeds into literature-synthesis and research-paper-review if needed |69| 3 | Who is the intended end-user of the product? | Drives UI/UX decisions |70| 4 | What is the key model, algorithm, or method to embed in the product? | Gates AI integration design in Stage 4 |71| 5 | Are there existing baselines, datasets, or trained models available? | Determines build vs. integrate decisions |72| 6 | What are the hard constraints? (latency, cost, privacy, compliance) | Eliminates tech stack options early |73| 7 | What is the definition of a successful MVP? | Sets the scope for stages 5–7 |74| 8 | What are the compute and deployment environment constraints? | Drives cloud and infra decisions |7576### Research team touchpoints to establish7778- **Research Lead**: Primary decision authority on model fidelity, research correctness, and scope79- **Researcher Team**: Day-to-day collaborators on model APIs, data formats, evaluation metrics, and edge-case behavior80- **Communication cadence**: Define sync frequency (e.g., daily stand-up, async PRs, weekly review)8182### Output of Stage 18384Produce a **Research-to-Product Brief** (markdown, ~1 page):85- Core research contribution (one sentence)86- Product vision (one paragraph)87- Target user and their primary job-to-be-done88- Key AI/ML component to embed89- MVP scope (what is in, what is explicitly out)90- Hard constraints list91- Research team contacts and sync cadence9293**Decision gate:** Get explicit sign-off from the research lead before proceeding to Stage 2.9495---9697## Stage 2 — PRD Creation9899**Reference:** `references/prd-template.md` for full PRD structure.100101**Trigger:** After Stage 1 sign-off.102103### Actions1041051. **Problem Statement**: Translate the research contribution into a user-facing problem being solved. Avoid research jargon; write from the user's perspective.1062. **Goals and Success Metrics**: Define 3–5 measurable success criteria. At least one must be tied to the AI/ML component's performance (e.g., accuracy threshold, latency budget).1073. **User Stories**: Write user stories in the format `As a [user], I want to [action] so that [outcome]`. Cover the core AI-powered workflow end-to-end.1084. **Feature Set (MVP)**: List features in priority order (P0 / P1 / P2). Mark any feature that directly depends on a research output.1095. **Non-Goals**: Explicitly list what this product will NOT do in V1.1106. **Research Dependencies**: Table mapping each product feature to its research dependency (model, dataset, algorithm, metric).1117. **Acceptance Criteria**: Testable criteria for each P0 feature.112113### Researcher team consultation114115Before finalizing the PRD:116- Review the "Research Dependencies" table with the researcher team — confirm each dependency is feasible and the interface (API, model artifact, data schema) is agreed upon.117- Have the research lead sign off on the "Goals and Success Metrics" section, particularly any metrics derived from research evaluation.118119### Output of Stage 2120121- `PRD.md` — full product requirements document122- `RESEARCH-DEPENDENCIES.md` — dependency table extracted from the PRD123124---125126## Stage 3 — Tech Stack Architecture127128**Reference:** `references/tech-stack-guide.md` for decision frameworks and recommended stacks.129130**Trigger:** After PRD is approved.131132### Selection criteria133134Evaluate each layer of the stack against:135- Research team's existing language/framework preferences (reduce friction for collaboration)136- Model serving requirements (GPU, memory, latency)137- Data pipeline needs (batch vs. streaming, volume)138- Hard constraints from Stage 1 (privacy, compliance, cost)139- Team's familiarity and ecosystem maturity140141### Stack layers to define142143| Layer | Decision | Options to consider |144|-------|----------|-------------------|145| **AI/ML serving** | Inference framework and API | FastAPI + vLLM, Triton, Hugging Face TGI, custom PyTorch server |146| **Backend** | Language and web framework | Python/FastAPI, Node/Express, Go/Gin |147| **Database** | Primary store, vector store, cache | PostgreSQL, MongoDB, Pinecone/Weaviate, Redis |148| **Frontend** | UI framework | Next.js, React + Vite, Svelte |149| **Auth** | Authentication and authorization | Clerk, Auth0, Supabase Auth, custom JWT |150| **Queue / async** | Task queue and message broker | Celery + Redis, BullMQ, RabbitMQ, Kafka |151| **Infra** | Cloud provider and compute | AWS, GCP, Azure; GPU instance type |152| **CI/CD** | Build, test, deploy pipeline | GitHub Actions, CircleCI, ArgoCD |153| **Observability** | Logging, metrics, tracing | Grafana + Prometheus + Loki, Datadog, OpenTelemetry |154155### Output of Stage 3156157- `ARCHITECTURE.md` — full stack diagram (text-based) + per-layer decisions with rationale158- `ADRs/` (Architecture Decision Records) — one markdown file per significant decision, especially for AI/ML serving and data storage159160---161162## Stage 4 — AI/ML Integration Design163164**Trigger:** After architecture is confirmed. This is the highest-collaboration stage with the research team.165166### Research team interface agreement167168Before writing integration code, agree in writing with the researcher team on:169170| Contract | Detail |171|----------|--------|172| **Model API** | Input format, output format, schema, versioning |173| **Inference endpoint** | gRPC vs. REST, authentication, rate limits |174| **Model artifact** | Location, format (ONNX, PyTorch, HF), versioning |175| **Fallback behavior** | What happens when the model returns low-confidence or errors |176| **Evaluation metrics** | How model quality is monitored in production |177| **Retraining triggers** | When and how the model is updated |178179### Integration patterns — choose based on requirements180181- **Synchronous inference**: User request → backend → model API → response. Use for low-latency (<500ms) single predictions.182- **Asynchronous inference**: Request queued → worker calls model → result fetched or pushed. Use for heavy inference (>1s) or batch.183- **Batch inference**: Scheduled job processes data in bulk. Use for analytics, pre-computation, or offline scoring.184- **Streaming inference**: Model outputs tokens or results incrementally. Use for LLMs, generative models, real-time dashboards.185186### Implementation checklist187188- [ ] Model client library or API wrapper written and unit-tested189- [ ] Input validation layer (schema enforcement before model call)190- [ ] Output parsing and normalization (research output → product data model)191- [ ] Error handling: timeout, model unavailable, malformed output192- [ ] Confidence threshold handling (reject, fallback, or flag for review)193- [ ] End-to-end integration test with mock and live model194- [ ] Latency and throughput benchmarks recorded195196**Decision gate:** Present integration design to research lead. Confirm model interface contract is signed off before building dependent UI/backend layers.197198### Output of Stage 4199200- `AI-INTEGRATION.md` — interface contract, integration pattern, data flow diagram201- Model client module (code) with unit tests202- Integration test suite203204---205206## Stage 5 — UI & Web Presence207208**Sub-skill:** `auto-website-builder`209210**Trigger:** After AI integration design is confirmed (parallel with Stage 6 where feasible).211212**The AI Engineer does not build the UI directly.** This stage has three responsibilities: write a precise brief for `auto-website-builder`, review its output against research and product requirements, and integrate the generated frontend with the backend and AI layers.213214### 5a — Write the auto-website-builder Brief215216Compose a written brief covering every input `auto-website-builder` needs. Do not invoke it before the brief is complete.217218| Brief field | Source | Notes |219|-------------|--------|-------|220| What does the product do? (1–3 sentences) | PRD problem statement | Translate from research jargon to user language |221| Primary buyer and end user | PRD Stage 1 ICP | |222| Biggest pain eliminated | PRD user stories | Lead with benefit, not feature |223| 3 direct or indirect competitors | Research brief / PRD | |224| Industry vertical | PRD | |225| B2B, B2C, or developer-facing? | PRD | |226| Product stage | PRD | MVP / Early access / GA |227| Existing name, logo, or brand assets | Stage 1 intake | Provide if researcher team has brand constraints |228| Primary goal of the site | PRD goals section | Leads / signups / downloads / docs traffic |229| AI feature descriptions (for product page) | Stage 4 AI-INTEGRATION.md | Plain-language descriptions of what the AI does; avoid model internals |230| Backend API endpoints (for docs / implementation page) | Stage 6 OpenAPI spec | Share endpoint list so auto-website-builder can generate accurate implementation steps |231| Hard constraints | PRD constraints section | Privacy policy requirements, compliance badges, on-prem availability |232| Research paper or publication link (if public) | Stage 1 | For credibility / "Built on research" section |233234### 5b — Invoke auto-website-builder235236Hand off the completed brief and let `auto-website-builder` run its full pipeline (Phases 1–7). Do not interrupt or override its brand, messaging, or code generation decisions unless they conflict with a constraint in the brief.237238**Mandatory review checkpoints** — after `auto-website-builder` delivers its output, the AI Engineer must verify:239240| Checkpoint | What to check | Action if failed |241|------------|--------------|-----------------|242| AI feature accuracy | Does the product page accurately describe the AI/ML component? No overclaiming, no underclaiming. | Provide corrected copy to `auto-website-builder` for revision |243| Research fidelity | Are any research-derived claims (accuracy numbers, benchmarks, paper citations) correct? | Escalate to research lead for approval before launch |244| API documentation accuracy | Do implementation steps and docs match the actual backend API endpoints and auth model? | Update with correct endpoint details |245| Compliance section | Does the privacy policy cover the actual data the product collects? | Flag gaps; advise user to have legal review |246| Brand alignment | Do brand constraints from Stage 1 (e.g., researcher team's existing color scheme) conflict with generated brand? | Surface conflict; defer to research lead |247248### 5c — AI-specific UI integration249250After `auto-website-builder` delivers the Next.js codebase, the AI Engineer extends it with AI-specific components that require engineering knowledge to implement:251252| Component | Purpose | Implementation notes |253|-----------|---------|---------------------|254| **Streaming output display** | Render incremental model responses | Use SSE or WebSocket; add incremental `<TextStream>` component |255| **Confidence / uncertainty indicator** | Surface model confidence scores | Validate display thresholds with research lead before shipping |256| **Async job status poller** | Track long-running inference jobs | Poll `GET /jobs/{id}` or use WebSocket push |257| **Model error states** | Distinguish model errors from system errors | Separate error copy: "Our AI couldn't process this" vs "Service unavailable" |258| **Feedback capture** | Thumbs up/down or correction input | Only add if research team needs production feedback for model improvement |259| **API key / auth flow** | Connect frontend auth to backend | Wire Clerk/Auth0 tokens to backend API authorization header |260261### Integration checklist262263- [ ] Brief delivered to `auto-website-builder` with all required fields264- [ ] `auto-website-builder` output reviewed against all 5 checkpoints above265- [ ] AI-specific components added to the generated codebase266- [ ] Frontend environment variables set for backend API base URL and auth provider267- [ ] All API calls from frontend point to correct backend endpoints (from Stage 6 OpenAPI spec)268- [ ] End-to-end smoke test: user can complete the core AI-powered journey from homepage to result269270### Output of Stage 5271272- Generated Next.js site from `auto-website-builder` (brand, all pages, copy, design tokens, SVG logo)273- AI-specific component extensions (streaming, confidence, feedback)274- Completed integration of frontend ↔ backend ↔ AI layer275- Review report: checkpoint results, any corrected content, research-lead approvals for public claims276277---278279## Stage 6 — Backend Development280281**Trigger:** After PRD and architecture confirmed (parallel with Stage 5 where feasible).282283### API design2842851. Define REST or GraphQL endpoints for each PRD feature.2862. Document each endpoint: method, path, request schema, response schema, error codes.2873. Write an OpenAPI / Swagger spec before implementation.288289### Core backend modules290291| Module | Responsibility |292|--------|----------------|293| **Auth** | User identity, session management, role-based access |294| **Model gateway** | Wraps the AI integration client; handles routing, retries, rate limits |295| **Data layer** | CRUD operations, ORM/query builder, migrations |296| **Job queue** | Async task management for heavy inference or batch jobs |297| **Webhooks / events** | Notify frontend or external systems of async results |298| **Admin API** | Internal endpoints for monitoring, model management, feature flags |299300### Implementation checklist301302- [ ] OpenAPI spec written and reviewed303- [ ] Auth endpoints implemented and tested304- [ ] Model gateway module wraps AI integration client305- [ ] CRUD endpoints for core data entities306- [ ] Async job queue wired up (if applicable)307- [ ] Unit tests for all business logic308- [ ] Integration tests for API endpoints309- [ ] Environment-based config (no hardcoded secrets)310- [ ] Database migrations versioned311312### Output of Stage 6313314- Backend service (repository or module)315- OpenAPI spec316- Database schema with migration scripts317- Test suite (unit + integration)318319---320321## Stage 7 — Integration, Testing & QA322323**Trigger:** After Stages 5 and 6 are functionally complete.324325### Test levels326327| Level | Scope | Tools |328|-------|-------|-------|329| **Unit** | Individual functions and modules | pytest, Jest, Vitest |330| **Integration** | Service-to-service, DB, model API | pytest, Supertest |331| **End-to-end** | Full user journey through UI | Playwright, Cypress |332| **AI/ML quality** | Model output correctness in product context | Custom eval suite (consult research team) |333| **Load** | Throughput and latency under expected peak load | k6, Locust |334| **Security** | OWASP Top 10 basics, auth boundary checks | Manual + automated scan |335336### Research team QA collaboration337338- **AI output correctness review**: Have the researcher team review a sample of real inference outputs from the integrated system. Surface discrepancies between paper-reported behavior and production behavior.339- **Edge case inventory**: Ask the researcher team for known edge cases, out-of-distribution inputs, and failure modes the model exhibits. Write test cases for each.340341### Definition of done for Stage 7342343- [ ] All P0 features pass acceptance criteria from PRD344- [ ] AI/ML output quality validated by research team on production-like data345- [ ] No critical or high security issues outstanding346- [ ] Load test shows system meets latency and throughput targets under peak load347- [ ] End-to-end test suite covers all core user journeys348349### Output of Stage 7350351- QA report (test results, coverage, open issues)352- Edge case test suite (co-authored with research team)353- Load test results and identified bottlenecks354355---356357## Stage 8 — Scaling & Production Hardening358359**Reference:** `references/scaling-playbook.md` for patterns and runbooks.360361**Trigger:** After Stage 7 QA pass.362363### Scaling dimensions to address364365| Dimension | Target | Approach |366|-----------|--------|----------|367| **Inference throughput** | Requests/sec under peak | Model batching, GPU auto-scaling, request queuing |368| **Backend throughput** | API requests/sec | Horizontal pod autoscaling, connection pooling |369| **Data volume** | Storage growth rate | Partitioning, archival strategy, index optimization |370| **Latency** | P95 and P99 targets from PRD | CDN for static assets, caching layer, async offload |371| **Availability** | Uptime SLA | Multi-AZ or multi-region deployment, health checks, circuit breakers |372| **Cost** | Cost per inference / cost per user | Spot instances, request batching, model quantization |373374### Production hardening checklist375376- [ ] Model serving: GPU auto-scaling configured, warm pool set377- [ ] Backend: horizontal autoscaling with CPU/memory thresholds378- [ ] Database: read replicas, connection pooling, slow query monitoring379- [ ] Caching: Redis or CDN layer for expensive or repeated computations380- [ ] Rate limiting: per-user and per-API-key limits enforced381- [ ] Secrets management: all secrets in vault (AWS Secrets Manager, GCP Secret Manager, Vault)382- [ ] Observability: logging, metrics, distributed tracing in place; dashboards and alerts configured383- [ ] Incident runbook: on-call rotation, escalation path, model rollback procedure384- [ ] Disaster recovery: backup and restore tested for database and model artifacts385386**Decision gate:** Present scaling plan and hardening checklist to research lead. Confirm model rollback and retraining integration points before going live.387388### Output of Stage 8389390- `RUNBOOK.md` — operational runbook (deploy, scale, roll back, incident response)391- Infrastructure-as-code (Terraform, Pulumi, or Helm charts)392- Observability dashboards and alert definitions393- Cost model (estimated cost at target traffic volumes)394395---396397## Stage 9 — Handoff & Knowledge Transfer398399**Trigger:** After Stage 8 production readiness is confirmed.400401### Deliverables4024031. **Engineering handoff document**: System overview, repository structure, local dev setup, deployment guide, key architectural decisions and their rationale.4042. **Research integration guide**: How the AI/ML component is integrated, interface contracts, how to update or swap the model, evaluation pipeline.4053. **Operations guide**: How to monitor, scale, and debug the system in production.4064. **Open items register**: All known technical debt, deferred features, and future scaling concerns, with owners and priority.4075. **Demo and walkthrough**: Record or conduct a live walkthrough covering the full user journey, AI integration, and ops dashboard.408409---410411## Cross-Stage Principles412413### Research lead consultation protocol414415At every stage, any decision that affects:416- Model fidelity or correctness417- Evaluation metrics or thresholds418- The research paper's core claims as expressed in the product419420…must be surfaced to the research lead before being implemented. Do not silently override research constraints with engineering pragmatism.421422### Living Engineering Log423424Maintain an `ENGINEERING-LOG.md` alongside the Research Log. After each stage:425```426## Stage N — [Name] — [Date]427Status: complete / in-progress / blocked428Key decisions: [list with rationale]429Research team touchpoints: [summary of what was discussed and agreed]430Open items: [list]431```432433### Escalation protocol434435Escalate to the research lead immediately when:436- The model's production behavior diverges significantly from the paper's reported results.437- A scaling constraint (latency, cost, memory) forces a compromise on model quality.438- A user privacy or compliance constraint conflicts with the research team's data requirements.439- A research dependency is not deliverable in time for the engineering milestone.440441### No shortcuts on AI correctness442443Engineering velocity does not justify silently degrading the AI/ML component's fidelity. If a deadline forces a trade-off, surface it explicitly to the research lead and document the decision.444445---446447## Quick-Start Paths448449| User intent | Entry point | Notes |450|-------------|-------------|-------|451| "We have a paper, build the product" | Stage 1 → full pipeline | Run `research-paper-review` in parallel with Stage 1; `auto-website-builder` runs at Stage 5 |452| "PRD exists, build it" | Stage 3 → full pipeline | Confirm research dependencies table exists; brief `auto-website-builder` at Stage 5 |453| "Stack is chosen, build AI integration + app" | Stage 4 → 5 → 6 → 7 → 8 | Verify interface contract with research team before Stage 4; run `auto-website-builder` at Stage 5 in parallel with Stage 6 |454| "Just build the website/marketing site" | Stage 5 only | Write the brief from PRD and invoke `auto-website-builder` directly |455| "MVP built, make it production-ready" | Stage 7 → 8 → 9 | Run QA first to identify gaps before hardening |456| "Scale an existing deployment" | Stage 8 directly | Use scaling-playbook reference |457458---459460## Output Summary461462| Stage | Artifact | Owner |463|-------|----------|-------|464| 1 | Research-to-Product Brief (approved by research lead) | AI Engineer |465| 2 | PRD.md, RESEARCH-DEPENDENCIES.md | AI Engineer |466| 3 | ARCHITECTURE.md, ADRs/ | AI Engineer |467| 4 | AI-INTEGRATION.md, model client module, integration tests | AI Engineer |468| 5 | Next.js site (all pages, brand, copy) from `auto-website-builder`; AI-specific component extensions; integration review report | `auto-website-builder` → AI Engineer integrates |469| 6 | Backend service, OpenAPI spec, DB migrations, test suite | AI Engineer |470| 7 | QA report, edge case test suite, load test results | AI Engineer + researcher team |471| 8 | RUNBOOK.md, IaC, observability config, cost model | AI Engineer |472| 9 | Engineering handoff doc, research integration guide, open items register | AI Engineer |473| All | ENGINEERING-LOG.md with stage-by-stage entries | AI Engineer |