Skip to content

MohitGoyal09/ModThread

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mod Thread

Mod Thread is a Reddit Devvit moderation app built for the Reddit Mod Tools and Migrated Apps Hackathon in the Best New Mod Tool category.

It helps moderators handle heated local or city subreddit threads by turning a messy comment branch into a shared case room: branch weather, evidence trail, context-pin draft, and reusable precedent records in one moderator-focused workflow.

Submission Summary

Problem: Moderators often lose time re-reading long comment branches, reconstructing what another mod already checked, and explaining why a moderation decision was made.

Solution: Mod Thread gives mod teams an operational case room for a thread. Mods can see the current thread weather, preserve context in a Mod Trail, draft a public context pin, and save an internal precedent card for future similar incidents.

Category: Best New Mod Tool.

Ported app: Not applicable. This is a new Devvit app, not a Data API bot port.

Primary demo: A seeded local-market rumor thread, where moderators identify a fast-moving branch, request a source, add city-clerk context, draft a context pin, and save a Local Rumor precedent.

Repository Layout

.
├── README.md
├── mod-thread/
│   ├── devvit.json
│   ├── package.json
│   ├── src/
│   │   ├── client/          # React custom-post UI
│   │   ├── server/          # Hono API, Devvit server code, repositories
│   │   └── shared/          # API and domain types
│   └── tests/               # Vitest coverage
├── docs/
│   └── superpowers/
│       ├── specs/           # product/design spec
│       └── plans/           # implementation plan
└── .github/
    └── dependabot.yml

Main app README:

Planning docs:

Product Capabilities

Thread Weather

Thread Weather summarizes the active branch state using deterministic signals and explainable reason codes.

Supported weather states:

  • calm
  • warming
  • flame_pocket
  • report_spike
  • missing_context
  • helpful_correction
  • cooldown_needed

Example reason codes:

  • fast_reply_branch
  • missing_source_context
  • multiple_reports
  • repeated_question
  • helpful_correction_present
  • mod_action_seen

The MVP intentionally avoids opaque AI moderation scoring. The goal is explainable triage, not automated enforcement.

Mod Trail

Each hotspot has a shared mod-authored trail. A moderator can record:

  • origin marker
  • evidence added
  • source/context request
  • ownership handoff
  • context-pin draft event
  • resolution
  • precedent saved

This helps later moderators understand what happened without rereading the whole branch.

Context Pin Draft

Mods can maintain a public-facing draft for verified context. The current implementation stores the draft and keeps it in the case room; a future production pass can add an explicit final confirmation flow that posts or pins it to Reddit.

Precedent Cards

A precedent card saves internal moderation memory:

  • rule tag
  • context summary
  • decision
  • rationale
  • future guidance

This helps teams respond consistently to repeated local rumors, source gaps, or heated civic threads.

Seeded Demo

The app ships with a deterministic demo case:

  • post id: t3_market_rumor_demo
  • scenario: weekend market closing rumor
  • hotspot anchor: t1_market_origin
  • thread weather: flame_pocket
  • context pin includes an official city source
  • precedent rule tag: Local Rumor

The demo makes the app useful immediately in a Devvit playtest environment, even without live Reddit reports.

Architecture

flowchart TD
  Mod[Moderator] --> CustomPost[Devvit Custom Post]
  CustomPost --> ReactUI[React Case Room UI]
  ReactUI --> Api[Hono API Routes]
  Api --> Service[ModThreadService]
  Service --> Weather[Weather Engine]
  Service --> Repo[ModThreadRepository]
  Repo --> Redis[Devvit Redis]
  Service --> Demo[Seeded Demo Scenario]

  Api -. tests .-> InMemory[In-Memory Repository]
  Repo -. tests .-> FakeRedis[Fake Redis Client]
Loading

Layers

src/shared/domain.ts
  Domain types, deterministic IDs, default settings.

src/server/weatherEngine.ts
  Deterministic Thread Weather suggestion logic.

src/server/repository.ts
  Repository interface and in-memory implementation.

src/server/redisRepository.ts
  Redis-backed implementation using Devvit Redis-compatible methods.

src/server/modThreadService.ts
  Use-case layer for cases, hotspots, trail entries, context pins, and precedents.

src/server/demoScenario.ts
  Seeded market-rumor scenario.

src/server/routes/api.ts
  Hono JSON API used by the React custom-post UI.

src/client/game.tsx
  Expanded Case Room UI.

src/client/splash.tsx
  Compact launcher into expanded mode.

Request Flow

sequenceDiagram
  participant M as Moderator
  participant UI as Case Room UI
  participant API as Hono API
  participant S as ModThreadService
  participant R as Redis Repository
  participant W as Weather Engine

  M->>UI: Open Mod Thread
  UI->>API: GET /api/init
  API->>S: seedMarketRumorDemo or getCaseRoom
  S->>W: suggestWeather(signals)
  S->>R: save case, hotspot, trail, draft, precedent
  R-->>S: persisted state
  S-->>API: CaseRoomState
  API-->>UI: CaseRoomResponse
  UI-->>M: Weather, trail, draft, precedents
Loading

Data Model

Case

Represents a moderated thread or incident.

Key fields:

  • caseId
  • subredditName
  • postId
  • title
  • status
  • createdAt
  • updatedAt
  • activeHotspotId
  • settingsSnapshot

Hotspot

Represents a risky or important branch.

Key fields:

  • hotspotId
  • postId
  • anchorCommentId
  • parentId
  • weatherState
  • confidence
  • reasonCodes
  • status

TrailEntry

Represents one moderation trail event.

