Team contribution to sunstead hack in Levi, Finland.
README.md

Slopgotchi #

A public AI-slop accountability pet for Tangled. Join a team "zoo," and your Tangled pull requests get scored for slop — careless overbuild, weak tests, scope sprawl — by an open model on Featherless. The score and a receipt are written as public ATProto records, and a tamagotchi-style pet renders whose health is a rolling average of your recent slop.

Slopgotchi scores carelessness, not authorship. It does not try to detect whether AI was used, and it is not a merge gate — it's a public accountability signal that lives on-protocol.

Architecture #

Three layers (see docs/plans/2026-06-24-001-feat-slopgotchi-plan.md):

  • Protocol (truth): app.slopgotchi.diagnostic (one per scored PR round) and app.slopgotchi.pet.state (one per developer) records on the service account's ATProto repo. World-readable; any client can re-render a pet from them.
  • Pipeline (compute): resolve handle → DID → PDS, listRecords the sh.tangled.repo.pull records, gunzip the inline patch blob, score on Featherless, write records, recompute health. Triggered by join (backfill) and by cron (ongoing) — one idempotent loop keyed on (PR, round).
  • App (experience): the Next.js zoo UI and join flow.

Stack #

  • Next.js (App Router) on Vercel
  • Upstash Redis — the single datastore (idempotency, registry, cached pet state)
  • Featherless (OpenAI-compatible) for inference
  • @atproto/api + @atproto/identity for protocol reads/writes
  • Zod for record/score validation, Vitest for tests

Local setup #

npm install
cp .env.example .env.local   # fill in the values below
npm run dev

Environment #

Var Purpose
UPSTASH_REDIS_REST_URL / _TOKEN Upstash Redis. Run vercel install upstash to provision and auto-inject.
FEATHERLESS_API_KEY Featherless inference.
FEATHERLESS_MODEL Optional model override (default Qwen/Qwen2.5-7B-Instruct; Qwen2.5-Coder-32B is higher quality but often capacity-queued).
SLOPGOTCHI_PDS PDS host for the service account (e.g. https://bsky.social).
SLOPGOTCHI_IDENTIFIER Service account handle or DID.
SLOPGOTCHI_APP_PASSWORD App password for the service account (never the main password).
CRON_SECRET Bearer secret required by the cron poll route.
MAX_BACKFILL_ROUNDS Rounds backfilled synchronously per join (default 25).
CRON_MAX_DIDS DIDs processed per cron invocation (default 10).

Tests run without any of these — unit tests use mocks, and integration tests skip when their required env vars are absent.

Testing #

npm test          # vitest run
npm run typecheck # tsc --noEmit
npm run build     # next build

Deploy #

vercel install upstash   # provisions Redis + injects UPSTASH_* env
vercel --prod

Set the remaining env vars in the Vercel dashboard (or vercel env add).

Cron / "keeps watching" #

vercel.json ships a once-daily cron (Hobby-safe). Per-minute polling needs one of:

  • Vercel Pro: change the crons schedule in vercel.json to * * * * * and raise export const maxDuration in the route files to 300.
  • Hobby: point an external scheduler (cron-job.org / QStash) at GET /api/cron/poll every ~60s with header Authorization: Bearer $CRON_SECRET.

Idempotency on (PR, round) makes repeated/overlapping invocations safe.