Margin Retention

Every pricing decision, with its evidence.

margin-retention / quote-workbench

Connecting to API

Try:

—

Product

Qty

Discount

Line GM

8.0%

—

Loading…

Decision, margin and reasons, from the live API.

A · SKU
B · Product
C · Units
D · Disc %
E · Net price
F · Revenue
G · GM %
H · Status
1
SKU-100
Air handler, 2-ton
2
4.0
393.60
787.20
32.7
sample
2
SKU-110
Condensing unit, 3-ton
7
7.5
629.00
4,403.00
31.6
sample
3
SKU-200
Condenser fan motor
12
10.0
130.50
1,566.00
29.5
sample
4
SKU-210
Coil guard
6
6.0
86.48
518.88
32.9
sample
5
SKU-300
Programmable thermostat
11
12.0
51.04
561.44
33.4
sample
6
SKU-310
Zone control panel
5
3.0
225.04
1,125.20
34.2
sample
7
SKU-100
Air handler, 2-ton
10
9.0
373.10
3,731.00
29.0
sample
8
SKU-110
Condensing unit, 3-ton
4
5.0
646.00
2,584.00
33.4
sample

Gold rows: your quotes. Others: sample flow.

78

automated backend tests

7

core workflow views

0

autonomous price changes

100%

deterministic policy checks

01 / The opportunity

Every decision has an owner.

01

Analyze

Cost, price, context.

02

Validate

Math and policy checks.

03

Submit

Analyst sends for review.

04

Approve

Manager decides.

05

Audit

Append-only record.

02 / Design principles

Built for explainability, not theater.

01

Correct math

Margin = (price − cost) / price.

02

Accountability

Submitter and approver are different people.

03

Fresh evidence

Any change forces revalidation.

04

Honest AI

Templates are labeled as templates.

05

Decision support

Never changes live prices.

03 / System design

A thin interface over hard rules.

Experience

React + TypeScript

Seven workflow views

↓ Typed API ↓

Service

FastAPI

Workflow orchestration

↓

Calculate

Margin math

Pure functions

Govern

Policy engine

Deterministic rules

Explain

Templates

Always labeled

↓

Record

SQLite

Append-only audit events

calc.py
def margin(price, cost):
    if price <= 0:
        raise ValueError()

    return (price - cost) / price

78 tests passed

Calculation · policy · workflow · service

Engineering quality

Confidence comes from testable boundaries.

Deterministic calculations and policies

Staleness tracked as a first-class state

Append-only audit history

No autonomous production actions

Python
FastAPI
SQLite
React
TypeScript
Vite
The outcome

AI-assisted.
Policy-bound.
Human-decided.

Return to portfolio