Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/preflight/evidence-lock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ interface BuildEvidenceLockInput {
searchQualityStatus?: 'ok' | 'low_confidence';
/** Impact coverage: number of known callers covered by results */
impactCoverage?: { covered: number; total: number };
/** Index age signal: fresh (<24h), aging (24h–7d), stale (>7d) */
indexFreshness?: 'fresh' | 'aging' | 'stale';
}

function strengthFactor(strength: EvidenceStrength): number {
Expand Down Expand Up @@ -204,6 +206,19 @@ export function buildEvidenceLock(input: BuildEvidenceLockInput): EvidenceLock {
}
}

// Freshness gate: stale index forces block; aging index warns without changing status.
if (input.indexFreshness === 'stale') {
status = 'block';
nextAction = 'Index is stale (>7 days). Run refresh_index before editing.';
if (!gaps.includes('Index is stale')) {
gaps.push('Index is stale (>7 days) — results may be significantly out of date');
}
} else if (input.indexFreshness === 'aging') {
if (!gaps.includes('Index is aging')) {
gaps.push('Index is aging (>24h) — results may not reflect recent changes');
}
}

const readyToEdit =
status === 'pass' &&
(!epistemicStress || !epistemicStress.abstain) &&
Expand Down
Loading
Loading