# Agent tools: four tools instead of fifty-five

Decided 8 November 2026 (John, in session). This document records why the MCP surface changed and how the four tools work. The REST API, CLI and generated clients are unchanged by this decision; it concerns what an agent sees over MCP.

Amended 12 November 2026: `check` gains `what: page`, the one stateless page-localisation call. It is an exception to principle 4 and is set out below. The tool count stays at four.

## Why

On 8 November 2026 the hosted MCP (`https://api.threefold.eco/mcp`) was exercised as a coding agent would use it: about 70 calls across every tool. Findings:

| Problem | Measured |
|---|---|
| Too many tools | 55 tools (52 keyless). Their definitions cost about 24,000 tokens of the agent's context before any call; the 10-market and 56-genre enums were repeated in most of them. Mobbin's MCP, the reference for this product shape, has 8, of which 3 search. |
| The model barely saw results | The text block of every result was a one-line summary (`"50 items returned."`); the data was only in `structuredContent`, which not every host passes to the model. |
| Results too large where they did arrive | `chart_history` 1.19 MB, `get_app` 179 KB, `compare_markets` 166 KB, `paid_ads` 70 KB with 180 ads in the whole library. |
| Broken tools | 4 failed output validation on every realistic call (fixed in #60); 6 analysis tools failed without `ANTHROPIC_API_KEY` and blamed the caller; 4 label tools returned 404 while labels are off; 7 operator tools were listed to customers. |
| No guidance | No server `instructions`. |

The tools mirrored the REST API one to one. An agent had to choose among 55 and stitch six calls together to answer one question, which costs more context than one good answer, not less.

## Principles

1. **Tools follow the person's questions, not the API.** Someone taking an app into another market asks three things: how does *this app* show up there, what does *this market* reward, and is *my* thing ready for it. A team adds a fourth: keep track of what we follow.
2. **One call answers the question across Brand, Paid and Organic.** Splitting pillars into separate tools repeats the 55-tool mistake. The value is the joined-up answer.
3. **Size is controlled per answer, not by tool count.** Every result leads with a digest under a hard budget, then offers filters and a cursor to drill down, and a link to see everything in the web app. Raw rows are never dumped into the agent's context, however much data sits behind the answer. This matters most for Paid, which will carry every platform, format, sponsorship and UGC.
4. **We supply evidence and criteria; the user's agent judges.** Threefold labels the market once, at collection time (shared, cheap per item), and runs rule checks (limits, language, counts). Judgement on the user's own material (screenshots, ad drafts, copy, repository) is done by the user's agent against our criteria and reference examples. Their unreleased material never has to leave their machine, nothing needs uploading to the hosted server, no model runs per request on our side, and the answer stays fast. Server-side grading, for consistent scores and audit trails, is an optional enterprise extra, not the default.
   **Exception, 12 Nov 2026:** `check` with `what: page` runs one model call on the server and sends that page's text to the model supplier. The merge that puts the translation back is deterministic code, not the agent's writing. Source code and repository files still never go through it.
5. **Every answer serves the person behind the agent too.** Results carry `threefold.eco` links to the same view in the web app, so the agent does the research and the person can check the evidence visually.
6. **Nothing that cannot work is listed.** Tools whose dependencies are not configured are not offered; operator tools live in the CLI.

## The four tools

| Tool | Question | Replaces |
|---|---|---|
| `app` | How does this app show up across stores, pillars and markets? | get_app, search_apps, search_app_store, screenshot_gallery, listing_history, chart_history, export_history, app_reviews, review_summary, compare_paid, explain_listing_differences, paid_ads/organic_posts by app |
| `market` | What wins in this market and genre, optionally next to an app like mine or my home market? | top_apps, compare_markets, paid_ads, paid_summary, organic_posts, price_points, market_glossary, market_launch_checklist, b2b_market_checklist, market_take, label_profile, label_compare, label_gaps, language_fit |
| `check` | Grade my listing, screenshots, ad, name, website, repository or live app for this market, or localise a page's text (`what: page`, stateless; the one exception to principle 4). `what: store` with `levers: { lever }` returns store conversion drafts and findings (holiday events, local prices, custom product pages, page tests, rating velocity and review replies); see store-levers.md. | market_brief, market_entry_report, market_entry_narrative, listing_check, variant_lint, i18n_check, i18n_check_rules, i18n_report, brand_name_check, translate, visual_brief |
| `workspace` | What do we track, who are our competitors, what changed, what have we saved? | track_app, backfill_app, create/list/delete_watch, watch_events, save_item, list_collections, get_collection, add_note, account_usage |

## Jobs: what a customer asks, and the call

An agent that has never seen threefold starts at `/llms.txt`. Its first section, "Start here", is this table. Task search (`GET /api/discover?q=<the customer's words>`) puts the same call first and names it in `start_with` (`registry/search.mjs`, tested in `test/registry-search.test.mjs`).

| The customer asks | Call |
|---|---|
| Should we launch in country A or B first? | `market` once for each country, with `like` = their app. `focus: "demand"` adds a size estimate |
| How do the top apps present themselves in X? | `market`, `focus: "brand"` |
| What ads do my competitors run in X? | Each named rival: `app`, `focus: "paid"`, `markets: ["X"]` (`workspace` `get` lists the rivals the user set). Every ad in the category, rivals or not: `market`, `focus: "paid"` |
| Is my store page ready for X? | `check`, `what: "app"`, `app` = their app |
| Which creators post about apps like mine in X? | `market`, `focus: "creators"` |
| Set up a rollout for X, and what do I do first? | `workspace`, `action: "project_create"`. The answer's "Next:" line is the first step |
| What changed for my app this week? | `app`, `focus: "changes"` |
| What is in my workspace? Which accounts are connected? | `workspace` `get`, then `connections` |

The library holds data for 10 of the 32 country codes the tools accept: `gb us es mx ar br de fr jp kr`. The other codes work in `check` and in projects. A call for a country with no data says so and names `POST /api/coverage/request`.

Removed from MCP: operator and ingest tools (`run_ingest`, `plan_ingest`, `ingest_cost`, `ingest_status`, `media_archive_status`, `plan_media_archive`: use the CLI), `discover_endpoints` and `describe_endpoint` (the docs, OpenAPI and `llms.txt` cover them), and `request_coverage` (a result that meets a coverage gap says so and how to ask). Server-side narrative tools (`explain_*`, `*_narrative`, `translate`, `visual_brief`, `brand_name_check`) follow principle 4: the agent writes the narrative from the evidence. Their REST routes remain.

The short-text `translate` tool stays off MCP. Page localisation is `check` with `what: page` (below), not a return of `translate`. The REST route for short evidence text is unchanged.

### Result shape (all four)

- **Text block** (what the model reads): a markdown digest, at most about 4,000 tokens. Key facts with numbers, the top few examples, a citation link for every claim (store URL, ad library URL, post URL), the `threefold.eco` link for the person, and how to go deeper (which `focus`, filter or `cursor` to pass next). Coverage gaps are stated in the digest, not hidden.
- **Images**: at most 6 low-resolution previews per result, in the order the digest refers to them.
- **`structuredContent`**: the same answer as typed data, for hosts and programs that read it. It has no `summary`: the digest goes out once, in the text block, so a host that gives the model both does not pay for it twice (P9-1, 19 Nov 2026). REST answers keep `summary`.
- **`_meta`**: cost, balance and data freshness, as before.

### Detail levels (all four)

Added 20 November 2026 (P12-6, `docs/decisions/0014-build-for-smarter-agents.md`). Each tool takes `detail`: `brief`, `standard` (the default) or `full`. An agent with a small budget asks for less. An agent with cheap context gets more in one call. Over REST it is the same argument (`?detail=brief`, or in the POST body), and in the CLI it is a flag: `threefold call agent_app --app Duolingo --detail brief`.

| | `brief` | `standard` | `full` |
|---|---|---|---|
| Choose it when | You need the answer and the top items, for example inside a loop over many apps or markets | You have no reason to choose | Context is cheap and one call must hold the most |
| Rows of one list | The top 3, then "…and N more: ask again with detail: "full"." | The size each section states (4 to 20) | All rows the tool read, at most 50 |
| Quoted text (description excerpt, review, caption) | As standard | 120 to 320 characters | 4 times standard |
| Digest ceiling | 16,000 characters | 16,000 characters | 48,000 characters (about 12,000 tokens) |
| Previews | At most 2 | At most 6 | At most 6 |

Rules that hold at every level:

- **`standard` is the answer as it was before the argument existed, byte for byte.** `test/agent-detail.test.mjs` and the two Postgres files compare no `detail` with `detail: "standard"` for every focus, check target and read action.
- **The level changes no read.** Each query, its limit, the meter and the price are the same. `full` shows what `standard` reads and then cuts. It adds no query, so it cannot be slower at the database.
- **`brief` never drops a warning.** Every Coverage line stays, and so does the line for a failed read ("Could not read … The read failed") and the `unavailable` list. A rule row that did not pass (`FAIL`, `WARN`, `NOT CHECKED`) stays when the table is cut. `coverage`, `next`, `links` and each verdict in the data are the same at each level. When `brief` or `full` must cut a digest at its ceiling, it cuts the body and keeps the Coverage, Go deeper and link lines whole.
- **The hard ceiling of `full`:** a digest of 48,000 characters, 50 rows for one list, 6 previews, and data no larger than the rows `standard` already reads (a page is 20 rows). One call cannot return megabytes.
- **An unknown value is refused** with `invalid_request` (400) and the allowed values in the message (`docs/errors.md`).
- **The data (`structuredContent`)**: a summary list (`topApps`, `topTasks`) follows the level. A paged list (`items`, `apps`) keeps its page of 20 at every level, because the cursor moves a whole page. With `brief`, the digest shows the top 3 of a page; page with `standard` when you need every row.

One module owns the levels: `modules/product/agent/detail.mjs`. A focus module states its standard size (`table(rows, columns, { max: 8 })`, `rows(5)`, `cutLines(lines, 20)`, `chars(140)`) and the level scales it there. No focus module compares `detail` with a level name.

Left out of `full`, because each needs a new or larger read: more than 10 recent reviews, more than 30 paid ads or 10 organic posts in the `app` overview, more than 3 ads and 3 posts in the `market` overview, more than 6 reference screenshots in `check`, a page larger than 20 rows, and more than 6 previews (each preview is a fetch). Use `focus` and `cursor` for those. `check` with `what: page` returns the whole page in the data at every level; `detail` changes only the rows of its digest.

Measured on 20 November 2026 on the seed (`data/snapshot.json`, Postgres), one call per row. Each cell is digest characters (estimated tokens, UTF-8 bytes / 4) / data bytes / previews. The seed holds few ads and posts, so the Paid and Organic lists are short here; the gap between levels grows with the library.

| Call | `brief` | `standard` | `full` |
|---|---|---|---|
| `app` Clash of Clans, overview, 5 markets | 3,381 (854) / 1,097 / 2 | 4,289 (1,088) / 1,097 / 5 | 4,289 (1,088) / 1,097 / 5 |
| `app` Clash of Clans, `focus: brand` | 2,993 (758) / 639 / 0 | 4,478 (1,136) / 639 / 0 | 4,871 (1,233) / 639 / 0 |
| `market` Mexico, education, overview | 3,546 (899) / 3,341 / 2 | 4,180 (1,062) / 4,896 / 2 | 4,423 (1,123) / 5,494 / 2 |
| `market` Mexico, education, `focus: language` | 2,051 (522) / 3,200 / 0 | 2,757 (699) / 3,200 / 0 | 5,459 (1,375) / 4,857 / 0 |
| `check` listing for Mexico (one limit failure, Spain-only terms) | 4,135 (1,040) / 6,593 / 0 | 4,561 (1,146) / 6,593 / 0 | 4,561 (1,146) / 6,593 / 0 |
| `check` repo for Germany (hosted) | 1,923 (482) / 10,517 / 0 | 4,687 (1,178) / 10,517 / 0 | 8,869 (2,234) / 10,517 / 0 |
| `workspace` saved, 8 recipes | 508 (128) / 1,524 / 0 | 923 (231) / 1,524 / 0 | 923 (231) / 1,524 / 0 |
| `workspace` get, empty workspace | 928 (232) / 543 / 0 | 928 (232) / 543 / 0 | 928 (232) / 543 / 0 |

The argument costs about 170 tokens once per session: the tool list is 14,701 characters with it (the test's limit is 16,000).

### `app`

Inputs: `app` (name or id; an ambiguous name returns the candidates), `markets` (optional; default the app's charting markets, capped), `store` (`ios`, `play`; default both when linked), `focus` (`overview` default, `brand`, `paid`, `organic`, `reviews`, `changes`), `platform`, `format`, `since`, `cursor`, `detail`.

Overview: per market, the localised title and subtitle, copy language, rating, chart positions and first screenshot; Paid and Organic totals by platform with the longest-running examples; how the app differs between markets. Each `focus` expands one part with paging.

`focus: "changes"` answers "what changed since `since`" (default: seven days ago), in every country that has a copy of the store page, or in `markets` when given. It compares threefold's copies of each store page (about one a week) and the chart days, and gives one sentence for each country: the sentence the web app shows above "what it changed" ("Strava kept its page in the US the same, 15 Nov to 22 Nov. It fell from #3 to #4 by 22 Nov."), then new description lines and the ratings count. Countries with no change share one line. A country with no copy since that day is listed as "not read", never as "no change". The rules are in `modules/product/agent/app-change-rules.mjs` (BUG-250: a second copy of the web app's rule, held equal by a test).

### `market`

Inputs: `market`, `genre` (plain words, fuzzy matched; a miss returns suggestions), `like` (optional reference app), `vs` (optional home market), `store`, `focus` (`overview` default, `brand`, `paid`, `organic`, `pricing`, `language`, `launch`, `demand`, `gaps`), `platform`, `format`, `cursor`, `detail`.

`focus: "gaps"` (issue 163) answers "what do ads and organic posts in `vs` (default `us`) do that this market's do not?": answers that are at least 30% of the labelled ads that ran 30+ days in `vs` and at most 0% of this market's ads in the same niche (`label_gaps`, `labels.md`). `include` names labels (`creative_format`, `hook_type`, `angle`, `cta_type`, `spoken_dialect`); without it every readable label is checked. Labels are read only after they pass the evaluation, so until then the answer says no labelled ads yet.

Overview: the top apps and how localised they are, which ads run longest, top posts, price points and local vocabulary. With `vs`, what differs from the home market and who crossed over. With `like`, where an app like that fits and what it would need to change. With no `like` and no `vs`, a signed-in caller whose workspace has its own app or competitors gets "you against your competitors" (see `workspace` below). Label findings (formats, styles, offers) appear here once labels are live; until then the digest says they are not available.

`focus: demand` returns directional monthly downloads and revenue as low-to-high ranges for the free chart, with observed counts in a separate table and a badge that says the figures are modelled and uncalibrated until real numbers are supplied (demand-estimator.md). `GET /api/market/demand` returns the same data, and takes `rank` for one chart position.

The market glossary's TBX export writes the locale and niche as text, not XML markup.

### `check`

Inputs: `market`, `what` (`listing`, `screenshots`, `ad`, `name`, `website`, `repo`, `app`, `page`, `preflight`), `url` (for `what: website`), plus the material: listing title, subtitle, keywords, description and promotional text, with optional iOS `iap_display_name` and `iap_description`; `app` (id, for a live app), `name`, `genre`, `from` (home market), `snapshot` (for `what: preflight`: the store state, shape in `docs/store-preflight.md`), and, for `what: page`, the page and its options (below). `detail` works for every `what`. `what: preflight` runs the four technical store checks (purchase localisations, legal URLs, EU trader status, regional metadata) on that snapshot and returns pass and fail items; it fetches only the snapshot's three URLs and writes nothing.

With no `app`, `url` and `listing`, `what: app`, `screenshots`, `aso` and `discovery` use the workspace's own app of a signed-in caller (see `workspace` below).

Returns: the rule checks threefold ran (field limits, language and variant problems, keyword overlap with the market's vocabulary, screenshot counts), the criteria for this market with the numbers behind them, reference examples from the top apps (images and links), and a closing instruction telling the agent what to grade itself. Listing limits include title 30 characters; subtitle 30 on iOS or 80 on Play; promotional text 170; description 4,000; and iOS IAP display name 30 and description 45. The 100-unit keyword field is counted as NFC-normalized Unicode code points, not UTF-8 bytes. The digest reports duplicate warnings and IAP limit failures. `what: app` is the market-entry brief for a live app. `what: repo` returns the market's readiness rules for the agent to apply to the repository it already has open; the local stdio server also runs the scanner over the path given.

Google Play requires at least two screenshots to publish a listing. Formats that recommend apps or games using screenshots need at least four for apps and at least three for games, with Google's size and aspect ratio rules.

`what: website` (added 8 Nov 2026) fetches the given page and the market's language version it links (hreflang; redirects followed, every hop checked as a public address) and checks: hreflang annotations, a version for the market's language or variant, `<html lang>`, the text's language, Spanish variant terms, and the legal pages the market's law requires (Impressum and privacy notice in Germany, mentions légales in France, aviso legal in Spain, the 特定商取引法 notice in Japan), each with its source. It reports currencies and payment methods named on the page without grading them. A page that builds its content in the browser is reported as not checkable rather than failing. Competitors' websites come later (docs/archive/plans/plan-data-everywhere.md, workstream C).

`what: visual` (added 23 Nov 2026, `#171`) opens `url` in headless Chromium in the language of `market` (`de`, `jp`, `kr`, `mx`, `br` or `sa`) at a phone and a desktop width, and returns clipped or overlapping text, failed and fallback fonts, right-to-left faults, amount, date and price formats and leaked English, each with a selector, a cropped screenshot and a structured fix (`structuredContent.visual`; the screenshots are attached images). No model runs. A hosted server answers only when both `THREEFOLD_RUNTIME_VISUAL=on` and `THREEFOLD_RUNTIME_VISUAL_ISOLATED=on` (the browser runs sandboxed in its own limited container; not yet true anywhere, BUG-099), for a caller with an API key or a signed-in account and a public address, one check at a time (a second one at the same moment gets `rate_limited`, 429, "busy") and a few an hour for each account; the local server renders on the caller's machine. All six locales at once: `threefold check --runtime-visual`. See visual-locale-check.md.

Page text is sent to the model supplier, Anthropic today. The local `threefold check` runs on the caller's machine and sends nothing. `what: page` localises one page for one target variant (decided 12 Nov 2026). It takes the page as `html`, `markdown`, a field tree (text, rich text and pass-through fields) or a list of text nodes, with the same options as `POST /api/pages/localise`: `variant`, `market`, `niche`, glossary, protected phrases, `formality` and `slugs`. Its rules are set out in direction.md (page-localisation section).

The structure is copied, not written by the model. Links and their targets, images, video, layout, numbers, currency, dates, placeholders and default slugs come back unchanged. The model translates only the text nodes. A node that fails the structure, placeholder or protected-phrase check keeps its source text and is listed. Variant rules and the market glossary are reported, and legal items stay human review.

The result has a digest within the same budget: counts of nodes translated and kept, the QA verdict, warnings with the matched text, human-review items, the glossary rows used, and how to fetch more. `structuredContent` carries the full merged content and the QA findings. threefold stores nothing and creates no temporary URL. The local stdio server calls the same HTTP route.

`check` is not marked read-only for MCP clients (`readOnlyHint: false`, `idempotentHint: false`), because `what: page` calls a model and each call costs money. An MCP annotation belongs to the tool, not to one call, so a host may ask the person before any `check` call. `app` and `market` are read-only. `POST /api/pages/localise` carries the same annotation.

This is the exception to principle 4. Page text goes to the model supplier. Repository files and source code are not sent: `check` with `what: repo` still returns criteria only, and the local `threefold check` still uploads nothing. Pricing: `PLACEHOLDER`. The call is metered at supplier cost, and no customer price is published.

### `workspace`

Actions: `get` (default: the workspace's apps, competitors per market, target markets, watches, latest digest, saved items, usage), `set_apps`, `set_competitors`, `set_markets`, `watch`, `unwatch` (with apps: follow or stop following those apps; with no apps: turn the country alerts of every active country on or off, see country-alerts.md), `changes` (what changed since the last digest, country alerts included), `save` (a brief or check result, shared with the team), `saved`, and the discovery loop: `discovery_loop_view`, `discovery_loop_run`, `discovery_loop_list`, `discovery_loop_act` (draft, reject, dismiss, reopen, measure; an agent never approves or publishes, see `docs/discovery-loop.md`). `detail` works for every action.

`discovery_loop_list` needs the `read` scope. With `payload.detect: true` it first runs detection, which writes opportunity rows, so that call needs the `track` scope.

`watch` sends the alerts to an e-mail address, a webhook, or both. Pass `email`, `webhook_url` or both, and only those are used. The e-mail must be a valid address. The webhook URL must use HTTPS and point to a public address: the same check that the delivery makes. A Slack or Discord incoming-webhook URL gets that chat's message format. The tool takes no webhook secret, so its webhook payloads are not signed; for a signed webhook use `POST /api/watches`. Without `email` and `webhook_url`, the alerts go to the caller's e-mail, or else to the e-mail of the workspace's owner, an admin or a member. When there is no address, `watch` refuses with a 400 that says to pass `email` or `webhook_url`. This is usual for the stdio server and the default workspace. The tool never makes up an address: nobody reads a made-up address, so its alerts would go nowhere. The answer says where the alerts go. It shows the address only when the caller gave it in the call or it is the caller's own. Otherwise it says "the workspace owner" or "a workspace member", and `structuredContent` has `email_to` in place of `email`: a caller with only an API key does not see another person's address. Watches that already exist do not change.

**Projects.** A project is a rollout into one country. `get` lists the projects with each one's next step. Every project answer has a line "Next: …" (the text the web app shows, from `modules/product/projects/progress.mjs`), and its first "Go deeper" line is the call that does that step. A step that only a signed-in person may do (approve, sign off) has no call and says so.

`payload` has no JSON Schema in the tool list: about 80 project actions take different fields, and their schemas would not fit the 16,000-character budget. Its description gives the shape of `project_create`, and `GET /api/discover/project_<action>` gives the fields of every action. An error names the field that was wrong and the fields that are allowed. Worked examples of the common actions (replace the ids and the revision with those of the last answer):

| Action | Call |
|---|---|
| `project_create` | `workspace({action:"project_create", payload:{name:"Duolingo into France", kind:"app", description:"Launch Duolingo in France", home_market:"us", target_market:"fr", app_id:"570060128", persist_consent:<true, only after the user has agreed that threefold stores this project's material>}})` |
| `project_list` | `workspace({action:"project_list"})` |
| `project_get` | `workspace({action:"project_get", project_id:"<id>"})` |
| `project_update` | `workspace({action:"project_update", project_id:"<id>", payload:{revision:1, category:"health-fitness"}})` |
| `project_research` | `workspace({action:"project_research", project_id:"<id>", payload:{revision:1}})` brings in the app's store pages as sources (app projects) |
| `project_evidence_add` | `workspace({action:"project_evidence_add", project_id:"<id>", payload:{revision:2, title:"Customer interview", url:"https://example.com/notes", pillar:"brand", market:"fr", observed_at:"2026-11-20", rights:"<owned | licensed | reference_only: ask the user>", content:"Shipping takes 3 to 5 days."}})` |
| `project_material_add` | `workspace({action:"project_material_add", project_id:"<id>", payload:{revision:3, kind:"listing", title:"French listing", content:"<text>", evidence_ids:["<source id>"]}})` |
| `project_material_update` | `workspace({action:"project_material_update", project_id:"<id>", resource_id:"<material id>", payload:{revision:4, content:"<new text>"}})` |
| `project_check` | `workspace({action:"project_check", project_id:"<id>", payload:{revision:5}})` |
| `project_review` | `workspace({action:"project_review", project_id:"<id>", resource_id:"<material id>", payload:{revision:6, decision:"request_changes", note:"Shorter title"}})`. `decision:"approve"` needs a signed-in person |
| `project_export` | `workspace({action:"project_export", project_id:"<id>", format:"markdown"})` |
| `project_country_configure` | `workspace({action:"project_country_configure", project_id:"<id>", payload:{revision:7, country:"fr", contract:{budget_ceiling_minor:500000, currency:"EUR", payback_window_days:90, target_criteria:"…", scope:"…", responsibilities:{threefold_executes:[…], customer_approves_or_configures:[…], partner_or_out_of_scope:[…]}, material_ids:["<material id>"], availability_evidence:"…", assessment_evidence:"…", measurement_plan:"…", channel:"apple_ads"}}})` |
| `project_country_readiness` | `workspace({action:"project_country_readiness", project_id:"<id>", payload:{revision:8, country:"fr"}})`. Before a contract exists it answers 404 and names `project_country_configure` |
| `project_delete` | `workspace({action:"project_delete", project_id:"<id>", payload:{revision:9}})` |

The other project actions (pricing, Apple Ads, publication, design, voice, engagement) are documented at `GET /api/discover/project_<action>` and in product-workflows.md: they have no worked example here.

`persist_consent` on `project_create` records that the user agreed that threefold stores the project's material. The server does not create a project unless it is the boolean true, and an agent asks the user first. No example that an agent reads pre-fills it (owners, 24 Nov 2026): `/llms.txt`, the tool and schema descriptions, the registry's examples and the tool answers show `<true, only after the user has agreed that threefold stores this project's material>`, which is not valid JSON, so an example cannot be copied and sent as it is. A call without consent answers 400 with what consent means and the sentence to show the user. Runnable examples are in tests and fixtures only (`test/project-consent-examples.test.mjs`). The tool list has no room for the whole sentence (16,000-character budget): there the field's description says "Ask the user first", and the sentence comes with the 400, the `workspace` answers and `/llms.txt`. The sentence the user agrees to is the web app's consent tick, word for word (`modules/product/projects/create-help.mjs`; a test compares the two): "I choose to store this project, source notes, material, reviews and check history in this workspace until I delete it or its configured retention applies. This is separate from stateless checks. Only add content you have permission to use; review output before publishing."

**Saved.** `save` and `saved` keep tool calls to run again ("saved tool calls"). They are not the web app's "Saved" library items: `get` shows that count on its own line. **Connections.** `connections` lists every connected account. `rollup_connections` and `ad_ops_connections` show the same accounts for store sync and ad operations. An agent cannot connect an account: a signed-in owner or admin does it in the web app.

For an individual this is "this is my app". For a team it is shared memory: the competitor sets, digests and saved briefs everyone opens. Once a signed-in caller's workspace has its own app (`set_apps`) or competitors (`set_competitors`), it is the default context of `market` and `check` (`modules/product/agent/workspace-defaults.mjs`):

- `market` with the overview (the default focus), no `like` and no `vs` answers "you against your competitors". The workspace's app on the requested `store` is the reference app, as if it were given as `like`. The section "You Against Your Competitors" puts each competitor set for this market or for all markets on the chart.
- `check` with no `app` uses the workspace's app on the requested `store` for `what: app`, `screenshots`, `aso` and `discovery`. A call that gives `url` or `listing` does not use it: these are the caller's own subject, and a `url` may be a competitor's site.
- The answer has one line that says that the workspace's app or competitors were used, and `structuredContent.workspace` names them.

The rules:

- An explicit argument wins. A call with `like`, `vs` or `app` gives the same answer as before, and the workspace is not read.
- These calls also give the same answer as before: a workspace with no app and no competitor on that store, the default workspace (the stdio server, `THREEFOLD_AUTH=off`, and the operator key with no workspace header), and a caller with no workspace (keyless).
- When the read of the workspace fails, the answer is the same as before, and `unavailable` lists `your workspace (app and competitors)`. A failed read is never shown as "nothing set up". A `check` that then has no app refuses, and its message says that the read failed.
- Only the caller's own workspace is read.

## Enterprise, outside the tools

The four tools serve individuals and teams alike; the enterprise layer is the account and admin side, most of it built: SSO, audit log, scoped keys, admin-provisioned connectors for Claude, ChatGPT and Grok (`docs/launch/enterprise-connectors.md`), the EU region guard, data export. Still to add: digests by email, Slack or webhook; a feed into the customer's BI; optional server-side grading with consistent scores.

## Context budget

| | Before | After |
|---|---|---|
| Tool definitions | ~24,000 tokens (55 tools) | target under 4,000 tokens (4 tools) |
| Typical result in the model's view | one line (data out of view) or 50 KB to 1.2 MB | digest of at most ~4,000 tokens plus up to 6 previews |
| Calls to answer "how does Duolingo advertise in Germany" | about 6 | 1 |

## Measured after the build (8 November 2026, local server on a copy of production)

| | Value |
|---|---|
| Tool definitions (`tools/list`) | 8,985 bytes, about 2,250 tokens (was 95,296 bytes) |
| Server instructions | 1,266 characters |
| `app` Duolingo, 3 markets | 5,493-character digest, 3 previews |
| `market` Mexico, language learning, like Duolingo, vs US | 5,486 characters, 2 previews |
| `check` listing for Mexico | 3,404 characters; flags Spain-only terms (`móvil`, `vosotros`) with sources |
| `check` repo (hosted) | 4,687 characters: the market's readiness rules for the agent to apply |
| `workspace` get | 1,020 characters |

Every read path of the four tools is covered by `test/agent-tools-postgres.test.mjs`: no error, digest within budget, at most six previews, no `undefined`/`NaN` in the text, output schema respected. Coverage statements ("no ads collected for Mexico", "reviews collected for the United Kingdom only") come from `modules/product/agent/coverage.mjs`, which reads what the library holds, so a missing source is never reported as zero. When a read fails, the answer adds `unavailable: [section names]` and a Coverage line, so an agent can tell "the read failed" from "there is no data". `modules/product/agent/sections.mjs` (`trySection`) does this for every section.

`what: page` has not been measured: no digest size, supplier cost or latency is recorded yet.

Measured on 24 November 2026 (a local server on a copy of the review data), after the descriptions said when to use each tool: `tools/list` is 15,750 characters (13,850 before; the tests' limit stays 16,000, which is the 4,000-token target above), the server instructions are 2,339 characters, and `/llms.txt` is 43,963 bytes (40,697 before; the grader's limit is 50,000). A new input needs room: tighten another description before you add one.
## Local scanner and supplied compliance sync

The local `threefold check` repository scan accepts comma-separated, gitignore-style exclusions against project-relative file paths. Excluded files are removed before platform detection and checks, so excluded domain/generated data cannot contribute evidence or checks:

```sh
node cli/threefold.mjs check . --markets es-MX,de-DE --exclude-paths 'domain/,curriculum/'
```

The scanner reads the selected checkout locally; source files are not uploaded. `--json` emits JSON. `--runtime web --url http://localhost:3000` opts into a local runtime check. `--upload` sends only the report to `POST /api/i18n/reports`; it requires an API key using `THREEFOLD_API_KEY` or `threefold login --key ...` (OAuth MCP login alone cannot upload). Upload errors are included in the report. Verdict `incomplete` exits 1; `complete` and `complete_static` exit 0. `complete_static` means an applicable automated check could not run, not that runtime behavior was verified.

`check` with `what: compliance-sync` accepts supplied source text; it does not fetch or inspect remote manifests, store pages, badge destinations or email systems. Example:

```json
{
  "what": "compliance-sync",
  "compliance": {
    "manifests": {"ios": "...", "privacy": "...", "android": "..."},
    "privacyPage": "...",
    "storeDescription": "...",
    "statutoryDisclosures": "...",
    "storeBadges": ["https://apps.apple.com/app/id123?ct=campaign&pt=partner"],
    "lifecycleEmails": {
      "en-US": {"welcome": "...", "renewal": "..."},
      "es-MX": {"welcome": "...", "renewal": "..."}
    }
  }
}
```

The heuristic checks whether selected manifest permissions/data categories are mentioned in privacy/store copy, flags selected contradictions and subscription-disclosure gaps, validates HTTPS badge URL shape and recognized-store attribution parameters, and checks lifecycle-email event parity across at least two locales. Missing inputs and unknown badge hosts are `unverified`; contextual mismatches are warnings; malformed URLs and email parity data can fail. Verdicts are `fail`, `needs_review`, or `needs_human_review`; none certifies compliance. It cannot establish actual data practices, disclosure sufficiency, legal compliance or human translation quality. Human legal and language review remain required.

## Local search acquisition artifacts

`threefold acquisition generate`, `engines`, and `audit` return JSON and do not submit pages, publish videos, or buy advertising. Generate a standalone calculator with `threefold acquisition generate --type calculator --locale en --output calculator.html`. Practice and assessment generation take `--input questions.json`, for example `{"type":"practice","locale":"en","questions":[{"prompt":"2 + 2?","answer":"4"}]}`. For a non-English locale, or a market whose default locale is non-English, the input JSON must supply all interface labels used by that artifact in `translations` (and may supply a `title`); missing labels are reported as an error. The result marks supplied language and content unverified: human language review is required. Answers are embedded in the downloaded HTML and are not suitable for secure examinations. Comparison generation uses `--type comparison --market de --locale en` for an English interface, and optional `--niche`, `--keyword` and `--intent`: it shows only collected search results, their observation context and evidence links. The intent is supplied, not inferred. Missing search coverage is reported, not fabricated. The search library requires its configured Postgres database.

The input JSON may include `metadata`: `canonicalUrl`, `description`, `robots`, `bingVerification`, and `alternates`, an array of `{"locale":"es-MX","url":"https://example.com/es"}`. Optional `video` supplies `name`, `description`, `thumbnailUrl`, `uploadDate`, and `contentUrl` or `embedUrl`; the artifact emits a VideoObject schema from those supplied facts. Metadata does not upload, verify, submit, or guarantee indexing of a page or video.

`threefold acquisition engines` describes Bing and Cốc Cốc web search and YouTube video discovery, including ownership/account gates and source links. It makes no indexing submission. `threefold acquisition audit --path calculator.html` or `--url https://example.com/` measures Chromium LCP and JavaScript bytes with a cold cache. Both strict gates must pass: LCP below 2,500 ms and JavaScript below 150,000 bytes. The JavaScript budget combines transferred script response bodies with UTF-8 source bytes of browser-observed inline, eval, data, and blob scripts in the page's default execution context. Isolated browser automation and the audit observer are excluded. Frames, service workers, or other workers cause measurement failure rather than silently excluding their scripts. The report declares its viewport, timing and network context; unavailable measurements and failed or blocked requests fail the audit. A local artifact is loaded offline, so its external dependencies cause an incomplete audit; remote requests are intercepted and fetched over DNS-pinned HTTPS, and non-GET requests and WebSockets are blocked. Playwright and its Chromium binary must be installed locally. These measurements are a reproducible lab observation, not a field Core Web Vitals distribution.
