@polygraph/codex-plugin 0.4.31 → 0.4.32
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.
|
@@ -69,7 +69,8 @@ This returns:
|
|
|
69
69
|
- `name`: Repository name
|
|
70
70
|
- `repository`: Full repo name (e.g., `org/repo`)
|
|
71
71
|
- `provider`: VCS provider (e.g., `GITHUB`)
|
|
72
|
-
|
|
72
|
+
|
|
73
|
+
Candidate entries do not include repository descriptions. For natural-language discovery, pass the user's intent in `semanticQuery` so the service can apply semantic matching internally.
|
|
73
74
|
|
|
74
75
|
### Step 2: Select Relevant Repos
|
|
75
76
|
|
|
@@ -79,8 +80,8 @@ If `selectedRepoIds` or exact repo refs were provided by the main agent, use tho
|
|
|
79
80
|
|
|
80
81
|
Otherwise, analyze the candidates using the `userContext` to determine which repos are relevant:
|
|
81
82
|
|
|
82
|
-
1.
|
|
83
|
-
2. Match
|
|
83
|
+
1. Review each repo's `repository`, `name`, `provider`, and any relationship/filter metadata returned by the tool
|
|
84
|
+
2. Match those fields and any requested filters against the `userContext` to identify relevant repos
|
|
84
85
|
3. Select the repos that are relevant to the task
|
|
85
86
|
4. When uncertain, include all candidates
|
|
86
87
|
5. When the user described the task in natural language and the result is large, re-query with `semanticQuery` set to that description
|
|
@@ -129,16 +130,16 @@ Return a structured summary in this format:
|
|
|
129
130
|
|
|
130
131
|
### Repositories in this session
|
|
131
132
|
|
|
132
|
-
| Repo | Repository ID |
|
|
133
|
-
| --- | --- | --- |
|
|
134
|
-
| REPO_FULL_NAME | REPOSITORY_ID |
|
|
133
|
+
| Repo | Repository ID | Relationship |
|
|
134
|
+
| --- | --- | --- |
|
|
135
|
+
| REPO_FULL_NAME | REPOSITORY_ID | DIRECTION (distance: N) |
|
|
135
136
|
|
|
136
137
|
### All Candidates Discovered
|
|
137
138
|
(Only include this section if `list_repos` was called)
|
|
138
139
|
|
|
139
|
-
| Repo | Repository ID |
|
|
140
|
-
| --- | --- | --- |
|
|
141
|
-
| REPO_FULL_NAME | REPOSITORY_ID |
|
|
140
|
+
| Repo | Repository ID | Selected |
|
|
141
|
+
| --- | --- | --- |
|
|
142
|
+
| REPO_FULL_NAME | REPOSITORY_ID | Yes/No |
|
|
142
143
|
```
|
|
143
144
|
|
|
144
145
|
## Important Notes
|
package/package.json
CHANGED
|
@@ -29,7 +29,7 @@ Polygraph functionality is available via both MCP tools and CLI commands. Use wh
|
|
|
29
29
|
|
|
30
30
|
| MCP Tool | CLI Equivalent | Description |
|
|
31
31
|
| --- | --- | --- |
|
|
32
|
-
| `list_repos` | `polygraph repo list` | Discover candidate repositories. |
|
|
32
|
+
| `list_repos` | `polygraph repo list` | Discover candidate repositories. Candidate entries do not include repository descriptions; use `semanticQuery` for natural-language discovery. |
|
|
33
33
|
| `start_session` | `polygraph session start --repo <ids>` | Initialize a Polygraph session with selected repositories |
|
|
34
34
|
| `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. |
|
|
35
35
|
| `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'`. |
|
|
@@ -306,27 +306,9 @@ push_branch(
|
|
|
306
306
|
|
|
307
307
|
### Session Description Policy
|
|
308
308
|
|
|
309
|
-
`description` is user-facing Polygraph session context.
|
|
309
|
+
`description` is user-facing Polygraph session context. It is required for `push_branch`, `create_pr`, and `associate_pr`, and is the primary input to `update_session` (`mark_pr_ready` does not take a description).
|
|
310
310
|
|
|
311
|
-
`description`
|
|
312
|
-
|
|
313
|
-
```text
|
|
314
|
-
Goal: <what the session is trying to accomplish>
|
|
315
|
-
|
|
316
|
-
Current Progress: <what has been completed so far, including PR/session state when relevant>
|
|
317
|
-
|
|
318
|
-
What Worked: <important decisions, approaches, or constraints that future agents should preserve>
|
|
319
|
-
|
|
320
|
-
Next Steps: <clear next implementation steps>
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
- Do not use a one-line feature summary for final handoff or PR creation in a multi-repo session.
|
|
324
|
-
- Keep it concise but durable for a future resumed agent.
|
|
325
|
-
- Prefer high-level state over file-by-file changelogs.
|
|
326
|
-
- Mention unresolved decisions or risks when they matter.
|
|
327
|
-
- In `Next Steps`, include only next implementation steps. Do not list routine operational steps such as pushing branches, watching CI, or marking PRs ready.
|
|
328
|
-
|
|
329
|
-
> **Tip (optional):** The Polygraph UI renders fenced ` ```mermaid ` blocks in the session description as diagrams. If a small diagram would genuinely clarify the session state — for example, cross-repo relationships or a sequence of changes — you may include one. Plain text remains the norm; diagrams are never required.
|
|
311
|
+
**Whenever you write or update a session description, read [`reference/session-description.md`](reference/session-description.md) first.** That reference file holds the full policy: the canonical Markdown-heading template (`## Goal` / `## Current progress` / `## What worked` / `## Next steps`), the dual-audience guidance (humans in the web UI now, agents reconstructing history later), and the formatting building blocks the app renders (callouts, tables, mermaid, links, `link_reference`).
|
|
330
312
|
|
|
331
313
|
### 3. Create Draft PRs
|
|
332
314
|
|
|
@@ -636,15 +618,11 @@ get_ci_logs(
|
|
|
636
618
|
|
|
637
619
|
### Update Session Description
|
|
638
620
|
|
|
639
|
-
Use this when the user asks to summarize progress, update the session description, capture the current state.
|
|
621
|
+
Use this when the user asks to summarize progress, update the session description, or capture the current state.
|
|
640
622
|
|
|
641
|
-
|
|
642
|
-
- Read the current session details.
|
|
643
|
-
- Consider the current conversation, child-agent results, PRs, pushed branches, validation, and unresolved decisions.
|
|
644
|
-
- 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.
|
|
645
|
-
- If updating or replacing the existing last item, write the resulting state directly.
|
|
623
|
+
Read [`reference/session-description.md`](reference/session-description.md) for the full update procedure (what to read before writing, how to append vs. replace) and the canonical Markdown-heading format. Then call `update_session` with the resulting summary as `description`.
|
|
646
624
|
|
|
647
|
-
|
|
625
|
+
Be liberal about updating the session description when you make changes that affect the scope of the session, how logic flows between repos, or anything else important for posterity. Avoid updating it for small implementation details that are not relevant outside of this session. An up-to-date session description matters for maintainability.
|
|
648
626
|
|
|
649
627
|
### Print Polygraph Session Details
|
|
650
628
|
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# Session Description Reference
|
|
2
|
+
|
|
3
|
+
## Session Description Policy
|
|
4
|
+
|
|
5
|
+
`description` is user-facing Polygraph session context.
|
|
6
|
+
|
|
7
|
+
`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.) The Polygraph web app renders the description as Markdown, so use real Markdown headings — not flat `Label:` lines. Use the canonical structured format:
|
|
8
|
+
|
|
9
|
+
```markdown
|
|
10
|
+
## Goal
|
|
11
|
+
|
|
12
|
+
<what the session is trying to accomplish>
|
|
13
|
+
|
|
14
|
+
## Current progress
|
|
15
|
+
|
|
16
|
+
<what has been completed so far, including PR/session state when relevant>
|
|
17
|
+
|
|
18
|
+
## What worked
|
|
19
|
+
|
|
20
|
+
<important decisions, approaches, or constraints that future agents should preserve>
|
|
21
|
+
|
|
22
|
+
## Next steps
|
|
23
|
+
|
|
24
|
+
<clear next implementation steps>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
- Do not use a one-line feature summary for final handoff or PR creation in a multi-repo session.
|
|
28
|
+
- Keep it concise but durable for a future resumed agent.
|
|
29
|
+
- Prefer high-level state over file-by-file changelogs.
|
|
30
|
+
- Mention unresolved decisions or risks when they matter.
|
|
31
|
+
- In `Next steps`, include only next implementation steps. Do not list routine operational steps such as pushing branches, watching CI, or marking PRs ready.
|
|
32
|
+
|
|
33
|
+
## Dual audience: humans now, agents later
|
|
34
|
+
|
|
35
|
+
The description has two readers, and you must write for both:
|
|
36
|
+
|
|
37
|
+
1. **Humans, in the web UI** — this is the primary surface. The app renders the description as Markdown for people scanning session state.
|
|
38
|
+
2. **Agents, later** — the description is also read back by agents reconstructing session history (for example, on resume). They may not have the original working tree, branch, or local environment available.
|
|
39
|
+
|
|
40
|
+
Because of the second audience, write **durably**:
|
|
41
|
+
|
|
42
|
+
- Avoid ephemeral or local references (paths, ports, in-progress scratch state) that won't mean anything to a later reader.
|
|
43
|
+
- Don't assume the original working tree is available — describe *what* changed and *why* at a level that survives without the diff in front of you.
|
|
44
|
+
- Capture decisions and constraints, not just a snapshot of the current terminal.
|
|
45
|
+
|
|
46
|
+
## Formatting building blocks
|
|
47
|
+
|
|
48
|
+
Plain text (headings + prose + lists) remains the norm. The blocks below are available when they genuinely add clarity — reach for them only when they earn their place.
|
|
49
|
+
|
|
50
|
+
### Headings, emphasis, lists
|
|
51
|
+
|
|
52
|
+
Use the `##` headings from the canonical template. Use **bold**/*italic* for emphasis, and bullet or numbered lists for enumerations. Keep nesting shallow.
|
|
53
|
+
|
|
54
|
+
### Callouts (GitHub alert syntax)
|
|
55
|
+
|
|
56
|
+
The app maps each callout to a status color, so pick the right type:
|
|
57
|
+
|
|
58
|
+
- `> [!WARNING]` / `> [!CAUTION]` — risky migrations, destructive operations, or **required manual steps** a reader must not miss.
|
|
59
|
+
- `> [!NOTE]` / `> [!IMPORTANT]` — context, rationale, or a key constraint worth highlighting.
|
|
60
|
+
- `> [!TIP]` — an optional helpful pointer.
|
|
61
|
+
|
|
62
|
+
```markdown
|
|
63
|
+
> [!WARNING]
|
|
64
|
+
> The auth migration must run before deploying the API repo, or existing sessions are invalidated.
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Tables (GFM)
|
|
68
|
+
|
|
69
|
+
Use a GitHub-Flavored Markdown table only for genuinely tabular data. The polygraph UI already shows per-PR state so avoid that.
|
|
70
|
+
|
|
71
|
+
```markdown
|
|
72
|
+
| Repo | Change Type |
|
|
73
|
+
| ----------- | ------------------ |
|
|
74
|
+
| org/api | api functionality |
|
|
75
|
+
| org/web | text-only |
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Mermaid diagrams
|
|
79
|
+
|
|
80
|
+
The app renders fenced ` ```mermaid ` blocks as diagrams. Use one only when it genuinely clarifies session state. Good uses:
|
|
81
|
+
|
|
82
|
+
- Control or data flow between logic pieces across repos or system components.
|
|
83
|
+
- A sequence of changes, or migration order.
|
|
84
|
+
- A state machine.
|
|
85
|
+
|
|
86
|
+
> [!IMPORTANT]
|
|
87
|
+
> Do NOT redraw the cross-repo dependency / repository graph. The app already renders the repo-relationship graph for every session, so a repo-relationship diagram in the description is redundant.
|
|
88
|
+
|
|
89
|
+
Plain text remains the norm; diagrams are optional and never required.
|
|
90
|
+
|
|
91
|
+
### Code blocks and task lists
|
|
92
|
+
|
|
93
|
+
Use fenced code blocks for commands, signatures, or short snippets. Use task lists (`- [ ]` / `- [x]`) when tracking discrete remaining work items.
|
|
94
|
+
|
|
95
|
+
### Links
|
|
96
|
+
|
|
97
|
+
- Prefer durable external URLs (e.g. GitHub PRs/issues, Linear tickets).
|
|
98
|
+
- Do NOT put local or dev links in the description: `localhost`, `127.0.0.1`, and `file://` URLs do not resolve in the UI and are useless to later readers.
|
|
99
|
+
- Do NOT put repo-relative file paths (`./foo.ts`, `../bar`) as links — they don't resolve in the UI.
|
|
100
|
+
- To attach supplementary references (PRs, issues, other Polygraph sessions, Linear tickets), use the `link_reference` tool instead of inline links. `link_reference` is **supplementary** to the description, not a replacement for it.
|
|
101
|
+
|
|
102
|
+
## Updating the session description
|
|
103
|
+
|
|
104
|
+
Before writing:
|
|
105
|
+
|
|
106
|
+
- Read the current session details.
|
|
107
|
+
- Consider the current conversation, child-agent results, PRs, pushed branches, validation, and unresolved decisions.
|
|
108
|
+
- 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.
|
|
109
|
+
- If updating or replacing the existing last item, write the resulting state directly.
|
|
110
|
+
|
|
111
|
+
Write the description using the canonical structured format above. Then call `update_session` or one of the other tools like `create_pr` that take a description as input.
|