Skip to content

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:

  1. /home/justinwieb/forge/CLAUDE.md, the bootstrap, who Justin is, code words, security rules, response style
  2. /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.
  3. /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.
  4. /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.
  5. /home/justinwieb/forge/memory/handoffs/worker-builder-playbook-2026-04-23.md, typology + cost model for fleet workers (you are one).
  6. 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.
  7. 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:

  1. Macros & metadata files
  2. macOS ._* files anywhere (run find /home/justinwieb/forge -name '._*' -type f)
  3. *.bak, *.bak.*, *.old, *.orig files
  4. __pycache__/, .DS_Store, Thumbs.db

  5. Stray top-level files (forge root has these, confirm what they are):

  6. CLAUDE.md.bak.1777298035
  7. Data Organization Master Plan.txt
  8. JustinWiebVR-Projects.csv
  9. smart_router_costs.json
  10. smart-router.skill
  11. .openclaw/ (per MEMORY.md, "FULLY WIPED 2026-03-15", confirm empty/safe to remove)

  12. Brands subtree heavy footprint

  13. node_modules/ checked into brands/gus-the-bass/ and brands/wiebelhaus-enterprises/self-hosted-setup/timetrack/, verify regenerable from package.json, propose .gitignore + delete

  14. Stale handoffs (memory/handoffs/)

  15. List all handoffs by date
  16. Cross-reference with today's daily log + active work
  17. Flag handoffs whose subject is "complete" or whose date is >30 days with no follow-up
  18. DO NOT propose deletion, propose either (a) move to memory/handoffs/_archive/ or (b) leave in place. Justin decides.

  19. Logs

  20. logs/ has many subdirs (workers/, integrations/, site-screenshots/, plus root logs)
  21. Identify which are actively written (rotate-worthy) vs frozen-in-time (archivable)
  22. Worker logs older than 14 days → archive candidates
  23. Don't delete anything; propose a rotation policy

  24. Tasks & comms ephemera

  25. tasks/completed/ and tasks/failed/, entries older than 30 days, archive candidates
  26. comms/results/, comms/inbox/, old files, propose retention policy

  27. MEMORY.md drift

  28. Walk every Tools & Pipelines and External Service Access link target, verify the file exists at the path
  29. Flag broken pointers
  30. Flag pointers to files that haven't been touched in 60+ days (potential dead tools)

  31. Empty directories

  32. find . -type d -empty (excluding .git)

  33. Files referenced nowhere

  34. For top-level .md files (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.

  35. 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 md5sum on candidates)

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 .env or .envrc file
  • 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.json hooks)
  • 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:

  1. git log --all --oneline -- <path>, recent commits = keep
  2. grep -r "<filename>" /home/justinwieb/forge --include='*.md' --include='*.sh' --include='*.py' --include='*.json' --include='*.yml', referenced anywhere?
  3. Check if it's in: a systemd unit, a cron entry, a hook, an n8n workflow, a skill/agent definition
  4. 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 /recall skill 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.