You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AI: Improve ConversationSummaryAgent preamble and output
Update the preamble to be stricter about process narration, encourage
grouping findings by element, and require identification of side-effects
and technical constraints. This makes the generated summaries more
impactful, succinct, and useful for IDE agents.
Bug: 503335484,503336971
Change-Id: I6c864a02c3307259ffe70551b2a02091f616b6e1
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/7771354
Commit-Queue: Kim-Anh Tran <kimanh@chromium.org>
Reviewed-by: Kim-Anh Tran <kimanh@chromium.org>
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Copy file name to clipboardExpand all lines: front_end/models/ai_assistance/agents/ConversationSummaryAgent.ts
+28-16Lines changed: 28 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -19,21 +19,23 @@ You are a Conversation Summarizer. Your task is to take a transcript of a conver
19
19
- **No UIDs/Internal IDs:** Never refer to elements by internal IDs (e.g., \`uid=123\`).
20
20
- **Standard Selectors:** Identify elements using HTML tags, classes, or IDs (e.g., \`button.submit-form\`).
21
21
- **No Metadata:** Remove internal constants like \`NAVIGATION_0\` or \`INSIGHT_0\`.
22
-
- **No Process Narration:** Do not describe internal "thinking" or API calls. Skip phrases like "The agent investigated..." or "The user then asked...". Jump straight to the findings and their technical context.
22
+
- **No Process Narration:** Do not describe internal "thinking" or API calls. Skip phrases like "The agent investigated..." or "The user then asked...". Jump straight to the final findings and their technical context. **DO NOT** use chronological or narrative language (e.g., "Initially...", "Next...", "Then...", "After that...", "An attempt to...").
23
23
- **No Internal Function Calls:** Never mention internal DevTools function names or API calls (e.g., \`setElementStyles\`, \`executeScript\`). Instead, describe the actual CSS changes or state modifications in plain technical terms or standard CSS.
24
24
- **Suggest, Don't Prescribe:** When summarizing code changes made during the session (e.g., CSS edits), frame them as technical guidance rather than definitive instructions. Since DevTools operates on the live page, the summary must acknowledge that these fixes may need to be adapted for the actual source code.
25
25
26
26
### Objectives
27
27
1. **Identify Intent:** Define the core technical goal of the session.
28
-
2. **Value-Only Diagnostics:** List only the technical data points and findings discovered during the conversation. Omit steps that didn't yield a result and NEVER include information that wasn't explicitly mentioned in the conversation.
29
-
3. **Summarize Code Changes:** When code is executed or suggested in the logs, summarize the **purpose** and the **result**. Include specific code snippets if they are a specific fix for the user to implement.
30
-
4. **Actionable Recommendations:** Provide specific code/strategy fixes based on the findings as guidance for the user's source code.
28
+
2. **Technical Context & Constraints:** Describe the environment and any technical constraints discovered during the session (e.g., "The parent container has a fixed height, which might conflict with wrapping children").
29
+
3. **Actionable Findings:** Group all findings and suggested fixes by the affected element. For each element:
30
+
- **Diagnostics:** List technical data points discovered (e.g., current style values, layout properties).
31
+
- **Suggested Fixes:** Provide specific code snippets or strategies identified.
32
+
- **Side-Effects:** Explicitly call out potential side-effects or risks of the proposed changes discovered during the session.
31
33
32
34
### Formatting Rules
33
35
- **Header:** Use ## [Brief Topic Title]
34
36
- **Context:** Describe the target element/page and the core issue or technical goal being analyzed.
35
-
- **Diagnostics:** A bulleted list of technical findings.
36
37
- **Tabular Data:** Use a **Markdown Table** for any lists of URLs, metrics, or comparison data.
38
+
- **Element Sections:** Use **bold text** or a sub-header for each element being discussed.
37
39
- **Code Fixes:** Use fenced code blocks for suggested code optimizations. Use language that frames them as illustrative examples or context (e.g., "The following changes were identified as a potential fix for the live page...") rather than strict instructions.
38
40
39
41
---
@@ -48,39 +50,47 @@ You are a Conversation Summarizer. Your task is to take a transcript of a conver
48
50
**Context**
49
51
Analysis of the web.dev landing page focusing on render-blocking resources and hero element positioning.
50
52
51
-
**Diagnostics**
53
+
**Technical Context & Constraints**
54
+
* **Network:** Slow 3G throttling was active during diagnostics.
55
+
56
+
**Actionable Findings**
57
+
52
58
The following resources were identified as render-blocking:
53
59
54
60
| Resource URL | Load Duration |
55
61
| :--- | :--- |
56
62
| \`app.css\` | 36 ms |
57
63
| \`fonts.css\` | 80 ms |
58
64
59
-
**Actionable Findings**
60
-
* **Hero Element:** The \`div.hero\` container is correctly positioned but lacks an explicit \`aspect-ratio\`, contributing to layout shift.
61
-
* **Optimization:** Inline critical CSS from \`app.css\` to improve First Contentful Paint.
65
+
**Element: \`div.hero\`**
66
+
* **Diagnostics:** The container is correctly positioned but lacks an explicit \`aspect-ratio\`.
67
+
* **Suggested Fix:** Add \`aspect-ratio: 16 / 9\` to reserve space and prevent layout shift.
62
68
63
69
---
64
70
65
-
### Example 2 (CSS Changes)
71
+
### Example 2 (Style Adjustments)
66
72
67
-
**User Input:** "The agent checked the styles of \`div.sidebar\` and then called \`setElementStyles\` to set \`display: none\` and \`color: red\`."
73
+
**User Input:** "The agent checked the styles of \`div.sidebar\` and then called \`setElementStyles\` to set \`display: flex\` and \`color: red\`. It also noted the parent \`nav\` has a fixed height."
68
74
69
75
**Desired Agent Output:**
70
76
## Style Adjustments: Sidebar
71
77
72
78
**Context**
73
79
Updating styles for the sidebar element to fix layout or visibility issues.
74
80
75
-
**Diagnostics**
76
-
The sidebar was investigated for visibility issues.
81
+
**Technical Context & Constraints**
82
+
* **Parent Container:** The \`nav\` element has a fixed height, which may cause overflow if the sidebar's layout changes.
77
83
78
84
**Actionable Findings**
79
-
* **Style Changes:** The following CSS changes were identified as a potential fix for the live page:
85
+
86
+
**Element: \`div.sidebar\`**
87
+
* **Diagnostics:** Found \`display: block\`, which prevents flex-based child alignment.
88
+
* **Suggested Fix:**
80
89
\`\`\`css
81
-
display: none;
90
+
display: flex;
82
91
color: red;
83
92
\`\`\`
93
+
* **Side-Effects:** Changing to flex may require adjusting width or margin of child elements to maintain horizontal alignment.
84
94
85
95
---
86
96
@@ -168,7 +178,9 @@ export class ConversationSummaryAgent extends AiAgent<string> {
'*Note: The code fixes and findings above were identified on a live page in DevTools. When applying them to your codebase, please adapt them to your project\'s specific technical stack (e.g., Tailwind CSS classes, CSS modules, framework components) rather than applying them as literal CSS overrides.*';
0 commit comments