Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,12 @@ assail:
# VALIDATION
# ═══════════════════════════════════════════════════════════════════════════════

# Reject legacy directive paths in satellite batches already migrated under #117.
validate-bot-directives:
@bash hooks/validate-bot-directives.sh

# Validate RSR compliance
validate-rsr:
validate-rsr: validate-bot-directives
#!/usr/bin/env bash
echo "=== RSR Compliance Check ==="
MISSING=""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: CC-BY-SA-4.0
// Copyright (c) {{CURRENT_YEAR}} hyperpolymath (hyperpolymath) <j.d.a.jewell@open.ac.uk>
= Agent Instructions
= Bot Directives
:toc: preamble

Methodology-aware configuration for AI agents. Read by any AI agent
Expand Down Expand Up @@ -32,8 +32,7 @@ Methodology-aware configuration for AI agents. Read by any AI agent
== Relationship to Other Files

* `AGENTIC.a2ml` says WHAT agents can do (permissions, gating)
* `agent_instructions/` says HOW agents should work (methodology)
* `bot_directives/` says what the gitbot-fleet does (fleet-specific)
* `bot_directives/` says HOW agents should work (methodology)
* `CLAUDE.md` says how Claude specifically should work (Claude-specific)

== Reference
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: CC-BY-SA-4.0
// Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk>
= Agent Instructions
= Bot Directives
:toc: preamble

Methodology-aware configuration for AI agents. Read by any AI agent
Expand Down Expand Up @@ -32,8 +32,7 @@ Methodology-aware configuration for AI agents. Read by any AI agent
== Relationship to Other Files

* `AGENTIC.a2ml` says WHAT agents can do (permissions, gating)
* `agent_instructions/` says HOW agents should work (methodology)
* `bot_directives/` says what the gitbot-fleet does (fleet-specific)
* `bot_directives/` says HOW agents should work (methodology)
* `CLAUDE.md` says how Claude specifically should work (Claude-specific)

== Reference
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: CC-BY-SA-4.0
// Copyright (c) {{CURRENT_YEAR}} Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk>
= Agent Instructions
= Bot Directives
:toc: preamble

Methodology-aware configuration for AI agents. Read by any AI agent
Expand Down Expand Up @@ -32,8 +32,7 @@ Methodology-aware configuration for AI agents. Read by any AI agent
== Relationship to Other Files

* `AGENTIC.a2ml` says WHAT agents can do (permissions, gating)
* `agent_instructions/` says HOW agents should work (methodology)
* `bot_directives/` says what the gitbot-fleet does (fleet-specific)
* `bot_directives/` says HOW agents should work (methodology)
* `CLAUDE.md` says how Claude specifically should work (Claude-specific)

== Reference
Expand Down
72 changes: 72 additions & 0 deletions hooks/validate-bot-directives.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: MPL-2.0

set -euo pipefail

readonly DEFAULT_TARGETS=(
"affinescript-ecosystem/affinescript-vite"
"affinescript-ecosystem/affinescriptiser"
"affinescript-ecosystem/rattlescript"
)

validate_targets() {
local failed=0
local target
local machine_readable

for target in "$@"; do
machine_readable="${target}/.machine_readable"

if [[ -d "${machine_readable}/agent_instructions" ]]; then
printf 'ERROR: legacy directive directory remains: %s\n' \
"${machine_readable}/agent_instructions" >&2
failed=1
fi

if [[ ! -d "${machine_readable}/bot_directives" ]]; then
printf 'ERROR: canonical directive directory is missing: %s\n' \
"${machine_readable}/bot_directives" >&2
failed=1
fi

if rg --hidden --glob '!**/.git/**' --quiet 'agent_instructions' "$target"; then
printf 'ERROR: legacy agent_instructions reference remains under %s\n' \
"$target" >&2
rg --hidden --glob '!**/.git/**' --line-number \
'agent_instructions' "$target" >&2
failed=1
fi
done

return "$failed"
}

self_test() {
local fixture
fixture="$(mktemp -d /tmp/validate-bot-directives.XXXXXX)"
trap 'rm -rf -- "$fixture"' RETURN

mkdir -p "${fixture}/.machine_readable/agent_instructions"
if validate_targets "$fixture" >/dev/null 2>&1; then
echo "ERROR: validator accepted a planted legacy directory" >&2
return 1
fi

mv "${fixture}/.machine_readable/agent_instructions" \
"${fixture}/.machine_readable/bot_directives"
validate_targets "$fixture"
echo "Bot-directives validator self-test passed."
}

if [[ "${1:-}" == "--self-test" ]]; then
self_test
exit
fi

if (( $# > 0 )); then
validate_targets "$@"
else
validate_targets "${DEFAULT_TARGETS[@]}"
fi

echo "Bot-directives migration validation passed."
Loading