본문으로 건너뛰기
cccskills
무료GitHub에 공개

memory-cleanup

Finds and, on the owner's word, kills process tails that hold a machine's memory for nothing — idle Claude Code desktop sessions, leftovers of closed apps, orphaned workers, zombies. Use on "memory", "swap", "laptop is slow", "zombie processes", "kill the tails", "clean up memory", and after closing heavy apps.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(5)

  • SKILL.md5.0 KB
  • README.md1.2 KB
  • README.ru.md2.0 KB
  • scripts/tails-linux.sh5.7 KB
  • scripts/tails-macos.sh12.5 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

memory-cleanup

An active skill: it kills processes, so the snapshot and the kill are separate steps. The snapshot script only reads.

Typical picture on a 16 GB Mac: a few gigabytes held by Claude Code desktop sessions idle for days (30–400 MB each, dozens of them), a daemon of a closed app still running its workers, duplicate worker brokers, a Chrome for Testing left by puppeteer. A background npm run dev started inside a session dies together with that session.

When memory is really short

"13 of 16 GB used" and the Swap Used size mean nothing by themselves: macOS keeps memory busy with cache and compression, and swap does not shrink after memory is freed until a reboot. Shortage shows by three signs:

  • pressure is yellow or red: sysctl kern.memorystatus_vm_pressure_level above 1, memory_pressure shows less than 25–30% free;
  • Swapouts in vm_stat grow before your eyes (two readings a minute apart);
  • swap grows three readings in a row.

Measure a process by top -o mem or footprint: ps (RSS) does not see the compressed part and understates it. Look at the top of top -o mem before cleaning: one live job (a local whisper transcription, a model load) can hold more than all the tails together, and the script does not list children of active sessions.

Procedure

  1. Snapshot. From the skill root:

    bash scripts/tails-macos.sh                                                     # local
    ssh -o BatchMode=yes -o ConnectTimeout=8 <alias> 'bash -s' < scripts/tails-<os>.sh   # remote
    

    The script reads only, never calls sudo, kills nothing. It prints a table of candidates and a summary: total RSS, swap, memory pressure. Keep the summary: it is the "before" for step 5. It skips launchd gui-domain services (on Linux, processes in .service units), system processes, Claude.app, the current shell and its ancestors; the current claude session is named on a separate line. It prints no process environment, only session ids. Output is in Russian; the class labels are:

    ClassWhat it is
    claude-сессия (claude session)a Claude Code CLI process: bundled with Desktop (including the version/hash path) or standalone; session id when present, folder, child processes and dev servers with ports
    хвост закрытого приложения (closed-app tail)a process from /Applications/X.app with PPID 1 while the main binary X is not running, and everything under it
    сирота (orphan)a worker with PPID 1: omp/bun, Chrome for Testing / puppeteer, npx/MCP servers, grok/codex without a parent; duplicates are marked
    dev-сервер (dev server)http.server, vite, npm run dev without a parent, older than a day
    зомби (zombie)STAT Z older than a minute, with a parent: holds no memory, its parent reaps it
  2. Decide on claude sessions. The script does not know activity. In the Claude desktop app call list_sessions and match by id: a session is a tail if its lastActivityAt is older than 12 h, it is not the current one, not isRunning, and no work is going on in it. Leave the other claude sessions alone.

  3. Show or kill.

    • On the owner's "kill", "clean up" — without another question: claude-session tails from step 2, closed-app tails, orphans.
    • Dev servers and anything unclear — show as a table and ask.
    • Never: the current session, active and running sessions, launchd services, Claude.app.
    • Before killing a claude process, name its child dev servers and ports from the "dies with it" column: they die with it.
    • Zombies are not killed: if one lingers, name its parent to the owner.
  4. Kill — in bash with an array, with a check and a follow-up KILL:

    bash -c 'pids=(111 222 333); kill -TERM "${pids[@]}"; sleep 4
      for p in "${pids[@]}"; do kill -0 "$p" 2>/dev/null && kill -KILL "$p"; done'
    

    Pitfalls:

    • in zsh kill $pids with a string does not split words, kill gets one string and silently kills nothing;
    • idle claude sessions often ignore SIGTERM, so the KILL pass is not optional;
    • a dev server started with & inside a session can outlive the killed session as an orphan: check its port with lsof -iTCP:<port> -sTCP:LISTEN after the kill.
  5. Verify. Run the script again: no killed candidates left. Report swap and memory pressure before and after to the owner.

A killed claude session stays in the app's list: its process comes back on the next message in it. Ending the CLI does not free the memory of the Desktop renderer/utility processes. Restarting the whole app is fine after checking it does not interrupt needed work; confirm the effect with another reading.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Orchestrate iterative visual style searches with branch prompts, decision graphs, feedback loops, and final direction selection.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

serejaris/personal-corp-os2312026년 10월 20일 업데이트

Audits the agent rules in the current folder (AGENTS.md, nested AGENTS.md files) and the skill descriptions the agent sees at start, then reports what to cut, move or rewrite and edits only after the user says yes. Use on «аудит правил», «проверь AGENTS.md», «почему агент не слушается правил», «проверь скиллы».

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

serejaris/personal-corp-os2312026년 10월 20일 업데이트

avatar

무료

Робот агента Personal Corp. Агент делает себе голову робота из набора деталей, хранит её в штабе в stack/avatars.json и кладёт в штаб страницу avatar/robot.html, где робот стоит за партой своего штаба и вокруг видны отделы, без сервера и интернета. На уроке по ссылке входа с экрана урока робот входит в живой класс и горит маячком, пока агент работает. Триггеры /avatar, /avatar <ссылка входа>, сделай себе аватар, покажи своего робота, приди на урок.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

serejaris/personal-corp-os2312026년 10월 20일 업데이트

benchmark

무료

Use when choosing between engines or models for an agent pipeline and the answer must come from measurement on your own data, not from marketing pages: speech recognition for meeting recordings, the model that turns a transcript into notes, the critic model that checks it. Runs every variant in an isolated container, measures time, cost per hour of input (USD and RUB, with price source and date) and quality (WER/CER and course terms for ASR; code checks plus a judge of a different model for LLM steps), writes results.json/csv and one static analytics page. Triggers on "бенчмарк", "сравни движки", "сколько стоит час записи", "какую модель взять для пайплайна", "benchmark the pipeline", "compare ASR engines".

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

serejaris/personal-corp-os2312026년 10월 20일 업데이트

Use when user asks for Claude Code usage stats, weekly analytics, project activity summary, or wants to see what projects were worked on. Triggers on "аналитика", "статистика claude", "cc stats", "weekly report", "что делал"

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

serejaris/personal-corp-os2312026년 10월 20일 업데이트

Use when needing strategic project analysis from multiple independent expert perspectives. Triggers on business decisions, growth strategy, product direction, competitive analysis, or any situation where diverse C-level opinions reduce blind spots

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

serejaris/personal-corp-os2312026년 10월 20일 업데이트

serejaris의 스킬 모두 보기

이 스킬의 문제 신고