tenant-engine/.claude/rules/session-protocol.md
tegwick 897c62caef De-template agent instructions from the seed repo
The .claude/rules/ files still carried the seed placeholders. The
practical failure: session-protocol.md told agents to check the inbox
with to_agent="repo-seed", which returns [] regardless. Three unread
messages from gate-house and risk-nexus sat unread for days behind that
wrong query until fix-consistency's C-28 surfaced them. Replaced
repo-seed with tenant-engine throughout, and REPO-WP- with this repo's
actual TEN-WP- prefix.

Also records that no MCP server is registered (dev-hub was deregistered
2026-09-04), so the REST paths are the default rather than the fallback,
and fixes the root CLAUDE.md heading, still "Repo Seed".

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HHwvAEQfmzLHtrFGhXtVjq

Assistant: claude-code
Assistant-Model: opus
Assistant-Process: 823014@bnt-lap001
Assistant-Session: 2a0786b1-efea-4c38-959b-6e86a493f259
2026-09-07 00:22:38 +02:00

3.6 KiB

Session Protocol

Dev Hub (State Hub API): http://127.0.0.1:8000 Agent name on the hub (inbox to_agent): tenant-engine

No MCP server is registered by default (dev-hub was deregistered 2026-09-04). Use the REST paths below; the MCP variants apply only if a server has been registered and is actually running.

Step 1 — Orient

Read the offline-safe brief first — it works without a live hub connection:

cat .custodian-brief.md

Then call the MCP tool for richer cross-domain context when MCP tools are exposed:

get_domain_summary("infotech")

If MCP tools are unavailable in the current agent session, use the REST API:

curl -s "http://127.0.0.1:8000/state/summary" | python3 -m json.tool

If the hub is offline: cd ~/state-hub && make api

Step 2 — Check inbox With MCP tools:

get_messages(to_agent="tenant-engine", unread_only=True)

Mark read with mark_message_read(message_id). Reply or act on coordination requests before proceeding.

Without MCP tools:

curl -s "http://127.0.0.1:8000/messages/?to_agent=tenant-engine&unread_only=true" \
  | python3 -m json.tool
curl -s -X PATCH "http://127.0.0.1:8000/messages/<id>/read" \
  -H "Content-Type: application/json" -d '{}'

Step 3 — Scan workplans

ls workplans/

For each file with status: ready, active, or blocked, note pending wait/todo/progress tasks.

Step 4 — Present brief

  1. Active workplans for infotech — title, task counts, blocking decisions
  2. Pending tasks from workplans/ + any [repo:tenant-engine] hub tasks
  3. Goal guidance — if goal_guidance in summary:
    • needs_workplan: surface as top action — "Repo goal '{title}' has no workplan yet"
    • alignment_warnings: flag if active work is not aligned with current goal
  4. Suggested next action — highest-priority open item
  5. SBOM status — flag if last_sbom_at is unset for this repo

If no workplans: follow First Session Protocol (first-session.md).

During work: record_decision() · add_progress_event() · resolve_decision()

State Hub is a read model. Never register workplans or tasks by hand (create_workplan, create_task) — write the workplan file in workplans/ and run fix-consistency; C-06 registers the workplan and tasks and writes IDs back into the file. Manual registration creates duplicates when fix-consistency runs. Work structure belongs in repo files (ADR-001).

Legacy: create_workstream and /workstreams/ remain as metered aliases — see workplan-convention.md (compatibility footnote).

Session close: With MCP tools:

add_progress_event(summary="...", topic_id="cee7bedf-2b48-46ef-8601-006474f2ad7a", workplan_id="<uuid>")

Without MCP tools:

curl -s -X POST http://127.0.0.1:8000/progress/ \
  -H "Content-Type: application/json" \
  -d '{"topic_id":"cee7bedf-2b48-46ef-8601-006474f2ad7a","workplan_id":"<uuid>","event_type":"note","summary":"what changed","author":"codex"}'

If workplan files were modified, ensure the local copy is up to date first, then sync from the repo checkout:

git pull --ff-only
statehub fix-consistency

For repos where implementation runs on a remote machine (e.g. CoulombCore), use the pull-before-fix mode from any shell with the State Hub CLI:

statehub fix-consistency --repo tenant-engine --remote

C-15 (DB task ahead of file) is normal in multi-machine workflows — writeback will sync the file to match DB. C-16 (repo behind remote) blocks all writes until you pull — intentional to prevent clobbering remote progress.