> ## Documentation Index
> Fetch the complete documentation index at: https://sitegpt.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Playbook: Knowledge maintenance

> An agent playbook for auditing, updating, resyncing, and cleaning chatbot knowledge with the SiteGPT CLI.

Use this playbook for recurring knowledge-base maintenance, failed-ingestion cleanup, source updates, and content quality checks.

## Required access

Recommended scopes:

```bash theme={null}
sitegpt login \
  --profile knowledge-agent \
  --scope account:read \
  --scope chatbots:read \
  --scope knowledge:read \
  --scope knowledge:write \
  --scope knowledge:delete
```

Add `settings:read` if the agent should inspect chatbot settings and `settings:write` if it should update crawler-related settings.

## 1. Inspect health

```bash theme={null}
sitegpt dashboard --chatbot <chatbot-id> --json
sitegpt knowledge documents stats --chatbot <chatbot-id> --json
sitegpt knowledge documents list --chatbot <chatbot-id> --status FAILED --json
sitegpt knowledge documents list --chatbot <chatbot-id> --status PROCESSING --json
sitegpt knowledge sync-jobs list --chatbot <chatbot-id> --json
```

Look for:

* Failed documents
* Stale source documents
* Missing sitemap sync/scan jobs
* Duplicated documents
* Outdated custom responses
* Large pending queues

## 2. Resync failed or stale documents

Resync all failed documents:

```bash theme={null}
sitegpt knowledge documents resync --chatbot <chatbot-id> --state failed
```

Resync by source:

```bash theme={null}
sitegpt knowledge documents resync --chatbot <chatbot-id> --source WEBSITE
sitegpt knowledge documents resync --chatbot <chatbot-id> --source SITEMAP
```

Resync exact documents:

```bash theme={null}
sitegpt knowledge documents resync --chatbot <chatbot-id> --document <document-id> --document <document-id>
```

## 3. Update document config

For pages with layout noise:

```bash theme={null}
sitegpt knowledge documents update-config \
  --chatbot <chatbot-id> \
  --document <document-id> \
  --only-main-content true \
  --include-selector main \
  --exclude-selector nav \
  --exclude-selector footer
```

For recurring content refresh:

```bash theme={null}
sitegpt knowledge documents update-config --chatbot <chatbot-id> --document <document-id> --sync WEEKLY
```

Valid sync frequencies:

```text theme={null}
NEVER, DAILY, WEEKLY, MONTHLY
```

## 4. Maintain sync jobs

List active jobs:

```bash theme={null}
sitegpt knowledge sync-jobs list --chatbot <chatbot-id>
```

Update job frequency:

```bash theme={null}
sitegpt knowledge sync-jobs update --chatbot <chatbot-id> <job-id> --sync WEEKLY
sitegpt knowledge sync-jobs update --chatbot <chatbot-id> <job-id> --scan WEEKLY
```

Disable a job:

```bash theme={null}
sitegpt knowledge sync-jobs delete --chatbot <chatbot-id> <job-id> --yes
```

Sitemap `--scan` keeps sitemap URL additions/deletions up to date. `--sync` refreshes content for known URLs.

## 5. Add new website content

Prefer sitemap:

```bash theme={null}
sitegpt knowledge sitemap add \
  --chatbot <chatbot-id> \
  https://example.com/sitemap.xml \
  --max-links 500 \
  --only-main-content true \
  --sync WEEKLY \
  --scan WEEKLY
```

Fallback to website crawl:

```bash theme={null}
sitegpt knowledge website add \
  --chatbot <chatbot-id> \
  https://example.com/docs \
  --depth 3 \
  --max-links 200 \
  --only-main-content true
```

Use exact links for surgical updates:

```bash theme={null}
sitegpt knowledge links add \
  --chatbot <chatbot-id> \
  https://example.com/pricing \
  https://example.com/refund-policy \
  --only-main-content true
```

## 6. Maintain source connections

List sources:

```bash theme={null}
sitegpt knowledge sources list --chatbot <chatbot-id> --json
```

Select more files for an existing picker connection:

```bash theme={null}
sitegpt knowledge sources authorize --chatbot <chatbot-id> <source-id>
sitegpt knowledge sources documents --chatbot <chatbot-id> <source-id>
sitegpt knowledge sources ingest --chatbot <chatbot-id> <source-id>
```

Ingest selected documents only:

```bash theme={null}
sitegpt knowledge sources ingest \
  --chatbot <chatbot-id> \
  <source-id> \
  --external-id <external-document-id> \
  --sync WEEKLY
```

GitHub:

```bash theme={null}
sitegpt knowledge sources github repos --chatbot <chatbot-id> --source <source-id>
sitegpt knowledge sources github files --chatbot <chatbot-id> --source <source-id> --owner <owner> --repo <repo>
sitegpt knowledge sources ingest --chatbot <chatbot-id> <source-id> --repo <repo> --branch main --pattern "docs/**"
```

Confluence:

```bash theme={null}
sitegpt knowledge sources confluence spaces --chatbot <chatbot-id> --source <source-id>
sitegpt knowledge sources confluence pages --chatbot <chatbot-id> --source <source-id> --space <space-id>
sitegpt knowledge sources ingest --chatbot <chatbot-id> <source-id> --page <page-id>
```

## 7. Add or update text knowledge

Use text knowledge for short curated policy text, summaries, or controlled notes:

```bash theme={null}
sitegpt knowledge text update --chatbot <chatbot-id> --name "Support policy notes" --file ./support-notes.md
```

Because this replaces the text document, read existing content first when editing:

```bash theme={null}
sitegpt knowledge documents list --chatbot <chatbot-id> --source TEXT --json
sitegpt knowledge documents get --chatbot <chatbot-id> <document-id> --content --json
```

## 8. Maintain Custom Responses

List open Custom Responses:

```bash theme={null}
sitegpt knowledge custom-responses list --chatbot <chatbot-id> --state OPEN --json
```

Add a new approved answer:

```bash theme={null}
sitegpt knowledge custom-responses add \
  --chatbot <chatbot-id> \
  --question "Do you offer refunds?" \
  --answer "Refund eligibility depends on your plan and billing terms. Contact support@example.com for account-specific help."
```

Update an existing response:

```bash theme={null}
sitegpt knowledge custom-responses update --chatbot <chatbot-id> <custom-response-id> --answer "Updated approved answer."
```

Delete outdated responses:

```bash theme={null}
sitegpt knowledge custom-responses delete --chatbot <chatbot-id> <custom-response-id> --yes
```

## 9. Delete obsolete documents carefully

Preview matching documents:

```bash theme={null}
sitegpt knowledge documents list --chatbot <chatbot-id> --query "old product" --json
```

Delete exact IDs:

```bash theme={null}
sitegpt knowledge documents delete --chatbot <chatbot-id> --document <document-id> --document <document-id> --yes
```

Delete failed documents only:

```bash theme={null}
sitegpt knowledge documents delete --chatbot <chatbot-id> --state failed --yes
```

Avoid `--all --yes` unless the user explicitly asked for broad deletion.

## 10. Final verification

```bash theme={null}
sitegpt dashboard --chatbot <chatbot-id> --json
sitegpt knowledge documents stats --chatbot <chatbot-id> --json
sitegpt knowledge documents list --chatbot <chatbot-id> --status FAILED --json
sitegpt messages send --chatbot <chatbot-id> "What topics are you trained on?" --json
```

Report:

* What was added or updated
* Any failed documents
* Any sync jobs changed
* Any deleted documents or custom responses
* Follow-up work requiring human approval
