Skip to content

Commit 46a4d6a

Browse files
committed
feat: show pro memory policy
1 parent 75c6e98 commit 46a4d6a

3 files changed

Lines changed: 31 additions & 3 deletions

File tree

docs/PROJECT_STATE.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Project State
22

3-
Last updated: 2026-04-14 (Pro proof memory context visibility)
3+
Last updated: 2026-04-14 (Pro proof memory policy visibility)
44

55
## Canonical build docs
66

@@ -18,7 +18,7 @@ Strategy, market, pricing, and older design docs still matter, but if there is a
1818

1919
## Current Version
2020

21-
**v0.19.4** - OSS Pro visibility bundle release: `check --json` exposes installed Pro proof plans, proof recipe summaries, and proof memory context at the top level, and `pro status` plus `check --review` render Pro proof-memory, proof memory health, cleanup history, proof memory context, proof recipes, learned proof, learned proof scoring, proof workbench next actions, stale recipe warnings, proof recipe next actions, proof closure summaries, reusable proof commands, reusable evidence paths, and prioritized proof-surface wording when available.
21+
**v0.19.4** - OSS Pro visibility bundle release: `check --json` exposes installed Pro proof plans, proof recipe summaries, and proof memory context at the top level, and `pro status` plus `check --review` render Pro proof-memory, proof memory health, cleanup history, proof memory context, proof memory policy, proof recipes, learned proof, learned proof scoring, proof workbench next actions, stale recipe warnings, proof recipe next actions, proof closure summaries, reusable proof commands, reusable evidence paths, and prioritized proof-surface wording when available.
2222

2323
## Goal
2424

@@ -64,6 +64,7 @@ Pivot from a CLI-only merge gate to an agent-native runtime with system-level au
6464
- Post-v0.19.4 draft update: `check --json` now adds a top-level `proofRecipe` summary when Pro provides learned proof evidence, including memory health penalty and warning fields. `check --review` also renders the Pro-provided memory health penalty and warning without moving scoring logic into OSS.
6565
- Post-v0.19.4 draft update: agent-guardrails pro status now renders Pro-provided cleanup event history, including cleanup event count, last cleanup time, recent cleanup summary, affected commands, and archive reasons.
6666
- Post-v0.19.4 draft update: `check --json` now adds a top-level `proofMemoryContext` summary when Pro explains recent proof-memory cleanup. `check --review` renders the same context, archived commands, cleanup reasons, and go-live impact without moving memory-change logic into OSS.
67+
- Post-v0.19.4 draft update: `agent-guardrails pro status` now renders Pro-provided proof memory policy thresholds, including stale age, failed-reuse archive threshold, and cleanup-context window.
6768

6869
## Strategic Direction Update (2026-04-07)
6970

lib/commands/pro-status.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,26 @@ function printProofMemory(proofMemory) {
106106
}
107107
}
108108

109+
function formatProofMemoryPolicy(policy) {
110+
if (!policy) return null;
111+
112+
const parts = [];
113+
if (policy.staleAfterDays != null) {
114+
parts.push(`stale after ${policy.staleAfterDays} days`);
115+
}
116+
if (policy.maxFailureCount != null) {
117+
const failedReuseLabel = Number(policy.maxFailureCount) === 1
118+
? "failed reuse attempt"
119+
: "failed reuse attempts";
120+
parts.push(`archive after ${policy.maxFailureCount} ${failedReuseLabel}`);
121+
}
122+
if (policy.recentCleanupDays != null) {
123+
parts.push(`cleanup context ${policy.recentCleanupDays} days`);
124+
}
125+
126+
return parts.length > 0 ? `Policy: ${parts.join("; ")}` : null;
127+
}
128+
109129
function printProofMemoryHealth(proofMemoryHealth) {
110130
if (!proofMemoryHealth) return;
111131

@@ -129,6 +149,11 @@ function printProofMemoryHealth(proofMemoryHealth) {
129149
`Cleanup candidates: ${counts.cleanupCandidates ?? 0}`
130150
].join("; "));
131151

152+
const policySummary = formatProofMemoryPolicy(proofMemoryHealth.policy || proofMemoryHealth.nextAction?.policy);
153+
if (policySummary) {
154+
console.log(` ${policySummary}`);
155+
}
156+
132157
if (proofMemoryHealth.lastCleanupAt) {
133158
console.log(` Last cleanup: ${proofMemoryHealth.lastCleanupAt}`);
134159
}

tests/pro-status.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,12 @@ async function withMockInstalledPro(callback, repoRoot = OSS_REPO_ROOT) {
117117
" headline: 'Proof memory needs cleanup before its recommendations should be trusted blindly.',",
118118
" summary: 'Proof memory has unreliable or stale recipes that should be reviewed.',",
119119
" counts: { trusted: 1, watch: 1, unreliable: 1, unknown: 0, archived: 1, cleanupEvents: 1, cleanupCandidates: 1 },",
120+
" policy: { staleAfterDays: 90, maxFailureCount: 2, recentCleanupDays: 30 },",
120121
" lastCleanupAt: '2026-04-13T00:00:00.000Z',",
121122
" recentCleanupEvents: [",
122123
" { type: 'proof-memory-cleanup', appliedAt: '2026-04-13T00:00:00.000Z', archivedCount: 1, commands: ['npm test'], reasons: ['stale 200 days; failed 4x'], summary: 'Archived 1 proof recipe from active repo memory.' }",
123124
" ],",
124-
" nextAction: { code: 'preview-proof-memory-cleanup', label: 'Preview proof memory cleanup', command: 'agent-guardrails pro status --json', value: 'Review cleanup candidates before archiving unreliable proof recipes.' },",
125+
" nextAction: { code: 'preview-proof-memory-cleanup', label: 'Preview proof memory cleanup', command: 'agent-guardrails pro status --json', policy: { staleAfterDays: 90, maxFailureCount: 2, recentCleanupDays: 30 }, value: 'Review cleanup candidates before archiving unreliable proof recipes.' },",
125126
" userValue: 'Keeps repo memory useful by separating trusted proof habits from stale or failed advice.'",
126127
" },",
127128
" demoGoLiveDecision: {",
@@ -222,6 +223,7 @@ export async function run() {
222223
assert.match(output, /Proof memory health: needs_cleanup \(warning\)/);
223224
assert.match(output, /Proof memory needs cleanup before its recommendations should be trusted blindly/);
224225
assert.match(output, /Trusted: 1; Watch: 1; Unreliable: 1; Archived: 1; Cleanup events: 1; Cleanup candidates: 1/);
226+
assert.match(output, /Policy: stale after 90 days; archive after 2 failed reuse attempts; cleanup context 30 days/);
225227
assert.match(output, /Last cleanup: 2026-04-13T00:00:00.000Z/);
226228
assert.match(output, /Recent cleanup/);
227229
assert.match(output, /Archived 1 proof recipe from active repo memory/);

0 commit comments

Comments
 (0)