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

46 lines
1.7 KiB
Org Mode

#+TITLE: SKILL: Social Consensus Protocol (Universal Literate Note)
#+ID: skill-consensus
#+STARTUP: content
#+FILETAGS: :distributed:swarms:consensus:psf:
#+DEPENDS_ON: skill-sub-agent-manager
* 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)
:PROPERTIES:
:STATUS: FROZEN
:END:
** 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)
#+begin_src lisp :tangle projects/org-skill-consensus/src/consensus-logic.lisp
(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)))
#+end_src
* Registration
#+begin_src lisp
(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))
#+end_src