Docs

Collaboration

Handoffs

Pass an intent and everything your agent knows about it to a teammate's agent, from your agent, the CLI or the dashboard.

11 min readUpdated

On this page

A handoff passes in-flight work (an intent, INT-n) from you to a teammate. They become its owner, and their agent picks it up with the context yours built: the plan, what it claimed, what it changed, what it ran into.

Use it when you're going on leave at the end of a sprint, when the work turned out to belong to someone else's area, or when a teammate is better placed to finish it.

What the teammate gets

The intent keeps its number, status, claims and history; only the owner changes. Comity also opens a direct-message thread from you to them, linked to the intent, with the subject Handoff: INT-n <title>. Its message carries the bundle:

  • The intent's plan.
  • Its claims: paths, symbols and contracts.
  • The files and symbols touched so far.
  • Open conflicts with other work.
  • The latest status your agent shared.
  • Your note, if you wrote one.
  • Tried, didn't work: what was already tried, if anything (see below).
  • A context pack from your agent's session, if one was sent: the message only names it (see below).
  • How to continue.

The thread shows up in the dashboard's Messages tab like any direct thread, and either of you can reply in it. See Messaging & channels.

Handing off

Three ways, all doing the same thing.

From your agent

Ask your agent to hand the work off ("hand this off to Jordan, note that the PDF layout is done but the totals are wrong"). It calls the MCP tool intent_handoff:

JSON
{ "to": "jordan@acme.com", "note": "PDF layout is done. Totals are off by tax on discounted lines; see the failing test in invoices.test.ts." }

ref defaults to the agent's current intent. intent_close with outcome handoff and handoff_to does the same handoff.

From the CLI

Terminal
comity handoff @jordan --note "PDF layout is done; totals still wrong"
comity handoff jordan@acme.com --intent INT-12 --yes

@name matches a teammate by name, first name or the part of their email before @. Without --intent, the CLI hands off your only live intent in the current repo. The CLI also builds a context pack from your agent session's transcript on this machine and shows it before you confirm. See comity handoff.

From the dashboard

Open the intent in the Work tab, click Hand off…, pick the teammate, add an optional note and, under Tried, didn't work, what you already tried (one per line, what => result, up to 10), then click Hand off. The drawer then links to the handoff thread in Messages.

What the teammate's agent sees

At its next tool call or prompt, the recipient's agent gets a Handed off to you section in its Comity context: who handed off which intent, their note, what was already tried, the context pack, the claims, files and symbols touched, the intent's open conflicts (as they are now, not as they were at handoff time), the last status, and how to pick it up. Every new agent session they start shows it again until one of them adopts the intent (for up to 7 days).

Their agent should confirm with them before taking over. To continue, it calls intent_adopt from a session in the intent's repo:

JSON
{ "ref": "INT-12" }

That binds the agent's session to the intent: its claims, recorded changes and conflicts become that session's, and the agent carries on from the bundle; the result repeats the context pack in full. If the session had only an auto-drafted intent of its own, that draft is abandoned. A session in another repo is told to adopt it from a session in the intent's repo.

Your recorded changes stay with the intent until the teammate's session records its own: then the files it now changes replace yours, and files no longer changed in its worktree (renamed, deleted, rewritten as another migration number) drop out; if it works on another branch, your recorded changes are retired once it records its first change. So teammates' briefings show the intent's current work, not paths from before the handoff.

Tried, didn't work

A handoff can carry a short list of what was already tried and didn't work: dead ends, approaches ruled out, commands that failed. The next agent then doesn't spend an hour repeating them. Agents list only what they actually attempted; it's all optional.

Each item is a what and an optional result, or a plain string (the what). Up to 10 items; each text is cut to 300 characters. Newest come first, and an item with the same what (ignoring case and spacing) as an earlier one replaces it.

  • Your agent passes tried to intent_handoff or intent_close:

    JSON
    { "to": "jordan@acme.com", "tried": [{ "what": "Rounding per line before tax", "result": "totals still off by 1 cent" }, "Bumping decimal.js"] }

    While it works, it can also record them on the intent with intent_update tried. Recorded items travel with any later handoff, and with shared tasks released from the intent, also when the release is automatic.

  • The CLI: comity handoff @jordan --tried "Rounding per line before tax => totals still off by 1 cent" (repeatable; without => the whole text is the what).

  • The dashboard: the Tried, didn't work field of Hand off….

