# Delodocs Vault Pipeline

> Understand, diagnose, and repair the DeLoDocs vault automation pipeline (Inbox triage, cleanup, watchdog, router, wiki curator). Use when the Inbox is not draining, the router has stopped moving files, the watchdog is failing, or you need to understand how the vault's automated knowledge pipeline works.

- Skill: `delorenj/delodocs-vault-pipeline-2` (Agent Skill)
- Install (CLI): `npx get-skill add delorenj/delodocs-vault-pipeline-2`
- Raw SKILL.md: https://api.skillmd.com/api/skills/delorenj/delodocs-vault-pipeline-2/raw
- Safety review: pending (external: skill-scanner PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: DevOps & Infra
- Author: delorenj (https://skillmd.com/u/delorenj)
- Updated: 2026-11-12
- Page: https://skillmd.com/skills/delorenj/delodocs-vault-pipeline-2

---


# DeLoDocs Vault Automation Pipeline

> **The vault is not a git repo.** It is synced only by Syncthing (folder id
> `delodocs`; hub big-chungus is the source of truth). Never `git init`, commit,
> or push it; a pipeline fix "lands" when the file is written. History lives in
> `~/DeLoDocs-history-2026-07-17.bundle` and GitHub `delorenj/DeLoDocs`. The hub's
> `.stignore` carries `/.git` so a peer cannot re-sync one; `.stignore` is
> per-device. Full story: the vault's own `AGENTS.md` → "Version Control & Backups".

## Wax-owned subtree

`Inbox/Wax/` (`~/d/Inbox/Wax`) is reserved for Wax document arrivals, not this
watchdog's new/changed-file enrichment. `Transcripts/` is Wax output. Before any
recursive cleanup, recovery/backfill or routing run, verify actual exclusions
for `Inbox/Wax/**` in cleanup, watchdog and router configuration/code; a prose
ownership declaration does not exclude anything. If exclusions are absent,
report the competing-writer boundary and repair it as a scoped operational
change before sweeping those paths. Do not steal/move/delete Wax arrivals or
interpret Wax's `pipeline-status` as an instruction to the vault router.
Use `wax-pipeline` for bindings/receipts and `heyma-pipeline-doctor` for incidents.

## Pipeline Architecture

The vault runs a three-stage Inbox triage pipeline plus downstream wiki passes:

```
Inbox/  →  cleanup (candybar, 10m)  →  watchdog (service) + Hermes enrichment
        →  router (service; no candybar)  →  {Category}/_triage/{file}.md
        →  (no second pass: delodocs-triage-second-pass decommissioned 2026-11-04)
```

> Scheduling: Candybar owns WHEN each stage runs (see the `candybar` skill). The
> `delodocs-*.timer` units are retired or disabled native clocks: never re-enable
> one, and register a candybar instead of adding a timer. The `.service` units are
> the execution half.

### Stage 1: Cleanup — Candybar `delodocs-inbox-cleanup` (runs `delodocs-inbox-cleanup.service`)

Script: `_vault/scripts/inbox_cleanup.py`

Deletes deterministic junk (sync-conflicts, empty files, duplicates).
Uploads non-markdown attachments to MinIO. Runs first, before enrichment.

### Stage 2: Watchdog + Enrichment — `delodocs-inbox-watchdog.service`

Script: `_vault/scripts/inbox_watchdog.py`
Prompt: `_vault/Workflows/prompts/inbox-frontmatter-watchdog.md`

Long-running service (execution, not a clock: no schedule of its own). Spots new/changed `.md` files in `Inbox/` recursively.
Waits 20s for file stability, then wakes Delodocs PM Hermes profile with
a manifest. Hermes adds YAML frontmatter (source, captured, category,
tags, route-path, route-confidence) and sets `pipeline-status: [ready]`.

State: `~/.local/state/delodocs/inbox-watchdog/state.json`

### Stage 3: Router — `delodocs-inbox-router.service`

> Not scheduled (checked 2026-11-03): no candybar is registered for the router and
> the unit is not installed in `~/.config/systemd/user`. Its old 10-minute cadence
> came from the retired `delodocs-inbox-router.timer`. To schedule it, register a
> candybar (`systemd` runner for the `.service`); never re-enable the timer.

Script: `_vault/scripts/inbox_router.py`

Deterministic mover. Scans for `pipeline-status: [ready]` +
`route-confidence: high` + valid `route-path`. Moves files to destination.
Holds files that don't qualify with reason logged.

State: `~/.local/state/delodocs/inbox-router/state.json`
Logs: `_vault/Workflows/logs/inbox-router-YYYY-MM.md`

### Downstream

- `delodocs-wiki-curator-daily.service` — reviews routed notes for wiki growth
- `delodocs-wiki-self-tuning-weekly.service` — routing quality review (Candybar `delodocs-wiki-self-tuning-weekly`)

Check a stage's schedule with `cd ~/code/33GOD/candybar && uv run candybar show <name>`;
if a stage has no candybar, it is not scheduled. Register one rather than restoring its timer.

## Diagnostic Playbook

When the pipeline appears stalled:

### 1. Check service status

```bash
systemctl --user is-active delodocs-inbox-watchdog.service
(cd ~/code/33GOD/candybar && uv run candybar show delodocs-inbox-cleanup -n 5)
```

### 2. Check watchdog journal for errors

```bash
journalctl --user -u delodocs-inbox-watchdog.service --no-pager -n 80
```

Key patterns and what they mean:

| Pattern | Meaning |
|---|---|
| `"no ready files"` | Normal — nothing to do right now |
| `"hermes failed: exit=1"` | Hermes enrichment is failing |
| `FileNotFoundError` for hermes | Wrong binary path in service file |

### 3. Check router logs

```bash
cat _vault/Workflows/logs/inbox-router-YYYY-MM.md
```

Held reasons and what they mean:

| Reason | Meaning |
|---|---|
| `pipeline-status is new` | Enrichment never ran on this file |
| `pipeline-status is hitl` | Needs human decision on category |
| `category X maps to Y, not route-path Z` | Frontmatter inconsistency |

### 4. Check watchdog state for failed files

```bash
cat ~/.local/state/delodocs/inbox-watchdog/state.json
```

Look for `"status": "failed"` entries. The `"last_error"` field shows the
Hermes error. Files with `"attempts": 3` and `"status": "failed"` are
abandoned — they need manual reset after fixing the root cause.

### 5. Count stuck Inbox files

```bash
grep -rl "pipeline-status:" Inbox/ | xargs grep -l "new" | wc -l
```

### 6. Count files held in router

```bash
python3 -c "
import json
state = json.load(open('$HOME/.local/state/delodocs/inbox-router/state.json'))
held = sum(1 for f in state.get('files',{}).values() if f.get('status')=='held')
print(held)
"
```

## Common Failure Modes

### Model/provider deprecated

**Symptom:** `"hermes failed: exit=1"` repeatedly; `last_error` contains
"model is not supported" or "Error code: 400".

**Root cause:** The watchdog unit file hardcodes `HERMES_PROVIDER` and
`HERMES_MODEL` environment variables. When the provider deprecates the
model, all enrichment calls fail silently (watchdog loops, router holds).

**Fix:**
1. Update the env vars in `_vault/Workflows/systemd/delodocs-inbox-watchdog.service`
2. Reinstall: `install -Dm644 _vault/Workflows/systemd/delodocs-inbox-watchdog.service ~/.config/systemd/user/delodocs-inbox-watchdog.service`
3. Reload + restart: `systemctl --user daemon-reload && systemctl --user restart delodocs-inbox-watchdog`
4. Reset failed files in watchdog state.json (delete entries or set attempts to 0)

### Hermes binary path wrong

**Symptom:** `FileNotFoundError` for hermes binary, service crash.

**Fix:** Update `HERMES_BIN` in the unit file to the output of `which hermes`.

### Files stuck after enrichment fix

After fixing the model, files with `"attempts": 3, "status": "failed"` won't
retry automatically. Options:
- Delete those entries from `state.json` to force re-baseline
- Set `"attempts"` to 0
- Run a one-shot backfill: `python3 _vault/scripts/inbox_watchdog.py --vault "$PWD" --scan-existing --once`

### _triage folders accumulating

The router lands files in `{Category}/_triage/`. Nothing drains that backlog
today: the `delodocs-triage-second-pass` candybar (was Hermes job
delodocs-pm:fc39bd8b33c8) was decommissioned and archived on 2026-11-04 because
its profile `delodocs-pm` was retired. Triage `_triage/` by hand, or register a
new candybar (see the `candybar` skill) against a live profile if the drain is
still wanted.

## Key File Paths

| Path | Purpose |
|---|---|
| `_vault/Workflows/systemd/delodocs-inbox-watchdog.service` | Watchdog unit |
| `_vault/Workflows/systemd/delodocs-inbox-router.service` | Router unit |
| `_vault/Workflows/systemd/delodocs-inbox-router.timer` | Retired native router timer; do not enable |
| `_vault/scripts/inbox_watchdog.py` | Watchdog script |
| `_vault/scripts/inbox_router.py` | Router script |
| `_vault/scripts/inbox_cleanup.py` | Cleanup script |
| `_vault/Workflows/prompts/inbox-frontmatter-watchdog.md` | Enrichment prompt |
| `~/.local/state/delodocs/inbox-watchdog/state.json` | Watchdog state |
| `~/.local/state/delodocs/inbox-router/state.json` | Router state |
| `_vault/Workflows/logs/inbox-router-YYYY-MM.md` | Router move log |

