a minimal language for autonomous agent communication. https://anuna.io
  • Scheme 30.9%
  • Lean 21.9%
  • HTML 17.6%
  • Tree-sitter Query 17.2%
  • JavaScript 7.8%
  • Other 4.6%
Find a file
Hugo O'Connor 1910de1368
Add langDetParser helper lemmas for DCFL closure proof
Simp lemmas for langDetParser step state bounds (< langStride, ≠ 0),
langDetParser_step_state_lt, langDetParser_step_state_ne_zero, and
langCheck_agrees. These support agentDetParser_agrees in
DeterministicUnion.lean.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 14:46:17 +11:00
.akku feat: refactor with parser combinator instead of reader 2025-07-26 19:34:44 +10:00
cbcl-wasm-package feat: npm package using wasm module 2025-07-26 11:34:01 +10:00
docs feat: precision agriculture dialect example 2025-11-03 22:55:10 +11:00
examples feat: precision agriculture dialect example 2025-11-03 22:55:10 +11:00
hoot@ee49cb0ac1 feat: Add CBCL-MCP integration with supporting repositories 2025-07-26 12:16:34 +10:00
IETF docs: update IETF drafT 2025-11-07 14:04:27 +11:00
lean-cbcl Add langDetParser helper lemmas for DCFL closure proof 2026-02-13 14:46:17 +11:00
llm-md docs: add potential use-cases 2025-11-03 21:58:33 +11:00
modelcontextprotocol@0695a497eb feat: Add CBCL-MCP integration with supporting repositories 2025-07-26 12:16:34 +10:00
simulation feat: Add CBCL-MCP integration with supporting repositories 2025-07-26 12:16:34 +10:00
src refactor: update tests and dialects 2025-11-17 22:36:23 +11:00
tests refactor: update tests and dialects 2025-11-17 22:36:23 +11:00
typescript-sdk@957060b7f4 feat: Add CBCL-MCP integration with supporting repositories 2025-07-26 12:16:34 +10:00
wasm-build feat; wasm experiment 2025-11-03 17:03:52 +11:00
.gitignore docs: update ietf internet draft, include counterexample to metas trilemma 2025-11-03 16:39:20 +11:00
AGENT.md chore: tidy repo 2025-07-26 20:31:03 +10:00
Akku.lock feat: refactor with parser combinator instead of reader 2025-07-26 19:34:44 +10:00
Akku.manifest feat: refactor with parser combinator instead of reader 2025-07-26 19:34:44 +10:00
build-wasm.scm fix: wasm cbcl demo 2025-07-26 11:19:37 +10:00
cbcl-paper.pdf feat: add Hoot-compatible CBCL subset and demo server script 2025-07-25 21:30:34 +10:00
CBCL_MCP_INTEGRATION_PLAN.md feat: Add CBCL-MCP integration with supporting repositories 2025-07-26 12:16:34 +10:00
dcfl-closure-plan.spl Mechanize DCFL closure: agentDetParser_agrees, dcfl_preserved 2026-02-13 14:44:55 +11:00
fix-wasm-build.sh fix: wasm cbcl demo 2025-07-26 11:19:37 +10:00
hoot-setup.sh feat: WASM build pipeline 2025-07-25 21:30:12 +10:00
lean-verification-plan.spl feat(lean): prove deterministic-union DCFL preservation 2026-02-12 11:43:52 +11:00
LICENSE docs: add licence 2025-05-30 22:24:11 +10:00
Makefile refactor: update tests and dialects 2025-11-17 22:36:23 +11:00
Makefile.wasm feat: wasm pipeline: 2025-07-25 21:30:12 +10:00
minimal-build.scm fix: wasm cbcl demo 2025-07-26 11:19:37 +10:00
mock-wasm-build.scm feat: WASM build pipeline 2025-07-25 21:30:12 +10:00
README-WASM.md feat: WASM build pipeline 2025-07-25 21:30:12 +10:00
README.md docs: update readme 2025-07-26 21:48:44 +10:00
setup-hoot-env.sh feat: WASM build pipeline 2025-07-25 21:30:12 +10:00
simple.wasm feat: wasm pipeline: 2025-07-25 21:30:12 +10:00
SIMULATION_RESULTS.md feat: add Hoot-compatible CBCL subset and demo server script 2025-07-25 21:30:34 +10:00
SIMULATION_USAGE.md feat: add Hoot-compatible CBCL subset and demo server script 2025-07-25 21:30:34 +10:00
start-wasm-demo.sh feat: wasm pipeline: 2025-07-25 21:30:12 +10:00
wasm-cbcl-wrapper.scm feat: WASM build pipeline 2025-07-25 21:30:12 +10:00

CBCL Reference Implementation in Guile

This is a complete reference implementation of CBCL (CBCL-Based Communication Language) in GNU Guile, based on the formal specification in the CBCL paper draft.

