Skip to content

AutoPilot: 5 AI agents that autonomously run your Shopify store#2

Open
joshgaskin wants to merge 29 commits intoGrowzilla:mainfrom
joshgaskin:issue-1-shopify-autopilot
Open

AutoPilot: 5 AI agents that autonomously run your Shopify store#2
joshgaskin wants to merge 29 commits intoGrowzilla:mainfrom
joshgaskin:issue-1-shopify-autopilot

Conversation

@joshgaskin
Copy link
Copy Markdown

Summary

  • 5 autonomous AI agents (Rick, Hank, Ron, Marty, Marcus) running on a 60-second loop
  • Claude-powered personalities — agents narrate decisions in their own voice
  • Real actions: product deactivation, discount codes, purchase orders, customer campaigns, storefront widgets
  • Agent dialogue UI with avatars, click-to-filter, revert actions
  • Product intelligence — scoring, tiering, velocity, stockout prediction
  • PO system — Hank auto-creates purchase orders, tracks inbound stock
  • Customer segmentation — RFM analysis with Champions/Loyal/At Risk/New/Lost
  • Storefront widget — "Only X left!" urgency badges

Agents

Agent Domain Actions
Rick (Pickle Rick) Operations Deactivates zero-stock products, stockout alerts, health checks
Hank Supply Chain Product scoring, creates draft POs, tier tagging
Ron Finance Slow mover detection, creates discount codes
Marty Marketing Customer segmentation, win-back + VIP campaigns
Marcus Chief of Staff Coordinates all agents, deploys storefront widget, daily insights

Test plan

  • npm run dev — frontend on :3000, backend on :8000
  • Agents run autonomously on startup with seed data
  • Agent dialogue shows personality-rich commentary
  • PO created with line items
  • Discount codes created for slow movers
  • Products deactivated in local DB
  • Click agent card to filter dialogue
  • Revert button on actions
  • Customer segments page with donut chart
  • Render deploy live at shopify-autopilot.onrender.com

Closes #1

… widget

- 4-agent orchestration system (Rick/Hank/Ron/Marcus) with intelligence layer
- AutoPilot page: 4-tab command center (Agents/Inventory/Actions/Live)
- Segments page: RFM customer segmentation with donut chart
- Low-stock urgency widget for storefront injection
- Shell nav updated with AutoPilot + Segments entries

