> ## Documentation Index
> Fetch the complete documentation index at: https://docs.khanhng.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 2.4 Crosscutting Concepts

> Concepts that apply across Kcode Robot Suite: plugin contract, services, permissions, events, configuration, and design system.

## 2.4.1 Plugin contract

`KcodePlugin` is the boundary between a demo and the platform. It carries metadata, optional routes, navigation, permissions, settings, commands, lifecycle hooks, and an entry component. See the [plugin contract](https://docs.khanhng.com/kcode-robot-suite/sdk-reference/plugin-contract.md).

## 2.4.2 Registration validation

The `PluginRegistry` validates every plugin before it stores a frozen snapshot.

| Rule | Detail |
| - | - |
| Plugin ID | Lowercase kebab-case. Duplicate IDs are rejected. |
| Versions | `version` and `sdkVersion` must be semantic versions. |
| Metadata | Must match the plugin's `id`, `name`, and `version`, and include a description, a category, a valid status, and at least one technology. |
| Routes | Paths start with `/` and are unique. |
| Permissions and settings | Identifiers are unique and use letters, digits, `.` and `-`. Setting defaults must match the declared type and options. |
| Cross-plugin collisions | Route paths, navigation IDs, and permission IDs must not collide with an already registered plugin. |

## 2.4.3 Permissions

Plugins declare permissions. The kernel's `PermissionService` stores grants per subject. A subject with `platform.admin` passes every check. `DemoAuthService.hasPermission` applies the same administrator rule.

## 2.4.4 Events

Plugins communicate through an event bus on `PluginContext`. Handlers run in order, and failures reach the publisher. Examples used by bundled plugins include `operations.refresh.requested`, `operations.dashboard.initialized`, and `wheremybot.lifecycle.changed`.

## 2.4.5 Configuration

The `ConfigurationStore` keeps one in-memory namespace for each plugin. A plugin can read or write only settings it declared, and `set` validates the value against the declared type, options, and required flag. Values are not persisted.

## 2.4.6 Service interfaces and mocks

Each plugin defines service interfaces such as `OperationsService` or `MeetingService`. Mock classes simulate latency and in-memory state behind them. To use a real provider, implement the interface and construct it where the plugin wires its service.

## 2.4.7 Design system

`@kcode/design-system` provides a dark, high-contrast visual language as CSS tokens plus primitives, patterns, and charts. Plugins use these primitives instead of defining a parallel visual language.

## 2.4.8 Logging and notifications

`ConsoleLogger` and `InMemoryNotificationService` in `@kcode/services` implement the SDK's `Logger` and `NotificationService`. The kernel scopes each plugin's logger with `plugin:<id>`. In the web app, the runtime logs to the browser console with a `[pluginId]` prefix and shows toasts for notifications.

## 2.4.9 Testing

Contract tests (`*.contract.test.ts`) cover the kernel (`kernel.contract.test.ts`) and demo authentication (`demo-auth-service.contract.test.ts`). Run them with `pnpm test`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.