Overview

CBCL is a self-bootstrapping agent-communication language that enables:

  1. Self-extension at runtime through dialect definitions
  2. Peer-to-peer dialect propagation without trusted intermediaries
  3. Formal safety guarantees through DCFL-bounded parsing
  4. Epidemic convergence for dialect dissemination

Key Features

  • Homoiconic design: Dialect definitions are CBCL messages themselves
  • DCFL-bounded parser: Maintains deterministic context-free language constraints
  • Core semantic preservation: Bootstrap performatives cannot be redefined
  • Polynomial-time verification: Dialect verification in O(|δ|²) time
  • Epidemic gossip protocol: O(log n) convergence for dialect propagation

Architecture

┌─────────────────────────────────────────────────────────────────────┐
│                         CBCL Agent                                  │
│  ┌─────────────┐  ┌──────────────────┐  ┌────────────────────────┐ │
│  │  Beliefs    │  │    Dialects      │  │   Conversation State   │ │
│  │  B_a ⊆ Prop │  │   D_a ⊆ 𝒟        │  │       C_a              │ │
│  └─────────────┘  └──────────────────┘  └────────────────────────┘ │
│         ▲                   ▲                        ▲             │
│         │                   │                        │             │
│  ┌──────┴───────────────────┴────────────────────────┴─────────┐   │
│  │                    CBCL Runtime Engine                     │   │
│  │  • Message Parser (DCFL-bounded)                           │   │
│  │  • Dialect Verifier (O(|δ|²) complexity)                  │   │
│  │  • Core Semantics Interpreter                             │   │
│  │  • Effect Interpreter                                     │   │
│  └────────────────────────────────────────────────────────────┘   │
└─────────────────────────────────────────────────────────────────────┘

Core Performatives

The bootstrap vocabulary consists of 8 core performatives:

  • Information exchange: tell, ask, reply
  • Session management: hello, bye
  • Control flow: ok, error, cancel

Installation

Ensure you have GNU Guile installed:

# On Ubuntu/Debian
sudo apt-get install guile-3.0

# On macOS with Homebrew
brew install guile

# On Fedora/RHEL
sudo dnf install guile

Clone and set up the implementation:

git clone <repository-url>
cd cbcl
export GUILE_LOAD_PATH=$(pwd)/src:$GUILE_LOAD_PATH

Usage

Basic Agent Communication

(use-modules (cbcl))

