This file orients agentic coding assistants working in this repo. Keep edits small, follow existing conventions, and validate with tests/lint.
- Python 3.10+ CLI/TUI client for Agent Zero
- Entry points:
a0cli(CLI) anda0tui(TUI) - Core modules:
backend.py,cli/,ui/,observer/,llm_providers/ - Tests live in
tests/
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -e ".[dev]"- Run CLI:
a0cliorpython -m cli - Run TUI:
a0tuiorpython -m main_new - Package build (optional):
python -m build
- Lint:
ruff check . - Format check:
black --check . - Auto-format:
black . - Optional autofix:
ruff check . --fix
- Run full suite:
pytest tests/ - Run with coverage:
pytest tests/ --cov=. --cov-report=html - Run a single file:
pytest tests/test_backend_context.py - Run a single test:
pytest tests/test_backend_context.py::TestContextBuilder::test_preview_redaction - Run by keyword:
pytest -k "context" - E2E (mock server):
scripts/run_e2e.sh
- No
.cursor/rules,.cursorrules, or.github/copilot-instructions.mdfound in this repo.
- Target Python 3.10+.
- Use type hints for function signatures and public APIs.
- Prefer
Optional[T]orT | Noneover implicitNone. - Keep functions small and focused; avoid side effects in helpers.
- Formatting is enforced by Black.
- Line length is 100 characters (
[tool.black]and[tool.ruff]). - Do not hand-format to a different width.
- Follow Ruff import sorting (isort-style).
- Group imports in this order: standard library, third-party, local.
- Keep imports explicit; avoid
from x import *.
- Functions/variables:
snake_case. - Classes:
PascalCase. - Constants:
UPPER_SNAKE_CASE. - Async functions: suffix with
_asynconly if it clarifies intent.
- Catch specific exceptions; avoid bare
except. - Log with
logging.getLogger("agentzero.<module>"). - Return safe, user-facing messages rather than raw stack traces.
- Preserve original exceptions where helpful for debugging.
- Prefer
async/awaitwithaiohttpwhere used. - Use timeouts and close sessions with context managers.
- Avoid blocking calls in async paths; use
asyncio.to_threadif needed.
- Config lives in
config.yaml/config.example.yaml. - Environment variables are prefixed with
AGENTZERO_. - Never commit secrets or real API keys.
- Use
logginginstead ofprint. - Keep user-facing messages consistent with existing CLI/TUI output styles.
- Use pytest and pytest-asyncio (
asyncio_mode = auto). - Add tests for new behaviors; keep them deterministic.
- Prefer unit tests in
tests/over ad-hoc scripts.
backend.py— Agent Zero client + context buildercli/— CLI interface and slash commandsui/— Textual-based TUIobserver/— Tool routing and observer logicllm_providers/— LLM integration adaptersdocs/— Project docs and specs
- Keep diffs minimal and scoped to the task.
- Do not add new dependencies without explicit approval.
- Update docs when behavior or config changes.
- Prefer tests + lint before requesting review.
- Redact or exclude sensitive data in logs and previews.
- Be careful with filesystem operations; avoid destructive defaults.
- Place tests in
tests/usingtest_*.pynaming. - Name test classes
TestSomethingand test functionstest_something. - For async tests, use
async def+ pytest-asyncio.
- Lint and format checks pass.
- Relevant tests pass (or clearly noted).
- No secrets added to git.
- Documentation updated when needed.