clean
Skill0 starsChanged 8 days agoMITView on GitHub
List live Orca agent sessions with their RAM usage, then warn and close idle ones to free memory. Use when the user says "clean", "clean up sessions", "free memory/RAM", "which agents are running", "close idle agents/sessions", "that session is eating memory", or "trim/compact this chat". Shows every worktree's terminals, chat agents and workers sorted by memory, own project first; sends an "about to be closed" warning, reads the reply, waits a grace period, then closes. `trim` archives a long chat's context to disk (devin sessions.db export or scrollback) then sends the agent's native /compact so RAM drops without losing the transcript. Works for any agent CLI Orca can run (devin, claude, codex, copilot, ...); Orca is the only backend today, the protocol is written so other delegation platforms can adopt it.
23 other projects use a version of this.
Adopted by
Most recently taken up by
- aakash1552005/universal-agent-skillstheir own version, first seen Nov 29, 2026
- mystilleef/spae-frameworktheir own version, first seen Nov 24, 2026
- flavien-ia/hypervibe-harnesstheir own version, first seen Nov 19, 2026
- jinhuang712/claude-code-broomtheir own version, first seen Nov 16, 2026
- nazmirket/skillstheir own version, first seen Nov 15, 2026
- romeohc/afkittheir own version, first seen Nov 15, 2026
Used with
Projects with it also use expressive, friendly and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
bergsideSkillexpressive
Vibrant, personality-driven design with bold colors, playful graphics, and dynamic layouts that balance creativity with structure.
Also in 4 projects that use this
bergsideSkillfriendly
Approachable, intuitive design with rounded elements, ample whitespace, and soft pastel color palettes.
Also in 4 projects that use this
- +10 more from bergside
Other versions23 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 23
- bergside/awesome-design-skills★ 2.9ksame name
- aimeos/pagible★ 609same name
- kurtosis-tech/kurtosis★ 560same name
- OutThisLife/brooklyn-skills★ 218same name
- flavien-ia/hypervibe-craft★ 54same name
- flavien-ia/hypervibe-harness★ 54same name
- aakash1552005/universal-agent-skills★ 4same name
- RektTillNoon/alpha-skills★ 4same name
- VoTruongDanh/Skills-Agent★ 4same name
- andalabx/skills★ 2same name
13 more not listed
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 repositoryOne other file it gives its agents.
- AGENTS.mdAGENTS.md
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 0 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 21 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 85
Close: After grace, the same command finishes.
- Very specific: line 129
If archiving fails or is skipped for a session whose native compact command would run, trim refuses — compacting with nothing on disk …
- Very specific: line 153
Don't double-close: After any close error, re-list before retrying.
“Common” is measured: kept by at least 6 in 10 of the 21 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
clean — Orca session memory manager
Presents the calling agent with every live session running in Orca (terminals, chat agents, supervised workers), how much RAM each holds, and lets that agent warn a session, wait for its reply, then close or trim it.
Requires the orca CLI (v1.4+) and a running Orca. Works from any agent —
devin cli, claude code, codex, copilot — because all of it is ordinary orca
commands plus one Node helper script.
Resolve the helper
node <skill-dir>/scripts/clean.mjs <command> [options]<skill-dir> is the directory this SKILL.md lives in. Node 18+ required (any
agent box has it). If node is missing, every step below also has a raw orca
equivalent in references/protocol.md — run those instead. All orca calls take
--json; pass --environment <id> on clean.mjs via --orca overrides / the
env var ORCA_CLI_COMMAND when targeting a paired server (handles are
server-scoped).
Commands
node scripts/clean.mjs list [--all] [--json] # sessions + memory; own repo first
node scripts/clean.mjs peek <handle> # what the terminal currently shows
node scripts/clean.mjs warn <target> # send the warning only
node scripts/clean.mjs close <target> # warn → grace → park/close
[--grace <sec>] [--message <m>] [--no-warn] [--tab] [--dry-run]
[--hard] [--session <id>] # kill the terminal / resume id to pre-type
node scripts/clean.mjs trim <target> # archive context + send /compact
[--archive <dir>] [--then-close] [--force] [--dry-run]
node scripts/clean.mjs self # your own session identity<target> is any of: a term_… handle, a ptyId suffix,
orca_session_id:… / dispatch:<id> mailbox, a dispatch id, or a worktree
selector (id:, identity:, name:, path:) to address a whole workspace.
list prints the exact id to use per row.
The clean workflow — follow it in order
- Measure.
clean.mjs listshows host RAM, the Orca app footprint, each worktree's total, and per-session memory (pty,devin,workingetc.). Rows markedSELFare you. Finished/detached rows are collapsed;--allshows them. If nothing exceeds your threshold, stop — do not close for the sake of it. - Confirm candidates with the user. Report the list as a table
(workspace, agent, state, memory, idle time, last preview). Let the user
pick what goes, unless they already said "close idle ones above X MB" or
similar. Prefer
dead/donesessions and shells overworkingones. - Warn first — always.
clean.mjs close <target> --grace 60(default) sends each target "you're about to be closed… reply if you need time", then polls PTY targets and prints any reply it catches during the grace window. Use--messageto override. For chat/mailbox sessions the warning goes to their mailbox (orchestration send --type question); they may not be watching — that is why the grace period exists. Only pass--no-warnwhen the session is already dead or the user demanded immediacy. - Read the reply. During the grace window
closeprints each changed screen tail. If a session replies that it is saving work, wait — runclean.mjs peek <handle>again before closing; give it the time it asks for (within reason). AREADY/silence outcome means proceed. - Close. After grace, the same command finishes. Resumable agents
(devin) are parked by default: the agent gets
/exit, its process (and its RAM) goes away, but the terminal stays as a ~100MB shell withdevin <original flags> --resume <id>already typed at the prompt — the user presses Enter to get the conversation back. The id comes from the agent's exit screen, then its process command line, then (last resort) the newestsessions.dbsession for that directory. Park only carries--permission-mode,--respect-workspace-trustand--modelover, so a one-shot launch prompt is never re-sent. If the agent is sitting on a trust/permission prompt, Orca blocks the/exitand park reports an error instead of guessing.--hardskips parking and kills the terminal. Everything else: PTYs viaterminal close(--tabfor the whole tab), dispatches viaworker-stop, a whole workspace viaterminal close --worktree <sel> --all(durable — removes tabs, layouts and resume records). Chat sessions have no PTY handle: the warning is delivered to their mailbox and the only hard close is removing the workspace (orca worktree rm --worktree <sel>) — always ask the user before that. - Verify. Re-run
clean.mjs listand report the host freed-memory delta. Aterminal_handle_staleerror means the runtime restarted: re-list and retry with the fresh handle — never dual-send to an old handle.
trim — shrink a long chat, keep the context
For a session that should keep working but has grown heavy:
clean.mjs trim <handle>first archives context to disk:- devin: dumps the session's full
message_nodestranscript from%APPDATA%\devin\cli\sessions.db(or$CHISEL_SESSION_DB) to.clean-archive/devin-<id>-<ts>.md, matched byworking_directory. The file header notesdevin --resume <id>for later recall. - other agents: pages the terminal scrollback to a
.logfile.
- devin: dumps the session's full
- Then it sends the agent's native compaction command —
/compactfor devin/claude/codex/copilot/opencode/pi/grok — or, for unknown agents, a checkpoint instruction asking it to write.clean-checkpoint.md(goal, decisions, open work, key paths) so the essentials survive in-context. - It re-measures after ~15s and reports memory before/after. A full /compact
can take minutes; re-run
listlater for the true delta.--then-closeappends the close hint for after the compaction lands. ExpectmemAfterto be flat even when compaction succeeds — measured runs show the process heap is not returned eagerly;trim's payoff is the archive plus slower re-growth. To actually reclaim RAM,closethe session (--resumebrings it back fromsessions.db).
If archiving fails or is skipped for a session whose native compact command
would run, trim refuses — compacting with nothing on disk defeats the
purpose. Pass --force to compact anyway, or point --archive somewhere
writable. Checkpoint prompts sent to unknown agents and mailbox sessions are
non-destructive and still go through.
The archive is the point: the trimmed transcript stays on disk where any agent can grep it later — quality preserved, RAM reclaimed.
Safety rules — non-negotiable
- Never act on SELF.
clean.mjs selfprints your own handle/paneKey;close/trim/warnrefuse it, and bulk workspace close is refused when the workspace contains your session. - Own project first, others only when asked.
listranks your repo's worktrees first. Warn/close/trim on another project's workspace needs an explicit user instruction ("close the cadence workers", "clean everywhere") — never venture out unprompted, and tell the user the sessions belong to other projects. - Idle ≠ safe. A
done/idlestate means the agent finished a turn, not that its work is saved. The warn-and-wait step exists precisely for that — never skip it on a session that could hold unsaved state. - Dead targets are free, not urgent.
dead/detachedrows hold no agent process; closing them only frees the tab/layout. Use--no-warnfor them. - Don't double-close. After any close error, re-
listbefore retrying; handles are runtime-scoped and change on restart. - Other projects are running. This machine is memory-constrained — run
list, report honestly, and let the user decide anything ambiguous.
Portability
Everything above is expressed as a 5-verb contract — list / peek / warn /
close / trim — over three address types (pty handle, mailbox, workspace).
clean.mjs isolates all Orca specifics behind that contract; a second
platform only needs to reimplement those verbs (see
references/protocol.md for the semantics each verb must preserve and the
raw orca commands behind each).
Reference docs
references/protocol.md— the warn→wait→close contract, mailbox/dispatch addressing, per-agent notes, raw orca command equivalents, edge cases.references/devin-memory.md— why devin sessions reach ~2.8GB, what--cloudbuys you, and how the disk-backed context story works today.
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.

