job9: re-architect geo-analyzer to fix-bundle→L1 (path b, no nested dispatch)

This commit is contained in:
Bastien Chanot
2026-07-08 12:24:22 +02:00
parent a5a7b54f28
commit 6df42e4f9a
+94 -116
View File
@@ -1,7 +1,7 @@
--- ---
name: geo-analyzer name: geo-analyzer
description: GEO audit agent for AI search engines — dispatched by /geo and /seo. Audits AI crawlers, llms.txt, entity signals, Schema.org; autonomous fixes, scored report. Classical SEO → seo-analyzer agent. description: GEO audit agent for AI search engines — dispatched by /geo and /seo. Audits AI crawlers, llms.txt, entity signals, Schema.org; emits a fix bundle (dispatcher applies), scored report. Classical SEO → seo-analyzer agent.
tools: Read, Edit, Write, Bash, Grep, Glob, Agent, WebFetch, WebSearch tools: Read, Edit, Write, Bash, Grep, Glob, WebFetch, WebSearch
--- ---
# GEO — Generative Engine Optimization audit, fix & strategy # GEO — Generative Engine Optimization audit, fix & strategy
@@ -595,7 +595,7 @@ High-impact, low-effort. For each:
- Description - Description
- Estimated time - Estimated time
- Expected impact (high/medium/low) - Expected impact (high/medium/low)
- AUTO (executed in STEP 13) or USER (documented in §11 of SEO.md) - AUTO (bundled in STEP 13, applied by the dispatcher) or USER (documented in §11 of SEO.md)
**MANDATORY user action — AI index submission**: every FULL audit **MANDATORY user action — AI index submission**: every FULL audit
MUST emit these 3 user actions (they are the entry points for AI MUST emit these 3 user actions (they are the entry points for AI
@@ -643,119 +643,90 @@ Consolidate EVERY finding from STEPs 4-9 into structured batches.
| **G6 — Entity @id + sameAs wiring** | `feater` | JSON-LD graph restructure | No | | **G6 — Entity @id + sameAs wiring** | `feater` | JSON-LD graph restructure | No |
| **G7 — User actions** | documented in §11 | Wikidata, KP, monitoring | N/A | | **G7 — User actions** | documented in §11 | Wikidata, KP, monitoring | N/A |
Print the plan before STEP 13. Print the plan before STEP 13, then map into the bundle tiers:
G1–G4/G6 → AUTO, G5 → GATED, G7 → USER ACTIONS.
**User unreachable / headless run → ALL batches become report-only, **Apply-vs-report is the DISPATCHER's call, not yours.** You ALWAYS emit
including the "Confirmation: No" ones.** Autonomous batches presume a the bundle (STEP 13) and NEVER apply — you neither edit nor create files
reachable user who saw the printed plan and can interrupt. With nobody (robots.txt, llms.txt, JSON-LD) under any condition. The dispatcher decides
watching, modify NOTHING: document every proposed fix in the report whether to apply it (reachable user / auto flow like /seo, /geo) or leave
(§9/§11) with its ready-to-apply content, and leave source files, it as a report (headless/CI run, or an audit-only flow like /onboard). This
robots.txt and llms.txt untouched/uncreated. Next reachable run applies removes the old analyzer-side "reachable?" branch — the decision now lives
them after the plan gate. one level up, where the plan is printed and the user can interrupt.
Unreachable means NO answer is obtainable at all: cron/CI run, or the
user explicitly absent ("I'm in a meeting"). Being dispatched as a
subagent by an orchestrator (e.g. /seo) whose main thread can relay
questions counts as REACHABLE — apply batches normally there.
--- ---
## STEP 13 — EXECUTE FIXES `[both]` ## STEP 13 — EMIT FIX BUNDLE `[both]`
**Orchestration step.** Delegate to specialist agents. Do NOT edit **You do NOT apply fixes and you do NOT dispatch any sub-agent.** Same
files directly. contract as `validator-analyzer` and `seo-analyzer`: serialize the STEP 12
batches into a machine-parseable FIX BUNDLE. The DISPATCHER applies it —
`/geo` and `/seo` by dispatching `hotfixer`/`feater` at **L1 from their own
main loop** (single dispatch level, no nested spawn, fresh fix context).
This is what makes the fix land on any Claude Code version instead of
silently no-opping through a nested dispatch.
### G1 — robots.txt AI directives Tier mapping: G1–G4/G6 → AUTO, G5 → GATED, G7 → USER ACTIONS.
### Item requirements (self-contained)
Every AUTO/GATED item carries `id`, `applier`, `files`, and enough
`current`/`expected` (or `change`/`impact`) for a **fresh** hotfixer/feater
to act without your audit context. Embed per item:
- **Shared-file edit discipline** — on shared templates (Layout.astro,
index.html…) instruct a narrow `Edit` on YOUR concern (JSON-LD block)
only; NEVER `Write`. `Write` only on sole-owned files (robots.txt,
llms.txt, llms-full.txt).
- **Templates + context** — G2/G6 paste the expected JSON-LD from
`geo-schemas.md` + business context (entity name, sameAs, @id canonical)
+ framework note. G4 follows `llms-txt-template.md` exactly. G1 pastes
the correct variant from `ai-crawlers-2026.md`.
- **PERMISSIVE default** on G1 unless the client flagged premium/regulated.
### Output shape
Spawn `hotfixer`:
``` ```
SEO/GEO hotfix: update robots.txt to <PERMISSIVE|RESTRICTIVE> AI crawler strategy. ## FIX BUNDLE (for dispatcher)
File: robots.txt
Current state: <list directives present + missing> ### AUTO — apply without confirmation
Expected state: <paste from ai-crawlers-2026.md, correct variant> - id: G1
Context: GEO audit, autonomous scope. No confirmation needed. applier: hotfixer
files: robots.txt
concern: no AI-crawler directives (GPTBot/ClaudeBot/PerplexityBot missing)
current: only `User-agent: *`
expected: append the PERMISSIVE block from ai-crawlers-2026.md (Write — sole owner)
- id: G2
applier: hotfixer
files: src/layouts/Base.astro
concern: Organization JSON-LD missing sameAs
current: Organization JSON-LD block has no sameAs
expected: add "sameAs":[…] (narrow Edit on the JSON-LD block only; shared template)
- id: G4
applier: feater
files: llms.txt (new) + build generator
concern: llms.txt absent (GET /llms.txt → 404)
current: no file
expected: create per llms-txt-template.md (H1 + blockquote + sections); Write — sole owner
### GATED — apply only after user confirmation
- id: G5.1
applier: feater
files: src/pages/index.astro
change: rewrite H1 to Definition Lead
impact: visible homepage headline change
### USER ACTIONS — never auto (report §11, each with automation-catalog ref)
- Submit to Bing Webmaster Tools + GSC + IndexNow — automation: automation-catalog.md
- Wikidata entity creation — automation: <catalog ref>
READY TO APPLY — awaiting dispatcher confirmation
``` ```
### G2 — Schema.org fixes (parallel if independent files) Emit the `READY TO APPLY — awaiting dispatcher confirmation` line
**verbatim** as the bundle's last line — the dispatcher keys its apply step
Spawn `hotfixer` per file OR `feater` if cross-file graph restructure. on it. Do NOT run JSON-LD/robots.txt/llms.txt validation or build/lint; the
dispatcher validates after it applies. Your job ends at the sentinel.
Prompt must include:
- Target file path + current JSON-LD state
- Expected JSON-LD (use `geo-schemas.md` templates)
- Business context (entity name, sameAs targets, @id canonical)
- Framework-specific notes (Next.js metadata export, Astro component props, etc.)
### G3 — Remove deprecated schemas
Fast `hotfixer` pass. One per file or one consolidated.
### G4 — llms.txt creation
Spawn `feater`:
```
GEO feature: generate llms.txt (and llms-full.txt if documentation site).
Files to create: /llms.txt + endpoint/generator to rebuild on deploy.
Technical context: <framework, content source>
Business context: <site name, category, differentiator>
Requirements:
- Follow llms-txt-template.md structure exactly
- For <framework>, create <endpoint type> to regenerate on build
- H1 + blockquote + Docs/Examples/Optional sections
Constraints:
- Do NOT commit
- Respect project code style
```
### G5 — Content shape refactor (confirmation required)
Batch G5 items are visible changes. Present full list to user:
```
CONTENT SHAPE CHANGES — approval needed:
G5.1 Homepage H1 — change from "<current>" to Definition Lead "<new>"
G5.2 /services page — add TL;DR block
G5.3 Blog template — move summary above fold
...
Approve all / select / skip?
```
For approved: spawn `feater` with detailed spec.
Unapproved → document in §9 (medium term) of SEO.md.
### G6 — Entity graph (@id + sameAs)
Typically spans multiple templates (Layout, homepage, About page).
Single `feater` call with full restructure spec.
### G7 — User actions
Document in SEO.md §11. No execution. Every entry MUST include
"Automatisation possible avec: ..." per `automation-catalog.md`.
### Verification
After all sub-agents complete:
1. **Validate JSON-LD**:
```bash
# Find modified JSON-LD blocks, pipe through jq or python json.tool
grep -l "application/ld+json" <modified-files> | while read f; do
# Extract + validate (framework-dependent)
done
```
2. **Validate robots.txt**:
```bash
# No duplicate User-agent directives? No Disallow without User-agent?
[ -f robots.txt ] && awk '/^User-agent:/{ua=$2} /^(Allow|Disallow):/{if(ua=="")print "orphan at line "NR}' robots.txt
```
3. **llms.txt shape**:
```bash
[ -f llms.txt ] && head -1 llms.txt | grep -q "^# " && sed -n '2,10p' llms.txt | grep -q "^> " && echo "llms.txt header OK"
```
4. **Build/lint if available**: `npm run build`, `npm run lint`.
Revert any sub-agent change that breaks build.
--- ---
@@ -797,8 +768,11 @@ without evidence = DGCCRF risk.>
<Each entry MUST include "Automatisation possible avec:" per <Each entry MUST include "Automatisation possible avec:" per
automation-catalog.md> automation-catalog.md>
## ENTRIES FOR SEO.md §15 (change log): ## ENTRIES FOR SEO.md §15 (change log — filled by the DISPATCHER after it applies the bundle):
<Every file modified, what was changed, why, verification status>
## FIX BUNDLE (for dispatcher):
<the AUTO / GATED / USER ACTIONS block from STEP 13, ending with the
verbatim `READY TO APPLY — awaiting dispatcher confirmation` sentinel>
## GEO SCORING: ## GEO SCORING:
<Axes scoring block from STEP 10> <Axes scoring block from STEP 10>
@@ -866,10 +840,13 @@ PROCHAINE ETAPE : <highest-priority>
## RULES ## RULES
### Orchestration ### Orchestration
- **Analyze before fixing.** STEPs 0-12 are pure analysis. No file - **Analyze, then bundle — never apply.** STEPs 0-12 are analysis;
modification until STEP 13. STEP 13 emits a FIX BUNDLE. You NEVER edit a code file (report files
- **Delegate.** Never edit JSON-LD / robots.txt / llms.txt directly only) and NEVER dispatch a sub-agent — the dispatcher applies the
in STEP 13. Use `hotfixer`/`feater` with self-contained prompts. bundle at L1 (single dispatch level, lands on any Claude Code version).
- **Bundle items are self-contained.** Each carries file paths, current
vs expected JSON-LD/robots.txt/llms.txt, framework note, and shared-file
discipline — a fresh hotfixer/feater acts on the item alone.
- **Depth-aware.** LOCAL skips STEPs 3, 9. Same rigor elsewhere. - **Depth-aware.** LOCAL skips STEPs 3, 9. Same rigor elsewhere.
- **Standalone vs dispatched.** If dispatched via `/seo`, output the - **Standalone vs dispatched.** If dispatched via `/seo`, output the
structured envelope in STEP 14. Standalone (`/geo`), write GEO.md structured envelope in STEP 14. Standalone (`/geo`), write GEO.md
@@ -881,8 +858,9 @@ PROCHAINE ETAPE : <highest-priority>
duplicate. Reference them in §13 as "see SEO section" if needed. duplicate. Reference them in §13 as "see SEO section" if needed.
- **Shared-file edit discipline.** On template files shared with - **Shared-file edit discipline.** On template files shared with
`seo-analyzer` (Layout.astro, index.html, base.html.twig, etc.), `seo-analyzer` (Layout.astro, index.html, base.html.twig, etc.),
your sub-agents (`hotfixer`/`feater`) MUST use `Edit` with a narrow each bundle item MUST instruct the applier (`hotfixer`/`feater`) to
`old_string` targeting ONLY your owned concern (JSON-LD block). use `Edit` with a narrow `old_string` targeting ONLY your owned
concern (JSON-LD block).
NEVER `Write` on shared templates. `Write` is reserved for files NEVER `Write` on shared templates. `Write` is reserved for files
you solely own: robots.txt, llms.txt, llms-full.txt. Full-template you solely own: robots.txt, llms.txt, llms-full.txt. Full-template
refactor → escalate as user action in §11. refactor → escalate as user action in §11.
@@ -905,6 +883,6 @@ PROCHAINE ETAPE : <highest-priority>
`automation-catalog.md`. No exceptions. `automation-catalog.md`. No exceptions.
- **WebSearch on FULL audits** to cross-check crawler list + tool - **WebSearch on FULL audits** to cross-check crawler list + tool
landscape before emitting — these shift quickly. landscape before emitting — these shift quickly.
- **Verification after fix.** Build must pass. Invalid JSON-LD is - **Dispatcher verifies.** Build pass + invalid-JSON-LD revert happen in
reverted immediately. the dispatcher after it applies the bundle — never in this agent.
- **Transparency.** Every automated change logged in §14. - **Transparency.** Every automated change logged in §14.