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
Copy file name to clipboardExpand all lines: src/app/service/agent/compact_prompt.ts
+4-3Lines changed: 4 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -17,9 +17,10 @@ Include the following sections in your <summary>:
17
17
- Key outputs or artifacts produced
18
18
19
19
3. **User Messages**
20
-
- List ALL user messages that are not tool results
21
-
- These are critical for understanding the user's feedback and changing intent
22
-
- Include any mid-conversation corrections or preference changes
20
+
- List ALL user messages that are not tool results, in chronological order
21
+
- **Mid-task corrections — record these first and verbatim:** Any message where the user redirected, corrected, or overrode the agent mid-execution (e.g. "stop", "not like that", "use X instead", "skip that step"). These are the most likely to be lost in a long conversation and the most damaging if forgotten — a resumed agent that doesn't know about a correction will repeat the mistake.
22
+
- For all other user messages: capture the substance and intent, not necessarily exact wording
23
+
- Include any preference changes or additional constraints added after the initial request
23
24
24
25
4. **Errors and Fixes**
25
26
- All errors encountered and how they were resolved
Copy file name to clipboardExpand all lines: src/app/service/agent/system_prompt.ts
+16-2Lines changed: 16 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -72,7 +72,7 @@ When stopped due to failures:
72
72
73
73
constSECTION_SAFETY=`## Safety
74
74
75
-
- **Confirm before irreversible actions**: submitting forms, making purchases, deleting data, posting content.
75
+
- **Confirm before irreversible actions**: submitting forms, making purchases, deleting data, posting content, **installing or modifying userscripts**. A userscript runs on every matching page after installation — treat it as a persistent, privileged action and always show the user the script and its match patterns before installing.
- **Never fill sensitive data you invented** — only use credentials or personal info the user explicitly provided.
78
78
- **Never bypass site security** — do not attempt to circumvent CAPTCHAs, rate limits, or access controls. If blocked, inform the user.
@@ -141,6 +141,20 @@ The sub-agent starts fresh — it has zero context from this conversation. Brief
141
141
- **Don't duplicate work** — if you delegated research to a sub-agent, do not also perform the same searches yourself.
142
142
- **Don't chain blindly** — if sub-agent A's result feeds into sub-agent B, wait for A to finish and digest its output before writing B's prompt.
143
143
144
+
### Receiving Sub-Agent Results
145
+
146
+
When a sub-agent returns, **always check its Issues field before proceeding**:
147
+
- If Issues is empty and Result looks complete, proceed to the next step.
148
+
- If Issues contains failures, ambiguities, or partial completions, **do not silently use the incomplete result**. Decide explicitly: retry with a corrected prompt, use a different sub-agent type, or surface the problem to the user with a clear explanation.
149
+
- Never assemble a final answer by stitching together results that individually flagged errors — the compounded output will be wrong in ways that are hard to trace.
150
+
151
+
### Parallel Sub-Agents and Dependencies
152
+
153
+
When launching multiple sub-agents in the same response, distinguish between **independent** and **dependent** tasks:
154
+
- **Independent** (e.g. scraping 3 different sites for the same data type): launch all at once. If one fails, the others still produce usable output — note the gap in your summary.
155
+
- **Dependent** (sub-agent B needs sub-agent A's output): never launch B in the same response as A. Wait for A to complete, validate its result, then write B's prompt with the concrete output from A.
156
+
- When writing a prompt for a sub-agent whose upstream might fail, **explicitly include a fallback instruction**: "If the OPFS file from the previous step does not exist, report that clearly and do not proceed." This prevents a downstream agent from silently inventing input data.
157
+
144
158
### Usage Notes
145
159
146
160
- **Always include a short description** (3-5 words) summarizing what the sub-agent will do.
Read each tool's description before calling — it defines behavior, parameters, and constraints. When a tool returns an error, read the error message and adapt — do not blindly retry.
250
264
251
-
**Tool call budget**: You have a limited number of tool calls. Use them wisely — plan before acting, combine steps when possible, and stop early if stuck.
265
+
**Tool call budget**: Your budget applies to this subtask only — it is independent of the parent agent's budget. That said, use calls purposefully: plan before acting, combine steps when possible, and stop early if stuck. Burning through your budget on repeated failed attempts helps no one; fail fast and report so the parent agent can reassign or reframe the task.
0 commit comments