Plugin authoring¶
Developer guide for building plugins on the Threadory platform — Connectors, Skills, and Domain Packs.
This directory documents the three plugin contracts exposed by the kernel and walks through how to build each
one against the real connector_base, skill_base, and pack_base packages in this repository.
Table of contents¶
- Overview — the 5-layer architecture, plugin types, manifests, kernel purity rule
- Authoring a Connector —
SourceConnector+ActionConnectorProtocols, manifest, auth methods, webhook + OAuth helpers - Authoring a Skill —
SkillProtocol,SkillManifest, triggers,@skilldecorator,SkillContextsub-APIs, stateful vs stateless patterns - Authoring a Domain Pack —
DomainPackand its 4 sub-Protocols,applies_tofilter, inheritance viaextends, glossary loader - Testing — pytest layout, Postgres testcontainers pattern,
KernelMock,FakeLLMRouter, golden datasets - Publishing — local install, entry-point registration, version compatibility
Quick map¶
| Plugin type | Base package | Entry-point group | Manifest section name |
|---|---|---|---|
| Connector | connector_base |
knowledge_os.connectors |
connector: |
| Skill | skill_base |
knowledge_os.skills |
skill: |
| Domain Pack | pack_base |
knowledge_os.domain_packs |
domain_pack: |
Common pattern¶
Every plugin is a self-contained Python package shaped as:
packages/<your_plugin>/
├── pyproject.toml # declares the entry-point group + name
├── src/<your_plugin>/
│ ├── __init__.py
│ ├── manifest.yaml # validated by pydantic at import time
│ └── <implementation>.py
└── tests/
└── test_<plugin>.py # unit + contract tests
- Ship a
manifest.yamlnext to the implementation module — pydantic v2 validates it on load (extra="forbid",frozen=Trueon every model). - Register your class via Python entry points in
pyproject.toml. - Cover the implementation with
pytest-asyncio(asyncio_mode = "auto") and the helpers fromtesting_kit(KernelMock,FakeLLMRouter, golden file helpers).
Authoritative source¶
The canonical contract spec lives in
doc-platform-rewrite/02_plugin_contracts.md in the repository.
This guide is the developer-facing companion: shorter, with code recipes, kept in sync with the in-tree
connector_base, skill_base, pack_base source. When the two disagree, the spec wins; please open
an issue.
Prerequisites¶
- Python 3.12
uv0.4+- Familiarity with pydantic v2, async Python, and JSON Schema draft-2020-12
- A checkout of this monorepo (the plugin base packages are workspace members)