The handoff merges its items with the ones recorded on the intent. The handoff message gets a Tried, didn't work section ("- what → result"), the recipient's Handed off to you section lists them right after your note, and intent_adopt's result repeats them: "Tried, didn't work (don't repeat these unless something changed)".

Context pack

A note and a list of dead ends don't tell the next agent what your agent actually did. A context pack does: a short, structured summary of your agent's session, written on your machine when the work changes hands, so the teammate's agent doesn't start blind. It is never the transcript.

JSON
{
  "to": "jordan@acme.com",
  "context": {
    "summary": "PDF layout done. Totals still wrong on discounted lines.",
    "decisions": [{ "what": "Round once per invoice, not per line", "why": "Finance reconciles per invoice" }],
    "files": [
      { "path": "src/invoices/pdf.ts", "action": "edited", "why": "new layout" },
      { "path": "src/invoices/totals.ts", "action": "read", "why": "tax is applied here" }
    ],
    "commands": [{ "command": "pnpm test invoices", "outcome": "failed", "note": "3 failing: rounding" }],
    "open_questions": ["Should credit notes use the same rounding?"],
    "next_steps": ["Fix tax on discounted lines in totals.ts"],
    "links": [{ "url": "https://github.com/acme/app/pull/88", "label": "draft PR" }]
  }
}

Every field is optional. Dead ends don't belong here: they go in tried.

Field Holds Limit
summary Where things stand, in 1–3 sentences 600 characters
decisions {what, why?}: decisions taken and why 8 items; what 200, why 300 characters
files {path, action, why?}: action is read, edited, created or deleted 25 items; path 300, why 200 characters
commands {command, outcome, note?}: outcome is passed, failed or other; the command line, never its output 12 items; command 300, note 200 characters
open_questions Questions still open 5 items of 300 characters
next_steps Concrete next steps 8 items of 300 characters
links {url, label?}: http(s) links only 8 items; url 500, label 100 characters

Longer texts are cut; more items than the limit is an error (400). The whole pack is then trimmed to 6,000 characters, least useful first: files only read, passed commands, links, other files, other commands, decisions, open questions, next steps, and finally the summary is shortened.

Before storing it, Comity redacts private keys, Comity, GitHub, AWS, Slack and Stripe-style keys, JWTs, password=/token=-style values, values of variables named like *_KEY, *_TOKEN, *_SECRET, *_PASSWORD, auth headers, credentials in URLs, and home folders (/Users/ana/… becomes ~/…). The comity handoff CLI redacts the same way before anything leaves your machine. In a metadata_only org, only the file list (path and action) is kept; all free text is dropped.

  • Your agent passes context to intent_handoff or intent_close (outcome handoff). Its result says what went: "Context pack sent to Jordan: …", plus how many values were redacted, how many items were trimmed, and what a metadata-only org dropped.
  • The CLI builds it from the local transcript of the intent's session on your machine (files read and changed, commands and whether they passed), adds --summary and --next, and shows it before you confirm. --no-context sends none. See comity handoff.

The handoff message only names the pack. The pack itself shows in the recipient's Handed off to you section, in intent_adopt's result and in the intent's drawer in the dashboard. Like your note, it is only for the two of you: besides you and the recipient, only whoever owns the intent later (handed on or adopted) and the owner before the handoff (when an admin handed it off) can read it, in the drawer or with history_search; other members don't see it. (A pack left with a shared task release is for the whole org, since anyone may claim the task next.) Packs are encrypted, kept 90 days, then deleted (see Data & deletion). An org owner's org export includes them, as it includes direct messages.

Following up

For details the pack lacks, the recipient's agent asks the sender: ask with to: intent:INT-n on an intent handed to you reaches whoever handed it off (the pack's writer), not yourself. With Ask my agent on, a read-only copy of the session that wrote the pack answers while the sender's machine is online; otherwise their agent answers at its next step.

