feat: retire PROJECT_STATE.md — add real-time coordination API protocol

- CLAUDE.md: triggers now query coordination API (/api/coord/status,
  /api/coord/components, /api/coord/messages) instead of reading
  PROJECT_STATE.md files
- COORDINATION_PROTOCOL.md: new doc covering locks, component states,
  workflows, work items, and inter-session messages via ClaudeTools API
- guru-rmm/PROJECT_STATE.md: marked ARCHIVED, redirects to
  COORDINATION_PROTOCOL.md for live state

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-12 08:37:13 -07:00
parent 7a733c5d54
commit fc8cc5f125
3 changed files with 214 additions and 19 deletions

View File

@@ -111,14 +111,14 @@ If user mentions **GuruRMM**, **Dataforth**, **tunnel**, **VASLOG**, **AD2**, **
- GuruRMM keywords → `projects/msp-tools/guru-rmm/CONTEXT.md`
- Dataforth keywords → `projects/dataforth-dos/CONTEXT.md`
- General → `CONTEXT.md` (root)
2. If `PROJECT_STATE.md` exists alongside CONTEXT.md, read it **and** `.claude/PROJECT_STATE_PROTOCOL.md`.
2. Query the coordination API for current state: `GET http://172.16.3.30:8001/api/coord/status` (no auth needed for status) and `GET /api/coord/components?project_key=<key>`.
3. THEN respond with full context.
### Trigger 2: Continuation/Resume Words
If user says "continue", "let's work on", "back to", "resume", "finish":
1. Detect project from message, read project CONTEXT.md.
2. If PROJECT_STATE.md exists, read it and `.claude/PROJECT_STATE_PROTOCOL.md`.
3. Check "Current State" and "Recent Session Logs" sections, then proceed.
2. Query coordination API: `GET /api/coord/status` for active locks and in-progress workflows; `GET /api/coord/messages/unread-count?session_id=<this-session>` for pending messages.
3. Check for unread messages and display them before proceeding.
### Trigger 3: Infrastructure/Deployment Questions
If user asks about **servers**, **databases**, **credentials**, **deploy**, **IP**, **password**:
@@ -163,23 +163,25 @@ Never ask "What did we do last time?" or "What's the server IP?" — read the CO
- **Frontend Design:** Auto-invoke `/frontend-design` skill after ANY UI change (HTML/CSS/JSX/styling)
- **Sequential Thinking:** Use for genuine complexity — rejection loops, 3+ critical issues, architectural decisions
- **Task Management:** Complex work (>3 steps) → TaskCreate. Persist to `.claude/active-tasks.json`.
- **Coordination:** Before touching shared resources (server code, migrations, build pipeline) → claim a lock via `POST /api/coord/locks`. Release on completion via `DELETE /api/coord/locks/{id}`. See `.claude/COORDINATION_PROTOCOL.md`.
### Cross-User Messages (MANDATORY)
### Cross-Session Messages (MANDATORY)
After every `/sync` — and whenever reading any session log from another user — scan for sections named `## Note for <user>` or `## Message for <user>`. If found:
At session start and after every `/sync`, check for unread messages:
```
GET http://172.16.3.30:8001/api/coord/messages?to_session=<this-session>&unread_only=true
```
If unread messages exist, display each one prominently before any other work:
```
============================================================
MESSAGE FROM <from_session> — <subject>
============================================================
<body>
============================================================
```
Mark as read via `PUT /api/coord/messages/{id}/read` after displaying.
1. Display the full note content **prominently at the top of the response**, before sync status or anything else, formatted as:
```
============================================================
MESSAGE FROM <AUTHOR> (<date>)
============================================================
<full note content>
============================================================
```
2. Explicitly address each action item or question in the note before moving on.
3. Do not bury these in the sync summary or skip them because other work is in progress.
This applies to ALL session logs pulled during sync, not just the most recent one.
Also scan session logs pulled during `/sync` for legacy `## Note for <user>` sections (transitional — older sessions still use markdown).
---
@@ -188,7 +190,8 @@ This applies to ALL session logs pulled during sync, not just the most recent on
When user references previous work, use `/context` command. Never ask for info in:
- `credentials.md` — Infrastructure reference (being migrated to SOPS vault)
- `session-logs/` — Daily work logs (also in `projects/*/session-logs/` and `clients/*/session-logs/`)
- `projects/*/PROJECT_STATE.md` and `clients/*/PROJECT_STATE.md` — per-project state (active locks, current state, recent changes). Loaded automatically per Trigger 2 above; protocol at `.claude/PROJECT_STATE_PROTOCOL.md`
- **Coordination API** — current locks, component states, workflows, messages: `GET http://172.16.3.30:8001/api/coord/status`
- `projects/*/PROJECT_STATE.md` — ARCHIVED. Read-only historical reference. Do not edit. Use coordination API for live state.
### Credential Access (SOPS Vault)