---
name: market-watch-app
description: Publish the threefold market-watch dashboard as a Claude artifact that the user installs as a Mac or Windows app. It shows their app and their rivals in each target country, and notifies them when their rank drops, when threefold first sees a rival's store page, or when a rival changes its store page. Use when the user asks for a threefold dashboard, a desktop app, a menu bar item or alerts on their markets.
---

# Market watch app

Follow this workflow to give the user a desktop app that watches their markets. You publish one ready-made page, `dashboard.html`, as a Claude artifact. The user then installs the artifact as an app from Claude Desktop.

## What the user gets

- One strip, "New since you last looked": a card for each alert that the user has not read, until they select "Mark all as read". An alert is the user's own rank falling, a rival's store page seen for the first time, or a rival's store page changing. A fall of the user's own app is the only thing in red. Other moves do not alert: they show on the tracks only.
- One rank track for each country. The track is a line with rank 1 at the left, and its scale fits the ranks up to 100; a rank past 100 sits in a zone at the right end. Each app is a round mark at its chart rank, with the rank above it. The user's app is the filled blue mark. A tail runs from the mark back to the earlier rank. A tag "New page" or "First seen" marks a store page event, in blue until it is read. At the right, how the user's own rank moved. Under the country name: the apps that are not in the chart, not read since a date, with no data, or with only a chart rank and no copy of the store page. The user points at a mark to see the dates of its ranks.
- One notification for the new alerts of a check, one short sentence each, such as "Babbel fell from #71 to #90 in Spain.". A fall alerts once. It alerts again only when the rank falls below the worst rank already alerted. A page change and a "first seen" alert once. If notifications are not allowed yet, the page shows a button "Turn on notifications". A rival that the threefold workspace sets for some countries alerts only in those countries.
- A count of unread changes in the menu bar (macOS) or the system tray (Windows).

