Files
memex/notes/org-skill-consensus.org

1.7 KiB

SKILL: Social Consensus Protocol (Universal Literate Note)

Overview

The Social Consensus Protocol enables multi-agent negotiation. It provides a Lisp-native implementation of decentralized agreement, allowing federated `org-agent` instances to coordinate on shared resources and conflicting goals.

Phase A: Demand (PRD)

1. Purpose

Enable reliable, cross-instance coordination without a central master.

2. User Needs

  • Resource Negotiation: Agree on which instance should handle a high-compute task.
  • Conflict Resolution: Settle divergent world-states during swarm execution.
  • Byzantine Fault Tolerance: Handle disconnected or misbehaving instances gracefully.

Phase D: Build (Implementation)

Consensus Algorithm (Simplified Raft)

(defun consensus-propose-vote (proposal)
  "Broadcasts a proposal to the peer swarm and collects votes.
   Implements PSF Social Consensus Protocol."
  (let* ((peers (get-swarm-peer-list))
         (votes (loop for peer in peers 
                      collect (org-agent:send-swarm-packet peer `(:type :REQUEST :action :vote :proposal ,proposal)))))
    (if (> (count :YES votes) (/ (length peers) 2))
        t ; Consensus reached
        nil)))

Registration

(defskill :skill-consensus
  :priority 85
  :trigger (lambda (context) (eq (getf (getf context :payload) :sensor) :conflict-detected))
  :neuro (lambda (context) "Formulate a consensus proposal for the peer swarm.")
  :symbolic (lambda (action context) action))