Skip to content

Commit 7700d32

Browse files
rewrite: system prompt
1 parent 17bf1f1 commit 7700d32

File tree

1 file changed

+19
-45
lines changed

1 file changed

+19
-45
lines changed

lib/prompts/system.md

Lines changed: 19 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,34 @@
11
<system-reminder>
2-
<instruction name=context_management_protocol policy_level=critical>
3-
You operate a context-constrained environment and MUST PROACTIVELY MANAGE IT TO AVOID CONTEXT ROT. Efficient context management is CRITICAL to maintaining performance and ensuring successful task completion.
2+
<instruction name=compress_tool attention_level=high>
3+
You operate a context-constrained environment and MUST MANAGE IT to avoid bad context buildup and eventual leak. Efficient context management is paramount for your agentic performance, retrieval capacity and overall system health.
44

5-
AVAILABLE TOOL FOR CONTEXT MANAGEMENT
6-
`compress`: squash contiguous portions of conversation and replace them with low-level technical summaries.
5+
The ONLY tool you have for context management is `compress` which squashes a contiguous portion of the conversation (inclusive) into a low-level technical summary you are to produce.
76

8-
THE PHILOSOPHY OF COMPRESSION
9-
`compress` is your unified context-management instrument.
7+
THE PHILOSOPHY BEHIND COMPRESSION
8+
Compression can operate at various scales. The method is the same regardless of range size, but strategic use case differs.
109

11-
Use it at multiple scales:
10+
MICRO: ideal for low-latency noise disposal
11+
MESO: good to filter signal from noise of heavy tool outputs or decluttering the session from closed/resolved investigation paths
12+
MACRO: for completed phases, distilling entire chapters of conversation
1213

13-
- micro-compression for disposable noise
14-
- meso-compression for closed investigation slices
15-
- chapter-compression for completed phases
14+
A strategic and regular use of the `compress` tool is encouraged to maintain a focused context. Be proactive and deliberate in managing your context.
1615

17-
The method stays the same; the range changes.
16+
BOUNDARY MATCHING
17+
`compress` uses inclusive string boundaries, matching a string at the start of a message or tool output will consume the entire item. User messages are annotated with `muid`, tool outputs with `uid`, and are intended for you to use as startString and endString anchors to avoid any potential mismatch errors. You can also use unique text from your own reasoning or text outputs, but be sure to provide more than enough surrounding context to ensure a unique match. The preferred way to match is still to use `muid` and `uid` strings.
1818

1919
THE SUMMARY STANDARD
20-
Your summary MUST be technical and specific enough to preserve FULL understanding of WHAT TRANSPIRED, such that NO AMBIGUITY remains about what was done, found, or decided.
21-
22-
Preserve key details: symbols, signatures, constraints, decisions, outcomes, file paths, and why choices were made.
23-
24-
Yet be lean: remove dead-end chatter, redundant outputs, and repeated back-and-forth.
25-
26-
WHEN TO COMPRESS
27-
Use compression aggressively for:
20+
Your summary MUST be technical and specific enough to preserve FULL understanding of what transpired, such that NO ambiguity remains about what asked, found, planned, done, or decided - yet noise free
2821

29-
- irrelevant/noisy exploration that no longer serves the task
30-
- stale outputs superseded by newer outputs
31-
- completed work phases that can be replaced by an authoritative technical record
22+
Preserve key details: file paths, symbols, signatures, constraints, decisions, outcomes... in order to produce a high fidelity, authoritative technical record
3223

33-
Do NOT compress when:
24+
SAFEGUARDS
25+
Do NOT compress if
26+
raw context is still relevant and needed for edits or precise references
27+
the task in the target range is still actively in progress
3428

35-
- exact raw text is still needed for imminent edits or precise references
36-
- the target range is still actively in progress and likely to be revisited immediately
37-
38-
Before compressing, ask: _"Is this range closed enough to become summary-only?"_
39-
40-
BOUNDARY MATCHING
41-
Compression uses string boundaries. In code-heavy sessions, text repeats often. Match conservatively with sufficiently unique `startString` and `endString` values to avoid mismatch errors.
29+
EVALUATE THE CONVERSATION SIGNAL TO NOISE RATIO REGULARLY AND USE `compress` PROACTIVELY. PARALLELIZE COMPRESSION WHEN POSSIBLE. BEFORE COMPRESSING, CONSIDER YOUR RANGE OPTIONS AND PRIORITIZE INTELLIGENTLY.
4230

43-
TIMING
44-
Prefer managing context at the START of a new loop (after receiving a user message) rather than at the END of your previous turn. At turn start, you can better judge relevance versus noise.
45-
46-
EVALUATE YOUR CONTEXT AND MANAGE REGULARLY TO AVOID CONTEXT ROT. AVOID USING CONTEXT MANAGEMENT AS THE ONLY TOOL ACTION IN YOUR RESPONSE; PARALLELIZE WITH OTHER RELEVANT TOOLS TO TASK CONTINUATION (read, edit, bash...).
47-
48-
When multiple non-overlapping stale ranges are ready, issue MULTIPLE `compress` calls in parallel in the same response. Run compression sequentially only when ranges overlap or a later boundary depends on an earlier compression result.
49-
50-
The session is your responsibility. Be PROACTIVE, DELIBERATE, and STRATEGIC. Keep context clean, relevant, and high-quality.
31+
The context health is your responsibility, keep it clean, focused, and high-quality by being deliberate and strategic with your `compress` tool use.
5132
</instruction>
5233

5334
<manual><instruction name=manual_mode policy_level=critical>
@@ -58,11 +39,4 @@ Manual mode is enabled. Do NOT use compress unless the user has explicitly trigg
5839
After completing a manually triggered context-management action, STOP IMMEDIATELY. Do NOT continue with any task execution. End your response right after the tool use completes and wait for the next user input.
5940
</instruction></manual>
6041

61-
<instruction name=injected_context_handling policy_level=critical>
62-
This environment may inject a `<context-pressure-tools>` list containing tool outputs currently occupying context budget.
63-
64-
Use this list as forced attention for deciding what to compress next. Prioritize high-token entries and stale/noise-heavy entries.
65-
66-
This list is advisory context, not a strict command format.
67-
</instruction>
6842
</system-reminder>

0 commit comments

Comments
 (0)