- Scheme 30.9%
- Lean 21.9%
- HTML 17.6%
- Tree-sitter Query 17.2%
- JavaScript 7.8%
- Other 4.6%
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> |
||
|---|---|---|
| .akku | ||
| cbcl-wasm-package | ||
| docs | ||
| examples | ||
| hoot@ee49cb0ac1 | ||
| IETF | ||
| lean-cbcl | ||
| llm-md | ||
| modelcontextprotocol@0695a497eb | ||
| simulation | ||
| src | ||
| tests | ||
| typescript-sdk@957060b7f4 | ||
| wasm-build | ||
| .gitignore | ||
| AGENT.md | ||
| Akku.lock | ||
| Akku.manifest | ||
| build-wasm.scm | ||
| cbcl-paper.pdf | ||
| CBCL_MCP_INTEGRATION_PLAN.md | ||
| dcfl-closure-plan.spl | ||
| fix-wasm-build.sh | ||
| hoot-setup.sh | ||
| lean-verification-plan.spl | ||
| LICENSE | ||
| Makefile | ||
| Makefile.wasm | ||
| minimal-build.scm | ||
| mock-wasm-build.scm | ||
| README-WASM.md | ||
| README.md | ||
| setup-hoot-env.sh | ||
| simple.wasm | ||
| SIMULATION_RESULTS.md | ||
| SIMULATION_USAGE.md | ||
| start-wasm-demo.sh | ||
| wasm-cbcl-wrapper.scm | ||
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:
- Self-extension at runtime through dialect definitions
- Peer-to-peer dialect propagation without trusted intermediaries
- Formal safety guarantees through DCFL-bounded parsing
- 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:
- Academic Paper: Complete theoretical framework with formal proofs
- Planning Dialect Walkthrough: Emergency supply coordination scenario
- Cross-chain Dialect Walkthrough: DeFi asset bridge scenario
- Artifacts Dialect Walkthrough: Scientific research collaboration scenario
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
References
- CBCL Paper Draft: "CBCL: A Self-Bootstrapping Agent-Communication Language with Provable Safety and Convergence Properties"
- GNU Guile: https://www.gnu.org/software/guile/
- SRFI specifications: https://srfi.schemers.org/
- Academic Walkthroughs: Planning, Cross-chain, Artifacts