diff --git a/README.md b/README.md
index d6ace9b..fa9c6fc 100644
--- a/README.md
+++ b/README.md
@@ -84,7 +84,7 @@ two steps:
new here? the [agystack guide](./docs/guide/README.md) walks you through a first real task, from setup and prompting through verification and overnight runs.
-that's it. the other skills are situational; the mode skill uses them for you as needed. out of the box on Antigravity the mode splits work by model tier: fast mechanical code and exploration runs on `flash`, while judgment, complex tasks, and deep code run on `pro`. the default review panel is `pro` / `flash` / `inherit`. [`/setup-agystack`](./skills/setup-agystack/SKILL.md) changes any of it.
+that's it. the other skills are situational; the mode skill uses them for you as needed. out of the box on Antigravity the mode splits work by model tier: exploration, investigators, and swarm workers run on `flash`, while implementation, judgment, and synthesis roles use `inherit` (your active chat model). the default review and runner panel is `inherit` / `flash` / `pro`. [`/setup-agystack`](./skills/setup-agystack/SKILL.md) changes any of it.
## usage
@@ -92,7 +92,7 @@ use [`/agystack`](./skills/agystack/SKILL.md) or [`/poteto-mode`](./skills/potet
### just use [`/agystack`](./skills/agystack/SKILL.md) or [`/poteto-mode`](./skills/poteto-mode/SKILL.md)
-this skill is the main shortcut. i use it whenever i need the agent to do rigorous engineering work. it comes with twenty-three playbooks:
+this skill is the main shortcut. i use it whenever i need the agent to do rigorous engineering work. it comes with 23 playbooks:
```
/poteto-mode this pr has a subtle bug where the scroll drifts every 750ms even when idle. repro
@@ -105,7 +105,7 @@ morning.
```
-the twenty-three playbooks
+the 23 playbooks
| playbook | for |
|---|---|
@@ -206,13 +206,14 @@ Or trigger `/cloud-swarm` right in chat:
| [`/why`](./skills/why/SKILL.md) | you want to know why something was built this way. discovers available MCPs at run time and queries each evidence category in parallel (source control, issue tracker, long-form docs, real-time chat, infra observability, error tracking, analytics warehouse). |
| [`/recall`](./skills/recall/SKILL.md) | you're starting or resuming work and want your recent context on a topic rebuilt from your own chat history and the shared record, handed back as a tight current-state brief. |
| [`/blast-radius`](./skills/blast-radius/SKILL.md) | you have a small-looking change and want to know what else it could break, with the one fact it's safe because of proven by running code, not asserted. |
-| `/grill-me` | your requirements are underspecified or ambiguous and you want Socratic pressure testing before kicking off architecture or autonomous execution ([guide](./docs/guide/04-design.md#flesh-out-ambiguous-requirements-with-grill-me)). |
+| [`/in-your-own-words`](./skills/in-your-own-words/SKILL.md) | you want the agent to restate goal, problem, scope, and plan before proposing or writing code. |
| [`/architect`](./skills/architect/SKILL.md) | you're about to write code that crosses a function boundary and want the caller's usage, types, and module shape settled first. |
| [`/arena`](./skills/arena/SKILL.md) | you want N parallel attempts at the same thing, then to grab the best parts of each. |
| [`/cloud-swarm`](./skills/cloud-swarm/SKILL.md) | you want N parallel workers across different slices or races in Cloud Run, then one aggregated report. |
| [`/interrogate`](./skills/interrogate/SKILL.md) | you have a diff and want several different models to try to break it, including a strict code-quality lens. |
| [`/automate-me`](./skills/automate-me/SKILL.md) | you want your own `-mode` skill, drafted from how you've actually worked. |
| [`/deslop`](./skills/deslop/SKILL.md) | you want to clean defensive code, redundant guards, and AI bloat out of diffs before commit. |
+| [`/correct`](./skills/correct/SKILL.md) | an agent hit a recurring mistake and you want to harden the repo with architectural or test checks before adding prompt text. |
| [`/setup-agystack`](./skills/setup-agystack/SKILL.md) | you want to pick which models agystack uses per role. detects your models and writes a config rule. |
| [`/reflect`](./skills/reflect/SKILL.md) | a long task landed and you want the recipe captured as a skill edit. |
| [`/teach`](./skills/teach/SKILL.md) | you want to actually understand a change or subsystem, not just have it summarized. runs how + why and weaves one plain explanation, built up diagram by diagram. |
@@ -220,13 +221,18 @@ Or trigger `/cloud-swarm` right in chat:
| [`/no-comments`](./skills/no-comments/SKILL.md) | strip comments before review; spawns Comment Sicko, fixes accepted findings, offers encodings for claimed constraints. |
| [`/typescript-best-practices`](./skills/typescript-best-practices/SKILL.md) | you're reading or editing typescript. grounds the type-system-discipline principle in syntax. |
| [`/figure-it-out`](./skills/figure-it-out/SKILL.md) | no bundled playbook fits. designs a rigorous, auditable playbook for the task. |
+| [`/loop`](./skills/loop/SKILL.md) | you want iterative edits run against a concrete `--verify` command with reactive `schedule` wakeups until green. |
| [`/show-me-your-work`](./skills/show-me-your-work/SKILL.md) | you want a reviewable decision trail. logs decisions to a tsv you can commit. |
+| [`/ketchup`](./skills/ketchup/SKILL.md) | you want a status brief under 100 words on an autonomous run or background task, with artifact links and selectable picks. |
| [`/create-verification-skill`](./skills/create-verification-skill/SKILL.md) | your project has no scripted way to prove app behavior. generates a project-local verify skill with a feature map, for any language or platform. |
+| [`/create-formal-verification-skill`](./skills/create-formal-verification-skill/SKILL.md) | you need formal model checking (TLA+, Alloy, Dafny) for high-consequence concurrency, consensus, complex state machines, or critical parsers. |
| [`/maintain-verification-skill`](./skills/maintain-verification-skill/SKILL.md) | your verify skill's feature map has drifted from the app. source wave + one live pass, at most one PR of proven corrections. |
+| [`/benchmark-checklist`](./skills/benchmark-checklist/SKILL.md) | you are reporting performance numbers or speedups and want to check them against the Seven Performance Verification Questions first. |
| [`/unslop`](./skills/unslop/SKILL.md) | you're cleaning up writing. removes AI tells. |
| [`/bro`](./skills/bro/SKILL.md) | you want the last message restated in plain human language, no jargon. |
| [`/technical-writing`](./skills/technical-writing/SKILL.md) | layered doc standard (Diátaxis + Google developer style + STE + Global English) for docs, RFCs, readmes, PR descriptions, commit messages. |
| [`/statechart`](./skills/statechart/SKILL.md) | you want to model system states, transitions, invariants, and failure modes as native Mermaid diagrams. |
+| [`/sharpen`](./skills/sharpen/SKILL.md) | you want a deeper version of a prompt rebuilt around raw inputs, expert methods, and external checks. |
@@ -260,7 +266,6 @@ figure it out: /poteto-mode i'm stepping away. migrate every caller from the
right when i'm back.
how: /how do we cancel runs? do we have an n+1 when we look up every run to cancel?
why: /why is this feature flag not on yet?
-grill-me: my idea is rough. probe my assumptions and grill me before we design anything.
architect: design this instrumentation to be high signal with no false positives. /architect
this first.
arena: /arena take my prompt to the arena verbatim. i want to compare their proposals
@@ -288,10 +293,10 @@ agystack also ships [comment-sicko](./agents/comment-sicko.md), a read-only comm
## principles
-twenty-three short skills, one principle each. `poteto-mode` indexes them inline and reads that index at task start. the standalone files are there so other skills can reference a principle by name, and so the index can point at the full rule for each.
+twenty-four short skills, one principle each. `poteto-mode` indexes them inline and reads that index at task start. the standalone files are there so other skills can reference a principle by name, and so the index can point at the full rule for each.
-all twenty-three principles
+all twenty-four principles
| principle | group | rule |
|---|---|---|
diff --git a/agystack-models.md b/agystack-models.md
index 89ca3bf..02eecec 100644
--- a/agystack-models.md
+++ b/agystack-models.md
@@ -23,5 +23,3 @@ swarm workers: flash
architect runners: inherit, flash, pro
interrogate reviewers: inherit, flash, pro
-
-
diff --git a/docs/guide/08-principles.md b/docs/guide/08-principles.md
index acbdca4..7e0bc66 100644
--- a/docs/guide/08-principles.md
+++ b/docs/guide/08-principles.md
@@ -1,6 +1,6 @@
# Steer with principle names
-agystack ships 23 principles as individual skills. `/poteto-mode` reads their index at the start of every multi-step task, applies the ones the task triggers, and names each applied principle in its reply along with the decision it changed.
+agystack ships 24 principles as individual skills. `/poteto-mode` reads their index at the start of every multi-step task, applies the ones the task triggers, and names each applied principle in its reply along with the decision it changed.
You don't invoke principles. You use their names to steer. Each name points at a complete rule the agent has already read, so one phrase redirects the work more precisely than a paragraph of instructions.
@@ -26,7 +26,7 @@ separate before serializing shared state. give each attempt its own worktree, no
Each phrase lands because the rule behind it is specific. The agent still has to say, in its reply, which decision the rule changed. A principle citation with no decision behind it is the tell that it name-dropped instead of applying.
-## The 23, briefly
+## The 24, briefly
The core principles decide how much to build and when to rethink the design:
diff --git a/skills/setup-agystack/SKILL.md b/skills/setup-agystack/SKILL.md
index b954da9..89c90f0 100644
--- a/skills/setup-agystack/SKILL.md
+++ b/skills/setup-agystack/SKILL.md
@@ -74,8 +74,8 @@ If `~/.gemini/config/plugins/agystack/agystack-models.md` exists, read its curre
### 4. Map and confirm
Show every role with its model tier and confirm:
-- Single roles: `feature, refactoring`, `bug-fix`, `perf-issue`, `hillclimb`, `swarm workers`
-- Panel roles: `arena runners`, `architect runners`, `interrogate reviewers`
+- Single roles: `feature, refactoring`, `bug-fix`, `perf-issue`, `hillclimb`, `judgment and prose`, `hardest tasks`, `how explorer`, `how explainer`, `why investigators`, `why synthesizer`, `reflect tooling`, `reflect judgment, divergent, synthesizer`, `swarm workers`
+- Panel roles: `arena runners`, `arena cross-judge pool`, `architect runners`, `interrogate reviewers`
### 5. Write the model rule
@@ -83,29 +83,29 @@ Write to `.agents/plugins/agystack/agystack-models.md` if installed workspace-lo
```
# agystack model configuration. One line per role. Delete a line to fall back to the skill default.
-# Antigravity model tiers for invoke_subagent:
+# Antigravity invoke_subagent model tiers:
+# - inherit (Runs on the active parent chat session model, e.g. Gemini 3.8 Flash High)
# - pro (High-capability tier: deep reasoning, large refactors, complex design)
-# - flash (Balanced fast tier: exploration, reading, standard code generation)
-# - flash_lite (Lightweight tier: fast mechanical lookups)
-# - inherit (Runs on the active parent chat session model)
-
-feature, refactoring: pro
-bug-fix: pro
-perf-issue: pro
-hillclimb: pro
-judgment and prose: pro
-hardest tasks: pro
+# - flash (Fast / balanced reasoning tier: exploration, reading, standard generation)
+# - flash_lite (Lightweight tier: fast mechanical scans and lookups)
+
+feature, refactoring: inherit
+bug-fix: inherit
+perf-issue: inherit
+hillclimb: inherit
+judgment and prose: inherit
+hardest tasks: inherit
how explorer: flash
-how explainer: pro
+how explainer: inherit
why investigators: flash
-why synthesizer: pro
-reflect tooling: pro
-reflect judgment, divergent, synthesizer: pro
-arena runners: pro, flash, inherit
-arena cross-judge pool: pro, flash, inherit
+why synthesizer: inherit
+reflect tooling: inherit
+reflect judgment, divergent, synthesizer: inherit
+arena runners: inherit, flash, pro
+arena cross-judge pool: inherit, flash, pro
swarm workers: flash
-architect runners: pro, flash, inherit
-interrogate reviewers: pro, flash, inherit
+architect runners: inherit, flash, pro
+interrogate reviewers: inherit, flash, pro
```
### 6. Confirm
@@ -114,4 +114,4 @@ Confirm that the model rule and runtime settings are active for new sessions.
### 7. Offer a verification skill (optional)
-If the project lacks an end-to-end verification harness, offer `/create-verification-skill`.
+If the project lacks an end-to-end verification harness, offer `/create-verification-skill`. For high-consequence concurrency, consensus, complex state machines, or critical parsers, also offer `/create-formal-verification-skill`.
diff --git a/tests/test_antigravity_invariants.py b/tests/test_antigravity_invariants.py
new file mode 100644
index 0000000..57f961d
--- /dev/null
+++ b/tests/test_antigravity_invariants.py
@@ -0,0 +1,296 @@
+import re
+import sys
+import tempfile
+import unittest
+from pathlib import Path
+
+REPO_ROOT = Path(__file__).resolve().parent.parent
+SKILLS_DIR = REPO_ROOT / "skills"
+sys.path.insert(0, str(SKILLS_DIR / "setup-agystack" / "scripts"))
+import setup_runtime
+
+EXPECTED_MODEL_TIERS: dict[str, list[str]] = {
+ "feature, refactoring": ["inherit"],
+ "bug-fix": ["inherit"],
+ "perf-issue": ["inherit"],
+ "hillclimb": ["inherit"],
+ "judgment and prose": ["inherit"],
+ "hardest tasks": ["inherit"],
+ "how explorer": ["flash"],
+ "how explainer": ["inherit"],
+ "why investigators": ["flash"],
+ "why synthesizer": ["inherit"],
+ "reflect tooling": ["inherit"],
+ "reflect judgment, divergent, synthesizer": ["inherit"],
+ "arena runners": ["inherit", "flash", "pro"],
+ "arena cross-judge pool": ["inherit", "flash", "pro"],
+ "swarm workers": ["flash"],
+ "architect runners": ["inherit", "flash", "pro"],
+ "interrogate reviewers": ["inherit", "flash", "pro"],
+}
+
+BANNED_CURSOR_RE = re.compile(
+ r"\.cursor/rules"
+ r"|pstack-models\.mdc"
+ r"|cursor-team-kit"
+ r"|api2\.cursor\.sh"
+ r"|SendToUser"
+ r"|SendSlackMessage"
+ r"|update_state"
+ r"|claude-opus-5-5"
+ r"|-xhigh-fast"
+ r"|\bStrReplace\b"
+ r"|\bReadLints\b"
+ r"|\bTodoWrite\b"
+ r"|\bSemanticSearch\b"
+)
+DOT_CURSOR_RE = re.compile(r"\.cursor")
+NEGATIVE_CURSOR_GLOB_RE = re.compile(r"(?:Do not|Don't) glob(?:\s+across)?\s+`?~/\.cursor/projects/\*/`?")
+LEGACY_TOOL_ARG_RE = re.compile(r"\b(?:AskQuestion|subagent_type|generalPurpose|run_in_background)\b|readonly:\s*(?:true|false)")
+
+
+def _read_repo_file(rel_path: str) -> str:
+ path = REPO_ROOT / rel_path
+ assert path.is_file(), f"Required file missing: {rel_path}"
+ return path.read_text(encoding="utf-8")
+
+
+def _parse_model_lines(text: str) -> dict[str, list[str]]:
+ roles: dict[str, list[str]] = {}
+ for raw_line in text.splitlines():
+ line = raw_line.strip()
+ if not line or line.startswith("#") or ":" not in line:
+ continue
+ role, tiers_raw = line.split(":", 1)
+ role_key = role.strip()
+ assert role_key not in roles, f"Duplicate role key {role_key!r} in model config"
+ roles[role_key] = [tier.strip() for tier in tiers_raw.split(",") if tier.strip()]
+ return roles
+
+
+def _is_excluded_skill_doc(rel_path: Path) -> bool:
+ parts = rel_path.parts
+ if "node_modules" in parts:
+ return True
+ return any(parts[idx : idx + 2] == ("scripts", "test") for idx in range(len(parts) - 1))
+
+
+def _is_allowed_legacy_mapping_row(rel_posix: str, line: str) -> bool:
+ if rel_posix != "poteto-mode/references/antigravity-tools.md":
+ return False
+ stripped = line.strip()
+ if not stripped.startswith("|"):
+ return False
+ return any(
+ token in stripped
+ for token in ("`TypeName:", "`ask_question`", "Default. Antigravity subagents")
+ )
+
+
+def find_cursor_leakage(root_dir: Path) -> list[str]:
+ violations: list[str] = []
+ for md_path in sorted(root_dir.rglob("*.md")):
+ rel_path = md_path.relative_to(root_dir)
+ if _is_excluded_skill_doc(rel_path):
+ continue
+ rel_posix = rel_path.as_posix()
+ for lineno, line in enumerate(md_path.read_text(encoding="utf-8").splitlines(), 1):
+ banned_match = BANNED_CURSOR_RE.search(line)
+ if banned_match:
+ violations.append(f"{rel_posix}:{lineno}: banned token {banned_match.group(0)!r}")
+ continue
+ sanitized_line = NEGATIVE_CURSOR_GLOB_RE.sub("", line)
+ if DOT_CURSOR_RE.search(sanitized_line):
+ violations.append(f"{rel_posix}:{lineno}: unguarded '.cursor' reference")
+ continue
+ legacy_match = LEGACY_TOOL_ARG_RE.search(line)
+ if legacy_match and not _is_allowed_legacy_mapping_row(rel_posix, line):
+ violations.append(f"{rel_posix}:{lineno}: banned legacy Cursor token {legacy_match.group(0)!r}")
+ return violations
+
+
+class TestAntigravityInvariants(unittest.TestCase):
+ def test_brain_artifact_deliverables(self):
+ for rel_path in (
+ "skills/poteto-mode/SKILL.md",
+ "skills/poteto-mode/references/antigravity-tools.md",
+ ):
+ content = _read_repo_file(rel_path)
+ for token in (
+ "/brain//",
+ "implementation_plan.md",
+ "walkthrough.md",
+ "decisions.tsv",
+ "scratch/",
+ ):
+ self.assertIn(token, content, f"{rel_path} missing brain artifact token {token!r}")
+
+ agents_md = _read_repo_file("rules/AGENTS.md")
+ for token in (
+ "implementation_plan.md",
+ "walkthrough.md",
+ "decision_trail.md",
+ "scratch/",
+ ):
+ self.assertIn(token, agents_md, f"rules/AGENTS.md missing deliverable token {token!r}")
+
+ def test_three_tier_parallel_routing(self):
+ self.assertFalse(
+ (SKILLS_DIR / "swarm").exists(),
+ "skills/swarm must stay absent so Antigravity native /swarm is unshadowed",
+ )
+ tools_ref = _read_repo_file("skills/poteto-mode/references/antigravity-tools.md")
+ for token in ("Local fan-out", "invoke_subagent", "8 or fewer", "/swarm", "/cloud-swarm", "Cloud Run"):
+ self.assertIn(token, tools_ref, f"antigravity-tools.md missing routing token {token!r}")
+
+ cloud_swarm = _read_repo_file("skills/cloud-swarm/SKILL.md")
+ for token in ("invoke_subagent", "8 or fewer", "/swarm", "more than 8", "Cloud Run"):
+ self.assertIn(
+ token.lower(),
+ cloud_swarm.lower(),
+ f"cloud-swarm/SKILL.md missing routing token {token!r}",
+ )
+
+ def test_send_message_iterative_worker_loops(self):
+ poteto_skill = _read_repo_file("skills/poteto-mode/SKILL.md")
+ self.assertIn("send_message", poteto_skill)
+ self.assertIn("iterate with an active worker", poteto_skill)
+
+ tools_ref = _read_repo_file("skills/poteto-mode/references/antigravity-tools.md")
+ self.assertIn("send_message", tools_ref)
+ self.assertIn("Iterative Worker Loops", tools_ref)
+
+ def test_browser_subagent_and_surface_precedence_hierarchy(self):
+ for rel_path in ("rules/AGENTS.md", "skills/poteto-mode/references/antigravity-tools.md"):
+ content = _read_repo_file(rel_path)
+ self.assertIn("Surface Precedence Hierarchy", content, f"{rel_path} missing Surface Precedence Hierarchy")
+ self.assertIn("browser_subagent", content, f"{rel_path} missing browser_subagent")
+
+ verify_skill = _read_repo_file("skills/create-verification-skill/SKILL.md")
+ self.assertIn("browser_subagent", verify_skill)
+
+ def test_permissioned_github_recovery(self):
+ tools_ref = _read_repo_file("skills/poteto-mode/references/antigravity-tools.md")
+ for token in (
+ "permissioned-github",
+ "Recovery Invariant",
+ "126/127",
+ "Never apologize or retry the identical command in a loop",
+ "git.read",
+ "gh.read",
+ "git.update",
+ "gh.create",
+ ):
+ self.assertIn(token, tools_ref, f"antigravity-tools.md missing permissioned-github token {token!r}")
+
+ def test_orchestrate_playbook_present(self):
+ orchestrate_path = SKILLS_DIR / "poteto-mode" / "playbooks" / "orchestrate.md"
+ self.assertTrue(orchestrate_path.is_file(), "skills/poteto-mode/playbooks/orchestrate.md missing")
+ self.assertTrue(orchestrate_path.read_text(encoding="utf-8").strip())
+ self.assertIn("playbooks/orchestrate.md", _read_repo_file("skills/poteto-mode/SKILL.md"))
+
+ def test_active_role_keys_defined_and_consumed(self):
+ models_path = REPO_ROOT / "agystack-models.md"
+ root_models = _parse_model_lines(models_path.read_text(encoding="utf-8"))
+ self.assertEqual(root_models, EXPECTED_MODEL_TIERS)
+
+ parsed = setup_runtime.parse_model_config(config_path=str(models_path))
+ self.assertTrue(parsed["ok"], f"setup_runtime.parse_model_config failed: {parsed.get('error')}")
+ for role_key, expected_tiers in EXPECTED_MODEL_TIERS.items():
+ self.assertEqual(parsed["roles"].get(role_key), expected_tiers)
+
+ setup_skill = _read_repo_file("skills/setup-agystack/SKILL.md")
+ step4_match = re.search(
+ r"### 4\. Map and confirm(.*?)### 5\. Write the model rule",
+ setup_skill,
+ re.DOTALL,
+ )
+ self.assertIsNotNone(step4_match, "setup-agystack/SKILL.md missing Step 4 section")
+ step4_roles = re.findall(r"`([^`]+)`", step4_match.group(1))
+ self.assertEqual(len(step4_roles), len(set(step4_roles)), "Duplicate role in setup-agystack Step 4")
+ self.assertEqual(set(step4_roles), set(EXPECTED_MODEL_TIERS))
+
+ step5_match = re.search(
+ r"### 5\. Write the model rule.*?```[^\n]*\n(.*?)```",
+ setup_skill,
+ re.DOTALL,
+ )
+ self.assertIsNotNone(step5_match, "setup-agystack/SKILL.md missing Step 5 config code block")
+ setup_models = _parse_model_lines(step5_match.group(1))
+ self.assertEqual(setup_models, EXPECTED_MODEL_TIERS)
+
+ how_skill = _read_repo_file("skills/how/SKILL.md")
+ self.assertRegex(how_skill, r"how[- ]explorer")
+ self.assertRegex(how_skill, r"how[- ]explainer")
+
+ why_skill = _read_repo_file("skills/why/SKILL.md")
+ self.assertRegex(why_skill, r"why[- ]investigators")
+ self.assertRegex(why_skill, r"why[- ]synthesizer")
+
+ self.assertIn("architect runners", _read_repo_file("skills/architect/SKILL.md"))
+ self.assertIn("interrogate reviewers", _read_repo_file("skills/interrogate/SKILL.md"))
+ self.assertIn("arena runners", _read_repo_file("skills/arena/SKILL.md"))
+ self.assertIn("swarm workers", _read_repo_file("skills/cloud-swarm/SKILL.md"))
+ self.assertIn("swarm workers", _read_repo_file("skills/poteto-mode/references/antigravity-tools.md"))
+ reflect_skill = _read_repo_file("skills/reflect/SKILL.md")
+ self.assertRegex(reflect_skill, r"reflect[- ]tooling")
+ self.assertRegex(reflect_skill, r"reflect[- ]judgment")
+
+ def test_zero_cursor_leakage_across_skills(self):
+ for target_dir in (SKILLS_DIR, REPO_ROOT / "rules", REPO_ROOT / "agents"):
+ violations = find_cursor_leakage(target_dir)
+ self.assertEqual(violations, [], f"Cursor leakage found in {target_dir.name}/: {violations}")
+
+ def test_cursor_leakage_scanner_catches_injected_files_and_honors_allowances(self):
+ with tempfile.TemporaryDirectory() as tmp_dir:
+ tmp_skills = Path(tmp_dir) / "skills"
+ (tmp_skills / "bad-skill").mkdir(parents=True)
+ (tmp_skills / "bad-skill" / "SKILL.md").write_text(
+ "Load `.cursor/rules/pstack-models.mdc` before editing.\n",
+ encoding="utf-8",
+ )
+ (tmp_skills / "bad-ask").mkdir(parents=True)
+ (tmp_skills / "bad-ask" / "SKILL.md").write_text(
+ "Call `AskQuestion` when stuck.\n",
+ encoding="utf-8",
+ )
+ (tmp_skills / "bad-bypass").mkdir(parents=True)
+ (tmp_skills / "bad-bypass" / "SKILL.md").write_text(
+ "Do not glob ~/.cursor/projects/*/; read ~/.cursor/skills/pstack.md\n"
+ "Spawn subagent_type: generalPurpose with run_in_background: true\n"
+ "Check .cursorrules too.\n",
+ encoding="utf-8",
+ )
+ (tmp_skills / "recall").mkdir(parents=True)
+ (tmp_skills / "recall" / "SKILL.md").write_text(
+ "Do not glob `~/.cursor/projects/*/`.\n",
+ encoding="utf-8",
+ )
+ (tmp_skills / "poteto-mode" / "references").mkdir(parents=True)
+ (tmp_skills / "poteto-mode" / "references" / "antigravity-tools.md").write_text(
+ "| `AskQuestion` | `ask_question` tool for interactive questions |\n"
+ "| `subagent_type: generalPurpose` | `TypeName: \"self\"` |\n",
+ encoding="utf-8",
+ )
+ (tmp_skills / "pkg" / "node_modules" / "dep").mkdir(parents=True)
+ (tmp_skills / "pkg" / "node_modules" / "dep" / "README.md").write_text(
+ ".cursor/rules/pstack-models.mdc\n",
+ encoding="utf-8",
+ )
+ (tmp_skills / "pkg" / "scripts" / "test").mkdir(parents=True)
+ (tmp_skills / "pkg" / "scripts" / "test" / "fixture.md").write_text(
+ "SendToUser\n",
+ encoding="utf-8",
+ )
+
+ violations = find_cursor_leakage(tmp_skills)
+ self.assertEqual(len(violations), 5, f"Unexpected violations: {violations}")
+ self.assertTrue(any("bad-skill/SKILL.md:1" in v for v in violations))
+ self.assertTrue(any("bad-ask/SKILL.md:1" in v for v in violations))
+ self.assertTrue(any("bad-bypass/SKILL.md:1" in v for v in violations))
+ self.assertTrue(any("bad-bypass/SKILL.md:2" in v for v in violations))
+ self.assertTrue(any("bad-bypass/SKILL.md:3" in v for v in violations))
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/tests/test_skill_catalog.py b/tests/test_skill_catalog.py
index 0ba2b7f..6599d0c 100644
--- a/tests/test_skill_catalog.py
+++ b/tests/test_skill_catalog.py
@@ -103,3 +103,75 @@ def test_no_swarm_skill_collision():
skill_name = name_match.group(1).strip().strip("'\"")
assert skill_name != "swarm", f"{skill_file} declares 'name: swarm' and shadows Antigravity's built-in swarm skill"
+
+def _extract_readme_details_section(summary: str) -> str:
+ readme = (REPO_ROOT / "README.md").read_text(encoding="utf-8")
+ match = re.search(rf"{re.escape(summary)}
(.*?) ", readme, re.DOTALL)
+ assert match is not None, f"README.md missing '{summary}' section"
+ return match.group(1)
+
+
+def test_readme_indexes_all_non_principle_skills():
+ all_skills_section = _extract_readme_details_section("all skills")
+ skills_dir = REPO_ROOT / "skills"
+ non_principle_skills = [
+ skill_file
+ for skill_file in sorted(skills_dir.glob("*/SKILL.md"))
+ if not skill_file.parent.name.startswith("principle-")
+ ]
+ assert non_principle_skills, "No non-principle skills found in skills/"
+
+ missing = []
+ for skill_file in non_principle_skills:
+ slug = skill_file.parent.name
+ row_pattern = rf"^\|\s*\[`/{re.escape(slug)}`\]\((?:\./)?skills/{re.escape(slug)}/SKILL\.md\)\s*\|"
+ if not re.search(row_pattern, all_skills_section, re.MULTILINE):
+ missing.append(slug)
+
+ assert not missing, f"README.md 'all skills' table missing skills: {missing}"
+
+
+def test_readme_has_no_ghost_skills():
+ all_skills_section = _extract_readme_details_section("all skills")
+ table_rows = [
+ line
+ for line in all_skills_section.splitlines()
+ if line.startswith("|") and not line.startswith("| skill |") and not line.startswith("|---")
+ ]
+ assert table_rows, "README.md 'all skills' table has no skill rows"
+
+ seen_slugs: set[str] = set()
+ ghosts: list[str] = []
+ broken_links: list[str] = []
+ duplicates: list[str] = []
+
+ for row in table_rows:
+ cells = row.split("|")
+ assert len(cells) >= 3, f"Malformed skill table row in README.md: {row!r}"
+ first_cell = cells[1]
+ slugs = re.findall(r"`/([a-z0-9-]+)`", first_cell)
+ assert slugs, f"README.md skill row missing `/` entry: {row!r}"
+ link_targets = re.findall(r"\((?:\./)?skills/([a-z0-9-]+)/SKILL\.md\)", first_cell)
+ if not link_targets or link_targets != slugs:
+ broken_links.append(f"{row.strip()} -> {link_targets}")
+ for slug in slugs:
+ if slug in seen_slugs:
+ duplicates.append(slug)
+ seen_slugs.add(slug)
+ if not (REPO_ROOT / "skills" / slug / "SKILL.md").is_file():
+ ghosts.append(slug)
+
+ examples_section = _extract_readme_details_section("all the examples")
+ example_slugs = re.findall(r"(?:^|\s)/([a-z0-9-]+)(?=\s|$)", examples_section, re.MULTILINE)
+ ghost_examples = sorted({slug for slug in example_slugs if not (REPO_ROOT / "skills" / slug / "SKILL.md").is_file()})
+
+ playbooks_section = _extract_readme_details_section("the 23 playbooks")
+ readme_playbooks = set(re.findall(r"\(\./skills/poteto-mode/playbooks/([^)]+)\)", playbooks_section))
+ disk_playbooks = {p.name for p in (REPO_ROOT / "skills" / "poteto-mode" / "playbooks").glob("*.md")}
+ playbook_drift = sorted(readme_playbooks ^ disk_playbooks)
+
+ assert not ghosts, f"README.md 'all skills' table lists non-existent skills: {ghosts}"
+ assert not broken_links, f"README.md 'all skills' table has invalid links: {broken_links}"
+ assert not duplicates, f"README.md 'all skills' table has duplicate skills: {duplicates}"
+ assert not ghost_examples, f"README.md 'all the examples' references non-existent skills: {ghost_examples}"
+ assert not playbook_drift, f"README.md 'the 23 playbooks' out of sync with disk: {playbook_drift}"