Chat with an agent in a terminal
Run jcode in a folder of your code. jcode starts an agent in that folder and opens a chat with it. You give no state folder, brief file, or port.
cd ~/src/hello
jcode "hello.sh should take a name; with none it says hello, world"
jcode 0.1.0 · a1 · us.amazon.ergo-1.0 · process · ~/src/hello (main)
/help for the commands · Esc then Enter stops a command · Ctrl-C leaves, and the agent keeps running
agent I look at the script first.
▸ read_file hello.sh
✓ #!/bin/sh · 3 lines
▸ write_file hello.sh
✓ wrote 87 characters to hello.sh
@@ -1,3 +1,3 @@
#!/bin/sh
-# Prints a greeting.
-echo "hello"
+# Prints a greeting: hello, NAME, or hello, world.
+echo "hello, ${1:-world}"
▸ run sh hello.sh Alice; sh hello.sh
✓ exit 0
hello, Alice
hello, world
? Both cases work. Shall I also add a --help option?
── a1 asks · us.amazon.ergo-1.0 · process · turns 4/40 · 4.7k tok ──
Type the answer.
Start, leave, and come back
| Command | What it does |
|---|---|
jcode |
Asks for the task, starts an agent in the current folder, and opens the chat. |
jcode TEXT |
The same, with TEXT as the task. |
jcode -c |
Opens the chat of the last agent of the current folder. |
jcode ls |
The agents. A * marks the agents of the current folder. |
jcode config |
The settings. jcode config KEY VALUE sets one. |
The launcher bin/jcode starts the daemon in the background when none runs, with its output in serve.log of the state folder. JCODE_PORT sets its port. The default is 7717, or a free port when another program has 7717. The program of ztcl build cannot start the daemon: start it yourself with jcode serve > jcode.log 2>&1 &.
Ctrl-C ends the chat. The agent keeps running, and jcode -c opens it again.
The settings
The first jcode asks two questions and saves the answers in ~/.config/jcode/config.json:
| Setting | Description | Default |
|---|---|---|
model |
The model id of Bedrock. | us.amazon.ergo-1.0 |
isolation |
process, vm, or none (Isolation). |
The safest level of the host: process, else vm, else none with a warning. |
run |
The run tool: all, off, or WORD,WORD. |
all |
In the chat
Each line that you type is a message to the agent. While the agent works, it gets the message with its next tool results. When it asks, the message is the answer. When it is done, the message gives it more work.
| Input | What it does |
|---|---|
| Esc, then Enter | Stops the running command. The agent goes on. |
/diff |
The changes in the folder, with colors. |
/cost |
The tokens, the USD, and the times. |
/status |
The state of the agent. |
/interrupt |
Stops the running command. |
/stop |
Stops the agent. |
/model ID, /isolation LEVEL |
Sets the model or the level of the next agent. |
/help |
The commands. |
/quit |
Leaves, as Ctrl-C. |
@FILE |
Names a file for the agent. The chat warns when the file does not exist. |
--plain turns the colors off.
Note
This chat is the line form. The full-screen chat, with an input box, folds, and a search of the scrollback, needs the terminal backend of
ztcl::tui.