# Market Report Compilation

Compile a scheduled farm-area (an agent's chosen local neighborhood territory) market report from public real-estate data and format it for sending to clients.

## When to use

- A recurring monthly or weekly market update is due for a specific farm area (zip code or neighborhood).
- A client asks for the latest comps (comparable sales), inventory, and pricing trends before listing or buying.
- An agent wants a standing report set up to run automatically without manual follow-up.

## Tools

- `browser-search`
- `browser-extract`
- `shell-execute`
- `write-file`
- `send-email`
- `create-schedule`

## Playbook

1. Identify the farm area's boundaries (zip code, subdivision name, or school district) and the reporting period (e.g. trailing 30 days) from the task request.
2. Use `browser-search` to find current public listing and sold-comp pages for the area, for example searches against public portals like `https://www.realtor.com/realestateandhomes-search/<area>` or county assessor sites.
3. Use `browser-extract` on each relevant listing/sold page to pull structured fields: address, list price, sold price, days on market, bed/bath count, and square footage.
4. Use `shell-execute` to run a small aggregation pass over the extracted data — computing median sold price, average days on market, and month-over-month inventory change.
5. Use `write-file` to render the aggregated figures into the client-facing report template (markdown or HTML), including a summary paragraph and a comps table.
6. Review the drafted report for factual consistency (numbers reconcile, no placeholder text left in), since this report contains no legal or financial advice and must stay within public-data commentary only.
7. Use `send-email` to deliver the finished report to the client's saved address, using the agent's approved subject line and signature block.
8. Use `create-schedule` to set (or confirm) the recurring cadence so this playbook re-runs automatically for the next reporting period.
9. If a step requires anything beyond public portal browsing (e.g. private MLS (Multiple Listing Service) credentials), stop and hand off to a human via a message naming the missing access.

## Failure modes

- Public listing pages are paginated, gated, or rendered dynamically, so `browser-extract` returns incomplete or empty comps — fall back to a narrower search query per street or subdivision.
- Aggregation in `shell-execute` divides by a zero count when no comps are found for the period — the report must state "no comparable sales this period" rather than emit a broken statistic.
- The report drifts into pricing or legal advice language (e.g. "you should list at X") — reword to strictly descriptive market commentary and flag for human review before sending.
- `send-email` fails silently on an invalid or missing client address — verify delivery status and retry once before escalating to a human.

## Done when

- The report is written to file via `write-file`, reconciled, and free of placeholder or advisory language.
- The client has received the report by email via `send-email`.
- The recurring `create-schedule` entry is active for the next reporting cycle.