Public: anyone can read this; the crew can change it.

Migrated from github.com/Trevato/SO-ARM100

The crew moderates in real time: every chat message is checked by a moderator agent, which hides abuse and tells the admin #24

opened this in answer to

Merged 44d 7h ago

Every posted chat line is now checked in the background by a moderation model. A hide verdict removes the line for everyone and logs it, and mute-suggest shows the owner a one-click mute. Type check and bun test pass (132 tests, 0 failures) with a fake model.

Notes

opened this

Every posted chat line is now checked in the background by a moderation model. A hide verdict removes the line for everyone and logs it, and mute-suggest shows the owner a one-click mute. Type check and bun test pass (132 tests, 0 failures) with a fake model. I haven't run it against a real model, because the forge's default-model endpoint isn't documented anywhere I could see.

  • Chat speed: The line is broadcast first and checked afterwards, so the chat is never delayed. A check that hangs is abandoned after 8 s.
  • Outages and budget: If the model is unset, down, garbled, or over the per-minute cap, the line simply stands.
  • Owner panel: The owner sees on/off, the rules text, the lines the crew hid with Restore, and the mute suggestions in a small panel in the side column of viewer.html. There is no /admin page yet, because #12 hasn't landed, so these controls go over the owner's /live socket. They should move to the admin page once it exists.
  • Settings: On/off, the rules text and the max lines checked per minute (default 30) are validated at the boundary. They persist with the hidden-line log and suggestions in $FORGE_APP_DATA/so101/crew.json.
  • Not done: #14's word filter isn't on main either, so there is no filter stage ahead of the moderator yet.
  • Which model is "jev": I haven't confirmed this with the steward, so nothing is routed to it. The model client in src/moderator.ts talks to an OpenAI-compatible endpoint set by FORGE_MODEL_URL, with optional FORGE_MODEL_KEY and FORGE_MODEL_NAME. With FORGE_MODEL_URL unset, nothing is checked. Someone needs to point those at the forge's default model, or at jev once confirmed.

Tests in src/moderator.test.ts cover hide removing and logging, restore, mute-suggest, outage and garbled answers, a hanging model, the cost cap, settings validation and persistence, and the lobby path. Chat gained restore, and the Moderator is created in bench/fake-serve.ts and documented in Software/README.md.

🤖 Generated with Claude Code

Closes #15

2 earlier comments
commented

Every posted chat line is now checked in the background by a moderation model. A hide verdict removes the line for everyone and logs it, and mute-suggest shows the owner a one-click mute. Type check and bun test pass (132 tests, 0 failures) with a fake model. I haven't run it against a real model, because the forge's default-model endpoint isn't documented anywhere I could see.

  • Chat speed: The line is broadcast first and checked afterwards, so the chat is never delayed. A check that hangs is abandoned after 8 s.
  • Outages and budget: If the model is unset, down, garbled, or over the per-minute cap, the line simply stands.
  • Owner panel: The owner sees on/off, the rules text, the lines the crew hid with Restore, and the mute suggestions in a small panel in the side column of viewer.html. There is no /admin page yet, because #12 hasn't landed, so these controls go over the owner's /live socket. They should move to the admin page once it exists.
  • Settings: On/off, the rules text and the max lines checked per minute (default 30) are validated at the boundary. They persist with the hidden-line log and suggestions in $FORGE_APP_DATA/so101/crew.json.
  • Not done: #14's word filter isn't on main either, so there is no filter stage ahead of the moderator yet.
  • Which model is "jev": I haven't confirmed this with the steward, so nothing is routed to it. The model client in src/moderator.ts talks to an OpenAI-compatible endpoint set by FORGE_MODEL_URL, with optional FORGE_MODEL_KEY and FORGE_MODEL_NAME. With FORGE_MODEL_URL unset, nothing is checked. Someone needs to point those at the forge's default model, or at jev once confirmed.

Tests in src/moderator.test.ts cover hide removing and logging, restore, mute-suggest, outage and garbled answers, a hanging model, the cost cap, settings validation and persistence, and the lobby path. Chat gained restore, and the Moderator is created in bench/fake-serve.ts and documented in Software/README.md.

🤖 Generated with Claude Code

commented

I merged main into this branch and pushed. The type check is clean and all 140 tests pass.

Software/so101/bench/fake-serve.ts was the only file that conflicted. Both sides had changed the lines that build the lobby and start the relay. I kept both changes:

  • From this branch: the lobby still gets the Moderator, which writes crew.json and takes its model from modelFromEnv.
  • From main: the LeaderCalibrations store is still created and passed to startRelay.

Software/README.md and src/viewer.html also changed on both sides but merged automatically.

commented

I fixed everything the reviews asked for except the terminal door, which I left out. The type check is clean and the moderator and lobby tests pass. I did not run the full suite.

  • Per-author budget: each author now gets at most 5 checks a minute (PER_AUTHOR_PER_MINUTE), keyed on the verified from.id, inside the room's cap. The new test has one author flood and checks that a second author's line is still checked. The README says so.
  • Restore after an owner delete: onHide now returns whether the line was actually removed. The moderator logs a hide only when it was, so restore can't bring back a line the owner deleted. A new test covers it.
  • Owner-gate tests: a non-owner's crew, restore and dismiss are each refused, and the settings and hidden log stay unchanged. A non-owner never receives a crew message, while the owner does. Moving the gate would fail this test.
  • Panel:
    • A labelled "Most lines checked per minute" number input now sits in the owner's panel, so the README is accurate.
    • Buttons have a 44px hit area, and the panel is aria-live=polite.
    • The panel is not rebuilt while the rules textarea or the number input has focus.
  • load(): stored hidden and suggestions entries are shape-checked and bad ones dropped, so a hand-edited crew.json can't crash renderCrew. A new test covers it.

Declined: the terminal door. This app has no src/tty.ts and forge.json declares no tty, so there is no terminal to add the crew controls to. If a terminal is wanted, it should be a separate issue.

I couldn't check the page in a browser, so the panel changes are untested beyond the type check.

🤖 Generated with Claude Code

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs