# Clients and deals

> How an AI agent works with clients in Klarity: organizations, contacts, the dossier log, pipeline stages and deals, from logging a call to adding a deal.

Use this for client relationships and sales: "who should I follow up with", "log my call with Acme", "add a deal".

## Organizations

- `list_organizations` filters by `search` and `type` (`client`, `vendor`, `partner`, `other`). `get_organization` includes contacts.
- `create_organization` needs a `name`; set `type`, `hourly_rate` and `billing_address` for clients you will bill.
- `update_organization` changes only the fields you send, including time rounding for invoices.

## Dossier

Each client has a dossier: standing state plus an append-only log.
- `list_dossiers` lists client relationships most neglected first, with `needs_attention` and `attention_reason` (never contacted, quiet for 14 days or more, appointment passed). Use it for "who should I reach out to".
- `get_dossier` returns the state, the open items and the log.
- `add_dossier_entry` records what happened, in the user's words. `kind` is `note` (default), `risk`, `decision`, `opportunity` or `nothing_new`. Risks, decisions and opportunities stay open until `resolve_dossier_entry`. An entry resets the staleness clock; `nothing_new` records a check without claiming contact. Use `created_at` for an earlier conversation.
- `update_dossier` overwrites the standing state: what it is about now, the next move, engagement form, slot weekdays, next appointment.

Rule: record contact with `add_dossier_entry`, never by overwriting `update_dossier`. Nothing in the log is deleted; do not summarise or rewrite it.

## Deals

1. `list_pipeline_stages` to get a valid `stage_id`. Stages are per workspace.
2. `create_deal` with `title`, `stage_id`, and optionally `organization_id`, `value`, `probability`, `expected_close_date`, `next_follow_up`.
3. `list_deals` filters by stage and client; `get_deal` reads one.

There is no tool to update or move a deal between stages. Ask the user to move it in the app.

## Pitfalls

- Search before creating an organization; duplicates split time and invoices.
- Risk and opportunity entries belong to one client's dossier, not to summaries across clients.