Refs #1
- Server-side agent orchestrator runs every 60s independently of browser
- Rick (ops), Hank (supply chain), Ron (finance), Marcus (coordinator)
- Intelligence layer: product scoring, stockout detection, slow movers
- Claude API integration for agent voice/personality narration
- Agent actions persisted to SQLite, exposed via /agents/* API
- Frontend polls backend for agent state (pure read-only dashboard)
- Sample data seed when Shopify sync unavailable

Refs #1
Realistic scenarios: hot sellers with stockout risk, slow movers for
discounting, health issues (missing images, $0 price, active+OOS),
draft products with stock. Weighted velocity patterns to trigger
all agent behaviors.

Refs #1
- Rick: deactivates zero-stock products, tags low-stock items
- Hank: tags products with tier labels, creates draft POs for reorders
- Ron: creates price rules + discount codes for slow movers
- Marcus: deploys storefront urgency widget via ScriptTag
- Graceful fallback: logs [DEMO] Would... when Shopify unavailable

Refs #1
- Marty: customer segmentation, win-back campaigns, VIP early-access,
  product tagging for content-before-discount strategy
- Agent cards now show profile pictures (avatars in /public/agents/)
- 5-agent grid layout, pulsing status indicator for active agents
- New action types: segment_analyzed, product_tagged, email campaigns

Refs #1
Replace flat ActionLog with AgentDialogue component:
- Chat bubble layout with agent avatars and colored left borders
- Marcus messages highlighted in accent green
- Fade-in animation on new messages
- Hover-to-show timestamps
- Type badges (Stockout, Discount, Campaign, etc.)

Refs #1
- Click an agent card to filter dialogue to just their actions
- Click again to show all agents
- Selected card gets accent border + ring
- Added profile images for Marcus, Hank, Marty, Ron
- Fixed avatar file extensions to match actual files

Refs #1
Every metric explains itself on hover:
- Tabs: what each section shows
- KPI cards: what the number means and which agent owns it
- Table columns: how scores/tiers/velocity/days-left are calculated
- References which agent acts on each metric

Refs #1
…racking

- purchase_orders + po_line_items SQLite tables
- Hank creates consolidated draft POs when products need restocking
- Inbound stock from active POs factored into days-left calculation
- Won't double-order: if inbound covers 7+ days, skips reorder
- GET /purchase-orders — list POs with line items
- GET /purchase-orders/inbound — inbound stock by product
- PATCH /purchase-orders/:id — update PO status

Refs #1
_has_acted keys are now restored from existing DB actions on startup.
Cycle counter also restored. Restart = 0 new actions (unless data changed).

Refs #1
- Hover any action to see "Revert" button (discounts, tags, POs, alerts)
- Reverted actions show strikethrough + red badge + greyed out
- Clears dedup key so agent can re-evaluate on next cycle
- POST /agents/actions/:id/revert endpoint

Refs #1
- /purchase-orders page with PO table, line item detail, inbound stock
- Click a PO row to expand line items
- "Advance status" button (draft → ordered → shipped → received)
- Inbound stock table showing what's on the way per product
- KPIs: active POs, drafts, in transit, total inbound units
- Added to sidebar nav

Refs #1
- Rick deactivates zero-stock products in local DB (status → draft)
- Ron saves discount codes to local discounts table
- GET /agents/discounts endpoint to view created codes
- Removed [DEMO] prefix — actions are real, just local instead of Shopify
- POs already working (Hank)

Refs #1
Product matching was falling through to variant title comparison (S/M/L)
which matched the first product for EVERY order. Now matches by product
title only. Also increased seed order volume and sharpened declining
product pattern so Ron/Hank actually trigger.

Results: 4 stockout alerts, 5 slow movers, 1 discount code, 1 PO with
214 units across 4 products.

Refs #1
Added CRITICAL DATA HONESTY RULES to every persona:
- Only reference numbers from actual data (stock, velocity, price, segments)
- Never invent CTR, conversion rates, margins, lead times, or analytics
- Shorter responses (1-2 sentences)
- "We'd need to check" instead of fabricating

Refs #1
…ients

Win-back and VIP campaigns now include Claude-generated email copy,
subject lines, recipient lists from customer DB, and discount codes.
Visible in the agent dialogue as full email previews.

Refs #1
- Removed 566 lines of dead client-side agent code (frontend/lib/agents/)
  Real agents are in backend/app/agents/
- Renamed email_sent → email_drafted (emails are drafted, not sent)
- Removed unused api import from autopilot.tsx
- Updated KPI labels to match reality

Refs #1
…does

- Orchestrator docstring clarifies local DB vs Shopify behavior
- CLAUDE.md now has full AutoPilot description with agent table,
  architecture, and key file references
- Ron's docstring updated to reflect local DB + Shopify dual mode
- Ready for code review

Refs #1
Homepage now sells AutoPilot:
- Hero with tagline + CTA to command center
- Store KPIs from live data
- Meet the Team — 5 agent cards with avatars and descriptions
- 3 pricing tiers: Starter ($49), Growth ($149), Enterprise (custom)

Refs #1
Restored dashboard to original. Added /pricing page with:
- Hero + CTA to command center
- Meet the Team — 5 agent cards with avatars
- 3 pricing tiers: Starter ($49), Growth ($149), Enterprise
- Added to sidebar nav

Refs #1
Pre-generated fixture files load on first startup:
- 32 agent actions with personality-rich commentary
- 5 agent states (all active)
- 1 purchase order (214 units, $8,963)
- 3 discount codes for slow movers

Anyone who clones and runs gets the full demo instantly.

Refs #1
…tary

- POST /agents/reset clears all actions, states, POs, discounts
- Resets dedup keys so agents re-evaluate everything
- Triggers immediate fresh cycle with new Claude narration
- Button next to tabs on autopilot page
- For live demos: click to watch agents think and act in real-time

Refs #1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shopify Hackathon: AutoPilot AI Agents

1 participant