# Comparisons

The 4 tools for comparisons. Before an agent first makes one, it reads guide topic compare.

## create_compare

Make a comparison in a space: two to twelve options — products, tools, vendors, plans, candidates — side by side on the same criteria. People see a card for each option (the pick first, with why) and a table with the criteria in rows and the options in columns, the best value in each row marked; they comment on an option or on one value. Give the criteria first (key, label, type, better, highlight), then the options, each with its values by criterion key. Every value comes from a page you read (the product page, a spec sheet, a pricing page, a review) — never from memory; give that page as source. Give null when you looked and did not find it: the table shows "Not found". Read guide topic "compare" first; check it with render_compare.

Parameters:
- `space_id` (string, required)
- `title` (string, required): What is being compared: "Laptops for the design team".
- `subtitle` (string): One line: what these are and how they were chosen.
- `verdict` (string): The bottom line in two or three sentences, from the values.
- `criteria` (object[], required)
- `options` (object[], required)

## read_compare

A comparison as it is now: title, subtitle, verdict, its criteria (by key), its options in order with their ids (what update_compare and comment take) and values, the best option(s) per criterion, and what is missing.

Parameters:
- `item_id` (string, required)

## update_compare

Change a comparison. Any of: title, subtitle, verdict; add_criteria (after the others); change_criteria (by key: the fields you give replace those fields, "" clears one; values must fit a new type); remove_criteria (keys, with their values); order_criteria (every key, in the new order); add_options; change_options (by id: fields replace, "" clears one, values merge — the keys you give replace those values; pick: true moves the pick to it); remove_options (ids); order_options (every id); set_values (one value at a time: option id, criterion key, value — null for not found —, note, source); clear_values (option id, criterion key: back to no value). Applied in that order, all or nothing. Every value comes from a page you read (the product page, a spec sheet, a pricing page, a review) — never from memory; give that page as source. Give null when you looked and did not find it: the table shows "Not found". read_compare first for the ids — people may have changed it.

Parameters:
- `item_id` (string, required)
- `title` (string)
- `subtitle` (string)
- `verdict` (string)
- `add_criteria` (object[])
- `change_criteria` (object[])
- `remove_criteria` (string[])
- `order_criteria` (string[])
- `add_options` (object[])
- `change_options` (object[])
- `remove_options` (string[])
- `order_options` (string[])
- `set_values` (object[])
- `clear_values` (object[])

## render_compare

See a comparison as people do: screenshots of the cards view and of the table (the window widens to show every column), plus checks — values not found or without a source, options without an image or a url, no pick or a pick without why, no highlighted criteria — and errors the page hit.

Parameters:
- `item_id` (string, required)
- `view` (string): Default both.
