Persist curator definitions: store, State Store RPCs, REST CRUD, config seed #485

Open
opened 2026-10-27 13:36:31 +00:00 by sam · 1 comment
Owner

Make curator definitions durable and API-authoritative: the store owns them, config seeds them, and the WebUI edits them.

Today there is no [curator] config block, no curator definition table, no curator RPCs, and GET /api/curators is read-only. The proven shape to mirror is bindings/mappings: internal/store/bindings.go's schema constant plus typed error sentinels plus Insert/Get/List/Update/Delete/Approve on *Store, the internal/domain/binding entity the store persists, and internal/webui/api_binding.go's CRUD handlers behind authorizeTaskMutation.

Scope

  • Domain type + store schema: the curator definition entity lives in internal/domain/curator (domain owns the type; the store persists it), with a curator_definitions table, indexes, fixed-width RFC3339 timestamps, and typed sentinels (not-found, duplicate name, invalid definition) in internal/store/curators.go.
  • Config seed with the store authoritative: [[curators]] seeds definitions at startup (insert-if-absent); a config row never overwrites a store row, and the store wins a name collision. A store definition that collides with a code-registered curator's name is refused with a clear log rather than silently replacing a Go engine with data.
  • State Store RPCs in the same change: state.proto gains the matching request/response messages and RPCs, staterpc.Client gains the façade, and sentinels cross via mapError/unmapError. docs/prds/state-store-contract.md (the authority for this boundary) is updated in the same change, per AGENTS.md's "never add a Go interface method without a matching RPC".
  • REST CRUD mirroring /api/bindings: GET|POST /api/curators, GET|PATCH|DELETE /api/curators/{id}, all guarded by authorizeTaskMutation; the existing read-only GET /api/curators response keeps its current fields so the dashboard keeps working.
  • Live apply: a create/update/delete goes through the runtime-mutation path from the previous child, so it takes effect without a restart.
  • Retire live-path constants: the two shipped curators' DefaultInterval Go constants stop being read at registration; the value becomes seed data (written into config by setup), never a pass-time fallback. RuntimeConfig{}'s empty pass-timeout / max-concurrent defaults become config values.

Non-goals

  • No dashboard SPA editor page.
  • No migration of the two shipped reference curators into data definitions beyond their interval constants -- a curator whose strategy cannot be expressed as tools + instructions stays a registered Go engine.
  • No second authority: no file-per-curator definition store on disk.

Acceptance criteria

  1. A definition created over REST survives a daemon restart and runs after restart; a definition deleted over REST does not come back (config seeding must not resurrect it).
  2. Config seeds a new definition once and never overwrites or resurrects a store row; the store wins a name collision; the collision behaviour is covered by a test.
  3. state.proto has a matching RPC for every persisted definition method, with TestOpenStoresNeverOwnsTaskDB still passing (the daemon/Gateway never open archie.db).
  4. GET|POST|PATCH|DELETE /api/curators mirror /api/bindings semantics including auth, and the pre-existing GET /api/curators fields are unchanged.
  5. No pass-time constant supplies interval, cooldown, tools, model, or memory engine for any curator, shipped or data-defined.

Security and failure paths

  • Mutation authority is authorizeTaskMutation, identical to bindings; no unauthenticated or weaker write path.
  • A definition naming a nonexistent tool fails closed at registration/pass and degrades that curator only.
  • Deleting a definition cancels its in-flight pass before the row disappears.
  • mapError/unmapError canonical message strings are wire contract: changing one breaks errors.Is on clients without any visible behaviour change.

