From 2ff9263f9c89b5d69a23c1541bb33eb6e9f6c7cf Mon Sep 17 00:00:00 2001 From: tegwick Date: Mon, 22 Jun 2026 23:16:27 +0200 Subject: [PATCH] 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 --- .claude/rules/first-session.md | 14 +++++------ .claude/rules/repo-identity.md | 4 ++-- .claude/rules/session-protocol.md | 13 ++++++----- .claude/rules/workplan-convention.md | 18 ++++++++++++--- AGENTS.md | 23 +++++++++++-------- ...P-0006-activity-core-always-on-endpoint.md | 2 +- ...onnect-WP-0001-foundation-gaaf-baseline.md | 2 +- .../llm-connect-WP-0002-core-extensions.md | 2 +- ...m-connect-WP-0003-functional-extensions.md | 2 +- ...t-WP-0004-adaptive-cost-quality-routing.md | 5 ++-- ...cost-model-and-problem-class-estimators.md | 2 +- 11 files changed, 53 insertions(+), 34 deletions(-) diff --git a/.claude/rules/first-session.md b/.claude/rules/first-session.md index c9089db..000e8ab 100644 --- a/.claude/rules/first-session.md +++ b/.claude/rules/first-session.md @@ -1,11 +1,11 @@ ## First Session Protocol -Triggered when `get_domain_summary("custodian")` shows **no workstreams**. +Triggered when `get_domain_summary("agents")` shows **no workstreams**. The project is registered but work has not yet been structured. **Step 1 — Read, don't write** -- `~/the-custodian/canon/projects/custodian/project_charter_v0.1.md` — purpose, scope -- `~/the-custodian/canon/projects/custodian/roadmap_v0.1.md` — planned phases +- `~/the-custodian/canon/projects/agents/project_charter_v0.1.md` — purpose, scope +- `~/the-custodian/canon/projects/agents/roadmap_v0.1.md` — planned phases - Scan repo root: README, directory structure, existing code or docs **Step 2 — Survey in-progress work** @@ -17,20 +17,20 @@ roadmap phase. **Wait for approval before creating.** **Step 4 — Create workplan file first, then DB record (ADR-001)** ``` -workplans/llm-connect-WP-NNNN-.md ← write this first +workplans/LLM-WP-NNNN-.md ← write this first ``` Then register in the hub: ``` -create_workstream(topic_id="cee7bedf-2b48-46ef-8601-006474f2ad7a", title="...", owner="...", description="...") +create_workstream(topic_id="64418556-3206-457a-ba29-6884b5b12cf3", title="...", owner="...", description="...") create_task(workstream_id="", title="...", priority="high|medium|low") ``` **Step 5 — Record the setup** ``` add_progress_event( - summary="First session: structured custodian into N workstreams, M tasks", + summary="First session: structured agents into N workstreams, M tasks", event_type="milestone", - topic_id="cee7bedf-2b48-46ef-8601-006474f2ad7a", + topic_id="64418556-3206-457a-ba29-6884b5b12cf3", detail={"workstreams": [...], "tasks_created": M} ) ``` diff --git a/.claude/rules/repo-identity.md b/.claude/rules/repo-identity.md index 10470bd..8fb2f85 100644 --- a/.claude/rules/repo-identity.md +++ b/.claude/rules/repo-identity.md @@ -1,5 +1,5 @@ **Purpose:** Multi-provider LLM client library — unified adapter interface for OpenAI, Claude, Gemini, OpenRouter with embedding support, token estimation, and TOML-based config. -**Domain:** custodian +**Domain:** agents **Repo slug:** llm-connect -**Topic ID:** cee7bedf-2b48-46ef-8601-006474f2ad7a +**Topic ID:** 64418556-3206-457a-ba29-6884b5b12cf3 diff --git a/.claude/rules/session-protocol.md b/.claude/rules/session-protocol.md index 59afff5..09b6753 100644 --- a/.claude/rules/session-protocol.md +++ b/.claude/rules/session-protocol.md @@ -1,6 +1,7 @@ ## 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** @@ -10,7 +11,7 @@ cat .custodian-brief.md ``` Then call the MCP tool for richer cross-domain context when MCP tools are exposed: ``` -get_domain_summary("custodian") +get_domain_summary("agents") ``` If MCP tools are unavailable in the current agent session, use the REST API: ```bash @@ -39,11 +40,11 @@ curl -s -X PATCH "http://127.0.0.1:8000/messages//read" \ ls workplans/ ``` For each file with `status: ready`, `active`, or `blocked`, note pending -`todo`/`in_progress` tasks. +`wait`/`todo`/`progress` tasks. **Step 4 — Present brief** -1. **Active workstreams** for `custodian` — title, task counts, blocking decisions +1. **Active workstreams** for `agents` — title, task counts, blocking decisions 2. **Pending tasks** from `workplans/` + any `[repo:llm-connect]` hub tasks 3. **Goal guidance** — if `goal_guidance` in summary: - `needs_workplan`: surface as top action — *"Repo goal '{title}' has no workplan yet"* @@ -61,13 +62,13 @@ If no workstreams: follow First Session Protocol (`first-session.md`). **Session close:** With MCP tools: ``` -add_progress_event(summary="...", topic_id="cee7bedf-2b48-46ef-8601-006474f2ad7a", workstream_id="") +add_progress_event(summary="...", topic_id="64418556-3206-457a-ba29-6884b5b12cf3", workstream_id="") ``` Without MCP tools: ```bash curl -s -X POST http://127.0.0.1:8000/progress/ \ -H "Content-Type: application/json" \ - -d '{"topic_id":"cee7bedf-2b48-46ef-8601-006474f2ad7a","workstream_id":"","event_type":"note","summary":"what changed","author":"codex"}' + -d '{"topic_id":"64418556-3206-457a-ba29-6884b5b12cf3","workstream_id":"","event_type":"note","summary":"what changed","author":"codex"}' ``` If workplan files were modified, ensure the local copy is up to date first: ```bash diff --git a/.claude/rules/workplan-convention.md b/.claude/rules/workplan-convention.md index 8ad0f27..5181b5e 100644 --- a/.claude/rules/workplan-convention.md +++ b/.claude/rules/workplan-convention.md @@ -1,7 +1,7 @@ ## Workplan Convention (ADR-001) -File location: `workplans/llm-connect-WP-NNNN-.md` -ID prefix: `LLM-WP` +File location: `workplans/LLM-WP-NNNN-.md` +ID prefix: `LLM-WP-` 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. Closed workplans may be moved to `workplans/archived/` with a completion-date -prefix: `YYMMDD-llm-connect-WP-NNNN-.md`. The frontmatter id remains +prefix: `YYMMDD-LLM-WP-NNNN-.md`. The frontmatter id remains unchanged; the prefix is only for quick visual reference. Small opportunistic tasks discovered during another session use **Ad Hoc Tasks**: @@ -25,4 +25,16 @@ Ecosystem todos from other agents arrive as `[repo:llm-connect]` hub tasks — visible at session start. Pick one up by creating the workplan file, then registering the workstream. +Task blocks use this shape: + +```task +id: LLM-WP-NNNN-T01 +status: wait | todo | progress | done | cancel +priority: high | medium | low +state_hub_task_id: "" # 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. + diff --git a/AGENTS.md b/AGENTS.md index d5a20be..92bc150 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -4,9 +4,9 @@ **Purpose:** Multi-provider LLM client library — unified adapter interface for OpenAI, Claude, Gemini, OpenRouter with embedding support, token estimation, and TOML-based config. -**Domain:** custodian +**Domain:** agents **Repo slug:** llm-connect -**Topic ID:** `cee7bedf-2b48-46ef-8601-006474f2ad7a` +**Topic ID:** `64418556-3206-457a-ba29-6884b5b12cf3` **Workplan prefix:** `LLM-WP-` --- @@ -28,7 +28,7 @@ there is no MCP server for Codex agents. cat .custodian-brief.md # Active workstreams for this domain -curl -s "http://127.0.0.1:8000/workstreams/?topic_id=cee7bedf-2b48-46ef-8601-006474f2ad7a&status=active" \ +curl -s "http://127.0.0.1:8000/workstreams/?topic_id=64418556-3206-457a-ba29-6884b5b12cf3&status=active" \ | python3 -m json.tool # Check inbox @@ -63,8 +63,8 @@ Omit `workstream_id` / `task_id` when not applicable. ```bash curl -s -X PATCH "http://127.0.0.1:8000/tasks/" \ -H "Content-Type: application/json" \ - -d '{"status": "in_progress"}' -# values: todo | in_progress | done | blocked + -d '{"status": "progress"}' +# values: wait | todo | progress | done | cancel ``` ### Flag a task for human review @@ -83,7 +83,7 @@ curl -s -X PATCH "http://127.0.0.1:8000/tasks/" \ 1. `cat .custodian-brief.md` — domain goal and open workstreams (offline-safe) 2. Check inbox: `GET /messages/?to_agent=llm-connect&unread_only=true`; mark read 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:** - Update task statuses in workplan files as tasks progress @@ -151,6 +151,11 @@ every repo's agent instructions because it is high-frequency, high-risk, and eas get wrong. **Canon:** `~/ops-warden/wiki/CredentialRouting.md` · catalog `~/ops-warden/registry/routing/catalog.yaml` + + + + --- ## Workplan Convention (ADR-001) @@ -176,7 +181,7 @@ anything needing analysis, design, approval, dependencies, or multiple phases. id: LLM-WP-NNNN type: workplan title: "..." -domain: custodian +domain: agents repo: llm-connect status: proposed | ready | active | blocked | backlog | finished | archived owner: codex @@ -198,7 +203,7 @@ derived health labels, not frontmatter statuses. ` ` `task id: LLM-WP-NNNN-T01 -status: todo | in_progress | done | blocked +status: wait | todo | progress | done | cancel priority: high | medium | low state_hub_task_id: "" # written by fix-consistency — do not edit ` ` ` @@ -206,7 +211,7 @@ state_hub_task_id: "" # written by fix-consistency — do not edit 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: 1. Write the file following the format above diff --git a/workplans/LLM-WP-0006-activity-core-always-on-endpoint.md b/workplans/LLM-WP-0006-activity-core-always-on-endpoint.md index d0cf182..893906e 100644 --- a/workplans/LLM-WP-0006-activity-core-always-on-endpoint.md +++ b/workplans/LLM-WP-0006-activity-core-always-on-endpoint.md @@ -2,7 +2,7 @@ id: LLM-WP-0006 type: workplan title: "Activity-Core Always-On LLM Endpoint" -domain: custodian +domain: agents repo: llm-connect status: finished owner: codex diff --git a/workplans/llm-connect-WP-0001-foundation-gaaf-baseline.md b/workplans/llm-connect-WP-0001-foundation-gaaf-baseline.md index 4fb3e3d..e30acd9 100644 --- a/workplans/llm-connect-WP-0001-foundation-gaaf-baseline.md +++ b/workplans/llm-connect-WP-0001-foundation-gaaf-baseline.md @@ -2,7 +2,7 @@ id: LLM-WP-0001 type: workplan title: llm-connect — Foundation & GAAF Baseline -domain: custodian +domain: agents status: completed owner: llm-connect created: 2026-04-01 diff --git a/workplans/llm-connect-WP-0002-core-extensions.md b/workplans/llm-connect-WP-0002-core-extensions.md index 29349f0..5bf75f6 100644 --- a/workplans/llm-connect-WP-0002-core-extensions.md +++ b/workplans/llm-connect-WP-0002-core-extensions.md @@ -2,7 +2,7 @@ id: LLM-WP-0002 type: workplan title: llm-connect — Core Extensions (FR-4 BudgetTracker + FR-3 async) -domain: custodian +domain: agents status: completed owner: llm-connect created: 2026-04-01 diff --git a/workplans/llm-connect-WP-0003-functional-extensions.md b/workplans/llm-connect-WP-0003-functional-extensions.md index 170e0f4..a2f0a52 100644 --- a/workplans/llm-connect-WP-0003-functional-extensions.md +++ b/workplans/llm-connect-WP-0003-functional-extensions.md @@ -2,7 +2,7 @@ id: LLM-WP-0003 type: workplan title: llm-connect — Functional Extensions (FR-2 RoutingPolicy + FR-1 HTTP server) -domain: custodian +domain: agents status: completed owner: llm-connect created: 2026-04-01 diff --git a/workplans/llm-connect-WP-0004-adaptive-cost-quality-routing.md b/workplans/llm-connect-WP-0004-adaptive-cost-quality-routing.md index 142294d..b6eb4de 100644 --- a/workplans/llm-connect-WP-0004-adaptive-cost-quality-routing.md +++ b/workplans/llm-connect-WP-0004-adaptive-cost-quality-routing.md @@ -2,7 +2,7 @@ id: LLM-WP-0004 type: workplan title: Adaptive Cost-Quality Routing -domain: custodian +domain: agents status: completed owner: llm-connect created: 2026-05-17 @@ -264,7 +264,8 @@ state_hub_task_id: "3a073ff7-0170-4a95-9c2a-a5daa84964e6" ### T01 — Quality observation data model + ledger | ID | Title | Priority | Status | -|-----|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|--------| +|-----|------------------------------------ +---------------------------------------------------------------------------------------------------------------------------------------------------------|----------|--------| | T01 | `QualityObservation` dataclass: `task_type`, `adapter_id`, `model_id`, `cost_usd`, `quality_score` (0..1), `latency_ms`, `tokens_in`, `tokens_out`, `baseline_adapter_id`, `recorded_at`, `tags` | high | done | | T02 | `QualityLedger` append-only JSONL store with file-locked writes, configurable path, simple query helpers (`by_task_type`, `recent`, `mean_quality`) | high | done | | T03 | TTL helpers: `prune_before(timestamp)` and `is_stale(observation, max_age)` so callers can refresh observations without re-reading the whole ledger | medium | done | diff --git a/workplans/llm-connect-WP-0005-cost-model-and-problem-class-estimators.md b/workplans/llm-connect-WP-0005-cost-model-and-problem-class-estimators.md index f9c145f..03823af 100644 --- a/workplans/llm-connect-WP-0005-cost-model-and-problem-class-estimators.md +++ b/workplans/llm-connect-WP-0005-cost-model-and-problem-class-estimators.md @@ -2,7 +2,7 @@ id: LLM-WP-0005 type: workplan title: "Cost Model and Problem-Class Token Estimators" -domain: custodian +domain: agents repo: llm-connect status: finished owner: llm-connect