Key fields:

  • entryId
  • hotspotId
  • actorId
  • entryType
  • targetThingId
  • note
  • createdAt

PrecedentCard

Represents reusable internal moderation memory.

Key fields:

  • precedentId
  • caseId
  • hotspotId
  • ruleTag
  • contextSummary
  • decision
  • rationale
  • futureGuidance
  • createdAt

API Surface

The Devvit server uses Hono routes.

GET  /api/init
POST /api/trail
POST /api/context-pin
POST /api/precedent

GET /api/init

Loads the active case room. By default it seeds and returns the demo case, so the app is demo-ready immediately.

Useful query parameters:

  • demo=1 or absent: seed demo case
  • demo=0: load an existing case only
  • postId=<id>: load a specific post id

POST /api/trail

Adds a Mod Trail entry.

Required body:

{
  "hotspotId": "hotspot:t3_market_rumor_demo:t1_market_origin",
  "entryType": "evidence_added",
  "targetThingId": "t1_city_clerk",
  "note": "Added city clerk clarification."
}

POST /api/context-pin

Updates the context-pin draft.

{
  "postId": "t3_market_rumor_demo",
  "draft": "Official city source confirms normal market hours."
}

POST /api/precedent

Saves a reusable precedent card.

{
  "postId": "t3_market_rumor_demo",
  "hotspotId": "hotspot:t3_market_rumor_demo:t1_market_origin",
  "ruleTag": "Local Rumor",
  "contextSummary": "Fast-moving rumor about market hours.",
  "decision": "Request source before escalation",
  "rationale": "The branch had momentum but lacked verified civic context.",
  "futureGuidance": "Find the origin and pin verified city guidance."
}

Moderator Demo Script

  1. Start Devvit playtest.
  2. Use the subreddit menu item Create Mod Thread case room.
  3. Open the custom post.
  4. Press Open to enter the Case Room.
  5. Point out the Flame pocket Thread Weather state and reason code.
  6. Show the Mod Trail with origin, context request, evidence, and precedent entries.
  7. Edit and save the Context Pin draft.
  8. Add a new trail entry.
  9. Save a precedent card.
  10. Explain how this reduces rereading, handoff friction, and repeated decision debates.

Development

Requires Node 22 or newer.

cd mod-thread
npm install

Run local verification:

cd mod-thread
npm run type-check
npm test
npm run lint
npm run build

Run Devvit playtest:

cd mod-thread
npm run dev

Upload and launch:

cd mod-thread
npm run deploy
npm run launch

Verification Status

Latest verified commands:

cd mod-thread
npm run type-check
npm test
npm run lint
npm run build

Expected result:

  • TypeScript build passes.
  • Vitest suite passes.
  • ESLint passes.
  • Vite/Devvit build completes.

Known non-blocking build warnings from the current template stack:

  • sourcemapFileNames invalid output option warning
  • deprecated inlineDynamicImports warning

Test Coverage

The current suite covers:

  • domain helpers and weather states
  • deterministic weather engine behavior
  • in-memory repository semantics
  • Redis repository semantics with fake Redis
  • service-layer retry safety
  • seeded demo idempotence
  • Hono API routes
  • Case Room UI rendering and context-pin mutation

Judging Criteria Fit

Community Impact

Mod Thread saves moderator time by preserving context in one case room instead of forcing every moderator to reread the thread and reconstruct prior decisions.

Polish

The app includes a real moderator-facing UI, seeded demo data, Redis persistence, route tests, UI tests, and a documented demo flow.

Reliable UX

The workflow is deterministic and explicit. The app avoids automatic enforcement, opaque scoring, and surprise public actions.

Ecosystem Impact

Mod Thread brings a thread-native incident-room workflow to Devvit: branch weather, shared context trail, and precedent memory in a single installable moderator tool.

Devpost Submission Draft

Tool Overview

Mod Thread helps moderation teams manage heated Reddit threads through a shared case room. It creates deterministic Thread Weather for the active branch, exposes reason codes, keeps a Mod Trail of mod-authored evidence and decisions, supports a context-pin draft, and saves internal precedent cards for future similar incidents.

Moderators use it by opening a Mod Thread case room from the subreddit menu, reviewing the active hotspot, adding trail entries, drafting context for the community, and saving a precedent when the decision is reusable. The app is designed for mod team handoff rather than automatic enforcement.

Project Impact

Mod Thread is useful for local, city, campus, event, and hobby communities where a single comment branch can become heated or confusing quickly. It saves mod time by preserving what has already been checked, reducing repeated source requests, and making moderation rationale easier to reuse later.

Example communities:

  • local or city communities responding to civic rumors
  • campus or event subreddits handling fast-moving schedule and safety threads
  • marketplace or hobby communities where repeated context gaps need consistent handling

Ported Project Fields

Not applicable. Mod Thread is a new Devvit mod tool, not a ported Data API bot.

Developer Platform Feedback Notes

  • The React/Hono Devvit scaffold made it fast to build a custom-post app with server routes.
  • Redis integration worked well once wrapped behind a repository interface.
  • The starter template's counter/demo code should be removed early because it can leave stale shared API types.
  • Current Vite/Devvit build warnings are non-blocking but noisy for hackathon polish.

Submission Checklist

  • App listing link from developer.reddit.com
  • Reddit usernames for all participants
  • Tool Overview
  • Project Impact
  • Demo instructions
  • Optional Developer Platform feedback
  • Optional helper nomination

Current Status

Mod Thread is concept-complete for the hackathon demo path. Remaining external steps are Devvit upload/publish and Devpost submission.

About

TypeScript project for threaded discussion and moderation-style community workflows.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors