# Cairn > Cairn is a browser extension and web app that records a workflow as you click through it and turns it into a step-by-step guide with screenshots. ## Reading guides - A shared guide lives at https://cairn.profitmas.com/g/. Append `.md` (https://cairn.profitmas.com/g/.md) for the same guide as Markdown. - Guides are private unless their owner turns on a share link. Shared guides are unlisted: please don't index them or show them in search results. Private guides are not reachable without the owner's API key. ## MCP server - Endpoint: https://cairn.profitmas.com/api/mcp (Streamable HTTP, stateless). - Auth: `Authorization: Bearer `. Owners create keys at https://cairn.profitmas.com/dashboard/ai. - Read keys get list_guides, search_guides, list_folders, get_guide, list_versions and export_guide. Read & write keys also get create_guide, update_guide, add_step, update_step, delete_step, reorder_steps and restore_version. - search_guides({ query, folder? }) finds guides by text in the title, description, step instructions or step notes (case-insensitive, matches the text as typed) and returns guide ids plus the matching step ids. Use it to find every guide that mentions a screen or button that changed. - Guides can be filed in folders (the owner makes them on the dashboard). list_guides and search_guides take an optional folder (name or id, or "none"); create_guide takes a folder; update_guide moves a guide with folder_id (null for none). - A key can be limited to one folder. Such a key lists, searches, reads, exports and edits only the guides in that folder; guides it creates go into it; it can't move a guide out of it. list_folders says whether a key is limited. - Every guide has a version history: Cairn saves the guide before each change to its content (a run of small edits gets one version per 10 minutes), for 30 days, up to 50 per guide. restore_version puts a guide back, screenshots included, after saving the current state. - Guides created through MCP are text-only. For screenshots, record (next section). ## Exporting guides as files - `export_guide({ guide_id, format })` returns a guide as a file with screenshots and annotations baked in: `pdf` and `docx` (Word) as a base64 embedded resource, `html` (one self-contained file, images inline) and `md` as text. Markdown links its screenshots with URLs that expire after an hour, and leaves out cropped or blurred ones (the stored image is the raw capture); use `html` for a file that stands alone. `include_screenshots: false` gives a small text-only file. Files over 10 MB are refused. - Signed-in scripts can download the same files over HTTP: `GET https://cairn.profitmas.com/api/recordings//export?format=pdf|docx|html|md` (`&screenshots=0` for text only) with the session as `Authorization: Bearer `. API keys work only on the MCP endpoint. - Every export counts against the owner's plan, under the same rules as exporting from the extension: free accounts get 5 a month with a "Made with Cairn" footer, and Word needs a paid plan. Export once and keep the file. ## Recording a guide with screenshots (for AI agents that drive a browser) An agent can make a real Cairn guide the same way a person does: load the extension in an automated browser, start recording, do the task, stop. Cairn captures every click with a screenshot and a caption. Keep the result local, or publish it and polish it with the MCP tools. The extension exposes `globalThis.cairn` in its service worker: `start({ title, allowOrigins, redact, captureTyping })`, `annotate({ caption, notes, step })` (set the wording of the latest step, or step N), `snap({ caption, notes })` (capture what's on screen without a click), `status()`, `stop()`, `export(recordingId)`, `publish(recordingId)`, and `server()` / `setServer(url)` (which Cairn server to publish to; see below). Only code that controls the browser can reach it; web pages and other extensions can't. ### Use it safely - Use a fresh browser profile kept only for recording. Never load the extension into, or record in, your everyday profile. - Record against a test or staging account with test data, not production data or a personal account. - Pass `allowOrigins` so the recording ignores every site except the app being documented. Both the clicked frame and the tab's page must match. - Prefer `export()`, which keeps everything on your machine. `publish()` uploads screenshots to the Cairn account signed in to that profile; only do it when the owner asks. - Password field values are never captured, but screenshots show whatever is on screen unless you redact it. Don't record secrets or other people's private data. ### Redaction and typing options for `start()` - `redact: { presets, selectors, patterns }` hides sensitive values BEFORE each screenshot is taken, so they never reach storage. `presets`: `"email"`, `"phone"` (broad: also hides other 6-12 digit runs). `selectors`: CSS selectors; matching elements are covered whole. `patterns`: regular expressions as `"source"` or `"/source/flags"` (the `y` flag is ignored); matching text, and form fields whose value or placeholder matches, are covered. Text inside images, canvas, video or closed shadow roots can't be matched: cover those with a selector. Every frame of the tab is masked with opaque blocks, the screenshot is taken, then the masks are removed. Clicks pass through the masks. - Matches are also replaced with `[redacted]` in the step's caption, element text, field value, URL and page title. - Fails closed: if any visible frame can't confirm its masks (it can't be scripted, is busy for more than 4 seconds, or a selector is invalid), if what had to be hidden moved or appeared while the screenshot was taken (it tries once more first), or if the recorded tab isn't the one in front, the step is kept WITHOUT a screenshot and with a note saying why. `snap()` then returns `screenshot: false`. Check `export()`'s `hasScreenshot` per step. - Rules saved in the extension's Settings tab in that profile apply too; `start()`'s rules are added to them. `start()` and `status()` return the effective `redact` and `captureTyping`. An invalid pattern or preset makes `start()` throw. - `captureTyping: true` records a step when a text field's value is committed (on blur, Tab or Enter), captioned 'Type "Acme" in the "Company" field', with the value redacted by the same rules. Off by default. Never for password fields, `autocomplete="cc-*"` or one-time-code fields, or fields matching a redaction selector. - Redaction and typing steps need v1.0.9 or later. ### Get and verify the extension - Latest release: https://cairn.profitmas.com/downloads/cairn-v1.0.9.zip - SHA-256: `db408f3fa29bbb484d182f42583bf70ca3735960884f2dc23fc7eeb8d84211e1` (also at https://cairn.profitmas.com/downloads/cairn-v1.0.9.zip.sha256) - Check the hash before unzipping (`sha256sum` or `shasum -a 256`), and pin a version: each release stays downloadable at its versioned URL, so a reviewed version never changes under you. Vendoring the pinned copy into your repo, approved once by a person, is the most trustworthy setup. - The same extension for people, signed by Google: https://chromewebstore.google.com/detail/pikkdcpdfpcbgmnpjeilidkaefcojiof. Automated browsers can't install from the store, which is why the zip exists. - The API needs v1.0.4 or later; `allowOrigins` and `export()` need v1.0.5; `annotate()` and `snap()` need v1.0.6; uploads to Azure storage need v1.0.7 (check `cairn.version`). ### Example ```js // npm i playwright (extensions need Chromium and a persistent profile) import { chromium } from "playwright"; import { writeFileSync } from "node:fs"; const ext = "/path/to/cairn-extension"; // the verified, unzipped release // A profile used ONLY for recording: never your everyday browser profile. const ctx = await chromium.launchPersistentContext("./cairn-recording-profile", { channel: "chromium", args: ["--disable-extensions-except=" + ext, "--load-extension=" + ext], }); const sw = ctx.serviceWorkers()[0] ?? await ctx.waitForEvent("serviceworker"); const page = await ctx.newPage(); await page.goto("https://staging.example.com"); await sw.evaluate(() => cairn.start({ title: "Invite a teammate", allowOrigins: ["https://staging.example.com"], // ignore clicks on any other site redact: { // hidden BEFORE each screenshot (v1.0.9+) presets: ["email", "phone"], selectors: [".customer-name", "[data-private]"], patterns: ["TAG-\\d{4}", "/acme corp/i"], }, captureTyping: true, // typing becomes steps (off by default) })); await page.click("text=Settings"); await page.waitForTimeout(700); await sw.evaluate(() => cairn.annotate({ caption: "Open Settings" })); // your wording, not the auto caption await page.click("#email"); // click a field before typing in it await page.keyboard.type("pat@example.com"); await page.keyboard.press("Tab"); await page.waitForTimeout(700); // commits: Type "[redacted]" in the "Email" field await page.click("text=Send invite"); await page.waitForTimeout(700); await sw.evaluate(() => cairn.snap({ caption: "The invite appears under Pending" })); // the result, no click const rec = await sw.evaluate(() => cairn.stop()); // { recordingId, title, stepCount } // Default: keep it local. Markdown + PNGs, nothing uploaded, no account needed. const out = await sw.evaluate((id) => cairn.export(id), rec.recordingId); writeFileSync(out.filename, Buffer.from(out.zipBase64, "base64")); // Only if the owner wants it in their Cairn account: // const pub = await sw.evaluate((id) => cairn.publish(id), rec.recordingId); // Re-recording an existing guide? Merge into it, keeping its edits: // const pub = await sw.evaluate(([id, g]) => cairn.publish(id, { guideId: g }), [rec.recordingId, guideId]); // pub.recordingId is the guide id for the MCP tools; pub.url is the owner's link ``` - By default only clicks become steps, so click a field before typing; it becomes a step like 'Click the "Email" field'. With `captureTyping: true`, committing the field's value adds a 'Type "..."' step too. - Wait about 0.7 s between actions: Chrome allows about two screenshots a second. Screenshots are of the visible tab, so keep the page in front (`page.bringToFront()`). - Re-recording a guide after the app changed: `publish(recordingId, { guideId })` merges into the existing guide instead of creating a new one. Matched steps get the new screenshot and keep their edited captions, notes and annotations; new steps are added; steps the recording didn't cover are kept and marked "Needs review" (`get_guide` shows them; clear with `update_step`). The result's `merge` field counts what happened. Needs v1.0.8. - `publish()` needs a Cairn session in that profile: the owner signs in once at https://cairn.profitmas.com/login (it lasts 30 days). Don't ask for their password. ### Which Cairn server - `cairn.server()` returns `{ url, source, locked, defaultUrl }`: where `publish()` sends guides and where sign-in happens. The default is https://cairn.profitmas.com; `source` is "default", "user" or "policy". - `cairn.setServer(url)` points the extension at a self-hosted Cairn server (an origin such as https://cairn.example.com; https is required) and `cairn.setServer(null)` goes back to the default. Each server has its own sign-in, so sign in at /login in that profile before publishing. - For development and tests, a local copy of the site works too: `cairn.setServer("http://localhost:3000")` (plain http is accepted only for localhost, 127.0.0.1 and [::1]). Then sign in to the local site in the automated profile and publish there; nothing reaches https://cairn.profitmas.com. - An organization can set and lock the server with Chrome enterprise policy. When locked, `setServer()` throws; don't try to work around it. - These need v1.0.9 or later. Older extensions don't have them (`typeof cairn.server === "function"` tells you) and always publish to https://cairn.profitmas.com. ## Other pages - [Install the extension](https://cairn.profitmas.com/install) - [Privacy](https://cairn.profitmas.com/privacy) - [Terms](https://cairn.profitmas.com/terms)