Context Loss Markers: Spot in Seconds When an Agent Drifts

Context loss happens unnoticed: the agent keeps answering confidently, but it no longer remembers the session’s rules, goals, and agreements. Detecting it from the text means reading everything with your own eyes. A community lifehack solves the problem in a second: greeting markers at the start and end of the reply. Here is the technique and its extensions.

The basic technique: a wrapping marker

A line is added to the project rules: “Start every reply with the line [ALIVE-1234] and end it with the line [/ALIVE-1234].” As long as the agent replies wrapped in the markers — the context is in place. The first reply without a marker is an instant signal: the agent has lost the session rules, and the context needs to be refreshed.

Why it works: the marker is the “cheapest” rule there is; it is executed mechanically for as long as the rules are being read at all. As soon as the model loses the session head, the marker goes first. It is a canary in the coal mine.

Extensions of the technique

  • An iteration counter in the marker: [ALIVE-042] grows with every reply — a jump or a reset is visible at once.
  • A digest in the marker: “[/ALIVE | task: X | step: 3/7]” — one-line telemetry of the state.
  • A rules check in the marker: the agent ends the reply with the line “rules: followed/partially/violated” — a self-report on discipline.
  • Different markers per session: the marker changes when a new task starts — session mix-ups are visible immediately.

When the agent “drifts”: symptoms before the marker

  • It re-asks about things that were already agreed.
  • It violates rules it followed an hour ago.
  • The style of replies turns generic and polite instead of specific.
  • Numbers and names from the start of the session get distorted.
  • The cost per iteration has grown with the same prompt — the context has swollen.

With any two symptoms — a check with the marker and a decision: hand off the results to a new session or end the task. Driving it further is not worth it: quality does not come back on its own after context loss.

Recovery after the loss

  1. Stop the session; do not write on top of the broken context.
  2. Collect the results: what was done, what was decided, what remains — by hand or with a separate “summarize” request.
  3. The results go into the project rules file (CLAUDE.md/AGENTS.md).
  4. A new session with a clean head and a three-paragraph briefing.

The full memory system into which the markers fit is described in the guide on CLAUDE.md, skills, and hooks. Markers are part of session discipline; their purpose is early detection, not a cure.

Signals and actions: a cheat sheet for context loss

Let us bring the symptoms, their meaning, and the first reaction together into one table — a cheat sheet for reviewing a session. The logic is simple: the earlier the signal, the cheaper the reaction. The marker catches the breakdown instantly and costs a few dozen tokens; indirect symptoms require careful reading and often appear before the marker disappears — a chance to react before the full breakdown. And the actions come down to a single rule — do not keep working on top of the broken context: first record the results, then a new session with a briefing.

SignalWhat it meansAction
A reply without the markerThe session rules are lostStop the session, collect the results
The counter in the marker jumps or has resetSessions or tasks got mixed upVerify the task, switch the marker when a new one starts
The digest in the marker contradicts the taskThe agent is “drifting” within the sessionHand off the results to a new session
Re-asking about things already settledAn early stage of context lossCheck with the marker, compress the context
The cost per iteration grew with the same promptThe context has swollen, discipline is fallingSum up the results, restart with a clean head
The style has turned generic and politeThe model has moved away from session specificsUpdate the rules or end the task
Numbers and names from the start of the session get distortedThe beginning of the context is no longer accessible to the modelUrgently record the facts, new session

The table does not replace the marker check — it speeds up the review of a breakdown that has already happened: from a signal row you can see what the breakdown means exactly and which action to perform first. Keep it next to the project rules: reacting to signals is as much a part of session discipline as the markers themselves. Over time the list is supplemented with signals from your own practice — for example, errors typical of your stack that the agent starts repeating when it loses the rules.

A useful habit is to run the table not only over emergencies but over planned runs as well: long tasks with an iteration counter, multi-step pipelines, batches of similar requests. In them, context loss arrives earlier on the clock, so the reaction threshold shifts: any two symptoms from the table in such a task are grounds for an immediate marker check, not an end-of-day one. At the end of a long session it is worth going through the table too: a match with even one row is a signal to compress the context or sum up the results.

Common questions

Does the marker cost tokens? A few dozen tokens per session — nothing against the cost of lost context.

Does it work on all models? On all that follow instructions; on models below the Haiku level the markers “drift” too — and that is an honest signal about the model’s fitness for agentic work.

Can the check be automated? Yes: a hook on the reply that verifies the marker, and a notification on a miss — the level of advanced wrappers.

What if the agent writes the marker but has forgotten the rules? The marker is a canary, not a guarantee: additionally keep a one-line digest inside the marker — its contents are verified by eye in a second.

The marker is visible in the reply — is that normal? For internal pipelines and agentic work — yes: the marker is telemetry, not text decoration. If the reply goes outward, the wrapper strips it with one line when parsing the response.

What do you do if the marker disappears in the middle of a long task? Stop the session and do not write on top of the broken context: collect the results of what was done and decided, move them into the project rules file, and open a new session with a briefing. This is the same recovery order described above.

How is the counter in the marker different from the basic wrapper? It is an extension of the same technique: one line carries more signal. A jump, a reset, or a frozen number is visible at once — no separate check needed.

Do markers catch API interruptions and network errors? No: a dropped connection is a different breakdown, visible in client errors. Markers catch the quiet breakdown — the loss of session rules behind an outwardly successful reply.

Markers turn the elusive “context loss” into a visible breakdown with instant diagnostics. One line in the rules — hours of saved review. The technique comes from community practice of 2026.

Like this post? Please share to your friends:
11AI - Your Free LLM
Leave a Reply

;-) :| :x :twisted: :smile: :shock: :sad: :roll: :razz: :oops: :o :mrgreen: :lol: :idea: :grin: :evil: :cry: :cool: :arrow: :???: :?: :!: