This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Mech-interact is an Open Autonomy skill implementing interactions with AI mechs on the Autonolas protocol. It is built on the open-aea and open-autonomy frameworks. The project contains AEA (Autonomous Economic Agent) packages: one ABCI skill and multiple smart contract wrappers.
uv sync
uv run autonomy init --reset --author valory --remote --ipfs --ipfs-node "/dns/registry.autonolas.tech/tcp/443/https"
uv run autonomy packages sync --update-packagesPrefix commands with uv run (e.g. uv run pytest ..., uv run make test).
# Run all tests (skill + contracts)
make test
# Run a single test file
pytest packages/valory/skills/mech_interact_abci/tests/test_file.py -rfE
# Run tests via tox (platform-specific, e.g. py3.12-darwin)
tox -e py3.12-darwin# Auto-format code (isort + black)
make formatters
# Run all code checks (black-check, isort-check, flake8, mypy, pylint, darglint)
make code-checks
# Run security checks
make security
# Run all linters at once
make all-linters# Regenerate ABCI docstrings, copyright headers, and package hashes
make generators
# Check package hashes and doc hashes
make common-checks-1
# Fix ABCI app FSM specs
make fix-abci-app-specsAll code lives under packages/valory/:
skills/mech_interact_abci/— The core ABCI skill implementing the mech interaction FSM (Finite State Machine)contracts/— Smart contract wrappers (mech, mech_mm, mech_marketplace_legacy, agent_registry, erc20, and Nevermined contracts)
The skill follows the Open Autonomy round-based architecture:
states/— Round definitions (FSM states). Each state file defines a round class withEventtransitions.base.pycontainsSynchronizedDataand sharedEventenum.behaviours/— Behaviour implementations (logic executed during each round).round_behaviour.pywires all behaviours together.rounds.py—MechInteractAbciAppFSM definition with transition function mapping states to events.models.py— Shared configuration and data models.handlers.py— Message handlers (abci, http, contract_api, ledger_api, signing).payloads.py— Payload definitions for consensus.
The FSM flow starts at MechVersionDetectionRound, branching based on mech version (v1 legacy vs v2 marketplace), then proceeding through information gathering, request, subscription purchase, and response rounds.
Each contract package contains:
contract.py— Python wrapper with typed methods for on-chain interactionscontract.yaml— AEA component configurationbuild/— Compiled ABI JSON files
- Dependencies are managed via
pyproject.toml+uv.lock(viauv) andtox.ini(CI). - Package hashes in
packages/packages.jsonmust stay in sync — runautonomy packages lockafter modifying packages. - Code style: black (line length 88), isort, flake8, mypy with
--disallow-untyped-defs, darglint (sphinx-style docstrings). - Third-party AEA packages are synced from IPFS, not vendored. Only
packages/valory/contains project-owned code.
Before pushing, run in order:
make cleanmake formattersmake code-checksmake generators(if packages modified)make common-checks-1(if packages modified)