[PR #4956] [CLOSED] [GUI] Plan mode: a plan card for every Plan-mode turn, including the requirements and the steps #5264

Closed
opened 2026-11-07 16:33:55 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/4956
Author: @MohSakhaei
Created: 11/1/2026
Status: ❌ Closed

Base: main ← Head: feature/plan-card


📝 Commits (3)

  • aeb31da Plan card now shows steps and they get updated upon completion of each step
  • 38cf1db Plan card starts with user request and AI agent findings and then steps
  • 8f7091f Merge main (v0.2.10) into feature/plan-card

📊 Changes

13 files changed (+457 additions, -37 deletions)

View changed files

📝 apps/host/server/agent/agent-bridge.mjs (+25 -7)
➕ apps/host/server/agent/plan-md.mjs (+115 -0)
📝 apps/host/server/agent/plan.mjs (+24 -9)
📝 apps/host/server/index.mjs (+1 -1)
📝 apps/host/src/components/PlanCard.tsx (+26 -2)
📝 apps/host/src/lib/plan.ts (+2 -2)
📝 apps/host/src/lib/store.ts (+4 -3)
📝 apps/host/src/screens/Chat.tsx (+21 -11)
📝 apps/host/src/styles/app.css (+9 -1)
➕ apps/host/tests/agent-plan-md.test.mjs (+178 -0)
📝 apps/host/tests/agent-plan-run.test.mjs (+1 -1)
📝 apps/host/tests/agent-plan.test.mjs (+26 -0)
📝 apps/host/tests/ui5-plan.test.mjs (+25 -0)

📄 Description

Problem and result

Before, all of it checked against the release itself (v0.2.9, c62d5e3a) :

  • Nothing in the release turns a Plan-mode turn into a plan. The mode is Plan only when /plan was typed
    (agent-bridge.mjs:410: const appliedMode = planTask ? 'plan' : modeOf(mode)), and the end of a turn
    creates a plan only when /plan was typed (settlePlan, :656-661, if (planTask)). So in a chat where you
    pick Plan in the MODE menu and ask for something there is no plan-shaped output at all: no card, no steps, no
    entry in <data>/agent/plans.json, no file.
  • What that turn does instead: the model works the way it works in Agent mode, because nothing tells it the mode
    is planning (the line in the chat harness that used to say so was removed, preset.mjs:16-17,32), while the mode is
    read-only, which is what refuses its writes, and the gate also turns away connected tools with "Plan mode only
    looks and changes nothing, so it cannot use this tool" (strata-gate.mjs:369-372).
    My chat on 2026-11-01 on a clean install from the release installer, in an empty folder, was six tool
    calls, three refused by the read-only sandbox, one escalation asked and settled as a decision by me, no
    steps and nothing on disk. That session is kept on disk as a transcript, so what follows is quoted from
    the file rather than from memory. #4124 reports the same situation from macOS and quotes the same
    message.

After:

  • A Plan-mode turn ends with a plan object, which in the release it never did. It is asked for two parts,
    findings first and the numbered list last, and it gets the card, the Plan tab, and
    .strata/plans/<name>.md in the chat's folder. The file reads what you
    asked, then what the turn found by looking, then ## Steps with one box per step.
  • Approve starts the step run. The host runs one goal round per step ("You are on step 2 of 3"), marks the step
    done with a one-line summary, and rewrites the file. Stop pauses where it was, Resume carries on, and the
    boxes tick in the card, the tab and the file.
  • The file is written by the app, never by the model. The Plan preset is untouched: still read-only, still
    approval: never.

What that release chat said, quoted from the session file
(home/sessions/--E-Projects-Test5--/session-296eb1e2-d2d9-4647-b059-d01dad800a13/session.v4.jsonl.zstd,
2026-11-01 21:24: 62 records across 23 zstd frames, decoded with the app's own Node 24.12.0). The chat
had Plan picked in the MODE menu and asked for a Blazor weather app in E:\Projects\Test5:

  • The mode is reported to the model as something I did: The approval policy changed from "ask" to "never" (changed by the user). I picked a mode, and the harness tells the model I edited its policy.
  • The file and command tools still carry an escape hatch in Plan mode: edit, pwsh and write each take
    a sandbox_permissions value whose enum is workspace-write and danger-full-access, plus a
    one-sentence justification the model is told to address to me.
  • The refusal it got: [sandbox: file access denied under read-only mode] [sandbox: escalation available - retry this exact operation once with sandbox_permissions ... the approval prompt asks the user].
  • After one escalation was asked and settled: Error: the user rejected escalating this command to "workspace-write"; it stays denied, so stop and explain instead of working around it.
  • So the model reads a mode as a person who changed their mind: "The sandbox blocked writing the project.
    Retrying with workspace write access." and then "The project-scaffold command was declined. Let me try
    creating the files directly with the file-writing tool instead."
  • The model reasons about it as a person who keeps saying no: "The user's original request was to create an
    app, and they rejected the scaffold escalation, which is puzzling. Maybe the approval prompt was unclear,
    or they prefer the write tool."
  • The word "planning" turns up once in all 62 records, in that reasoning, and it means about to build: "I'm
    planning out a Blazor Server application ... Let me check what .NET version is available and start
    building this out". Nothing in the session tells the model what the mode is for.
  • And it ends as a blocked builder, not as a planner: "I wasn't able to create any files: my sandbox
    currently only has read-only access to E:\Projects\Test5, and when I asked to widen it to allow
    writing the new project, the approval prompt was declined. Nothing was created or changed. Here's the
    plan I'm ready to execute as soon as write access is approved:"

Nothing from that turn became a plan. plans.json gained no entry for that chat, E:\Projects\Test5 is
still empty, and there is no .strata folder. The model did keep a list once (todo_write), and the app
renders it as one line ("Updates its to-do list.", events.mjs:52): it is the model's note about its own
turn, not something the app can tick, and it does not outlive the turn.

Searched the open and closed issues and pull requests for plan, plan mode, plan card, checklist and
todo. These came up, and I read each of them:

  • #4124 (open) reports Plan-mode writes being refused and an escalation retry blamed on the user. The
    block under Problem and result quotes the same wording out of a Windows session file, and it is the
    exact line #4124 objects to: the user rejected escalating this command to "workspace-write". My
    change does not touch that error message; it gives the model something else to do instead, which is
    why the refused writes are less likely in the first place.
  • #4120 (open) asks for a mode that is restricted and autonomous at the same time, between Manual and Bypass.
    That is the right place for the harder question this change leaves open: a plan run cannot write while the chat
    stays in Plan mode, so the client switches the chat to Manual before starting it, as upstream did. If a
    workspace-write preset lands, a chat left in Plan mode could carry its own plan out, and I would build on that
    rather than invent a mode here.
  • #3479 (closed) is about UI strings that never reach the locale files, /plan and PlanCard.tsx among them.
    This change adds no interface string, so nothing new goes missing from the catalogs; tests/locale-gaps.test.mjs
    fails on any tr("…") with no English entry and stays green.
  • #1719 is the RFC for the agent tab, which is where plan mode and goal mode came from.
  • #4618 asks for long local sessions to hold together, including a helper keeping the mode it was created with.
    Nothing here conflicts with it.

No thread covers a plan checklist file in the project, or a plan for every Plan-mode turn, so this is a new
thread rather than an addition. The scope issue described above should come first; this line becomes its URL.

Approach

One plan object in the host, and it brings a file with it.

Three reasons for this shape:

  • Every plan change already passes through one report function in the bridge, so a wrapper there writes the file
    and keeps its name in the plan. The card, the sidebar tab and the file come from the same plan frame and
    cannot drift apart.
  • The ticks have to be the host's job. Nothing outside the model knows which step of its own prose it has
    finished, and only the plan's steps carry state. The file mirrors that state rather than the model's
    narration, which is what freelanced it before.
  • The release already turns on the harness to-do tool (preset.mjs:29,91, tools-catalog.mjs:19), but
    the app shows one line per update (events.mjs:52,86), the list belongs to the model's turn, and it
    never leaves the session. The plan steps are the only checklist here that carries a state the app can
    act on, so the file and the card are both built from them.
  • The findings are the model's own words, kept rather than invented. parsePlan already took the last numbered
    run of two or more items as the steps; it now also keeps everything written before them as plan.context,
    capped at 3000 characters. planPrompt asks for that order. No harness change, no new prompt machinery.

The harness is where a Plan-mode turn would normally be told it is planning, and the upstream planning group
was removed from it (preset.mjs:16-17,32, docs/HARNESS.md:106). Until that comes back, the instruction
travels in the message, which is what /plan already did.

13 files:

  • server/agent/plan-md.mjs (new, 115 lines) writes the plan document: a marker line with the plan id, the
    title, a state line (approved · 1 of 4 steps done), what was asked for as a blockquote, then the findings,
    then ## Steps and one checkbox per step (the step's words, its reason after a dash, what it ended with).
    Atomic write (.tmp then rename), rewritten only when the text changed. A file at that name without our marker
    line was written by someone else and is never touched; the next name in the series is used. No steps or no
    chat folder means no file.
  • server/agent/plan.mjs: the two-part instruction in planPrompt, the findings capture in parsePlan and
    PlanStore.create, and one line in stepObjective that tells a step round where the plan document is, in
    case it needs that background.
  • server/agent/agent-bridge.mjs: five small hunks. The onPlan wrapper and planFileOf, the turn guard
    counting plan rewrites for a Plan-mode turn (plan: !!planTask || appliedMode === 'plan'), a Plan-mode turn
    going out through planPrompt and ending in settlePlan, and the plan keeping context.
  • server/index.mjs: one line, the report function passed through under its new name.
  • src/lib/plan.ts reads file and context (a blank or non-string context is dropped);
    src/components/PlanCard.tsx gains an "Open .md" line and a findings block above the steps, in the card
    and in the sidebar pane, through the markdown renderer answers already use; src/styles/app.css gains nine
    rules next to the other .plan__* rules, reusing existing colour and size variables.
  • src/lib/store.ts: Approve calls the step run instead of sending the plan back as a message.
  • src/screens/Chat.tsx: the Plan tab opens in the sidebar when a plan is proposed in a chat whose mode is Plan
    (upstream opens it only once a run starts, Chat.tsx:126; a /plan in another mode behaves as before), a tab that
    is gone is never the selected tab, a pane pointing at a tab that vanished falls back to the plan, coming back
    to a chat whose plan is paused or stopped brings the checklist back, and a reply that finishes while a step run
    holds the pane does not replace it with a file preview.
  • Tests: tests/agent-plan-md.test.mjs new (178 lines, 9 tests), plus 26 lines in agent-plan.test.mjs, 25 in
    ui5-plan.test.mjs, and 2 in agent-plan-run.test.mjs for the renamed report function.

How the other paths behave:

  • A plain Manual or Bypass chat that never plans gets no plan and no file. A plan is created only by /plan, a
    Plan-mode turn, or a /goal typed with numbered points, and the file is written only from the plan report
    path. Nothing in profile.mjs or strata-gate.mjs changed, which is how I checked the default path: those
    two files are not in the diff, and the mode tests still pass unchanged.
  • A /goal typed with numbered points (upstream, agent-bridge.mjs:976-978) gets its checklist file too. Its
    steps come from the person's own words, so there is no findings section.
  • The plan file is not a deliverable card and folder listings skip it (deliverables.mjs:16 refuses a path segment
    that starts with a dot, index.mjs:526 skips .strata). It is reached from the plan itself, and
    resolveChatFile has no dot rule, so Open and the preview work like any other file in the chat's folder.

One minute to try it:

  1. A chat with a folder open. MODE = Plan. Ask for something that needs more than one change.
  2. The reply should be two parts: what it found, naming the files it read, then a heading and a numbered list.
    The card shows the same text above its steps.
  3. The Plan tab opens in the sidebar. .strata/plans/<name>.md appears with empty boxes, the ask quoted first.
  4. Edit anything you do not like, then Approve. The card runs the steps and the boxes tick as it goes.
  5. Stop, then Resume: it picks up where it stopped and the file keeps the ticks it had.

Validation

All of it on Windows 11 x64, Node 22, no GPU, at 38cf1db1 on feature/plan-card, branched from v0.2.9
(c62d5e3a). For the harness-backed tests, STRATA_HARNESS_DIR pointed at the harness that ships with 0.2.9
(deepseek-harness 0.2.1-alpha.3), so those tests ran against a real harness and a scripted worker rather than
skipping. Without that variable about a hundred tests skip, so the totals below only mean something with it set.

Passed:

  • node --test tests/agent-plan-md.test.mjs in apps/host: 9 pass, 0 fail. The shape and order of the file (the
    ask, then the findings, then ## Steps and the boxes last), the count line, a skipped step still ticked, the
    name stepping past a foreign file, no write when nothing changed, no file for an empty plan or a chat with no
    folder, the deliverable scanner never returning it while an ordinary .md beside it is returned, and
    resolveChatFile opening it. Three of the nine drive a real harness with a scripted worker: a Plan-mode turn
    ends with a plan whose plan.file exists with three unticked boxes and whose plan.context is the sentence
    the model wrote before its list, and leaves .strata as the only new folder in the chat; a Plan-mode turn with
    no numbered list produces no plan and no folder; Approve then Start as goal ends with three [x],
    done · 3 of 3 steps done, a summary line under each step, the same file name throughout, and an Edit in the
    middle of a run keeping the findings text.
  • node --test tests/agent-plan-run.test.mjs: 6 pass, 0 fail. The existing /plan, plan-as-goal, stop and
    resume tests, with the file writes now on that path.
  • node --test tests/agent-plan.test.mjs tests/ui5-plan.test.mjs tests/locale-gaps.test.mjs: 20 pass, 0 fail.
    The two-part instruction and the findings that come back with it (kept, capped, empty when the reply is only a
    list, and a self-correcting reply keeps its earlier list as findings instead of as steps), the client reading
    file and context, Approve reaching the step run, the tab rules, and no interface string added.
  • node --test tests/agent-modes.test.mjs tests/agent-turn-guard.test.mjs tests/agent-tools.test.mjs: 32 pass,
    0 fail. Including "MODE Plan: a write is refused with no question, the file never appears, reading still works",
    "Plan stays read-only and Bypass asks nothing", and the turn guard stopping a plan turn that repeats its
    numbered list.
  • npm test in apps/host: 1267 tests, 1244 pass, 2 fail, 21 skipped. The same command on the same machine with
    the change set aside: 1255 tests, 1232 pass, 2 fail, 21 skipped. Twelve more tests, the same two failures, and
    nothing that passed before fails now.
  • npm run typecheck: 0 errors. The checkout had no node_modules/.bin/tsc, so TypeScript 5.6.3 went in with
    npm install --no-save; nothing in the tree or the lockfile changed.
  • git apply --check of the whole change (13 files, 457 insertions, 37 deletions) against a clean worktree at
    c62d5e3a: fits, including both new files.
  • .github/scripts/item-check.js, the format check the intake and reopen workflows run, over the issue text and
    over the pull request body above: checkPull passes in intake and reopen mode, checkIssue passes in both
    and is read as the feature form. Reproduce with node check-intake.cjs in this folder (Node 22, 2026-11-01).
  • Real chats in the patched app on my machine, real model, not scripted. The one worth looking at was written
    2026-11-01 at 20:36 in a repo I know well (a calculator solution, asking for a WPF front end that shares its
    core). E:\Projects\Test4\.strata\plans\wpf-desktop-front-end.md, 3714 bytes: title "WPF desktop front end",
    paused · 1 of 8 steps done, the ask quoted, then ## What I found (1923 characters kept in the plan store)
    naming the projects and files it read, what is already shared, what is not, and four questions it wants
    answered, then ## Steps with eight steps, each with a reason. In that file the ask starts at byte 111, the
    findings at 243, ## Steps at 2162. Step 1 is [x] with the summary "Wrote Calculator.Wpf.csproj, Wrote
    App.xaml, Wrote App.xaml.cs and more". On the same build before the findings work, five real plans in my data
    folder showed the ticking working and the ordering wrong; one Blazor plan sits paused with 3 of 9 steps
    ticked and its file rewritten a second after I pressed Stop.

Failed:

  • tests/chat-shell.test.mjs:31 and tests/model-directory.test.mjs:16: Error: EPERM: operation not permitted, symlink. This Windows account may not create symbolic links, and both fail inside the test's own symlink()
    call before any app code runs. Neither file is touched here, and both fail the same way without the change.
  • One run of the patched tree also failed tests/bundled-engine.test.mjs:115 (which engine build an older driver
    gets). It did not repeat in the two runs after it. Not investigated.

Not run:

  • npm run audit, contrast, measure, luminance, the CSS checks. Nine rules were added in app.css for the
    findings block. They reuse existing variables and add no colour, but they have not been through those audits.
  • Linux and macOS. Everything above is Windows.
  • Whether the exact client line that lost a checklist after a Stop is the one I changed. See Limits.
  • How the findings block reads on screen beyond my own reading of it. The interface tests here check the source,
    and there is no browser rig in this suite driving the sidebar pane.
  • A systematic check of how good a real model's findings and steps are, or of how well the instruction keeps a
    real model from trying to write. One real chat is quoted above. That is one model on one repo.

Limits

  • The model learns it is planning from the message, not the system prompt, because the harness no longer says it
    (preset.mjs:16-17,32). A model that skims past it can still try to write, and keeps going until the
    four-rewrite stop ends the turn. I did not reproduce that as a failure, so it is a reading of the code and
    nothing more. A standing mode note in the harness prompt is where it belongs; that is a harness change.
  • The refusal says what the mode cannot do, not "put that change into a step instead" (strata-gate.mjs:372).
    One sentence would say it. Left out because it is a different problem, and it is closer to #4124.
  • The app owns the ticks. A box ticked by hand in the file is overwritten at the next plan change, and a step
    written by hand in the file never enters the plan. Making the file the source of truth is a bigger change: the
    plan store would have to read the file back, and a Plan-mode run would need that one write allowed.
  • The findings are what the planning turn happened to write, kept whole up to 3000 characters and cut with an
    ellipsis past that, in the file and in the card. Nothing checks that the files it names are real. A turn that
    writes only a list gets a plan with no findings block, which is the old behaviour. A briefing typed when a run
    starts (kept to 600 characters) goes into each step's instruction but is not written into the file.
  • Plans made before this change have no context, so they show no findings block. Nothing migrates them.
  • A step round is told where the plan document is but is not made to read it. The findings are not re-injected
    into the instruction; that would repeat them in every step.
  • A tick lands when the harness goal for that step reports done, and the bridge waits while the goal is still
    armed (advancePlan in agent-bridge.mjs). A model that answers two steps inside one round ticks them
    together at the end of it. With the scripted worker a three-step run keeps one conversation and grows it
    (message counts 7, 9, 12, 14, 16, 18, 20, 23, 25, 27, 29, 31, 34, 36, 38), so one round of context per step
    rather than a fresh session per step.
  • A plan run still refuses to start while the chat is in Plan mode (agent-bridge.mjs:1078, upstream), and the client
    switches the chat to Manual first, as it did upstream. So a chat left in Plan mode can plan but cannot carry
    its own plan out without changing mode. Making step runs write while the chat stays in Plan mode is the open
    question here, and it belongs with #4120; I did not solve it in this pull request.
  • The sidebar rules for a stopped plan are defensive, not a found cause. Measured in a temporary test with the
    shipped harness: every plan frame a Stop sent was readable, the last one said paused, the plan stayed in the
    store, and its file was rewritten correctly a second later. The host did not forget it; the page stopped
    showing it. This suite has no rig that drives the pane, so the line that loses it is unconfirmed static
    analysis and I could not write a test that settles it.
  • A plan is parsed from the reply, and parsePlan takes the last run of two or more numbered items
    (upstream rule, plan.mjs). The release chat quoted above ends with a two-item list of things for me
    to do: "Approve the write-access prompt when it appears again" and "Select a folder". A Plan-mode
    reply in that shape under this change would make a plan whose steps ask me for permissions. The
    two-part instruction makes it uncommon, and every real chat I ran produced steps about the work, but a
    guard (skip a list whose items are addressed to the person, or require the findings heading) is a real
    gap. Flagging it rather than quietly widening a parser in the same pull request.
  • One file per plan, in .strata/plans, created on first use. A new plan replaces the old one in the same chat,
    exactly as /plan does today. If the folder is deleted or the chat's folder moves, the next plan frame writes
    it again, and until then Open reports the file as missing. Some people will want it listed as an ordinary file
    rather than hidden in a dot folder.

Before:
Screenshot 2026-11-01 212538
After:
Screenshot 2026-11-01 203616


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/4956 **Author:** [@MohSakhaei](https://github.com/MohSakhaei) **Created:** 11/1/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feature/plan-card` --- ### 📝 Commits (3) - [`aeb31da`](https://github.com/Niko1221/Strata/commit/aeb31da3c641c4b3b2aa6521c401cf8a2c82e8d4) Plan card now shows steps and they get updated upon completion of each step - [`38cf1db`](https://github.com/Niko1221/Strata/commit/38cf1db110e9e445089a8ae08ee6d216061790e6) Plan card starts with user request and AI agent findings and then steps - [`8f7091f`](https://github.com/Niko1221/Strata/commit/8f7091fd69f9324d3da40629cff68784751ca75b) Merge main (v0.2.10) into feature/plan-card ### 📊 Changes **13 files changed** (+457 additions, -37 deletions) <details> <summary>View changed files</summary> 📝 `apps/host/server/agent/agent-bridge.mjs` (+25 -7) ➕ `apps/host/server/agent/plan-md.mjs` (+115 -0) 📝 `apps/host/server/agent/plan.mjs` (+24 -9) 📝 `apps/host/server/index.mjs` (+1 -1) 📝 `apps/host/src/components/PlanCard.tsx` (+26 -2) 📝 `apps/host/src/lib/plan.ts` (+2 -2) 📝 `apps/host/src/lib/store.ts` (+4 -3) 📝 `apps/host/src/screens/Chat.tsx` (+21 -11) 📝 `apps/host/src/styles/app.css` (+9 -1) ➕ `apps/host/tests/agent-plan-md.test.mjs` (+178 -0) 📝 `apps/host/tests/agent-plan-run.test.mjs` (+1 -1) 📝 `apps/host/tests/agent-plan.test.mjs` (+26 -0) 📝 `apps/host/tests/ui5-plan.test.mjs` (+25 -0) </details> ### 📄 Description ### Problem and result Before, all of it checked against the release itself (`v0.2.9`, `c62d5e3a`) : - Nothing in the release turns a Plan-mode turn into a plan. The mode is Plan only when `/plan` was typed (`agent-bridge.mjs:410`: `const appliedMode = planTask ? 'plan' : modeOf(mode)`), and the end of a turn creates a plan only when `/plan` was typed (`settlePlan`, :656-661, `if (planTask)`). So in a chat where you pick Plan in the MODE menu and ask for something there is no plan-shaped output at all: no card, no steps, no entry in `<data>/agent/plans.json`, no file. - What that turn does instead: the model works the way it works in Agent mode, because nothing tells it the mode is planning (the line in the chat harness that used to say so was removed, `preset.mjs:16-17,32`), while the mode is read-only, which is what refuses its writes, and the gate also turns away connected tools with "Plan mode only looks and changes nothing, so it cannot use this tool" (`strata-gate.mjs:369-372`). My chat on 2026-11-01 on a clean install from the release installer, in an empty folder, was six tool calls, three refused by the read-only sandbox, one escalation asked and settled as a decision by me, no steps and nothing on disk. That session is kept on disk as a transcript, so what follows is quoted from the file rather than from memory. #4124 reports the same situation from macOS and quotes the same message. After: - A Plan-mode turn ends with a plan object, which in the release it never did. It is asked for two parts, findings first and the numbered list last, and it gets the card, the Plan tab, and `.strata/plans/<name>.md` in the chat's folder. The file reads what you asked, then what the turn found by looking, then `## Steps` with one box per step. - Approve starts the step run. The host runs one goal round per step ("You are on step 2 of 3"), marks the step done with a one-line summary, and rewrites the file. Stop pauses where it was, Resume carries on, and the boxes tick in the card, the tab and the file. - The file is written by the app, never by the model. The Plan preset is untouched: still `read-only`, still `approval: never`. What that release chat said, quoted from the session file (`home/sessions/--E-Projects-Test5--/session-296eb1e2-d2d9-4647-b059-d01dad800a13/session.v4.jsonl.zstd`, 2026-11-01 21:24: 62 records across 23 zstd frames, decoded with the app's own Node 24.12.0). The chat had Plan picked in the MODE menu and asked for a Blazor weather app in `E:\Projects\Test5`: - The mode is reported to the model as something I did: `The approval policy changed from "ask" to "never" (changed by the user).` I picked a mode, and the harness tells the model I edited its policy. - The file and command tools still carry an escape hatch in Plan mode: `edit`, `pwsh` and `write` each take a `sandbox_permissions` value whose enum is `workspace-write` and `danger-full-access`, plus a one-sentence `justification` the model is told to address to me. - The refusal it got: `[sandbox: file access denied under read-only mode] [sandbox: escalation available - retry this exact operation once with sandbox_permissions ... the approval prompt asks the user]`. - After one escalation was asked and settled: `Error: the user rejected escalating this command to "workspace-write"; it stays denied, so stop and explain instead of working around it`. - So the model reads a mode as a person who changed their mind: "The sandbox blocked writing the project. Retrying with workspace write access." and then "The project-scaffold command was declined. Let me try creating the files directly with the file-writing tool instead." - The model reasons about it as a person who keeps saying no: "The user's original request was to create an app, and they rejected the scaffold escalation, which is puzzling. Maybe the approval prompt was unclear, or they prefer the write tool." - The word "planning" turns up once in all 62 records, in that reasoning, and it means about to build: "I'm planning out a Blazor Server application ... Let me check what .NET version is available and start building this out". Nothing in the session tells the model what the mode is for. - And it ends as a blocked builder, not as a planner: "I wasn't able to create any files: my sandbox currently only has read-only access to `E:\Projects\Test5`, and when I asked to widen it to allow writing the new project, the approval prompt was declined. Nothing was created or changed. Here's the plan I'm ready to execute as soon as write access is approved:" Nothing from that turn became a plan. `plans.json` gained no entry for that chat, `E:\Projects\Test5` is still empty, and there is no `.strata` folder. The model did keep a list once (`todo_write`), and the app renders it as one line ("Updates its to-do list.", `events.mjs:52`): it is the model's note about its own turn, not something the app can tick, and it does not outlive the turn. ### Related discussion Searched the open and closed issues and pull requests for `plan`, `plan mode`, `plan card`, `checklist` and `todo`. These came up, and I read each of them: - #4124 (open) reports Plan-mode writes being refused and an escalation retry blamed on the user. The block under Problem and result quotes the same wording out of a Windows session file, and it is the exact line #4124 objects to: `the user rejected escalating this command to "workspace-write"`. My change does not touch that error message; it gives the model something else to do instead, which is why the refused writes are less likely in the first place. - #4120 (open) asks for a mode that is restricted and autonomous at the same time, between Manual and Bypass. That is the right place for the harder question this change leaves open: a plan run cannot write while the chat stays in Plan mode, so the client switches the chat to Manual before starting it, as upstream did. If a workspace-write preset lands, a chat left in Plan mode could carry its own plan out, and I would build on that rather than invent a mode here. - #3479 (closed) is about UI strings that never reach the locale files, `/plan` and `PlanCard.tsx` among them. This change adds no interface string, so nothing new goes missing from the catalogs; `tests/locale-gaps.test.mjs` fails on any `tr("…")` with no English entry and stays green. - #1719 is the RFC for the agent tab, which is where plan mode and goal mode came from. - #4618 asks for long local sessions to hold together, including a helper keeping the mode it was created with. Nothing here conflicts with it. No thread covers a plan checklist file in the project, or a plan for every Plan-mode turn, so this is a new thread rather than an addition. The scope issue described above should come first; this line becomes its URL. ### Approach One plan object in the host, and it brings a file with it. Three reasons for this shape: - Every plan change already passes through one report function in the bridge, so a wrapper there writes the file and keeps its name in the plan. The card, the sidebar tab and the file come from the same plan frame and cannot drift apart. - The ticks have to be the host's job. Nothing outside the model knows which step of its own prose it has finished, and only the plan's steps carry state. The file mirrors that state rather than the model's narration, which is what freelanced it before. - The release already turns on the harness to-do tool (`preset.mjs:29,91`, `tools-catalog.mjs:19`), but the app shows one line per update (`events.mjs:52,86`), the list belongs to the model's turn, and it never leaves the session. The plan steps are the only checklist here that carries a state the app can act on, so the file and the card are both built from them. - The findings are the model's own words, kept rather than invented. `parsePlan` already took the last numbered run of two or more items as the steps; it now also keeps everything written before them as `plan.context`, capped at 3000 characters. `planPrompt` asks for that order. No harness change, no new prompt machinery. The harness is where a Plan-mode turn would normally be told it is planning, and the upstream `planning` group was removed from it (`preset.mjs:16-17,32`, `docs/HARNESS.md:106`). Until that comes back, the instruction travels in the message, which is what `/plan` already did. 13 files: - `server/agent/plan-md.mjs` (new, 115 lines) writes the plan document: a marker line with the plan id, the title, a state line (`approved · 1 of 4 steps done`), what was asked for as a blockquote, then the findings, then `## Steps` and one checkbox per step (the step's words, its reason after a dash, what it ended with). Atomic write (`.tmp` then rename), rewritten only when the text changed. A file at that name without our marker line was written by someone else and is never touched; the next name in the series is used. No steps or no chat folder means no file. - `server/agent/plan.mjs`: the two-part instruction in `planPrompt`, the findings capture in `parsePlan` and `PlanStore.create`, and one line in `stepObjective` that tells a step round where the plan document is, in case it needs that background. - `server/agent/agent-bridge.mjs`: five small hunks. The `onPlan` wrapper and `planFileOf`, the turn guard counting plan rewrites for a Plan-mode turn (`plan: !!planTask || appliedMode === 'plan'`), a Plan-mode turn going out through `planPrompt` and ending in `settlePlan`, and the plan keeping `context`. - `server/index.mjs`: one line, the report function passed through under its new name. - `src/lib/plan.ts` reads `file` and `context` (a blank or non-string `context` is dropped); `src/components/PlanCard.tsx` gains an "Open <name>.md" line and a findings block above the steps, in the card and in the sidebar pane, through the markdown renderer answers already use; `src/styles/app.css` gains nine rules next to the other `.plan__*` rules, reusing existing colour and size variables. - `src/lib/store.ts`: Approve calls the step run instead of sending the plan back as a message. - `src/screens/Chat.tsx`: the Plan tab opens in the sidebar when a plan is proposed in a chat whose mode is Plan (upstream opens it only once a run starts, `Chat.tsx:126`; a `/plan` in another mode behaves as before), a tab that is gone is never the selected tab, a pane pointing at a tab that vanished falls back to the plan, coming back to a chat whose plan is paused or stopped brings the checklist back, and a reply that finishes while a step run holds the pane does not replace it with a file preview. - Tests: `tests/agent-plan-md.test.mjs` new (178 lines, 9 tests), plus 26 lines in `agent-plan.test.mjs`, 25 in `ui5-plan.test.mjs`, and 2 in `agent-plan-run.test.mjs` for the renamed report function. How the other paths behave: - A plain Manual or Bypass chat that never plans gets no plan and no file. A plan is created only by `/plan`, a Plan-mode turn, or a `/goal` typed with numbered points, and the file is written only from the plan report path. Nothing in `profile.mjs` or `strata-gate.mjs` changed, which is how I checked the default path: those two files are not in the diff, and the mode tests still pass unchanged. - A `/goal` typed with numbered points (upstream, `agent-bridge.mjs:976-978`) gets its checklist file too. Its steps come from the person's own words, so there is no findings section. - The plan file is not a deliverable card and folder listings skip it (`deliverables.mjs:16` refuses a path segment that starts with a dot, `index.mjs:526` skips `.strata`). It is reached from the plan itself, and `resolveChatFile` has no dot rule, so Open and the preview work like any other file in the chat's folder. One minute to try it: 1. A chat with a folder open. MODE = Plan. Ask for something that needs more than one change. 2. The reply should be two parts: what it found, naming the files it read, then a heading and a numbered list. The card shows the same text above its steps. 3. The Plan tab opens in the sidebar. `.strata/plans/<name>.md` appears with empty boxes, the ask quoted first. 4. Edit anything you do not like, then Approve. The card runs the steps and the boxes tick as it goes. 5. Stop, then Resume: it picks up where it stopped and the file keeps the ticks it had. ### Validation All of it on Windows 11 x64, Node 22, no GPU, at `38cf1db1` on `feature/plan-card`, branched from `v0.2.9` (`c62d5e3a`). For the harness-backed tests, `STRATA_HARNESS_DIR` pointed at the harness that ships with 0.2.9 (`deepseek-harness 0.2.1-alpha.3`), so those tests ran against a real harness and a scripted worker rather than skipping. Without that variable about a hundred tests skip, so the totals below only mean something with it set. **Passed:** - `node --test tests/agent-plan-md.test.mjs` in `apps/host`: 9 pass, 0 fail. The shape and order of the file (the ask, then the findings, then `## Steps` and the boxes last), the count line, a skipped step still ticked, the name stepping past a foreign file, no write when nothing changed, no file for an empty plan or a chat with no folder, the deliverable scanner never returning it while an ordinary `.md` beside it is returned, and `resolveChatFile` opening it. Three of the nine drive a real harness with a scripted worker: a Plan-mode turn ends with a plan whose `plan.file` exists with three unticked boxes and whose `plan.context` is the sentence the model wrote before its list, and leaves `.strata` as the only new folder in the chat; a Plan-mode turn with no numbered list produces no plan and no folder; Approve then Start as goal ends with three `[x]`, `done · 3 of 3 steps done`, a summary line under each step, the same file name throughout, and an Edit in the middle of a run keeping the findings text. - `node --test tests/agent-plan-run.test.mjs`: 6 pass, 0 fail. The existing `/plan`, plan-as-goal, stop and resume tests, with the file writes now on that path. - `node --test tests/agent-plan.test.mjs tests/ui5-plan.test.mjs tests/locale-gaps.test.mjs`: 20 pass, 0 fail. The two-part instruction and the findings that come back with it (kept, capped, empty when the reply is only a list, and a self-correcting reply keeps its earlier list as findings instead of as steps), the client reading `file` and `context`, Approve reaching the step run, the tab rules, and no interface string added. - `node --test tests/agent-modes.test.mjs tests/agent-turn-guard.test.mjs tests/agent-tools.test.mjs`: 32 pass, 0 fail. Including "MODE Plan: a write is refused with no question, the file never appears, reading still works", "Plan stays read-only and Bypass asks nothing", and the turn guard stopping a plan turn that repeats its numbered list. - `npm test` in `apps/host`: 1267 tests, 1244 pass, 2 fail, 21 skipped. The same command on the same machine with the change set aside: 1255 tests, 1232 pass, 2 fail, 21 skipped. Twelve more tests, the same two failures, and nothing that passed before fails now. - `npm run typecheck`: 0 errors. The checkout had no `node_modules/.bin/tsc`, so TypeScript 5.6.3 went in with `npm install --no-save`; nothing in the tree or the lockfile changed. - `git apply --check` of the whole change (13 files, 457 insertions, 37 deletions) against a clean worktree at `c62d5e3a`: fits, including both new files. - `.github/scripts/item-check.js`, the format check the intake and reopen workflows run, over the issue text and over the pull request body above: `checkPull` passes in intake and reopen mode, `checkIssue` passes in both and is read as the feature form. Reproduce with `node check-intake.cjs` in this folder (Node 22, 2026-11-01). - Real chats in the patched app on my machine, real model, not scripted. The one worth looking at was written 2026-11-01 at 20:36 in a repo I know well (a calculator solution, asking for a WPF front end that shares its core). `E:\Projects\Test4\.strata\plans\wpf-desktop-front-end.md`, 3714 bytes: title "WPF desktop front end", `paused · 1 of 8 steps done`, the ask quoted, then `## What I found` (1923 characters kept in the plan store) naming the projects and files it read, what is already shared, what is not, and four questions it wants answered, then `## Steps` with eight steps, each with a reason. In that file the ask starts at byte 111, the findings at 243, `## Steps` at 2162. Step 1 is `[x]` with the summary "Wrote Calculator.Wpf.csproj, Wrote App.xaml, Wrote App.xaml.cs and more". On the same build before the findings work, five real plans in my data folder showed the ticking working and the ordering wrong; one Blazor plan sits `paused` with 3 of 9 steps ticked and its file rewritten a second after I pressed Stop. **Failed:** - `tests/chat-shell.test.mjs:31` and `tests/model-directory.test.mjs:16`: `Error: EPERM: operation not permitted, symlink`. This Windows account may not create symbolic links, and both fail inside the test's own `symlink()` call before any app code runs. Neither file is touched here, and both fail the same way without the change. - One run of the patched tree also failed `tests/bundled-engine.test.mjs:115` (which engine build an older driver gets). It did not repeat in the two runs after it. Not investigated. **Not run:** - `npm run audit`, `contrast`, `measure`, `luminance`, the CSS checks. Nine rules were added in `app.css` for the findings block. They reuse existing variables and add no colour, but they have not been through those audits. - Linux and macOS. Everything above is Windows. - Whether the exact client line that lost a checklist after a Stop is the one I changed. See Limits. - How the findings block reads on screen beyond my own reading of it. The interface tests here check the source, and there is no browser rig in this suite driving the sidebar pane. - A systematic check of how good a real model's findings and steps are, or of how well the instruction keeps a real model from trying to write. One real chat is quoted above. That is one model on one repo. ### Limits - The model learns it is planning from the message, not the system prompt, because the harness no longer says it (`preset.mjs:16-17,32`). A model that skims past it can still try to write, and keeps going until the four-rewrite stop ends the turn. I did not reproduce that as a failure, so it is a reading of the code and nothing more. A standing mode note in the harness prompt is where it belongs; that is a harness change. - The refusal says what the mode cannot do, not "put that change into a step instead" (`strata-gate.mjs:372`). One sentence would say it. Left out because it is a different problem, and it is closer to #4124. - The app owns the ticks. A box ticked by hand in the file is overwritten at the next plan change, and a step written by hand in the file never enters the plan. Making the file the source of truth is a bigger change: the plan store would have to read the file back, and a Plan-mode run would need that one write allowed. - The findings are what the planning turn happened to write, kept whole up to 3000 characters and cut with an ellipsis past that, in the file and in the card. Nothing checks that the files it names are real. A turn that writes only a list gets a plan with no findings block, which is the old behaviour. A briefing typed when a run starts (kept to 600 characters) goes into each step's instruction but is not written into the file. - Plans made before this change have no `context`, so they show no findings block. Nothing migrates them. - A step round is told where the plan document is but is not made to read it. The findings are not re-injected into the instruction; that would repeat them in every step. - A tick lands when the harness goal for that step reports done, and the bridge waits while the goal is still armed (`advancePlan` in `agent-bridge.mjs`). A model that answers two steps inside one round ticks them together at the end of it. With the scripted worker a three-step run keeps one conversation and grows it (message counts 7, 9, 12, 14, 16, 18, 20, 23, 25, 27, 29, 31, 34, 36, 38), so one round of context per step rather than a fresh session per step. - A plan run still refuses to start while the chat is in Plan mode (`agent-bridge.mjs:1078`, upstream), and the client switches the chat to Manual first, as it did upstream. So a chat left in Plan mode can plan but cannot carry its own plan out without changing mode. Making step runs write while the chat stays in Plan mode is the open question here, and it belongs with #4120; I did not solve it in this pull request. - The sidebar rules for a stopped plan are defensive, not a found cause. Measured in a temporary test with the shipped harness: every plan frame a Stop sent was readable, the last one said `paused`, the plan stayed in the store, and its file was rewritten correctly a second later. The host did not forget it; the page stopped showing it. This suite has no rig that drives the pane, so the line that loses it is unconfirmed static analysis and I could not write a test that settles it. - A plan is parsed from the reply, and `parsePlan` takes the last run of two or more numbered items (upstream rule, `plan.mjs`). The release chat quoted above ends with a two-item list of things for me to do: "Approve the write-access prompt when it appears again" and "Select a folder". A Plan-mode reply in that shape under this change would make a plan whose steps ask me for permissions. The two-part instruction makes it uncommon, and every real chat I ran produced steps about the work, but a guard (skip a list whose items are addressed to the person, or require the findings heading) is a real gap. Flagging it rather than quietly widening a parser in the same pull request. - One file per plan, in `.strata/plans`, created on first use. A new plan replaces the old one in the same chat, exactly as `/plan` does today. If the folder is deleted or the chat's folder moves, the next plan frame writes it again, and until then Open reports the file as missing. Some people will want it listed as an ordinary file rather than hidden in a dot folder. Before: <img width="1353" height="1248" alt="Screenshot 2026-11-01 212538" src="https://github.com/user-attachments/assets/8d62e61d-46de-4918-8ddc-a33d2b73e019" /> After: <img width="2954" height="1105" alt="Screenshot 2026-11-01 203616" src="https://github.com/user-attachments/assets/6add6334-21d2-40c7-b530-b9857712d9cd" /> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 16:33:55 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#5264
No description provided.