@@ -2,7 +2,7 @@ import type { LongTermMemoryEntry, WorkspaceMemoryStore } from "./types.ts";
22import { LONG_TERM_LIMITS } from "./types.ts" ;
33import { workspaceKey , workspaceMemoryPath } from "./paths.ts" ;
44import { atomicWriteJSON , readJSON , updateJSON } from "./storage.ts" ;
5- import { assessMemoryQuality } from "./memory-quality.ts" ;
5+ import { assessMemoryQuality , isProgressSnapshotViolation } from "./memory-quality.ts" ;
66
77// Minimum length for workspace_memory envelope: <workspace_memory>\n...\n</workspace_memory>
88const MIN_ENVELOPE_LENGTH = 80 ;
@@ -254,28 +254,6 @@ export function redactCredentials(text: string): string {
254254 return result ;
255255}
256256
257- export function isProjectSnapshotViolation ( text : string ) : boolean {
258- // Test/suite counts
259- if ( / \d + \s + t e s t s ? \s + p a s s (?: e d ) ? / i. test ( text ) ) return true ;
260- if ( / \d + \s + s u i t e s ? \s + (?: p a s s | f a i l ) / i. test ( text ) ) return true ;
261-
262- // File counts with snapshot context, excluding limit statements
263- if ( / \d + \s * (?: 個 | 个 ) ? \s * (?: f i l e s ? | 文 件 ) / i. test ( text ) ) {
264- const hasSnapshotContext = / 同 步 | s y n c e d | u p l o a d e d | d o w n l o a d e d | c o m p l e t e d | g e n e r a t e d | c r e a t e d | m o d i f i e d | p r o c e s s e d | 完 成 / i. test ( text ) ;
265- const hasLimitContext = / l i m i t | m a x | m a x i m u m | m i n | m i n i m u m | s u p p o r t s ? | a l l o w e d | p e r \s + (?: b a t c h | r e q u e s t | u p l o a d ) / i. test ( text ) ;
266- if ( hasSnapshotContext && ! hasLimitContext ) return true ;
267- }
268-
269- // Phase/Wave/Sprint/Milestone/Task progress
270- if ( / (?: p h a s e s ? | w a v e s ? | s p r i n t s ? | m i l e s t o n e s ? | t a s k s ? ) \s * \d + (?: \s * [ - – ] \s * \d + ) ? / i. test ( text ) ) {
271- if ( / c o m p l e t e d | d o n e | f i n i s h e d | 完 成 / i. test ( text ) ) return true ;
272- }
273-
274- if ( / (?: 已 完 成 | 完 成 ) .{ 0 , 30 } (?: p h a s e s ? | w a v e s ? | s p r i n t s ? | m i l e s t o n e s ? | t a s k s ? ) / i. test ( text ) ) return true ;
275-
276- return false ;
277- }
278-
279257export function runMigrationP0Cleanup (
280258 store : WorkspaceMemoryStore ,
281259 nowIso : string ,
@@ -288,7 +266,7 @@ export function runMigrationP0Cleanup(
288266 if ( entry . source !== "compaction" ) return entry ;
289267 if ( entry . type !== "project" ) return entry ;
290268
291- if ( isProjectSnapshotViolation ( entry . text ) ) {
269+ if ( isProgressSnapshotViolation ( entry . text ) ) {
292270 return {
293271 ...entry ,
294272 status : "superseded" as const ,
0 commit comments