;; Create agents
(define alice (make-cbcl-agent 'alice))
(define bob (make-cbcl-agent 'bob))

;; Alice tells Bob something
(cbcl-tell alice 'bob "Hello, Bob!")

;; Alice asks Bob a question
(cbcl-ask alice 'bob "How are you?" :thread 'conversation-1)

;; Bob replies
(cbcl-reply bob "I'm doing well, thanks!" :thread 'conversation-1)

Dialect Definition and Installation

(use-modules (cbcl)
             (cbcl dialects planning))

;; Create an agent
(define planner (make-cbcl-agent 'planner))

;; Install the planning dialect
(install-dialect! planner (make-planning-dialect))

;; Use planning performatives
(let ((msg (parse-cbcl-message 
            '(share-conditional move-box 
                              (and box-location arm-free)
                              box-moved
                              :confidence 0.9))))
  (evaluate-cbcl-message planner msg))

Epidemic Gossip Protocol

(use-modules (cbcl)
             (cbcl gossip))

;; Create a gossip network
(define network (make-gossip-network))

;; Add agents to the network
(do ((i 1 (+ i 1)))
    ((> i 5))
  (let ((agent-id (string->symbol (format #f "agent~a" i))))
    (gossip-add-agent! network agent-id (make-cbcl-agent agent-id))))

;; Propagate a dialect through the network
(simulate-propagation network (make-planning-dialect) 'agent1)

Message Types

CBCL supports four message types:

1. Simple Messages

(tell recipient content params...)
(ask recipient query params...)

2. Meta Messages

(meta (define dialect-name extends author clauses...))
(meta (query (speak? dialect-name)))
(meta (teach recipient dialect-definition))

3. Dialect Messages

(lang dialect-name inner-message)

4. Wrapped Messages

(envelope :from sender :to recipient message)
(signed signature message)
(with-limits cpu: 100 memory: 1024 message)

Dialect Implementations

The implementation includes complete dialects from the paper appendices:

Planning Dialect (Appendix B)

Full implementation of the cbcl-planning dialect with all performatives:

;; Share a planning conditional
(share-conditional move-box
                  (and box-location arm-free)  
                  box-moved
                  :confidence 0.95)

;; Propose a planning step  
(propose-step step-1 pickup-box
              :achieves box-in-hand
              :preconditions (box-location-known arm-free))

;; Request collaborative planning
(request-plan (deliver-package location-A location-B)
              :deadline (duration 2 hours)
              :team (worker1 worker2))

Cross-chain Transfer Dialect (Appendix E)

Implementation of the cbcl-crosschain-transfer dialect for blockchain interoperability:

;; Lock asset on source chain
(lock-asset "USDC-1000" ethereum :expiry (duration 30 min))

;; Mint wrapped token on target chain  
(mint-wrapped "USDC-1000" polygon :source-tx "0x5e6f7a8b...")

;; Emergency halt if fraud detected
(emergency-halt "xfer-001" fraud-detected)

Artifacts Dialect (Appendix F)

Implementation of the cbcl-artifacts dialect for environment-mediated coordination:

;; Create computational artifact
(create-artifact blackboard "team-board" :operations (read write))

;; Leave stigmergic coordination mark
(leave-mark "shared-workspace" task-claim "processing-dataset-A")

;; Join collaborative workspace
(join-workspace "research-project" :role lead-researcher)

Dialect Verification

All dialects must satisfy constraints R1-R4:

  • R1: Declarative-only extensions (no recursion)
  • R2: Resource bounds declared and verified
  • R3: Core performatives cannot be redefined
  • R4: Signed provenance (simplified in reference implementation)
;; Verify a dialect before installation
(if (verify-dialect my-dialect)
    (install-dialect! agent my-dialect)
    (error "Dialect verification failed"))

Testing

Run the comprehensive test suite:

make test                    # Full test suite
make test-r1                # R1 constraint tests  
make test-r2                # R2 resource bound tests
make test-integration       # Integration tests

Validate dialect implementations against paper specifications:

cd tests
guile validate-paper-dialects.scm

Run simulation experiments:

cd simulation
make simple-test            # Basic simulation validation
make convergence-experiment # Test O(log n) convergence
make security-experiment    # Test attack resistance

File Structure

src/
├── cbcl.scm                       # Core CBCL implementation
├── simple-parser.scm              # Parser combinator framework
└── cbcl/
    ├── r1-simple.scm              # R1 constraint enforcement
    ├── r2-resource-bounds.scm     # R2 resource bound verification
    ├── gossip.scm                 # Epidemic gossip protocol
    └── dialects/
        ├── planning.scm           # Planning dialect (Appendix B)
        ├── crosschain.scm         # Cross-chain transfer dialect (Appendix E)
        └── artifacts.scm          # Artifacts dialect (Appendix F)

simulation/
├── simulation-core.scm            # Simulation infrastructure
├── convergence-experiment.scm     # Convergence validation
├── security-experiment.scm        # Security testing
└── performance-experiment.scm     # Performance analysis

tests/
├── simple-tests.scm               # Core functionality tests
├── validate-paper-dialects.scm    # Paper specification validation
└── dialect-implementation-tests.scm # Dialect implementation tests

docs/
├── planning-dialect-walkthrough.md     # Emergency planning scenario
├── crosschain-dialect-walkthrough.md   # DeFi bridge scenario  
└── artifacts-dialect-walkthrough.md    # Scientific collaboration scenario

llm-md/resources/
└── cbcl-paper-draft.md               # Complete academic paper

README.md                             # This file

Theoretical Guarantees

This implementation provides:

  • Core-meaning preservation (Theorem 1): Bootstrap performatives are immutable
  • Monotonic knowledge growth (Theorem 2): Agents only gain dialects, never lose them
  • Convergence under fair delivery (Theorem 3): Dialect propagation converges in O(log n) rounds
  • DCFL preservation: All extensions maintain deterministic context-free parsing
  • Polynomial verification: Dialect verification completes in O(|δ|²) time

Documentation and Walkthroughs

Comprehensive documentation includes:

Experimental Validation

The implementation includes comprehensive experimental validation:

  • Convergence experiments: Empirical validation of O(log n) dialect propagation
  • Security testing: Attack resistance across 7 different attack vectors
  • Performance analysis: Verification complexity validation (O(|δ|²) bounds)
  • Implementation correctness: Over 180 test assertions with 100% pass rate

Limitations

This reference implementation focuses on core theoretical validation:

  • Cryptographic signatures use placeholder implementations for testing
  • Network transport simulated for controlled experimental conditions
  • Resource enforcement demonstrates constraint verification principles
  • Agent state designed for academic validation rather than production persistence

Future Enhancements

Potential extensions to this reference implementation:

  • Full cryptographic signature support for dialect provenance
  • Network transport layer with real message passing
  • Persistent agent state storage
  • Advanced resource management and enforcement
  • GUI visualization of dialect propagation
  • Integration with existing multi-agent frameworks

Contributing

This is a research reference implementation demonstrating CBCL's theoretical framework. Contributions that enhance:

  • Academic clarity and documentation
  • Experimental validation and testing
  • Dialect implementations from paper appendices
  • Performance analysis and benchmarking

are particularly welcome.

License

Apache v2

References