MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / refresh_daily_note_files

Function refresh_daily_note_files

agents/reading-agent/main.py:2251–2288  ·  view source on GitHub ↗

Reclassify and refresh summaries in existing Daily Note files.

(
    *,
    user_id: str,
    daily_note_paths: Iterable[str],
)

Source from the content-addressed store, hash-verified

2249
2250
2251def refresh_daily_note_files(
2252 *,
2253 user_id: str,
2254 daily_note_paths: Iterable[str],
2255) -> Dict[str, Any]:
2256 """Reclassify and refresh summaries in existing Daily Note files."""
2257 user_profile = _daily_note_user_profile(user_id)
2258 scanned = 0
2259 refreshed = 0
2260 paths: List[str] = []
2261 errors: List[str] = []
2262
2263 for raw_path in daily_note_paths or []:
2264 path = Path(str(raw_path or "")).expanduser()
2265 if not path.is_absolute():
2266 path = PROJECT_ROOT / path
2267 if not path.exists() or not path.is_file():
2268 continue
2269 scanned += 1
2270 try:
2271 current = path.read_text(encoding="utf-8")
2272 updated = _refresh_daily_note_topic_summaries(current, user_profile=user_profile)
2273 updated = _llm_review_daily_note_categories(updated, user_profile=user_profile)
2274 updated = _refresh_daily_note_topic_summaries(updated, user_profile=user_profile)
2275 if updated.rstrip() + "\n" != current:
2276 path.write_text(updated.rstrip() + "\n", encoding="utf-8")
2277 _sync_obsidian_toc(path)
2278 refreshed += 1
2279 paths.append(str(path))
2280 except Exception as exc:
2281 errors.append(f"{path}: {exc}")
2282
2283 return {
2284 "scanned": scanned,
2285 "refreshed": refreshed,
2286 "daily_notes": sorted(set(paths)),
2287 "errors": errors[:8],
2288 }
2289
2290
2291def _daily_note_user_profile(user_id: str) -> Dict[str, Any]:

Callers

nothing calls this directly

Tested by

no test coverage detected