Desktop app that records your on-screen work session and uses the GitHub Copilot SDK to reconstruct it as an intent + ordered steps, then builds a reusable Skill or Automation for Microsoft Autopilots like Scout, Microsoft Copilot Cowork, or Copilot Studio.
TypeScript agent-skillsai-agentsautomationcopilotcopilot-clicopilot-coworkcopilot-studioelectronmicrosoft-scoutscreen-recording
Add Cowork (M365 Copilot) as a skill target architecture (#34)
adilei8c1dda0ec9c0
diff --git a/common/ipc.ts b/common/ipc.tsindex 4542e1d..3fb913a 100644--- a/common/ipc.ts+++ b/common/ipc.ts@@ -131,7 +131,7 @@ export interface SkillBuildProgress {/** Start a build (or refine one) for a session's analysis. */export interface SkillBuildInput {sessionId: string;- /** Target architecture (only "scout" is enabled today). */+ /** Target architecture (Scout or Cowork). */architecture: SkillArchitecture;/** Natural-language refinement for the current plan; omit for the first pass. */feedback?: string;@@ -144,12 +144,23 @@ export interface SkillPlanResult {error?: string;}-/** Result of finalizing + exporting a skill. */+/**+ * Where a built skill lands:+ * - **install** — write it into the target agent's live skills folder (Scout auto-loads it).+ * - **export** — download it to a folder the user picks (the only option for Cowork).+ */+export type SkillPlacement = "install" | "export";++/** Result of finalizing + placing a skill. */export interface SkillCreateResult {ok: boolean;skill?: BuiltSkill;- /** Absolute path of the exported SKILL.md. */+ /** Absolute path of the placed SKILL.md. */path?: string;+ /** How the skill was placed (echoed back for the done screen). */+ placement?: SkillPlacement;+ /** True when the user dismissed the export destination dialog — a cancel, not an error. */+ canceled?: boolean;error?: string;}@@ -165,7 +176,7 @@ export interface AutomationBuildProgress {/** Start an automation build (or refine one) for a session's analysis. */export interface AutomationBuildInput {sessionId: string;- /** Target architecture (only "scout" is enabled today). */+ /** Target architecture (automations are Scout-only today). */architecture: SkillArchitecture;/** Natural-language refinement for the current plan; omit for the first pass. */feedback?: string;@@ -388,11 +399,13 @@ export interface SkillRecorderApi {*/buildSkill(input: SkillBuildInput): Promise<SkillPlanResult>;/**- * Finalize the (user-edited) skill plan and export its SKILL.md into the target- * agent. The edited plan the user sees is authoritative — the body is written- * from exactly these inputs and steps.+ * Finalize the (user-edited) skill plan and place its SKILL.md. The edited plan the+ * user sees is authoritative — the body is written from exactly these inputs and steps.+ * `placement` picks the destination: `"install"` writes into the target agent's live+ * skills folder (Scout); `"export"` prompts for a folder and downloads it there (the+ * only option for Cowork). Defaults to `"install"`.*/- createSkill(sessionId: string, plan: SkillPlan): Promise<SkillCreateResult>;+ createSkill(sessionId: string, plan: SkillPlan, placement?: SkillPlacement): Promise<SkillCreateResult>;/** Load a previously built skill for a session, if any. */getSkill(sessionId: string): Promise<BuiltSkill | null>;/** Abort an in-flight build. */diff --git a/common/skill.ts b/common/skill.tsindex 65aa9db..71b7352 100644--- a/common/skill.ts+++ b/common/skill.ts@@ -11,7 +11,7 @@ import { z } from "zod";* *input*); this is the builder's *output*.*/-/** Agent architectures a skill can target. Only Scout is enabled for now. */+/** Agent architectures a skill can target. Scout and Cowork are enabled today. */export const SkillArchitecture = z.enum(["scout", "cowork", "copilot-studio"]);export type SkillArchitecture = z.infer<typeof SkillArchitecture>;@@ -27,7 +27,7 @@ export interface ArchitectureOption {export const ARCHITECTURES: readonly ArchitectureOption[] = [{ id: "scout", label: "Scout", enabled: true, note: "Microsoft Scout: native WorkIQ, browser, files, and built-in skills." },- { id: "cowork", label: "Cowork", enabled: false, note: "Coming soon." },+ { id: "cowork", label: "Cowork", enabled: true, note: "Microsoft 365 Copilot (Cowork): native Teams, Outlook, Calendar, SharePoint, files, and built-in skills." },{ id: "copilot-studio", label: "Copilot Studio", enabled: false, note: "Coming soon." },] as const;@@ -53,11 +53,10 @@ export interface BuildTarget {}/**- * The build targets shown up front, in order. Only Scout is wired today, so its- * skill and automation targets are enabled; the other architectures are shown as- * a single greyed "coming soon" card each (their `kind` is nominal — they can't be- * selected). Automations are deeply platform-specific, so the target — not just the- * architecture — is chosen before the builder plans.+ * The build targets shown up front, in order. Scout has both a skill and an automation+ * target; Cowork has a skill target (export/download only). Automations are deeply+ * platform-specific, so the target — not just the architecture — is chosen before the+ * builder plans. copilot-studio is shown as a single greyed "coming soon" card.*/export const TARGETS: readonly BuildTarget[] = [{@@ -74,7 +73,13 @@ export const TARGETS: readonly BuildTarget[] = [enabled: true,note: "A scheduled, multi-step automation Scout runs on a trigger.",},- { kind: "skill", architecture: "cowork", label: "Cowork", enabled: false, note: "Coming soon." },+ {+ kind: "skill",+ architecture: "cowork",+ label: "Cowork skill",+ enabled: true,+ note: "An on-demand skill for Microsoft 365 Copilot (Cowork) you export and install.",+ },{kind: "skill",architecture: "copilot-studio",diff --git a/electron/ipc.ts b/electron/ipc.tsindex aea2bff..6852296 100644--- a/electron/ipc.ts+++ b/electron/ipc.ts@@ -1,4 +1,5 @@-import { ipcMain, shell } from "electron";+import { BrowserWindow, dialog, ipcMain, shell, type OpenDialogOptions } from "electron";+import os from "node:os";import path from "node:path";import type {@@ -12,6 +13,7 @@ import type {MicrophoneSettingsResult,SkillBuildInput,SkillCreateResult,+ SkillPlacement,SkillPlanResult,} from "../common/ipc";import { IPC } from "../common/ipc";@@ -27,7 +29,7 @@ import type { NarrationManager } from "./narration/manager";import type { RecorderController } from "./recorder/controller";import { isValidSessionId } from "./recorder/session-store";import { deleteSession, listSessions } from "./sessions";-import { loadPersistedSkill, SkillBuilder } from "./skillbuilder/builder";+import { loadPersistedSkill, SkillBuilder, type SkillTarget } from "./skillbuilder/builder";const log = createLogger("IPC");@@ -230,17 +232,41 @@ export function registerIpc(}});- ipcMain.handle(IPC.createSkill, async (_event, sessionId: string, plan?: SkillPlan): Promise<SkillCreateResult> => {- if (!isValidSessionId(sessionId)) return { ok: false, error: "Unknown session." };- try {- const { skill, path: file } = await builder.create(sessionId, plan);- return { ok: true, skill, path: file };- } catch (err) {- const error = err instanceof Error ? err.message : String(err);- log.warn("create skill failed:", error);- return { ok: false, error };- }- });+ ipcMain.handle(+ IPC.createSkill,+ async (+ event,+ sessionId: string,+ plan?: SkillPlan,+ placement: SkillPlacement = "install",+ ): Promise<SkillCreateResult> => {+ if (!isValidSessionId(sessionId)) return { ok: false, error: "Unknown session." };+ try {+ let target: SkillTarget = { kind: "install" };+ if (placement === "export") {+ // Export == download: let the user pick a destination folder; we drop a+ // ready-to-use <name>/SKILL.md inside it. A dismissed dialog is a cancel, not an error.+ const win = BrowserWindow.fromWebContents(event.sender) ?? undefined;+ const opts: OpenDialogOptions = {+ title: "Export skill to folder",+ defaultPath: path.join(os.homedir(), "Downloads"),+ properties: ["openDirectory", "createDirectory"],+ };+ const result = win+ ? await dialog.showOpenDialog(win, opts)+ : await dialog.showOpenDialog(opts);+ if (result.canceled || result.filePaths.length === 0) return { ok: false, canceled: true };+ target = { kind: "export", dir: result.filePaths[0] };+ }+ const { skill, path: file } = await builder.create(sessionId, plan, target);+ return { ok: true, skill, path: file, placement };+ } catch (err) {+ const error = err instanceof Error ? err.message : String(err);+ log.warn("create skill failed:", error);+ return { ok: false, error };+ }+ },+ );ipcMain.handle(IPC.getSkill, (_event, sessionId: string) =>isValidSessionId(sessionId) ? loadPersistedSkill(sessionId) : null,diff --git a/electron/preload.cjs b/electron/preload.cjsindex 285f4c2..3b654c9 100644--- a/electron/preload.cjs+++ b/electron/preload.cjs@@ -88,7 +88,7 @@ contextBridge.exposeInMainWorld("skillRecorder", {listSessions: () => ipcRenderer.invoke(IPC.listSessions),deleteSession: (sessionId) => ipcRenderer.invoke(IPC.deleteSession, sessionId),buildSkill: (input) => ipcRenderer.invoke(IPC.buildSkill, input),- createSkill: (sessionId, plan) => ipcRenderer.invoke(IPC.createSkill, sessionId, plan),+ createSkill: (sessionId, plan, placement) => ipcRenderer.invoke(IPC.createSkill, sessionId, plan, placement),getSkill: (sessionId) => ipcRenderer.invoke(IPC.getSkill, sessionId),cancelSkill: (sessionId) => ipcRenderer.invoke(IPC.cancelSkill, sessionId),revealSkill: (sessionId) => ipcRenderer.invoke(IPC.revealSkill, sessionId),diff --git a/electron/skillbuilder/builder.ts b/electron/skillbuilder/builder.tsindex 93192c5..5b77ef2 100644--- a/electron/skillbuilder/builder.ts+++ b/electron/skillbuilder/builder.ts@@ -50,6 +50,19 @@ function skillsRoot(): string {return path.join(os.homedir(), ".copilot", "skills");}+/** True when `dir` is `root` or nested inside it (so we can safely re-use it). */+function isInside(root: string, dir: string): boolean {+ const rel = path.relative(root, dir);+ return rel === "" || (!rel.startsWith("..") && !path.isAbsolute(rel));+}++/**+ * Where {@link SkillBuilder.create} writes the finished SKILL.md:+ * - **install** — into the agent's live skills folder ({@link skillsRoot}), auto-loaded.+ * - **export** — into a user-picked folder (a "download"), as `<dir>/<name>/SKILL.md`.+ */+export type SkillTarget = { kind: "install" } | { kind: "export"; dir: string };+interface LiveBuild extends BaseLive {sessionDir: string;architecture: SkillArchitecture;@@ -94,7 +107,7 @@ export class SkillBuilder extends AgentBuilder<LiveBuild> {const { sessionId, architecture, feedback } = input;if (this.active.has(sessionId)) throw new Error("A build is already running for this session.");if (!catalogueFor(architecture)) {- throw new Error("That target architecture isn't available yet. Choose Scout.");+ throw new Error("That target architecture isn't available yet. Choose Scout or Cowork.");}const analysis = loadPersistedAnalysis(sessionId);if (!analysis) throw new Error("There is no analysis for this recording yet.");@@ -115,10 +128,15 @@ export class SkillBuilder extends AgentBuilder<LiveBuild> {}}- /** Finalize the user-edited plan into a SKILL.md and export it. The edited plan is+ /** Finalize the user-edited plan into a SKILL.md and place it. The edited plan is* authoritative: its name/description/inputs/steps are used verbatim and only the- * markdown body is written by the agent. */- async create(sessionId: string, editedPlan?: SkillPlan): Promise<{ skill: BuiltSkill; path: string }> {+ * markdown body is written by the agent. `target` picks the destination — installed+ * into the agent's live skills folder, or exported (downloaded) to a user-picked dir. */+ async create(+ sessionId: string,+ editedPlan?: SkillPlan,+ target: SkillTarget = { kind: "install" },+ ): Promise<{ skill: BuiltSkill; path: string }> {if (this.active.has(sessionId)) throw new Error("Wait for the current step to finish.");let held = this.live.get(sessionId);// Prefer the user's edited plan from the review tiles; fall back to the last@@ -153,10 +171,15 @@ export class SkillBuilder extends AgentBuilder<LiveBuild> {body: submission.body,};const built = toBuiltSkill(sessionId, plan.architecture, finalSubmission, plan);- const exportPath = this.exportSkill(built);+ const exportPath =+ target.kind === "export" ? this.exportSkillTo(built, target.dir) : this.exportSkill(built);const finalSkill: BuiltSkill = { ...built, exportedPath: exportPath, exportedAt: Date.now() };this.persist(live.sessionDir, finalSkill);- this.emit(sessionId, "done", `Skill exported to ${exportPath}`);+ this.emit(+ sessionId,+ "done",+ target.kind === "export" ? `Skill exported to ${exportPath}` : `Skill added: ${exportPath}`,+ );return { skill: finalSkill, path: exportPath };} finally {this.active.delete(sessionId);@@ -236,15 +259,18 @@ export class SkillBuilder extends AgentBuilder<LiveBuild> {return plan;}- /** Write the SKILL.md into the target agent's skills folder; returns its path. */+ /** Write the SKILL.md into the target agent's live skills folder; returns its path. */private exportSkill(skill: BuiltSkill): string {const root = skillsRoot();const name = slugifySkillName(skill.name);const prior = loadPersistedSkill(skill.sessionId);- // Re-export to the same folder if this session already exported one; otherwise- // pick a fresh, non-colliding directory so we never clobber an unrelated skill.- let dir = prior?.exportedPath ? path.dirname(prior.exportedPath) : path.join(root, name);- if (!prior?.exportedPath && existsSync(dir)) {+ const priorDir = prior?.exportedPath ? path.dirname(prior.exportedPath) : null;+ // Re-install over the same folder only when it already lives under the install root;+ // a prior *export* (download) folder must not be reused here. Otherwise pick a fresh,+ // non-colliding directory so we never clobber an unrelated skill.+ const reuse = priorDir !== null && isInside(root, priorDir);+ let dir = reuse ? (priorDir as string) : path.join(root, name);+ if (!reuse && existsSync(dir)) {let n = 2;while (existsSync(path.join(root, `${name}-${n}`))) n++;dir = path.join(root, `${name}-${n}`);@@ -255,6 +281,22 @@ export class SkillBuilder extends AgentBuilder<LiveBuild> {return file;}+ /** Export (download) the SKILL.md into a user-picked folder as `<baseDir>/<name>/SKILL.md`;+ * returns its path. Always picks a fresh, non-colliding subfolder within `baseDir`. */+ private exportSkillTo(skill: BuiltSkill, baseDir: string): string {+ const name = slugifySkillName(skill.name);+ let dir = path.join(baseDir, name);+ if (existsSync(dir)) {+ let n = 2;+ while (existsSync(path.join(baseDir, `${name}-${n}`))) n++;+ dir = path.join(baseDir, `${name}-${n}`);+ }+ mkdirSync(dir, { recursive: true });+ const file = path.join(dir, "SKILL.md");+ writeFileSync(file, renderSkillMarkdown(skill));+ return file;+ }+private persist(dir: string, skill: BuiltSkill): void {try {writeFileSync(path.join(dir, "skill.json"), JSON.stringify(skill, null, 2));diff --git a/electron/skillbuilder/cowork-catalog.ts b/electron/skillbuilder/cowork-catalog.tsnew file mode 100644index 0000000..888f7a5--- /dev/null+++ b/electron/skillbuilder/cowork-catalog.ts@@ -0,0 +1,138 @@+/**+ * A **static, versioned** snapshot of the Cowork (Microsoft 365 Copilot) agent's native+ * capabilities, embedded into the builder's system prompt. End users won't have the Cowork+ * harness introspectable, so we catalogue its BUILT-IN tools, MCP tools, and BUILT-IN+ * (shipped) skills here — authored from the agent-harness capability report — and ship it as+ * a constant.+ *+ * IMPORTANT: built-ins only. Do NOT list user-installed skills; a generated skill can only+ * rely on what every Cowork install ships with. Refresh this when Cowork's native+ * tools/skills change (re-run the harness capability report and diff).+ */+export const COWORK_CATALOGUE_VERSION = "2026-07-28";++/**+ * The reusable core of the Cowork catalogue: the native tools, built-in skills, and+ * recorded-action→capability mapping. Kept exported for symmetry with the Scout catalogue+ * (and any future Cowork automation support), though only the Skill Builder uses it today.+ */+export const COWORK_NATIVE_CAPABILITIES = `+## Where this runs, and the native tools to PREFER++Cowork is a **Microsoft 365 Copilot** agent with first-class **Microsoft 365** tools plus a+real shell and local file tools. Prefer a real native tool, API, or first-class **CLI** over+replaying a web UI. Reach for these in order:++1. **Microsoft 365 (MCP tools).** Use for anything in Teams, Outlook mail, Calendar,+ SharePoint/OneDrive, the org directory, or unified M365 search. Read tools are+ auto-approved; send/create/update/delete need the user's approval at run time.+ - Teams / chat: \`m365_teams/ListChats\`, \`m365_teams/GetChat\`, \`m365_teams/ListChatMessages\`,+ \`m365_teams/PostMessage\`, \`m365_teams/CreateChat\`, \`m365_teams/ListChannels\`,+ \`m365_teams/ListChannelMessages\`, \`m365_teams/PostChannelMessage\`, \`m365_teams/ReplyToChannelMessage\`.+ - Email: \`outlook/ListMessages\`, \`outlook/GetMessage\`, \`outlook/CreateDraftMessage\`,+ \`outlook/SendDraftMessage\`, \`outlook/ReplyToMessage\`, \`outlook/ReplyAllToMessage\`,+ \`outlook/ForwardMessage\`, \`outlook/SendEmailWithAttachments\`, \`outlook/ListMailFolders\`, \`outlook/MoveMessage\`.+ - Calendar: \`outlook_calendar/ListEvents\`, \`outlook_calendar/ListCalendarView\`,+ \`outlook_calendar/CreateEvent\`, \`outlook_calendar/UpdateEvent\`, \`outlook_calendar/FindMeetingTimes\`,+ \`outlook_calendar/GetRooms\`, \`outlook_calendar/AcceptEvent\`, \`outlook_calendar/DeclineEvent\`.+ - Files: \`sharepoint_onedrive/SearchDrive\`, \`sharepoint_onedrive/GetDriveChildren\`,+ \`sharepoint_onedrive/GetDriveItem\`, \`sharepoint_onedrive/ReadFileContent\`,+ \`sharepoint_onedrive/CreateFolder\`, \`sharepoint_onedrive/ListMyDrives\`, \`sharepoint_onedrive/SearchSites\`.+ - People / org: \`me_profile/GetMyDetails\`, \`me_profile/SearchPeople\`, \`me_profile/GetUserDetails\`,+ \`me_profile/GetManagerDetails\`, \`me_profile/GetDirectReportsDetails\`, \`me_profile/GetOrgTree\`.+ - Unified search: \`m365_search/SearchM365\` (across mail, files, chats, people).+ - Meeting transcripts: \`graph/GetMyRecentTranscripts\`, \`graph/ListMeetingTranscripts\`,+ \`graph/GetMeetingTranscript\`.+ - Escape hatch: \`graph/QueryGraph\` / \`graph/CallGraph\` for any Microsoft Graph call not+ covered by a dedicated tool above.+2. **SDK built-ins — local files and the web.** \`Read\` (read a file), \`Glob\` (find files by+ pattern), \`Grep\` (search file contents), \`core/web_fetch\` (fetch a URL), \`core/web_search\`+ (search the web). These DISCOVER inputs on the local OS or the public web instead of asking+ the user. Use \`Write\` / \`Edit\` to author or update local files.+3. **The device shell + installed CLIs (\`Bash\`).** When a service ships a first-class CLI, that+ CLI IS its native tool — prefer it over the browser. Above all: **GitHub → the \`gh\` CLI**+ (\`gh issue\`, \`gh pr\`, \`gh release\`, \`gh repo\`, \`gh api\`) — never drive github.com through a+ browser. Likewise \`git\`, and the cloud/service CLIs the task used (\`az\`, \`aws\`, \`gcloud\`,+ \`kubectl\`, \`npm\`, \`docker\`). Gate the shell with an \`allowed-tools\` pattern scoped to the+ tool, e.g. \`Bash(gh *)\` or \`Bash(git *)\`.+4. **Power BI (\`pbi_fabricaihub/*\`).** For Power BI / Fabric reports and semantic models:+ \`pbi_fabricaihub/ResolveReportIdFromUrl\`, \`pbi_fabricaihub/GetReportMetadata\`,+ \`pbi_fabricaihub/GetSemanticModelSchema\`, \`pbi_fabricaihub/ExecuteQuery\`, \`pbi_fabricaihub/ValueSearch\`.++> **No browser automation.** Cowork has NO Playwright / \`browser_*\` tools — it cannot click or+> type in a web UI. For a web app with no API and no CLI, the most it can do is READ a public+> page with \`core/web_fetch\`. So map every recorded UI step to an M365 tool, a CLI, or an API;+> if a step genuinely requires driving a UI Cowork can't automate, call it out in the skill+> rather than pretending to click.++## Built-in skills you can lean on++When the task matches one of Cowork's shipped skills, USE it (write the body to invoke it)+instead of reinventing the procedure. Built-in skills:+- **pptx** / **docx** / **xlsx** — create, read, or edit PowerPoint / Word / Excel-CSV.+- **pdf** — read and manipulate PDF files.+- **loop** — edit Microsoft Loop documents.+- **canvas** — build a shareable canvas / artifact.+- **deep-research** — multi-source research with citations.+- **code-review** / **security-review** — review code changes.+- **powerbi** — Power BI reporting workflows.+- **calendar-management** / **schedule-meeting** / **meeting-intel** — calendar + meeting workflows.+- **stakeholder-comms** / **daily-briefing** — communications and briefing workflows.+- **image-operations** — inspect or transform images.++Assume ONLY the tools and skills listed above exist. Do not depend on any other skill+being installed.++## Recorded action → native capability (examples)++| Recording shows | Prefer |+| --- | --- |+| Searching / reading a Teams chat | \`m365_teams/ListChats\` → \`m365_teams/ListChatMessages\` |+| Posting to a Teams chat or channel | \`m365_teams/PostMessage\` / \`m365_teams/PostChannelMessage\` (approval) |+| Reading / searching Outlook mail | \`outlook/ListMessages\` / \`outlook/GetMessage\`; broad search \`m365_search/SearchM365\` |+| Sending / replying to email | \`outlook/CreateDraftMessage\`+\`outlook/SendDraftMessage\` / \`outlook/ReplyToMessage\` (approval) |+| Checking a calendar / free-busy | \`outlook_calendar/ListCalendarView\` / \`outlook_calendar/FindMeetingTimes\` |+| Creating / updating a meeting | \`outlook_calendar/CreateEvent\` / \`outlook_calendar/UpdateEvent\` (approval) |+| Finding / reading a SharePoint or OneDrive file | \`sharepoint_onedrive/SearchDrive\` → \`sharepoint_onedrive/ReadFileContent\` |+| Looking someone up in the org | \`me_profile/SearchPeople\` / \`me_profile/GetUserDetails\` / \`me_profile/GetOrgTree\` |+| Reading a meeting transcript | \`graph/GetMyRecentTranscripts\` → \`graph/GetMeetingTranscript\` |+| Opening / reading a local file or folder | \`Read\` / \`Glob\` / \`Grep\` |+| Reading a public web page / searching the web | \`core/web_fetch\` / \`core/web_search\` |+| Acting on GitHub — issues, PRs, releases, repos | the \`gh\` CLI via \`Bash(gh *)\` — never the browser |+| Running git, cloud, or package operations | the matching CLI via the shell (\`git\`, \`az\`/\`aws\`/\`gcloud\`, \`npm\`, \`docker\`) |+| Editing a spreadsheet / doc / deck / PDF | the \`xlsx\` / \`docx\` / \`pptx\` / \`pdf\` built-in skill |+| Querying a Power BI report | \`pbi_fabricaihub/ResolveReportIdFromUrl\` → \`pbi_fabricaihub/ExecuteQuery\` |+| Filling a form on a web app with no API or CLI | no browser automation — prefer an API/CLI, else note the manual step |+`.trim();++const COWORK_CATALOGUE = `+# Target: Microsoft 365 Copilot (Cowork) — native capability catalogue (built-ins only)++A Cowork **skill** is a \`SKILL.md\` file: optional YAML frontmatter followed by a markdown+**instructions body** (the same shape as other Copilot skills).++Frontmatter fields:+- \`name\` — kebab-case, \`^[a-z0-9-]+$\`.+- \`description\` — one line of trigger keywords (when Cowork should reach for this skill).+- \`allowed-tools\` (optional) — a YAML list of tool patterns the skill may use, e.g.+ \`Bash(gh *)\`, \`Read\`, \`Write\`, \`Grep\`, \`Glob\`. Omit it to allow the default set.++The body is plain instructions written TO the Cowork agent (imperative voice): when to use+the skill, the procedure to follow, and how to handle inputs and edge cases.++${COWORK_NATIVE_CAPABILITIES}++## Writing the SKILL.md body++- Write a GENERALIZED procedure: if the recording acted on N specific items, the body loops+ over ALL items of that kind, not the specific examples that were recorded.+- Resolve each input via the plan (a fixed value / the user provides it / the agent locates it).+- Prefer the native M365 tools, file tools, and CLIs above. Cowork has NO browser automation,+ so never write "click"/"type" UI steps — map each to an M365 tool, an API, or a CLI.+- Keep it concise and imperative. Include a short "When to use" and the ordered steps.+`.trim();++/** The Cowork catalogue, or null. Exposed so {@link catalogueFor} can dispatch on it. */+export function coworkCatalogue(): string {+ return COWORK_CATALOGUE;+}diff --git a/electron/skillbuilder/scout-catalog.ts b/electron/skillbuilder/scout-catalog.tsindex ca75b9b..c0da929 100644--- a/electron/skillbuilder/scout-catalog.ts+++ b/electron/skillbuilder/scout-catalog.ts@@ -1,4 +1,5 @@import type { SkillArchitecture } from "../../common/skill";+import { coworkCatalogue } from "./cowork-catalog";/*** A **static, versioned** snapshot of the target agent's native capabilities,@@ -117,5 +118,12 @@ ${SCOUT_NATIVE_CAPABILITIES}/** The catalogue for a target architecture, or null if none is available yet. */export function catalogueFor(architecture: SkillArchitecture): string | null {- return architecture === "scout" ? SCOUT_CATALOGUE : null;+ switch (architecture) {+ case "scout":+ return SCOUT_CATALOGUE;+ case "cowork":+ return coworkCatalogue();+ default:+ return null;+ }}diff --git a/evals/README.md b/evals/README.mdindex 3b715f3..78d593a 100644--- a/evals/README.md+++ b/evals/README.md@@ -211,10 +211,15 @@ each scenario asserts the shape of the proposed `SkillPlan`:- **confirmation** — `requiresConfirmation` requires at least one action to set`pausesForConfirmation`, i.e. the send/create/delete surface pauses for the user.-**Coverage.** Two scenarios: `price-tracker-skill` (a canonical page URL → **fixed**-input, `web_fetch` + the `xlsx` skill, calculations then a confirmed append) and-`github-issue-triage-skill` (the gh-vs-browser case as a skill — must use `gh`,-forbid the browser, and gate the mutating comment/label actions).+**Coverage.** Five scenarios. Two target **Scout**: `price-tracker-skill` (a canonical+page URL → **fixed** input, `web_fetch` + the `xlsx` skill, calculations then a+confirmed append) and `github-issue-triage-skill` (the gh-vs-browser case as a skill —+must use `gh`, forbid the browser, and gate the mutating comment/label actions). Three+target **Cowork** (Microsoft 365 Copilot), whose catalogue has **no browser automation**+— each asserts the right M365 `server/Tool` is reached for while playwright/`click` and+the web hosts are forbidden: `cowork-teams-digest` (read a channel then post via+`m365_teams`), `cowork-outlook-reply` (triage the mailbox then reply via `outlook`), and+`cowork-calendar-schedule` (find a slot then book via `outlook_calendar`).## Mock pages (`evals/mocks/`)diff --git a/evals/skillbuilder/scenarios.ts b/evals/skillbuilder/scenarios.tsindex b8ae088..ab1484a 100644--- a/evals/skillbuilder/scenarios.ts+++ b/evals/skillbuilder/scenarios.ts@@ -14,6 +14,12 @@//// Together they assert the whole new contract: input `source` vocabulary, typed// calculation/action steps, native-tool choice, and confirmation on the risky step.+//+// A third group targets the **Cowork** (Microsoft 365 Copilot) catalogue. Cowork has+// NO browser automation, so every recorded web-UI step must map to a first-class M365+// tool. These three cover the biggest M365 surfaces — Teams, Outlook mail, and+// Calendar — and each asserts the right `server/Tool` is reached for while the browser+// (playwright/click and the *.office.com / teams.microsoft.com hosts) is forbidden.import type { SkillBuilderScenario } from "./scenario";@@ -174,4 +180,235 @@ const githubIssueTriage: SkillBuilderScenario = {},};-export const skillScenarios: SkillBuilderScenario[] = [priceTracker, githubIssueTriage];+/* --- Cowork (Microsoft 365 Copilot) scenarios ----------------------------- */++/** Read a Teams channel in the web app, summarize, post a digest — must use the m365_teams tool, never the browser. */+const coworkTeamsDigest: SkillBuilderScenario = {+ id: "cowork-teams-digest",+ title: "Post a morning digest to the leads Teams channel",+ architecture: "cowork",+ platform: "darwin",+ truth:+ "Every morning the user opens the 'Eng — Announcements' channel in the Teams web app, reads " ++ "the overnight messages, writes a short 3-bullet digest, and posts it to the 'Leads' channel. " ++ "Cowork has no browser automation, so the right generalization reads the source channel with " ++ "m365_teams/ListChannelMessages and posts with m365_teams/PostChannelMessage — summarizing is " ++ "a calculation and posting is the one mutating action, which pauses for confirmation because it " ++ "posts on the user's behalf. Driving teams.microsoft.com in a browser is wrong.",+ analysis: {+ title: "Post a morning digest to the leads channel",+ intent:+ "Each morning, read the overnight messages in the Eng Announcements Teams channel, summarize " ++ "them into a short digest, and post that digest to the Leads channel for the leads to skim.",+ intentConfidence: "high",+ intentRationale:+ "The Teams web app stayed on the Eng Announcements channel while messages were read, and the " ++ "same digest text was then posted into the Leads channel.",+ steps: [+ {+ id: "s1",+ title: "Open the Eng Announcements channel",+ detail:+ "Opened the 'Eng — Announcements' channel in the Teams web app to read the messages posted " ++ "overnight.",+ apps: ["Microsoft Teams"],+ evidence: [+ "browser.url https://teams.microsoft.com/l/channel/19%3Aeng-announcements/Announcements",+ "title 'Eng — Announcements | Microsoft Teams'",+ ],+ confidence: "high",+ },+ {+ id: "s2",+ title: "Read the overnight messages",+ detail: "Read the overnight posts in the channel to capture what happened.",+ apps: ["Microsoft Teams"],+ evidence: ["clipboard 'Deploy 4.2 shipped; incident #88 resolved; on-call rotates to Priya'"],+ confidence: "high",+ },+ {+ id: "s3",+ title: "Write a 3-bullet digest",+ detail:+ "Condensed the overnight messages into a short three-bullet digest of what the leads need " ++ "to know.",+ apps: ["Microsoft Teams"],+ evidence: ["clipboard '• Deploy 4.2 shipped • Incident #88 resolved • On-call: Priya'"],+ confidence: "medium",+ },+ {+ id: "s4",+ title: "Post the digest to the Leads channel",+ detail: "Posted the three-bullet digest into the 'Leads' channel.",+ apps: ["Microsoft Teams"],+ evidence: [+ "browser.url https://teams.microsoft.com/l/channel/19%3Aleads/Leads",+ "clipboard '• Deploy 4.2 shipped • Incident #88 resolved • On-call: Priya'",+ ],+ confidence: "medium",+ },+ ],+ },+ rubric: {+ mustUseAny: [["m365_teams"], ["postchannelmessage", "postmessage", "replytochannelmessage"]],+ forbidden: ["playwright", "browser_", "click", "teams.microsoft.com"],+ minInputs: 1,+ minCalculations: 1,+ minActions: 1,+ requiresConfirmation: true,+ },+};++/** Triage unread mail in Outlook web and reply — must use the outlook tool, never the browser. */+const coworkOutlookReply: SkillBuilderScenario = {+ id: "cowork-outlook-reply",+ title: "Acknowledge unread support emails",+ architecture: "cowork",+ platform: "darwin",+ truth:+ "The user triages the Support mailbox in Outlook on the web: for each unread customer email " ++ "they send a short acknowledgement reply. Cowork can't drive a browser, so the right tools are " ++ "outlook/ListMessages + outlook/GetMessage to read the unread mail and outlook/ReplyToMessage " ++ "(or CreateDraftMessage + SendDraftMessage) to send the acknowledgement — deciding which " ++ "messages qualify is a calculation, and sending the reply is the mutating action that pauses " ++ "for confirmation. Replaying outlook.office.com in a browser is wrong.",+ analysis: {+ title: "Acknowledge unread support emails",+ intent:+ "Triage the Support mailbox: for each unread customer email, send a short acknowledgement " ++ "reply letting them know their request was received and will be followed up.",+ intentConfidence: "high",+ intentRationale:+ "Outlook on the web stayed in the Support inbox; an unread customer email was opened and the " ++ "same acknowledgement text was sent as a reply.",+ steps: [+ {+ id: "s1",+ title: "Open the Support inbox",+ detail: "Opened the Support shared mailbox in Outlook on the web and filtered to unread mail.",+ apps: ["Microsoft Outlook"],+ evidence: ["browser.url https://outlook.office.com/mail/support/", "title 'Inbox — Support'"],+ confidence: "high",+ },+ {+ id: "s2",+ title: "Read an unread customer email",+ detail: "Opened an unread customer email to read the request before acknowledging it.",+ apps: ["Microsoft Outlook"],+ evidence: ["clipboard 'Order #5512 still hasn't arrived — can you check?'"],+ confidence: "high",+ },+ {+ id: "s3",+ title: "Decide it needs an acknowledgement",+ detail:+ "Judged that the unread customer email is a new request that should get an acknowledgement " ++ "reply.",+ apps: ["Microsoft Outlook"],+ evidence: ["clipboard 'Order #5512 still hasn't arrived — can you check?'"],+ confidence: "medium",+ },+ {+ id: "s4",+ title: "Send the acknowledgement reply",+ detail: "Replied to the customer with a short acknowledgement that their request was received.",+ apps: ["Microsoft Outlook"],+ evidence: [+ "clipboard 'Thanks — we've received your request and will follow up within one business day.'",+ "browser.url https://outlook.office.com/mail/support/",+ ],+ confidence: "medium",+ },+ ],+ },+ rubric: {+ mustUseAny: [["outlook/"], ["replytomessage", "senddraftmessage", "createdraftmessage", "replyalltomessage"]],+ forbidden: ["playwright", "browser_", "click", "outlook.office.com", "outlook.office365.com"],+ minInputs: 1,+ minCalculations: 1,+ minActions: 1,+ requiresConfirmation: true,+ },+};++/** Find a slot everyone can make and book a follow-up — must use outlook_calendar, never the browser. */+const coworkCalendarSchedule: SkillBuilderScenario = {+ id: "cowork-calendar-schedule",+ title: "Book a follow-up meeting with the call attendees",+ architecture: "cowork",+ platform: "darwin",+ truth:+ "After a customer call the user opens Outlook Calendar in the browser, checks the two attendees' " ++ "availability next week, and books a 30-minute follow-up. Cowork has no browser automation, so " ++ "the right tools are outlook_calendar/FindMeetingTimes (find a slot everyone can make) and " ++ "outlook_calendar/CreateEvent (book it) — resolving the slot is a calculation and creating the " ++ "event is the mutating action that pauses for confirmation because it invites people. Driving " ++ "the outlook.office.com calendar UI is wrong.",+ analysis: {+ title: "Book a follow-up meeting with the attendees",+ intent:+ "Schedule a 30-minute follow-up meeting with the two attendees from the call by finding a time " ++ "that works for everyone next week and creating the calendar event.",+ intentConfidence: "high",+ intentRationale:+ "Outlook Calendar on the web was used to inspect Priya and Sam's availability next week, and a " ++ "new 30-minute follow-up event was created with both as attendees.",+ steps: [+ {+ id: "s1",+ title: "Open Outlook Calendar",+ detail: "Opened Outlook Calendar on the web to look at next week for a follow-up slot.",+ apps: ["Microsoft Outlook"],+ evidence: ["browser.url https://outlook.office.com/calendar/view/week", "title 'Calendar — Outlook'"],+ confidence: "high",+ },+ {+ id: "s2",+ title: "Check the attendees' availability next week",+ detail: "Compared Priya and Sam's free/busy next week to find a 30-minute slot they can both make.",+ apps: ["Microsoft Outlook"],+ evidence: ["clipboard 'Priya free Tue 2pm, Wed 10am; Sam free Tue 2pm'"],+ confidence: "high",+ },+ {+ id: "s3",+ title: "Pick a slot everyone can make",+ detail: "Chose Tuesday 2:00pm as the slot both attendees are free for.",+ apps: ["Microsoft Outlook"],+ evidence: ["clipboard 'Tue 2:00pm works for both'"],+ confidence: "medium",+ },+ {+ id: "s4",+ title: "Create the 30-minute follow-up event",+ detail: "Created a 30-minute 'Follow-up' calendar event at the chosen slot and invited both attendees.",+ apps: ["Microsoft Outlook"],+ evidence: [+ "browser.url https://outlook.office.com/calendar/deeplink/compose",+ "clipboard 'Follow-up — 30 min — Priya, Sam'",+ ],+ confidence: "medium",+ },+ ],+ },+ rubric: {+ mustUseAny: [+ ["outlook_calendar"],+ ["findmeetingtimes", "listcalendarview", "listevents", "getschedule"],+ ["createevent"],+ ],+ forbidden: ["playwright", "browser_", "click", "outlook.office.com"],+ minInputs: 1,+ minCalculations: 1,+ minActions: 1,+ requiresConfirmation: true,+ },+};++export const skillScenarios: SkillBuilderScenario[] = [+ priceTracker,+ githubIssueTriage,+ coworkTeamsDigest,+ coworkOutlookReply,+ coworkCalendarSchedule,+];\ No newline at end of filediff --git a/src/Library.tsx b/src/Library.tsxindex 88be94f..33430b0 100644--- a/src/Library.tsx+++ b/src/Library.tsx@@ -7,6 +7,7 @@ import type {NarrationStatus,SessionSummary,SkillBuildProgress,+ SkillPlacement,} from "../common/ipc";import type {BuildTarget,@@ -735,6 +736,7 @@ function SkillBuilderView({const [builtName, setBuiltName] = useState("");const canceled = useRef(false);const inFlight = useRef(false);+ const [placement, setPlacement] = useState<SkillPlacement>("install");const updatePlan = useCallback((part: Partial<SkillPlan>) => {setPlan((prev) => (prev ? { ...prev, ...part } : prev));@@ -757,6 +759,9 @@ function SkillBuilderView({setBuiltName(s.name);setExportedPath(s.exportedPath);setArchitecture(s.architecture);+ // We don't persist how it was placed; Cowork can only export, and Scout defaults+ // to install (its primary action), so infer from the architecture on reopen.+ setPlacement(s.architecture === "cowork" ? "export" : "install");if (s.plan) setPlan(s.plan);setPhase("done");} else if (hasSkill) {@@ -792,24 +797,31 @@ function SkillBuilderView({}}, [sessionId, architecture]);- const create = useCallback(async () => {- if (!plan) return;- canceled.current = false;- inFlight.current = true;- setError(null);- setStatusLine("Writing the skill…");- setPhase("creating");- const res = await window.skillRecorder.createSkill(sessionId, plan);- inFlight.current = false;- if (res.ok && res.skill) {- setBuiltName(res.skill.name);- setExportedPath(res.path ?? res.skill.exportedPath ?? "");- setPhase("done");- } else if (!canceled.current) {- setError(res.error ?? "Could not create the skill");- setPhase("plan");- }- }, [sessionId, plan]);+ const place = useCallback(+ async (which: SkillPlacement) => {+ if (!plan) return;+ canceled.current = false;+ inFlight.current = true;+ setError(null);+ setStatusLine(which === "export" ? "Exporting the skill…" : "Writing the skill…");+ setPhase("creating");+ const res = await window.skillRecorder.createSkill(sessionId, plan, which);+ inFlight.current = false;+ if (res.ok && res.skill) {+ setBuiltName(res.skill.name);+ setExportedPath(res.path ?? res.skill.exportedPath ?? "");+ setPlacement(res.placement ?? which);+ setPhase("done");+ } else if (res.canceled) {+ // User dismissed the export folder picker — quietly return to the plan.+ setPhase("plan");+ } else if (!canceled.current) {+ setError(res.error ?? "Could not create the skill");+ setPhase("plan");+ }+ },+ [sessionId, plan],+ );const cancelRun = useCallback(async () => {canceled.current = true;@@ -913,9 +925,12 @@ function SkillBuilderView({<div className="sb-check" aria-hidden>✓</div>- <h2 className="sb-title">Skill ready</h2>+ <h2 className="sb-title">{placement === "install" ? "Added to Scout" : "Skill exported"}</h2><p>- <code className="sb-slug">{builtName}</code> is built for {archLabel(architecture)}.+ <code className="sb-slug">{builtName}</code>{" "}+ {placement === "install"+ ? "is now in Scout — it loads automatically."+ : `is built for ${archLabel(architecture)}. Install it wherever ${archLabel(architecture)} loads skills.`}</p>{exportedPath && <p className="sb-path">{exportedPath}</p>}</div>@@ -926,12 +941,25 @@ function SkillBuilderView({<div className="ws-foot"><span className="foot-status" /><div className="ws-foot-actions">+ {architecture === "scout" && (+ <button+ className="ghost"+ onClick={() => void place("export")}+ title="Download the skill to a folder you choose"+ >+ Export…+ </button>+ )}<buttonclassName="record-cta"- onClick={() => void create()}- title="Create and export the skill"+ onClick={() => void place(architecture === "scout" ? "install" : "export")}+ title={+ architecture === "scout"+ ? "Add the skill to Scout so it loads automatically"+ : "Download the skill to a folder you choose"+ }>- Create & export skill+ {architecture === "scout" ? "Add to Scout" : "Export skill"}</button></div></div>