cj-ways/arcana/persist-knowledge
Claude Code and agent skill by cj-ways/arcana
- community
Checking that the SKILL.md file is still in the repository.
Persists codebase patterns, conventions, or architectural knowledge to CLAUDE.md, MEMORY.md, or .claude/rules/. Auto-invokes when the user states a convention like "we always do X," "the pattern is," "from now on," or corrects a project-wide pattern. Manual via /persist-knowledge.
Install
npx vskill@latest install cj-ways/arcana/persist-knowledgeSKILL.md
The same SKILL.md was published earlier as cj-ways/arcana/persist-knowledge.
Persist Knowledge
Two modes of operation:
- Auto-invocation — Agent detects the user sharing a global pattern/convention/rule mid-conversation and persists it immediately (lightweight, single-finding).
- Manual invocation (
/persist-knowledge) — Full session scan at end of session, consolidates all findings.
Gotchas
- Writing duplicate rules that already exist in CLAUDE.md. Always search the target file before writing. Use Grep to check for keywords from the new rule. If a rule already covers the same ground — even with different wording — do not add a second version. Mark it as "Confirmed existing" and move on.
- Persisting ephemeral/session-specific information. Only persist things that apply across sessions. "We're debugging the auth bug" is session context, not a convention. "Auth tokens use RS256 signing" is a lasting convention. Ask: would this still be true and useful next week?
- Writing to the wrong file. Each target has a clear purpose — CLAUDE.md for project conventions and code patterns,
.claude/rules/for enforcement rules that need their own file (>15 lines), MEMORY.md for personal preferences and session decisions. A naming convention does not belong in MEMORY.md. A personal workflow preference does not belong in CLAUDE.md. - Auto-triggering on casual statements. Not every "I always do X" is a convention declaration. If the user says "I always forget to run tests" in a joking or off-hand context, that is not a rule to persist. Look for intentional, directive language: "from now on," "the convention is," "every X must have Y." When in doubt, do not persist — false persistence is worse than a missed convention.
Auto-Invocation Mode
When to trigger: The agent should invoke this skill when the user states something that looks like a global codebase convention, pattern, or rule — not a one-off task instruction. Signals include:
- "We always do X in this project"
- "The convention is X"
- "Never do X, always do Y"
- "From now on, X"
- "The pattern for X is Y"
- "Every X should have Y"
- User corrects the agent on a pattern that applies project-wide
- User explains a non-obvious codebase-wide behavior or constraint
- User states a naming convention, file organization rule, or architectural principle
When NOT to trigger:
- One-off task instructions ("use X for this file")
- Questions or discussions without a stated rule
- Information already documented in CLAUDE.md, MEMORY.md, or
.claude/rules/ - Personal preferences that don't affect the codebase ("I like dark mode")
Auto-invocation quality check — before persisting, verify:
- Is this a GLOBAL pattern (applies across the whole project), not a one-off decision?
- Is this NEW information not already captured in existing docs?
- Would a NEW agent session benefit from knowing this?
If any answer is NO, do not persist.
Workflow (auto-invoke):
- Extract the specific pattern/rule/convention from what the user said
- Classify it using the Documentation Hierarchy table below
- Read the target file to check for duplicates
- If new: write it to the correct location, matching surrounding style
- Report briefly:
Persisted to <target>: "<one-line summary>" - If already documented: report
Already documented in <target> (line N)— do not duplicate
Keep it lightweight — no full session scan, no summary table, no commit message suggestion.
Manual Mode (/persist-knowledge)
Arguments
| Arg | Effect | |
|---|---|---|
| _(none)_ | Full scan — all categories | |
patterns | Only new code patterns -> CLAUDE.md | |
decisions | Only architectural decisions -> MEMORY.md | |
memory | Only update MEMORY.md | |
claude | Only update CLAUDE.md |
Phase 1: Scan the Current Session
Read the current conversation context and identify findings across these categories:
Code patterns — Are there any naming conventions, file structure rules, import conventions, type/interface patterns, or coding style rules that were established or confirmed?
Architectural decisions — Were any decisions made about module structure, service design, data model design, state management, API design, or system boundaries?
User preferences — Any style preferences, comment conventions, workflow preferences, or tool preferences stated by the user?
Corrections — Did any existing documentation turn out to be wrong, misleading, or incomplete?
Project status — Were any milestones reached, phases completed, or significant decisions resolved?
For each finding, determine:
- Is it new? (not already in any target file)
- Is it stable? (expected to persist beyond this session)
Phase 2: Check Existing Docs
Before writing, read the relevant sections of each target file to detect duplicates and find the right insertion point:
- Read CLAUDE.md — specifically Code Patterns, Architecture, and Code Style sections
- Read MEMORY.md — all sections
- Read `.claude/rules/*.md` — any file relevant to the findings
For each finding:
- Already documented correctly -> skip, mark as "Confirmed existing"
- Documented but needs correction/expansion -> update in place, mark as "Updated"
- Not documented -> write, mark as "Added"
Phase 3: Write Updates
Write findings to target files. For each write:
Writing to CLAUDE.md
- Insert into the most specific matching section
- If no section fits, add a new
###subsection under the most relevant##section - Format: bullet list, one-liners, match surrounding style exactly
- No decorative comments, no rationale unless the logic is genuinely non-obvious
- Example of correct style (match this):
```
- All API responses use camelCase keys — never snake_case in JSON output
```
Writing to MEMORY.md
- Find the matching existing topic group
- If no group fits, add a new
## Topic Namesection above# currentDate - Format: bullet points, one-liners
- Date architectural decisions: append
(YYYY-MM-DD)to the section header or the bullet - Example of correct style:
```
- Switched from REST to GraphQL for all client-facing APIs (2026-03-18)
```
Writing to .claude/rules/<topic>.md
- Only when a new multi-line topic needs its own reference (>15 lines on one topic)
- Create the file only if it does not exist
- Use the same markdown structure as existing rules files
Phase 4: Report
Present a summary table of all findings:
If no new learnings found: output "No new patterns or decisions to persist from this session."
Suggested commit message if files were modified:
Documentation Hierarchy
Before writing anything, understand where each type of finding belongs:
| Content | Target | Rule | |
|---|---|---|---|
| Stable project-wide code patterns (naming, structure, return types, conventions) | CLAUDE.md — Code Patterns section | Must be confirmed across multiple files or explicitly stated by user as convention | |
| Topic-specific deep reference (>15 lines on one topic) | .claude/rules/<topic>.md | When CLAUDE.md section becomes too long | |
| Session decisions, per-session learnings, user preferences, status updates | MEMORY.md | Everything else — must be < 200 lines total |
Rules
- NEVER duplicate content that already exists in any target file — read first, always
- NEVER create new files (other than new
.claude/rules/<topic>.mdwhen genuinely needed) - NEVER exceed 200 lines in MEMORY.md — warn if approaching limit, suggest pruning stale entries
- NEVER add rationale/comments unless the logic is non-obvious (match the project style)
- ALWAYS read target files before writing to verify no duplicates
- ALWAYS match the exact bullet style and formatting of surrounding content
- ALWAYS include session date
(YYYY-MM-DD)for architectural decisions in MEMORY.md - If the session had no new learnings: report this honestly, do not invent content
- Only use these tools: Read, Edit, Glob, Grep, Write (only for new
.claude/rules/<topic>.md)
Output
Auto-invocation: Single line — Persisted to <target>: "<summary>" or Already documented in <target>.
Manual invocation:
- Summary table (findings -> target -> action)
- Suggested commit message (if files were modified)
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/persist-knowledge/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/cj-ways/arcana/persist-knowledge)