Forge Cleanup: Prune & Optimize¶
Date: 2026-04-28
Owner: Opus worker (forge-cleanup_Opus47)
Parent session: Justin's home-base + an n8n-telegram_Opus47 working on the brain build
Estimated effort: Phased: Phase 0 alone is ~30 min
Read first (mandatory, your job depends on understanding this)¶
Before you touch anything, internalize:
/home/justinwieb/forge/CLAUDE.md, the bootstrap, who Justin is, code words, security rules, response style/home/justinwieb/forge/system-map/README.md+fleet.md+architecture.md+steering.md, the model-agnostic shared brain. NEVER prune anything here without explicit approval./home/justinwieb/forge/memory/handoffs/building-the-brain-life-os-inbox-2026-04-27.md, the master vision. The Life-OS Inbox is the north star. Anything that supports the brain stays./home/justinwieb/forge/memory/handoffs/decorator-crab-master-plan-2026-04-21.md, the Context Graph integration architecture (n8n → SQLite → Context API). Live and growing./home/justinwieb/forge/memory/handoffs/worker-builder-playbook-2026-04-23.md, typology + cost model for fleet workers (you are one).- MEMORY.md at
~/.claude/projects/-home-justinwieb-forge/memory/MEMORY.md, the auto-loaded index. The "Tools & Pipelines" section is canonical; cleanup must respect it. - Today's daily log at
memory/daily/2026-04-28.md, what's currently happening (MkDocs build + brain build).
The vision in one paragraph¶
Forge is Justin's central workspace and AI command center, a self-hosted homelab orchestrating a fleet of 9+ machines (Finn/Proxmox, UDev/dev-VM, plex, media-server, n8n, frigate, adguard, homeassistant, immich, minecraft) plus a swarm of Claude Code agents. He's a content creator + entrepreneur running multiple brands (JustinWieb-VR, Nova Design, Gus Outdoor Co, Sip-N-Serve, Wiebelhaus Enterprises). The active build is the Life-OS Inbox, a chat-driven brain that captures via Telegram, processes via n8n + Claude, and surfaces context via the Context API. As of today, https://markdown.justinsforge.com is live (MkDocs Material behind CF Access) so he can browse all forge markdown from his phone.
What "prune and optimize" means here¶
| ✅ DO | ❌ DON'T |
|---|---|
Find dead code, broken symlinks, macOS ._* files, .bak files |
Refactor working code, pruning only |
| Identify duplicate / superseded docs and propose consolidation | Touch anything wired into a live systemd unit, n8n workflow, or cron |
| Surface stale handoffs (work completed, no longer referenced) | Delete daily logs from memory/daily/, append-only convention |
| Compress findings into structured reports | Touch ~/.forge-secrets/ or any .env |
Verify with git log, grep, systemctl, crontab before recommending delete |
Touch system-map/ without explicit approval (model-agnostic shared brain) |
| Propose, wait for approval, then execute | Make destructive changes silently |
Phased approach: STRICT¶
Phase 0: Inventory only (DO THIS FIRST AND STOP)¶
Walk the forge tree and produce a structured report. Do NOT delete or move anything.
Categories to enumerate:
- Macros & metadata files
- macOS
._*files anywhere (runfind /home/justinwieb/forge -name '._*' -type f) *.bak,*.bak.*,*.old,*.origfiles-
__pycache__/,.DS_Store,Thumbs.db -
Stray top-level files (forge root has these, confirm what they are):
CLAUDE.md.bak.1777298035Data Organization Master Plan.txtJustinWiebVR-Projects.csvsmart_router_costs.jsonsmart-router.skill-
.openclaw/(per MEMORY.md, "FULLY WIPED 2026-03-15", confirm empty/safe to remove) -
Brands subtree heavy footprint
-
node_modules/checked intobrands/gus-the-bass/andbrands/wiebelhaus-enterprises/self-hosted-setup/timetrack/, verify regenerable frompackage.json, propose.gitignore+ delete -
Stale handoffs (
memory/handoffs/) - List all handoffs by date
- Cross-reference with today's daily log + active work
- Flag handoffs whose subject is "complete" or whose date is >30 days with no follow-up
-
DO NOT propose deletion, propose either (a) move to
memory/handoffs/_archive/or (b) leave in place. Justin decides. -
Logs
logs/has many subdirs (workers/,integrations/,site-screenshots/, plus root logs)- Identify which are actively written (rotate-worthy) vs frozen-in-time (archivable)
- Worker logs older than 14 days → archive candidates
-
Don't delete anything; propose a rotation policy
-
Tasks & comms ephemera
tasks/completed/andtasks/failed/, entries older than 30 days, archive candidates-
comms/results/,comms/inbox/, old files, propose retention policy -
MEMORY.md drift
- Walk every
Tools & PipelinesandExternal Service Accesslink target, verify the file exists at the path - Flag broken pointers
-
Flag pointers to files that haven't been touched in 60+ days (potential dead tools)
-
Empty directories
-
find . -type d -empty(excluding.git) -
Files referenced nowhere
-
For top-level
.mdfiles (BOOTSTRAP, IDENTITY, SOUL, HEARTBEAT, USER, AGENTS, TOOLS, README), grep across forge for references, surface any with zero inbound refs as candidates for either consolidation or deletion. Don't delete; report. -
Duplicate / shadow content
- Same filename appearing in multiple top-level dirs (e.g. multiple
README.md, that's expected, but flag suspicious overlaps) - Files whose content is >80% identical (use
md5sumon candidates)
- Same filename appearing in multiple top-level dirs (e.g. multiple
Phase 0 deliverable: write a structured report to comms/inbox/parent-session-cleanup-status-1.md AND save a copy at memory/handoffs/forge-cleanup-inventory-2026-04-28.md. Then STOP and wait for Justin's approval to move to Phase 1.
Phase 1: Low-risk approved wins¶
After Justin signs off on Phase 0, execute only the categories he greenlights. Likely candidates:
- macOS ._* files (always safe to delete)
- __pycache__/, .DS_Store (always safe)
- *.bak.* (after confirming no recent reference)
- node_modules/ checked into brands (after verifying package.json exists)
- .openclaw/ (already wiped per MEMORY.md note)
For each: produce a git diff --stat summary post-execution.
Phase 2: Mid-risk: stale handoffs, old logs¶
Move (don't delete) into _archive/ subdirs. Update any inbound references.
Phase 3: Structural¶
Consolidate redundant docs, normalize naming, fix MEMORY.md drift.
Hard limits, never touch without explicit per-action approval¶
system-map/, model-agnostic shared brain~/.forge-secrets/(already outside repo, but never touch even if encountered)- Any
.envor.envrcfile MEMORY.md(you may flag drift; Justin updates)CLAUDE.md(same)- Any file referenced by an active systemd unit (
systemctl list-units --type=service | grep forge) - Any file referenced by an active cron job (
crontab -l) - Any file referenced by an active hook (
.claude/settings.jsonhooks) - Any file referenced by an n8n workflow (workflows live at
infra/n8n/workflows/, grep them) memory/daily/*.md, append-only convention, NEVER delete
Verification protocol before any delete recommendation¶
For every candidate file, before adding it to your "delete" pile:
git log --all --oneline -- <path>, recent commits = keepgrep -r "<filename>" /home/justinwieb/forge --include='*.md' --include='*.sh' --include='*.py' --include='*.json' --include='*.yml', referenced anywhere?- Check if it's in: a systemd unit, a cron entry, a hook, an n8n workflow, a skill/agent definition
- If ANY doubt remains → leave it in place and flag for Justin
Communication protocol¶
- Push reports as numbered files to
comms/inbox/parent-session-cleanup-status-<N>.md(N=1,2,3…) - For Phase 0, also write the canonical inventory to
memory/handoffs/forge-cleanup-inventory-2026-04-28.md - After each phase, sign off with
[forge-cleanup_Opus47]and wait
When you reference a forge .md file in a report to Justin, link it to the MkDocs viewer:
- memory/handoffs/foo.md → [foo](https://markdown.justinsforge.com/memory/handoffs/foo/)
- Indexed scope only: memory/, system-map/, docs/, brands/, infra/, root .md. For logs/, scripts/, tasks/, etc. (excluded from MkDocs), keep the raw path.
You have¶
- Full read access to forge
- Full bash on UDev (this VM)
git log,git blame,grep,find, use them aggressively- The
/recallskill for semantic search across forge knowledge, use it to find inbound references before flagging anything for deletion
You don't have¶
- Authority to delete anything in Phase 0 (inventory only)
- Authority to push to git (Justin commits manually)
- Authority to touch the hard-limits list above
Final note¶
You are Opus 4.7. Don't spawn helpers, you have the budget. If you do spawn a tool subagent, keep it Sonnet/Haiku and only for narrow searches. Don't burn context loading the entire repo into your window, sample, grep, jump to specifics.
When you finish Phase 0, the report should let Justin make a 30-second decision on each category: "yes prune", "leave", or "ask more". That's the bar.