Skip to content

Enhancement: agent-driven jj history curation #43

@pofallon

Description

@pofallon

Summary

Add a curator agent that intelligently reorganizes jj commit history after the bead loop completes, replacing the current heuristic-only curate_history action with agent-driven judgment.

Current State

curate_history (in src/maverick/library/actions/jj.py) runs two mechanical passes:

  1. jj absorb — distributes stray hunks into the correct ancestor by line blame
  2. Heuristic squash — squashes commits whose descriptions contain fix/fixup/lint/format/typecheck keywords into their parent

This is conservative by design — it only combines obvious fix-up commits.

Proposed Enhancement

A curator agent that:

  1. Reviews jj log + per-commit diffs for the working set
  2. Identifies semantic groupings — e.g. "these 3 beads all relate to authentication"
  3. Produces a rewrite plan using jj primitives:
    • jj squash — combine related commits
    • jj split — separate commits that touch unrelated concerns
    • jj rebase -r — reorder for logical flow
    • jj describe — rewrite commit messages for the merged result
  4. Executes the plan with operation-log safety (jj op restore on failure)

Design Considerations

  • The agent should receive the full jj log --stat and optionally jj diff for each commit
  • Output should be a structured rewrite plan (list of jj commands), not free-form text
  • Each rewrite step should be validated (no conflicts introduced)
  • The operation log provides a safety net — snapshot before, restore on failure
  • Could run as an optional step (curate_with_agent: true) or replace the heuristic entirely once proven

Acceptance Criteria

  • Curator agent class in src/maverick/agents/
  • curate_history_with_agent action in src/maverick/library/actions/jj.py
  • Integration with fly-beads.yaml (opt-in via input flag)
  • Tests covering plan generation and execution
  • Operation-log rollback on any failure

Labels

enhancement, jj, agents

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions