@polygraph/claude-plugin 0.4.27 → 0.4.29

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.27",
3
+ "version": "0.4.29",
4
4
  "description": "AI agent skills and subagents for Polygraph multi-repo coordination",
5
5
  "author": {
6
6
  "name": "Narwhal Technologies Inc",
@@ -27,13 +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.
35
34
 
36
- `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: if it already has one, pass `taskId` to route the message to it instead of starting a new run.
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.
37
36
 
38
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.
39
38
 
@@ -42,8 +41,7 @@ spawn_agent(
42
41
  sessionId: "<sessionId>",
43
42
  repo: "<repo>",
44
43
  instruction: "<instruction>",
45
- context: "<context>",
46
- taskId: "<taskId>" // optional - pass only for a user-approved follow-up to an active task
44
+ context: "<context>"
47
45
  )
48
46
  ```
49
47
 
@@ -89,8 +87,6 @@ After calling `spawn_agent`, parse the structured JSON response:
89
87
  { "taskId": "…", "message": "…", "status": "delegated" }
90
88
  ```
91
89
 
92
- 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.
93
-
94
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.
95
91
 
96
92
  For each child in the response (field: `children[]`), inspect:
@@ -107,7 +103,7 @@ State machine:
107
103
  - Read `child.inputRequiredQuestion`.
108
104
  - Surface this question verbatim to the parent/user: "The child agent in `{child.repoFullName}` needs input: {child.inputRequiredQuestion}".
109
105
  - Wait for the parent/user to supply an answer.
110
- - 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.
111
107
  - Resume polling.
112
108
 
113
109
  <!-- Claude and Codex parents handle permission gates via the native MCP elicitation dialog
@@ -22,7 +22,7 @@ These tools are available via MCP and CLI. Use whichever is available in your en
22
22
 
23
23
  | MCP Tool | CLI Equivalent | Description |
24
24
  | --- | --- | --- |
25
- | `list_repos` | `polygraph repo list` | Discover candidate repositories with descriptions and graph relationships |
25
+ | `list_repos` | `polygraph repo list` | Discover candidate repositories. |
26
26
  | `start_session` | `polygraph session start --repo <ids>` | Initialize a NEW session with selected repositories. Only use when no `sessionId` was provided. |
27
27
  | `add_repo` | — | Attach repositories to an EXISTING session. Use when `sessionId` was provided and the session has no repos yet, or when the user wants to add more. |
28
28
  | `show_session` | `polygraph session show <id> [--details]` | Get full session details including URL, and use details when session summary, repo IDs, PR URLs, and PR descriptions are needed |
@@ -65,16 +65,22 @@ Call `list_repos` to discover available candidate repositories:
65
65
  list_repos()
66
66
  ```
67
67
 
68
+ `list_repos` accepts these optional parameters; set whichever apply. Refer to the tool schema for each parameter.
69
+
70
+ - `connectedTo`: repo ID, name, or full name (e.g. `nrwl/ocean`); pair with `connectionType`
71
+ - `connectionType`: `directly-upstream` | `directly-downstream` | `directly-both` (default) | `upstream` | `downstream` | `both`
72
+ - `publishedPackages`, `consumedPackages`, `publishedApis`, `consumedApis`: arrays of package names / API paths
73
+ - `nameFilter`: array of repo name patterns (e.g. `nrwl/*`)
74
+ - `semanticQuery`: free-text description of the repositories you want
75
+
68
76
  This returns:
69
77
 
70
- - **`initiator`**: The current repository, or `null` if not running from a specific repo
71
- - **`candidates`**: Candidate account repositories, each with:
78
+ - **`repos`**: Candidate account repositories, each with:
72
79
  - `id`: Repository ID
73
80
  - `name`: Repository name
81
+ - `repository`: Full repo name (e.g., `org/repo`)
82
+ - `provider`: VCS provider (e.g., `GITHUB`)
74
83
  - `description`: AI-generated description of what the repository does (may be null)
75
- - `vcsConfiguration.repositoryFullName`: Full repo name (e.g., `org/repo`)
76
- - `graphRelationship`: How this repository relates to the initiator (`distance`, `direction`, `path`), or `null` if the repository is not in the dependency graph. When `initiator` is null, `graphRelationship` will be null for all candidates.
77
- - **`dependencyGraph`**: Graph of repository dependency `edges` (always available, independent of initiator)
78
84
 
79
85
  ### Step 2: Select Relevant Repos
80
86
 
@@ -84,14 +90,11 @@ If `selectedRepoIds` or exact repo refs were provided by the main agent, use tho
84
90
 
85
91
  Otherwise, analyze the candidates using the `userContext` to determine which repos are relevant:
86
92
 
87
- 1. Read each candidate's `description` and `graphRelationship`
88
- 2. Match against the `userContext` consider:
89
- - Repository descriptions that mention relevant functionality
90
- - Graph relationships (closer repos are more likely relevant); note that `graphRelationship` may be `null` for repositories not in the dependency graph — use their `description` to assess relevance
91
- - When `graphRelationship` is null for all candidates (no initiator), rely on `description` fields and the raw `dependencyGraph` edges for selection instead
92
- - Direction (upstream/downstream based on the nature of the change)
93
- 3. Select only the repos that are clearly relevant to the task
94
- 4. If uncertain which repos are relevant, include all candidates (safe default)
93
+ 1. Read each repo's `description`
94
+ 2. Match repo descriptions against the `userContext` to identify relevant repos
95
+ 3. Select the repos that are relevant to the task
96
+ 4. When uncertain, include all candidates
97
+ 5. When the user described the task in natural language and the result is large, re-query with `semanticQuery` set to that description
95
98
 
96
99
  ### Step 3: Initialize Polygraph Session or Attach Repos
97
100
 
@@ -147,11 +150,6 @@ Return a structured summary in this format:
147
150
  | Repo | Repository ID | Description | Selected |
148
151
  | --- | --- | --- | --- |
149
152
  | REPO_FULL_NAME | REPOSITORY_ID | DESCRIPTION | Yes/No |
150
-
151
- ### Initiator
152
- (Only include this section if `list_repos` was called and `initiator` is non-null)
153
- - **Name:** <initiator name>
154
- - **Repo:** <initiator repo full name>
155
153
  ```
156
154
 
157
155
  ## Important Notes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polygraph/claude-plugin",
3
- "version": "0.4.27",
3
+ "version": "0.4.29",
4
4
  "description": "AI agent skills and subagents for Polygraph multi-repo coordination",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
@@ -21,25 +21,27 @@ Polygraph functionality is available via both MCP tools and CLI commands. Use wh
21
21
 
22
22
  | MCP Tool | CLI Equivalent | Description |
23
23
  | --- | --- | --- |
24
- | `list_repos` | `polygraph repo list` | Discover candidate repositories with descriptions and graph relationships |
24
+ | `list_repos` | `polygraph repo list` | Discover candidate repositories. |
25
25
  | `start_session` | `polygraph session start --repo <ids>` | Initialize a Polygraph session with selected repositories |
26
- | `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 repo has at most one active child at a time: while a task is active in a repo, pass `taskId` to follow up — never start a second concurrent run in the same repo. 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' \| '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'`. |
28
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. |
29
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. |
30
30
  | `create_pr` | — | Create draft PRs with session metadata linking related PRs |
31
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. |
32
- | `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. |
33
33
  | `link_reference` | — | Link an external reference to a session. |
34
34
  | `mark_pr_ready` | — | Mark draft PRs as ready for review |
35
35
  | `associate_pr` | — | Associate an existing PR with a session |
36
36
  | `add_repo` | — | Add repositories to a running Polygraph session. For explicit refs, pass the refs directly and skip `list_repos`. |
37
37
  | `archive_session` | `polygraph session archive <id>` | Archive a session, hiding it from active lists (it can still be resumed) |
38
38
  | `get_ci_logs` | — | Retrieve full plain-text log for a specific CI job |
39
- | | `polygraph auth login [--token]` | Authenticate with Polygraph (use `--token` for headless/CI) |
40
- | | `polygraph session list` | List all sessions |
41
- | | `polygraph account list` / `polygraph account select` | Organization management |
42
- | | `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 |
43
45
 
44
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.
45
47
 
@@ -72,7 +74,7 @@ The delegate/monitor/stop steps apply only when working across repos. A single-r
72
74
  4. **Monitor child agents** - Use `show_agent` to poll progress and read the flat `children[]` array for each child's `status` and `lastOutputLines`.
73
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.
74
76
  6. **Push branches** - Use `push_branch` after making commits. A required `description` must follow the Session Description Policy.
75
- 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.
76
78
  8. **Create draft PRs** - Use `create_pr` to create linked draft PRs. Always pass `description` following the Session Description Policy.
77
79
  9. **Associate existing PRs** (optional) - Use `associate_pr` to link PRs created outside Polygraph.
78
80
  10. **Query PR status** - Use `show_session` to check progress.
@@ -227,11 +229,9 @@ Use this pattern when the child may need clarification, the task is exploratory,
227
229
  { "taskId": "…", "message": "…", "status": "delegated" }
228
230
  ```
229
231
 
230
- 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.
231
-
232
232
  2. Poll `show_agent`. The response shape is `{ children: PolygraphChildStatusItem[] }`. For each child, inspect:
233
233
 
234
- - `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'`).
235
235
  - `child.inputRequiredQuestion` — populated only when `child.status === 'input-required'`.
236
236
  - `child.lastOutputLines` — recent log tail.
237
237
  - `child.repoFullName` — which repo is talking.
@@ -239,10 +239,11 @@ Use this pattern when the child may need clarification, the task is exploratory,
239
239
  Drive the state machine:
240
240
 
241
241
  - `child.status === 'in-progress'` or `'created'` — 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 `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.
243
243
  - `child.status === 'completed'` — read `child.lastOutputLines`, proceed to `push_branch` + `create_pr`.
244
244
  - `child.status === 'failed'` — read `child.lastOutputLines`, surface the failure.
245
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.
246
247
 
247
248
  3. To abort mid-flight, call `stop_agent` with `{ sessionId, repo }`. The response is:
248
249
 
@@ -300,7 +301,7 @@ push_branch(
300
301
 
301
302
  `description` is user-facing Polygraph session context.
302
303
 
303
- `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:
304
305
 
305
306
  ```text
306
307
  Goal: <what the session is trying to accomplish>
@@ -636,7 +637,7 @@ Before writing:
636
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.
637
638
  - If updating or replacing the existing last item, write the resulting state directly.
638
639
 
639
- 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`.
640
641
 
641
642
  ### Print Polygraph Session Details
642
643
 
@@ -669,7 +670,7 @@ If the session has a description timeline, also display:
669
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
670
671
  1. **Link PRs in descriptions** - Reference related PRs in each PR body
671
672
  1. **Keep PRs as drafts** until all repos are ready
672
- 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
673
674
  1. **Test integration** before marking PRs ready
674
675
  1. **Coordinate merge order** if there are deployment dependencies
675
676