Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions scripts/evolve.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/usr/bin/env python3
"""
maxval.effect.intent - Autonomous Evolution Meta-Loop
Applies continuous maximum-value effect vectors to a target project.
maxval.effect.intent - Evolution Meta-Loop (DEMONSTRATION)

DEMO/STUB: this orchestrates the baseline -> apply -> finalize phases but does
NOT dispatch any real LLM swarm or mutate code. apply_maxval_vector() is a
placeholder; finalize_effect() reports a simulated outcome. See README/positioning.
"""

import os
Expand Down Expand Up @@ -29,16 +32,15 @@ def baseline_intent(target_dir):

def apply_maxval_vector(target_dir):
"""
Simulates the injection of an Autoresearch Swarm mutation.
In a live environment, this dispatches parallel agent sub-processes.
STUB: placeholder for swarm dispatch. Does nothing yet; a live build would
dispatch parallel agent sub-processes and gate their results.
"""
print("[VECTOR] Dispatching parallel swarm agents to discover maxval optimizations...")
# Placeholder for actual LLM agent dispatching logic (subagent-driven-development)
print("[VECTOR] Swarm returned 3 potential intent paths. Running Evolution Gate on all...")
# STUB: no real LLM agents are dispatched here yet.
print("[VECTOR][DEMO] Swarm dispatch is not implemented — no real LLM agents are run.")
print("[VECTOR][DEMO] (A live build would dispatch parallel agents here and gate the results.)")

def finalize_effect():
print("[MAXVAL] Optimal effect achieved. Intent vectors aligned.")
print("[MAXVAL] Branch cleanly merged. Continuous evolution cycle complete.")
print("[MAXVAL][DEMO] Simulated effect complete — no real optimization was performed and no branch was merged.")

if __name__ == "__main__":
if len(sys.argv) < 2:
Expand Down
19 changes: 11 additions & 8 deletions scripts/recursive_evolution.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#!/usr/bin/env python3
"""
Infinite Recursive Evolution Loop with Hardware Piping
Loops continuously until the derived feature checklist reaches "perfect" state.
Applies MaxVal/Effect/Intent vectors through Gated Evolution on each epoch.
Recursive Evolution Loop with Hardware Piping (DEMONSTRATION)

DEMO: this loops over feature_map.json and, each epoch, deterministically marks
one pending feature as 'tallied' until all are tallied. It does NOT run a real
LLM swarm or mutate code; trigger_evolution_gate() invokes the evolve.py stub.
The HardwarePipingManager leasing/GC is real; the "evolution" is simulated.
"""

import os
Expand Down Expand Up @@ -31,19 +34,19 @@ def trigger_evolution_gate(target_dir, hw_manager):
print(f" [HARDWARE] Requesting compute lease...")
if hw_manager.request_lease(cpu_req=1):
try:
print(f" [GATE] Lease granted. Engaging swarm for hypothesis mutation...")
print(" [GATE][DEMO] Lease granted. Running the evolve.py stub (no real swarm)...")
hw_manager.flush_vram() # VRAM time-slicing prep
subprocess.run([sys.executable, os.path.join(os.path.dirname(__file__), 'evolve.py'), target_dir], capture_output=True)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚖️ Poor tradeoff

Behavioral change contradicts PR objectives.

The PR objectives explicitly state "No behavioral or API changes" and "changes only strings, docstrings, and comments," but adding capture_output=True to subprocess.run() changes runtime behavior by suppressing the output from evolve.py that would otherwise be visible to the user. Previously, all output from the evolve.py script would flow directly to stdout/stderr; now it is captured and discarded.

🧰 Tools
🪛 Ruff (0.15.15)

[error] 39-39: subprocess call: check for execution of untrusted input

(S603)


[warning] 39-39: subprocess.run without explicit check argument

Add explicit check=False

