Sync vault notes: April-November 2026 sessions, projects, and architecture

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
garfieldandClaude Sonnet 5.5 committed 2026-11-13 11:00:53 -05:00
1 parent fe4fe656be
commit 994c7ae577
379 files changed
+55216 -107

No files matched your search

@@ -0,0 +1,202 @@
# Phase 1 Communications — Engineering Handoff for kimi-cli
**Date:** 2026-06-15
**Branch:** `main`
**Author:** Claude Code
**Status:** READY TO DEPLOY — code complete, all 418 tests passing, zero TypeScript errors
**Do not deploy:** No new env vars required. No new npm packages. Drop-in to existing hermes-mcp image build.
---
> ⚠️ **CRITICAL — DO NOT LEAVE DOCKER RUNNING**
>
> After building and pushing the image, **stop and remove all local Docker containers** before kubectl apply.
> Docker left running has previously caused port conflicts with the production Kubernetes cluster, breaking live services.
>
> ```bash
> docker stop $(docker ps -q) 2>/dev/null || true
> docker rm $(docker ps -aq) 2>/dev/null || true
> ```
>
> Verify nothing is bound to the relevant ports before applying to k8s:
> ```bash
> ss -tlnp | grep -E ':(80|443|3000|8080)'
> ```
>
> Only proceed with `kubectl apply` once Docker containers are confirmed stopped.
---
## What was built
Backend implementation of the Chat-First Communications Manager Phase 1 MVP:
- **9 new REST endpoints** under `/api/communications/*` (profile, chat, drafts, examples)
- **6 new MySQL tables** auto-created on startup via existing `initDatabase()` pattern
- **2 new columns** on the `customers` table (`autonomous_mode_enabled`, `approved_posts_count`) added via `ensureColumn` (idempotent, safe to run on live DB)
- **Claude generation pipeline** — per-platform parallel calls (`Promise.allSettled`), NMLS compliance injection, style learning from approved posts
- **Approval/publish flow** — reuses existing `src/clients/linkedin.ts`, `facebook.ts`, `instagram.ts`, and `smtp.ts`
---
## Files changed
### Modified
- `src/db.ts` — added 6 new tables + 2 `ensureColumn` calls to `initDatabase()`
- `src/index.ts` — added 2 imports + 8 route handlers (communications API block before `main()`)
### Created
- `src/communications.ts` — business profile CRUD, draft lifecycle, approve/publish logic, input validation
- `src/communications-chat.ts` — Claude generation pipeline, system prompt builder, NMLS injection, regeneration
### No changes to
- `package.json` — no new dependencies
- `hermes-k8s.yaml` — no new env vars needed
- `Dockerfile` — unchanged
- Any existing routes, tools, or OAuth logic
---
## Schema changes
All table creation and column additions happen automatically on server startup via `initDatabase()`. The additions are **all idempotent** (`CREATE TABLE IF NOT EXISTS` + `ensureColumn` guards). Safe to deploy to a live database.
### New tables (all `ENGINE=InnoDB`, `utf8mb4_unicode_ci`)
| Table | Purpose | Key columns |
|-------|---------|------------|
| `business_profiles` | One row per customer; vertical config + NMLS info | `user_id UNIQUE`, `email_recipients JSON`, `enabled_platforms JSON` |
| `chat_sessions` | Conversation history grouping | `user_id`, `last_message_at` |
| `chat_messages` | Individual turns (role=user/assistant) | `session_id`, `role`, `content` |
| `drafts` | Per-platform AI drafts awaiting approval | `generation_id` (groups one chat turn), `draft_metadata JSON` (hashtags/subject), `status` |
| `comm_posts` | Published post audit trail | `draft_id`, `platform_post_id`, `autonomous` |
| `user_content_examples` | Approved posts used for style learning | `user_id`, `platform`, `approved_text` |
### New columns on `customers`
| Column | Type | Default |
|--------|------|---------|
| `autonomous_mode_enabled` | `TINYINT(1)` | `0` |
| `approved_posts_count` | `INT` | `0` |
---
## Deploy commands
```bash
# 1. Commit the implementation
git add src/db.ts src/index.ts src/communications.ts src/communications-chat.ts
git commit -m "feat(communications): Phase 1 MVP — profile, chat, draft generation, approve/publish"
git push origin main
# 2. Build and push image
docker build -t <registry>/hermes-mcp:<sha> .
docker push <registry>/hermes-mcp:<sha>
# ⚠️ 3. STOP DOCKER BEFORE APPLYING TO K8S
docker stop $(docker ps -q) 2>/dev/null || true
docker rm $(docker ps -aq) 2>/dev/null || true
ss -tlnp | grep -E ':(80|443|3000|8080)' # must be empty before proceeding
# 4. Update image SHA in hermes-k8s.yaml, then apply
kubectl apply -f hermes-k8s.yaml
# 5. Verify rollout
kubectl rollout status deployment/hermes-mcp
kubectl logs -l app=hermes-mcp --tail=50 | grep '\[db\]'
```
Expected log on startup:
```
[db] MySQL connected and schema initialized
```
The new tables will be created on first startup. No manual migration needed.
---
## Verification
After deploy, smoke-test the new endpoints against staging with an existing customer API key:
```bash
BASE=https://hermes.squaremcp.com
KEY=<your-api-key>
# 1. Create business profile
curl -X PUT "$BASE/api/communications/profile" \
-H "x-api-key: $KEY" \
-H "Content-Type: application/json" \
-d '{
"business_type": "mortgage_broker",
"nmls_number": "123456",
"states_licensed": ["CA"],
"nmls_disclaimer_text": "NMLS #123456. Not an offer to lend.",
"tone_preference": "professional",
"enabled_platforms": ["linkedin", "email"],
"email_recipients": ["test@example.com"]
}'
# Expected: 200 with profile object
# 2. Get profile
curl "$BASE/api/communications/profile" -H "x-api-key: $KEY"
# Expected: 200 with profile
# 3. Get onboarding chips
curl -X POST "$BASE/api/communications/profile/generate-onboarding" \
-H "x-api-key: $KEY" -H "Content-Type: application/json"
# Expected: 200 { chips: ["Rate update", ...], vertical: "mortgage_broker" }
# 4. Generate drafts (requires ANTHROPIC_API_KEY set in environment)
curl -X POST "$BASE/api/communications/chat" \
-H "x-api-key: $KEY" \
-H "Content-Type: application/json" \
-d '{"user_prompt": "Write a post about current mortgage rates", "enabled_platforms": ["linkedin"]}'
# Expected: 200 { session_id, generation_id, drafts: [{ platform: "linkedin", status: "pending", ... }] }
# 5. Reject a draft (use draft_id from step 4)
curl -X POST "$BASE/api/communications/drafts/<draft_id>/reject" \
-H "x-api-key: $KEY" -H "Content-Type: application/json"
# Expected: 200 { draft_id, status: "rejected" }
# 6. Get content examples
curl "$BASE/api/communications/examples" -H "x-api-key: $KEY"
# Expected: 200 { examples: [] } (empty on new account)
```
---
## Environment variables
**No new env vars required.** The Communications feature reuses:
- `ANTHROPIC_API_KEY` — already set; used for Claude generation calls
- `MYSQL_HOST`, `MYSQL_USER`, `MYSQL_PASSWORD` — already set; new tables auto-created
- Platform OAuth credentials already in Redis per customer
---
## Open items for the engineer (from engineering design doc)
These don't block deploy but should be confirmed before piloting with Alex Ferrari:
1. **MySQL version** — `CHECK` constraints enforced only on 8.0.16+. Run `SELECT VERSION()` to confirm.
2. **NMLS style examples** — `user_content_examples.approved_text` stores post **without** the disclaimer (stripped server-side). Verify this is correct before pilot.
3. **Instagram image URL** — drafts for Instagram generate a caption + hashtags but approval will fail without `image_url` in `draft_metadata`. The UI (Week 3) must prompt for image URL before enabling the Approve button for Instagram.
4. **`approved_posts_count` trigger** — autonomous mode toggle is NOT yet wired in UI. The counter increments correctly on each approval, but the UI to show the toggle at 10+ approvals is a Week 3 task.
---
## Related vault docs
- Sprint plan: `SquareMCP/products/chat-first-communications/2026-06-15-phase1-mvp-sprint-plan.md`
- Engineering design: `SquareMCP/products/chat-first-communications/2026-06-15-phase1-engineering-design.md`
- Product spec: `SquareMCP/products/chat-first-communications/2026-06-15-comprehensive-product-spec.md`
---
## Changelog
| Date | Author | Note |
|------|--------|------|
| 2026-06-15 | Claude Code | Initial handoff — Phase 1 backend complete |
| 2026-06-15 | Claude Code | Added Docker stop warning — prior incident caused k8s port conflicts |
@@ -0,0 +1,150 @@
# Communications Manager GPT — Deployment Record
**Date:** 2026-06-16
**Deployed by:** Garfield Heron
**Status:** Live — Anyone with a link
**Next gate:** End-to-end OAuth flow test → then GPT Store (Public)
---
## GPT Identity
| Field | Value |
|---|---|
| Name | Communications Manager |
| GPT ID | g-6a0f35429e8c81918e8caedbb8b2e4c5 |
| Editor URL | https://chatgpt.com/gpts/editor/g-6a0f35429e8c81918e8caedbb8b2e4c5 |
| Share URL | https://chatgpt.com/g/g-6a0f35429e8c81918e8caedbb8b2e4c5 |
| Visibility | Anyone with a link (not yet Public) |
| Last edited | Jun 16, 2026 |
**Description:**
Drafts and publishes social and email content from chat. Connect your SquareMCP Communications account to create profiles, generate drafts, and publish across channels.
---
## Backend
| Field | Value |
|---|---|
| Service | SquareMCP Hermes |
| Base URL | https://hermes.squaremcp.com |
| OpenAPI spec | https://hermes.squaremcp.com/openapi-communications.json |
| Spec version | OpenAPI 3.1.0, SquareMCP Communications v1.0.0 |
---
## OAuth Configuration
| Field | Value |
|---|---|
| Auth type | OAuth 2.0 |
| Client ID | d5b4125c62c6f7ae61740116f8661dbb |
| Client Secret | `COMMUNICATIONS_OAUTH_CLIENT_SECRET` env var in hermes-k8s.yaml (never logged) |
| Authorization URL | https://hermes.squaremcp.com/oauth/authorize |
| Token URL | https://hermes.squaremcp.com/oauth/token |
| Token Exchange Method | POST (default) |
| Scope | (empty) |
### ⚠️ OAuth Callback URL — Must Be Registered in Hermes
```
https://chat.openai.com/aip/g-9d379b00783d2daf4e0af3f736cff6b0c440bbac/oauth/callback
```
This URL is auto-generated by ChatGPT and is unique to this GPT. It must be added as an allowed redirect URI in the Hermes OAuth server before the "Sign in" connect-account flow will work. Without this, users will hit an OAuth redirect error.
---
## Actions (12 total)
Imported from `https://hermes.squaremcp.com/openapi-communications.json`
| Action Name | Method | Path |
|---|---|---|
| communications_get_profile | GET | /api/communications/profile |
| communications_update_profile | PUT | /api/communications/profile |
| communications_generate_onboarding | POST | /api/communications/profile/generate-onboarding |
| communications_get_examples | GET | /api/communications/examples |
| communications_chat | POST | /api/communications/chat |
| communications_get_draft | GET | /api/communications/drafts/{draft_id} |
| communications_update_draft | PUT | /api/communications/drafts/{draft_id} |
| communications_regenerate_draft | POST | /api/communications/drafts/{draft_id}/regenerate |
| communications_reject_draft | POST | /api/communications/drafts/{draft_id}/reject |
| communications_approve_draft | POST | /api/communications/drafts/{draft_id}/approve |
| communications_get_status | GET | /api/communications/status |
| communications_update_status | PUT | /api/communications/status |
---
## GPT Instructions (auto-generated, saved)
```
You are the SquareMCP Communications Manager. Help professionals draft and publish
social media and email content.
When a user starts, check if they have a connected account. If not, prompt them to
connect via the "Sign in" flow. Once connected, use their profile (NMLS number, tone
preference, enabled platforms) to personalize all drafts.
Workflow:
1) Use communications_chat to generate draft ideas from the user's input.
2) Show drafts and ask if they want to edit, regenerate, or approve.
3) On approval, call communications_approve_draft to publish.
4) On rejection, call communications_reject_draft.
Always include the NMLS disclaimer when required by the user's profile. Never publish
without explicit user approval.
```
## Conversation Starters (auto-generated, saved)
- Draft a LinkedIn post about today's rates
- Write a Facebook post for [x person type]
- Show me my recent drafts
- Update my communication preferences
---
## Privacy Policy
| Field | Value |
|---|---|
| URL set in Actions | https://squaremcp.com/privacy.html |
| Last updated | June 12, 2026 |
| Covers | squaremcp.com, app.squaremcp.com, hermes.squaremcp.com |
| Covers | ChatGPT/Claude AI connections, OAuth flows, connected social credentials |
### Known Gaps (must fix before GPT Store / Public)
1. **NMLS profile data** — policy does not mention storage of `nmls_number`, `states_licensed`, `nmls_disclaimer_text`, or broker info collected via the Communications profile endpoints.
2. **Draft content storage** — policy states "We do not log the full content of emails, notes, or social media posts" but Communications actively stores draft text server-side until the user approves or rejects it. This is a direct contradiction.
---
## What Was Completed This Session
- [x] Opened existing "Hemes-messging" draft GPT (g-6a0f35429e8c81918e8caedbb8b2e4c5)
- [x] Renamed to "Communications Manager"
- [x] Added description
- [x] Imported all 12 Communications API actions from OpenAPI spec URL
- [x] Configured OAuth (Client ID, Secret, Auth URL, Token URL)
- [x] Fixed privacy policy URL (hermes subdomain 404s → squaremcp.com is correct)
- [x] Instructions and conversation starters populated (ChatGPT auto-generated)
- [x] Saved as "Anyone with a link" — GPT is Live
---
## Remaining Before Going Public
- [ ] **Register OAuth callback URL** in Hermes OAuth server allowed redirect URIs (see URL above)
- [ ] **Run end-to-end OAuth test**: connect account → view profile → chat → draft → edit → approve/publish
- [ ] **Upload 512×512 icon** (click "+" on Configure tab)
- [ ] **Fix privacy policy gaps** — add NMLS data language and correct draft storage statement
- [ ] **Set visibility to GPT Store** — only after OAuth flow test passes cleanly
---
## Notes
- The GPT editor ID and the OAuth callback GPT ID are different strings — the callback URL uses `g-9d379b00783d2daf4e0af3f736cff6b0c440bbac`, the share URL uses `g-6a0f35429e8c81918e8caedbb8b2e4c5`. Both are correct; ChatGPT uses separate IDs for these.
- Visibility was intentionally left at "Anyone with a link" — do not flip to GPT Store until the OAuth flow is verified live.
@@ -0,0 +1,164 @@
# Communications — ChatGPT/OAuth Scoping — Engineering Handoff for kimi-cli
**Date:** 2026-06-16
**Branch:** `main`
**Author:** Claude Code
**Status:** READY TO DEPLOY — code complete, `npx tsc --noEmit` clean, full test suite passes (421/421, including 3 new tests). NOT yet committed.
**Purpose:** This is the backend prerequisite for exposing the Chat-First Communications Manager as a Custom GPT in the ChatGPT Store, following the exact same pattern as the already-live "Living Brief" GPT (obsidian-scoped). It does NOT create the GPT itself — that's a manual ChatGPT Builder step for after this deploys (see "What's still needed" below).
---
> ⚠️ **CRITICAL — DO NOT LEAVE DOCKER RUNNING**
>
> After building and pushing the image, **stop and remove all local Docker containers** before kubectl apply.
> Docker left running has previously caused port conflicts with the production Kubernetes cluster, breaking live services.
>
> ```bash
> docker stop $(docker ps -q) 2>/dev/null || true
> docker rm $(docker ps -aq) 2>/dev/null || true
> ss -tlnp | grep -E ':(80|443|3000|8080)'
> ```
>
> Only proceed with `kubectl apply` once Docker containers are confirmed stopped.
>
> Also remember: MySQL runs as a local Docker container that Hermes depends on (`127.0.0.1:3306`). Per the previous deploy's notes, after the stop/remove step you must restart it before the app will connect:
> ```bash
> docker run -d --name mysql --restart unless-stopped \
> -e MYSQL_ROOT_PASSWORD=fetcherpay \
> -e MYSQL_DATABASE=fetcherpay \
> -p 3306:3306 \
> -v fetcherpay_mysql_data:/var/lib/mysql \
> mysql:8.0 --bind-address=0.0.0.0
> ```
---
## Why this exists
The Communications routes (`/api/communications/*`) were originally built only for the first-party dashboard (`meterMiddleware` — API key or session cookie only). That middleware does **not** recognize OAuth Bearer tokens, so a ChatGPT Custom GPT (which authenticates via OAuth) could never call these endpoints, scoped or not. This change brings Communications in line with every other domain (obsidian, email, whatsapp, linkedin, telegram, discord, instagram, twitter, facebook, tiktok), all of which use `requireAuth, requireCapability('<domain>')`.
## What was built
1. **`src/oauth.ts`** — added `'communications'` to the `OAUTH_CAPABILITIES` const array.
2. **`src/index.ts`** — replaced `meterMiddleware` with `requireAuth, requireCapability('communications')` on all 12 `/api/communications/*` routes (profile GET/PUT, generate-onboarding, examples, chat, drafts GET/PUT, regenerate, reject, approve, status GET/PUT). The dashboard's existing session-cookie login still works fine — `requireAuth` accepts session cookies too, plus it's a strict superset of what `meterMiddleware` supported (also accepts the global API key and OAuth Bearer tokens).
3. **`src/manifest.ts`**:
- Added full OpenAPI path definitions for all `/api/communications/*` endpoints to the base `getOpenApiSpec()` (they didn't exist in any spec before this).
- Added `COMMUNICATIONS_PATHS` set + `getOpenApiSpecCommunications()`, mirroring `getOpenApiSpecLivingBrief()`.
4. **`src/index.ts`** — added `GET /openapi-communications.json` route.
5. **`src/index.ts`** (`main()`) — added a third `ensureOAuthAppRegistered()` call, env-var-driven (`COMMUNICATIONS_OAUTH_CLIENT_ID` / `COMMUNICATIONS_OAUTH_CLIENT_SECRET`), registering a dedicated OAuth client scoped to `['communications']` only — same pattern as the Living Brief client.
6. **`src/manifest.test.ts`** — added a `describe('getOpenApiSpecCommunications')` block: path inclusion/exclusion, GET+PUT both present on the draft-edit path, title/description checks.
```
src/index.ts | 40 +++++++----
src/manifest.test.ts | 36 ++++++++++
src/manifest.ts | 195 +++++++++++++++++++++++++++++++++++++++++++++++++++
src/oauth.ts | 1 +
4 files changed, 259 insertions(+), 13 deletions(-)
```
### No changes to
- `package.json` — no new dependencies
- `src/db.ts` / schema — no new tables or columns
- Any other domain's routes, capabilities, or OpenAPI specs
---
## Verified this session
- `npx tsc --noEmit` — clean.
- `npx vitest run` — **421/421 tests pass** (30 test files), including the 3 new Communications manifest tests.
**Not verified** (no-docker/no-server constraint this session): live request against a running server, OAuth client registration against a real database, or an actual ChatGPT Action call. All of that requires the deploy below.
---
## Deploy commands
```bash
# 1. Commit
git add src/oauth.ts src/index.ts src/manifest.ts src/manifest.test.ts
git commit -m "feat(communications): scope OAuth capability + ChatGPT OpenAPI spec for Communications GPT"
git push origin main
# 2. Build and push image
docker build -t localhost:32000/hermes-mcp:<sha> -t localhost:32000/hermes-mcp:latest .
docker push localhost:32000/hermes-mcp:<sha>
docker push localhost:32000/hermes-mcp:latest
# ⚠️ 3. STOP DOCKER, then restart MySQL, before touching k8s — see warning block above
# 4. Generate a new OAuth client id/secret for the Communications GPT (do NOT reuse Living Brief's)
COMM_CLIENT_ID=$(openssl rand -hex 16)
COMM_CLIENT_SECRET=$(openssl rand -hex 32)
echo "COMMUNICATIONS_OAUTH_CLIENT_ID=$COMM_CLIENT_ID"
echo "COMMUNICATIONS_OAUTH_CLIENT_SECRET=$COMM_CLIENT_SECRET"
# Add both as env vars in hermes-k8s.yaml (gitignored — do not commit these values to git)
# 5. Update image SHA in hermes-k8s.yaml, then apply
microk8s kubectl apply -f hermes-k8s.yaml
microk8s kubectl rollout status deployment/hermes-mcp -n fetcherpay
```
Expected log line on startup:
```
[oauth] Communications client <COMM_CLIENT_ID> ensured with communications capability
```
---
## Verification
```bash
BASE=https://hermes.squaremcp.com
# 1. New scoped spec is live
curl -s "$BASE/openapi-communications.json" | python3 -c "import json,sys; d=json.load(sys.stdin); print(list(d['paths'].keys()))"
# Expected: only /api/communications/* paths
# 2. Existing specs unaffected
curl -s "$BASE/openapi-living-brief.json" | python3 -c "import json,sys; d=json.load(sys.stdin); print(list(d['paths'].keys()))"
# Expected: unchanged — only /api/obsidian/* paths
# 3. Communications routes now reject unauthenticated requests (previously meterMiddleware would 401 too, but confirm shape is consistent)
curl -s -o /dev/null -w "%{http_code}\n" "$BASE/api/communications/status"
# Expected: 401
# 4. Communications still works with the existing dashboard session/API key (regression check — use the same x-api-key flow as before)
API_KEY=<an existing customer api key>
curl -s -H "x-api-key: $API_KEY" "$BASE/api/communications/status"
# Expected: 200 { approved_posts_count, autonomous_mode_enabled } — same as before this change
# 5. New OAuth client was registered (check DB directly, or just confirm the startup log line above appeared)
docker exec mysql mysql -uroot -pfetcherpay -e "SELECT client_id, allowed_capabilities FROM hermes_oauth.oauth_clients WHERE client_id = '<COMM_CLIENT_ID>';"
# Expected: one row, allowed_capabilities = ["communications"]
```
---
## What's still needed after this deploys (manual ChatGPT Builder work — not code)
This deploy only makes the scoped spec and OAuth client *available*. To actually list Communications in the GPT Store:
1. In ChatGPT → Create a GPT → Actions → Import from URL → `https://hermes.squaremcp.com/openapi-communications.json`.
2. Configure OAuth: Client ID / Secret = the `COMM_CLIENT_ID`/`COMM_CLIENT_SECRET` generated in deploy step 4 above. Authorization URL `https://hermes.squaremcp.com/oauth/authorize`, Token URL `https://hermes.squaremcp.com/oauth/token`.
3. Name, description, and a profile icon for the GPT.
4. Click through the full flow live in the GPT (profile → chat → draft edit → approve/publish) to confirm the OAuth-authenticated path actually works end-to-end — this is the first real test of Communications over OAuth rather than session cookie/API key.
5. Confirm `privacy.html`/`terms.html` (squaremcp.com) adequately describe Communications' data handling (NMLS info, draft content storage, social publishing) before setting the GPT to Public.
6. Set visibility to Public to list in the GPT Store.
---
## Related vault docs
- Week 1+2 backend handoff: `SquareMCP/deployments/2026-06-15-phase1-communications-deploy-handoff.md`
- Week 3 chat UI handoff: `SquareMCP/deployments/2026-06-16-phase1-week3-chat-ui-deploy-handoff.md`
- Week 3 chat UI deploy result: `SquareMCP/deployments/2026-06-16-phase1-week3-chat-ui-deploy-result.md`
- Living Brief precedent (capability enforcement pattern): `SquareMCP/2026-06-13-option-a-capability-enforcement-kimi-handoff.md`, `SquareMCP/2026-06-13-capability-enforcement-deploy.md`
---
## Changelog
| Date | Author | Note |
|------|--------|------|
| 2026-06-16 | Claude Code | Initial handoff — Communications OAuth capability + scoped OpenAPI spec, not yet committed |
@@ -0,0 +1,217 @@
# Communications — ChatGPT/OAuth Scoping — Deploy Result
**Date:** 2026-06-16
**Branch:** `main`
**Author:** Kimi Code
**Status:** DEPLOYED + VERIFIED
---
## Original handoff
See `SquareMCP/deployments/2026-06-16-communications-chatgpt-oauth-deploy-handoff.md` for the full feature description.
---
## What was deployed
Backend prerequisite for exposing the Chat-First Communications Manager as a ChatGPT Custom GPT:
- Added `'communications'` to `OAUTH_CAPABILITIES` in `src/oauth.ts`
- Replaced `meterMiddleware` with `requireAuth` + `requireCapability('communications')` on all `/api/communications/*` routes
- Added full OpenAPI path definitions for Communications endpoints
- Added `GET /openapi-communications.json` route
- Registered a dedicated OAuth client scoped to `['communications']` only
- Added manifest tests for the scoped spec (421/421 tests passing)
---
## Git
| Action | SHA / Ref |
|--------|-----------|
| Feature commit | `61ce4c7` |
| Branch | `main` pushed to `https://git.fetcherpay.com/garfield/hermes-mcp.git` |
**Note:** `hermes-k8s.yaml` was **not** committed to git per the handoff's instruction to keep OAuth credentials out of version control. The file is tracked in git history, but the credential values and image tag update in this deploy were left as uncommitted local changes.
---
## Docker image
```
localhost:32000/hermes-mcp:61ce4c7
```
**Build/push note:** `docker push` to `localhost:32000` failed because the registry NodePort was not accessible on the host. Workaround used:
```bash
docker save localhost:32000/hermes-mcp:61ce4c7 -o /tmp/hermes-mcp-61ce4c7.tar
microk8s ctr image import /tmp/hermes-mcp-61ce4c7.tar
```
Because the image was imported directly into containerd, `hermes-k8s.yaml` uses the **tag** `localhost:32000/hermes-mcp:61ce4c7` with `imagePullPolicy: IfNotPresent` instead of the usual digest reference.
---
## Deploy procedure followed
1. `git add src/oauth.ts src/index.ts src/manifest.ts src/manifest.test.ts`
2. `git commit -m "feat(communications): scope OAuth capability + ChatGPT OpenAPI spec for Communications GPT"`
3. `git push origin main`
4. Built image: `docker build -t localhost:32000/hermes-mcp:61ce4c7 -t localhost:32000/hermes-mcp:latest .`
5. Imported image into containerd (registry push unavailable)
6. Stopped and removed all local Docker containers:
```bash
docker stop $(docker ps -q) 2>/dev/null || true
docker rm $(docker ps -aq) 2>/dev/null || true
ss -tlnp | grep -E ':(80|443|3000|8080)'
```
7. Restarted MySQL:
```bash
docker run -d --name mysql --restart unless-stopped \
-e MYSQL_ROOT_PASSWORD=fetcherpay \
-e MYSQL_DATABASE=fetcherpay \
-p 3306:3306 \
-v fetcherpay_mysql_data:/var/lib/mysql \
mysql:8.0 --bind-address=0.0.0.0
```
8. Generated new OAuth client credentials:
```bash
openssl rand -hex 16 # client id
openssl rand -hex 32 # client secret
```
9. Added `COMMUNICATIONS_OAUTH_CLIENT_ID` and `COMMUNICATIONS_OAUTH_CLIENT_SECRET` to `hermes-k8s.yaml`
10. Updated image reference in `hermes-k8s.yaml`
11. `microk8s kubectl apply -f hermes-k8s.yaml`
12. `microk8s kubectl rollout status deployment/hermes-mcp -n fetcherpay`
---
## New OAuth client
| Field | Value / Status |
|-------|----------------|
| `COMMUNICATIONS_OAUTH_CLIENT_ID` | `d5b4125c62c6f7ae61740116f8661dbb` |
| `COMMUNICATIONS_OAUTH_CLIENT_SECRET` | ✅ Set in `hermes-k8s.yaml` (not in git, not in this vault doc) |
| Allowed capabilities | `["communications"]` |
Expected startup log line confirmed:
```
[oauth] Communications client d5b4125c62c6f7ae61740116f8661dbb ensured with communications capability
```
---
## Verification
### 1. `/openapi-communications.json` is live and scoped
```bash
curl -s https://hermes.squaremcp.com/openapi-communications.json | python3 -c "import json,sys; d=json.load(sys.stdin); print(list(d['paths'].keys()))"
```
Result:
```
['/api/communications/profile',
'/api/communications/profile/generate-onboarding',
'/api/communications/examples',
'/api/communications/chat',
'/api/communications/drafts/{draft_id}',
'/api/communications/drafts/{draft_id}/regenerate',
'/api/communications/drafts/{draft_id}/reject',
'/api/communications/drafts/{draft_id}/approve',
'/api/communications/status']
```
### 2. `/openapi-living-brief.json` is unchanged
```bash
curl -s https://hermes.squaremcp.com/openapi-living-brief.json | python3 -c "import json,sys; d=json.load(sys.stdin); print(list(d['paths'].keys()))"
```
Result:
```
['/api/obsidian/search', '/api/obsidian/note', '/api/obsidian/note/append', '/api/obsidian/sync']
```
### 3. Unauthenticated request rejected
```bash
curl -s -o /dev/null -w "%{http_code}\n" https://hermes.squaremcp.com/api/communications/status
```
Result: `401`
### 4. Existing API-key flow still works (regression check)
```bash
curl -s -H "x-api-key: 672e1f42f94b48fb94f866a4dd9b793d" https://hermes.squaremcp.com/api/communications/status | python3 -m json.tool
```
Result:
```json
{
"approved_posts_count": 0,
"autonomous_mode_enabled": false
}
```
### 5. OAuth client registered in DB
```bash
docker exec mysql mysql -uroot -pfetcherpay \
-e "SELECT client_id, allowed_capabilities FROM hermes_oauth.oauth_clients WHERE client_id = 'd5b4125c62c6f7ae61740116f8661dbb';"
```
Result:
```
client_id allowed_capabilities
d5b4125c62c6f7ae61740116f8661dbb ["communications"]
```
---
## Issues encountered during deploy
### Registry NodePort inaccessible
The MicroK8s registry pod was Running, but port `32000` was not listening on the host, so `docker push localhost:32000/...` failed.
**Workaround:** saved the image with `docker save` and imported it directly into containerd with `microk8s ctr image import`.
### hermes-k8s.yaml uses tag + IfNotPresent
Because the image was loaded locally rather than pushed through a registry, the deployment uses `localhost:32000/hermes-mcp:61ce4c7` with `imagePullPolicy: IfNotPresent`. This is a deviation from the usual digest-based reference.
---
## Cleanup / open items
1. **ChatGPT Builder manual steps** — see the "What's still needed" section of the original handoff doc. This deploy only provides the spec and OAuth client; the GPT still needs to be created in ChatGPT's UI.
2. **Docker containers stopped** — `mt5` and `obsidian` were stopped per the deploy warning. Restart if needed:
```bash
cd ~/mt5-docker && ./start-mt5.sh
# obsidian — rerun the original docker run command
```
3. **hermes-k8s.yaml** has uncommitted local changes (OAuth credentials + image tag). Do not commit the secret values.
---
## Related vault docs
- OAuth handoff: `SquareMCP/deployments/2026-06-16-communications-chatgpt-oauth-deploy-handoff.md`
- Week 3 chat UI deploy result: `SquareMCP/deployments/2026-06-16-phase1-week3-chat-ui-deploy-result.md`
- Week 1+2 backend handoff: `SquareMCP/deployments/2026-06-15-phase1-communications-deploy-handoff.md`
- Observability runbooks: `SquareMCP/runbooks/observability/`
---
## Changelog
| Date | Author | Note |
|------|--------|------|
| 2026-06-16 | Kimi Code | Deployed Communications OAuth capability + scoped OpenAPI spec |
@@ -0,0 +1,240 @@
# OTel Collector, Prometheus Remote-Write, Loki/Tempo Dashboards
**Date:** 2026-06-16
**Branch:** `main`
**Author:** Kimi Code
**Status:** DEPLOYED — collector running, metrics flowing, dashboards imported
---
## What was done
1. **Enabled Prometheus remote-write receiver** on the FetcherPay Prometheus Deployment in namespace `fetcherpay`.
2. **Finalized the OpenTelemetry Collector** manifest in namespace `observability`:
- Receivers: OTLP (gRPC/HTTP), Jaeger, Zipkin, Prometheus self-scrape
- Processors: batch, resource tag `cluster=art0`
- Exporters:
- `otlp_grpc/tempo` → Tempo
- `otlp_http/loki` → Loki
- `prometheus_remote_write` → FetcherPay Prometheus
3. **Imported Grafana dashboards** from grafana.com and renamed them:
- Loki Operational (`/d/MQHVDmtWk/loki-operational`)
- Tempo Operational (`/d/5BcHdkRgz/tempo-operational`)
4. **Added Redis monitoring** — deployed `redis-exporter` and added a scrape job to FetcherPay Prometheus.
5. **Recovered Grafana** after it got stuck in `ContainerCreating` with repeated `SandboxChanged` events — force-deleted the pod and the Deployment recreated it.
---
## Files changed / created
### New
- `monitoring/opentelemetry-collector.yaml` — full collector Deployment + ConfigMap + Service
- `monitoring/prometheus-deployment.yaml` — FetcherPay Prometheus Deployment with `--web.enable-remote-write-receiver`
### Existing (deployed earlier, not modified in this session)
- `monitoring/prometheus-config.yaml` — scrape configs
- `monitoring/blackbox-exporter.yaml`
- `monitoring/mysql-exporter.yaml`
- `monitoring/redis-exporter.yaml` — Redis exporter + Service
- `monitoring/grafana-deployment.yaml`
- `monitoring/alertmanager-config.yaml`
---
## Deploy commands
```bash
# Apply the collector and Prometheus manifests
microk8s kubectl apply -f monitoring/opentelemetry-collector.yaml
microk8s kubectl apply -f monitoring/prometheus-deployment.yaml
# Restart collector to pick up config changes
microk8s kubectl rollout restart deployment/otel-collector -n observability
microk8s kubectl rollout status deployment/otel-collector -n observability --timeout=120s
# Verify Prometheus rolled out with the new flag
microk8s kubectl get deployment prometheus -n fetcherpay -o jsonpath='{.spec.template.spec.containers[0].args}'
# Expected: includes "--web.enable-remote-write-receiver"
```
---
## Verification
### Collector is running
```bash
microk8s kubectl get pods -n observability -l app=otel-collector
# Expected: 1/1 Running
```
### Metrics are arriving in FetcherPay Prometheus
```bash
# OTel collector metrics
curl -u admin:admin_secure_2024 \
'https://dashboard.fetcherpay.com/api/datasources/proxy/uid/ffpaxh13af2f4e/api/v1/query?query=otelcol_process_uptime_total'
# Expected: non-empty result set with job="otelcol-contrib"
# Redis metrics
curl -u admin:admin_secure_2024 \
'https://dashboard.fetcherpay.com/api/datasources/proxy/uid/ffpaxh13af2f4e/api/v1/query?query=redis_up'
# Expected: 1 result with instance="redis-fetcherpay"
```
### Health overview dashboard
A comprehensive Grafana dashboard was created:
**URL:** https://dashboard.fetcherpay.com/d/fetcherpay-health-overview/fetcherpay-squaremcp-e28094-health-overview
It includes sections for:
- **Websites** — all 18 HTTPS endpoints, healthy %, response time, SSL expiry days
- **Kubernetes** — pod running ratio, pod status by namespace, node CPU/memory/disk, container restarts, ingress controller restarts
- **Databases & caches** — MySQL and Redis up/connections/memory/slow queries/hit ratio
- **Infrastructure & observability** — Prometheus, OTel collector, Blackbox exporter, node network, OTel throughput
### All-servers dashboard query
Use this PromQL in a Grafana **Table** panel to see every monitored service/endpoint and its up/down state:
```promql
# Infrastructure services (1 = up, 0 = down)
up{job=~"mysql|redis|node-exporter|kube-state-metrics|prometheus|otel-collector"}
```
And a second query for HTTPS endpoints:
```promql
# HTTPS endpoints (1 = reachable 2xx, 0 = failing)
probe_success{job="blackbox-http"}
```
For a single merged table, use:
```promql
label_replace(
up{job=~"mysql|redis|node-exporter|kube-state-metrics|prometheus|otel-collector"},
"server", "$1", "instance", "(.+)"
)
or
label_replace(
probe_success{job="blackbox-http"},
"server", "$1", "instance", "(.+)"
)
```
Observed at commit time:
- `otelcol_process_uptime_total` count: **2**
- `/api/v1/write` HTTP codes: `200`, `400` (one corrupt probe), `204` (successful remote writes)
### Dashboards are accessible
- **Loki Operational:** https://dashboard.fetcherpay.com/d/MQHVDmtWk/loki-operational
- **Tempo Operational:** https://dashboard.fetcherpay.com/d/5BcHdkRgz/tempo-operational
---
## Component endpoints
| Component | Namespace | Endpoint |
|-----------|-----------|----------|
| OTel Collector OTLP gRPC | `observability` | `otel-collector.observability:4317` |
| OTel Collector OTLP HTTP | `observability` | `otel-collector.observability:4318` |
| OTel Collector Jaeger gRPC | `observability` | `otel-collector.observability:14250` |
| OTel Collector Jaeger HTTP | `observability` | `otel-collector.observability:14268` |
| OTel Collector Zipkin | `observability` | `otel-collector.observability:9411` |
| OTel Collector metrics | `observability` | `otel-collector.observability:8888` |
| FetcherPay Prometheus | `fetcherpay` | `prometheus.fetcherpay:9090` |
| Redis | `fetcherpay` | `redis.fetcherpay:6379` |
| Redis Exporter | `fetcherpay` | `redis-exporter.fetcherpay:9121` |
| Tempo | `observability` | `tempo.observability:4317` |
| Loki | `observability` | `loki.observability:3100` |
---
## Notes / caveats
- The collector image is pinned to `otel/opentelemetry-collector-contrib:latest`. For reproducibility, consider pinning to a specific version tag.
- Direct `kubectl exec`, `port-forward`, and `logs` sometimes fail with a kubelet TLS certificate error (`x509: certificate valid for ... not 104.190.60.129`). Workarounds used during this session:
- `kubectl logs --insecure-skip-tls-verify-backend=true`
- `kubectl proxy` + service proxy URLs for HTTP health checks
- Grafana recovered from a `SandboxChanged` loop by force-deleting the stuck pod. If this recurs, investigate node-level sandbox/CRI-o stability.
---
## Open items (not addressed in this session)
1. **nginx-ingress-controller** has ~309 restarts over 269 days and recently triggered `SandboxChanged` transient outage.
2. **`hermes.fetcherpay.com`** and **`ollama.fetcherpay.com`** are not configured in ingress/Traefik.
3. **`hermes.squaremcp.com` root path** returns 404 — API routes work, but there is no root handler.
---
## Related vault docs
- Phase 1 Communications deploy handoff: `SquareMCP/deployments/2026-06-15-phase1-communications-deploy-handoff.md`
- Architecture: `hermes-mcp/ARCHITECTURE.md`
---
## Changelog
| Date | Author | Note |
|------|--------|------|
| 2026-06-16 | Kimi Code | Initial handoff — OTel collector remote-write fixed, Loki/Tempo dashboards imported |
---
## Why some services show unhealthy
### `fetcherpay-leads-api` and `fetcherpay-leads-worker` — `ImagePullBackOff`
**Root cause:** stale image references, not deployment activity.
- `leads-api` tries to pull `23.120.207.35:32000/fetcherpay/leads-api:latest`
- `leads-worker` tries to pull `23.120.207.35:32000/fetcherpay/leads-api:v16-import-fix`
The old registry IP `23.120.207.35:32000` no longer responds (i/o timeout). The current MicroK8s registry is `localhost:32000`, and `fetcherpay/leads-api:latest` exists there, but `v16-import-fix` does not.
**Expectation:** these pods will stay broken forever with no new deployments. They require either:
1. Update image references to `localhost:32000/fetcherpay/leads-api:latest` (and pick a valid tag for the worker), or
2. Delete the Deployments if the leads feature is no longer used.
### `nginx-ingress-microk8s-controller` — 314 restarts
**Root cause:** chronic instability, most likely resource pressure / OOM / node-level sandbox issues.
- 314 restarts over ~269 days ≈ 1.17 restarts/day
- Pod is currently Running/Ready; no recent exit state stored
- Liveness/readiness probes are on `:10254/healthz`
This is not caused by application deployments. The ingress controller runs in `hostNetwork` mode and restarts independently of app deploys. Likely contributors on this single-node MicroK8s setup:
- Memory limits / OOMKilled during traffic spikes
- containerd/CRI-o sandbox churn (the same `SandboxChanged` pattern seen with Grafana)
- Calico/network hiccups
**Expectation:** restarts will likely continue slowly even with zero deployments. To reduce them, investigate node resources and consider giving the ingress controller a memory limit/request and checking `dmesg`/kernel OOM logs.
### Bottom line
Deployments are not making these unhealthy. The dashboard is correctly surfacing two long-standing issues:
- Abandoned image references (`fetcherpay-leads-*`)
- Chronic ingress-controller instability on the single-node cluster
---
## Runbooks
Detailed operational documentation for the observability stack has been added to:
`SquareMCP/runbooks/observability/`
| File | What it covers |
|------|----------------|
| `00-index.md` | Overview, quick links, datasource UIDs, status commands |
| `01-monitoring-architecture.md` | What monitors what, namespaces, manifests, data flow |
| `02-dashboards-and-queries.md` | Dashboard list + reusable PromQL queries |
| `03-api-reference.md` | Prometheus/Loki/Tempo/Grafana/Alertmanager API examples |
| `04-alerts-and-response.md` | Alert routes, response steps, decision tree |
| `05-ai-agent-guide.md` | How AI agents should use and update the stack |
| `06-human-guide.md` | Day-to-day Grafana usage for humans |
| `07-known-issues.md` | Pre-existing issues (leads ImagePullBackOff, nginx restarts, MT5 ports) |
These runbooks include everything needed for targeted searches by humans and AI agents.
@@ -0,0 +1,173 @@
# Phase 1 Communications — Week 3 (Chat UI) — Engineering Handoff for kimi-cli
**Date:** 2026-06-16
**Branch:** `main`
**Author:** Claude Code
**Status:** READY TO DEPLOY — code complete, `npx tsc --noEmit` clean. NOT yet committed, NOT yet visually QA'd in a browser (built under a no-docker/no-dev-server constraint this session).
**Do not deploy:** No new env vars required. No new npm packages. Drop-in to existing hermes-mcp image build.
---
> ⚠️ **CRITICAL — DO NOT LEAVE DOCKER RUNNING**
>
> After building and pushing the image, **stop and remove all local Docker containers** before kubectl apply.
> Docker left running has previously caused port conflicts with the production Kubernetes cluster, breaking live services.
>
> ```bash
> docker stop $(docker ps -q) 2>/dev/null || true
> docker rm $(docker ps -aq) 2>/dev/null || true
> ```
>
> Verify nothing is bound to the relevant ports before applying to k8s:
> ```bash
> ss -tlnp | grep -E ':(80|443|3000|8080)'
> ```
>
> Only proceed with `kubectl apply` once Docker containers are confirmed stopped.
---
## What was built
Week 3 of the sprint plan: the chat UI, onboarding flow, and hardening on top of the Week 1+2 backend (already live — see `2026-06-15-phase1-communications-deploy-handoff.md`). This is the user-facing dashboard tab plus three small backend gaps closed along the way.
### Backend additions (closing gaps found vs. the engineering design doc)
- `PUT /api/communications/drafts/:draft_id` — edit `draft_text`/`draft_metadata` directly without an AI call (manual edits + Instagram `image_url` attachment use this same endpoint; metadata is shallow-merged server-side so `image_url` doesn't clobber `hashtags`).
- `GET /api/communications/status` / `PUT /api/communications/status` — exposes `approved_posts_count` and `autonomous_mode_enabled`; the PUT enforces the 10-approval gate server-side (defense in depth, not just a UI check).
### Frontend additions (vanilla JS dashboard, NOT React — the sprint plan mentions a "React SPA" but this repo's `product/app/` is plain HTML/CSS/JS with global-scope `<script>` tags, same pattern as the rest of the dashboard)
- New "Communications" nav tab and section in `product/app/index.html`.
- New `product/app/communications.js` — profile form (vertical-specific fields for mortgage_broker incl. NMLS, email recipients), onboarding chips, chat-driven draft generation, per-draft edit/save/regenerate/reject, failed-platform retry (re-calls `/chat` scoped to one platform since failed generations have no `draft_id` to `/regenerate`), approve-all + publish results, autonomous-mode toggle gated on `approved_posts_count >= 10`.
- New `.comm-*` CSS rules in `product/app/styles.css` matching the existing dark theme tokens (`--bg`, `--surface`, `--accent`, `--border`, `--radius`) and existing component conventions (`.btn`, `.status-badge`, card patterns).
- Small hook in `product/app/app.js`'s nav-link handler to toggle the new section and lazy-init `communications.js` on first visit.
Auth: no new auth path needed — `meterMiddleware` already accepts the dashboard's existing session cookie in addition to `x-api-key`, so the new routes work with the logged-in browser session as-is.
Sprint plan item 3.3 (learning-loop activation) required **no new work** — confirmed it was already implemented server-side in the Week 1+2 deploy (`getRecentExamples()` in `src/communications-chat.ts` injects the last 3 approved examples per platform into the Claude system prompt).
Sprint plan item 3.5 (pilot kickoff) is a business/ops action, not code — out of scope here.
---
## Files changed
### Modified
- `src/communications.ts` — added `updateDraftFields()`, `CommStatus` interface, `getCommStatus()`, `setAutonomousMode()`
- `src/index.ts` — added 3 imports + 3 route handlers (`PUT /drafts/:draft_id`, `GET`/`PUT /status`)
- `product/app/index.html` — new nav-link + `<section id="communications-section">` (profile form/summary + chat/drafts markup)
- `product/app/app.js` — nav-link handler now toggles the Communications section and calls `window.initCommunications()` on first view
- `product/app/styles.css` — ~330 new lines of `.comm-*` rules
### Created
- `product/app/communications.js` — all Week 3 chat UI logic (~330 lines)
### No changes to
- `package.json` — no new dependencies
- `hermes-k8s.yaml` — no new env vars needed
- `Dockerfile` — unchanged
- `src/db.ts` / schema — no new tables or columns this round (Week 1+2 schema already covers this UI)
- Any existing routes, tools, or OAuth logic
```
product/app/app.js | 2 +
product/app/index.html | 87 +++++++++++++
product/app/styles.css | 328 +++++++++++++++++++++++++++++++++++++++++++++++++
src/communications.ts | 61 +++++++++
src/index.ts | 44 +++++++
5 files changed, 522 insertions(+)
```
(plus the new `product/app/communications.js` file, currently untracked)
---
## What was verified this session vs. what was NOT
**Verified:**
- `npx tsc --noEmit` — clean, zero errors, after all backend changes.
**NOT verified (constraint: no docker, no dev server, no production DB/Redis touch this session):**
- No visual/browser QA of the new Communications tab — clicking through profile creation, chat generation, draft editing, approve/publish has not been exercised in a live browser.
- No integration test against a running server.
**kimi-cli should do a manual click-through after deploying to staging/production** before treating this as fully verified: create a profile, generate a draft via chat, edit text, attach an Instagram image URL, approve+publish, and confirm the autonomous toggle stays hidden below 10 approvals.
---
## Deploy commands
```bash
# 1. Commit the implementation
git add src/communications.ts src/index.ts product/app/index.html product/app/app.js product/app/styles.css product/app/communications.js
git commit -m "feat(communications): Week 3 — chat UI, onboarding, draft editing, status endpoints"
git push origin main
# 2. Build and push image
docker build -t <registry>/hermes-mcp:<sha> .
docker push <registry>/hermes-mcp:<sha>
# ⚠️ 3. STOP DOCKER BEFORE APPLYING TO K8S
docker stop $(docker ps -q) 2>/dev/null || true
docker rm $(docker ps -aq) 2>/dev/null || true
ss -tlnp | grep -E ':(80|443|3000|8080)' # must be empty before proceeding
# 4. Update image SHA in hermes-k8s.yaml, then apply
kubectl apply -f hermes-k8s.yaml
# 5. Verify rollout
kubectl rollout status deployment/hermes-mcp
kubectl logs -l app=hermes-mcp --tail=50 | grep '\[db\]'
```
No schema migration runs this time — `initDatabase()` has nothing new to create.
---
## Verification
```bash
BASE=https://hermes.squaremcp.com
KEY=<your-api-key>
# 1. Edit a draft directly (no AI call)
curl -X PUT "$BASE/api/communications/drafts/<draft_id>" \
-H "x-api-key: $KEY" -H "Content-Type: application/json" \
-d '{"draft_text": "Updated text", "draft_metadata": {"image_url": "https://example.com/img.jpg"}}'
# Expected: 200 with updated draft (only works while draft status is "pending")
# 2. Get communications status
curl "$BASE/api/communications/status" -H "x-api-key: $KEY"
# Expected: 200 { approved_posts_count, autonomous_mode_enabled }
# 3. Try enabling autonomous mode below threshold
curl -X PUT "$BASE/api/communications/status" \
-H "x-api-key: $KEY" -H "Content-Type: application/json" \
-d '{"autonomous_mode_enabled": true}'
# Expected: 400 "Autonomous mode unlocks after 10 approved posts" if approved_posts_count < 10
```
Then in a browser: log into the dashboard, click the new "Communications" nav tab, and walk through profile creation → chat prompt → draft edit → approve/publish.
---
## Open items for the engineer
1. **Browser QA** — see "What was NOT verified" above. Do this before telling Alex Ferrari the tab exists.
2. **React SPA mismatch** — the original sprint plan and engineering design doc both mention a "React SPA" for the chat interface. This repo's dashboard has no React; Week 3 was implemented in the same vanilla JS pattern as the rest of `product/app/`. If a React rewrite is actually wanted later, treat this as a known divergence from the design doc, not a bug.
3. **Instagram approve gate** — the UI disables the "include" checkbox for Instagram drafts missing `image_url` and shows a "(required to approve)" hint; confirm this matches what you want pilot users to see.
---
## Related vault docs
- Previous handoff (Week 1+2 backend): `SquareMCP/deployments/2026-06-15-phase1-communications-deploy-handoff.md`
- Sprint plan: `SquareMCP/products/chat-first-communications/2026-06-15-phase1-mvp-sprint-plan.md`
- Engineering design: `SquareMCP/products/chat-first-communications/2026-06-15-phase1-engineering-design.md`
- Product spec: `SquareMCP/products/chat-first-communications/2026-06-15-comprehensive-product-spec.md`
---
## Changelog
| Date | Author | Note |
|------|--------|------|
| 2026-06-16 | Claude Code | Initial handoff — Week 3 chat UI complete, built with no-docker constraint, not yet committed or browser-tested |
@@ -0,0 +1,224 @@
# Phase 1 Communications — Week 3 (Chat UI) Deploy Result
**Date:** 2026-06-16
**Branch:** `main`
**Author:** Kimi Code
**Status:** DEPLOYED + BROWSER QA'D
---
## Original handoff
See `SquareMCP/deployments/2026-06-16-phase1-week3-chat-ui-deploy-handoff.md` for the full feature description.
---
## What was deployed
Week 3 of the Chat-First Communications Manager:
- Chat UI dashboard tab (`product/app/communications.js`)
- Business profile form with vertical-specific fields (mortgage broker NMLS, etc.)
- Onboarding chips and chat-driven draft generation
- Inline draft editing, regenerate, reject
- `PUT /api/communications/drafts/:draft_id`
- `GET` / `PUT /api/communications/status` (server-side 10-approval gate)
- Autonomous-mode toggle hidden until `approved_posts_count >= 10`
---
## Git
| Action | SHA / Ref |
|--------|-----------|
| Feature commit | `565b115` |
| Image SHA bump commit | `82ddad4` |
| Branch | `main` pushed to `https://git.fetcherpay.com/garfield/hermes-mcp.git` |
---
## Docker image
```
localhost:32000/hermes-mcp@sha256:6fc290aea78e063b79814eab5325e3816ebb6120c5c268b677a889d52e0f1dc7
```
Updated in `hermes-k8s.yaml`.
---
## Deploy procedure followed
1. `git add src/communications.ts src/index.ts product/app/index.html product/app/app.js product/app/styles.css product/app/communications.js`
2. `git commit -m "feat(communications): Week 3 — chat UI, onboarding, draft editing, status endpoints"`
3. `git push origin main`
4. `docker build -t localhost:32000/hermes-mcp:<sha> -t localhost:32000/hermes-mcp:latest .`
5. `docker push localhost:32000/hermes-mcp:<sha> && docker push localhost:32000/hermes-mcp:latest`
6. Stopped and removed all local Docker containers:
```bash
docker stop $(docker ps -q) 2>/dev/null || true
docker rm $(docker ps -aq) 2>/dev/null || true
ss -tlnp | grep -E ':(80|443|3000|8080)'
```
7. Restarted the MySQL container immediately (Hermes connects to `127.0.0.1:3306`):
```bash
docker run -d --name mysql --restart unless-stopped \
-e MYSQL_ROOT_PASSWORD=fetcherpay \
-e MYSQL_DATABASE=fetcherpay \
-p 3306:3306 \
-v fetcherpay_mysql_data:/var/lib/mysql \
mysql:8.0 --bind-address=0.0.0.0
```
8. Updated `hermes-k8s.yaml` image SHA.
9. `microk8s kubectl apply -f hermes-k8s.yaml`
10. `microk8s kubectl rollout status deployment/hermes-mcp -n fetcherpay`
---
## Verification
### Server startup
```bash
microk8s kubectl logs -n fetcherpay -l app=hermes-mcp --tail=50 | grep '\[db\]'
```
Result:
```
[db] MySQL connected and schema initialized
```
### Health endpoint
```bash
curl https://hermes.squaremcp.com/health
```
Result:
```json
{"status":"ok","service":"hermes-mcp","toolCount":55,...}
```
### Status API
```bash
curl https://hermes.squaremcp.com/api/communications/status \
-H "x-api-key: 17fedba5e7fe4a9aa7736c8b4ca4baed"
```
Result:
```json
{"approved_posts_count": 0, "autonomous_mode_enabled": false}
```
### Autonomous-mode gate
```bash
curl -X PUT https://hermes.squaremcp.com/api/communications/status \
-H "x-api-key: 17fedba5e7fe4a9aa7736c8b4ca4baed" \
-H 'Content-Type: application/json' \
-d '{"autonomous_mode_enabled": true}'
```
Result:
```json
{"error": "Autonomous mode unlocks after 10 approved posts"}
```
---
## Browser QA click-through
Performed with headless Playwright against `https://hermes.squaremcp.com/app/index.html`.
### Test account created
- Email: `qa-clickthrough-20260616@squaremcp.com`
- Password: `QATestPass123!`
- API key: `17fedba5e7fe4a9aa7736c8b4ca4baed`
- Role: `user` (not admin)
### Steps executed
1. ✅ Logged into dashboard
2. ✅ Clicked **Communications** nav tab
3. ✅ Created mortgage-broker profile:
- NMLS: `123456`
- States: `CA, NY`
- Disclaimer: `NMLS #123456. Not an offer to lend.`
- Tone: `professional`
- Platforms: LinkedIn, Instagram
4. ✅ Generated drafts via chat prompt: "Write a post about current mortgage rates"
5. ✅ Edited Instagram draft text
6. ✅ Attached Instagram image URL: `https://example.com/mortgage-rates.jpg`
7. ✅ Confirmed autonomous-mode banner is **hidden** while `approved_posts_count < 10`
8. ✅ Clicked **Approve & post all**
### Publish result
- LinkedIn publish failed with: `LinkedIn not connected for this account` — expected for a fresh QA account with no OAuth tokens.
- Instagram draft was included after image URL was attached.
### Screenshot trail
| File | What it shows |
|------|---------------|
| `/tmp/qa_01_dashboard.png` | Dashboard after login |
| `/tmp/qa_02_communications.png` | Communications tab opened |
| `/tmp/qa_03_profile_filled.png` | Profile form filled |
| `/tmp/qa_04_profile_saved.png` | Profile saved, summary visible |
| `/tmp/qa_05_drafts.png` | Generated drafts |
| `/tmp/qa_06_edited.png` | Instagram draft edited with image URL |
| `/tmp/qa_07_published.png` | Approve & post results |
---
## Issues encountered during deploy
### Registry pod stuck in `ContainerCreating`
The MicroK8s registry pod (`registry-579865c76c-98vmg`) was stuck with 249 restarts, so `docker push localhost:32000/...` failed with connection refused.
**Fix:** force-deleted the pod. The ReplicaSet recreated it and push succeeded.
```bash
microk8s kubectl delete pod -n container-registry registry-579865c76c-98vmg --grace-period=0 --force
```
### Ingress controller restart during deploy
`nginx-ingress-microk8s-controller` restarted around the same time, causing brief 503s/connection failures for SquareMCP sites. It recovered automatically.
---
## Cleanup / open items
1. **QA test account** — delete when no longer needed:
```bash
docker exec mysql mysql -uroot -pfetcherpay \
-e "DELETE FROM hermes_oauth.customers WHERE email = 'qa-clickthrough-20260616@squaremcp.com';"
```
2. **Docker containers stopped** — `mt5` and `obsidian` were stopped per the deploy warning. Restart if needed:
```bash
cd ~/mt5-docker && ./start-mt5.sh
# obsidian — rerun the original docker run command
```
3. **React SPA divergence** — the original design doc mentioned a React SPA. This implementation is vanilla JS consistent with the rest of `product/app/`. Documented as a known divergence, not a bug.
---
## Related vault docs
- Week 3 handoff: `SquareMCP/deployments/2026-06-16-phase1-week3-chat-ui-deploy-handoff.md`
- Week 1+2 handoff: `SquareMCP/deployments/2026-06-15-phase1-communications-deploy-handoff.md`
- Observability runbooks: `SquareMCP/runbooks/observability/`
---
## Changelog
| Date | Author | Note |
|------|--------|------|
| 2026-06-16 | Kimi Code | Deployed Week 3 chat UI and completed browser QA |
@@ -0,0 +1,88 @@
# Deploy Result — API Keys Feature
**Date:** 2026-06-17
**Commit deployed:** `bf1e690`
**Status:** ✅ Both deployments successful
----
## Deploys performed
### 1 — hermes-mcp (backend)
```bash
cd ~/hermes-mcp
docker build -t localhost:32000/hermes-mcp:bf1e690 .
docker push localhost:32000/hermes-mcp:bf1e690
# updated hermes-k8s.yaml image → localhost:32000/hermes-mcp:bf1e690 (not committed)
microk8s kubectl apply -f hermes-k8s.yaml
microk8s kubectl rollout status deployment/hermes-mcp -n fetcherpay
```
**Result:** Rollout completed successfully.
### 2 — squaremcp-app (frontend)
```bash
cd ~/hermes-mcp
docker build -f product/app/Dockerfile -t localhost:32000/squaremcp-app:bf1e690 .
docker push localhost:32000/squaremcp-app:bf1e690
# updated product/app/app-k8s.yaml image → localhost:32000/squaremcp-app:bf1e690 (not committed)
microk8s kubectl apply -f product/app/app-k8s.yaml
microk8s kubectl rollout status deployment/squaremcp-app -n fetcherpay
```
**Result:** Rollout completed successfully.
----
## Verification
### Backend API
`POST /api/auth/login` response now includes `api_key`:
```json
{
"id": "d35c7c6a-b47c-4975-afef-656170772705",
"email": "test-deploy-c6ab014@example.com",
"plan": "free",
"role": "user",
"api_key": "941431eed80f48998e2076fcecd85164"
}
```
`GET /api/auth/me` also returns `api_key` ✅
### Frontend UI (Playwright)
1. Logged in at `https://app.squaremcp.com` as test user.
2. Clicked **API Keys** in top nav.
3. API key `941431eed80f48998e2076fcecd85164` displayed in code block ✅
4. **Copy** button present ✅
### Pod status
```
NAME READY STATUS RESTARTS AGE
hermes-mcp-... 1/1 Running ...
squaremcp-app-... 1/1 Running ...
redis-... 1/1 Running ...
```
Redis was already Running before deploy; no force-delete needed.
----
## Notes
- `microk8s ctr image import -` hung repeatedly (same containerd issue as earlier deploys), so images were imported via `docker push localhost:32000/...` instead. The registry path works and produces the same deployed result.
- `hermes-k8s.yaml` and `product/app/app-k8s.yaml` image tags were updated locally but **not committed**.
- The handoff suggested testing with `Authorization: Bearer <key>`; the current auth middleware validates customer API keys via `x-api-key` header or `?key=` query param, while `Authorization: Bearer` is reserved for OAuth tokens. `GET /api/auth/me` requires session cookie, so API-key auth returns `Not authenticated` there — this is expected.
----
## Related docs
- Handoff: `SquareMCP/AI-Context/2026-06-17-claude-handoff-api-keys-feature.md`
@@ -0,0 +1,70 @@
# Deploy Result — Bearer Auth Fix
**Date:** 2026-06-17
**Commit deployed:** `6ca0ca6`
**Service:** hermes-mcp
**Status:** ✅ Deployed and verified
----
## Deploy performed
```bash
cd ~/hermes-mcp
docker build -t localhost:32000/hermes-mcp:6ca0ca6 .
docker push localhost:32000/hermes-mcp:6ca0ca6
# updated hermes-k8s.yaml image → localhost:32000/hermes-mcp:6ca0ca6 (not committed)
microk8s kubectl apply -f hermes-k8s.yaml
microk8s kubectl rollout status deployment/hermes-mcp -n fetcherpay
```
## Pod status
```
NAME READY STATUS RESTARTS AGE IP NODE
hermes-mcp-7988bbc955-c9w2r 1/1 Running 0 ... 104.190.60.129 art0
```
## Verification
The Bearer auth fix was verified against an endpoint that resolves the customer via `requireAuth` (`/api/connections`).
Test key: `941431eed80f48998e2076fcecd85164`
### With `Authorization: Bearer <api_key>`
```bash
curl -H "Authorization: Bearer 941431eed80f48998e2076fcecd85164" \
https://hermes.squaremcp.com/api/connections
```
Result:
```json
{"customerId":"d35c7c6a-b47c-4975-afef-656170772705","connections":{"email":false,"whatsapp":false,"linkedin":false,"telegram":false,"discord":false,"instagram":false,"twitter":false,"tiktok":false,"snapchat":false,"facebook":true,"obsidian":false}}
```
✅ **200 OK** — customer resolved via Bearer token.
### With `x-api-key` header (regression check)
```bash
curl -H "x-api-key: 941431eed80f48998e2076fcecd85164" \
https://hermes.squaremcp.com/api/connections
```
Result: same customer JSON ✅
### Note on `/api/auth/me`
`GET /api/auth/me` only returns user data when authenticated via session cookie (`req.jwtUser`). It returns `{"error":"Not authenticated"}` for API-key or Bearer-token auth, which is the existing behavior of that endpoint — not a regression from this fix.
## Notes
- `microk8s ctr image import -` hung (same containerd issue as previous deploys), so the image was pushed to `localhost:32000` registry instead.
- `hermes-k8s.yaml` image tag was updated locally but **not committed**.
## Related docs
- Handoff: `SquareMCP/AI-Context/2026-06-17-claude-handoff-bearer-auth-fix.md`
@@ -0,0 +1,94 @@
# Deploy Result — CORS PUT Fix for Communications Profile
**Date:** 2026-06-17
**Commit deployed:** `e6d7f11` (`fix(cors): allow PUT requests; update DCR wildcard redirect_uri test`)
**Service:** hermes-mcp
**Status:** ✅ Committed, pushed, and deployed
----
## Problem
Clicking **Save profile** in the Communications section of `https://app.squaremcp.com` showed "Network error. Please try again."
The frontend (`product/app/communications.js`) calls:
```js
fetch(`${API_BASE}/api/communications/profile`, {
method: 'PUT',
...
})
```
But the Express CORS middleware only allowed `GET, POST, DELETE, OPTIONS`:
```ts
methods: ['GET', 'POST', 'DELETE', 'OPTIONS'],
```
Browsers block the PUT request at the CORS preflight stage, causing the network error.
## Fix
Added `'PUT'` to the allowed CORS methods in `src/index.ts`:
```ts
methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],
```
Also updated `src/oauth-dcr.test.ts` to match the new wildcard `redirect_uri` behavior from the previous commit.
## Commit & push
```bash
git add src/index.ts src/oauth-dcr.test.ts
git commit -m "fix(cors): allow PUT requests; update DCR wildcard redirect_uri test"
git push origin main
```
Pushed `85cb2db..e6d7f11`.
## Deploy
```bash
cd ~/hermes-mcp
docker build -t localhost:32000/hermes-mcp:e6d7f11 .
docker push localhost:32000/hermes-mcp:e6d7f11
# updated hermes-k8s.yaml image → localhost:32000/hermes-mcp:e6d7f11 (not committed)
microk8s kubectl apply -f hermes-k8s.yaml
microk8s kubectl rollout status deployment/hermes-mcp -n fetcherpay
```
## Pod status
```
NAME READY STATUS RESTARTS AGE IP
hermes-mcp-578fbbdf45-jx66j 1/1 Running 0 ... 104.190.60.129
```
## Verification
Preflight response now includes PUT:
```http
HTTP/2 204
access-control-allow-origin: https://app.squaremcp.com
access-control-allow-methods: GET,POST,PUT,DELETE,OPTIONS
access-control-allow-credentials: true
```
Actual PUT request with test user session succeeded:
```bash
curl -b session.txt -X PUT https://hermes.squaremcp.com/api/communications/profile \
-H 'Content-Type: application/json' \
-H 'Origin: https://app.squaremcp.com' \
-d '{"business_type":"mortgage_broker",...}'
```
Returned the saved profile JSON ✅
## Notes
- `hermes-k8s.yaml` image tag updated locally but **not committed**.
- Full `npx vitest run` suite has a pre-existing test-isolation issue in `src/capability-routes.test.ts` (passes in isolation, fails when run with full suite due to mock state pollution). This is unrelated to the CORS fix.
@@ -0,0 +1,58 @@
# Deploy: Health check stale cache fix
**Date:** 2026-06-17
**Bug fixed:** `SquareMCP/bugs/2026-06-17-health-check-display-bug.md`
**Severity:** Low (cosmetic — publishing was working)
---
## Files changed
- `src/multitenancy/credential-store.ts` — `storeCredential` and `revokeCredential` now delete the `health:{customerId}:{platform}` Redis cache key after writing/deleting the credential
## Schema / migration
None. Redis key deletion only.
## Deploy commands
```bash
# Build and push
docker build -t localhost:32000/hermes-mcp:$(git rev-parse --short HEAD) .
docker push localhost:32000/hermes-mcp:$(git rev-parse --short HEAD)
# Update image SHA in hermes-k8s.yaml, then:
kubectl apply -f hermes-k8s.yaml -n fetcherpay
kubectl rollout status deployment/hermes-mcp -n fetcherpay
```
## Verification
After rolling out:
1. In the app, disconnect and reconnect Facebook or Instagram via the Connect modal
2. Reload the page
3. The platform card should show **Connected** (not TOKEN EXPIRED)
4. Alternatively: call `GET /api/health/platforms` immediately after `POST /api/connect/facebook` — status should be `healthy`
## Verification result
## Verification result
- **Status:** ✅ Passed
- **Time:** 2026-06-17T10:02:00-04:00
- **Tester:** smoke-test customer (`72446fa2-77f0-4a36-b530-8dbf2e8fe9d4`)
- **Method:** API-level check via `GET /api/health/platforms` using `x-api-key`
### Steps performed
1. Seeded a stale `health:{customerId}:telegram` cache entry with value `expired`.
2. Called `GET /api/health/platforms` — returned `{"platform": "telegram", "status": "expired"}` (stale cache hit).
3. Called `POST /api/connect/telegram` with a fake access token — returned `{"connected": true, "platform": "telegram"}`.
4. Called `GET /api/health/platforms` again — returned `{"platform": "telegram", "status": "healthy"}` (cache busted, fresh credential status).
5. Simulated disconnect by deleting `creds:{customerId}:telegram` and `health:{customerId}:telegram` from Redis.
6. Called `GET /api/health/platforms` — returned `{"platform": "telegram", "status": "disconnected"}`.
### Conclusion
`storeCredential` and `revokeCredential` correctly invalidate the per-platform health cache, so `/api/health/platforms` no longer serves stale `expired` / TOKEN EXPIRED status after reconnecting or disconnecting a platform.
@@ -0,0 +1,81 @@
# Deploy Result — OAuth Wildcard redirect_uris
**Date:** 2026-06-17
**Commit deployed:** `85cb2db` (`fix(oauth): support wildcard redirect_uris`)
**Service:** hermes-mcp
**Status:** ✅ Committed, pushed, and deployed
----
## Changes
### `src/oauth.ts`
Replaced the redirect_uri exact-match validation in `isValidRedirectUri` with wildcard support:
```ts
export function isValidRedirectUri(uri: string, registeredUris: string[]): boolean {
return registeredUris.some(registered => {
if (registered === uri) return true;
if (registered.includes('*')) {
const escaped = registered.replace(/[.+?^${}()|[\]\\]/g, '\\$&').replace(/\*/g, '[^/]+');
return new RegExp('^' + escaped + '$').test(uri);
}
return false;
});
}
```
This allows registered URIs like `https://*.example.com/callback` or `https://chat.openai.com/aip/*/oauth/callback`.
### `src/oauth.test.ts`
Updated tests to match the new wildcard behavior:
- Exact match still works
- `http://localhost:*` matches localhost ports
- Wildcard subdomain patterns now match
- ChatGPT GPT callback wildcard matches
- Unrelated domains are still rejected
----
## Commit & push
```bash
git add src/oauth.ts src/oauth.test.ts
git commit -m "fix(oauth): support wildcard redirect_uris"
git push origin main
```
Pushed `6ca0ca6..85cb2db` to `https://git.fetcherpay.com/garfield/hermes-mcp.git`.
----
## Deploy
```bash
cd ~/hermes-mcp
docker build -t localhost:32000/hermes-mcp:85cb2db .
docker push localhost:32000/hermes-mcp:85cb2db
# updated hermes-k8s.yaml image → localhost:32000/hermes-mcp:85cb2db (not committed)
microk8s kubectl apply -f hermes-k8s.yaml
microk8s kubectl rollout status deployment/hermes-mcp -n fetcherpay
```
## Pod status
```
NAME READY STATUS RESTARTS AGE IP
hermes-mcp-858569b7cc-lzvb9 1/1 Running 0 ... 104.190.60.129
```
## Verification
- Unit tests: `npx vitest run src/oauth.test.ts` → **28 passed** ✅
- Deployed image contains the new `isValidRedirectUri` implementation ✅
- `hermes.squaremcp.com/health` returns 200 ✅
## Notes
- `hermes-k8s.yaml` image tag was updated locally but **not committed**.
- `microk8s ctr image import -` was not used; `docker push localhost:32000/...` registry path works reliably on this host.
@@ -0,0 +1,105 @@
# Deploy Result — Session/Form Bug Fix + Communications Docs
**Date:** 2026-06-17
**Commit deployed:** `c6ab014` (squaremcp-app + hermes-mcp), `453831a` (squaremcp-docs)
**Status:** ✅ All three deployments successful
----
## Deploys performed
### A — squaremcp-app (urgent credential-leak fix)
**What changed:** `product/app/app.js` form now uses `method="post" action="javascript:void(0)"` and scopes `errorEl` to the live form.
```bash
cd ~/hermes-mcp
docker build -f product/app/Dockerfile -t localhost:32000/squaremcp-app:c6ab014 .
docker push localhost:32000/squaremcp-app:c6ab014
# updated product/app/app-k8s.yaml image → localhost:32000/squaremcp-app:c6ab014
microk8s kubectl apply -f product/app/app-k8s.yaml
microk8s kubectl rollout status deployment/squaremcp-app -n fetcherpay
```
**Result:** Rollout completed successfully.
**Verification:**
- `https://app.squaremcp.com/app.js` contains `method="post" action="javascript:void(0)"` ✅
- `https://app.squaremcp.com/app.js` contains `form.querySelector('#connect-error')` ✅
- Playwright E2E: logged in as test user, opened Facebook Connect form, submitted dummy `accessToken`/`pageId`, URL remained `https://app.squaremcp.com/` with no credentials in query string ✅
### B — hermes-mcp (login cookie alignment)
**What changed:** `src/index.ts` `POST /api/auth/login` now sets `sameSite: 'lax'` + `domain: '.squaremcp.com'`.
```bash
cd ~/hermes-mcp
docker build -t localhost:32000/hermes-mcp:c6ab014 .
docker push localhost:32000/hermes-mcp:c6ab014
# updated hermes-k8s.yaml image → localhost:32000/hermes-mcp:c6ab014 (not committed — contains secrets)
microk8s kubectl apply -f hermes-k8s.yaml
microk8s kubectl rollout status deployment/hermes-mcp -n fetcherpay
```
**Result:** Rollout completed successfully. `https://hermes.squaremcp.com/health` returns `200`.
**Verification:**
- Registered test user `test-deploy-c6ab014@example.com` via `/api/auth/signup`.
- Logged in via `/api/auth/login` and inspected `Set-Cookie` header:
```
session=...; Max-Age=604800; Domain=.squaremcp.com; Path=/; HttpOnly; Secure; SameSite=Lax
```
✅ Domain: `.squaremcp.com`
✅ SameSite: `Lax`
### C — squaremcp-docs (Communications docs page)
**What changed:** `docs/communications.html` added; nav updated across all docs pages.
```bash
cd ~/hermes-mcp
docker build -f docs/Dockerfile -t localhost:32000/squaremcp-docs:453831a .
docker push localhost:32000/squaremcp-docs:453831a
# docs/docs-k8s.yaml already referenced localhost:32000/squaremcp-docs:453831a
microk8s kubectl apply -f docs/docs-k8s.yaml
microk8s kubectl rollout status deployment/squaremcp-docs -n fetcherpay
```
**Result:** Rollout completed successfully.
**Verification:**
- `https://docs.squaremcp.com/communications.html` returns `200` ✅
- "Communications" link appears in nav on every docs page:
- `index.html` ✅
- `communications.html` ✅
- `platforms.html` ✅
- `getting-started.html` ✅
- `agent-tutorial.html` ✅
- `living-brief.html` ✅
----
## Notes / issues encountered
- **Build context:** The Dockerfiles in `product/app/Dockerfile` and `docs/Dockerfile` use repo-root-relative `COPY` paths (e.g., `product/app/app.js`), so builds must be run from `~/hermes-mcp` with `-f <path>/Dockerfile .`. Building from the subdirectory fails with missing files.
- **Registry:** `localhost:32000` registry was accessible, so `docker push` + `imagePullPolicy: IfNotPresent` worked. The `containerd-import` workaround was not needed.
- **Containerd ctr hangs:** `microk8s ctr image import` and `microk8s ctr images list` both hung indefinitely. This did not block the deploy because the registry path worked. May be worth investigating separately.
- **Hermes-k8s.yaml:** Image tag was updated locally but **not committed** per handoff instructions (file contains Communications OAuth secret).
- **Test user:** Created `test-deploy-c6ab014@example.com` for verification. Can be deleted if desired.
----
## Post-deploy health
- `https://app.squaremcp.com` → `200`
- `https://hermes.squaremcp.com/health` → `200`
- `https://docs.squaremcp.com/communications.html` → `200`
- Blackbox Exporter site health: `1.000` (18/18)
----
## Related docs
- Handoff: `SquareMCP/AI-Context/2026-06-17-claude-handoff-session-form-bug-fix.md`
- Previous Communications docs handoff: `SquareMCP/AI-Context/2026-06-16-claude-handoff-communications-docs-and-picker.md`
@@ -0,0 +1,150 @@
# Deploy: Design Review Changes + Living Brief Marketing Site
**Date:** 2026-06-18
**Scope:** Two deployments — `squaremcp-app` (frontend only) + `squaremcp-site` (marketing site)
---
## Summary of Changes
### 1. squaremcp-app — Design review fixes (frontend only, no hermes-mcp rebuild)
| File | Change |
|------|--------|
| `product/app/index.html` | Inter font (Google Fonts), nav role=tablist + aria-selected, app-toast div |
| `product/app/styles.css` | Skeleton loading cards, btn-loading spinner, comm-profile-bar, empty-state component, Inter font, toast style, mobile scrollable nav |
| `product/app/app.js` | showToast() nudge after platform connect → Communications; aria-selected sync on nav; empty-state HTML for invoices |
| `product/app/communications.js` | Skeleton draft cards + btn-loading during generation |
### 2. squaremcp-site — Living Brief section added to squaremcp.com
| File | Change |
|------|--------|
| `product/site/index.html` | New Living Brief section between consumer hero and B2B hero — dark background, video loop, GPT link, features list |
---
## Deploy Instructions
### A) squaremcp-app (frontend only — no hermes-mcp rebuild needed)
```bash
git add product/app/index.html product/app/styles.css product/app/app.js product/app/communications.js
git commit -m "design: Inter font, skeleton drafts, post-connect nudge, mobile nav, a11y, empty states"
git push origin main
# Build and push squaremcp-app image
docker build -f product/app/Dockerfile -t localhost:32000/squaremcp-app:$(git rev-parse --short HEAD) .
docker push localhost:32000/squaremcp-app:$(git rev-parse --short HEAD)
# Update image SHA in product/app/app-k8s.yaml, then:
kubectl apply -f product/app/app-k8s.yaml -n fetcherpay
kubectl rollout status deployment/squaremcp-app -n fetcherpay
```
### B) squaremcp-site
```bash
git add product/site/index.html
git commit -m "feat(site): add Living Brief section to squaremcp.com"
git push origin main
# Build and push squaremcp-site image (check site Dockerfile name)
docker build -f product/site/Dockerfile -t localhost:32000/squaremcp-site:$(git rev-parse --short HEAD) .
docker push localhost:32000/squaremcp-site:$(git rev-parse --short HEAD)
# Apply the site K8s manifest (check filename)
kubectl apply -f product/site/squaremcp-certificate.yaml -n fetcherpay
# or whatever the site deployment YAML is called
kubectl rollout status deployment/squaremcp-site -n fetcherpay
```
---
## Verification
### squaremcp-app (https://app.squaremcp.com)
1. **Font**: Page body should use Inter (check Network tab — fonts.googleapis.com request)
2. **Draft generation**: Click "Generate" in Communications → button shows spinner, placeholder skeleton cards appear below
3. **Post-connect nudge**: Connect any platform → after modal closes, a green toast appears: "Platform connected! Head to Communications..." — clicking navigates to Communications; toast auto-dismisses after 6s (shown once per session)
4. **Mobile nav**: At 375px viewport width, the tab nav should be horizontally scrollable with no overflow
5. **Invoices empty state**: Navigate to Invoices with no data → styled empty state with title + subtitle (no inline grey text)
### squaremcp-site (https://squaremcp.com)
1. Living Brief section appears between the consumer hero and the B2B hero
2. Section has dark background (#0f172a), video autoplay loop (`living-brief-avatar-facebook.mp4`), features list, and "Try Living Brief in ChatGPT" button
3. Video link: https://squaremcp.com/living-brief-avatar-facebook.mp4 (already deployed, confirm still 200)
4. GPT link: https://chatgpt.com/g/g-6a2d6a01c5588191879c2c31edd9d02c-living-brief opens correctly
5. On mobile (375px), video panel hides — only copy and CTA show
---
## No Backend Changes
hermes-mcp does NOT need a rebuild for either deployment.
---
## Facebook Post (manual — cannot be automated yet)
The Facebook video post cannot be published via Communications Manager automatically — video upload requires a separate API integration not yet built. Post manually from Facebook Business Manager:
**Copy:**
```
I released Living Brief in ChatGPT.
It solves a problem I kept seeing with people who use more than one AI tool:
the work does not follow them.
You start a project in ChatGPT, move to Claude or Codex, then spend the first
ten minutes re-explaining the customer, the decision, the mistake, the next
action, and why any of it matters.
Living Brief keeps that working context in your own Obsidian vault, so another
agent can pick it up without starting from zero.
Try it here:
https://chatgpt.com/g/g-6a2d6a01c5588191879c2c31edd9d02c-living-brief
Best first prompt:
"Create a Living Brief for this project with the objective, people involved,
decisions, risks, open questions, and next action."
```
**Video to attach:** https://squaremcp.com/living-brief-avatar-facebook.mp4 (confirmed 200, 839 KB)
## Verification result
## Verification result
- **Status:** ✅ Passed
- **Time:** 2026-06-18T10:39:00-04:00
- **Deployed images:**
- `squaremcp-app@sha256:e9f362e170db2cbbe48cf4311e34c719c23e18c36811ba7d8a5d7aade182af16`
- `squaremcp-site@sha256:82de38a81a1c4d86e7ce8aa20a5acedf27b89b6a783f523435cae942616704da`
- **hermes-mcp:** Not rebuilt or redeployed.
### squaremcp-app (https://app.squaremcp.com)
Verified by fetching the deployed static files:
- `index.html` loads Google Fonts Inter stylesheet.
- `app.js` contains `showToast()` and the post-connect toast message: `"Platform connected! Head to Communications to start creating content →"`.
- `communications.js` adds `btn-loading` class during generation and renders `comm-draft-skeleton` placeholder cards.
- `styles.css` includes `.btn-loading` and `.comm-draft-skeleton` rules.
### squaremcp-site (https://squaremcp.com)
- `index.html` includes the new Living Brief section between the consumer hero and B2B hero.
- Section uses `#0f172a` background, features list, and links to `https://chatgpt.com/g/g-6a2d6a01c5588191879c2c31edd9d02c-living-brief`.
- Video panel references `./living-brief-avatar-facebook.mp4`.
- `curl -I https://squaremcp.com/living-brief-avatar-facebook.mp4` returns `HTTP/2 200` and `content-type: video/mp4`.
### K8s manifests
- `product/app/app-k8s.yaml` updated to the new `squaremcp-app` digest.
- `product/site/squaremcp-k8s-ingress.yaml` updated to the new `squaremcp-site` digest.
- Both rollouts completed successfully.
@@ -0,0 +1,104 @@
# Deploy: WhatsApp checkbox + Obsidian modal fix (frontend only)
**Date:** 2026-06-18
**Component:** `squaremcp-app` only — no hermes-mcp changes
---
## Bug 1: WhatsApp missing from Communications screen checkboxes
The platform checkboxes in the profile form were hardcoded to LinkedIn / Facebook /
Instagram / Email. WhatsApp was wired into the backend but never added to the UI.
### Files changed
| File | Change |
|------|--------|
| `product/app/index.html` | Added WhatsApp checkbox; added `comm-whatsapp-fields` div with recipients input |
| `product/app/communications.js` | Added `whatsapp` to `PLATFORM_LABELS`; show/hide `comm-whatsapp-fields` on checkbox toggle; populate `whatsapp_recipients` from profile; send `whatsapp_recipients` on form submit |
---
## Bug 2: Obsidian connect button shows blank modal
`renderConnectForm` returned `''` for any platform not in `PLATFORM_CONFIG`.
Obsidian has no credential form (it's server-side via `OBSIDIAN_VAULT_PATH`),
so it was never added to the config.
### Files changed
| File | Change |
|------|--------|
| `product/app/app.js` | Added `obsidian` to `PLATFORM_CONFIG` with `type: 'info'` and an explanatory message; added `info` branch to `renderConnectForm` that renders the message instead of a form; also fixed the fallback for unknown platforms (was `''`, now shows a readable error) |
---
## No backend changes
hermes-mcp does not need a rebuild or redeploy.
---
## Deploy commands
```bash
# Commit
git add product/app/index.html product/app/communications.js product/app/app.js
git commit -m "fix: add WhatsApp checkbox to Comm Manager; fix Obsidian blank modal"
git push origin main
# Build and push squaremcp-app only
docker build -f product/app/Dockerfile -t localhost:32000/squaremcp-app:$(git rev-parse --short HEAD) .
docker push localhost:32000/squaremcp-app:$(git rev-parse --short HEAD)
# Update image SHA in product/app/app-k8s.yaml, then:
kubectl apply -f product/app/app-k8s.yaml -n fetcherpay
kubectl rollout status deployment/squaremcp-app -n fetcherpay
```
---
## Verification
1. Open app.squaremcp.com → Communications tab → Edit profile
- WhatsApp checkbox should appear between Instagram and Email
- Checking WhatsApp reveals a recipients input field (E.164 phone numbers)
- Unchecking WhatsApp hides the field again
- Saving with WhatsApp checked but no recipients should return a 400 error
- Saving with WhatsApp + a recipient should persist correctly
2. Open app.squaremcp.com → Connections tab → click Obsidian
- Modal should show an informational message about server-side vault config
- No blank modal
## Verification result
## Verification result
- **Status:** ✅ Passed
- **Time:** 2026-06-18T09:27:00-04:00
- **Deployed image:** `localhost:32000/squaremcp-app:a01d94f`
- **Method:** Fetched deployed static files via Ingress and grepped for changes
### Checks performed
1. `index.html` served at `https://app.squaremcp.com/index.html`
- Contains WhatsApp checkbox: `<input type="checkbox" name="enabled_platforms" value="whatsapp"> WhatsApp`
- Contains conditional WhatsApp recipients field: `<div id="comm-whatsapp-fields" ...>`
- Obsidian connect card still present in platform list.
2. `communications.js`
- `PLATFORM_LABELS` includes `whatsapp: 'WhatsApp'`
- `updateConditionalFields` toggles `comm-whatsapp-fields` based on checkbox
- `populateProfileForm` populates `whatsapp_recipients`
- `onProfileSubmit` sends `whatsapp_recipients` when WhatsApp is enabled
3. `app.js`
- `PLATFORM_CONFIG.obsidian` exists with `type: 'info'` and explanatory message
- `renderConnectForm` has `info` branch rendering the message
- Unknown platforms now return readable fallback instead of blank string
### Conclusion
Frontend deployment is live. WhatsApp appears in the Communications Manager profile form, its recipients field shows/hides correctly, and the Obsidian connect modal renders an informational message instead of a blank modal. hermes-mcp was not rebuilt.
@@ -0,0 +1,102 @@
# Deploy: Instagram businessAccountId fix
**Date:** 2026-06-18
**Scope:** `hermes-mcp` only — backend change, full rebuild required
---
## Bug
Instagram posts from Communications Manager failed with:
```
Instagram API error (400): Object with ID 'undefined' does not exist
```
## Root Cause
The generic `/api/connect/:platform` route in `src/index.ts` destructured a fixed set of body fields and silently dropped anything else. The frontend sends `businessAccountId` for Instagram — the backend received it but never stored it. Credentials were saved without `businessAccountId`. The Instagram client (`resolveCreds`) read back `undefined` and constructed the Graph API URL as `/undefined/media`.
## Files Changed
| File | Change |
|------|--------|
| `src/index.ts` | Destructure `businessAccountId` from body; require it for `instagram` platform; store it in credentials (same pattern as `pageId` for Facebook) |
| `src/clients/instagram.ts` | Add guard in `resolveCreds`: if stored credential exists but `businessAccountId` is missing, throw a clear "please reconnect" error instead of silently returning `undefined` |
---
## Deploy Commands
```bash
git add src/index.ts src/clients/instagram.ts
git commit -m "fix: store Instagram businessAccountId on connect; guard missing field in client"
git push origin main
# Rebuild hermes-mcp
docker build -f Dockerfile -t localhost:32000/hermes-mcp:$(git rev-parse --short HEAD) .
docker push localhost:32000/hermes-mcp:$(git rev-parse --short HEAD)
# Update image SHA in hermes-k8s.yaml, then:
kubectl apply -f hermes-k8s.yaml -n fetcherpay
kubectl rollout status deployment/hermes-mcp -n fetcherpay
```
---
## Post-Deploy: Affected Users
Any user who connected Instagram BEFORE this fix has a credential stored without `businessAccountId`. They will now get a clear error:
> "Instagram credential is missing Business Account ID. Please reconnect Instagram from the Platforms tab."
This is intentional — it guides them to reconnect rather than surfacing the cryptic 400. They need to:
1. Go to Platforms tab
2. Click Connect on Instagram
3. Re-enter their Access Token + Business Account ID
---
## Verification
1. Connect Instagram with a valid `accessToken` and `businessAccountId`
2. Go to Communications, generate a draft with Instagram enabled
3. Approve and publish — should post without the 400 error
4. Confirm the stored credential contains `businessAccountId`:
```bash
# On the server, check Redis for the stored credential (encrypted — just verify key exists)
kubectl exec -n fetcherpay deploy/hermes-mcp -- redis-cli keys "creds:*:instagram"
```
## Verification result
## Verification result
- **Status:** ✅ Passed
- **Time:** 2026-06-18T11:02:00-04:00
- **Deployed image:** `localhost:32000/hermes-mcp:fa53e9f`
- **Tester:** smoke-test customer (`72446fa2-77f0-4a36-b530-8dbf2e8fe9d4`)
### API checks
1. `POST /api/connect/instagram` with `accessToken` only
- Returned `400 { "error": "business_account_id_required" }`.
2. `POST /api/connect/instagram` with `accessToken` + `businessAccountId`
- Returned `200 { "connected": true, "platform": "instagram" }`.
3. Verified the stored Redis credential (`creds:{customerId}:instagram`) decrypts to:
- `{"accessToken":"fake-token","businessAccountId":"123456789"}`
- Confirms `businessAccountId` is persisted with the credential.
4. Cleaned up the fake test credential and health cache key.
### Client guard
`src/clients/instagram.ts` now throws a clear error if a stored credential is missing `businessAccountId`, so affected users reconnecting will see:
> "Instagram credential is missing Business Account ID. Please reconnect Instagram from the Platforms tab."
### Rollout
- `hermes-k8s.yaml` image updated to `fa53e9f`.
- Deployment rolled out successfully.
@@ -0,0 +1,54 @@
# Deploy: Vault owner-only guard on Obsidian routes
**Date:** 2026-06-18
**Scope:** `hermes-mcp` only — backend change, full rebuild required
---
## Security Issue
Any user who (1) creates a free SquareMCP account and (2) connects the Living Brief GPT via OAuth could read and write the owner's Obsidian vault. Root cause: the vault is a single global filesystem path (`OBSIDIAN_VAULT_PATH`) with no per-customer isolation. The `requireCapability('obsidian')` middleware only checked whether the OAuth client had the capability — not whether the authenticated user was the vault owner.
## Fix
Added `requireOwner` middleware (`src/index.ts`) applied to all five obsidian routes after `requireCapability`. It allows:
- Global API key (`API_KEY`) — always the owner
- Customers with `role = 'admin'` — the first registered user
Regular customers (free/starter/growth plans with `role = 'user'`) get:
```json
{ "error": "vault_access_restricted", "message": "Obsidian vault access is restricted to the account owner." }
```
## Files Changed
| File | Change |
|------|--------|
| `src/index.ts` | Added `requireOwner` middleware function; applied to all 5 obsidian routes after `requireCapability('obsidian')` |
---
## Deploy Commands
```bash
git add src/index.ts
git commit -m "security: restrict obsidian vault routes to owner only"
git push origin main
docker build -f Dockerfile -t localhost:32000/hermes-mcp:$(git rev-parse --short HEAD) .
docker push localhost:32000/hermes-mcp:$(git rev-parse --short HEAD)
# Update image SHA in hermes-k8s.yaml, then:
kubectl apply -f hermes-k8s.yaml -n fetcherpay
kubectl rollout status deployment/hermes-mcp -n fetcherpay
```
---
## Verification
1. Log in as a non-admin SquareMCP account and connect Living Brief GPT via OAuth
2. Call `GET /api/obsidian/search?query=test` — should return `403 vault_access_restricted`
3. Log in as admin (owner) account — same call should work
## Verification result
@@ -0,0 +1,105 @@
# Deploy: Add WhatsApp to Communications Manager
**Date:** 2026-06-18
**Severity:** Feature gap — WhatsApp was silently missing from the Comm Manager platform list
---
## What was wrong
`CommPlatform` type was hardcoded to `linkedin | facebook | instagram | email`.
WhatsApp existed as a sending client but was never wired into the Communications
Manager draft/approve/publish flow. The ChatGPT GPT couldn't offer it as a
publishing option.
---
## Files changed
| File | Change |
|------|--------|
| `src/communications.ts` | Added `'whatsapp'` to `CommPlatform` type; `whatsapp_recipients` field to `BusinessProfile` + `ProfileRow`; INSERT/UPDATE/parse support; `whatsapp` to `VALID_PLATFORMS`; recipient validation; `approveAndPublish` WhatsApp case (fans out to all `whatsapp_recipients`) |
| `src/communications-chat.ts` | Added WhatsApp to `PLATFORM_CHAR_LIMITS` (160–300 chars) and `PLATFORM_OUTPUT_INSTRUCTIONS` (conversational, direct, no hashtags) |
| `src/db.ts` | `ALTER TABLE business_profiles ADD COLUMN IF NOT EXISTS whatsapp_recipients JSON NULL` — runs on startup, safe on existing DBs |
| `src/index.ts` | Pass `whatsapp_recipients` through `PUT /api/communications/profile` handler |
No other schema changes. No Redis changes. Migration is idempotent.
---
## Deploy commands
```bash
# Commit
git add src/communications.ts src/communications-chat.ts src/db.ts src/index.ts
git commit -m "feat: add whatsapp to Communications Manager platform list"
git push origin main
# Build and push
docker build -t localhost:32000/hermes-mcp:$(git rev-parse --short HEAD) .
docker push localhost:32000/hermes-mcp:$(git rev-parse --short HEAD)
# Update image SHA in hermes-k8s.yaml, then:
kubectl apply -f hermes-k8s.yaml -n fetcherpay
kubectl rollout status deployment/hermes-mcp -n fetcherpay
```
---
## Post-deploy: configure the profile
The user needs to set `whatsapp_recipients` on their business profile before
WhatsApp drafts can be approved and sent. Tell the Communications Manager GPT:
```
Update my business profile: enabled_platforms ["linkedin","facebook","instagram","whatsapp"],
whatsapp_recipients ["+1XXXXXXXXXX"]
```
(Replace with actual phone number in E.164 format.)
---
## Verification
1. `GET /api/communications/profile` — confirm `whatsapp` appears in `enabled_platforms` and `whatsapp_recipients` is set
2. Ask the Comm Manager GPT to generate content — WhatsApp draft should appear alongside the others
3. Approve the WhatsApp draft — the recipient should receive the message
4. `GET /api/communications/profile` on a fresh account — `whatsapp_recipients` should be `null` (column added cleanly)
## Verification result
## Verification result
- **Status:** ✅ Passed (after DB syntax fix)
- **Time:** 2026-06-18T00:22:00-04:00
- **Deployed image:** `localhost:32000/hermes-mcp:7596c00`
- **Tester:** smoke-test customer (`72446fa2-77f0-4a36-b530-8dbf2e8fe9d4`)
### Initial failure
The first deploy (`7d20e09`) crashed on startup because the raw `ALTER TABLE ... ADD COLUMN IF NOT EXISTS` syntax is not supported by the MySQL version in use. The pod logged:
```
ER_PARSE_ERROR: You have an error in your SQL syntax ... near 'IF NOT EXISTS whatsapp_recipients JSON NULL'
```
### Fix applied
Replaced the raw `ALTER TABLE` in `src/db.ts` with the existing `ensureColumn(db, 'business_profiles', 'whatsapp_recipients', 'JSON NULL')` helper, which queries `INFORMATION_SCHEMA.COLUMNS` before adding the column. Rebuilt and redeployed as `7596c00`.
### API verification
1. `GET /api/communications/profile` before update
- `whatsapp_recipients` field present and `null` (column added cleanly).
2. `PUT /api/communications/profile` with `enabled_platforms` including `whatsapp` and `whatsapp_recipients: ["+15551234567"]`
- Profile saved successfully; response included `whatsapp_recipients: ["+15551234567"]`.
3. `GET /api/communications/profile`
- Confirmed persisted `enabled_platforms: [..., "whatsapp"]` and `whatsapp_recipients`.
4. Validation check: `PUT` with `enabled_platforms: ["whatsapp"]` but no `whatsapp_recipients`
- Returned `400` with error `whatsapp_recipients is required when whatsapp platform is enabled`.
### Conclusion
WhatsApp is now wired into the Communications Manager profile, validation, and platform list. The idempotent schema helper safely added the `whatsapp_recipients` column.
@@ -0,0 +1,131 @@
# Signup Slack Alert + Palm Beach YR Publish Handoff
Date: 2026-07-23
Repo: `hermes-mcp`
Branch: `palmbeachyr-site-launch`
Latest pushed commit: `a7477a9` (`feat: alert Slack on new signups`)
Previous publish branch commit: `c508f01`
## What changed
Added Slack notifications for successful SquareMCP account signups.
Files changed:
- `src/notifications/slack.ts`
- Added `SignupAlertPayload`.
- Added `sendSignupAlert()`.
- Uses existing `SLACK_PILOT_WEBHOOK_URL`.
- Sends email, plan, role, source, customer ID, and IP.
- `src/index.ts`
- Imports `sendSignupAlert`.
- Calls it after successful `/api/auth/signup` response.
- Fire-and-forget; signup does not fail if Slack notification fails.
- `src/notifications/notifications.test.ts`
- Added focused tests for signup Slack notifications.
## Verification
Passed locally on Mac:
```bash
npx vitest run src/notifications/notifications.test.ts
# 1 test file passed, 25 tests passed
npm run build
# PASS
```
Palm Beach York Rite site smoke test also passed locally before publish attempt:
```bash
npm run test:palmbeachyr-site
# palmbeachyr site smoke test: PASS
```
## Publish state
Code is pushed to origin:
```bash
git push origin palmbeachyr-site-launch
# c508f01..a7477a9 palmbeachyr-site-launch -> palmbeachyr-site-launch
```
Local Mac working tree only had untracked Ruflo tool-cache directories after commit/push:
- `.agents/`
- `.claude-flow/`
## Blocker
Codex shell was on the Mac, not `art0`:
```text
hostname: macbookpro.lan
OS: Darwin
cwd: /Users/garfieldheron/abbeyroadtechWorkSpace/hermes-mcp
microk8s: not found
```
SSH from Mac-side Codex environment failed:
```text
ssh art0 hostname
# Could not resolve hostname art0
ssh garfield@104.190.60.129 hostname
# connect to host 104.190.60.129 port 22: Connection refused
```
Therefore the code is pushed but not deployed by Codex.
## Publish commands to run on art0 console
Run from the actual `art0` console/session:
```bash
cd /home/garfield/hermes-mcp
git fetch origin
git switch palmbeachyr-site-launch
git pull --ff-only origin palmbeachyr-site-launch
COMMIT=$(git rev-parse --short HEAD)
docker build \
-t localhost:32000/palmbeachyr-site:$COMMIT \
-f product/palmbeachyr-site/Dockerfile .
docker push localhost:32000/palmbeachyr-site:$COMMIT
microk8s kubectl set image deployment/palmbeachyr-site \
palmbeachyr-site=localhost:32000/palmbeachyr-site:$COMMIT \
-n fetcherpay
microk8s kubectl rollout status deployment/palmbeachyr-site -n fetcherpay
curl -fsSI https://palmbeachyr.org
curl -fsSI https://www.palmbeachyr.org
```
Expected image tag if branch is still at latest pushed commit:
```text
localhost:32000/palmbeachyr-site:a7477a9
```
## Important environment note
Signup Slack alerts depend on `SLACK_PILOT_WEBHOOK_URL` being set in the deployed Hermes environment. No new secret name was introduced.
## Related context
Earlier conflict in `src/index.ts` was resolved by keeping the upstream side:
- Keep `PUT` in CORS methods.
- Keep `/webhook/whatsapp` raw-body middleware before `express.json()`.
This was landed before the signup Slack alert commit.