@polygraph/claude-plugin 0.4.26 → 0.4.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polygraph",
3
- "version": "0.4.26",
3
+ "version": "0.4.28",
4
4
  "description": "AI agent skills and subagents for Polygraph multi-repo coordination",
5
5
  "author": {
6
6
  "name": "Narwhal Technologies Inc",
@@ -27,11 +27,12 @@ The main agent provides these parameters in the prompt:
27
27
  | `repo` | Repository to delegate to (e.g., `org/repo-name`) |
28
28
  | `instruction` | The task instruction for the child agent |
29
29
  | `context` | (Optional) Additional context to pass to the child agent |
30
- | `taskId` | (Optional) Existing active task to route a user-approved follow-up to; omit on the first call for a new run |
31
30
 
32
31
  ## Delegating work
33
32
 
34
- Call the `spawn_agent` tool to start a child agent on the repo or to route an explicit follow-up to an active task. If the main agent supplied a `taskId` - meaning this is a user-approved follow-up turn against an already active task - forward it unchanged; otherwise omit `taskId` and a new child run is started.
33
+ Call the `spawn_agent` tool to start a child agent on the repo or to send a follow-up to an active task. Follow-up routing is automatic: if the repo already has an active child task (working or paused on input), the orchestrator delivers your `instruction` to that task as a follow-up message; otherwise it starts a new child run.
34
+
35
+ `repo` must be a repository other than the one the parent agent is working in — never delegate into the parent's own repo. A repo has at most one active child: while one is active, any `spawn_agent` call for that repo is routed to it as a follow-up rather than starting a second run.
35
36
 
36
37
  **Resume/reconstruction is read-only.** If the parent asks you to resume, reconnect, restore, or reconstruct a preserved session without an explicit new change request from the user, do not call `spawn_agent` to continue work. Use `show_agent` only as needed to read status/log context, return a concise restoration summary, and stop. After resuming, wait for explicit user instructions before any child agent makes changes.
37
38
 
@@ -40,8 +41,7 @@ spawn_agent(
40
41
  sessionId: "<sessionId>",
41
42
  repo: "<repo>",
42
43
  instruction: "<instruction>",
43
- context: "<context>",
44
- taskId: "<taskId>" // optional - pass only for a user-approved follow-up to an active task
44
+ context: "<context>"
45
45
  )
46
46
  ```
47
47
 
@@ -87,8 +87,6 @@ After calling `spawn_agent`, parse the structured JSON response:
87
87
  { "taskId": "…", "message": "…", "status": "delegated" }
88
88
  ```
89
89
 
90
- Store the returned `taskId`. You will pass it back to `spawn_agent` on any follow-up turn so the orchestrator routes the message to the same active task instead of starting a new run.
91
-
92
90
  Then poll `show_agent` on a backoff cadence. **Do not pass a `tail` argument** — the tool's default is sized for status polling. Only set `tail` if you have a specific reason (e.g., the default truncated output you actually need to inspect, or you are hunting for an earlier failure that scrolled off). Never ratchet `tail` upward across polls; that is what causes the polling loop to flood your context window.
93
91
 
94
92
  For each child in the response (field: `children[]`), inspect:
@@ -105,7 +103,7 @@ State machine:
105
103
  - Read `child.inputRequiredQuestion`.
106
104
  - Surface this question verbatim to the parent/user: "The child agent in `{child.repoFullName}` needs input: {child.inputRequiredQuestion}".
107
105
  - Wait for the parent/user to supply an answer.
108
- - Call `spawn_agent` again with `instruction: <the answer>` and `taskId: <stored taskId>` so the orchestrator routes the answer to the same active task.
106
+ - Call `spawn_agent` again with the same `repo` and `instruction: <the answer>` the orchestrator routes it to the active task automatically.
109
107
  - Resume polling.
110
108
 
111
109
  <!-- Claude and Codex parents handle permission gates via the native MCP elicitation dialog
@@ -39,7 +39,7 @@ The main agent provides these parameters in the prompt:
39
39
 
40
40
  Additionally, the main agent may pass in repos via **MCP resource syntax** (e.g. `polygraph://repos/org/repo-name`).
41
41
 
42
- **Direct-add rule:** If `sessionId` is provided and the prompt names exact repositories to add by ID, short name, full name, GitHub `owner/repo` slug, URL-like slug, or MCP resource syntax, call `add_repo` directly with those refs in `repoIds`. Do NOT call `list_repos`, do NOT ask for candidates, and do NOT require candidate discovery first. Candidate discovery is account-repo-only; `list_repos` is only for discovery/filtering when the user does not know the exact repo or explicitly wants candidate selection.
42
+ **Direct-add rule:** If `sessionId` is provided and the prompt names exact repositories to add by ID, short name, full name, GitHub `owner/repo` slug, URL-like slug, or MCP resource syntax, call `add_repo` directly with those refs in `repoIds`. Refs are not limited to organization repos — public open-source repos can be added by `owner/repo` slug or URL, even though they never appear in `list_repos`. Do NOT call `list_repos`, do NOT ask for candidates, and do NOT require candidate discovery first. Candidate discovery is account-repo-only; `list_repos` is only for discovery/filtering when the user does not know the exact repo or explicitly wants candidate selection.
43
43
 
44
44
  ## Workflow
45
45
 
@@ -115,7 +115,7 @@ Call `add_repo` to attach the selected repositories to the existing session —
115
115
  add_repo(sessionId: "<sessionId>", repoIds: [...])
116
116
  ```
117
117
 
118
- `repoIds` may be repository IDs from discovery, or exact refs provided by the user: short name, full name, GitHub `owner/repo` slug, URL-like slug, or MCP resource syntax. For exact user-provided refs, pass the strings directly and do not call `list_repos` first.
118
+ `repoIds` may be repository IDs from discovery, or exact refs provided by the user: short name, full name, GitHub `owner/repo` slug, URL-like slug, or MCP resource syntax — including repos outside the organization, such as public open-source repos. For exact user-provided refs, pass the strings directly and do not call `list_repos` first.
119
119
 
120
120
  ### Step 4: Get Session Details
121
121
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polygraph/claude-plugin",
3
- "version": "0.4.26",
3
+ "version": "0.4.28",
4
4
  "description": "AI agent skills and subagents for Polygraph multi-repo coordination",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
@@ -1,17 +1,19 @@
1
1
  ---
2
2
  name: polygraph
3
- description: Guidance for coordinating changes across multiple repositories using Polygraph. Use when working on a feature that affects another repository, coordinating changes/branches/PRs across repos, delegating tasks to child agents in different repos, discovering how code is consumed across repositories, or starting a multi-repo coordination session. TRIGGER when user mentions "polygraph", "other repos", "other repositories", "who uses this", "what uses this", "cross-repo", "multi-repo", "consuming this API/endpoint", "dependent repositories", or asks about what other repos are doing with shared code/APIs/endpoints.
3
+ description: Guidance for working with Polygraph repositories, sessions, child agents, PRs, and CI. Use when discovering repositories or how code is consumed across them, starting, joining, resuming, or sharing a Polygraph session, handing off progress, coordinating changes/branches/PRs across repos, delegating tasks to child agents in different repos, or checking CI status and logs. TRIGGER when user mentions "polygraph", resuming or sharing a session, "other repos", "other repositories", "who uses this", "what uses this", "cross-repo", "multi-repo", "consuming this API/endpoint", "dependent repositories", or asks about what other repos are doing with shared code/APIs/endpoints.
4
4
 
5
5
  allowed-tools:
6
6
  - mcp__plugin_polygraph_polygraph-mcp
7
7
 
8
8
  ---
9
9
 
10
- # Multi-Repo Coordination with Polygraph
10
+ # Working with Polygraph
11
11
 
12
- **IMPORTANT:** NEVER `cd` into cloned repositories or access their files directly. ALWAYS use the `spawn_agent` tool to perform work in other repositories.
12
+ **IMPORTANT:** Polygraph keeps local clones only for *other* repositories in the session. NEVER `cd` into those clones or access their files directly — work in other repositories ALWAYS happens through the Polygraph MCP `spawn_agent` tool, invoked via background `polygraph-delegate-subagent` Tasks.
13
13
 
14
- This skill provides guidance for working on features that span multiple repositories using Polygraph for coordination.
14
+ Polygraph connects repositories and the agent work happening across them. Its central artifact is the session, which groups the repositories, branches, PRs, and CI status for one piece of work and can be shared and resumed: use it to coordinate changes across multiple repositories, and also on its own to share the session URL with collaborators, hand off progress via the session description, resume prior work, and watch CI across the session's PRs.
15
+
16
+ **Polygraph operates on the current repo in place.** Starting or joining a session never clones or modifies the repository you are in — you keep working in your real working directory, and `push_branch` pushes your local commits from that checkout. Only *other* repositories are worked on in separate Polygraph-managed clones via `spawn_agent`.
15
17
 
16
18
  ## Available Tools
17
19
 
@@ -21,25 +23,27 @@ Polygraph functionality is available via both MCP tools and CLI commands. Use wh
21
23
  | --- | --- | --- |
22
24
  | `list_repos` | `polygraph repo list` | Discover candidate repositories with descriptions and graph relationships |
23
25
  | `start_session` | `polygraph session start --repo <ids>` | Initialize a Polygraph session with selected repositories |
24
- | `spawn_agent` | — | Start a new child task or send an explicit follow-up to an active task in another repository. Input: `{ sessionId, repo, instruction, context?, taskId? }`. Output: `{ taskId, message, status: 'delegated' }`. Pass the `taskId` returned by a prior call to route a follow-up message to a specific active task; omit to start a new child run. A session resume or reconstruction is read-only context restoration; after resuming, do not use `spawn_agent` to continue changes unless the user explicitly asks for changes. |
25
- | `show_agent` | — | Poll flat per-child status for the session. Output: `{ children: PolygraphChildStatusItem[] }` where each item exposes `repositoryId`, `repoFullName`, `status`, `lastOutputLines`, `durationMs`, `instruction`, `agentType?`, `inputRequiredQuestion?`. `status` is an AcpRunStatus: `'created' \| 'in-progress' \| 'input-required' \| 'completed' \| 'failed' \| 'cancelled'` (British double-L on `'cancelled'`). `inputRequiredQuestion` is populated only when `status === 'input-required'`. |
26
+ | `spawn_agent` | — | Start a new child task or send a follow-up to an active task in another repository. Input: `{ sessionId, repo, instruction, context? }`. Output: `{ taskId, message, status: 'delegated' }`. Follow-up routing is automatic: if the repo already has an active child task, the instruction is delivered to it as a follow-up message; otherwise a new child run starts. A repo has at most one active child at a time. A session resume or reconstruction is read-only context restoration; after resuming, do not use `spawn_agent` to continue changes unless the user explicitly asks for changes. |
27
+ | `show_agent` | — | Poll flat per-child status for the session. Output: `{ children: PolygraphChildStatusItem[] }` where each item exposes `repositoryId`, `repoFullName`, `status`, `lastOutputLines`, `durationMs`, `instruction`, `agentType?`, `inputRequiredQuestion?`. `status` is an AcpRunStatus: `'created' \| 'in-progress' \| 'input-required' \| 'permission-required' \| 'completed' \| 'failed' \| 'cancelled'` (British double-L on `'cancelled'`). `inputRequiredQuestion` is populated only when `status === 'input-required'`. |
26
28
  | `stop_agent` | — | Cancel an in-progress child. Output: `{ taskId, state: 'cancelled', sessionPreserved: true, output, message }`. Because `sessionPreserved: true`, the preserved agent session can be restored later for context, but resume must wait for explicit user instructions before making changes. |
27
- | `push_branch` | — | Push a local git branch to the remote repository. Requires a session description. |
29
+ | `push_branch` | — | Push a local git branch to the remote repository. For the repo you are in, this pushes from your current checkout. Requires a session description. |
28
30
  | `create_pr` | — | Create draft PRs with session metadata linking related PRs |
29
31
  | `show_session` | `polygraph session show <id> [--details]` | Query status of the current session. Use details when session summary, repo IDs, PR URLs, and PR descriptions are needed. |
30
- | `update_session_description` | `polygraph session update-description` | Set the current session description from a synthesized progress summary or user-provided text. This updates session metadata only; it does not require PR creation or mark-ready. |
32
+ | `update_session` | `polygraph session update --session <id> [--title] [--description]` | Update the session title and/or description (at least one required). Set the description from a synthesized progress summary or user-provided text. This updates session metadata only; it does not require PR creation or mark-ready. |
31
33
  | `link_reference` | — | Link an external reference to a session. |
32
34
  | `mark_pr_ready` | — | Mark draft PRs as ready for review |
33
35
  | `associate_pr` | — | Associate an existing PR with a session |
34
36
  | `add_repo` | — | Add repositories to a running Polygraph session. For explicit refs, pass the refs directly and skip `list_repos`. |
35
- | `complete_session` | `polygraph session archive <id>` | Mark a session complete |
37
+ | `archive_session` | `polygraph session archive <id>` | Archive a session, hiding it from active lists (it can still be resumed) |
36
38
  | `get_ci_logs` | — | Retrieve full plain-text log for a specific CI job |
37
- | | `polygraph auth login [--token]` | Authenticate with Polygraph (use `--token` for headless/CI) |
38
- | | `polygraph session list` | List all sessions |
39
- | | `polygraph account list` / `polygraph account select` | Organization management |
40
- | | `polygraph whoami` | Show current auth status and org |
39
+ | `login` | `polygraph auth login [--token]` | Authenticate with Polygraph (use `--token` for headless/CI) |
40
+ | `logout` | `polygraph auth logout` | Log out of Polygraph |
41
+ | `list_sessions` | `polygraph session list` | List sessions. By default only active sessions created by the current git user; pass `recommendedFilters: false` for all sessions. |
42
+ | `list_accounts` | `polygraph account list` | List available organizations |
43
+ | `select_account` | `polygraph account select` | Select the organization that future commands run against |
44
+ | `whoami` | `polygraph whoami` | Show current auth status and org |
41
45
 
42
- **Delegation rules:** `list_repos` and `start_session` MUST be called via the `polygraph-init-subagent` as described in step 0. Direct `add_repo` is allowed only when the user provides exact repo refs for an existing session. `spawn_agent` and `show_agent` MUST ALWAYS be called via background Task subagents (`run_in_background: true`) as described in the delegation sections below — NEVER call them directly in the main conversation.
46
+ **Delegation rules:** `list_repos` and `start_session` MUST be called via the `polygraph-init-subagent` as described in step 0. Direct `add_repo` is allowed only when the user provides exact repo refs for an existing session. `spawn_agent` and `show_agent` MUST ALWAYS be called via background Task subagents (`run_in_background: true`) as described in the delegation sections below — NEVER call them directly in the main conversation. The subagents are plugin-namespaced: pass `subagent_type: "polygraph:polygraph-init-subagent"` / `"polygraph:polygraph-delegate-subagent"`; fall back to the bare name only if the namespaced form is not found.
43
47
 
44
48
  ## CLI Statefulness
45
49
 
@@ -62,28 +66,30 @@ After logging in (or if logged in but no org is selected), use `polygraph accoun
62
66
 
63
67
  ## Workflow Overview
64
68
 
69
+ The delegate/monitor/stop steps apply only when working across repos. A single-repo session skips them and still benefits from shared progress, resume, and CI visibility.
70
+
65
71
  0. **Initialize or join Polygraph session** - If you were spawned inside an existing session (the startup banner names a session ID), reuse it. Call `show_session` first; if it already has repos and the user did not ask to add more, you're done. If the user asks to add exact repo refs, call `add_repo` directly with those refs and skip candidate discovery. If the session has no repos and no exact refs were provided, launch the `polygraph-init-subagent` with that `sessionId` so it discovers candidates and uses `add_repo` (NOT `start_session`). Only when there is no session ID at all should the init subagent create a new session.
66
- 1. **Delegate work to each repo** - Use the `polygraph-delegate-subagent` to start child agents in other repositories. Choose the Simple (fire-and-forget) or Multi-turn (interactive) pattern described below based on whether the child may need clarification.
72
+ 1. **Delegate work to each repo** - Use the `polygraph-delegate-subagent` to start child agents in other repositories. Delegate only to *other* repos — never to the repo you are in; work on it directly (your regular subagents are fine for local work — only Polygraph delegation is reserved for other repos). Parallel delegation across repos is encouraged, but only one active child per repo. Choose the Simple (fire-and-forget) or Multi-turn (interactive) pattern described below based on whether the child may need clarification.
67
73
 
68
74
  4. **Monitor child agents** - Use `show_agent` to poll progress and read the flat `children[]` array for each child's `status` and `lastOutputLines`.
69
75
  5. **Stop child agents** (if needed) - Use `stop_agent` to cancel an in-progress child agent. The underlying agent session is preserved for later read-only context restoration; after a resume, wait for explicit user instructions before making changes.
70
76
  6. **Push branches** - Use `push_branch` after making commits. A required `description` must follow the Session Description Policy.
71
- 7. **Update session description** - Use `update_session_description` to update the session description; must follow the Session Description Policy. Independent of PR creation or mark-ready.
77
+ 7. **Update session description** - Use `update_session` to update the session description; must follow the Session Description Policy. Independent of PR creation or mark-ready.
72
78
  8. **Create draft PRs** - Use `create_pr` to create linked draft PRs. Always pass `description` following the Session Description Policy.
73
79
  9. **Associate existing PRs** (optional) - Use `associate_pr` to link PRs created outside Polygraph.
74
80
  10. **Query PR status** - Use `show_session` to check progress.
75
81
  11. **Mark PRs ready** - Use `mark_pr_ready` when work is complete.
76
- 12. **Complete session** - Use `complete_session` to mark the session as completed when the user requests it.
82
+ 12. **Archive session** - Use `archive_session` to archive the session when the user requests it.
77
83
 
78
84
  ## Step-by-Step Guide
79
85
 
80
86
  ### 0. Initialize or Join Polygraph Session
81
87
 
82
- There are three cases. Pick exactly one before calling any tool.
88
+ There are three cases. Pick exactly one before calling any tool. The case labels are internal routing shorthand — never mention them in anything you show the user.
83
89
 
84
90
  **Hard rule: if a session ID is already in scope (e.g., the startup banner says "You're in Polygraph session …", or the user passed one), that session ID is authoritative for this entire conversation. NEVER call `start_session` — doing so creates a brand-new session and orphans the one the parent harness is pointed at. Reuse the existing session via `show_session` and, if needed, `add_repo`.**
85
91
 
86
- **Case A — Existing session, already has repos.** Call `show_session` directly with the known session ID. Skip the init subagent entirely. Print the session details (format below) and proceed.
92
+ **Case A — Existing session, already has repos.** Call `show_session` directly with the known session ID. Skip the init subagent entirely, show the session details (format below), and proceed.
87
93
 
88
94
  **Case B — Existing session, no repos yet (or user wants to add more).** If the user gives exact repo refs by ID, short name, full name, GitHub `owner/repo` slug, or URL-like slug, call `add_repo(sessionId, repoIds: [...])` directly with those refs. Do NOT call `list_repos`, do NOT ask for candidates, and do NOT launch the init subagent just to resolve those refs. If the user wants discovery/filtering instead, launch the `polygraph-init-subagent`, passing both the existing `sessionId` and `userContext`. The subagent will discover candidates, select relevant repositories, and call `add_repo` against the existing session — it will NOT call `start_session`.
89
95
 
@@ -100,7 +106,7 @@ In case B, call `add_repo` yourself when exact repo refs were provided; otherwis
100
106
 
101
107
  ```
102
108
  Task(
103
- subagent_type: "polygraph-init-subagent",
109
+ subagent_type: "polygraph:polygraph-init-subagent",
104
110
  description: "Init Polygraph session",
105
111
  prompt: """
106
112
  Parameters:
@@ -122,9 +128,9 @@ The subagent will:
122
128
  4. Call `show_session` to retrieve session details
123
129
  5. Return a summary with session URL and repo info
124
130
 
125
- **Case C only — new session just created:** After the init subagent completes and creates the new session, render the session welcome card (skip the session-details block below for this case). Prefer the `session_intro` MCP tool — call it with the session ID; it returns the card as markdown. If that tool is unavailable, run `polygraph session intro -s <sessionId>` via the CLI instead. The CLI command is intentionally hidden/internal and may not appear in public command listings, but it remains the correct skill fallback for rendering the welcome card. Either way, print the result to the user verbatim as markdown — do NOT wrap it in a code block or reformat it (the logo is pre-fenced; the rest is live markdown). It needs no other input, and you do not need to call `show_session` first. Then continue (ask the user what they want, or start the requested task).
131
+ **When the init subagent has just created a brand-new session,** render the session welcome card instead of the session-details block below. Prefer the `session_intro` MCP tool — call it with the session ID; it returns the card as markdown. If that tool is unavailable, run `polygraph session intro -s <sessionId>` via the CLI instead. The CLI command is intentionally hidden/internal and may not appear in public command listings, but it remains the correct skill fallback for rendering the welcome card. Either way, print the result to the user verbatim as markdown — do NOT wrap it in a code block or reformat it (the logo is pre-fenced; the rest is live markdown). It needs no other input, and you do not need to call `show_session` first. Then continue (ask the user what they want, or start the requested task).
126
132
 
127
- **After receiving the subagent's summary (Case B) or after calling `show_session` for an existing session (Case A), print the session details:**
133
+ **For an existing session after `show_session` returns or the init subagent's summary arrives — show the session details:**
128
134
 
129
135
  **Session:** POLYGRAPH_SESSION_URL
130
136
 
@@ -160,7 +166,7 @@ Use this workflow when the user gives a Polygraph session ID and asks to underst
160
166
  - PR description
161
167
  5. If the request was resume/reconnect/reconstruct only, report the restored session context and wait for the user's next instruction.
162
168
  6. If the user explicitly asked to inspect or investigate prior work, use the PR descriptions and session summary to decide whether more repo investigation is needed.
163
- 7. If the repo to investigate is already part of the session, delegate directly to that repo.
169
+ 7. If the repo to investigate is already part of the session, delegate directly to that repo (unless it is the repo you are in — investigate that one directly).
164
170
  8. If the repo to investigate is not currently initialized in the session, and either the user provided an exact repo ref or the repo appears in `<repositories>`, call `add_repo` with that ref or repo `<id>` directly. Do not call `list_repos` just to resolve the repo.
165
171
  9. After `add_repo`, call `show_session` again to verify the repo was added, then delegate to that repo.
166
172
  10. Fall back to `list_repos` only when the desired repo is not an exact ref and is missing from `<repositories>`, or when the details output came from an older Polygraph version that did not include repo IDs.
@@ -190,7 +196,7 @@ Use this pattern when the task is well-defined and the child is not expected to
190
196
 
191
197
  ```
192
198
  Task(
193
- subagent_type: "polygraph-delegate-subagent",
199
+ subagent_type: "polygraph:polygraph-delegate-subagent",
194
200
  run_in_background: true,
195
201
  description: "Delegate to <repo-name>",
196
202
  prompt: """
@@ -205,7 +211,7 @@ Task(
205
211
  )
206
212
  ```
207
213
 
208
- 2. Delegate to multiple repos in parallel by launching multiple background Task subagents at the same time. Read the output files later to check progress.
214
+ 2. Delegate to multiple repos in parallel by launching multiple background Task subagents at the same time — one delegation per repo at a time. Read the output files later to check progress.
209
215
  3. For each child, the subagent watches `child.status` in the flat `children[]` response and exits when it sees a terminal status — typically `'completed'` or `'failed'` (and `'cancelled'` if it was stopped).
210
216
  4. Once all background subagents report a terminal status, continue to `push_branch` + `create_pr`.
211
217
 
@@ -223,11 +229,9 @@ Use this pattern when the child may need clarification, the task is exploratory,
223
229
  { "taskId": "…", "message": "…", "status": "delegated" }
224
230
  ```
225
231
 
226
- Store the returned `taskId`. You will pass it back on any follow-up turn so the orchestrator routes the message to the same active task instead of starting a new run.
227
-
228
232
  2. Poll `show_agent`. The response shape is `{ children: PolygraphChildStatusItem[] }`. For each child, inspect:
229
233
 
230
- - `child.status` — one of `'created'`, `'in-progress'`, `'input-required'`, `'completed'`, `'failed'`, `'cancelled'` (British double-L on `'cancelled'`).
234
+ - `child.status` — one of `'created'`, `'in-progress'`, `'input-required'`, `'permission-required'`, `'completed'`, `'failed'`, `'cancelled'` (British double-L on `'cancelled'`).
231
235
  - `child.inputRequiredQuestion` — populated only when `child.status === 'input-required'`.
232
236
  - `child.lastOutputLines` — recent log tail.
233
237
  - `child.repoFullName` — which repo is talking.
@@ -235,10 +239,11 @@ Use this pattern when the child may need clarification, the task is exploratory,
235
239
  Drive the state machine:
236
240
 
237
241
  - `child.status === 'in-progress'` or `'created'` — continue polling.
238
- - `child.status === 'input-required'` — read `child.inputRequiredQuestion`, surface it to the user verbatim (e.g. "The child agent in `{child.repoFullName}` needs input: {child.inputRequiredQuestion}"), get the answer, then call `spawn_agent` again with `taskId: <stored taskId>` and `instruction: <answer>`. Continue polling.
242
+ - `child.status === 'input-required'` — read `child.inputRequiredQuestion`, surface it to the user verbatim (e.g. "The child agent in `{child.repoFullName}` needs input: {child.inputRequiredQuestion}"), get the answer, then call `spawn_agent` again with the same `repo` and `instruction: <answer>` — it is routed to the active task automatically. Continue polling.
239
243
  - `child.status === 'completed'` — read `child.lastOutputLines`, proceed to `push_branch` + `create_pr`.
240
244
  - `child.status === 'failed'` — read `child.lastOutputLines`, surface the failure.
241
245
  - `child.status === 'cancelled'` — the child was stopped via `stop_agent`; see below.
246
+ - `child.status === 'permission-required'` — the child is waiting on a permission decision; see "Handling permission requests" below.
242
247
 
243
248
  3. To abort mid-flight, call `stop_agent` with `{ sessionId, repo }`. The response is:
244
249
 
@@ -275,6 +280,8 @@ The `allow_agent` and `deny_agent` tools exist for parents whose MCP clients do
275
280
 
276
281
  Once work is complete in a repository, push the branch using `push_branch`. This must be done before creating a PR.
277
282
 
283
+ `push_branch` pushes from the local checkout: for the repo you are in, that is your current working directory with your commits; for delegated repos, it is the Polygraph-managed clone the child agent worked in. There is no separate session copy of the current repo.
284
+
278
285
  **Parameters:**
279
286
 
280
287
  - `sessionId` (required): The Polygraph session ID
@@ -294,7 +301,7 @@ push_branch(
294
301
 
295
302
  `description` is user-facing Polygraph session context.
296
303
 
297
- `description` is required for `push_branch`, `create_pr`, `associate_pr`, and `update_session_description`. (`mark_pr_ready` does not take a description.) Use the canonical structured format:
304
+ `description` is required for `push_branch`, `create_pr`, and `associate_pr`, and is the primary input to `update_session` (which takes `title` and/or `description`). (`mark_pr_ready` does not take a description.) Use the canonical structured format:
298
305
 
299
306
  ```text
300
307
  Goal: <what the session is trying to accomplish>
@@ -541,6 +548,8 @@ Use `add_repo` to add repositories to an existing Polygraph session after it has
541
548
 
542
549
  **Direct-add rule:** When the user provides exact repo refs by ID, short name, full name, GitHub `owner/repo` slug, or URL-like slug, pass those refs directly to `add_repo` and do not call `list_repos` first. Candidate discovery remains account-repo-only and is only for cases where the user does not know the exact repo or asks to choose/filter candidates.
543
550
 
551
+ **Not limited to your organization:** repos outside the org — including public open-source repos — can be added by GitHub `owner/repo` slug or URL. Only `list_repos` discovery is org-scoped, so a repo missing from `list_repos` can still be added directly.
552
+
544
553
  **Parameters:**
545
554
 
546
555
  - `sessionId` (required): The Polygraph session ID
@@ -549,43 +558,33 @@ Use `add_repo` to add repositories to an existing Polygraph session after it has
549
558
  ```
550
559
  add_repo(
551
560
  sessionId: "<session-id>",
552
- repoIds: ["nrwl/ocean"]
561
+ repoIds: ["org/repo-name", "facebook/react"]
553
562
  )
554
563
  ```
555
564
 
556
- ### 8. Complete Session
565
+ ### 8. Archive Session
557
566
 
558
- **IMPORTANT: Only call this tool when the user explicitly asks to complete or close the session.** Do not automatically complete sessions as part of the workflow.
567
+ **IMPORTANT: Only call this tool when the user explicitly asks to archive or close the session.** Do not archive sessions automatically as part of the workflow.
559
568
 
560
- **Warning:** Completing a session seals it from further modifications. Only complete a session when the user explicitly confirms they are done coordinating the session.
561
-
562
- Use `complete_session` to mark the session as completed. Completing a session will:
563
-
564
- - **Mark the session as completed** and sealed from further modifications (no new PRs, status changes, etc.)
565
-
566
- This is idempotent — completing an already-completed session returns success.
569
+ Use `archive_session` (CLI: `polygraph session archive <id>`) to archive the session. Archiving only hides the session from active lists it can still be resumed and interacted with afterwards. It is idempotent — archiving an already-archived session returns success.
567
570
 
568
571
  **Parameters:**
569
572
 
570
573
  - `sessionId` (required): The Polygraph session ID
571
- - `clean` (optional): Remove local session worktrees after marking the session complete
574
+ - `clean` (optional): Remove the local clones Polygraph created for delegated repos after archiving
572
575
 
573
576
  **Returns:**
574
577
 
575
578
  - `sessionId`: The session ID
576
- - `completed`: Boolean indicating completion status
579
+ - `completed`: Boolean indicating the session is archived
577
580
 
578
581
  ```
579
- complete_session(
582
+ archive_session(
580
583
  sessionId: "<session-id>"
581
584
  )
582
585
  ```
583
586
 
584
- **When to call:**
585
-
586
- - After all cross-repo work is finished
587
- - All PRs have been created and marked ready for review
588
- - The user explicitly confirms they want to close all PRs and seal the session
587
+ **When to call:** all work is finished, PRs are created and marked ready, and the user explicitly confirms they are done with the session.
589
588
 
590
589
  ## Other Capabilities
591
590
 
@@ -638,7 +637,7 @@ Before writing:
638
637
  - If appending a new item, read the current/latest description first and write the full replacement description with the existing items plus the new item.
639
638
  - If updating or replacing the existing last item, write the resulting state directly.
640
639
 
641
- Write the description using the canonical structured format in the Session Description Policy. Then call `update_session_description` with the resulting summary.
640
+ Write the description using the canonical structured format in the Session Description Policy. Then call `update_session` with the resulting summary as `description`.
642
641
 
643
642
  ### Print Polygraph Session Details
644
643
 
@@ -671,11 +670,11 @@ If the session has a description timeline, also display:
671
670
  1. **Poll child status before proceeding** — Always verify child agents have reached a terminal `child.status` (`'completed'`, `'failed'`, or `'cancelled'`) via `show_agent` before pushing branches or creating PRs
672
671
  1. **Link PRs in descriptions** - Reference related PRs in each PR body
673
672
  1. **Keep PRs as drafts** until all repos are ready
674
- 1. **Always pass `description`** when calling `create_pr`, `associate_pr`, or `update_session_description` — it is required and must follow the Session Description Policy
673
+ 1. **Always pass `description`** when calling `create_pr`, `associate_pr`, or `update_session` — it is required and must follow the Session Description Policy
675
674
  1. **Test integration** before marking PRs ready
676
675
  1. **Coordinate merge order** if there are deployment dependencies
677
676
 
678
677
  1. **NEVER call `spawn_agent` or `show_agent` directly**. These MUST ALWAYS go through background Task subagents (`run_in_background: true`).
679
678
 
680
679
  1. **Use `stop_agent` to clean up** — Stop child agents that are stuck or no longer needed. The child's session is preserved (`sessionPreserved: true`) so the context can be restored later, but after resuming you must wait for explicit user instructions before making changes.
681
- 1. **Only complete sessions when asked** — Only call `complete_session` when the user explicitly requests it. Completing a session seals it from further modifications. Do not automatically complete sessions.
680
+ 1. **Only archive sessions when asked** — Only call `archive_session` when the user explicitly requests it. Archiving hides the session from active lists; it can still be resumed later.