From cad9d820bf038dfaba8fd4e0ffd0ed91ef8e457b Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Feb 2026 04:48:47 +0000 Subject: [PATCH] feat: add /help command available in all interactive modes Adds a printHelp() function that outputs detailed usage information covering all three modes (chat, command, AI-assisted), available commands, mode switching, and examples. /help is intercepted before the mode-specific switch block so it works in any mode. https://claude.ai/code/session_01PoHBfe7eKmhHvVF12W3xZ2 --- cmd/picoclaw/cmd_agent.go | 61 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/cmd/picoclaw/cmd_agent.go b/cmd/picoclaw/cmd_agent.go index b67bfd734..854d23709 100644 --- a/cmd/picoclaw/cmd_agent.go +++ b/cmd/picoclaw/cmd_agent.go @@ -108,6 +108,7 @@ func agentCmd() { fmt.Printf("\n%s %s\n", logo, response) } else { fmt.Printf("%s Interactive mode (Ctrl+C to exit)\n", logo) + fmt.Println(" /help - show detailed help") fmt.Println(" /cmd - switch to command mode") fmt.Println(" /pico - switch to chat mode") fmt.Println(" /hipico - AI assistance in command mode") @@ -162,6 +163,12 @@ func interactiveMode(agentLoop *agent.AgentLoop, sessionKey string) { return } + // /help works in all modes + if input == "/help" { + printHelp() + continue + } + switch mode { case modePico: if input == "/cmd" { @@ -277,6 +284,12 @@ func simpleInteractiveMode(agentLoop *agent.AgentLoop, sessionKey string) { return } + // /help works in all modes + if input == "/help" { + printHelp() + continue + } + switch mode { case modePico: if input == "/cmd" { @@ -349,6 +362,54 @@ func simpleInteractiveMode(agentLoop *agent.AgentLoop, sessionKey string) { } } +// printHelp outputs detailed usage information for all interactive modes. +func printHelp() { + fmt.Printf(`%s PicoClaw Interactive Mode Help +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + +PicoClaw has three interactive modes: + + 1. Chat Mode (default) + Talk to the AI agent directly. Your input is sent as a message + and the AI responds. + + 2. Command Mode + Execute shell commands directly, like a terminal. Supports cd, + pipes, redirects, and all standard shell features. + + 3. AI-Assisted Command Mode + A multi-turn AI conversation within command mode. The AI is aware + of your current working directory and can help with system tasks. + +Commands (available in all modes): + /help Show this help message + exit Exit PicoClaw + quit Exit PicoClaw + Ctrl+C Exit PicoClaw + +Mode switching: + /cmd Switch to command mode (from chat mode) + /pico Switch to chat mode (from command / AI-assisted mode) + /hipico Start AI-assisted mode (from command mode) + /byepico End AI assistance (from AI-assisted mode) + +Examples: + Chat mode: + %s You: What is the weather today? + + Command mode: + $ ls -al /var/log + $ cd /tmp + $ cat error.log | grep "FATAL" + + AI-assisted mode (enter from command mode): + $ /hipico check the log files for errors + %s> show me more details on line 42 + %s> /byepico + +`, logo, logo, logo, logo) +} + // executeShellCommand runs a shell command in the current working directory // and prints the output. It also handles the cd command to change directories. func executeShellCommand(input string) {