Skip to content

Document-Before-Acknowledge

This is the hardest rule in the system and the one that makes the whole learning pipeline work. It's Stage 2 — the discipline layer that ensures mistakes actually get captured.

The Rule

When the agent identifies a mistake, it must write the lesson to the daily note before replying to the conversation. The file write is a prerequisite, not an afterthought.

❌  Wrong: "My bad, I should have checked" → (maybe writes later, maybe doesn't)
✅  Right: [writes to memory/YYYY-MM-DD.md] → "My bad, I should have checked"

Why This Matters

Without mechanical enforcement, the conversational pull to respond immediately wins every time. Language models are optimized for conversation, not documentation — the instinct to reply first is deeply embedded.

Three violations were documented in a single session before adding trigger-phrase detection:

If you're about to say any variant of "my bad," "should have," "missed that," "forgot to" — STOP. Open the daily note. Write the lesson. Then reply.

Implementation

This rule exists in AGENTS.md as a standing order with explicit trigger phrases. The enforcement is mechanical, not aspirational:

  1. Trigger phrases — The agent monitors its own output for mistake-acknowledging language
  2. Tool-call ordering — The file write must happen before the text response
  3. No exceptions — "I'll remember that" without a file write = violation

Standing order text (from AGENTS.md)

markdown
### Self-Learning (No Exceptions)
- **Document BEFORE acknowledging.** When you identify a mistake, failure,
  or missed opportunity — write the daily note entry (Mistakes/Lessons +
  Lesson Candidate) FIRST, then reply to the conversation.
- **Trigger phrases that REQUIRE documentation:** If you're about to say
  any variant of "my bad," "should have," "missed that," "forgot to" — STOP.
  Open memory/YYYY-MM-DD.md. Write the lesson. Then reply.
- **No verbal-only acknowledgments.** "I'll remember that" without a
  file write = violation. Text > Brain. Always.

Violation Patterns

This is the most violated standing order in production systems, which is itself evidence that it's the most important one. Common patterns:

  • Conversational momentum — The agent is mid-conversation, recognizes a mistake, and responds before the documentation instinct fires
  • Low-severity self-assessment — The agent decides a mistake is "minor" and doesn't warrant documentation (but frequency matters more than individual severity)
  • Compound responses — The agent acknowledges the mistake and documents it, but in the wrong order (reply first, then file write)

The lesson extractor cron exists specifically to catch violations — it scans session transcripts for trigger phrases that weren't followed by file writes.

Built with OpenClaw 🤖