Skip to main content

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:

  1. Prints a banner and the masked API key it loaded.
  2. Creates a new remote thread (createAWSThread) and prints the Remote Thread ID.
  3. 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, keeping stdout clean 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 exit or quit to 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:

  1. A reported error, surfaced as Error: <message>.
  2. instructorState.explanation โ€” in practice, always this one.
  3. The AI messages in messages, joined, as a fallback.
  4. 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.