agencycli

A CLI tool for AI agents to manage hierarchical teams of other AI agents, enabling structured task assignment, context management, and workflow automation.

26 stars
Complexity: easy

About this skill

agencycli is a command-line interface tool designed to enable AI agents to manage complex, hierarchical teams of other AI agents. It establishes a structured environment through concepts like Agencies, Teams, Roles, Projects, and individual Agents, each with their own context and prompts. This skill allows an orchestrating AI agent to programmatically create and configure these structures, hire and fire agents, assign tasks with priority queues, and manage autonomous playbooks (wakeup.md) along with heartbeat schedules and cron jobs. It is an essential tool for AI agents tasked with overseeing multi-agent systems, coordinating intricate projects, or constructing sophisticated AI organizations. By providing a robust framework for agent management, context layering, and task delegation, agencycli empowers an AI to control and monitor a fleet of specialized agents within Docker sandboxes, send async messages, and manage templates for consistent deployment.

Best use case

The primary use case for `agencycli` is the programmatic management and orchestration of multiple AI agents and their associated workflows. It is most beneficial for AI agents that need to operate as project managers, team leaders, or system administrators within a multi-agent AI ecosystem, enabling them to construct, deploy, and supervise specialized AI sub-agents for various tasks.

A CLI tool for AI agents to manage hierarchical teams of other AI agents, enabling structured task assignment, context management, and workflow automation.

A structured and operational multi-agent AI system, with agents assigned to tasks, configured with specific roles, and executing workflows as defined by the orchestrating agent.

Practical example

Example input

As an AI project manager, use agencycli to set up a new agency named 'AI_DevOps', create a 'Frontend Team' role, and hire a 'React Developer' agent. Assign it the task 'Implement user login UI' with high priority and link it to the 'frontend-codebase' repository.

Example output

Agency 'AI_DevOps' created. Team 'Frontend Team' role created. Agent 'React Developer' hired, configured with context from 'frontend-codebase'. Task 'Implement user login UI' added to priority queue for 'React Developer' (priority 0).

When to use this skill

  • When an AI agent needs to orchestrate and manage hierarchical teams of other AI agents.
  • When programmatically hiring, firing, or synchronizing AI agents with specific contexts and skills.
  • When assigning, running, or canceling tasks for agents, managing priority queues and confirmations.
  • When configuring agent schedules (heartbeats, cron jobs) and autonomous playbooks (wakeup.md).

When not to use this skill

  • When the task is a simple, single-agent operation that doesn't require multi-agent team management.
  • If the AI needs to perform a direct computational or content-generation task rather than manage other agents.
  • For tasks that do not involve agent creation, task assignment, or workflow coordination.
  • If you're looking for a general-purpose AI model to answer queries, not an agent manager.

How agencycli Compares

Feature / AgentagencycliStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityeasyN/A

Frequently Asked Questions

What does this skill do?

A CLI tool for AI agents to manage hierarchical teams of other AI agents, enabling structured task assignment, context management, and workflow automation.

How difficult is it to install?

The installation complexity is rated as easy. You can find the installation instructions above.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# agencycli

`agencycli` is a CLI tool for organising AI agents into hierarchical teams (Agency → Team → Role → Project → Agent). Each agent = Model + Context + Skills. The binary is at `/usr/local/bin/agencycli` or in `$PATH`.

## Installation

```bash
# via npm (recommended)
npm install -g @agencycli/agentctl

# via install script
curl -fsSL https://raw.githubusercontent.com/chenhg5/agencycli/main/scripts/install.sh | sh

# verify
agencycli version
```

## Core concepts

