CLI Usage (Interactive REPL)
The Interactive REPL is the default operational mode. It opens a direct, conversational session with the remote agent.
Starting a sessionโ
node dist/index.js
# or, if linked/installed globally:
patb-cli
On startup, the CLI:
- Prints a banner and the masked API key it loaded.
- Creates a new remote thread (
createAWSThread) and prints theRemote Thread ID. - Prompts you for input with
๐ค You:.
Controlsโ
- Converse โ type your message and press
Enter. The CLI triggers a run on the remote thread and streams the response back. - Progress tracking โ run state is written to
stderr, keepingstdoutclean if you redirect or pipe it. The remote service reports a single node,the-brain, so in practice you see one line as a turn starts and one as it finishes. - Exit โ type
exitorquitto end the session.
What the agent does with your messageโ
The remote agent is a guided journey, not a general-purpose chatbot: greet, pick a topic, pick a subtopic, then either learn about it or have an article written. It asks one question at a time and always ends a turn with the next one, so the usual opening move is simply to say hello and answer what it asks.
Example transcriptโ
==================================================
๐ง Pinky and the Brain - Remote Agent CLI REPL
Initializing remote session (API Key: abcd...wxyz)...
==================================================
๐งต Remote Thread ID: thread_abc123xyz
Type your message to prompt the agent workflow.
Type 'exit' or 'quit' to end the session.
==================================================
๐ค You: hello
๐ค Agent executing...
๐ [the-brain] Starting agent workflow for: the-brain
๐ [the-brain] Run complete
--------------------------------------------------
๐ค Response:
Ah, Pinky! Behold the four pillars of tonight's potential enlightenment:
1. AWS Cloud Practitioner Certification โ the CLF-C02 exam.
2. Cellular Automata โ Conway's Game of Life, Wolfram, Lenia, particle life.
3. English for Certifications โ IELTS, TOEFL and Cambridge.
4. Technical Interview Preparation โ role-based roadmaps.
Which shall we conquer first?
--------------------------------------------------
The thread id is what makes this a conversation: every turn you type goes to the same remote thread, so the agent remembers the topic you chose and the article in progress. Restarting the CLI starts a new thread, and the journey begins again.
How responses are chosenโ
Each streamed complete event carries the run's result. connectAWSStream in
src/remote.ts resolves the text to show in this order:
- A reported
error, surfaced asError: <message>. instructorState.explanationโ in practice, always this one.- The AI messages in
messages, joined, as a fallback. - A generic
"Workflow completed successfully.".
Step 2 is the whole story in normal operation. The name is a leftover: the service once
routed a supervisor to several specialist nodes, each returning its own slice of state,
and this client picked between a writer's draft, an instructor's explanation and a
developer's test results. That architecture is gone โ there is one agent now โ but the
service deliberately kept instructorState.explanation as the field every reply
arrives in, so clients like this one did not have to change. A lesson, a finished
article and a publish report all come through it.
For running as a background agent server instead of an interactive terminal session, see Zed Bridge Usage.