All lessons › Function E — The Agentic SOC › Understand — Correlation, Intel and the Hunt
E3.6

Plan, then replan — an investigation that changes its mind

E3
▶
Lightboard recording

Not recorded yet. The lesson below is complete and runnable today — the video is added later without touching this page.

Video placeholderpublishes automatically from recordings/E3.6.mp4
Risk

The agent anchors on its first hypothesis and spends the whole incident gathering evidence for it.

Control

An explicit plan record with a replan trigger, so an abandoned branch is visible in the trace rather than silently dropped.

The lab

Feed contradicting evidence mid-investigation and check the plan actually changes, and that the abandoned branch is recorded.

◉Use case relevance

An agent forms a hypothesis at step one and spends the rest of the incident finding evidence for it. The evidence that should have stopped it supports nothing at all — which is exactly why an agent scoring only support reads it as noise and carries on.

At CyberTravels. Plan records the hypothesis, counts contradicting evidence, and makes replanning a trigger rather than a judgement call. The abandoned branch stays in the trace, because a branch that is not in the trace looks like one nobody considered.

◴What this lesson is — Day 0, Day 1, Day 2

An investigation that is structurally allowed to change its mind: a plan record, a replan trigger that counts contradicting evidence, and abandoned branches that stay visible in the trace.

Day 0 — why

An agent scoring evidence only on support confirms its first theory and never terminates.

Day 1 — how

Force a replan when evidence refutes, and keep the abandoned branch visible in the trace.

Day 2 — measure

Branches considered and dropped, visible to a reviewer. A trace with one branch is not an investigation.

Measure this

what to measuredenominator or target
branches considered and dropped, visible to a reviewercount; a trace with one branch is not an investigation

▦The framework, and how it works

   evidence        supports?        the plan

   1 refund at 03:14   misuse|theft   agent-misuse
   2 agent's session   misuse         agent-misuse
   3 SPIFFE, no human  misuse         agent-misuse
   4 plan has no       --- nothing -- agent-misuse   <- refutes, supports
     refund step                                        nothing, and an
                                                        agent scoring only
                                                        support skips it
   5 vendor tool desc  injection      REPLAN -------> indirect-injection
   6 desc changed      injection      indirect-injection

   the abandoned branch stays in the trace: a reviewer must see that
   agent-misuse was considered and dropped, not that it was never raised

Every investigator is wrong at step one. What separates an investigator from an expensive autocomplete is what happens when the evidence stops fitting.

The way agents fail here is specific. They score evidence on whether it supports a hypothesis — so evidence that supports nothing reads as noise, when refutation is exactly what should force the replan. The agent keeps gathering support for a theory the evidence already killed.

Anchor → E1.0. An agent that scores evidence only on support never ends the interval; it spends the whole incident confirming step one. Refutation is what makes the investigation terminate, and the abandoned branch stays in the trace so a reviewer can see it did.

2 · The abandoned branch stays in the trace

A reviewer needs to see that a hypothesis was considered and dropped, not that it was never raised. A conclusion with no visible alternatives looks inevitable, and an investigation that looks inevitable is one nobody can audit.

In CyberTravels the branch that gets abandoned is the obvious one: the workflow agent issued the refund, so the workflow agent did it. The evidence that kills that theory supports nothing at all — the agent's own plan for that run contains no refund step.

3 · An investigation that changes its mind

Six pieces of evidence, three hypotheses, one replan. Step 4 is the one an eager investigator skips.

▶Real time execution as skill

The skill — skills/secops/investigation-replan-trace/SKILL.md

name: investigation-replan-trace
description: >-
  Run an investigation that must abandon its opening hypothesis, and check the
  replan is visible in the trace. Use when an investigating agent keeps
  confirming its first theory, when evidence that refutes rather than supports
  is being ignored, or when a reviewer needs to see which branches were dropped.
allowed-tools: Read, Grep, Glob

The failure is not being wrong at step one. It is staying wrong.

Every investigator is wrong at step one. What separates an investigator from an expensive autocomplete is what happens when the evidence stops fitting: a real one abandons the branch, and the abandoned branch stays in the record.

The specific way agents fail here is subtle. They score evidence on whether it supports a hypothesis, so evidence that supports nothing reads as noise — when refutation is exactly what should force the replan.

When to use this

On any investigation an agent drives end to end, and in review of one that reached a confident conclusion quickly. A trace with no replan on a complex incident is a warning, not a success.

Step-by-step

1 — Record the opening hypothesis explicitly. An unstated hypothesis cannot be abandoned, only drifted from.

2 — Score each piece of evidence for and against, separately. Support and refutation are not one axis.

3 — Trigger a replan on refutation, not on absence of support. Evidence that supports nothing is the signal; treat it as a trigger, not as noise.

4 — Keep the abandoned branch in the trace. A reviewer must see that a hypothesis was considered and dropped, not that it was never raised.

5 — Stop when a hypothesis survives evidence that could have refuted it. Not when one accumulates the most support.

Example

Input — six pieces of evidence and three competing hypotheses, in scripts/investigation_replan_trace.py.

Output — the turn of a real run:

4. traces   the agent's plan for that run contains no refund step
   (neutral — refutes nothing, so nothing changes)
5. mcp      the vendor MCP server returned a tool description naming a refund
   REPLAN agent-misuse -> indirect-injection

Output contract

{
  "steps": [{"n": 0, "source": "str", "fact": "str",
             "hypothesis_before": "str", "hypothesis_after": "str",
             "replanned": true}],
  "replans": 0,
  "final": "str"
}

Common edge cases

  • Evidence supports two hypotheses equally. It is not a discriminator; keep both alive rather than picking the first.
  • The refuting evidence arrives first. Then the opening hypothesis was wrong before it was formed, which is fine and should still be recorded.
  • No hypothesis survives. That is a result. It means the list was incomplete, not that the investigation failed.

Failure modes

  • Anchoring. Every subsequent query is designed to confirm step one.
  • Silent branch pruning. The conclusion looks inevitable because the alternatives were never written down.
  • Treating "supports nothing" as noise. It is the strongest signal in the trace.

Three ways to do this lesson. Pick one. They run the same procedure against the same code — what changes is who drives it, and how much you see.

1In your AI agent — you are taught

The agent reads the lesson, explains the idea, fetches the code, runs the check and answers your questions as you go. This is the one to take if you are here to learn.

Install it, once. From the folder you cloned. --all does every agent it finds on your machine:

python3 scripts/install_skills.py --all --lessons E3.6

Then restart your agent and open it in that folder. On Windows, if python3 says Python was not found, use python instead.

Then pick e3-6-plan:

agentinstall just for this agentstart it
Claude Codepython3 scripts/install_skills.py --tool claude --lessons E3.6type /e3-6-plan
GitHub Copilot (VS Code)python3 scripts/install_skills.py --tool copilot --lessons E3.6type /e3-6-plan in Chat
Cursorpython3 scripts/install_skills.py --tool cursor --lessons E3.6type / in Agent chat and search for it
Codexpython3 scripts/install_skills.py --tool agents --lessons E3.6type $e3-6-plan, or run /skills

2As one Python command — you just run it

No agent, no conversation. The same lesson executes and prints the same readback. Take this one if you have no assistant, if you are reviewing rather than learning, or if you want the result without the teaching around it.

python3 scripts/lesson.py E3.6

3Read the code, and the difference — nothing runs

Neither of the above, and no model needed. The first command writes CyberTravels exactly as it stood at the end of this lesson; the second prints the diff — the lines this lesson added or changed, and nothing from any later one.

python3 scripts/checkpoint.py --at E3.6 --out work/cybertravels
python3 scripts/checkpoint.py --at E3.6 --diff

On Windows, type python wherever these say python3 — and use \ instead of / in the paths. Everything else is identical. A0.0 step 2 explains why.

Ways 1 and 2 need a model; way 3 does not. A signed-in Claude Code CLI needs no API key, and any OpenAI-compatible endpoint works too. With neither, the audit exits 2 and says so rather than inventing an answer. A0.0 sets this up.

Ways 1 and 2 both end with the same readback: What I did, What changed, The number and Read this next. A step that was skipped or refused is reported as exactly that, never as a pass.

If you did the last lesson’s challenge, expect this to stop. Most challenges ask you to edit the code, and ways 1 and 2 will not overwrite your edits: you get stopped, not a failure, with two options — --out for a fresh folder that keeps your work, or --force to discard it and start this lesson clean.

✓What you just proved

One replan, from agent-misuse to indirect-injection, with the neutral evidence at step 4 marked as refuting nothing — and the abandoned branch still visible in the trace.

✎Your turn

Add evidence that refutes the final hypothesis too. An investigation that cannot end undecided is not investigating.

Tools used

OpenTelemetry

Skill source: skills/secops/investigation-replan-trace

← PreviousE3.5 · Agent-assisted reconstruction — a timeline you can challenge