# Behavior Reference

## Current Documentation Definition

Current documentation means pages linked by the visible documentation sidebar on:

- Chinese: `https://docs.debox.pro/UserGuide`
- English: `https://docs.debox.pro/en/UserGuide`

The script does not use GitHub, `/sitemap.xml`, guessed URLs, or hidden routes.

## First And Later Runs

On the first run, no manifest exists, so all current pages and images are written locally.
Later runs compare content hashes with `manifest.json` and report additions, changes, and
removals.

## Safety

The script refuses a non-empty output folder that has no DeBox sync marker. This prevents it
from treating an unrelated folder as its managed documentation folder.

The selected language is stored in the marker and manifest. Reusing the same folder with a
different language is refused.

Pages and images are downloaded into a temporary staging directory. Files are validated before
they replace managed local files. Existing files are preserved when synchronization is
incomplete. Stale files are deleted only after navigation, every page, and every image finish
successfully.

Every page records its original source URL. Broken links and images are listed in reports.

## Summary

The script synchronizes and reports deterministic facts. The agent is responsible for reading
all synchronized Markdown, writing `summary.md`, and explaining the documentation to the user
after every successful run.
