Agentic Site Updater Tool

Status: In Progress | Updated: June 16, 2025

1. Directory Layout (Enterprise Bundle)

ai_scp_agent/
│
├── bin/
│   └── ai_agent.py            # Final production agent code
│
├── config/
│   └── config.ini             # Sample configuration file
│
├── systemd/
│   └── ai_agent.service       # Linux service unit file
│
├── tests/
│   └── test_harness.py        # Automated file drop tester
│
├── docs/
│   └── deployment_readme.md   # Deployment guide   └── troubleshooting.md     # Ops troubleshooting guide
│
└── logs/                      # Log file directory (optional pre-created)

2. Test Harness (test_harness.py)

Simple tester for simulating file drops:

import os
import time
from datetime import datetime

WATCH_DIR = '/home/username/watchqueue'  # Adjust to match config.ini

sample_content = """
# Sample Markdown Test File

This is a simulated test file for AI SCP agent.
"""

for i in range(3):
    filename = f"testfile_{datetime.now().strftime('%Y%m%d%H%M%S')}_{i}.md"
    filepath = os.path.join(WATCH_DIR, filename)
    with open(filepath, 'w') as f:
        f.write(sample_content)
    print(f"Created {filepath}")
    time.sleep(1)

3. Troubleshooting Guide (troubleshooting.md)

Common Failure Points

| Symptom | Possible Cause | Resolution | | ------------------- | ------------------ | ---------------------------------------------- | | SSH Failure | Private key issue | Verify key type, permissions, authorized_keys | | SCP failure | Wrong path | Confirm remote path permissions | | Remote script fails | Build script issue | SSH manually to test script | | Agent not running | systemd failure | Check journalctl -u ai_agent |


4. Deployment Instructions

Step 1: Install Required Packages

sudo apt install python3-pip
pip3 install paramiko watchdog

Step 2: Create Deployment Layout

mkdir -p /opt/ai_scp_agent/{bin,config,systemd,logs}
# Copy files into place

Step 3: Edit Config

vim /opt/ai_scp_agent/config/config.ini

Step 4: Enable Service

sudo cp /opt/ai_scp_agent/systemd/ai_agent.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable ai_agent
sudo systemctl start ai_agent

Step 5: Validate Logs

journalctl -u ai_agent -f
# OR
cat /opt/ai_scp_agent/logs/agent.log

Step 6: Simulate Test Run

python3 /opt/ai_scp_agent/tests/test_harness.py

5. Operational Notes

  • Safe for continuous 24/7 operation
  • Automatic file quarantine on failure
  • Atomic file moves prevent corruption
  • Preflight SSH checks avoid unnecessary failures
  • Agent fully logs all actions for audit trail

6. Security Posture

  • SSH key only (preferable)
  • Private keys secured via file permissions
  • Optional host key pinning for advanced security
  • No plaintext credentials stored
  • Agent runs under dedicated restricted Linux user

"Stable automation scales. Predictable automation survives." 🚀