Skip to main content

Multi-Agent Collaboration CLI with flock-based locking and event-driven workflow

Project description

Mai CLI

English | 简体中文

PyPI Version License Python

Multi-Agent Coordination CLI — enables multiple AI agents to collaborate autonomously via a standardized command interface, backed by flock-based atomic locking.


✨ Features

  • 🔒 Atomic flock locks — race-condition-free claim/complete via POSIX fcntl.flock()
  • 📋 Standardized commands — full Issue lifecycle, queue scanning, lock management, audit logs, daily summaries
  • 📁 File-based storage — all metadata stored in .mai/ directory
  • ⚙️ JSON configuration — queue SLA, agent heartbeat, issue ID prefix all in config.json
  • 🔄 Concurrent-safe daily summaries — multiple agents write simultaneously with flock protection
  • 🌍 Global Infrastructure — centralized management of global config and project registry in ~/.mai-cli/ (v1.10.3+)
  • Idempotent writes — repeating any operation preserves state
  • 📦 Zero dependencies — Python 3 stdlib only

🏗️ Architecture

flowchart TB
    subgraph Storage
        A[".mai/ — Metadata storage"]
    end
    subgraph Core
        C["Issue Queue"]
        D["flock Lock"]
        E["Heartbeat Guardian"]
    end
    subgraph Commands
        F["mai issue"]
        G["mai queue"]
        H["mai lock"]
        I["mai daily-summary"]
    end
    F --> C
    G --> C
    H --> D
    I --> C
    C --> A

🚀 Quick Start

Requirements

  • Python 3.8+ (stdlib only, no external dependencies)
  • Linux / macOS / WSL (POSIX environment)

Install

pip install mai-cli

Minimal Example

# 0. Global setup (v1.10.3+)
mai setup --root admin

# 1. Initialize project (Root required)
mai init -o admin

# 2. Register an agent
mai agent add alice --heartbeat-minutes 30

# 3. Create an issue

mai issue new questions "Technical review" -o alice

# 4. Claim issue (auto-locks)
mai issue claim REQ-001 -o alice

# 5. Complete issue
mai issue complete REQ-001 "Approved for implementation" -o alice

# 6. Check queue
mai queue check --overdue

📖 Documentation

Document Description
Deployment Deployment guide
Command Reference Full command reference

🤝 Contributing

PRs and Issues are welcome!

  1. Fork this project
  2. Create a feature branch git checkout -b feature/AmazingFeature
  3. Commit your changes git commit -m 'feat: Add some AmazingFeature'
  4. Push to the branch git push origin feature/AmazingFeature
  5. Open a Pull Request

📄 License

MIT License — see LICENSE.


Mai CLI v1.12.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mai_cli-1.12.0.tar.gz (45.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mai_cli-1.12.0-py3-none-any.whl (40.0 kB view details)

Uploaded Python 3

File details

Details for the file mai_cli-1.12.0.tar.gz.

File metadata

  • Download URL: mai_cli-1.12.0.tar.gz
  • Upload date:
  • Size: 45.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for mai_cli-1.12.0.tar.gz
Algorithm Hash digest
SHA256 9d9d4b4c4051b5cc87ef11305667bf88dcf8729329618f9d9f8b3ce112409d69
MD5 b199cbe1a1b4f5fdeae967c6dab008bf
BLAKE2b-256 dbdb647adddf2ec4bfcff7d563b81807f670ebe78a0ad2c468415a0ce10e2a48

See more details on using hashes here.

File details

Details for the file mai_cli-1.12.0-py3-none-any.whl.

File metadata

  • Download URL: mai_cli-1.12.0-py3-none-any.whl
  • Upload date:
  • Size: 40.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for mai_cli-1.12.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4ac35d7e51749020198c7ce448af6dd7dc4e1424d09731934e6e86078e5a5f4e
MD5 2962069a2e5fa61e8d7428984500c1eb
BLAKE2b-256 1bd0d17e5a739a3f17186fdd3539cfb4691b2e83affa7021d64673d1e8d47dc7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page