Skills lovstudio:auto-context
git clone https://github.com/lovstudio/skills
T=$(mktemp -d) && git clone --depth=1 https://github.com/lovstudio/skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/auto-context" ~/.claude/skills/lovstudio-skills-lovstudio-auto-context && rm -rf "$T"
skills/auto-context/SKILL.mdAutoContext: 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 index | Do it, report path |
| Confirm-first | edit , edit project , overwrite/delete existing memory | Show diff, wait for "yes" |
| Suggest-only | , , , 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 or with exact command |
| Near capacity | Suggest or 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]
)
/lovstudio-auto-context [args]Two call shapes:
A. Bare call — health report + opportunistic memory write
/lovstudio-auto-context
- Measure — estimate turns, tool calls, distinct topics
- Assess — healthy / getting noisy / polluted / critical
- 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
. Report the path.MEMORY.md - Recommend harness actions if needed (
,/fork
,/compact
) with the exact command to paste./btw
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 | Confirm-first |
| "记到项目 / 加到项目 CLAUDE.md" | edit project | 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 with exact syntax | Suggest-only |
Action: Write Project Memory (auto-execute)
Directory:
~/.claude/projects/<project-slug>/memory/ (already exists; do
not mkdir).
Procedure:
- Pick filename:
(e.g.<type>_<topic>.md
).feedback_output_paths.md - Write with the required frontmatter (
,name
,description
).type - For
/feedback
types, includeproject
and**Why:**
lines.**How to apply:** - Update
with one-line pointer under 150 chars.MEMORY.md - Report the absolute + relative path.
Action: Edit Global CLAUDE.md (confirm-first)
Target:
~/.claude/CLAUDE.md.
Procedure:
- Read the file.
- Locate the best section for the addition (match existing heading like "输出规范", "网络 / 代理", "Debugging Discipline"; or create a new section if none fits).
- Show the proposed diff as a fenced block with
/-
lines.+ - Ask: "执行这个修改?(yes/no)"
- On "yes" → apply via
. On anything else → abort, optionally offer to save as project memory instead.Edit
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: /fork
or
approaching capacity — compact first, then continue: /compact
Do not wrap in explanations. The command is the deliverable.
What this skill cannot do (be honest about it)
- Invoke
,/fork
,/compact
,/btw
, new session — harness-only./clear - Edit another agent's transcript.
- Auto-install hooks — use
for that./update-config
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.