fix: v3.0.8 - SKILL.md was too big and LAWs too deep - move to top + engine emits badge (#279)

Three independent Opus 4.7 self-debugs on 2026-04-18 converged on the same
root cause of the v3.0.6/v3.0.7 canonical-compliance regression: SKILL.md is
42,860 tokens / 1,478 lines, LAWs lived at line 1094+, every realistic reading
strategy failed to reach them before synthesis.

Unit 1 - Moved the BADGE MANDATORY block and VOICE CONTRACT LAW 1-5 (plus
the formatting-authority preface) from line ~1090 to line ~75 (right after
the SKILL CONTRACT preface, before HOW TO INVOKE THIS SKILL). Every reading
strategy now lands the LAWs in active context before synthesis.

Unit 2 - Engine now emits the badge as the first line of --emit=compact
stdout. Passing through the script output becomes the default-correct
behavior; emitting the badge no longer depends on model compliance. Reads
version from .claude-plugin/plugin.json at runtime with graceful fallback.

Unit 3 - Deleted skills/last30days/SKILL.md stub (231-line v3-spec file).
This was the wrong-file-capture hazard Ron Conway's self-debug identified:
model grabbed the first SKILL.md find surfaced and treated it as
authoritative. Only ONE SKILL.md in the plugin package now.

Diagnoses verbatim:
- Kanye thread: "I read lines 1-600 in chunks, jumped to 300-899, then
  stopped. File is 1478 lines. I never saw past ~900."
- Peter thread: "I tried Read once, hit the 25K token cap on a 42,860-token
  file, and bailed instead of chunked-reading with offset/limit. I never
  opened SKILL.md at all."
- Ron Conway thread: "I read one SKILL.md (231 lines)... the v3 spec stub.
  I never opened the operational SKILL.md sitting next to the script."

Validation: direct engine invocation confirms badge at line 1 of compact
output. Module imports clean.

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Matt Van Horn
2026-04-18 12:50:10 -07:00
committed by GitHub
parent 58845df312
commit 361e9d6c13
5 changed files with 92 additions and 287 deletions
+39
View File
@@ -2,11 +2,49 @@
from __future__ import annotations
import json
import pathlib
from collections import Counter
from datetime import date
from urllib.parse import urlparse
from . import dates, schema
def _skill_version() -> str:
"""Read plugin version from .claude-plugin/plugin.json if available.
Tries nearest plugin.json by walking up from render.py's own location.
Falls back to "?" if not found. This keeps the badge emission from
crashing on non-plugin-cache installs (repo checkout, Gemini, Codex).
"""
here = pathlib.Path(__file__).resolve()
for parent in [here.parent, *here.parents]:
candidate = parent / ".claude-plugin" / "plugin.json"
if candidate.is_file():
try:
return json.loads(candidate.read_text()).get("version", "?")
except (json.JSONDecodeError, OSError):
return "?"
return "?"
def _render_badge() -> list[str]:
"""Emit the MANDATORY first-line badge per SKILL.md OUTPUT CONTRACT.
Added in v3.0.8 after three Opus 4.7 self-debugs (2026-04-18) confirmed
the model was failing to emit the badge manually because SKILL.md was
too big to reach the BADGE MANDATORY block before synthesis. Engine
emission makes passing-through-the-script-output the default-correct
behavior; emitting the badge no longer depends on model compliance.
"""
version = _skill_version()
today = date.today().strftime("%Y-%m-%d")
return [
f"🌐 last30days v{version} · synced {today}",
"",
]
SOURCE_LABELS = {
"grounding": "Web",
"hackernews": "Hacker News",
@@ -40,6 +78,7 @@ def _assistant_safety_lines() -> list[str]:
def render_compact(report: schema.Report, cluster_limit: int = 8, fun_level: str = "medium", save_path: str | None = None) -> str:
non_empty = [s for s, items in sorted(report.items_by_source.items()) if items]
lines = [
*_render_badge(),
f"# last30days v3.0.0: {report.topic}",
"",
*_assistant_safety_lines(),