(PLW1510)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/recursive_evolution.py` at line 39, The change in
recursive_evolution.py adds capture_output=True to the subprocess.run call that
invokes evolve.py (subprocess.run([... , target_dir], capture_output=True)),
which suppresses evolve.py's stdout/stderr and violates the "no behavioral
changes" requirement; revert this by removing the capture_output=True argument
(or set it to False) so subprocess.run forwards evolve.py's output to the parent
process as before, ensuring the call in recursive_evolution.py continues to run
evolve.py with visible stdout/stderr.

🧹 Nitpick | 🔵 Trivial | 💤 Low value

Add explicit check parameter to subprocess.run().

The call to subprocess.run() should include an explicit check=False parameter to clarify that non-zero exit codes are intentionally ignored, or add error handling if failures should be detected.

♻️ Proposed fix
-            subprocess.run([sys.executable, os.path.join(os.path.dirname(__file__), 'evolve.py'), target_dir], capture_output=True)
+            subprocess.run([sys.executable, os.path.join(os.path.dirname(__file__), 'evolve.py'), target_dir], capture_output=True, check=False)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
subprocess.run([sys.executable, os.path.join(os.path.dirname(__file__), 'evolve.py'), target_dir], capture_output=True)
subprocess.run([sys.executable, os.path.join(os.path.dirname(__file__), 'evolve.py'), target_dir], capture_output=True, check=False)
🧰 Tools
🪛 Ruff (0.15.15)

[error] 39-39: subprocess call: check for execution of untrusted input

(S603)


[warning] 39-39: subprocess.run without explicit check argument

Add explicit check=False

(PLW1510)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/recursive_evolution.py` at line 39, The subprocess.run call invoking
sys.executable with 'evolve.py' and target_dir should explicitly pass
check=False (i.e. subprocess.run([...], capture_output=True, check=False)) to
make it clear that non-zero exits are intentionally ignored, or alternatively
inspect the returned CompletedProcess (assign result = subprocess.run(...)) and
handle result.returncode/error output; update the call in the subprocess.run
invocation in recursive_evolution.py accordingly.

Source: Linters/SAST tools

finally:
hw_manager.flush_vram() # VRAM time-slicing cleanup
print(f" [HARDWARE] Releasing compute lease...")
Comment thread
coderabbitai[bot] marked this conversation as resolved.
hw_manager.release_lease(cpu_req=1)
else:
print(f" [HARDWARE] Lease denied (System fully utilized). Swarm mutation queued for next cycle.")
print(" [HARDWARE][DEMO] Lease denied (System fully utilized). Simulated mutation queued for next cycle.")

def infinite_evolution_loop(target_dir):
epoch = 0
print("[INIT] Booting Infinite Recursive Evolution Matrix...")
print("[INIT][DEMO] Booting the Evolution Matrix demonstration loop (deterministic tally; no real LLM swarm)...")
hw_manager = HardwarePipingManager()
print(f"[INIT] HardwarePipingManager active. Max bounded CPU units: {hw_manager.max_cpu}")

Expand All @@ -58,7 +61,7 @@ def infinite_evolution_loop(target_dir):

if is_perfect(checklist):
print("[PERFECT] Derived checklist is fully tallied. All features mapped and gated.")
print("[TERMINATE] Recursive evolution achieved absolute MaxVal. Halting loop.")
print("[TERMINATE][DEMO] Demonstration loop complete — all features tallied (no real MaxVal optimization performed).")
break

print("[STATE] Sub-optimal state detected. Deriving pending intents:")
Expand All @@ -74,7 +77,7 @@ def infinite_evolution_loop(target_dir):
for feat in checklist['features']:
if feat['status'] != 'tallied':
feat['status'] = 'tallied'
print(f" [MAXVAL] Evolution successful! Feature '{feat['name']}' tallied & mapped.")
print(f" [MAXVAL][DEMO] Simulated success: feature '{feat['name']}' marked 'tallied' (no real evolution performed).")
break

save_checklist(target_dir, checklist)
Expand Down
Loading