Skip to content

fix(prompts): remove 10-item cap from discovery TodoWrite plan#2298

Merged
mrcfps merged 2 commits into
nexu-io:mainfrom
eefynet:fix/prompt-todowrite-plan-item-cap
May 22, 2026
Merged

fix(prompts): remove 10-item cap from discovery TodoWrite plan#2298
mrcfps merged 2 commits into
nexu-io:mainfrom
eefynet:fix/prompt-todowrite-plan-item-cap

Conversation

@neogenix
Copy link
Copy Markdown
Contributor

Why

I noticed agents capping their plan at exactly 10 items even on complex
briefs that genuinely needed more — and silently skipping the rest after
hitting the limit. Tracing it back: RULE 3 of DISCOVERY_AND_PHILOSOPHY
in apps/daemon/src/prompts/discovery.ts explicitly told the model
"a plan of 5–10 short imperative items". That upper bound was the cap.

TodoWrite's schema is unbounded; the limit was entirely prompt copy. The
same wording also lived in packages/contracts/src/prompts/discovery.ts
(consumed by apps/web for BYOK API mode), so the daemon-only fix would
have left the cap active for half the user base.

What users will see

Plans for complex tasks can now legitimately exceed 10 steps when the
brief warrants it. RULE 3's intent — TodoWrite as the first tool call,
live progress updates, planning before building — is preserved. No UI
change. No new keys, no settings, no behavior change on simpler briefs
that already fit in 10 items.

Surface area

  • None — internal refactor, docs, tests, or translation update only

(packages/contracts is touched, but only a string constant inside; no
DTO, no SSE event, no exported shape change.)

Screenshots

N/A (server-side prompt change, no UI).

Bug fix verification

  • Red specs:
    • apps/daemon/tests/prompts/discovery-todo-cap.test.ts
    • packages/contracts/tests/system-prompt.test.ts
  • Red on main and green on this branch: yes — the prior wording
    matched the 5[–\-]10\s+short\s+imperative assertion the new tests
    forbid. Confirmed by grepping the main snapshot at the commit before
    this branch's first commit.
  • The 4th assertion in each test forbids semantically equivalent
    re-introductions (at most N items, maximum N, no more than N)
    so a future prompt rewrite cannot accidentally bring the cap back.

Validation

  • pnpm guard (clean)
  • pnpm typecheck (clean)
  • pnpm --filter @open-design/daemon test — 2870 tests pass
  • pnpm --filter @open-design/contracts test — 90 tests pass

Adjacent issues (out of scope)

apps/web/src/components/DesignSystemFlow.tsx:1801 silently caps the DS
workspace compact todo widget at 6 items via todos.slice(0, 6). Now
that plans can legitimately exceed that count, the widget needs a
+N more overflow indicator. Filed as a follow-up; not in scope here.

neogenix added 2 commits May 19, 2026 13:13
The RULE 3 sentence in DISCOVERY_AND_PHILOSOPHY told the model to write
'a plan of 5–10 short imperative items'. That upper bound caused the agent
to cap every plan at exactly ten steps even when the task genuinely needed
more. The TodoWrite JSON schema imposes no maxItems constraint, so the cap
was entirely prompt-driven.

Replace '5–10 short imperative items' with 'short imperative items covering
the work'. TodoWrite intent, RULE 3 label, and planning-before-building
requirement all survive unchanged.

Red spec: apps/daemon/tests/prompts/discovery-todo-cap.test.ts
…rden tests

[pass-6,7 BLOCKER] packages/contracts/src/prompts/discovery.ts still had
the old '5-10 short imperative items' wording. apps/web imports
composeSystemPrompt from @open-design/contracts (ProjectView.tsx:43),
so web-originated chat runs were still subject to the cap.

[pass-8 WARNING] discovery-todo-cap.test.ts did not cover the contracts
copy, leaving that path unguarded. Also no guard against semantically
equivalent re-introduction via 'at most / maximum / no more than'.

Changes:
- packages/contracts/src/prompts/discovery.ts: apply same wording fix as
  apps/daemon; add inline rationale comment
- apps/daemon/src/prompts/discovery.ts: add inline rationale comment
- apps/daemon/tests/prompts/discovery-todo-cap.test.ts: add 4th assertion
  blocking 'at most|maximum|no more than N item' re-introduction
- packages/contracts/tests/system-prompt.test.ts: add 5-assertion suite
  guarding the contracts copy and composed prompt output
@lefarcen lefarcen requested a review from Siri-Ray May 19, 2026 19:36
@lefarcen lefarcen added size/S PR changes 20-100 lines risk/high High risk: apps/desktop, daemon, auth, migration, workflows, package deps type/bugfix Bug fix labels May 19, 2026
Copy link
Copy Markdown
Contributor

@Siri-Ray Siri-Ray left a comment

Choose a reason for hiding this comment

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

@neogenix I reviewed the prompt wording changes in both the daemon and contracts copies, plus the new regression coverage around the removed TodoWrite plan item cap. I also ran the contracts prompt suite and the daemon test suite after installing workspace dependencies; both passed. Thanks for tightening both runtime paths and adding guardrails against the cap coming back.

🔁 Powered by Looper · runner=reviewer · agent=codex · An autonomous AI dev team for your GitHub repos.

@mrcfps mrcfps merged commit c5e38bb into nexu-io:main May 22, 2026
14 checks passed
@neogenix neogenix deleted the fix/prompt-todowrite-plan-item-cap branch May 22, 2026 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk/high High risk: apps/desktop, daemon, auth, migration, workflows, package deps size/S PR changes 20-100 lines type/bugfix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants