
Lovstudio:Auto Context
- 2 installs
- Updated July 13, 2026
- lovstudio/auto-context-skill
Evaluates a Claude session for context pollution and takes shaping actions like writing memory, updating CLAUDE.md, and suggesting /compact or /fork.
About
Detects session context pollution such as topic drift and stale noise, then writes project memory, updates CLAUDE.md with diff-and-confirm, and surfaces harness commands like /fork and /compact. A developer uses it to keep a long Claude Code session focused.
- Writes project memory and updates CLAUDE.md with diff and confirm
- Suggests harness commands like /fork, /compact, /btw
Lovstudio:Auto Context by the numbers
- 2 all-time installs (skills.sh)
- Ranked #2,419 of 3,282 Productivity & Planning skills by installs in the Skillselion catalog
- Data as of Jul 25, 2026 (Skillselion catalog sync)
npx skills add https://github.com/lovstudio/auto-context-skill --skill lovstudioauto-contextAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 2 |
|---|---|
| Last updated | July 13, 2026 |
| Repository | lovstudio/auto-context-skill ↗ |
What it does
Evaluates a Claude session for context pollution and takes shaping actions like writing memory, updating CLAUDE.md, and suggesting /compact or /fork.
Files
AutoContext: Context Operator
Not just a health check — a full operator over everything that shapes context. Three layers by action sensitivity:
| Layer | Examples | Behavior |
|---|---|---|
| Auto-execute | write project memory, update MEMORY.md index | Do it, report path |
| Confirm-first | edit ~/.claude/CLAUDE.md, edit project CLAUDE.md, overwrite/delete existing memory | Show diff, wait for "yes" |
| Suggest-only | /fork, /compact, /btw, new session | Print the exact command to paste |
The harness owns /fork and /compact; this skill cannot invoke them. But it can do everything else and will.
Auto Mode (via Plugin Hook)
When the lovstudio plugin is enabled, a UserPromptSubmit hook monitors transcript size. Above threshold (40+ entries or 150KB+), it injects a lightweight <auto-context> reminder.
When you see `<auto-context>`:
| Context State | Action |
|---|---|
| Mostly relevant | Continue, say nothing |
| Some stale noise | Mentally deprioritize, proceed |
| Mostly irrelevant | Suggest /fork or /btw with exact command |
| Near capacity | Suggest /compact or /fork with exact command |
Rules:
- 1 sentence max unless acting.
- If context is fine, say nothing.
- Never auto-fork/auto-compact (can't anyway — harness-only).
- Don't mention "AutoContext" unless asked.
Manual Mode (/lovstudio-auto-context [args])
Two call shapes:
A. Bare call — health report + opportunistic memory write
/lovstudio-auto-context1. Measure — estimate turns, tool calls, distinct topics 2. Assess — healthy / getting noisy / polluted / critical 3. Scan recent turns for unpersisted feedback/preferences — if the user stated a rule or preference earlier in the session that should persist to future conversations (typical trigger phrases: "从今以后", "以后都", "所有 X 应该 Y", "别再", "记住"), and no memory was written, auto-execute: write the memory file + update MEMORY.md. Report the path. 4. Recommend harness actions if needed (/fork, /compact, /btw) with the exact command to paste.
Keep to 3-5 lines unless taking confirm-first actions.
B. With arguments — targeted context operation
/lovstudio-auto-context <free-form instruction>Parse the instruction and route to the right action class:
| Instruction pattern | Action | Sensitivity |
|---|---|---|
| "记到全局 / write to global / 加到 ~/.claude/CLAUDE.md" | edit ~/.claude/CLAUDE.md | Confirm-first |
| "记到项目 / 加到项目 CLAUDE.md" | edit project CLAUDE.md | Confirm-first |
| "记住 X / 记到 memory" | write project memory | Auto-execute |
| "忘掉 X / forget X" | remove relevant memory file + index entry | Confirm-first |
| "该分叉了吗 / should I fork" | evaluate + suggest command | Suggest-only |
| "压缩一下 / compact" | suggest /compact with exact syntax | Suggest-only |
Action: Write Project Memory (auto-execute)
Directory: ~/.claude/projects/<project-slug>/memory/ (already exists; do not mkdir).
Procedure: 1. Pick filename: <type>_<topic>.md (e.g. feedback_output_paths.md). 2. Write with the required frontmatter (name, description, type). 3. For feedback / project types, include **Why:** and **How to apply:** lines. 4. Update MEMORY.md with one-line pointer under 150 chars. 5. Report the absolute + relative path.
Action: Edit Global CLAUDE.md (confirm-first)
Target: ~/.claude/CLAUDE.md.
Procedure: 1. Read the file. 2. Locate the best section for the addition (match existing heading like "输出规范", "网络 / 代理", "Debugging Discipline"; or create a new section if none fits). 3. Show the proposed diff as a fenced block with -/+ lines. 4. Ask: "执行这个修改?(yes/no)" 5. On "yes" → apply via Edit. On anything else → abort, optionally offer to save as project memory instead.
Never skip the diff step. CLAUDE.md is user-authored authoritative config; silent edits erode trust.
Action: Edit Project CLAUDE.md (confirm-first)
Same flow as global, but target is <cwd>/CLAUDE.md (walk up if not at root). Same diff-then-confirm requirement.
Action: Suggest Harness Commands (suggest-only)
Produce the exact string the user should paste, not a description:
context polluted — paste this to fork:
/forkor
approaching capacity — compact first, then continue:
/compactDo not wrap in explanations. The command is the deliverable.
What this skill cannot do (be honest about it)
- Invoke
/fork,/compact,/btw,/clear, new session — harness-only. - Edit another agent's transcript.
- Auto-install hooks — use
/update-configfor that.
If the user asks for one of these, say so and give them the command to paste.
Output convention
Every action that writes a file must echo its absolute + relative path (per project-wide output-paths rule). Applies to memory files, CLAUDE.md edits (show final path), and any derived artifacts.
Changelog
0.2.0 — 2026-04-18
- Expand scope from "hygiene checker" to context operator covering all
context-affecting actions the skill can reach.
- Add action layer 1 (auto-execute): write project memory when unpersisted
feedback/preferences are detected in the session.
- Add action layer 2 (confirm-first): edit
~/.claude/CLAUDE.mdor project
CLAUDE.md with diff-preview-then-confirm flow.
- Add action layer 3 (suggest-only): surface
/fork,/compact,/btwas
exact-paste strings. Document that harness owns these — skill can't invoke them.
- Add argument-parsing for targeted ops: "记到全局", "记到项目", "记住 X",
"忘掉 X", "该分叉了吗".
- Output-path convention: every file-writing action echoes absolute +
relative path.
0.1.0
- Initial release: hook-triggered
<auto-context>nudge + manual
/lovstudio-auto-context health report.
AutoContext
Context operator for Claude Code sessions — not just a health check.
What It Does
Three capability layers, routed by action sensitivity:
- Auto-execute: writes project memory when it spots unpersisted
feedback/preferences; updates MEMORY.md index.
- Confirm-first: edits
~/.claude/CLAUDE.mdor projectCLAUDE.md
with a shown diff and explicit "yes" before applying.
- Suggest-only: harness commands like
/fork,/compact,/btw—
surfaced as exact-paste strings.
You (turn 31): "从今以后所有输出都要带路径"
↑ AutoContext writes feedback memory automatically
You (turn 45): "/lovstudio-auto-context 记到全局"
↑ Shows diff of proposed ~/.claude/CLAUDE.md edit, waits for yes
You (turn 80): transcript size crosses threshold
↑ Suggests: paste `/fork` (harness owns this one)Install
Works standalone as a manual skill. Auto-trigger on long transcripts requires the lovstudio plugin which registers the UserPromptSubmit hook.
Manual Use
/lovstudio-auto-context # health report + opportunistic memory write
/lovstudio-auto-context 记到全局 # edit ~/.claude/CLAUDE.md with confirm
/lovstudio-auto-context 记到项目 # edit project CLAUDE.md with confirm
/lovstudio-auto-context 记住 X # write project memory
/lovstudio-auto-context 该分叉了吗 # evaluate + suggest /forkWhat It Cannot Do
Harness-owned commands (/fork, /compact, /btw, /clear, new session) can't be invoked programmatically. The skill will print the exact command for you to paste.
Version
0.2.0 — adds confirm-first editing of global/project CLAUDE.md and auto-write of feedback memory. See CHANGELOG.md.
License
MIT