Add resolved_since_last and skipped_since_last delta fields to the plan_checkpoint progression event. Add a helper that scans progression.jsonl backwards for the last plan_checkpoint event timestamp, then use _execution_log_ids_since(plan, since) to populate these fields. Also add an execution_summary count dict. This completes the checkpoint as a full record of what happened since the last one.
The build_plan_checkpoint_event() in progression.py:573 currently records a snapshot of scores, queue state, and trigger info — but no delta information about what resolved/skipped since the last checkpoint. The existing build_scan_complete_event() already includes resolved_ids, skipped_ids, and execution_summary fields (populated via _execution_log_ids_since() and count_log_activity_since()). This task adds the same delta fields to plan_checkpoint so each checkpoint is a self-contained record of activity since the prior one.
Key existing infrastructure:
_execution_log_ids_since(plan, since) → (resolved_ids, skipped_ids) — already in progression.py:204
count_log_activity_since(plan, since) → dict[str, int] — in completion_flow.py:257
load_progression(path) — reads full jsonl, returns list[dict] — in progression.py:37
Two call sites emit plan_checkpoint: plan_reconcile.py:410 (scan) and plan_sync.py:484 (review)
Add a new function last_plan_checkpoint_timestamp(path: Path | None = None) -> str | None after load_progression() (~line 62).
Implementation: Call load_progression(path), iterate in reverse, return the of the first event with . Return if none found.
Assistant
{"flags":[{"id":"plan_checkpoint_execution_summary_first_window","concern":"The plan's call-site logic leaves execution_summary empty on the first checkpoint, which contradicts the stated goal of making the checkpoint a full record of activity since the prior boundary. already returns all historical resolved/skipped IDs, but only accepts a string timestamp, so the proposed fallback drops all earlier actions from the summary.","category":"correctness","severity_hint":"likely-significant","evidence":"Repo behavior today already shows this asymmetry in scan_complete: computes when there is no prior timestamp, while accepts . cannot count from ."},{"id":"plan_checkpoint_delta_window_not_proven_by_tests","concern":"The proposed tests do not actually prove that the new helper is used to window deltas from the last . The existing scan/review checkpoint tests only assert basic payload fields on a fresh progression file, so an implementation that always dumps the full execution log could still pass.","category":"completeness","severity_hint":"likely-significant","evidence":"Current checkpoint integration tests in and never seed an earlier event or mix older/newer execution-log entries. The unit checkpoint tests in also only validate static payload construction."},{"id":"plan_structure_missing_required_execution_heading","concern":"The plan does not follow the required structure exactly: it uses instead of a literal or section.","category":"completeness","severity_hint":"likely-significant","evidence":"The provided plan metadata already includes the validator warning The body uses , which does not satisfy the stated structure requirement."}],"verified_flag_ids":[],"disputed_flag_ids":[]}
User
Assistant
{"flags":[{"id":"plan_checkpoint_review_path_wiring_not_covered","concern":"The revised plan still leaves the review checkpoint path under-tested. plan_checkpoint is emitted from two separate call sites, but the new end-to-end windowing test is only specified for the scan reconcile flow. A mistake in plan_sync.py could still slip through even if the scan-path test passes.","category":"completeness","severity_hint":"likely-significant","evidence":"The repo has distinct checkpoint emitters in desloppify/app/commands/scan/plan_reconcile.py:407-418 and desloppify/app/commands/review/importing/plan_sync.py:479-494. The plan's new Step 5c explicitly proves windowing only 'via the scan reconcile flow', while the existing review-path test at desloppify/tests/commands/review/test_review_importing_support_direct.py:224-323 currently checks only the basic checkpoint payload and is no longer called out for delta assertions."}],"verified_flag_ids":["plan_checkpoint_execution_summary_first_window","plan_checkpoint_delta_window_not_proven_by_tests","plan_structure_missing_required_execution_heading"],"disputed_flag_ids":[]}
timestamp
event_type == "plan_checkpoint"
None
Export from __all__ at line 685.
Note: Loading the full file and scanning backwards is consistent with the existing load_progression() pattern. The file is small enough (event-per-scan) that optimization is unnecessary.
Step 2: Add delta fields to build_plan_checkpoint_event() (progression.py:573)
Scope: Small
Add parameters to build_plan_checkpoint_event():
resolved_since_last: list[str] | None = None
skipped_since_last: list[str] | None = None
execution_summary: dict[str, int] | None = None
Add to payload (after the existing source_command line ~599):
python
if resolved_since_last:
payload["resolved_since_last"] = resolved_since_last
if skipped_since_last:
payload["skipped_since_last"] = skipped_since_last
payload["execution_summary"] = execution_summary or {}
This follows the same conditional-inclusion pattern as build_scan_complete_event().
Step 3: Wire up call sites
Scope: Small
3a: plan_reconcile.py:407 (scan path)
Before the build_plan_checkpoint_event() call, compute the delta:
File with mixed events → returns timestamp of most recent plan_checkpoint
File with no plan_checkpoint events → None
Update test_plan_checkpoint (line 274): add execution_log entries to the mock plan, pass the new parameters, assert resolved_since_last, skipped_since_last, and execution_summary appear in the payload.
Add test for omission: when all three new params are None/empty, resolved_since_last and skipped_since_last are absent from payload, and execution_summary is {}.
Step 5: Integration-level test for call site wiring
Scope: Small
In test_plan_reconcile.py: verify the existing checkpoint test (around line 421) now produces events with the delta fields when the plan has execution_log entries.
In test_review_importing_support_direct.py: same check for the review path.
Execution and Validation Order
Step 1 first — the helper is a pure function with no dependencies, easy to validate in isolation.
Step 2 — signature change is backward-compatible (all new params have defaults).
Step 4 unit tests — validate Steps 1 and 2 before wiring call sites.
Step 3 — wire the two call sites.
Step 5 — integration tests confirm end-to-end.
Full test suite: python -m pytest desloppify/tests/ -q
code
Plan metadata:
{
"version": 1,
"timestamp": "2026-03-23T07:06:03Z",
"hash": "sha256:b048d6a8da83dfafbe8a590be943e024c15e911419cbeebe98a02d6f5b05dd29",
"questions": [
"Should execution_summary always be present (as {}) or omitted when empty \u2014 matching build_scan_complete_event's always-present pattern, or matching the conditional pattern of resolved_ids/skipped_ids?",
"Should last_plan_checkpoint_timestamp also consider scan_complete events as 'last checkpoint' for computing deltas, or strictly only plan_checkpoint events? (This matters for the first checkpoint after a scan \u2014 if we only look at plan_checkpoints, the first one may include all historical activity.)"
],
"success_criteria": [
"build_plan_checkpoint_event() accepts and includes resolved_since_last, skipped_since_last, and execution_summary in its payload",
"last_plan_checkpoint_timestamp() correctly scans progression.jsonl backwards and returns the most recent plan_checkpoint timestamp or None",
"Both call sites (plan_reconcile.py scan path and plan_sync.py review path) compute and pass the delta fields",
"Existing tests still pass \u2014 the new parameters are all optional with backward-compatible defaults",
"New unit tests cover: the helper function, payload inclusion when populated, payload omission when empty",
"Full test suite passes: python -m pytest desloppify/tests/ -q"
],
"assumptions": [
"The progression.jsonl file is small enough to load fully and scan backwards \u2014 no need for reverse-file-reading optimization",
"execution_summary will always be present in payload (as empty dict when no activity), matching the build_scan_complete_event pattern \u2014 this avoids downstream consumers needing to handle absence",
"resolved_since_last and skipped_since_last are only included when non-empty, matching the conditional pattern used by build_scan_complete_event for resolved_ids/skipped_ids",
"The delta window is from the last plan_checkpoint event only (not scan_complete), so the first checkpoint after a fresh plan will capture all activity since plan creation",
"count_log_activity_since import from completion_flow.py is acceptable at both call sites \u2014 it's already imported in plan_reconcile.py and adding it to plan_sync.py follows the same pattern"
],
"structure_warnings": [
"Plan should include ## Execution Order or ## Validation Order."
]
}
code
Plan structure warnings from validator:
[
"Plan should include ## Execution Order or ## Validation Order."
]
code
Existing flags:
[]
Requirements:
- Consider whether the plan is at the right level of abstraction.
- Reuse existing flag IDs when the same concern is still open.
- `verified_flag_ids` should list previously addressed flags that now appear resolved.
- Focus on concrete issues that would cause real problems.
- Robustness level: standard. Use balanced judgment. Flag significant risks, but do not spend flags on minor polish or executor-obvious boilerplate.
- Verify that the plan remains aligned with the user's original intent.
- Verify that the plan follows the expected structure: one H1 title, `## Overview`, numbered `## Step N:` sections with file references and numbered substeps, plus `## Execution Order` or `## Validation Order`. Missing structure should be flagged as category `completeness` with severity_hint `likely-significant`.
- Flag scope creep explicitly when the plan grows beyond the original idea or recorded user notes. Use the phrase "Scope creep:" in the concern.
- Assign severity_hint carefully. Implementation details the executor will naturally resolve should usually be `likely-minor`.
Add resolved_since_last and skipped_since_last delta fields to the plan_checkpoint progression event. Add a helper that scans progression.jsonl backwards for the last plan_checkpoint event timestamp, then use _execution_log_ids_since(plan, since) to populate these fields. Also add an execution_summary count dict. This completes the checkpoint as a full record of what happened since the last one.
The build_plan_checkpoint_event() in progression.py:573 currently records a snapshot of scores, queue state, and trigger info — but no delta information about what resolved/skipped since the last checkpoint. The existing build_scan_complete_event() already includes resolved_ids, skipped_ids, and execution_summary fields (populated via _execution_log_ids_since() and count_log_activity_since()). This task adds the same delta fields to plan_checkpoint so each checkpoint is a self-contained record of activity since the prior one.
Key existing infrastructure:
_execution_log_ids_since(plan, since) → (resolved_ids, skipped_ids) — already in progression.py:204, accepts since: str | None (None = all entries)
count_log_activity_since(plan, since) → dict[str, int] — in completion_flow.py:257, requires since: str (does not accept None)
load_progression(path) — reads full jsonl, returns list[dict] — in progression.py:37
Two call sites emit plan_checkpoint: plan_reconcile.py:410 (scan) and plan_sync.py:484 (review)
Step 1: Widen count_log_activity_since to accept None (completion_flow.py:257)
Scope: Small
Change the signature from since: str to since: str | None at completion_flow.py:257.
Update the comparison at line 267: when since is None, include all entries (skip the timestamp >= since guard), matching the behavior of _execution_log_ids_since.
python
if since is not None and timestamp < since:
continue
This eliminates the asymmetry where _execution_log_ids_since(plan, None) returns all history but count_log_activity_since(plan, None) would fail or return nothing.
Add a new function last_plan_checkpoint_timestamp(path: Path | None = None) -> str | None after load_progression() (~line 62).
Implementation: Call load_progression(path), iterate in reverse, return the timestamp of the first event with event_type == "plan_checkpoint". Return None if none found.
Export from __all__ at line 685.
Step 3: Add delta fields to build_plan_checkpoint_event() (progression.py:573)
Scope: Small
Add parameters to build_plan_checkpoint_event():
resolved_since_last: list[str] | None = None
skipped_since_last: list[str] | None = None
execution_summary: dict[str, int] | None = None
Add to payload (after the existing source_command line ~599):
python
if resolved_since_last:
payload["resolved_since_last"] = resolved_since_last
if skipped_since_last:
payload["skipped_since_last"] = skipped_since_last
payload["execution_summary"] = execution_summary or {}
execution_summary is always present (as {} when empty), matching build_scan_complete_event. The list fields are conditionally included, matching the resolved_ids/skipped_ids pattern.
Step 4: Wire up call sites
Scope: Small
4a: plan_reconcile.py:407 (scan path)
Before the build_plan_checkpoint_event() call, compute the delta:
File with mixed events → returns timestamp of most recent plan_checkpoint.
File with no plan_checkpoint events → None.
5b: Unit test build_plan_checkpoint_event delta fields
Update test_plan_checkpoint (line 274): pass the new parameters with non-empty values, assert resolved_since_last, skipped_since_last, and execution_summary appear in the payload.
Add test for omission: when all three new params are None/empty, resolved_since_last and skipped_since_last are absent from payload, and execution_summary is {}.
5c: Windowed-delta integration test (proves correct use of the helper)
Seed a progression.jsonl with an earlier plan_checkpoint event at timestamp T1.
Seed a plan execution_log with entries both before and after T1.
Invoke the checkpoint emission code path (via the scan reconcile flow).
Assert the resulting event's resolved_since_last contains only IDs from entries after T1, not the full history. This proves the windowing is wired correctly — an implementation that always dumps the full log would fail.
5d: First-checkpoint integration test
Use empty progression.jsonl (no prior checkpoint).
Seed a plan execution_log with entries.
Assert the resulting event's resolved_since_last and execution_summary include all entries — confirming the None timestamp path captures full history.
Step 2 — add the last_plan_checkpoint_timestamp helper.
Step 3 — add delta parameters to build_plan_checkpoint_event.
Step 5a/5b — unit tests for Steps 2 and 3.
Step 4 — wire call sites.
Step 5c/5d — integration tests proving windowed and first-window behavior.
Validation Order
Unit tests for helper + builder after Steps 1–3.
Integration tests after Step 4.
Full suite: python -m pytest desloppify/tests/ -q
code
Plan metadata:
{
"version": 2,
"timestamp": "2026-03-23T07:10:55Z",
"hash": "sha256:9f42e9eb5a8206db243ceae353d5e5d96829f6bcf5eb5f9fdb7e911c6ea745c0",
"changes_summary": "Three changes from v1: (1) Added Step 1 to widen count_log_activity_since to accept None, fixing the first-window asymmetry where resolved/skipped captured full history but execution_summary was empty. Call sites now pass last_cp_ts unconditionally without if/else {}. (2) Added Step 5c/5d windowed-delta integration tests that seed a prior checkpoint + interleaved execution_log entries and assert only post-checkpoint activity appears, plus a first-checkpoint test proving full-history capture when no prior checkpoint exists. (3) Split ordering into separate ## Execution Order and ## Validation Order sections.",
"flags_addressed": [
"plan_checkpoint_execution_summary_first_window",
"plan_checkpoint_delta_window_not_proven_by_tests",
"plan_structure_missing_required_execution_heading"
],
"questions": [
"Should last_plan_checkpoint_timestamp also consider scan_complete events as 'last checkpoint' for computing deltas, or strictly only plan_checkpoint events? (This matters for the first checkpoint after a scan \u2014 if we only look at plan_checkpoints, the first one may include all historical activity.)"
],
"success_criteria": [
"build_plan_checkpoint_event() accepts and includes resolved_since_last, skipped_since_last, and execution_summary in its payload",
"last_plan_checkpoint_timestamp() correctly scans progression.jsonl backwards and returns the most recent plan_checkpoint timestamp or None",
"count_log_activity_since() accepts since: str | None and returns full history when None, consistent with _execution_log_ids_since",
"Both call sites (plan_reconcile.py scan path and plan_sync.py review path) compute and pass the delta fields unconditionally (no empty-dict fallback)",
"Existing tests still pass \u2014 all new parameters are optional with backward-compatible defaults",
"Windowed-delta integration test proves only post-last-checkpoint activity is included",
"First-checkpoint integration test proves full history is captured when no prior checkpoint exists",
"Full test suite passes: python -m pytest desloppify/tests/ -q"
],
"assumptions": [
"The progression.jsonl file is small enough to load fully and scan backwards \u2014 no need for reverse-file-reading optimization",
"execution_summary will always be present in payload (as empty dict when no activity), matching the build_scan_complete_event pattern",
"resolved_since_last and skipped_since_last are only included when non-empty, matching the conditional pattern used by for /",
"The delta window is from the last event only (not ), so the first checkpoint after a fresh plan will capture all activity since plan creation",
"Widening to accept is safe \u2014 existing callers in already guard with , so passing would not change their behavior unless they opt in"
],
"structure_warnings": [],
"delta_from_previous_percent": 37.64
}
code
Plan structure warnings from validator:
[]
Existing flags:
[
{
"id": "plan_checkpoint_execution_summary_first_window",
"concern": "The plan's call-site logic leaves execution_summary empty on the first checkpoint, which contradicts the stated goal of making the checkpoint a full record of activity since the prior boundary. _execution_log_ids_since(plan, None) already returns all historical resolved/skipped IDs, but count_log_activity_since() only accepts a string timestamp, so the proposed if last_cp_ts else {} fallback drops all earlier actions from the summary.",
"status": "addressed",
"severity": "significant"
},
{
"id": "plan_checkpoint_delta_window_not_proven_by_tests",
"concern": "The proposed tests do not actually prove that the new helper is used to window deltas from the last plan_checkpoint. The existing scan/review checkpoint tests only assert basic payload fields on a fresh progression file, so an implementation that always dumps the full execution log could still pass.",
"status": "addressed",
"severity": "significant"
},
{
"id": "plan_structure_missing_required_execution_heading",
"concern": "The plan does not follow the required structure exactly: it uses ## Execution and Validation Order instead of a literal ## Execution Order or ## Validation Order section.",
"status": "addressed",
"severity": "significant"
}
]
code
Requirements:
- Consider whether the plan is at the right level of abstraction.
- Reuse existing flag IDs when the same concern is still open.
- `verified_flag_ids` should list previously addressed flags that now appear resolved.
- Focus on concrete issues that would cause real problems.
- Robustness level: standard. Use balanced judgment. Flag significant risks, but do not spend flags on minor polish or executor-obvious boilerplate.
- Verify that the plan remains aligned with the user's original intent.
- Verify that the plan follows the expected structure: one H1 title, `## Overview`, numbered `## Step N:` sections with file references and numbered substeps, plus `## Execution Order` or `## Validation Order`. Missing structure should be flagged as category `completeness` with severity_hint `likely-significant`.
- Flag scope creep explicitly when the plan grows beyond the original idea or recorded user notes. Use the phrase "Scope creep:" in the concern.
- Assign severity_hint carefully. Implementation details the executor will naturally resolve should usually be `likely-minor`.