Sovereign Engineering (ADR-261)

Service Design System — Organisation-Level Service Menu, Fee Negotiation & Automated Agreement Dispatch

Think of this system as an organisation-level service menu — what you sell as an agency, and at what standard price. Before this system, every service was a one-off line item on an asset. There was no catalogue. There was no way to say "Tenant Finder costs 8.4% PCM, standard rate, across all properties."

Author: Architect (Kimi K3) Status: Eugin-approved concept — ready for Programmer Date: 2026-07-20 Target: db_raia
← Back to Developer Hub TEXTBOOK SPECIFICATION
In Plain English

Think of this system as an organisation-level service menu — what you sell as an agency, and at what standard price. Before this system, every service was a one-off line item on an asset. There was no catalogue. There was no way to say "Tenant Finder costs 8.4% PCM, standard rate, across all properties."

The Service Design System changes that. It lets each agency define their own catalogue of services with standard fees, negotiate per-landlord discounts (with documented reasons), and automatically dispatch a legally compliant service agreement via HelloSign e-signature. Two Paperclip agents handle the workflow: ServiceOnboardingAgent walks the landlord through service selection and fee agreement, and ComplianceOnboardingAgent runs AML/KYC checks in parallel. Both are jurisdiction-aware — UK Renters Rights Act (RRA) fee transparency rules for GB, Thailand PDPA rules for TH.

The result: a repeatable, audit-trailed, legally compliant onboarding process that works for any jurisdiction, any agency, any landlord. No more manual PDFs, no more guessing what the standard fee is, no more compliance gaps.

Service Design Menu UX

Organisation Settings > Service Design

The Service Design tab lives inside Organisation Settings, alongside General, Branding, Billing, Compliance, and Team. It is split by jurisdiction — each jurisdiction gets its own section with its own service catalogue.

Catalogue Table

┌─────────────────────────────────────────────────────────────────────┐
│  Organisation Settings  >  Service Design                           │
│                                                                     │
│  ┌──────────────────────────────────────────────────────────────┐  │
│  │ 🇬🇧 United Kingdom                         [+ Add Service]  │  │
│  └──────────────────────────────────────────────────────────────┘  │
│                                                                     │
│  ┌──────┬──────────────┬────────────┬──────────────┬──────────┬──┐  │
│  │ Name │ Description  │ Std Fee    │ Fee Type     │ Status   │ ⋮ │  │
│  ├──────┼──────────────┼────────────┼──────────────┼──────────┼──┤  │
│  │ TF   │ Find tenants │ 8.4% PCM  │ % of Rent    │ Active   │ ⋮ │  │
│  │ RC   │ Collect rent │ 12% PCM   │ % of Rent    │ Active   │ ⋮ │  │
│  │ MP   │ Full mgmt    │ 15% PCM   │ % of Rent    │ Active   │ ⋮ │  │
│  │ FS   │ Full cover   │ 18% PCM   │ % of Rent    │ Active   │ ⋮ │  │
│  │ VM   │ Vacant mgmt  │ £120/mo   │ Fixed Monthly│ Active   │ ⋮ │  │
│  │ PS   │ Property sl  │ 1.5%      │ % of Sale    │ Active   │ ⋮ │  │
│  └──────┴──────────────┴────────────┴──────────────┴──────────┴──┘  │
│                                                                     │
│  ┌──────────────────────────────────────────────────────────────┐  │
│  │ 🇹🇭 Thailand                                [+ Add Service]  │  │
│  └──────────────────────────────────────────────────────────────┘  │
│                                                                     │
│  ┌──────┬──────────────┬────────────┬──────────────┬──────────┬──┐  │
│  │ Name │ Description  │ Std Fee    │ Fee Type     │ Status   │ ⋮ │  │
│  ├──────┼──────────────┼────────────┼──────────────┼──────────┼──┤  │
│  │ PM   │ Full mgmt    │ ฿5,000/mo  │ Fixed Monthly│ Active   │ ⋮ │  │
│  │ SC   │ Short-let    │ 20% PCM    │ % of Rent    │ Active   │ ⋮ │  │
│  └──────┴──────────────┴────────────┴──────────────┴──────────┴──┘  │
│                                                                     │
│  ┌──────────────────────────────────────────────────────────────┐  │
│  │ 💰 Negotiations (Pending)                                      │  │
│  │ [Draft] [Sent] [Signed] [Past/Archive] [All]  │  │
│  └──────────────────────────────────────────────────────────────┘  │
│  ┌──────┬────────────┬────────────┬──────────────┬──────────┬──┐  │
│  │ Landlord│ Service  │ Std Fee    │ Agreed Fee   │ Status   │ ⋮ │  │
│  ├──────┼────────────┼────────────┼──────────────┼──────────┼──┤  │
│  │ J. Smith│ Full Mgmt│ 15% PCM    │ 12% PCM      │ Signed   │ ✎ │  │
│  │ M. Lee │ Tenant Fd │ 8.4% PCM   │ 7% PCM       │ Draft    │ ✎ │  │
│  └──────┴────────────┴────────────┴──────────────┴──────────┴──┘  │
└─────────────────────────────────────────────────────────────────────┘
    

Filter Pills

The negotiations table includes filter pills to narrow the list by agreement status. The order is: Draft, Sent, Signed, Past/Archive, All. "All" is intentionally last because it is the slowest query — it loads every negotiation record. The "Missing" status was removed entirely: not-signed is inherently captured by Draft or Sent, so a separate "Missing" pill was redundant (KISS principle). "In Discussion" was also removed — it was redundant with Draft/Sent states; KISS.

Default View

On page load, the default view is the list view (not a grid/kanban). The active filter pill is determined by:

  • If Draft > 0 → default to Draft
  • Else if Sent > 0 → default to Sent
  • Else → default to Signed

This ensures staff land on the most actionable queue — drafts needing attention, then sent agreements awaiting signature, then signed records.

Create / Edit Service Modal

Clicking "+ Add Service" or the edit icon opens a modal with the following fields:

┌───────────────────────────────────────────────┐
│  ✏️ Create Service                              │
│                                                 │
│  Service Name:    [Tenant Finder Service    ]   │
│  Description:     [Find and vet tenants     ]   │
│                  [for your property         ]   │
│                                                 │
│  Jurisdiction:    [🇬🇧 United Kingdom  ▼]        │
│  Service Type:    [tenant_finder        ▼]      │
│  Bundle:          [stand_alone          ▼]      │
│                                                 │
│  ── Standard Fee ──                              │
│  Fee Type:        [% of Rent           ▼]       │
│  Fee Value:       [8.4                  ]  %    │
│  Currency:        [GBP                  ▼]      │
│  Label:           [8.4% of monthly rent   ]     │
│                                                 │
│  ── Fee Transparency (RRA Compliance) ──         │
│  What this fee covers:                          │
│  [Tenant find, referencing, Right to Rent   ]   │
│  [check, tenancy agreement, inventory       ]   │
│                                                 │
│  RRA Exempt?  [ ] (e.g., utilities pass-through)│
│                                                 │
│  ── Additional Fees (Optional) ──                │
│  ☑ Gas Safety Cert        £120                  │
│  ☐ EICR                   £220                  │
│  ☑ Tenancy Setup          £150                  │
│                                                 │
│  Active:        [✓]                              │
│  Effective From: [2026-08-01    ]                │
│                                                 │
│  [Cancel]           [Save Service]               │
└───────────────────────────────────────────────┘
    

Fee Negotiation Panel

When a landlord wants a discount, staff open the negotiation panel from the negotiations table. This shows the standard fee alongside the proposed agreed fee, with a required discount reason, internal staff notes, and a draft email preview.

