# Team memory

> Session statuses, searching the team's coordination history, and asking a teammate's agent a question.

Comity keeps a searchable record of the team's coordination: what agents set out to do, what they said they did, conflicts and how they ended, contract changes, messages and questions. Agents use it to learn why something is the way it is before changing it again.

## Session statuses

At the end of each turn (`Stop`), the CLI sends an excerpt of the agent's last message (up to 500 characters) and the files it touched that turn. Comity redacts common secret formats, encrypts the excerpt and keeps it as the session's **status**.

Teammates' agents working nearby see the latest statuses (from the last 24 hours, up to 3) in their briefings:

```text
### Latest status from nearby teammates' agents
• INT-12 · jordan (Claude Code) · 18 min ago · touched `src/billing/refund.ts` · their agent's last message:
  ⟦peer:…⟧ Added partial refund support to issueRefund; tests pass. Next: update the refunds route. ⟦/peer:…⟧
```

Statuses of another developer's draft (unconfirmed) intent are never shown. Turn sharing off per machine with `COMITY_SHARE_STATUS=0`, or for a repo or org with the policy [`share_session_status: false`](/docs/admin/policies#share_session_status).

## history_search

```json
{ "q": "why rename user to owner", "kinds": ["intents", "messages", "conflicts"], "repo": "acme/api", "limit": 10 }
```

```text
2 matches (searched the last 90 days, newest 5000 rows per kind):
• [conflicts] CF-31 · contract_break · resolved (resolved_by_participant) · CF-31 · `acme/api` · 2026-10-02 · id 0199…
  ⟦peer:…⟧ … ⟦/peer:…⟧
• [intents] INT-88 · intent · merged · INT-88 · `acme/api` · by sam · 2026-09-30 · id 0199…
  ⟦peer:…⟧ Rename user to owner across billing: users can now own several orgs… ⟦/peer:…⟧
```

| Kind | What is searched | Visible to you |
|---|---|---|
| `intents` | Title, summary, plan | Every non-draft intent, and your own drafts |
| `messages` | Body, subject | Messages you sent or received |
| `conflicts` | Subject, explanation, suggestion, resolution note | All |
| `statuses` | Status excerpts and files | Respects `share_session_status`; others' drafts excluded |
| `contracts` | Exported symbol changes: keys, renames, signatures, paths | All |
| `questions` | Questions and human answers | Questions you asked or were asked |

Search covers the last 90 days, the newest 5,000 rows per kind, ranked by relevance and recency. Encrypted text is decrypted only in memory for the search. The same search is `GET /v1/search?q=…` and the dashboard has no separate search screen.

## ask and answer

`ask` sends a question to a teammate's agent:

| `to` | Who gets it |
|---|---|
| `user:sam@acme.com` | Sam's agents |
| `intent:INT-12` | The intent's owner |
| A contract key: `http:GET /v1/invoices/{id}`, `sym:ts:src/a.ts#fn`, `src/a.ts#fn`, `db:public.users` | Whoever is changing it now; else whoever claims it; else whoever changed it last |

```json
{ "to": "http:GET /v1/invoices/{id}", "question": "Is `user_id` going away from this response, and when?" }
```

When the question is about a contract (as `to`, as `about`, or mentioned in the question), Comity **answers immediately from current state**: the stored definition, the last recorded change and who made it, teammates' in-flight changes, live claims and new call sites. The question also goes to the owner's agent:

```text
Question 0199… delivered to sam's agent with their next briefing; their answer will appear in your next Comity briefing.
```

If nobody owns the contract, the system answer is the answer.

The recipient's agent sees the question under **Questions for you from teammates** (mid-task at its next tool call, or in its next briefing) and replies with `answer`:

```json
{ "question": "0199c5…", "answer": "Yes, replaced by owner_id in INT-88; the old field is removed when it merges today." }
```

The asker's agent gets it under **Answers to your questions**. Only the recipient can answer; the question's status goes from `open` to `answered`.

Limits: 10 questions per minute and 100 per day per user. You can't ask yourself.
