An autonomous product intelligence agent that detects metric anomalies, diagnoses root causes, generates code fixes, and opens pull requests — without human intervention.
Built for the Mind the Product × World Product Day Hackathon 2026, sponsored by Pendo / Novus.
When a key metric drops, a PM's morning looks like this:
- Get paged at 2am
- Open four dashboards to find the anomaly
- Watch session replays to understand user behavior
- File a ticket, assign a developer, wait for sprint planning
- A week later, the bug is fixed
PM Autopilot compresses that entire sequence to a single decision: approve or reject a pull request.
Novus anomaly detected
↓
Confirm signal (real drop? enough traffic?)
↓
Diagnose funnel (which sub-feature broke?)
↓
Scan session replays (rage-clicks → common pattern)
↓
Locate code (Novus track event filePath → direct GitHub fetch)
↓
Generate fix (Gemini 2.0 Flash → unified diff)
↓
Open GitHub PR (branch → commit → PR with context)
↓
Create Novus in-app guide ("We're working on a fix")
↓
Notify Slack
↓
PM approves or rejects the PR ← only human decision
pm-autopilot/
├── app/
│ ├── page.tsx # Dashboard — live agent run feed
│ ├── runs/[id]/page.tsx # Run detail — step-by-step trace + diff viewer
│ ├── settings/page.tsx # Integrations config (Novus, GitHub OAuth, Gemini, Slack)
│ └── api/
│ ├── webhook/route.ts # Receives Novus anomaly signals (HMAC-verified)
│ ├── run/route.ts # POST — trigger a manual run
│ ├── runs/route.ts # GET — list all agent runs
│ ├── runs/[id]/route.ts # GET + POST (approve/reject)
│ ├── runs/[id]/stream/ # SSE — real-time step updates
│ ├── demo/route.ts # Full pipeline with mock data
│ ├── novus/artifacts/ # Novus page/feature picker
│ ├── novus/metric/ # Live metric snapshot for modal
│ ├── auth/github/ # GitHub OAuth 2.0 flow
│ ├── settings/route.ts # Persist non-secret config
│ └── config/route.ts # Safe client-side config flags
├── lib/
│ ├── agent/
│ │ ├── orchestrator.ts # Sequential step runner
│ │ ├── mock.ts # Full mock layer for DEMO_MODE If Enabled
│ │ └── steps/ # detect · diagnose · replay_scan · locate · fix · pr · guide · notify
│ ├── novus/
│ │ ├── auth.ts # OAuth 2.1 client_credentials + token cache
│ │ ├── mcp.ts # JSON-RPC 2.0 over Novus MCP (SSE transport)
│ │ ├── http.ts # Raw node:https client (bypasses Next.js fetch patching)
│ │ ├── client.ts # Typed wrappers: getArtifact, listReplays, etc.
│ │ └── artifacts-cache.ts # 60s server-side cache + request coalescing
│ ├── github/
│ │ ├── client.ts # Octokit wrapper (OAuth cookie + PAT fallback)
│ │ └── diff.ts # Unified diff parser + patch applier
│ ├── llm/client.ts # gemini-3.1-flash-lite-preview via OpenAI-compatible endpoint
│ └── store/runs.ts # SQLite (WAL mode) run persistence
└── components/
├── RunCard.tsx # Run summary with progress track
├── StepTrace.tsx # Expandable step-by-step timeline
├── AnomalyChart.tsx # Recharts line chart with anomaly marker
├── DiffViewer.tsx # Syntax-highlighted unified diff
└── StatusBadge.tsx # Pill badge for run/step status
| Layer | Technology |
|---|---|
| Framework | Next.js 14 (App Router) |
| Language | TypeScript (strict) |
| Styling | Tailwind CSS |
| AI | Gemini 3.1 Flash via OpenAI-compatible endpoint |
| Analytics | Novus MCP API (JSON-RPC 2.0 over SSE) |
| Version control | GitHub REST API via Octokit |
| Persistence | SQLite with better-sqlite3 (WAL mode) |
| Notifications | Slack Incoming Webhooks |
PM Autopilot integrates with four Novus MCP tools:
| Tool | Used in | Purpose |
|---|---|---|
getArtifactMetrics |
detect, modal | Confirm metric drop is real; populate live snapshot |
listArtifactsByType |
artifact picker | Show real pages and features in the trigger modal |
listReplays + getSessionReplayEvents |
replay_scan | Find rage-click sessions, extract event sequences |
getArtifact |
locate (Tier 1) | Read data.currentCode.filePath from track events — no GitHub search needed |
createArtifact (type=guide) |
guide | Deploy in-app banner while PR is in review |
The auth layer uses OAuth 2.1 client_credentials against novus-api.pendo.io/mcp-auth/token, caches tokens for 24 hours, and auto-renews on 401 — all via raw node:https to bypass Next.js 14's patched fetch() which breaks SSE streams.
The locate step uses a precision hierarchy:
Tier 1 — Track event (zero search)
Novus stores data.currentCode.filePath for every tracked event.
→ Fetch that exact file from GitHub. No LLM ranking needed.
Tier 2 — Feature CSS selector
Novus stores the DOM selector for every feature (e.g. "#apply-coupon-btn").
→ Extract the most specific CSS token → GitHub code search → LLM ranks top 3.
Tier 3 — Replay text / artifact name (fallback)
Use the element string from session replay analysis.
→ GitHub code search → LLM ranks. Skipped (not failed) if nothing found.
All tiers are non-fatal — if a file can't be found, the fix step generates a patch from the failure pattern alone, the PR step is skipped, but guide and notify still run.
- Node.js 18+
- A Novus workspace
- A GitHub account
- A Google AI Studio key
git clone https://github.com/mohamdImran/pm-autopilot
cd pm-autopilot
npm installCopy and fill in .env.local:
# Novus — Service Account Credentials (Novus > Settings > Service Account)
NOVUS_CLIENT_ID=your_client_id
NOVUS_CLIENT_SECRET=your_client_secret
NOVUS_APP_ID=your_app_id
# GitHub OAuth App (github.com/settings/developers)
# Callback: http://localhost:3000/api/auth/github/callback
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
GITHUB_REPO=owner/repo # Target repo for PRs
# AI
GEMINI_API_KEY=AIza...
# Slack (optional)
SLACK_WEBHOOK_URL=https://hooks.slack.com/services/...
# Anomaly detection thresholds
ANOMALY_THRESHOLD=15 # Min % drop to trigger (default: 15)
MIN_VISITOR_COUNT=50 # Min visitors to avoid false positives
# Webhook security
WEBHOOK_SECRET= # HMAC-SHA256 for verifying Novus webhooksnpm run devGo to Settings → Integrations → GitHub → Authorize with GitHub. Select the target repository from the dropdown.
Click + New run → select a Novus page or feature → the live metric snapshot auto-loads → choose the metric with a drop → Run agent.
Set DEMO_MODE=true in .env.local to run the full pipeline with zero real credentials. All Novus, GitHub, LLM, and Slack calls are replaced with realistic mock data. The PR approve/reject actions update the run status without calling the GitHub API.
DEMO_MODE=true npm run devConfigure Novus to send anomaly signals to:
POST /api/webhook
X-Novus-Signature: sha256=<hmac-sha256-of-body>
{
"artifactId": "page-cart-001",
"metricName": "cart_conversion_rate",
"currentValue": 0.41,
"previousValue": 0.68
}
The webhook verifies the HMAC signature, creates a run, and fires the orchestrator asynchronously. Returns 202 Accepted immediately.
| Criterion | How PM Autopilot addresses it |
|---|---|
| Product Thinking | Sharp problem (PM triage time), clear user (SaaS PMs), one decision surface (approve/reject), respects the PM's judgment without replacing it |
| Craft and Execution | Full 8-step pipeline works end-to-end; UI is intentional; step trace is debuggable; error states are explicit (no silent fallbacks) |
| Originality | Novus getArtifact → currentCode.filePath → direct GitHub file fetch is a novel pattern; session replay → LLM → unified diff → PR is a new integration surface |
| Shippedness | Live deployable URL; Novus installed and tracking; behaviors measurable in the Novus dashboard; stranger can land and run an agent cycle immediately |
MIT