Phase 2 part 1: the CRM bridge to EspoCRM through Hermes

Supermarket queues CRM work in crm_actions and never writes to EspoCRM
itself. A Hermes cron job (supermarket-crm, set up by `supermarket
hermes`) runs every 15 minutes behind a monitor script that prints
Supermarket's crm-state file, so unchanged state skips the AI run. Hermes
calls the new MCP tools crm_pending_actions, crm_report_result and
crm_ingest, creating each record through the Core's MCP hub unless a
match exists, and copying Leads, Accounts and Contacts back every 6 hours
for duplicate checks. Schema 5 adds crm_actions and crm_records.

Prospects -> CRM queue shows the queue, a test Lead, sync, Retry and
Cancel. When an action fails with a connection error, the page checks
EspoCRM from this computer and says whether the CRM is down or the hub
can't reach it, with a note to send to the Core's maintainer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-21 16:28:46 -07:00
co-authored by Claude Opus 5.5
parent 5feb6a16d4
commit 1dc5476d43
15 changed files with 1586 additions and 30 deletions
+5
View File
@@ -38,6 +38,11 @@
<a href="/content/published" {{if eq $nav "content/published"}}aria-current="page"{{end}}>Published</a>
</div>
{{end}}
{{if eq .ID "prospects"}}
<div class="subnav">
<a href="/crm" {{if eq $nav "prospects/crm"}}aria-current="page"{{end}}>CRM queue</a>
</div>
{{end}}
{{else}}
<span class="soon" title="{{.Body}}">{{template "icon" .ID}}<span>{{.Name}}</span><small>{{.Phase}}</small></span>
{{end}}