Making a pack's decision a team decision

A decision in a pack is only for whoever reads the pack. When it should hold for everyone ("round once per invoice, not per line"), click Make team decision next to it in the drawer: it becomes a proposed team decision (source context_pack), and once an owner or admin confirms it, every agent working in the repository gets it in its briefing. The button turns into a link to the new D-n. Owners, admins and members can do this; API: POST /v1/context-packs/:id/decisions/:index/promote.

What happens on your side

Your agents' sessions are released from the intent. The work they recorded so far stays with the intent and goes to the teammate with it. If one of your agents keeps editing the same files, Comity now treats that as overlapping the teammate's intent and reports a conflict.

Until the teammate adopts it, the code is still on your machine, so for conflict detection the intent still counts as yours: conflicts and explanations name you, and the teammate's own work never conflicts with it as "your other session". Once they adopt it, it counts as theirs.

Until then the dashboard's Work tab shows the intent as Handing off (and under the Handing off filter), with what the handoff carries: "From Sam: plan, 3 files, 1 thing tried, 2 left" (whether it has a plan, the files touched, the tried notes, the context pack's next steps). Only these counts are shown to the team, never the note or the pack. The API returns the same as the intent's handoff field.

When the teammate's agent adopts the intent, you get a short message from Comity in the handoff thread: "jordan@acme.com picked up INT-12 "PDF export" in a Claude Code session and continues it." (their name when they have set one). Your agents see it too, in sessions in the intent's repo.

Who can hand off

  • Who hands off: the intent's owner, or an org owner or admin.
  • Who can receive: a member of the org with the role owner, admin or member. Viewers and billing contacts can't own intents.
  • Which intents: live ones (draft, active, blocked, in_review) and expired ones. A handed-off draft stays private: afterwards only the teammate sees it. Closed intents (merged, abandoned) can't be handed off. The dashboard offers Hand off… for declared intents.

Protected paths

If the intent touches a protected path (a claim or a recorded change under its glob) that the teammate doesn't own, adopting it raises a blocking protected_path conflict for them, and only an owner or admin can approve an override. Comity says so when you hand off, not only when they adopt: your agent's intent_handoff result ("Warning: Marina doesn't own protected path src/routes/** (owners: tyler@acme.com), which INT-4 touches (src/routes/refunds.ts); adopting it will be blocked until an owner or admin approves an override."), the handoff message and their Handed off to you section all carry the warning, and the bundle lists the paths under protected_paths. Hand it to an owner instead, or ask an owner or admin to approve the override. A path an earlier override already approved for the intent isn't warned about.

API

Output
POST /v1/intents/:ref/handoff

Scope intents:write. Body {to, note?, tried?, context?}: to is the teammate's email, note up to 2,000 characters, tried up to 10 items ({what, result?} or a string; see Tried, didn't work), context a context pack.

Terminal
curl -X POST https://api.comity.so/v1/intents/INT-12/handoff \
  -H "Authorization: Bearer $COMITY_TOKEN" -H "Content-Type: application/json" \
  -d '{"to": "jordan@acme.com", "note": "PDF layout is done; totals still wrong"}'

Returns {intent, handoff}: the updated intent (now owned by the teammate) and the handoff (id, intent, from, to, note, thread_id, message_id, created_at, adopted_at, and bundle with the snapshot described above; bundle.tried lists {what, result, at} items, newest first, when there are any; bundle.context is the stored pack). When you sent a pack, handoff.context_note says what happened to it. Errors: 400 when the teammate can't own intents, 403 when you are neither the owner nor an admin, 404 for an unknown member, 409 when the intent is closed or they already own it. See the REST API.

Each handoff emits an intent.handed_off event (in webhooks and the audit log) with the repo, intent number, who it went from and to, who did it, the thread, tried (the number of items, when there are any) and context: true when a pack went along; the texts are never in events. Each adoption emits intent.adopted with the repo, intent number, who it came from and who adopted it, the handoff, its thread, and the adopting agent session.

Try Comity now.

Start free →

npm i -g comity-cli && comity login && comity init