# Whole-workspace health inventory Use when the user asks to "check everything" — Hermes, agents, the OBS vault and the project workspace — and take needed actions. The request is broad; the procedure is narrow: **read-only inventory → grouped decisions → approved actions only**. ## 1. Read-only inventory (one or two batched terminal calls) Hermes / agents: ```bash hermes profile list # every profile + model + gateway state hermes cron list # paused/active, last run, last failure text hermes doctor | head -60 hermes gateway status | head -8 hermes fallback list hermes auth list # pools, sources, rate-limit cooldowns claude auth status # evidence for THIS process env only ``` Project workspace (``): ```bash for d in */; do d=${d%/}; if [ -d "$d/.git" ]; then echo "$d | git | $(git -C $d branch --show-current) | dirty=$(git -C $d status --porcelain | wc -l | tr -d ' ') | last=$(git -C $d log -1 --format=%cs 2>/dev/null)" else echo "$d | NO-GIT | files=$(find $d -type f -not -path '*/node_modules/*' | wc -l | tr -d ' ')"; fi; done ``` Then diff the folder list against the brief list in `Projeler/AGENTS.md` — new folders (typically video projects without git) accumulate there silently. `git rev-list @{u}..HEAD` fails on repos with no upstream or no commits; treat that as "no upstream", not as an error to chase. OBS vault (``): ```bash ls | grep -v -E '^(||)$' # exclude forbidden dirs BEFORE listing git fetch -q origin; git status -sb | head -1 # ahead/behind git status --porcelain | wc -l # dirty count ``` Read `Agent Rehberi/Açık İşler.md` and `Agent Rehberi/Güncel Sistem.md` — but treat them as **last-known**, not current. Several open items there are typically already resolved by the live commands above (gateway stale, CLI logged out, provider pool empty); the inventory's main value is closing those with fresh evidence. ## 1b. "What is unfinished?" depth pass (per repo) When the question is specifically "what did we leave half-done", the dirty-count line is not enough. Per git repo, list every non-main branch with ahead-count, merge state, upstream and last commit: ```bash for b in $(git branch --format='%(refname:short)'); do [ "$b" = main ] && continue a=$(git rev-list --count main..$b) m=$(git branch --merged main --format='%(refname:short)' | grep -qx "$b" && echo MERGED || echo open) u=$(git rev-parse --abbrev-ref $b@{u} 2>/dev/null || echo local-only) echo "$b | +$a | $m | $u | $(git log -1 --format='%cs %s' $b | cut -c1-70)"; done git worktree list --porcelain | grep -B3 prunable | grep '^worktree' # dirs that vanished ``` - **open + local-only = loss risk** (exists only on this disk) — list these first and offer push as the top action (push stays approval-gated). - A `local-only` label can be wrong when the remote branch exists but no upstream is set; confirm with `git rev-list --left-right --count ...origin/` after a fetch. - **Prunable worktrees:** the branch commits are safe in refs, but any uncommitted work in the vanished directory is gone — say so; `git worktree prune` is cleanup, not recovery. - Merged branches whose worktrees still exist are cleanup candidates, not unfinished work. - Projects named in `Projeler/AGENTS.md` or OBS `Projeler/` but absent locally: check `gh repo list --json name,pushedAt` before calling them lost — they are often safe on GitHub with no local clone. - Before answering "that project/feature does not exist", grep recent disk-move or verification cron outputs (`~/.hermes/cron/output/*/`) for the folder name: projects get moved to the external disk to free space, and a folder you cannot see under `Projeler/` (and cannot read outside the approved external folder) may still be a real, half-done project. Say "not on the internal disk, possibly moved" instead of "none". - Count open roadmap items per OBS project (`grep -c '^\s*- \[ \]' Roadmap.md`) and the newest note date to separate active from dormant projects. - `du -sh` large non-git folders (test sandboxes, video renders) and offer them as user-decided cleanup; never delete in the audit. - Commit-dirty files often link to another agent's pending work (a data file tied to an outgoing permission email, a role's task note) — name the connection instead of treating it as noise. Report order: active projects (each: open branches, unpushed commits, uncommitted files) → dormant → disk/cleanup candidates → stale docs → a priority list starting with loss-risk → numbered questions. ## 2. Report shape Three headed sections — Hermes, OBS, Projeler — each with 3–6 bullet findings that contrast note state vs live state. Then two action groups: - **A — low-risk, do with one approval:** pull/commit of the vault (push is a separate approval), dated status sections in Açık İşler / Güncel Sistem that close items with evidence and keep history, an `Öğrendiklerim/ .md` record, brief additions to `Projeler/AGENTS.md` (protected file → approval prompt). - **B — user decision required:** uncommitted work in a code repo (never commit someone's half-done feature unasked), script bugs to delegate (e.g. a sync script that pushes without pulling), paused cron jobs (may be intentional), spreading credentials to other profiles. ## 3. Decisions: numbered list in the reply, form optional Put the B-group questions as a **numbered list at the end of the reply** under their own heading. A `clarify` form may be offered in addition, but it times out silently on the desktop surface and then the plan is blocked with nothing on screen; the numbered list is the durable copy the user can answer by number later. ## 3b. Approved push/merge sweep ("do the quick ones") When the user approves pushes and merges in bulk, do only what is mechanically safe and hand the rest to the owning PM: 1. **Pre-push scan per branch** (diff against `origin/` if it exists, else `origin/main`): filenames matching keystore/`.jks`/`key.properties`/`.env`/`.p8`/`.p12`/`.pem`/ `google-services`; added lines matching `storePassword|api_key=|sk-…|ghp_…|BEGIN …PRIVATE`; blobs over ~20 MB via `git rev-list --objects .. | git cat-file --batch-check='%(objecttype) %(objectsize) %(rest)'`. A hit that only reads a property (`keystoreProperties["storePassword"]`) is fine — read it before blocking. 2. **Push with an explicit refspec** `git push origin :refs/heads/` and verify each by comparing `git rev-parse ` with `git ls-remote origin refs/heads/`, not by the push text. Note when a pushed `main` feeds GitHub Pages/a deploy — the push publishes. 3. **Merge only fast-forwards yourself.** `git merge-base --is-ancestor main ` true → `git push origin :main` (works from any worktree), then `git -C merge --ff-only `. For an ff into a checkout with uncommitted files, first confirm the incoming diff does not touch those files, then run the project's tests/analyze before pushing main. 4. **Non-ff merge = trial in a throwaway worktree:** `git worktree add .worktrees/merge-x -b merge/x main`, merge, and on any conflict `git merge --abort`, `git worktree remove`, delete the temp branch (`git update-ref -d` when it equals main). Conflict resolution needs a build and belongs to the coder/PM, not the sweep. 5. **Never merge into a branch that deploys a live site** (website `main`) without the user looking first; push the feature branch only. Unreviewed product branches (several feature branches of one app) go to that product's PM as a merge/close decision. 6. `git worktree prune -v` on repos with vanished worktree dirs — metadata only. Report: pushed (with verified hashes), merged (with test output), deliberately not done (each with the reason and the owning agent), then questions. ## 3c. "Repoları GitHub'dan en güncele çek" (toplu pull) Onay gerektirmeyen, yıkıcı olmayan senkron; push yok. Her repo için: 1. `GIT_TERMINAL_PROMPT=0 git fetch --all --prune` (macOS'ta `timeout` yok, prompt kapatmak yeter). 2. Durumu sınıfla: uzak yok / detached / upstream yok / güncel / ayrışmış (ileri ve geri) / geride. 3. Yalnız "geride ve ileri=0" olanda `git merge --ff-only @{u}`; kirli dosyalar ff'yi bozmuyorsa sorun yok. Ayrışmış ya da ff olmayanlara dokunma, raporla. 4. Ana klasör detached HEAD ise ve `git merge-base --is-ancestor HEAD origin/main` doğruysa `git checkout --detach origin/main` ile ilerlet; `main` dalı genelde başka bir worktree'de checkout'tur, onu ana klasörde checkout etmeye çalışma. 5. Ajanların açık worktree'lerine dokunma. Rapor dört grupta: güncellendi (+N commit), zaten güncel, Mac'te ileride (gönderilmemiş commit sayısı ve kısa içerik; push onaylı ayrı adım), GitHub bağlantısı yok. "Çek" isteğinde asıl bulgu çoğu zaman tersidir: yerel ileride, GitHub geride; bunu açıkça söyle ve push'u soru olarak sor. ## 4. Act only on explicit answers No answer = no change. Do not interpret a timed-out form, a new greeting, or "devam et" as approval for group A. When approved: vault `git pull` before any commit (the nightly script's push rejections come from the remote being ahead), commit dirty notes, ask again before push; update notes with a dated section rather than rewriting history.