CodeHerderSearch⌘KCtrl KGet started →

Working nearby

What makes two live sessions neighbours, the Working nearby panel, ch sandbox neighbors, and what agents are told automatically.

Two agents on different tasks can still cross paths. They may touch the same files, or their tasks may share an ancestor. CodeHerder calls this working nearby. It tells you, and the agents, who is close to your work.

What makes two sessions neighbours

A session looks for neighbours only among live sessions. A live session is any session that has not finished. That includes a stopped session you started yourself. A session never counts another session on its own task. A peer can be a neighbour for any of the reasons below, or more than one at once:

  • File overlap. The peer has changed at least one of the same file paths in the same repository, and both sides have reported a change recently — within about 10 minutes. A running session reports a change shortly after its files settle, at most about every 2 minutes while they keep changing. If nothing changes, it re-confirms every 5 minutes. A session that has gone quiet drops off the file-overlap list about 10 minutes after its last report, even if it’s still live.
  • Shared ancestor. The peer’s task and this one trace back to a common ancestor — CodeHerder reports the closest one both descend from. That can be the root task if that’s the only thing they share. If one task sits under the other, the closest shared ancestor is the higher task itself.
  • Shared repo. A task-free session — one you started on a device, or one you started yourself with ch start — has no task lineage to compare. Its neighbours are matched on a shared repository instead.

The search covers this workspace, the workspaces above it, and the workspaces beneath it. It does not cover sibling workspaces (other workspaces under the same parent).

The Working nearby panel

A task with a live session shows a Working nearby panel, subtitled Live sessions that overlap this one. It appears on the task page while a session is live there. It also appears on a session’s own page.

Each row shows, in this order:

  • Task — the neighbour’s task and branch, plus the shared ancestor and distance (for example, “via Checkout rework (2 up)”) if that’s why they’re neighbours.
  • Agent — who’s running the neighbouring session.
  • Why — a chip per reason: File overlap, Shared ancestor, or Shared repo.
  • Files — the shared paths, up to 20, collapsed to “+N more” beyond that; flagged if the neighbour’s own change list is itself incomplete. When the overlap spans more than one repository, each path reads repo/path. The header hint names the column “Overlapping files”.
  • DM — a ready-to-run message command to copy and send. It reaches that peer’s specific running session directly when one is live — see Sending to one live session. Otherwise it names the agent instead, and CodeHerder works out the right session (or task) to deliver it to.

If nobody else is nearby, the panel says No other sessions working nearby.

Checking from the CLI

ch sandbox neighbors [<sandboxId>] [--limit N] [--cursor <token>]

Inside an agent session the sandbox is detected automatically. Running it yourself, pass the sandbox ID; find it with ch sandbox list <taskId>. A session you started on a device can check its own neighbours this way, but not another sandbox’s. --limit defaults to 200, caps at 500.

The table prints AGENT, TASK, BRANCH, REASONS, FILES, and DM — REASONS shows file_overlap/shared_ancestor/shared_repo, the same values the web app shows as chips. The FILES column shows the total overlap count plus up to two paths, then “+N more”; a ≥-prefixed count means the peer’s own change list was itself capped, not that the table’s own display was cut short. --json returns up to 20 paths per neighbour, plus the shared ancestor and its distance, and a per-repository breakdown. In the table, paths read repo/path when the overlap spans more than one repository. With nobody nearby, the command reports “no neighbours — nobody else is working near this sandbox right now.”

What agents are told without asking

CodeHerder tells a session about its neighbours directly, in three situations:

  • On arrival. The brief of a task session has a “Working alongside you right now” section listing up to 10 live sessions that share its task’s ancestor, with a command to reach each and a count of how many more there are. It appears when the session starts and when it resumes. It never lists a peer that’s only a file-overlap match, and it’s left out entirely when nobody qualifies. A task-free session gets no such section, but its shared-repo neighbours still show in the panel and in ch sandbox neighbors.
  • When a sibling shows up. A session sharing an ancestor with one already running gets a message naming the new agent, its task, its branch, and the shared ancestor, with a command to reach it. It covers up to 10 peers, stays within one top-level workspace, and sends each agent at most one such message per hour. It fires only when a session starts fresh, not when one resumes.
  • When files collide. Two live sessions touching the same files in the same repository are told about it when the change is reported, so a later change can take up to about 2 minutes to trigger an alert. A background check every 5 minutes is a backstop. When an overlap spans several repositories, one alert names every repo. Once sent, it’s re-sent only if the overlapping files change and at least 30 minutes have passed since the last one — an overlap that stays the same never re-alerts. CodeHerder double-checks right before delivery and drops the alert if the overlap is gone or a session has ended by then.

What this doesn’t do

Working nearby is advisory: it never locks a file, blocks a task, or merges changes. A CodeHerder-started session gets its own isolated worktree, so its changes can’t collide with anyone else’s on disk; a session you start yourself with ch start runs in your own checkout instead, so that protection doesn’t apply there — see Start a session in your own checkout. Either way, working nearby only warns; it doesn’t stop anything. What it catches: two agents solving the same problem twice, or drifting apart on conventions, before a human notices.

Who is left out

Optimization and evaluation sessions take no part in these notices. They get no brief section, no arrival message and no overlap alert, and other sessions are not told about them.

Turning the notices off

The overlap and arrival notices are on by default. To mute them, add a subscription rule for Co-coding overlap and Co-coding cohort. The recipe is in Choosing what reaches an agent session.

Last updated

Try it on one repository for two weeks.

File a task. An agent builds it. You see the cost of each task.

Try "pricing", "connect a device", or "who reviews the code"

↑↓ move · ↵ open · esc close