xiaohongshu
xiaohongshu
dev-log-monitoring
This skill should be used when testing ScreenGraph end-to-end flows (drift detection, agent runs) while monitoring backend and frontend logs in real-time. Use when the user wants to observe system behavior across services, debug live runs, or verify event streaming.
Full skill instructions
Monitor backend (Encore.ts) and frontend (SvelteKit) logs during ScreenGraph development and testing. This skill provides a systematic workflow for starting services, capturing logs, navigating the app with Playwright MCP, and analyzing the complete event flow after execution.
Use this skill when:
Do NOT use this skill when:
Start Encore backend and pipe logs to a temporary file for later analysis:
cd /path/to/ScreenGraph/backend && encore run 2>&1 | tee /tmp/backend-logs.txt &
Wait for backend health check:
sleep 8 && curl -s http://localhost:4000/health
Expected response:
{"status":"healthy","database":"connected","timestamp":"..."}
Start SvelteKit frontend and pipe logs to a temporary file:
cd /path/to/ScreenGraph/frontend && bun run dev 2>&1 | tee /tmp/frontend-logs.txt &
Wait for frontend to be ready:
sleep 5 && curl -s http://localhost:5173 | head -n 1
Expected response:
<!doctype html>
Check both services are healthy:
# Backend
curl -s http://localhost:4000/health
# Frontend
curl -s http://localhost:5173 | head -n 1
Use Playwright MCP to open the app:
mcp_playwright_browser_navigate(url: "http://localhost:5173")
Click the "Detect My First Drift" button:
mcp_playwright_browser_click(
element: "Detect My First Drift button",
ref: [element_ref_from_snapshot]
)
Handle any alerts if backend wasn't ready:
mcp_playwright_browser_handle_dialog(accept: true)
The frontend should automatically redirect to /run/[runId]. If not:
mcp_playwright_browser_navigate(url: "http://localhost:5173/run/[runId]")
Get current page snapshot to verify run page loaded:
mcp_playwright_browser_snapshot()
Look for:
Monitor frontend activity:
mcp_playwright_browser_console_messages()
mcp_playwright_browser_network_requests()
Look for:
[Graph Stream] WebSocket opened[Graph Stream] Received event from streamGET /artifacts/content?refId=obj://...101 (successful)Grep for agent state machine activity:
tail -100 /tmp/backend-logs.txt | grep -E "(agent|graph|screenshot|drift)" -i
Key patterns to look for (see references/log_patterns.md for complete list):
Agent Nodes:
INF Node started actor=orchestrator nodeName=EnsureDeviceINF Node finished actor=orchestrator nodeName=EnsureDevice outcomeStatus=SUCCESSINF Node started actor=orchestrator nodeName=ProvisionAppINF Node started actor=orchestrator nodeName=LaunchOrAttachINF Node started actor=orchestrator nodeName=PerceiveINF Node started actor=orchestrator nodeName=WaitIdleINF Node started actor=orchestrator nodeName=StopEvent Recording:
INF Event recorded: agent.run.started eventSeq=1INF Event recorded: agent.event.screenshot_capturedINF Event recorded: agent.event.screen_perceivedINF Event recorded: agent.run.finishedGraph Projection:
INF Projection batch processed projectedScreens=1INF Backfill complete runEventsCount=23 graphOutcomesCount=1Grep for Vite and WebSocket activity:
tail -50 /tmp/frontend-logs.txt
Look for:
VITE v6.4.1 ready in [N] ms[vite] connectedGet full agent execution timeline with timestamps:
grep -E "5:07PM" /tmp/backend-logs.txt | grep -E "(Node started|Node finished|Event recorded)" | head -50
Check all events were recorded in order:
grep "Event recorded:" /tmp/backend-logs.txt | grep "5:07PM"
Expected sequence:
agent.run.started (seq=1)agent.node.started for each nodeagent.event.screenshot_capturedagent.event.ui_hierarchy_capturedagent.event.screen_perceivedgraph.screen.discovered (graph event)agent.run.finished (final)Look for Stop node output with final metrics:
grep "Stop OUTPUT" /tmp/backend-logs.txt | grep "5:07PM"
Example output:
metrics={"runDurationInMilliseconds":5326,"totalIterationsExecuted":5,"uniqueActionsPersistedCount":0,"uniqueScreensDiscoveredCount":0}
Verify both streams delivered all events:
grep "Backfill complete" /tmp/backend-logs.txt | grep "5:07PM"
Expected:
runEventsCount=23graphOutcomesCount=1Check artifacts were stored:
grep "screenshot" /tmp/backend-logs.txt | grep "5:07PM"
Look for artifact reference like:
obj://artifacts/[runId]/screenshot/[hash].png
Create a comprehensive summary with:
Example summary structure:
═══════════════════════════════════════════════════════════════════
🎯 DRIFT DETECTION FLOW - COMPLETE LOG SUMMARY
═══════════════════════════════════════════════════════════════════
Run ID: [runId]
App: [package]
Duration: [duration]
Status: ✅ COMPLETED
─────────────────────────────────────────────────────────────────
📊 AGENT STATE MACHINE FLOW
─────────────────────────────────────────────────────────────────
Step 1: EnsureDevice ([start] → [end])
✅ Device check: [deviceId] online
✅ Appium health check: port 4723 healthy
Step 2: ProvisionApp ([start] → [end])
✅ App install check: [package] already installed
[... continue for all nodes ...]
─────────────────────────────────────────────────────────────────
🎨 GRAPH PROJECTION
─────────────────────────────────────────────────────────────────
✅ [N] screen(s) discovered
✅ Hashes: [hash1], [hash2], ...
✅ Screenshots stored
─────────────────────────────────────────────────────────────────
📡 STREAMING ARCHITECTURE
─────────────────────────────────────────────────────────────────
Run Events: [N] events backfilled
Graph Events: [N] events backfilled
WebSocket: ✅ Connected
─────────────────────────────────────────────────────────────────
🌐 FRONTEND ACTIVITY
─────────────────────────────────────────────────────────────────
Console Logs:
- [LOG] [Graph Stream] WebSocket opened
- [LOG] [Graph Stream] Received event: graph.screen.discovered
Network:
- Screenshot fetch: ✅ 200 OK
- WebSocket upgrade: ✅ 101
─────────────────────────────────────────────────────────────────
📈 METRICS
─────────────────────────────────────────────────────────────────
Steps: [N]
Screens: [N]
Errors: [N]
Duration: [N]ms
If needed to stop services:
# Kill backend
pkill -f "encore run"
# Kill frontend
pkill -f "vite"
If logs need to be saved for later analysis:
# Copy logs to permanent location
cp /tmp/backend-logs.txt ./logs/backend-run-$(date +%Y%m%d-%H%M%S).txt
cp /tmp/frontend-logs.txt ./logs/frontend-run-$(date +%Y%m%d-%H%M%S).txt
Symptom: Failed to load resource: net::ERR_CONNECTION_REFUSED @ http://localhost:4000/
Fix:
# Check if encore is running
ps aux | grep "encore run"
# Restart if needed
cd backend && encore run 2>&1 | tee /tmp/backend-logs.txt &
sleep 8 && curl -s http://localhost:4000/health
Symptom: WebSocket connection to 'ws://localhost:5173/' failed
Fix:
# Kill existing processes
pkill -f "vite"
# Restart frontend
cd frontend && bun run dev 2>&1 | tee /tmp/frontend-logs.txt &
sleep 5
Symptom: Run page shows "0 events"
Check:
# Look for event recording in backend logs
grep "Event recorded:" /tmp/backend-logs.txt
# Check if run actually started
grep "agent.run.started" /tmp/backend-logs.txt
Symptom: projectedScreens=0 in all projection logs
Check:
# Verify graph service is loaded
curl -s http://localhost:4000/graph/diagnostics
# Check if screen perceived event was emitted
grep "agent.event.screen_perceived" /tmp/backend-logs.txt
Complete reference of all log patterns, event types, and metrics to watch for across backend and frontend services. Load this when analyzing specific log patterns or troubleshooting issues.
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience