feat: length-aware reinforcement + batch triage CLI + off-host backup

- Reinforcement matcher now handles paragraph-length memories via a
  dual-mode threshold: short memories keep the 70% overlap rule,
  long memories (>15 stems) require 12 absolute overlaps AND 35%
  fraction so organic paraphrase can still reinforce. Diagnosis:
  every active memory stayed at reference_count=0 because 40-token
  project summaries never hit 70% overlap on real responses.
- scripts/atocore_client.py gains batch-extract (fan out
  /interactions/{id}/extract over recent interactions) and triage
  (interactive promote/reject walker for the candidate queue),
  matching the Phase 9 reflection-loop review flow without pulling
  extraction into the capture hot path.
- deploy/dalidou/cron-backup.sh adds an optional off-host rsync step
  gated on ATOCORE_BACKUP_RSYNC, fail-open when the target is offline
  so a laptop being off at 03:00 UTC never reds the local backup.
- docs/next-steps.md records the retrieval-quality sweep: project
  state surfaces, chunks are on-topic but broad, active memories
  never reach the pack (reflection loop has no retrieval outlet yet).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-11 11:20:03 -04:00
parent c5bad996a7
commit 9366ba7879
5 changed files with 294 additions and 6 deletions

View File

@@ -18,13 +18,22 @@
# emails. Check /var/log/atocore-backup.log for diagnostics.
#
# Environment variables:
# ATOCORE_URL default http://127.0.0.1:8100
# ATOCORE_BACKUP_CHROMA default false (set to "true" for cold chroma copy)
# ATOCORE_URL default http://127.0.0.1:8100
# ATOCORE_BACKUP_CHROMA default false (set to "true" for cold chroma copy)
# ATOCORE_BACKUP_DIR default /srv/storage/atocore/backups
# ATOCORE_BACKUP_RSYNC optional rsync destination for off-host copies
# (e.g. papa@laptop:/home/papa/atocore-backups/)
# When set, the local snapshots tree is rsynced to
# the destination after cleanup. Unset = skip.
# SSH key auth must already be configured from this
# host to the destination.
set -euo pipefail
ATOCORE_URL="${ATOCORE_URL:-http://127.0.0.1:8100}"
INCLUDE_CHROMA="${ATOCORE_BACKUP_CHROMA:-false}"
BACKUP_DIR="${ATOCORE_BACKUP_DIR:-/srv/storage/atocore/backups}"
RSYNC_TARGET="${ATOCORE_BACKUP_RSYNC:-}"
TIMESTAMP="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
log() { printf '[%s] %s\n' "$TIMESTAMP" "$*"; }
@@ -53,4 +62,24 @@ CLEANUP_RESULT=$(curl -sf -X POST \
}
log "Cleanup result: $CLEANUP_RESULT"
# Step 3: Off-host rsync (optional). Fail-open: log but don't abort
# the cron so a laptop being offline at 03:00 UTC never turns the
# local backup path red.
if [[ -n "$RSYNC_TARGET" ]]; then
log "Step 3: rsyncing snapshots to $RSYNC_TARGET"
if [[ ! -d "$BACKUP_DIR/snapshots" ]]; then
log "WARN: $BACKUP_DIR/snapshots does not exist, skipping rsync"
else
RSYNC_OUTPUT=$(rsync -a --delete \
-e "ssh -o ConnectTimeout=10 -o BatchMode=yes -o StrictHostKeyChecking=accept-new" \
"$BACKUP_DIR/snapshots/" "$RSYNC_TARGET" 2>&1) && {
log "Rsync complete"
} || {
log "WARN: rsync to $RSYNC_TARGET failed (offline or auth?): $RSYNC_OUTPUT"
}
fi
else
log "Step 3: ATOCORE_BACKUP_RSYNC not set, skipping off-host copy"
fi
log "=== AtoCore daily backup complete ==="