The page reads threefold through the tools `app` and `workspace` ([the four tools](https://threefold.eco/docs/agent-tools/)). It checks again every 6 hours while the app is open.

## What the user needs

- A Claude plan on which artifacts can use connectors (Pro, Max, Ultra, Team or Enterprise).
- The threefold connector in their Claude account, at `https://api.threefold.eco/mcp`.
- To install the app: Claude Desktop for Mac or Windows, version 6.28899.0 or later.

## Workflow

### 1. Check the connector

A published page can call only connectors of the user's Claude account. A threefold MCP server that is set up only on this computer (a plugin, `.mcp.json`) is not enough.

If the account has no threefold connector, stop and tell the user to add it: in Claude, open Settings, then Connectors, select "Add custom connector", paste `https://api.threefold.eco/mcp` and sign in to threefold. Continue when they say it is done.

### 2. Take the page as it is

Read `dashboard.html` from this skill's folder. If you cannot read local files, download the raw bytes to a local file, then publish that file:

```sh
curl -fsS -o dashboard.html https://threefold.eco/skills/market-watch-app/dashboard.html
```

Do not use a fetch tool that turns a page into text or a summary: it drops the page's script and style. Before you publish, check the file:

- Its first line is `<!doctype html>`, and its last line is `</html>`.
- It contains `<title>threefold</title>`.
- It contains the two marker comments of the adapter: `CLAUDE RUNTIME ADAPTER` and `end of the adapter`.

If a check fails, or a tool gave you text that is not the raw file, stop and tell the user. Never rebuild the page from a summary.

Publish that file whole. Do not rewrite its design, its text or its logic.

### 3. Check the adapter against your current runtime contract

The page talks to Claude in one marked block, "CLAUDE RUNTIME ADAPTER", and nowhere else. The adapter is written from runtime contract 0.2.99, fetched on 25 Nov 2026. It ran inside Claude Desktop 7.37095.0 on contract 0.2.99 on 25 Nov 2026: connector reads, the install button, the two permission dialogs, per-person storage, a notification and the count in the menu bar were seen to work. Load your guidance on runtime capabilities for published artifacts and read the contract version it serves. If it is 0.2.99, publish the block as it is. If your session serves a newer contract, compare each function below with its type definitions, change only this block, and tell the user which functions you changed.

| Function | What it must do |
|---|---|
| `callTool(name, args)` | `mcp.callTool(server, name, args)`, with `server` found by `listTools()` (the connector listing `app` and `workspace`; `threefold` first). Return `{structuredContent, content, isError}`. A rejection with code `tool_error` becomes `isError: true` with `e.result.content`. Throw `no_runtime` when `window.claude` is missing, `use("mcp")` is null, or the code is `capability_disabled`. Throw `no_connector` for `server_not_connected`, `not_in_manifest`, `needs_reauth`, `not_granted`, `approval_required` and the like, with Claude's code in `e.reason`. |
| `notify(text)` | In the installed app: `desktop.notification.show` with the body `text`, cut to 300 characters, when `desktop.permissions.state("notifications")` is `"granted"`; `"ask"` for `"prompt"` or `"denied"`. Elsewhere: web Notification, titled "threefold". Never asks. |
| `notificationState()` | `"on"`, `"ask"` or `"off"`, without asking. The page reads it after each check and shows "Turn on notifications" for `"ask"`. |
| `allowNotifications()` | From a click: `desktop.permissions.request(["notifications","menu-bar"])`, or `manage()` after a "Don't allow". Elsewhere: `Notification.requestPermission()`. When it resolves true, the page sends one confirmation notification at once. |
| `setMenuBar(text)` | `desktop.tray.set` with an icon, a title, a tooltip and a `menu` with one item, "Open threefold", whose click calls `window.show()`, when `"menu-bar"` is granted; `app.dock.setBadge(text)`; and the window title. |
| `useHeaderAsTitleBar()` | Once while the page loads, only when `desktop.window` exists: `window.setOptions` with one constant object, `titleBarStyle: "hiddenInset"`, `dragHeight: 12`, `backgroundColor: "#ffffff"`, and no size. Catch a rejection. Resolve true only when `applied` is `"now"` and `os.platform()` is not `"win32"`; the page then leaves room for the window buttons and makes its header drag the window. |
| `installState()`, `requestInstall()` | `desktop.install.state()` and `request()`, straight from a click. The page shows "Install as app" when the state is `"available"`. |
| `loadState(key, fallback, {fresh, merge})`, `saveState` | Memory Map, then db documents `data/users/<user.id()>/<key>` as `{value}`, then localStorage. `fresh` reads the db and localStorage again; `merge` joins their copies. `saveState` writes memory and localStorage before its first await. |

When the user's own Settings are saved, the page does not call `workspace` at all: Claude may ask before each `workspace` call, because the tool is not read-only.

### 4. Publish

Publish the page as an artifact named "threefold" with `capabilities: {mcp: {servers: [{server: "<the segment of your threefold tools, e.g. claude_ai_threefold>", tools: ["app", "workspace"]}]}, desktop: {}, db: {}, user: {}}`. Keep the tag `<script type="application/json" id="claude-artifacts-manifest">{"permissions": ["notifications", "menu-bar"]}</script>`. The publish result names the connector's display name. The page finds it by itself, so do not edit the page for it. The installed app takes its name, "threefold", from the page's `<title>`.

### 5. Test once

Open the artifact and allow the threefold connector when Claude asks. A correct page shows a rank track for each country, or a notice that asks the user to name their app.

- "Connect threefold to Claude": the connector is missing or was declined. Go back to step 1.
- "Claude did not pass the data part of threefold's answer": `callTool` returns only the text of the result. Change it to return `structuredContent` too, then publish again.
- Settings are lost when the user closes the app: the artifact was published without `db: {}` and `user: {}` (step 4), so only `localStorage` keeps them.

### 6. Tell the user how to install it

1. Open the artifact in Claude Desktop and select "Install as app" in the page, or in the artifact's title menu. The app is called "threefold". On a Mac its window is white, with no grey title bar: the page's header holds the window buttons and drags the window. The window can reload once when it first takes this look.
2. In the app, select "Turn on notifications" and allow Notifications and the Menu bar item (on Windows, the tray icon). The page then sends one notification: "Notifications are on. Changes in your markets will show here.". On a Mac, the first notification of an app brings macOS's own banner, '"threefold" Notifications', in its place: select Options, then Allow, on that banner. Until then, a notification can go to Notification Centre with no banner.
3. On a Mac, closing the window of an app with a menu bar item only hides it, and the page keeps running. To bring the window back, open the app's tile in the Dock or Launchpad, or pick "Open threefold" from the item's menu. On 25 Nov 2026 a press on the item, which then had no menu, did not bring a closed window back; with the menu, a pick did (seen on John's Mac, 19:02 to 19:04). If the Mac has a menu bar manager, the item can be behind its arrow. With a Focus mode on, notifications go to Notification Centre without a banner.
4. Claude asks again after each new version of the artifact.

### 7. Say what it watches

A signed-in connector reads the user's threefold workspace: their app, their rivals and their target countries. If the workspace has no app, offer to set it:

```json
{ "action": "set_apps", "apps": ["<the user's app>"] }
```

```json
{ "action": "set_competitors", "apps": ["<rival-1>", "<rival-2>"] }
```

```json
{ "action": "set_markets", "markets": ["<country>", "<country>"], "home": "<home country>" }
```

The user can also select "Settings" in the app and type an app, up to 5 rivals and the countries. That choice wins over the workspace. It lasts for the session, and for later sessions only if the adapter's store keeps it.

## Limits to tell the user

- **Each person publishes their own copy.** Claude runs connector calls only for the person who published an artifact, or for people in their organisation. A link to this artifact shows anyone else the page without data. Give other people this skill, not the link.
- **Countries.** threefold holds chart data for 10 countries: `gb us es mx ar br de fr jp kr`. The track of another country says "threefold holds no chart data here yet".
- **How fresh.** Chart ranks are read about once a day and store pages about once a week. Each mark shows the date that threefold gives for its rank when the user points at it. "Not read since <date>" under a country means threefold has no new copy: it does not mean "no change".
- **"First seen" is not a launch date.** It is the day threefold first saved a copy of the rival's store page in that country.
- **Reads.** One check is one `workspace` read and one `app` read for each watched app, at most 7 calls. If a call returns HTTP 402 or the codes `insufficient_balance` or `plan_limit`, the page shows one notice, makes no more calls and stops its 6-hour checks until the user selects "Check now".
- **The app must be open.** It checks while its window or its menu bar item is open. For alerts by e-mail or webhook when it is closed, set a watch with `workspace` and `action: "watch"`.
- **Two copies can run.** An artifact opened in Claude's main window keeps running there after the user goes to another screen, beside the installed app. Both copies share the saved state, and the page checks it just before each notification, so one alert gives one notification. Each copy still makes its own reads.
