Skip to content
Frank Huettner

Agentic AI in Business · Workshop II

Homework until 23 Nov, Part C: Stay in control

On this page

Claude Code can work alone for a long time. That is its strength, and its risk: it can go in circles, lose the thread in a long conversation, or change something that you cannot take back. In this part, you learn three moves that keep you in charge: Esc, /clear, and a copy.

6. Watch Claude Code, and press Esc when it goes in circles

Going in circles means: Claude Code tries the same thing again and again, and gets no closer.

A real case from our tests. We gave Claude Code the two prompts of the kimchi part of the last homework three times: trials 1, 2 and 3.

In every trial, Claude Code was to fix the search in a copy of the Langflow flow (step 13 of the last homework). The replay below shows what Claude Code wrote in trial 1.

Your turn. Watch the replay:

  1. Click Play the replay.
  2. Watch for one thing: does Claude Code say something new, or the same again? You do not need to understand every line.
  3. Click Esc Stop it here where you would stop Claude Code.
Claude Code · z-ai/glm-5.3-flash · our trial 1, 17 Nov
  1. Make a copy of the Langflow flow Draft Reply (Enron) and name it "Draft Reply (Enron) - Search Fix". …
  2. Thought for 1m 26s
  3. I'll do this in steps: first inspect the pieces I need from the flow JSON …
  4. Thought for 1m 58s, ran 2 shell commands
  5. Now let me look at the related mails' full texts and measure which stored mails are actually closest to the Kimchi mail …
  6. Thought for 42s, ran 2 shell commands
  7. … Before building anything, let me verify empirically which search input actually brings the Kimchi mail into the top 5. …
  8. Thought for 29s, ran 3 shell commands
  9. Interesting — the tweaks on MailSearch-mails.search_query were ignored (its input comes through an edge, and edge values win over tweaks). …
  10. Thought for 53s, ran 1 shell command
  11. The tweaks path doesn't reach the search (the edge wins). …
  12. Thought for 2m 8s, ran 3 shell commands
  13. The tweaks on MailSearch.search_query were ignored — that input comes through an edge, and the edge value wins. …
  14. Thought for 40s, ran 3 shell commands
  15. The tweaks on search_query don't apply (the edge wins), but settings like number_of_results are not edge-fed …
  16. The planned format (subject + body) improves the Kimchi mail's rank from 31 to 13, but let me be systematic …
  17. 现在我来验证组件代码在 Langflow 上的加载情况(仅校验——不修改任何流程):Now I check how Langflow loads the code of the component (a check only, no flow is changed):
  18. 代码是有效的。现在我来构建副本的 JSON:…The code is valid. Now I build the JSON of the copy: …
  19. The copy is created (id f567b653…, same folder). Now the edit: add the Search Query component and rewire. …
  20. 已完成。以下是我所做工作的总结:Done. Here is a summary of what I did:
  21. ✻ Sautéed for 23m 10s · done 8:21 PM

Later, in your own work with Claude Code: after Esc, ask. The replay above is only for practice: there is nothing to paste into it. In Claude Code, the key Esc stops Claude Code at once and keeps everything that it did so far, so you lose nothing. Then you could ask it something like:

What are you trying now? Why did the last try not work?

And when it writes in another language:

Please write in English.

You can also interrupt Claude Code (press Esc) when you see no new line for a few minutes, and ask: “What are you waiting for?” The answer may be simple, for example: Langflow needs a restart (./kingo restart in a second terminal tab). Or Claude Code has a good reason to wait. Then you can tell it to continue.

How often it got lost. We looked into the logs of our three trials. The task was the same each time: the same prompt, the same model (GLM 5.3 Flash). The trials differed in one thing: what Claude Code got to read about the setup, as in info-for-ai of step 2. Trial 1 got long instructions, trial 2 nothing, trial 3 the three short files of step 2.

  1. Trial 123 min
    with long instructions for Claude Code
    • said the same thing 4 times
    • 4 tries that went nowhere: twice the key files (blocked), a way to change the search that the flow ignores, a long check that it had to stop
    • 6 messages in Chinese

    "Kimchi for Monday" not in the sources

  2. Trial 29 min
    with no extra instructions
    • did not say the same thing twice
    • 1 try that went nowhere: a run of the flow that took too long
    • English throughout

    "Kimchi for Monday" not in the sources

  3. Trial 38 min
    with the three short files of step 2
    • said the same thing 2 times
    • 1 try that went nowhere: a typo in a command
    • English throughout

    "Kimchi for Monday" in the sources

Orange: trial 1, the run of the replay above. One run each: a hint, not proof. In trial 3, Claude Code could also call OpenRouter (its files said how; the sandbox adds your key), so it could measure the search itself.

Why did it write Chinese?

That is the model, not the tool. Models that learned many languages sometimes switch language in the middle of an answer; researchers call it code-switching (Deng et al., 2025). In our trial 3, the facts of step 2 said “The student … reads English”, and Claude Code wrote English from start to end. So did trial 2, without that line: one run proves nothing. But the line costs you nothing.

Why watch at all? Because the feeling misleads. In 2025, the research group METR measured experienced programmers: with AI tools, they felt 20% faster, and they were 19% slower (METR, 2025). METR says that today’s tools are different, so do not take the numbers as they are. Take the lesson: a feeling is not a measurement.

Done: you know when to press Esc, and what to ask then.

Next time. In your next longer task, watch the first minute. Press Esc once and ask what Claude Code is doing. Then write “continue”.

From Anthropic’s best practices for Claude Code: steer the session.

7. Start fresh: after two failed tries, and for a new task

