Skip to content

Commit d1b715e

Browse files
committed
feat(agent-workspace): add managed memory inspection capability
1 parent 68b1d61 commit d1b715e

15 files changed

Lines changed: 282 additions & 6 deletions

docs/diataxis/en/explanation/agent-conversation-focus-mode-plan.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Implemented now:
2626
- the graph layout now reserves width for the docked workspace so the graph surface and agent surface can coexist.
2727
- graph-focus fullscreen now promotes the real graph workspace while keeping a restorable control card in front of it.
2828
- the new shell strings and runtime empty/fullscreen labels now have bilingual coverage, existing knowledge-card actions / localized system messages re-render on language switch, and conversation card rerender now flows through a centralized card-kind renderer registry in `workspace_panes` to reduce drift risk.
29-
- conversation knowledge points now carry an execution-capable typed descriptor surface: `focus` and `learning path` are joined by tutor-side `generate_quiz` / `recap` / `generate_transfer` / `generate_counterexample` / `follow_up`, query-side `compare_query_backends` / `inspect_query_backend_diagnostics` / `inspect_query_backend_comparison_history` / `inspect_query_backend_comparison_trend`, tutor diagnostics `inspect_tutor_adapter_telemetry` / `inspect_tutor_trace_diagnostics`, quality/session diagnostics (`inspect_learning_quality_trend` / `inspect_learning_quality_history` / `inspect_session_plan_quality_trend` / `inspect_session_plan_quality_history`), session-side `inspect_session_history` / `build_study_session`, and managed-memory operators (`inspect_memory_snapshot` / `inspect_unit_memory_snapshot` / `inspect_memory_retrain_plan` / `inspect_memory_read` / `write_memory_note` / `record_memory_correction` / `evict_memory_note`), while descriptors include execution, failure, and UI-hint metadata.
29+
- conversation knowledge points now carry an execution-capable typed descriptor surface: `focus` and `learning path` are joined by tutor-side `generate_quiz` / `recap` / `generate_transfer` / `generate_counterexample` / `follow_up`, query-side `compare_query_backends` / `inspect_query_backend_diagnostics` / `inspect_query_backend_comparison_history` / `inspect_query_backend_comparison_trend`, tutor diagnostics `inspect_tutor_adapter_telemetry` / `inspect_tutor_trace_diagnostics`, quality/session diagnostics (`inspect_learning_quality_trend` / `inspect_learning_quality_history` / `inspect_session_plan_quality_trend` / `inspect_session_plan_quality_history`), session-side `inspect_session_history` / `build_study_session`, and managed-memory operators (`inspect_memory_snapshot` / `inspect_unit_memory_snapshot` / `inspect_long_term_memory_snapshot` / `inspect_memory_retrain_plan` / `inspect_memory_read` / `inspect_long_term_memory_read` / `inspect_managed_memory_state` / `write_memory_note` / `record_memory_correction` / `evict_memory_note`), while descriptors include execution, failure, and UI-hint metadata.
3030
- browser smoke now exercises real `conversation/path/query-compare/query-compare-history/query-compare-trend/quality-trend/quality-history/session-plan-quality-trend/session-plan-quality-history/session-plan` backend flows, real graph runtime, and real path runtime with screenshot/console/network-summary evidence artifacts.
3131

3232
Still open:
@@ -35,6 +35,7 @@ Still open:
3535
- long-lived dynamic conversation cards beyond the current `study_session_card` / `tutor_action_card` / `session_history_card` / `query_backend_comparison_card` / `query_backend_diagnostics_card` / `query_backend_comparison_history_card` / `query_backend_comparison_trend_card` / `tutor_adapter_telemetry_card` / `tutor_trace_diagnostics_card` / `learning_quality_trend_card` / `learning_quality_history_card` / `session_plan_quality_trend_card` / `session_plan_quality_history_card` paths now share registry-driven rerender wiring, and a source-level guard test now enforces append-kind/registry parity (`src/agent_workspace.frontend.test.ts`); follow-up work is to keep each new card kind wired through that gate by default.
3636
- the execution-capable contract is now present and no longer limited to quiz/recap, but it still has room to absorb broader tutor/query/session operations beyond the currently shipped action band.
3737
- managed memory mutation is now present in the conversation lane, but it remains intentionally scoped:
38+
- read-side inspection now includes deterministic managed-state lookup for the selected atom,
3839
- writes are limited to session-layer managed notes/corrections,
3940
- eviction only removes the deterministic managed keys for the selected atom,
4041
- this is a product-side memory operator surface, not a claim of full memory-admin tooling.

