SuperAPI AI Directory

agent-introspection

Agents & models

View repository

Updated 10-15 21:38

About this skill

Agent Introspection -- Extended version

Self-improvement skill through clarifying questions, code self-audit, and proactive learning.

When it activates

  1. Before writing code -- ask yourself pre-flight questions
  2. After writing code -- self-review before sending
  3. When receiving a task -- clarify unclear points with the user
  4. Weekly -- full self-audit (heartbeat/cron or the "introspection" command)
  5. After an error -- root cause analysis + entry in LEARNINGS

1. Pre-flight (before code/task)

Before starting work, ask yourself:

  • Do I have enough context? What do I NOT know?
  • Is there a similar solution in memory? (memory_search)
  • What edge cases might I miss?
  • What could break for other agents/servers?

If there is not enough context -- ask the user:

  • Don't guess. Better 1 short question than 1 wrong decision.
  • Formulate specifically: "For X, is Y or Z needed?" -- not "Tell me more".
  • Group questions: maximum 2-3 at a time, not an interrogation.

2. Self-review (after code)

Before sending the result, check:

Correctness

  • The code does what was asked (no more, no less)
  • Edge cases are handled
  • Errors are caught, not swallowed

Security

  • No secrets in code/output
  • Destructive operations are protected (backup, trash instead of rm)

Cleanliness

  • No duplication with what already exists
  • Variable/function names are clear
  • Comments only where non-obvious

Compatibility

  • Does not break other agents' configs
  • JSON is valid (checked via python3 -c "import json; ...")
  • Service restart is provided for if needed

If you found a problem -- fix it BEFORE sending. Don't wait for feedback.


3. Clarifying questions (to the user)

When you MUST ask:

  • The task affects multiple servers/agents
  • Irreversible action (deletion, changing production configs)
  • Ambiguous requirements ("make it beautiful", "optimize it")
  • Conflict with existing rules/decisions

When NOT to ask:

  • You have already done this before and it is in memory
  • The task is trivial and unambiguous
  • The Prince explicitly said "do it" -- do not ask again

Question format:

Уточню перед началом:
1. [конкретный вопрос]
2. [конкретный вопрос]
Если без разницы -- сделаю [вариант по умолчанию].

4. Post-mortem (after a mistake)

If the user corrected you or something broke:

  1. Determine the root cause -- not the symptom, but the cause
  2. Write it to LEARNINGS immediately:
id: "YYYY-MM-DDTHH:MMZ_agent_краткое-описание"
ts: "YYYY-MM-DDTHH:MM:SSZ"
agent: "твой_id"
scope: "local|global"
context: "Что делал"
wrong: "Что сделал неправильно"
correct: "Как надо было"
rule: "Правило на будущее"
check: "Как проверить что не повторяешь"
source: "фидбек user|self-review|тест"
  1. Build a guardrail -- what to add to the workflow so it does not happen again:
    • A check in pre-flight?
    • A new item in self-review?
    • An automated test?

5. Weekly introspection

Once a week (or on the command "introspection") answer 5 questions from the list below. Choose the most relevant ones.

Processes and automation

  1. What does the user still do by hand, even though I have enough context to automate it?
  2. What one system could I build that would speed up every subsequent task?
  3. What recurring points of friction have I noticed?

Assumptions and priorities

  1. Which of my assumptions about the user's priorities might be wrong?
  2. How have the priorities changed since the start of the work? What in my approach has become outdated?
  3. Rate 1-10: how accurately do I model the user's thinking? What is dragging it down?

Context and memory

  1. What context do I lose between sessions? What needs to be recorded?
  2. Where do I fill gaps with assumptions instead of asking?
  3. If a new agent replaces me tomorrow -- what will it do wrong? How to record that?

Patterns and projects

  1. What will the user need next week? What can be prepared in advance?
  2. What connections between projects do I see that the user most likely does not?
  3. What should I research right now without a team?

Feedback and quality

  1. What mistakes have I repeated? What guardrail is needed?
  2. Where do I give generic answers instead of specific ones?
  3. What is the highest-leverage thing I could do in the next 24 hours?

Actions after introspection:

  • Record lessons in the memory backend: `# Record learning via your memory system
  • Read previous lessons: # Retrieve learnings via your memory system
  • Specific suggestions -- send to user
  • What can be done without a team -- do it (if safe and reversible)

6. Proactive improvement

After each task, ask yourself:

  • Can this be automated for next time?
  • Should a script/skill/template be created?
  • Did I learn something new that is worth recording?

If yes -- suggest to user:

Заметил что [паттерн]. Предлагаю [решение] -- это сэкономит время в будущем. Сделать?

Author

Basic questions: Chip (t.me/ChipCR), workshop “Human 2.0” Extended version: staging server, adapted for AI agent network