Skip to main content

pm_catchup_context

Function pm_catchup_context 

Source
pub async fn pm_catchup_context(project_dir: &Path) -> Option<String>
Expand description

Build PM-prompt catch-up seed context for the given project directory.

Why: the PM prompt benefits from a one-time digest of what happened in the project since the last session — paused work, recent commits, recent memory palace entries — so it can orient immediately without asking the operator. This is injected as fallback_guidance (the last section of the assembled prompt) and is only wired into the PM agent path; sub-agents receive None because they operate under the PM’s direction and do not need the high-level activity digest.

Watermark is NOT advanced (advance_watermark = false). trusty-code is a read-only consumer of the catch-up state: watermark advancement is owned by trusty-mpm’s session_launch hook, which controls the canonical boundary between sessions. Advancing from trusty-code would skew that boundary and cause cross-harness interference where activity is silently dropped from the next mpm session’s digest.

Fail-open: any error or empty/whitespace result returns None rather than propagating, so prompt assembly always succeeds even when the daemon is offline or the project has no git history.

What: resolves memory_socket via [crate::session::memory_sink::resolve_recorder_socket] (env override TRUSTY_MEMORY_SOCKET first, else the derived socket path, else a fail-fast placeholder — issue #2030; never the live daemon from a test process — #9139), then delegates to [pm_catchup_context_with_socket]. Test: catchup::tests::pm_catchup_context_does_not_panic_on_empty_repo.