Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
docs(web): add Cap for Agents documentation
Richie McIlroy7f44442d0ff5
diff --git a/apps/web/__tests__/unit/agent-docs.test.ts b/apps/web/__tests__/unit/agent-docs.test.tsnew file mode 100644index 000000000..507185af4--- /dev/null+++ b/apps/web/__tests__/unit/agent-docs.test.ts@@ -0,0 +1,318 @@+import fs from "node:fs";+import path from "node:path";+import { compileMDX } from "next-mdx-remote/rsc";+import * as React from "react";+import { renderToStaticMarkup } from "react-dom/server";+import { afterEach, describe, expect, it, vi } from "vitest";+import { getDocBySlug, getDocSearchIndex } from "@/utils/docs";+import {+ CAP_AGENT_PROMPT,+ CopyablePrompt,+ copyAgentPrompt,+} from "../../app/(docs)/docs/_components/CopyablePrompt";+import { docsConfig } from "../../app/(docs)/docs/docs-config";++const agentSlugs = [+ "agents",+ "agents/setup",+ "agents/workflows",+ "agents/safety",+];+const teamSlugs = ["teams", "teams/google-drive", "migrating-to-cap"];+const correctedReferenceSlugs = [+ "installation",+ "quickstart",+ "recording/instant-mode",+ "recording/keyboard-shortcuts",+ "recording/studio-mode",+ "sharing/share-a-cap",+ "sharing/comments",+ "sharing/analytics",+ "sharing/embeds",+ "s3-config",+ "s3-config/aws-s3",+ "s3-config/cloudflare-r2",+ "api/rest-api",+ "api/webhooks",+];++describe("Cap for Agents docs", () => {+ afterEach(() => vi.unstubAllGlobals());++ it("keeps the complete section prominent in the sidebar and search", () => {+ const group = docsConfig.sidebar.find(+ (section) => section.title === "Cap for Agents",+ );+ expect(group?.items.map((item) => item.slug)).toEqual(agentSlugs);+ expect(docsConfig.sidebar[1]?.title).toBe("Cap for Agents");++ const searchEntries = getDocSearchIndex(docsConfig.sidebar).filter(+ (entry) => entry.group === "Cap for Agents",+ );+ expect(searchEntries.map((entry) => entry.slug).sort()).toEqual(+ [...agentSlugs].sort(),+ );+ });++ it("compiles every agent page as MDX", async () => {+ for (const slug of agentSlugs) {+ const doc = getDocBySlug(slug);+ expect(doc, `missing ${slug}`).toBeDefined();+ expect(doc?.metadata.title).toBeTruthy();+ expect(doc?.metadata.summary).toBeTruthy();+ await expect(+ compileMDX({+ source: doc?.content ?? "",+ components: { CopyablePrompt: () => null },+ }),+ ).resolves.toBeDefined();+ }+ });++ it("keeps the team, storage, and migration guides together", () => {+ const group = docsConfig.sidebar.find(+ (section) => section.title === "Teams & Migration",+ );+ expect(group?.items.map((item) => item.slug)).toEqual(teamSlugs);++ const searchEntries = getDocSearchIndex(docsConfig.sidebar).filter(+ (entry) => entry.group === "Teams & Migration",+ );+ expect(searchEntries.map((entry) => entry.slug).sort()).toEqual(+ [...teamSlugs].sort(),+ );+ });++ it("compiles the team, Google Drive, and migration guides", async () => {+ for (const slug of teamSlugs) {+ const doc = getDocBySlug(slug);+ expect(doc, `missing ${slug}`).toBeDefined();+ expect(doc?.metadata.title).toBeTruthy();+ expect(doc?.metadata.summary).toBeTruthy();+ await expect(+ compileMDX({ source: doc?.content ?? "" }),+ ).resolves.toBeDefined();+ }+ });++ it("documents the implemented storage and migration boundaries", () => {+ const drive = getDocBySlug("teams/google-drive")?.content ?? "";+ expect(drive).toContain("New uploads use the connected Google Drive");+ expect(drive).toContain("does not copy existing Caps into Drive");+ expect(drive).toContain("organization manages storage");++ const migration = getDocBySlug("migrating-to-cap")?.content ?? "";+ expect(migration).toContain("no more than 500 data rows");+ expect(migration).toContain("one Cap space label");+ expect(migration).toContain("cap jobs wait <operation-id> --json");+ expect(migration).toContain("hundreds of users");+ expect(migration).toContain("tens of thousands of recordings");++ const workflows = getDocBySlug("agents/workflows")?.content ?? "";+ expect(workflows).toContain(+ "cap caps import loom <loom-url> --organization <organization-id> --owner-email <email> --space <space-name>",+ );+ expect(workflows).not.toContain(+ "cap caps import loom <loom-url> --organization <organization-id> --owner-email <email> --space <space-id>",+ );+ });++ it("compiles every corrected product reference page", async () => {+ for (const slug of correctedReferenceSlugs) {+ const doc = getDocBySlug(slug);+ expect(doc, `missing ${slug}`).toBeDefined();+ await expect(+ compileMDX({ source: doc?.content ?? "" }),+ ).resolves.toBeDefined();+ }+ });++ it("does not repeat removed shortcut, analytics, embed, or webhook claims", () => {+ const shortcuts =+ getDocBySlug("recording/keyboard-shortcuts")?.content ?? "";+ expect(shortcuts).toContain("shortcut store starts empty");+ expect(shortcuts).not.toContain("Cmd + Shift + 2");++ const analytics = getDocBySlug("sharing/analytics")?.content ?? "";+ expect(analytics).toContain("distinct analytics session identifiers");+ expect(analytics).not.toContain(+ "Refreshing the page and watching again counts as an additional view",+ );++ const embeds = getDocBySlug("sharing/embeds")?.content ?? "";+ expect(embeds).toContain(+ "does not provide a documented autoplay guarantee",+ );++ const webhooks = getDocBySlug("api/webhooks")?.content ?? "";+ expect(webhooks).toContain(+ "does not currently expose a documented public webhook subscription API",+ );+ });++ it("documents the current Studio editor feature surface", () => {+ const studio = getDocBySlug("recording/studio-mode")?.content ?? "";+ for (const marker of [+ "Click to generate zoom segments",+ "Manual zooms do not require click metadata",+ "Split Screen",+ "Sensitive",+ "Highlight",+ "They do not automatically follow",+ "multiple text lanes",+ "Export with Subtitles",+ "WebVTT (VTT)",+ "Generate and edit captions",+ "Show recorded keyboard input",+ "Add music and other audio",+ "higher-quality SVG artwork",+ "Cursor-only MOV",+ ]) {+ expect(studio).toContain(marker);+ }+ expect(studio).toContain("Imported MP4s");+ expect(studio).toContain("does not contain the required cursor metadata");+ expect(studio).toContain("Scene track is unavailable");+ });++ it("keeps internal links from the reviewed pages resolvable", () => {+ for (const sourceSlug of [+ ...agentSlugs,+ ...teamSlugs,+ ...correctedReferenceSlugs,+ ]) {+ const content = getDocBySlug(sourceSlug)?.content ?? "";+ for (const match of content.matchAll(+ /\]\(\/docs\/([^#)\s]+)(?:#[^)]+)?\)/g,+ )) {+ const targetSlug = match[1];+ if (!targetSlug) continue;+ expect(+ getDocBySlug(targetSlug),+ `${sourceSlug} links to missing ${targetSlug}`,+ ).toBeDefined();+ }+ }+ });++ it("ships an agent-safe copyable prompt and current contract markers", () => {+ const overview = getDocBySlug("agents")?.content ?? "";+ expect(overview).toContain("<CopyablePrompt />");+ expect(overview.indexOf("<CopyablePrompt />")).toBeLessThan(+ overview.indexOf("## The fastest way to start"),+ );+ for (const marker of [+ "curl -fsSL https://cap.so/install-cli.sh | sh",+ "irm https://cap.so/install-cli.ps1 | iex",+ "cap guide --json",+ "cap auth login --json",+ "--component all --dry-run --json",+ "full Cap skill",+ "cap mcp serve",+ "cap doctor --json",+ "cap record start",+ "cap caps context",+ "cap caps transcript",+ "cap caps download",+ "cap screenshot",+ "cap recordings",+ "cap project",+ "cap automations",+ "Treat every command listed by cap guide --json as supported",+ "explicit confirmation",+ "cap jobs wait",+ "Clearly separate what you verified",+ ]) {+ expect(CAP_AGENT_PROMPT).toContain(marker);+ }+ expect(CAP_AGENT_PROMPT).not.toContain(+ "If it does not, stop and direct me",+ );++ const setup = getDocBySlug("agents/setup")?.content ?? "";+ expect(setup).toContain("<CopyablePrompt />");+ for (const target of ["codex", "claude", "cursor"]) {+ expect(setup).toContain(`--target ${target}`);+ }+ expect(setup).toContain('"command": ["cap", "mcp", "serve"]');++ const safety = getDocBySlug("agents/safety")?.content ?? "";+ expect(safety).toContain("structured `code` and `message` fields");+ });++ it("renders a prominent one-prompt setup action", () => {+ vi.stubGlobal("React", React);+ const markup = renderToStaticMarkup(React.createElement(CopyablePrompt));+ expect(markup).toContain("Make Cap Your Agent’s Video Assistant");+ expect(markup).toContain("Copy Agent Setup Prompt");+ expect(markup).toContain("Installs the Cap CLI");+ expect(markup).toContain("Adds the full Cap skill");+ expect(markup).toContain("Connects local MCP");+ expect(markup).toContain('aria-live="polite"');+ });++ it("exposes the agent section to machine readers", () => {+ const llms = fs.readFileSync(+ path.join(process.cwd(), "public/llms.txt"),+ "utf8",+ );+ expect(llms).toContain("https://cap.so/docs/agents");+ expect(llms).toContain("run `cap guide --json`");+ expect(llms).toContain("explicit confirmation before every mutation");+ expect(llms).toContain("https://cap.so/docs/teams/google-drive");+ expect(llms).toContain("https://cap.so/docs/migrating-to-cap");+ expect(llms).toContain("up to 500 rows per self-serve batch");+ });++ it("keeps the reviewed documentation free of em dashes", () => {+ const emDash = String.fromCodePoint(0x2014);+ for (const slug of [+ ...agentSlugs,+ ...teamSlugs,+ ...correctedReferenceSlugs,+ ]) {+ expect(+ getDocBySlug(slug)?.content ?? "",+ `${slug} contains an em dash`,+ ).not.toContain(emDash);+ }++ const llms = fs.readFileSync(+ path.join(process.cwd(), "public/llms.txt"),+ "utf8",+ );+ expect(llms).not.toContain(emDash);+ });++ it("copies the complete prompt and preserves a manual fallback", async () => {+ const textArea = {+ focus: vi.fn(),+ select: vi.fn(),+ setSelectionRange: vi.fn(),+ } as unknown as HTMLTextAreaElement;+ const execCommand = vi.fn(() => true);+ const writeText = vi.fn(() => Promise.resolve());+ vi.stubGlobal("document", { execCommand });+ vi.stubGlobal("navigator", { clipboard: { writeText } });++ await expect(copyAgentPrompt(textArea)).resolves.toBe(true);+ expect(textArea.focus).toHaveBeenCalledOnce();+ expect(textArea.select).toHaveBeenCalledOnce();+ expect(textArea.setSelectionRange).toHaveBeenCalledWith(+ 0,+ CAP_AGENT_PROMPT.length,+ );+ expect(writeText).not.toHaveBeenCalled();++ execCommand.mockReturnValue(false);+ await expect(copyAgentPrompt(textArea)).resolves.toBe(true);+ expect(writeText).toHaveBeenCalledWith(CAP_AGENT_PROMPT);++ vi.stubGlobal("navigator", {+ clipboard: {+ writeText: vi.fn(() => Promise.reject(new Error("denied"))),+ },+ });+ await expect(copyAgentPrompt(textArea)).resolves.toBe(false);+ });+});diff --git a/apps/web/content/docs/agents.mdx b/apps/web/content/docs/agents.mdxnew file mode 100644index 000000000..b9941a016--- /dev/null+++ b/apps/web/content/docs/agents.mdx@@ -0,0 +1,84 @@+---+title: "Cap for Agents"+summary: "Record, understand, share, and manage Cap through Codex, Claude Code, OpenCode, Cursor, or any shell-capable agent"+tags: "Agents"+---++Cap can be used end to end from an AI agent. Your agent can record your screen, upload and share recordings, read transcripts and AI summaries, search your library, collaborate in comments, inspect analytics, organize team content, and manage advanced Cap features without depending on the dashboard.++<CopyablePrompt />++## The fastest way to start++1. Select **Copy Agent Setup Prompt** above.+2. Paste it into Codex, Claude Code, Cursor, OpenCode, or another agent that can run shell commands.+3. Review the exact CLI and agent-configuration changes it proposes, then approve them.+4. Complete the focused Cap browser login when prompted and tell the agent what you want to do.++The prompt handles CLI discovery or installation, least-privilege authentication, the full Cap skill, local MCP configuration, and setup verification. It then teaches the agent to use Cap as an ongoing recording, video-understanding, collaboration, and organization helper. If you prefer to configure each piece yourself, follow [Set Up Your Agent](/docs/agents/setup).++## What your agent can do++| Goal | Examples |+| --- | --- |+| Understand recordings | Read the title, AI title, summary, chapters, transcript, comments, reactions, views, sharing state, permissions, and processing state |+| Find information | Search all, owned, or shared Caps; filter by organization or folder; inspect notifications |+| Collaborate | Draft and, after confirmation, post timestamped comments, replies, reactions, title changes, and visibility changes |+| Record and share | Check capture readiness, select a screen or window, record, validate, export, upload, and return the share link |+| Manage a library | Create and organize folders and spaces, move Caps, manage public collection pages, and download recordings or transcripts |+| Run a team | Inspect members, invites, billing, storage, analytics, domains, and settings; perform confirmed admin changes |+| Migrate and build | Run durable Loom imports, wait for jobs, and manage Cap developer apps, videos, domains, usage, and credits |++See [Agent Workflows](/docs/agents/workflows) for ready-to-use scenarios and success checks.++## How agents connect to Cap++### Direct CLI++This is the universal path. Any agent that can run terminal commands can use Cap. Every command supports machine-readable output through `--json`, while recording and export stream newline-delimited JSON events.++The installed binary is self-describing:++```sh+cap guide --json+cap <command> --help+```++Agents should discover the current contract from those commands instead of guessing flags or relying on a copied command list.++### Cap skill++The Cap skill teaches a compatible agent when to reach for Cap and how to handle confirmation, secrets, passwords, and long-running jobs. It deliberately delegates command details to `cap guide --json`, so the instructions stay aligned with the installed version.++### Local MCP++`cap mcp serve` exposes structured Cap tools over local stdio. MCP works well for library reads, safe writes, resources, and browser handoffs. Secure input and local file actions intentionally stay in the CLI.++[Set up your agent](/docs/agents/setup) covers Codex, Claude Code, OpenCode, Cursor, and generic MCP clients.++## Why this is safe to hand to an agent++Cap's agent surface is designed around explicit boundaries:++- Read operations and waits do not start AI, transcription, or paid processing.+- Mutations require the agent to show the proposed action and get your confirmation.+- Passwords, storage credentials, API keys, image files, and newly issued developer credentials stay out of MCP and chat.+- Browser approval uses a focused Cap or provider handoff; the agent re-reads state afterward.+- Durable operations return an operation ID, and the agent waits for the terminal state instead of treating “accepted” as success.+- Permissions remain server-enforced. Installing an integration does not grant it access to your Cap account.++Read [Safety & Troubleshooting](/docs/agents/safety) before giving an agent administrative, billing, storage, developer, or destructive work.++## Your first task++Try one of these after setup:++- “Summarize this Cap, list every decision and action item, and cite the relevant timestamps: `<Cap URL>`.”+- “Find my Caps about onboarding from the last month and give me a concise project brief.”+- “Record a short reproduction of this bug, upload it, and give me the link. Ask before recording and before uploading.”+- “Show me this month's organization analytics and explain the biggest changes. Do not modify anything.”+- “Draft a timestamped reply to this comment, show it to me, and only post it after I approve.”+- “Inspect our organization storage and propose a Google Drive rollout. Do not connect or change anything yet.”+- “Audit this Loom migration CSV, propose owner and space mappings, and do not import anything until I approve the first batch.”++The dedicated [Google Drive](/docs/teams/google-drive) and [Migrating to Cap](/docs/migrating-to-cap) guides include the full boundaries and copyable agent prompts.diff --git a/apps/web/content/docs/agents/safety.mdx b/apps/web/content/docs/agents/safety.mdxnew file mode 100644index 000000000..d3937db32--- /dev/null+++ b/apps/web/content/docs/agents/safety.mdx@@ -0,0 +1,145 @@+---+title: "Safety & Troubleshooting"+summary: "The confirmation, secret-handling, permission, and verification rules for Cap agents"+tags: "Agents"+---++> **Agent-readable page:** Treat every rule here as part of the task. If a requested action conflicts with these boundaries, stop and ask the user instead of finding a workaround.++## Read first, then propose changes++An agent should begin with `cap guide --json`, current state, and the narrowest relevant read command. Reads and waits do not need confirmation. Everything that changes state does.++Before a mutation, the agent must show:++- the exact Cap, organization, folder, space, member, developer app, or file involved;+- the current state when it can be read;+- the exact proposed new state or content;+- whether the action uploads data, starts paid work, opens a provider handoff, or is destructive;+- how success will be verified.++Only after explicit approval may it pass `--yes` to the CLI or `confirmed=true` to MCP.++## Actions that require confirmation++| Category | Examples |+| --- | --- |+| Content | Post or delete a comment, reply, or reaction; replace a transcript; change a title |+| Processing | Start or retry transcription, AI generation, imports, duplication, or another paid or durable job |+| Recording and upload | Begin screen, camera, microphone, or system-audio capture; upload local content |+| Sharing | Change visibility, passwords, public pages, locations, domains, or access |+| Library | Create, rename, move, or delete Caps, folders, and spaces |+| Organization | Invite or remove members, change roles or seats, update settings or storage, delete an organization |+| Billing and developer | Create checkout links, change auto top-up, issue or rotate credentials, delete videos or apps |+| Account | Change profile data or sign out all devices and agent sessions |++Confirmation applies even when a command does not have a `--yes` flag. The agent obtains approval before running it.++## Keep secrets out of chat and MCP++Never ask the user to paste any of these into an agent conversation or MCP tool call:++- Cap passwords;+- `CAP_AGENT_TOKEN`, `CAP_API_KEY`, or another API key;+- S3 access keys or secret keys;+- newly issued developer credentials;+- sensitive image or local credential files.++Use the exact secure CLI flow instead. Password and S3 commands accept hidden interactive input or stdin where supported. MCP intentionally does not expose those secret fields.++For a password-protected Cap, the agent should ask the user to run:++```sh+cap caps unlock <id-or-url>+```++The short-lived unlock grant can then be used by subsequent Cap commands without putting the password into chat, arguments, JSON, or logs.++## Use the least-privileged login++Start with the default `creator` profile. Use `admin` only for organization, member, billing, or storage work. Use `full` only for developer tasks that require developer scopes.++```sh+cap auth login --json+cap auth login --profile admin --json+cap auth login --profile full --json+```++Installing a skill or MCP server does not authenticate it or increase its server-side permissions.++## Distinguish observation from paid work++These commands observe existing state and never start processing:++```sh+cap caps context <id-or-url> --json+cap caps status <id-or-url> --json+cap caps wait <id-or-url> --for all --json+cap jobs get <operation-id> --json+cap jobs wait <operation-id> --json+```++Commands such as `cap caps process`, Loom import, duplication, and some developer or billing operations change state and require confirmation.++## Wait for terminal results++An accepted, pending, processing, or queued response is not completion. Preserve the returned operation ID, run `cap jobs wait <operation-id> --json`, and inspect the terminal result. Re-read the affected resource when practical.++For recording, require the stopped event to report `recordingMetaExists: true`, then run `cap project validate` before export or upload.++## Treat JSON and exit codes correctly++- Use `--json` for machine-readable stdout.+- Treat stdout as the authoritative result and stderr as diagnostics.+- Recording and export emit newline-delimited JSON events, not one JSON document.+- Exit code `1` is a runtime failure; inspect the JSON `error` field or the structured `code` and `message` fields returned by Cap's account API.+- Exit code `2` is invalid command usage; inspect `cap <command> --help` instead of retrying guessed flags.+- Diagnostic commands may exit successfully while reporting an unavailable capability. Branch on fields such as `ok`, `captureReady`, or `valid`.++## Browser handoffs++CLI login, Stripe checkout and billing portal flows, Google Drive authorization, and referrals can return a URL or open a browser. The agent should:++1. explain which provider flow is opening;+2. let the user complete it directly;+3. never ask for provider credentials;+4. re-read Cap state afterward to verify the result.++## Troubleshooting checklist++### `cap` is not found++Install it from [Set Up Your Agent](/docs/agents/setup#install-the-cap-cli), open a new terminal, and run `cap version --json`.++### Authentication fails++Run `cap auth status --json`. If needed, use `cap auth login --json` and complete the browser approval. For self-hosted Cap, make sure `CAP_SERVER_URL` points to the intended server before login.++### The agent guesses a flag or output shape++Stop and run:++```sh+cap guide --json+cap <command> --help+```++The installed binary is the source of truth.++### MCP is unavailable++Verify that the client launches the local command `cap mcp serve`, that `cap` is on the client's PATH, and that stdout is not wrapped or logged by another process. Use direct CLI commands as a fallback.++### A Cap is password protected++Do not put the password in the prompt. Complete `cap caps unlock <id-or-url>` in a secure terminal, then retry the read.++### Processing does not finish++Keep the operation or Cap ID, use the relevant wait command with a bounded timeout, and report the last verified state. Do not start duplicate work unless the user explicitly approves a retry.++### A command is forbidden++Read the returned permissions or capabilities. Re-authenticate with a broader profile only if the task truly needs it and the user agrees. Do not work around a server-enforced denial.++Return to the [Cap for Agents overview](/docs/agents) or choose a tested [Agent Workflow](/docs/agents/workflows).diff --git a/apps/web/content/docs/agents/setup.mdx b/apps/web/content/docs/agents/setup.mdxnew file mode 100644index 000000000..13c6aba86--- /dev/null+++ b/apps/web/content/docs/agents/setup.mdx@@ -0,0 +1,166 @@+---+title: "Set Up Your Agent"+summary: "Install Cap, authenticate with least privilege, and connect your preferred agent"+tags: "Agents"+---++> **Agent-readable page:** You can send this URL to your agent. It should follow the verification and confirmation rules below, never overwrite an existing agent configuration blindly, and stop for you when a browser or secure terminal handoff is required.++<CopyablePrompt />++The prompt above can perform this setup with you. The rest of this page documents every step for manual installation and troubleshooting.++## Install the Cap CLI++The CLI ships with Cap Desktop, so both stay on the same version.++### From Cap Desktop++Open **Settings → Command Line → Install CLI**.++### macOS or Linux++```sh+curl -fsSL https://cap.so/install-cli.sh | sh+```++### Windows PowerShell++```powershell+irm https://cap.so/install-cli.ps1 | iex+```++The installer adds `cap` to your PATH and installs Cap Desktop when it is missing. Open a new terminal after installation, then verify the binary:++```sh+cap version --json+cap guide --json+```++## Authenticate with least privilege++First inspect the current state:++```sh+cap auth status --json+```++If authentication is required, authorize Cap in your browser:++```sh+cap auth login --json+```++Login uses the `creator` profile by default. Request a broader profile only when the task needs it:++| Profile | Use it for |+| --- | --- |+| `creator` | Caps, uploads, comments, library, analytics, notifications, and profile tasks |+| `admin` | Creator access plus organization members, settings, billing, and storage integrations |+| `full` | Admin access plus developer apps, credentials, videos, and credits |++```sh+cap auth login --profile admin --json+cap auth login --profile full --json+```++Cap CLI credentials are stored by the operating system when available. `CAP_AGENT_TOKEN` is supported for headless environments, but do not paste tokens into an agent conversation or commit them to a project.++## Codex++Preview exactly what Cap will change:++```sh+cap agents install --target codex --component all --dry-run --json+```++After reviewing the paths and values, apply the integration:++```sh+cap agents install --target codex --component all --yes --json+```++This installs the Cap skill and adds a local `cap mcp serve` entry to Codex's configuration. Restart Codex so it reloads the integration.++## Claude Code++```sh+cap agents install --target claude --component all --dry-run --json+cap agents install --target claude --component all --yes --json+```++Review the preview first, then restart Claude Code after applying it.++## Cursor++```sh+cap agents install --target cursor --component all --dry-run --json+cap agents install --target cursor --component all --yes --json+```++Review the preview first, then restart Cursor after applying it.++## OpenCode++OpenCode can use Cap immediately through its shell tools: paste the [agent prompt](/docs/agents#the-fastest-way-to-start) and let it call `cap guide --json`.++To use Cap as a local MCP server too, merge this entry into your `opencode.json` configuration:++```json+{+ "$schema": "https://opencode.ai/config.json",+ "mcp": {+ "cap": {+ "type": "local",+ "command": ["cap", "mcp", "serve"],+ "enabled": true+ }+ }+}+```++Do not replace unrelated OpenCode settings. After merging the entry, restart OpenCode and check the server:++```sh+opencode mcp list+```++See OpenCode's [local MCP documentation](https://opencode.ai/docs/mcp-servers/#local) for configuration details.++## Any other agent or MCP client++If the agent can run shell commands, no integration is required. Give it the [copyable prompt](/docs/agents#the-fastest-way-to-start).++For an MCP client that supports local stdio servers, configure:++```json+{+ "command": "cap",+ "args": ["mcp", "serve"]+}+```++Keep `cap mcp serve` on stdio. Its stdout is reserved for MCP protocol messages.++## Verify the full setup++Ask the agent to run these read-only checks:++```sh+cap version --json+cap guide --json+cap auth status --json+cap caps list --limit 1 --json+```++A correct setup has:++- valid JSON on stdout;+- a successful authenticated status before account-backed work;+- either a Cap result or an empty list from the library check, not a guessed answer;+- no secret value printed by `cap auth status`;+- no changes made during verification.++If MCP is installed, also ask the agent to list the available Cap tools. It should find read tools such as `caps_list` and `caps_context`. Passwords and storage credentials should not appear as MCP inputs.++Continue with [Agent Workflows](/docs/agents/workflows).diff --git a/apps/web/content/docs/agents/workflows.mdx b/apps/web/content/docs/agents/workflows.mdxnew file mode 100644index 000000000..419370a49--- /dev/null+++ b/apps/web/content/docs/agents/workflows.mdx@@ -0,0 +1,181 @@+---+title: "Agent Workflows"+summary: "Practical Cap scenarios with safe prompts, expected actions, and success checks"+tags: "Agents"+---++> **Agent-readable page:** Send this page with the task you want completed. The agent must run `cap guide --json`, prefer JSON output, inspect current state before changing it, and follow the confirmation boundary in each workflow.++## Understand a recording++**Ask your agent:**++> Summarize this Cap for someone who missed the meeting. Include decisions, owners, action items, open questions, and useful timestamps: `<Cap URL>`.++The agent should:++1. Run `cap caps context <id-or-url> --json`.+2. Use the returned title, AI output, chapters, transcript, comments, reactions, views, permissions, and processing state.+3. If content is already processing, optionally observe it with `cap caps wait <id-or-url> --for all --json`.+4. Never claim that `wait` started transcription or AI processing.++**Success check:** The answer is grounded in returned Cap content, distinguishes missing or still-processing fields, and does not start paid work.++## Search across your library++**Ask your agent:**++> Find my Caps about customer onboarding, identify the three most relevant, and combine their decisions and unresolved questions. Do not modify anything.++The agent should start with:++```sh+cap caps list --search "customer onboarding" --json+```++It can narrow by `--scope`, `--organization`, `--folder`, or `--updated-after`, then call `cap caps context` only for relevant results.++**Success check:** The agent explains its selection, works from the returned IDs, and stays read-only.++## Draft and post a comment++**Ask your agent:**++> Read this Cap and draft a concise timestamped comment asking for clarification at the point where pricing is discussed. Show me the exact comment before posting it.++The agent should read the Cap, draft the text and timestamp, and stop for confirmation. Only after you approve should it run a confirmed command such as:++```sh+cap caps comments add <id-or-url> "<approved comment>" --timestamp-ms <timestamp> --yes --json+```++Replies and reactions use the same review-first pattern through `cap caps comments reply` and `cap caps reactions add`.++**Success check:** The posted content exactly matches what you approved, and the agent re-reads the Cap or command result to verify it exists.++## Record and share a bug reproduction++**Ask your agent:**++> Help me record a short reproduction of this bug. Ask before capture starts, stop after the reproduction, validate the recording, then ask again before uploading it.++The agent should:++1. Check `cap doctor --json` and branch on `captureReady`.+2. Discover inputs with `cap targets --json` and show you the selected screen, window, camera, microphone, and audio settings.+3. Get your explicit confirmation before capture.+4. Start a detached recording and retain its `recordingId` and `path`.+5. Stop that exact session and require `recordingMetaExists: true`.+6. Run `cap project validate <path.cap> --json`.+7. Export locally if needed.+8. Show the upload plan and obtain a second confirmation before `cap upload`.++```sh+cap record start --screen <screen-id> --detach --json+cap record stop --id <recording-id> --json+cap project validate <path.cap> --json+cap export <path.cap> --output bug-repro.mp4 --json+cap upload bug-repro.mp4 --json+```++**Success check:** The validated recording corresponds to the session that was started, export reaches a terminal completion event, and upload returns a Cap ID and share link.++## Upload an existing recording++**Ask your agent:**++> Upload `demo.mp4` to Cap with the title “July product demo” and give me the link. Show me the exact file and title before uploading.++After confirmation:++```sh+cap upload demo.mp4 --name "July product demo" --json+```++For a `.cap` project without an export, the agent can propose `cap upload <path.cap> --export --json`.++**Success check:** The agent checks the command's JSON result for the returned ID and link instead of inventing or reconstructing a URL.++## Review engagement++**Ask your agent:**++> Compare this month's organization analytics with the context from our most-watched Caps. Explain likely patterns, but do not change anything.++The agent can inspect organizations and run a bounded analytics query:++```sh+cap organizations list --json+cap analytics --organization <organization-id> --range month --json+```++It may add `--space` or `--cap` for a narrower view.++**Success check:** Time range and scope are explicit, observed metrics are separated from interpretation, and no settings are changed.++## Organize team content++**Ask your agent:**++> Find the correct product space and release folder for this Cap. Show me the current and proposed location, then move it only after I approve.++The agent should inspect organizations, spaces, folders, and the Cap's current context first:++```sh+cap organizations list --json+cap library spaces list <organization-id> --json+cap library folders list <organization-id> --space <space-id> --json+cap caps context <id-or-url> --json+```++After confirmation, it can use `cap caps move` with the exact organization, container, space, and folder identifiers returned by discovery.++**Success check:** The agent re-reads the Cap and confirms its final location. It must not infer IDs from display names.++Read [Working With Your Team](/docs/teams) for the organization roles, spaces, folders, storage, and analytics that this workflow can manage.++## Configure organization storage++**Ask your agent:**++> Inspect our organization's current storage and show me a plan to use Google Drive for new uploads. Do not open an authorization flow, choose a folder, or change the provider until I approve each step.++The agent should run `cap guide --json`, inspect the organization and existing storage integrations, and explain that a provider change applies to future uploads rather than moving existing files. Google authorization must happen in the browser, and the exact writable Drive folder must be confirmed before activation.++**Success check:** The agent re-reads the organization storage state, tests the connection, and verifies one non-sensitive sample upload and playback before recommending a team-wide rollout.++Read [Google Drive](/docs/teams/google-drive) for the complete workflow and rollout checklist.++## Run a Loom migration++**Ask your agent:**++> Import this Loom URL into our organization, assign it to the confirmed owner email and Cap space name, and wait for the migration to finish. Preview the exact mapping before starting.++After checking organization, member, and space state, the agent should show the mapping and get confirmation. A confirmed import can be run as:++```sh+cap caps import loom <loom-url> --organization <organization-id> --owner-email <email> --space <space-name> --yes --json+cap jobs wait <operation-id> --json+```++The import command also supports `--wait`. For a batch migration, process one explicit row at a time, preserve the source URL and returned operation ID, and reconcile conflicts before retrying. The operation is durable, but starting an import is not itself an idempotent action.++**Success check:** Every source row has a terminal job result and a verified destination. An accepted or queued response is not treated as complete.++For CSV limits, owner and space mapping, large-batch controls, and source-unavailable handling, read [Migrating to Cap](/docs/migrating-to-cap).++## Use Cap for administration or development++Cap also exposes account, organization, notification, storage, billing, and developer workflows. Ask the agent to discover the current surface rather than copying commands from an old prompt:++```sh+cap guide --json+cap account --help+cap organizations --help+cap developers --help+```++Use the `admin` login profile for organization and billing work and `full` only for developer tasks. Billing, storage, domains, membership, credential rotation, auto top-up, and destructive changes always require an exact preview and explicit confirmation.++Read [Safety & Troubleshooting](/docs/agents/safety) for the rules that apply to every workflow.diff --git a/apps/web/content/docs/introduction.mdx b/apps/web/content/docs/introduction.mdxindex f222a0b2d..03ace3251 100644--- a/apps/web/content/docs/introduction.mdx+++ b/apps/web/content/docs/introduction.mdx@@ -8,6 +8,8 @@ Cap is the open source alternative to Loom. It is a lightweight, powerful screenWhether you are walking a teammate through a bug, recording a product demo, creating a tutorial, or sending async updates, Cap makes it fast and effortless.+Cap is built for AI agents too. Codex, Claude Code, Cursor, OpenCode, or any shell-capable agent can record, share, search, and manage Cap for you — [one prompt sets it up](/docs/agents).+## Why Cap?**Open source and transparent.** Cap is built in the open with a permissive license. You can inspect every line of code, contribute features, or self-host on your own infrastructure.@@ -28,6 +30,8 @@ Whether you are walking a teammate through a bug, recording a product demo, crea- **Studio Mode** - Record locally, then edit with professional tools. Customize backgrounds, add zoom effects, trim footage, and export polished videos.+- **Cap for Agents** - Let your AI agent drive Cap through the CLI, skill, and local MCP. It can record your screen, share links, read transcripts and summaries, and organize your library, asking for confirmation before anything changes.+- **AI Captions** - Automatic transcription and captioning powered by AI. Every recording gets searchable, accessible captions.- **Camera Overlay** - Include your webcam as a floating overlay to add a personal touch to any recording.@@ -48,6 +52,8 @@ The fastest way to get started with Cap:2. **[Record your first Cap](/docs/quickstart)** in under a minute3. **Share the link** with anyone+Working with an AI agent instead? [Cap for Agents](/docs/agents) sets up the whole integration with a single copy-paste prompt.+## Desktop AppCap Desktop is available for **macOS** (Apple Silicon and Intel) and **Windows** (10 and later). Download the latest version from [Cap.so/download](https://cap.so/download).@@ -58,6 +64,12 @@ The desktop app handles recording, camera/microphone capture, and local editingThe Cap web app at [Cap.so](https://cap.so) is your dashboard for managing recordings, customizing share settings, viewing analytics, and collaborating with your team. It is also where viewers watch shared recordings.+## Cap for Agents++Your AI agent can use Cap end to end: check capture readiness, record your screen, upload and return a share link, read transcripts and AI summaries, search your library, draft comments, and manage folders, spaces, and team settings. Reads are free-form; every mutation requires your explicit confirmation, and secrets never pass through chat.++Start at [Cap for Agents](/docs/agents) — the one-prompt setup installs the CLI, the Cap skill, and the local MCP server into Codex, Claude Code, Cursor, or OpenCode.+## Self-HostingCap can be fully self-hosted on your own infrastructure using Docker Compose. This gives you complete ownership of your data, recordings, and user accounts. See the [self-hosting guide](/docs/self-hosting) for detailed setup instructions.