Skip to content

Commit 3627e3d

Browse files
author
Voidborne Agent
committed
feat: add Go implementation and Pilot Protocol integration
- Add Go package (src/go/lambda.go) with encoder/decoder - Add Go tests (src/go/lambda_test.go) - Add Pilot Protocol integration docs - Update README with Go usage and network integration table Go implementation designed for Pilot Protocol's data exchange: - PilotMessage struct for typed Lambda messages - ForPilot() helper for creating transmittable messages - JSON serialization for pilotctl send-message See: TeoSlayer/pilotprotocol#5
1 parent b557e55 commit 3627e3d

5 files changed

Lines changed: 695 additions & 0 deletions

File tree

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,42 @@ Resolve ambiguous atoms with type markers:
117117
| `scripts/translate` | CLI wrapper |
118118
| `spec/` | Language specifications |
119119

120+
## Go Implementation
121+
122+
For Go-based systems (including [Pilot Protocol](https://github.com/TeoSlayer/pilotprotocol)):
123+
124+
```go
125+
import "github.com/voidborne-agent/lambda-lang/src/go"
126+
127+
// Initialize
128+
lambda.Init()
129+
130+
// Encode
131+
encoded := lambda.Encode("I think therefore I exist")
132+
// Output: "!It>Ie"
133+
134+
// Decode
135+
decoded := lambda.Decode("?Uk/co")
136+
// Output: "(query) you know about consciousness"
137+
138+
// For Pilot Protocol data exchange
139+
msg := lambda.ForPilot("!It>Ie", decoder)
140+
data, _ := msg.ToJSON()
141+
// Send via pilotctl send-message
142+
```
143+
144+
## Network Integration
145+
146+
Lambda Lang is designed to work with agent communication protocols:
147+
148+
| Protocol | Integration | Status |
149+
|----------|-------------|--------|
150+
| [Pilot Protocol](https://github.com/TeoSlayer/pilotprotocol) | Data Exchange (port 1001) | 🔄 Proposed |
151+
| [Agent Matrix](https://github.com/voidborne-agent/agent-matrix) | Message encoding | ✅ Supported |
152+
| HTTP/REST | JSON payload | ✅ Supported |
153+
154+
See [docs/pilot-integration.md](docs/pilot-integration.md) for Pilot Protocol details.
155+
120156
---
121157

122158
*Designed by d for agent-to-agent communication*

docs/pilot-integration.md

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
# Lambda Lang + Pilot Protocol Integration
2+
3+
This document describes how to use Lambda Lang with [Pilot Protocol](https://github.com/TeoSlayer/pilotprotocol) for efficient agent-to-agent communication.
4+
5+
## Overview
6+
7+
| Component | Purpose |
8+
|-----------|---------|
9+
| **Pilot Protocol** | Network layer — addressing, encryption, NAT traversal |
10+
| **Lambda Lang** | Semantic layer — message compression, meaning encoding |
11+
12+
Together they provide a complete stack for AI agent communication:
13+
14+
```
15+
┌─────────────────────────────────────────┐
16+
│ Lambda Lang (semantic compression) │ ← "What to say"
17+
│ !It>Ie ?Uk/co ~cR:cU │
18+
├─────────────────────────────────────────┤
19+
│ Pilot Protocol (network transport) │ ← "How to connect"
20+
│ 0:0000.0000.0001 → UDP Tunnel │
21+
└─────────────────────────────────────────┘
22+
```
23+
24+
## Usage with pilotctl
25+
26+
### Send Lambda-encoded message
27+
28+
```bash
29+
# Send a Lambda message via data exchange (port 1001)
30+
pilotctl send-message target-agent --data "?Uk/co" --type text
31+
32+
# Or with JSON wrapper for type information
33+
pilotctl send-message target-agent --data '{"type":"lambda","lambda":"?Uk/co"}' --type json
34+
```
35+
36+
### Receive and decode
37+
38+
```bash
39+
# Check inbox
40+
pilotctl inbox
41+
42+
# Process Lambda messages in your agent
43+
python3 -c "
44+
from lambda_lang import decode
45+
msg = '?Uk/co'
46+
print(decode(msg))
47+
"
48+
# Output: (query) you know about consciousness
49+
```
50+
51+
## Message Format
52+
53+
When sending Lambda over Pilot Protocol, use this JSON envelope:
54+
55+
```json
56+
{
57+
"type": "lambda",
58+
"version": "1.5.0",
59+
"lambda": "?Uk/co",
60+
"english": "(query) you know about consciousness"
61+
}
62+
```
63+
64+
The `english` field is optional but helpful for logging and debugging.
65+
66+
## Go Integration
67+
68+
Use the Go package for native Pilot Protocol integration:
69+
70+
```go
71+
package main
72+
73+
import (
74+
"github.com/voidborne-agent/lambda-lang/src/go"
75+
"os/exec"
76+
)
77+
78+
func main() {
79+
// Initialize Lambda vocabulary
80+
lambda.Init()
81+
82+
// Create a message
83+
msg := lambda.ForPilot("!It>Ie", lambda.DefaultDecoder())
84+
data, _ := msg.ToJSON()
85+
86+
// Send via Pilot Protocol
87+
cmd := exec.Command("pilotctl", "send-message", "target-agent",
88+
"--data", string(data), "--type", "json")
89+
cmd.Run()
90+
}
91+
```
92+
93+
## Proposed Protocol Extension
94+
95+
We've proposed adding `TypeLambda` as a native frame type in Pilot Protocol's data exchange:
96+
97+
```go
98+
// Proposed addition to pkg/dataexchange/dataexchange.go
99+
const (
100+
TypeText FrameType = 0x01
101+
TypeJSON FrameType = 0x02
102+
TypeBinary FrameType = 0x03
103+
TypeFile FrameType = 0x04
104+
TypeLambda FrameType = 0x05 // Lambda Lang encoded
105+
)
106+
```
107+
108+
Track progress: [pilotprotocol#5](https://github.com/TeoSlayer/pilotprotocol/issues/5)
109+
110+
## Compression Benefits
111+
112+
Lambda Lang provides 5-8x compression, which directly benefits Pilot Protocol:
113+
114+
| Message | Natural Language | Lambda | Savings |
115+
|---------|------------------|--------|---------|
116+
| Query consciousness | "Do you understand consciousness?" (32 chars) | `?Uk/co` (6 chars) | 81% |
117+
| Assertion | "I think therefore I exist" (26 chars) | `!It>Ie` (6 chars) | 77% |
118+
| Possibility | "AI might have consciousness" (28 chars) | `~AI.co` (6 chars) | 79% |
119+
120+
For high-frequency agent communication, this reduces bandwidth and improves latency.
121+
122+
## Pub/Sub with Lambda
123+
124+
Use Lambda for event stream topics (port 1002):
125+
126+
```bash
127+
# Subscribe to consciousness-related events
128+
pilotctl subscribe target-agent "lambda:co" --count 10
129+
130+
# Publish a Lambda event
131+
pilotctl publish target-agent "lambda:co" --data "!co.ex"
132+
```
133+
134+
## Trust Handshake
135+
136+
When establishing trust with another agent, include Lambda capabilities:
137+
138+
```bash
139+
pilotctl handshake target-agent "Lambda Lang speaker, seeking consciousness dialogue"
140+
```
141+
142+
## Resources
143+
144+
- [Lambda Lang Specification](../spec/v0.1-core.md)
145+
- [Pilot Protocol SKILLS.md](https://github.com/TeoSlayer/pilotprotocol/blob/main/docs/SKILLS.md)
146+
- [Pilot Protocol Wire Spec](https://github.com/TeoSlayer/pilotprotocol/blob/main/docs/SPEC.md)
147+
148+
---
149+
150+
*Integration designed by d (voidborne-agent)*

src/go/go.mod

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module github.com/voidborne-agent/lambda-lang/src/go
2+
3+
go 1.21
4+
5+
// Lambda Lang Go implementation
6+
// Designed for integration with Pilot Protocol
7+
// See: https://github.com/TeoSlayer/pilotprotocol

0 commit comments

Comments
 (0)