---
title: "Session Sync bulk gate: project guard, escalate-only metadata, 50-sample distill"
from: codex
to: ["jadong", "codex", "claude-code"]
project: "maester"
date: 2026-07-01T23:17:53.288867+09:00
status: sent
type: report
---

# Session Sync bulk gate follow-up

Date: 2026-07-01 KST
Project: maester
Repo: /home/tlswk/projects/maester-agent

## A. Project inference
- Root cause: Hermes canary had `cwd=/home/tlswk`; the old fallback used the home directory basename as project, producing `project=tlswk`.
- Fixed: project is inferred only from `/projects/<slug>` paths or sanitized distiller output.
- `tlswk`, `tlswkehd`, OS usernames, and home-directory names are rejected as projects and become `general`.
- If the distiller returns `general` but the normalized envelope has a valid project slug, the envelope project is retained.
- Existing canary doc metadata may still contain the old project because the current Maester PATCH path updates content, not metadata. Future session sync writes are fixed.

## B. Metadata update rule
- Changed update path from metadata freeze to escalate-only.
- `project`: preserve existing value.
- `importance`: max only, `low < normal < high < critical`.
- `doc_type`: max only, `chat_log < research < idea < report < handoff < decision`.

## C. Dry-run distill sample
- Command: `python3 scripts/session_sync_distill_sample.py --limit 50 --output /tmp/session_sync_distill_sample_20260701.json`.
- Maester write was not called. OpenRouter distiller only.
- Completed: 50/50, errors: 0.
- Sample by agent: `hermes=9`, `codex=21`, `claude_code=20`.
- doc_type distribution: `decision=13`, `chat_log=15`, `handoff=3`, `report=16`, `research=2`, `idea=1`.
- action_policy distribution after gate: `extract=25`, `none=25`.
- has_action=true: `29/50 = 58%`.
- actionable intersection (`decision|handoff|report AND has_action=true`): `25/50 = 50%`.

## D. Bulk decision
- Bulk write was not executed.
- Reason: actionable intersection is high enough that the extraction policy should be reviewed before opening the batch.
- Current 45-day rule does not reduce much on this machine: Claude Code min updated_at is `2026-05-30`, so almost all Claude sessions are inside 45 days.
- Projected write candidates and rough input tokens:
  - 45 days: `861` writes, approx `2.01M` input tokens.
  - 30 days: `860` writes, approx `2.00M` input tokens.
  - 14 days: `103` writes, approx `770k` input tokens.
  - 7 days: `80` writes, approx `539k` input tokens.

## Verification
- `python3 scripts/test_session_sync.py` -> PASS.
- `.venv/bin/python -m compileall api.py session_sync scripts/session_sync_reconcile.py scripts/session_sync_watch.py scripts/session_sync_distill_sample.py scripts/test_session_sync.py` -> passed.

## Not done
- No bulk Maester write.
- No scheduler/cron/systemd/cloud routine.
- Existing dirty `data/action_lifecycle_audit.jsonl` left untouched.
