# how to add a cli adapter

Canonical URL: https://bernstein.run/q/how-to-add-a-cli-adapter
Markdown URL: https://bernstein.run/q/how-to-add-a-cli-adapter.md
Tags: adapters, extension

subclass bernstein.adapters.base.CLIAdapter, implement spawn(prompt, workdir, model_config, session_id, ...) to launch your cli with a prompt and stream output, and register the class via the adapter entry-point (or drop the file under src/bernstein/adapters/ and add it to adapters/registry.py for in-tree changes). bernstein.adapters._contract enforces capability checks. existing adapters under src/bernstein/adapters/ (aider.py, claude.py, codex.py, ollama.py, generic.py) are the reference. for unknown cli tools, use generic.py and parameterise it through bernstein.yaml. the plugin sdk in src/bernstein/adapters/plugin_sdk.py lets you ship adapters as separate pip packages.

## Related

- https://bernstein.run/q/bernstein-vs-aider
- https://bernstein.run/q/mcp-server-for-multi-agent-coding
