Skip to content

feat(goal): support guided goal authoring#839

Open
chengluyu wants to merge 7 commits into
mainfrom
feat/writing-goal-skill
Open

feat(goal): support guided goal authoring#839
chengluyu wants to merge 7 commits into
mainfrom
feat/writing-goal-skill

Conversation

@chengluyu

Copy link
Copy Markdown
Collaborator

Summary

Adds a write-goal builtin skill that helps users turn a rough intention into a well-specified /goal objective, and fixes the goal-mode machinery so a model-authored goal actually starts and runs end-to-end. Together these make "help me write and start a goal" a smooth, guided flow.

What's included

The write-goal skill

  • A builtin skill (peer of custom-theme, update-config) teaching how to write good goals as a completion contract: end state, proof, boundaries, iteration loop, and an honest stop/blocked rule — distilled from real public /goal cases.
  • Interactive by design: only engages when the user asks, drafts in the user's language, shows the full draft for approval, revises collaboratively, and respects the user's final call if they want it looser.
  • On approval it starts the goal by calling CreateGoal directly (rather than printing paste-text).
  • Budgets are opt-in: it no longer bakes a turn cap into objectives, and suggests a budget only when useful, framed on token cost.

Goal-mode fixes that make model-initiated goals work

  • Continuation: a goal created mid-turn via CreateGoal now drives continuation turns instead of stopping after the turn that created it. Previously turnWorker only entered the driver for goals already active (or paused/blocked) at turn launch.
  • Start menu: CreateGoal approval reuses the same menu as /goal (Switch to Auto / YOLO / Start in Manual / Don't start), applying the chosen permission mode before the goal is created. Mirrors the ExitPlanMode pattern via a new goal_start display kind + a dedicated ask policy. auto mode still auto-approves.
  • Menu descriptions: the approval panel can now show per-option helper text (optional description on ApprovalPanelChoice), so the CreateGoal menu shows the same descriptions as /goal. Choices without a description render exactly as before.
  • No goalId leak: CreateGoal/GetGoal no longer serialize the internal goalId to the model, so it can't echo a meaningless UUID to the user. The id stays on GoalSnapshot for the TUI/SDK.

Testing

  • agent-core full suite green; new tests for the mid-turn continuation, the goal-start-review-ask policy, the goalId redaction, the approval adapter menus, and the panel description rendering.
  • agent-core, kimi-code, and protocol typecheck clean; lint clean on changed files.

Note for reviewers

Non-TUI approval clients (e.g. ACP) receive the new goal_start display kind and fall back to generic rendering, same as plan_review. First-class handling there would be a follow-up.

🤖 Generated with Claude Code

The skill told the model to print '/goal <objective>' text for the user
to paste rather than starting the goal itself, so an approved draft never
became an active goal until the user manually invoked the tool. Once the
user approves the wording, call CreateGoal directly; a final confirmation
still runs before the goal begins.
The contract template, examples, and stop rule all told the model to add
a turn cap, so it baked 'stop after N turns' into objectives and set a
budget unprompted. Drop the default cap, separate the honest stop/blocked
rule from spending limits, and add guidance to suggest a budget only when
useful, framed on token cost, and to warn on oversized values.
turnWorker read goal status once at turn launch and only handed off to
the continuation driver when the goal was already active, or was
paused/blocked and resumed. A goal created mid-turn via the CreateGoal
tool became active during an ordinary turn, so the driver never engaged
and the run stopped after the turn that started it. Broaden the post-turn
gate to drive whenever the goal is active after a clean turn.
A model-issued CreateGoal showed a plain Approve/Reject prompt, so an
approved goal began under whatever mode happened to be active. Mirror the
ExitPlanMode pattern: a new goal_start display kind carries the objective
and current mode, a dedicated ask policy intercepts CreateGoal in
manual/yolo and applies the chosen permission mode before the goal is
created, and the TUI approval panel renders the same auto/yolo/manual/
decline options as the /goal command. auto mode still auto-approves.
CreateGoal and GetGoal serialized the full snapshot, including the random
goalId, so the model could echo it to the user as if it were meaningful.
No goal tool takes an id, so strip it from the model-facing tool output
while keeping it on GoalSnapshot for the TUI/SDK.
The approval panel rendered choices as labels only, so the CreateGoal
start menu dropped the per-option descriptions the /goal command shows.
Add an optional description to ApprovalPanelChoice, populate it from the
shared /goal options, and render it dim beneath the label. Choices without
a description render exactly as before.
Add the skill loader and register it alongside the other builtins. The
SKILL.md body landed in earlier commits but its wrapper and registration
were missed, so the skill was not actually discoverable until now.
@changeset-bot

changeset-bot Bot commented Jun 17, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 2985236

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jun 17, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@2985236
npx https://pkg.pr.new/@moonshot-ai/kimi-code@2985236

commit: 2985236

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2985236ced

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +309 to +311
const goalBecameActive = this.agent.goal.getGoal().goal?.status === 'active';
if (
resumedFromPausedOrBlocked &&
currentGoalStatus === 'active' &&
goalBecameActive &&

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep created-goal continuations cancelable

When CreateGoal makes a previously non-goal turn active, this broadened branch now enters driveGoal after runOneTurn(..., true) has already cleared activeTurn. The continuation loop then runs with hasActiveTurn === false, so user steering can launch a concurrent turn and cancel() cannot abort the original controller/signal for the autonomous goal run. This affects the new guided/model-authored goal path; keep the active turn alive (as the already-active goal path does) before starting these continuations.

Useful? React with 👍 / 👎.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant