feat: persist carpenter workflow status and price freshness

This commit is contained in:
alexpolo1
2026-03-29 12:27:06 +00:00
parent 3b7772c697
commit 10d94c7ff1
20 changed files with 3854 additions and 1659 deletions

View File

@@ -6,11 +6,30 @@ Use this file to keep AI assistants (Copilot, Claude, Cursor) aligned on project
**Tilbudgivern** is an AI-powered quote calculator for Danish carpenters, focused on roofing work. It uses OpenAI GPT-4 to generate professional quotes with auto-calculated materials and labor.
## Mission Memory
This is the core mission and should guide product, UX, AI, and data decisions:
- Tilbudgivern must make it possible for a carpenter to stand with the customer, note a few roof measurements and short project notes, and get to a usable quote draft as fast as possible.
- The primary use case is mobile phone on site or laptop in the van, so speed, low friction, and strong defaults matter more than long forms.
- The system should reuse as much historical data as possible from both local Tilbudgivern projects and Ordrestyring history.
- Smart Packages are the operational backbone: they should be easy to choose, easy to edit, and contain realistic carpenter tasks, hours, materials, and pricing structure.
- AI should act as a carpenter-friendly writing and cleanup assistant: fix spelling and structure, turn rough notes into sharp customer-facing offer text, but never silently invent or change factual numbers.
- Every quote flow should create reusable historical learning signals, so the system gets better the more it is used.
Short version:
> Fast field quote creation for carpenters, powered by reusable history, editable Smart Packages, and AI-assisted customer text.
## Active Focus
- [ ] Smart Packages testing and refinement
- [ ] UI/UX improvements for quote creation flow
- [ ] Ordrestyring API GraphQL migration
- [ ] 2-minute quick quote flow for field use
- [ ] Reuse historical data from local projects + Ordrestyring in Smart Package selection
- [ ] Keep Smart Packages editable but prefilled from history
- [ ] Generate structured AI quote drafts from project/package/material/labor data
- [ ] Capture learning data from each completed quote flow
- [ ] Persist project workflow status in DB: `geometry_complete -> smart_package_complete -> review_pending -> ready_for_ordrestyring -> sent_to_ordrestyring`
- [ ] Show latest material pricelist freshness from persisted import logs/API in carpenter flow
## Tech Stack Quick Reference
@@ -48,6 +67,7 @@ Pre-configured roofing packages with auto-calculation:
- [CLAUDE.md](CLAUDE.md) - Claude Code instructions
- [docs/README.md](docs/README.md) - Documentation index
- [docs/deployment/PM2_GUIDE.md](docs/deployment/PM2_GUIDE.md) - PM2 management
- [docs/MISSION.md](MISSION.md) - Product mission and North Star
### Features
- [docs/features/SMART_PACKAGES_COMPLETE_CATALOG.md](docs/features/SMART_PACKAGES_COMPLETE_CATALOG.md) - All 15 packages
@@ -102,6 +122,15 @@ Required in `backend/.env`:
Optional:
- `ORDRESTYRING_API_TOKEN`, `OPENAI_ADMIN_KEY`
Business-owned OpenAI setup:
- All OpenAI usage must use the shared business account configuration, not ad hoc personal/project credentials.
- Prefer the centralized backend config helpers over direct client initialization.
Workflow state memory:
- Final Review must not force sending. A carpenter must be able to leave a quote in `ready_for_ordrestyring` and return later.
- Frontend status displays should prefer persisted DB/API state over hardcoded assumptions.
- Material price freshness should come from persisted import logs such as Bygma/Stark import history, not from frontend-only state.
## How to Use with AI Assistants
**VS Code Copilot:**
@@ -120,4 +149,4 @@ See .cursorrules and COPILOT_MEMORY.md for project context.
```
---
*Last updated: January 2026*
*Last updated: 2026-03-29*

99
docs/MISSION.md Normal file
View File

@@ -0,0 +1,99 @@
# Tilbudgivern Mission
Last updated: 2026-03-29
## North Star
Tilbudgivern exists to make quote creation so fast and reliable that a carpenter can stand with the customer, measure the roof, note a few project facts, and leave with a strong quote draft the same day.
The product should work equally well on:
- mobile phone on site
- laptop in the van
- desktop in the office
## Core Mission
1. Minimize friction in the field.
The carpenter should only need a few inputs to get started:
- customer/address
- project type
- roof type/material
- length/width/pitch or rough area
- short customer note
2. Reuse as much real data as possible.
Tilbudsgiveren should prefer real historical evidence over empty forms:
- local Tilbudgivern project history
- synced Ordrestyring history
- previously used Smart Packages
- previously accepted/sent offers
3. Make Smart Packages the operational backbone.
Smart Packages should be:
- quick to choose
- easy to edit
- grounded in real carpenter work
- structured with materials, tasks, hours, and pricing
4. Let AI help with language, not fake facts.
AI should:
- fix spelling and messy notes
- structure rough carpenter input
- produce sharp, customer-friendly offer text
- explain the work clearly
AI must not:
- invent measurements
- invent prices
- silently change quantities, rates, or totals
- fabricate work not present in project/package data
5. Make the system improve through usage.
Every completed quote flow should create reusable learning signals:
- what package was suggested
- what package was chosen
- what materials/tasks were changed
- what text was accepted
- which historical cases were used
The system should get better over time as more quotes are created.
## Product Principles
- Field-first beats backoffice-first.
- Prefill beats blank state.
- Editable beats locked automation.
- Real history beats generic AI.
- Short path to first useful draft beats perfect initial completeness.
- Structured project data beats free-text prompts.
## What “Good” Looks Like
A carpenter can:
- create a project in under 2 minutes
- get a relevant Smart Package recommendation automatically
- receive suggested materials and hours from similar jobs
- generate a customer-ready quote draft from structured data
- correct mistakes quickly before sending
- leave the quote in a clear persisted status before sending to Ordrestyring
## Implementation Direction
When choosing features, architecture, or UX, prefer work that moves the product toward:
- quick quote flow
- strong historical matching
- local sync and reuse of Ordrestyring data
- structured quote generation
- mobile-friendly editing and confirmation
- persisted workflow states that match the real carpenter journey
- visible material pricelist freshness from synced supplier/import data
- measurable learning from accepted/edited quotes
## Non-Goals
Avoid optimizing primarily for:
- long admin workflows before first quote value
- AI-generated content without structured project grounding
- rigid package systems that are hard for carpenters to override
- flows that assume office-only usage