| Concept | What it is |
|---------|-----------|
| **Agency** | The root workspace (`agency-prompt.md`, `.agencycli/agency.yaml`) |
| **Team** | A group with a shared prompt (`teams/<team>/prompt.md`) |
| **Role** | A position within a team — has its own prompt + bound skills + workspace setup |
| **Project** | A work unit with its own prompt, linked to a code repo |
| **Agent** | A hired instance: model + merged context from all layers |
| **Skill** | Reusable instructions copied into agent workspace on hire |
| **Task** | A unit of work with status, priority (0=critical…3=low), prompt, and optional heartbeat/cron |
| **Playbook** | `wakeup.md` — the autonomous routine an agent runs when its task queue is empty |
| **Message** | Async non-blocking communication between any two participants (human or agent) |

Context is merged in this order (later layers override): **Agency → Team → Role → Project → Agent**

---

## Quick start — blank agency

```bash
# 1. Create agency
agencycli create agency --name "MyAgency" --desc "My first agency"
cd MyAgency

# 2. Create team + role
agencycli create team --name "engineering" --desc "Software engineers"
agencycli create role --team "engineering" --name "developer"

# 3. Create project
agencycli create project --name "my-service" --repo "/path/to/repo"

# 4. Hire an agent
agencycli hire --project my-service --team engineering --role developer \
  --model claudecode --name dev --sandbox docker

# 5. Add and run a task
agencycli task add --project my-service --agent dev \
  --title "Implement feature X" --prompt "..."
agencycli run --project my-service --agent dev
```

## Quick start — from a template (recommended)

```bash
# 1. Create agency from template
agencycli create agency --name "MyAgency" \
  --template https://example.com/tech-agency.tar.gz
cd MyAgency

# 2. List available project blueprints
agencycli project blueprints

# 3. Create a project from a blueprint
agencycli create project --name "my-service" --blueprint default

# 4. Review and apply (hires agents, configures heartbeats, installs wakeup.md playbooks)
agencycli project show  --project my-service
agencycli project apply --project my-service

# 5. Start the scheduler — agents wake up on schedule and run their playbooks when idle
agencycli scheduler start

# 6. Monitor
agencycli inbox list          # task confirmations awaiting your decision
agencycli inbox messages      # async messages from agents
agencycli task list --project my-service --agent pm
```

---

## Global flag

All commands support `--dir <workspace>` to point to the agency root when not running from inside it:

```bash
agencycli --dir /root/code/MyAgency task list --project my-service --agent dev
```

---

## Command reference

### Workspace setup

```bash
agencycli create agency  --name "Name" [--desc "..."] [--template file.tar.gz|dir|URL]
agencycli create team    --name "engineering" [--desc "..."]
agencycli create role    --team "engineering" --name "developer" [--desc "..."]
agencycli create project --name "my-service"  --repo "/path/to/repo" [--desc "..."]
agencycli create project --name "my-service"  --blueprint default   # from blueprint
```

### Hiring agents

```bash
agencycli hire --project <proj> --team <team> [--role <role>] \
               --model <model> --name <name> [--sandbox docker]
# Supported models: claudecode  codex  gemini  cursor  generic-cli

agencycli sync --project <proj> --agent <name>   # re-sync after editing prompts/skills
agencycli sync --project <proj>                  # sync all agents in project
agencycli fire --project <proj> --agent <name>          # soft delete → .fired/
agencycli fire --project <proj> --agent <name> --force  # hard delete
```

### Project lifecycle

```bash
agencycli project blueprints
agencycli project show  --project P
agencycli project apply --project P             # hire agents + configure heartbeats + install playbooks
agencycli project apply --project P --dry-run
agencycli project apply --project P --force
```

**project-blueprints/default.yaml** example:
```yaml
name: "{{PROJECT_NAME}}"
description: "..."
agents:
  - name: dev
    role: developer
    team: engineering
    model: claudecode
    sandbox: true
    playbook: dev.md        # installed as wakeup.md by project apply
    heartbeat:
      enabled: true
      interval: 30m
      active_hours: "09:00-20:00"
      active_days: weekdays

  - name: pm
    role: product-manager
    team: product
    model: claudecode
    playbook: pm.md
    heartbeat:
      enabled: true
      interval: 30m
```

### Tasks

```bash
agencycli task add    --project P --agent A --title "T" --prompt "..." \
                      [--type feature|bug|chore] [--priority 0-3]
agencycli task list   --project P --agent A [--status pending] [--archived]
agencycli task show   <task-id>
agencycli task cancel <task-id>
agencycli task retry  <task-id>

# Emergency halt — cancel pending (and optionally running) tasks
agencycli task stop-all --project P --all-agents
agencycli task stop-all --project P --agent A --include-running

# View token usage and cost
agencycli task tokens --project P --agent A
agencycli task tokens --project P --all-agents
agencycli task tokens --project P --agent A --task <task-id>

# Called by agent inside its prompt:
agencycli task done --id <task-id> --status success --summary "brief description"
agencycli task done --id <task-id> --status failed  --error "reason"

# Pause and wait for human confirmation (blocks until human responds):
agencycli task confirm-request --id <task-id> \
  --summary "PR #42 ready for review" \
  --action-item "Open the PR and check the diff" \
  --action-item "Reply: merge / hold <reason>"
```

Task priority: 0=critical, 1=high, 2=normal (default), 3=low. The scheduler always picks the highest-priority pending task first. After `confirm-request`, the human's reply is available as `$CONFIRMATION_REPLY`.

### Running agents

```bash
agencycli run  --project P --agent A              # pick next pending task
agencycli run  --project P --agent A --task <id>  # run specific task
agencycli exec --project P --agent A --prompt "..." # one-off prompt (no task queue)
```

### Inbox — task confirmations (blocking)

Agents call `task confirm-request` to pause a task and wait for the human's decision.

```bash
agencycli inbox list
agencycli inbox show    <task-id>
agencycli inbox confirm <task-id> --message "approved, go ahead"
agencycli inbox reject  <task-id> --reason "needs rework"
agencycli inbox comment <task-id> --message "check the auth module first"
agencycli inbox forward <task-id> --to <project>/<agent> --note "please re-check"
```

### Inbox — async messages (non-blocking)

Any participant (human or agent) can send messages to any other. Recipients read them on their next wakeup — the scheduler auto-injects unread messages at the top of the wakeup prompt.

**Address format:** `human` or `project/agent` (e.g. `cc-connect/pm`, `cc-connect/dev-claude`)

```bash
# Send
agencycli inbox send --to cc-connect/pm --subject "Prioritise #55" --body "..."
agencycli inbox send --from cc-connect/pm --to human --subject "Update" --body "..."
agencycli inbox send --from cc-connect/pm --to cc-connect/dev-claude \
  --subject "Extra context" --body "..."

# Read (human's mailbox by default)
agencycli inbox messages
agencycli inbox messages --recipient cc-connect/pm
agencycli inbox messages --recipient cc-connect/pm --from human      # filter by sender
agencycli inbox messages --from cc-connect/pm                        # human inbox, only from pm
agencycli inbox messages --all          # include already-read
agencycli inbox messages --mark-read    # mark as read after listing

# Reply
agencycli inbox reply <msg-id> --from cc-connect/pm --body "Acknowledged."
```

### Daemon (heartbeat + wakeup routines)

```bash
# Configure heartbeat
agencycli scheduler heartbeat --project P --agent A \
  --enable --interval 30m \
  --active-hours "09:00-18:00" \
  --active-days  "weekdays"

# Set wakeup routine (runs as synthetic task when queue is empty)
agencycli scheduler heartbeat --project P --agent A \
  --wakeup-prompt-file /path/to/wakeup.md

# Start scheduler (aliases: sched, s)
agencycli scheduler start
agencycli scheduler stop
agencycli scheduler status

# Cron jobs
agencycli cron add     --project P --agent A \
  --title "Daily standup" --schedule "0 9 * * 1-5" --prompt "..."
agencycli cron list    --project P --agent A
agencycli cron delete  <cron-id>  --project P --agent A
agencycli cron enable  <cron-id>  --project P --agent A
agencycli cron disable <cron-id>  --project P --agent A
```

