Volver a PodcastsClaude
Claude Code 101
Gestión del contexto en Claude Code
is Claw's working memory.
es la memoria de trabajo de Claude.
Every file it reads, every command it runs, every message you send, it all takes up space in the context window.
Cada archivo que lee, cada comando que ejecuta, cada mensaje que envías, todo eso ocupa espacio en el context window.
Think of the context window as the amount of space that Claude could hold in his memory.
Piensa en el context window como la cantidad de espacio que Claude puede mantener en su memoria.
Whenever you enter a prompt, Claude reads a file, runs a tool call, gets a tool call result.
Cada vez que introduces un prompt, Claude lee un archivo, ejecuta una llamada a herramienta, obtiene un resultado de llamada a herramienta.
This is added on to the context window.
Esto se añade al context window.
And since there's only a finite amount you can put in the context window, it becomes extremely important to optimize this as much as possible.
Y dado que solo hay una cantidad finita que puedes poner en el context window, se vuelve extremadamente importante optimizarlo tanto como sea posible.
Now, when you approach this limit, the context window is automatically compacted.
Ahora bien, cuando te acercas a este límite, el context window se compacta automáticamente.
Compaction will summarize important details and remove the unnecessary tool call results and free up a lot of space in your context window.
Compact resumirá los detalles importantes y eliminará los resultados de llamadas a herramientas innecesarios, liberando mucho espacio en tu context window.
Do note though that this could potentially lose details in your previous conversation.
Hay que tener en cuenta, sin embargo, que esto podría potencialmente perder detalles de tu conversación anterior.
You can run the compaction manually as well with the /compact command.
También puedes ejecutar la compactación manualmente con el comando /compact.
This will compact everything that you've done up to that point, which could be handy if you want to clear up context space, but also have a memory of what you previously worked on.
Esto compactará todo lo que hayas hecho hasta ese punto, lo cual puede ser útil si quieres liberar espacio de contexto pero también conservar un recuerdo de lo que trabajaste anteriormente.
If you want to completely start from scratch without memory of what was previously worked on, you can also run /cle and that will remove everything starting from scratch.
Si quieres empezar completamente desde cero sin memoria de lo que se trabajó anteriormente, también puedes ejecutar /clear y eso eliminará todo empezando desde cero.
To check the state of your context, run the /context command.
Para verificar el estado de tu contexto, ejecuta el comando /context.
Here you'll get a big picture of how large your context size is, the different categories that are taking up the most context, and a graphic showing you all of this.
Aquí obtendrás una visión general de qué tan grande es tu contexto, las diferentes categorías que están ocupando más contexto, y un gráfico que te muestra todo esto.
A general rule of thumb is when you're working on a specific feature and are going over the context window, but need to continue, then compact.
Una regla general es que cuando estás trabajando en una función específica y vas a superar el context window, pero necesitas continuar, entonces usa compact.
Keeping the context relevant for this feature is important when continuing development.
Mantener el contexto relevante para esta función es importante al continuar el desarrollo.
If you have finished the plan and want to start on a new feature, then clear.
Si has terminado el plan y quieres comenzar con una nueva función, entonces usa clear.
You don't want the previous conversation to present bias in anything new that you want to create.
No quieres que la conversación anterior introduzca sesgos en nada nuevo que quieras crear.
For things that you do want Claude to remember in other sessions, put it in the claw.md file.
Para las cosas que quieres que Claude recuerde en otras sesiones, ponlas en el archivo claude.md.
That way, it doesn't have to rediscover things from scratch all over again.
De esa manera, no tiene que redescubrirlas desde cero en cada ocasión.
Be specific.
Sé específico.
The irony behind writing a smaller prompt is that it in the long run, it will take up more context.
La ironía de escribir un prompt más corto es que a largo plazo ocupará más contexto.
Without being explicit, Claude is forced to look around your codebase more and do its own thinking, which takes up a lot more context.
Sin ser explícito, Claude se ve obligado a buscar por tu codebase y hacer su propio razonamiento, lo que ocupa mucho más contexto.
window space than if you were just a little bit more clear with a sentence or two.
espacio de ventana que si hubieras sido un poco más claro con una oración o dos.
MCP servers load all of the tools available into context by default.
Los servidores MCP cargan todas las herramientas disponibles en el contexto de forma predeterminada.
So, if you have a lot of MCP servers for things that are unrelated to the project, it might be worth turning them off.
Por lo tanto, si tienes muchos servidores MCP para cosas no relacionadas con el proyecto, podría valer la pena desactivarlos.
You can also try out skills, which works similarly to MCP servers, but doesn't put the entire thing into context, saving you space.
También puedes probar las skills, que funcionan de manera similar a los servidores MCP, pero no cargan todo en el contexto, ahorrándote espacio.
Sub agents run in parallel with your main agent but has a complete separate context window.
Los sub agents se ejecutan en paralelo con tu agente principal pero tienen un context window completamente separado.
So for tasks that require an answer without the journey like where is the authentication endpoints located, you can have the sub agent do the work and return just a summary to your main agent.
Así que para tareas que requieren una respuesta sin el recorrido, como dónde están ubicados los endpoints de autenticación, puedes hacer que el sub agent realice el trabajo y devuelva solo un resumen a tu agente principal.
Managing context within cloud code is crucial.
Gestionar el contexto dentro de Claude Code es crucial.
Use slash compact to summarize long sessions and slashclear to start fresh.
Usa /compact para resumir sesiones largas y /clear para empezar desde cero.
To use your context window effectively, be specific with what you want.
Para usar tu context window de manera efectiva, sé específico con lo que quieres.
Check what's using your current context window and use sub agents to delegate tasks you only need the answer for.
Revisa qué está usando tu context window actual y usa sub agents para delegar tareas de las que solo necesitas la respuesta.