┌─────────────────────────────────────────────────┐
│  💰 Negotiate Fee — John Smith                    │
│  Property: 123 High Street, London                │
│                                                  │
│  Service: Full Management (Property Manager)     │
│  Standard Fee: 15% PCM (£1,500/mo on £10k rent)  │
│                                                  │
│  ── Agreed Fee ──                                 │
│  Fee Type:  [% of Rent                   ▼]      │
│  Fee Value: [12.0                       ]  %      │
│  Label:     [12% of monthly rent           ]     │
│                                                  │
│  Discount Reason:                                │
│  [Portfolio consolidation — 3 properties    ]    │
│  [managed by RAIA (Real estate Artificial Intelligence Agent)                         ]     │
│                                                  │
│  Discount Note (internal):                       │
│  [John is moving all 3 properties from      ]    │
│  [competitor. Offered 12% for 24-month      ]    │
│  [commitment.                              ]     │
│                                                  │
│  ── Draft Email (optional) ──                    │
│  [Preview]  [Send to Landlord]                    │
│                                                  │
│  [Cancel]  [Save as Draft]  [Send via HelloSign] │
└─────────────────────────────────────────────────┘
    

The "Send via HelloSign" button triggers the automated agreement dispatch. It is disabled until the compliance check passes and the fee has been approved (HITL gate cleared if the discount is >20% of standard).

The Two Agents

ServiceOnboardingAgent

Trigger: A new landlord person record is created in tbl_persons with status = 'lead' and the first asset is linked via tbl_asset_ownership.

Flow:

New Landlord + Asset
       │
       ▼
┌────────────────────────────────────────────────────────────────┐
│  ServiceOnboardingAgent                                        │
│                                                                │
│  1. Discovery — Reads the org's tbl_service_catalog for the    │
│     jurisdiction. Presents services to the landlord.           │
│                                                                │
│  2. Selection — Landlord picks services. Agent writes          │
│     tbl_service_negotiations rows (status = 'pending').        │
│                                                                │
│  3. Fee Agreement — Agent presents standard fee. If discount   │
│     requested, creates draft with discount reason, flags for   │
│     HITL approval if >20% below standard.                      │
│                                                                │
│  4. HITL Gate #1 — If negotiated fee < 80% of standard fee,   │
│     or discount reason is blank, the negotiation is blocked    │
│     at 'pending' until staff reviews and approves.             │
│                                                                │
│  5. Agreement Generation — Selects correct HelloSign template  │
│     for jurisdiction + service type. Calls HelloSign API to    │
│     create signature request with populated merge fields.      │
│                                                                │
│  6. Signing — HelloSign sends signing email to landlord.       │
│     Agent monitors webhook callback.                           │
│                                                                │
│  7. Post-Signing — On webhook 'signature_request_signed':      │
│     - Downloads signed PDF to GCS                              │
│     - Creates tbl_documents row                                │
│     - Updates tbl_service_agreements with document_id, signed_at│
│     - Creates tbl_service_agreement_assets rows                │
│     - Creates tbl_services rows for each asset                 │
│     - Updates tbl_service_negotiations status to 'accepted'    │
│                                                                │
│  8. Notification — Sends welcome message to landlord with      │
│     summary of selected services, fees, and next steps.        │
└────────────────────────────────────────────────────────────────┘
    

ComplianceOnboardingAgent

Trigger: Same trigger as ServiceOnboardingAgent (new landlord + asset). Runs in parallel, but the agreement signing is gated on compliance passing.

New Landlord + Asset
       │
       ▼
┌────────────────────────────────────────────────────────────────┐
│  ComplianceOnboardingAgent                                     │
│                                                                │
│  1. Jurisdiction Detection — Reads un_locode from the asset.   │
│     Maps to jurisdiction (GB, TH, etc.).                       │
│                                                                │
│  2. Check Execution — Runs checks per jurisdiction:            │
│     - GB: Sumsub AML + Kamma licence check + Companies House   │
│     - TH: ID document verification + PEP screening + basic AML │
│                                                                │
│  3. Result Writing — Creates tbl_compliance_checks rows with   │
│     check_status, risk_level, provider_ref, provider_result.   │
│                                                                │
│  4. HITL Gate #2 — If check_status = 'failed' or risk_level = │
│     'critical', BLOCK signing. Flag to compliance team for     │
│     manual review.                                             │
│                                                                │
│  5. Gate Signal — Writes a signal ServiceOnboardingAgent reads:│
│     compliance_ok = true/false. Agreement signing is gated on  │
│     this.                                                      │
└────────────────────────────────────────────────────────────────┘
    

