Self Improvement
C
03 · Tech Stack (Rawclaw)

Self-Improvement

How agents learn from corrections.

Last synced 2026-04-28

Self-Improvement Protocol

The system gets smarter every day. Not by magic — by explicit feedback loops. Every mistake, every win, every new data point feeds back into the knowledge base.


Core Principle

Nothing learned once should need to be learned twice.

When an agent discovers something — a correction, a pattern, a failure, a success — it doesn't just fix the immediate problem. It updates the system so every future execution benefits.


After Every Mistake

  1. Log it. Hive mind action with action="learning":

    sqlite3 _system/store/businessos.db "INSERT INTO hive_mind (agent_id, chat_id, action, summary, created_at) 
      VALUES ('[AGENT]', '[CHAT]', 'learning', 'WHAT WENT WRONG: [description]. ROOT CAUSE: [why]. FIX: [what changed].', strftime('%s','now'));"
    
  2. Fix the source. Don't just fix the output — fix the doc that caused the wrong output:

    • Voice mistake -> update brand/voice.md or brand/constraints.md
    • Process failure -> update the relevant SOP in ops/delivery/sops/ or sales/docs/sops/
    • Wrong routing -> update the relevant CONTEXT.md
    • Bad data -> fix at the source (CRM, database, integration)
  3. Prevent recurrence. If the same type of mistake could happen again, add a check:

    • Add to banned words/phrases in brand/constraints.md
    • Add a validation step to the relevant SOP
    • Add a guard condition to the agent's CLAUDE.md

After Every New Data Point

Route it to the right place. Don't let information die in a conversation.

| Data Type | Route To | Who Handles | |-----------|----------|-------------| | Sales call transcript | sales/calls/YYYY-MM-DD-name.md | Larry | | Client feedback | clients/[name]/activity-log.md | Cleo | | Competitor intel | research/competitor/ | Ovi | | Market trend | research/market/ | Ovi | | Content performance data | content/pipeline/ | Quilly | | Financial data | ops/finance/ | Sam | | Technical finding | research/internal/ | Ali | | Process improvement | Relevant SOP | The agent who found it | | Voice correction from Chris | brand/voice.md or brand/constraints.md | Quilly |


After Every Successful Pattern

  1. Log it. Hive mind with action="pattern_confirmed":

    sqlite3 _system/store/businessos.db "INSERT INTO hive_mind (agent_id, chat_id, action, summary, created_at) 
      VALUES ('[AGENT]', '[CHAT]', 'pattern_confirmed', 'PATTERN: [what worked]. CONTEXT: [when/where]. REPLICABLE: [yes/no and why].', strftime('%s','now'));"
    
  2. Document it. If the pattern is replicable, add it to the relevant framework doc:

    • Sales pattern -> sales/docs/playbook.md or new script in sales/scripts/
    • Content pattern -> content/docs/frameworks/
    • Delivery pattern -> ops/delivery/sops/
    • Research pattern -> research/ methodology docs

Scheduled Learning Loops

Daily (Automatic)

  • Every agent logs actions to hive_mind (already happening)
  • Memory system extracts and stores knowledge from conversations
  • Scheduled tasks run on cron (competitor scraping, monitoring)

Weekly (Scan-Driven)

  • Scan reviews last 7 days of hive_mind entries
  • Identifies: repeated errors, missed patterns, docs that got referenced but were wrong
  • Routes doc updates to responsible agents
  • Flags any agent that hasn't logged in 48+ hours

Monthly (Scan + Chris)

  • Full doc freshness audit: which docs haven't been reviewed in 30+ days?
  • Client portfolio review: Cleo generates health report for all active clients
  • Financial review: Sam generates cost analysis and revenue trends
  • Content review: Quilly analyzes what content performed and why
  • Sales review: Larry analyzes pipeline conversion and objection patterns

Quarterly

  • Full knowledge base audit
  • Archive stale research (90-day policy)
  • Update brand positioning if market has shifted
  • Review agent performance metrics
  • Evaluate if new sub-agents or team restructuring needed

Memory Consolidation

The memories table stores individual learnings. Over time, related memories get consolidated into higher-level insights. This happens automatically:

  1. Extraction: Conversations produce memories (raw observations)
  2. Consolidation: Related memories merge into summaries (consolidations table)
  3. Decay: Low-importance memories that never get accessed lose salience
  4. Retrieval: Agents query memories before starting work (pre-task context)

Pre-Task Protocol (Every Agent)

Before starting any meaningful task, agents should:

sqlite3 _system/store/businessos.db "SELECT summary FROM memories 
  WHERE agent_id='[AGENT]' AND salience > 0.3 
  ORDER BY importance DESC, accessed_at DESC LIMIT 10;"

This loads the 10 most relevant memories before execution.


What NOT to Store

  • Ephemeral task details (current conversation state)
  • Git history (use git log)
  • Code that can be read from files
  • Anything already in a CLAUDE.md or CONTEXT.md file
  • Duplicate information across multiple docs

The Compounding Effect

Week 1: Agents execute from base knowledge. Month 1: 200+ hive mind entries. Agents start referencing patterns. Month 3: 1,000+ entries. Consolidated memories reveal cross-domain insights. Month 6: The system knows the business at a depth no individual could. Agents proactively identify bottlenecks, suggest improvements, and take data-driven action.

This isn't aspirational. It's the architecture. Every action logged, every mistake corrected, every pattern confirmed — permanently.