Skip to content

Instantly share code, notes, and snippets.

@dmmulroy
Created November 1, 2026 15:01
Show Gist options
  • Select an option

  • Save dmmulroy/bd3878d1bcaad7b2800b1d0dff083991 to your computer and use it in GitHub Desktop.

Select an option

Save dmmulroy/bd3878d1bcaad7b2800b1d0dff083991 to your computer and use it in GitHub Desktop.
Slop List API: Cloudflare design (show-me style)

Slop List API: design

An API on Cloudflare that holds the "ai slop posters" list as data and serves it to people and agents. Only Slop Lister can write to it. Anyone can read it over HTTP or MCP, and anyone can subscribe to changes.

The API never talks to X. Slop Lister stays the only thing that touches X. The API stores what Slop Lister reports.

  • Write: Slop Lister pushes entries and an hourly snapshot using a bearer token.
  • Read: public GET served from Workers Cache. Writes purge it by tag.
  • MCP: a stateless createMcpHandler for tools and resources. One hub Durable Object holds the subscriptions/listen streams.
  • Push: one SubscriberServer Durable Object per webhook subscriber, holding an ordered outbox, Standard Webhooks HMAC signing, and alarm-driven retries.
  • Built to cf-workflow-pool's standards: Effect HttpApi over /v1, Durable Objects as HTTP services, Alchemy v2 stack, errors.md contract.

1. System at a glance

flowchart LR
  SL[Slop Lister<br/>hourly routine + chat] -- "PUT /v1/entries/:id<br/>POST /v1/snapshots<br/>Bearer token" --> W
  SL -.->|"reads X (only Slop Lister)"| X[(X list<br/>source of truth)]
  subgraph CF[Cloudflare]
    C[[Workers Cache<br/>tag: slop-list]] --> W[SlopListApi Worker<br/>Effect HttpApi /v1 + /mcp]
    W --> L[(SlopListServer DO<br/>singleton · SQLite)]
    L -- "fanout callback" --> S1[(SubscriberServer DO<br/>sub_a)]
    L -- "fanout callback" --> S2[(SubscriberServer DO<br/>sub_b)]
    L -- "notify" --> H[(McpHubServer DO<br/>listen streams)]
    W -- "purge tag" --> C
  end
  P[People / scripts] -- "GET /v1/entries" --> C
  A[MCP clients] -- "tools, resources" --> W
  A -- "subscriptions/listen (SSE)" --> H
  S1 -- "signed POST" --> E1[Subscriber endpoint]
  S2 -- "signed POST" --> E2[Subscriber endpoint]
Loading
Piece Owns Keyed by
SlopListApi Worker Auth, parsing, cache headers, purge, MCP request handling n/a
SlopListServer DO Entries, append-only event log, subscriber registry, fan-out ListId 2116659176894071283
SubscriberServer DO One subscriber's endpoint, secret, outbox, delivery cursor SubscriptionId (sub_…)
McpHubServer DO Open MCP subscriptions/listen SSE streams HubId (hub-0, sharded later if needed)

A singleton list DO is enough. Writes arrive about hourly, plus the odd chat add. Reads almost never reach it because the cache absorbs them.


2. Data model

The key is the X user id, because handles change. Two fields describe status:

  • status is the editorial decision. It belongs to Slop Lister and Dillon.
  • xMembership is what the last snapshot saw on X.

X drops people who block Dillon. The API keeps them listed and records that X no longer shows them.

