fix(compact): soften English checkpoint rule
This commit is contained in:
@@ -2,5 +2,5 @@
|
|||||||
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
# 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:
|
# after editing either side, bring the other along and re-record with:
|
||||||
# pnpm run verify-translation-pairing --write packages/compact/compact-basic/README.md
|
# pnpm run verify-translation-pairing --write packages/compact/compact-basic/README.md
|
||||||
README.md: 28f27c192c8fe13b01a950d5a5814669c79c5afe
|
README.md: b35e5dc110e908047338054337b309a77b7e0f68
|
||||||
README.zh.md: edac643e69a2cd06832ee0dcbf8b19b5d906386a
|
README.zh.md: 9c5f83d987b584d58ffacadce4e469bb6ba81aa2
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ The summarization model receives the conversation replayed verbatim — the same
|
|||||||
##### Compaction instruction (final user message)
|
##### Compaction instruction (final user message)
|
||||||
|
|
||||||
```markdown
|
```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.
|
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]
|
- [decisions and their rationale, constraints, user preferences, open questions, data needed to continue]
|
||||||
|
|
||||||
Rules:
|
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.
|
- Capture user feedback and explicit instructions faithfully, especially corrections.
|
||||||
- Do NOT mention this summarization request or that the context was compacted.
|
- 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.
|
- Output only the checkpoint text: do not call any tool or take any other action.
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ This is an automatically generated checkpoint condensing an earlier span of the
|
|||||||
##### 压缩指令(最终 user 消息)
|
##### 压缩指令(最终 user 消息)
|
||||||
|
|
||||||
```markdown
|
```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.
|
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]
|
- [decisions and their rationale, constraints, user preferences, open questions, data needed to continue]
|
||||||
|
|
||||||
Rules:
|
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.
|
- Capture user feedback and explicit instructions faithfully, especially corrections.
|
||||||
- Do NOT mention this summarization request or that the context was compacted.
|
- 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.
|
- Output only the checkpoint text: do not call any tool or take any other action.
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ const SUMMARY_CLOSE_TAG = '</compacted-summary>'
|
|||||||
* request, so the provider's KV cache is reused instead of invalidated.
|
* request, so the provider's KV cache is reused instead of invalidated.
|
||||||
*/
|
*/
|
||||||
const COMPACTION_INSTRUCTION = [
|
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.',
|
'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]',
|
'- [decisions and their rationale, constraints, user preferences, open questions, data needed to continue]',
|
||||||
'',
|
'',
|
||||||
'Rules:',
|
'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.',
|
'- Capture user feedback and explicit instructions faithfully, especially corrections.',
|
||||||
'- Do NOT mention this summarization request or that the context was compacted.',
|
'- 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.',
|
'- Output only the checkpoint text: do not call any tool or take any other action.',
|
||||||
|
|||||||
@@ -1224,8 +1224,8 @@ describe('default one-shot summarizer', () => {
|
|||||||
expect(messages[0]).toEqual(prefix)
|
expect(messages[0]).toEqual(prefix)
|
||||||
const last = messages.at(-1)?.content[0]
|
const last = messages.at(-1)?.content[0]
|
||||||
const lastText = last?.type === 'text' ? last.text : ''
|
const lastText = last?.type === 'text' ? last.text : ''
|
||||||
expect(lastText).toContain('Produce only an English-language internal engineering checkpoint')
|
expect(lastText).toContain('Write concise English engineering prose.')
|
||||||
expect(lastText).toContain('Translate narrative source material as needed; preserve exact literals.')
|
expect(lastText).toContain('numeric values, function signatures, and syntax fragments.')
|
||||||
expect(lastText).toContain('## Primary Request and Intent')
|
expect(lastText).toContain('## Primary Request and Intent')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -345,8 +345,8 @@ describe('context-overflow recovery across the real loop and compact-basic', ()
|
|||||||
const instruction = adapter.summaryRequests[0]!.messages.at(-1)?.content
|
const instruction = adapter.summaryRequests[0]!.messages.at(-1)?.content
|
||||||
.map(block => (block.type === 'text' ? block.text : ''))
|
.map(block => (block.type === 'text' ? block.text : ''))
|
||||||
.join('') ?? ''
|
.join('') ?? ''
|
||||||
expect(instruction).toContain('Produce only an English-language internal engineering checkpoint')
|
expect(instruction).toContain('Write concise English engineering prose.')
|
||||||
expect(instruction).toContain('Translate narrative source material as needed; preserve exact literals.')
|
expect(instruction).toContain('numeric values, function signatures, and syntax fragments.')
|
||||||
expect(JSON.stringify(adapter.conversationRequests[0]!.messages)).toContain('OLD HISTORY SENTINEL')
|
expect(JSON.stringify(adapter.conversationRequests[0]!.messages)).toContain('OLD HISTORY SENTINEL')
|
||||||
const retry = JSON.stringify(adapter.conversationRequests[1]!.messages)
|
const retry = JSON.stringify(adapter.conversationRequests[1]!.messages)
|
||||||
expect(retry).toContain('RECOVERY CHECKPOINT')
|
expect(retry).toContain('RECOVERY CHECKPOINT')
|
||||||
|
|||||||
Reference in New Issue
Block a user