Repository navigation
Description
Parent: #867 (family (b) of three; slice 1 — HTTP admin routes + console parity — is the job that carries #867 itself)
Milestone: Phase 5 · Labels: rewrite, rust, mcp, factory
Dependency: needs the HTTP admin surface from #867 to exist, because the tool handlers reuse its session/auth model and audit path.
The MCP server for relay admins: a new crate (nostream-admin-adjacent) using the rmcp SDK, exposing the seven tool families the issue named:
relay_status— uptime, worker health, connection count, version, NIP-11 doclist_events/get_event/delete_event— audited event-store inspection with kind/pubkey filtersuser_admin— admission, vanish, balance opsinvoices_*— list/inspect payment invoicesreports_*— NIP-56 triage: list, action (hide/allow), audit trailsettings_get/settings_set— the typed, schema-validated settings surfacemaintenance_*— trigger retention/cleanup, read last-run stats
Auth is the same admin credential model as the HTTP console; every call is audit-logged to the delivery-log store.
Measured at f01cb5f3 (recon for job 032-admin-console-parity):
- TypeScript counterpart: none —
grep -rn -i mcp src/has no hits, andcrates/nostream-admin/src/lib.rs:19-20says the same. This is a new surface, not a port. rmcpis absent fromCargo.lock(grep -c '^name = "rmcp"'→ 0).- The seams its tools would sit on partly exist:
EventRepository,InvoiceRepository(crates/nostream-storage/src/repositories.rs:635),ReportRepository(:767),nostream-configfor settings,nostreamdtelemetry/liveness for status. - Oracle: none exists. It must be built with the crate: a
tools/listsnapshot plus one integration test per tool against a running relay. The repo has no JS-client test harness at all, so this is a from-scratch harness; it should reuse the in-process server pattern slice 1 establishes incrates/nostream-admin/tests/.
Estimate basis: no LOC to inherit; price it from the tool count and the harness work, not from #867's headline. Cost to be set by the scoping job from measured units in .factory/estimates.md.
Note on closing: this repository's default branch is main, so Closes #N is inert on a PR targeting rewrite/main — the issue is closed by hand with the merge sha.
Activity
chappie-daemon commentedon Nov 19, 2026
Filed from the #867 scope gate in job 032; estimated pending its own scoping job.
feat(admin): serve the console's HTTP surface from the relay's one li…
chappie-daemon commentedon Nov 19, 2026
Job opened:
033-admin-mcp-server, baserewrite/mainat9a7c3181(the admin HTTP surface's merge), branchfactory/033-admin-mcp-server. Stage: recon.How this job is being sized, per the board's Sizing rule and the issue's own note:
rmcpversion actually resolved; the line saying which of those dominates goes in the spec.tools/listsnapshot plus one real call per tool against a running relay, with the response body asserted — the class of defect feat(admin): serve the console's HTTP surface from the relay's one listener #1192 fixed late (cameri/skills#317) is exactly what a status-only harness passes.chappie-daemon commentedon Nov 19, 2026
Spec written (slice 1).
spec.mdin the job folder: 418 lines, R1–R25, AC1–AC28, 33 values rows, digestfc468d9cf8d2c28a.The slice cut, fixed at spec time (the board's Sizing rule), each later slice with its dependency:
nostreamd --mcp-stdio, the token gate, the audit sink, the harness, and four tools:settings_get,settings_set,list_events,get_event.relay_status— depends on a status seam and a NIP-11 document, neither of which exists at9a7c3181(no total connection count anywhere;nip-parity.md:963-964).delete_event+user_admin— the store-level writes,delete_eventcurrently audited nowhere.invoices_*+reports_*— depends on the trait change nothing writes today (Report.actionable).maintenance_*— depends on an API change:clear_old_eventsdrops itsEventPurgeCountsinto a log line andpublish_heartbeatwriteslast_run_*: None.The oracle is payload-asserting, the lesson from #1192's late defect (cameri/skills#317): the full
tools/listsnapshot with a comparator proved to reject a dropped tool and a widened schema, a real call per tool asserting the response body's fields and values, and a refusal per tool path — none of it a status check.Two record corrections the spec carries: the issue's "audit-logged to the delivery-log store" names a store that never held admin actions (the capture wrote a Redis sorted set; the rewrite writes
admin-audit.jsonl, ADR 0014 D9), so the audit file is the sink; and the audit action union is closed at nine names, which slice 1 extends by four, adding ADR 0014 D18.Cost: $3.29 expected from measured units, bracket $1.97–$3.69;
#860carries the plan adjustment, because #867's $5.00 row cannot hold all five slices.chappie-daemon commentedon Nov 20, 2026
Job 033-admin-mcp-server — review round 2 closed CHANGES.
At
44d03725: code PASS, security PASS, performance PASS; ux CHANGES (1), architecture CHANGES (3). The nine round-1 blocking findings are confirmed closed, each re-inverted by the code lens.Round 2's four blockers are all about what the surface promises versus what it does:
list_eventssilently ignored a mistyped argument name and answered unfiltered ({"kind":1}→ all rows,isError:false) — a client cannot tell a typo from a criterion;TOOL_ARGUMENTS' doc named the schema as its invariant where the code needs 'no stricter than the router's deserialiser', and the ADR repeated the stricter reading;DEFAULT_PAGE_ROWSwas migrated for LMDB while Postgres kept its own 500 under another name.Measured gains from round-1's fixes, both re-measured at the fixed head:
get_event {"id":""}10,994 → 843 µs (13×),list_events {"ids":[""]}20,839 → 887 µs (23.5×), and a 500-row page 594,490 → 287,292 B (−51.7 %).chappie-daemon commentedon Nov 20, 2026
Job 033-admin-mcp-server — round 3 PASS, approver ESCALATE (
money-access-identity), PR open.#1197
Final head
80a631af(the changeset now says the mode is its own process). Round 3: code, security, ux and architecture all PASS;uiandperformancestood down on counted reasons inreview-plan.json. Oracle, run independently by the approver in a fresh target dir: 105 targets, 1560 passed / 0 failed / 6 ignored; merge-tree clean againstrewrite/main.The approver's verdict is not about the code: every accept condition held, and it escalated because this slice puts a console session token (
NOSTREAM_ADMIN_TOKEN) into a second process that grants settings read/write and event reads while declining the HTTP rate limiter — a decision for a person. Slice 2 (relay status) is the natural place to answer it with a socket-only or rate-limited shape.chappie-daemon commentedon Nov 20, 2026
Job 033-admin-mcp-server — slice 1 approved, PR #1197 open, merge is the owner's word.
#1197
Head
3c83570b. Round 8 was five PASS verdicts (uistood down on a counted read: no rendered path in any round's delta); the approver then re-took the gate itself — 105 targets, 1582 passed / 0 failed / 6 ignored, fmt and both clippy passes clean, release build clean — and returned APPROVE after a record-only repair.The credential is what the operator asked for: a token document delivered by
--admin-token-file(regular file, no group or other permission, at most 4 KiB, re-read on every call so the file's lifetime is the revocation) or--admin-token-fd(same checks, read once). Reads by default;settings_setneeds an explicitwritescope; a scope denial appendsmcp.denied;NOSTREAM_ADMIN_TOKENis retired and refuses the start.Cost: $8.94 against $3.29 expected — about $4.3 of that is the rework the escalation asked for, the rest eight review rounds and two approver passes. Regret line in the job record.
Slices 2–5 remain cut in the job's
spec.md; #1193 and #1194 are filed and open.feat(admin): serve the admin MCP server on stdio (#1183, slice 1) (#1197
chappie-daemon commentedon Nov 20, 2026
Merged: PR #1197 into
rewrite/mainat982e6759f11da042901c6a80959dfc01f2c53f3a— slice 1 of #1183 (the admin MCP server on stdio, behind a scoped token document). Slices 2–5 stay cut in the job'sspec.mdand are tracked on this issue's successor scope; #1193 and #1194 remain open.Cost: $8.94 actual against $3.29 expected (+172 %), about $4.3 of it the operator-requested credential rework (rounds 4–8) and the rest eight review rounds plus two approver passes.
14 remaining items
feat(mcp): add delete_event and reports_action over a report setter (#…
chappie-daemon commentedon Nov 21, 2026
Slice 4 opened:
user_admin, the invoice reads, andreports_list. Baserewrite/mainata8cef4a5.033's cut put
user_admin,invoices_listandinvoices_gethere as the families whose repository seams are complete and whose surface is absent, and leftmaintenance_*to slice 5 because that slice's cost is the API change rather than the tools. I am addingreports_listto this slice: 033 put both report tools in slice 3, 036 shipped the action half and recorded the read half as unowned. Now that the report store reaches the door,reports_listis a pure read over a landed route — the cheapest place it will ever sit, and leaving it for slice 5 would attach a trivial read to that slice's API break.Recon is running on three questions that can move the price: whether
user_adminis one tool with an action enum or one per operation, whether listing reports composes fromfind_actionable/find_by_event_id/find_actionable_targetsor needs a new trait method on both backends, and whatinvoices_getanswers for an unknown id.chappie-daemon commentedon Nov 21, 2026
Slice 4 spec written: digest
62f0a2a6ceca344f, 931 lines, five tools.The cut as shipped in the spec, and the three calls inside it:
user_adminanduser_getare two tools because scope is a row property. OneTOOLSrow would make a balance read demand awritecredential or let an admission through a read-only one; a case pins the split by asserting the four reads answer under a read document anduser_adminis refused once.reports_listis the actionable review queue overfind_actionable(limit)— no new seam. The general listing is out of scope with its measured price (15 files / +196 / −19 across six implementors), so a later slice can take it deliberately rather than inherit it.is_vanished, because that method writes a row when it hydrates: a read must not write under a read grant, and a case asserts the store is unchanged after the call.invoices_listis pending-only (the only list read that exists), andinvoices_getanswers an unknown id as{"invoice": null}, matchingget_eventandreports_action. The four absent-name sites ADR 0017 left pointing atuser_adminmove tomaintenance_runhere, with a criterion counting them.Base measured, not assumed: 7 tools over the spawned binary,
-32602for all five names, no audit file for five refused calls;nostream-mcp77,mcp_stdio18,parity_lmdb52.chappie-daemon commentedon Nov 22, 2026
Slice 4 approved: PR #1225, green, awaiting merge.
user_admin,user_get,invoices_list,invoices_get,reports_list— five tools over the store seams the recon measured, no new trait method and no new store field.Round 1 ran three lenses (
code,security,architecture;ux,uiandperformancestood down with reasons) and took three build-side reworks:user_rowread the same store row twice; it now reads once and derives the balance, with case 18 refusing the removed read through a delegatingUserRepositoryso the one-read invariant is pinned by a case rather than by a comment;build.mdrow naming a command that exits 2 on the installed factory version.The security lens measured the scope split's blast radius rather than asserting it: with
user_admin's row inverted toread, an empty-scope document ranvanish, left a stored row, and wrote an ordinary audit line with no denial.Bench at
d57ce933: 1 801 passed / 0 failed / 9 ignored, fmt and both clippy clean, release clean;store_families18 cases each with a measured red.Owed and filed: #1223 (
offsetunbounded on a read grant, first read with a caller-chosen offset). The Postgres arms run only in CI, where a database exists.feat(mcp): add user_admin, user_get, the invoice reads and reports_li…
chappie-daemon commentedon Nov 22, 2026
Slice 4 merged:
ab3626c1onrewrite/main(2026-11-22T01:39:09Z), true merge commit. PR #1225 landed on the approver's APPROVE ata1de51c5plus two docs-only commits: the changeset's false sentence about the user read, andreports_list's description, which invited a caller to copy the row's integeridwherereports_actiontakes the hexevent_id.Cost: expected $4.50, actual $3.2981 — 26.7% under. 13 sessions, 1 251 requests, 176.3M cache-read, 6.09 h summed wall. A
regretline records the miss and a re-estimate to $3.30 keeps the baseline atcost_expected_usd_original.Why the estimate was high, which is the same lesson as slice 3 in a sharper form. The 4.50 priced a second spec round and three reworks at slice 3's rate. The second spec round cost $0.62 — a revision against a red-team list, not a cold write — and the three reworks came in at $0.05–0.10 each, because each was a doc sentence, a schema table or a test double on a branch whose gate was already warm. The one term that ran the other way was the builder: $1.08 in one 397-request session, because a five-tool build spends its budget on the snapshot and the twelve count sites rather than on new behaviour. The estimate for the next slice should price the cold build and the first spec, and treat every pass after them as a fraction of one.
Process that earned its keep. The gate ran eight inversions named in the scoping plan before writing a single finding, and all eight reddened: slice 3's four review passes for three unprovable assertions became one pass for none. The count verifier (
build-lint --worktree, from the plugin change in cameri/skills#328) ran at every build check and caught no stale count, but two record-side misses still happened — abuild.mdrow naming a command that exits 2 on the installed version, and four numbers the post-round spec amendment outran. Both are the same class: a change to the head or to the spec must re-run the check, and the next mechanisation is to point the same verifier atspec.md.One incident. The AC14 inversion that moves the oracle aside left
store_families.rsdeleted in the worktree between two commits. An external read caught it; it was restored before any commit; the gate confirmed the file's presence in the run it recorded. The inversion is the right test, and it is onegit add -Afrom deleting a target — builders should name paths.chappie-daemon commentedon Nov 22, 2026
Slice 5 (job
038-mcp-maintenance) opened onrewrite/mainatab3626c1; recon landed. Measured ground:clear_old_eventsdropsEventPurgeCountstwice (MaintenanceServiceand theMaintenanceTaskstrait) across exactly two implementors and 8 call sites — the storage layer already returns the counts on both backends, and noEventRepositoryimplementor moves. The hard fact for the last-run record: the MCP server is only served inmcp_stdio::serve, which returns before the daemon'sserveand composesunavailable::stores(), so the door cannot read the daemon's pass through memory — the spec chooses the record's shape and says so. Base counts: mcp 96 passed, services maintenance 6, parity_lmdb 52; bothmaintenance_*names answer-32602 tool not foundover the real binary. Expected cost $3.50.chappie-daemon commentedon Nov 22, 2026
Slice 5 spec written: digest
f2e63aa0b7600dd5, 777 lines, R1–R15, D1–D6, AC1–AC15. The record-shape question recon left open is settled in D3: the last-run record is process memory inAdminState, payload{"run": {ranAt, deleted, expired, retained}}and{"run": null}for never-ran — the daemon's pass is invisible to the door and the tool's description says so. D2 keeps "the same code path" honest:maintenance_runcalls the purge step throughMaintenanceService, the same function theMaintenanceTasksarm delegates to, because aMaintenanceRunnerneeds the outbox dispatcher, payments service, relay key source and hub the stdio mode does not compose. D5 retires the absent-name example to a literalno_such_tool, since after this slice no #1183 name is absent. Red-team running againstab3626c1.chappie-daemon commentedon Nov 22, 2026
Spec closed at digest
345410647a4ef868; build round 1 started.Second red-team pass (against
fe52af4513cf9b3a) returned 13 proven fails-at-base, 2 declared Guards green, 0 unproven, no undeclared divergence — the first pass's AC15 is now measured, not claimed: I ran both legs atab3626c1through the pinned native toolchain (scripts/rust.shcannot reach its cache from this profile): workspace 1 801 passed / 0 failed over 104 targets, release build exit 0 in 7m32s, and the per-target readings re-extracted one by one (mcp 96 = 5/6/11/10/18/23/5/18, services maintenance 6, mcp_stdio 19, admin 50 + 3). Those live in.factory/jobs/038-mcp-maintenance/base-readings.md.It also caught six criteria a wrong implementation could satisfy or that would not run as written — AC2's grep missing
-r, AC10'stail -2printing the Doc-tests line, AC7's audited pair writing two lines rather than one, AC8's counts satisfied by two comments (now anchored to the audit vector's rows, 12 → 14), AC12's lost old-phrase sweep inauth.rs:12, and AC6's half 2 filtering only a constant-null stub. The two-pass cap means they are recorded as orchestrator amendments under Assumptions, with the measurement that produced each, rather than sent round a third time.chappie-daemon commentedon Nov 22, 2026
Slice 5 build landed on branch
factory/038-mcp-maintenanceat64f84448(seven commits onab3626c1), build gates green:build-lintexit 0,decision-coverageexit 0, static stage (clippy--all-targets --all-features) 0 findings at that sha.What it moved, measured rather than claimed: mcp 101 over 9 targets (96/8 at base), services
maintenance7 (6),mcp_stdio20 (19), workspace 1 808/0 over 105 targets (1 801/0 over 104), release build green, fmt and both clippy passes clean. The seam answers counts at every layer (PassOutcome.counts: Option<EventPurgeCounts>,Noneon the error and timeout arms rather than zeros), the record isMaintenanceRunon process memory with replace-never-sum, and the door gainedmaintenance_run(Write) andmaintenance_last_run(Read).Two spec readings the builder reported instead of quietly matching: my AC8 amendment named a path that does not exist (the vector is
crates/nostream-mcp/tests/audit.rs:84-97, re-measured 12 → 14), and AC14's needle counts read 3, not 2 — the same shapeTOOL_RELAY_STATUShas at base. Both corrected in the spec's amendments with the reasons attached.Review round 1 scoping: five lenses run (
codeas the gate, thensecurity,ux,architecture,performance);uistood down on a measured sweep of the diff's 26 paths — no rendered surface at base or head.chappie-daemon commentedon Nov 22, 2026
Rework 1 closed at
8e2ace82; review round 2 is a confirmation pass onarchitecturealone.Round 1 was code PASS, security PASS, ux PASS, performance PASS, architecture CHANGES, ui skipped by plan. The two findings, and how they closed:
record_maintenance_run(deleted, expired, retained)let adeleted/expiredtranspose compile while all five new cases stayed green (both lenses measured the swap surviving). It now takes oneEventPurgeCountsvalue and builds the record by field name — the old call fails witherror[E0061]: this method takes 1 argument but 3 arguments were supplied.CONFIGURATION.mdexamples it. D3 now says the record is this process's own, that beside a daemon{"run": null}means "this process has not run one" — a known blind spot, not a fact — and Consequences names the durable cross-process record as its successor, noting the daemon now produces the counts throughPassOutcome.counts.A third item came from the count verifier rather than a lens: sixteen of
build.md's rows quoted…-abbreviated paths andgrep -nline numbers as counts. All sixteen now run as written;verify-counts.tsexits 0 with 55 quoted counts agreeing with the tree.The round's delta: 3 files, +26 −20 — the signature, its only call site, and the ADR. Static stage at the rework head: 0 findings. Gates re-run by the orchestrator, not taken on the builder's word: build-lint 0, decision-coverage 0, verify-counts 0, workspace 1 808/0 over 105 targets, release 0, fmt and both clippy 0.
Process defect, recorded rather than smoothed over: I wrote round 1's
roundline and skipped itsplanline, which blocked round 2's confirmation check until it was appended late with a note saying it arrived after the round. The line is now there and the log lints.chappie-daemon commentedon Nov 22, 2026
Slice 5 review closed: three rounds, all PASS, approver running at
2a116117.64f84448): code PASS (whole gate at the head plus three inversions, one per criteria-bearing branch, all reddening the cases that claim them), security PASS, ux PASS, performance PASS, architecture CHANGES.8e2ace82): the counts became oneEventPurgeCountsvalue — the old call now fails witherror[E0061]— and ADR 0019's D3 cost was restated, since it had argued that a door beside a daemon is "outside the tree" while ADR 0014 D18 and 0016 D1 document that deployment.PassOutcome.counts(from5e08fdff, an ancestor of the ADR's own commit) makes false, and which:151-153of the same ADR contradicted.2a116117, one file, +5 −2): the sixth key is now priced as an amendment to ADR 0016's five-key shape plus a writer at the loop that discardsrun_pass'sPassOutcome— "the counts are produced and dropped rather than absent". Architecture PASS; the cited lines re-verified at this head.Worth recording as method: the two findings that mattered most were both introduced by a fix or invisible to the test suite — a positional-count swap that all five new cases stay green through, and a cost paragraph whose premise a neighbouring ADR refutes. The confirmation rounds exist for exactly that, and they cost 0.03 each.
Also:
build.mdquoted sixteen commands that could not be re-run (…-abbreviated paths,grep -nline numbers in count slots). All now run as written;verify-counts.tsexits 0 with 56 quoted counts agreeing.feat(mcp): the maintenance tools, the counts the pass drops, and the …
chappie-daemon commentedon Nov 22, 2026
All seven tool families are on
rewrite/mainas of6d1454b122bcfb56da7ff513ec47cbbe89b1a314(PR #1226, slice 5 of 5). Read from the merged tree'stools/listsnapshot rather than from the plan — fourteen tools:relay_statuslist_events,get_event,delete_eventuser_admin,user_getinvoices_list,invoices_getreports_list,reports_actionsettings_get,settings_setmaintenance_run,maintenance_last_runSlices: #867's HTTP admin surface, then
relay_status(#1219), the writes (#1220), users and invoices (#1224), maintenance (#1226 on this merge).One known limit, stated in ADR 0019's D3 and priced in its Consequences:
maintenance_last_runrecords this process's own runs, so a stdio door run beside a daemon answersnullfor passes the daemon performed. The durable cross-process record is that decision's named successor — an amendment to ADR 0016's five-key document plus a writer at the loop, which already holds the counts and discards them. It is a follow-up, not a gap in this issue.Every call is audit-logged with its
mcp.<name>action and no count indetail, and the absent-name example retired tono_such_toolbecause no name in this issue is absent any more.