docs/diataxis/en/explanation/development-progress-dashboard.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,25 @@ Execution anchor:
7171
- Changed the next bounded backend-governance slice:
7272
- keep repeated device-level measurement honest and move the next default budget into product/memory/operator work unless a measured trigger fires.
7373

74+
## Latest Mainline Increment (2026-04-21 M8.20 Managed Memory Inspection Lane)
75+
76+
- Added an explicit managed-memory inspection action without widening mutation scope:
77+
- `inspect_managed_memory_state`.
78+
- Mainline capability emission now exposes deterministic per-atom managed-state lookup instead of forcing operators or users to infer it from broader session reads:
79+
- `memoryLayer = session`,
80+
- `memoryOperation = read`,
81+
- `memoryLimit = 4`,
82+
- `memoryMatchKeys = [conversation_note:{atomId}, conversation_correction:{atomId}]`.
83+
- Kept contract/runtime/backend behavior aligned for targeted read execution:
84+
- frontend contract and runtime planners now forward `matchKeys` for read requests when present,
85+
- learning-platform read execution now filters by `matchKeys` before applying query-token matching,
86+
- no new write/delete semantics were introduced.
87+
- Expanded regression coverage for:
88+
- conversation capability emission,
89+
- frontend read payload shaping,
90+
- runtime managed-memory execution payload forwarding,
91+
- targeted backend read behavior.
92+
7493
## Latest Mainline Increment (2026-04-14 M1 Baseline)
7594

7695
- Added first `AgentConversationAPI` contract surface:

docs/diataxis/en/explanation/local-backend-sufficiency-and-escalation-plan.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Current default posture:
2626
First post-checkpoint product-memory slice now landed on `main`:
2727

2828
- agent workspace exposes read-only `long_term` memory snapshot/read actions,
29+
- the conversation lane now exposes read-only deterministic managed-state inspection for the selected atom,
2930
- managed mutation remains session-scoped by design.
3031
- operator diagnostics now summarize memory-policy execution by layer and operation, so the new product-memory lane is inspectable instead of opaque.
3132

@@ -70,7 +71,7 @@ The architecture baseline is no longer "pre-independence."
7071
That logic is also weak.
7172
The sharper gaps are currently:
7273

73-
- explicit memory CRUD / correction surfaces,
74+
- broader explicit memory CRUD / correction/reporting surfaces beyond the current managed-key inspection/write/eviction scope,
7475
- conversation-product orchestration,
7576
- stable operator-facing reports,
7677
- clearer lane selection between product work and backend escalation.
@@ -242,7 +243,7 @@ If the backend sufficiency report remains green, backend escalation should pause
242243
Recommended next product order:
243244

244245
1. conversation-product hardening:
245-
- explicit conversation memory APIs,
246+
- extend explicit conversation memory APIs beyond the current snapshot/read/managed-key inspection and note/correction/eviction surface,
246247
- correction / feedback flows,
247248
- stronger agent action surfaces around focus mode and learning path,
248249
- operator-facing visibility for those flows.

docs/diataxis/zh/explanation/agent-conversation-focus-mode-plan.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
- 图谱布局已经为 docked workspace 预留宽度,graph surface 与 agent surface 可以并存。
2525
- graph focus 的 fullscreen 已可提升真实 graph workspace,同时保留一个可恢复的控制卡;
2626
- 新壳层静态文案与运行时按钮/空态标签已具备双语覆盖,且已有知识卡片动作按钮与本地化系统消息会在语言切换时重渲;conversation card 的重渲链路也已收敛为 `workspace_panes` 中的 card-kind 注册表驱动,降低后续漂移风险。
27-
- conversation knowledge point 现在已经具备可执行 typed descriptor:除 `focus` / `learning path` 外,已接入 tutor 侧 `generate_quiz` / `recap` / `generate_transfer` / `generate_counterexample` / `follow_up`、query 侧 `compare_query_backends` / `inspect_query_backend_diagnostics` / `inspect_query_backend_comparison_history` / `inspect_query_backend_comparison_trend`、导师诊断侧 `inspect_tutor_adapter_telemetry` / `inspect_tutor_trace_diagnostics`、质量/会话诊断侧 `inspect_learning_quality_trend` / `inspect_learning_quality_history` / `inspect_session_plan_quality_trend` / `inspect_session_plan_quality_history`、session 侧 `inspect_session_history` / `build_study_session`,以及托管记忆操作(`inspect_memory_snapshot` / `inspect_unit_memory_snapshot` / `inspect_memory_retrain_plan` / `inspect_memory_read` / `write_memory_note` / `record_memory_correction` / `evict_memory_note`),同时补齐 execution / failure / UI hint 元数据。
27+
- conversation knowledge point 现在已经具备可执行 typed descriptor:除 `focus` / `learning path` 外,已接入 tutor 侧 `generate_quiz` / `recap` / `generate_transfer` / `generate_counterexample` / `follow_up`、query 侧 `compare_query_backends` / `inspect_query_backend_diagnostics` / `inspect_query_backend_comparison_history` / `inspect_query_backend_comparison_trend`、导师诊断侧 `inspect_tutor_adapter_telemetry` / `inspect_tutor_trace_diagnostics`、质量/会话诊断侧 `inspect_learning_quality_trend` / `inspect_learning_quality_history` / `inspect_session_plan_quality_trend` / `inspect_session_plan_quality_history`、session 侧 `inspect_session_history` / `build_study_session`,以及托管记忆操作(`inspect_memory_snapshot` / `inspect_unit_memory_snapshot` / `inspect_long_term_memory_snapshot` / `inspect_memory_retrain_plan` / `inspect_memory_read` / `inspect_long_term_memory_read` / `inspect_managed_memory_state` / `write_memory_note` / `record_memory_correction` / `evict_memory_note`),同时补齐 execution / failure / UI hint 元数据。
2828
- browser smoke 已覆盖真实 `conversation/path/query-compare/query-compare-history/query-compare-trend/quality-trend/quality-history/session-plan-quality-trend/session-plan-quality-history/session-plan` 后端链路、真实 graph runtime、真实 path runtime,并会输出 screenshot / console / network-summary 证据产物。
2929

3030
仍未完成:
@@ -33,6 +33,7 @@
3333
- 当前 `study_session_card` / `tutor_action_card` / `session_history_card` / `query_backend_comparison_card` / `query_backend_diagnostics_card` / `query_backend_comparison_history_card` / `query_backend_comparison_trend_card` / `tutor_adapter_telemetry_card` / `tutor_trace_diagnostics_card` / `learning_quality_trend_card` / `learning_quality_history_card` / `session_plan_quality_trend_card` / `session_plan_quality_history_card` 已支持语言切换后重渲,且已统一走注册表驱动;同时已新增源码级门禁测试校验 append-kind 与注册表键集合一致(`src/agent_workspace.frontend.test.ts`)。后续新增 card kind 时,需要默认通过该门禁。
3434
- 可执行 contract 已具备,且不再只停留在 quiz/recap,但仍需继续吸收更广的 tutor/query/session 动作。
3535
- 对话 lane 现在已具备受控记忆写入/修正/清理动作,但范围被刻意收窄:
36+
- 读取侧现在也支持针对所选 atom 的确定性托管状态检查,
3637
- 写入仅落在 session 层托管 note/correction,
3738
- 清理仅移除当前 atom 对应的确定性托管 key,
3839
- 这是产品侧 memory operator surface,不是“完整记忆管理后台已完成”的宣称。

docs/diataxis/zh/explanation/development-progress-dashboard.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,25 @@
7171
- 已更新下一段有界 backend governance 切片:
7272
- 保持设备级测量诚实,把默认预算转向 product / memory / operator 工作,除非 measured trigger 真实触发。
7373

74+
## 主线最新增量(2026-04-21 M8.20 托管记忆定向检查链路)
75+
76+
- 已新增一个显式托管记忆检查动作,但没有扩大 mutation scope:
77+
- `inspect_managed_memory_state`
78+
- 主线 capability 发射现在直接暴露按 atom 定位的确定性托管状态读取,不再要求用户或 operator 从更宽泛的 session read 结果里自行推断:
79+
- `memoryLayer = session`
80+
- `memoryOperation = read`
81+
- `memoryLimit = 4`
82+
- `memoryMatchKeys = [conversation_note:{atomId}, conversation_correction:{atomId}]`
83+
- contract/runtime/backend 三层对定向读取保持一致:
84+
- 当前端 contract 与 runtime planner 遇到 read + `memoryMatchKeys` 时,会显式透传 `matchKeys`
85+
- learning-platform 的 read 执行会先按 `matchKeys` 过滤,再应用 query-token 匹配,
86+
- 没有引入新的写入/删除语义。
87+
- 回归覆盖同步扩展到:
88+
- conversation capability 发射,
89+
- 前端 read payload 组装,
90+
- runtime 托管记忆执行 payload 透传,
91+
- backend 定向读取行为。
92+
7493
## 主线最新增量(2026-04-14 M1 基线)
7594

7695
- 已新增第一版 `AgentConversationAPI` 合同面:

docs/diataxis/zh/explanation/local-backend-sufficiency-and-escalation-plan.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
首个 post-checkpoint product-memory 增量已经落在 `main`
2727

2828
- agent workspace 已暴露只读 `long_term` memory snapshot/read 动作,
29+
- 对话 lane 现在也已暴露针对所选 atom 的只读确定性托管状态检查,
2930
- 托管写入/修正/清理仍然按设计限制在 session 层。
3031
- operator diagnostics 现在会按 layer / operation 汇总 memory-policy 执行情况,使这条 product-memory 主线可观测、不可黑箱化。
3132

@@ -70,7 +71,7 @@
7071
这个逻辑当前也站不住。
7172
真正更尖锐的缺口是:
7273

73-
- 显式 memory CRUD / correction surface,
74+
- 在当前托管 key 检查 / 写入 / 清理能力之外,更完整的显式 memory CRUD / correction / reporting surface,
7475
- conversation-product orchestration,
7576
- 稳定的 operator-facing report,
7677
- 在产品工作与 backend 升级之间更明确的 lane 选择。
@@ -241,7 +242,7 @@
241242
推荐的产品推进顺序:
242243

243244
1. conversation-product 加固:
244-
- 显式 conversation memory API,
245+
- 在当前 snapshot/read/托管 key 检查与 note/correction/eviction 能力之上继续扩展显式 conversation memory API,
245246
- correction / feedback 流程,
246247
- 围绕 focus mode 与 learning path 的更强 agent action surface,
247248
- 与这些链路配套的 operator-facing visibility。

src/agent_workspace.frontend.test.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,36 @@ describe('agent_workspace frontend operation contract', () => {
479479
});
480480
});
481481

482+
test('apply_memory_policy builds read payload with targeted matchKeys passthrough', () => {
483+
const requestPlan = buildKnowledgeOperationRequestPayload({
484+
request: {
485+
userId: 'learner-a',
486+
atomId: 'atom-2',
487+
memoryLayer: 'session',
488+
memoryOperation: 'read',
489+
memoryLimit: 4,
490+
memoryMatchKeys: ['conversation_note:atom-2', 'conversation_correction:atom-2'],
491+
},
492+
execution: {
493+
operationId: 'apply_memory_policy',
494+
},
495+
});
496+
497+
expect(requestPlan).toEqual({
498+
operationId: 'apply_memory_policy',
499+
endpoint: '/api/knowledge/memory/policy',
500+
method: 'POST',
501+
resultPresentation: 'memory_policy_card',
502+
body: {
503+
userId: 'learner-a',
504+
layer: 'session',
505+
operation: 'read',
506+
limit: 4,
507+
matchKeys: ['conversation_note:atom-2', 'conversation_correction:atom-2'],
508+
},
509+
});
510+
});
511+
482512
test('unsupported operation result presentation fails fast', () => {
483513
expect(() =>
484514
resolveOperationResultPresentation('build_learning_path', 'tutor_action_card')

0 commit comments

Comments
 (0)