Alloy / Discord agentic consulting

The agentic layer for
Discord communities.

Not a chatbot pasted onto your server. A governed operating layer that listens, reasons, calls tools, shows its work, and returns the result where your community already lives.

104 governed tools 32 Discord commands 4 specialist lanes Oracle A1 production
Grunt · live community surface online

Thesis AI doesn't have to be a gimmick. Community doesn't have to be a job. Alloy runs your governed signal pipeline through Grunt on Discord.

One interface / an entire operating system

Discord is the canvas.
Alloy is the machinery.

The same live component handles community administration, persistent knowledge, media, scheduling, research, approvals, infrastructure checks, and parallel specialist work.

01Community opsThreads, forums, roles, events, moderation
02Knowledge + memoryLibrary recall, personas, session compaction
03Research + webTavily, cloud browser automation, citations
04Media intelligenceVision, image generation, attachment context
05Governed actionTier gates, confirmations, audit receipts
06Specialist lanesUp to four parallel agents, one synthesis
Member path · scroll choreographed live

Signal begins in Discord A message lands in #community-help — listen gate, entitlement, quota, tools, then Grunt's reply.

Act IV — The pullback

The window shrinks. The pipeline appears.

A public Hostinger front door. A private Oracle runtime. Local-first persistence inside durable Docker volumes. Tailscale operator access. One controlled path from community signal to visible receipt.

CommunityDiscord signals@mention · reply · /ask · DM
Static front doorHostinger websiteThis simulation and service story
ProductionOracle A1Python bot + FastAPI in Docker
Governed loopContext → tools → trace104 built-ins + dynamic MCP
Local-first persistenceSQLite + JSON + volumesDurable cloud-hosted execution
Private operator pathTailscale → Agent StudioSwift TL remote control surface
01 / localMac rollback seedRetired runtime retained for recovery; not production.
02 / cloudOracle A1 productionTwo Docker services with named data and log volumes.
03 / privateTailscale operationsPhone and laptop reach Agent Studio without exposing it publicly.
Alternate entry / slash command/ask skips the listen gate and enters the same governed pipeline.

Act V — The governed signal pipeline, chapter by chapter

01 · Input surfaces

Not every message is a job.

Before Grunt lifts a finger, Alloy decides whether a message even deserves a reply. A signal only enters the pipeline when it clearly asks for the bot — everything else slides past untouched.

A run starts when Discord delivers a signal the bot is configured to accept. In guild chat, on_message fires — but Grunt only engages when at least one trigger matches: an @mention, a reply to one of its messages, a name-drop of Grunt, or an author on the WATCHED_USER_IDS list.

Text-plus-image attachments and reply-chain images count too. The /ask slash command runs the same pipeline with no listen gate; DMs route to a separate consulting discovery handler. Bot messages, empty promptless posts, and non-members get dropped.

02 · Pipeline

One signal, a governed path.

Once a message is accepted, it travels a fixed, governed route — no step skipped, no gate bypassed. This is the spine every Team Rocket Grant run rides.

The happy path moves the signal through the listen gateentitlement gate (tier + quota) → _respond_inner. From there build_context and pick_tools assemble what the model sees, the harness binds a session and trace route, and _run_agentic opens the reasoning loop.

Inside the loop the LLM and tools trade turns until the model returns a final answer — delivered as a plain-text reply plus trace embeds.

03 · Permissions

Power scales with trust.

Every member can talk to Grunt, but not everyone can make it act. Alloy maps Discord roles to tiers, and tiers decide quota and which tools are even on the table.

After the listen gate, watched users are forced onto an OpenAI chat-only path — no tools, no harness. Everyone else hits the entitlement gate, which resolves a tier: Owner (bypass quota, all tools), Admin (2/day), Booster (10/day), Default (1/week).

filter_tools_for_tier trims the toolset before _dispatch applies its own gates. Harness full mode stays owner-only regardless of tier.

04 · Context

Grunt reads the room first.

A good answer needs more than the question. Alloy stacks persona, memory, and recent history into every prompt so Grunt stays in character and on topic.

build_context() in cogs/_context.py stacks layers in order: the Team Rocket persona, provider awareness, library blocks (topical recall), long-term memory, compacted session history, then the current user message with optional vision blocks.

Tool schemas attach only when use_tools is on and the user is off the watched path.

05 · Agentic loop

Think. Act. Check. Repeat.

This is where Grunt earns its keep. Instead of one guess, it works in a loop — calling tools, reading results, and refining until the job is actually done.

With use_agentic_loop and tools enabled, each turn calls the LLM with system + history + tool schemas, parses text and any tool calls, optionally confirms, runs _dispatch for each tool, appends the results, streams progress to trace embeds, and repeats until there are no tool calls or the cap is hit.

Dispatch is gated bottom-to-top: tier filter → owner gate → tool_config.json → harness lane policy → confirmation → execute → audit. LLMRouter defaults chat to DeepSeek and reroutes vision / image work to OpenAI.

06 · Trace

The work shows itself.

Confidence comes from seeing the work. Alongside every answer, Alloy keeps a live record of what Grunt planned, called, and concluded — for operators, not just users.

For non-watched agentic runs, _resolve_trace_route (the sole thread factory, I1) opens a grunt-work forum thread with full reasoning, a condensed mirror thread on the invocation message, and an inline fallback if forum routing is off.

_TraceSession streams embeds: plan → tool_start / tool_done → lane_spawn / lane_done → synthesis → final. A non-blocking side channel POSTs run events to TRAINERLABS_CONTROL_URL — Docker DNS in Oracle production, localhost only for rollback/dev — and a failure there never blocks the Discord reply.

07 · Output

Personality up front, receipts behind.

Users meet Grunt's voice; operators get the paper trail. The final reply stays clean and in-character while the machinery lives in the trace.

Outputs split by purpose: a plain-text reply is always the primary answer in the invocation channel; trace embeds land in the grunt-work forum and mirror thread; image embeds, quota embeds, and confirmation prompts appear inline as needed.

The final answer rule keeps Grunt's in-character text separate from the trace machinery — users see the personality, operators see the work log.

Act VI — The owner takes the harness

Owner runs /ask in Agent Studio.

Plan mode → tool dispatch → trace panel. Agent Studio runs beside Grunt on Oracle and reaches the operator privately over Tailscale; the Mac remains a rollback seed, not the production host.

Oracle A1 / onlineTailscale / enrolledPython / productionTypeScript / migration gate

Act VII — Forge it together

See the work.
Then shape your system.

Alloy consulting begins inside the same governed interface you just watched. Message Grunt in Discord DMs—no server join required. The live bot can qualify a discovery conversation in two bounded turns and schedule the next step.