Refactor AGENTS.md from encyclopedia to map; move spec into docs/
Splits the 990-line AGENTS.md into a 184-line map (architecture,
where-to-find index, always-on invariants, capability matrix,
maintenance contract) plus 18 new docs/*.md files holding the deep
content per topic (storage, schema and query languages, indexes,
embeddings, branches/commits, runs, merge, changes, execution, policy,
server, CLI reference, audit, errors, CI, constants, v0.3.1 notes).
Adds scripts/check-agents-md.sh and a check_agents_md CI job that
verifies every docs/ link in AGENTS.md resolves and every doc in the
canonical set is linked. CLAUDE.md remains a symlink to AGENTS.md.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-28 23:31:08 +02:00
|
|
|
#!/usr/bin/env bash
|
2026-05-15 03:45:22 +03:00
|
|
|
# Verify that AGENTS.md and the docs audience indexes stay in sync.
|
Refactor AGENTS.md from encyclopedia to map; move spec into docs/
Splits the 990-line AGENTS.md into a 184-line map (architecture,
where-to-find index, always-on invariants, capability matrix,
maintenance contract) plus 18 new docs/*.md files holding the deep
content per topic (storage, schema and query languages, indexes,
embeddings, branches/commits, runs, merge, changes, execution, policy,
server, CLI reference, audit, errors, CI, constants, v0.3.1 notes).
Adds scripts/check-agents-md.sh and a check_agents_md CI job that
verifies every docs/ link in AGENTS.md resolves and every doc in the
canonical set is linked. CLAUDE.md remains a symlink to AGENTS.md.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-28 23:31:08 +02:00
|
|
|
#
|
2026-05-15 03:45:22 +03:00
|
|
|
# Checks:
|
|
|
|
|
# 1. Every docs/ link from AGENTS.md, docs/user/index.md, and
|
|
|
|
|
# docs/dev/index.md exists.
|
|
|
|
|
# 2. Every canonical docs file is discoverable from those indexes.
|
Refactor AGENTS.md from encyclopedia to map; move spec into docs/
Splits the 990-line AGENTS.md into a 184-line map (architecture,
where-to-find index, always-on invariants, capability matrix,
maintenance contract) plus 18 new docs/*.md files holding the deep
content per topic (storage, schema and query languages, indexes,
embeddings, branches/commits, runs, merge, changes, execution, policy,
server, CLI reference, audit, errors, CI, constants, v0.3.1 notes).
Adds scripts/check-agents-md.sh and a check_agents_md CI job that
verifies every docs/ link in AGENTS.md resolves and every doc in the
canonical set is linked. CLAUDE.md remains a symlink to AGENTS.md.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-28 23:31:08 +02:00
|
|
|
#
|
2026-05-15 03:45:22 +03:00
|
|
|
# Release notes are represented by the docs/releases/ directory entry instead
|
|
|
|
|
# of requiring every per-version release note to be linked individually.
|
Refactor AGENTS.md from encyclopedia to map; move spec into docs/
Splits the 990-line AGENTS.md into a 184-line map (architecture,
where-to-find index, always-on invariants, capability matrix,
maintenance contract) plus 18 new docs/*.md files holding the deep
content per topic (storage, schema and query languages, indexes,
embeddings, branches/commits, runs, merge, changes, execution, policy,
server, CLI reference, audit, errors, CI, constants, v0.3.1 notes).
Adds scripts/check-agents-md.sh and a check_agents_md CI job that
verifies every docs/ link in AGENTS.md resolves and every doc in the
canonical set is linked. CLAUDE.md remains a symlink to AGENTS.md.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-28 23:31:08 +02:00
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
|
|
repo_root="$(cd "$(dirname "$0")/.." && pwd)"
|
|
|
|
|
cd "$repo_root"
|
|
|
|
|
|
2026-05-15 03:45:22 +03:00
|
|
|
index_files=(AGENTS.md docs/user/index.md docs/dev/index.md)
|
|
|
|
|
for index_file in "${index_files[@]}"; do
|
|
|
|
|
if [[ ! -f "$index_file" ]]; then
|
|
|
|
|
echo "error: $index_file not found" >&2
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
normalize_path() {
|
|
|
|
|
python3 - "$1" <<'PY'
|
|
|
|
|
import os
|
|
|
|
|
import sys
|
|
|
|
|
|
|
|
|
|
print(os.path.normpath(sys.argv[1]).replace(os.sep, "/"))
|
|
|
|
|
PY
|
|
|
|
|
}
|
Refactor AGENTS.md from encyclopedia to map; move spec into docs/
Splits the 990-line AGENTS.md into a 184-line map (architecture,
where-to-find index, always-on invariants, capability matrix,
maintenance contract) plus 18 new docs/*.md files holding the deep
content per topic (storage, schema and query languages, indexes,
embeddings, branches/commits, runs, merge, changes, execution, policy,
server, CLI reference, audit, errors, CI, constants, v0.3.1 notes).
Adds scripts/check-agents-md.sh and a check_agents_md CI job that
verifies every docs/ link in AGENTS.md resolves and every doc in the
canonical set is linked. CLAUDE.md remains a symlink to AGENTS.md.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-28 23:31:08 +02:00
|
|
|
|
|
|
|
|
canonical=()
|
|
|
|
|
while IFS= read -r line; do
|
|
|
|
|
canonical+=("$line")
|
2026-05-15 03:45:22 +03:00
|
|
|
done < <(find docs -type f -name '*.md' ! -path 'docs/releases/*' | sort)
|
Refactor AGENTS.md from encyclopedia to map; move spec into docs/
Splits the 990-line AGENTS.md into a 184-line map (architecture,
where-to-find index, always-on invariants, capability matrix,
maintenance contract) plus 18 new docs/*.md files holding the deep
content per topic (storage, schema and query languages, indexes,
embeddings, branches/commits, runs, merge, changes, execution, policy,
server, CLI reference, audit, errors, CI, constants, v0.3.1 notes).
Adds scripts/check-agents-md.sh and a check_agents_md CI job that
verifies every docs/ link in AGENTS.md resolves and every doc in the
canonical set is linked. CLAUDE.md remains a symlink to AGENTS.md.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-28 23:31:08 +02:00
|
|
|
if [[ -d docs/releases ]]; then
|
|
|
|
|
canonical+=("docs/releases/")
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
linked=()
|
2026-05-15 03:45:22 +03:00
|
|
|
for index_file in "${index_files[@]}"; do
|
|
|
|
|
base_dir="$(dirname "$index_file")"
|
|
|
|
|
|
|
|
|
|
# Markdown links.
|
|
|
|
|
while IFS= read -r raw_link; do
|
|
|
|
|
link="${raw_link%%#*}"
|
|
|
|
|
[[ -z "$link" ]] && continue
|
|
|
|
|
[[ "$link" =~ ^[a-zA-Z][a-zA-Z0-9+.-]*: ]] && continue
|
|
|
|
|
[[ "$link" == /* ]] && continue
|
|
|
|
|
|
|
|
|
|
if [[ "$link" == docs/* ]]; then
|
|
|
|
|
normalized="$(normalize_path "$link")"
|
|
|
|
|
else
|
|
|
|
|
normalized="$(normalize_path "$base_dir/$link")"
|
|
|
|
|
fi
|
|
|
|
|
if [[ "$link" == */ ]]; then
|
|
|
|
|
normalized="${normalized%/}/"
|
|
|
|
|
fi
|
|
|
|
|
linked+=("$normalized")
|
|
|
|
|
done < <(
|
|
|
|
|
grep -oE '\[[^]]+\]\([^)]+\)' "$index_file" \
|
|
|
|
|
| sed -E 's/.*\(([^)]+)\).*/\1/' || true
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Agent import directives in AGENTS.md.
|
|
|
|
|
while IFS= read -r raw_link; do
|
|
|
|
|
link="${raw_link#@}"
|
|
|
|
|
linked+=("$(normalize_path "$link")")
|
|
|
|
|
done < <(grep -oE '^@docs/[^[:space:]]+' "$index_file" || true)
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
deduped=()
|
Refactor AGENTS.md from encyclopedia to map; move spec into docs/
Splits the 990-line AGENTS.md into a 184-line map (architecture,
where-to-find index, always-on invariants, capability matrix,
maintenance contract) plus 18 new docs/*.md files holding the deep
content per topic (storage, schema and query languages, indexes,
embeddings, branches/commits, runs, merge, changes, execution, policy,
server, CLI reference, audit, errors, CI, constants, v0.3.1 notes).
Adds scripts/check-agents-md.sh and a check_agents_md CI job that
verifies every docs/ link in AGENTS.md resolves and every doc in the
canonical set is linked. CLAUDE.md remains a symlink to AGENTS.md.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-28 23:31:08 +02:00
|
|
|
while IFS= read -r line; do
|
2026-05-15 03:45:22 +03:00
|
|
|
deduped+=("$line")
|
|
|
|
|
done < <(printf '%s\n' "${linked[@]}" | sort -u)
|
|
|
|
|
linked=("${deduped[@]}")
|
Refactor AGENTS.md from encyclopedia to map; move spec into docs/
Splits the 990-line AGENTS.md into a 184-line map (architecture,
where-to-find index, always-on invariants, capability matrix,
maintenance contract) plus 18 new docs/*.md files holding the deep
content per topic (storage, schema and query languages, indexes,
embeddings, branches/commits, runs, merge, changes, execution, policy,
server, CLI reference, audit, errors, CI, constants, v0.3.1 notes).
Adds scripts/check-agents-md.sh and a check_agents_md CI job that
verifies every docs/ link in AGENTS.md resolves and every doc in the
canonical set is linked. CLAUDE.md remains a symlink to AGENTS.md.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-28 23:31:08 +02:00
|
|
|
|
|
|
|
|
fail=0
|
|
|
|
|
|
|
|
|
|
for link in "${linked[@]}"; do
|
2026-05-15 03:45:22 +03:00
|
|
|
if [[ "$link" == */ ]]; then
|
|
|
|
|
if [[ ! -d "$link" ]]; then
|
|
|
|
|
echo "error: docs index links to missing directory: $link" >&2
|
Refactor AGENTS.md from encyclopedia to map; move spec into docs/
Splits the 990-line AGENTS.md into a 184-line map (architecture,
where-to-find index, always-on invariants, capability matrix,
maintenance contract) plus 18 new docs/*.md files holding the deep
content per topic (storage, schema and query languages, indexes,
embeddings, branches/commits, runs, merge, changes, execution, policy,
server, CLI reference, audit, errors, CI, constants, v0.3.1 notes).
Adds scripts/check-agents-md.sh and a check_agents_md CI job that
verifies every docs/ link in AGENTS.md resolves and every doc in the
canonical set is linked. CLAUDE.md remains a symlink to AGENTS.md.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-28 23:31:08 +02:00
|
|
|
fail=1
|
|
|
|
|
fi
|
|
|
|
|
else
|
2026-05-15 03:45:22 +03:00
|
|
|
if [[ ! -f "$link" ]]; then
|
|
|
|
|
echo "error: docs index links to missing file: $link" >&2
|
Refactor AGENTS.md from encyclopedia to map; move spec into docs/
Splits the 990-line AGENTS.md into a 184-line map (architecture,
where-to-find index, always-on invariants, capability matrix,
maintenance contract) plus 18 new docs/*.md files holding the deep
content per topic (storage, schema and query languages, indexes,
embeddings, branches/commits, runs, merge, changes, execution, policy,
server, CLI reference, audit, errors, CI, constants, v0.3.1 notes).
Adds scripts/check-agents-md.sh and a check_agents_md CI job that
verifies every docs/ link in AGENTS.md resolves and every doc in the
canonical set is linked. CLAUDE.md remains a symlink to AGENTS.md.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-28 23:31:08 +02:00
|
|
|
fail=1
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
for doc in "${canonical[@]}"; do
|
|
|
|
|
found=0
|
|
|
|
|
for link in "${linked[@]}"; do
|
2026-05-15 03:45:22 +03:00
|
|
|
if [[ "$link" == "$doc" ]]; then
|
Refactor AGENTS.md from encyclopedia to map; move spec into docs/
Splits the 990-line AGENTS.md into a 184-line map (architecture,
where-to-find index, always-on invariants, capability matrix,
maintenance contract) plus 18 new docs/*.md files holding the deep
content per topic (storage, schema and query languages, indexes,
embeddings, branches/commits, runs, merge, changes, execution, policy,
server, CLI reference, audit, errors, CI, constants, v0.3.1 notes).
Adds scripts/check-agents-md.sh and a check_agents_md CI job that
verifies every docs/ link in AGENTS.md resolves and every doc in the
canonical set is linked. CLAUDE.md remains a symlink to AGENTS.md.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-28 23:31:08 +02:00
|
|
|
found=1
|
|
|
|
|
break
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
if [[ "$found" -eq 0 ]]; then
|
2026-05-15 03:45:22 +03:00
|
|
|
echo "error: doc not linked from AGENTS.md or audience indexes: $doc" >&2
|
Refactor AGENTS.md from encyclopedia to map; move spec into docs/
Splits the 990-line AGENTS.md into a 184-line map (architecture,
where-to-find index, always-on invariants, capability matrix,
maintenance contract) plus 18 new docs/*.md files holding the deep
content per topic (storage, schema and query languages, indexes,
embeddings, branches/commits, runs, merge, changes, execution, policy,
server, CLI reference, audit, errors, CI, constants, v0.3.1 notes).
Adds scripts/check-agents-md.sh and a check_agents_md CI job that
verifies every docs/ link in AGENTS.md resolves and every doc in the
canonical set is linked. CLAUDE.md remains a symlink to AGENTS.md.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-28 23:31:08 +02:00
|
|
|
fail=1
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
if [[ "$fail" -ne 0 ]]; then
|
|
|
|
|
echo >&2
|
2026-05-15 03:45:22 +03:00
|
|
|
echo "AGENTS.md / docs indexes are out of sync. Update AGENTS.md, docs/user/index.md, or docs/dev/index.md." >&2
|
Refactor AGENTS.md from encyclopedia to map; move spec into docs/
Splits the 990-line AGENTS.md into a 184-line map (architecture,
where-to-find index, always-on invariants, capability matrix,
maintenance contract) plus 18 new docs/*.md files holding the deep
content per topic (storage, schema and query languages, indexes,
embeddings, branches/commits, runs, merge, changes, execution, policy,
server, CLI reference, audit, errors, CI, constants, v0.3.1 notes).
Adds scripts/check-agents-md.sh and a check_agents_md CI job that
verifies every docs/ link in AGENTS.md resolves and every doc in the
canonical set is linked. CLAUDE.md remains a symlink to AGENTS.md.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-28 23:31:08 +02:00
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
2026-05-15 03:45:22 +03:00
|
|
|
echo "AGENTS.md ↔ docs indexes OK (${#linked[@]} links, ${#canonical[@]} docs)."
|