Skip to content

feat(minimize): add optional intra-message ddmin after turn shrinking - #145

Open
BasilZafar11 wants to merge 1 commit into
CodewithJha:mainfrom
BasilZafar11:fix/issue-34-intra-message-ddmin
Open

BasilZafar11 wants to merge 1 commit into
CodewithJha:mainfrom
BasilZafar11:fix/issue-34-intra-message-ddmin

Conversation

@BasilZafar11

Copy link
Copy Markdown
Contributor

Summary

Fixes #34

Add the opt-in Core parameter minimize_genome(..., intra_message=True). After existing turn-level ddmin finishes, a second phase removes character partitions from each retained message. Every accepted deletion resets and executes the target and uses the existing policy evaluator to preserve every requested rule ID. Empty/whitespace-only deletion proposals are skipped.

The default remains False, preserving existing turn-only behavior, traces, execution counts, and lineage. Existing CLI and Hosted callers retain that default; this PR adds a Python API parameter, not a CLI or Hosted request flag. The shrink algorithm uses no LLM, tokenizer, or new dependency.

Enabled runs include both phases in reexec_count, retain the accepted final trace, and record ddmin_intra_message / intra_message=true in genome lineage. Smaller messages flow into the existing regression artifact and replay path. Character-level shrinking can require many additional target executions, so the lifecycle docs explain the opt-in cost.

Type of change

  • Core engine (minimize)
  • Tests
  • Documentation

Checklist

  • Read CONTRIBUTING.md and repository policies
  • Linked related issue
  • Framework-independent Core; no providers added
  • Meaningful offline regression coverage
  • Documentation describes the actual API and unchanged default
  • One minimization concern per PR
  • Authorized offline testing only

Test plan

  • uv run --locked pytest tests/unit/test_minimize.py tests/unit/test_regression.py -q --tb=short: 17 passed.
  • MUTINY_SAMPLE_OFFLINE=1 uv run --locked pytest -q --tb=short: 771 passed, including unit, integration, reliability, and packaging checks.
  • uv run --locked ruff check: passed.
  • git diff --check: passed.

New tests cover default/off equivalence, a verbose multi-sentence single-turn fixture, reducing each retained turn after turn-level shrink, preserving all specified rules rather than any violation, execution counts/final trace correspondence, parent isolation, irreproducible/empty inputs, already-minimal content, and saving/replaying the reduced regression.

CLI shell smoke, production web build, and container startup remain covered by existing CI. Branch starts at latest upstream main 99ed9ad, matching fork main at the final fetch.

@vercel

vercel Bot commented Nov 10, 2026

Copy link
Copy Markdown

@BasilZafar11 is attempting to deploy a commit to the priyanshu's projects Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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.

minimize: optional intra-message ddmin after turn-level shrink

1 participant