JustToThePointEnglish Website Version
JustToThePoint en español
Skip to main content

OpenClaw: A Practical Guide to Running a Local Autonomous AI Agent — Part 4: File Management and the exec Permission Model

Introduction

Think of a website as a shop. Before opening each morning, the shopkeeper does a quick walk-through:

This skill performs that walk-through for justtothepoint.com. It runs four checks in order, each answering a different question:

#CheckQuestion it answersWhy it matters
1UptimeIs the site reachable right now?If it’s down, nothing else matters.
2BuildDoes the site still compile cleanly?A broken build means the next deploy ships broken pages.
3DeployIs the live site the version I just built?The #1 silent failure: an upload that “succeeded” but didn’t replace the old files.
4AuditDo any links point at dead pages?Link rot is invisible until a reader hits a 404.

The checks are ordered from cheapest and most fundamental to most expensive, and the skill stops at the first failure that blocks the rest: if the site is down, there’s no point auditing links; if the build fails, there’s no new build to verify.

The two-tool philosophy

This skill deliberately does not implement its own crawler. Crawling is a solved problem, and squirrelscan does it better (260+ rules, free in offline mode). What squirrelscan doesn’t know is your Hugo project or your deploy pipeline. So the skill delegates crawling to squirrelscan and adds the two pieces only you can know:

  1. Did my Hugo build succeed? — squirrel doesn’t build your site.
  2. Is my live site the build I just made? — squirrel doesn’t know your deploy.

That’s the whole design: orchestrate, don’t duplicate.

State: why the skill remembers

A single check tells you “is it healthy now?” A series of checks tells you “is it getting healthier?” The skill keeps four small files:

None of these are required for a single run. They exist so the next run is smarter than this one.

site-health-check

SKILL.md

---
name: site-health-check
description: "Daily health check for justtothepoint.com: uptime verification, Hugo build integrity, post-deploy hash verification, and a full-site link-rot audit delegated to squirrelscan (all links, all pages, free offline). Use when the user asks to run their daily site check, see if the site is up, verify a deploy landed, or find dead links. Not for fetching or auditing unrelated pages."
license: MIT
metadata:
  version: '2.0'
  author: Máximo Núñez Alarcón
dependencies:
  - mac-setup-expert    # environment checks: hugo, squirrel, Python 3.11+
---

# Site health check (justtothepoint.com)

## 0. Skill anatomy — how this skill is organized

This skill is a **workflow orchestrator**. It does not reimplement crawling;
it delegates to specialist tools and adds the two things they don't know:
**Hugo build integrity** and **deployment state**.

| Layer | Component | Role |
|---|---|---|
| Orchestration | `SKILL.md` (this file) | Decides what to run, in what order |
| State | `state.json`, `dead-links.md`, `uptime-log.md` | Survives across runs |
| Crawling | `squirrel audit --offline` | 260+ rules, all pages, all links — free |
| Build check | `hugo --minify --gc` | Catches broken builds before they ship |
| Deploy check | SHA-256 of homepage | Proves the live site matches the build |

**Companion skill:** `mac-setup-expert` answers *"is my environment ready?"*
(Hugo version, squirrelscan installation, Python venv). This skill answers
*"is my website healthy?"* Ask `mac-setup-expert` first if a tool is missing.

---

## 1. When to use this skill

Run when the user asks for their daily site check, an uptime check, a deploy
verification, or a link-rot audit of justtothepoint.com — for example:

- "run my daily site check"
- "is justtothepoint up?"
- "did my deploy land?"
- "check my site for dead links"
- "audit my links today"

---

## 2. State files and Available scripts

- **`scripts/deployMac.sh`**  — build, verify, upload, and verify a Hugo site on shared hosting.

All state lives in `~/macOS/claude/skills/site-health-check/`.
Create the directory and files on first run; read them before doing anything
else.

- `state.json` — `{"queueRebuilt": "<ISO date>", "lastBuildFileCount": <int>, "lastDeployHash": "<sha256>"}`
- `dead-links.md` — one line per confirmed dead link: `YYYY-MM-DD | <source article> | <dead URL> | <status or error>`
- `uptime-log.md` — one line per run: `YYYY-MM-DD HH:MM UTC | UP|DOWN | <notes>`
- `scores.md` — **new**: one line per audit: `YYYY-MM-DD | score<n> (<grade>) | links=<n> dead | perf=<n> | a11y=<n>`

---

## 3. Instructions

### 3.1 Step 0 — Environment preflight

Before any network call, confirm the required tools exist. If a tool is
missing, delegate to `mac-setup-expert` (its `references/troubleshooting.md`
covers installation).

```bash
# Required for build integrity
hugo version
# Required for the link audit (free, offline)
squirrel --version
# Required only if you extend this skill with Python helpers
python3 -V   # must be 3.11+
```

If squirrel is missing, the audit step degrades gracefully to the old
hand-rolled fetch loop (see §3.6 fallback), but warn the user that coverage
will drop from all links to 40 checks per run.

## 3.2 Step 1 — Read state

Read state.json, dead-links.md, uptime-log.md, and scores.md.
Create empty versions if missing.

## 3.3 Step 2 — Uptime check

Fetch the homepage and https://justtothepoint.com/sitemap.xml. The site is
UP when both return HTTP 200 and the homepage contains the marker
"JustToThePoint". Retry a failed fetch exactly once before concluding.

```bash
curl https://justtothepoint.com/sitemap.xml --max-time 15 --retry 1 --retry-delay 2
```

Append the result to uptime-log.md. This is a fast triage signal, not a 24/7 monitor.
For real alerting when your Mac is asleep, pair it with an external uptime service (see §7).

## 3.4 Step 2a — Hugo build integrity (new)

If the Hugo project directory exists locally:

1. Run the Hugo build command in the Hugo project directory.
```bash
SITE_DIR="/Volumes/MacDatosMaster/justtothepoint"
BUILD_DIR="/Volumes/MacDatosMaster/justtothepoint/public"

hugo \
  --source "$SITE_DIR" \
  --config "$SITE_DIR/config.yaml" \
  --destination "$BUILD_DIR" \
  --minify --gc 
```

2. Assert exit code 0. A non-zero exit means the site would ship broken —
stop and report the error before any audit.

3. Count generated HTML files:
```bash
HTML_COUNT=$(find "$BUILD_DIR" -type f -name '*.html' | wc -l | tr -d ' ')
echo "HTML files generated: $HTML_COUNT"
```

4. Compare with state.json.lastBuildFileCount. If the count dropped by more than 10%, warn:
"Build produced 30% fewer pages than last time —   check for a deleted section or a broken content directory."

Update lastBuildFileCount in state.json.

## 3.5 Step 2b — Deployment verification

This check catches the most common failure: "I uploaded but the old page is still showing."

```bash
# Embed a build ID in my Hugo template, e.g., mymeta.html, partials (Hugo)
<meta name="build-id" content="{{ now.Unix }}">

# Deploy-hash check, it is part of my deploy script to my shared hosting
# `scripts/deployMac.sh`

LIVE_ID=$(curl -fsSL --max-time 15 "${SITE_URL}/?cb=$(date +%s)" \
          | grep -o 'name="build-id" content="[^"]*"' | head -1)
LOCAL_ID=$(grep -o 'name="build-id" content="[^"]*"' public/index.html | head -1)
[ "$LIVE_ID" = "$LOCAL_ID" ] && echo "✅ Deploy verified — live homepage matches the local build" || echo "⚠️ Deploy mismatch — live homepage differs from the local build"
```

Interpretation:

| Situation	| Meaning |	Action |
| Hashes match |	Live site is current |	Continue to audit |
| Hashes differ, last deploy < 1 h ago |	CDN/propagation lag |	Re-check in 5 min |
| Hashes differ, last deploy > 1 h ago |	Upload failed or incomplete	| Report as ⚠️ stale deploy |

Store LIVE_ID as lastDeployHash in state.json for trend tracking.

## 3.6 Step 3 — Link-rot audit via squirrelscan

Preferred path (squirrel installed): delegate crawling entirely to
squirrel audit in offline mode. This checks every page and every
external link in one pass — not 8 articles × 5 links — and it is free
when signed out or using --offline.

```bash
NO_TELEMETRY=1 squirrel audit https://justtothepoint.com \
  --offline \
  --format json \
  --output /tmp/site-health-check.json \
  -y
```

Then parse /tmp/site-health-check.json:

* issues entries in the links category → confirmed dead links.
* score → append to scores.md.
* skippedChecks → do not treat a skipped link rule as passing.

Append each confirmed dead link to dead-links.md with today's date.

Fallback path (squirrel not installed). If squirrel is missing, skip the audit and warn the user that link coverage is unavailable until squirrelscan is installed.

## 3.7 Step 4 — Update state and scores

If using the fallback queue: remove processed articles from the queue and
write state.json back. Rebuild the queue from the sitemap if empty or if
queueRebuilt is older than 14 days.

Append the audit score to scores.md so the agent can answer "is my
site getting healthier?" — not just "is it up?".

## 3.8 Step 5 — Report

Report to the user:

1. Uptime: UP / DOWN (with HTTP codes).
2. Build: ✅ passes / ❌ fails (with the Hugo error if any).
3. Deploy: ✅ verified / ⚠️ stale (with hashes if mismatched).
4. Audit: articles checked, links checked, score (if available).
5. New dead links: a table of source article | dead URL | status.
6. Trend: score change vs. last entry in scores.md.

If everything is healthy, say so in one or two lines.

# 4. Hard limits — mandatory

These limits apply only to the fallback path. When squirrel audit --offline is used, the crawler already enforces its own polite defaults;
you do not need to cap it, but you may pass --max-pages if the site is
very large.

For the fallback:

* At most 8 article fetches + 40 link checks (48 fetches total) per run.
* Fetches strictly sequential — never parallel, never more than one retry.
* Small content limit (~1,000 characters) — link checks need status and
    title, not full pages.

## 5. Scheduling and IP notes

* This skill runs on demand when invoked — no cron jobs.

* If the user wants scheduled runs, use an external uptime service
  (UptimeRobot, Better Stack) rather than relying on a local cron that
  stops when the Mac sleeps. The skill's uptime check is for on-demand
  triage, not 24/7 alerting.

* Fetches from this environment egress (network traffic going out from a machine) from its infrastructure,
  not from the server hosting justtothepoint.com, so the user's hosting IP is never
  the requester.

## 6. Dependencies and composition with mac-setup-expert

mac-setup-expert knows the environment; this skill knows the website.
They are complementary, not overlapping.
text

```
User: "run my daily site check"
  → site-health-check loads
  → preflight asks mac-setup-expert: hugo? squirrel? python3.11?
      → if missing: mac-setup-expert/troubleshooting.md tells the agent how to fix
  → site-health-check runs uptime → build → deploy → audit
  → report
```

Rule: do not merge the two skills. site-health-check declares its
dependency in the frontmatter (above), and the agent calls
mac-setup-expert only when a tool is missing.

## 7. Example

Input: "run my daily site check"

Output:

* Uptime: UP (homepage 200, sitemap 200)
* Build: ✅ hugo --minify --gc exits 0; 218 HTML files (last run: 218)
* Deploy: ✅ verified — live homepage hash matches public/index.html
* Audit: full site via squirrelscan — 218 pages, 1,204 external links, score 82 (B)
* New dead links:

| Source article |	Dead link |	Status |
| /2023/04/sobolev-spaces/ |	https://oldwiki.example.org/Sobolev |	404 |

* Trend: score 82 (last week 79) — ↑ 3 points
* Queue: not applicable (full crawl, no batching)
#deploy.sh
#!/usr/bin/env sh
#______           _
#|  _  \         | |
#| | | |___ _ __ | | ___  _   _
#| | | / _ \ '_ \| |/ _ \| | | |
#| |/ /  __/ |_) | | (_) | |_| |
#|___/ \___| .__/|_|\___/ \__, |
#          | |             __/ |
#          |_|            |___/
#------------------------------------------------------------------------------
# deployMac.sh — build, verify, upload, and verify a Hugo site on shared hosting.
#
# Prerequisites:
#   - SSH key authentication to the host (see below)
#   - rsync installed locally and on the server
#   - squirrelscan installed (optional, for pre-deploy audit)
#
# First-time SSH setup:
#   1. ssh-keygen -t ed25519 -C "hugo-deploy"
#   2. ssh-copy-id -i ~/.ssh/id_ed25519.pub USER@HOST
#   3. ssh USER@HOST   # accept the host key once
#------------------------------------------------------------------------------
set -eu   # exit on error or undefined variable

# --- Configuration — EDIT THESE ------------------------------------------------
SSH_USER="${SSH_USER:-nmaximo7}"
SSH_HOST="${SSH_HOST:-91.146.103.142}"
SSH_PORT="${SSH_PORT:-2222}"
HUGO_DIR="${HUGO_DIR:-/Volumes/MacDatosMaster/justtothepoint}"
SRC="public/"
DEST="httpdocs/"
SITE_URL="${SITE_URL:-https://justtothepoint.com}"
DRY_RUN="${DRY_RUN:-0}"

say() { printf '%s\n' "$*"; }
die() { printf '❌ %s\n' "$*" >&2; exit 1; }

# --- 0/5 Preflight ------------------------------------------------------------
command -v hugo  >/dev/null 2>&1 || die "hugo not found — run mac-setup-master"
command -v rsync >/dev/null 2>&1 || die "rsync not found"
[ -d "$HUGO_DIR" ] || die "Hugo project not found at $HUGO_DIR"

if command -v cowsay >/dev/null 2>&1; then
  cowsay "Deploy Hugo"
else
  say "Deploy Hugo"
fi

# --- 1/5 Build ----------------------------------------------------------------
say "→ 1/5 Building Hugo site…"
pkill hugo 2>/dev/null || true
cd "$HUGO_DIR"
rm -rf ./public
hugo --gc --minify --cleanDestinationDir --baseURL "${SITE_URL}/" \
  || die "Hugo build failed"

# --- 2/5 Verify build output --------------------------------------------------
say "→ 2/5 Verifying build output…"
HTML_COUNT=$(find public -name '*.html' | wc -l | tr -d ' ')
say "   Generated ${HTML_COUNT} HTML files."
[ "$HTML_COUNT" -ge 10 ] || die "Build produced fewer than 10 pages — aborting."

# --- 3/5 Pre-deploy audit (optional) ------------------------------------------
say "→ 3/5 Running local audit…"
if command -v squirrel >/dev/null 2>&1; then
  python3 -m http.server 1313 --directory public >/dev/null 2>&1 &
  SERVER_PID=$!
  # Poll until the server answers, up to 5 s (a fixed `sleep 1` is flaky).
  for _ in 1 2 3 4 5; do
    curl -fsS --max-time 2 http://localhost:1313/ >/dev/null 2>&1 && break
    sleep 1
  done
  NO_TELEMETRY=1 squirrel audit http://localhost:1313 --offline --format text \
    || say "   ⚠️  Local audit reported issues — review the output above before deploy."
  kill "$SERVER_PID" 2>/dev/null || true
  wait "$SERVER_PID" 2>/dev/null || true
else
  say "   (squirrel not installed — skipping local audit; coverage will be partial)"
fi

# --- 4/5 Deploy ---------------------------------------------------------------
say "→ 4/5 Deploying the site…"
RSYNC_FLAGS="--checksum --chmod=D755,F644 --compress --delete --perms --recursive --verbose"
[ "$DRY_RUN" = "1" ] && RSYNC_FLAGS="$RSYNC_FLAGS --dry-run"
rsync $RSYNC_FLAGS \
  --rsh="ssh -p ${SSH_PORT}" \
  "${SRC}" "${SSH_USER}@${SSH_HOST}:${DEST}" \
  || die "rsync failed"

echo "→ 5/5 Verifying live site…"

LIVE_ID=$(curl -fsSL --max-time 15 "${SITE_URL}/?cb=$(date +%s)" \
          | grep -o 'name="build-id" content="[^"]*"' | head -1)
LOCAL_ID=$(grep -o 'name="build-id" content="[^"]*"' public/index.html | head -1)

if [ "$LIVE_ID" = "$LOCAL_ID" ]; then
  say "✅ Deploy verified — live homepage matches the local build."
else
  say "⚠️  Deploy mismatch — live homepage differs from the local build."
  say "   Local: ${LOCAL_ID}"
  say "   Live : ${LIVE_ID}"
  exit 1
fi
Bitcoin donation
Children reading and learning

JustToThePoint Copyright © 2011 - 2026 Anawim. ALL RIGHTS RESERVED. Bilingual e-books, articles, and videos to help your child and your entire family succeed, develop a healthy lifestyle, and have a lot of fun. About us., Social Issues, Join us.

This website uses cookies to improve your navigation experience.
By continuing, you are consenting to our use of cookies, in accordance with our Cookies Policy and Website Terms and Conditions of use.