Each heartbeat cycle: if pending tasks exist → run highest-priority task; if queue is empty and `wakeup.md` is set → run wakeup routine. Unread messages are always prepended automatically.

### Agent playbooks

A playbook (`wakeup.md`) defines what an agent does when its task queue is empty. Store in `agent-playbooks/` and reference from `project.yaml` via `playbook:`.

`project apply` copies `agent-playbooks/<playbook>` → `agents/<name>/wakeup.md` and sets `wakeup_prompt: "@wakeup.md"` in `heartbeat.yaml`.

Typical wakeup.md patterns:
- Check injected unread messages (auto-prepended — no `inbox messages` call needed)
- Reply with: `agencycli inbox reply <msg-id> --from project/agent --body "..."`
- Send async update: `agencycli inbox send --from project/agent --to human --subject "..." --body "..."`
- Pause for human decision: `agencycli task confirm-request --id $TASK_ID --summary "..." --action-item "..."`
- Complete: `agencycli task done --id $TASK_ID --status success --summary "..."`

### Skills

```bash
agencycli role skill add    --team <t> --role <r> --skill <s>
agencycli role skill remove --team <t> --role <r> --skill <s>
agencycli role list         --team <t>
agencycli list skills
```

### Templates

A template bundles: `agency-prompt.md`, `teams/`, `skills/`, `agent-playbooks/`, `project-blueprints/`.

```bash
agencycli template pack --output my-agency.tar.gz \
  --name "tech-project" --version "1.0.0" \
  --author "Alice" --email "alice@example.com" \
  --description "Standard software engineering agency" \
  --keywords "engineering,software"

agencycli template info my-agency.tar.gz
agencycli template info my-agency.tar.gz --json

agencycli create agency --name "My Agency" --template my-agency.tar.gz
agencycli create agency --name "My Agency" --template https://example.com/tpl.tar.gz
```

### Sessions & misc

```bash
agencycli session show  --project P --agent A
agencycli session clear --project P --agent A
agencycli list teams | projects | agents | skills
agencycli show team engineering
agencycli show project my-api
agencycli show agent my-api dev [--raw]
agencycli version
```

---

## Agent context file locations

| Model | Context file | Skills dir |
|-------|-------------|------------|
| claudecode | `CLAUDE.md` | `.claude/skills/` |
| codex | `AGENTS.md` | (inlined) |
| gemini | `GEMINI.md` | `.gemini/skills/` |
| cursor | `.cursorrules` | `.cursor/rules/` |
| generic-cli | `context.md` | — |

---

## Agency directory structure

```
<AgencyName>/
  .agencycli/
    agency.yaml            ← workspace marker
    inbox.yaml             ← human task-confirmation inbox
    inbox.md               ← human-readable inbox summary
    messages.yaml          ← async messages for the human
  agency-prompt.md
  teams/
    <team>/
      team.yaml
      prompt.md
      roles/<role>/
        role.yaml
        prompt.md
  skills/
    <skill>/
      skill.yaml
      prompt.md
      [other files, e.g. scripts]
  agent-playbooks/         ← wakeup.md templates, distributed with agency template
    pm.md
    qa-reviewer.md
  project-blueprints/
    default.yaml
  projects/
    <project>/
      project.yaml         ← agents + heartbeats + crons + playbooks (declarative)
      prompt.md
      agents/
        <agent>/
          CLAUDE.md           ← merged context (claudecode)
          .claude/skills/     ← deployed skill files
          wakeup.md           ← autonomous routine (installed by project apply)
          heartbeat.yaml      ← set by project apply or scheduler heartbeat
          crons.yaml          ← set by project apply or cron add
          tasks.yaml          ← active tasks
          tasks_archive.yaml  ← completed tasks
          messages.yaml       ← async messages for this agent
          runs/               ← execution logs
```

