-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
area/infraCI, builds, tooling, project infrastructureCI, builds, tooling, project infrastructurecomplexity/simpleStraightforward change, minimal riskStraightforward change, minimal riskenhancementNew feature or requestNew feature or requestmilestone/v0.5v0.5 Advanced routing & scalev0.5 Advanced routing & scalepriority/lowLower priority — scale & validationLower priority — scale & validation
Description
Problem
Developers wanting to create contextweaver plugins (custom retrievers, event hooks, store backends, summarizers) have no template or scaffold. They must reverse-engineer the protocol definitions, entry-point configuration, and testing patterns from the main repo. This friction discourages ecosystem contributions.
Proposal
Add a contextweaver init --plugin CLI command that scaffolds a minimal plugin project:
python -m contextweaver init --plugin my-retrieverGenerates:
contextweaver-my-retriever/
├── pyproject.toml # entry-point pre-configured
├── src/
│ └── contextweaver_my_retriever/
│ ├── __init__.py
│ └── retriever.py # stub implementing Retriever protocol
├── tests/
│ └── test_retriever.py # protocol conformance test
├── README.md # usage instructions
└── .github/
└── workflows/
└── ci.yml # basic CI (lint + test)
Plugin types supported
The --type flag selects which protocol to scaffold:
| Type | Protocol | Stub |
|---|---|---|
retriever (default) |
Retriever |
score() method |
hook |
EventHook |
on_event() method |
store |
EventLog / ArtifactStore |
CRUD methods |
summarizer |
Summarizer |
summarize() method |
Template content
pyproject.tomlwith correct[project.entry-points]section- Stub class implementing the chosen protocol
- Conformance test using
isinstance()and basic smoke test - README with installation and registration instructions
Acceptance Criteria
-
python -m contextweaver init --plugin <name>creates a valid project directory -
--typeflag supports retriever, hook, store, summarizer - Generated
pyproject.tomlincludes correct entry-point configuration - Protocol stub passes type checking with
mypy --strict - Generated tests pass with
pytestout of the box - Generated README explains how to install and register the plugin
- Templates are stored as importlib.resources data (not hardcoded strings)
Implementation Notes
- Use
importlib.resourcesto load templates from atemplates/package directory - String interpolation (not Jinja) to avoid adding dependencies
- Add the
init --pluginsubcommand to__main__.py - Keep templates minimal — users can expand as needed
File Paths
src/contextweaver/__main__.py(edit — add init subcommand)src/contextweaver/templates/(new package with template files)tests/test_cli.py(edit — test init subcommand)
Cross-references
- Depends on [routing] Pluggable retrieval backend with entry-point discovery #121 (pluggable retrieval backend — defines Retriever protocol)
- Related to [routing] Add EngineRegistry with pluggable Retriever, Reranker, and ClusteringEngine protocols #47 (EngineRegistry — plugin discovery)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area/infraCI, builds, tooling, project infrastructureCI, builds, tooling, project infrastructurecomplexity/simpleStraightforward change, minimal riskStraightforward change, minimal riskenhancementNew feature or requestNew feature or requestmilestone/v0.5v0.5 Advanced routing & scalev0.5 Advanced routing & scalepriority/lowLower priority — scale & validationLower priority — scale & validation