Quiz. Say your mail AI assistant starts every reply with “Dear Sir”, and you asked Claude Code to fix that. Twice you told Claude Code what was wrong, and the replies still start with “Dear Sir”. What now?

  • Tell Claude Code a third time, more clearly: by now, Claude Code knows the problem well
  • Type /clear, and write one new prompt with what you learned
Show the answer

Type /clear. /clear empties the conversation. Without it, the model reads the whole conversation again at every step, also the two tries that failed. A third correction only adds to them. After /clear, one new prompt that holds what you learned works better almost every time. Your files stay as they are. The picture below visualizes this (try both buttons):

What the model reads again at every steproom in the course: 200,000 tokens
  1. AGENTS.md + facts
  2. Your prompt
  3. Try 1 ✗
  4. Correction
  5. Try 2 ✗
  6. Correction

Every step, the model reads all of this again: also the two tries that failed.

Your turn: watch the number. Start Claude Code as in step 1, if it is not running.

  1. Type /context: it shows how many tokens the model gets at every step. In our trial 2, right at the start, it showed 15.8k/200k tokens (8%): the start files and the tool’s own instructions for the model, before the first prompt.
  2. Ask Claude Code one question, for example: “Which flows are in my Langflow?” New here? Ask: “What does plan.md say?” Then type /context again: the number grew.
  3. Type /clear, and then /context: back at the start.

A long conversation has two costs:

  • It costs money. Every step sends the whole conversation again. On your OpenRouter key, you pay for all of it, at every step; with --login, it uses up your subscription’s limits faster.
  • It gets less reliable. Researchers who tested 18 models found: the longer the text in front of a model, the less reliable its answers, even for simple tasks (Chroma, 2025).

So start every new task with /clear. For example: you worked on your n8n workflow all morning, and now you want to change a prompt in Langflow. Type /clear first: the model does not need the morning’s conversation for the new task.

/clear only empties the conversation. Two things stay:

  • What Claude Code knows about your project. After /clear, the model gets the start files of step 2 again, and Claude Code’s own notes (more on them below).
  • The old conversation. Type /resume, and pick it from the list of your earlier conversations.

Keep what you learned. What Claude Code found out only in the conversation, for example which file was to blame, is gone after /clear. So before /clear, let Claude Code write it down. Paste:

Write what we learned so far into notes.md: what we tried, what failed, what we know now.

After /clear, begin your new prompt with “Read notes.md first.”

What about /compact?

/compact does not empty the conversation: it puts a summary in its place. That summary still holds the two tries that failed, so after two failed tries, /clear with one new prompt is better. /compact fits a long task that goes well: you keep the thread, and the model gets fewer tokens at every step. You can tell it what to keep, for example:

/compact keep the changes to the flow and the command that tests it

/compact itself reads the whole conversation once, to write the summary: on a long conversation, that is one big step.

Where its notes are. While it works, Claude Code writes notes for itself, its memory, and loads them at every start. Type /memory in Claude Code to see them. Usually, they are in ~/.claude/projects/, in a folder for each project. kingo keeps them in the folder where Claude Code works, in memory-of-ai/, where you can read them: in the course, that is ~/kingo-pod/claude/memory-of-ai/. Is a note wrong? Ask Claude Code to correct it, or delete it.

Done: you know how to start fresh, and how to keep what you learned.

Next time. Before your next new task, type /clear.

From Anthropic’s best practices for Claude Code: steer the session, and keep cost and context down; /resume: its page on commands; its notes: How Claude remembers your project.

8. Work on a copy where there is no undo

Claude Code can undo its own changes: type /rewind, and pick the point to go back to. But /rewind undoes only changes to files that Claude Code edited itself.

Files in your folderthat Claude Code edited itself/rewind takes them back
Langflow, n8n, your databasenot files in your folderNo /rewind here: make a copy first

Quiz. What can /rewind undo? Sort each change into its box.

ChangeCan /rewind undo it?
Claude Code wrote the file plan.md, in your course folderYes
Claude Code changed a line in AGENTS.md, in your course folderYes
Claude Code changed your flow in LangflowNo
Claude Code changed your workflow in n8nNo
Claude Code changed a row in your databaseNo
Why

/rewind brings back the files that Claude Code edited itself. Everything else stays as it is:

  • in any project: a file that only a command changed, and every change outside your folder, for example in a database, through an API, or a mail that went out;
  • here: your flows and workflows. They are not files in your folder: they live in Langflow and n8n, and Claude Code changes them through their APIs. A change to your flow, or to your published n8n workflow, reaches your mail AI assistant at once.

Your turn: undo a change. In Claude Code, paste:

Add a short joke about kimchi to the end of plan.md.

Look at the end of plan.md (step 3 shows how to open it). Then type /rewind, pick your prompt about the joke, and choose Restore code. Look again: the joke is gone, and the rest of plan.md is as before.

Can Claude Code put a flow back? Ask it, for example: “Put the flow back as it was before your change.” Claude Code knows from the conversation what it changed. Here, it also has backups: AGENTS.md asks it to save a flow or a workflow in backups/ before it changes it, and kingo saves all your flows and workflows at every start of ./kingo claude. That can work, but not for sure.

Where there is no undo, a copy is your undo. The last homework of the course did this, with the copy Draft Reply (Enron) - Search Fix (step 13): the original keeps working, and you can run both and compare. When the copy is better, ask Claude Code to bring the change into the original.

Done: you know where /rewind is your undo, and where a copy is.

Next time. For your next risky idea, start your prompt with: “Make a copy of … and change only the copy.”

From Anthropic’s How Claude Code works: “Actions that affect remote systems (databases, APIs, deployments) can’t be checkpointed”, and its page on checkpointing. That Langflow and n8n are such places comes from how kingo-pod works.

Next: Part D · A project of your own →