Răsfoiți Sursa

fix(compact): soften English checkpoint rule

fz 1 lună în urmă
părinte
comite
a43a0b5cff

+ 2 - 2
packages/compact/compact-basic/README.i18n.yaml

@@ -2,5 +2,5 @@
 # side as of the last confirmed-consistent state. Both languages carry equal authority;
 # after editing either side, bring the other along and re-record with:
 #   pnpm run verify-translation-pairing --write packages/compact/compact-basic/README.md
-README.md: 28f27c192c8fe13b01a950d5a5814669c79c5afe
-README.zh.md: edac643e69a2cd06832ee0dcbf8b19b5d906386a
+README.md: b35e5dc110e908047338054337b309a77b7e0f68
+README.zh.md: 9c5f83d987b584d58ffacadce4e469bb6ba81aa2

+ 2 - 2
packages/compact/compact-basic/README.md

@@ -107,7 +107,7 @@ The summarization model receives the conversation replayed verbatim — the same
 ##### Compaction instruction (final user message)
 
 ```markdown
-You are now acting as a compaction engine for this AI coding assistant. Produce only an English-language internal engineering checkpoint that condenses the conversation ABOVE into a structured checkpoint that lets another model resume the work with no loss of essential context. Translate narrative source material as needed; preserve exact literals.
+You are now acting as a compaction engine for this AI coding assistant. Condense the conversation ABOVE into a structured checkpoint that lets another model resume the work with no loss of essential context.
 
 Output EXACTLY the Markdown structure below: keep every section, in order. Use terse bullets, not prose paragraphs. Write "(none)" for an empty section — never drop a section.
 
@@ -136,7 +136,7 @@ Output EXACTLY the Markdown structure below: keep every section, in order. Use t
 - [decisions and their rationale, constraints, user preferences, open questions, data needed to continue]
 
 Rules:
-- Preserve exact file paths, commands, error strings, identifiers, and function signatures.
+- Write concise English engineering prose. Preserve exact file paths, commands, error strings, identifiers, numeric values, function signatures, and syntax fragments.
 - Capture user feedback and explicit instructions faithfully, especially corrections.
 - Do NOT mention this summarization request or that the context was compacted.
 - Output only the checkpoint text: do not call any tool or take any other action.

+ 2 - 2
packages/compact/compact-basic/README.zh.md

@@ -107,7 +107,7 @@ This is an automatically generated checkpoint condensing an earlier span of the
 ##### 压缩指令(最终 user 消息)
 
 ```markdown
-You are now acting as a compaction engine for this AI coding assistant. Produce only an English-language internal engineering checkpoint that condenses the conversation ABOVE into a structured checkpoint that lets another model resume the work with no loss of essential context. Translate narrative source material as needed; preserve exact literals.
+You are now acting as a compaction engine for this AI coding assistant. Condense the conversation ABOVE into a structured checkpoint that lets another model resume the work with no loss of essential context.
 
 Output EXACTLY the Markdown structure below: keep every section, in order. Use terse bullets, not prose paragraphs. Write "(none)" for an empty section — never drop a section.
 
@@ -136,7 +136,7 @@ Output EXACTLY the Markdown structure below: keep every section, in order. Use t
 - [decisions and their rationale, constraints, user preferences, open questions, data needed to continue]
 
 Rules:
-- Preserve exact file paths, commands, error strings, identifiers, and function signatures.
+- Write concise English engineering prose. Preserve exact file paths, commands, error strings, identifiers, numeric values, function signatures, and syntax fragments.
 - Capture user feedback and explicit instructions faithfully, especially corrections.
 - Do NOT mention this summarization request or that the context was compacted.
 - Output only the checkpoint text: do not call any tool or take any other action.

+ 2 - 2
packages/compact/compact-basic/src/summarizer.ts

@@ -29,7 +29,7 @@ const SUMMARY_CLOSE_TAG = '</compacted-summary>'
  * request, so the provider's KV cache is reused instead of invalidated.
  */
 const COMPACTION_INSTRUCTION = [
-  'You are now acting as a compaction engine for this AI coding assistant. Produce only an English-language internal engineering checkpoint that condenses the conversation ABOVE into a structured checkpoint that lets another model resume the work with no loss of essential context. Translate narrative source material as needed; preserve exact literals.',
+  'You are now acting as a compaction engine for this AI coding assistant. Condense the conversation ABOVE into a structured checkpoint that lets another model resume the work with no loss of essential context.',
   '',
   'Output EXACTLY the Markdown structure below: keep every section, in order. Use terse bullets, not prose paragraphs. Write "(none)" for an empty section — never drop a section.',
   '',
@@ -58,7 +58,7 @@ const COMPACTION_INSTRUCTION = [
   '- [decisions and their rationale, constraints, user preferences, open questions, data needed to continue]',
   '',
   'Rules:',
-  '- Preserve exact file paths, commands, error strings, identifiers, and function signatures.',
+  '- Write concise English engineering prose. Preserve exact file paths, commands, error strings, identifiers, numeric values, function signatures, and syntax fragments.',
   '- Capture user feedback and explicit instructions faithfully, especially corrections.',
   '- Do NOT mention this summarization request or that the context was compacted.',
   '- Output only the checkpoint text: do not call any tool or take any other action.',

+ 2 - 2
packages/compact/compact-basic/tests/compact-basic.spec.ts

@@ -1224,8 +1224,8 @@ describe('default one-shot summarizer', () => {
     expect(messages[0]).toEqual(prefix)
     const last = messages.at(-1)?.content[0]
     const lastText = last?.type === 'text' ? last.text : ''
-    expect(lastText).toContain('Produce only an English-language internal engineering checkpoint')
-    expect(lastText).toContain('Translate narrative source material as needed; preserve exact literals.')
+    expect(lastText).toContain('Write concise English engineering prose.')
+    expect(lastText).toContain('numeric values, function signatures, and syntax fragments.')
     expect(lastText).toContain('## Primary Request and Intent')
   })
 

+ 2 - 2
packages/compact/compact-basic/tests/compact-loop-repro.spec.ts

@@ -345,8 +345,8 @@ describe('context-overflow recovery across the real loop and compact-basic', ()
         const instruction = adapter.summaryRequests[0]!.messages.at(-1)?.content
           .map(block => (block.type === 'text' ? block.text : ''))
           .join('') ?? ''
-        expect(instruction).toContain('Produce only an English-language internal engineering checkpoint')
-        expect(instruction).toContain('Translate narrative source material as needed; preserve exact literals.')
+        expect(instruction).toContain('Write concise English engineering prose.')
+        expect(instruction).toContain('numeric values, function signatures, and syntax fragments.')
         expect(JSON.stringify(adapter.conversationRequests[0]!.messages)).toContain('OLD HISTORY SENTINEL')
         const retry = JSON.stringify(adapter.conversationRequests[1]!.messages)
         expect(retry).toContain('RECOVERY CHECKPOINT')