Home / Fundamentals and the agent loop
The essential slash commands
A small set of slash commands drives an entire Claude Code session, the project's memory, the conversation's context and the active extensions, without ever touching the repository's code.
A small set of slash commands drives an entire Claude Code session, without ever touching the repository's code. They manage the project's memory, reset the context, summarise it, or inspect what is actually loaded in the current session, external servers and hooks included. Each one costs a single keystroke and avoids a guess about what is active.
What drives memory and context
/init generates or updates CLAUDE.md from an analysis of the repository. /clear starts again from an entirely empty conversation, no message and no open file remain in the session's memory. /compact frees up context by summarising the conversation's history, an optional instruction specifies what to keep from the summary. Both commands free up context, but not in the same way: /clear wipes everything, useful between two tasks that have nothing in common, /compact keeps a summary of what has just been done, useful in the middle of a long task that needs to continue without starting from scratch.
> /clear
New conversation, empty context
> /compact summarise only the decisions made about the payment API
Context reduced, summary kept
> /agents
To create or manage a subagent, ask for it in natural language
or edit the files in the .claude/agents folder
Inspecting active extensions
/mcp displays the connections to MCP servers, the protocol that links Claude Code to external tools or data, and manages their authentication, including reconnecting a specific server or turning a connection on and off. This command also works outside the usual interactive mode, in a script that calls Claude Code with no terminal open. /hooks displays the configured hooks, scripts that run automatically at certain session events, for example before a tool runs.
The change to /agents
Since Claude Code version 2.1.198, /agents no longer opens an interactive management screen for subagents. It now displays a simple reminder, pointing to editing the files in the .claude/agents or ~/.claude/agents folder directly, or to a request phrased in natural language to Claude to create or modify a subagent. Checking what these commands actually display, rather than assuming their behaviour from a memory of an earlier version, avoids looking for a screen that no longer exists.
Three layers of slash commands
A developer types /agents in his Claude Code session to check the list of subagents configured in the repository. The screen displays a message pointing to editing the files in the .claude/agents folder or to a request phrased in natural language.
Write in one sentence what this situation establishes, and in one sentence what it does not establish.
What this establishes: This situation establishes that the /agents command, in this session, displays a reminder pointing to two ways of managing subagents rather than a direct management screen.
What this does not establish: It does not establish that the command has always worked this way, since this behaviour dates from Claude Code version 2.1.198.
The three most common miscalibrations
- Too broad This situation confirms that every slash command now points to manually editing files rather than to a screen.
- Too narrow This situation says nothing about how to manage subagents, only that the /agents command exists.
- Off target This situation shows that the repository already contains a .claude/agents folder filled with several configured subagents.
- /init, /clear and /compact drive respectively the project's memory, resetting the context and summarising it.
- /mcp and /hooks give a direct view of the servers and hooks active in the current session.
- /compact and /clear do not do the same job, the first summarises without total loss of history, the second starts again from an entirely empty base.
- Since version 2.1.198, /agents points to manually editing the files or to a request in natural language rather than opening a management screen.
In an active Claude Code session, type /mcp then /hooks one after the other, and note what is actually connected before assuming that an expected extension is available.
These points depend on an interface or a rule that may have changed since this was written. Check them on your own screen before relying on them.
- A full inventory of every existing slash command was not gathered in a single pass, only the commands cited here were checked individually.
Every datable claim in this lesson links here to the public text behind it. A source that does not open proves nothing.