Request lifecycle
- You run
/mclawd ...,/mineclawd prompt ..., or type a request in the overlay input bar. - MineClawd validates provider config and OP access.
- MineClawd loads or creates active session state.
- MineClawd sends a streaming request to the OpenAI-compatible or Vertex endpoint.
- Stream deltas are sent to the client in real time via the
AGENT_STREAM_EVENTchannel. The overlay renders each delta with a blinking cursor. - Model responses can trigger tool calls. Tool results are fed back into the model loop.
- Final assistant output is rendered to chat (and the overlay) and session history is saved.
Runtime tool families
- Command and script execution:
execute-commandapply-instant-server-script
- Persistent script files:
list-server-scriptsread-server-scriptwrite-server-scriptdelete-server-scriptreload-gamesync-command-tree
- Clarification:
ask-user-question
- Asset tracking:
list-assetsupsert-asset-recordremove-asset-record
- Web search (requires Tavily API key):
search
- Mod information:
list_modslist_commandsfetch_modrinthfetch_url
- Dynamic placeholders (only when enabled):
list-dynamic-contentregister-dynamic-itemregister-dynamic-blockregister-dynamic-fluidupdate-dynamic-itemupdate-dynamic-blockupdate-dynamic-fluidunregister-dynamic-content
Storage layout
Session internals
- Session id is a 4-character lowercase token.
- Command token format is
<id>-<title-slug>. - Session file stores OpenAI and Vertex histories separately.
- Active session pointer is stored in
active.jsonper owner. - Session title is generated after first successful round using summarize model.
LLM transport details
- OpenAI-compatible request path:
<endpoint>/chat/completions - Vertex request path:
<endpoint>/<model>:generateContent?key=<api_key> - Both paths use 60-second request timeout.
- Both paths support function-style tool calling.
- Both paths support streaming. Stream deltas are forwarded to the client via the
AGENT_STREAM_EVENTnetwork channel.
Streaming architecture
Stream events use theAGENT_STREAM_EVENT channel with a request ID, event type byte, and payload string.
| Event type | Byte | Payload |
|---|---|---|
START | 0 | JSON with sessionId and request text |
DELTA | 1 | Text fragment from the LLM |
DONE | 2 | Empty |
ERROR | 3 | Error message string |
TOOL_STATUS | 4 | Name of the tool currently being called |
TOOL_STATUS_CLEAR | 5 | Empty (clears the tool status indicator) |
DONE or ERROR arrives. During generation, TOOL_STATUS events display an animated indicator showing which tool MineClawd is calling in real time. The indicator clears when TOOL_STATUS_CLEAR arrives.
Active requests are tracked server-side in ACTIVE_REQUESTS and ACTIVE_NETWORK_REQUESTS maps. The /mineclawd stop command marks the request ID in CANCELLED_REQUEST_IDS and cancels in-flight HTTP connections.
Dynamic placeholder internals
- Capacity:
30item slots,30block slots,30fluid slots. - Fixed ids include:
mineclawd:dynamic_item_001mineclawd:dynamic_block_001mineclawd:dynamic_fluid_001
- State sync uses
sync_dynamic_contentnetwork payload. - State persistence uses world
PersistentStateidmineclawd_dynamic_content. AUTOmode enables runtime placeholders in client runtime and disables them on dedicated servers.
Networking channels
MineClawd defines these packet identifiers:mineclawd:client_readymineclawd:client_gui_prefmineclawd:open_configmineclawd:sync_broadcast_targetmineclawd:sync_assistive_touchmineclawd:sync_dynamic_contentmineclawd:open_questionmineclawd:question_responsemineclawd:open_sessionsmineclawd:open_assetsmineclawd:open_history_bookmineclawd:agent_stream_event
Asset tracking internals
Asset records are stored per owner inmineclawd/assets/<owner>.json. Each record contains:
id— unique identifiercategory— one ofENTITIES,ITEMS_BLOCKS_FLUIDS,SPECIAL_ITEMS,COMMANDS,GAME_MECHANICSname,summary,scriptPath,details- Category-specific fields:
contentId,specialItemId,specialItemNbt,command,entityUuid,entityDimension,entityX,entityY,entityZ sessionId— the session that created the assetcreatedAt,updatedAt— timestamps
upsert-asset-record tool calls.
Limits and timers
| Setting or behavior | Value |
|---|---|
| Tool call limit range | 1 to 20 |
| Default tool call limit value | 16 |
| Tool call limit default state | disabled |
| Ask-user max options | 5 |
| Ask-user timeout | 60 seconds |
| Failed-request retry token TTL | 30 minutes |
| Rate-limit retry count | 2 retries |
| Rate-limit retry backoff | 1500ms * retry_index |
| History max entries for book build | 300 |
| Overlay input bar max length | 600 characters |
| Asset categories | 5 |
Security model
- Every command path is OP-gated.
- KubeJS execution is real server execution, not simulation.
- API keys must be treated as secrets.
- Use trusted environments only.
