Description

Context

!wikiadd is the Signal-bot command that lets a member quote a message (or -n N for the last N messages) and have AI extract wiki-worthy content, decide which page to update or create, and commit + push to the wiki repo. Cloudflare Pages auto-deploys to https://irregularpedia.org.

A team-review on 2026-05-04 surfaced this:

The bot has been writing to the ARCHIVED IrregularChatWiki.git repo, not apps/wiki/ in the monorepo (the actual source for irregularpedia.org). Zero IrregularBot commits ever landed in apps/wiki/ per git log --author=IrregularBot. Members thought their content was being added; nothing reached the live site for some time.

Today's commit 9a7881a1 hardened the security side (admin gate, page allowlist, secret scan, anti-prompt-injection, sender anonymization, sanitized errors). But !wikiadd still points at the dead repo and even admins running it produce nothing useful. This issue is the actual repair: redirect the writes to the correct repo with a safe write model.

Acceptance criteria

  • [ ] Bot's wiki working tree clones the monorepo at git.irregularchat.com/irregulars/irregularchat-monorepo.git, not IrregularChatWiki.git
  • [ ] Bot writes to apps/wiki/src/content/docs/... (the live Astro Starlight content tree)
  • [ ] Bot does NOT push direct to main. Instead, on each !wikiadd invocation:
  • Create a fresh branch like wikiadd/<requester-hash>/<short-slug>-<date>
  • Commit changes to that branch
  • Push branch
  • Open a GitLab merge request via the API: title wikiadd: <page title>, body includes the source group + pseudonymized requester hash + AI's reasoning
  • Reply to the user with the MR URL (so they can verify and admins can review)
  • [ ] On approve+merge, CI's existing deploy-wiki job auto-publishes (no extra wiring needed)
  • [ ] Update WIKI_REPO_URL / GITLAB_WIKI_URL env semantics — likely retire GITLAB_WIKI_URL entirely and reuse the monorepo's existing remote
  • [ ] Bot user irregularbot needs Developer access on irregulars/irregularchat-monorepo (currently has access to the archived IrregularChatWiki)
  • [ ] Update apps/signal-bot/CLAUDE.md lines 481-529 (the !wikiadd doc) to reflect the new flow
  • [ ] Astro frontmatter validation: run pnpm --filter @irregularchat/wiki astro check (or a Zod schema mirroring Starlight's content config) on the new/updated page BEFORE commit. Reject AI output that doesn't pass.
  • [ ] Push retry with rebase on non-fast-forward (one bounded retry: git fetch + rebase + push)
  • [ ] Embedding-based page selection: replace the 100-page-title heuristic with semantic similarity using the existing wikiEmbeddings manager. The AI should see top-K similar pages, not the first 100 alphabetically.
  • [ ] At least one unit test covering the path traversal rejection AND the protected-pages allowlist
  • [ ] At least one integration test that mocks the GitLab MR API + verifies the bot constructs the right MR body

Technical hints

  • The monorepo already has CI permissions and the wiki deploy path; no new Cloudflare config needed
  • For MR creation see today's apps/scoreboard/src/api/award-request-admin.ts and bot-bug-report.ts for the GitLab MR API pattern
  • For Astro frontmatter validation, look at apps/wiki/src/content/config.ts (or equivalent) for the existing Zod schema; reuse don't reinvent
  • The dynamic-import + lock pattern in community-rollup-scheduler.ts (mutex on in-flight) is a good model for the per-invocation branch-create + push race
  • Keep the 9a7881a1 security hardening (page allowlist, secret scan, anti-injection) — they should layer with the new MR flow

Why this matters

  • The admin gate I just shipped means only admins can invoke. Nothing's broken in production — just blocked.
  • This bounty is the actual fix for the original ask: a community-friendly path to add wiki content via Signal that ACTUALLY reaches the live site.
  • MR-based flow naturally gates the AI's output through human review — even if the security hardening misses something, an admin sees the MR before merge.

Out of scope (separate bounties)

  • Removing the admin gate post-fix: filed separately once review confidence is high
  • Embeddings-based search itself: already exists via wikiEmbeddings; this just wires the existing system in

--- *L-tier (200 pts + 40 merge_pr = 240). Substantial — touches bot code, GitLab API integration, Astro validation, tests. Half-day to a full day of work for someone familiar with the codebase.*

Getting Started (added for pickup-readiness)

Path note: bot code is at selfhost/messaging-apps/signal-messenger/src/src/...;
the !wikiadd doc cited as "apps/signal-bot/CLAUDE.md lines 481-529" is now in
selfhost/messaging-apps/signal-messenger/CLAUDE.md.
  • Prerequisite (arrange first): irregularbot needs Developer access on
  • irregulars/irregularchat-monorepo — request before starting; it gates the push + MR steps.

  • Reference implementations (from hints): GitLab MR API → apps/scoreboard/src/api/award-request-admin.ts,
  • bot-bug-report.ts; in-flight lock → community-rollup-scheduler.ts; Astro schema → apps/wiki/src/content/config.ts.

  • Verify: pnpm --filter @irregularchat/wiki astro check on the generated page; run the new
  • path-traversal + MR-body tests via cd selfhost/messaging-apps/signal-messenger/src && npx vitest run; end-to-end, run !wikiadd and confirm the reply carries a real MR URL that CI's deploy-wiki publishes on merge.

Prepared for pickup by 🤖 GearSmith's Goal-Tender (Claude).

Relevant files

No relevant files linked yet.

Hints

No hints yet.

Activity

  • +200 sac earned L bounty Jun 18

Comments

No comments yet. Be the first to weigh in.

↑ Top