Result<T, E> instead of throwing exceptions, and security rules are enforced at lint time via ESLint.
This guide covers everything you need to extend Comis: building custom channel adapters, writing lifecycle plugins, creating advanced skills, and orchestrating multi-agent pipelines.
What You Can Build
Custom Channel Adapters
Connect Comis to any chat platform by implementing theChannelPort interface. Comis ships with 10 adapters (Discord, Telegram, Slack, WhatsApp, Signal, iMessage, LINE, IRC, Echo, Email) and you can add more without modifying core code.
Each adapter handles platform-specific messaging, media, reactions, and threading while presenting a unified interface to the rest of the system. The EchoChannelAdapter serves as the simplest reference implementation — an in-memory adapter with zero external dependencies.
Lifecycle Plugins
Hook into lifecycle points to modify behavior, add audit logging, block actions, or inject context. The plugin system provides 5 modifying hooks (where your handler can alter data flowing through the pipeline) and 8 void hooks (where you observe events without modifying them). Beyond lifecycle hooks, plugins can register custom tools that agents can call, add HTTP routes to the gateway, and define custom configuration schema sections. This makes the plugin system the primary extension mechanism for cross-cutting concerns like audit logging, webhook forwarding, or custom authorization.Custom Skills
Create prompt-based skills with SKILL.md manifests or connect external MCP servers. Skills extend what agents can do — from answering domain-specific questions to executing multi-step workflows. Prompt skills are Markdown files with YAML frontmatter defining the skill’s name, permissions, allowed tools, and input schema. The body contains the prompt template with variable placeholders. For more advanced integrations, MCP (Model Context Protocol) servers expose tools and resources to agents over a standardized protocol.Execution Pipelines
Orchestrate multi-agent workflows as directed acyclic graphs (DAGs). Define nodes with dependencies, input passing, and barrier modes for parallel agent coordination. Each node in the graph runs an agent with a specific task. Nodes can depend on other nodes, receive output from upstream nodes as input variables, and run in parallel when their dependencies are satisfied. The graph coordinator manages node scheduling, timeout enforcement, and aggregate result collection.Architecture at a Glance
All domain logic lives in@comis/core. Port interfaces define boundaries — what the system needs. Adapter packages implement those boundaries — how it’s done. The composition root in core/src/bootstrap.ts wires everything together at startup, returning an AppContainer with the fully configured event bus, plugin registry, and hook runner.
Every function returns Result<T, E> — no thrown exceptions. This pattern is enforced by ESLint and used across all 15 packages. Core utilities like ok(), err(), tryCatch(), and fromPromise() from @comis/shared make error handling explicit, typed, and composable.
Key Patterns
A few patterns appear throughout the codebase and are important to understand before diving in:Result<T, E>— Every function returns aResultdiscriminated union instead of throwing exceptions. Useok()for success anderr()for failure. This pattern is ESLint-enforced.- Factory functions — Prefer
createXxx()factory functions returning typed interfaces over direct class instantiation (e.g.,createCircuitBreaker()returnsCircuitBreaker). TypedEventBus— The inter-module communication layer. Packages subscribe to typed events instead of importing each other directly. TheEventMapinterface provides compile-time safety for all typed events.AsyncLocalStorage— Request-scoped context is available viarunWithContext()andgetContext()incore/src/context/, providing trace IDs and agent context without passing them through every function call.
Prerequisites
Before extending Comis, you should be comfortable with:- TypeScript — strict mode, generics, discriminated unions, and ES modules
- Node.js >= 22 — the runtime target for all packages
- pnpm — the package manager used for the monorepo workspace
pnpm validate (expands to pnpm docs:check && pnpm build:clean && pnpm cycles && pnpm cycles:refs && pnpm lint:security && pnpm test:coverage).
Getting Started
Architecture
Hexagonal pattern, ports, adapters, and the composition root
Packages
All 15 packages with roles and dependency graph
Event Bus
Typed events across 5 domain subsystems (Messaging, Agent, Channel, Infra, Terminal)
Custom Adapters
Step-by-step channel adapter tutorial
Plugins
Lifecycle hooks and extension registrations
Custom Skills
Advanced skill development beyond prompt skills
Pipelines
Multi-agent execution graphs (DAGs)
Contributing
Setup, coding standards, and PR process
