# v8.13 MemAct/AtomMem/AgeMem Action-Policy Expansion Implementation Plan

> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.

**Goal:** Expand the memory action surface from telemetry-only into a first-class, bounded action-policy layer aligned with MemAct/AtomMem/AgeMem principles.

**Architecture:** Introduce typed memory action intents, policy evaluation, and guarded application paths. Keep actions opt-in and observable; default behavior remains unchanged when flags are off.

**Tech Stack:** TypeScript, `src/tools.ts`, `src/orchestrator.ts`, `src/lifecycle.ts`, `src/storage.ts`, node:test.

---

## Task 1: Define action taxonomy and policy contracts

**Files:**
- Modify: `src/types.ts`
- Modify: `src/schemas.ts`
- Docs: `docs/architecture/memory-lifecycle.md`

**Steps:**
1. Define action types: `store_episode`, `store_note`, `update_note`, `create_artifact`, `summarize_node`, `discard`, `link_graph`.
2. Define action eligibility context schema (confidence, lifecycle state, importance, source).
3. Add strict parse + default-safe fallbacks.

## Task 2: Implement policy evaluator

**Files:**
- Create: `src/memory-action-policy.ts`
- Modify: `src/orchestrator.ts`
- Test: `tests/memory-action-policy.test.ts`

**Steps:**
1. Implement deterministic policy decision function (`allow` | `defer` | `deny`) with rationale.
2. Integrate evaluator before any action application path.
3. Persist decision traces for observability.
4. Add tests for precedence, disabled flags, and zero-limit semantics.

## Task 3: Expand tooling for action application and audit

**Files:**
- Modify: `src/tools.ts`
- Modify: `src/cli.ts`
- Test: `tests/tools-memory-action-apply.test.ts`
- Test: `tests/cli-memory-action-audit.test.ts`
- Docs: `docs/api.md`, `docs/operations.md`

**Steps:**
1. Add/extend tool surface for safe action application with dry-run.
2. Add `openclaw engram action-audit` CLI report for action outcomes and policy decisions.
3. Ensure audit output is namespace-aware.

## Task 4: Close loop with lifecycle + compounding signals

**Files:**
- Modify: `src/lifecycle.ts`
- Modify: `src/compounding/engine.ts`
- Test: `tests/memory-action-lifecycle-integration.test.ts`

**Steps:**
1. Feed action outcomes into lifecycle scoring as bounded priors.
2. Feed rejected/failing actions into compounding mistake/rubric generation.
3. Add integration tests ensuring no circular amplification.

## Task 5: Rollout and risk controls

**Files:**
- Modify: `docs/config-reference.md`
- Modify: `docs/setup-config-tuning.md`
- Modify: `CHANGELOG.md`

**Steps:**
1. Add rollout presets for conservative/balanced/research modes.
2. Provide operator guidance for action-policy gating in production.
3. Verify disabled-path behavior remains baseline-equivalent.

