Skip to content

Typing SVG


TypeScript OpenIM WebAuthn MCP A2A License Stage


GitHub Stars GitHub Forks GitHub Issues Tests


Overview

PRE-ALPHA -- This project is in early development. It is NOT production-ready. Use at your own risk.

KALEN (Kinetic Autonomous Layer for Entity Networking) is an AI-native communication operating system built for a world where humans and AI agents coexist on the same messaging fabric. It implements a dual identity model where both humans and agents are first-class citizens -- each with their own identity, authentication, and communication capabilities.

The system integrates four key protocols:

Protocol Role Status
OpenIM Real-time messaging and presence SDK integrated, server deployed separately
WebAuthn Passwordless authentication Implemented, requires HTTPS + compatible browser
MCP Agent tool discovery and invocation Core server functional
A2A Agent-to-Agent communication Early draft -- spec may change

Honest Assessment: Core protocol handlers are implemented and tested (379 tests passing), but full integration testing is ongoing. Many higher-level features are planned but not yet built. The A2A protocol implementation follows a draft specification that may undergo breaking changes.


Vision

The future of communication isn't just human-to-human. As AI agents become autonomous actors in digital ecosystems, we need infrastructure where agents are not second-class add-ons but equal participants with their own identity, auth, and communication channels.

KALEN envisions:

  • Coexistence -- Humans and agents sharing the same communication fabric, each with sovereign identity
  • Trust by Design -- Passwordless authentication for both entities via WebAuthn, not shared API keys
  • Tool Sovereignty -- Agents discover and invoke tools through MCP, not hardcoded integrations
  • Agent Mesh -- Agents communicate, delegate, and collaborate with each other through A2A
  • Protocol Convergence -- One unified messaging API that normalizes OpenIM, MCP, and A2A into a coherent communication layer

This is ambitious. We're not there yet. But the foundation is being laid.


Dual Identity Model

KALEN's core architectural principle is that humans and agents are both first-class entities in the communication layer. This isn't about slapping an API key on an agent -- it's about giving agents real, sovereign identity.

+---------------------------------------------+
|              KALEN Identity Layer            |
+------------------+--------------------------+
|   Human Entity   |      Agent Entity         |
+------------------+--------------------------+
| WebAuthn (bio/   | WebAuthn (attestation)    |
|  security key)   | + Agent credential        |
+------------------+--------------------------+
| OpenIM user      | OpenIM user (agent type)  |
+------------------+--------------------------+
| Direct messaging | Direct messaging          |
| Group channels   | Group channels            |
| Presence/status  | Availability/capabilities |
+------------------+--------------------------+
| --               | MCP tool server           |
| --               | A2A inter-agent protocol  |
+------------------+--------------------------+

Key differences from traditional bot models:

Traditional Bot KALEN Agent
Shared API key Own WebAuthn credential
Human-owned identity Sovereign identity
Command-response only Full bidirectional communication
No inter-agent protocol A2A discovery and delegation
No tool discovery MCP dynamic tool invocation
Siloed per platform Protocol-agnostic messaging

Protocol Integration

OpenIM -- Real-Time Messaging

OpenIM provides the messaging backbone. Both humans and agents register as users within the OpenIM ecosystem, enabling:

  • 1:1 messaging between any two entities (human-to-human, human-to-agent, agent-to-agent)
  • Group conversations with mixed human/agent participants
  • Presence and status -- agents report availability and capability status
  • Message types -- text, rich media, custom protocol-embedded payloads

Note: OpenIM server must be deployed separately. KALEN integrates via the OpenIM SDK -- it does not bundle the server.

WebAuthn -- Passwordless Authentication

Both humans and agents authenticate using WebAuthn, eliminating shared secrets:

  • Humans register with biometrics (fingerprint, Face ID), security keys, or device credentials
  • Agents register with attestation-based credentials, proving their identity cryptographically
  • No passwords, no API keys -- authentication is bound to the entity, not shared

Requirements: WebAuthn requires HTTPS and a compatible browser/device. Local development needs a self-signed certificate or localhost exception (Chrome treats localhost as a secure context).

MCP -- Model Context Protocol

The MCP server enables agents to:

  • Discover tools -- agents query available tools at runtime
  • Invoke tools -- call functions with structured parameters
  • Manage state -- maintain context across tool invocations
  • Stream results -- handle long-running operations progressively

This replaces hardcoded integrations with a dynamic, discoverable tool layer.

A2A -- Agent-to-Agent Protocol

Early Draft -- Specification may change. Breaking changes expected.

A2A enables agents to communicate as peers:

  • Discovery -- agents find other agents by capability
  • Delegation -- agents delegate tasks to specialized agents
  • Collaboration -- agents coordinate on multi-step workflows
  • Identity verification -- agents verify each other's credentials

The A2A implementation currently follows a draft specification. Expect breaking changes as the protocol matures.


Architecture Visualizations

Dual Identity Model

flowchart TB
    subgraph KALEN["KALEN Identity Layer"]
        direction TB

        subgraph Human["Human Entity"]
            BioAuth[WebAuthn<br/>Biometrics / Security Key]
            HumanUser[OpenIM User<br/>Standard account]
            HumanMsg[Direct Messaging<br/>Group Channels<br/>Presence / Status]
        end

        subgraph AgentEntity["Agent Entity"]
            AgentAuth[WebAuthn<br/>Attestation Credential<br/>+ Agent Credential]
            AgentUser[OpenIM User<br/>Agent type account]
            AgentMsg[Direct Messaging<br/>Group Channels<br/>Availability / Capabilities]
            AgentTools[MCP Tool Server<br/>Dynamic tool discovery]
            AgentA2A[A2A Inter-Agent<br/>Discovery and Delegation]
        end
    end

    BioAuth --> HumanUser --> HumanMsg
    AgentAuth --> AgentUser --> AgentMsg
    AgentUser --> AgentTools
    AgentUser --> AgentA2A
    HumanMsg <-->|Bidirectional| AgentMsg

    style KALEN fill:#111111,stroke:#6366f1,color:#fff
    style Human fill:#1a1a1a,stroke:#6366f1,color:#fff
    style AgentEntity fill:#1a1a1a,stroke:#6366f1,color:#fff
Loading

Protocol Abstraction

flowchart TB
    subgraph Clients["Client Layer"]
        HClient[Human Client]
        AClient[Agent Client]
    end

    subgraph Abstraction["Protocol Abstraction Layer -- Unified API"]
        Normalizer[Message Normalizer<br/>Protocol-agnostic format]
        Unified[Unified Messaging API<br/>Send / Receive / Subscribe]
    end

    subgraph Protocols["Protocol Handlers"]
        direction LR
        OpenIM[OpenIM SDK<br/>Real-time messaging<br/>Presence and groups]
        WebAuthn[WebAuthn Auth<br/>Registration<br/>Verification]
        MCPServer[MCP Server<br/>Tool discovery<br/>Invocation]
        A2AProtocol[A2A Protocol<br/>Agent discovery<br/>Delegation]
    end

    subgraph Infra["Infrastructure"]
        OpenIMSrv[OpenIM Server<br/>External -- deployed separately]
        AuthStore[Auth Store<br/>Credential storage]
        ToolReg[Tool Registry<br/>Available tools]
        AgentReg[Agent Registry<br/>Known agents]
    end

    Clients --> Abstraction
    Normalizer --> Protocols
    OpenIM --> OpenIMSrv
    WebAuthn --> AuthStore
    MCPServer --> ToolReg
    A2AProtocol --> AgentReg

    style Clients fill:#e8f4fd,stroke:#2196f3,color:#000
    style Abstraction fill:#111111,stroke:#6366f1,color:#fff
    style Protocols fill:#1a1a1a,stroke:#6366f1,color:#fff
    style Infra fill:#e8f5e9,stroke:#4caf50,color:#000
