PHPackages                             myctobot/aoe-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. myctobot/aoe-php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

myctobot/aoe-php
================

AI Agent Session Manager - PHP port of agent-of-empires with multi-tenancy support

v1.0.1(2mo ago)012MITPHPPHP &gt;=8.1

Since Feb 19Pushed 2mo agoCompare

[ Source](https://github.com/mfrederico/aoe-php)[ Packagist](https://packagist.org/packages/myctobot/aoe-php)[ RSS](/packages/myctobot-aoe-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (2)Used By (0)

AOE-PHP - AI Agent Session Manager
==================================

[](#aoe-php---ai-agent-session-manager)

A PHP port of [agent-of-empires](https://github.com/njbrake/agent-of-empires) - a terminal session manager for AI coding agents (Claude Code, OpenCode) using tmux.

Features
--------

[](#features)

- **Multi-tenant support** - Isolated sessions per tenant, integrated with myctobot config
- **Session management** - Create, list, remove, and manage AI agent sessions
- **tmux integration** - Each session runs in its own tmux session
- **WebSocket server** - Real-time terminal streaming via OpenSwoole (planned)
- **CLI interface** - Full command-line interface using Symfony Console

Requirements
------------

[](#requirements)

- PHP 8.1+
- Composer
- tmux
- OpenSwoole extension (for WebSocket features)

Installation
------------

[](#installation)

```
composer require myctobot/aoe-php
```

Or clone and install locally:

```
git clone
cd aoe-php
composer install
```

Configuration
-------------

[](#configuration)

### Default Configuration

[](#default-configuration)

The default configuration is in `config/aoe.php`:

```
return [
    'storage_path' => $_SERVER['HOME'] . '/.aoe-php',
    'default_tool' => 'claude',
    'myctobot_conf_path' => '/path/to/myctobot/conf',

    'tmux' => [
        'prefix' => 'aoe-',  // Session prefix: aoe-{tenant}-{id}
    ],

    'websocket' => [
        'host' => '127.0.0.1',
        'port' => 9502,
        'poll_interval' => 100,
    ],
];
```

### Tenant Configuration

[](#tenant-configuration)

Tenants are discovered from myctobot config files (`conf/config.{tenant}.ini`). Add an `[aoe]` section for tenant-specific overrides:

```
; In myctobot/conf/config.acme.ini
[aoe]
storage_path = /var/lib/aoe/acme
default_tool = claude
```

Usage
-----

[](#usage)

All session commands require a tenant specified via `--tenant` flag or `AOE_TENANT` environment variable.

### List Available Tenants

[](#list-available-tenants)

```
bin/aoe tenant:list
```

Output:

```
+---------+----------+----------------+
| Tenant  | Sessions | Has AOE Config |
+---------+----------+----------------+
| acme    | 3        | Yes            |
| demo    | 0        | No             |
+---------+----------+----------------+

```

### Add a Session

[](#add-a-session)

```
# Add current directory
bin/aoe --tenant=acme add

# Add specific path with options
bin/aoe --tenant=acme add /path/to/project \
    --title="My Project" \
    --group="frontend/web" \
    --tool=claude
```

### List Sessions

[](#list-sessions)

```
bin/aoe --tenant=acme sessions

# Filter by group
bin/aoe --tenant=acme sessions --group="frontend"

# JSON output
bin/aoe --tenant=acme sessions --json
```

Output:

```
+----------+------------------+-----------+--------+-------+---------------------------+
| ID       | Title            | Status    | Tool   | Group | Path                      |
+----------+------------------+-----------+--------+-------+---------------------------+
| 49e8e3b0 | My Project       | ⏹ Stopped | claude | -     | /home/user/projects/myapp |
+----------+------------------+-----------+--------+-------+---------------------------+

```

### Show Status Summary

[](#show-status-summary)

```
bin/aoe --tenant=acme status
```

Output:

```
Session Status for tenant: acme

By Status:
  ⚡ Running:   1
  ⏳ Waiting:   0
  💤 Idle:      2
  ⏹ Stopped:   5

By Tool:
  claude:      6
  opencode:    2

Total: 8 session(s), 1 active

```

### Remove a Session

[](#remove-a-session)

```
# With confirmation
bin/aoe --tenant=acme remove abc12345

# Force (no confirmation)
bin/aoe --tenant=acme remove abc1 --force
```

### Using Environment Variable

[](#using-environment-variable)

```
export AOE_TENANT=acme
bin/aoe sessions
bin/aoe add /path/to/project
bin/aoe status
```

### Start a Session

[](#start-a-session)

```
# Start session (creates tmux session)
bin/aoe --tenant=acme session:start abc12345

# Override command
bin/aoe --tenant=acme session:start abc1 --command="claude --continue"

# Dry run (show what would happen)
bin/aoe --tenant=acme session:start abc1 --dry-run
```

### Stop a Session

[](#stop-a-session)

```
# Stop with confirmation
bin/aoe --tenant=acme session:stop abc12345

# Force stop (no confirmation)
bin/aoe --tenant=acme session:stop abc1 --force
```

### Restart a Session

[](#restart-a-session)

```
bin/aoe --tenant=acme session:restart abc12345
```

### Attach to a Session

[](#attach-to-a-session)

```
bin/aoe --tenant=acme session:attach abc12345
# Press Ctrl+B then D to detach
```

### Session Status Detail

[](#session-status-detail)

```
# Show detailed status
bin/aoe --tenant=acme session:status abc12345

# Include captured pane content
bin/aoe --tenant=acme session:status abc1 --capture=30

# Update status by analyzing pane content
bin/aoe --tenant=acme session:status abc1 --update

# JSON output
bin/aoe --tenant=acme session:status abc1 --json
```

Project Structure
-----------------

[](#project-structure)

```
aoe-php/
├── bin/
│   └── aoe                      # CLI entry point
├── config/
│   └── aoe.php                  # Default configuration
├── src/
│   ├── Aoe.php                  # Main facade (planned)
│   ├── Config/
│   │   └── AoeConfig.php        # Configuration loader
│   ├── Tenant/
│   │   ├── TenantContext.php    # Current tenant holder
│   │   ├── TenantResolver.php   # Resolve tenant from CLI/env
│   │   └── TenantRequiredException.php
│   ├── Session/
│   │   ├── Instance.php         # Session entity
│   │   ├── Status.php           # Status enum
│   │   ├── Storage.php          # JSON persistence
│   │   ├── WorktreeInfo.php     # Git worktree info
│   │   └── Group.php            # Session grouping
│   ├── Tmux/                    # (Phase 2 - Complete)
│   │   ├── TmuxService.php      # tmux wrapper (tenant-prefixed)
│   │   └── StatusDetector.php   # Detect status from output
│   ├── Git/                     # (Phase 5)
│   │   └── WorktreeService.php  # Git worktree operations
│   ├── WebSocket/               # (Phase 3-4)
│   │   ├── Server.php           # OpenSwoole WebSocket
│   │   ├── TerminalProxy.php    # Terminal streaming
│   │   ├── MessageHandler.php   # Command handling
│   │   └── ClientManager.php    # Client tracking
│   └── Cli/
│       ├── Application.php      # CLI application
│       └── Commands/
│           ├── BaseCommand.php
│           ├── TenantCommand.php
│           ├── AddCommand.php
│           ├── ListCommand.php
│           ├── RemoveCommand.php
│           ├── StatusCommand.php
│           ├── SessionStartCommand.php
│           ├── SessionStopCommand.php
│           ├── SessionRestartCommand.php
│           ├── SessionAttachCommand.php
│           └── SessionStatusCommand.php
└── tests/

```

Data Storage
------------

[](#data-storage)

Sessions are stored in JSON files, isolated per tenant:

```
~/.aoe-php/
└── tenants/
    ├── acme/
    │   ├── sessions.json
    │   └── groups.json
    └── demo/
        ├── sessions.json
        └── groups.json

```

Implementation Status
---------------------

[](#implementation-status)

### Phase 1: Core Session Management ✅

[](#phase-1-core-session-management-)

- Project structure and composer.json
- Multi-tenancy support (TenantContext, TenantResolver)
- Configuration with myctobot INI integration
- Session entities (Instance, Status, WorktreeInfo, Group)
- JSON storage (tenant-scoped)
- CLI commands: `tenant:list`, `add`, `sessions`, `remove`, `status`

### Phase 2: Tmux Integration ✅

[](#phase-2-tmux-integration-)

- TmuxService wrapper (tenant-prefixed sessions)
- StatusDetector (analyze pane content for Running/Waiting/Idle/Error)
- CLI commands: `session:start`, `session:stop`, `session:restart`, `session:attach`, `session:status`
- Instance class integration: `start()`, `stop()`, `restart()`, `captureOutput()`, `sendKeys()`, `refreshStatus()`

### Phase 3: WebSocket Server (Planned)

[](#phase-3-websocket-server-planned)

- OpenSwoole WebSocket server
- ClientManager (tenant-scoped connections)
- MessageHandler with tenant authentication
- Commands: `server:start`, `server:stop`

### Phase 4: Terminal Proxy (Planned)

[](#phase-4-terminal-proxy-planned)

- TerminalProxy with polling loop
- Output diffing
- ANSI handling
- Real-time streaming to WebSocket clients

### Phase 5: Advanced Features (Planned)

[](#phase-5-advanced-features-planned)

- Git worktree support
- Claude session ID detection
- Session forking
- Group management commands

Integration with myctobot
-------------------------

[](#integration-with-myctobot)

As a Composer package:

```
{
    "require": {
        "myctobot/aoe-php": "^1.0"
    }
}
```

Usage in controllers:

```
use Aoe\Session\Storage;
use Aoe\Tenant\TenantContext;
use Aoe\Config\AoeConfig;

// Set tenant from session
$tenantSlug = $_SESSION['tenant_slug'];
TenantContext::set($tenantSlug);

// Load config
$config = AoeConfig::createDefault();
$tenantConfig = $config->forTenant($tenantSlug);

// Get sessions
$storage = new Storage($tenantSlug);
$sessions = $storage->loadAll();
```

WebSocket Protocol (Planned)
----------------------------

[](#websocket-protocol-planned)

```
// Client -> Server
{"action": "auth", "tenant": "acme", "token": "optional"}
{"action": "subscribe", "sessionId": "abc123"}
{"action": "command", "sessionId": "abc123", "command": "start"}
{"action": "sendKeys", "sessionId": "abc123", "keys": "y\n"}

// Server -> Client
{"type": "auth", "success": true, "tenant": "acme"}
{"type": "output", "sessionId": "abc123", "data": "terminal output..."}
{"type": "status", "sessionId": "abc123", "status": "running"}
```

License
-------

[](#license)

MIT

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance83

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

88d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5bc1ed4fcfebe896dea9c9ee2aac5c62be92cda12ae96a3ef9dcb91485afeee4?d=identicon)[mfrederico](/maintainers/mfrederico)

---

Top Contributors

[![mfrederico](https://avatars.githubusercontent.com/u/197117?v=4)](https://github.com/mfrederico "mfrederico (8 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/myctobot-aoe-php/health.svg)

```
[![Health](https://phpackages.com/badges/myctobot-aoe-php/health.svg)](https://phpackages.com/packages/myctobot-aoe-php)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.7k509.9M17.0k](/packages/laravel-framework)[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.1k84.2M225](/packages/laravel-horizon)[laravel/nightwatch

The official Laravel Nightwatch package.

3526.1M13](/packages/laravel-nightwatch)[shlinkio/shlink

A self-hosted and PHP-based URL shortener application with CLI and REST interfaces

4.8k4.3k](/packages/shlinkio-shlink)[fisharebest/webtrees

webtrees online genealogy

73710.5k13](/packages/fisharebest-webtrees)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
