You are validating and fixing the latest agents-database changes on branch feat/memory-promotion-automation-clean.

Primary objective:
- The new automatic background processing for memory consolidation and promotion appears broken.
- Leave the repo with that added functionality actually working end to end.

Definition of done:
1. Find the intended flow for automatic consolidation/promotion/background processing.
2. Reproduce the current failure with concrete evidence.
3. Fix the broken pieces.
4. Validate end to end with runnable evidence, not just static reasoning.
5. Update any needed docs/scripts/tests to match the final behavior.
6. End with a concise summary in the final output including: root cause, files changed, validation run, and any residual risk.

Important operating rules:
- Work in /mnt/rpi/agents-database.
- Do not push or merge.
- Be careful not to commit or rely on transient DB contents from data/shared-agent-memory.sqlite3 unless truly required. That file is already dirty; avoid making the situation worse.
- Prefer minimal, robust fixes.
- Do not stop early. Keep going until the definition of done is met or you hit a real blocker.
- If useful, create your own tmux pi jobs for long-running or parallelizable subtasks using the native wrappers in /mnt/rpi/pi-config/bin:
  - pi-job-start
  - pi-job-check
  - pi-job-wait
  - pi-job-list
  - pi-job-stop
  Use them when they help you avoid blocking or to split investigation/validation work.
- Since this run is one-prompt only, self-manage aggressively: inspect logs/tests/scripts, form a plan, execute, validate, and summarize.
- For waiting/poll cadence, choose adaptively based on what you observe. Nothing is fixed for you.

Suggested first steps:
- Inspect git diff/status and relevant scripts/tests for the automation changes.
- Search for maintenance/background/consolidate/promote flows.
- Reproduce with the smallest meaningful command.
- Add or update tests that would have caught the bug.

When done, print a crisp final report with commands run and their outcomes.