Combined Orchestration Flow

New Landlord Event
       │
       ▼
┌───────────────────┐
│ Orchestrator      │  (Paperclip master agent)
│ Creates:          │
│ - ServiceOnboard  │
│ - ComplianceOnboard│
└───────────────────┘
       │
       ├──────────────────┐
       ▼                  ▼
┌──────────────┐  ┌──────────────────┐
│ Service      │  │ Compliance       │
│ Onboarding   │  │ Onboarding       │
│ Agent        │  │ Agent            │
│              │  │                  │
│ 1. Catalog   │  │ 1. AML/KYC      │
│ 2. Select    │  │ 2. Sanctions    │
│ 3. Negotiate │  │ 3. Licence      │
│              │  │                  │
└──────┬───────┘  └────────┬─────────┘
       │                   │
       │   (parallel)      │
       │                   │
       ▼                   ▼
┌──────────────────────────────────┐
│         HITL Gate #1            │
│  (negotiation < 80% std fee)    │
│         HITL Gate #2            │
│  (compliance failed/critical)   │
└──────────────────────────────────┘
       │
       ▼
┌──────────────────────────────────┐
│  Agreement Dispatch              │
│  - HelloSign send                │
│  - Landlord signs                │
│  - PDF → GCS + tbl_documents    │
│  - tbl_service_agreements row    │
│  - tbl_service_agreement_assets  │
│  - tbl_services rows             │
└──────────────────────────────────┘
       │
       ▼
┌──────────────────────────────────┐
│  Notification                    │
│  - Welcome message to landlord   │
│  - Summary of services/fees      │
│  - Next steps                    │
└──────────────────────────────────┘
    

Data Model

Four new tables, one ALTER on an existing table, and a few seed inserts. Here is the entity relationship at a glance:

tbl_organisations
  │
  ├─── tbl_service_catalog (org defines their services)
  │      │  Columns: catalog_id, organisation_id, jurisdiction,
  │      │  service_name, service_description, service_type,
  │      │  standard_fee_type, standard_fee_value,
  │      │  standard_fee_currency, standard_fee_label,
  │      │  additional_fee_ids (UUID[] → tbl_charges_pricing),
  │      │  fee_transparency_notes, rra_exempt, is_active,
  │      │  effective_from, effective_until, sort_order
  │      │
  │      ├─── tbl_service_negotiations (per-landlord fee negotiation)
  │      │      │  Columns: negotiation_id, organisation_id,
  │      │      │  catalog_id, person_id, agreed_fee_type/value/currency,
  │      │      │  status (pending/accepted/declined/expired/superseded),
  │      │      │  discount_reason, discount_note, negotiated_by,
  │      │      │  agreement_id, expires_at
  │      │      │
  │      │      └─── tbl_service_agreements (resulting contract)
  │      │             │  NEW COLUMNS: catalog_id, negotiation_id,
  │      │             │  hello_sign_signature_request_id,
  │      │             │  hello_sign_signing_url
  │      │             │
  │      │             ├─── tbl_service_agreement_assets (assets covered)
  │      │             │      └─── tbl_services (existing per-asset rows)
  │      │             │
  │      │             └─── tbl_documents (signed PDF via HelloSign)
  │      │
  │      └─── tbl_hello_sign_templates (per-org template registry)
  │             Columns: template_id, organisation_id, jurisdiction,
  │             template_name, hello_sign_template_id, service_type,
  │             is_active, version, signature_roles, field_mapping (JSONB)
  │
  ├─── tbl_charges_pricing (org-level operational fee catalog)
  │
  ├─── tbl_compliance_checks (ComplianceOnboardingAgent results)
  │      Columns: check_id, organisation_id, person_id, jurisdiction,
  │      check_type (aml/sanctions/kyc/identity), check_status,
  │      check_provider, provider_ref, provider_result (JSONB),
  │      risk_level, risk_factors, reviewed_by, review_notes
  │
  └─── tbl_organisations_attributes (hello_sign keys, rra flags)
    
