Merge branch 'fix/kvb-cleanup-rule-text' into unify/skills-20261114
# Conflicts: # skills/kvb-cleanup/SKILL.md
This commit is contained in:
commit
3af83b0c46
2 files changed
+63
-65
No files matched your search
+41
-40
@@ -6,64 +6,64 @@ description: >
|
||||
"platte voll", "no space left on device".
|
||||
---
|
||||
|
||||
Delete only what the operator picked in this run; questions, inventory and
|
||||
proposal change nothing. Never invent a size or a peer's answer: unmeasured
|
||||
is `unknown`.
|
||||
Delete only this run's operator picks; asking, inventory and proposal change
|
||||
nothing. Never invent a size or a peer's answer: unmeasured is `unknown`.
|
||||
|
||||
## Step 0: the chair
|
||||
|
||||
Shared resources belong to the `kvb-org-organize` chair; its resource watch
|
||||
Shared resources belong to the `kvb-org-organize` chair; its watch
|
||||
runs the configured low-risk cleanup. Another session chairs: send it the
|
||||
request and stop, or, when the operator ordered the cleanup here, first
|
||||
request and stop, or, ordered here by the operator, first
|
||||
`${CLAUDE_SKILL_DIR}/../kvb-org-radio/scripts/radio.py post --to <chair>
|
||||
"<plan>"`.
|
||||
|
||||
## Step 1: inventory
|
||||
|
||||
Read-only, in parallel, with sizes, only in the agent write scope (Claude
|
||||
Code: `sandbox.filesystem.allowWrite`) and session scratch dirs; never
|
||||
another user's files. Prefer the project's cleanup and teardown targets; obey
|
||||
rules forbidding raw commands.
|
||||
Read-only, parallel, sized, only in the agent write scope (Claude Code:
|
||||
`sandbox.filesystem.allowWrite`) and session scratch dirs, never another
|
||||
user's files. Prefer project cleanup and teardown targets; obey bans on raw
|
||||
commands.
|
||||
|
||||
- **/tmp**: `pkgmgr gc --report --docker --root /tmp --root <write dir>`,
|
||||
else `du -sh` per own entry; system entries (`.X11-unix`, `.ICE-unix`, `systemd-private-*`,
|
||||
`ssh-*`, `tmux-*`, sockets) are never candidates.
|
||||
else `du -sh` per own entry; never system entries (`.*-unix`,
|
||||
`systemd-private-*`, `ssh-*`, `tmux-*`, sockets).
|
||||
- **Docker**, **worktrees**: read `docker.md` (its `⚠ Volumes` checklist
|
||||
joins Step 4) and `worktrees.md` next to this file when present.
|
||||
- **Agent dirs**: pip, npm, pre-commit, act, gh, buildx caches; Ansible and
|
||||
build temp dirs.
|
||||
- **Council root** (`~/.local/state/agents-shared`): `archive/` only.
|
||||
- **Register**: `council.py list --long`; `rasci.py artifacts` (`kvb-org-artefacts`,
|
||||
`--ended` for candidates).
|
||||
- **Register**: `council.py list --long`; `rasci.py artifacts`
|
||||
(`kvb-org-artefacts`, `--ended` for candidates).
|
||||
- **Queue**: `${CLAUDE_SKILL_DIR}/../kvb-org-queue-cleanup/scripts/cleanup.py
|
||||
request`; go on meanwhile.
|
||||
- **Live use**: `fuser`, `lsof`, `ps -o pid,etime,comm`, never full command
|
||||
lines or environments (credentials). Sandboxed, an empty result proves
|
||||
nothing.
|
||||
- **Live use**: `fuser` (exit 1 or 123: free), `lsof`, `ps -o
|
||||
pid,etime,comm`; never full command lines or environments (credentials).
|
||||
Sandboxed, an empty result proves nothing.
|
||||
- **Archive duties**: memory or project rules requiring a copy before
|
||||
deletion (logs, reports, generated maps).
|
||||
|
||||
## Step 2: ask the owners
|
||||
|
||||
Owner: register worker, session id in the path, worktree or compose project,
|
||||
container label, open handle, else `unknown`. `radio.py send call --to
|
||||
<peer>` the text in `ask.md` next to this file once to each local peer
|
||||
owning candidates the register does not cover; go on meanwhile.
|
||||
Owner: register worker, path session id, worktree or compose project,
|
||||
container label, open handle, else `unknown`. Once per local peer owning
|
||||
unregistered candidates, `radio.py send call --to <peer>` the `ask.md` text;
|
||||
go on meanwhile.
|
||||
|
||||
## Step 3: classify
|
||||
|
||||
First match wins: claimed by a peer, `keep`; in a register task not `done`,
|
||||
`stopped` or `stale`, `keep (task <task>)` (an ended task's items are its
|
||||
worker's candidates); a running deploy, gate, test, swarm run or build, `keep
|
||||
(running)`; a silent peer's, `keep (no answer from <peer>)`, silence is not
|
||||
consent; sandboxed, anything touched within 24 hours, `keep (recent,
|
||||
possibly in use)`; archive duty,
|
||||
`archive first`, never a plain delete. Else a candidate:
|
||||
`stopped` or `stale` (a branch merged into the default branch makes it
|
||||
`stale`; an ended task's items are its worker's candidates), `keep (task <task>)`; a
|
||||
running deploy, gate, test, swarm or build, `keep (running)`; a silent peer's,
|
||||
`keep (no answer from <peer>)`, silence is not consent; sandboxed, touched
|
||||
within 24 hours (`find -mmin -1440`; bfs fails on `-newermt`) and neither
|
||||
owner-released nor operator-picked, `keep (recent, possibly in use)`; archive
|
||||
duty, `archive first`, never a plain delete. Else a candidate:
|
||||
|
||||
- **low**, regenerated cheaply: stopped containers without volumes, dangling
|
||||
images, unused networks, finished sessions' scratch and logs.
|
||||
- **medium**, regenerated slowly, rate-limited or networked: unused tagged
|
||||
images, build cache, package caches, clean worktrees already merged.
|
||||
- **low**, cheap to regenerate: stopped containers without volumes, dangling
|
||||
images, unused networks, ended sessions' scratch and logs.
|
||||
- **medium**, slow, rate-limited or networked to regenerate: unused tagged
|
||||
images, build and package caches, clean merged worktrees.
|
||||
- **high**, data loss or a broken run: volumes, stopped containers with
|
||||
volumes, running unclaimed containers or stacks, dirty or unpushed
|
||||
worktrees, unread reports, anything `unknown`.
|
||||
@@ -71,22 +71,23 @@ possibly in use)`; archive duty,
|
||||
## Step 4: propose
|
||||
|
||||
One table, biggest first: area, item, size, owner, risk, proposal, what
|
||||
breaks if wrong. Below it reclaimable size per risk and every `keep` grouped
|
||||
by reason. Then `AskUserQuestion`:
|
||||
breaks if wrong. Below it reclaimable size per risk and every `keep` by
|
||||
reason. Then `AskUserQuestion`:
|
||||
|
||||
1. `multiSelect: true`, at most four questions: `/tmp`, `Docker`, `Other
|
||||
dirs`, `High risk` (every high-risk candidate); size, risk and worst case
|
||||
in each option's description. Over four options: group by owner or risk,
|
||||
or call again. Only ticks select; nothing preselected.
|
||||
1. `multiSelect: true`, up to four questions: `/tmp`, `Docker`, `Other
|
||||
dirs`, `High risk` (every high-risk candidate); each option names size,
|
||||
risk and worst case. Over four options, group by owner or risk or call
|
||||
again; merge single items into one question: one-option questions fail.
|
||||
Only ticks select, not an empty `Other` answer; nothing preselected.
|
||||
2. `multiSelect: false`: `Execute: <n> items, <size> (Recommended)` naming
|
||||
the ticked items' worst case, `Revise the selection` (repeats 1), `Abort`.
|
||||
|
||||
## Step 5: execute
|
||||
|
||||
After `Execute`, read `execute.md` next to this file first.
|
||||
After `Execute`, read `execute.md` first.
|
||||
|
||||
## Step 6: report
|
||||
|
||||
`df -h` and `docker system df` before and after, freed size per area, every
|
||||
skipped or failed item with its reason. `radio.py post --to <peer>` tells each
|
||||
answering peer which removed items lay near its own.
|
||||
`df -h` and `docker system df` before and after, freed size per area, skipped
|
||||
or failed items with reasons. `radio.py post --to <peer>` each
|
||||
answering peer the removed items near its own.
|
||||
@@ -1,31 +1,28 @@
|
||||
# Executing the selection
|
||||
|
||||
- Re-check claims, open handles and running state right before each delete:
|
||||
- Right before each delete, re-check claims, open handles and running state:
|
||||
a peer may have started something since the inventory.
|
||||
- Delete exactly the selected items, by name or path. No blanket prune
|
||||
(`docker system prune -a --volumes`, `rm -rf /tmp/*`) that sweeps beyond
|
||||
the selection. For more than a handful of paths, write the list to a file
|
||||
under `/tmp`, grep it against every claim once more, then delete with
|
||||
`xargs -d '\n' rm -rf -- < <list>`.
|
||||
- Never stop, take down or kill a running job, and never ask its owner to, to
|
||||
free space: not for a priority slot, not at a disk stop. Free idle items,
|
||||
ask the operator for an exception, or wait; an owner's own disk guard only
|
||||
alerts the chair, and only the operator can order a running job down. A
|
||||
hung job is not freed through cleanup: the `kvb-org-organize` hang rule
|
||||
lets only its owner end it.
|
||||
- Idle running stacks go down through the project's teardown target, never by
|
||||
removing their containers or volumes underneath them. Worktrees go as
|
||||
`worktrees.md` says.
|
||||
- Delete exactly the selected items, by name or path, never by a blanket
|
||||
prune (`docker system prune -a --volumes`, `rm -rf /tmp/*`). For more than
|
||||
a handful of paths, write the list to a file under `/tmp`, grep it against
|
||||
every claim once more, then `xargs -d '\n' rm -rf -- < <list>`; never
|
||||
`find -exec rm -rf`, which the classifier refuses.
|
||||
- Never stop, take down or kill a running job to free space, nor ask its
|
||||
owner to: not for a priority slot, not at a disk stop. Free idle items, ask
|
||||
the operator for an exception, or wait; an owner's disk guard only alerts
|
||||
the chair; only the operator orders a running job down. A hung job is no
|
||||
cleanup item: the `kvb-org-organize` hang rule lets only its owner end it.
|
||||
- Idle running stacks go down by the project's teardown target, never by
|
||||
removing their containers or volumes. Worktrees go as `worktrees.md` says.
|
||||
- Archive-first items: copy out, verify the copy, then delete.
|
||||
- Drop every deleted item from its task as the `kvb-org-artefacts` skill says
|
||||
(`rasci.py set <task> --drop-artifact <kind>:<ref>`), so `artifacts` stays
|
||||
true.
|
||||
- A host permission layer (an auto-mode classifier, a deny rule) may refuse a
|
||||
delete. Never route around it with another command or a peer. Finish the
|
||||
rest, then put the refused item to the operator again as its own option: an
|
||||
explicit renewed selection may pass; if it is refused again, hand over the
|
||||
exact command with its list file for the operator to run.
|
||||
- A delete failing on permissions (files owned by a container UID): use the
|
||||
project's container helper. Never sudo, never bypass the sandbox; without a
|
||||
- Drop every deleted item from its task (`rasci.py set <task> --drop-artifact
|
||||
<kind>:<ref>`, see `kvb-org-artefacts`) so `artifacts` stays true.
|
||||
- A host permission layer (auto-mode classifier, deny rule) may refuse a
|
||||
delete; never route around it by another command or a peer. Finish the
|
||||
rest, then offer the refused item to the operator again as its own option:
|
||||
an explicit renewed pick may pass; refused again, hand over the exact
|
||||
command with its list file.
|
||||
- A delete failing on permissions (container-UID files) goes through the
|
||||
project's container helper, never sudo or a sandbox bypass; without a
|
||||
helper, report the path.
|
||||
- Stop on the first unexpected error and report it.
|
||||
Reference in new issue
Block a user