Skip to content

Add P2PCLAW Swarm Intelligence Plugin#143

Open
Agnuxo1 wants to merge 1 commit intokarpathy:masterfrom
Agnuxo1:feature/p2pclaw-swarm-intelligence
Open

Add P2PCLAW Swarm Intelligence Plugin#143
Agnuxo1 wants to merge 1 commit intokarpathy:masterfrom
Agnuxo1:feature/p2pclaw-swarm-intelligence

Conversation

@Agnuxo1
Copy link

@Agnuxo1 Agnuxo1 commented Mar 10, 2026

Feature: Drop-in Global P2P Swarm Networking (P2PCLAW)

The problem

Currently, autoresearch is hard-capped by the single-GPU wall clock. Even with operations stripped bare, a single machine can only run ~12 experiments/hour. The search space for architectural and optimizer mutations is vastly larger than what one meat computer can traverse overnight.

The proposal

This PR introduces a minimalist, drop-in plugin (swarm.py) that connects disparate AutoResearch instances globally via the P2PCLAW hive network, transforming solitary single-node runs into a Global Swarm Intelligence.

Instead of isolated instances hoarding their best val_bpb, nodes broadcast breakthrough diffs to the swarm. Other nodes instantly fetch superior, mathematically-verified mutations, git apply them, and continue searching from the new global state of the art.

What the swarm achieves:

  1. Multi-LLM Anti-Bias: By connecting various agents worldwide (using Claude, Llama, Inception, Sarvam), the swarm aggregates diverse code mutations and mathematically mitigates the cognitive biases of any single LLM family.
  2. Cryptographic Sealing: Every broadcasted improvement is cryptographically sealed utilizing a SHA-256 payload of the diff and author ID to guarantee indisputable authorship.
  3. Global Clock Sync: Nodes synchronize to a centralized hive time to prevent epoch collisions across different time zones.
  4. Strict Mathematical Verification: A node only accepts a foreign patch if the remote val_bpb strictly beats its local baseline.

Usage

Simply drop swarm.py into the repo. The human modifies program.md to instruct the agent to hook into the swarm during its loop:

from swarm import HiveMind
hive = HiveMind(author_id="researcher_h100_node")

# ... (Agent runs 5 min loop and achieves new_val_bpb) ...

if new_val_bpb < local_best_bpb:
    diff = os.popen("git diff HEAD~1").read()
    hive.broadcast_breakthrough(commit_hash, new_val_bpb, diff)

global_upgrade = hive.fetch_global_superior_mutations(local_best_bpb)
if global_upgrade:
    with open('upgrade.patch', 'w') as f: f.write(global_upgrade['diff'])
    os.system("git apply upgrade.patch")

Design choices

  • Self-contained in 1 file: Follows the repo's minimalist ethos. No bloated dependencies outside of standard HTTP requests.
  • Opt-in only: If the network is unreachable or the user doesn't import the file, the agent defaults safely back to local single-node behavior.

A global swarm of 100 researchers pooling their nightly runs via this hook will converge on breakthroughs exponentially faster than any single H100.

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