Handle /new and /help
Exit

Handle /new and /help

Add /new to reset conversation history and /help to print available commands

💻

Writing code and entering commands is only available on desktop. Open this page on a larger screen to complete this chapter.

Resetting context and showing the command list

Two more commands complete the slash command set.

/new resets history = []. The model uses conversation history to follow up on previous questions — once you reset it, the model no longer has access to anything discussed before. This is useful when you switch topics and don't want prior context to bias the answers.

/help prints all available commands so users don't have to remember the syntax. Without it, the only way to learn what /files and /new do is to read the source code.

Instructions

  1. In chat_loop, between the elif command == "/files": block and the else: clause, add elif command == "/new":.
  2. Inside the /new block:
    • Add history = [] — this empties the conversation memory so the model starts fresh without any prior context.
    • Add print("New conversation started. I won't remember what we discussed before.") to confirm the reset.
  3. After the /new block, add elif command == "/help":.
  4. Inside the /help block, add these four print statements in order:
    • print("/files — list indexed files")
    • print("/new — start a new conversation (clears memory)")
    • print("/quit — exit")
    • print("@filename ... — ask about a specific file, e.g. @readme.md what does it cover?")