Normalize agent instructions and workplan frontmatter (STATE-WP-0067)

- Align agent files with on-disk workplan prefixes (infer from workplan ids)
- Set workplan domain to registered domain_slug; add topic_slug where applicable
- Repair frontmatter delimiter formatting; migrate legacy task status literals
- Regenerate AGENTS.md, CLAUDE.md, and .claude/rules from State Hub templates
This commit is contained in:
tegwick 2026-06-22 23:16:28 +02:00
parent 48f40b8e24
commit 723f23d05d
12 changed files with 65 additions and 49 deletions

View file

@ -1,11 +1,11 @@
## First Session Protocol ## First Session Protocol
Triggered when `get_domain_summary("railiance")` shows **no workstreams**. Triggered when `get_domain_summary("financials")` shows **no workstreams**.
The project is registered but work has not yet been structured. The project is registered but work has not yet been structured.
**Step 1 — Read, don't write** **Step 1 — Read, don't write**
- `~/the-custodian/canon/projects/railiance/project_charter_v0.1.md` — purpose, scope - `~/the-custodian/canon/projects/financials/project_charter_v0.1.md` — purpose, scope
- `~/the-custodian/canon/projects/railiance/roadmap_v0.1.md` — planned phases - `~/the-custodian/canon/projects/financials/roadmap_v0.1.md` — planned phases
- Scan repo root: README, directory structure, existing code or docs - Scan repo root: README, directory structure, existing code or docs
**Step 2 — Survey in-progress work** **Step 2 — Survey in-progress work**
@ -17,7 +17,7 @@ roadmap phase. **Wait for approval before creating.**
**Step 4 — Create workplan file first, then DB record (ADR-001)** **Step 4 — Create workplan file first, then DB record (ADR-001)**
``` ```
workplans/railiance-hosts-WP-NNNN-<slug>.md ← write this first workplans/RAIL-HO-WP-NNNN-<slug>.md ← write this first
``` ```
Then register in the hub: Then register in the hub:
``` ```
@ -28,7 +28,7 @@ create_task(workstream_id="<id>", title="...", priority="high|medium|low")
**Step 5 — Record the setup** **Step 5 — Record the setup**
``` ```
add_progress_event( add_progress_event(
summary="First session: structured railiance into N workstreams, M tasks", summary="First session: structured financials into N workstreams, M tasks",
event_type="milestone", event_type="milestone",
topic_id="ca369340-a64e-442e-98f1-a4fa7dc74a38", topic_id="ca369340-a64e-442e-98f1-a4fa7dc74a38",
detail={"workstreams": [...], "tasks_created": M} detail={"workstreams": [...], "tasks_created": M}

View file

@ -1,6 +1,6 @@
## Repo boundary ## Repo boundary
This repo owns **railiance-hosts** only. It does not own: This repo owns **railiance-infra** only. It does not own:
<!-- TODO: List what belongs in adjacent repos, e.g.: <!-- TODO: List what belongs in adjacent repos, e.g.:
- SSH key management → railiance-infra/ - SSH key management → railiance-infra/

View file

@ -1,5 +1,5 @@
**Purpose:** Host inventory and node-level configuration for railiance infrastructure. Tracks server specs, network topology, and per-host service assignments. **Purpose:** OAS S1 Infrastructure Substrate — OS provisioning, Ansible roles, Goss spec, Terraform, inventory
**Domain:** railiance **Domain:** financials
**Repo slug:** railiance-hosts **Repo slug:** railiance-infra
**Topic ID:** ca369340-a64e-442e-98f1-a4fa7dc74a38 **Topic ID:** ca369340-a64e-442e-98f1-a4fa7dc74a38

View file

@ -1,6 +1,7 @@
## Session Protocol ## Session Protocol
State Hub: http://127.0.0.1:8000 Dev Hub (State Hub API): http://127.0.0.1:8000
MCP server name in `~/.claude.json`: `dev-hub`
**Step 1 — Orient** **Step 1 — Orient**
@ -10,7 +11,7 @@ cat .custodian-brief.md
``` ```
Then call the MCP tool for richer cross-domain context when MCP tools are exposed: Then call the MCP tool for richer cross-domain context when MCP tools are exposed:
``` ```
get_domain_summary("railiance") get_domain_summary("financials")
``` ```
If MCP tools are unavailable in the current agent session, use the REST API: If MCP tools are unavailable in the current agent session, use the REST API:
```bash ```bash
@ -21,14 +22,14 @@ If the hub is offline: `cd ~/state-hub && make api`
**Step 2 — Check inbox** **Step 2 — Check inbox**
With MCP tools: With MCP tools:
``` ```
get_messages(to_agent="railiance-hosts", unread_only=True) get_messages(to_agent="railiance-infra", unread_only=True)
``` ```
Mark read with `mark_message_read(message_id)`. Reply or act on coordination Mark read with `mark_message_read(message_id)`. Reply or act on coordination
requests before proceeding. requests before proceeding.
Without MCP tools: Without MCP tools:
```bash ```bash
curl -s "http://127.0.0.1:8000/messages/?to_agent=railiance-hosts&unread_only=true" \ curl -s "http://127.0.0.1:8000/messages/?to_agent=railiance-infra&unread_only=true" \
| python3 -m json.tool | python3 -m json.tool
curl -s -X PATCH "http://127.0.0.1:8000/messages/<id>/read" \ curl -s -X PATCH "http://127.0.0.1:8000/messages/<id>/read" \
-H "Content-Type: application/json" -d '{}' -H "Content-Type: application/json" -d '{}'
@ -39,12 +40,12 @@ curl -s -X PATCH "http://127.0.0.1:8000/messages/<id>/read" \
ls workplans/ ls workplans/
``` ```
For each file with `status: ready`, `active`, or `blocked`, note pending For each file with `status: ready`, `active`, or `blocked`, note pending
`todo`/`in_progress` tasks. `wait`/`todo`/`progress` tasks.
**Step 4 — Present brief** **Step 4 — Present brief**
1. **Active workstreams** for `railiance` — title, task counts, blocking decisions 1. **Active workstreams** for `financials` — title, task counts, blocking decisions
2. **Pending tasks** from `workplans/` + any `[repo:railiance-hosts]` hub tasks 2. **Pending tasks** from `workplans/` + any `[repo:railiance-infra]` hub tasks
3. **Goal guidance** — if `goal_guidance` in summary: 3. **Goal guidance** — if `goal_guidance` in summary:
- `needs_workplan`: surface as top action — *"Repo goal '{title}' has no workplan yet"* - `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 - `alignment_warnings`: flag if active work is not aligned with current goal
@ -72,12 +73,12 @@ curl -s -X POST http://127.0.0.1:8000/progress/ \
If workplan files were modified, ensure the local copy is up to date first: If workplan files were modified, ensure the local copy is up to date first:
```bash ```bash
git -C <repo_path> pull --ff-only git -C <repo_path> pull --ff-only
cd ~/state-hub && make fix-consistency REPO=railiance-hosts cd ~/state-hub && make fix-consistency REPO=railiance-infra
``` ```
For repos where implementation runs on a remote machine (e.g. CoulombCore), For repos where implementation runs on a remote machine (e.g. CoulombCore),
use the combined target which pulls before fixing: use the combined target which pulls before fixing:
```bash ```bash
cd ~/state-hub && make fix-consistency-remote REPO=railiance-hosts cd ~/state-hub && make fix-consistency-remote REPO=railiance-infra
``` ```
**C-15** (DB task ahead of file) is normal in multi-machine workflows — writeback **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 will sync the file to match DB. **C-16** (repo behind remote) blocks all writes

View file

@ -1,7 +1,7 @@
## Workplan Convention (ADR-001) ## Workplan Convention (ADR-001)
File location: `workplans/railiance-hosts-WP-NNNN-<slug>.md` File location: `workplans/RAIL-HO-WP-NNNN-<slug>.md`
ID prefix: `RAILIANCE-WP` ID prefix: `RAIL-HO-WP-`
Work items originate as files in this repo **before** being registered in the hub. Work items originate as files in this repo **before** being registered in the hub.
@ -12,7 +12,7 @@ repo state, and `finished` when implementation is complete. `stalled` and
`needs_review` are derived health labels, not stored statuses. `needs_review` are derived health labels, not stored statuses.
Closed workplans may be moved to `workplans/archived/` with a completion-date Closed workplans may be moved to `workplans/archived/` with a completion-date
prefix: `YYMMDD-railiance-hosts-WP-NNNN-<slug>.md`. The frontmatter id remains prefix: `YYMMDD-RAIL-HO-WP-NNNN-<slug>.md`. The frontmatter id remains
unchanged; the prefix is only for quick visual reference. unchanged; the prefix is only for quick visual reference.
Small opportunistic tasks discovered during another session use **Ad Hoc Tasks**: Small opportunistic tasks discovered during another session use **Ad Hoc Tasks**:
@ -21,8 +21,20 @@ Small opportunistic tasks discovered during another session use **Ad Hoc Tasks**
directly. Promote anything requiring analysis, design, approval, dependencies, or directly. Promote anything requiring analysis, design, approval, dependencies, or
multiple planned phases into a normal workplan. multiple planned phases into a normal workplan.
Ecosystem todos from other agents arrive as `[repo:railiance-hosts]` hub tasks — Ecosystem todos from other agents arrive as `[repo:railiance-infra]` hub tasks —
visible at session start. Pick one up by creating the workplan file, then registering visible at session start. Pick one up by creating the workplan file, then registering
the workstream. the workstream.
Task blocks use this shape:
```task
id: RAIL-HO-WP-NNNN-T01
status: wait | todo | progress | done | cancel
priority: high | medium | low
state_hub_task_id: "<uuid>" # written by fix-consistency — do not edit
```
Status progression is `todo``progress``done`; use `wait` for waiting or
blocked work and `cancel` for stopped work.
<!-- Ralph Loop rules and HEUREKA sequence: ~/.claude/CLAUDE.md — do not duplicate here --> <!-- Ralph Loop rules and HEUREKA sequence: ~/.claude/CLAUDE.md — do not duplicate here -->

View file

@ -1,13 +1,13 @@
# railiance-hosts — Agent Instructions # railiance-infra — Agent Instructions
## Repo Identity ## Repo Identity
**Purpose:** Host inventory and node-level configuration for railiance infrastructure. Tracks server specs, network topology, and per-host service assignments. **Purpose:** OAS S1 Infrastructure Substrate — OS provisioning, Ansible roles, Goss spec, Terraform, inventory
**Domain:** railiance **Domain:** financials
**Repo slug:** railiance-hosts **Repo slug:** railiance-infra
**Topic ID:** `ca369340-a64e-442e-98f1-a4fa7dc74a38` **Topic ID:** `ca369340-a64e-442e-98f1-a4fa7dc74a38`
**Workplan prefix:** `RAILIANCE-WP-` **Workplan prefix:** `RAIL-HO-WP-`
--- ---
@ -32,7 +32,7 @@ curl -s "http://127.0.0.1:8000/workstreams/?topic_id=ca369340-a64e-442e-98f1-a4f
| python3 -m json.tool | python3 -m json.tool
# Check inbox # Check inbox
curl -s "http://127.0.0.1:8000/messages/?to_agent=railiance-hosts&unread_only=true" \ curl -s "http://127.0.0.1:8000/messages/?to_agent=railiance-infra&unread_only=true" \
| python3 -m json.tool | python3 -m json.tool
``` ```
@ -63,8 +63,8 @@ Omit `workstream_id` / `task_id` when not applicable.
```bash ```bash
curl -s -X PATCH "http://127.0.0.1:8000/tasks/<task_id>" \ curl -s -X PATCH "http://127.0.0.1:8000/tasks/<task_id>" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d '{"status": "in_progress"}' -d '{"status": "progress"}'
# values: todo | in_progress | done | blocked # values: wait | todo | progress | done | cancel
``` ```
### Flag a task for human review ### Flag a task for human review
@ -81,9 +81,9 @@ curl -s -X PATCH "http://127.0.0.1:8000/tasks/<task_id>" \
**Start:** **Start:**
1. `cat .custodian-brief.md` — domain goal and open workstreams (offline-safe) 1. `cat .custodian-brief.md` — domain goal and open workstreams (offline-safe)
2. Check inbox: `GET /messages/?to_agent=railiance-hosts&unread_only=true`; mark read 2. Check inbox: `GET /messages/?to_agent=railiance-infra&unread_only=true`; mark read
3. Scan workplans: `ls workplans/` — note `status: ready`, `active`, or `blocked` files and open tasks 3. Scan workplans: `ls workplans/` — note `status: ready`, `active`, or `blocked` files and open tasks
4. Check blocked tasks: `GET /tasks/?needs_human=true` 4. Check human-needed tasks: `GET /tasks/?needs_human=true`
**During work:** **During work:**
- Update task statuses in workplan files as tasks progress - Update task statuses in workplan files as tasks progress
@ -95,7 +95,7 @@ curl -s -X PATCH "http://127.0.0.1:8000/tasks/<task_id>" \
3. Note for the custodian operator: after workplan file changes, run from 3. Note for the custodian operator: after workplan file changes, run from
`~/state-hub`: `~/state-hub`:
```bash ```bash
make fix-consistency REPO=railiance-hosts make fix-consistency REPO=railiance-infra
``` ```
This syncs task status from files into the hub DB. This syncs task status from files into the hub DB.
@ -151,6 +151,11 @@ every repo's agent instructions because it is high-frequency, high-risk, and eas
get wrong. get wrong.
**Canon:** `~/ops-warden/wiki/CredentialRouting.md` · catalog `~/ops-warden/registry/routing/catalog.yaml` **Canon:** `~/ops-warden/wiki/CredentialRouting.md` · catalog `~/ops-warden/registry/routing/catalog.yaml`
<!-- REPO-AGENTS-EXTENSIONS -->
<!-- Append repo-specific agent instructions below this marker.
The state-hub template sync preserves content after this line. -->
--- ---
## Workplan Convention (ADR-001) ## Workplan Convention (ADR-001)
@ -176,8 +181,8 @@ anything needing analysis, design, approval, dependencies, or multiple phases.
id: RAILIANCE-WP-NNNN id: RAILIANCE-WP-NNNN
type: workplan type: workplan
title: "..." title: "..."
domain: railiance domain: financials
repo: railiance-hosts repo: railiance-infra
status: proposed | ready | active | blocked | backlog | finished | archived status: proposed | ready | active | blocked | backlog | finished | archived
owner: codex owner: codex
topic_slug: ... topic_slug: ...
@ -198,7 +203,7 @@ derived health labels, not frontmatter statuses.
` ` `task ` ` `task
id: RAILIANCE-WP-NNNN-T01 id: RAILIANCE-WP-NNNN-T01
status: todo | in_progress | done | blocked status: wait | todo | progress | done | cancel
priority: high | medium | low priority: high | medium | low
state_hub_task_id: "<uuid>" # written by fix-consistency — do not edit state_hub_task_id: "<uuid>" # written by fix-consistency — do not edit
` ` ` ` ` `
@ -206,9 +211,9 @@ state_hub_task_id: "<uuid>" # written by fix-consistency — do not edit
Task description text. Task description text.
``` ```
Status progression: `todo``in_progress` → `done` (or `blocked`) Status progression: `todo``progress` → `done`; use `wait` for waiting/blocked work and `cancel` for stopped work.
To create a new workplan: To create a new workplan:
1. Write the file following the format above 1. Write the file following the format above
2. Notify the custodian operator to run `make fix-consistency REPO=railiance-hosts` 2. Notify the custodian operator to run `make fix-consistency REPO=railiance-infra`
(or send a message to the hub agent via `POST /messages/`) (or send a message to the hub agent via `POST /messages/`)

View file

@ -1,4 +1,4 @@
# railiance-hosts — Claude Code Instructions # railiance-infra — Claude Code Instructions
@SCOPE.md @SCOPE.md
@.claude/rules/repo-identity.md @.claude/rules/repo-identity.md

View file

@ -2,7 +2,7 @@
id: RAIL-HO-WP-0001 id: RAIL-HO-WP-0001
type: workplan type: workplan
title: "Secure Single-Server Bootstrap at HostEurope" title: "Secure Single-Server Bootstrap at HostEurope"
domain: railiance domain: financials
repo: railiance-infra repo: railiance-infra
status: completed status: completed
owner: railiance owner: railiance
@ -18,8 +18,7 @@ handoff_note: >
done in railiance-bootstrap (harden.yml, bootstrap.yml) is superseded by done in railiance-bootstrap (harden.yml, bootstrap.yml) is superseded by
the roles/base and roles/sops_agent structure in this repo. The HostEurope the roles/base and roles/sops_agent structure in this repo. The HostEurope
server IP is 92.205.62.239 (hosts.ini is gitignored — recreate from server IP is 92.205.62.239 (hosts.ini is gitignored — recreate from
inventory/servers.yaml when working on the host). inventory/servers.yaml when working on the host).---
---
# Secure Single-Server Bootstrap at HostEurope # Secure Single-Server Bootstrap at HostEurope
@ -56,7 +55,6 @@ ssh -R 8000:127.0.0.1:8000 <user>@92.205.62.239
Then Claude on the remote host can reach `http://127.0.0.1:8000` as normal. Then Claude on the remote host can reach `http://127.0.0.1:8000` as normal.
See also: the tunnel setup note in `CLAUDE.md`. See also: the tunnel setup note in `CLAUDE.md`.
--- ---
## Tasks ## Tasks

View file

@ -2,7 +2,7 @@
id: RAIL-HO-WP-0002 id: RAIL-HO-WP-0002
type: workplan type: workplan
title: "Server Specification and Automated Test Suite" title: "Server Specification and Automated Test Suite"
domain: railiance domain: financials
repo: railiance-infra repo: railiance-infra
status: completed status: completed
owner: railiance owner: railiance

View file

@ -2,7 +2,7 @@
id: RAIL-HO-WP-0003 id: RAIL-HO-WP-0003
type: workplan type: workplan
title: "Railiance 5-Repo Stack Restructure" title: "Railiance 5-Repo Stack Restructure"
domain: railiance domain: financials
repo: railiance-infra repo: railiance-infra
status: completed status: completed
owner: railiance owner: railiance

View file

@ -2,7 +2,7 @@
id: RAIL-HO-WP-0004 id: RAIL-HO-WP-0004
type: workplan type: workplan
title: "Railiance Production Readiness — Automated, Reproducible Stack" title: "Railiance Production Readiness — Automated, Reproducible Stack"
domain: railiance domain: financials
repo: railiance-infra repo: railiance-infra
status: finished status: finished
owner: worsch owner: worsch
@ -437,7 +437,7 @@ context.
```task ```task
id: RAIL-HO-WP-0004-T09 id: RAIL-HO-WP-0004-T09
status: cancelled status: cancel
priority: medium priority: medium
state_hub_task_id: "d2afe78a-eb51-4ce9-b332-f181323d2370" state_hub_task_id: "d2afe78a-eb51-4ce9-b332-f181323d2370"
needs_human: false needs_human: false

View file

@ -2,7 +2,7 @@
id: RAIL-HO-WP-0005 id: RAIL-HO-WP-0005
type: workplan type: workplan
title: "Forgejo Production Migration on railiance01" title: "Forgejo Production Migration on railiance01"
domain: railiance domain: financials
repo: railiance-infra repo: railiance-infra
status: active status: active
owner: railiance owner: railiance
@ -115,7 +115,7 @@ operator / agents / developers
```task ```task
id: RAIL-HO-WP-0005-T01 id: RAIL-HO-WP-0005-T01
status: in_progress status: progress
priority: high priority: high
state_hub_task_id: "cf59d171-5629-45c9-9d44-8d6499827ffc" state_hub_task_id: "cf59d171-5629-45c9-9d44-8d6499827ffc"
``` ```