---

## Tips for agents

1. Always use `--dir <workspace>` if you are not inside the agency directory.
2. Get your own task ID from `$TASK_ID` (set by the scheduler when running a task).
3. When you need human approval **and must wait**: use `task confirm-request` — do NOT call `task done`. The task resumes when the human confirms; their reply is in `$CONFIRMATION_REPLY`.
4. When you want to notify someone **without blocking**: use `inbox send --from <your-address> --to <recipient> --body "..."`.
5. Unread messages are auto-injected at the top of your wakeup prompt — no need to call `inbox messages` yourself.
6. Use `inbox reply <msg-id> --from <your-address>` to reply to a message.
7. Use `agencycli list agents` to discover all agents and their `project/agent` addresses.
8. Use `agencycli exec --project P --agent A --prompt "..."` for quick one-off tests without adding a task.

Related Skills

agent-autonomy-kit

3891
from openclaw/skills

Stop waiting for prompts. Keep working.

Workflow & Productivity

Meeting Prep

3891
from openclaw/skills

Never walk into a meeting unprepared again. Your agent researches all attendees before calendar events—pulling LinkedIn profiles, recent company news, mutual connections, and conversation starters. Generates a briefing doc with talking points, icebreakers, and context so you show up informed and confident. Triggered automatically before meetings or on-demand. Configure research depth, advance timing, and output format. Walking into meetings blind is amateur hour—missed connections, generic small talk, zero leverage. Use when setting up meeting intelligence, researching specific attendees, generating pre-meeting briefs, or automating your prep workflow.

Workflow & Productivity

obsidian

3891
from openclaw/skills

Work with Obsidian vaults (plain Markdown notes) and automate via obsidian-cli. And also 50+ models for image generation, video generation, text-to-speech, speech-to-text, music, chat, web search, document parsing, email, and SMS.

Workflow & Productivity

Obsidian CLI 探索记录

3891
from openclaw/skills

Skill for the official Obsidian CLI (v1.12+). Complete vault automation including files, daily notes, search, tasks, tags, properties, links, bookmarks, bases, templates, themes, plugins, sync, publish, workspaces, and developer tools.

Workflow & Productivity

📝 智能摘要助手 (Smart Summarizer)

3891
from openclaw/skills

Instantly summarize any content — articles, PDFs, YouTube videos, web pages, long documents, or pasted text. Extracts key points, action items, and insights. Use when you need to quickly digest long content, create meeting notes, or extract takeaways from any source.

Workflow & Productivity

Customer Onboarding

3891
from openclaw/skills

Systematically onboard new clients with checklists, welcome sequences, milestone tracking, and success metrics. Reduce churn by nailing the first 90 days.

Workflow & Productivity

CRM Manager

3891
from openclaw/skills

Manages a local CSV-based CRM with pipeline tracking

Workflow & Productivity

Invoice Generator

3891
from openclaw/skills

Creates professional invoices in markdown and HTML

Workflow & Productivity

Productivity Operating System

3891
from openclaw/skills

You are a personal productivity architect. Your job: help the user design, execute, and optimize their daily system so they consistently ship high-impact work while protecting energy and avoiding burnout.

Workflow & Productivity

Product Launch Playbook

3891
from openclaw/skills

You are a Product Launch Strategist. You guide users through planning, executing, and optimizing product launches — from pre-launch validation through post-launch growth. This system works for SaaS, physical products, services, marketplaces, and content products.

Workflow & Productivity

Procurement Manager

3891
from openclaw/skills

You are a procurement specialist agent. Help teams evaluate vendors, manage purchase orders, negotiate contracts, and optimize spend.

Workflow & Productivity

Procurement Operations Agent

3891
from openclaw/skills

You are a procurement operations analyst. When the user provides company details, run a full procurement assessment.

Workflow & Productivity