[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75JXWBYEA38ZWN87G3MZYYR":3,"skill-same:01M75JXWBYEA38ZWN87G3MZYYR":73},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":28,"repositoryHtmlUrl":29,"repositoryHomepageUrl":6,"ownerHtmlUrl":30,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":31,"install":32,"resources":44},"01M75JXWBYEA38ZWN87G3MZYYR","teams-remote",null,"Activate, operate, and tear down a bidirectional bridge between this Copilot CLI session and a Microsoft Teams channel so the user can step away from the terminal. Proactively refreshes the Teams MCP OAuth token and falls back to direct HTTP against the MCP server when the CLI's cached bearer goes stale (solves -32001 timeouts on long-running sessions). Invoke with no args (or team\u002Fchannel names, or a channel URL) to activate. Invoke with the literal argument 'end' to close an active session: posts a final summary, flips away_mode=false, deletes state. Activation triggers: 'teams-remote', 'i'm stepping away', 'ping me in teams', 'post progress to teams', 'afk mode', 'continue in teams', 'headed into a meeting'. End triggers: 'teams-remote end', 'end-teams-remote', 'close-teams-remote', 'stop-teams-remote', 'i'm back at the terminal', 'back from afk', 'done being remote', 'stop posting to teams', 'disable remote mode'.","LiorZivi\u002FZiviDevelopmentMarketplace","LiorZivi","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F20906364?v=4","01M75JSA2QYQCR1ZNNQ16G1ZBG","01M75JSA3RWE8SXTCDVKK8H5TA",2,"Apache-2.0","https:\u002F\u002Fgithub.com\u002FLiorZivi\u002FZiviDevelopmentMarketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fgeneral-ops\u002Fskills\u002Fteams-remote\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: teams-remote\ndescription: \"Activate, operate, and tear down a bidirectional bridge between this Copilot CLI session and a Microsoft Teams channel so the user can step away from the terminal. Proactively refreshes the Teams MCP OAuth token and falls back to direct HTTP against the MCP server when the CLI's cached bearer goes stale (solves -32001 timeouts on long-running sessions). Invoke with no args (or team\u002Fchannel names, or a channel URL) to activate. Invoke with the literal argument 'end' to close an active session: posts a final summary, flips away_mode=false, deletes state. Activation triggers: 'teams-remote', 'i'm stepping away', 'ping me in teams', 'post progress to teams', 'afk mode', 'continue in teams', 'headed into a meeting'. End triggers: 'teams-remote end', 'end-teams-remote', 'close-teams-remote', 'stop-teams-remote', 'i'm back at the terminal', 'back from afk', 'done being remote', 'stop posting to teams', 'disable remote mode'.\"\nargument-hint: \"end | [team-name] [channel-name] | [channel-url]\"\nuser-invocable: true\n---\n\n# teams-remote — Activation, Core Loop & End (with Token Refresh & HTTP Fallback)\n\nYou are the Copilot CLI ↔ Microsoft Teams bridge. You keep a Teams channel in sync with this CLI session while the user is away from the terminal.\n\n`teams-remote` ships two hardening features over a naïve MCP-only bridge:\n\n1. **Proactive OAuth token refresh.** Before every poll tick, the transport layer inspects `~\u002F.copilot\u002Fmcp-oauth-config\u002F*.tokens.json` and refreshes the bearer if it's within 10 minutes of expiry. The new token is written back to disk with camelCase keys.\n2. **Direct-HTTP fallback.** The CLI caches the old bearer in memory at startup and does **not** reload it when the tokens file is refreshed. Once a refresh fires (or the MCP tool call returns `-32001` \u002F 401 \u002F `AADSTS*`), switch to the envelope's `http_fallback` sibling — a JSON-RPC `tools\u002Fcall` against the MCP `serverUrl` with a freshly-refreshed bearer — and stay on HTTP for the rest of the session.\n\n**All writes and reads still flow through the Teams MCP server when it works.** HTTP is strictly a fallback, not the default.\n\n## Dispatch — which mode am I in?\n\n- **End mode** — the user invoked `\u002Fteams-remote end`, or the natural-language request is clearly about tearing down an existing remote session. **Skip straight to the [End Flow](#end-flow) section.**\n- **Activation mode** — anything else. Continue with prerequisites.\n\n## Prerequisites — check FIRST, before anything else (activation mode only)\n\n| Capability | Provider | Used for |\n|---|---|---|\n| **Teams MCP server** | Agency-hosted Copilot CLI sessions auto-provision the `teams-*` MCP tools (signed into M365). | All outbound posts **and** polling (primary transport). |\n| **Teams MCP OAuth config on disk** | `~\u002F.copilot\u002Fmcp-oauth-config\u002F\u003Cname>.json` + sibling `\u003Cname>.tokens.json` (created automatically by the CLI on first auth). | Token refresh + direct-HTTP fallback. |\n\nRequired MCP tools: `teams-ListTeams`, `teams-ListChannels`, `teams-PostChannelMessage`, `teams-ReplyToChannelMessage`, `teams-ListChannelMessageReplies`.\n\n**If ANY of those MCP tools are missing, DO NOT start the remote session.** Print a concise error to the user and stop.\n\nFor **end mode** the MCP is preferred but not strictly required — `end.py` will still clean up local state.\n\n## MCP token refresh & direct-HTTP fallback\n\nThis is the core of the skill. The transport contract:\n\n- **Transport module**: `${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fteams-remote\u002Fteams_transport.py`. Pure stdlib Python (`urllib.request`, `json`, `pathlib`, `time`, `dataclasses`). No third-party deps.\n- **Refresh window**: 10 minutes before `expiresAt`. `poll.py --step tick` calls `ensure_fresh_token(tokens_path)` at the top of every tick. If a refresh fires, state's `transport` is flipped to `\"http\"` and every subsequent envelope signals the switch.\n- **Dual-transport envelopes**: `poll.py` emits every outbound envelope (`poll` tick, `heartbeat`, `progress_post`, the `inject` ack template) with **both** `mcp_call` + `mcp_args` **and** an `http_fallback` sibling of the shape:\n  ```json\n  {\"url\": \"\u003CserverUrl>\",\n   \"body\": {\"jsonrpc\": \"2.0\", \"id\": 1, \"method\": \"tools\u002Fcall\",\n            \"params\": {\"name\": \"teams-ListChannelMessageReplies\",\n                       \"arguments\": {...}}}}\n  ```\n- **When to switch to HTTP** — switch the moment any of these fire:\n  - the envelope carries `\"transport\": \"http\"`, or\n  - the last `mcp_call` returned `-32001` (request timed out), 401, or any error mentioning `AADSTS`.\n  **Once you switch, stay on HTTP for the rest of the session.** The CLI's cached bearer never catches up.\n- **HTTP call mechanics**: POST to `http_fallback.url` with headers determined by `http_fallback.auth`:\n  - `auth: \"bearer\"` (user-managed Teams MCP, OAuth on disk) — send `Authorization: Bearer \u003Caccess_token from the tokens file at http_fallback.tokens_path>`. Tool name in `body.params.name` is fully-qualified (`teams-…`).\n  - `auth: \"none\"` (agency-hosted Teams MCP via local loopback proxy at `http:\u002F\u002F127.0.0.1:\u003Cport>`) — **do NOT send `Authorization`**; the proxy injects M365 auth upstream. Tool name in `body.params.name` is already stripped of the `teams-` prefix (e.g. `ListChannelMessageReplies`) — send it verbatim.\n  Always include:\n  ```\n  Content-Type: application\u002Fjson\n  Accept: application\u002Fjson, text\u002Fevent-stream\n  ```\n  The response body is SSE-formatted with triple-nested JSON. Use `teams_transport.parse_sse_response` or the PowerShell reference parser from `phone-mode` (`Skill-1.txt` §*Robust SSE Response Parsing*). **Never** regex out ids or reply content — unicode escapes (`\\u0022`) will silently break you.\n- **Failure-mode rule**: if SSE parsing returns `None`, treat it as an error, **not** as \"no messages\". Re-post via the native MCP tool is an acceptable retry; a silently-empty reply list is not.\n\n`activate.py`, `ask.py`, and `end.py` follow the same dual-transport contract: `cmd_run` emits `mcp_call` + `http_fallback` siblings on `transport: \"mcp\"`, and strips `mcp_call`\u002F`mcp_args` (leaving only `http_fallback`) once `transport: \"http\"`. The four scripts do not own the transport flip — only `poll.py --step record-mcp-error` does. Scripts emit the call shape; the agent decides which sibling to execute.\n\n## Plugin Paths\n\n- **Plugin root**: `${CLAUDE_PLUGIN_ROOT}`\n- **Activation script**: `${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fteams-remote\u002Factivate.py`\n- **Ask script**: `${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fteams-remote\u002Fask.py`\n- **Poll script**: `${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fteams-remote\u002Fpoll.py`\n- **End script**: `${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fteams-remote\u002Fend.py`\n- **Transport module**: `${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fteams-remote\u002Fteams_transport.py`\n- **State directory**: `~\u002F.copilot\u002Fsession-state\u002F\u003Csession-id>\u002Fplugins\u002Fgeneral-ops\u002Fteams-remote\u002F` (per-session). Hook crash log stays machine-level at `\u003Ctempdir>\u002Fgeneral-ops\u002Fhook-error.log`.\n\n## Resolving the Team and Channel\n\nIdentical to the `teams-remote` skill. Optional persistent config files: `.github\u002Fteams-remote.json` or `~\u002F.copilot\u002Fteams-remote.json` (the `teams-remote.json` files are also read as a fallback for convenience). Keys: `teamId`, `channelId`, `team`, `channel`, `pollIntervalSeconds`, `timeoutMinutes`.\n\n## Activation Flow (two-step handshake)\n\n### Step 1 — `activate.py --step run`\n\n```\npython \"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fteams-remote\u002Factivate.py\" \\\n    --step run --session-id \u003CSID> \\\n    --team-id \u003Cresolved-team-guid> \\\n    --channel-id \u003Cresolved-channel-id> \\\n    [--team \"\u003Cdisplay>\"] [--channel \"\u003Cdisplay>\"] \\\n    [--user-display \"\u003Cname>\"] \\\n    [--user-id \u003Cuser-guid>]\n```\n\n> **Tip — notification hack.** If you pass `--user-id \u003Cguid>` (the Graph user GUID of the away user — discoverable via `teams-ListChannelMembers` or from any `from.userId` in a prior reply), teams-remote will stamp every outbound reply (ack, heartbeat, progress) with a self-@mention. That alone is enough to raise a push notification even though messages are authored on behalf of the signed-in user (who would otherwise be suppressed). Omit `--user-id` to keep the old behaviour. Running sessions can opt in after activation with `poll.py --step set-user-mention --user-id \u003Cguid> --user-display \"\u003Cname>\"`.\n\nEmits one of: `already_active`, `need_input`, `error`, or `post_root` (execute the `mcp_call`, then proceed to step 2).\n\n### Step 2 — `activate.py --step finalize`\n\n```\npython \"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fteams-remote\u002Factivate.py\" \\\n    --step finalize --session-id \u003CSID> \\\n    --root-message-id \u003Cid-from-mcp-response> \\\n    --created-iso \u003CcreatedDateTime-from-mcp-response>\n```\n\nEmits `ready` on success. State is persisted with `transport: \"mcp\"` (the default) and `last_processed_id: \"0\"`.\n\n## Envelope Contract\n\nIf an envelope has `next_step`, run it before yielding the turn. Only `action: \"ended\"` is terminal.\n\n| `action`              | `next_step`   | Meaning                                |\n|-----------------------|---------------|----------------------------------------|\n| `ready` (activate)    | `poll_idle`   | Activated; start idle loop             |\n| `ready` (ask)         | `poll_input`  | Question posted; switch to input poll  |\n| `continue`            | `tick`        | No new replies; tick again             |\n| `heartbeat`           | `tick`        | Long-poll keepalive; tick again        |\n| `mcp_error_recorded`  | `tick`        | Transport flipped; resume on http      |\n| `ended`               | (terminal)    | Session closed                         |\n\n## Behaviour While Away (`away_mode=true`)\n\n### Rule 1 — Route every question through ask.py (two-step)\n\n```\npython \"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fteams-remote\u002Fask.py\" --step run --session-id \u003CSID> --question \"\u003Ctext>\"\npython \"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fteams-remote\u002Fask.py\" --step finalize --session-id \u003CSID> --message-id \u003Cid> --created-iso \u003Ciso>\n```\n\nThen enter the **input-poll** loop via `poll.py --mode input`. Branch on action as in `teams-remote`.\n\n### Rule 2 — Idle polling between tasks\n\n**Preferred: long-poll mode.** Use this when Teams MCP transport is discoverable (the default in agency-hosted and user-authorised sessions):\n\n```\npython \"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fteams-remote\u002Fpoll.py\" --step tick --mode idle --long-poll --session-id \u003CSID>\n```\n\nThis blocks inside the subprocess for up to 10 minutes, doing short internal HTTP GETs. It returns a single envelope:\n\n```\n{\"action\": \"poll_result\", \"mode\": \"idle\", \"replies\": [...], \"timed_out\": \u003Cbool>, \"next_step\": \"process\", ...}\n```\n\nNo `mcp_call` \u002F `mcp_args` \u002F `sleep_seconds` — the blocking wait **is** the sleep, the fetch has already happened. Immediately pipe the envelope into `--step process`:\n\n```\npython \"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fteams-remote\u002Fpoll.py\" --step process --mode idle --session-id \u003CSID> --replies-json '\u003Cpoll_result-envelope-as-json>'\n```\n\n`--step process` accepts the whole envelope (it reads the `replies` key). Branch on the returned action as usual (`inject` \u002F `terminate` \u002F `heartbeat` \u002F `continue`).\n\nWhy long-poll: one forced LLM turn per ~10 min of idle instead of ~60 (collapses ~60× reduction in idle token drain). See `docs\u002FLongPollImplementation-Measurements.md` for measured results.\n\n**Fallback: short-poll mode.** If `--long-poll` is omitted or the transport cannot be discovered, the envelope carries `mcp_call` + `mcp_args` + `sleep_seconds` as before:\n\n```\npython \"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fteams-remote\u002Fpoll.py\" --step tick --mode idle --session-id \u003CSID> --with-sleep\n```\n\nEvery envelope carries `mcp_call` + `mcp_args` and an `http_fallback` sibling (see [MCP token refresh & direct-HTTP fallback](#mcp-token-refresh--direct-http-fallback)). Try `mcp_call` first; switch to `http_fallback` on `-32001` \u002F 401 \u002F `AADSTS*`, or immediately if the envelope's top-level `transport` field is `\"http\"`.\n\nBranch on action (both modes):\n\n- `\"inject\"` — each reply in `replies` becomes a new user prompt. The envelope also carries an `ack_template` — fill in `content` with a short acknowledgement (≤2 sentences, paraphrase what you understood) and post it **in parallel with the first real-work tool call**. See Rule 2a.\n- `\"terminate\"` — jump to the [End Flow](#end-flow) with `--reason remote-triggered`.\n- `\"heartbeat\"` — execute the `mcp_call`; on the next tick pass its id as `--record-own-id \u003Cid> --record-own-kind heartbeat`.\n- `\"continue\"` — loop. If `truncated: true`, warn.\n- `\"poll_result\"` (long-poll only) — already handled above by piping straight into `--step process`; the resulting action will be one of the four above.\n\n#### MCP error handling (-32001 \u002F McpError)\n\nIf a `teams-*` MCP tool call returns `McpError` \u002F `-32001 Request timed out` (live example: `MCP server 'teams': McpError: MCP error -32001: Request timed out`) — or any other `McpError` code — immediately run:\n\n```\npython \"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fteams-remote\u002Fpoll.py\" \\\n  --step record-mcp-error --session-id \u003CSID> \\\n  --code -32001 --message \"Request timed out\"\n```\n\nThis flips `state.transport` to `\"http\"` for the rest of the session and increments `mcp_timeout_streak`. Then re-run `--step tick`: the next envelope will carry `transport: \"http\"` and will have had its `mcp_call`\u002F`mcp_args` stripped, leaving only `http_fallback` as the executable path. Do **not** retry the MCP call in between — it will hang for the full CLI request timeout again.\n\n### Rule 2a — Acknowledge injected messages in parallel with starting work\n\nPost the ack and the first real-work tool call as **parallel** tool calls in a single response so a hung MCP never blocks progress.\n\n### Rule 2b — Every Teams post must carry prefix + self-@mention (non-negotiable)\n\nEvery single message you post to the Teams thread **MUST** include all three pieces below. No exceptions. That covers ack replies, heartbeats, progress posts, the activate root post, the end summary, **and** ad-hoc \u002F free-form replies you compose by hand (answering a user question, status updates, clarification requests, etc.).\n\nThe three pieces:\n\n1. **Visible prefix** — the rendered text begins with the literal string `Copilot agent message:` so the user can tell at a glance that the message came from the agent (distinguishing it from messages they typed themselves).\n2. **In-content self-@mention** — content begins with `@DisplayName` (literal at-sign + the away user's display name from state) before any other visible text. Recommended shape: `@DisplayName Copilot agent message: …`.\n3. **`mentions` argument** — the `teams-ReplyToChannelMessage` \u002F `teams-PostChannelMessage` call (or HTTP-fallback `body.params.arguments.mentions`) carries a JSON-stringified array like `[{\"displayName\":\"Lior Zivi\",\"id\":\"\u003Cguid>\",\"type\":\"user\"}]` with the same id\u002Fdisplay the state carries.\n\nEnvelope-driven posts already include pieces (2) and (3) — `poll.py._apply_mention_hack` sets them and emits a `mention_hint` you can copy. `activate.py` and `end.py` inject them into their summary posts. But (1) — the `Copilot agent message:` prefix — is your responsibility on every post, envelope-driven or ad-hoc. Forgetting any piece breaks the user's notification flow or their ability to identify your posts.\n\n#### Rule 2b.1 — Ad-hoc posts: ALWAYS plain text, NEVER HTML\n\nFor any Teams post you compose by hand (free-form replies, ack content you write into the `ack_template`, answers to questions, status updates, clarifications, etc.) you **MUST**:\n\n- Set `contentType: \"text\"` on the `teams-ReplyToChannelMessage` \u002F `teams-PostChannelMessage` \u002F `teams-SendMessageToChat` call (or `body.params.arguments.contentType: \"text\"` on the HTTP-fallback path).\n- Write the `@DisplayName` mention as **literal plain text** at the start of `content` (e.g. `@Lior Zivi Copilot agent message: ...`). The Teams MCP server expands `@DisplayName` into proper Teams mention markup automatically when the `mentions` argument is also present — you do **not** need to (and **must not**) author `\u003Cat>...\u003C\u002Fat>` tags yourself in ad-hoc posts.\n- Pass the `mentions` JSON-stringified array argument every time. Pull `id` and `displayName` from state (`user_mention_id`, `user_display`) — they're echoed in every poll envelope's `mention_hint`. Forgetting `mentions` means the away user gets no push notification; this is the #1 cause of \"you didn't ping me\".\n- **Never** author raw HTML — no `\u003Cp>`, `\u003Cbr>`, `\u003Cul>`, `\u003Cli>`, `\u003Cb>`, `\u003Ci>`, `\u003Cat>`, `\u003Cdiv>`, etc. Teams renders most hand-rolled HTML inconsistently and often shows the literal tags. Use plain-text formatting only: line breaks via `\\n`, lists via `- ` bullet prefixes, emphasis via `*asterisks*` or ALL-CAPS sparingly.\n\nThe HTML envelopes that `activate.py`, `end.py`, and `poll.py._apply_mention_hack` produce are the **only** sanctioned source of HTML on the wire — they use a tiny, controlled subset (`\u003Cp>\u003Cat>DisplayName\u003C\u002Fat> …\u003C\u002Fp>`) that Teams renders correctly. Do not extend that subset, and do not append HTML to those envelopes' `content` fields — append plain text.\n\n### Rule 3 — Self-filter is by message id, not sender\n\n`poll.py` dedupes against `own_message_ids` (every id we posted: root, questions, progress, heartbeat, summary). **Plus** a new defensive layer: `last_processed_id` in state (a decimal-string of the max `int(reply_id)` ever processed) and a `int(reply_id) > last_processed_id` floor in `_filter_candidates`. Clock-skewed or duplicate timestamps can't re-surface an old reply.\n\n### Rule 4 — Termination\n\n- `\u002Fteams-remote end` runs the [End Flow](#end-flow) with `--reason user-invoked`.\n- `--reason` is a closed enum: `user-invoked` | `remote-triggered` | `session-ended`.\n- `remote-triggered` is used when `poll.py` returns `\"terminate\"` (user replied `end`, `\u002Fteams-remote end`, or `\u002Fteams-remote-end` in Teams).\n\n## Stop-hook contract (do not fight it)\n\nA Stop hook at `scripts\u002Fhooks\u002Fteams_remote_stop.py` fires at the end of every assistant turn. When it detects `away_mode=true` for the active `teams-remote` state file it writes:\n\n```json\n{\"decision\": \"block\", \"reason\": \"teams-remote is active for session \u003CSID> (away_mode=true). Before ending this turn, run the idle-poll cycle...\"}\n```\n\nThe block reason explicitly reminds the agent to switch to `http_fallback` if `transport==http` or the last MCP call errored.\n\n**What this means for you:** treat the block reason as an imperative. Run the idle-poll cycle it describes before trying to stop again. Only `\u002Fteams-remote end` flips `away_mode=false` and lets the hook through.\n\n## End Flow\n\n### Prerequisites (end mode)\n\nTeams MCP is preferred but not required. If unavailable, local state is still cleaned up.\n\n### Step 1 — `end.py --step run`\n\n```\npython \"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fteams-remote\u002Fend.py\" --step run --session-id \u003CSID> --reason user-invoked\n```\n\nPossible actions: `no_session`, `post_summary` (execute `mcp_call` — or `http_fallback` if we've already switched — then proceed to step 2).\n\nIf the MCP\u002FHTTP call fails, still proceed to step 2 — the session is already logically closed.\n\n### Step 2 — `end.py --step finalize`\n\n```\npython \"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fteams-remote\u002Fend.py\" --step finalize --session-id \u003CSID>\n```\n\nDeletes state. Emits `ended`.\n\n### Reason Codes\n\n| `--reason` | When to use |\n|---|---|\n| `user-invoked` | Default. User ran `\u002Fteams-remote end` (or a natural-language end phrase). |\n| `remote-triggered` | Idle-poll matched `end` \u002F `\u002Fteams-remote end` \u002F `\u002Fteams-remote-end` \u002F `\u002Fteams-remote end` \u002F `\u002Fteams-remote-end` in a Teams reply. |\n| `session-ended` | Reserved — currently unused. |\n\n### Reactivation\n\nAfter `ended`, `\u002Fteams-remote` starts a **fresh** activation — no resume.\n\n## Termination Matrix\n\n| Trigger | How it's handled |\n|---|---|\n| User types `\u002Fteams-remote end` (or natural-language end phrase) in the CLI | End Flow with reason `user-invoked` |\n| User replies `end`, `\u002Fteams-remote end`, or `\u002Fteams-remote-end` in the Teams thread | `poll.py` idle action `\"terminate\"` → End Flow with reason `remote-triggered` |\n| CLI session exits without cleanup | Nothing; summary skipped, stale state reaped on next activation |\n\n## Notes\n\n- State schema version is `3`. Any mismatch is treated as \"no session\".\n- State directory: `~\u002F.copilot\u002Fsession-state\u002F\u003Csession-id>\u002Fplugins\u002Fgeneral-ops\u002Fteams-remote\u002F` (per-session, **v1.8.0+**). Files inside: `state.json`, `pending.json`, `activate-pending.json`. Hook-crash log stays machine-level at `\u003Ctempdir>\u002Fgeneral-ops\u002Fhook-error.log`.\n- `teams-ListChannelMessageReplies` caps `maxReplies` at 50. Tighten `pollIntervalSeconds` if truncation becomes a problem.\n- Progress posts are **off by default**. Enable with `\"auto_progress\": true` in the state JSON.\n- **Team\u002Fchannel ambiguity is an error, not a guess.**\n- Transport failures are tolerated: if `find_teams_mcp_config()` returns `None` (no MCP OAuth state on disk yet) `poll.py` logs a one-line note to stderr and emits the envelope without `http_fallback`. You stay on MCP.\n- `--record-own-id` is honoured by both `--step tick` **and** `--step process` (**v1.9.1+**). Earlier builds only persisted it through `process`, which the long-poll fast path bypasses — leading to a tight loop where each just-posted ack\u002Fheartbeat\u002Fprogress reply came back as a new inbound on the next tick. Pass `--record-own-id \u003Cid> [--record-own-kind heartbeat|progress|other]` on whichever step you reach next; it is idempotent.\n","# teams-remote — Activation, Core Loop & End (with Token Refresh & HTTP Fallback)\n\nYou are the Copilot CLI ↔ Microsoft Teams bridge. You keep a Teams channel in sync with this CLI session while the user is away from the terminal.\n\n`teams-remote` ships two hardening features over a naïve MCP-only bridge:\n\n1. **Proactive OAuth token refresh.** Before every poll tick, the transport layer inspects `~\u002F.copilot\u002Fmcp-oauth-config\u002F*.tokens.json` and refreshes the bearer if it's within 10 minutes of expiry. The new token is written back to disk with camelCase keys.\n2. **Direct-HTTP fallback.** The CLI caches the old bearer in memory at startup and does **not** reload it when the tokens file is refreshed. Once a refresh fires (or the MCP tool call returns `-32001` \u002F 401 \u002F `AADSTS*`), switch to the envelope's `http_fallback` sibling — a JSON-RPC `tools\u002Fcall` against the MCP `serverUrl` with a freshly-refreshed bearer — and stay on HTTP for the rest of the session.\n\n**All writes and reads still flow through the Teams MCP server when it works.** HTTP is strictly a fallback, not the default.\n\n## Dispatch — which mode am I in?\n\n- **End mode** — the user invoked `\u002Fteams-remote end`, or the natural-language request is clearly about tearing down an existing remote session. **Skip straight to the [End Flow](#end-flow) section.**\n- **Activation mode** — anything else. Continue with prerequisites.\n\n## Prerequisites — check FIRST, before anything else (activation mode only)\n\n| Capability | Provider | Used for |\n|---|---|---|\n| **Teams MCP server** | Agency-hosted Copilot CLI sessions auto-provision the `teams-*` MCP tools (signed into M365). | All outbound posts **and** polling (primary transport). |\n| **Teams MCP OAuth config on disk** | `~\u002F.copilot\u002Fmcp-oauth-config\u002F\u003Cname>.json` + sibling `\u003Cname>.tokens.json` (created automatically by the CLI on first auth). | Token refresh + direct-HTTP fallback. |\n\nRequired MCP tools: `teams-ListTeams`, `teams-ListChannels`, `teams-PostChannelMessage`, `teams-ReplyToChannelMessage`, `teams-ListChannelMessageReplies`.\n\n**If ANY of those MCP tools are missing, DO NOT start the remote session.** Print a concise error to the user and stop.\n\nFor **end mode** the MCP is preferred but not strictly required — `end.py` will still clean up local state.\n\n## MCP token refresh & direct-HTTP fallback\n\nThis is the core of the skill. The transport contract:\n\n- **Transport module**: `${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fteams-remote\u002Fteams_transport.py`. Pure stdlib Python (`urllib.request`, `json`, `pathlib`, `time`, `dataclasses`). No third-party deps.\n- **Refresh window**: 10 minutes before `expiresAt`. `poll.py --step tick` calls `ensure_fresh_token(tokens_path)` at the top of every tick. If a refresh fires, state's `transport` is flipped to `\"http\"` and every subsequent envelope signals the switch.\n- **Dual-transport envelopes**: `poll.py` emits every outbound envelope (`poll` tick, `heartbeat`, `progress_post`, the `inject` ack template) with **both** `mcp_call` + `mcp_args` **and** an `http_fallback` sibling of the shape:\n  ```json\n  {\"url\": \"\u003CserverUrl>\",\n   \"body\": {\"jsonrpc\": \"2.0\", \"id\": 1, \"method\": \"tools\u002Fcall\",\n            \"params\": {\"name\": \"teams-ListChannelMessageReplies\",\n                       \"arguments\": {...}}}}\n  ```\n- **When to switch to HTTP** — switch the moment any of these fire:\n  - the envelope carries `\"transport\": \"http\"`, or\n  - the last `mcp_call` returned `-32001` (request timed out), 401, or any error mentioning `AADSTS`.\n  **Once you switch, stay on HTTP for the rest of the session.** The CLI's cached bearer never catches up.\n- **HTTP call mechanics**: POST to `http_fallback.url` with headers determined by `http_fallback.auth`:\n  - `auth: \"bearer\"` (user-managed Teams MCP, OAuth on disk) — send `Authorization: Bearer \u003Caccess_token from the tokens file at http_fallback.tokens_path>`. Tool name in `body.params.name` is fully-qualified (`teams-…`).\n  - `auth: \"none\"` (agency-hosted Teams MCP via local loopback proxy at `http:\u002F\u002F127.0.0.1:\u003Cport>`) — **do NOT send `Authorization`**; the proxy injects M365 auth upstream. Tool name in `body.params.name` is already stripped of the `teams-` prefix (e.g. `ListChannelMessageReplies`) — send it verbatim.\n  Always include:\n  ```\n  Content-Type: application\u002Fjson\n  Accept: application\u002Fjson, text\u002Fevent-stream\n  ```\n  The response body is SSE-formatted with triple-nested JSON. Use `teams_transport.parse_sse_response` or the PowerShell reference parser from `phone-mode` (`Skill-1.txt` §*Robust SSE Response Parsing*). **Never** regex out ids or reply content — unicode escapes (`\\u0022`) will silently break you.\n- **Failure-mode rule**: if SSE parsing returns `None`, treat it as an error, **not** as \"no messages\". Re-post via the native MCP tool is an acceptable retry; a silently-empty reply list is not.\n\n`activate.py`, `ask.py`, and `end.py` follow the same dual-transport contract: `cmd_run` emits `mcp_call` + `http_fallback` siblings on `transport: \"mcp\"`, and strips `mcp_call`\u002F`mcp_args` (leaving only `http_fallback`) once `transport: \"http\"`. The four scripts do not own the transport flip — only `poll.py --step record-mcp-error` does. Scripts emit the call shape; the agent decides which sibling to execute.\n\n## Plugin Paths\n\n- **Plugin root**: `${CLAUDE_PLUGIN_ROOT}`\n- **Activation script**: `${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fteams-remote\u002Factivate.py`\n- **Ask script**: `${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fteams-remote\u002Fask.py`\n- **Poll script**: `${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fteams-remote\u002Fpoll.py`\n- **End script**: `${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fteams-remote\u002Fend.py`\n- **Transport module**: `${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fteams-remote\u002Fteams_transport.py`\n- **State directory**: `~\u002F.copilot\u002Fsession-state\u002F\u003Csession-id>\u002Fplugins\u002Fgeneral-ops\u002Fteams-remote\u002F` (per-session). Hook crash log stays machine-level at `\u003Ctempdir>\u002Fgeneral-ops\u002Fhook-error.log`.\n\n## Resolving the Team and Channel\n\nIdentical to the `teams-remote` skill. Optional persistent config files: `.github\u002Fteams-remote.json` or `~\u002F.copilot\u002Fteams-remote.json` (the `teams-remote.json` files are also read as a fallback for convenience). Keys: `teamId`, `channelId`, `team`, `channel`, `pollIntervalSeconds`, `timeoutMinutes`.\n\n## Activation Flow (two-step handshake)\n\n### Step 1 — `activate.py --step run`\n\n```\npython \"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fteams-remote\u002Factivate.py\" \\\n    --step run --session-id \u003CSID> \\\n    --team-id \u003Cresolved-team-guid> \\\n    --channel-id \u003Cresolved-channel-id> \\\n    [--team \"\u003Cdisplay>\"] [--channel \"\u003Cdisplay>\"] \\\n    [--user-display \"\u003Cname>\"] \\\n    [--user-id \u003Cuser-guid>]\n```\n\n> **Tip — notification hack.** If you pass `--user-id \u003Cguid>` (the Graph user GUID of the away user — discoverable via `teams-ListChannelMembers` or from any `from.userId` in a prior reply), teams-remote will stamp every outbound reply (ack, heartbeat, progress) with a self-@mention. That alone is enough to raise a push notification even though messages are authored on behalf of the signed-in user (who would otherwise be suppressed). Omit `--user-id` to keep the old behaviour. Running sessions can opt in after activation with `poll.py --step set-user-mention --user-id \u003Cguid> --user-display \"\u003Cname>\"`.\n\nEmits one of: `already_active`, `need_input`, `error`, or `post_root` (execute the `mcp_call`, then proceed to step 2).\n\n### Step 2 — `activate.py --step finalize`\n\n```\npython \"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fteams-remote\u002Factivate.py\" \\\n    --step finalize --session-id \u003CSID> \\\n    --root-message-id \u003Cid-from-mcp-response> \\\n    --created-iso \u003CcreatedDateTime-from-mcp-response>\n```\n\nEmits `ready` on success. State is persisted with `transport: \"mcp\"` (the default) and `last_processed_id: \"0\"`.\n\n## Envelope Contract\n\nIf an envelope has `next_step`, run it before yielding the turn. Only `action: \"ended\"` is terminal.\n\n| `action`              | `next_step`   | Meaning                                |\n|-----------------------|---------------|----------------------------------------|\n| `ready` (activate)    | `poll_idle`   | Activated; start idle loop             |\n| `ready` (ask)         | `poll_input`  | Question posted; switch to input poll  |\n| `continue`            | `tick`        | No new replies; tick again             |\n| `heartbeat`           | `tick`        | Long-poll keepalive; tick again        |\n| `mcp_error_recorded`  | `tick`        | Transport flipped; resume on http      |\n| `ended`               | (terminal)    | Session closed                         |\n\n## Behaviour While Away (`away_mode=true`)\n\n### Rule 1 — Route every question through ask.py (two-step)\n\n```\npython \"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fteams-remote\u002Fask.py\" --step run --session-id \u003CSID> --question \"\u003Ctext>\"\npython \"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fteams-remote\u002Fask.py\" --step finalize --session-id \u003CSID> --message-id \u003Cid> --created-iso \u003Ciso>\n```\n\nThen enter the **input-poll** loop via `poll.py --mode input`. Branch on action as in `teams-remote`.\n\n### Rule 2 — Idle polling between tasks\n\n**Preferred: long-poll mode.** Use this when Teams MCP transport is discoverable (the default in agency-hosted and user-authorised sessions):\n\n```\npython \"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fteams-remote\u002Fpoll.py\" --step tick --mode idle --long-poll --session-id \u003CSID>\n```\n\nThis blocks inside the subprocess for up to 10 minutes, doing short internal HTTP GETs. It returns a single envelope:\n\n```\n{\"action\": \"poll_result\", \"mode\": \"idle\", \"replies\": [...], \"timed_out\": \u003Cbool>, \"next_step\": \"process\", ...}\n```\n\nNo `mcp_call` \u002F `mcp_args` \u002F `sleep_seconds` — the blocking wait **is** the sleep, the fetch has already happened. Immediately pipe the envelope into `--step process`:\n\n```\npython \"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fteams-remote\u002Fpoll.py\" --step process --mode idle --session-id \u003CSID> --replies-json '\u003Cpoll_result-envelope-as-json>'\n```\n\n`--step process` accepts the whole envelope (it reads the `replies` key). Branch on the returned action as usual (`inject` \u002F `terminate` \u002F `heartbeat` \u002F `continue`).\n\nWhy long-poll: one forced LLM turn per ~10 min of idle instead of ~60 (collapses ~60× reduction in idle token drain). See `docs\u002FLongPollImplementation-Measurements.md` for measured results.\n\n**Fallback: short-poll mode.** If `--long-poll` is omitted or the transport cannot be discovered, the envelope carries `mcp_call` + `mcp_args` + `sleep_seconds` as before:\n\n```\npython \"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fteams-remote\u002Fpoll.py\" --step tick --mode idle --session-id \u003CSID> --with-sleep\n```\n\nEvery envelope carries `mcp_call` + `mcp_args` and an `http_fallback` sibling (see [MCP token refresh & direct-HTTP fallback](#mcp-token-refresh--direct-http-fallback)). Try `mcp_call` first; switch to `http_fallback` on `-32001` \u002F 401 \u002F `AADSTS*`, or immediately if the envelope's top-level `transport` field is `\"http\"`.\n\nBranch on action (both modes):\n\n- `\"inject\"` — each reply in `replies` becomes a new user prompt. The envelope also carries an `ack_template` — fill in `content` with a short acknowledgement (≤2 sentences, paraphrase what you understood) and post it **in parallel with the first real-work tool call**. See Rule 2a.\n- `\"terminate\"` — jump to the [End Flow](#end-flow) with `--reason remote-triggered`.\n- `\"heartbeat\"` — execute the `mcp_call`; on the next tick pass its id as `--record-own-id \u003Cid> --record-own-kind heartbeat`.\n- `\"continue\"` — loop. If `truncated: true`, warn.\n- `\"poll_result\"` (long-poll only) — already handled above by piping straight into `--step process`; the resulting action will be one of the four above.\n\n#### MCP error handling (-32001 \u002F McpError)\n\nIf a `teams-*` MCP tool call returns `McpError` \u002F `-32001 Request timed out` (live example: `MCP server 'teams': McpError: MCP error -32001: Request timed out`) — or any other `McpError` code — immediately run:\n\n```\npython \"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fteams-remote\u002Fpoll.py\" \\\n  --step record-mcp-error --session-id \u003CSID> \\\n  --code -32001 --message \"Request timed out\"\n```\n\nThis flips `state.transport` to `\"http\"` for the rest of the session and increments `mcp_timeout_streak`. Then re-run `--step tick`: the next envelope will carry `transport: \"http\"` and will have had its `mcp_call`\u002F`mcp_args` stripped, leaving only `http_fallback` as the executable path. Do **not** retry the MCP call in between — it will hang for the full CLI request timeout again.\n\n### Rule 2a — Acknowledge injected messages in parallel with starting work\n\nPost the ack and the first real-work tool call as **parallel** tool calls in a single response so a hung MCP never blocks progress.\n\n### Rule 2b — Every Teams post must carry prefix + self-@mention (non-negotiable)\n\nEvery single message you post to the Teams thread **MUST** include all three pieces below. No exceptions. That covers ack replies, heartbeats, progress posts, the activate root post, the end summary, **and** ad-hoc \u002F free-form replies you compose by hand (answering a user question, status updates, clarification requests, etc.).\n\nThe three pieces:\n\n1. **Visible prefix** — the rendered text begins with the literal string `Copilot agent message:` so the user can tell at a glance that the message came from the agent (distinguishing it from messages they typed themselves).\n2. **In-content self-@mention** — content begins with `@DisplayName` (literal at-sign + the away user's display name from state) before any other visible text. Recommended shape: `@DisplayName Copilot agent message: …`.\n3. **`mentions` argument** — the `teams-ReplyToChannelMessage` \u002F `teams-PostChannelMessage` call (or HTTP-fallback `body.params.arguments.mentions`) carries a JSON-stringified array like `[{\"displayName\":\"Lior Zivi\",\"id\":\"\u003Cguid>\",\"type\":\"user\"}]` with the same id\u002Fdisplay the state carries.\n\nEnvelope-driven posts already include pieces (2) and (3) — `poll.py._apply_mention_hack` sets them and emits a `mention_hint` you can copy. `activate.py` and `end.py` inject them into their summary posts. But (1) — the `Copilot agent message:` prefix — is your responsibility on every post, envelope-driven or ad-hoc. Forgetting any piece breaks the user's notification flow or their ability to identify your posts.\n\n#### Rule 2b.1 — Ad-hoc posts: ALWAYS plain text, NEVER HTML\n\nFor any Teams post you compose by hand (free-form replies, ack content you write into the `ack_template`, answers to questions, status updates, clarifications, etc.) you **MUST**:\n\n- Set `contentType: \"text\"` on the `teams-ReplyToChannelMessage` \u002F `teams-PostChannelMessage` \u002F `teams-SendMessageToChat` call (or `body.params.arguments.contentType: \"text\"` on the HTTP-fallback path).\n- Write the `@DisplayName` mention as **literal plain text** at the start of `content` (e.g. `@Lior Zivi Copilot agent message: ...`). The Teams MCP server expands `@DisplayName` into proper Teams mention markup automatically when the `mentions` argument is also present — you do **not** need to (and **must not**) author `\u003Cat>...\u003C\u002Fat>` tags yourself in ad-hoc posts.\n- Pass the `mentions` JSON-stringified array argument every time. Pull `id` and `displayName` from state (`user_mention_id`, `user_display`) — they're echoed in every poll envelope's `mention_hint`. Forgetting `mentions` means the away user gets no push notification; this is the #1 cause of \"you didn't ping me\".\n- **Never** author raw HTML — no `\u003Cp>`, `\u003Cbr>`, `\u003Cul>`, `\u003Cli>`, `\u003Cb>`, `\u003Ci>`, `\u003Cat>`, `\u003Cdiv>`, etc. Teams renders most hand-rolled HTML inconsistently and often shows the literal tags. Use plain-text formatting only: line breaks via `\\n`, lists via `- ` bullet prefixes, emphasis via `*asterisks*` or ALL-CAPS sparingly.\n\nThe HTML envelopes that `activate.py`, `end.py`, and `poll.py._apply_mention_hack` produce are the **only** sanctioned source of HTML on the wire — they use a tiny, controlled subset (`\u003Cp>\u003Cat>DisplayName\u003C\u002Fat> …\u003C\u002Fp>`) that Teams renders correctly. Do not extend that subset, and do not append HTML to those envelopes' `content` fields — append plain text.\n\n### Rule 3 — Self-filter is by message id, not sender\n\n`poll.py` dedupes against `own_message_ids` (every id we posted: root, questions, progress, heartbeat, summary). **Plus** a new defensive layer: `last_processed_id` in state (a decimal-string of the max `int(reply_id)` ever processed) and a `int(reply_id) > last_processed_id` floor in `_filter_candidates`. Clock-skewed or duplicate timestamps can't re-surface an old reply.\n\n### Rule 4 — Termination\n\n- `\u002Fteams-remote end` runs the [End Flow](#end-flow) with `--reason user-invoked`.\n- `--reason` is a closed enum: `user-invoked` | `remote-triggered` | `session-ended`.\n- `remote-triggered` is used when `poll.py` returns `\"terminate\"` (user replied `end`, `\u002Fteams-remote end`, or `\u002Fteams-remote-end` in Teams).\n\n## Stop-hook contract (do not fight it)\n\nA Stop hook at `scripts\u002Fhooks\u002Fteams_remote_stop.py` fires at the end of every assistant turn. When it detects `away_mode=true` for the active `teams-remote` state file it writes:\n\n```json\n{\"decision\": \"block\", \"reason\": \"teams-remote is active for session \u003CSID> (away_mode=true). Before ending this turn, run the idle-poll cycle...\"}\n```\n\nThe block reason explicitly reminds the agent to switch to `http_fallback` if `transport==http` or the last MCP call errored.\n\n**What this means for you:** treat the block reason as an imperative. Run the idle-poll cycle it describes before trying to stop again. Only `\u002Fteams-remote end` flips `away_mode=false` and lets the hook through.\n\n## End Flow\n\n### Prerequisites (end mode)\n\nTeams MCP is preferred but not required. If unavailable, local state is still cleaned up.\n\n### Step 1 — `end.py --step run`\n\n```\npython \"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fteams-remote\u002Fend.py\" --step run --session-id \u003CSID> --reason user-invoked\n```\n\nPossible actions: `no_session`, `post_summary` (execute `mcp_call` — or `http_fallback` if we've already switched — then proceed to step 2).\n\nIf the MCP\u002FHTTP call fails, still proceed to step 2 — the session is already logically closed.\n\n### Step 2 — `end.py --step finalize`\n\n```\npython \"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fteams-remote\u002Fend.py\" --step finalize --session-id \u003CSID>\n```\n\nDeletes state. Emits `ended`.\n\n### Reason Codes\n\n| `--reason` | When to use |\n|---|---|\n| `user-invoked` | Default. User ran `\u002Fteams-remote end` (or a natural-language end phrase). |\n| `remote-triggered` | Idle-poll matched `end` \u002F `\u002Fteams-remote end` \u002F `\u002Fteams-remote-end` \u002F `\u002Fteams-remote end` \u002F `\u002Fteams-remote-end` in a Teams reply. |\n| `session-ended` | Reserved — currently unused. |\n\n### Reactivation\n\nAfter `ended`, `\u002Fteams-remote` starts a **fresh** activation — no resume.\n\n## Termination Matrix\n\n| Trigger | How it's handled |\n|---|---|\n| User types `\u002Fteams-remote end` (or natural-language end phrase) in the CLI | End Flow with reason `user-invoked` |\n| User replies `end`, `\u002Fteams-remote end`, or `\u002Fteams-remote-end` in the Teams thread | `poll.py` idle action `\"terminate\"` → End Flow with reason `remote-triggered` |\n| CLI session exits without cleanup | Nothing; summary skipped, stale state reaped on next activation |\n\n## Notes\n\n- State schema version is `3`. Any mismatch is treated as \"no session\".\n- State directory: `~\u002F.copilot\u002Fsession-state\u002F\u003Csession-id>\u002Fplugins\u002Fgeneral-ops\u002Fteams-remote\u002F` (per-session, **v1.8.0+**). Files inside: `state.json`, `pending.json`, `activate-pending.json`. Hook-crash log stays machine-level at `\u003Ctempdir>\u002Fgeneral-ops\u002Fhook-error.log`.\n- `teams-ListChannelMessageReplies` caps `maxReplies` at 50. Tighten `pollIntervalSeconds` if truncation becomes a problem.\n- Progress posts are **off by default**. Enable with `\"auto_progress\": true` in the state JSON.\n- **Team\u002Fchannel ambiguity is an error, not a guess.**\n- Transport failures are tolerated: if `find_teams_mcp_config()` returns `None` (no MCP OAuth state on disk yet) `poll.py` logs a one-line note to stderr and emits the envelope without `http_fallback`. You stay on MCP.\n- `--record-own-id` is honoured by both `--step tick` **and** `--step process` (**v1.9.1+**). Earlier builds only persisted it through `process`, which the long-poll fast path bypasses — leading to a tight loop where each just-posted ack\u002Fheartbeat\u002Fprogress reply came back as a new inbound on the next tick. Pass `--record-own-id \u003Cid> [--record-own-kind heartbeat|progress|other]` on whichever step you reach next; it is idempotent.\n",{"name":5,"description":7,"argument-hint":23,"user-invocable":24},"end | [team-name] [channel-name] | [channel-url]",true,"main","b0ad4fe6bb632e7113e406e43ecab014c27535df","plugins\u002Fgeneral-ops\u002Fskills\u002Fteams-remote",0,"https:\u002F\u002Fgithub.com\u002FLiorZivi\u002FZiviDevelopmentMarketplace","https:\u002F\u002Fgithub.com\u002FLiorZivi","2026-11-07 21:50:56",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":24},[34,37,40],{"tool":35,"command":36},"npx","npx skills add LiorZivi\u002FZiviDevelopmentMarketplace --skill teams-remote",{"tool":38,"command":39},"bunx","bunx skills add LiorZivi\u002FZiviDevelopmentMarketplace --skill teams-remote",{"tool":41,"command":42},"pnpm","pnpm dlx skills add LiorZivi\u002FZiviDevelopmentMarketplace --skill teams-remote","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FLiorZivi\u002FZiviDevelopmentMarketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fgeneral-ops\u002Fskills\u002Fteams-remote\u002FSKILL.md",[45,51,55,59,63,69],{"path":46,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":49,"sourceHtmlUrl":50},"docs\u002FLongPollImplementation-Measurements.md","REFERENCE","参考文档",9372,"https:\u002F\u002Fgithub.com\u002FLiorZivi\u002FZiviDevelopmentMarketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fgeneral-ops\u002Fskills\u002Fteams-remote\u002Fdocs\u002FLongPollImplementation-Measurements.md",{"path":52,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":53,"sourceHtmlUrl":54},"docs\u002Fteams-remote-long-poll-flow.md",11877,"https:\u002F\u002Fgithub.com\u002FLiorZivi\u002FZiviDevelopmentMarketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fgeneral-ops\u002Fskills\u002Fteams-remote\u002Fdocs\u002Fteams-remote-long-poll-flow.md",{"path":56,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":57,"sourceHtmlUrl":58},"docs\u002FteamsMCP32001ErrorExplanation.md",6069,"https:\u002F\u002Fgithub.com\u002FLiorZivi\u002FZiviDevelopmentMarketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fgeneral-ops\u002Fskills\u002Fteams-remote\u002Fdocs\u002FteamsMCP32001ErrorExplanation.md",{"path":60,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":61,"sourceHtmlUrl":62},"learn\u002FTeamsRemoteSkill.md",32427,"https:\u002F\u002Fgithub.com\u002FLiorZivi\u002FZiviDevelopmentMarketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fgeneral-ops\u002Fskills\u002Fteams-remote\u002Flearn\u002FTeamsRemoteSkill.md",{"path":64,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":67,"sourceHtmlUrl":68},"learn\u002FTeamsRemoteSkill.pptx","ASSET","资产文件",997662,"https:\u002F\u002Fgithub.com\u002FLiorZivi\u002FZiviDevelopmentMarketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fgeneral-ops\u002Fskills\u002Fteams-remote\u002Flearn\u002FTeamsRemoteSkill.pptx",{"path":70,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":71,"sourceHtmlUrl":72},"Plans\u002Fteams-remote-stop-hook-isolation-fix-Plan.md",13004,"https:\u002F\u002Fgithub.com\u002FLiorZivi\u002FZiviDevelopmentMarketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fgeneral-ops\u002Fskills\u002Fteams-remote\u002FPlans\u002Fteams-remote-stop-hook-isolation-fix-Plan.md",[74,81,86,95,103,110],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":18},"01M75JZ4GKYCD3RBB0VH9SZJKX","my-skill","SKILL_DESCRIPTION — when should Claude load this skill?","https:\u002F\u002Fgithub.com\u002FLiorZivi\u002FZiviDevelopmentMarketplace\u002Fblob\u002Fmain\u002Ftemplates\u002Fplugin-full\u002Fskills\u002Fmy-skill\u002FSKILL.md",[],[],{"skillNo":82,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":18},"01M75JZ345QQFV2NHYWFQSTTQG","https:\u002F\u002Fgithub.com\u002FLiorZivi\u002FZiviDevelopmentMarketplace\u002Fblob\u002Fmain\u002Ftemplates\u002Fplugin-basic\u002Fskills\u002Fmy-skill\u002FSKILL.md",[],[],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":90,"licenseFileUrl":91,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":18},"01M75JYVVAS823VXX1KC5P0R2Q","humanizer","Remove signs of AI-generated writing from text. Use when editing or reviewing\ntext to make it sound more natural and human-written. Based on Wikipedia's\ncomprehensive \"Signs of AI writing\" guide. Detects and fixes patterns including:\ninflated symbolism, promotional language, superficial -ing analyses, vague\nattributions, em dash overuse, rule of three, AI vocabulary words, passive\nvoice, negative parallelisms, and filler phrases.","MIT","https:\u002F\u002Fgithub.com\u002FLiorZivi\u002FZiviDevelopmentMarketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fremote-plugin-blader\u002Fskills\u002Fhumanizer\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FLiorZivi\u002FZiviDevelopmentMarketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fremote-plugin-blader\u002Fskills\u002Fhumanizer\u002FSKILL.md",[],[],{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":90,"licenseFileUrl":99,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":18},"01M75JYPHMG5V58X4CW4FAA6M6","deep-research","Use when the user needs multi-source research with citation tracking, evidence persistence, and structured report generation. Triggers on \"deep research\", \"comprehensive analysis\", \"research report\", \"compare X vs Y\", \"analyze trends\", or \"state of the art\". Not for simple lookups, debugging, or questions answerable with 1-2 searches.","https:\u002F\u002Fgithub.com\u002FLiorZivi\u002FZiviDevelopmentMarketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fremote-plugin-199-biotechnologies\u002Fskills\u002Fdeep-research\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FLiorZivi\u002FZiviDevelopmentMarketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fremote-plugin-199-biotechnologies\u002Fskills\u002Fdeep-research\u002FSKILL.md",[],[],{"skillNo":104,"name":105,"nameZh":6,"description":106,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":107,"categories":108,"keywords":109,"publishedAt":18},"01M75JYDYT6EBNY4SYMCG0MWP8","ai-local-diffusion-invoker","Generate images locally on the user's own NVIDIA GPU by invoking a separately-installed LocalAIExecution `localai` CLI (FLUX text-to-image) through its stable --json subprocess contract. This skill vendors NONE of LocalAIExecution's code — it discovers the external tool at runtime and shells out to it. Use when the user wants to create\u002Fgenerate an image, render a picture from a text prompt, run local text-to-image \u002F diffusion \u002F FLUX, or make art on their own GPU without cloud or paid APIs. Triggers on: 'generate an image of X', 'create a picture of X', 'render X locally', 'make art of X', 'text-to-image X', 'run FLUX on X', 'local diffusion X'.","https:\u002F\u002Fgithub.com\u002FLiorZivi\u002FZiviDevelopmentMarketplace\u002Fblob\u002Fmain\u002Fplugins\u002Flocal-ai\u002Fskills\u002Fai-local-diffusion-invoker\u002FSKILL.md",[],[],{"skillNo":111,"name":112,"nameZh":6,"description":113,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":114,"categories":115,"keywords":116,"publishedAt":18},"01M75JY5TANS9YPMHBH0DANXGM","telegram-remote","Activate, operate, and tear down a bidirectional bridge between this Copilot CLI session and a Telegram bot DM so the user can step away from the terminal. Works from any repository and needs only a Telegram bot token plus chat ID. Posts meaningful progress, routes questions, uploads requested local files, and injects Telegram replies back into the session. Invoke with no args to activate or with 'end' to close an active session. Activation triggers: 'telegram-remote', 'i'm stepping away', 'ping me on telegram', 'post progress to telegram', 'afk mode', 'continue on telegram', 'headed into a meeting'. End triggers: 'telegram-remote end', 'end-telegram-remote', 'stop-telegram-remote', 'i'm back at the terminal', 'back from afk', 'stop posting to telegram', 'disable remote mode'.","https:\u002F\u002Fgithub.com\u002FLiorZivi\u002FZiviDevelopmentMarketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fgeneral-ops\u002Fskills\u002Ftelegram-remote\u002FSKILL.md",[],[]]