Skip to content

Add planner-visible intent commit grouping#53

Draft
KristjanPikhof wants to merge 42 commits into
mainfrom
refactor/intent-commits
Draft

Add planner-visible intent commit grouping#53
KristjanPikhof wants to merge 42 commits into
mainfrom
refactor/intent-commits

Conversation

@KristjanPikhof

Copy link
Copy Markdown
Owner

Feature Description

Intent mode now waits briefly for related captures to settle, shows the planner
a lossless visible window, and lets the planner split that window into ordered
commit_groups. This keeps rapid related work visible to AI without forcing
unrelated or independent same-file edits into one broad commit.

Type of Change

  • New feature

Implementation Details

  • Add ACD_INTENT_SETTLE_WINDOW so intent mode can wait briefly after the
    pending-count gate before planning.
  • Make same-path captures planner-visible by default, with
    ACD_INTENT_PATH_COALESCE=1 available for the legacy folded behavior.
  • Add commit_groups planner support so one window can publish several atomic
    commits in order.
  • Record planner-visible windows in state and expose them through status,
    diagnose, and events output.
  • Reject unsafe grouped planner output, including interleaved same-path groups.

Key Files Changed

File Change
internal/daemon/replay.go Applies settle-window and grouped replay behavior
internal/ai/intent_planner.go Adds and validates grouped planner output
internal/state/intent_planner_window.go Stores planner-window observability
internal/cli/intent_planner_window.go Surfaces planner windows in CLI output
test/integration/intent_atomicity_test.go Covers rapid and same-file grouping behavior

Database Changes

  • Migration included and tested

How to Test

Verified locally:

  • git diff --check
  • cleanenv make lint
  • cleanenv make test
  • cleanenv go test ./test/integration/... -tags=integration -race -count=1 -timeout 5m
  • cleanenv go test ./internal/daemon/... ./internal/git/... ./internal/state/... ./internal/pause/... ./internal/cli/... -race -count=3 -timeout 10m

After the final docs-only commit, git diff --check main..HEAD also passed.

Edge Cases Considered

  • Rapid five-change bursts should be offered to the planner together.
  • Independent edits in the same file should remain visible as separate seqs.
  • Logical flush bypasses wait time but not replay safety.
  • Invalid or interleaved commit_groups are rejected and fall back safely.
  • Custom subprocess planners must follow the same grouped-output contract.

Feature Flag

  • Behind configuration: ACD_COMMIT_STRATEGY=intent

- Add a configurable settle window to gate bursty intent planning.
- Parse zero and valid durations while falling back on invalid input.
- Cover env loading, defaults, invalid values, and zero handling in
  tests.
- Add configurable settle delay once pending intents reach the threshold
- Surface the new setting in daemon config and replay resolution
- Keep negative test overrides clamped to zero/off
- Surface the intent settle window in strategy reporting.
- Parse daemon metadata for non-negative durations.
- Extend status tests to cover settle window metadata and reporting.
- Surface settle-window timing in intent strategy output
- Keep status and diagnose assertions aligned with the new field
- Keep every durable same-path capture visible unless opted in.
- Require explicit env values to re-enable destructive squash.
- Align tests with the new default and accepted spellings.
- Add a helper to inspect offered capture seqs in planner requests.
- Update the replay test to keep four same-path edits visible.
- Assert the planner can select the full chain as one commit.
- Cover independent edits in the same file so planner still sees both
  captures.
- Reuse the offered-seq helper in replay assertions to simplify checks.
- Treat recent rapid captures as settling before planning
- Cover both the settle-window skip and the eventual 5-capture batch
- Record settle-window context in daemon traces.
- Expose newest-pending and settle-trigger fields in CLI reports.
- Distinguish settle-window waits from generic batch waits in CLI output
- Report the newest pending event age and settle trigger timing
- Keep planner observability aligned with the pending window semantics
- Differentiate settle-window waiting from general batch waiting
- Surface the correct countdown when intent is paused for settling
- Add coverage for JSON and human status output in the settle case
- Distinguish intent settle-window waits from age-based waits in status.
- Cover compact, verbose, and JSON list output for the new wait path.
- Distinguish settle-window waits from the older batch-wait display.
- Add coverage for a rapid burst that should stay grouped as one commit.
- Keep planner-driven replays from auto-zeroing the settle window.
- Make same-path coalescing opt-in so durable captures stay visible.
- Skip settle waiting once pending hits the window cap.
- Disable the settle window in the singleton replay test.
- Allow intent replay to skip settle delay once the window is full.
- Keep CLI observability aligned with the new full-window gate.
- Add structured commit groups to intent plans and validate them
- Normalize grouped grouping reasons alongside legacy plan fields
- Apply message-quality rewriting to each commit group independently
- Allow one planning response to represent multiple independent commits
- Keep legacy top-level fields aligned with the first group for
  compatibility
- Pass commit-group data from the planner subprocess to the daemon.
- Replay and validation now operate on grouped selections instead of a
  single flat selection, preserving commit boundaries during publishing.
- Add v11 state schema support for planner-window observability
- Persist offered, hidden, selected, and deferred event breakdowns
- Keep migration notes aligned with the new durable storage layout
- Store privacy-safe planner window summaries and per-event lookup rows.
- Add schema coverage to ensure the new tables and indexes exist.
- Record planner window metadata end to end.
- Persist and reload window fields so observability data survives
  storage.
- Capture planner provider/model from replay config for window records.
- Persist planner window metadata for every replay path
- Include short-circuits and validation failures in the record
- Keep replay history aligned with what the planner saw and chose
- Load persisted intent planner windows for replayed events
- Surface planner window metadata in event listings
- Show offered and hidden seqs to make window output explainable
- Include the latest planner window in strategy reports for CLI users.
- Show offered, selected, deferred, hidden, and validation details when
  available so planner behavior is easier to inspect.
- Keep CLI observability structs consistently aligned
- No functional behavior changes; this is readability cleanup
- Update the state, CLI, and test files to use the planner windows name
  consistently.
- Keep the rename aligned with the existing planner terminology exposed
  in recent commits.
- Keep the intent planner filenames consistent with the new singular
  naming.
- Rename the CLI, state, and test files together so the suite stays in
  sync.
- Add JSON event coverage for planner-window details
- Add status summary coverage for the last planner window
- Add integration coverage for planner-window partitioning
- Assert independent intents stay separable in the daemon
- Check the rapid-five path still reports one coalesced group
- Align test fixtures with the new bullet-list commit body format
- Keep intent atomicity expectations consistent with generated output
- Ensure the partitioning test covers the final rendered message shape
- Disable the settle window so the test uses immediate intent capture.
- Enable path coalescing to make the two saves collapse into one path.
- Keep the quiescence scenario deterministic under intent strategy.
- Give intent mode a burst settle delay so related edits can land
  together
- Document grouped replay, planner-window diagnostics, and default env
  values
- Require commit groups to stay in non-overlapping seq ranges
- Keep replay deterministic by falling back when planner output is
  invalid
- Update docs and tests to match the tightened planner contract
- Document the new planner contract for multi-intent windows.
- Explain that ordered `commit_groups` preserve atomic replay.
- Clarify custom planners should follow the same selection behavior.
@KristjanPikhof KristjanPikhof self-assigned this Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant