Contributing to Attocode¶
Getting Started¶
git clone https://github.com/eren23/attocode.git
cd attocode
uv sync --all-extras # creates .venv, installs everything
# or: python -m venv .venv && source .venv/bin/activate && pip install -e ".[dev]"
Development Workflow¶
- Create a feature branch from
main - Make changes, add tests
- Run
pytest tests/unit/ -x -qfor fast feedback - Run
ruff check src/ tests/for linting - Open a pull request
Running Tests¶
# All tests
pytest tests/
# Unit tests only (fast, no I/O)
pytest tests/unit/ -x -q
# Specific module
pytest tests/unit/integrations/test_agents.py -v
# With coverage
pytest tests/ --cov=src/attocode --cov-report=term-missing
# Skip known pre-existing failures
pytest tests/unit/ --ignore=tests/unit/attoswarm -x
Code Style¶
- Formatter/Linter: Ruff
- Type checker: mypy (strict mode)
- Test framework: pytest with
pytest-asyncio - Use
@dataclassfor data containers - Use
AsyncMockfor async dependencies in tests - Group related tests in classes:
class TestFeatureName:
Project Structure¶
src/
attocode/ Main agent package
attoswarm/ Standalone swarm orchestration
attocode_core/ Shared AST indexing
tests/
unit/ Fast tests, no I/O
integration/ Slower tests requiring I/O
See Architecture for detailed module documentation.
Adding a New Tool¶
- Create
src/attocode/tools/my_tool.pyimplementingBaseTool - Register in
src/attocode/tools/registry.py - Add tests in
tests/unit/tools/test_my_tool.py - Update the policy table in
src/attocode/integrations/safety/policy_engine.pyif the tool needs special permissions
Adding a New Provider¶
- Create adapter in
src/attocode/providers/adapters/ - Implement
LLMProviderbase class fromproviders/base.py - Register in
providers/registry.py - Add model defaults in
config.py - See Providers
Adding a New Integration¶
- Pick the appropriate subdirectory under
src/attocode/integrations/(or create one) - Add your module
- Export from the subdirectory's
__init__.py - Write tests in
tests/unit/integrations/
Commit Messages¶
Use conventional commit style:
feat(budget): add dynamic budget reallocation
fix(sandbox): handle missing Landlock kernel support
test(recording): add playback engine unit tests
docs(providers): add OpenAI adapter reference
Known Pre-existing Test Failures¶
These tests fail in CI due to environment assumptions and are safe to ignore:
| Test | Reason |
|---|---|
test_mcp.py::test_empty_when_no_files |
Global MCP defaults now include context7 |
test_attoswarm_smoke.py::test_two_claude_smoke_fake_worker |
Swarm integration timing |
test_cli.py::test_init_interactive_minimal_existing_repo |
Attoswarm CLI change |