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

Callers

nothing calls this directly

Tested by

no test coverage detected