@polygraph/claude-plugin 0.4.27 → 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.27",
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,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
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.28",
4
4
  "description": "AI agent skills and subagents for Polygraph multi-repo coordination",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
@@ -23,23 +23,25 @@ Polygraph functionality is available via both MCP tools and CLI commands. Use wh
23
23
  | --- | --- | --- |
24
24
  | `list_repos` | `polygraph repo list` | Discover candidate repositories with descriptions and graph relationships |
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