Mock CRM for the crmmeister.com article "Connect Claude to your CRM"
by Ahmed Essam

What it is: a tiny CRM API on dummy data (fictional company, seed 42) with 3 traps
of the kind seen in real CRM APIs, plus a script that runs 3 safety habits against it.

Needs: Python 3.9 or newer. No packages to install. Runs only on your own computer
(127.0.0.1), talks to nothing on the internet.

Run the demo (writes 3 logs, an undo file and results.json into ./runs):
    python3 demo_habits.py runs
    (on Windows: py demo_habits.py runs)

Run the CRM on its own to try your own prompts or scripts against it:
    MOCK_CRM_READ_KEY=pick-any-text MOCK_CRM_ADMIN_KEY=pick-other-text python3 mock_crm.py 8765
    (Windows PowerShell: $env:MOCK_CRM_READ_KEY="..."; $env:MOCK_CRM_ADMIN_KEY="..."; python mock_crm.py 8765)

Endpoints: GET /leads, /contacts, /notes, /calls (with _limit, _skip, lead_id; leads also status),
GET /<collection>/<id>, PUT /leads/<id>, PUT /notes/<id>. Pages hold at most 100 records.
Send the key as: Authorization: Bearer <key>. The read key cannot write (403).

The 3 traps:
  1. GET /contacts?email=... ignores the email parameter. Use ?query=email:"<address>".
  2. PUT ignores unknown fields and still answers 200. The note field is "pinned", not "is_pinned".
  3. Calls with "source": "legacy_sync" count ring time in "duration"; native calls count talk time only.
