← Back to Investigations

The forgetful agent

2026-11-25 · Tyler Holmwood

At Origin, we run all of our agents through our observability tool. This allows us to be notified when an agent performs a risky or destructive behavior in our environment. However, sometimes our agents perform actions that are seemingly benign but still unexpected, leading us to wonder why they would behave like that. This is one of those cases.

A colleague posted in our #ai-nonsense Slack channel that their agent “forgot” who it was collaborating with and opted to mass-message all running sessions on their machine to relocate the peer. Curious as to why the agent would need to broadcast a message to identify a peer, I decided to dig into the trace.

I discovered an issue that runs deeper than a forgetful agent: when an agent session is resumed, its messaging alias is regenerated. This prevents agents that were previously collaborating from easily reaching each other after resumes. An undocumented feature flag exists in the Claude Code source to generate stable, session-based aliases, but is not currently enabled. Read on to find out what this costs and what you can do to prevent unnecessary token spend.

The excerpts below come from real captured agent traces. Some trace contents have been edited for user privacy, security, and brevity, but the intent and results remain.

The incident

The two sessions in question had been collaborating for some time. Traces from a few days prior showed them communicating under the aliases documents-c4 and documents-e8. The latter session was working on PR 4598, related to some of our new governance features for Microsoft 365 Copilot.

Earlier peer message reporting the results of a lab test

On Nov 19, the user asked the session working on the dependent PR (4243) to get context from the session working on the base PR (4598) and offer help. ListAgents showed six peers. None of them had the previously used documents-e8 alias.

The developer requests the new PR order, followed by the ListAgents result identifying documents-b7 and six live peers

The agent then searched through session JSONL files for the PR number. Searching the resulting file, it was able to recover the documents-e8 peer address, confirming the PR owner. It attempted sending a message to this recovered address, but the send failed.

The search for the base PR in local JSONL transcripts

The transcript search recovers the historical documents-e8 alias

SendMessage returns an unreachable-agent error for documents-e8

After this failure, the agent listed all recently updated JSONL files in the Documents folder, printing the current working directory and file write time. This confirmed the same session was live and working in origin-m365-macos. The agent's reasoning was not available here, but given that it had already scraped this transcript for the failed address, its options for locating the peer were limited. That was when the agent sent six identical messages, one to each peer from ListAgents, looking for the session working on PR 4598.

O3 groups six SendMessage calls and shows the first delivery and its full message to the base-PR session

The intended peer responded

The broadcast worked! The agent working on 4598, now using the alias documents-68, did receive the message and answered accordingly, allowing the agents to resume collaboration.

The dependent-PR session receives the reply from documents-68

What the other recipients did

The five other sessions also received the same message, and each behaved slightly differently.

The first did not address the received message at all. It was performing other work and continued to carry that out without interruption. Two other sessions received the message, briefly acknowledged in internal messages that it wasn't for them, and moved on.

The game monitor declines the peer request and continues monitoring

The blog session tells the developer it ignored the request

One session raised the message to the user, informing them that it had received the message and did not reply, as instructed.

The benchmark monitor declines the request and returns to the benchmark question

Finally, the last session, which was running Mythos, was stopped by the safety classifier. This stream refusal contained the broadcast message along with other tool calls, so it was difficult to say what exactly the refusal was addressing.

Claude Code records a classifier stop in the receiving session

Root Causes

We did not have access to the model's internal chain-of-thought to understand why it could not locate a session it was previously in contact with. However, there were two factors in the traces that likely explained the need for the SendMessage broadcast.

Just prior to the user request in the first screenshot, the session was compacted. In the compaction summary, there was no mention of session aliases, despite there being plenty of references to PR 4598 and the M365 work. Even if there had been saved aliases, another larger issue may have prevented the sessions from re-establishing communication.

While reviewing the traces, I discovered a sequence in which one of the sessions was restarted and resumed. Shortly after this happened, the agent reported that its alias had been updated.

Claude Code reports that a background command was left unfinished when the previous session ended

The resumed session identifies its old and new messaging suffixes

