Skip to content

feat: add correction flywheel (store, capture, parser, controller hooks)#116

Closed
abrichr wants to merge 0 commit into
mainfrom
feat/correction-flywheel
Closed

feat: add correction flywheel (store, capture, parser, controller hooks)#116
abrichr wants to merge 0 commit into
mainfrom
feat/correction-flywheel

Conversation

@abrichr
Copy link
Copy Markdown
Member

@abrichr abrichr commented Mar 7, 2026

Summary

Implements the correction flywheel MVP — the core loop that makes OpenAdapt improve from production failures:

Agent fails at step N → correction store checked → if match, inject corrected step → if no match and capture enabled, human completes step → Recorder captures → VLM parses → correction stored → next run retrieves it.

New files (3)

  • correction_store.py (97 lines) — JSON-file-based correction library with save/find (fuzzy SequenceMatcher)/load_all
  • correction_capture.py (238 lines) — Human correction capture using openadapt-capture Recorder (primary path, full input events + action-gated screenshots) with PIL screenshot fallback
  • correction_parser.py (86 lines) — VLM call to parse before/after screenshots into PlanStep dict (think/action/expect)

Modified files (2)

  • demo_controller.py (+147 lines) — Added correction_store and enable_correction_capture params to DemoController and run_with_controller. Three new methods: _try_stored_correction(), _try_capture_correction(), _capture_human_correction(). Hooks into retry-exhaustion path (before replan).
  • benchmarks/cli.py (+18 lines) — Added --correction-library and --enable-correction-capture CLI flags

Tests

  • 17 new tests in test_correction_flywheel.py, all passing
  • 54 existing test_demo_controller.py tests unaffected (71 total passing)

Test plan

  • uv run pytest tests/test_correction_flywheel.py -v — 17/17 passing
  • uv run pytest tests/test_demo_controller.py -v — 54/54 passing
  • Manual macOS E2E test (record agent fail → human correct → next run succeeds)
  • Record 3-minute demo video

🤖 Generated with Claude Code

@abrichr abrichr closed this Mar 16, 2026
@abrichr abrichr force-pushed the feat/correction-flywheel branch from 01ef338 to e8711c8 Compare March 16, 2026 22:43
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