Command Code loops/retries when writing large markdown handoff docs, only succeeds after splitting into smaller files
还没有人认领这个 Issue。
评估
调研方向
使用引用的 /plan 提示词、trace ID、项目设置和目标路径 ./docs/handoff/codebase-audit-phase2.md,在 Command Code 0.40.0 上复现。将单文件请求与文档化的拆分文件变通方案进行比较,然后检查计划模式和文件写入的入口点,以验证大型输出能够完成、清晰报告其限制,或平稳过渡;不再观察到重试循环即表示完成。
由索引模型根据 Issue 内容生成。
描述
Summary
Command Code repeatedly loops/retries when asked to analyze a codebase and write a large markdown handoff/spec document, especially when the requested output is one large file. The agent appears to repeatedly restart or resend the same “I’ll write it now / let me start writing” style messages instead of actually completing the file.
This happened in two separate projects, in two different folders, with two different prompts. In both cases, the task only completed after I instructed Command Code to stop trying to write one monolithic file and instead split the output into multiple smaller markdown files.
Trace ID from one occurrence:
5054acc945fbd22906a86e2688409796
This affects my workflow because I use Command Code to audit codebases and generate long handoff/spec documents. When the output is large, Command Code gets stuck in a retry/planning loop instead of producing the requested deliverable.
Expected Behavior
Command Code should:
-
Enter
/planmode and analyze the codebase according to the provided audit prompt. -
Finish the plan/research phase.
-
Exit or allow switching out of
/planwhen instructed. -
Write the requested markdown handoff/spec document to the specified path.
-
If the requested file is too large, either:
- write it successfully in chunks to the same file, or
- clearly state that the file is too large and ask/suggest splitting it into smaller files.
In this case, the expected deliverable was:
./docs/handoff/codebase-audit-phase2.md
The prompt explicitly instructed Command Code not to modify existing files, not to implement anything, and to create only that one markdown file.
Actual Behavior
Command Code analyzed the codebase but then appeared to get stuck before writing the large markdown file. It repeatedly produced “thought” cycles and messages indicating it was about to write the document, but it did not successfully complete the requested one-file output.
The behavior was roughly:
- Command Code analyzed the project.
- It appeared to remain stuck in
/plan. - I manually instructed it to write the document.
- It still repeated the same style of message/restart loop instead of writing the requested file.
- The issue repeated multiple times.
- Eventually the session hit a network/retry failure.
- The task only completed after I explicitly told it to abandon the monolithic file and split the output into multiple smaller markdown files.
Important detail: this happened twice, in two different project folders, with different prompts, but both tasks involved creating long handoff/spec markdown documents.
There also appeared to be inconsistent behavior around /plan mode. In one run, Command Code wrote some files successfully into the project directory while apparently still in plan mode, then later claimed plan mode prevented writing outside ~/.commandcode/plans/. It then repeatedly reasoned about whether to exit plan mode, retry writes, or create a plan file, instead of cleanly proceeding.
The successful workaround was to tell it:
Instead of writing one monolithic file, please create multiple documents, one for each section.
After that, Command Code was able to create smaller markdown files and complete the task.
Steps to reproduce the issue
-
Open a project with a sufficiently large codebase.
-
Create or provide an audit prompt that requires Command Code to inspect the codebase and generate a long markdown handoff/spec document.
-
Start Command Code in
/planmode with a prompt like:/plan Read the file at ./docs/handoff/codebase-audit-prompt.md in full before doing anything else. That file contains your complete instructions, full context about what this application is, what has already been built, what new features are being designed, and exactly what you are auditing and why. Follow every instruction in that file precisely. Use your own judgment to locate relevant files throughout the codebase — do not limit yourself to only the paths explicitly named. If a file that answers one of the audit questions is located somewhere other than expected, find it and include it. Your only deliverable is one new markdown file written to ./docs/handoff/codebase-audit-phase2.md. Do not modify any existing files. Do not implement anything. Do not create any file other than ./docs/handoff/codebase-audit-phase2.md.
Let Command Code analyze the project.
Once analysis is complete, instruct it to write the document.
Observe that it repeatedly enters long “thought” cycles and appears to restart/retry rather than writing the requested long markdown file.
Try manually instructing it to leave /plan mode and write the document.
Observe that it still loops/retries and does not successfully complete the one large markdown output.
Then instruct it to split the document into multiple smaller files, for example:
It appears that long files do not work for you. Abandon the one monolithic mega long file. Make a new directory and output into ./docs/handoff/advisor-and-routines/{1,2,3,4,...,n}-{section-name}.md
Observe that Command Code is then able to complete the task by writing smaller files.
Command Code Version
### Command Code Version
0.40.0
### Operating System
macOS
### Terminal/IDE
iTerm2
### Shell
zsh
### Additional context
This happened in two separate projects, in two different folders, with two different prompts. Both tasks involved analyzing the codebase and writing a long markdown handoff/spec document.
The issue seems connected to one or both of the following:
1. Large single-file markdown output, likely over 1,000 lines.
2. `/plan` mode not cleanly transitioning into execution/writing mode.
In one occurrence, Command Code appeared to repeatedly think through the same decision:
- whether it was still in `/plan`
- whether plan mode prevented writing to the project directory
- whether it should retry writing
- whether it should exit plan mode
- whether it needed to create a plan file first
Instead of cleanly exiting plan mode or writing the requested file, it looped through variations of this reasoning.
One session eventually produced:
```text
⚠ Error: Network connection lost.
Type "continue" to try again. If the issue persists, contact
support: https://commandcode.ai/discord
Trace ID: 5054acc945fbd22906a86e2688409796
The workaround was to explicitly instruct Command Code to stop trying to create one monolithic markdown file and instead create a directory of smaller files, one per section. Once I gave that instruction, the task completed successfully.
Example successful workaround instruction:
It appears to be that long files do not work for you. Abandon the one "monolithic" mega long file. Thus, make a new directory & output into ./docs/handoff/advisor-and-routines/{1, 2, 3, 4, ..., n}-{section-name}.md
After this, Command Code created smaller files successfully, for example:
WRITE [docs/handoff/advisor-and-routines/2-desire-data-model-and-api.md]
Created docs/handoff/advisor-and-routines/2-desire-data-model-and-api.md
The core problem is that Command Code does not seem to gracefully handle very large requested markdown outputs as a single file, and it does not clearly recover by suggesting file splitting or automatically chunking the write.
- 主要语言
- 没有语言数据
- 星标
- 4k
- 派生
- 350
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
CommandCodeAI/command-code 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
CommandCodeAI/command-code#855 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
CommandCodeAI/command-code#841 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
CommandCodeAI/command-code#655 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
CommandCodeAI/command-code#608 ·
-
难度 3/5 1-2 天 新手友好度 70/100
CommandCodeAI/command-code#893 ·
查看 CommandCodeAI/command-code 的全部 Issue
相似的 Issue
-
enhancement
难度 2/5 1-3 小时 新手友好度 68/100
JuliusBrussee/caveman#1102 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
use-agent-os/agent-os#3263 ·
-
[Bug]: context-limit error parsing has no pattern for llama.cpp's "context size (N tokens)" phrasing 未关闭area/compression area/local-models area/sessions comp/agent duplicate P2 sweeper:risk-session-state type/bug
难度 2/5 1-3 小时 新手友好度 82/100
NousResearch/hermes-agent#117793 · 1 条评论 ·
-
possible bug
难度 2/5 1-3 小时 新手友好度 88/100
Mintplex-Labs/anything-llm#6415 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 82/100