erDiagram
  ENTRY ||--o{ EVENT : "changes emit"
  ENTRY ||--o{ APPEAL : has
  SUBSCRIBER }o--o{ EVENT : "receives (via outbox)"
  ENTRY {
    XUserId userId PK
    string handleAtAdd
    Option currentHandle
    Option displayName
    Option triggerPost "id + url (Dillon's 'delete your account' reply)"
    Option targetPost "id + text"
    Instant addedAt
    Source source "auto | chat | via_cos | manual | reconcile"
    string addedBy
    Status status "active | blocked | appealed | removed"
    XMembership xMembership "present | absent | unknown"
    Option lastSeenOnXAt
    int version "seq of last change"
  }
  EVENT {
    int seq PK "monotonic, = list version"
    EventType type "entry.added | entry.updated | entry.removed"
    XUserId userId
    json entry "public projection at that seq"
    Instant at
  }
  APPEAL {
    string appealId PK
    XUserId userId
    Instant raisedAt
    Outcome outcome "pending | upheld | removed"
    Option privateNote "never public"
    Option senderEmail "never public"
  }
  SUBSCRIBER {
    SubscriptionId id PK
    SubStatus status "pending | active | failing | disabled"
  }
Loading
// domain/entry.ts (shape only)
export const XUserId = Schema.String.pipe(Schema.pattern(/^\d{1,20}$/), Schema.brand("XUserId"));
export const EntryStatus = Schema.Literals(["active", "blocked", "appealed", "removed"]);
export const EntrySource = Schema.Literals(["auto", "chat", "via_cos", "manual", "reconcile"]);
export class PublicEntry extends Schema.Class<PublicEntry>("PublicEntry")({
  userId: XUserId, handleAtAdd: Handle, currentHandle: Schema.Option(Handle),
  displayName: Schema.Option(Schema.String), triggerPost: Schema.Option(PostRef),
  targetPost: Schema.Option(TargetPost), addedAt: Schema.DateTimeUtc, source: EntrySource,
  status: EntryStatus, xMembership: XMembership, appeals: Schema.Array(PublicAppeal), version: Seq,
}) {}

Two rules:

  • PublicEntry never contains appeal sender emails or private notes. The private view needs the token.
  • A write that changes nothing (same fields, same status) emits no event and triggers no purge. Repeated pushes therefore cost nothing.

Status transitions:

stateDiagram-v2
  [*] --> active : add
  active --> blocked : re-add 403 reported
  blocked --> active : add succeeds again
  active --> appealed : appeal received
  appealed --> active : Dillon keeps them
  appealed --> removed : Dillon removes
  active --> removed : Dillon removes
  removed --> active : re-added
Loading

The API records decidedBy on removed. Checking that the decision came from Dillon is Slop Lister's job. The API trusts its token.


3. Endpoints

All routes live under /v1, per the standards. Write routes require Authorization: Bearer <SLOP_LISTER_TOKEN>.

Method Path Auth Purpose Cache
GET /v1/entries public Full list (status != removed), { version, entries }, ETag "v<seq>" Workers Cache, tag slop-list
GET /v1/user-ids public text/plain, one active user id per line same
GET /v1/entries/:userId public One entry plus public history tag slop-list
GET /v1/changes?since=<seq>&limit= public Events after seq, { events, next, version } tag slop-list
PUT /v1/entries/:userId token Idempotent upsert of one entry bypass, then purge
PATCH /v1/entries/:userId/status token { status, reason, decidedBy } bypass, then purge
POST /v1/entries/:userId/appeals token Record an appeal (later phase) bypass, then purge
POST /v1/snapshots token Full X-list snapshot, reconcile bypass, then purge
POST /v1/subscriptions public, rate-limited Create a webhook subscriber. Returns secret and management token once none
GET / DELETE /v1/subscriptions/:id management token Status and stop none
POST /v1/subscriptions/:id/rotate-secret management token New secret, with a 24h overlap none
POST /v1/subscriptions/:id/resume management token Retry a disabled subscriber none
POST /mcp public MCP Streamable HTTP, stateless 2026-07-28 none

Notes:

  • I used PUT /v1/entries/:userId instead of the POST /entries from the brief. The id is in the path, so a replay is idempotent by construction.
  • A token on a GET returns the private projection. Requests that carry Authorization bypass Workers Cache automatically.

4. Write path

sequenceDiagram
  autonumber
  participant SL as Slop Lister
  participant W as SlopListApi Worker
  participant L as SlopListServer DO
  participant C as Workers Cache
  participant S as SubscriberServer DO (each)
  participant H as McpHubServer DO
  SL->>W: PUT /v1/entries/123 (Bearer)
  W->>W: verify token (constant-time), decode payload once
  W->>L: PUT /v1/entries/123 (DO HttpApi)
  L->>L: txn: upsert entry, append event seq=N,<br/>schedule fanout(N)
  L-->>W: 200 { entry, changed: true, version: N }
  W->>C: purge({ tags: ["slop-list"] })
  W-->>SL: 200 { entry, version: N }
  Note over L: fanout callback (alarm, at-least-once)
  L->>S: POST /v1/events { seq: N, ... } (idempotent on seq)
  L->>H: POST /v1/notify { uri: "slop://list" }
  S->>S: txn: append to outbox, schedule deliver
Loading

Fan-out runs inside a durable Alchemy.makeCallback that is scheduled in the same SQLite transaction as the write. A crash after the commit still fans out. Subscriber and hub calls dedupe on seq, so a retried fan-out repeats nothing.

The Worker purges after the DO confirms the write and before it answers, so Slop Lister reads its own write. If the purge fails, the write still succeeds and the failure is logged. Cache TTLs (section 6) cap how long stale data can live.


5. Reconcile (hourly snapshot)

Slop Lister reads the X list with get_lists_members and pushes the full member set. The X list is the source of truth for membership. The API's own fields (status, history) are never overwritten by an absence.

POST /v1/snapshots { snapshotId, takenAt, listId, members: [{ userId, handle, displayName }], force? }

reconcile(snapshot):
  if snapshot.takenAt <= lastSnapshot.takenAt      -> 409 stale_snapshot
  seen    = set(snapshot.members.userId)
  listed  = entries where status != removed
  missing = listed where xMembership == present and userId not in seen
  if not force and |missing| > max(5, 20% of listed) -> 409 snapshot_looks_truncated
  txn:
    for m in snapshot.members:
      if no entry      -> insert { source: reconcile, status: active }   emit entry.added
      else             -> set currentHandle, displayName, xMembership=present, lastSeenOnXAt
                          (emit entry.updated only if something public changed)
    for e in missing   -> xMembership = absent                           emit entry.updated
    lastSnapshot = snapshot; schedule fanout for each new seq
  return { added, updated, markedAbsent, version }
  • The truncation guard protects against a tool error or empty page that would otherwise mark the whole list absent. A real mass drop gets resent with force: true.
  • Blocked accounts: X drops them and they land as xMembership: absent. Their editorial status stays active until Slop Lister reports a 403 on re-add, which sets blocked. They stay on the public list either way.
  • Seeding: the first snapshot creates the 47 live members. A one-off import then maps state.json handles to ids from that snapshot to fill source, the removed record, and appeals. Handles that don't match get logged for manual review rather than guessed.

6. Read path and cache

sequenceDiagram
  participant U as Reader
  participant C as Workers Cache (tiered)
  participant W as Worker
  participant L as SlopListServer DO
  U->>C: GET /v1/entries (If-None-Match: "v41")
  alt hit and fresh
    C-->>U: 304 or 200 from edge (Worker not invoked)
  else miss or purged
    C->>W: one collapsed request per key per colo
    W->>L: GET /v1/entries
    L-->>W: { version: 42, entries }
    W-->>C: 200 + cache headers
    C-->>U: 200
  end
Loading

Headers on public reads:

Cache-Control: public, max-age=60, s-maxage=300, stale-while-revalidate=60
Cache-Tag: slop-list
ETag: "v42"
Vary: Accept-Encoding

Choices:

  • Workers Cache, not caches.default. The new cache sits in front of the Worker, uses tiers and request collapsing, and purges by tag globally. The legacy Cache API only works per colo and can't purge globally, so it would leave stale copies behind.
  • Enabling it. Call yield* Cloudflare.cache() in the Worker init (Alchemy beta.84). It returns the runtime purge client.
  • Purge on every write that changes something, one tag. Reconcile purges once per call, not once per entry. Writes come roughly hourly, far under the Free-tier purge rate limit that Workers Cache always uses.
  • s-maxage=300 is the backstop if a purge fails. The edge serves data at most about 5 minutes stale.
  • /v1/changes?since=. Each cursor is its own cache key, since query strings stay in the key. Every cursor variant shares the slop-list tag, so one purge clears them all.
  • Deploys. Cache keys include the Worker version by default, so each deploy starts cold. That stays the default so a schema change can never serve an old shape.
  • Authed and MCP routes send Cache-Control: private, no-store. Requests with Authorization bypass the cache anyway.

7. MCP

A public, read-only server at https://<host>/mcp. It uses the Agents SDK ≥0.20 createMcpHandler(factory) (MCP 2026-07-28, stateless, no protocol session). Legacy Streamable HTTP clients work on the same route.

Kind Name Input → output
tool list_members { status?, cursor?, limit? } → page of PublicEntry
tool is_listed { userId } or { handle } → { listed, entry? }. Matches currentHandle, then handleAtAdd
tool get_entry_history { userId } → events for that user
tool changes_since { cursor } → events after the cursor, plus a new cursor
resource slop://list full public list (same body as GET /v1/entries)
resource slop://entries/{userId} one entry
notification notifications/resources/updated uri: slop://list after any change
notification notifications/resources/list_changed when an entry resource appears or disappears

The tools call the same cached GET /v1/... routes through a loopback fetch, so MCP reads are served from the edge as well.

Events. The Cloudflare handler's notify.* is isolate-local. It reaches only listen streams owned by the same handler instance. A notify from whichever isolate handled a write would miss most listeners, so the Worker sends listen requests to one hub Durable Object:

Worker.fetch(req):
  if path == "/mcp" and header("Mcp-Method") == "subscriptions/listen":
      return McpHubServer("hub-0").fetch(req)          // SSE stream lives in the hub
  if path == "/mcp":
      return statelessHandler(req, env, ctx)            // tools, resources: any isolate
  return httpApi(req)

McpHubServer:                                          // one instance owns all streams
  handler = createMcpHandler(createServer, { keepAliveMs: 15_000, maxSubscriptions: 1024 })
  POST /mcp        -> handler(req)
  POST /v1/notify  -> handler.notify.resourceUpdated(uri); handler.notify.resourcesChanged()

What this means:

  • No replay. The 2026-07-28 spec has no Last-Event-ID replay. Clients reopen streams that end and should call changes_since with their last cursor to catch up. Webhooks are the delivery path that guarantees each event arrives.
  • Cost. SSE can't hibernate, so the hub stays active while anyone listens. That is one Durable Object's duration charge. Shard by hashing a client identifier past about 1,000 streams.
  • Standards exception. /mcp on the hub is a raw passthrough route, not a typed HttpApi endpoint. /v1/notify stays HttpApi. This is the one documented exception to the DO HTTP boundary rule.

8. Webhooks: one Durable Object per subscriber

sequenceDiagram
  autonumber
  participant C as Caller
  participant W as Worker
  participant L as SlopListServer
  participant S as SubscriberServer(sub_x)
  participant E as Endpoint
  C->>W: POST /v1/subscriptions { url, events }
  W->>W: validate URL (https, public host, not our host), rate-limit per IP
  W->>S: POST /v1/init { url, events }
  S->>S: generate whsec_ secret + management token (store hash only)
  S->>E: signed "subscription.verify" ping
  E-->>S: 2xx
  S->>L: register sub_x (status active, from seq = current)
  W-->>C: 201 { id, secret, managementToken }  (shown once)
Loading

Per-subscriber state, in that subscriber's own SQLite:

  • config: url, event filter, status, current and previous secret (previous kept 24h after rotation), management-token hash.
  • outbox: (seq PK, type, body, attempts, nextAttemptAt).
  • cursor: lastDeliveredSeq.

Delivery loop. A deliver callback (Alchemy.makeCallback) sits on the DO's native alarm:

enqueue(event):                          // from list fanout, idempotent
  if event.seq <= max(outbox.seq, cursor): return
  txn: insert outbox; deliver.schedule("head", { after: 0 })

deliver():                               // at-least-once; failures back off
  head = outbox order by seq limit 1;  if none: return
  body = JSON(head); id = "evt_" + head.seq; ts = now()
  sig  = "v1," + b64(HMAC_SHA256(secret, id + "." + ts + "." + body))   // + previous secret during rotation
  res  = fetch(url, POST, body, headers{ webhook-id: id, webhook-timestamp: ts, webhook-signature: sig }, timeout 10s)
  2xx   -> txn: delete head; cursor = head.seq; failures = 0; if more: deliver.schedule("head", { after: 0 })
  410   -> status = disabled; tell list DO to unregister
  else  -> fail  (callback retry: exponential from 30s, parks after 8 attempts, hourly recovery)
  parked > 72h -> status = disabled (resume via POST /v1/subscriptions/:id/resume)

Design choices:

  • Ordered per subscriber. The head of the queue blocks what follows it. Volume is a few events an hour, so strict order is cheap, and subscribers can apply events without sorting them.
  • The DO is the isolation unit. A slow or dead endpoint only delays its own outbox. The list DO's fan-out does an enqueue call and returns.
  • Signing follows Standard Webhooks. Most webhook libraries can verify it. Receivers check the signature against a 5-minute timestamp tolerance and dedupe on webhook-id.
  • Fat payloads. The body carries the event type, seq, and the PublicEntry. A subscriber never has to call back.
  • Queues later. With hundreds of subscribers, fan-out would move to a Cloudflare Queue: list DO → queue → consumer → subscriber DOs. That isn't needed at launch.

9. Auth and secrets

Secret Where it lives Use
SLOP_LISTER_TOKEN Worker secret_text via Config.Redacted("SLOP_LISTER_TOKEN"), set at deploy Write routes and the private projection
SLOP_LISTER_TOKEN_NEXT Optional second binding Zero-downtime rotation: both are accepted, then the old one is removed
Subscriber whsec_ secret That subscriber's DO SQLite, returned once HMAC signing
Management token SHA-256 hash in the subscriber DO Manage a single subscription
// http/auth.ts (shape)
export class SlopListerAuth extends HttpApiMiddleware.Service<SlopListerAuth>()("SlopListerAuth", {
  provides: CurrentWriter, failure: Unauthenticated, security: { bearer: HttpApiSecurity.bearer },
}) {}
// handler: digest(presented) vs digest(Redacted.value(token)) with crypto.subtle.timingSafeEqual
  • The token is never logged and never echoed. A 401 response says only that the request could not be authenticated.
  • The token must be stored somewhere Slop Lister's routines can read without printing it. See open questions.
  • Writes record addedBy / decidedBy from the payload and the authenticated writer. That gives an audit trail if the token ever leaks.

10. Code and Alchemy layout

One app with no packages: there is one consumer, and the standards create a package only at two.

apps/dev.mulroy.slop/api/          # @iac/dev.mulroy.slop-api (if it lives in iac)
├── alchemy.run.ts                 # Stack: SlopList
├── vite.config.ts                 # dev / plan:production / deploy:production / destroy:production (cache: false)
├── src/
│   ├── worker.ts                  # SlopListApi Worker, composition root, routes /v1 + /mcp
│   ├── http/{api,handlers,errors,auth,request-id,cache-headers}.ts
│   ├── domain/{entry,event,snapshot,subscription}.ts     # schemas, branded ids, parsers, diff
│   ├── list/{list-api,list-server,list-client,migrations}.ts
│   ├── subscriber/{subscriber-api,subscriber-server,subscriber-client,signing,url-policy}.ts
│   └── mcp/{create-server,mcp-hub-server,mcp-hub-client}.ts
└── test/                          # behavior tests over HttpApi with *TestLayer fakes

Names follow the client/server rule: ISlopListClient / SlopListClient / SlopListServer, the same for Subscriber* and McpHub*. Each client is built per invocation with makeExecutionMemo and an Effect Cache keyed by the branded id.

SlopListApi.fetch
├── HttpApi /v1/entries*      → SlopListerAuth? → ListHandlers → SlopListClient(ListId) → SlopListServer
│                               └─ on write: CacheControl.purge(["slop-list"])
├── HttpApi /v1/snapshots     → SlopListerAuth → SlopListClient.reconcile
├── HttpApi /v1/subscriptions → UrlPolicy → SubscriberClient(SubscriptionId).init
└── /mcp                      → listen? McpHubClient("hub-0").fetch : statelessMcpHandler
SlopListServer.fanout(seq)    → SubscriberClient(id).enqueue × active subs; McpHubClient.notify
// alchemy.run.ts (shape)
export class SlopListApi extends Cloudflare.Worker<
  SlopListApi, {}, SlopListServer | SubscriberServer | McpHubServer
>()("SlopListApi") {}

export const slopListApiLayer = SlopListApi.make(
  { main: import.meta.url, domain: SLOP_LIST_HOST /* stage-qualified outside production */ },
  Effect.gen(function* () {
    const { purge } = yield* Cloudflare.cache();               // enables Workers Cache + purge client
    const writerToken = yield* Config.Redacted("SLOP_LISTER_TOKEN");
    return { fetch: makeRouter({ purge, writerToken }) };
  }).pipe(Effect.provide(Layer.mergeAll(slopListClientLayer, subscriberClientLayer, mcpHubClientLayer))),
);

export default Alchemy.Stack(
  "SlopList",
  { providers: Cloudflare.providers(), state: Cloudflare.state() },
  Effect.gen(function* () {
    const api = yield* SlopListApi;
    return { url: api.url };
  }).pipe(Effect.provide(slopListApiLayer)),
);

Infra rules carried over:

  • Production and preview stages each get isolated Durable Object namespaces and a stage-qualified host.
  • plan:production runs before every deploy. Any replace or delete in the plan stops the deploy, since replacing a DO namespace wipes the list.

11. Errors

All errors follow errors.md. The public envelope is { code, message, details, requestId, retryable }. Each tag gets translated explicitly with catchTags.

Tag HTTP code retryable Example message
Unauthenticated 401 unauthenticated false "This request could not be authenticated. Send the Slop Lister token as a Bearer token."
InvalidEntry 400 invalid_entry false "The entry for user 123 was not saved because addedAt is not an ISO-8601 time." details.violations[]
EntryNotFound 404 entry_not_found false "No entry exists for user 123. Check the id, or add the account first."
InvalidStatusTransition 409 invalid_status_transition false "User 123 is already removed, so it can't move to appealed. Re-add the account first."
StaleSnapshot 409 stale_snapshot false "This snapshot was taken before the last one applied, so nothing changed. Send a newer snapshot."
SnapshotLooksTruncated 409 snapshot_looks_truncated false "The snapshot would mark 40 of 47 listed accounts as absent from X, so it was not applied. If the X list really shrank, resend with force: true."
WebhookUrlRejected 400 webhook_url_rejected false "The webhook URL was rejected because it isn't HTTPS. Use an https:// URL on a public host." details.reason
WebhookVerificationFailed 400 webhook_verification_failed true "The endpoint returned 500 to the verification ping, so the subscription was not created. Fix the endpoint and try again."
SubscriptionNotFound 404 subscription_not_found false "No subscription sub_x exists, or the management token does not match."
SubscriptionLimitReached 409 subscription_limit_reached false "This API has reached its subscriber limit. Use MCP or poll /v1/changes instead."
ListUnavailable 503 list_unavailable true "The list store is temporarily unavailable. Retry in a few seconds. Nothing was changed."

Notes:

  • "Nothing was changed" appears only where it is provably true: when the DO rejected the request before its transaction.
  • Database errors that are not part of the contract stay Effect.die and surface as 500 with a requestId.

12. Failure modes

Failure What happens Mitigation
Slop Lister crashes mid-run Some writes landed Every write is idempotent. The next run replays safely, and unchanged writes emit nothing
X tool returns a partial member page Reconcile would mark people absent Truncation guard returns 409. Resend with force only after checking
Purge fails or hits a rate limit Edge serves stale data Write already committed. s-maxage=300 caps staleness, and the next write purges again
Cache stampede after a purge Many misses at once Request collapsing per key per colo, plus the tiered cache. The DO sees about one read per colo
List DO restarts during fan-out Fan-out interrupted Fan-out is a durable callback scheduled in the write transaction. Enqueue dedupes on seq
Subscriber endpoint down Its outbox grows Backoff, park after 8 attempts, disable after 72h. Other subscribers are unaffected
Duplicate webhook delivery Receiver sees an event twice Stable webhook-id = evt_<seq>. Receivers dedupe on it
Webhook URL points inward SSRF attempt HTTPS only. Reject IP literals, localhost, *.internal, and our own host
MCP listen stream drops (deploy, eviction) Client misses events Clients reopen. changes_since catches up from their cursor
Token leaks Someone can write Rotate with _NEXT. The audit trail on events supports rollback with PATCH .../status
Account renames Handle lookups miss Keyed by user id. Snapshots refresh currentHandle, and is_listed checks both handles
PII in appeals Emails could leak Public projection excludes them, with a test that serializes every public route and asserts no @ addresses

13. Rollout

  1. Scaffold.
    • Stack, preview stage, and plan:production.
    • Store with PUT, PATCH, and GET. No webhooks yet.
  2. Seed.
    • Slop Lister posts one snapshot of the 47 live members.
    • A one-off import maps state.json handles to ids and fills source, the removed record, and appeals.
    • Unmatched handles go into a review list.
  3. Dual-write.
    • Slop Lister calls the API after each successful add_lists_member and after each 403 (blocked).
    • It runs a snapshot at the end of every hourly run.
    • state.json stays its dedupe source for now.
  4. Public read. Turn on the custom domain and Workers Cache, then check purge and staleness against the deployed host.
  5. MCP. Stateless tools and resources first, then the hub plus subscriptions/listen.
  6. Webhooks. Subscriber DOs, verification ping, and signing test vectors. Open to a few known subscribers before going self-serve.
  7. Appeals intake (later). The twice-daily email routine posts appeals. Dillon's decision drives PATCH .../status.
  8. Optional. Slop Lister dedupes against is_listed instead of state.json.

14. Open questions

  1. Home and host. Should this live in dmmulroy/iac under apps/dev.mulroy.slop/api, serving slop.mulroy.dev, or in its own repo that copies cf-workflow-pool's standards?
  2. Who can subscribe. Self-serve and rate-limited, as designed, or only by invitation (subscriptions created with the Slop Lister token)?
  3. What counts as listed. Should the public list include blocked and appealed accounts? The draft says yes: everything except removed.
  4. Post text. Should targetPost.text be public, or only the post id and URL? It quotes someone else's post, which may later be deleted.
  5. "MCP events/triggers." I read this as subscriptions/listen plus resources/updated, with webhooks as the delivery path that guarantees arrival. Is there a specific client or trigger spec you meant?
  6. Token storage. Where should Slop Lister's routines read SLOP_LISTER_TOKEN from without exposing it? The vault, or a box file readable only by that bot?
  7. Alchemy version. Cloudflare.cache(), Worker.cache, and Alchemy.makeCallback are confirmed in beta.84 (iac), not in beta.81 (workflow pool). Pin beta.84 or later.
  8. Removal authority. Should PATCH status=removed require a second factor, such as a separate admin token that only Dillon holds? That would keep removal on Dillon's say even if Slop Lister's token leaks.

Research notes: Slop List API

Gathered 2026-11-01 (SAST). These notes feed DESIGN.md.

1. Repo

  • dmmulroy/cf-workflow-pool (https://github.com/dmmulroy/cf-workflow-pool), cloned to /workspace/cf-workflow-pool, HEAD 73e0f2f.
  • Docs read: docs/coding-standards.md, docs/errors.md, AGENTS.md, docs/vite-plus.md.
  • Code read for Alchemy patterns: apps/*/alchemy.run.ts, the DO server and client files, and benchmarks-trace-telemetry.ts.
  • Not chosen:
    • cloudflare-workflow-pool: design notes only.
    • wf-pool: older.
  • Toolchain:
    • Effect 4.0.1, alchemy 2.0.0-beta.81, @effect/sql-sqlite-do.
    • vite-plus 1.1.0 (vp), pnpm 12, TS 7.
    • ready = vp check && vp run -r test.
  • Lint, set to error:
    • consistent-type-assertions ("never")
    • no-explicit-any, no-non-null-assertion, no-unsafe-type-assertion
    • prefer-vite-plus-imports
    • typeAware and typeCheck are both on.
  • Also relevant: dmmulroy/iac (/workspace/iac) owns the mulroy.dev zones. Its rules:
    • Apps go in apps/<reverse-dns-host>/<role>.
    • Adopt resources, never recreate them.
    • Any planned replace or delete is a stop.
    • It is on alchemy 2.0.0-beta.84, with the Cloudflare provider split into @alchemy.run/cloudflare.

2. Coding standards (docs/coding-standards.md), brief quotes and paraphrase

  • Boundaries
    • Apps never import other apps, and packages never import apps.
    • Create a package only once there are two consumers.
  • Environment-isolated infra
    • Every stage gets its own resources.
    • The shared stack is deployed first and destroyed last.
    • Non-prod resource names are stage-qualified.
  • Parsing: "parse unknown input once at the adapter boundary"
    • Use a private Schema.decodeUnknownEffect behind domain-named unary parsers.
    • Never widen to unknown and cast back.
    • as unknown as is allowed only as a documented // SAFETY: assertion with a Verified by: line.
  • Optionals: use Option.Option<A> inside the app, with no null, undefined, or ?: props.
  • DO HTTP boundary
    • "Each Durable Object is an Effect HttpApi service served via fetch." No typed Alchemy RPC.
    • Naming: IAccountClient (interface), AccountClient (Context.Service), AccountServer (Cloudflare.DurableObject).
    • Build a fresh client per invocation with makeExecutionMemo, plus an Effect Cache keyed by canonical ID, over HttpApiClient.makeWith(Api, { baseUrl: "http://x.internal", httpClient: Cloudflare.toHttpClient(ns.getByName(id)) }).
    • Key DO instances by canonical branded domain IDs.
  • Versioned endpoints: every route lives under /v1/..., with no unversioned aliases.
  • Imports
    • import { Effect, Schema } from "effect".
    • Unstable modules come through narrow entrypoints (effect/http, effect/http-api, effect/sql), never leaf modules.
  • Effect style
    • Effect.gen or Effect.fn for logic, pipe for cross-cutting concerns.
    • Translate errors with catchTag/catchTags. No catch-all, no instanceof.
  • Layers
    • Services stay in the requirement channel.
    • Order within a file: interface → service class → make<X> → xLayerWithoutDependencies → xLayer → xTestLayer.
    • Only tests import make*. No "Tag" in names.
  • OpenAPI is generated from HttpApi (vp run generate:openapi) with examples. No tests that just restate a schema.
  • JSDoc on every export.

3. Error conventions (docs/errors.md)

  • Errors are a product interface. Each one should:
    • Say what failed and why.
    • Give the next step.
    • Offer only truthful reassurance.
    • Be calm and free of blame and jargon.
  • Internal errors carry typed context:
    • operation, safe IDs, and a classified reason literal.
    • The cause, when it is safe to keep.
    • A searchable leading message.
  • Public errors have stable code, message, details, requestId, and a truthful retryable.
  • Never expose: credentials, access assertions, JWT claims, raw bodies, SQL, stacks, private causes, or vendor bodies.
  • Status codes: 400 (fixable input), 401, 404 (valid id that is unknown), 405, 409 (state conflict), 415, 500 (invariant), 503 (capability temporarily down).
  • Translation: translate every known tag explicitly. A new failure must force a classification decision.
  • 10-item checklist:
    1. What failed.
    2. The most specific safe reason.
    3. Typed context.
    4. A way forward.
    5. Truthful retry guidance.
    6. Calm tone.
    7. Searchable.
    8. requestId correlation.
    9. No secrets.
    10. No catch-all.

4. Alchemy patterns from the repo (alchemy v2 beta, Effect-native)

// Tagged error with HTTP status
export class ReservationConflict extends Schema.TaggedError<ReservationConflict>()(
  "ReservationConflict",
  { sku: Sku, message: Schema.String },
  { httpApiStatus: 409 },
) {}

// API declaration
const reserve = HttpApiEndpoint.post("reserve", "/v1/reservations", {
  payload: ReserveRequest, success: Reservation, error: [ReservationConflict, InvalidSku],
});
export class InventoryHttpApi extends HttpApi.make("InventoryHttpApi")
  .add(HttpApiGroup.make("inventory").add(reserve))
  .middleware(RequestIdMiddleware) {}

// Durable Object served over fetch
export class InventoryServer extends Cloudflare.DurableObject<
  InventoryServer, { readonly fetch: Http.HttpEffect }
>()("InventoryServer") {}
export const inventoryServerLayer = InventoryServer.make(Effect.succeed(Effect.gen(function* () {
  const state = yield* Cloudflare.DurableObjectState;
  // SqliteClient.layer({ storage: state.raw.storage }) + SqliteMigrator.fromRecord({...})
  return { fetch: HttpRouter.toHttpEffect(HttpApiBuilder.layer(InventoryHttpApi).pipe(/* handlers, Http.Platform */)) };
}).pipe(Effect.orDie)));

// Worker + Stack
export class BenchmarksDriver extends Cloudflare.Worker<BenchmarksDriver, {}, InventoryServer>()("BenchmarksDriver") {}
export default Alchemy.Stack("CfWorkflowPoolBenchmarks",
  { providers: Cloudflare.providers(), state: Cloudflare.state() },
  Effect.gen(function* () { const w = yield* BenchmarksDriver; return { url: w.url }; })
    .pipe(Effect.provide(benchmarksDriverLayer)));
  • Typed cross-stack outputs: class XStack extends Alchemy.Stack<XStack, { token: Redacted<string> }>()(NAME) {}, plus Alchemy.Stage guards.
  • Secrets: Config.Redacted("NAME") (bound as secret_text). Call Redacted.value only at the point of use.
  • Per-app vite tasks, all with cache: false:
    • dev = alchemy dev --stage local
    • deploy:production, which depends on shared-infra
    • plan:production and destroy:production
  • Tests: vite-plus/test with in-memory fakes built via Service.of({...}).

Newer Alchemy APIs that matter here

Found in iac's installed @alchemy.run/cloudflare@2.0.0-beta.84 source:

  • Worker({ cache: { enabled, crossVersionCache } }). In an Effect-native init you can instead call yield* Cloudflare.cache(), which returns { purge } for runtime tag purge.
  • Worker({ domain: "host" }) attaches a custom domain with DNS and TLS. Cloudflare.Workers.cron(expr, handler) sets up crons.
  • Alchemy.makeCallback(name, handler, { retry }) gives durable, typed DO callbacks on SQLite and native alarms:
    • At-least-once delivery.
    • Default backoff starts at 30s and parks after 8 attempts, with hourly recovery.
    • .schedule(id, { after, payload }) replaces any pending job with the same id. .cancel(id) and .getStatus(id) also exist.
    • One native alarm processes up to 100 due jobs.
  • Cloudflare.SecretsStore.ReadSecret(secret) binds a Secrets Store secret.

