Agent Sync

Agent Sync turns supported SleekWP post types into file-backed configuration inside your active theme. Instead of keeping everything hidden in the database, the actual plugin data is mirrored into JSON files under your theme and kept in sync with the matching custom post type records.

This is especially useful when you want coding agents to work on plugin data in a reliable way. The data lives in real files, the folder can be versioned in Git, and each synced directory gets an AGENTS.md file so the agent sees the instructions and schema next to the JSON it is expected to edit.

Why This Exists

Most WordPress plugin configuration is stored in admin screens, custom post types, post meta, or options. That works fine for humans clicking around inside WP Admin, but it is a poor interface for coding agents. Agents either have to reverse-engineer the UI, guess the data shape, or ask you to paste raw JSON by hand.

Agent Sync fixes that by turning plugin data into durable files:

  • Readable — each item is a JSON file with a stable slug-based filename
  • Version-controlled — changes can be reviewed, committed, and deployed like code
  • Bidirectional — WP Admin updates write back to files, and file edits import back into WordPress
  • Agent-friendly — the synced folder includes an AGENTS.md file with the schema and editing instructions

The result is a first-class way of letting coding agents work on plugin data, with data and instructions living side by side.

Directory Structure

The feature is opt-in. If your active theme does not contain a sleek/ directory, nothing syncs.

When enabled, the synced files live under:

        wp-content/themes/your-theme/
└── sleek/
    ├── ai/
    │   ├── agents/
    │   │   ├── AGENTS.md
    │   │   └── content-writer.json
    │   ├── agent-modes/
    │   │   ├── AGENTS.md
    │   │   └── seo-audit.json
    │   └── chatbots/
    │       ├── AGENTS.md
    │       └── support-bot.json
    ├── pixel/
    │   └── images/
    │       ├── AGENTS.md
    │       └── launch-banner.json
    ├── rank/
    │   └── page-groups/
    │       ├── AGENTS.md
    │       └── city-pages.json
    └── view/
        ├── pages/
        │   ├── AGENTS.md
        │   └── roadmap.json
        └── views/
            ├── AGENTS.md
            └── customers.json
  
                    
Copy

Currently supported sync targets are:

  • SleekAI — chatbots, agents, and agent modes
  • SleekPixel — images
  • SleekRank — page groups
  • SleekView — admin pages and views

JSON File Format

Each synced item is stored as one JSON file. The shape is intentionally simple:

        {
  "sync": {
    "key": "7f7cc7d8-2f7e-4f6c-bd66-5f80a7c9fef4",
    "updatedAt": "2026-04-23T08:15:00+00:00",
    "version": 1
  },
  "post": {
    "title": "City Pages",
    "status": "publish"
  },
  "data": {
    "basePageId": 123,
    "urlPattern": "/services/{slug}/",
    "sources": [
      {
        "type": "json",
        "url": "https://example.com/cities.json"
      }
    ]
  }
}
  
                    
Copy

The fields are used as follows:

  • sync — internal sync metadata used to track the relationship between the file and the database record
  • post — the WordPress post title and status for the synced item
  • data — the actual plugin configuration, written directly to the post type's data meta object

The filename is based on the post slug, so the human-facing identifier stays clean. Internally, the sync.key is still kept in post meta to preserve a stable link between file and record even if slugs or titles change later.

How Sync Works

The sync is bidirectional:

  • Theme → Database — if you edit a JSON file, the matching post type record is updated on the next load
  • Database → Theme — if you edit the item in WP Admin, the JSON file is rewritten during shutdown
  • Initial backfill — existing records are exported automatically the first time sync runs and no file exists yet

Conflict resolution is timestamp-based. If the database copy is newer than the file, the database wins and the JSON file is regenerated. If the file is newer, the file is imported.

This gives you a practical workflow where both of these remain valid:

  • a developer edits JSON in the theme and refreshes WordPress
  • an editor updates the item in WP Admin and the file stays in sync automatically

Safe Defaults

The sync is deliberately conservative.

Two important safeguards are built in:

  • Missing files do not auto-delete database records. If a JSON file is missing, the existing WordPress record is exported again instead of being removed.
  • Empty data objects do not overwrite the database. An empty file payload will not backfill an empty object over an existing record.

That makes the system much safer for real-world agent workflows, especially when branches diverge or files are temporarily removed during local work.

Deleting the WordPress record in WP Admin is the intentional destructive action. In that case, the corresponding JSON file is removed as well.

AGENTS.md Generation

Each synced directory receives an AGENTS.md file automatically. This is not hand-written inside the theme. The source of truth stays in the plugin itself:

  • includes/agents/<type>/instruction.md
  • includes/agents/<type>/schema.json

When sync runs, SleekWP reads those two source files, combines them into a single AGENTS.md, and writes the result into the synced theme directory next to the JSON files.

That matters for two reasons:

  • Plugin authors keep ownership of the schema and instructions
  • Agents get a single file beside the data that explains exactly how the JSON should be edited

If either instruction.md or schema.json changes in the plugin, the generated AGENTS.md is recreated automatically.

Why This Works Well With Coding Agents

This pattern is much better than asking an agent to click around inside a complex settings screen.

The agent can:

  • open the synced folder
  • read AGENTS.md
  • inspect the real JSON files
  • make schema-aware changes
  • commit those changes like any other code change

That means the AI is working against explicit, versioned state instead of inferred UI state.

For teams using Claude Code, Codex, Cursor, or similar tools, this is the main benefit: plugin data stops being a hidden implementation detail and becomes something agents can reason about directly.

The intended workflow is simple:

  1. Create wp-content/themes/your-theme/sleek/
  2. Let SleekWP export the existing supported records into JSON files
  3. Point your coding agent at the relevant synced folder
  4. Let it use AGENTS.md plus the JSON files to make the change
  5. Refresh WordPress and continue working in WP Admin if needed

If you want to keep plugin configuration reviewable, portable, and genuinely usable by coding agents, Agent Sync is the right abstraction.