DDL (click to expand)
-- tbl_service_catalog
CREATE TABLE tbl_service_catalog (
    catalog_id          UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    organisation_id     UUID NOT NULL REFERENCES tbl_organisations(organisation_id),
    jurisdiction        CHAR(2) NOT NULL CHECK (jurisdiction IN ('GB', 'TH')),
    service_name        TEXT NOT NULL,
    service_description TEXT,
    service_type        TEXT NOT NULL,
    service_bundle      TEXT,
    is_bundle           BOOLEAN NOT NULL DEFAULT false,
    standard_fee_type   TEXT NOT NULL CHECK (standard_fee_type IN ('percent_of_rent','fixed_monthly','fixed_per_let','percent_of_sale','custom')),
    standard_fee_value  NUMERIC(12,2) NOT NULL,
    standard_fee_currency CHAR(3) NOT NULL DEFAULT 'GBP',
    standard_fee_label  TEXT,
    additional_fee_ids  UUID[] DEFAULT '{}',
    fee_transparency_notes TEXT,
    rra_exempt          BOOLEAN NOT NULL DEFAULT false,
    is_active           BOOLEAN NOT NULL DEFAULT true,
    effective_from      DATE,
    effective_until     DATE,
    sort_order          INTEGER NOT NULL DEFAULT 0,
    created_at          TIMESTAMPTZ NOT NULL DEFAULT now(),
    updated_at          TIMESTAMPTZ NOT NULL DEFAULT now()
);

-- tbl_service_negotiations
CREATE TABLE tbl_service_negotiations (
    negotiation_id      UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    organisation_id     UUID NOT NULL REFERENCES tbl_organisations(organisation_id),
    catalog_id          UUID NOT NULL REFERENCES tbl_service_catalog(catalog_id),
    person_id           UUID NOT NULL REFERENCES tbl_persons(person_id),
    agreed_fee_type     TEXT NOT NULL,
    agreed_fee_value    NUMERIC(12,2) NOT NULL,
    agreed_fee_currency CHAR(3) NOT NULL DEFAULT 'GBP',
    agreed_fee_label    TEXT,
    status              TEXT NOT NULL DEFAULT 'pending' CHECK (status IN ('pending','accepted','declined','expired','superseded')),
    discount_reason     TEXT,
    discount_note       TEXT,
    negotiated_by       UUID REFERENCES tbl_profiles(profile_id),
    negotiated_at       TIMESTAMPTZ,
    agreement_id        UUID REFERENCES tbl_service_agreements(agreement_id),
    expires_at          TIMESTAMPTZ,
    created_at          TIMESTAMPTZ NOT NULL DEFAULT now(),
    updated_at          TIMESTAMPTZ NOT NULL DEFAULT now()
);

-- tbl_hello_sign_templates
CREATE TABLE tbl_hello_sign_templates (
    template_id         UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    organisation_id     UUID NOT NULL REFERENCES tbl_organisations(organisation_id),
    jurisdiction        CHAR(2) NOT NULL,
    template_name       TEXT NOT NULL,
    hello_sign_template_id TEXT NOT NULL,
    service_type        TEXT,
    is_active           BOOLEAN NOT NULL DEFAULT true,
    version             INTEGER NOT NULL DEFAULT 1,
    signature_roles     TEXT[] NOT NULL DEFAULT '{landlord,agent}',
    field_mapping       JSONB NOT NULL DEFAULT '{}',
    created_at          TIMESTAMPTZ NOT NULL DEFAULT now(),
    updated_at          TIMESTAMPTZ NOT NULL DEFAULT now()
);

-- tbl_compliance_checks
CREATE TABLE tbl_compliance_checks (
    check_id            UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    organisation_id     UUID NOT NULL REFERENCES tbl_organisations(organisation_id),
    person_id           UUID NOT NULL REFERENCES tbl_persons(person_id),
    jurisdiction        CHAR(2) NOT NULL,
    check_type          TEXT NOT NULL,
    check_status        TEXT NOT NULL DEFAULT 'pending' CHECK (check_status IN ('pending','in_progress','passed','failed','referred')),
    check_provider      TEXT,
    provider_ref        TEXT,
    provider_result     JSONB,
    risk_level          TEXT CHECK (risk_level IN ('low','medium','high','critical')),
    risk_factors        TEXT[],
    reviewed_by         UUID REFERENCES tbl_profiles(profile_id),
    reviewed_at         TIMESTAMPTZ,
    review_notes        TEXT,
    created_at          TIMESTAMPTZ NOT NULL DEFAULT now(),
    completed_at        TIMESTAMPTZ
);

