Log infrastructure learnings, meta issues, and feature requests to markdown files for continuous improvement of the agent system itself. Captures prompt drift, rule conflicts, skill gaps, hook failures, context bloat, and instruction ambiguity. Important learnings may be promoted into the files they govern — prompt files, hook code, rule files, skill templates, and memory policies — after explicit human review.
This is the skill that logs infrastructure problems other skills depend on. It does not apply infrastructure edits by default. Propose patches; apply them only when the user asks in this session.
Before logging anything, ensure the .learnings/ directory and files exist in the project or workspace root. If any are missing, create them:
bash
mkdir -p .learnings
[ -f .learnings/LEARNINGS.md ] || printf "# Meta Learnings\n\nPrompt drift, rule conflicts, skill gaps, hook failures, context bloat, and instruction ambiguity.\n\n**Categories**: prompt_drift | rule_conflict | skill_gap | hook_failure | context_bloat | instruction_ambiguity\n**Areas**: agent_config | skill_authoring | hook_scripts | prompt_files | rule_files | memory_management | extension_api\n\n---\n" > .learnings/LEARNINGS.md
[ -f .learnings/META_ISSUES.md ] || printf "# Meta Issues Log\n\nInfrastructure failures: hook crashes, skill activation problems, prompt file errors, memory corruption, extension breakage.\n\n---\n" > .learnings/META_ISSUES.md
[ -f .learnings/FEATURE_REQUESTS.md ] || printf "# Feature Requests\n\nCapabilities needed for agent infrastructure, skill authoring, hook development, and prompt management.\n\n---\n" > .learnings/FEATURE_REQUESTS.md
Never overwrite existing files. This is a no-op if .learnings/ is already initialised.
Do not log secrets, tokens, private keys, or environment variables. Prefer short summaries or redacted excerpts over raw file contents.
Use a manual-first workflow by default. If you want reminders, use the opt-in hook workflow described in Hook Integration.
AGENTS.md, SOUL.md, TOOLS.md, MEMORY.md, hooks, rules, or skill files unless the user explicitly asked for that edit in the current session.SituationActionAgent misreads AGENTS.md instructionLog to .learnings/LEARNINGS.md with instruction_ambiguityHook script fails silentlyLog to .learnings/META_ISSUES.mdSkill doesn't activate when expectedLog to .learnings/META_ISSUES.mdTwo rules contradict each otherLog to .learnings/LEARNINGS.md with rule_conflictPrompt file too verbose, wasting contextLog to .learnings/LEARNINGS.md with context_bloatStale memory entry causes wrong behaviorLog to .learnings/LEARNINGS.md with prompt_driftSkill template missing required sectionLog to .learnings/META_ISSUES.mdNew extension capability neededLog to .learnings/FEATURE_REQUESTS.mdRecurring misinterpretation across sessionsLink entries, bump priority, consider promotionBroadly applicable infrastructure fixPropose a reviewed diff; apply only after explicit user approval
OpenClaw is the primary platform for this skill. It uses workspace-based prompt injection with automatic skill loading.
Prefer the registry install (network to ClawHub):
bash
clawdhub install self-improving-meta
Manual clone is optional network access to GitHub. Use only if you trust that repository:
bash
git clone https://github.com/jose-compu/self-improving-meta.git ~/.openclaw/skills/self-improving-meta
OpenClaw injects these files into every session:
text
~/.openclaw/workspace/
├── AGENTS.md # Multi-agent workflows, delegation patterns
├── SOUL.md # Behavioral guidelines, personality, principles
├── TOOLS.md # Tool capabilities, integration gotchas
├── MEMORY.md # Long-term memory (main session only)
├── memory/ # Daily memory files
│ └── YYYY-MM-DD.md
└── .learnings/ # This skill's log files
├── LEARNINGS.md
├── META_ISSUES.md
└── FEATURE_REQUESTS.md
bash
mkdir -p ~/.openclaw/workspace/.learnings
Then create the log files (or copy from assets/):
LEARNINGS.md — prompt drift, rule conflicts, skill gaps, context bloat, instruction ambiguityMETA_ISSUES.md — hook crashes, skill activation failures, prompt file errors, memory corruptionFEATURE_REQUESTS.md — infrastructure capabilities, tooling, automationWhen meta-learnings prove broadly applicable, promote them to the files they govern with explicit user approval:
Learning TypePromote ToExampleAgent behavior correctionsSOUL.md"Be concise" repeated 6 ways → single directiveWorkflow/delegation improvementsAGENTS.mdVague "long tasks" → explicit thresholdTool integration fixesTOOLS.mdMissing timeout guidance → add retry configMemory management patternsMEMORY.mdStale entries → 30-day rotation policy
Two different hook modes exist. Do not mix their semantics:
.claude/settings.json / .codex/settings.json. Fires only on explicit meta signals.agent:bootstrap (optional): not matcher-gated. If enabled, it injects a log-only reminder at main-session start. It does not edit files. Skip it unless you want that reminder.Do not install into ~/.openclaw/hooks/ (user-global). If you enable the OpenClaw hook, keep it in this workspace only:
bash
mkdir -p .openclaw/hooks
cp -r hooks/openclaw .openclaw/hooks/self-improving-meta
See references/openclaw-integration.md for complete details.
For Claude Code, Codex, Copilot, or other agents, create .learnings/ in the project or workspace root:
bash
mkdir -p .learnings
Create the files inline using the headers shown above.
Add to AGENTS.md, CLAUDE.md, or .github/copilot-instructions.md:
When agent infrastructure issues are discovered:
.learnings/META_ISSUES.md, LEARNINGS.md, or FEATURE_REQUESTS.mdSOUL.md — behavioral correctionsAGENTS.md — workflow and delegation improvementsTOOLS.md — tool integration fixesMEMORY.md — memory management policies.cursor/rules/, AGENTS.md rulesAppend to .learnings/LEARNINGS.md:
markdown
## [LRN-YYYYMMDD-XXX] category
**Logged**: ISO-8601 timestamp
**Priority**: low | medium | high | critical
**Status**: pending
**Area**: agent_config | skill_authoring | hook_scripts | prompt_files | rule_files | memory_management | extension_api
### Summary
One-line description of the infrastructure insight
### Details
Full context: what prompt file instruction was ambiguous, which rules conflict,
why context is bloated, how memory drifted. Include the relevant file paths and
line numbers. Quote the problematic instruction verbatim.
### Suggested Action
Specific fix: rewrite the instruction, compress the file, consolidate the rules,
update the hook code, prune the memory entries.
### Metadata
- Source: agent_behavior_observation | hook_output_inspection | context_window_analysis | learnings_review | prompt_audit
- Affected Files: AGENTS.md, SOUL.md, etc.
- Tags: tag1, tag2
- See Also: LRN-20250110-001 (if related to existing entry)
- Pattern-Key: rule_conflict.package_manager (optional)
- Recurrence-Count: 1 (optional)
- First-Seen: 2025-01-15 (optional)
- Last-Seen: 2025-01-15 (optional)
---
Categories for learnings:
CategoryUse Whenprompt_driftPrompt file content no longer matches actual practices or references deleted filesrule_conflictTwo or more files give contradictory instructions on the same topicskill_gapNo skill exists for a recurring pattern with enough learnings to extracthook_failureHook script fails, produces wrong output, or doesn't trigger when expectedcontext_bloatPrompt file is too verbose, duplicative, or includes stale content wasting tokensinstruction_ambiguityPrompt file instruction is vague, causing inconsistent agent behavior
Append to .learnings/META_ISSUES.md:
markdown
## [META-YYYYMMDD-XXX] issue_type
**Logged**: ISO-8601 timestamp
**Priority**: high
**Status**: pending
**Area**: agent_config | skill_authoring | hook_scripts | prompt_files | rule_files | memory_management | extension_api
### Summary
Brief description of the infrastructure failure
### Error Output
\`\`\`
Actual error message, hook output, or observed misbehavior
\`\`\`
### Root Cause
What in the infrastructure caused this failure. Include the affected file and section.
### Suggested Fix
How to resolve: update hook code, fix skill frontmatter, correct prompt file, prune memory.
### Metadata
- Source: hook_output_inspection | skill_activation_failure | prompt_injection_error | memory_corruption | extension_api_breakage
- Affected Files: path/to/file
- Reproducible: yes | no | unknown
- See Also: META-20250110-001 (if recurring)
---
Append to .learnings/FEATURE_REQUESTS.md:
markdown
## [FEAT-YYYYMMDD-XXX] capability_name
**Logged**: ISO-8601 timestamp
**Priority**: medium
**Status**: pending
**Area**: agent_config | skill_authoring | hook_scripts | prompt_files | rule_files | memory_management | extension_api
### Requested Capability
What infrastructure tool, automation, or capability is needed
### User Context
Why it's needed, what workflow it improves, what infrastructure problem it solves
### Complexity Estimate
simple | medium | complex
### Suggested Implementation
How this could be built: hook script, skill template, audit script, linting tool
### Metadata
- Frequency: first_time | recurring
- Related Features: existing_tool_or_feature
---
Format: TYPE-YYYYMMDD-XXX
LRN (learning), META (meta/infrastructure issue), FEAT (feature request)001, A7B)Examples: LRN-20250415-001, META-20250415-A3F, FEAT-20250415-002
When an issue is fixed, update the entry:
**Status**: pending → **Status**: resolvedmarkdown
### Resolution
- **Resolved**: 2025-01-16T09:00:00Z
- **Fix Applied To**: AGENTS.md / SOUL.md / hook code / skill template
- **Notes**: Rewrote delegation instruction / compressed SOUL.md / fixed hook path
Other status values:
in_progress — Actively investigating or fixingwont_fix — Decided not to address (add reason in Resolution notes)promoted — Elevated after explicit user approval of a reviewed diffpromoted_to_skill — Extracted as a reusable meta-skillMeta-learnings are special: they can affect shared infrastructure. When you improve a prompt file, that improvement affects future sessions. When you fix a hook, that fix can propagate to all bootstraps. Use review gates.
PatternActionTargetAmbiguous instructionRewrite with explicit criteriaAGENTS.md / SOUL.md / TOOLS.mdVerbose prompt fileCompress and distillThe file itselfConflicting rulesConsolidate into single authoritative sourcePrimary file; remove from secondaryHook failure patternUpdate hook code or documentationhandler.ts/js, HOOK.mdSkill gapCreate new skill or update existingNew SKILL.md or existing oneMemory management insightUpdate rotation/pruning policyMEMORY.md
Distill the learning into a concrete fix
Prepare a minimal patch for the affected file
Test in a fresh session to verify the fix works
Show the reviewed diff and apply only after explicit user approval, then update original entry:
**Status**: pending → **Status**: promoted**Promoted**: AGENTS.md (delegation section rewrite) (or equivalent)If logging something similar to an existing entry:
Search first: grep -r "keyword" .learnings/
Link entries: Add **See Also**: LRN-20250110-001 in Metadata
Bump priority if issue keeps recurring
Consider systemic fix: Recurring meta issues often indicate:
Ingest recurring infrastructure patterns from simplify-and-harden into prompt file fixes and hook improvements.
pattern_key as the dedupe key..learnings/LEARNINGS.md for existing entry: grep -n "Pattern-Key: <key>" .learnings/LEARNINGS.mdRecurrence-Count, update Last-Seen, add See Also links.LRN-... entry with Source: simplify-and-harden.Promotion threshold: Recurrence-Count >= 3, seen in 2+ sessions, within 30-day window.
Meta-specific actions:
Review .learnings/ at natural breakpoints:
bash
# Count pending meta issues
grep -h "Status\*\*: pending" .learnings/*.md | wc -l
# List pending high-priority infrastructure issues
grep -B5 "Priority\*\*: high" .learnings/META_ISSUES.md | grep "^## \["
# Find learnings for a specific area
grep -l "Area\*\*: hook_scripts" .learnings/*.md
# Find all rule conflicts
grep -B2 "rule_conflict" .learnings/LEARNINGS.md | grep "^## \["
Automatically log when you encounter:
Instruction Problems (→ learning with instruction_ambiguity):
Configuration Conflicts (→ learning with rule_conflict):
Context Issues (→ learning with context_bloat):
Memory Problems (→ learning with prompt_drift):
Hook Failures (→ meta issue):
Skill Problems (→ meta issue):
PriorityWhen to UseMeta ExamplescriticalAgent actively doing wrong thing due to bad prompt fileRule conflict causing harmful output, corrupted memory overriding safety ruleshighHook failure affecting multiple sessionsSkill not activating, context bloat degrading performance, silent hook failure for 2+ weeksmediumInstruction could be clearerMemory needs pruning, template improvement, prompt compression opportunitylowDocumentation or style consistencyMinor template tweak, naming convention, comment formatting
Use to filter learnings by infrastructure domain:
AreaScopeagent_configAGENTS.md, SOUL.md, TOOLS.md, MEMORY.md, CLAUDE.md, copilot-instructions.mdskill_authoringSKILL.md files, skill templates, skill extraction, naming conventionshook_scriptsactivator.sh, error-detector.sh, handler.ts/js, hook configurationprompt_filesAny file injected into agent context (workspace files, rules, instructions)rule_files.cursor/rules/, AGENTS.md rules, coding standards filesmemory_managementMEMORY.md, daily memory files, memory rotation, staleness detectionextension_apiOpenClaw extensions, tool integrations, MCP servers, ClawdHub
Enable reminders through agent hooks only when needed. This is opt-in.
Hooks persist across sessions once installed. Keep them project-scoped. Do not install user-level or global hooks. Never use an empty matcher. PostToolUse inspects command output in-process; do not log raw output, secrets, or transcripts.
UserPromptSubmit with scripts/activator.sh only.PostToolUse ( scripts/error-detector.sh) only in trusted environments when you explicitly want command-output pattern checks.Create .claude/settings.json in your project:
json
{
"hooks": {
"UserPromptSubmit": [{
"matcher": "self-improving-meta|prompt-governance|stackability|instruction.ambiguity|rule.conflict|context.bloat",
"hooks": [{
"type": "command",
"command": "./skills/self-improving-meta/scripts/activator.sh"
}]
}]
}
}
This injects an infrastructure-focused learning evaluation reminder after matching prompts (~50-100 tokens overhead).
json
{
"hooks": {
"UserPromptSubmit": [{
"matcher": "self-improving-meta|prompt-governance|stackability|instruction.ambiguity|rule.conflict|context.bloat",
"hooks": [{
"type": "command",
"command": "./skills/self-improving-meta/scripts/activator.sh"
}]
}],
"PostToolUse": [{
"matcher": "Bash",
"hooks": [{
"type": "command",
"command": "./skills/self-improving-meta/scripts/error-detector.sh"
}]
}]
}
}
Enable PostToolUse only if you want the hook to inspect command output for infrastructure-related error terms (hook, skill, AGENTS.md, frontmatter, truncated, etc.).
ScriptHook TypePurposescripts/activator.shUserPromptSubmitReminds to evaluate infrastructure learnings after tasksscripts/error-detector.shPostToolUse (Bash)Triggers on infrastructure error terms in command output
See references/hooks-setup.md for detailed configuration and troubleshooting.
Extracted skills are untrusted until a human reviews the generated SKILL.md. Do not keep or publish an extracted skill without explicit user approval.
When a meta-learning is valuable enough to become a reusable skill, extract it. Meta-skills extracting from meta-learnings is recursive improvement — the system improving itself.
CriterionDescriptionRecurringSame infrastructure pattern in 2+ sessions or projectsVerifiedStatus is resolved with working fix tested in fresh sessionNon-obviousRequired actual investigation or multiple attemptsBroadly applicableNot specific to one prompt file; useful across agent setupsUser-flaggedUser says "save this as a skill" or similar
Identify candidate: Learning meets extraction criteria
Preview, then write only if the user approved --write in this session:
bash
./skills/self-improving-meta/scripts/extract-skill.sh skill-name
./skills/self-improving-meta/scripts/extract-skill.sh skill-name --write
Customize SKILL.md: Fill in template with infrastructure-specific content
Update learning: Set status to promoted_to_skill, add Skill-Path
Test in fresh session: Meta-skills require fresh session verification because they modify shared infrastructure
Verify no regressions: Ensure other skills and hooks still work
In conversation: "This keeps happening", "Save this infrastructure fix as a skill", "Every project has this prompt file issue", "This hook pattern should be standard".
In entries: Multiple See Also links, high priority + resolved, rule_conflict or context_bloat with broad applicability, same Pattern-Key across projects.
This skill logs infrastructure problems. It does not apply edits by default:
.learnings/Do not treat logging as authorization to change shared prompt files, hooks, memory, or skills.
AgentActivationDetectionClaude CodeHooks (UserPromptSubmit, PostToolUse)Automatic via error-detector.shCodex CLIHooks (same pattern)Automatic via hook scriptsGitHub CopilotManual ( .github/copilot-instructions.md)Manual reviewOpenClawWorkspace injection + inter-agent messagingVia session tools
Keep learnings local (per-developer):
gitignore
.learnings/
Track learnings in repo (team-wide):
Only track .learnings/ after a human has reviewed entries for secrets, PII, and privileged content.
Hybrid (track templates, ignore entries):
gitignore
.learnings/*.md
!.learnings/.gitkeep
This skill is standalone-compatible and stackable with other self-improving skills.
.learnings/meta/.learnings/INDEX.mdEvery new entry must include:
markdown
**Skill**: meta
event + matcher + file + 5m_window; max 1 reminder per skill every 5 minutes.Only trigger this skill automatically for explicit meta signals such as:
self-improving-meta|prompt-governance|stackabilityinstruction.ambiguity|rule.conflict|context.bloatDo not match generic words such as hook, skill, rule, or prompt by themselves.
When guidance conflicts, apply:
securityengineeringcodingaimeta as tie-breaker.learnings/meta/ in stackable mode..learnings/*.md log files only.AGENTS.md, SOUL.md, TOOLS.md, MEMORY.md, rules, hooks, or generated skills is not a logging write. Show a reviewed diff and apply only after explicit user approval.