Tools
Org
Hierarchical multi-agent architecture framework with automated enforcement for OpenClaw. Skill + Plugin bundle: agents understand the hierarchy AND it's auto-enforced on workspace files.
Configuration Example
{
"plugins": {
"allow": ["architecture-enforcer"],
"config": {
"architecture-enforcer": {
"dryRun": false,
"forceOverwrite": false,
"skipAgents": ["my-special-agent"]
}
}
}
}
README
# ๐๏ธ OpenClaw Subagent Architecture
Hierarchical multi-agent architecture framework with **automated enforcement** for [OpenClaw](https://openclaw.com).
> **Skill + Plugin bundle**: Agents *understand* the hierarchy (skill) AND it's *auto-enforced* (plugin).
## The Problem
OpenClaw supports multiple agents, but when you add a new one, nothing automatically:
- Tells it who its parent agent is
- Sets its layer/depth/tier in SOUL.md
- Creates AGENTS.md with the hierarchy registry format
- Creates AGENT-MANIFEST.md with escalation policies
- Updates the central org registry
You end up with agents that don't know their place in the hierarchy.
## The Solution
This package combines:
| Component | What It Does |
|-----------|-------------|
| **Skill** | Agents read the architecture spec, understand layers/protocols/delegation |
| **Plugin** | Gateway hooks auto-write hierarchy files when agents are added or on startup |
## Features
- ๐๏ธ **6-Layer Hierarchy** โ L0 Orchestrator โ L1 Director โ L2 Manager โ L3 Specialist โ L4 Operator โ L5 Worker
- ๐ **Auto-Enforcement** โ patches SOUL.md, AGENTS.md, AGENT-MANIFEST.md on gateway start and agent spawn
- ๐ง **Smart SOUL.md Patching** โ injects hierarchy section without destroying custom persona content
- ๐ก๏ธ **Idempotent** โ only writes when files are missing or incorrect
- ๐ **4-Tier Model System** โ cost-efficient model allocation per layer
- ๐ **Plug-and-Play Departments** โ add/remove domain directors anytime
- ๐ **Observability** โ STATUS.md dashboard, heartbeat protocol
- ๐งฉ **Result Caching** โ shared cache prevents redundant work across branches
## Quick Start
### 1. Clone
```bash
git clone https://github.com/itomtangme/openclaw-org.git \
~/.openclaw/skills/openclaw-org
```
### 2. Symlink plugin
```bash
ln -s ~/.openclaw/skills/openclaw-org \
~/.openclaw/workspace/plugins/architecture-enforcer
```
### 3. Enable
```bash
openclaw config set plugins.allow '["architecture-enforcer"]'
openclaw gateway restart
```
That's it. The plugin will audit all agent workspaces on startup and patch any missing hierarchy files.
## How It Works
```
openclaw.json (agents.list + subagents.allowAgents)
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Hierarchy Resolution โ
โ Derive parent/child/layer โ
โ from config relationships โ
โโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Per-Agent Enforcement โ
โ Check workspace files โ
โ Write missing/incorrect โ
โ Preserve custom content โ
โโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโ
โ
โผ
workspace-<agent>/
โโโ SOUL.md (hierarchy section injected)
โโโ AGENTS.md (v2.2 registry format)
โโโ AGENT-MANIFEST.md (parent, capabilities, escalation)
```
### Hierarchy Resolution
The plugin reads `openclaw.json` and derives hierarchy:
- `agents.list[].id` โ agent identity
- `agents.list[].subagents.allowAgents` โ parentโchild relationships
- `main` = L0, `sysadmin`/`full-power` = L1-C (by convention)
- Depth = walk parent chain โ determines layer (L1-D, L2, L3, etc.)
### Enforcement Triggers
| Trigger | Scope |
|---------|-------|
| Gateway starts | All agent workspaces |
| Sub-agent spawned | Newly spawned agent |
| `/enforce` command | All or specific agent |
| CLI `enforce-architecture` | Scriptable, supports `--dry-run` |
## Architecture Overview
```
L0 Orchestrator (main) โ CEO, routes & synthesizes
โโโ L1-C Core: sysadmin โ CTO, manages OpenClaw itself
โโโ L1-C Core: full-power โ Emergency override
โโโ L1-D Department Director (pluggable)
โ โโโ L2 Manager
โ โ โโโ L3 Specialist
โ โ โ โโโ L4 Operator
โ โ โ โ โโโ L5 Worker (ephemeral)
```
### Model Tiers
| Tier | Layer | Purpose |
|------|-------|---------|
| Tier-1 | L0, L1 | Max intelligence (Opus/GPT-5) |
| Tier-2 | L1-D, L2 | Strong (Sonnet/Gemini Pro) |
| Tier-3 | L3, L4 | Fast (Flash/Haiku) |
| Tier-4 | L4, L5 | Cheapest |
**Rule**: Children inherit or downgrade tier. Never upgrade beyond parent.
## Configuration
```json
{
"plugins": {
"allow": ["architecture-enforcer"],
"config": {
"architecture-enforcer": {
"dryRun": false,
"forceOverwrite": false,
"skipAgents": ["my-special-agent"]
}
}
}
}
```
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `dryRun` | boolean | `false` | Log changes without writing |
| `forceOverwrite` | boolean | `false` | Overwrite even if v2.2 markers present |
| `skipAgents` | string[] | `[]` | Agent IDs to exclude from enforcement |
| `templateDir` | string | auto | Custom template directory path |
## Commands
### Slash Commands
```
/enforce โ Full audit of all agents
/enforce planner โ Enforce specific agent
```
### CLI
```bash
openclaw plugins cli architecture-enforcer enforce-architecture
openclaw plugins cli architecture-enforcer enforce-architecture --dry-run
openclaw plugins cli architecture-enforcer enforce-architecture --agent planner
openclaw plugins cli architecture-enforcer enforce-architecture --force
```
## File Structure
```
openclaw-org/
โโโ package.json # Plugin entry + metadata
โโโ openclaw.plugin.json # OpenClaw plugin manifest
โโโ plugin/
โ โโโ index.ts # Lifecycle hooks & commands
โ โโโ src/
โ โโโ enforcer.ts # Core enforcement engine
โโโ skill/
โ โโโ SKILL.md # Skill entry point
โ โโโ assets/templates/ # Workspace file templates
โ โ โโโ SOUL-template.md
โ โ โโโ AGENTS-template.md
โ โ โโโ MANIFEST-template.md
โ โ โโโ STATUS-template.md
โ โโโ references/
โ โโโ ARCHITECTURE.md # Complete v2.2 specification
โโโ docs/
โ โโโ DESIGN.md # Design rationale
โโโ README.md
โโโ LICENSE
```
## Prior Art
This package supersedes [openclaw-architecture](https://github.com/itomtangme/openclaw-architecture) (skill-only, no enforcement). If you're using the old skill, migrate to this one for automated enforcement.
## License
MIT
tools
Comments
Sign in to leave a comment