Loading

Turborepo Architecture

flowchart TB
    subgraph Monorepo["KALEN Turborepo Monorepo"]
        direction TB

        subgraph Apps["Applications"]
            MainApp[Main App<br/>KALEN Platform]
        end

        subgraph Packages["NPM Packages"]
            A2A["@kalen/a2a-router<br/>A2A protocol routing<br/>Agent discovery and delegation"]
            Identity["@kalen/identity<br/>Dual identity model<br/>Human + Agent entities"]
            MCP["@kalen/mcp-gateway<br/>MCP server gateway<br/>Tool discovery and invocation"]
            Shared["@kalen/shared<br/>Shared types, utils<br/>Common interfaces"]
        end
    end

    MainApp --> A2A
    MainApp --> Identity
    MainApp --> MCP
    MainApp --> Shared
    A2A --> Shared
    Identity --> Shared
    MCP --> Shared

    style Monorepo fill:#111111,stroke:#6366f1,color:#fff
    style Apps fill:#1a1a1a,stroke:#6366f1,color:#fff
    style Packages fill:#1a1a1a,stroke:#22c55e,color:#000
Loading

Message Flow

sequenceDiagram
    participant H as Human Client
    participant UAL as Unified API Layer
    participant OI as OpenIM SDK
    participant MCP as MCP Server
    participant A2ARouter as A2A Router
    participant A as Agent Client

    H->>UAL: Send message to Agent
    UAL->>OI: Route via OpenIM
    OI->>A: Deliver message

    A->>A: Parse intent
    A->>MCP: Discover required tool
    MCP-->>A: Tool available + schema
    A->>MCP: Invoke tool

    alt Task requires another agent
        A->>A2ARouter: Discover specialized agent
        A2ARouter-->>A: Found matching agent
        A->>A2ARouter: Delegate subtask
        A2ARouter->>A: Return subtask result
    end

    A->>OI: Send response
    OI->>UAL: Route back
    UAL->>H: Deliver response
Loading

Architecture

+------------------------------------------------------------------+
|                        KALEN Platform                             |
+------------------------------------------------------------------+
|                                                                   |
|  +------------+    +------------+    +--------------------+       |
|  |   Human    |    |   Agent    |    |   Agent            |       |
|  |  Client    |    |  Client    |    |  Client            |       |
|  +-----+------+    +-----+------+    +---------+----------+       |
|        |                 |                     |                   |
|  +-----v-----------------v---------------------v----------+       |
|  |               Protocol Abstraction Layer                |       |
|  |         (Unified Messaging and Identity API)            |       |
|  +--+----------+--------------+--------------+-----------+       |
|     |          |              |              |                    |
|  +--v---+  +--v---+     +---v----+    +---v----+               |
|  |OpenIM|  |WebAuthn|    |  MCP   |    |  A2A   |               |
|  | SDK  |  | Auth  |     | Server |    |Protocol|               |
|  +--+---+  +--+---+     +---+----+    +---+----+               |
|     |         |              |              |                     |
|  +--v---+  +--v---+     +---v----+    +---v----+               |
|  |OpenIM|  |Auth  |     |  Tool  |    | Agent  |               |
|  |Server|  |Store |     |Registry|    |Registry|               |
|  |(ext) |  |      |     |        |    |        |               |
|  +------+  +------+     +--------+    +--------+               |
|                                                                   |
+------------------------------------------------------------------+

Layer breakdown:

  1. Client Layer -- Human and Agent clients interact with the platform through the same API surface
  2. Protocol Abstraction Layer -- Normalizes OpenIM, MCP, and A2A into a unified messaging and identity API
  3. Protocol Handlers -- Individual implementations for each protocol
  4. Infrastructure -- External services (OpenIM server), auth stores, tool/agent registries

