MoonshotAI / MoonshotAI/kimi-code

feat(agent-core): throttle goal continuation turns when waiting for background agents

Open
#666 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
7.5k
Forks
1.2k
Avg merge
11h 53m
Merged PRs (30d)
350

Description

When running in goal mode with a swarm of background agents, the driveGoal() loop currently schedules continuation turns with no minimum interval. The model calls TaskList every 1-2 seconds to check agent status, consuming 100-200 tokens per turn and wasting a large amount of context over a long-running goal.

We fixed this in our fork by adding a 15-second minimum interval between goal continuation turns and by updating the goal reminder/continuation prompt to tell the model not to poll background tasks with TaskList (prefer automatic completion notifications or TaskOutput(block=true)).

Commit with the fix: https://github.com/thecannabisapp/kimi-code/commit/f227bb20

If the maintainers want to merge this, the key changes are in packages/agent-core/src/agent/turn/index.ts (the driveGoal throttle) and packages/agent-core/src/agent/injection/goal.ts (the prompt guidance).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with driveGoal in packages/agent-core/src/agent/turn/index.ts and the goal reminder and continuation prompt in packages/agent-core/src/agent/injection/goal.ts. Compare the referenced commit f227bb20 with the current files, then verify that goal continuation turns have a 15-second minimum interval and that the prompt directs the model away from TaskList polling toward completion notifications or TaskOutput(block=true).

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
ai, cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
75/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.