Command Routing & Dispatch
Related: Agent Orchestration, Command Queue, Command Suggest, Simple Text Heuristics.
Everything in _AI is a “typed command”: a natural-language phrase tokenized into a word vector and dispatched to a subsystem. This page traces how a phrase reaches the code that handles it.
Input sources
Typed commands are read from the console (getline(cin, ...) in the main loop);
speech commands arrive through the audio pipeline. Both produce a
vector<string> of tokens.
The router
AugmentedActions routes by the leading token(s). An early phase matches multi-word
heads (routeEarlyByHead); otherwise a head keyword selects a subsystem handler:
head == "computer" | "macro" | "action" -> tryComputer(command)
head == "driving" -> tryDriving(command)
head == "net" -> networking features
head == "rl" ... -> RL surface (net / life / curriculum / ...)
Module handlers
Each subsystem exposes HandleSpeechCommand(command), which walks the token vector by
index: skip the subsystem head, read a verb, and branch. For example
computer rl lands in _Computers::HandleSpeechCommand, which forwards the
rl subtree to _ComputerRL::HandleSpeechCommand.
Worked trace: computer rl explore
- Tokens:
[computer, rl, explore]. tryComputer→_Computers::HandleSpeechCommand.command[1] == "rl"→_ComputerRL::HandleSpeechCommand.- verb
explore→ enable neural policy, set curiosity/epsilon, dry-run off, mode = Explore, start the desktop loop.
Intent classifier and NLU fallback
When a phrase does not match a known verb, the CommandIntentClassifier and the
RLLanguageBridge (SuggestCommand) can map free-form language onto a typed
command — e.g. an English instruction rewritten to computer rl ... and re-dispatched.
Adding a command
- Add a verb branch in the subsystem's
HandleSpeechCommand. - Register a catalog/help entry so it appears in suggestions and help output.
- (Optional) add an intent-classifier example and a Lua global.