diff --git a/.changeset/plan-timestamp-prefix.md b/.changeset/plan-timestamp-prefix.md new file mode 100644 index 00000000000..d757c9686bf --- /dev/null +++ b/.changeset/plan-timestamp-prefix.md @@ -0,0 +1,5 @@ +--- +"@kilocode/cli": patch +--- + +Restore session timestamp prefixes for generated plan filenames while preserving descriptive model-chosen names. diff --git a/packages/opencode/src/kilocode/session/native-plan-prompt.txt b/packages/opencode/src/kilocode/session/native-plan-prompt.txt index 108154c7392..f6cfdf2ece3 100644 --- a/packages/opencode/src/kilocode/session/native-plan-prompt.txt +++ b/packages/opencode/src/kilocode/session/native-plan-prompt.txt @@ -22,7 +22,7 @@ Your job is to gather context, challenge assumptions, resolve design questions, - You may create and edit plan Markdown files only. - Follow the latest Plan File reminder for the target plan location. -- Prefer `.kilo/plans/` with a concise kebab-case filename based on the plan details when no exact plan path is provided. +- If no exact plan file path is provided, follow the latest Plan File reminder for the directory and generated filename pattern. - Use repo-root `plans/`, `.plans/`, or `.opencode/plans/` only when requested or required by the repo/client and your permissions allow it. - Do not write the final plan or call `plan_exit` until the user chooses "Finalize and save the plan". - After final approval, write the final plan to the chosen plan file, then call `plan_exit` with the saved plan path. diff --git a/packages/opencode/src/kilocode/session/prompt.ts b/packages/opencode/src/kilocode/session/prompt.ts index 7a78d09239f..2200e4089f3 100644 --- a/packages/opencode/src/kilocode/session/prompt.ts +++ b/packages/opencode/src/kilocode/session/prompt.ts @@ -287,12 +287,13 @@ export namespace KiloSessionPrompt { const file = input.messages ? PlanFile.latest(input.messages) : undefined const saved = PlanFile.resolve(file, ctx) const target = saved ?? plan + const time = input.session.time.created const dir = path.dirname(target) if (saved && !(await Filesystem.exists(target))) await ensurePlanDir(dir) const info = saved ? `The current saved plan file is ${target}. Read and edit this file when refining the plan.` - : `Use the plan path specified by the user or project instructions when present and permissions allow it. If none is specified, create a plan in ${dir} using a concise kebab-case filename based on the plan details.` + : `Use any exact plan file path from user or project instructions unchanged. If only a directory is specified, create the plan there; otherwise create it in ${dir}. For generated filenames, use ${time}-.md, choosing the suffix from the plan details, for example ${time}-database-cache-plan.md.` const body = [ "## Plan File", info, diff --git a/packages/opencode/test/kilocode/plan-exit-detection.test.ts b/packages/opencode/test/kilocode/plan-exit-detection.test.ts index a0732f45b68..def09b3bea7 100644 --- a/packages/opencode/test/kilocode/plan-exit-detection.test.ts +++ b/packages/opencode/test/kilocode/plan-exit-detection.test.ts @@ -681,9 +681,9 @@ describe("plan_exit detection", () => { const part = user.parts.at(-1) const text = part?.type === "text" ? part.text : "" - expect(text).toContain("Use the plan path specified by the user or project instructions") + expect(text).toContain(`${session.time.created}-.md`) + expect(text).toContain(`${session.time.created}-database-cache-plan.md`) expect(text).toContain("plans/ or .plans/") - expect(text).toContain("If none is specified") expect(text).not.toContain(Session.plan(session, Instance.current)) })) @@ -733,8 +733,7 @@ describe("plan_exit detection", () => { const text = content(user) expect(text).toContain("The current saved plan file is") expect(text.replaceAll(path.sep, "/")).toContain(".plans/fix.md") - expect(text).toContain("Read and edit this file when refining the plan") - expect(text).toContain("experienced technical leader") + expect(text).not.toContain(`${session.time.created}-.md`) expect(text).not.toContain("No plan file exists yet") })) @@ -771,8 +770,7 @@ describe("plan_exit detection", () => { const part = user.parts.at(-1) const text = part?.type === "text" ? part.text : "" - expect(text).toContain("Use the plan path specified by the user or project instructions") - expect(text).toContain("If none is specified") + expect(text).toContain(`${session.time.created}-.md`) expect(text).toContain("plans/ or .plans/") expect(text).not.toContain("Default to") expect(text).not.toContain("A fallback plan file exists")