5. HumanLayer show-me skill

Source: humanlayer/skills → plugins/show-me/skills/show-me/SKILL.md @ bba9d13. Copy saved at show-me-SKILL.md.

  • Core instruction: "help the user understand the current topic visually… skip the preamble and keep prose brief. Pick the smallest view that makes the key point clear."
  • Allowed views:
    • pseudocode
    • call tree
    • component tree (tsx)
    • shallow file tree
    • Mermaid (sequence, flow, state, ER)
    • diffs of component, file layout, call tree, or state
    • a whole code block when most of it is new
    • a focused HTML file for dense visuals
  • Rules:
    • Put each visual next to the short text it supports.
    • Keep only the calls, files, and boundaries that matter.
    • Use one or a few views, never all of them.
  • There is no fixed section template. The structure is "short claim, then the smallest visual", repeated.

6. Cloudflare primitives

Primitive What matters for us Docs
Workers Cache (new) Tiered cache in front of the Worker. Hits never invoke it. Set up with Cache-Control, Cache-Tag, Vary, and stale-while-revalidate. Has request collapsing. ctx.cache.purge({ tags }) is a global instant purge with Free-tier purge rate limits. The cache key is path + entrypoint + props + Worker version unless crossVersionCache. No host purge, no pre-warm. https://developers.cloudflare.com/workers/cache/ · /workers/cache/purge/ · /workers/cache/limitations/
Legacy Cache API (caches.default) Per-colo only. delete is local, and there is no tiering, collapsing, or SWR. Rejected for this design. https://developers.cloudflare.com/workers/runtime-apis/cache/
DO SQLite + alarms Single-threaded, strongly consistent store. One alarm per object, retried with exponential backoff starting at 2s, up to 6 retries (retryCount, isRetry). Alchemy's makeCallback multiplexes jobs onto that alarm. https://developers.cloudflare.com/durable-objects/api/base/ · /durable-objects/api/alarms/
MCP (2026-07-28 spec) Agents SDK ≥0.20 createMcpHandler(factory) is stateless and needs no DO. McpAgent is deprecated. List and resource changes stream via subscriptions/listen, a POST that returns SSE. handler.notify.resourceUpdated(uri) is available. Notifications are isolate-local and only reach streams owned by the same handler instance. No Last-Event-ID replay, and clients reopen streams that end. maxSubscriptions defaults to 1024 and the keepalive to 15s. Mcp-Method request header. https://developers.cloudflare.com/agents/model-context-protocol/apis/handler-api/ · /guides/migrate-to-mcp-sdk-v2/ · /changelog/post/2026-07-27-agents-sdk-v0.20.0-mcp-sdk-v2/
Queues At-least-once delivery, 3 retries by default (max 100), retry_delay, DLQ, batches up to 100, 128 KB messages. A lever for scale, not needed at launch. https://developers.cloudflare.com/queues/configuration/dead-letter-queues/ · /queues/platform/limits/
Webhook signing Standard Webhooks headers webhook-id, webhook-timestamp, and webhook-signature: v1,<b64 HMAC-SHA256(id.ts.body)>. 5-minute tolerance, space-separated multi-signatures for rotation, constant-time compare. https://www.standardwebhooks.com/ (spec), from prior knowledge

7. Ambiguities found during research

  • The workflow pool pins alchemy beta.81, and iac uses beta.84. I verified makeCallback, Worker.cache, and Cloudflare.cache() only in beta.84.
  • "MCP events/triggers" has no exact counterpart in the 2026-07-28 spec. The closest primitives are subscriptions/listen plus notifications/resources/updated.
  • Workers Cache key and query strings: the limitations page lists "ignore query string" as a zone setting that Workers Caching does not offer, which implies query strings stay in the key. Requests that carry Authorization bypass the cache automatically. ctx.cache.invalidate() marks entries stale so they revalidate with a 304, and cache can be imported from cloudflare:workers for purges where ctx is not in scope. Still to verify on a deploy: that ?since= variants are cached separately.

Slop Lister: how it works (brief relayed by Conductor, Nov 1 2026)

Source: Slop Lister's own description, forwarded by the parent agent. Close paraphrase, not a transcript.

Job

  • Maintains Dillon's public X List "ai slop posters": list id 2116659176894071283, owner @dillon_mulroy (uid 384666406).

How accounts get added

  1. Hourly routine: searches from:dillon_mulroy "delete your account".
    • Target = the post's in_reply_to_user_id. Skip when missing or self. Never guess the target from mentions.
    • Dedupe with get_lists_members plus its own state file.
    • Adds via add_lists_member. This is the only X write it is allowed to make.
  2. Chat: Dillon pastes links in chat.
  3. Via CoS: Chief of Staff forwards "@bot add ... slop list" posts.

Appeals

  • Inbox: ai-slop-list@mail.grokbot.com, checked by a twice-daily routine.
  • Removal happens only when Dillon says so.

Desired entry shape

user_id (key), handle at time of add, display name, trigger post id/url, target post id/text, added_at, source (auto | chat | via_cos | manual), added_by, status (active | blocked | removed | appealed), appeal history.

Pain points

  • X silently drops members who block Dillon. Re-adding them returns 403.
  • Adds of suspended or deleted accounts fail.
  • The live list has 47 members, and about 19 manual adds are missing from state. The X list is the source of truth, so the API needs an hourly full-snapshot reconcile endpoint.
  • Muting is not possible.
  • X tool rate limits: 30/min and 1000/day.

What it wants from the API

  • Authenticated, idempotent POST /entries: upsert on user_id, plus status updates.
  • Authenticated reconcile/snapshot push.
  • Public GET of the full list, edge-cached, with an ETag and a since cursor. Two formats: JSON and plain user ids.
  • Public MCP: list_members, is_listed(user_id|handle), entry history.
  • Webhooks and MCP events for entry.added / entry.removed, HMAC-signed.
  • Appeal intake later.
  • The API must never act on X itself.

Live state (read-only snapshot of /home/box/agent-data/shared/slop-lister/state.json, 2026-11-01)

Top-level keys and their shape:

  • list_id (string)
  • last_seen_post_id (string): the search cursor
  • added: 29 entries, handles only
  • skipped: 2 entries, {handle, reason}. Example reason: "403 block"
  • last_run: local-time string ("2026-11-01 09:54 America/New_York")
  • appeals_seen: 3 entries, {thread_id, sender, handle, date, raised, status, note}
  • removed: 1 entry, {handle, user_id, date, reason}

Seeding consequences:

  • added carries handles with no user ids, so the import has to resolve ids from a live list snapshot.
  • Appeals are keyed by handle and email thread, not user id.
  • Appeal records include sender email addresses. They are personal data and must not appear in any public endpoint.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment