Add explicit memory promotion workflow for reflection and delegation summaries
Context
Follow-up to #57. LightAgent now has MemoryScope, MemoryPolicy, memory write admission, trace hierarchy fields, and LightSwarm runtime-context propagation through #80. The remaining gap is an explicit path for promoting internal reflection or delegation evidence into future user-facing memory.
Problem
Reflection and delegation summaries may be useful for audit while still being unsafe to inject into later user prompts. Applications currently need to build their own promotion convention on top of memory metadata and admission callbacks.
Proposed scope
- represent reflection/delegation output as a non-injectable memory candidate by default;
- provide an explicit promotion API or lifecycle hook that can approve, reject, or rewrite a candidate;
- preserve
source,scope,trust,confidence,agent_name,trace_id,parent_trace_id, and derived-memory lineage; - support policy-based and human-reviewed promotion;
- record promotion decisions in trace/audit output;
- add tests proving unattributed or unreviewed internal memory cannot become prompt-injectable by default.
Non-goals
- automatically merging source and delegated traces;
- replacing existing memory backends;
- making reflection memory globally shared by default.
Acceptance criteria
- Reflection/delegation candidates are fail-closed for prompt injection.
- Promotion is explicit and auditable.
- Existing memory backends remain compatible.
- Sync and async policy paths have deterministic tests.
我查看了 MemoryPolicy、MemoryScope,以及当前的 Memory 写入和 Trace 路径。我认为这个功能可以直接接入现有的 Policy 流程,不需要另外创建一套 Memory 路径。
我的初步想法是:reflection 和 delegation 的输出在经过明确的 approve / reject / rewrite 步骤之前,始终保持不可注入状态,同时继承现有的来源和 Trace 元数据。这样也可以避免修改当前的 Backend API。
我可以为这个晋升流程补充同步和异步测试,其中包括一项回归测试,用于确保未经审核的 Memory 永远不会进入 Prompt Context。如果这符合你的设计方向,我可以提交一个聚焦的 PR。
Development update: the v0.9.5 memory-promotion security boundary is now in development.
The planned and in-progress capabilities include:
- a
MemoryCandidatemodel for candidate memory; MemoryPromotionDecisionfor allow, deny, and rewrite decisions;- explicit promotion admission through
memory_promotion_admission; before_memory_promoteandafter_memory_promotelifecycle hooks;- non-injectable defaults for reflection, delegation, and unattributed candidates;
- promotion into prompt-injectable memory only after explicit policy approval or human review;
- trace records for candidate provenance, promotion decisions, reasons, and lineage;
- regression tests covering fail-closed defaults, approval, rejection, rewriting, hooks, and audit events.
This issue will remain open. It will be closed after the implementation PR is merged and CI passes on Python 3.10, 3.11, and 3.12.
Implementation update: #83 now contains the complete v0.9.5 memory-promotion workflow, including MemoryCandidate, MemoryPromotionDecision, explicit promotion admission, promotion hooks, fail-closed injection defaults, trace auditing, lifecycle closure, documentation, and regression coverage.
The full GitHub Actions suite has passed on Python 3.10, 3.11, and 3.12, with 112 tracked tests. This issue will close when #83 is merged.