Log engineering learnings, issues, and feature requests to markdown files for continuous improvement. Captures architecture decisions, build failures, test gaps, performance regressions, dependency problems, and code quality issues. Important learnings get promoted to architecture decision records, coding standards, and CI/CD runbooks.
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 "# Engineering Learnings\n\nArchitecture decisions, code quality insights, and engineering knowledge captured during development.\n\n**Categories**: architecture_debt | code_smell | performance_regression | dependency_issue | testing_gap | design_flaw\n**Areas**: design | implementation | code_review | ci_cd | deployment | monitoring\n\n---\n" > .learnings/LEARNINGS.md
[ -f .learnings/ENGINEERING_ISSUES.md ] || printf "# Engineering Issues Log\n\nBuild failures, deployment errors, performance regressions, and infrastructure problems.\n\n---\n" > .learnings/ENGINEERING_ISSUES.md
[ -f .learnings/FEATURE_REQUESTS.md ] || printf "# Feature Requests\n\nEngineering capabilities, tooling improvements, and infrastructure enhancements requested during development.\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, environment variables, or full config files unless the user explicitly asks for that level of detail. Prefer short summaries or redacted excerpts over raw command output or full stack traces.
Use a manual-first workflow by default. If you want reminders, use the opt-in hook workflow described in Hook Integration.
SituationActionBuild fails (CI or local)Log to .learnings/ENGINEERING_ISSUES.md with build contextArchitecture violation discoveredLog to .learnings/LEARNINGS.md with category architecture_debtTest flake or gap identifiedLog to .learnings/LEARNINGS.md with category testing_gapDependency CVE or breaking changeLog to .learnings/ENGINEERING_ISSUES.md with dependency detailsPerformance regression detectedLog to .learnings/ENGINEERING_ISSUES.md with metrics/benchmarksCode smell found during reviewLog to .learnings/LEARNINGS.md with category code_smellDesign flaw surfacesLog to .learnings/LEARNINGS.md with category design_flawUser requests engineering capabilityLog to .learnings/FEATURE_REQUESTS.mdDeployment rollback triggeredLog to .learnings/ENGINEERING_ISSUES.md with rollback reasonN+1 query or slow path foundLog to .learnings/LEARNINGS.md with category performance_regressionSimilar to existing entryLink with **See Also**, consider priority bumpBroadly applicable patternPromote to ADR, coding standards, or CI/CD runbookDesign pattern proven in practicePromote to SOUL.md (OpenClaw workspace)CI/CD workflow improvementPromote to AGENTS.md (OpenClaw workspace)Build tool or infra gotchaPromote to TOOLS.md (OpenClaw workspace)
OpenClaw is the primary platform for this skill. It uses workspace-based prompt injection with automatic skill loading.
Via ClawdHub (recommended):
bash
clawdhub install self-improving-engineering
Manual:
bash
git clone https://github.com/jose-compu/self-improving-engineering.git ~/.openclaw/skills/self-improving-engineering
OpenClaw injects these files into every session:
text
~/.openclaw/workspace/
├── AGENTS.md # CI/CD workflows, deployment patterns, multi-agent coordination
├── SOUL.md # Design principles, architecture guidelines, coding standards
├── TOOLS.md # Build tools, test frameworks, dependency managers, infra 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
├── ENGINEERING_ISSUES.md
└── FEATURE_REQUESTS.md
bash
mkdir -p ~/.openclaw/workspace/.learnings
Then create the log files (or copy from assets/):
LEARNINGS.md — architecture decisions, code quality insights, design patternsENGINEERING_ISSUES.md — build failures, deploy errors, performance regressionsFEATURE_REQUESTS.md — tooling improvements, infrastructure enhancementsWhen learnings prove broadly applicable, promote them to workspace files:
Learning TypePromote ToExampleDesign patterns & principlesSOUL.md"Prefer composition over inheritance for service layer"CI/CD workflows & deploy patternsAGENTS.md"Run migration check before deploy"Build tool & infra gotchasTOOLS.md"Node 20 breaks native modules; pin to 18 LTS"
Opt-in and project-scoped. Enabling a hook persists across future sessions; skip this unless you need reminders.
For lightweight reminders at session start (recommended: activator only):
bash
cp -r hooks/openclaw ~/.openclaw/hooks/self-improving-engineering
openclaw hooks enable self-improving-engineering
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. Avoid reading templates from the current repo or workspace unless you explicitly trust that path.
When engineering issues or architectural discoveries occur:
.learnings/ENGINEERING_ISSUES.md, LEARNINGS.md, or FEATURE_REQUESTS.mddocs/decisions/CLAUDE.md or .github/copilot-instructions.mdAGENTS.mdAppend to .learnings/LEARNINGS.md:
markdown
## [LRN-YYYYMMDD-XXX] category
**Logged**: ISO-8601 timestamp
**Priority**: low | medium | high | critical
**Status**: pending
**Area**: design | implementation | code_review | ci_cd | deployment | monitoring
### Summary
One-line description of the engineering learning
### Details
Full context: what was discovered, why it matters, what the correct approach is
### Suggested Action
Specific fix, refactoring step, or architectural change to make
### Metadata
- Source: build_failure | test_failure | code_review | deployment | monitoring | investigation
- Category: architecture_debt | code_smell | performance_regression | dependency_issue | testing_gap | design_flaw
- Related Files: path/to/file.ext
- Tags: tag1, tag2
- See Also: LRN-20250110-001 (if related to existing entry)
- Pattern-Key: arch.circular_dependency | perf.n_plus_one | test.missing_integration (optional)
- Recurrence-Count: 1 (optional)
- First-Seen: 2025-01-15 (optional)
- Last-Seen: 2025-01-15 (optional)
---
Categories:
architecture_debt — coupling, circular dependencies, layer violations, missing abstractionscode_smell — long methods, god classes, feature envy, primitive obsessionperformance_regression — N+1 queries, memory leaks, slow endpoints, missing indexesdependency_issue — CVEs, version conflicts, breaking upgrades, deprecated packagestesting_gap — missing integration tests, untested edge cases, flaky testsdesign_flaw — wrong pattern choice, API contract issues, data model problemsAppend to .learnings/ENGINEERING_ISSUES.md:
markdown
## [ENG-YYYYMMDD-XXX] issue_type
**Logged**: ISO-8601 timestamp
**Priority**: high
**Status**: pending
**Area**: design | implementation | code_review | ci_cd | deployment | monitoring
### Summary
Brief description of the engineering issue
### Error
Actual error message, build output, or test failure
text
### Context
- Build/deploy step that failed
- Environment details (CI runner, Node version, OS)
- Input or configuration that triggered the issue
- Summary or redacted excerpt of relevant output
### Impact
What is blocked or degraded by this issue
### Suggested Fix
If identifiable, what might resolve this
### Metadata
- Reproducible: yes | no | unknown
- Environment: local | ci | staging | production
- Related Files: path/to/file.ext
- See Also: ENG-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**: design | implementation | code_review | ci_cd | deployment | monitoring
### Requested Capability
What engineering capability or tooling improvement is needed
### Engineering Context
Why this is needed, what pain point it addresses, what breaks without it
### Complexity Estimate
simple | medium | complex
### Suggested Implementation
Architecture approach, libraries to evaluate, integration points
### Metadata
- Frequency: first_time | recurring
- Related Features: existing_feature_name
---
Format: TYPE-YYYYMMDD-XXX
LRN (learning), ENG (engineering issue), FEAT (feature request)001, A7B)Examples: LRN-20250115-001, ENG-20250115-A3F, FEAT-20250115-002
When an issue is fixed, update the entry:
**Status**: pending → **Status**: resolvedmarkdown
### Resolution
- **Resolved**: 2025-01-16T09:00:00Z
- **Commit/PR**: abc123 or #42
- **Root Cause**: Brief description of actual root cause
- **Notes**: What was done and any follow-up needed
Other status values:
in_progress — Actively being worked onwont_fix — Decided not to address (add reason in Resolution notes)promoted — Elevated to ADR, coding standard, or CI/CD runbookpromoted_to_skill — Extracted as a reusable skillWhen a learning is broadly applicable (not a one-off fix), promote it to permanent project memory.
TargetWhat Belongs Theredocs/decisions/ADR-NNN.mdArchitecture decisions with context and consequencesCLAUDE.mdProject facts, build conventions, gotchas for all Claude interactionsAGENTS.mdCI/CD workflows, deployment patterns, automation rules.github/copilot-instructions.mdProject context and conventions for GitHub CopilotSOUL.mdDesign principles, coding philosophy, architecture guidelines (OpenClaw)TOOLS.mdBuild tools, test frameworks, dependency manager gotchas (OpenClaw).github/CODING_STANDARDS.mdTeam coding standards and conventions
Distill the learning into a concise rule, ADR, or standard
Prepare a minimal patch for the appropriate section in the target file (create file if needed)
Show a reviewed diff and apply only after explicit user approval
Update original entry:
**Status**: pending → **Status**: promoted**Promoted**: docs/decisions/ADR-007.md or target fileLearning (verbose):
Discovered circular dependency between UserService and AuthService. UserService imports AuthService for token validation, AuthService imports UserService for user lookup. Causes test isolation failures and makes both services untestable independently.
As ADR (concise):
markdown
# ADR-007: Break circular service dependencies with event bus
## Status: Accepted
## Context
UserService and AuthService have circular imports causing test isolation failures.
## Decision
Use an event bus for cross-service communication. Services publish events instead of direct imports.
## Consequences
- Services become independently testable
- Adds event bus infrastructure dependency
- Requires eventual consistency for cross-service queries
If logging something similar to an existing entry:
Search first: grep -r "keyword" .learnings/
Link entries: Add **See Also**: ENG-20250110-001 in Metadata
Bump priority if issue keeps recurring
Consider systemic fix: Recurring issues often indicate:
TOOLS.md).eslintrc or coding standard)Use this workflow to ingest recurring engineering patterns from the simplify-and-harden skill and turn them into durable engineering guidance.
Read simplify_and_harden.learning_loop.candidates from the task summary.
For each candidate, use pattern_key as the stable dedupe key.
Search .learnings/LEARNINGS.md for an existing entry with that key:
grep -n "Pattern-Key: <pattern_key>" .learnings/LEARNINGS.mdIf found:
Recurrence-CountLast-SeenSee Also links to related entries/tasksIf not found:
LRN-... entrySource: simplify-and-hardenPattern-Key, Recurrence-Count: 1, and First-Seen/ Last-SeenPromote recurring patterns into agent context/system prompt files when all are true:
Recurrence-Count >= 3Promotion targets:
CLAUDE.mdAGENTS.md.github/copilot-instructions.mdSOUL.md / TOOLS.md for OpenClaw workspace-level guidance when applicableWrite promoted rules as short prevention rules (what to check before/while coding), not long incident write-ups.
Review .learnings/ at natural engineering breakpoints:
bash
# Count pending engineering items
grep -h "Status\*\*: pending" .learnings/*.md | wc -l
# List pending high-priority items
grep -B5 "Priority\*\*: high" .learnings/*.md | grep "^## \["
# Find learnings for a specific area
grep -l "Area\*\*: ci_cd" .learnings/*.md
# Find all architecture debt entries
grep -B2 "Category.*architecture_debt" .learnings/LEARNINGS.md | grep "^## \["
Automatically log when you notice:
Build Failures (→ engineering issue):
Test Failures (→ engineering issue or learning with testing_gap):
Code Review Feedback (→ learning with appropriate category):
Deployment Issues (→ engineering issue):
Performance Alerts (→ learning with performance_regression):
Dependency Audit Warnings (→ engineering issue):
npm audit / pnpm audit finds vulnerabilitiesPriorityWhen to UsecriticalProduction outage, data loss risk, security vulnerability (CVE with exploit), service completely downhighBuild broken on main, test suite red, blocking deployment, dependency CVE without known exploitmediumTech debt accumulating, code smell in frequently-changed module, missing tests for happy pathlowStyle inconsistency, documentation gap, minor code smell in stable code, nice-to-have refactor
Use to filter learnings by engineering concern:
AreaScopedesignArchitecture decisions, system design, API contracts, data modelingimplementationCode quality, algorithms, data structures, business logiccode_reviewReview feedback, PR patterns, merge conflicts, coding standardsci_cdBuild pipelines, test automation, artifact management, CI configurationdeploymentRelease process, infrastructure, containers, orchestration, rollbacksmonitoringObservability, alerting, logging, tracing, SLO/SLA tracking
Keep learnings local (per-developer):
gitignore
.learnings/
This is the default to avoid committing sensitive or noisy local logs by accident.
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
Enable reminders through agent hooks only when needed. This is opt-in — you must explicitly configure hooks.
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": "build|test|deploy|fix|debug|error|ci|cd|rollback",
"hooks": [{
"type": "command",
"command": "./skills/self-improving-engineering/scripts/activator.sh"
}]
}]
}
}
This injects a lightweight engineering learning reminder after matching prompts (~50-100 tokens overhead).
For advanced setup with PostToolUse error detection, see references/hooks-setup.md. Keep it disabled unless you explicitly want tool-output pattern checks.
ScriptHook TypePurposescripts/activator.shUserPromptSubmitReminds to evaluate engineering learnings after tasksscripts/error-detector.shPostToolUse (Bash)Triggers on build errors, test failures, dep vulnerabilities
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 learning is valuable enough to become a reusable skill, extract it using the provided helper.
A learning qualifies for skill extraction when ANY of these apply:
CriterionDescriptionRecurringHas See Also links to 2+ similar issuesVerifiedStatus is resolved with working fixNon-obviousRequired actual debugging/investigation to discoverBroadly applicableNot project-specific; useful across codebasesUser-flaggedUser says "save this as a skill" or similar
Identify candidate: Learning meets extraction criteria
Run helper (or create manually): bash
./skills/self-improving-engineering/scripts/extract-skill.sh skill-name --dry-run
./skills/self-improving-engineering/scripts/extract-skill.sh skill-name
Customize SKILL.md: Fill in template with learning content
Update learning: Set status to promoted_to_skill, add Skill-Path
Verify: Read skill in fresh session to ensure it's self-contained
skills/<skill-name>/SKILL.md using template from assets/SKILL-TEMPLATE.mdname and description, name matches folder nameAgentActivationSetupClaude CodeHooks (UserPromptSubmit, PostToolUse).claude/settings.jsonCodex CLIHooks (same as Claude Code).codex/settings.jsonGitHub CopilotManual (no hooks).github/copilot-instructions.mdOpenClawWorkspace injection + inter-agent messagingSee "OpenClaw Setup" above
Regardless of agent, apply self-improving engineering when you:
This skill is standalone-compatible and stackable with other self-improving skills.
.learnings/engineering/.learnings/INDEX.mdEvery new entry must include:
markdown
**Skill**: engineering
event + matcher + file + 5m_window; max 1 reminder per skill every 5 minutes.Only trigger this skill automatically for engineering signals such as:
build failed|ci failed|deploy failed|rollback|pipelinedependency|version conflict|coverage drop|performance regressionWhen guidance conflicts, apply:
securityengineeringcodingaimeta as tie-breaker.learnings/engineering/ 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.