@softspark/ai-toolkit 4.1.0 → 4.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AGENTS.md CHANGED
@@ -348,7 +348,7 @@ Security expert. Use for OWASP Top 10, CVE analysis, security audits, penetratio
348
348
 
349
349
  ### `seo-specialist`
350
350
 
351
- Search engine + generative engine optimization specialist. Trigger words: SEO, GEO, AEO, search engine, meta tags, structured data, Core Web Vitals, sitemap, robots.txt, schema.org, llms.txt, ChatGPT visibility, Claude citation, Perplexity ranking, AI Overviews
351
+ Search engine + generative engine optimization specialist. Trigger words: SEO, GEO, AEO, search engine, meta tags, structured data, Core Web Vitals, sitemap, robots.txt, schema.org, llms.txt, ChatGPT visibility, Claude citation, Perplexity ranking, AI Overviews, topical authority, chunk architecture, semantic triples, query fan out
352
352
 
353
353
  **Tools:** `Read, Write, Edit, Bash, Grep, Glob`
354
354
 
@@ -436,7 +436,7 @@ Specialized agent personas — apply their expertise for relevant tasks:
436
436
  - **search-specialist**: Information retrieval and search optimization specialist. Trigger words: search, query, semantic search, information retrieval, relevance, ranking, search optimization
437
437
  - **security-architect**: Proactive security design expert. Use for Threat Modeling, architecture security reviews, and designing secure systems (AuthN/AuthZ, Crypto).
438
438
  - **security-auditor**: Security expert. Use for OWASP Top 10, CVE analysis, security audits, penetration testing, vulnerability assessment, hardening. Triggers: security, owasp, cve, vulnerability, audit, hardening, penetration, pentest, injection test, api security.
439
- - **seo-specialist**: Search engine + generative engine optimization specialist. Trigger words: SEO, GEO, AEO, search engine, meta tags, structured data, Core Web Vitals, sitemap, robots.txt, schema.org, llms.txt, ChatGPT visibility, Claude citation, Perplexity ranking, AI Overviews
439
+ - **seo-specialist**: Search engine + generative engine optimization specialist. Trigger words: SEO, GEO, AEO, search engine, meta tags, structured data, Core Web Vitals, sitemap, robots.txt, schema.org, llms.txt, ChatGPT visibility, Claude citation, Perplexity ranking, AI Overviews, topical authority, chunk architecture, semantic triples, query fan out
440
440
  - **system-governor**: The Guardian of the Constitution. Validates all evolutionary changes and enforces immutable rules. Has VETO power.
441
441
  - **tech-lead**: Technical authority for code quality, architecture patterns, and stack decisions. Use for code reviews, technological disputes, and standards enforcement.
442
442
  - **technical-researcher**: Deep technical investigation and multi-source research synthesis specialist. Trigger words: technical research, feasibility study, root cause analysis, API investigation, compatibility research, comparison matrix, synthesize, aggregate, report, executive summary, gap analysis, findings, multi-source, cross-reference
