How tyler-zig/gronk works
Gronk is a Discord assistant whose main workflow starts with a mention, reply, or thread message, routes the request, gathers relevant context and attachments, calls Grok, then responds in Discord and retains conversation metadata. Separate workflows provide image generation, Discord-history analysis, channel personas, and verbosity controls. The excerpts show core orchestration and several module responsibilities; some feature wiring is supported by the README but not visible in the sampled source, so uncertain call edges are omitted.
Main entry points: main.py Bot entry and routing · grok_responder.py Grok response handling · discord_history.py History search and analysis · reply_context.py Reply and thread context
Components 19
Discord interaction
- Bot entry and routing
main.py - Reply and thread context
reply_context.py - Media collection
media_utils.py - History search and analysis
discord_history.py - Natural-language routing
nlp_utils.py
Grok capabilities
- Grok response handling
grok_responder.py - Grok chat client
grok_client.py - Document processing
document_utils.py - Structured response schemas
grok_schemas.py - Image generation
image_generation.py - Usage cost estimates
cost_utils.py
Channel personalization
- Persona management
persona_manager.py - Response verbosity
verbosity.py
Conversation state
- Conversation records
conversation_store.py - Conversation database
data - Persona and channel settings
data
Other components
- Discord user
- Discord platform
- xAI API and tools
Connections 27
- Discord user → Discord platform: sends message
- Discord platform → Bot entry and routing: delivers event
- Bot entry and routing → Discord platform: reads message
- Bot entry and routing → Natural-language routing: detects intent
- Bot entry and routing → Reply and thread context: gathers context
- Reply and thread context → Discord platform: fetches history
- Reply and thread context → Media collection: collects media
- Bot entry and routing → Media collection: collects attachments
- Bot entry and routing → Image generation: dispatches image request
- Image generation → xAI API and tools: requests images
- Bot entry and routing → Grok response handling: dispatches query
- Grok response handling → Document processing: uploads documents
- Grok response handling → Grok chat client: requests chat response
- Grok chat client → xAI API and tools: calls chat API
- Grok response handling → Persona management: loads active persona
- Grok response handling → Response verbosity: loads style modifier
- Response verbosity → Persona management: reads and updates settings
- Persona management → Persona and channel settings: reads and writes
- Grok response handling → Usage cost estimates: estimates usage cost
- Grok response handling → Conversation records: stores response metadata
- Bot entry and routing → Conversation records: looks up reply context
- Conversation records → Conversation database: reads and writes
- Grok response handling → Discord platform: sends response
- Bot entry and routing → History search and analysis: routes history requests
- History search and analysis → Discord platform: scans messages
- History search and analysis → Grok chat client: analyzes collected history
- History search and analysis → Discord platform: sends cited analysis