agentleFS
tamldtamld/defense-in-depth/.agents/skills/skill-self-reflection/SKILL.md

Self Reflection

Skill4 starsChanged 7 months agoMITView on GitHub

Post-task reflection protocol for extracting lessons, identifying gaps, promoting knowledge, and driving system growth. Turns ephemeral experience into permanent wisdom.

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 6 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use generic descriptions — be specific about file, line, context

    line 75
  2. Distinctive:

    Every finding must pass the quality gate from rule-lesson-quality:

    line 82
  3. Very specific:

    Use [HYPO] evidence level for verified findings — promote to [RUNTIME]

    line 140
  4. Distinctive:

    When a pattern appears ≥ 3 times across sessions:

    line 146
  5. Distinctive:

    If ≥ 3 → identify the pattern

    line 159
  6. Distinctive:

    Use skill-creator to create the appropriate artifact

    line 160
  7. Distinctive:

    Create a rule that contradicts an existing one — update the existing rule instead

    line 165

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

🪞 Self Reflection — The Growth Engine

"An unreflected session is a wasted session. Friction that isn't captured is friction repeated."

This skill operationalizes the Growth Flywheel from COGNITIVE_TREE.md: ACCEPT → SLAP → TRUST → GROW.


Reflection Flowchart

flowchart TD
    TRIGGER["Reflection triggered\n(task done, handoff, failure)"] --> COLLECT["① COLLECT\nGather session data"]
    COLLECT --> CLASSIFY["② CLASSIFY\nSort findings by type"]
    CLASSIFY --> EVALUATE["③ EVALUATE\nApply quality gate"]
    EVALUATE --> RECORD["④ RECORD\nPersist to lesson store"]
    RECORD --> PROMOTE["⑤ PROMOTE\nEscalate if pattern found"]
    PROMOTE --> Q1{"Pattern found\n≥ 3 occurrences?"}
    Q1 -->|"Yes"| RULE["Propose new rule\n(use skill-creator)"]
    Q1 -->|"No"| DONE["✅ Reflection complete"]

Phase ①: COLLECT — Gather Session Data

Review the work done and answer these questions:

QuestionEvidence Source
What was the task?Ticket/task description
What did I plan to do?Implementation plan
What did I actually do?Git diff, file changes
What went wrong?Error logs, failed attempts
What went right?Successful verifications
What surprised me?Unexpected behaviors, edge cases
What took longer than expected?Time/effort observations

Do Not Do

  • Skip collection because "nothing interesting happened"
  • Rely on memory instead of evidence (check actual diffs)
  • Collect only successes — failures are the richest learning source

Phase ②: CLASSIFY — Sort Findings

Each finding gets classified into exactly one category:

TagMeaningExample
[DEBT]Technical debt introduced"Used any type to bypass strict mode"
[NUGGET]Valuable pattern discovered"BOM stripping must happen before regex"
[GAP]Missing capability or documentation"No guard for YAML syntax validation"
[FRICTION]Process that slowed work"Had to read 5 files to understand config flow"
[WIN]Something that worked well"Evidence tagging caught a false assumption early"

Do Not Do

  • Tag everything as [NUGGET] — be honest about debt and gaps
  • Use generic descriptions — be specific about file, line, context
  • Skip [FRICTION] items — they are seeds for process improvement

Phase ③: EVALUATE — Apply Quality Gate

Every finding must pass the quality gate from rule-lesson-quality:

flowchart TD
    FINDING["Finding"] --> Q1{"Has specific\nscenario?"}
    Q1 -->|"No"| DROP["Drop — too generic"]
    Q1 -->|"Yes"| Q2{"Has wrong\napproach?"}
    Q2 -->|"No"| ENRICH["Enrich with\nwhat was tried"]
    Q2 -->|"Yes"| Q3{"Has correct\napproach?"}
    Q3 -->|"No"| ENRICH
    Q3 -->|"Yes"| PASS["✅ Quality passed"]
    ENRICH --> Q3

Quality Score (required ≥ 3)

ScoreCriteria
❌ 0Generic, no context
❌ 1Has context but no wrong/correct approach
⚠️ 2Has approaches but vague
✅ 3Specific scenario + concrete wrong + correct approaches

Do Not Do

  • Record "always test your code" — rejected (score 0)
  • Record "the guard failed" without explaining WHY — rejected (score 1)
  • Skip the quality gate because "it's obvious" — nothing is obvious

Phase ④: RECORD — Persist to Lesson Store

Format each qualified finding as a lesson:

{
  scenario: "Guard hollow-artifact failed on UTF-8 files with BOM",
  wrongApproach: "Applied regex pattern at position 0, BOM shifted content by 3 bytes, false negative",
  correctApproach: "Added BOM detection (0xEF,0xBB,0xBF) and strip step in normalize() before pattern matching",
  insight: "Always normalize text encoding before applying content-matching patterns",
  searchTerms: ["BOM", "UTF-8", "regex", "hollow-artifact", "normalize"],
  tags: ["guard", "encoding", "false-negative"],
  evidenceLevel: "RUNTIME",
  relatedFiles: ["src/guards/hollow-artifact.ts"]
}

Storage Location

Project HasStore In
lessons.jsonlAppend to file
Memory MCPCall record_lesson tool
NeitherCreate lessons.jsonl at project root

Do Not Do

  • Store lessons in private workspace only — they must be git-tracked
  • Skip searchTerms — a lesson that can't be recalled doesn't exist
  • Use [HYPO] evidence level for verified findings — promote to [RUNTIME]

Phase ⑤: PROMOTE — Escalate Patterns

When a pattern appears ≥ 3 times across sessions:

flowchart TD
    PATTERN["Same lesson\nrecorded 3+ times"] --> Q1{"What kind\nof pattern?"}
    Q1 -->|"Constraint\nviolation"| RULE["Promote to RULE\n(.agents/rules/)"]
    Q1 -->|"Repeatable\ncapability"| SKILL["Promote to SKILL\n(.agents/skills/)"]
    Q1 -->|"Multi-step\nprocess"| WORKFLOW["Promote to WORKFLOW\n(.agents/workflows/)"]
    Q1 -->|"Architecture\ninsight"| TREE["Update COGNITIVE_TREE\n(.agents/philosophy/)"]

Promotion Protocol

  1. Count occurrences of similar lessons
  2. If ≥ 3 → identify the pattern
  3. Use skill-creator to create the appropriate artifact
  4. Cross-reference the original lessons as evidence

Do Not Do

  • Promote after just 1 occurrence — wait for the pattern to confirm
  • Create a rule that contradicts an existing one — update the existing rule instead
  • Promote without evidence — the lesson chain IS the evidence

Reflection Output Template

## Session Reflection — {date}

### Summary
{1-2 sentences on what was accomplished}

### Findings

| # | Tag | Finding | Quality |
|:---|:---|:---|:---:|
| 1 | [NUGGET] | {specific finding} | ✅ 3 |
| 2 | [DEBT] | {specific debt} | ✅ 3 |
| 3 | [FRICTION] | {specific friction} | ✅ 3 |

### Lessons Recorded
- {lesson 1 — scenario + insight}
- {lesson 2 — scenario + insight}

### Promotion Candidates
- {pattern seen N times — candidate for rule/skill/workflow}

### HANDOFF (if session ending)
- Current state: {what's done}
- Next action: {what should happen next}
- Key files: {relevant paths}

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.