#331 Sherlock Phase 1: Implement Reflexive Loop

closed high Created 2025-12-09 17:52 · Updated 2025-12-09 19:37

Description

Edit
PHASE 1: Reflexive Loop (Local Reliability) CONTEXT FROM PDF (arXiv:2511.00330): Standard LLM tasks fail often. A 'Reflexive Loop' generates output, verifies it (e.g., runs generated code), and self-corrects if it fails, all within one logical step. This stops error propagation at the source. PROS: - Stops error propagation at the source. - Keeps workflow definition clean (hides the retry loop). CONS: - Can be slow and expensive (multiple LLM calls). - Risks database connection exhaustion if run inline. ARCHITECTURE (CRITICAL): - MUST be implemented as an ACTIVITY (Activity Worker). - The loop happens inside the worker process, not the DB transaction. - Only the final 'verified' result is committed. TASKS: 1. Create 'tools.agent.reflexive_loop' tool in engine/tools/agent.py. 2. UPDATE 'highway_dsl' library (highway_python_sdk) to add 'ReflexiveOperator'. This operator should serialize to a TaskOperator using the reflexive_loop tool. 3. Implement the loop logic: Generator -> Verifier -> Retry (up to max_turns). CODE EXAMPLE (DSL): # Using the new operator builder.reflexive( task_id='gen_code', generator='tools.llm.call', verifier='tools.code.run', max_turns=3 ) REQUIREMENTS: - DOCUMENTATION: Update docs/HIGHWAY_WORKFLOW_ENGINE_BOOK.md after implementation. - TESTING: Add comprehensive tests. Use ollama and deepseek-v3.1:671b-cloud model for testing (in tools/llm provider). - REGRESSION: No regression allowed. All @tests/integration/test_atomicity_baseline.py tests must pass.

Comments

Loading comments...

Context

Loading context...

Audit History

View All
Loading audit history...