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
constDURABLE_LEARNING_CRITERIA=`Extract only new, non-obvious, durable codebase knowledge:
4
+
5
+
- hidden relationships between files or modules;
6
+
- execution paths that differ from how the code appears;
7
+
- non-obvious configuration, environment variables, or flags;
8
+
- debugging breakthroughs when errors were misleading;
9
+
- API or tool quirks and their workarounds;
10
+
- useful build or test commands not already documented;
11
+
- architectural decisions and constraints;
12
+
- files that must change together.
13
+
14
+
Do not treat obvious documented facts, standard language or framework behavior, existing repository guidance, verbose explanations, or session-specific details as durable learning.`
15
+
16
+
functionrenderNotificationInstructions(): string{
17
+
return`Before starting the learning pass, send the user this exact progress message:
18
+
19
+
\`Initialized pre-compression learning.\`
20
+
21
+
After the learning pass, send one concise progress message before invoking the compress tool:
22
+
23
+
- If durable learning was found, start with \`Learning is finished.\` and briefly list the insights and any files changed.
24
+
- If there was no durable learning, send exactly \`Learning is finished. Nothing to extract.\`
25
+
26
+
These messages must not interrupt compression or ask the user for input.`
27
+
}
28
+
29
+
exportfunctionappendCompressionLearning(
30
+
prompt: string,
31
+
config?: CompressionLearningConfig,
32
+
): string{
33
+
if(!config?.enabled){
34
+
returnprompt
35
+
}
36
+
37
+
constsections=[
38
+
prompt.trim(),
39
+
`LEARN BEFORE COMPRESSION
40
+
41
+
Before invoking the compress tool, review the selected closed context for durable codebase learning.
42
+
43
+
First follow any learning policy present in the system or project instructions. Read the applicable repository guidance before deciding what to extract or where to persist it. Treat the criteria below as defaults where project policy is silent; do not override more specific project learning rules.
44
+
45
+
${DURABLE_LEARNING_CRITERIA}
46
+
47
+
When genuine new learning exists, determine its narrowest applicable directory and follow the project's persistence policy. If the project does not specify a destination, read the relevant existing AGENTS.md files and persist each insight in 1-3 concise lines in the nearest appropriate AGENTS.md before compressing. Do not create or edit guidance files when there is no durable new learning.
48
+
49
+
Do not manufacture learning or delay necessary compression. The compression summary must still preserve all session state needed to continue; persisted guidance complements rather than replaces that summary.`,
0 commit comments