diff --git a/internal/agentscript/runtime.go b/internal/agentscript/runtime.go index 22831c8..eb287a5 100644 --- a/internal/agentscript/runtime.go +++ b/internal/agentscript/runtime.go @@ -431,7 +431,18 @@ func (r *Runtime) executeCommand(ctx context.Context, cmd *Command, input string case "search": result, err = r.search(ctx, cmd.Arg) case "summarize": - result, err = r.geminiCall(ctx, "Summarize the following content concisely:\n\n"+input) + // Content comes from piped input (stdin) or, if none, the arg — + // like echo. Keeps the pipeline stdin->stdout portable while also + // allowing `summarize "text"` directly. + content := input + if content == "" { + content = cmd.Arg + } + if content == "" { + err = fmt.Errorf("summarize: no content (pipe text in or pass it as an argument)") + } else { + result, err = r.geminiCall(ctx, "Summarize the following content concisely:\n\n"+content) + } case "ask": prompt := cmd.Arg if input != "" { @@ -445,11 +456,16 @@ func (r *Runtime) executeCommand(ctx context.Context, cmd *Command, input string } result, err = r.claudeCall(ctx, prompt) case "analyze": + // Content from piped input (stdin); if none, treat the arg as the + // content rather than only the focus — echo-like dual source. prompt := "Analyze the following" - if cmd.Arg != "" { + content := input + if content == "" && cmd.Arg != "" { + content = cmd.Arg + } else if cmd.Arg != "" { prompt += " focusing on " + cmd.Arg } - prompt += ":\n\n" + input + prompt += ":\n\n" + content result, err = r.geminiCall(ctx, prompt) case "save": result, err = r.save(cmd.Arg, input) diff --git a/pkg/script/translate.go b/pkg/script/translate.go index 5d3376f..6d74f6f 100644 --- a/pkg/script/translate.go +++ b/pkg/script/translate.go @@ -81,6 +81,12 @@ CHOOSING THE BACKEND - Use ` + "`temporal`" + ` ONLY when the user explicitly asks for a durable, long-running, scheduled, or background workflow. Currently only the ` + "`echo`" + ` command runs on temporal. - If the user says "in memory", "locally", "quickly", or doesn't mention durability, use ` + "`memory`" + `. +PASSING CONTENT +When the user pastes text to act on (e.g. "summarize ", "analyze "), put that pasted text directly into the command's quoted argument: + Request: summarize The quick brown fox jumped over the lazy dog. + Output: memory static ( summarize "The quick brown fox jumped over the lazy dog." ) +Do NOT use a file path or ` + "`read`" + ` for pasted content — content travels in the argument so the same program is portable across backends. Verbs take their content from the pipeline input or, when there is none, from their argument. + AVAILABLE COMMANDS (you may use ONLY these — never invent a command): ` + available + `