{
  "_schema": "knowledge-base-article/v1",
  "title": "Self-Maintaining Federation Pattern",
  "intro": "How to automate your federation endpoints so they stay current without manual maintenance — a key advancement in v7.0.",
  "sections": [
    {
      "heading": "The Problem",
      "body": "<p>Manually updating 6 JSON endpoints every time your site changes is tedious and error-prone. A self-maintaining federation uses scripts and AI agent prompts to keep all endpoints current, validated, and in sync automatically.</p>"
    },
    {
      "heading": "Reference Automation Scripts",
      "body": "<table class='standards-table'><thead><tr><th>Script</th><th>Responsibility</th><th>Trigger</th></tr></thead><tbody><tr><td><code>calculate_karma.py</code></td><td>Compute Digital Karma Score, write karma.json</td><td>Daily or on content change</td></tr><tr><td><code>update_federation.py</code></td><td>Refresh timestamps, regenerate health.json</td><td>On rebuild</td></tr><tr><td><code>harvest_data.py</code></td><td>Pull site data from approved sources</td><td>Scheduled</td></tr><tr><td><code>rebuild.sh</code></td><td>Master orchestration: runs all scripts, validates output</td><td>On deploy</td></tr></tbody></table>"
    },
    {
      "heading": "Agent System Prompt",
      "body": "<p>Define an agent system prompt at <code>/prompts/agent-system.md</code> that gives an AI agent its role and operating boundaries. Core responsibilities: Monitor, Harvest, Validate, Update, Report.</p><p>The agent can read files, update <code>/data/</code>, <code>/datasets/</code>, and <code>/ai/</code> directories, and run validators — but should never remove required endpoints or change the federation version without approval.</p>"
    },
    {
      "heading": "Getting Started",
      "body": "<p>Start with the master rebuild script. Even a simple shell script that runs the karma calculator and updates the health endpoint timestamp is a meaningful first step. Reference implementation at <a href='https://www.aiwebsitesystems.com' target='_blank' rel='noopener'>AI Website Systems</a>.</p>"
    }
  ],
  "seo": {
    "meta_title": "Self-Maintaining Federation Pattern | Knowledge Base | Digital Karma Web",
    "meta_description": "How to automate your Digital Karma Web Federation endpoints so they stay current without manual maintenance."
  }
}
