diff --git a/pkg/agent/commands.go b/pkg/agent/commands.go index 96a4f1f..4a062b7 100644 --- a/pkg/agent/commands.go +++ b/pkg/agent/commands.go @@ -246,6 +246,15 @@ func (s *agent) handleCommand(ctx context.Context, input string, handler EventHa handler(infoEvent(strings.TrimRight(s.session.contextDebug(), "\n"))) }, + "/cost": func(args []string) { + if s.session == nil { + handler(infoEvent("no active session")) + return + } + handler(infoEvent(fmt.Sprintf("last=$%.4f session=$%.4f", + s.session.LastTurnCostUSD, s.session.SessionCostUSD))) + }, + "/usage": func(args []string) { if s.session == nil { handler(infoEvent("no active session")) @@ -369,6 +378,7 @@ func (s *agent) handleCommand(ctx context.Context, input string, handler EventHa " /queued [pop|clear] - manage queued prompts", " /compact - summarize conversation and compact context", " /context - show context size and message breakdown", + " /cost - show last turn and session cost", " /usage - show token usage and context percentage", " /history - dump bounded message history", " /clear - clear session", diff --git a/pkg/store/sessionfile.go b/pkg/store/sessionfile.go index cf4ec57..f3acea1 100644 --- a/pkg/store/sessionfile.go +++ b/pkg/store/sessionfile.go @@ -373,7 +373,7 @@ func (h *sessionHelper) handleCtl(input string) error { return h.saveTranscript(data) case "compact", "clear", "backend", "model", "models", "agents", "agent", "sessions", "cwd", "skills", - "tools", "context", "usage", "history", + "tools", "context", "usage", "cost", "history", "irw", "help": h.sess.Core.Submit(h.sess.Ctx, "/"+input, h.makePublish()) default: