Update CRON.md with AI agent instructions

This commit is contained in:
Etherdrake
2026-02-14 13:04:18 +01:00
parent 18c45cc0b8
commit 2db9a7da0c
+49 -98
View File
@@ -1,118 +1,69 @@
# Polymarket Documentation - Daily Sync Cron Job # Polymarket Documentation - Daily Update Instructions for AI Agent
## Overview ## Mission
This cron job checks for updates to the Polymarket documentation and pushes any changes to the GitHub repository daily. Your task is to check for updates to the Polymarket documentation and push any changes to the GitHub repository daily.
## Schedule ## What You Are
- **Time:** Every day at 06:00 UTC (adjust to your preference) You are an AI assistant responsible for keeping the Polymarket documentation synchronized with the official docs.polymarket.com website.
- **Frequency:** Daily
## Instructions ## When to Run
Execute this task once per day. Choose a consistent time (e.g., early morning your time).
### 1. Check for Updates ## Step-by-Step Instructions
```bash
# Navigate to the repository
cd /home/himalaya/clawd/PolymarketDocumentation
# Fetch latest from remote ### Step 1: Navigate to the Repository
git fetch origin Go to the PolymarketDocumentation folder:
```
# Check for changes /home/himalaya/clawd/PolymarketDocumentation
git status
# If there are changes in TARGET.md, re-run the scrape
if [ -n "$(git diff origin/main -- TARGET.md)" ]; then
echo "TARGET.md changed - re-scraping..."
./scrape.sh
fi
``` ```
### 2. Add and Commit Changes ### Step 2: Check if TARGET.md Has New URLs
```bash Read the TARGET.md file and check if any new URLs have been added compared to what's already been scraped. The file contains a list of documentation URLs that need to be fetched.
# Add all new/modified files
git add -A
# Check if there are changes to commit ### Step 3: Scrape New or Updated Pages
if [ -n "$(git status --porcelain)" ]; then For each URL in TARGET.md that doesn't already have a corresponding file in the docs/ folder, or if you suspect the official docs have been updated:
git commit -m "Update Polymarket documentation - $(date -u +%Y-%m-%d)"
else 1. Use the web_fetch tool or curl to fetch each URL
echo "No changes to commit" 2. Save the content as a .md file in the appropriate docs/ subfolder
exit 0 3. Match the folder structure to the URL path (e.g., `/quickstart/overview.md` goes in `docs/quickstart/`)
fi
### Step 4: Check for Changes
Run `git status` to see what files have been added or modified.
### Step 5: Commit Changes
If there are new or updated files:
1. Add all changes: `git add -A`
2. Commit with a message that includes today's date, for example: "Update Polymarket documentation - 2026-02-14"
3. Use `git commit` to save the changes locally
### Step 6: Push to GitHub
After committing, push the changes to the remote repository:
``` ```
### 3. Push Changes
```bash
git push origin main git push origin main
``` ```
## Complete Cron Script ### Step 7: Report
Tell the user what was done:
- How many new files were added
- Which sections were updated
- Confirm the push was successful
Save this as `daily-sync.sh` and run via cron: ## Important Notes
```bash - Only commit and push if there are actual changes
#!/bin/bash - If TARGET.md hasn't changed and all docs are already scraped, simply report "No updates needed today"
# Polymarket Documentation Daily Sync - Keep the folder structure organized - match the URL paths
# Runs daily to check for doc updates and push changes - The repository is at: https://github.com/Etherdrake/PolymarketDocumentation
set -e ## Example Output
REPO_DIR="/home/himalaya/clawd/PolymarketDocumentation" When you complete this task, say something like:
cd "$REPO_DIR"
echo "=== $(date -u) Starting daily sync ===" "Checked Polymarket documentation. No new URLs in TARGET.md and all 117 files already present. No update needed today."
# Fetch latest OR:
git fetch origin
# Check if TARGET.md changed "Updated Polymarket documentation: Added 3 new API reference files (get-market-price, get-order-book, list-events). Pushed to GitHub successfully."
if ! git diff --quiet origin/main -- TARGET.md; then
echo "TARGET.md changed - re-scraping..."
./scrape.sh
fi
# Stage all changes ## Manual Trigger
git add -A If the user asks you to check for updates, run through these steps immediately rather than waiting for your daily schedule.
# Check if there are changes to commit
if [ -n "$(git status --porcelain)" ]; then
echo "Committing changes..."
git commit -m "Update Polymarket documentation - $(date -u +%Y-%m-%d)"
echo "Pushing to GitHub..."
git push origin main
echo "=== Sync complete ==="
else
echo "No changes to commit"
fi
```
## Cron Setup
Add to crontab:
```bash
# Daily at 06:00 UTC
0 6 * * * /home/himalaya/clawd/PolymarketDocumentation/daily-sync.sh >> /home/himalaya/clawd/PolymarketDocumentation/sync.log 2>&1
```
Or use OpenClaw cron:
```bash
openclaw cron add --schedule "0 6 * * *" --payload "systemEvent" --text "Run Polymarket docs daily sync" --sessionTarget "main"
```
## Log File
Logs are written to: `sync.log`
## Manual Run
To run manually:
```bash
cd /home/himalaya/clawd/PolymarketDocumentation
./daily-sync.sh
```
## Notes
- The scrape script fetches all URLs listed in TARGET.md
- Only commits if there are actual changes
- Skips commit if docs haven't changed
- Safe to run multiple times per day if needed