Dependencies

  • Depends on the generic engine child (something to persist and configure) and the runtime-mutation child (live apply).
  • Depends on the State Store contract (docs/prds/state-store-contract.md) being extended in the same change.
  • Not blocked on forge issue tools. The chat agent can already reach issues through the unconfined shell tool (gh issue edit|comment|create|close, authenticated via ~/.config/gh/hosts.yml). Dedicated issue tools (#161) are a convenience, not a prerequisite. See the correction comment on #789.

Merged from the other tracker

Phase 3. Persist definitions: domain entity in internal/domain/curator + curator_definitions table in internal/store/curators.go (schema const, indexes, RFC3339, typed sentinels); config seeds insert-if-absent with the store authoritative on collision; state.proto messages+RPCs, staterpc.Client facade, mapError/unmapError, and docs/prds/state-store-contract.md updated in the same change; REST GET|POST /api/curators and GET|PATCH|DELETE /api/curators/{id} behind authorizeTaskMutation, existing GET fields unchanged; retire skillcurator/sessioncurator DefaultInterval from the registration path and RuntimeConfig{} code defaults.

Acceptance: definition created over REST survives restart and runs; deleted definition is not resurrected by config seed; config never overwrites a store row; every persisted method has a matching RPC with TestOpenStoresNeverOwnsTaskDB still passing; REST mirrors /api/bindings incl. auth; no pass-time constant supplies interval/cooldown/tools/model/memory engine.

Security/failure: authorizeTaskMutation is the only mutation authority; canonical mapError/unmapError message strings are wire contract; delete cancels the in-flight pass before the row goes.

Deps: phases 1+2; State Store contract extension in the same change; tools registry work for the orchestrator curator's forge issue tools. GitHub: #792. Design: docs/prds/dynamic-curators.md.

Acceptance criteria

Curator REST CRUD persists definitions across restart, respects store-over-config authority, enforces mutation authorization, and cancels active passes on deletion.

Notes

CORRECTION (2026-09-12): the 'forge issue tools are a blocker' finding was wrong. No dedicated issue tool exists and no MCP server was ever configured, BUT the chat agent's is unconfined (chat.unrestricted_filesystem=true), so already works. Dedicated tools (#161) are convenience, not a prerequisite. VERIFIED STATE: (1) ToolBuilder has NO implementation anywhere - only the interface decl at domain/curator/registrar.go:86 and the fail-closed guard at registry.go:123; bootstrap.go builds the Registrar with no Tools field. (2) curatorLLMRunner at app/archied/main.go:551 drops ChatRequest.Tools - a SECOND independent blocker; fixing ToolBuilder alone still yields tool-less passes. (3) No definition persistence, no Unregister, no Runtime.Add/Remove. (4) runtime.go:202-211 logs nothing on not-due, so the skill curator's absence from logs is indistinguishable from health. EVIDENCE: standalone prototype at ~/projects/issue-orchestrator drove a real tool loop against live GitHub issues with local model defiant-fable-q6: 3 issues, 2 model steps, ~60s. Proof the loop works on local HW.


Imported from beads archie-core-trnd.3 · GitHub #798 · body merged from the fuller GitHub #792 · type task · priority P1 · created 2026-09-12

Make curator definitions durable and API-authoritative: the store owns them, config seeds them, and the WebUI edits them. Today there is no `[curator]` config block, no curator definition table, no curator RPCs, and `GET /api/curators` is read-only. The proven shape to mirror is bindings/mappings: `internal/store/bindings.go`'s schema constant plus typed error sentinels plus `Insert`/`Get`/`List`/`Update`/`Delete`/`Approve` on `*Store`, the `internal/domain/binding` entity the store persists, and `internal/webui/api_binding.go`'s CRUD handlers behind `authorizeTaskMutation`. ### Scope - **Domain type + store schema**: the curator definition entity lives in `internal/domain/curator` (domain owns the type; the store persists it), with a `curator_definitions` table, indexes, fixed-width RFC3339 timestamps, and typed sentinels (not-found, duplicate name, invalid definition) in `internal/store/curators.go`. - **Config seed with the store authoritative**: `[[curators]]` seeds definitions at startup (insert-if-absent); a config row never overwrites a store row, and the store wins a name collision. A store definition that collides with a code-registered curator's name is refused with a clear log rather than silently replacing a Go engine with data. - **State Store RPCs in the same change**: `state.proto` gains the matching request/response messages and RPCs, `staterpc.Client` gains the façade, and sentinels cross via `mapError`/`unmapError`. `docs/prds/state-store-contract.md` (the authority for this boundary) is updated in the same change, per AGENTS.md's "never add a Go interface method without a matching RPC". - **REST CRUD** mirroring `/api/bindings`: `GET|POST /api/curators`, `GET|PATCH|DELETE /api/curators/{id}`, all guarded by `authorizeTaskMutation`; the existing read-only `GET /api/curators` response keeps its current fields so the dashboard keeps working. - **Live apply**: a create/update/delete goes through the runtime-mutation path from the previous child, so it takes effect without a restart. - **Retire live-path constants**: the two shipped curators' `DefaultInterval` Go constants stop being read at registration; the value becomes seed data (written into config by setup), never a pass-time fallback. `RuntimeConfig{}`'s empty pass-timeout / max-concurrent defaults become config values. ### Non-goals - No dashboard SPA editor page. - No migration of the two shipped reference curators into data definitions beyond their interval constants -- a curator whose strategy cannot be expressed as tools + instructions stays a registered Go engine. - No second authority: no file-per-curator definition store on disk. ### Acceptance criteria 1. A definition created over REST survives a daemon restart and runs after restart; a definition deleted over REST does not come back (config seeding must not resurrect it). 2. Config seeds a new definition once and never overwrites or resurrects a store row; the store wins a name collision; the collision behaviour is covered by a test. 3. `state.proto` has a matching RPC for every persisted definition method, with `TestOpenStoresNeverOwnsTaskDB` still passing (the daemon/Gateway never open `archie.db`). 4. `GET|POST|PATCH|DELETE /api/curators` mirror `/api/bindings` semantics including auth, and the pre-existing `GET /api/curators` fields are unchanged. 5. No pass-time constant supplies interval, cooldown, tools, model, or memory engine for any curator, shipped or data-defined. ### Security and failure paths - Mutation authority is `authorizeTaskMutation`, identical to bindings; no unauthenticated or weaker write path. - A definition naming a nonexistent tool fails closed at registration/pass and degrades that curator only. - Deleting a definition cancels its in-flight pass before the row disappears. - `mapError`/`unmapError` canonical message strings are wire contract: changing one breaks `errors.Is` on clients without any visible behaviour change. ### Dependencies - Depends on the generic engine child (something to persist and configure) and the runtime-mutation child (live apply). - Depends on the State Store contract (`docs/prds/state-store-contract.md`) being extended in the same change. - **Not** blocked on forge issue tools. The chat agent can already reach issues through the unconfined `shell` tool (`gh issue edit|comment|create|close`, authenticated via `~/.config/gh/hosts.yml`). Dedicated issue tools (#161) are a convenience, not a prerequisite. See the correction comment on #789. ### Merged from the other tracker Phase 3. Persist definitions: domain entity in internal/domain/curator + curator_definitions table in internal/store/curators.go (schema const, indexes, RFC3339, typed sentinels); config seeds insert-if-absent with the store authoritative on collision; state.proto messages+RPCs, staterpc.Client facade, mapError/unmapError, and docs/prds/state-store-contract.md updated in the same change; REST GET|POST /api/curators and GET|PATCH|DELETE /api/curators/{id} behind authorizeTaskMutation, existing GET fields unchanged; retire skillcurator/sessioncurator DefaultInterval from the registration path and RuntimeConfig{} code defaults. Acceptance: definition created over REST survives restart and runs; deleted definition is not resurrected by config seed; config never overwrites a store row; every persisted method has a matching RPC with TestOpenStoresNeverOwnsTaskDB still passing; REST mirrors /api/bindings incl. auth; no pass-time constant supplies interval/cooldown/tools/model/memory engine. Security/failure: authorizeTaskMutation is the only mutation authority; canonical mapError/unmapError message strings are wire contract; delete cancels the in-flight pass before the row goes. Deps: phases 1+2; State Store contract extension in the same change; tools registry work for the orchestrator curator's forge issue tools. GitHub: #792. Design: docs/prds/dynamic-curators.md. ### Acceptance criteria Curator REST CRUD persists definitions across restart, respects store-over-config authority, enforces mutation authorization, and cancels active passes on deletion. ### Notes CORRECTION (2026-09-12): the 'forge issue tools are a blocker' finding was wrong. No dedicated issue tool exists and no MCP server was ever configured, BUT the chat agent's is unconfined (chat.unrestricted_filesystem=true), so already works. Dedicated tools (#161) are convenience, not a prerequisite. VERIFIED STATE: (1) ToolBuilder has NO implementation anywhere - only the interface decl at domain/curator/registrar.go:86 and the fail-closed guard at registry.go:123; bootstrap.go builds the Registrar with no Tools field. (2) curatorLLMRunner at app/archied/main.go:551 drops ChatRequest.Tools - a SECOND independent blocker; fixing ToolBuilder alone still yields tool-less passes. (3) No definition persistence, no Unregister, no Runtime.Add/Remove. (4) runtime.go:202-211 logs nothing on not-due, so the skill curator's absence from logs is indistinguishable from health. EVIDENCE: standalone prototype at ~/projects/issue-orchestrator drove a real tool loop against live GitHub issues with local model defiant-fable-q6: 3 issues, 2 model steps, ~60s. Proof the loop works on local HW. --- _Imported from beads `archie-core-trnd.3` · GitHub #798 · body merged from the fuller GitHub #792 · type task · priority P1 · created 2026-09-12_
sam added the hightask labels 2026-10-27 13:36:31 +00:00
sam self-assigned this 2026-10-27 13:36:31 +00:00
Author
Owner

sam wrote (originally 2026-10-08):

4q28.18 now provides authoritative curators resource, dashboard editor and live registration through existing control-plane contract. Keeping this ticket open because its explicit acceptance also requires retiring built-in interval/runtime defaults and proving an executed model pass, beyond that narrower ticket.

_sam wrote (originally 2026-10-08):_ 4q28.18 now provides authoritative curators resource, dashboard editor and live registration through existing control-plane contract. Keeping this ticket open because its explicit acceptance also requires retiring built-in interval/runtime defaults and proving an executed model pass, beyond that narrower ticket.
sam added a new dependency 2026-10-27 13:42:07 +00:00
sam added a new dependency 2026-11-14 14:45:07 +00:00
sam added the deferred label 2026-11-15 17:26:24 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: sam/archie#485