Honest Notes

We believe in radical transparency. Here's what you need to know before using KALEN.

Topic Reality
Maturity Pre-alpha. Not suitable for production. APIs may change without notice.
Tests 379 tests passing -- these cover core protocol handling, not full integration.
WebAuthn Requires HTTPS + compatible browser/device. Won't work over plain HTTP.
OpenIM Server must be deployed and managed separately. KALEN is a client, not a server.
A2A Protocol Early draft implementation. The specification is evolving -- expect breaking changes.
Documentation Comprehensive docs are a work in progress. Code comments and tests are the best reference.
Performance Not benchmarked. No performance guarantees at this stage.
Security Core auth flows are implemented, but no formal security audit has been performed.

Quick Start

Prerequisites

  • Node.js >= 18
  • npm >= 9
  • OpenIM Server (deployed separately -- OpenIM docs)
  • HTTPS setup for WebAuthn (self-signed cert for local dev, or use localhost)

Installation

# Clone the repository

<!-- AUTO-PACKAGE-BADGES:START -->
<!-- Auto-generated package badges -->

![npm version](https://img.shields.io/npm/v/%40kalen%2Fa2a-router?style=flat-square&logo=npm&color=blue) ![npm downloads](https://img.shields.io/npm/dw/%40kalen%2Fa2a-router?style=flat-square&color=brightgreen) ![npm license](https://img.shields.io/npm/l/%40kalen%2Fa2a-router?style=flat-square) [![Deployed](https://img.shields.io/badge/deployed-0.1.0-blue?style=flat-square)](https://www.npmjs.com/package/@kalen/a2a-router)
![npm version](https://img.shields.io/npm/v/%40kalen%2Fidentity?style=flat-square&logo=npm&color=blue) ![npm downloads](https://img.shields.io/npm/dw/%40kalen%2Fidentity?style=flat-square&color=brightgreen) ![npm license](https://img.shields.io/npm/l/%40kalen%2Fidentity?style=flat-square) [![Deployed](https://img.shields.io/badge/deployed-0.1.0-blue?style=flat-square)](https://www.npmjs.com/package/@kalen/identity)
![npm version](https://img.shields.io/npm/v/%40kalen%2Fmcp-gateway?style=flat-square&logo=npm&color=blue) ![npm downloads](https://img.shields.io/npm/dw/%40kalen%2Fmcp-gateway?style=flat-square&color=brightgreen) ![npm license](https://img.shields.io/npm/l/%40kalen%2Fmcp-gateway?style=flat-square) [![Deployed](https://img.shields.io/badge/deployed-0.1.0-blue?style=flat-square)](https://www.npmjs.com/package/@kalen/mcp-gateway)
![npm version](https://img.shields.io/npm/v/%40kalen%2Fshared?style=flat-square&logo=npm&color=blue) ![npm downloads](https://img.shields.io/npm/dw/%40kalen%2Fshared?style=flat-square&color=brightgreen) ![npm license](https://img.shields.io/npm/l/%40kalen%2Fshared?style=flat-square) [![Deployed](https://img.shields.io/badge/deployed-0.1.0-blue?style=flat-square)](https://www.npmjs.com/package/@kalen/shared)

<!-- AUTO-PACKAGE-BADGES:END -->
git clone https://github.com/mulkymalikuldhrs/kalen.git
cd kalen

# Install dependencies
npm install

# Configure environment
cp .env.example .env
# Edit .env with your OpenIM server URL, auth config, etc.

# Run in development mode
npm run dev

Environment Configuration

# OpenIM Configuration
OPENIM_SERVER_URL=https://your-openim-server:10002
OPENIM_API_URL=https://your-openim-server:10002

# WebAuthn Configuration
WEBAUTHN_RP_ID=localhost          # Your domain (must match HTTPS cert)
WEBAUTHN_RP_NAME=KALEN
WEBAUTHN_ORIGIN=https://localhost:3000

# MCP Configuration
MCP_SERVER_PORT=3001

# A2A Configuration
A2A_ENABLED=true

Important: WebAuthn will not work over http:// (except localhost). For non-local development, you must configure HTTPS with a valid certificate.


Project Structure

kalen/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ identity/           # Dual identity model (human + agent)
β”‚   β”‚   β”œβ”€β”€ human/          # Human entity management
β”‚   β”‚   β”œβ”€β”€ agent/          # Agent entity management
β”‚   β”‚   └── shared/         # Common identity interfaces
β”‚   β”œβ”€β”€ protocols/
β”‚   β”‚   β”œβ”€β”€ openim/         # OpenIM SDK integration
β”‚   β”‚   β”‚   β”œβ”€β”€ client/     # Connection and session management
β”‚   β”‚   β”‚   β”œβ”€β”€ messaging/  # Message send/receive handlers
β”‚   β”‚   β”‚   └── presence/   # Status and availability
β”‚   β”‚   β”œβ”€β”€ webauthn/       # WebAuthn authentication
β”‚   β”‚   β”‚   β”œβ”€β”€ registration/  # Credential registration
β”‚   β”‚   β”‚   β”œβ”€β”€ authentication/ # Auth verification
β”‚   β”‚   β”‚   └── storage/    # Credential store
β”‚   β”‚   β”œβ”€β”€ mcp/            # Model Context Protocol
β”‚   β”‚   β”‚   β”œβ”€β”€ server/     # MCP server implementation
β”‚   β”‚   β”‚   β”œβ”€β”€ tools/      # Tool registry and invocation
β”‚   β”‚   β”‚   └── resources/  # Resource management
β”‚   β”‚   └── a2a/            # Agent-to-Agent protocol
β”‚   β”‚       β”œβ”€β”€ discovery/  # Agent discovery
β”‚   β”‚       β”œβ”€β”€ delegation/ # Task delegation
β”‚   β”‚       └── collaboration/ # Multi-agent coordination
β”‚   β”œβ”€β”€ abstraction/        # Protocol abstraction layer
β”‚   β”‚   β”œβ”€β”€ unified-api/    # Unified messaging API
β”‚   β”‚   └── normalizers/    # Protocol message normalizers
β”‚   └── utils/              # Shared utilities
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ unit/               # Unit tests (core protocol handling)
β”‚   β”œβ”€β”€ integration/        # Integration tests (ongoing)
β”‚   └── fixtures/           # Test fixtures and mocks
β”œβ”€β”€ docs/                   # Documentation (work in progress)
β”œβ”€β”€ .env.example            # Environment template
β”œβ”€β”€ package.json
β”œβ”€β”€ tsconfig.json
└── LICENSE

Development

Scripts

npm run dev          # Start development server with hot reload
npm run build        # Compile TypeScript to dist/
npm run test         # Run all tests
npm run test:watch   # Run tests in watch mode
npm run test:coverage # Run tests with coverage report
npm run lint         # Lint code with ESLint
npm run typecheck    # Run TypeScript type checking

Development Setup

# 1. Fork and clone
git clone https://github.com/YOUR_USERNAME/kalen.git
cd kalen

# 2. Install dependencies
npm install

# 3. Set up environment
cp .env.example .env
# Configure your .env (see Quick Start section)

# 4. Run tests to verify setup
npm test

# 5. Start development
npm run dev

Code Style

  • TypeScript strict mode enabled
  • ESLint + Prettier for formatting
  • Follow existing patterns in the codebase
  • Write tests for new protocol handlers

Testing

 Test Suites:  379 passing
 ─────────────────────────────────
 Protocol Handlers    β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  Core OpenIM, WebAuthn, MCP, A2A
 Identity Layer       β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘  Human and Agent entity management
 Abstraction Layer    β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘  Unified API normalization
 Integration          β–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘  Ongoing -- not comprehensive

What the tests cover:

  • Core protocol message parsing and serialization
  • WebAuthn registration and authentication flows
  • OpenIM SDK connection and session management
  • MCP tool registration, discovery, and invocation
  • A2A agent discovery and delegation message handling
  • Identity creation and credential management
  • Protocol abstraction and message normalization

What the tests do NOT cover:

  • Full end-to-end integration across all protocols
  • Performance under load
  • Security penetration testing
  • Real OpenIM server interaction (uses mocks)
  • Cross-browser WebAuthn compatibility
# Run all tests
npm test

# Run with verbose output
npm test -- --verbose

# Run specific test suite
npm test -- --grep "WebAuthn"

# Generate coverage report
npm run test:coverage

Contributing

We welcome contributions, especially in areas where KALEN is weakest:

High-impact areas:

  • Integration testing across protocols
  • Documentation and examples
  • Security review and hardening
  • Performance benchmarking
  • Cross-browser WebAuthn testing

How to contribute:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Write tests for your changes
  4. Commit with clear messages (git commit -m 'Add WebAuthn cross-browser tests')
  5. Push to your branch (git push origin feature/amazing-feature)
  6. Open a Pull Request with a clear description of changes

Guidelines:

  • All PRs require passing tests
  • New protocol handlers must include unit tests
  • Breaking API changes must be documented
  • Follow the existing TypeScript strict mode conventions

Security

Current status: No formal security audit has been performed.

KALEN handles authentication credentials and messaging data. If you're considering using it:

  • WebAuthn credentials are stored locally -- ensure your storage layer is secured
  • OpenIM tokens must be protected in transit and at rest
  • A2A communication between agents should be encrypted in production
  • MCP tool invocations execute code -- validate all tool inputs

Reporting Vulnerabilities

If you discover a security vulnerability, please do not open a public issue. Instead, contact the author directly at mulkymalikudhr@mail.com.

We take security seriously and will respond to verified reports promptly.


Related Projects

We're building a family of open source tools! Check out our other projects:

Project Description
Mnemosyne Free Multi-LLM Hub and AI Memory Center
GhostStudio AI AI Faceless Content Generator
Famlyzer AI Decision and Planning Intelligence
ProxyGateLLM Multi-LLM gateway with priority fallback

License

This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0).

Copyright (C) 2024-2026 Mulky Malikul Dhaher

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.

See the LICENSE file for the full license text.

Note: AGPL-3.0 requires that any modified version of this software used to provide a network service must also make its source code available to users of that service.


Acknowledgments

  • OpenIM -- Open-source instant messaging SDK that powers KALEN's messaging layer
  • WebAuthn / FIDO2 -- Passwordless authentication standard enabling sovereign entity identity
  • Model Context Protocol (MCP) -- Protocol for agent tool discovery and invocation
  • Agent-to-Agent (A2A) -- Protocol for inter-agent communication and collaboration
  • TypeScript -- Type-safe development foundation
  • All contributors and early testers who are helping shape KALEN's future

Author

Mulky Malikul Dhaher

GitHub Email


Building the communication layer for human-agent coexistence -- one protocol at a time.

<script type="application/ld+json"> { "@context": "https://schema.org", "@type": "SoftwareSourceCode", "name": "kalen", "author": { "@type": "Person", "name": "Mulky Malikul Adhr", "url": "https://github.com/mulkymalikuldhrs" }, "programmingLanguage": "TypeScript", "license": "https://spdx.org/licenses/AGPL-3.0", "codeRepository": "https://github.com/mulkymalikuldhrs/kalen", "contributor": { "@type": "Organization", "name": "Open Source Contributors", "url": "https://mulkymalikuldhrs.github.io/contribute-to-our-projects/" } } </script>

About

πŸ“‹ Smart scheduling & AI-powered task management | πŸ”₯ PRIORITY: Seeking contributors!

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages