---
title: "How to know when another agent renamed a function you call · Cork"
description: "Find out when another AI agent renamed or changed a function your code calls: git pickaxe, type checks after rebase, session hooks, and live awareness."
canonical: "https://corkcli.com/blog/detect-renamed-function-another-agent"
last_updated: "2026-11-14"
published: "2026-10-03"
author: "Kevin Vera"
---

# How to know when another agent renamed a function you call

Find out when another AI agent renamed or changed a function your code calls: git pickaxe, type checks after rebase, session hooks, and live awareness.

By Kevin Vera · October 3, 2026 · [Guides](https://corkcli.com/blog/c/guides) · 6 min read

Without a coordination tool, you find out that another agent renamed a function you call in one of three ways: the build or type check fails after you rebase onto their work, a test fails, or someone tells you. To find out sooner, fetch and rebase often, type check right after every rebase, use `git log -S` to find the commit that removed the old name, and have agents announce renames to each other. To find out before you write the broken call at all, the rename has to reach your agent while it is working, which is what live awareness tools do.

## Why renames are the classic agent collision

A rename is the textbook semantic conflict. The renaming agent updates every caller it can see, so its branch is clean. Your agent, working from an older snapshot or a separate worktree, adds a new call to the old name. Git merges both branches without complaint because they changed different lines, and the result does not build, or in a dynamic language, fails at runtime when that path runs.

The same goes for signature changes: a new required parameter, a reordered argument list, or a different return type.

## 1. Rebase often and type check immediately

The fastest reliable signal is your compiler or type checker run against the latest main:

```bash
git fetch origin
git rebase origin/main
npx tsc --noEmit      # TypeScript: type check without writing output
```

Use the equivalent for your stack (a normal build for Go, Rust, Java or C#; your type checker for Python). An "is not defined," "has no exported member," or "expected 2 arguments" error right after a rebase is usually someone else's rename or signature change. In dynamic languages without types, only tests that exercise the call will catch it, so run them after every rebase.

## 2. Find the commit that removed the old name

Once you know a name disappeared, git's pickaxe finds when and why:

```bash
git log -S'getUser' --oneline origin/main
```

`-S` lists commits that changed the number of occurrences of the string, which is exactly what a rename does. Add `-p` to see the diffs. If you want commits whose added or removed lines match a pattern instead, use `-G`:

```bash
git log -G'getUser\(' --oneline origin/main
```

To follow the new function's history directly:

```bash
git log -L :fetchUser:src/users.ts
```

The commit message and author tell you which agent made the change and, ideally, why.

## 3. See what landed before you start working

Before starting or resuming an agent, check what changed on main since its branch point:

```bash
git fetch origin
git log --oneline HEAD..origin/main
git diff HEAD...origin/main --stat
```

In Claude Code you can feed this to the agent automatically. A `SessionStart` hook's stdout is added to Claude's context:

```json
{
  "hooks": {
    "SessionStart": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "git fetch -q origin && git log --oneline HEAD..origin/main"
          }
        ]
      }
    ]
  }
}
```

Now every session starts knowing which commits it is behind, which prompts it to rebase before writing code against stale names.

## 4. Make renaming agents announce and soften the change

Put a rule in the instructions every agent reads (`AGENTS.md`, or `CLAUDE.md`):

```markdown
## Renames and signature changes
- Keep the old name as a deprecated alias that calls the new one until all open branches have landed.
- Add new parameters as optional with a default.
- State every rename or signature change in the commit message as "RENAME old -> new".
```

The alias turns a hard break into a warning, and the commit message convention makes `git log --grep=RENAME` a quick way to list them.

In Claude Code, sessions running at the same time can also tell each other directly. Cross-session messaging lets Claude message your other sessions, and the docs name this exact case: "When a change in one session breaks what another is building on, Claude can warn that session before you notice." You can prompt it after a rename:

```text
Tell my other sessions that getUser is now fetchUser in src/users.ts
```

The limit is that the warning depends on the renaming agent deciding to send it, and it reaches only Claude Code sessions, not a Codex or Cursor agent on the same repo.

## 5. Catch it in CI before main breaks

As a backstop, make sure no branch lands without being tested against the current main. On GitHub, enable "Require branches to be up to date before merging" on the protected branch, or use a merge queue, which runs required checks on the latest base plus the changes ahead of each pull request. Either way, the broken call fails CI instead of breaking main.

## How Cork helps

Every method above tells you after the broken call exists: after a rebase, after CI, or after another agent remembers to say something. Cork is the [coordination layer](https://corkcli.com/blog/coordination-layer-ai-coding-agents) for multiplayer coding agents: it keeps Claude Code, Codex and Cursor agents, on one machine or across a team's machines, from overwriting each other on one codebase, and hands each agent what the others already learned.

For renames specifically:

- **Live awareness:** when another agent changes code yours depends on, such as a rename or a new signature, your agent hears it on its next step, before it pushes and without anyone choosing to send a message.
- **[Semantic lint](https://corkcli.com/blog/semantic-lint):** a teammate's rename or signature change becomes a lint rule your agents are checked against, so a new call to the old name gets flagged.
- **Briefing:** when your agent starts or gets a prompt, it is handed the exact current signatures and callers of the code it is about to touch, not the ones from its branch point.
- **Across tools:** the same protocol runs through hooks in Claude Code, Codex and Cursor, so a rename in a Codex session reaches a Claude Code session.

Cork Free covers one machine with no account; the paid plan extends it to teammates' machines. Install:

```bash
curl -fsSL https://corkcli.com/install.sh | sh
```

## Frequently asked questions

### How do I find which commit renamed a function?

Run `git log -S'oldName' --oneline` on the branch that has the change. It lists commits that changed how often the string appears, which includes the rename.

### Why did my code break after merging when both branches passed CI?

One branch renamed or changed a function and the other added a call to the old version. Each passed alone; the combination was never tested. Require branches to be up to date before merging, or use a merge queue.

### Can Claude Code tell me when another session renames something?

Another Claude Code session can message yours through cross-session messaging, if it decides to or you ask it to. It does not happen automatically for every rename.

### Does this happen in dynamic languages too?

Yes, and it is harder to spot: without a type checker, the broken call only fails when that code runs, so tests that exercise it are your main defense.

## Sources

- <https://git-scm.com/docs/git-log>
- <https://git-scm.com/docs/gitdiffcore>
- <https://www.typescriptlang.org/tsconfig/#noEmit>
- <https://code.claude.com/docs/en/hooks-guide>
- <https://code.claude.com/docs/en/cross-session-messaging>
- <https://code.claude.com/docs/en/memory>
- <https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/about-protected-branches>
- <https://martinfowler.com/bliki/SemanticConflict.html>

## Related reading

- [Pre-commit checks for code written by AI agents](https://corkcli.com/blog/pre-commit-checks-ai-generated-code): Pre-commit checks for AI-written code: git hooks, the pre-commit framework, secret scanning, and agent hooks in Claude Code, Codex and Cursor.
- [How to stop an agent editing a file someone else is changing](https://corkcli.com/blog/stop-agent-editing-file-someone-else-is-changing): Block an AI coding agent from editing a file another session is changing: a tested Claude Code PreToolUse lock hook, Cursor and Codex equivalents, and limits.
- [Blast radius: how to know what a code change breaks before you make it](https://corkcli.com/blog/blast-radius-code-change): Find a code change's blast radius before you make it: callers via LSP and git grep, dependents with Nx or Turborepo, history, tests, and teammates' work.
- [How to give AI coding agents context about recent changes](https://corkcli.com/blog/give-ai-coding-agents-context-recent-changes): Give Claude Code, Codex and Cursor context about recent changes: good commit messages, SessionStart and prompt hooks that inject git history, and live updates.

[All articles](https://corkcli.com/blog.md) · [Cork in Markdown](https://corkcli.com/index.md) · [llms.txt](https://corkcli.com/llms.txt)

This page in HTML: https://corkcli.com/blog/detect-renamed-function-another-agent
