OpenClaw Agent Reconciliation Skill
Overview
This skill enables systematic reconciliation between the filesystem agent definitions (AGENTS.md files under agent-companies-core/agents/openclawforge-ai/agents/) and the OpenClaw SQLite database tables (openclaw_agents, openclaw_agent_skills, openclaw_agent_models, openclaw_agent_capabilities) that power the OpenClaw control plane.
Trigger Conditions
- User asks to "reconcile agents"
- User asks to "check agents against database"
- User asks to "verify agent registrations"
- User asks to "audit agent names"
- User asks to "validate naming conventions"
- User asks to "find missing agents" or "find extra agents"
- User asks to "generate agent fix SQL"
- User asks to "sync agents to database"
Execution Workflow
Step 0: Schema Validation (MANDATORY)
Before generating ANY SQL, validate the schema:
Query the openclaw_agents table schema:
PRAGMA table_info(openclaw_agents);
Verify columns match expected from schema/create-openclaw-tables.sql:
id, name, slug, role, reports_to, description, skills, company, status, adapter_type, adapter_config, runtime_config, budget_monthly_cents, spent_monthly_cents, last_heartbeat_at, capabilities, metadata, created_at, updated_at
CRITICAL: The openclaw_agents table has:
name = human-readable agent name (e.g., "OpenClaw Agent Reconciler")
slug = agent identifier (e.g., "openclaw-ai-agent-reconciler")
company = company namespace (e.g., "openclawforge-ai")
Step 1: Filesystem Discovery
- Scan
agent-companies-core/agents/openclawforge-ai/agents/**/AGENTS.md
- Parse YAML frontmatter for each agent
- Extract:
name, slug, reportsTo, role, description, skills
- Build filesystem agent index
Step 2: Database Discovery
- Query
openclaw_agents table → all rows
- Query
openclaw_agent_skills table → skill assignments by agent_id
- Query
openclaw_agent_models table → model assignments by agent_id
- Build database agent index
Step 3: Reconciliation Match
- Match filesystem agents to database agents by
slug ↔ slug
- Identify missing agents: in filesystem, not in database
- Identify extra agents: in database, not in filesystem
- Identify field mismatches: name, role, reports_to, description differences
- Identify missing skill assignments
- Identify missing model assignments
- Identify naming convention violations
Step 4: SQL Fix Generation
Generate SQL INSERT/UPDATE/DELETE statements:
| Issue Type |
SQL Operation |
| Missing agent |
INSERT INTO openclaw_agents |
| Extra agent |
DELETE FROM openclaw_agents (FK cascade) |
| Field mismatch |
UPDATE openclaw_agents |
| Missing skill |
INSERT INTO openclaw_agent_skills |
| Missing model |
INSERT INTO openclaw_agent_models |
Step 5: Collaboration Delegation
- Database operations → delegate to
openclaw-ai-sqlite-manager
- Agent creation logic → delegate to
openclaw-ai-agent-creator
- Model assignment logic → delegate to
openclaw-ai-model-assigner
Step 6: Report Output
- Save SQL to
reconciliation_fixes.sql
- Save JSON report to
reconciliation_report.json
- Print summary with counts per table
Input Parameters
| Parameter |
Type |
Required |
Description |
agents_dir |
string |
No |
Path to agents directory (default: agent-companies-core/agents/openclawforge-ai/agents) |
db_path |
string |
No |
Path to SQLite database (default: schema/openclaw-app.db) |
output_sql_path |
string |
No |
Path for SQL output (default: reconciliation_fixes.sql) |
dry_run |
boolean |
No |
If true, only report without generating SQL |
Error Handling
- Missing agents directory: Report error and exit
- Database connection failure: Report error with connection details
- Malformed AGENTS.md: Log warning, skip file, continue
- No database agents: Report warning but continue with filesystem scan
Skill Name: openclaw-ai-agent-reconciler
Version: 1.0
Owner: openclaw-ai-agent-reconciler
Created: 2026-05-01
1---2name: openclaw-ai-agent-reconciler3description: >4 Audit filesystem agent definitions (AGENTS.md) against the OpenClaw SQLite database (openclaw_agents, openclaw_agent_skills, openclaw_agent_models, openclaw_agent_capabilities tables). Identify missing registrations, extra database entries, field mismatches, and naming convention violations. Generate SQL fixes via collaboration with SQLite Manager.5triggers:6 - agent reconciliation request7 - filesystem database audit8 - missing agent detection9 - naming convention validation10 - agent table reconciliation11 - database agent integrity check12 - fresh reconciliation13 - full agent sync14 - sync agents to database15 - generate reconciliation SQL16metadata:17 source: https://skillmd.com/skills/construct-ai-primary/openclaw-ai-agent-reconciler18---1920# OpenClaw Agent Reconciliation Skill2122## Overview2324This skill enables systematic reconciliation between the filesystem agent definitions (AGENTS.md files under `agent-companies-core/agents/openclawforge-ai/agents/`) and the OpenClaw SQLite database tables (`openclaw_agents`, `openclaw_agent_skills`, `openclaw_agent_models`, `openclaw_agent_capabilities`) that power the OpenClaw control plane.2526## Trigger Conditions2728- User asks to "reconcile agents"29- User asks to "check agents against database"30- User asks to "verify agent registrations"31- User asks to "audit agent names"32- User asks to "validate naming conventions"33- User asks to "find missing agents" or "find extra agents"34- User asks to "generate agent fix SQL"35- User asks to "sync agents to database"3637## Execution Workflow3839### Step 0: Schema Validation (MANDATORY)4041Before generating ANY SQL, validate the schema:42431. Query the `openclaw_agents` table schema:44 ```sql45 PRAGMA table_info(openclaw_agents);46 ```47482. Verify columns match expected from `schema/create-openclaw-tables.sql`:49 - `id`, `name`, `slug`, `role`, `reports_to`, `description`, `skills`, `company`, `status`, `adapter_type`, `adapter_config`, `runtime_config`, `budget_monthly_cents`, `spent_monthly_cents`, `last_heartbeat_at`, `capabilities`, `metadata`, `created_at`, `updated_at`50513. **CRITICAL**: The `openclaw_agents` table has:52 - `name` = human-readable agent name (e.g., "OpenClaw Agent Reconciler")53 - `slug` = agent identifier (e.g., "openclaw-ai-agent-reconciler")54 - `company` = company namespace (e.g., "openclawforge-ai")5556### Step 1: Filesystem Discovery57581. Scan `agent-companies-core/agents/openclawforge-ai/agents/**/AGENTS.md`592. Parse YAML frontmatter for each agent603. Extract: `name`, `slug`, `reportsTo`, `role`, `description`, `skills`614. Build filesystem agent index6263### Step 2: Database Discovery64651. Query `openclaw_agents` table → all rows662. Query `openclaw_agent_skills` table → skill assignments by `agent_id`673. Query `openclaw_agent_models` table → model assignments by `agent_id`684. Build database agent index6970### Step 3: Reconciliation Match71721. Match filesystem agents to database agents by `slug` ↔ `slug`732. Identify **missing agents**: in filesystem, not in database743. Identify **extra agents**: in database, not in filesystem754. Identify **field mismatches**: name, role, reports_to, description differences765. Identify **missing skill assignments**776. Identify **missing model assignments**787. Identify **naming convention violations**7980### Step 4: SQL Fix Generation8182Generate SQL INSERT/UPDATE/DELETE statements:8384| Issue Type | SQL Operation |85|------------|---------------|86| Missing agent | INSERT INTO openclaw_agents |87| Extra agent | DELETE FROM openclaw_agents (FK cascade) |88| Field mismatch | UPDATE openclaw_agents |89| Missing skill | INSERT INTO openclaw_agent_skills |90| Missing model | INSERT INTO openclaw_agent_models |9192### Step 5: Collaboration Delegation9394- **Database operations** → delegate to `openclaw-ai-sqlite-manager`95- **Agent creation logic** → delegate to `openclaw-ai-agent-creator`96- **Model assignment logic** → delegate to `openclaw-ai-model-assigner`9798### Step 6: Report Output99100- Save SQL to `reconciliation_fixes.sql`101- Save JSON report to `reconciliation_report.json`102- Print summary with counts per table103104## Input Parameters105106| Parameter | Type | Required | Description |107|-----------|------|----------|-------------|108| `agents_dir` | string | No | Path to agents directory (default: `agent-companies-core/agents/openclawforge-ai/agents`) |109| `db_path` | string | No | Path to SQLite database (default: `schema/openclaw-app.db`) |110| `output_sql_path` | string | No | Path for SQL output (default: `reconciliation_fixes.sql`) |111| `dry_run` | boolean | No | If true, only report without generating SQL |112113## Error Handling114115- **Missing agents directory**: Report error and exit116- **Database connection failure**: Report error with connection details117- **Malformed AGENTS.md**: Log warning, skip file, continue118- **No database agents**: Report warning but continue with filesystem scan119120---121122**Skill Name**: openclaw-ai-agent-reconciler123**Version**: 1.0124**Owner**: openclaw-ai-agent-reconciler125**Created**: 2026-05-01