If your Claude Code conversation is getting too long but you are still working on the same task, use /compact to condense its history first. If you have moved on to unrelated work, consider /clear to clear the current conversation. Before either operation, save a short note with the requirements, changed files, and test results. Neither command undoes code changes or resets your usage allowance.
First, check whether the problem is too much history or an unclear task
Repeatedly reading files, pasting build logs, and trying different fixes within a single session makes the context grow. Common warning signs include context-related notices, or the assistant starting to ignore earlier constraints and revisit approaches you have already ruled out.
But slow responses do not necessarily mean the conversation is too long. Network delays, tool execution, and builds also take time. If you see a usage-limit or rate-limit notice, clearing the chat is not the appropriate fix.
Ask yourself two questions first:
- Does the next step still depend on requirements and conclusions discussed earlier?
- Can you narrow the current problem down to one clear objective, such as “fix only this test without changing public interfaces”?
If the goal keeps shifting, pin down the requirements first. Turning a vague task into a shorter vague task will not make it easier to carry out.
Use /compact first when continuing the same task
/compact summarizes the current conversation, reducing the amount of history that needs to be carried forward. It is useful when you want to continue fixing an issue after a long investigation, or move from one phase of a task to the next.
Enter the following command in Claude Code’s interactive input, not in a macOS shell:
/compact 保留当前目标、不可修改的接口、已改文件、失败测试和下一步;省略重复日志与已排除的尝试。
Compaction does not preserve everything word for word. A detail mentioned much earlier may not survive in its original form. Once compaction is complete, ask the assistant to restate the current goal and constraints before allowing it to make further changes.
Treat the compacted summary as a handoff note, not a complete backup. Requirements you cannot afford to lose should be written into project files you can inspect.
If you only want to get rid of one long log, there is no need to discard the entire task’s background. From then on, providing just the failing command, the key error, and the relevant location is usually more effective than pasting the full output again.
Consider /clear when you have moved to an unrelated task
For example, if you were fixing a UI layout and now need to analyze a script in another project, keeping the old conversation may only add distractions. Save any necessary conclusions first, then run this in the interactive input:
/clear
This clears the current conversation context. It does not delete code files or undo actions the assistant has already performed. Persistent information, such as project-level instructions, may still be loaded in subsequent work, so do not treat it as a reset of the entire development environment.
Before clearing the conversation, check the actual state of the working directory in the project terminal:
pwd
git status --short
git diff --stat
git diff
Pay particular attention to untracked files, unfinished changes, and changes from different tasks mixed together. Do not discard working-directory contents just to “tidy up the conversation.” Managing a session and restoring code are separate operations.
Resume work on a Mac project with a short handoff note
Create a work note in the project root where you can easily find it. These five items are enough:
- Goal: What needs to change, and how you will know it is done.
- Constraints: Which interfaces, files, or dependencies must not be changed.
- Progress: What has been changed, and what is only planned and has not yet been done.
- Evidence: Commands you have run, their exit status, and any remaining errors.
- Next step: Only the very next action to take.
Do not put keys, access tokens, or connection passwords in the note. Follow your team’s conventions when deciding whether temporary notes belong in version control.
When resuming, you can use a prompt like this:
先读取工作笔记,并检查当前 git diff。
复述目标、限制和剩余问题,暂时不要修改文件。
确认现状后,只执行笔记里的下一步。
For an iOS project, the note should also identify the workspace or project entry point, the scheme, and the build command you have already verified. If you have not run tests, explicitly record them as “not run.” Do not report “looks like it compiles” as a success.
If you only have Windows available but need to verify the macOS toolchain, you can rent a Mac by the day from RDPMini for this step; check the console for currently available configurations. The reason to choose macOS is to run the required build tools, not to expand Claude Code’s context.
If it still goes off track after compaction, narrow the task
After resuming, first check that the assistant correctly understands three things: what problem it is solving, what must not be changed, and how to verify the next step. If it cannot clearly explain even one of these, provide the missing information before allowing more changes to accumulate.
Assign only one verifiable piece of work at a time: first identify the cause of a failure, then make one targeted change, and finally run the relevant test. Avoid asking it to “refactor the project, fix errors, fill test gaps, and optimize performance” all at once, or the new history will quickly grow again.
Apply the same principle to logs: keep the command, the first significant error, and the relevant surrounding context. There is no need to resend all successful output. If the full log is needed, ask the assistant to read the relevant section of the local file.
Finally, remember that compacting the context may reduce the history included in subsequent requests, but it does not guarantee that every request will cost less, nor does it restore your usage allowance. Judge its effectiveness by whether the assistant can complete the next step using the available evidence, not just by how much shorter the conversation has become.
Frequently asked questions
Does /clear delete files Claude Code has edited?
No. It clears the current conversation context, not changes in your working directory. Use git status and git diff to inspect those changes separately.
Does /compact reset my usage allowance?
No. It compresses conversation context. It does not reset subscription allowances, API balances, or rate limits.
Need macOS? Rent a Mac for your project.
For a short-term build, compatibility testing, or model experiment, choose a dedicated Mac mini and billing period that fit the task. For extended offline use or connecting physical peripherals, a local device may be a better fit. Check the dashboard for real-time node availability.
Choose a node and rental period