-- ALTER existing tbl_service_agreements
ALTER TABLE tbl_service_agreements ADD COLUMN IF NOT EXISTS catalog_id UUID REFERENCES tbl_service_catalog(catalog_id);
ALTER TABLE tbl_service_agreements ADD COLUMN IF NOT EXISTS negotiation_id UUID REFERENCES tbl_service_negotiations(negotiation_id);
ALTER TABLE tbl_service_agreements ADD COLUMN IF NOT EXISTS hello_sign_signature_request_id TEXT;
ALTER TABLE tbl_service_agreements ADD COLUMN IF NOT EXISTS hello_sign_signing_url TEXT;
      

Jurisdiction Rules

The system enforces jurisdiction-specific rules at the database layer, API layer, UI layer, and agent layer. The two initial jurisdictions are UK (Renters Rights Act 2024/2025) and Thailand (PDPA / commercial agency rules).

Rule UK (GB) — RRA Thailand (TH) — PDPA
Fee Transparency Mandatory. fee_transparency_notes must be non-empty for all non-exempt fees. Description of what the fee covers displayed before landlord signs. Recommended but not mandatory. No RRA-style fee transparency law.
Agreed vs Standard Fee Agreed ≤ Standard. System enforces that agreed_fee_value cannot exceed standard_fee_value for GB. No cap. Agreed fee can equal or exceed standard. Commercial agency rules apply.
Discount Reason Required. When agreed_fee_value < standard_fee_value, discount_reason is mandatory. Optional. No legal requirement for discount documentation.
Currency GBP (default). Fees displayed as % of rent or fixed monthly amount. THB (default). Thai Baht as primary display currency.
Contract Language English. Written agreement required (HelloSign dispatch ensures written record). Thai language version may be needed. Phase 2 for multi-language templates.
Compliance Checks Sumsub AML + Kamma licence check + Companies House (for corporate landlords). ID document verification + PEP screening + basic AML.
Cooling-Off Period 14 days for consumer landlords (Phase 2). Not applicable (Phase 2 review).

Future Jurisdiction Expansion

Adding a new country (e.g. SG, AU): add a row to tbl_jurisdictions, add rows to tbl_regulations, the organisation creates services with the new jurisdiction code, configure a HelloSign template, and add a compliance check provider. No DDL changes needed — the system is jurisdiction-agnostic by design.

Red Team Findings

The Architect (Kimi K3) red-teamed the design before any code was written. Seven findings were identified, ranked by severity, with recommended mitigations. These should be addressed before or during implementation.

Finding 1: CRITICAL — Fee Double-Counting via additional_fee_ids

Issue: tbl_service_catalog.additional_fee_ids references tbl_charges_pricing via a UUID array. But some fees are truly per-service (tenancy setup is only relevant for Tenant Finder) while others are per-property (gas safety applies regardless of service package). When a landlord selects multiple services, the same gas safety fee could appear as an "additional fee" on multiple service rows, leading to double-counting.

Mitigation: Treat additional_fee_ids as a suggestion — fees commonly bundled with this service. The actual billing engine (future phase) should deduplicate across selected services. For now, the UI should show a warning when a service is selected that has overlapping additional fees with already-selected services.

Finding 2: HIGH — Negotiation Status vs Agreement Lifecycle Orthogonality

Issue: tbl_service_negotiations.status can be 'accepted' while the associated tbl_service_agreements sits at 'pre_signature' (never signed). Staff see "Accepted" in the negotiation panel but the agreement is still unsigned. No automated reminder or expiry.

Mitigation: Add a derived status: negotiations should auto-transition to 'expired' if agreement_id is set but signed_at is NULL after 30 days. Add a cron/agent check for this.

Finding 3: HIGH — HelloSign Single Point of Failure

Issue: The entire agreement signing flow depends on HelloSign API availability. If HelloSign is down, the API key is misconfigured, or the template is deleted, the onboarding flow blocks entirely.

Mitigation: (1) Add a fallback_method column to tbl_service_agreements ('hellosign' | 'manual_upload' | 'document_generation'). (2) For manual fallback: generate a PDF server-side, upload to GCS, and allow staff to send it via email. (3) Add a health check: Paperclip agent monitors HelloSign API health and alerts if down.

Finding 4: MEDIUM — ComplianceOnboardingAgent Concurrency with ServiceOnboardingAgent

Issue: The two agents run in parallel, but the agreement signing is gated on compliance passing. Race condition: what if the landlord selects services and agrees to fees before compliance completes? The "Send via HelloSign" button could be clicked while the compliance check is still running.

Mitigation: (1) The "Send via HelloSign" button should be disabled until tbl_compliance_checks has check_status = 'passed'. (2) ServiceOnboardingAgent should check compliance status before offering the signing option. (3) Add a compliance_gate_cleared boolean or timestamp to tbl_service_negotiations.

Finding 5: MEDIUM — Cold-Start for New Organisations

Issue: When a new organisation signs up, tbl_service_catalog is empty. The Service Design tab shows an empty jurisdiction section. No services can be selected by landlords.

Mitigation: (1) Provide a "Quick Start" button that populates default services based on jurisdiction (e.g. Sovereign Node's 6 services for GB, Beyond360's 2 services for TH). (2) The default set can be edited later. (3) Add a seed migration that inserts default services for the main organisation.

Finding 6: LOW — additional_fee_ids as UUID Array Breaks Referential Integrity

Issue: PostgreSQL does not enforce FK constraints on array elements. A charge_id could be deleted from tbl_charges_pricing while still referenced in the array.

Mitigation: Either (preferred) use a junction table tbl_service_catalog_fees with explicit FK constraints, or (acceptable) add application-level validation and a nightly cron check for orphaned references.

Finding 7: LOW — No RLS Policy for New Tables

Issue: The new tables (tbl_service_catalog, tbl_service_negotiations, etc.) need Row-Level Security policies. Without RLS, a user from organisation A could see organisation B's service catalog.

Mitigation: Add RLS policies as part of the migration. The existing pattern is organisation_id = (SELECT organisation_id FROM tbl_profiles WHERE id = auth.uid()). Add to the implementation checklist.

Open Questions for Eugin

These decisions need Eugin's input before the Programmer can proceed. Each question blocks a specific aspect of implementation.

# Question Impact Decision
1 Should HelloSign use OAuth (embedded signing) or API key (email-based)? OAuth gives embedded UX but requires more setup. UX: embedded vs emailed ⏳
2 What is the actual HelloSign API key for the main org? Setup blocker ⏳
3 Should tbl_service_catalog support tiered pricing (e.g. 10% for first property, 8% for 3+)? Data model change ⏳
4 What's the plan for the existing 315 tbl_service_agreements rows? Backfill with catalog_id and negotiation_id or leave as legacy? Migration scope ⏳
5 Should the HelloSign template be per-service-type or one template with conditional sections? Template setup ⏳
6 For Thailand: do we need a Thai-language HelloSign template? Legal compliance ⏳
7 What is the fallback signing method if HelloSign is unavailable? Operational risk ⏳
8 Should tbl_service_catalog.standard_fee_value be a range (e.g. "8-12%") or a single value? Fee display ⏳
9 Who owns the HelloSign billing — EstateAigents or each agency? Cost allocation ⏳
10 Should the ComplianceOnboardingAgent use Sumsub or a different provider for the initial build? Implementation ⏳

Migration Path

Six phases, from schema creation through to frontend. V300 (schema) and V301 (seed data) are the critical path. V305 (HelloSign webhook) has the highest risk because it touches production document storage.

Phase Name DDL? Data Migration? Code? Risk Details
V300 Schema 4 CREATE TABLE, 1 ALTER TABLE, 2 INSERT No No MEDIUM Create tbl_service_catalog, tbl_service_negotiations, tbl_hello_sign_templates, tbl_compliance_checks. ALTER tbl_service_agreements. INSERT document types + org attributes.
V301 Seed Data No Sovereign Node + Beyond360 catalogs No LOW Seed Sovereign Node 6 GB services + Beyond360 2 TH services. Link existing tbl_charges_pricing. Backfill negotiation records for existing agreements.
V302 HelloSign Setup No Register templates No LOW Manual: Create HelloSign templates in web app (GB + TH). Register in tbl_hello_sign_templates. Configure API keys in tbl_organisations_attributes.
V303 ServiceOnboardingAgent No No Paperclip agent MEDIUM Conversational agent + delegated actions. Service selection, fee negotiation, HelloSign trigger.
V304 ComplianceOnboardingAgent No No Paperclip agent MEDIUM Deterministic workflow. AML/KYC by jurisdiction, HITL gate on failure.
V305 HelloSign Webhook No No API route HIGH POST /api/webhooks/hellosign. Signed PDF download to GCS, create tbl_documents, update tbl_service_agreements.
V306 Frontend UX No No React component MEDIUM Service Design tab in Organisation Settings. Catalog table with CRUD, negotiation panel, HelloSign dispatch button, compliance status display.
Phase 1 (V300) — Schema
├── CREATE TABLE tbl_service_catalog
├── CREATE TABLE tbl_service_negotiations
├── CREATE TABLE tbl_hello_sign_templates
├── CREATE TABLE tbl_compliance_checks
├── ALTER TABLE tbl_service_agreements (add catalog_id, negotiation_id,
│   hello_sign_signature_request_id, hello_sign_signing_url)
├── INSERT INTO tbl_document_types (3 rows)
└── INSERT INTO tbl_organisations_attributes (4 rows)

Phase 2 (V301) — Seed Data
├── INSERT Sovereign Node GB service catalog (6 rows)
├── INSERT Beyond360 TH service catalog (2 rows)
├── Link existing tbl_charges_pricing to catalog rows
└── Backfill: for existing tbl_service_agreements, create negotiation records

Phase 3 (V302) — HelloSign Setup
├── Manual: Create HelloSign templates in web app (GB + TH)
├── INSERT into tbl_hello_sign_templates for each org
└── Configure HelloSign API keys in tbl_organisations_attributes

Phase 4 (V303-V304) — Agents
├── Paperclip ServiceOnboardingAgent (V303)
├── Paperclip ComplianceOnboardingAgent (V304)
└── Agent-to-agent orchestration logic

Phase 5 (V305) — Webhook
├── HelloSign webhook POST /api/webhooks/hellosign
├── Signed PDF download → GCS
├── Create tbl_documents row
└── Update tbl_service_agreements

Phase 6 (V306) — Frontend
├── Service Design tab in Organisation Settings
├── Catalog table with CRUD
├── Negotiation panel
├── HelloSign dispatch button
└── Compliance check status display
    

Final decisions (2026-07-20)

Eugin approved the following decisions on 2026-07-20. These are now locked and should not be re-opened without a new ADR.

# Decision Reasoning
1 Filter pills order: Draft, Sent, Signed, Past/Archive, All KISS principle. All is intentionally last because it is the slowest query — it loads every negotiation record. No query is forced to scan the full table on page load.
2 Remove "Missing" status. The Missing pill was removed entirely. Not-signed is inherently captured by Draft or Sent. A separate "Missing" pill was redundant and violated the KISS principle.
3 Default view: if Draft > 0 → Draft; else if Sent > 0 → Sent; else → Signed. List view is default. Staff land on the most actionable queue. Drafts need attention first, then sent agreements awaiting signature, then signed records. List view is the simplest, most scannable layout.
4 In Discussion removed. The In Discussion filter pill was removed entirely. Redundant with Draft/Sent states; KISS principle.

Repository Code

The live codebase implementation for this textbook logic sits within the following repository folder: