Michael Chihlas 66e592096c feat(pilot): Phase 3 — Suggested fix tracking + Resolve preview with state_version cache
Adds the AI-proposed resolution path and the inline preview of the
markdown that will be posted to the customer ticket on Resolve. The
preview is keyed on (session_id, ai_sessions.state_version) so back-to-
back fetches against unchanged state hit an in-process cache instead
of paying for a Sonnet call.

Backend:
- preview_cache: in-process LRU keyed on (kind, session_id, state_version).
  No TTL — state_version is the source of truth. Soft-cap 5000 entries.
- unified_chat_service: [SUGGEST_FIX] parser (last-block-wins, JSON
  payload, confidence clamped 0-100), supersession persistence (sets
  superseded_at on prior active row), atomic state_version bump.
- ResolutionNoteGeneratorService: pulls session, facts, active fix, and
  redacted script_generations into a structured input bundle for Sonnet;
  produces the four-section markdown (Problem / What we confirmed /
  Root cause / Resolution). Sensitive script parameters redacted via
  ScriptTemplateEngine.redact_sensitive driven by the template's
  parameters_schema.
- /api/v1/ai-sessions/{id}/suggested-fixes/active — 200 with the active
  fix or 404.
- /api/v1/ai-sessions/{id}/suggested-fixes/{fix_id}/decision — records
  one_off / draft_template / build_template / dismissed; dismiss
  supersedes; bumps state_version. 409 on dismissing an already-
  superseded fix.
- /api/v1/ai-sessions/{id}/resolution-note/preview — generates or returns
  cached markdown; from_cache flag in payload signals cache hit.
- scripts.py POST /generate now bumps state_version on the linked
  ai_session_id when present (third source of preview-cache invalidation
  per Section 5.5).
- ASSISTANT_SYSTEM_PROMPT documents [SUGGEST_FIX] (when to/not to emit,
  format, supersession semantics).
- 12 tests covering the parser (well-formed, last-wins, malformed,
  confidence clamping), supersession + state_version invariant, all
  decision branches, preview cache hit-on-no-change + miss-after-write.

Frontend:
- src/components/pilot/sections/SuggestedFix.tsx — amber-accented card
  with confidence badge; dismiss action wired to the decision endpoint.
- src/components/pilot/ResolutionNotePreview.tsx — popover with refresh,
  loading state, cached/fresh indicator, ticket-ref display.
- src/api/sessionSuggestedFixes.ts — typed client; getActive normalizes
  404 to null so callers don't have to special-case.
- TaskLane gains suggestedFixSlot + bottomSlot props (rendered after
  Diagnostic Checks; bottomSlot anchors the Resolve action).
- AssistantChatPage: refreshSessionDerived helper batches fact + fix
  refresh; fact mutations and chat sends both schedule a 500ms-debounced
  preview refresh per the Section 5.5 spec.

Verified end-to-end against the dev stack with a real Sonnet call:
- /active 404 → fact create → preview generates four-section markdown
  grounded only in provided facts → second preview call hits cache
  (from_cache=true, no LLM call) → fact write 2 → cache miss, regenerates.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 21:45:52 -04:00

ResolutionFlow

Stop writing ticket notes. Start generating them.

ResolutionFlow is an AI-powered troubleshooting platform for MSP professionals. Engineers follow guided flows while an AI copilot assists — and documentation writes itself as a byproduct of the work.

Production: resolutionflow.com


Quick Start

# Prerequisites: Docker, Python 3.11+, Node.js 20+

# Start PostgreSQL
docker start patherly_postgres

# Backend
cd backend
source venv/bin/activate
pip install -r requirements.txt
alembic upgrade head
uvicorn app.main:app --reload

# Frontend (separate terminal)
cd frontend
npm install
npm run dev

See DEV-ENV.md for full environment setup (devserver, Docker, CORS).


Features

FlowPilot AI Copilot

Like having a senior engineer on every call. FlowPilot guides troubleshooting decisions, suggests next steps with context-aware intelligence, and automatically captures documentation as a byproduct of the session.

  • Confidence-tiered model routing (fast responses for simple steps, deeper reasoning for complex decisions)
  • AI-generated ticket summaries and session documentation
  • Standalone assistant chat with RAG for open-ended troubleshooting
  • Knowledge Flywheel: AI analyzes completed sessions and proposes new flows automatically

Guided Flows

  • Troubleshooting Flows — Decision trees with branching paths for diagnosing issues
  • Procedural Flows (Projects) — Step-by-step checklists for onboarding, migrations, deployments
  • Maintenance Flows — Scheduled recurring tasks with batch execution across multiple targets
  • Visual Flow Editor with drag-and-drop canvas, undo/redo, markdown support
  • AI Flow Builder — describe what you need, get a complete flow generated

Auto-Documentation

Every session generates timestamped, detailed notes formatted for your PSA. Engineers never write another ticket note.

  • Export to Markdown, plain text, or HTML
  • Sensitive data redaction
  • One-click push to ConnectWise PSA tickets

ConnectWise PSA Integration

  • Post session documentation directly to ConnectWise tickets as internal notes
  • Pull ticket details and client context into FlowPilot sessions
  • Member mapping between ResolutionFlow and ConnectWise users
  • Credentials encrypted at rest (Fernet), stored per-team

Team & Knowledge Management

  • Role-based access (super_admin, team_admin, engineer, viewer)
  • Shared flow library with categories, tags, folders, full-text search
  • Step Library — reusable troubleshooting steps with ratings and reviews
  • Session sharing via link (authenticated and public views)
  • Escalation workflow with AI-enhanced briefing packages
  • Flow proposals from AI analysis (review queue for team leads)

Tech Stack

Layer Technology
Frontend React 19, TypeScript, Vite, Tailwind CSS v4
State Zustand (immer + zundo for undo/redo)
Routing React Router v7
Canvas @xyflow/react (React Flow) + dagre
Backend Python FastAPI, async SQLAlchemy 2.0 + asyncpg
Database PostgreSQL 16
Migrations Alembic (75+ migrations)
Auth JWT (python-jose) + bcrypt, refresh token rotation
AI Anthropic Claude API (tiered model routing)
Embeddings Voyage AI (semantic search)
Scheduling APScheduler 3.x (async)
Analytics PostHog
Hosting Railway (auto-deploy on push to main)

Project Structure

patherly/
├── backend/
│   ├── app/
│   │   ├── main.py                 # FastAPI entry point
│   │   ├── api/endpoints/          # Route handlers (35+ endpoints)
│   │   ├── core/                   # Config, database, permissions, security
│   │   ├── models/                 # SQLAlchemy models
│   │   ├── schemas/                # Pydantic schemas
│   │   └── services/psa/           # PSA provider abstraction layer
│   ├── alembic/                    # Database migrations
│   └── tests/                      # Integration tests (100+)
├── frontend/
│   ├── src/
│   │   ├── components/             # UI components by domain
│   │   ├── pages/                  # Page components
│   │   ├── store/                  # Zustand stores
│   │   └── types/                  # TypeScript interfaces
├── docs/                           # Design docs, plans, ConnectWise reference
├── brand-assets/                   # SVGs, brand guide
├── CLAUDE.md                       # AI assistant project context
├── CURRENT-STATE.md                # Detailed feature status
└── CHANGELOG.md                    # Release history

Running Tests

# Backend integration tests
cd backend
pytest --override-ini="addopts="

# Frontend build (stricter than tsc --noEmit)
cd frontend
npm run build

Documentation

Document Purpose
CLAUDE.md Full project context for AI-assisted development
CURRENT-STATE.md Detailed feature status
03-DEVELOPMENT-ROADMAP.md Development roadmap
UI-DESIGN-SYSTEM.md Design system (Slate & Ice)
DEV-ENV.md Development environment setup
CHANGELOG.md Release history

License

Proprietary. All rights reserved.

Description
Troubleshooting decision tree application for MSP engineers - automatically generates professional documentation from guided diagnostic workflows
Readme 16 MiB
Languages
Python 54.7%
TypeScript 43.5%
HTML 1.1%
CSS 0.6%