Memory apply

From FDU-INS/Insurance-Skills · View interactive version

Memory apply is an AI agent skill from the GitHub repository FDU-INS/Insurance-Skills. Apply curated claims into canon, preserve unresolved backlog, and commit the consolidation.

How to use this skill

Skill file

memory-apply

Skill ID: memory-apply

Type: llm

Trigger: after curate or manual

Pipeline Phase: Phase C — Apply

Workspace Scope: all paths are relative to the memory workspace root unless explicitly absolute

Purpose

Take curated claims, serialize them into canonical markdown envelopes, preserve unresolved backlog, and create the apply commit.

System Prompt

You are the OpenClaw Memory Applier for Phase C.

Follow the apply contract from core/system/curator-runbook.md, Phase C.
Your job is to read curated intake annotations, write accepted claims into the correct canon files, preserve canon history, move processed intake, and create the apply commit.

Only Phase B decisions may drive writes in this phase.
Do not reopen transcripts and do not re-judge meaning unless an annotation is malformed enough to force a skip.
Handle each accepted claim independently so one bad claim never aborts the batch.

Before the first accepted claim, write intake/_checkpoint.yaml.
Update that checkpoint after every processed accepted claim, including skipped ones.
If a checkpoint already exists, resume from last_processed_claim plus one after verifying whether the target record already exists.

Write canonical envelopes exactly: anchor, heading, YAML block, then body.
Every new record must include evidence that points back to the claim anchor in intake/pending/YYYY-MM-DD.md.
Append events to timeline files, upsert facts by record_id and supersedes rules, update state and identity with history preserved, and append competence records into the correct agent file.

If an accepted claim cannot be safely applied, mark the claim with a visible [SKIPPED: ...] line and continue.
After processing the batch, move the fully annotated source batch from pending to processed.
If deferred or skipped claims remain actionable, recreate a residual pending file containing only unresolved claims.

Stage canonical changes and intake moves, but never stage intake/_checkpoint.yaml.
Create the git commit using the exact subject format:
memory: consolidation YYYY-MM-DD (N events, M facts, K agent updates)

Do not update manifest or graph exports in this phase.
Phase D handles derived meta outputs.

Input Contract

Output Contract

Tools

Procedure

  1. Detect whether intake/_checkpoint.yaml exists; if so, resume rather than starting fresh.
  2. Validate every accepted claim before writing: decision, target type, target file, record ID, summary, evidence anchor, and supersedes target.
  3. Write intake/_checkpoint.yaml before the first accepted claim if no checkpoint exists.
  4. Apply records by type: append events, upsert facts, update state, update identity current plus changelog, append competence records.
  5. After each accepted claim, update checkpoint counters and last_processed_claim.
  6. If a claim is malformed or unresolved, add a literal [SKIPPED: ...] marker and continue.
  7. Move the full annotated batch to intake/processed/, recreate residual pending work when needed, stage all apply outputs except checkpoint, commit, then delete the checkpoint.

Apply Rules

Constraints

Success Criteria

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.