Local testing confirmed that Claude Code agents' aliases are refreshed when a session resumes in a new process. Browsing their GitHub issues reveals that we are not the only ones to run into this. Other users have reported peer names invalidating on resume, and a related report asks for session IDs to work as addresses.

Extracting the bundled JavaScript from Claude Code also confirms this behavior and reveals a feature flag, tengu_session_stable_address, that generates the messaging alias based on the stable session ID instead of random bytes. This feature flag has been present since v2.1.267, but is not linked to any editable config options or enabled in our environment.

// Claude Code 2.1.329, deobfuscated
function stableSessionAddressEnabled() {
  try {
    return getFeatureValue_SESSION_PINNED("tengu_session_stable_address", false);
  } catch {
    return false;
  }
}

function generatePeerAlias(workingDirectory, sessionId) {
  const prefix = sanitizeDirectoryName(basename(workingDirectory)) || "claude";
  const suffix = stableSessionAddressEnabled()
    ? twoWordSlug(createHash("sha256").update(sessionId).digest())
    : randomBytes(1).toString("hex");

  return `${prefix}-${suffix}`;
}

This stable address generation path was tested by running Claude in offline mode, seeding cachedGrowthBookFeatures.tengu_session_stable_address = true into .claude.json, and launching with CLAUDE_CODE_GB_DISK_CACHE_WHEN_TELEMETRY_OFF=1. Resumed sessions were confirmed to share stable aliases. When I re-enabled online mode, this feature flag was overwritten on cache refresh.

Alternate recovery

I am not claiming that the agents will always work around this limitation by broadcasting messages. In fact, the trace session of documents-68 revealed that it ran into the same problem when trying to respond to the sender, whose alias had also changed. Here, it opted to write the response as a Markdown file in the working folder instead of guessing the recipient among the list of active peers. This file was discovered by the intended recipient and is what allowed them to reestablish communication.

The base-PR session decides to save the reply to a file, then Claude Code confirms it created to_cursor_session.md

In both cases, these agents spent time and tokens to work around restrictions in their given tool set when a systemic solution already exists but is not enabled. While it is important for these models to be persistent in their problem-solving, it is equally important to provide them with an environment that facilitates the work they are trying to accomplish.

Impact

This design not only limits collaboration between resumed agent sessions but could also incur costs. Broadcast messages like the one shown here cause unnecessary model usage. Origin recorded six model calls linked to the message's recipients. Those calls wrote about 115,000 tokens to the prompt cache, for an estimated $1.66 in total usage at standard API rates with 5-minute cache writes.

Unintended recipientModelCallsCache-read tokensCache-write tokensEstimated cost
documents-c1Opus 5.52468,181740$0.1011
documents-9cOpus 5.52480,745806$0.1052
documents-7aMythos 5.1270,660114,225$1.4526
Measured total61,019,586115,771$1.66

The recipients that did not visibly acknowledge the response are omitted from the table.

This may not seem like a large amount, but when we compare the associated costs against the ideal case of the agent using SendMessage directly, there is a roughly 13-18x difference.

MethodModel callsEstimated costBasis
Sender request turn12$0.48Cost of alias refresh: including the transcript searches, failed direct send, and broadcast.
Unintended recipients6$1.66Unintended recipient responses from the table above.
Total Cost$2.14
Estimated direct send3-4$0.12-0.16This session's average of $0.04 per call, counting one ListAgents call, one SendMessage call, and a reply and/or a user response.

The comparison does not include the work performed by the intended recipient.

These additional costs over many sessions could certainly add up. If you perform heavy cross-agent collaboration in your workflows, I would suggest implementing a custom messaging tool or specifically naming your sessions until this feature becomes live. Claude Code's documentation suggests naming sessions with --name or /rename to help with finding and resuming sessions, but these names are also addressable. I have confirmed this through local testing.

Having AI observability is what allowed us to identify and root cause this anomalous agent behavior. Origin can identify both risks posed by agentic adoption and inefficiencies in your day-to-day work with agents. Knowing which configurations and options are right for you and your organization is not as simple as reading the documentation provided by Anthropic. Being able to analyze workflows to suggest and validate best practices requires the visibility we can provide.