Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions internal/agentscript/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 != "" {
Expand All @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions pkg/script/translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 <pasted text>", "analyze <pasted text>"), 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 + `

Expand Down
Loading