Skip to content

Add a /goal composer command that works with any provider #1960

Description

@SawyerHood

The workflow

I want to give an agent a goal instead of a single prompt. I type /goal <text> in the composer. The agent keeps working, in loops, until it meets the goal or asks me for help. I want this for any model from any provider, not only for one provider.

What happens today

bb has no /goal command. Each prompt is one turn. To get goal-style behavior I must write my own instructions in every prompt, or use a workflow script.

What you would expect

  • The composer accepts /goal <text> as a slash command. The command shows in the slash-command list.
  • bb sends the goal as a turn with a server-owned instruction block that tells the agent to work until the goal is done, verify the result, and report.
  • The thread shows the goal in the timeline as a goal card, with a done / not done state.
  • It works with every provider (Claude Code, Codex, Pi, ACP providers), because the server owns the instruction and not the provider.
  • It is also available from the CLI and the SDK, for example bb thread message --goal "<text>" or a /goal prefix in the message text.

Cursor GUI shipped a /goal command recently; that is the reference.

Context and alternatives

  • Workaround today: the workflows plugin, or a custom instruction in each prompt.
  • The server already owns product policy for turns, so the goal instruction belongs to the server (see AGENTS.md, Server And Daemon).
  • Source: user feedback collected on 2026-08-19.

Checks

  • I searched open and closed issues for the same request.
  • If an agent wrote this, the body ends with > AGENT GENERATED: by <model>.

AGENT GENERATED: by Claude Opus 5

Activity

  1. added
    threads
    ui
    cli
    on Aug 19, 2026
  2. mistakeknot commented on Sep 23, 2026

    @mistakeknot
    Contributor

    Evidence that might help decide scope. Tested at main @ 9b8c1d3 with Claude Code 2.1.280.

    Why /goal doesn't show for Claude Code threads today. The send-menu Goal action comes from each provider's composerActions, and the / typeahead lists only built-ins, skills, and .claude/commands files, so neither surface offers goal for Claude Code.

    How Codex goals work today. bb passes the /goal … text to codex app-server unchanged (

    export function toCodexUserInput(input: PromptInput[]): CodexUserInput[] {
    return input.map((chunk): CodexUserInput => {
    switch (chunk.type) {
    case "text":
    return { type: "text", text: chunk.text, text_elements: [] };
    case "image":
    return { type: "image", url: chunk.url };
    case "localImage":
    return { type: "localImage", path: chunk.path };
    case "localFile":
    return {
    type: "text",
    text: `[Attached file: ${chunk.path}]`,
    text_elements: [],
    };
    }
    });
    }
    ) and Codex sets the goal itself. The goal card is fed by Codex's thread/goal/updated and thread/goal/cleared notifications, which carry objective, status (active | paused | budgetLimited | complete), and budget (
    case "thread/goal/updated": {
    const goal: CodexGoalState = {
    objective: handledEvent.params.goal.objective,
    status: handledEvent.params.goal.status,
    tokenBudget: handledEvent.params.goal.tokenBudget,
    tokensUsed: handledEvent.params.goal.tokensUsed,
    timeUsedSeconds: handledEvent.params.goal.timeUsedSeconds,
    };
    return [
    {
    kind: "extension.state",
    extensionKind: CODEX_GOAL_EXTENSION_KIND,
    payload: goal,
    },
    ];
    }
    case "thread/goal/cleared":
    return [
    {
    kind: "extension.state",
    extensionKind: CODEX_GOAL_EXTENSION_KIND,
    payload: null,
    },
    ];
    ,
    export const threadTimelineGoalStatusSchema = z.enum([
    "active",
    "paused",
    "budgetLimited",
    "complete",
    ]);
    export const threadTimelineGoalSchema = z.object({
    sourceSeq: z.number().int().nonnegative(),
    updatedAt: z.number(),
    objective: z.string(),
    status: threadTimelineGoalStatusSchema,
    tokenBudget: z.number().nullable(),
    tokensUsed: z.number(),
    timeUsedSeconds: z.number(),
    });
    export type ThreadTimelineGoal = z.infer<typeof threadTimelineGoalSchema>;
    ). The card and the clear handling are keyed to the provider-codex/goal extension kind (
    const latestGoalRows = listLatestThreadStateEventRowsByThreadIds(deps.db, {
    threadIds: threads.map((thread) => thread.id),
    kind: LEGACY_CODEX_GOAL_EXTENSION_KIND,
    });
    ,
    observe(event: ThreadEvent): void {
    if (
    event.type !== "thread/extensionState/updated" ||
    event.kind !== LEGACY_CODEX_GOAL_EXTENSION_KIND ||
    event.payload !== null
    ) {
    return;
    }
    ).

    Claude Code has a native /goal in headless mode, and bb already passes it through. Repro:

    claude -p --model claude-haiku-4-5-20251001 --output-format stream-json --verbose --max-turns 4 "/goal reply with the single word ok"
    
    • init.slash_commands includes goal.
    • The first assistant message is synthetic (model: "<synthetic>") with text Goal set: reply with the single word ok and a structured local_command_run: {"command":"goal","args":"reply with the single word ok"}, so the objective is available without parsing text.
    • The model then answers and the result is success. I saw no goal progress, completion, or clear event in the stream; only the set is observable.
    • Same behavior when the prompt is sent as a stream-json user message (--input-format stream-json), which is how bb's SDK session sends turns (
      pushInput(
      text: string,
      promptId?: NonNullable<SDKUserMessage["uuid"]>,
      ): Promise<void> {
      const message: SDKUserMessage = {
      type: "user",
      message: { role: "user", content: text },
      parent_tool_use_id: null,
      ). bb only strips /plan, and only in plan mode (
      function stripClaudePlanCommandMentions(args: {
      input: readonly PromptInput[];
      claudeCodePermissionMode: "plan" | undefined;
      }): PromptInput[] {
      if (args.claudeCodePermissionMode !== "plan") {
      return [...args.input];
      }
      return removeCommandMentionsFromPromptInput(args.input, {
      trigger: "/",
      name: "plan",
      });
      }
      ). So typing /goal … in a Claude Code thread today most likely sets a native goal that bb can't show or clear.
    • Unverified: I didn't run this inside a bb thread end to end, and I didn't check what /goal clear emits.
    Trimmed stream-json output
    {"type":"system","subtype":"init","claude_code_version":"2.1.280","model":"claude-haiku-4-5-20251001","slash_commands":[…,"goal",…],…}
    {"type":"assistant","message":{"model":"<synthetic>","role":"assistant","stop_reason":"end_turn","content":[{"type":"text","text":"Goal set: reply with the single word ok"}],…},"local_command_run":{"command":"goal","args":"reply with the single word ok"},…}
    {"type":"assistant","message":{"model":"claude-haiku-4-5-20251001","content":[{"type":"text","text":"ok"}],…},…}
    {"type":"result","subtype":"success","is_error":false,"num_turns":1,"result":"ok",…}
    

    That leaves two ways to cover Claude Code:

    1. Native, per provider (like Codex): add "goal" to Claude Code's composerActions, map local_command_run.command === "goal" to goal state, and implement thread/goal/clear. Small on the input side. The catch is state: Claude Code emits nothing for progress or completion, so the card could only go from active to cleared, never to complete. The goal card is also keyed to provider-codex/goal today, so this needs a provider-neutral goal state; a thread/goal/updated event type exists (
      z.object({
      type: z.literal("thread/goal/updated"),
      threadId: z.string(),
      providerThreadId: z.string(),
      objective: z.string(),
      status: threadTimelineGoalStatusSchema,
      tokenBudget: z.number().nullable(),
      tokensUsed: z.number(),
      timeUsedSeconds: z.number(),
      }),
      z.object({
      type: z.literal("thread/goal/cleared"),
      threadId: z.string(),
      providerThreadId: z.string(),
      }),
      ) but is stored as the Codex extension kind (
      case "thread/goal/updated": {
      const payload: Record<string, unknown> = {};
      for (const field of GOAL_FIELDS) {
      payload[field] = stored.data[field];
      }
      return {
      type: "thread/extensionState/updated",
      data: {
      ...withoutGoalFields(stored.data),
      kind: LEGACY_CODEX_GOAL_EXTENSION_KIND,
      payload,
      },
      };
      }
      case "thread/goal/cleared":
      return {
      type: "thread/extensionState/updated",
      data: {
      ...stored.data,
      kind: LEGACY_CODEX_GOAL_EXTENSION_KIND,
      payload: null,
      },
      };
      ).
    2. Server-owned, as this issue proposes: one implementation for every provider, with bb owning the instruction block and the done state. Two things to decide: how bb detects "done" without a provider signal, and what to send Codex, whose app-server treats a literal /goal … line as a native goal.

    #3411 mentions a local prototype with native Codex goal create/resume/clear and asks whether that should be split under this issue; whichever direction you pick here answers that too.

    Which direction do you want? I can build either one.

    AGENT GENERATED

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    clithreadsui

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions