Skip to content

Commit 059aa0c

Browse files
committed
feat: implement DISC-01 compact/full search modes and SAFE-01 freshness-aware edit gating
1 parent adfe8d5 commit 059aa0c

File tree

7 files changed

+1268
-24
lines changed

7 files changed

+1268
-24
lines changed

src/preflight/evidence-lock.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ interface BuildEvidenceLockInput {
4444
searchQualityStatus?: 'ok' | 'low_confidence';
4545
/** Impact coverage: number of known callers covered by results */
4646
impactCoverage?: { covered: number; total: number };
47+
/** Index age signal: fresh (<24h), aging (24h–7d), stale (>7d) */
48+
indexFreshness?: 'fresh' | 'aging' | 'stale';
4749
}
4850

4951
function strengthFactor(strength: EvidenceStrength): number {
@@ -204,6 +206,19 @@ export function buildEvidenceLock(input: BuildEvidenceLockInput): EvidenceLock {
204206
}
205207
}
206208

209+
// Freshness gate: stale index forces block; aging index warns without changing status.
210+
if (input.indexFreshness === 'stale') {
211+
status = 'block';
212+
nextAction = 'Index is stale (>7 days). Run refresh_index before editing.';
213+
if (!gaps.includes('Index is stale')) {
214+
gaps.push('Index is stale (>7 days) — results may be significantly out of date');
215+
}
216+
} else if (input.indexFreshness === 'aging') {
217+
if (!gaps.includes('Index is aging')) {
218+
gaps.push('Index is aging (>24h) — results may not reflect recent changes');
219+
}
220+
}
221+
207222
const readyToEdit =
208223
status === 'pass' &&
209224
(!epistemicStress || !epistemicStress.abstain) &&

0 commit comments

Comments
 (0)