package/CHANGELOG.md CHANGED
@@ -7,6 +7,60 @@ Versioning follows [Semantic Versioning](https://semver.org/).
7
7
 
8
8
  ---
9
9
 
10
+ ## v4.2.1 - Claude Code hook enforcement and README cleanup (2026-05-12)
11
+
12
+ Patch release. Tightens Claude Code runtime enforcement, fixes duplicated hook cleanup during install/update, and removes the README hero image for release.
13
+
14
+ ### Changed
15
+
16
+ - **Stop quality gate** - Registered `quality-gate.sh` for `Stop` in addition to `TaskCompleted`, so final Claude Code responses are blocked when supported lint/type checks fail.
17
+ - **README release surface** - Removed the README hero image block while keeping badges and release notes intact.
18
+ - **Runtime guidance** - Clarified in `CLAUDE.md` that Claude Code consumes `CLAUDE.md`, settings, hooks, skills, and agents, while `AGENTS.md` is generated for Codex/OpenCode/Gemini compatibility.
19
+
20
+ ### Fixed
21
+
22
+ - **Quality gate exit codes** - Reworked shell pipelines so `ruff`, `tsc`, `dart analyze`, `phpstan`, and `go test` failures are not masked by output truncation.
23
+ - **Hook merge cleanup** - `scripts/merge-hooks.py` now removes legacy untagged ai-toolkit hook entries matching current toolkit hook signatures while preserving custom hooks.
24
+
25
+ ### Ecosystem
26
+
27
+ - Refreshed `benchmarks/ecosystem-doctor-snapshot.json` for current editor/runtime docs. Claude Code now exposes `Stop` in docs; the toolkit already supported `Stop` hooks, and this release registers the strict quality gate there.
28
+
29
+ ### Verification
30
+
31
+ - `python3 scripts/ecosystem_doctor.py --offline --check`: no drift.
32
+ - `python3 scripts/validate.py --strict`: 0 errors, 0 warnings.
33
+ - `python3 scripts/audit_skills.py --ci`: HIGH 0, WARN 0.
34
+ - `npm test`: 1049/1049 passing.
35
+ - `npm --cache /tmp/ai-toolkit-npm-cache pack --dry-run`: `softspark-ai-toolkit-4.2.1.tgz`.
36
+
37
+ ---
38
+
39
+ ## v4.2.0 - SEO GEO pipeline and release gate hardening (2026-05-07)
40
+
41
+ Minor release. Adds AI pipeline, content citability, and topical authority guidance to `seo-validate` from PR #9 by @fakenso, and keeps the release gate fixes prepared for v4.1.1 in the same unreleased train.
42
+
43
+ ### Added
44
+
45
+ - **SEO AI pipeline reference** - Added `app/skills/seo-validate/reference/ai-pipeline.md` covering the Prepare/Retrieve/Signal/Serve pipeline, ranking signals, Query Fan Out, and format routing.
46
+ - **Content citability reference** - Added `app/skills/seo-validate/reference/content-citability.md` covering chunk architecture, semantic triples, hedging patterns, decision frameworks, contrast patterns, negative definitions, freshness, and E-E-A-T.
47
+ - **Topical authority scope** - Added `--scope topical` to `seo-validate`, with checks for pillar/cluster structure, internal link density, generic anchors, orphan pages, ID-based slugs, and keyword cannibalization.
48
+ - **Expanded GEO guidance** - Expanded Category 6 from INFO-only guidance to INFO/WARN heuristics for chunk boundaries, author quality, and freshness. Updated `seo-specialist` with AI pipeline, multi-platform SEO, and topical authority responsibilities.
49
+
50
+ ### Fixed
51
+
52
+ - **URL rule registration test** - Replaced the live `raw.githubusercontent.com` dependency with a local fixture path guarded by `AI_TOOLKIT_TEST_MODE=1`, keeping production URL fetching HTTPS-only while making the full Bats suite hermetic.
53
+ - **Release validation gate** - Updated CI and `prepublishOnly` to run `python3 scripts/validate.py --strict`, matching the release preparation SOP.
54
+
55
+ ### Verification
56
+
57
+ - `npm test`: 1047/1047 passing.
58
+ - `python3 scripts/validate.py --strict`: 0 errors, 0 warnings.
59
+ - `python3 scripts/audit_skills.py --ci`: HIGH 0, WARN 0.
60
+ - `python3 scripts/evaluate_skills.py`: 107/107 passing.
61
+
62
+ ---
63
+
10
64
  ## v4.1.0 — Default `output-mode: concise` propagated to all editors (2026-05-06)
11
65
 
12
66
  Minor release. Adds a global `output-mode: concise` directive that propagates to every editor config produced by ai-toolkit. Reduces token usage and removes preamble/filler from assistant responses across Claude Code, Cursor, Windsurf, Cline, Roo Code, Augment, Codex, Antigravity, GitHub Copilot, Gemini CLI, and Aider.
package/README.md CHANGED
@@ -6,43 +6,16 @@
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
7
7
  [![Skills](https://img.shields.io/badge/skills-107-brightgreen)](app/skills/)
8
8
  [![Agents](https://img.shields.io/badge/agents-44-blue)](app/agents/)
9
- [![Tests](https://img.shields.io/badge/tests-1047%20passing-success)](tests/)
9
+ [![Tests](https://img.shields.io/badge/tests-1049%20passing-success)](tests/)
10
10
 
11
- <p align="center">
12
- <img src="assets/ai-toolkit-readme-hero.png" alt="ai-toolkit 3 README hero showing one toolkit for 12 AI editors" width="900">
13
- </p>
11
+ ## What's New in v4.2.1
14
12
 
15
- ---
16
-
17
- ## What's New in v4.1.0
18
-
19
- Default `output-mode: concise` directive now propagates to every editor config (Claude Code global + project-local CLAUDE.md, Cursor `.mdc` rules, Windsurf, Cline, Roo, Augment, Codex `.agents/rules`, Antigravity, GitHub Copilot, Gemini CLI, Aider). Auto-installed on every `ai-toolkit install` / `ai-toolkit update`. The `brand-voice` skill (shipped v3.2.0) auto-loads concise rules; assistants without that skill still see the directive in their config.
20
-
21
- - **No preamble**, lead with the result, max 3 sentences per closed question, tables over prose, no trailing summaries.
22
- - **Opt out**: `/brand-voice default` (session) or strip `<!-- TOOLKIT:output-mode -->` block from CLAUDE.md (permanent).
23
-
24
- ## What's New in v4.0.1
25
-
26
- CI hotfix for v4.0.0. Corrects skill subtype counts in `README.md` "What You Get" table and `kb/reference/architecture-overview.md` (hybrid 32 → 30, knowledge 48 → 45). The metadata contract tests caught the drift on CI; v4.0.0 release path missed three count locations. No skill catalog changes — see v4.0.0 below for the actual consolidation.
27
-
28
- ## What's New in v4.0.0
29
-
30
- **Breaking release.** Skill catalog consolidated from 112 → 107: removes 5 redundant skills, merges their substantive knowledge into the surviving targets. Eliminates `/skills` truncation and removes overlap that confused agent dispatch.
31
-
32
- - **`/search` removed** — `/research-mastery` is the superset (KB → MCP/Context7 → web with hierarchy of truth). Local Grep/Glob fallback is now part of `/research-mastery`.
33
- - **`/teams` removed** — `/workflow` covers the same scenarios without the experimental `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` flag.
34
- - **`plan-writing` knowledge skill removed** — estimation patterns (T-shirt sizing, cone of uncertainty) and pre-mortem rules are now part of `/plan`.
35
- - **`debugging-tactics` knowledge skill removed** — Iron Law, 4-phase methodology, and "5 Whys" are now part of `/debug`.
36
- - **`hive-mind` knowledge skill removed** — consensus voting and aggregation merged into `/swarm`.
37
-
38
- ### Migration
13
+ Patch release focused on making Claude Code rule enforcement harder to bypass and cleaning the release-facing README.
39
14
 
40
- | Before | After |
41
- |--------|-------|
42
- | `/search <query>` | `/research-mastery <query>` |
43
- | `/teams <preset>` | `/workflow <type>` |
44
- | Agent `skills: plan-writing` | Agent `skills: plan` |
45
- | Agent `skills: debugging-tactics` | Agent `skills: debug` |
15
+ - **Stop quality gate**: `quality-gate.sh` now runs on `Stop` as well as `TaskCompleted`, blocking final responses when lint/type checks fail.
16
+ - **Reliable hook failures**: shell pipelines in the quality gate now preserve the failing tool exit code instead of hiding errors behind `head`.
17
+ - **Cleaner installs**: hook merging now strips legacy untagged ai-toolkit duplicates while preserving user-owned hooks.
18
+ - **README cleanup**: removed the hero image block for a lighter release README.
46
19
 
47
20
  See [CHANGELOG.md](CHANGELOG.md) for full history.
48
21
 
@@ -152,7 +125,7 @@ See [CLI Reference](kb/reference/cli-reference.md) for all commands and options.
152
125
  | `skills/` (hybrid) | 30 | Slash commands with agent knowledge base |
153
126
  | `skills/` (knowledge) | 45 | Domain knowledge auto-loaded by agents (includes 13 `<lang>-rules` skills) |
154
127
  | `agents/` | 44 | Specialized agents across 10 categories |
155
- | `hooks/` | 21 global + 5 skill-scoped | Quality gates, path safety, prompt governance, session lifecycle |
128
+ | `hooks/` | 22 global + 5 skill-scoped | Quality gates, path safety, prompt governance, session lifecycle |
156
129
  | `plugins/` | 11 packs | Opt-in domain bundles (security, research, frontend, enterprise, 6 language packs) |
157
130
  | `constitution.md` | 6 articles | Machine-enforced safety rules |
158
131
  | `rules/` | auto-injected | Language-specific and custom rules injected into your configs |
@@ -168,14 +141,14 @@ ai-toolkit/
168
141
  │ ├── agents/ # 44 agent definitions
169
142
  │ ├── skills/ # 107 skills (task / hybrid / knowledge)
170
143
  │ ├── rules/ # Auto-injected into your CLAUDE.md
171
- │ ├── hooks/ # Hook scripts (21 entries, 12 lifecycle events)
144
+ │ ├── hooks/ # Hook scripts (22 entries, 12 lifecycle events)
172
145
  │ ├── plugins/ # 11 experimental plugin packs (opt-in)
173
146
  │ ├── output-styles/ # System prompt output style overrides
174
147
  │ ├── constitution.md # 6 immutable safety articles
175
148
  │ └── ARCHITECTURE.md # Full system design
176
149
  ├── kb/ # Reference docs, procedures, plans
177
150
  ├── scripts/ # Validation, install, evaluation scripts
178
- ├── tests/ # Bats test suite (1047 tests)
151
+ ├── tests/ # Bats test suite (1049 tests)
179
152
  └── CHANGELOG.md
180
153
  ```
181
154
 
@@ -187,7 +160,7 @@ ai-toolkit/
187
160
 
188
161
  **Machine-enforced constitution** — 6-article safety constitution enforced via `PreToolUse` hooks that actually block `rm -rf`, `DROP TABLE`, and irreversible operations. Not just documentation.
189
162
 
190
- **21 lifecycle hooks** — Executable scripts across 12 events (SessionStart → SessionEnd). Guards, governance, quality gates, session persistence, MCP health checks. See [Hooks Catalog](kb/reference/hooks-catalog.md).
163
+ **22 lifecycle hooks** — Executable scripts across 12 events (SessionStart → SessionEnd). Guards, governance, quality gates, session persistence, MCP health checks. See [Hooks Catalog](kb/reference/hooks-catalog.md).
191
164
 
192
165
  **Security scanning** — `/skill-audit` for code-level risks, `/cve-scan` for dependency CVEs. Both CI-ready with exit codes.
193
166
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ai-toolkit",
3
3
  "description": "Professional-grade Claude Code toolkit with persona presets, skill security auditor, expanded lifecycle hooks, experimental opt-in plugin packs, benchmark harvesting, and multi-tool support.",
4
- "version": "4.1.0",
4
+ "version": "4.2.1",
5
5
  "author": {
6
6
  "name": "SoftSpark",
7
7
  "url": "https://github.com/softspark"
@@ -8,7 +8,7 @@ Universal multi-agent system for software development. Works across all reposito
8
8
  |-----------|-------|
9
9
  | Agents | See agents catalog |
10
10
  | Skills | See skills catalog |
11
- | Hooks | 12 events / 21 entries (SessionStart ×3, Notification ×1, PreToolUse ×4, UserPromptSubmit ×2, PostToolUse ×2, Stop ×2, TaskCompleted ×1, TeammateIdle ×1, SubagentStart ×1, SubagentStop ×1, PreCompact ×2, SessionEnd ×1) |
11
+ | Hooks | 12 events / 22 entries (SessionStart ×3, Notification ×1, PreToolUse ×4, UserPromptSubmit ×2, PostToolUse ×2, Stop ×3, TaskCompleted ×1, TeammateIdle ×1, SubagentStart ×1, SubagentStop ×1, PreCompact ×2, SessionEnd ×1) |
12
12
 
13
13
  ---
14
14
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: seo-specialist
3
- description: "Search engine + generative engine optimization specialist. Trigger words: SEO, GEO, AEO, search engine, meta tags, structured data, Core Web Vitals, sitemap, robots.txt, schema.org, llms.txt, ChatGPT visibility, Claude citation, Perplexity ranking, AI Overviews"
3
+ description: "Search engine + generative engine optimization specialist. Trigger words: SEO, GEO, AEO, search engine, meta tags, structured data, Core Web Vitals, sitemap, robots.txt, schema.org, llms.txt, ChatGPT visibility, Claude citation, Perplexity ranking, AI Overviews, topical authority, chunk architecture, semantic triples, query fan out"
4
4
  tools: Read, Write, Edit, Bash, Grep, Glob
5
5
  model: sonnet
6
6
  color: cyan
@@ -9,7 +9,7 @@ skills: clean-code, seo-validate
9
9
 
10
10
  # SEO + GEO Specialist
11
11
 
12
- Optimization for both classical search engines AND generative engines (ChatGPT, Claude, Perplexity, Google AI Overviews, Gemini).
12
+ Optimization for both classical search engines AND generative engines (ChatGPT, Claude, Perplexity, Google AI Overviews, Gemini, Google AI Mode).
13
13
 
14
14
  ## Expertise
15
15
  - Technical SEO
@@ -18,6 +18,10 @@ Optimization for both classical search engines AND generative engines (ChatGPT,
18
18
  - Structured data (Schema.org)
19
19
  - SEO auditing
20
20
  - **Generative Engine Optimization (GEO)** — being cited by LLM-based answer engines
21
+ - **Google AI pipeline** — understanding the 4-stage Prepare/Retrieve/Signal/Serve pipeline and 7 ranking signals
22
+ - **Query Fan Out** — 95% of AI retrieval sub-queries have zero MSV; topical coverage matters more than keyword volume
23
+ - **Probabilistic ranking** — no deterministic "position 1"; optimize for citation probability across personas and contexts
24
+ - **Topical authority** — pillar + cluster architecture, orphan page detection, keyword cannibalization
21
25
 
22
26
  ## Responsibilities
23
27
 
@@ -39,6 +43,28 @@ Optimization for both classical search engines AND generative engines (ChatGPT,
39
43
  - Knowledge graph
40
44
  - Breadcrumbs
41
45
 
46
+ ### AI Pipeline Optimization
47
+ - **Chunk architecture** — design each H2 section as a self-contained ~375-word answer unit (≤500 tokens); each H3 is a separate chunk candidate
48
+ - **Semantic triple authoring** — Subject → Predicate → Object factual statements over marketing prose ("toughness: H3, dimensions: 160×200 cm" vs "exceptional quality")
49
+ - **Opinionated content** — clear declarative recommendations over hedged language ("we recommend X for Y" not "X may be worth considering")
50
+ - **Decision frameworks** — "if X → choose Y" constructions, the most-cited AI pattern
51
+ - **Contrast and comparison** — Jetstream signal: explicit "X vs Y", "unlike X, Y does…" patterns boost AI citation probability
52
+ - **Negative definitions** — "not recommended for Z" covers AI exclusion sub-queries
53
+ - **Freshness management** — refresh key pages before the 13-week threshold; update `dateModified` in JSON-LD AND visible text
54
+
55
+ ### Topical Authority & Cluster Design
56
+ - **Pillar + cluster architecture** — one comprehensive pillar page linking to focused cluster articles per topic
57
+ - **Internal linking** — ~1 contextual link per 800 chars, descriptive anchor text (never "click here")
58
+ - **Orphan page detection** — every content page needs at least one inbound internal link
59
+ - **Keyword cannibalization** — identify and consolidate pages competing for the same primary keyword
60
+ - **Natural-language URLs** — 5–7 descriptive words; ID-based slugs lose ~11.4% AI citation rate
61
+
62
+ ### Multi-Platform SEO
63
+ - **Video metadata** — YouTube title, description, and chapters function as SEO signals; shorts/Reels appear in Google SERP carousels
64
+ - **Visual search** — unique product images + contextual alt text for Google Lens and Circle to Search; avoid stock-only imagery
65
+ - **Social SEO** — Reddit, Quora, Wykop presence for Google's Hidden Gems algorithm; authentic participation, not spam
66
+ - **Hook-first video** — first 3 seconds determine retention (Instagram measures it explicitly); no logo intros or "hi, my name is…" openings
67
+
42
68
  ## Technical Checklist
43
69
 
44
70
  ### Meta Tags
@@ -155,13 +181,18 @@ Goal: get cited by ChatGPT, Claude, Perplexity, Gemini, and Google AI Overviews
155
181
 
156
182
  ### GEO audit checklist
157
183
  - [ ] First sentence of every page answers the page's title as a question
184
+ - [ ] Each H2 section is ≤375 words (chunk boundary); longer sections split with H3
185
+ - [ ] No hedging language ("may be", "worth considering", "for many people") in recommendation contexts — replaced with declarative stance
186
+ - [ ] At least one decision framework ("if X → choose Y") per guide or category page
187
+ - [ ] At least one explicit contrast ("X vs Y", "unlike X, Y…") per comparison page
188
+ - [ ] At least one negative definition ("not recommended for…") per product or category page
158
189
  - [ ] At least one comparison table OR numbered list per long-form page
159
- - [ ] Author block with name + role + LinkedIn / GitHub / ORCID
160
- - [ ] Schema.org `Article` with `author`, `datePublished`, `dateModified`
190
+ - [ ] Author block with real name (not "Admin"), role, and ≥30 words of bio
191
+ - [ ] Schema.org `Article` with `author` (`Person` + `sameAs`), `datePublished`, `dateModified`
161
192
  - [ ] Schema.org `FAQPage` for any page with Q/A structure
193
+ - [ ] `dateModified` updated AND visible "Updated: [date]" text present
162
194
  - [ ] `llms.txt` at site root with curated canonical URLs
163
195
  - [ ] Page contains at least 3 unique data points (numbers, dates, version strings)
164
- - [ ] Date visible to the user, not just in metadata
165
196
  - [ ] No paywall / login wall on indexable content
166
197
  - [ ] No JavaScript-only content for primary value (LLM crawlers often skip JS)
167
198
  - [ ] Internal links use claim-as-anchor, not "click here"
@@ -1,48 +1,60 @@
1
1
  #!/usr/bin/env bash
2
2
  # quality-gate.sh — Block task completion if lint/type errors found.
3
3
  #
4
- # Fires on: TaskCompleted
5
- # Exit 2 = block completion. Skipped when TOOLKIT_HOOK_PROFILE=minimal.
4
+ # Fires on: Stop, TaskCompleted
5
+ # Exit 2 = block completion/stop. Skipped when TOOLKIT_HOOK_PROFILE=minimal.
6
6
  # Strict profile also runs mypy.
7
7
 
8
8
  # shellcheck source=_profile-check.sh
9
9
  source "$(dirname "$0")/_profile-check.sh"
10
10
 
11
- if [ -f pyproject.toml ] || [ -f setup.py ]; then
12
- ruff check . 2>&1 | head -30
13
- exit_code=$?
11
+ run_required() {
12
+ local label="$1"
13
+ local preview_cmd="$2"
14
+ shift 2
15
+
16
+ local tmp
17
+ tmp="$(mktemp "${TMPDIR:-/tmp}/ai-toolkit-quality.XXXXXX")"
18
+ "$@" >"$tmp" 2>&1
19
+ local exit_code=$?
20
+ eval "$preview_cmd" <"$tmp"
21
+ rm -f "$tmp"
22
+
14
23
  if [ $exit_code -ne 0 ]; then
15
- echo "QUALITY GATE FAILED: ruff found errors. Fix them before completing." >&2
24
+ echo "QUALITY GATE FAILED: ${label}. Fix it before completing." >&2
16
25
  exit 2
17
26
  fi
27
+ }
28
+
29
+ require_command() {
30
+ local command_name="$1"
31
+ if command -v "$command_name" >/dev/null 2>&1; then
32
+ return 0
33
+ fi
34
+ echo "QUALITY GATE SKIPPED: ${command_name} is not installed." >&2
35
+ return 1
36
+ }
37
+
38
+ if [ -f pyproject.toml ] || [ -f setup.py ]; then
39
+ if require_command ruff; then
40
+ run_required "ruff found errors" "head -30" ruff check .
41
+ fi
18
42
  if [ -d src ] && [ "$PROFILE" = "strict" ]; then
19
- mypy --strict src/ 2>&1 | tail -5
20
- exit_code=$?
21
- if [ $exit_code -ne 0 ]; then
22
- echo "QUALITY GATE FAILED: mypy found type errors." >&2
23
- exit 2
43
+ if require_command mypy; then
44
+ run_required "mypy found type errors" "tail -5" mypy --strict src/
24
45
  fi
25
46
  fi
26
47
  elif [ -f package.json ] && [ -f tsconfig.json ]; then
27
- npx tsc --noEmit 2>&1 | tail -10
28
- exit_code=$?
29
- if [ $exit_code -ne 0 ]; then
30
- echo "QUALITY GATE FAILED: TypeScript compilation errors." >&2
31
- exit 2
48
+ if require_command npx; then
49
+ run_required "TypeScript compilation errors" "tail -10" npx tsc --noEmit
32
50
  fi
33
51
  elif [ -f pubspec.yaml ]; then
34
- dart analyze 2>&1 | tail -10
35
- exit_code=$?
36
- if [ $exit_code -ne 0 ]; then
37
- echo "QUALITY GATE FAILED: Dart analysis issues." >&2
38
- exit 2
52
+ if require_command dart; then
53
+ run_required "Dart analysis issues" "tail -10" dart analyze
39
54
  fi
40
55
  elif [ -f go.mod ]; then
41
- go vet ./... 2>&1 | tail -10
42
- exit_code=$?
43
- if [ $exit_code -ne 0 ]; then
44
- echo "QUALITY GATE FAILED: Go vet issues." >&2
45
- exit 2
56
+ if require_command go; then
57
+ run_required "Go vet issues" "tail -10" go vet ./...
46
58
  fi
47
59
  fi
48
60
 
package/app/hooks.json CHANGED
@@ -150,6 +150,16 @@
150
150
  "command": "\"$HOME/.softspark/ai-toolkit/hooks/save-session.sh\""
151
151
  }
152
152
  ]
153
+ },
154
+ {
155
+ "_source": "ai-toolkit",
156
+ "matcher": "",
157
+ "hooks": [
158
+ {
159
+ "type": "command",
160
+ "command": "\"$HOME/.softspark/ai-toolkit/hooks/quality-gate.sh\""
161
+ }
162
+ ]
153
163
  }
154
164
  ],
155
165
  "TaskCompleted": [
@@ -6,7 +6,7 @@ effort: medium
6
6
  disable-model-invocation: true
7
7
  context: fork
8
8
  agent: seo-specialist
9
- argument-hint: "[path] [--scope full|technical|content|performance|geo|rendering] [--severity high|warn|info] [--framework auto|next|nuxt|astro|gatsby|sveltekit|remix|angular|vue|react-spa|vite-spa|cra|static] [--rendering auto|csr|ssr|ssg|isr|hybrid] [--output markdown|json]"
9
+ argument-hint: "[path] [--scope full|technical|content|performance|geo|rendering|topical] [--severity high|warn|info] [--framework auto|next|nuxt|astro|gatsby|sveltekit|remix|angular|vue|react-spa|vite-spa|cra|static] [--rendering auto|csr|ssr|ssg|isr|hybrid] [--output markdown|json]"
10
10
  allowed-tools: Read, Grep, Glob, Bash
11
11
  ---
12
12
 
@@ -14,7 +14,7 @@ allowed-tools: Read, Grep, Glob, Bash
14
14
 
15
15
  $ARGUMENTS
16
16
 
17
- Scan a codebase for SEO issues using pattern-matching heuristics. Detects W3C/HTML violations, meta tag gaps, structured data problems, hreflang errors, Core Web Vitals risks (LCP/INP/CLS), resource-hint misuse, above-the-fold anti-patterns, GEO gaps, SPA/CSR/SSG crawlability problems, technical SEO misconfigurations, and accessibility-for-SEO issues. Read-only — never modifies files.
17
+ Scan a codebase for SEO issues using pattern-matching heuristics. Detects W3C/HTML violations, meta tag gaps, structured data problems, hreflang errors, Core Web Vitals risks (LCP/INP/CLS), resource-hint misuse, above-the-fold anti-patterns, GEO gaps (chunk architecture, hedging language, decision frameworks, semantic triples, freshness), topical authority gaps (pillar/cluster structure, orphan pages, cannibalization), SPA/CSR/SSG crawlability problems, technical SEO misconfigurations, and accessibility-for-SEO issues. Read-only — never modifies files.
18
18
 
19
19
  **Standards basis**: W3C HTML5 Recommendation, W3C WCAG 2.2, Schema.org vocabulary, IETF RFC 5646 (BCP 47 language tags) for hreflang, web.dev Core Web Vitals thresholds (LCP <2.5s, INP <200ms, CLS <0.1), Google Search Central crawlability guidelines, and emerging GEO (Generative Engine Optimization) practices.
20
20
 
@@ -26,6 +26,7 @@ Scan a codebase for SEO issues using pattern-matching heuristics. Detects W3C/HT
26
26
  /seo-validate --scope rendering # Only SPA/CSR/SSG crawlability checks
27
27
  /seo-validate --scope performance # Only Core Web Vitals static signals
28
28
  /seo-validate --scope geo # Only GEO (Generative Engine Optimization)
29
+ /seo-validate --scope topical # Only topical authority and cluster architecture
29
30
  /seo-validate --severity high # Filter to HIGH findings only
30
31
  /seo-validate --framework next # Force framework (skip auto-detection)
31
32
  /seo-validate --rendering csr # Force rendering-mode interpretation
@@ -33,12 +34,13 @@ Scan a codebase for SEO issues using pattern-matching heuristics. Detects W3C/HT
33
34
  ```
34
35
 
35
36
  **Scopes:**
36
- - `full` (default) — all 9 categories
37
+ - `full` (default) — all 10 categories
37
38
  - `technical` — HTML semantics, hreflang, CWV, rendering, technical SEO (categories 1, 4, 5, 7, 8)
38
39
  - `content` — meta/OG, structured data, GEO, a11y-for-SEO (categories 2, 3, 6, 9)
39
40
  - `performance` — only CWV static signals (category 5)
40
- - `geo` — only GEO (category 6)
41
+ - `geo` — only GEO / citability checks (category 6)
41
42
  - `rendering` — only category 7 (SPA/CSR/SSG crawlability) — useful for migration audits
43
+ - `topical` — only topical authority and cluster architecture (category 10)
42
44
 
43
45
  **Severity filtering:** `--severity high` shows only HIGH, `--severity warn` shows HIGH+WARN, `--severity info` shows all. Default: all.
44
46
 
@@ -273,20 +275,30 @@ See: [reference/core-web-vitals.md](reference/core-web-vitals.md)
273
275
 
274
276
  ### Category 6: GEO (Generative Engine Optimization)
275
277
 
276
- Content structure for AI answer engines (ChatGPT, Perplexity, Google AI Overviews, Bing Copilot). **All findings here are severity `INFO`** — emerging practice, not penalty-causing.
278
+ Content structure for AI answer engines (ChatGPT, Perplexity, Google AI Overviews, Bing Copilot, Google AI Mode). **Most findings here are severity `INFO` or `WARN`** — guidance based on measured citation patterns, not penalty-causing.
279
+
280
+ Google's retrieval stage splits content into chunks of ≤500 tokens (~375 words). Each section must be a self-contained answer unit. See [reference/ai-pipeline.md](reference/ai-pipeline.md) for the full 4-stage pipeline and 7 ranking signals. See [reference/content-citability.md](reference/content-citability.md) for chunk anatomy, semantic triples, and hedging patterns.
277
281
 
278
282
  | Pattern | Severity | Confidence | Description |
279
283
  |---------|----------|------------|-------------|
280
284
  | No `FAQPage` schema on FAQ-style content | INFO | heuristic | Highly extractable by LLMs |
281
285
  | No `speakable` schema on summary content | INFO | heuristic | Voice/audio answer engines |
282
- | Long paragraphs (>400 words) without sub-headings | INFO | heuristic | Harder for LLMs to extract |
286
+ | H2 section body exceeds ~375 words without an H3 sub-heading | WARN | heuristic | Exceeds single chunk boundary (~500 tokens); AI cannot extract cleanly — split with H3 |
287
+ | First paragraph under a heading exceeds 60 words before a concrete fact, number, or direct recommendation | INFO | heuristic | AI extracts first 2–3 sentences as the answer; preamble displaces the answer |
288
+ | Hedging language in recommendation or product context: "may be", "might be", "could be", "worth considering", "for many", "for most people" | INFO | heuristic | AI skips hedged claims; Jetstream signal rewards declarative recommendations (see [content-citability.md](reference/content-citability.md)) |
289
+ | No decision framework ("if X → choose Y" / "for X, use Y") in guide or category content | INFO | heuristic | Decision frameworks are the most-cited AI construction; covers Jetstream cross-attention signal |
290
+ | No contrast or comparison ("X vs Y", "unlike X", "in contrast to X") in content with comparative headings | INFO | heuristic | Jetstream directly rewards explicit contrasts; absence reduces AI citation probability |
291
+ | No negative definition ("not recommended for", "not suitable for", "avoid if") on product or category pages | INFO | heuristic | Covers AI exclusion sub-queries ("which product is not for stomach sleepers?") |
292
+ | Author name uses generic placeholder: "Admin", "Team", "Staff", "Editor", or no author at all | WARN | heuristic | E-E-A-T Experience signal requires a real named author; generic names suppressed by Google Bury Rules |
293
+ | Author block contains fewer than 30 words of bio text near the author name | INFO | heuristic | LLM answer engines use author credentials as an authority signal; stub bios do not qualify |
294
+ | Article `dateModified` (JSON-LD or `<time>`) is older than 13 weeks with no visible update notice | WARN | heuristic | 50% of top AI-cited content updated within 13 weeks (Blyskall, 40M AI Overviews study); stale content drops from citation pools |
283
295
  | Missing explicit citation/source markup (`<cite>`, author bylines) | INFO | heuristic | LLM answer engines prefer attributable sources |
284
296
  | No `<q>` or quote schema on quoted content | INFO | heuristic | Aids AI extraction |
285
297
  | No Q&A structure on how-to content | INFO | heuristic | LLMs favor structured Q&A |
286
298
  | Heavy reliance on `<div>` over semantic HTML | INFO | heuristic | Semantic HTML improves AI parsing |
287
299
  | Key facts hidden behind JS interactions (tabs, accordions) | INFO | heuristic | LLMs see initial DOM only |
288
300
 
289
- See: [reference/geo-guidelines.md](reference/geo-guidelines.md)
301
+ See: [reference/geo-guidelines.md](reference/geo-guidelines.md), [reference/content-citability.md](reference/content-citability.md), [reference/ai-pipeline.md](reference/ai-pipeline.md)
290
302
 
291
303
  ---
292
304
 
@@ -385,6 +397,23 @@ Accessibility ↔ SEO overlap. WCAG compliance improves ranking signals.
385
397
 
386
398
  ---
387
399
 
400
+ ### Category 10: Topical Authority & Cluster Architecture
401
+
402
+ Topical authority is the degree to which a domain is recognised as an expert source across an entire topic, not just individual pages. AI retrieval (Gecko Score / semantic embedding) rewards domains with deep, interlinked coverage. Classical SEO also benefits — Senuto's study of 212K phrases across 7,200 semantic groups showed topical coverage dominates top-10 rankings independently of individual technical metrics.
403
+
404
+ | Pattern | Severity | Confidence | Description |
405
+ |---------|----------|------------|-------------|
406
+ | Long-form page (>800 words) has internal link density below 1 link per 800 characters of body text | WARN | heuristic | Google's internal linking guideline: ~1 contextual internal link per 800 chars; low density = weak cluster signal |
407
+ | Internal link uses generic anchor text: "click here", "read more", "here", "this page", "learn more" | WARN | definitive | Anchor text is a topical signal; descriptive claim-based anchors transfer semantic context to the linked page |
408
+ | Page >2,000 words with no outbound internal links to topically related pages | INFO | heuristic | Pillar pages must link out to cluster articles; absence breaks the pillar→cluster signal and reduces Gecko relevance |
409
+ | Page has >500 words of indexable content with zero detected inbound internal links (orphan page) | WARN | heuristic | Orphan pages receive minimal crawl budget and no authority pass-through; every content page needs at least one inbound link |
410
+ | Content page URL slug contains numeric IDs, UUIDs, or is purely numeric (e.g., `/post/12345`, `/p/abc-uuid`) | WARN | heuristic | Natural-language slugs (5–7 descriptive words) show +11.4% AI citation rate vs. ID-based URLs (Blyskall study) |
411
+ | Two or more pages on the same domain target the same primary keyword in H1 and title | WARN | heuristic | Keyword cannibalization: pages compete against each other, diluting authority; consolidate into pillar + cluster |
412
+
413
+ **Topical authority strategy note:** Query Fan Out means AI generates 50+ sub-queries per user question, 95% of which have zero Monthly Search Volume in any keyword tool. Covering a topic with a pillar + cluster architecture answers the full sub-query space that keyword tools cannot see. See [reference/ai-pipeline.md](reference/ai-pipeline.md).
414
+
415
+ ---
416
+
388
417
  ## Output Format
389
418
 
390
419
  ```markdown
@@ -393,7 +422,7 @@ Accessibility ↔ SEO overlap. WCAG compliance improves ranking signals.
393
422
  ### Summary
394
423
  | Metric | Value |
395
424
  |--------|-------|
396
- | Scope | full / technical / content / performance / geo / rendering |
425
+ | Scope | full / technical / content / performance / geo / rendering / topical |
397
426
  | Framework detected | next / nuxt / astro / gatsby / sveltekit / remix / angular / vue / react-spa / vite-spa / cra / static |
398
427
  | Rendering mode | csr / ssr / ssg / isr / hybrid |
399
428
  | Files scanned | N |
@@ -445,7 +474,7 @@ See: reference/spa-ssg-patterns.md#react-spa-migration
445
474
  - **Standards citation**: Every HIGH/WARN finding must cite a W3C/Schema.org/RFC/web.dev reference.
446
475
  - **Skip non-source files**: Binary files, lock files (`package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`), vendored directories (`node_modules/`, `vendor/`, `.git/`, `dist/`, `build/`, `out/`, `.next/`, `.nuxt/`, `.svelte-kit/`, `public/build/`).
447
476
  - **No false confidence**: Label heuristic findings clearly; above-the-fold detection is always heuristic.
448
- - **GEO is INFO-only**: Never flag GEO findings as HIGH/WARN — it is emerging practice.
477
+ - **GEO severity**: Category 6 findings may be WARN (chunk size, author quality, freshness) or INFO (hedging, frameworks, contrast, bio) see table. Never raise GEO findings to HIGH.
449
478
  - **SPA HIGH bar**: Only flag Category 7 HIGH when the app is clearly a content site (has public routes with meaningful content). Auth-gated apps (dashboards, admin panels) should stay at WARN/INFO since SEO is not a concern.
450
479
  - **Noscript is not a substitute for SSR/SSG**: `<noscript>` catches only the "no-JS" case, not the "crawler without JS execution" case — don't upgrade a CSR HIGH to WARN just because noscript exists.
451
480
  - **No auto-fix in v1**: Fixing SEO issues requires design/content decisions beyond pattern matching.
@@ -454,7 +483,9 @@ See: reference/spa-ssg-patterns.md#react-spa-migration
454
483
 
455
484
  - [reference/w3c-guidelines.md](reference/w3c-guidelines.md) — HTML5 semantic requirements, meta tag specs, language tag rules.
456
485
  - [reference/core-web-vitals.md](reference/core-web-vitals.md) — LCP/INP/CLS thresholds, resource hints, above-the-fold heuristic, per-framework image components.
457
- - [reference/geo-guidelines.md](reference/geo-guidelines.md) — GEO principles, `speakable` schema, citation/source markup, AI-extractable content structure.
486
+ - [reference/geo-guidelines.md](reference/geo-guidelines.md) — GEO principles, `speakable` schema, citation/source markup, AI-extractable content structure, chunk anatomy, 13-week freshness strategy.
458
487
  - [reference/geo-aeo-patterns.md](reference/geo-aeo-patterns.md) — AEO (Answer Engine Optimization): `FAQPage`/`HowTo`/`QAPage` schema, `llms.txt`, AI bot `robots.txt` directives, E-E-A-T signals, automated grep patterns for Category 6.
488
+ - [reference/content-citability.md](reference/content-citability.md) — Chunk architecture, semantic triples, opinionated vs hedging language, decision frameworks, contrast patterns, negative definitions, justified superlatives, grep patterns.
489
+ - [reference/ai-pipeline.md](reference/ai-pipeline.md) — Google's 4-stage AI pipeline (Prepare/Retrieve/Signal/Serve), 7 ranking signals (Gecko, Jetstream, PCTR, Freshness, BM25, Base, Boost/Bury), Query Fan Out, probabilistic ranking, format routing.
459
490
  - [reference/schema-types.md](reference/schema-types.md) — Schema.org JSON-LD templates (Article, FAQ, BreadcrumbList, Organization, Product, LocalBusiness) with required properties.
460
491
  - [reference/spa-ssg-patterns.md](reference/spa-ssg-patterns.md) — Rendering-mode decision tree, SPA pitfalls, per-framework detection patterns, prerendering strategies.