From c31289e17529157f43c7fa44b62e1f3ce79d6015 Mon Sep 17 00:00:00 2001 From: "haozhe.yang" Date: Wed, 22 Jul 2026 16:52:58 +0800 Subject: [PATCH 1/2] docs(cron): drop references to the non-existent `kimi resume` command - point user docs at the real resume command `kimi --session` - reword cron tool descriptions and code comments in agent-core and agent-core-v2 to describe session resume without naming a subcommand --- docs/en/configuration/data-locations.md | 2 +- docs/en/guides/use-cases.md | 2 +- docs/en/reference/tools.md | 2 +- docs/zh/configuration/data-locations.md | 2 +- docs/zh/guides/use-cases.md | 2 +- docs/zh/reference/tools.md | 2 +- .../src/session/cron/tools/cron-create.md | 5 ++-- .../src/session/cron/tools/cron-create.ts | 2 +- .../src/session/cron/tools/cron-list.md | 4 ++-- packages/agent-core/src/agent/cron/manager.ts | 24 ++++++++++--------- .../agent-core/src/tools/cron/cron-create.md | 5 ++-- .../agent-core/src/tools/cron/cron-create.ts | 4 ++-- .../agent-core/src/tools/cron/cron-list.md | 4 ++-- .../agent-core/src/tools/cron/scheduler.ts | 6 ++--- packages/agent-core/src/tools/cron/types.ts | 7 +++--- .../agent-core/test/agent/cron/resume.test.ts | 2 +- 16 files changed, 38 insertions(+), 37 deletions(-) diff --git a/docs/en/configuration/data-locations.md b/docs/en/configuration/data-locations.md index 17ad91d3c3..fa7bb44643 100644 --- a/docs/en/configuration/data-locations.md +++ b/docs/en/configuration/data-locations.md @@ -81,7 +81,7 @@ Inside each session directory: - **`agents/agent-0/` etc.**: sub-Agent instance directories, each containing their own `wire.jsonl`. - **`logs/kimi-code.log`**: diagnostic log for this session; only present when a diagnostic event occurs. - **`tasks/`**: background task persistence — `tasks/.json` stores status/pid/exit code; `tasks//output.log` stores output. -- **`cron/`**: scheduled task persistence; reloaded into the scheduler when `kimi resume` runs. See [Scheduled tasks](../reference/tools.md#scheduled-tasks). +- **`cron/`**: scheduled task persistence; reloaded into the scheduler when the session is resumed with `kimi --session`. See [Scheduled tasks](../reference/tools.md#scheduled-tasks). ## Built-in tool cache diff --git a/docs/en/guides/use-cases.md b/docs/en/guides/use-cases.md index 47ec976513..0b367aa11e 100644 --- a/docs/en/guides/use-cases.md +++ b/docs/en/guides/use-cases.md @@ -121,7 +121,7 @@ Check the production health endpoint every hour and let me know if anything look Come back in about 10 minutes and check whether the build has finished. ``` -Scheduled tasks are bound to their session — closing the terminal is fine, and they are reloaded and continue firing when you run `kimi resume` on the same session. They are not carried into brand-new sessions. Recurring tasks expire after 7 days — the agent receives a `stale` signal on the final trigger and decides whether to stop or renew based on your original instructions. +Scheduled tasks are bound to their session — closing the terminal is fine, and they are reloaded and continue firing when you resume the same session with `kimi --session`. They are not carried into brand-new sessions. Recurring tasks expire after 7 days — the agent receives a `stale` signal on the final trigger and decides whether to stop or renew based on your original instructions. To see what tasks are currently pending, just ask the agent (it calls the read-only `CronList` tool). To cancel a task, tell the agent to remove it or reference its 8-character ID. For the full tool reference, see [Scheduled tasks](../reference/tools.md#scheduled-tasks). The global kill switch is `KIMI_DISABLE_CRON=1`. diff --git a/docs/en/reference/tools.md b/docs/en/reference/tools.md index 8854caefc6..0a5c3ecf50 100644 --- a/docs/en/reference/tools.md +++ b/docs/en/reference/tools.md @@ -115,7 +115,7 @@ Background task tools manage tasks started via `Bash`, `Agent`, or `AskUserQuest ## Scheduled Tasks -Scheduled task tools allow the Agent to re-inject a prompt into the current session at a future time — either as a one-time reminder or as a recurring cron-triggered task (periodic checks, daily reports, deployment monitoring, etc.). Schedules are bound to the session and remain active after `kimi resume`, but are not carried into a brand-new session. A single session can hold at most 50 active scheduled tasks. Set `KIMI_DISABLE_CRON=1` to disable them entirely; see [Environment Variables](../configuration/env-vars.md#运行时开关). +Scheduled task tools allow the Agent to re-inject a prompt into the current session at a future time — either as a one-time reminder or as a recurring cron-triggered task (periodic checks, daily reports, deployment monitoring, etc.). Schedules are bound to the session and remain active when you resume it with `kimi --session`, but are not carried into a brand-new session. A single session can hold at most 50 active scheduled tasks. Set `KIMI_DISABLE_CRON=1` to disable them entirely; see [Environment Variables](../configuration/env-vars.md#运行时开关). | Tool | Default Approval | Description | | --- | --- | --- | diff --git a/docs/zh/configuration/data-locations.md b/docs/zh/configuration/data-locations.md index 9dd6d102b0..5ab5aaa027 100644 --- a/docs/zh/configuration/data-locations.md +++ b/docs/zh/configuration/data-locations.md @@ -81,7 +81,7 @@ $KIMI_CODE_HOME (默认 ~/.kimi-code) - **`agents/agent-0/` 等**:子 Agent 实例目录,各自含 `wire.jsonl`。 - **`logs/kimi-code.log`**:该会话的诊断日志,只有发生诊断事件时才存在。 - **`tasks/`**:后台任务持久化——`tasks/.json` 保存状态/pid/退出码,`tasks//output.log` 保存输出。 -- **`cron/`**:定时任务持久化,`kimi resume` 时重新加载到调度器。详见[定时任务](../reference/tools.md#定时任务)。 +- **`cron/`**:定时任务持久化,用 `kimi --session` 恢复会话时重新加载到调度器。详见[定时任务](../reference/tools.md#定时任务)。 ## 内置工具缓存 diff --git a/docs/zh/guides/use-cases.md b/docs/zh/guides/use-cases.md index dfca79ca83..3222c08eec 100644 --- a/docs/zh/guides/use-cases.md +++ b/docs/zh/guides/use-cases.md @@ -121,7 +121,7 @@ src/parser/markdown.ts 目前几乎没有测试。请补一组单元测试,覆 大约 10 分钟之后再回来,确认一下构建是否结束。 ``` -定时计划绑定在会话内:关掉终端没关系,对同一个会话执行 `kimi resume` 时会重新加载并继续触发;但它们不会带入全新的会话。周期任务在 7 天后会自动过期——Agent 会在最后一次触发时收到 `stale` 提示,可根据你之前的指示决定结束还是续期。 +定时计划绑定在会话内:关掉终端没关系,用 `kimi --session` 恢复同一个会话时会重新加载并继续触发;但它们不会带入全新的会话。周期任务在 7 天后会自动过期——Agent 会在最后一次触发时收到 `stale` 提示,可根据你之前的指示决定结束还是续期。 想查看当前有哪些挂起的任务,直接问 Agent 即可(它会调用只读的 `CronList` 工具);要取消某个任务,让 Agent 删除它或引用对应的 8 位 id。完整工具说明见[定时任务](../reference/tools.md#定时任务);整体关停开关是 `KIMI_DISABLE_CRON=1`。 diff --git a/docs/zh/reference/tools.md b/docs/zh/reference/tools.md index 810ffc6b97..3514fda042 100644 --- a/docs/zh/reference/tools.md +++ b/docs/zh/reference/tools.md @@ -115,7 +115,7 @@ Plan 模式是一种受约束的工作状态:进入后 `Write` 与 `Edit` 只 ## 定时任务 -定时任务工具允许 Agent 把一段 prompt 在未来某个时间重新注入到当前会话——既可以是一次性提醒,也可以是按 cron 周期触发的任务(定期巡检、每日报表、部署监控等)。计划绑定到会话,执行 `kimi resume` 后仍然有效,但不会带入全新的会话。单个会话最多保留 50 个生效中的定时任务。设置 `KIMI_DISABLE_CRON=1` 可整体禁用,详见[环境变量](../configuration/env-vars.md#运行时开关)。 +定时任务工具允许 Agent 把一段 prompt 在未来某个时间重新注入到当前会话——既可以是一次性提醒,也可以是按 cron 周期触发的任务(定期巡检、每日报表、部署监控等)。计划绑定到会话,用 `kimi --session` 恢复会话后仍然有效,但不会带入全新的会话。单个会话最多保留 50 个生效中的定时任务。设置 `KIMI_DISABLE_CRON=1` 可整体禁用,详见[环境变量](../configuration/env-vars.md#运行时开关)。 | 工具 | 默认审批 | 说明 | | --- | --- | --- | diff --git a/packages/agent-core-v2/src/session/cron/tools/cron-create.md b/packages/agent-core-v2/src/session/cron/tools/cron-create.md index 1973ec1741..04384b165d 100644 --- a/packages/agent-core-v2/src/session/cron/tools/cron-create.md +++ b/packages/agent-core-v2/src/session/cron/tools/cron-create.md @@ -67,9 +67,8 @@ Use `recurring: false` for "remind me at X" style requests, single deadlines, "i ## Session lifetime Cron tasks live in the current kimi CLI session. When you exit, they -are persisted under the session homedir; the next `kimi resume` of the -same session reloads them and the scheduler resumes from each task's -`createdAt`. Fire times that fell during the offline window are +are persisted under the session homedir; resuming the same session +reloads them and the scheduler resumes from each task's `createdAt`. Fire times that fell during the offline window are collapsed into a single delivery via `coalescedCount` (and recurring tasks past their 7-day window arrive with `stale: true` as their final delivery). diff --git a/packages/agent-core-v2/src/session/cron/tools/cron-create.ts b/packages/agent-core-v2/src/session/cron/tools/cron-create.ts index 4bf3118c27..3215a6cf20 100644 --- a/packages/agent-core-v2/src/session/cron/tools/cron-create.ts +++ b/packages/agent-core-v2/src/session/cron/tools/cron-create.ts @@ -5,7 +5,7 @@ * * Tasks live in `ISessionCronService` (Session scope) and are persisted * through the App-scoped `ICronTaskPersistence` under the project's cron - * scope, so a `kimi resume` of the same session reloads them and the + * scope, so resuming the same session reloads them and the * scheduler picks up where it left off (fires that fell during downtime * are collapsed into a single delivery with `coalescedCount`). Tasks do * NOT carry over into a brand-new session. diff --git a/packages/agent-core-v2/src/session/cron/tools/cron-list.md b/packages/agent-core-v2/src/session/cron/tools/cron-list.md index a7448079e5..d7d030eb66 100644 --- a/packages/agent-core-v2/src/session/cron/tools/cron-list.md +++ b/packages/agent-core-v2/src/session/cron/tools/cron-list.md @@ -45,8 +45,8 @@ Guidelines: cancel or modify a schedule, route the request through the model (i.e. call `CronDelete` or `CronCreate` on their behalf). - The empty case returns `cron_jobs: 0\nNo cron jobs scheduled.`. Cron - tasks survive a `kimi resume` of the same session but do not bleed - into new sessions. + tasks survive a resume of the same session but do not bleed into new + sessions. - After a context compaction, or whenever you are unsure which cron jobs are live, call this tool to re-enumerate them rather than guessing ids from earlier in the conversation. diff --git a/packages/agent-core/src/agent/cron/manager.ts b/packages/agent-core/src/agent/cron/manager.ts index 50d410764e..a959ca1b07 100644 --- a/packages/agent-core/src/agent/cron/manager.ts +++ b/packages/agent-core/src/agent/cron/manager.ts @@ -13,10 +13,11 @@ * - translate a fired `CronTask` into a `steer(...)` call carrying a * `CronJobOrigin`, plus the `cron_fired` telemetry event; * - mirror every store mutation to `/cron/.json` - * (via {@link addTask} / {@link removeTasks}) so that `kimi resume` - * can call {@link loadFromDisk} to rehydrate previously-scheduled - * tasks. When no `sessionDir` is supplied (subagents, tests, - * ephemeral sessions) the manager stays purely in-memory. + * (via {@link addTask} / {@link removeTasks}) so that a resumed + * session can call {@link loadFromDisk} to rehydrate + * previously-scheduled tasks. When no `sessionDir` is supplied + * (subagents, tests, ephemeral sessions) the manager stays purely + * in-memory. * - provide a `handleMissed(...)` entry point that future boot-time * missed-task notification will call. Today the scheduler's * `coalescedCount` semantics handle missed fires inline, so this @@ -143,7 +144,7 @@ export class CronManager { * `sessionDir` was supplied — the manager then behaves as pure * in-memory, matching pre-persistence semantics. When defined, * `addTask` / `removeTasks` schedule fire-and-forget writes so a - * later `kimi resume` can reload via {@link loadFromDisk}. + * later session resume can reload via {@link loadFromDisk}. */ private readonly persistStore: PerIdJsonStore | undefined; @@ -241,9 +242,9 @@ export class CronManager { /** * Persist the scheduler's `lastFiredAt` cursor for a recurring task - * so a `kimi resume` does not coalesce-replay an already-delivered - * fire. Called by the scheduler's `onAdvanceCursor` callback after a - * successful recurring fire. + * so resuming the session does not coalesce-replay an + * already-delivered fire. Called by the scheduler's `onAdvanceCursor` + * callback after a successful recurring fire. * * No-op when the task has already been removed between fire and * callback (concurrent CronDelete is the canonical case). When @@ -261,9 +262,10 @@ export class CronManager { } /** - * Rehydrate the in-memory store from `/cron/` after - * `kimi resume`. No-op when persistence is not attached. Idempotent: - * clears the in-memory map and re-inserts every record on disk. + * Rehydrate the in-memory store from `/cron/` after the + * session is resumed. No-op when persistence is not attached. + * Idempotent: clears the in-memory map and re-inserts every record on + * disk. * * Tasks are inserted via {@link SessionCronStore.adopt} so the * original `id` and `createdAt` survive — `createdAt` is the diff --git a/packages/agent-core/src/tools/cron/cron-create.md b/packages/agent-core/src/tools/cron/cron-create.md index a01151bd92..a922b5ec01 100644 --- a/packages/agent-core/src/tools/cron/cron-create.md +++ b/packages/agent-core/src/tools/cron/cron-create.md @@ -67,9 +67,8 @@ Use `recurring: false` for "remind me at X" style requests, single deadlines, "i ## Session lifetime Cron tasks live in the current kimi CLI session. When you exit, they -are persisted under the session homedir; the next `kimi resume` of the -same session reloads them and the scheduler resumes from each task's -`createdAt`. Fire times that fell during the offline window are +are persisted under the session homedir; resuming the same session +reloads them and the scheduler resumes from each task's `createdAt`. Fire times that fell during the offline window are collapsed into a single delivery via `coalescedCount` (and recurring tasks past their 7-day window arrive with `stale: true` as their final delivery). diff --git a/packages/agent-core/src/tools/cron/cron-create.ts b/packages/agent-core/src/tools/cron/cron-create.ts index e02bb8761b..4686a6e7f2 100644 --- a/packages/agent-core/src/tools/cron/cron-create.ts +++ b/packages/agent-core/src/tools/cron/cron-create.ts @@ -4,8 +4,8 @@ * cron cadence (`recurring: true`, the default). * * Tasks live in `SessionCronStore` and are mirrored to - * `/cron/.json` via `CronManager.addTask`, so a - * `kimi resume` of the same session reloads them and the scheduler + * `/cron/.json` via `CronManager.addTask`, so resuming + * the same session reloads them and the scheduler * picks up where it left off (fires that fell during downtime are * collapsed into a single delivery with `coalescedCount`). Tasks do * NOT carry over into a brand-new session. diff --git a/packages/agent-core/src/tools/cron/cron-list.md b/packages/agent-core/src/tools/cron/cron-list.md index 52ac8c8344..a499f0a754 100644 --- a/packages/agent-core/src/tools/cron/cron-list.md +++ b/packages/agent-core/src/tools/cron/cron-list.md @@ -45,8 +45,8 @@ Guidelines: cancel or modify a schedule, route the request through the model (i.e. call `CronDelete` or `CronCreate` on their behalf). - The empty case returns `cron_jobs: 0\nNo cron jobs scheduled.`. Cron - tasks survive a `kimi resume` of the same session but do not bleed - into new sessions. + tasks survive a resume of the same session but do not bleed into new + sessions. - After a context compaction, or whenever you are unsure which cron jobs are live, call this tool to re-enumerate them rather than guessing ids from earlier in the conversation. diff --git a/packages/agent-core/src/tools/cron/scheduler.ts b/packages/agent-core/src/tools/cron/scheduler.ts index 0e0220ef1d..8eb6d399a2 100644 --- a/packages/agent-core/src/tools/cron/scheduler.ts +++ b/packages/agent-core/src/tools/cron/scheduler.ts @@ -90,8 +90,8 @@ export interface CronSchedulerOptions { * Optional. Called after a recurring task fires successfully, with * the wall-clock timestamp of the last ideal occurrence whose * jittered delivery has just been delivered. The manager wires this - * to `store.markFired(id, ts)` + a per-id JSON write so a - * `kimi resume` does not replay the fire. + * to `store.markFired(id, ts)` + a per-id JSON write so resuming the + * session does not replay the fire. * * Fire-and-forget: the scheduler does not wait for persistence to * settle. One-shot tasks do not invoke this callback (the @@ -172,7 +172,7 @@ export function createCronScheduler(opts: CronSchedulerOptions): CronScheduler { const parsedCache = new Map(); // Per-task wall-clock baseline for "where did we last look from". - // Now persisted across `kimi resume` via `task.lastFiredAt`: when + // Now persisted across session resumes via `task.lastFiredAt`: when // the scheduler first sees a task whose `lastFiredAt` is set and // not in the future, that timestamp seeds this map so resume does // not coalesce-replay already-delivered recurring fires. A bogus diff --git a/packages/agent-core/src/tools/cron/types.ts b/packages/agent-core/src/tools/cron/types.ts index c03d55b4ec..bdf8c68f4a 100644 --- a/packages/agent-core/src/tools/cron/types.ts +++ b/packages/agent-core/src/tools/cron/types.ts @@ -11,9 +11,10 @@ * - `recurring` — undefined / true means "fire repeatedly until deleted * or auto-expired"; false means "fire once then auto-delete". * - `lastFiredAt` — wall-clock epoch ms of the last ideal occurrence - * whose jittered delivery has actually completed. Persisted so a - * `kimi resume` does not replay already-delivered recurring fires: - * without it, the scheduler would fall back to `createdAt` and + * whose jittered delivery has actually completed. Persisted so + * resuming the session does not replay already-delivered recurring + * fires: without it, the scheduler would fall back to `createdAt` + * and * coalesce yesterday's already-fired 09:00 into today's tick. A * value greater than the current wall clock is treated as corrupt * and the scheduler falls back to `createdAt` for that task. diff --git a/packages/agent-core/test/agent/cron/resume.test.ts b/packages/agent-core/test/agent/cron/resume.test.ts index 35d8115fc2..7f2c25b961 100644 --- a/packages/agent-core/test/agent/cron/resume.test.ts +++ b/packages/agent-core/test/agent/cron/resume.test.ts @@ -3,7 +3,7 @@ * * The manager's `addTask` / `removeTasks` wrappers mirror every mutation * to `/cron/.json`, and `loadFromDisk()` re-populates - * the in-memory store on `kimi resume`. The scheduler's + * the in-memory store when the session is resumed. The scheduler's * `createdAt`-based baseline is what makes a reloaded task fire * correctly even when ideal fire times landed during downtime — these * tests pin down both sides of the contract. From 6936be658791eefb3b21024489aa1a2fa2b8774a Mon Sep 17 00:00:00 2001 From: "haozhe.yang" Date: Wed, 22 Jul 2026 16:55:11 +0800 Subject: [PATCH 2/2] chore: add changeset for cron docs wording fix --- .changeset/drop-kimi-resume-refs.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/drop-kimi-resume-refs.md diff --git a/.changeset/drop-kimi-resume-refs.md b/.changeset/drop-kimi-resume-refs.md new file mode 100644 index 0000000000..81bc92cc80 --- /dev/null +++ b/.changeset/drop-kimi-resume-refs.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kimi-code": patch +--- + +Remove references to the non-existent `kimi resume` command from the scheduled-task tool descriptions.