Skip to content

Commit 75c6e98

Browse files
committed
feat: surface pro memory context
1 parent 42d78c6 commit 75c6e98

3 files changed

Lines changed: 50 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 cleanup event status visibility)
3+
Last updated: 2026-04-14 (Pro proof memory context 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 and proof recipe summaries at the top level, and `pro status` plus `check --review` render Pro proof-memory, proof memory health, cleanup history, 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 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

@@ -63,6 +63,7 @@ Pivot from a CLI-only merge gate to an agent-native runtime with system-level au
6363
- Post-v0.19.4 draft update: Pro status and cleanup resolution now checks the target repo `node_modules` before falling back to the OSS package location, so global OSS installs can still activate a project-local Pro package.
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.
66+
- 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.
6667

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

lib/commands/check.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,23 @@ function summarizeProProofRecipe(proofPlan = {}) {
194194
};
195195
}
196196

197+
function summarizeProofMemoryContext(proofPlan = {}) {
198+
const context = proofPlan.proofWorkbench?.memoryContext;
199+
if (!context) {
200+
return null;
201+
}
202+
203+
return {
204+
state: context.state || "unknown",
205+
summary: context.summary || null,
206+
appliedAt: context.appliedAt || null,
207+
archivedCount: context.archivedCount ?? null,
208+
archivedCommands: context.archivedCommands || [],
209+
reasons: context.reasons || [],
210+
goLiveImpact: context.goLiveImpact || null
211+
};
212+
}
213+
197214
function buildCheckResult({
198215
config,
199216
policy,
@@ -282,6 +299,7 @@ function buildCheckResult({
282299
goLiveDecision: review.goLiveDecision ?? null,
283300
proofPlan: review.proofPlan ?? null,
284301
proofRecipe: summarizeProProofRecipe(review.proofPlan),
302+
proofMemoryContext: summarizeProofMemoryContext(review.proofPlan),
285303
preset: config.preset,
286304
diffSource: baseRef ? `git diff ${baseRef}...HEAD` : "working tree",
287305
baseRef,
@@ -608,6 +626,19 @@ function printProDeepSignals(review) {
608626
if (proofWorkbenchScore) {
609627
console.log(`- Proof workbench score: ${proofWorkbenchScore}`);
610628
}
629+
const memoryContext = proofWorkbench.memoryContext;
630+
if (memoryContext?.summary) {
631+
console.log(`- Proof memory context: ${memoryContext.summary}`);
632+
if ((memoryContext.archivedCommands ?? []).length > 0) {
633+
console.log(`- Archived commands: ${memoryContext.archivedCommands.slice(0, 5).join(", ")}`);
634+
}
635+
if ((memoryContext.reasons ?? []).length > 0) {
636+
console.log(`- Cleanup reasons: ${memoryContext.reasons.slice(0, 3).join(" | ")}`);
637+
}
638+
if (memoryContext.goLiveImpact) {
639+
console.log(`- Memory impact: ${memoryContext.goLiveImpact}`);
640+
}
641+
}
611642
}
612643

613644
const prioritizedSurface = formatPrioritizedProofSurface(review?.proofPlan);

tests/check.test.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,14 @@ function withMockInstalledPro(callback) {
154154
" nextAction: 'Run `npm test` first because this repo reused it 2x for this proof pattern (high confidence; reused 2x, fresh recipe).',",
155155
" command: 'npm test',",
156156
" confidenceLevel: 'high',",
157-
" recommendationScore: 95",
157+
" recommendationScore: 95,",
158+
" memoryContext: {",
159+
" state: 'recent_cleanup',",
160+
" summary: 'Memory changed because cleanup archived 1 stale or failed proof recipe. Affected command: npm test.',",
161+
" archivedCommands: ['npm test'],",
162+
" reasons: ['stale 200 days; failed 4x'],",
163+
" goLiveImpact: 'Current proof recommendations use active trusted proof memory and avoid stale or repeatedly failed recipes that were archived by cleanup.'",
164+
" }",
158165
" },",
159166
" impactSurfaces: [",
160167
" { surface: 'validation', title: 'Validation proof', stepCount: 1, blockingCount: 1, memoryPressure: 3 }",
@@ -809,6 +816,10 @@ async function checkPrintsJsonWithInstalledPro() {
809816
assert.equal(parsed.proofRecipe.memoryHealthPenalty, 35);
810817
assert.match(parsed.proofRecipe.memoryHealthWarning, /unreliable/);
811818
assert.match(parsed.proofPlan.proofWorkbench.nextAction, /Run `npm test` first/);
819+
assert.equal(parsed.proofMemoryContext.state, "recent_cleanup");
820+
assert.match(parsed.proofMemoryContext.summary, /cleanup archived 1 stale or failed proof recipe/);
821+
assert.deepEqual(parsed.proofMemoryContext.archivedCommands, ["npm test"]);
822+
assert.match(parsed.proofMemoryContext.goLiveImpact, /active trusted proof memory/);
812823
assert.equal(parsed.proofPlan.impactSurfaces[0].surface, "validation");
813824
assert.ok(parsed.runtime.nextActions.some((item) => item.includes("[Pro] [HIGH]")));
814825
assert.deepEqual(parsed.review.contextQuality.suggestedFiles, ["src/auth/service.js", "tests/auth/service.test.js"]);
@@ -861,6 +872,10 @@ async function checkPrintsGoLiveVerdictWithInstalledPro() {
861872
assert.match(output, /exact command match; stale freshness penalty -15; memory health penalty -35; effective score 50/);
862873
assert.match(output, /Proof workbench: Run `npm test` first because this repo reused it 2x/);
863874
assert.match(output, /Proof workbench score: high confidence, recommendation 95/);
875+
assert.match(output, /Proof memory context: Memory changed because cleanup archived 1 stale or failed proof recipe/);
876+
assert.match(output, /Archived commands: npm test/);
877+
assert.match(output, /Cleanup reasons: stale 200 days; failed 4x/);
878+
assert.match(output, /Memory impact: Current proof recommendations use active trusted proof memory/);
864879
assert.match(output, /Prioritized proof surface: Validation proof \(1 blocking, memory pressure 3\)/);
865880
} finally {
866881
delete process.env.AGENT_GUARDRAILS_CHANGED_FILES;

0 commit comments

Comments
 (0)