Honcho CLI Specification
Status: Draft Author: [TBD] Last Updated: 2025-01-13
1. Overview
1.1 Target Audience
Primary (Now): Honcho core contributors and developers working on the Honcho codebase itself.
Secondary (Future): Open source developers using Honcho who want to self-host their own instance.
The CLI should be designed with the primary audience in mind, but architected in a way that naturally extends to the self-hosting use case.
1.2 Problem Statement
Local development of Honcho currently requires:
- Cloning the repository
- Running
uv syncto install dependencies - Manually starting the FastAPI server with
uv run fastapi dev src/main.py - Separately running the deriver with
uv run python -m src.deriver - Managing configuration via
.envandconfig.toml - Setting up PostgreSQL (typically via Docker)
This creates friction for both Honcho contributors and developers building applications on top of Honcho.
1.3 Proposed Solution
Create a honcho CLI that can be:
- Installed globally via
uv tool install honcho(orpip install honcho) - Run from any directory with sensible defaults
- Used to manage all Honcho components (server, deriver, database, etc.)
1.3 Design Principles
- Convention over configuration: Sensible defaults that “just work”
- Progressive disclosure: Simple commands for common cases, flags for advanced use
- Transparency: Clear feedback about what’s running and where
- Composability: Each command should be independently useful
2. Command Reference
2.1 Core Commands
honcho serve
Start the Honcho API server.
# Basic usage - starts server with default settings
honcho serve
# Development mode with auto-reload
honcho serve --reload
# Specify host/port
honcho serve --host 0.0.0.0 --port 8080
# Run in Docker container
honcho serve --docker
# Production mode with workers
honcho serve --workers 4Behavior:
- Starts uvicorn with the FastAPI application
- Uses configuration from (in order of precedence):
- CLI flags
- Environment variables
- Local
.honcho/config.tomlorhoncho.toml - Global
~/.honcho/config.toml - Built-in defaults
Open Questions:
- Should
--reloadbe the default (dev-first) or explicit? - Should it auto-start postgres if not available?
honcho deriver
Start the deriver background worker.
# Start a single deriver instance
honcho deriver
# Start multiple workers
honcho deriver --workers 3
# Run specific task types only
honcho deriver --tasks representation,summaryBehavior:
- Connects to the same database as
serve - Processes queued tasks (representation, summary, dream)
- Can run alongside or separately from the server
Open Questions:
- Should
honcho serve --with-deriverbe a convenience flag? - How to handle graceful shutdown?
honcho init
Initialize a new Honcho project or configure the CLI.
# Interactive setup
honcho init
# Initialize with defaults
honcho init --defaults
# Initialize for Docker-based setup
honcho init --dockerBehavior:
- Creates
.honcho/directory with:config.toml- local configurationdata/- local database files (if using SQLite)logs/- log files
- Optionally creates
docker-compose.ymlfor full stack
honcho status
Show the current state of Honcho services.
honcho statusExample Output:
Honcho Status
─────────────────────────────────────
Server: Running (http://localhost:8000)
Deriver: Running (2 workers)
Database: Connected (PostgreSQL 15.2)
Queue: 47 pending tasks
Configuration:
Config: .honcho/config.toml
Data: .honcho/data/
Logs: .honcho/logs/
2.2 Utility Commands
honcho openapi
Output the OpenAPI specification.
# Print to stdout
honcho openapi
# Write to file
honcho openapi > openapi.json
# Specific format
honcho openapi --format yamlhoncho docs
Launch the API documentation.
# Open docs in browser (starts server if needed)
honcho docs
# Just print the URL
honcho docs --url-onlyhoncho nuke
Clean up local state (destructive).
# Interactive confirmation
honcho nuke
# Skip confirmation
honcho nuke --force
# Nuke specific things
honcho nuke --db # Database only
honcho nuke --logs # Logs only
honcho nuke --all # Everything including configBehavior:
- Removes
.honcho/data/contents - Optionally removes logs
- Never removes config without
--all - Requires confirmation unless
--force
honcho doctor
Diagnose issues with the local setup.
honcho doctorExample Output:
Honcho Doctor
─────────────────────────────────────
[✓] Python version: 3.11.5
[✓] honcho version: 0.1.0
[✓] Configuration found: .honcho/config.toml
[✗] Database: Connection failed
→ PostgreSQL not running. Run: docker compose up -d postgres
[✓] Required environment variables set
[!] Optional: OPENAI_API_KEY not set (needed for default LLM)
honcho bench
Run the test bench for evaluating Honcho behavior.
# Run all benchmarks
honcho bench
# Run specific benchmark suite
honcho bench --suite memory
# Output results to file
honcho bench --output results.jsonOpen Questions:
- What benchmarks should be included?
- Should this require a running server or start its own?
2.3 Advanced Commands (Future)
honcho monitor
Launch a TUI dashboard for monitoring (uxie-style).
honcho monitorhoncho codegen
Generate SDK code from the OpenAPI spec.
# Generate TypeScript SDK
honcho codegen --lang typescript --output ./sdk
# Generate Python SDK
honcho codegen --lang python --output ./sdkhoncho mock
Run a mock server for SDK testing.
honcho mock --port 80013. Configuration
3.1 Configuration Hierarchy
Configuration is resolved in the following order (later overrides earlier):
- Built-in defaults - Sensible defaults for local development
- Global config -
~/.honcho/config.toml - Local config -
.honcho/config.tomlorhoncho.tomlin current directory - Environment variables -
HONCHO_*prefix - CLI flags - Explicit command-line arguments
3.2 Configuration File Format
# honcho.toml or .honcho/config.toml
[server]
host = "127.0.0.1"
port = 8000
reload = true
workers = 1
[database]
# SQLite for simple local dev
url = "sqlite+aiosqlite:///.honcho/data/honcho.db"
# Or PostgreSQL for full features
# url = "postgresql+psycopg://user:pass@localhost:5432/honcho"
[deriver]
workers = 2
batch_size = 10
[llm]
provider = "openai"
model = "gpt-4o-mini"
[llm.providers.openai]
api_key = "${OPENAI_API_KEY}"
[llm.providers.anthropic]
api_key = "${ANTHROPIC_API_KEY}"
[logging]
level = "INFO"
format = "pretty" # or "json"3.3 Environment Variables
All configuration can be overridden via environment variables:
HONCHO_SERVER_HOST=0.0.0.0
HONCHO_SERVER_PORT=8080
HONCHO_DATABASE_URL=postgresql://...
HONCHO_LLM_PROVIDER=anthropic
HONCHO_LOG_LEVEL=DEBUG3.4 State Directories
| Directory | Purpose | Location |
|---|---|---|
| Global config | User-wide defaults | ~/.honcho/config.toml |
| Local config | Project-specific config | .honcho/config.toml |
| Data | Database files, embeddings | .honcho/data/ |
| Logs | Application logs | .honcho/logs/ |
| Cache | Temporary files | .honcho/cache/ |
Open Questions:
- Should we support XDG Base Directory spec on Linux?
- How to handle Windows paths?
4. Architecture
4.1 Package Structure
honcho/
├── __init__.py
├── __main__.py # Entry point: python -m honcho
├── cli/
│ ├── __init__.py
│ ├── main.py # Click/Typer app definition
│ ├── commands/
│ │ ├── serve.py
│ │ ├── deriver.py
│ │ ├── init.py
│ │ ├── status.py
│ │ ├── nuke.py
│ │ ├── doctor.py
│ │ └── ...
│ └── utils/
│ ├── config.py # Configuration loading
│ ├── docker.py # Docker integration
│ └── output.py # Rich console output
├── server/ # Existing FastAPI app (renamed from src/)
├── deriver/ # Existing deriver
└── ...
4.2 CLI Framework Choice
Options:
- Typer - Modern, type-hint based, good autocompletion
- Click - Battle-tested, Typer is built on it
- argparse - Standard library, no dependencies
Recommendation: Typer
- Already used in FastAPI ecosystem
- Great developer experience
- Automatic help generation
- Rich integration for beautiful output
4.3 Entry Points
# pyproject.toml
[project.scripts]
honcho = "honcho.cli.main:app"This enables:
# After pip/uv install
honcho serve
# Or via module
python -m honcho serve5. Docker Integration
5.1 --docker Flag Behavior
When --docker is passed to commands:
honcho serve --dockerBehavior:
- Check if Docker is available
- Build/pull the Honcho image if needed
- Start a container with appropriate mounts and port bindings
- Stream logs to the terminal
5.2 Docker Compose Integration
# Generate docker-compose.yml
honcho init --docker
# Start all services via compose
honcho up
# Stop all services
honcho downGenerated docker-compose.yml:
version: "3.8"
services:
honcho:
image: ghcr.io/plastic-labs/honcho:latest
ports:
- "8000:8000"
environment:
- DATABASE_URL=postgresql://honcho:honcho@postgres:5432/honcho
depends_on:
- postgres
volumes:
- ./.honcho/config.toml:/app/config.toml:ro
deriver:
image: ghcr.io/plastic-labs/honcho:latest
command: deriver
environment:
- DATABASE_URL=postgresql://honcho:honcho@postgres:5432/honcho
depends_on:
- postgres
- honcho
postgres:
image: pgvector/pgvector:pg16
environment:
- POSTGRES_USER=honcho
- POSTGRES_PASSWORD=honcho
- POSTGRES_DB=honcho
volumes:
- ./.honcho/data/postgres:/var/lib/postgresql/data
ports:
- "5432:5432"5.3 Open Questions
- Should the CLI be included in the Docker image?
- How to handle
honcho serve --dockervsdocker compose up? - Should we support Podman as well?
6. Development Workflow Examples
6.1 Quick Start (New User)
# Install honcho
uv tool install honcho
# Initialize in current directory
honcho init
# Start the server (uses SQLite by default)
honcho serve
# In another terminal, start the deriver
honcho deriver6.2 Full Stack with Docker
# Install honcho
uv tool install honcho
# Initialize with Docker setup
honcho init --docker
# Start everything
honcho up
# Check status
honcho status
# View logs
honcho logs --follow
# Tear down
honcho down6.3 Contributing to Honcho
# Clone and install in development mode
git clone https://github.com/plastic-labs/honcho
cd honcho
uv sync
# Run from source (uses pyproject.toml entry point)
uv run honcho serve --reload
# Or the traditional way still works
uv run fastapi dev src/main.py7. Migration Path
7.1 Backwards Compatibility
The existing methods should continue to work:
uv run fastapi dev src/main.py- unchangeduv run python -m src.deriver- unchanged- Docker compose - unchanged
The CLI is an additional interface, not a replacement.
7.2 Deprecation Timeline
- Phase 1: CLI released alongside existing methods
- Phase 2: Documentation updated to prefer CLI
- Phase 3: Consider deprecating raw commands (optional)
8. Open Questions Summary
Configuration
- Global (
~/.honcho/) vs local (.honcho/) default preference? - Support for
honcho.tomlin project root vs.honcho/config.toml? - XDG Base Directory spec compliance?
Execution Model
- Should
honcho serveauto-start the deriver? - Should
honcho serveauto-start postgres? - Graceful shutdown handling?
- Multi-process vs multi-threaded deriver workers?
Docker
- CLI in Docker image or separate?
- Support for
--dockerflag vs dedicatedhoncho upcommand? - Podman support?
Scope
- Is this a dev tool only, or should it be production-ready?
- Should it support custom dreams/consumers as plugins?
- Mock server priority?
- Built-in coding agent - what would this do?
Distribution
- Package name on PyPI (is
honchoavailable?) - Versioning strategy (sync with API version?)
9. Implementation Plan
Phase 1: Foundation
- Set up CLI structure with Typer
- Implement
honcho serve(wrap existing FastAPI app) - Implement
honcho deriver(wrap existing deriver) - Basic configuration loading
Phase 2: Developer Experience
- Implement
honcho init - Implement
honcho status - Implement
honcho doctor - Implement
honcho nuke
Phase 3: Documentation & Distribution
- Implement
honcho openapi - Implement
honcho docs - PyPI packaging
- Documentation
Phase 4: Advanced Features
- Docker integration (
--dockerflags) -
honcho up/honcho downcommands -
honcho monitorTUI -
honcho bench
Phase 5: Extensibility
- Plugin system for custom commands
- SDK codegen
- Mock server
10. References
Appendix A: Command Comparison
| Current | Proposed CLI | Notes |
|---|---|---|
uv run fastapi dev src/main.py | honcho serve | Simpler |
uv run fastapi dev src/main.py --reload | honcho serve --reload | Same flags |
uv run python -m src.deriver | honcho deriver | Simpler |
docker compose up | honcho up | Optional wrapper |
| Manual config editing | honcho init | Guided setup |
| Check processes manually | honcho status | Unified view |
Appendix B: Similar Tools for Reference
- FastAPI CLI -
fastapi dev,fastapi run - Django -
django-admin,manage.py - Rails -
rails server,rails console - Hugo -
hugo server,hugo new - Vite -
vite dev,vite build