Skip to main content
Build your own Reddit engagement loop. The discovery loop metalworks ships is one opinionated assembly — every step is a public function you can call, replace, or reorder, so you can wire your own filter, voice, compliance rules, and storage into your own product.
This page is about composing the Reddit engagement / discovery loop yourself. Turning a demand report into a build spec for your coding agent is a different capability — see Build spec.

The loop, unbundled

run_discovery is essentially this, and each line is yours to swap:
The same three building blocks are on the facade as mw.discovery.filter(...) and mw.discovery.generate(...).

Bring your own pieces

  • Your own filter. filter_post is a convenience over a complete_structured call. Replace it with your own classifier, a keyword rule, or an embedding score — draft_reply doesn’t care how a post was selected.
  • Your own voice. DiscoveryContext + Persona carry voice guidelines, winning examples, pinned notes, an avoid-list, and per-account-type personas. This is the seam a memory system renders into.
  • Your own compliance. heuristic_check is deterministic and offline. Wrap it, extend it, or replace it with your own rules — then escalate to llm_judge only when you want a model’s second opinion.
  • Your own storage. Persist Opportunity objects wherever you like via the OpportunityRepo protocol (see Bring your own store).
  • Your own action. metalworks never posts unless you call RedditOAuth.post_comment (or mw.reddit.post). Queue drafts for human review, post to Slack, write to a DB — the gate hands you a vetted draft and stops.

Adaptive loops

run_discovery also exposes the seams an adaptive product needs without baking in a memory system or a database:
  • query_performance: Callable[[str], float] — rank queries by your own metric.
  • on_query_result: Callable[[str, int, int], None] — write back per-query metrics.
  • OpportunityRepo.opportunity_exists(url) — dedup so a seen post never re-burns two LLM calls.
Wire those to your store and you have the skeleton of a self-improving engagement product. metalworks gives you the building blocks; you compose them.

Verify your custom pieces

See Custom ChatModel and Bring your own store for the conformance details.