knowledge-persistence
Skill4 starsChanged 9 months agoMITView on GitHub
Patterns for learning from corrections, capturing instincts, extracting stable patterns, and building cross-session knowledge. Use when the user corrects you, when you discover a recurring pattern, or when insights should persist beyond the current session.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- feverZHONG/liya-knowledge-persistencetheir own version, first seen Sep 28, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- feverZHONG/liya-knowledge-persistence★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository78 other files it gives its agents.
- AGENTS.mdAGENTS.md
- rules/agents.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/claude-initial-setup.mdcCursor rule
- parallel-task-executionSkill
- subagent-patternsSkill
- task-coordinationSkill
- agent-communicationSkill
- context-managementSkill
- multi-agent-orchestrationSkill
- deploy-strategiesSkill
- github-actions-guideSkill
- pipeline-patternsSkill
- anthropic-sdk-guideSkill
- prompt-engineeringSkill
- tool-use-patternsSkill
- automated-review-setupSkill
- pr-standardsSkill
- review-checklistSkill
- file-organizationSkill
- immutability-patternsSkill
- naming-conventionsSkill
- branching-strategySkill
- commit-conventionsSkill
- pr-workflowSkill
- migration-patternsSkill
- query-optimizationSkill
- schema-design-guideSkill
- error-tracingSkill
- log-analysisSkill
- systematic-debuggingSkill
- django-admin-customizationSkill
- django-orm-masterySkill
- drf-api-patternsSkill
- docker-compose-guideSkill
- dockerfile-best-practicesSkill
- multi-stage-buildsSkill
- express-error-handlingSkill
- middleware-patternsSkill
- rest-api-nodeSkill
- async-fastapiSkill
- dependency-injection-fastapiSkill
- pydantic-validationSkill
- concurrency-patterns-goSkill
- error-handling-goSkill
- idiomatic-goSkill
- automation-triggersSkill
- hook-recipesSkill
- pre-post-hooksSkill
- junit-testingSkill
- maven-gradle-guideSkill
- spring-boot-patternsSkill
- mcp-resource-patternsSkill
- mcp-server-creationSkill
- mcp-tool-designSkill
- context-optimizationSkill
- memory-patternsSkill
- caching-strategiesSkill
- lazy-loading-patternsSkill
- profiling-guideSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 9 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 24
When the user corrects you, the correction invalidates stored knowledge.
- Distinctive: line 47
When you notice yourself repeatedly making the same decision, capture it:
- Distinctive: line 67
After seeing a pattern in 3+ locations, extract it to memory:
- Distinctive: line 113
When a user states a preference, save it immediately:
- Distinctive: line 130
Not all learned information is equally reliable:
- Distinctive: line 164
Saving everything: Not every observation deserves persistence.
- Distinctive: line 165
Ignoring corrections: When the user says "that is wrong", you must update memory.
- Distinctive: line 167
Stale memories: Never-updated memories become lies.
- Distinctive: line 183
Patterns need evidence: Wait for 3+ occurrences before extracting.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Knowledge Persistence
Knowledge persistence is about capturing what you learn during sessions so future sessions start smarter. This includes corrections, discovered patterns, user preferences, and debugging insights.
When to Use
- User corrects a mistake originating from stored memory
- You discover a pattern that applies broadly to the project
- A debugging session reveals a non-obvious root cause
- User states a preference ("always do X", "never use Y")
- You solve a problem that is likely to recur
Core Patterns
Learning from Corrections
When the user corrects you, the correction invalidates stored knowledge. Fix the source immediately:
User: "We don't use Express anymore, we migrated to Fastify"
# WRONG: Just acknowledge and continue
"Got it, I'll use Fastify."
# RIGHT: Update memory, then continue
1. Edit memory/MEMORY.md:
Old: "Framework: Express"
New: "Framework: Fastify (migrated from Express)"
2. Check topic files for stale Express references:
Edit memory/architecture.md if it mentions Express
3. Then continue with correct contextThe correction means the stored memory is wrong. Fix it at the source before continuing, so the same mistake does not repeat.
Instinct Capture
When you notice yourself repeatedly making the same decision, capture it:
# memory/patterns.md
## Project-Specific Instincts
### Error Handling
- This project always wraps service calls in try/catch at the route level
- Errors are logged with structuredLogger.error(), not console.error()
- All error responses use the AppError class from src/errors.ts
### Naming
- Database functions: findX, createX, updateX, deleteX (not getX, setX)
- Route handlers: handleGetUser, handleCreateUser (not getUser, createUser)
- Test files: same name with .test.ts suffix, same directoryPattern Extraction
After seeing a pattern in 3+ locations, extract it to memory:
# Observation across multiple files:
# - src/routes/users.ts uses Zod schema + validate middleware
# - src/routes/posts.ts uses Zod schema + validate middleware
# - src/routes/comments.ts uses Zod schema + validate middleware
# Extract to memory/patterns.md:
## Input Validation Pattern
All route handlers use Zod schemas for request validation:
1. Schema defined in src/schemas/{resource}.ts
2. validate(schema) middleware applied to route
3. Handler receives typed, validated body via req.validated
Example:
const schema = z.object({ title: z.string().min(1) })
router.post('/', validate(schema), handleCreatePost)Cross-Session Knowledge Building
Structure knowledge to be useful across sessions:
# memory/debugging.md
## Recurring Issues and Solutions
### "Cannot find module" after adding new file
- Cause: TypeScript path aliases not updated in tsconfig.json
- Fix: Add path to compilerOptions.paths in tsconfig.json
- Also check: jest.config.ts moduleNameMapper if tests fail
### Database connection timeout in tests
- Cause: Test database pool not closed after test suite
- Fix: Add afterAll(() => db.destroy()) in test setup
- File: src/test/setup.ts
### Build fails with "heap out of memory"
- Cause: TypeScript compiling node_modules due to missing exclude
- Fix: Ensure tsconfig.json has "exclude": ["node_modules", "dist"]Preference Capture
When a user states a preference, save it immediately:
User: "Always use bun instead of npm"
# Save to memory/MEMORY.md under User Preferences:
## User Preferences
- Package manager: bun (not npm or yarn)
- Always use named exports (no default exports)
- Prefers functional style over classes
- Run tests before committingPreferences are explicit user requests — save them after a single interaction, no need to wait for repetition.
Knowledge Confidence Levels
Not all learned information is equally reliable:
# HIGH confidence (save immediately):
- User explicitly states a preference
- Pattern confirmed in 3+ files
- Architectural decision documented in code comments or README
# MEDIUM confidence (save with caveat):
- Pattern seen in 2 files (note: "observed in X and Y, may be broader")
- Behavior inferred from test expectations
# LOW confidence (do NOT save):
- Pattern seen in only 1 file
- Guess about project conventions from naming alone
- Inferred from a single error messageKnowledge Lifecycle
Memory entries have a lifecycle:
Discovery -> Verification -> Recording -> Maintenance -> Retirement
1. Discovery: Notice a pattern or receive a correction
2. Verification: Confirm across multiple sources (unless explicit user request)
3. Recording: Save to appropriate memory file
4. Maintenance: Update when corrections arrive or project evolves
5. Retirement: Remove when no longer applicable (framework migration, etc.)Anti-Patterns
- Saving everything: Not every observation deserves persistence. A one-off fix for a typo is not worth saving. Focus on recurring patterns and explicit preferences.
- Ignoring corrections: When the user says "that is wrong", you must update memory. Acknowledging without updating means the error repeats next session.
- Speculative memories: "I think this project probably uses X" based on one file read is not reliable enough to save. Verify first.
- Stale memories: Never-updated memories become lies. When you notice information is outdated, fix it immediately.
- Chronological dumps: "On Tuesday I learned X, on Wednesday I learned Y" is useless. Organize by topic so information is findable.
Quick Reference
| Trigger | Action | Confidence Required |
| User says "remember X" | Save immediately | Explicit request |
| User corrects you | Update source immediately | Correction = verified |
| Pattern in 3+ files | Save as confirmed pattern | High |
| Pattern in 2 files | Save with caveat | Medium |
| Pattern in 1 file | Do not save | Too low |
| Debugging solution | Save if likely to recur | Medium-High |
Corrections are urgent: Fix the memory source before continuing. Preferences are immediate: One explicit request is enough to save. Patterns need evidence: Wait for 3+ occurrences before extracting. Organize by topic: Semantic grouping, never chronological.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

