Files
can-you-assist/.claude/rules/session-protocol.md
tegwick f4e965cc04 Add Claude Code support, credential routing polish, and CYA-WP-0006
Mirror sibling-repo Claude setup (CLAUDE.md + .claude/rules/*), align
AGENTS.md with fleet credential-routing template, and close housekeeping
gaps (WP-0002-T05 done, WP-0005 status note). Draft CYA-WP-0006 for
Profile 1 production hardening as the proposed next slice.
2026-06-19 20:33:13 +02:00

3.5 KiB

Session Protocol

State Hub: http://127.0.0.1:8000 (remote tunnel: http://127.0.0.1:18000)

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("capabilities")

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

curl -s "http://127.0.0.1:8000/workstreams/?topic_id=64418556-3206-457a-ba29-6884b5b12cf3&status=active" \
  | 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="can-you-assist", 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=can-you-assist&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 todo/in_progress tasks.

Step 4 — Present brief

  1. Active workstreams for capabilities — title, task counts, blocking decisions
  2. Pending tasks from workplans/ + any [repo:can-you-assist] 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 workstreams: follow First Session Protocol (first-session.md).

During work:

  • Keep changes small and inspectable.
  • Treat command execution safety as product behavior: explain destructive commands and require explicit confirmation before suggesting execution.
  • Do not commit secrets, API keys, local transcripts, private notes, or hidden memory contents.
  • Before requesting API keys, SSH access, login tokens, or database passwords, run warden route find / warden route show per credential-routing.md.
  • record_decision() · add_progress_event() · resolve_decision()

State Hub is a read model. Bootstrap tools (create_workstream, create_task) are First Session Protocol only. Work structure belongs in repo files (ADR-001).

Session close: With MCP tools:

add_progress_event(summary="...", topic_id="64418556-3206-457a-ba29-6884b5b12cf3", workstream_id="<uuid>")

Without MCP tools:

curl -s -X POST http://127.0.0.1:8000/progress/ \
  -H "Content-Type: application/json" \
  -d '{"topic_id":"64418556-3206-457a-ba29-6884b5b12cf3","workstream_id":"<uuid>","event_type":"note","summary":"what changed","author":"codex"}'

If workplan files were modified, ensure the local copy is up to date first:

git -C <repo_path> pull --ff-only
cd ~/state-hub && make fix-consistency REPO=can-you-assist

For repos where implementation runs on a remote machine (e.g. CoulombCore), use the combined target which pulls before fixing:

cd ~/state-hub && make fix-consistency-remote REPO=can-you-assist

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.