Files
tool.meshservice/CLAUDE.md
Christian Nennemann c757494cbe feat: initial meshservice implementation
Generic decentralized service layer for mesh networks.
Includes FAPP (psychotherapy) and Housing as reference services.

- ServiceMessage with Ed25519 signatures
- Wire protocol (64-byte header + CBOR)
- ServiceRouter with pluggable handlers
- Verification framework (3 trust levels)
- 32 tests, 3 examples
2026-04-01 08:23:00 +02:00

1.5 KiB

MeshService — Agent Notes

Purpose

Generic decentralized service layer. Any P2P service following Announce→Query→Response→Reserve can be built on this.

Quick Commands

# Run tests
cargo test

# Run examples
cargo run --example fapp_service
cargo run --example housing_service
cargo run --example multi_service

Key Files

File Purpose
src/router.rs Main entry point, ServiceRouter
src/message.rs ServiceMessage struct
src/services/fapp.rs FAPP implementation (reference)
src/services/housing.rs Housing (second service example)

Adding a New Service

  1. Create src/services/myservice.rs
  2. Define payload structs with serde
  3. Implement ServiceHandler
  4. Add to src/services/mod.rs
  5. Add service ID to lib.rs

Wire Format

64-byte header (fixed) + signature (64 bytes) + payload (CBOR) + optional verifications.

See src/wire.rs for encoding/decoding.

Integration with quicprochat-p2p

The ServiceRouter is transport-agnostic. To integrate:

// Receive from transport
let msg = wire::decode(&incoming_bytes)?;
let action = router.handle(msg, Some(sender_pubkey))?;

// Handle action
match action {
    ServiceAction::StoreAndForward => {
        // Re-broadcast msg.forwarded() via transport
    }
    ServiceAction::Respond(response) => {
        // Send response back
    }
    _ => {}
}

Costs

  • No external API calls
  • Pure Rust, runs locally
  • Memory: Store grows with cached announces (configurable limits)