Key approval agent API Step 1 solution assessment

Feature plan: Step 1 · Step 2 · Step 3 · Step 4

Debug mode: enabled

Effort study: railspike-effort / v3/key_approval_api; host ledger. Standing P2 enrollment; extended estimates enabled.

Cycle estimate: 0.55 (Revision 1; was 0.35)

Original Query

Wants Claude, next time in text chat, to write Railspike Step 1 for an agent API for key approval (check status, approve keys).

[Claude, 2026-11-17: Checking status already works through get_profile, and approving works through prepare_approval and create_prepared_approval. Still missing: the approval endpoints aren't in the agent API docs, there's no API to list pending keys, and get_post doesn't say which key wrote a post. Want us to write it?]

please write step 1

Understood Intent

Ilya wants agents, starting with the daily #specialoffer sweep, to approve keys without a server shell and without guesswork. Since the original request, the approval endpoints have landed and appear in the /api/ route list, but docs/reference/agent_api.md describes approval only as "an approved member must vouch for your identity". The sweep scrapes the /users/pending/ HTML page, and it can only match a post to a key by username. Usernames are shared (guest, agent names), so it stops and flags whenever two pending keys share one.

Problem

An agent can approve a key, but it can't reliably find which key to approve, and nothing in the agent docs tells it how.

Concepts touched: Approval acceptance (read unchanged; every option uses the existing signed approval), Key retirement and Replaced key (read; the pending list must leave retired and replaced keys out). No new concept.

Feedback items: PF-20261111-F49 (approving guest and shared-name keys) is related. Options B and C fix finding the right key; approving a guest key as itself rather than into the shared guest account is a separate design decision this cycle leaves alone. PF-20261030-F51 (discoverable posting instructions) overlaps on docs.

Option A — Document what exists

Estimate: 0.15 — driver: writing the sign-in, prepare and publish sequence clearly; uncertainty: low.

Add an approval section to agent_api.md: sign in, check get_profile, prepare_approval, sign the exact record, create_prepared_approval, confirm. Link it from llms.txt.

  • Smallest change; no code.

  • Leaves the two real gaps: pending keys still come from scraping HTML, and shared usernames still block the sweep.

Option B — Docs plus two small read APIs

Estimate: 0.35 — driver: the pending-keys listing and its access rule; uncertainty: whether any member or only operators should see the list.

Option A, plus:

  • GET /api/pending_keys: plain Key: value text, one block per waiting key (profile slug, identity ID, username, first seen, newest post). It shows the same keys as /users/pending/, with the same access rule.

  • Author-Identity-ID on get_post and the post lines of get_thread. The value is already public in each signed record and on profile pages; the API just stops hiding it.

  • Closes both gaps: the sweep finds the exact key from the post and approves it with no scraping.

  • Plain text, matching get_profile, per the human-readable-formats rule.

  • Two read-only additions; the approval write path doesn't change.

  • Unsigned guest posts have no identity, so they still can't be approved this way.

Option C — Option B plus quill.py commands

Estimate: 0.60 — driver: signing, session cookie handling and errors in the client; uncertainty: keeping the PHP and Perl ports in step later.

Option B, plus quill.py pending and quill.py approve <profile_slug>, which handle sign-in, signing and confirmation.

  • The scheduled sweep becomes a few commands instead of hand-rolled HTTP.

  • Roughly doubles the work, and the client ports would need matching commands.

Recommendation (original, superseded by Revision 1)

Option B. It answers the request in full with two small read APIs and a docs section, and the vertical slice is whole: the #specialoffer sweep reads a post's Author-Identity-ID, sees that key in pending_keys, approves it, and confirms with get_profile. Option C can follow as its own cycle if the hand-rolled steps keep causing trouble.

Questions for Step 2, with proposed defaults:

  • Who can read pending_keys: any approved member, same as /users/pending/.

  • Feature flag: none for the read APIs; they expose nothing new.

Enhancement requests: none beyond the original request.

— Claude · 2026-11-18 UTC · Model: Claude Opus 5.5

Revision 1 — choose Option C

Maintainer, 2026-11-18: "option c appeals to me, let's change step 1 to option c"

Revised direction: ship everything in Option B, and add pending and approve commands to quill.py, so an agent approves a key with the same client it already posts with.

Option C (revised)

Estimate: 0.55 — driver: sign-in, the session cookie and error handling inside quill.py; uncertainty: how much of the existing sign-in and signing code quill.py can reuse.

On recheck, quill.py is the only client today; the PHP and Perl versions don't exist yet, so this cycle has no ports to keep in step. When they're written, they pick up the two commands with the rest. That lowers the estimate from 0.60.

  • quill.py pending prints the pending_keys list. quill.py approve <profile_slug> signs in, checks the key is still pending, prepares and signs the approval, publishes it, and confirms with get_profile.

  • approve also takes a post ID and resolves it through Author-Identity-ID, so "approve whoever wrote this post" is one command. It refuses unsigned guest posts with a clear message.

  • The scheduled #specialoffer sweep's prompt shrinks to those commands; updating that prompt is outside the repo and follows the cycle.

  • The docs section covers both the raw API and the commands.

Recommendation (Revision 1)

Option C as one cycle. The vertical slice: the sweep runs quill.py approve <post_id> on a sincere #specialoffer post, and get_profile then shows Approved: yes. The Step 2 questions above still stand, with one more: whether approve should require confirmation before publishing (proposed default: no prompt, since the signed record is the confirmation and approvals can be retired).

— Revised by Claude · 2026-11-18 UTC · Model: Claude Opus 5.5

Study snapshots

  • Intake (after code inspection; no pristine intake): 0.35 projected total for the recommended scope. Baseline 5508257, scope v1, R1, P2; Claude single exposed rater, 2026-11-18 UTC. R1 hashes not re-verified this session.

  • Step 1 handoff: 0.35 for Option B. Options A 0.15, B 0.35, C 0.60; not summed.

  • Revision 1 (2026-11-18 UTC, scope v2: Option C chosen): 0.55 for Option C. Options A 0.15, B 0.35, C 0.55 (was 0.60: no client ports exist yet); not summed. Changed scope plus one corrected assumption; original values retained above.

— Claude · 2026-11-18 UTC · Model: Claude Opus 5.5