Skip to content
Skills Library
AI & agents · Automation

memory-reflexion

/memory-reflexion

Tier 2 episode extraction, the reflexion write path split out of the memory router per ADR-063. Extracts an episode from a completed session log so later sessions can replay what was tried and what it cost. Use when you say `extract episode from session`, `record what happened this session`, or `re-extract this episode`. Do NOT use for Tier 1 lookups (use memory-search) or for adding citations (use memory-enhancement).

Repository
ai-agents ↗
Licence
MIT
Last repository change
25.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
2
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 25.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Tier 2 episode extraction, the reflexion write path split out of the memory router per ADR-063. Extracts an episode from a completed session log so later sessions can replay what was tried and what it cost. Use when you say `extract episode from session`, `record what happened this session`, or `re-extract this episode`. Do NOT use for Tier 1 lookups (use memory-search) or for adding citations (use memory-enhancement).

Original author description

Tier 2 episode extraction, the reflexion write path split out of the memory router per ADR-063. Extracts an episode from a completed session log so later sessions can replay what was tried and what it cost. Use when you say `extract episode from session`, `record what happened this session`, or `re-extract this episode`. Do NOT use for Tier 1 lookups (use memory-search) or for adding citations (use memory-enhancement).

How it works

  1. Triggers
  2. Quick Start
  3. Quick Reference
  4. Who Reads Episodes
  5. Schema
  6. Ordering
  7. Graceful Degradation
  8. Verification
  9. Anti-Patterns
  10. Process
Original SKILL.md headings · 176 lines, 1,077 words
SKILL.md preview
---
name: memory-reflexion
version: 0.2.0
description: Tier 2 episode extraction, the reflexion write path split out of the
  memory router per ADR-063. Extracts an episode from a completed session log so
  later sessions can replay what was tried and what it cost. Use when you say
  `extract episode from session`, `record what happened this session`, or
  `re-extract this episode`. Do NOT use for Tier 1 lookups (use memory-search)
  or for adding citations (use memory-enhancement).
license: MIT
metadata:
  adr: ADR-038, ADR-063, ADR-089, ADR-103, ADR-106
  capability:
    kind: specialized-implementation
    status: active
  parent: memory
  routing:
    role: nested-helper
    invoker: memory
    trigger: memory routes a completed session recording request to the memory-reflexion sub-skill
    user-facing: false
---

# Memory Reflexion

Tier 2 episodic write operations: the reflexion write path extracted from the
`memory` router per ADR-063 (memory-skill decomposition). `memory` still routes
here; a caller that needs only to record a session outcome loads this sub-skill
instead of the full memory surface.

Reflexion is one operation: extract an episode from a completed session log.
The episode record is the durable artifact. It is committed to the repository
and can be queried through `memory-search`. No non-memory downstream consumer
reads it today.

> [!NOTE]
> This sub-skill previously carried a second step that folded episodes into a
> derived causal graph (Tier 3). ADR-089 removed that layer: nothing read it,
> and its aggregated output was noise. Episodes are unaffected and remain the
> system of record. See ADR-089 for the evidence.

## Triggers

Use this skill when the user says:

- `extract episode from session` to capture a completed session as an episode
- `record what happened this session` for the reflexion write path
- `re-extract this episode` to refresh a record over an existing episode file

## Quick Start

```bash
# Extract an episode from a completed session log (Tier 2)
python3 .claude/skills/memory/scripts/extract_session_episode.py "<session-log-path>"

# Re-extract over an existing episode, merging rather than clobbering
python3 .claude/skills/memory/scripts/extract_session_episode.py "<session-log-path>" --preserve
```

The script is canonical and shared with the `memory` router; this sub-skill does
not reimplement it. It lives at
`.claude/skills/memory/scripts/extract_session_episode.py`.

## Quick Reference

| Operation | Script | Key Parameters |
|-----------|--------|----------------|
| Extract episode (Tier 2) | `extract_session_episode.py` | `session_log_path`, `--output-path`, `--force`, `--preserve` |

`--force` and `--preserve` are mutually exclusive. `--force` overwrites an
existing episode file. `--preserve` merges a fresh extraction over the existing
record without dropping richer data already there.

## Who Reads Episodes

`memory-search` reads episodes today. Outside memory tooling, its own tests,
and documentation examples, no code calls `get_episodes`, `get_episode`, or
`get_decision_sequence`. Verify before you rely on the opposite:

```bash
git grep -n "get_episodes\|get_episode(\|get_decision_sequence" -- '*.py' \
  | grep -v "memory_core/\|/tests/\|test_"
```

An earlier version of this section claimed three consumers. That claim was
false and the ADR-089 review retracted it. One of the three excludes episode
paths from a churn signal, one allowlists the episode path prefix, and one
generates and stages episodes. None reads episode content.

Write for a future non-memory consumer. Episodes are the primary record of
what happened in a session, and their value is that they can be queried later.
That does not make an incomplete record harmless, so the extraction rules below
still bind.

Tier 2 survived the ADR-089 removal on derivation distance and cost, not on
readership. Episodes are the primary record and are many small files. The
removed causal graph was derived from them and was a single rewritten blob.
Whether episodes earn their keep is an open question that ADR-089 explicitly
declined to settle.

## Schema

The episode schema is defined in ADR-038 and documented in detail in
[references/reflexion-memory.md](references/reflexion-memory.md). That reference
travels with this sub-skill: it covers the episode schema and the integration
workflow. Read it when you need the exact field shapes.

## Ordering

```text
Completed session?
│
└─► extract_session_episode.py "<session-log-path>"
    └─► Produces an episode record in the repository episode store (Tier 2)
```

Only extract from COMPLETED sessions. A partial session produces an incomplete
episode, and an incomplete episode is a falsified record of what happened. It
is committed, so it outlives the session that produced it.

## Graceful Degradation

The reflexion write path is local-only. Serena is the canonical store and
travels with the repository (ADR-007). Episode extraction reads a session log
and writes an episode record. It requires no network store, so there is no
fallback to invoke here.

## Verification

| Operation | Verification |
|-----------|--------------|
| Episode extracted | Episode record written; CLI reports the episode ID and outcome |
| Episode staged | The new episode file appears in `git status` |
| Re-extraction | `--preserve` leaves existing richer fields intact; `--force` replaces the record |

## Anti-Patterns

| Anti-Pattern | Do This Instead |
|--------------|-----------------|
| Extracting from an in-progress session | Only extract from COMPLETED sessions |
| Re-running without a write mode on an existing episode | Choose `--force` (replace) or `--preserve` (merge) deliberately |
| Hand-editing an episode record | Re-extract from the session log |

## Process

### Phase 1: Extract

Run `extract_session_episode.py` against a completed session log. Confirm the
CLI reports an episode ID and a recognized outcome.

### Phase 2: Verify

Confirm the episode file exists in the episode store and that its outcome
matches how the session actually ended. An episode that records
`success` for a session that was abandoned is worse than no episode, because it
is committed and a later reader has no way to tell it from a true one.

## Related Skills

| Skill | When to Use Instead |
|-------|---------------------|
| `memory` | Router for search, health, or maintenance operations |
| `memory-search` | Tier 1 semantic lookup; smaller context than the full router |
| `memory-enhancement` | Add citations, verify code references, track confidence |
| `curating-memories` | Memory maintenance (obsolete, deduplicate, link) |

## Troubleshooting

| Symptom | Cause | Recovery |
|---------|-------|----------|
| Episode not found | Session log path wrong or session incomplete | Verify the session log path; confirm the session reached a terminal outcome |
| Episode file already exists | A prior extraction wrote it | Choose `--force` to replace or `--preserve` to merge |
| Outcome reads wrong | Session log terminal state is ambiguous | Fix the session log first; the episode derives from it |

See [references/reflexion-memory.md](references/reflexion-memory.md) for the full
troubleshooting table and the retrospective integration workflow.

## Extension Points

| Extension | How to Add |
|-----------|------------|
| New episode field | Extend the ADR-038 episode schema; update `extract_session_episode.py` and the reference |
| Downstream consumer | Read episode records directly; chain through `memory-search` for retrieval |

Before adding a derived aggregation over episodes, read ADR-089. The last one
was deleted for having no reader and producing noise. A new one needs a named
consumer that is not itself memory tooling.

## References

- ADR-007: Memory-first architecture (canonical store, local-only posture)
- ADR-037: Memory router architecture (the router this sub-skill delegates from)
- ADR-038: Reflexion memory schema (episode shape)
- ADR-056: Skill output format standardization (the envelope this sub-skill emits)
- ADR-063: Memory skill decomposition (this extraction)
- ADR-089: Removal of the derived causal-memory tier
- [references/reflexion-memory.md](references/reflexion-memory.md): full schema and integration workflow
Files in this package (2)
  • SKILL.md 8 KB
  • references/reflexion-memory.md 15 KB

Versions

RepositoryScoreLicence
This page · rjmurillo/ai-agents100MIT
rjmurillo/ai-agents100MIT

Identical content appears in 3 other GitHub folders. We show one copy with the highest score.

Database snapshot: 13.11.2026 · package version 285f5d7ecd3e (SHA-256 digest of the entire package)

Downloads in the last 30 days: 1 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100memory-search
    Tier 1 semantic memory search across the Serena corpus with progressive disclosure and token-budget warnings. The focused search operation split out of the memory router per ADR-063. Use when you say `search memory`, `what do we know about X`, or `recall prior context`. Do NOT…
  • 100memory
    Thin router for the tiered memory system. Points callers at the focused sub-skills for each operation, Tier 1 search, the reflexion write path, the memory-first gate, maintenance, and consolidation. Use when you ask "what do we know about X", "recall prior context", or "search…
  • 100reflexion
    Use for self-correcting implementation. Implements the reflexion loop: implement, validate, self-critique, retry (max 3 iterations).
  • 100i4h-workflow-dataset-replay
    Replay a workflow HDF5 episode through its original Scene. Use for visual trajectory and recording verification; do not use for policy evaluation or LeRobot data.
  • 93reflexion-pattern
    Critic node with verbal-memory of past failures, stable rubric scoring, and bounded retry budget. Use when an agent loop fails repeatedly on the same task and naive retry gives no improvement — Reflexion turns failure into actionable verbal feedback.
  • 100remember-session
    Use when the user asks to save, remember, record or persist what happened in the current session to MCP Memory Service ("save this session", "store the learnings", "vermerke es im Memory"), or when a session ends having produced decisions, root causes, or open follow-ups that a…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.