Commit Graph
58 Commits
Author SHA1 Message Date
b6aab36ef6 Sync workflow: cover every generated provider path (#725)
The sync's GENERATED_PATHS list was missing .agent, .codex, .veto,
.github/agents and .github/hooks, so the run after #714 regenerated the
other provider directories but left those carrying the Node-era hook
manifests and scripts, and main's CI failed on the hook-manifest and
provider-hook tests. The list now matches what bun run build:release
writes, and this commit carries the regenerated output for the missing
paths so main is consistent as soon as it lands.


Claude-Session: https://claude.ai/code/session_01Vau2X53xGTjjTCXWMVBoNY

Co-authored-by: Claude Code <noreply@anthropic.com>
2026-09-04 11:40:11 -07:00
Rex LorenzoandGitHub 14d2641685 Fix: keep the node runtime probe clear of cmd.exe metacharacters (#458)
Volta's Windows shims exec through `cmd /C`, which re-parses the argument
list, so the `>=` inside the probe's `node -e` payload was read as output
redirection. The command died with "The filename, directory name, or volume
label syntax is incorrect" before node started, the guard read that as a
missing runtime, and the hook it exists to protect was disabled on every
PostToolUse and Stop. A user on a supported Node 24 got a one-time notice
telling them to install Node 22, then silence.

Clamping with Math.min is the same floor test in the same ES5-only syntax,
with no character cmd.exe can claim. Verified through the Volta shim on Node
24.16.0 and 22.18.0 (exit 0) and against a real Node 20.6.1 binary (exit 1),
so the floor is unchanged. Adds a regression test asserting no `<`, `>`, or
newline reaches any generated `node -e` payload.

Upstream cause: volta-cli/volta#1791.

Prepared with AI assistance (Claude Code).
2026-08-03 15:02:29 -07:00
fd9076f4f0 Enforce the engines floor in the probe instead of a capability check
The probe asked whether node could load ESM, while the notice promised a
Node 22 floor and package.json engines declares >=22.12.0. Reviewers kept
flagging the gap, and they were right to: a 14.18-to-21 runtime passed the
probe on the strength of one import while the hook and its detector bundle
are only ever exercised on the engines floor, so "can load our code" was a
weaker claim than the one being made for it.

Check the floor directly: parseInt(process.versions.node) >= 22, in
ES5-only syntax that parses on any node old enough to fail it. Probe and
notice now derive from one NODE_MAJOR_FLOOR constant, so they cannot
disagree, and the archaeology about node: scheme support and pre-15
unhandled-rejection semantics goes with the import it explained.

Add the missing contract test: every generated hook command carries the
probe, the notice appears exactly where a harness can render it (Claude
and Codex, project and plugin), and the expected floor is read from
package.json engines rather than repeated by hand.

Verified against a fake pre-22 node, no node, and a real node: one notice
then the marker holds it silent, exit 0 in every failure shape, and the
hook's own exit code still passes through on a supported runtime.

Co-Authored-By: Claude Fable 5 (via Cursor) <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-26 22:17:19 +05:00
Abdul WahabandClaude Opus 5 86cdf528c5 Probe the import the hook actually uses, and fail closed on rejection
Greptile flagged that the probe does not enforce the Node 22 engines floor.
Two parts to that, and they land differently.

The real defect is narrower and worse than stated: the hook closure imports
`node:fs`, `node:os`, `node:path` and `node:url`, and the `node:` scheme needs
14.18, so a bare `import('fs')` probe passed on 12 and 13 and those runtimes
then died on the real import, which is the banner this branch exists to remove.
Probing `node:fs` closes that. The added `.catch(()=>process.exit(1))` is load
bearing rather than tidiness: before Node 15 an unhandled rejection is only a
warning and the process still exits 0, so a rejected probe would have read as a
pass on exactly the versions in question.

Not enforcing 22 is deliberate and stays. The probe asks whether this runtime
can load our code, not whether it is a supported one, so a 14.18-to-21 runtime
that works today keeps working rather than being silently switched off. The
notice names 22 because that is the version worth installing, and it only ever
reaches someone whose runtime already failed the probe, so no user is shown a
threshold that contradicts what ran.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-26 21:20:26 +05:00
Abdul WahabandClaude Opus 5 4f999ceff8 Give Codex the notice too; its hook reference documents systemMessage
Commit 8397d532 took a reviewer's word that Codex expects hookSpecificOutput
and dropped its notice on that basis. Codex documents `systemMessage` for
PostToolUse and Stop as text shown as a warning in the UI or event stream,
the same field Claude Code reads, so the notice belongs there and the earlier
comment asserted something unverified.

Checked the rest against their own references while here. Cursor's preToolUse
output is permission-shaped and its user_message renders only when the action
is DENIED, so warning would mean blocking the edit. Grok treats PostToolUse
and Stop as passive events and ignores stdout outright. Copilot's contract is
unconfirmed. Those three keep the probe alone, which is a verified limit now
rather than an assumption.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-26 21:10:41 +05:00
Abdul WahabandClaude Opus 5 8397d532b9 Keep the unsupported-node notice to the harness that can render it
`systemMessage` on stdout is a Claude Code contract. The shared guard was
emitting it for Codex and Cursor too, where what a harness does with stdout
it did not ask for is unconfirmed, and a Cursor preToolUse hook printing an
unexpected JSON object is the wrong thing to guess about.

Pass the notice in per harness instead of baking it into the guard. Claude
manifests opt in; Codex and Cursor take the runtime probe alone, so an
unsupported runtime stays as quiet there as it was before the probe existed.
Giving them their own shape later is one more argument at the call site.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-26 13:37:09 +05:00
Abdul WahabandClaude Opus 5 0db59088ff Stop the design hook erroring on a node too old for ESM
The hook command invokes bare `node`. When that node predates ESM,
`hook.mjs` dies while it is still being parsed, before the script's own
always-exit-0 contract can run, so node exits 1 and the harness reports a
hook error on every Stop and every edit.

Probe the runtime in the command string before invoking the hook, and
route the Claude plugin manifest through the guard that already covered
the project-local manifests. On probe failure the command exits 0 and
emits a one-time `systemMessage` naming the two fixes available to the
user, since nothing written in ESM can report this condition.

Fixes #410.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-26 12:46:11 +05:00
Paul BakausandClaude Fable 5 bcf354cd0c Fix Codex hook path so .codex-directory installs run the detector
The committed .codex/hooks.json hardcoded .agents/skills/impeccable/scripts/
hook.mjs. On a .codex-directory install the skill payload lives at .codex/
skills/..., so the guarded command ([ ! -f X ] || node X) found no file and
silently no-opped, leaving the design detector dead for those users.

Derive the hook payload path from the emitting provider's own configDir rather
than hardcoding .agents:

- buildCodexHooksManifest(skillDir) now builds `${skillDir}/skills/impeccable/
  scripts/hook.mjs`; hooksJsonFor threads each provider's configDir through. The
  Codex provider (configDir .codex) emits .codex/skills; the root sync and the
  self-consistent dist/codex bundle both point at their own payload.
- CLI installer: project-scope hook rewriting now derives the provider's own
  project-relative path instead of preserving the bundle token. The Codex bundle
  ships a .codex/skills command, but the CLI lays the skill at .agents/skills, so
  the installed .codex/hooks.json is rewritten to .agents/skills (Claude keeps
  its ${CLAUDE_PROJECT_DIR} token; global installs keep the absolute rewrite).

Per-provider hook payload path after the fix:

  Emission                              hook path
  dist/codex/.codex/hooks.json          .codex/skills/impeccable/scripts/hook.mjs
  root .codex/hooks.json (build sync)   .codex/skills/impeccable/scripts/hook.mjs
  CLI .agents (codex) project install   .agents/skills/impeccable/scripts/hook.mjs
  CLI .agents (codex) global install    <home>/.agents/skills/.../hook.mjs (abs)
  .claude / .cursor                     unchanged

Tests: extended hook-build (codex-dir -> .codex/skills, agents-dir -> .agents/
skills) and skills-cli (bundle ships .codex/skills, install rewrites to .agents/
skills). Regenerated tracked .codex/hooks.json via build:release.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-24 17:09:33 -07:00
Paul BakausandClaude Fable 5 eda81f0937 Release prep: skill v4.0.1
Bump plugin + marketplace to 4.0.1 and sync the regenerated provider
output: the guarded hook commands from issue #399 (a missing hook file
exits 0 instead of crashing every turn of a user-level install), the
canon standing exit, the visualize flow, the two shipped subagents, and
the interactive-spine fixes from today's live testing. Detector count
validates at 59 with undersized-ui-text.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-22 12:23:07 -07:00
Paul BakausandClaude Fable 5 c3aba1e343 hooks: two-tier design hook — immediate per-edit rules + full-set Stop deep pass
Eval evidence showed the per-edit PostToolUse stream fires overwhelmingly
on copy-level rules (em-dash-overuse ~97x/session) and measurably makes
models more conservative, while a full-detector pass at completion is what
actually fixes contrast/padding/glow. Split the hook accordingly:

- Per-edit (PostToolUse) now surfaces only IMMEDIATE_TIER_RULES: broken
  output (broken-image, text-overflow, clipped-overflow-container,
  body-text-viewport-edge), objective contrast/legibility failures
  (low-contrast, gray-on-color, tiny-text), single-property mechanical
  slop (gradient-text, dark-glow), and design-system drift (the four
  design-system-* rules, which compound if left uncorrected). Everything
  else defers. Override with hook.perEditRules: "all" in
  .impeccable/config.json. Tiering is off for Cursor/Copilot harnesses,
  which have no Stop pass wired, so nothing gets silently dropped there.

- Stop deep pass (runStopHook): runs the FULL rule set over every UI file
  touched this session (tracked via the existing hook.cache.json session
  state; deferred-only edits now mark the file touched), dedupes against
  everything already surfaced per-edit, honors ignore-rule/file/value and
  inline disables, reuses the [impeccable@1] envelope, and no-ops fast
  when no UI files were touched. Emits hookSpecificOutput
  { hookEventName: "Stop", additionalContext } per the Claude Code SDK
  Stop contract (conversation continues so the model can act on it).
  Second Stop fire is silent - deep-pass findings are remembered.

- Wiring: Stop entries (timeout 30) in plugin/hooks/hooks.json, the
  .claude settings + .codex hooks manifests (transformers + hook-admin
  repair path). Claude Code and Codex both dispatch a native Stop event;
  Cursor's stop hook is inconsistently dispatched (pre-write gate stays)
  and Copilot's agentStop/sessionEnd don't inject model context, so
  neither gets a Stop entry - documented in reference/hooks.md.

- Tests: tiering split/override/harness gating, Stop dedupe + silent
  no-touched-files + ignore machinery + kill switches; existing per-edit
  tests moved to immediate-tier rule ids. 181 tests green; smoke-tested
  the built dist skill end to end (glow surfaced per-edit, em-dash only
  at Stop, second Stop silent).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 16:46:00 -07:00
Paul Bakaus 1a3f5d78bd Fix Codex hook manifest schema 2026-06-30 23:56:06 -07:00
9c0012d4e1 feat(hooks): package design hook in plugin, install to settings.local.json (#243)
* feat(hooks): package design hook in plugin, install to settings.local.json

Three related changes to how the Impeccable design hook is distributed,
plus an unrelated build fix discovered along the way.

Package the hook in the Claude Code plugin
- The marketplace / `/plugin install` path previously shipped the skill and
  agents but no hook, so those users never got the design detector. The build
  now emits `plugin/hooks/hooks.json` (auto-discovered at the plugin root),
  resolving the script via `${CLAUDE_PLUGIN_ROOT}` so it works wherever Claude
  Code unpacks the plugin instead of assuming a `.claude/skills/` layout.

CLI installs the hook into settings.local.json, not shared settings.json
- `npx impeccable skills install/update` now writes the Claude hook to the
  gitignored `.claude/settings.local.json` (a machine-local install side
  effect) rather than the team-shared `settings.json`, which could otherwise
  be committed and break for teammates without the skill installed.
- Graceful handling (leave-it-never-duplicate): if our hook already lives in
  the shared `settings.json` (a legacy install or a deliberate user move), it
  is honored in place and never duplicated into the local override, which
  would otherwise run the detector twice per edit.
- The skill's `/impeccable hooks on|off` toggle is unaffected: it only writes
  `.impeccable/hook.json`, never the settings files.

Fix universal.zip build failure under archiver v8
- `archiver` was bumped to v8 (now ESM, factory function removed) but
  `scripts/lib/zip.js` still used the old `archiver('zip', ...)` API, so every
  build silently failed to produce `dist/universal.zip` (the skill-release
  artifact). Switched to `new ZipArchive({...})`.

Also folds in a pre-existing local rename of the hook status message
("Scanning design" -> "Checking UI changes") and its regenerated provider
output.

Tests: new coverage for the plugin-packaged hook manifest and the
shared-settings honor-in-place path; existing CLI assertions moved to
settings.local.json. Full suite green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(cli): detect hook by marker, not file existence (Bugbot)

hookInstalledForProvider treated any existing settings.local.json (or
hooks.json) as proof the hook was installed. Those files commonly hold
unrelated local settings, so the already-installed `skills install` path
would skip repairing a genuinely missing hook that `update` would add.

Detect the Impeccable marker in the file instead of mere existence. Adds a
test for the exact case: a settings.local.json with only permissions still
triggers hook repair and preserves the unrelated content.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* test(build): fail loud on a broken release zip + cover the zip writer

Close the gap that let the archiver v8 break ship a 0-byte universal.zip
with a green test suite:

- createProviderZip no longer swallows failures. It throws on a missing
  source, an archive with zero entries, or a 0-byte output, and build() now
  exits non-zero on any such rejection. A build that can't produce its release
  artifact fails instead of deploying an empty bundle.
- New tests/zip.test.mjs exercises the real zip writer and round-trips through
  extract-zip (the unpacker the CLI uses): a valid bundle unpacks to the skill
  tree, and the empty/missing-source cases throw. Wired into the core suite so
  it runs in `bun run test`.

Why this matters: the prior CLI e2e tests stub the bundle as a local
directory, so they never built, downloaded, or unzipped a real archive. The
zip writer had no coverage and failed soft, so Dependabot's archiver 7->8
major bump merged green and the deploy shipped an unusable bundle.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(cli): scope hook marker scan to the hooks subtree + prune local dupes (Bugbot)

Two follow-ups from Bugbot:

- fileHasImpeccableHookMarker scanned the whole settings file as raw text, so
  an unrelated string (e.g. a permissions allow entry that mentions the hook
  path) could falsely read as an installed hook and block install/repair or
  the shared-settings skip. Now it parses the JSON and scans only the `hooks`
  subtree.
- When the hook is honored in the shared settings.json, copyProviderHooks
  skipped the local write but left a stale hook in settings.local.json from an
  earlier machine-local install, so Claude Code loaded both and ran the
  detector twice per edit. It now prunes the local copy (preserving unrelated
  local settings, dropping the file if only our scaffolding remained).

Adds tests for both: a permissions string mentioning the hook path still
triggers repair, and a shared hook prunes the stale local duplicate while
keeping unrelated permissions.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-13 23:54:46 -07:00
672517f76e Add automatic design hook install and exceptions (#170)
* docs: add PRD for design detector hook integration

Plans a PostToolUse hook for Claude Code and Codex that runs the
existing design detector after every relevant file write and feeds
findings back to the agent as advisory system-reminder context. No
implementation in this commit; covers UX, technical design, build
pipeline changes, distribution, coverage tradeoffs, and rollout.

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs: revise hook PRD with best-practices review

Folds in the P0/P1/P2 findings from an online best-practices critique
against the official Claude Code and Codex hook references plus 10+
2026 community guides and similar prior-art tools (claw-hooks,
claude-code-hooks-mastery).

Key changes:
- Exec form everywhere (Codex snippet was shell form), with Windows
  rationale.
- Default timeout dropped from 10s to 5s.
- Re-entrancy guard (CLAUDE_HOOK_DEPTH) and per-file edit counter.
- Session-scoped finding dedup promoted from open question to v1.
- Per-language inline-ignore syntax map (HTML/JSX/CSS/JS).
- Hard-skip rules for sensitive paths and generated/lock files.
- Honest framing about Claude Code lacking per-plugin hook disable.
- Honest framing about Bash-written files being invisible in v1.
- Codex Windows-not-supported call-out, feature flag note, trust ceremony detail.
- Optional NDJSON audit log via IMPECCABLE_HOOK_LOG.
- Findings cap lowered 8 → 5 with attention-budget rationale.
- Versioned envelope ([impeccable@1]) on rendered template.
- Expanded test plan, decision log, and stdin payload appendix.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(hooks): ship the design detector hook for Claude Code and Codex

Implements docs/hooks-prd.md: a PostToolUse hook that runs the
impeccable design detector after every Edit/Write/MultiEdit on a UI
file and pushes findings into the agent's next-turn context as a
short system reminder. Silent on clean files. Never blocks an edit.

Why this matters: today, design slop (side-tab borders, gradient
text, purple/cyan palettes, bounce easing, etc.) only gets caught
when a human notices or someone explicitly runs /impeccable audit.
The hook closes the loop at the moment slop is written.

What ships in v1
- skill/scripts/hook.mjs: PostToolUse entry. Reads stdin, runs the
  detector in-process (no `npx impeccable` cold start), emits
  hookSpecificOutput.additionalContext when fresh findings exist.
- skill/scripts/hook-lib.mjs: extracted helpers (config, cache,
  filter, render, audit log, runHook orchestrator). 100% unit-testable.
- skill/scripts/hook-session-start.mjs: SessionStart greeting,
  gated by a project-scannable probe + 30-day throttle.
- skill/scripts/hook-admin.mjs: backs /impeccable hooks
  on/off/status/ignore-rule/ignore-file/reset.

Hardening built in
- Re-entrancy guard (IMPECCABLE_HOOK_DEPTH) so the hook can never
  recursively spawn itself.
- Hard-skip regexes for sensitive paths (.env, .pem, id_rsa,
  secrets, credentials, .git) and generated/lock/build output. These
  fire before the file is even read; cannot be turned off via config.
- Path-traversal check on the inbound file_path.
- Session-scoped dedup keyed by (session, file, rule, line) so the
  same finding never lands in context twice. Prevents the ~12.5K
  wasted tokens per chatty session called out in the PRD.
- Per-(session, file) edit counter with a one-shot suppression
  notice on the 7th edit, silent after.
- Fail-open contract: every error path returns exit 0 with no
  stdout. Optional NDJSON audit log via IMPECCABLE_HOOK_LOG.

Three kill switches (precedence high to low):
1. IMPECCABLE_HOOK_DISABLED env var (1/true/yes/on, case-insensitive)
2. .impeccable/hook.json `enabled: false`
3. /impeccable hooks off slash command (writes the JSON)

Inline ignores are language-aware. `// impeccable: ignore <rule>` for
JS/TS, `<!-- impeccable: ignore <rule> -->` for HTML/Vue/Svelte/Astro,
`{/* impeccable: ignore <rule> */}` for JSX/TSX, `/* impeccable:
ignore <rule> */` for CSS. `*` matches any rule. Directive applies
to the next non-blank line. Same shape as ESLint, Stylelint, Biome.

Build pipeline
- scripts/lib/transformers/hooks.js: per-provider hooks.json
  builders, plus the slim .codex-plugin/plugin.json manifest.
- providers.js: emitHooks: 'claude' for claude-code, emitHooks:
  'codex' for codex and agents. Codex also emits emitCodexPlugin.
- factory.js: emits hooks/hooks.json next to the skills tree.
- build.js: syncs hooks/ into harness roots and into the slim
  plugin/ subtree; writes .codex-plugin/plugin.json. Build is
  idempotent (verified: 98 staged files unchanged across two runs).

Claude Code wiring uses exec form (command + args) and the
${CLAUDE_PLUGIN_ROOT} placeholder. Matcher: Edit|Write|MultiEdit.
`if:` glob filters to UI extensions before spawning Node. PostToolUse
timeout 5s, SessionStart timeout 3s.

Codex wiring uses ${PLUGIN_ROOT} (Codex's native placeholder),
matcher Edit|Write|apply_patch, no `if:` analog (the script does the
extension filter). macOS and Linux only; hooks are disabled on
Windows in current Codex builds. The trust ceremony and feature flag
are documented in README.md.

Routing
- /impeccable hooks lives outside the 23-command router table on
  purpose: it is plumbing, not a design skill. The hidden
  routing slot is added to SKILL.md alongside pin/unpin so the LLM
  knows to dispatch it. The 23-command count and all stale-count
  validators remain happy.

Tests
- tests/hook.test.mjs: 38 unit tests covering env parsing, config
  load + defaults + malformed, cache round-trip + GC,
  ignoreRules/minSeverity/inline ignores (all four languages),
  globbing with **/*/{a,b}, render template with cap + clamp + 0-line
  prefix drop, audit log NDJSON, payload event-name parameterization,
  re-entrancy, kill switches, sensitive-path + generated-path +
  traversal skips, allowlist filter, config ignoreFiles, edit
  counter cycle including the 7th-edit notice, MultiEdit and
  apply_patch payload shapes, detector throw swallow, malformed
  stdin, missing file race.
- tests/hook-build.test.mjs: 18 integration tests covering hook
  manifest shape (matcher, timeouts, exec form, if: glob, placeholders),
  Codex differences (${PLUGIN_ROOT}, no if:, no SessionStart),
  Codex plugin manifest (no inline hooks field to avoid the
  duplicate-file error), routing across the hooksJsonFor table, and
  presence of all three committed artifacts plus the bundled detector
  the runtime relative-import path depends on.

Full suite: 175 bun tests + 186 node tests, all green.

Docs
- README.md: new "Design hook" section explaining default behavior,
  per-project / global / inline disable paths, the JSON schema knobs,
  the audit log debug flag, and the slop / a11y coverage split.
- HARNESSES.md: flips the `hooks` row for Codex from No -> Yes
  (Claude was already Yes), adds a per-harness hook-surface table
  with the manifest location and matcher each provider uses.

Open questions from the PRD intentionally deferred to v2: Bash-write
blind spot, effort-aware suppression, Stop-hook session summary,
per-rule severity, async hook mode. None block v1.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Fix Codex hook scanning: apply_patch paths and co-located stylesheets

Parse file targets from Codex apply_patch command bodies, co-scan imported
and sibling CSS when UI components are edited, drop the git-sweep PostToolUse
group, and align Codex SessionStart manifest and trust docs with the official
hooks spec.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Gitignore hook session cache and drop local test HTML

Hook dedup/throttle state in .impeccable/hook.cache.json is per-project
runtime data like other .impeccable/ sidecars. Remove an untracked
bad-nested-flexbox scratch page from site/public/.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Fix Claude Code hook: drop Edit-only if filter so Write/MultiEdit fire

Claude's if permission rule binds to one tool name, so Edit(*.{…}) never
spawned the hook on Write or MultiEdit despite the matcher listing them.
Extension filtering now lives in hook-lib on both Claude and Codex.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Surface Cursor design findings via stop-hook followup

Replace dropped postToolUse additional_context with afterFileEdit recording
and a one-shot stop followup_message so anti-pattern nudges reach the agent.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Fix design hook packaging and scans

* Fix Cursor hook pending bucket fallback

* Fix Sass hook scan coverage

* Fix Cursor hook review findings

* Fix session start dead hook normalization

* Fix hook config and relative scan paths

* Remove SessionStart design hook

* Remove redundant afterFileEdit normalization

* Fix Cursor suppression and module style scans

* Fix sensitive path hook filter

* Fix disabled Cursor stop hook emission

* Refresh hook harness artifacts

* Fix Cursor hook manifest install

* Add hook ignore-value support

* Ignore hook runtime files locally

* Fix Codex plugin hook packaging

* fix: address PR review bot findings

Block numeric hook depth counters from re-entering.

Avoid following stylesheet imports from traversal-looking hook targets.

* fix: gate ignore-value suggestions by supported rules

Only render exact ignore-value commands when the same finding can be suppressed by ignoreValues.

* Package Codex plugin as hook-only

* Remove Codex plugin packaging

* Recover hook install probe plumbing

* Remove Codex hook packaging follow-up doc

* Remove extra hook docs and skill wording changes

* Install real design hooks via skills CLI

* Add provider hook smoke runner

* Fix Cursor hook delivery with preToolUse gate

* Simplify Cursor hook install to preToolUse

* Clarify confirmed hook exceptions

* Persist hook ignores in shared config

* Guard font hook exceptions

* Fix hook install after main rebase

* Fix hook scan target handling

* fix: address hook review findings

* Address hook review feedback

* Stabilize DeepSeek insert live fixture

* Fix Cursor hook Python shell write bypass

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-13 21:19:19 -07:00
83dd99bf9f refactor(codex): drop the .codex/agents sidecar; rely on nested skill agents (#173)
Codex auto-discovers subagents bundled inside an installed skill's own
agents/ folder, so the separate .codex/agents/*.toml sidecar was redundant.

- cli: remove installCodexAgents/isCodexLikely and their install/update calls
- context.mjs: remove the CODEX_AGENT_MISSING self-heal directive
- build: drop codex agentFormat so no top-level .codex/agents is emitted; the
  nested in-skill .toml bundling is the whole delivery
- remove the tracked .codex/agents/*.toml and the gitignore exception
- docs + build.test.js updated for the nested layout
- CLI patch version bump; skill version unchanged

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-05-28 21:20:42 -07:00
e8e3665142 Live mode: staged AI copy edits (#158)
* feat(live): manual text-edit panel + Astro inject + stale-lockfile reap

Adds a manual text-edit popover under the live-mode bar so users can
retype copy directly without going through generate. The footer's
"Apply edits" button fires a manual_edits event; the server writes
the changes back to source via the new live-edit.mjs deterministic
file mutator. Mirrors the wrap+accept flow but skips variant generation.

New scripts:
- skill/scripts/live-edit.mjs: writes manual_edits back to source
- skill/scripts/live-text-rows.js: browser walker that surfaces every
  pure-text descendant of the picked element as an editable row

Touched scripts:
- skill/scripts/live-browser.js: text panel UI, CONFIGURING state hook
- skill/scripts/live-poll.mjs: manual_edits routing
- skill/scripts/live-server.mjs: manual_edits endpoint + handler
- skill/scripts/live-wrap.mjs: small adjustments to support the flow

Docs + tests:
- skill/reference/live.md: manual-edit section
- tests/live-edit.test.mjs, tests/live-text-rows.test.mjs

Also bundles two live-mode reliability fixes that surfaced during
manual testing of the feature:

1. live-inject now emits is:inline when the inject target is a .astro
   file. Astro otherwise processes the <script> tag and rewrites src
   to its own bundled URL, so the literal live.js never loads.

2. readLiveServerInfo now probes the lockfile PID with kill(pid, 0)
   and unlinks the stale lock if dead. Previously a crashed helper
   left server.json with a dead PID and live-poll reported "Live
   server not running" forever.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* feat(live): inline contenteditable text editing

Replace the text-edit popover panel with inline contenteditable activation.
When an element is picked in CONFIGURING, every pure-text descendant becomes
contenteditable="true" directly on the page. Each blur-event fires a single-op
manual_edits save to source. Esc restores original text and stays in CONFIGURING;
successful save exits to PICKING. If Go is clicked while a save is in-flight,
the save completes before generate fires.

Deleted ~340 lines of panel UI (initTextPanel, openTextPanel, closeTextPanel,
renderTextRow, buildTextFooter, etc.). Added enableInlineEdit, disableInlineEdit,
onInlineBlur. Server contract unchanged; live-edit.mjs handles per-op saves as
before. Tests: 186 pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(live): hide annotation overlay during inline edit

Annotation overlay's click handler was intercepting clicks on contenteditable
text elements. Hide the overlay when inline-edit is enabled to allow text
selection and editing. Restore it when exiting inline-edit (if still in
CONFIGURING).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(live): edit content badge mode with batched saves

Replace automatic inline contenteditable on element pick with an explicit "Edit content" badge. The badge appears at the element's top-right corner when an element is picked. Clicking the badge enters a new EDITING state where:

- The contextual bar hides
- The annotation overlay hides
- The badge morphs to show Cancel + Apply buttons
- Text descendants become contenteditable inline

Edits are held in memory (input event tracking) until Apply is clicked, which fires a single batched manual_edits event with all ops. Cancel discards drafts without saving. This eliminates the annotation overlay interference that prevented clicking on text elements.

The EDITING state integrates with the main state machine and handles all exits (Esc, click-outside, teardown) cleanly.

All 186 tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(live): use row.el.tagName for tag in applyEditing op

The applyEditing function was trying to use row.tag which doesn't exist on the row object. The tag should be the tagName of the text element itself (row.el.tagName.toLowerCase()).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(live): Edit content badge styling + auto-focus + separate buttons

- Edit content button now matches Go button styling (BP.accent background, BP.mark text, FONT, transitions, hover effects)
- Auto-focus first editable element when entering editing mode (50ms timeout)
- Separate Cancel and Apply buttons with 8px gap (no divider)
- Cancel uses muted styling (BP.hairline background, BP.textDim text)
- Apply keeps brand accent styling
- Remove all focus rings and outlines on edit badge buttons (no blue ring/outline in EDITING mode)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* feat(live): Subtle button UI + cursor positioning + better copy

- Change badge buttons to use impeccable-button aesthetic (ink background, surface text, hover to accent)
  - Removes aggressive styling conflict with Go button
  - No animations; simple 150ms background transition
  - Matches site design language (padding 0.625rem 1.5rem, 0.8125rem font, letter-spacing 0.03em)
- Shorter, clearer button copy: "Edit" instead of "Edit content", "Save" instead of "Apply"
- Fix cursor positioning: cursor now appears at END of text, not beginning
  - Use Selection API to collapse cursor to end of contenteditable element
  - Improves UX for immediate continuation of text
- Update live.md documentation to reflect new button labels

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* fix(live): Use site design system colors for edit badge buttons

- Edit/Save buttons: oklch(10% 0 0) background → oklch(60% 0.25 350) on hover
- Cancel button: oklch(55% 0 0) background → oklch(65% 0 0) on hover
- All buttons: 6px border-radius (matches Go button), oklch(98% 0 0) text
- Smooth transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1) (--ease-out)
- Uses site color palette instead of live-overlay constants

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* fix(live): Match slop-callout style for edit badge buttons

- Use exact .slop-callout aesthetic: paper background, accent border + text, uppercase 10px (0.625rem)
- 600 weight, 0.06em letter-spacing, 4px 8px padding, 6px border-radius
- Box-shadow: 0 2px 8px rgba(0,0,0,0.1) matches site callouts
- Hover: inverts to filled background (accent fill, paper text)
- Cancel uses ash color variant for muted state, Save uses accent
- Smooth 0.3s cubic-bezier(0.16, 1, 0.3, 1) transition on background and color

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* fix(live): Pill-shaped edit badge buttons, 2px padding, no uppercase

- Border-radius: 999px (pill shape)
- Padding: 2px 8px (more compact)
- Removed text-transform: uppercase

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* fix(live): Cancel button uses mist border + ash text

- Border: 1px solid oklch(92% 0 0) (--color-mist)
- Color: oklch(55% 0 0) (--color-ash)
- Hover: inverts to ash background with paper text

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* fix(live): Remove blue focus outline from contenteditable elements in EDITING mode

- Add inline outline: none on each row's element when contenteditable activates
- Inject [data-impeccable-editable] CSS rule to override browser default focus ring
- Use !important to win against site styles that re-apply focus outlines
- Cleanup restores outline/data-attribute on disable

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* feat(live): Decouple manual edits from agent/poll pipeline

Manual text edits now POST directly to a new /manual-edit endpoint
that runs live-edit.mjs synchronously and returns the result. The
event is never enqueued, never reaches the poll loop, never reaches
the agent.

Why: every Save was costing an LLM turn. The poll script would
dequeue the manual_edits event, run live-edit.mjs deterministically,
post a completion ack, then print the event JSON to stdout. The
Claude agent would read that output and decide "loop and re-poll".
Zero real work for the agent but every Save burned context.

Changes:
- live-server.mjs: new POST /manual-edit handler that runs live-edit.mjs
  synchronously and returns the result. Does not enqueue, does not log
  to session store. Defense-in-depth: /events rejects manual_edits.
- live-browser.js: applyEditing() POSTs to /manual-edit instead of
  sendEvent({type: 'manual_edits'}).
- live-poll.mjs: removed manual_edits handler branch (dead code now).
- reference/live.md: removed "Handle manual_edits" section; replaced
  with a one-line note that manual edits are server-direct.

The HMR-triggered page reload remains (dev server detects source file
change) but that is a separate dev-server behavior, not our pipeline.
resumeSession() already restores variants and selection after reload.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* feat(live): Stash manual edits server-side; commit via AI on request

Decouples manual-edit Save from source file writes. Save now stashes
to .impeccable/live/pending-manual-edits.json with no HMR refresh.
The user explicitly asks the AI to commit when ready.

Why: even with the prior /manual-edit fix, every Save still wrote to
source and triggered the dev server's HMR/full reload. The page flash
was the actual user pain. Now there's zero source touch on Save, and
the user controls when the dev server reloads.

Server (live-server.mjs):
- /manual-edit-stash POST: append to buffer file. Returns {ok, pendingCount, totalCount, perPage}.
- /manual-edit-stash GET: query counts by page for counter UI.
- /manual-edit-discard POST: drop entries (all if no pageUrl).
- Old /manual-edit returns 410 Gone (defense in depth).
- Buffer ops merge by (pageUrl, ref): keep first originalText, update newText.

CLIs:
- live-commit-manual-edits.mjs: read buffer, shell out to live-edit.mjs
  per entry, truncate succeeded entries, surface failures.
- live-discard-manual-edits.mjs: truncate buffer (optionally scoped by page).
- Both take optional --page-url=<url>.

Browser (live-browser.js):
- applyEditing() POSTs to /manual-edit-stash, no source write.
- Pending pill (• N staged) + trash icon next to Exit in global bar.
- One-time onboarding toast on first Save: "Saved. Tell the AI to commit when ready."
- Counter persists across reloads via GET /manual-edit-stash on init.
- Trash icon: confirm dialog scoped to current page, then POST /manual-edit-discard.

Variant pipeline interaction:
- live-wrap.mjs: when wrapping an element, apply pending manual edits to
  the source range so the wrap block's "original" variant reflects the
  user's edited DOM (their pre-Go view), not the raw source.
- live-accept.mjs: after accept writes the variant to source, scrub
  buffer ops whose originalText no longer appears in that file. The
  accept embodies the manual edit; the pending op is consumed.
- Variant discard does NOT touch the buffer.

Reference docs:
- reference/live.md: full commit/discard contract, trigger guidance
  (narrow action-verb intent), do-not-auto-commit rule.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* feat(live): Staged-edits pill becomes an "Apply" button

Click the "• N staged" pill → confirm dialog "Apply N staged edits
to source? The page will reload." → POST /manual-edit-commit on the
server, which shells out to live-commit-manual-edits.mjs. Same path
the AI uses, just triggered from the overlay.

Trash icon stays for discard. The AI-driven commit path also stays
(useful for inspecting failures or scripting). The pill is now the
primary apply affordance because it removes the chat-context-switch
for the common case.

Pill styling: pointer cursor, accent border + text at rest, fills
on hover (accent bg, paper text). Tooltip: "Click to apply staged
edits to source".

First-save toast updated: "Saved. Click the 'staged' badge to apply,
or ask the AI."

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* chore(live): gitignore pending-manual-edits.json runtime buffer

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore: drop stray site/ test edits from PR

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat(live): Pill label reads "Apply N staged"

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(live): Manual edit ops use the leaf element's locator, not parent's

Multi-row inline editing captures each contenteditable leaf (row.el) but
the op was being built with selectedElement.id / classList — i.e. the
parent card, not the editable text node. live-edit.mjs then searched
source for the parent's class on the leaf's tag (e.g. <span class=
"foundation-card">), found nothing, and silently failed.

Use row.el's own id / classList instead.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(live): Climb to nearest classed ancestor when leaf has no locator

A bare <em>/<strong>/etc. with no id or class produced ops the CLI
rejected with insufficient_locator. Prefer the leaf's own id/class; if
neither exists, walk up to the nearest ancestor with one and adopt its
tag + locator. Text-replace still works because the CLI narrows by
originalText inside the matched element's source range.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat(live): Make mixed-content paragraphs editable

The text-rows walker skips elements with mixed children (text + element +
text), so paragraphs like "Some text <code>x</code> more text" or "Body
text · <a>link</a>" exposed zero rows for the surrounding copy. At edit
time, wrap each non-whitespace direct text-node child in a marker span so
the walker emits a row for it. Unwrap on save/cancel. The locator climbs
to the parent's class as before, and live-edit narrows by originalText
inside that parent's source range.

hasTextRows now uses a lightweight subtree check that matches the new
wrap+walk path so the edit affordance shows up on mixed-content elements.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(live): Address Cursor Bugbot findings (CB-2 through CB-6)

CB-2 - Escape reverted DOM text but inlineEditDrafts retained the
pre-revert value; clicking Apply afterwards committed the undone edit.
Clear the draft entry when restoring innerText.

CB-3 - The scrub gate !result.handled || result.handled !== false was
a tautology that ran the scrub regardless of accept outcome. Use the
intended result.handled !== false.

CB-4 - The buffer-aware "original" content step in live-wrap iterated
every entry in the buffer with no pageUrl filter, so an edit on /a
could leak into a wrap call on /b. Add --page-url to the CLI; filter by
it; skip the buffer-aware step entirely when omitted. live.md updated.

CB-5 - removeEntries returned entry count while truncateBuffer returned
op count, causing the discard CLI and HTTP endpoint to report mixed
units. Make removeEntries return ops removed.

CB-6 - applyTextReplace used string truthiness to gate prepending
content above the edit, which silently dropped a leading empty line
when the file started with '\n'. Gate on the line index instead, and
mirror the fix on the trailing-empty-line side.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(live): A3+A4 data-integrity guards, A6 test coverage

A3 — applyTextReplace refuses with text_ambiguous_in_block when
originalText appears more than once in the matched element block.
Refusing is safer than picking the first indexOf hit when we can't
tell which leaf the user edited; user can rephrase one occurrence.

A4 — newText is rejected if it contains <, >, {, }, or a backtick.
Two layers: server-side validator in /manual-edit-stash returns 400,
CLI-side guard in applyTextReplace returns invalid_chars_in_newText.
Browser surfaces the specific reason via toast. The shared char list
lives in live-edit.mjs (validateNewTextChars). reference/live.md
documents the rule.

A6 — New test files cover the orchestration gap:
 - live-manual-edits-buffer.test.mjs (17 tests across read/stage/
   remove/find/count/truncate; pins removeEntries returns OPS count)
 - live-wrap-buffer-aware.test.mjs (3 tests; CB-4 regression test)
 - live-commit-manual-edits.test.mjs (4 tests; partial-failure,
   --page-url scope, no_pending_edits)
 - live-discard-manual-edits.test.mjs (3 tests; CB-5 unit consistency)
 - live-accept-scrub.test.mjs (4 tests; keep/drop/prune)
Plus 2 new cases in live-edit.test.mjs for A3 and A4.

Side-effect refactors:
 - scrubManualEditsAgainstFile accepts cwd for unit-testing and is
   exported.
 - Failed-op entries in live-edit.mjs now propagate forbidden and
   occurrences fields so callers can surface specifics.

41 tests across the 6 affected files pass; full suite green at 186/186.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore: drop .claude/pr-review.md from PR

Local review notes belong in the working tree, not the PR diff. Kept
in the file system; just untracked.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore: drop stray site/ test edits from PR (round 2)

Live-inject script tag and the "Impeccable Works!" / "WHAT'S INCLUDED
IN THE BOX" / "Wow Impeccable. ---- " strings were test edits that
slipped back into the branch. Restore both files to match main.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* feat(live): Disable Edit badge while variants are generating

Clicking Edit during GENERATING would open inline text editing on the
same DOM region the variant wrapper is about to land in, racing the
HMR and the mutation observer. The badge now switches to an
'idle-disabled' rendering (ash + mist, not-allowed cursor, disabled
attribute, tooltip) the moment state transitions into GENERATING.
Returns to 'idle' on the normal CONFIGURING re-entry paths.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(live): live-wrap refuses without --page-url when buffer has pending edits

When a manual edit is staged ("Impeccable Works!") but not yet committed,
the buffer holds the user's edited DOM while source still has the un-
edited text ("Impeccable"). live-wrap's buffer-aware step exists to
rewrite the wrap block's <div data-impeccable-variant="original"> to
match the staged DOM, but per CB-4 it is gated by --page-url. When the
agent invoking live-wrap omits --page-url, the buffer-aware step
silently no-op'd and the variant authoring saw stale source — the
user's manual edit appeared lost.

Make the silent no-op a loud error: when buffer.entries.length > 0
and --page-url is missing, exit 1 with
{ error: 'missing_page_url_with_pending_edits', pendingEntries, hint }.
Empty buffer = no risk = no requirement, so existing flows without
pending edits keep working.

Updated reference/live.md to flag --page-url as required when the
buffer has entries. Added regression test in
live-wrap-buffer-aware.test.mjs. live-wrap.test.mjs gained a buffer-
clear hook so any leftover .impeccable/live/pending-manual-edits.json
from local dev doesn't trip the new check.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* change back

* chore: drop stray site/ test edits from PR (round 3)

Live-inject script tag in Base.astro slipped back in via git add -A
while a local live server was running. Restore both site/ files to
main.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Fix live manual edit staging

* Rename live edit copy badge

* Use sentence case for live edit copy badge

* Move copy edit apply control outside live bar

* Improve live copy edit apply flow

* Clean up live copy edit AI apply flow

* Polish live copy edit docs and toast

* Fix staged copy edit review issues

* Fix CI jsdom dependency

* Fix Cursor Bot live edit findings

* Fix remaining live edit review issues

* Fix Bugbot staged edit edge cases

* Fix latest Bugbot live edit edges

* Fix remaining Bugbot wrap and discard issues

* Fix live copy edit safety contracts

* Fix copy edit rollback coverage

* Fix live manual copy edit apply flow

* Adjust live pending dock offset

* feat(live): route manual-edit Apply through the chat agent

Make the staged copy-edit Apply work when no CLI AI runner is
authenticated by routing the batch through the active chat session,
and surface runner failures clearly instead of opaque exit codes.

- live-poll: add --reply --data '<json>' so the chat agent can return
  a structured manual_edit_apply result (the documented flag was
  missing, so the server resolved with an empty object)
- live-server: manual_edit_apply event + deferred map, chat-vs-subprocess
  dispatch in /manual-edit-commit, resolve the deferred from the ack
- live-copy-edit-agent: chat provider, extractRunnerErrorMessage and
  commandAuthed pre-flight, diagnostic describeNoProviderError; drop the
  stale CLAUDE_CODE_SIMPLE and --no-session-persistence flags so headless
  CLAUDE_CODE_OAUTH_TOKEN auth works
- live-browser: clear pendingApplyInFlight on commit_done and add a
  watchdog so a missed signal can no longer freeze element picking
- reference/live.md: tight Handle manual_edit_apply handler plus a
  separate diagnostics reference section; advertise the event in the
  opening contract and dispatch table

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Add live manual edit apply coverage

* Fix manual edit apply review issues

* Fix manual edit review follow-ups

* Fix manual apply poll acknowledgements

* Fix manual apply failed-entry rollback

* Clarify manual apply LLM prompt

* Fix stale manual apply discard events

* Fix manual apply dynamic source edits

* Fix large manual apply chunks

* Clarify manual edit apply is first-class work

* Clarify manual apply resume flow

* Compact live manual apply evidence

* Reject malformed manual apply replies

* Recover legacy manual apply summaries

* Fix Astro live script injection

* Add live manual edit apply coverage

* Slim live manual apply flow

* Slim manual edit test dependencies

* Stabilize real browser LLM smoke

* Generalize manual edit LLM prompt examples

* Remove retired live edit wrapper

* Inline live text row walker

* Slim manual edit prompts

* Drop AGENTS doc churn

* Stabilize live manual apply prompts

* Stabilize manual apply visible Haiku flow

* Add hard framework manual edit coverage

* Stabilize manual edit LLM retries

* Fix manual apply transaction rollback

* Fix live shader text capture

* Clean up manual apply runtime artifacts

* Fix live manual edit apply reliability

* Clean up manual apply coverage

* Slim manual apply test cleanup

* Fix manual edit prompt contract test

* Align manual edit cancel hover

* Fix live loading shader capture

* Fix manual apply review findings

* Restore live e2e tests for CI

* Fix live loading shader halftone

* Tune live loading shader dots

* Restore main live shader behavior

* Fix manual apply review findings

* Fix manual apply bot follow-ups

* Clarify manual apply rollback changes

* Fix manual apply state naming

* Address PR review cleanup

* Fix manual apply review follow-ups

* Fix multiline manual apply verification

* Restore inline drafts when hiding live bar

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-28 19:02:12 -07:00
e7e923c4ef Skill + craft cleanup, detector hardening, native subagent pipeline (#152)
* skill: drop quality tiers, keep the real brand-craft guardrails

Codex's craft/brand pass introduced fast/ship/showpiece "quality bars"
plus brand-specific build gates, asset ledgers, sub-agent review, and
self-graded fallback labels. In practice those tiers became escape
hatches rather than craft pressure: the final output should always be
10/10, and the real decision points are splashiness and maximalism, not
quality.

Removed:
- All quality-bar / showpiece / fast / ship framing in shape.md and craft.md
- Standalone Brand Direction (#4) and Asset Requirements (#10) sections
  in shape's brief; renumbered back to 1-10
- The Brand hard rules section in brand.md (folded its real prohibitions
  into the existing Imagery and Brand bans sections)
- Brand-specific build-gate item, mock-fidelity bullet, production-bar
  bullet, present-step bullet in craft.md
- Asset ledger ceremony in craft Step 4
- Review-only sub-agents and "self-reviewed fallback, not independently
  validated" machinery in craft.md and polish.md
- The For brand surfaces, assess hard failures subsection in polish.md
  and the brand checklist row
- tests/brand-showpiece-reference.test.mjs (and its package.json wiring)

Kept (the real nuggets):
- Asset-substitution prohibition: image-led briefs ship real/generated
  assets or canvas/SVG/WebGL, not generic CSS panels, cards, bullets,
  or copy
- Repeated tiny uppercase tracked kicker labels as a brand ban
- Detector/QA output is defect evidence only, never proof of quality
- "What visual assets are real content here?" discovery question
- Inspect each major section individually for brand and long-form work
- repeated-section-kickers detection rule + fixture
- CLI improvements (JSON to stdout, -json/-fast aliases, severity field)
- critique.md: npx impeccable detect --json fix

Harness output dirs refreshed via bun run build. Full test suite (186)
passes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* skill: strip gate ceremony; require shape pause; allow compact briefs

The setup gate table and IMPECCABLE_PREFLIGHT banner pushed every
craft run through ritual restatement (PRODUCT.md → original prompt
→ round 1 → round 2 → 70-line "confirmed brief" → critique → summary,
all saying the same thing). Replaced with imperative prose that still
demands the same work but skips the user-facing telemetry.

Specifically:

SKILL.md
- Drop the Setup gate table and IMPECCABLE_PREFLIGHT banner.
- Keep the imperative steps explicitly: load context, identify register
  and load brand.md or product.md, AND load the matching command
  reference (craft.md / shape.md / etc.) when a sub-command is invoked.
  The command-reference step is non-negotiable; without craft.md loaded
  the agent skips the shape-and-confirm pause.

craft.md
- Drop the Build Gate / Craft Contract formal sections; replace with
  one paragraph stating prerequisites.
- Step 1 explicitly requires ending the response after presenting the
  shape output; the user must confirm before any code lands. Allows a
  compact 3-5 bullet brief when the prompt + PRODUCT.md already pin
  direction (full 10-section structure reserved for genuinely
  ambiguous tasks).
- Step 3 image gate skips silently when image generation isn't
  natively available; no user-facing announcement.
- Step 6 explicitly legitimizes "first pass clean, shipping" as a
  valid endpoint and bans inventing fake defects to demonstrate
  iteration.

shape.md
- Cap discovery at 1 round by default; second round only when first
  leaves material gaps.
- Adds an "assert-then-confirm, not menu-with-escape" rule: when
  PRODUCT.md and the prompt make one option obvious, name it and ask
  for confirm or override instead of enumerating "Restrained /
  Committed / Or something else?" as a real choice.
- Phase 2 brief has two forms now: compact (default for clear briefs)
  and full structured (genuinely ambiguous). Open Questions can't
  double as leading-with-Recommend; if you'd write "Recommend: X",
  decide X.
- Image gate same as craft.md.

Validated end-to-end with a Haiku skill-on observability run: agent
loads craft.md plus the brief's recommended implementation refs,
pauses for one productive question (accent color, trace fidelity,
CTA), and ships an artifact with zero side-tab violations vs. the
original v1 baseline. Cost trades up modestly for that quality.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* craft.md Step 6: Reading the screenshot is the inspection, not taking it

A v4 eval run took 4 targeted screenshots (hero, mobile, tablet,
query-section) and then never Read any of them back. The agent treated
browser_screenshot itself as "I inspected" and shipped without the
multimodal feedback loop ever closing. Detector caught the resulting
slop (5+ side-tab violations) on adjacent runs that did the same thing.

Step 6 now spells out the pattern explicitly: take the screenshot,
then Read the resulting PNG so its image content enters the
conversation as multimodal input, then critique what you actually see
in the image. With a check: "if your critique could have been written
without looking at the image, you didn't look at the image."

Validated with v5b: agent took 6 screenshots, Read all 6 back, and
shipped with zero detector findings (vs the previous greenfield runs
that hit 1-12 findings each).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* craft + brand: framework foundation, build-pipeline respect, image verification

Three closely-linked additions surfaced by an eval-harness session
investigating why the agent always shipped flat single-file HTML and
zero imagery on greenfield brand briefs.

1. craft.md gains a new Step 0 "Project Foundation" before Shape.
   Detects existing framework / component library / icon set and
   uses what's there. Greenfield: ask the user via AskUserQuestion
   with sensible defaults framed by the brief (Astro for content/
   brand sites, SvelteKit/Next/Nuxt for app surfaces, single
   index.html only for one-shot demos). Skipping the framework
   decision and writing flat HTML "to satisfy the spec" produces
   work that reads as a 2018 prototype regardless of visual
   quality.

2. craft.md Step 5 production bar gains two bullets:
   - Respect the build pipeline. Edit source files and run the
     project's `npm run build`; do not write to build/ / dist/ /
     .next/ directly with cat/heredoc/Bash redirects. Bypassing
     the pipeline skips asset hashing, image optimization, code
     splitting, and CSS extraction.
   - Verify external image URLs before referencing them. Use an
     image-search MCP, web-fetch tool, or browser if available;
     guessed photo IDs ship as broken-image placeholders.

3. brand.md "Imagery" section:
   - Generalizes the Unsplash URL guidance to "verify URLs
     before referencing them" with a hierarchy: image-search MCP
     > web-fetch > confidence-restricted manual selection >
     fewer photos.
   - Tightens the tech/dev-tool exception. Old line "zero imagery
     can be correct" gave models a permission slip. New framing
     keeps the underlying truth (typography + code + diagrams
     primarily carry voice) but raises the floor: imagery still
     earns its place when it serves the brief, and skipping it
     requires naming the typographic/diagrammatic move that's
     carrying the visual weight instead. "Zero imagery is the
     failure mode of laziness, not restraint."

Eval-harness corpus that prompted this: 19/19 brand landing tasks
shipped 0 images each, including ones where Opus had taste enough
to break the dev-tool color default lane. The skill needs to teach
both halves of the decision; the harness shouldn't have to nudge.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* detector: body-text-viewport-edge rule + OKLCH/var-resolution + anchor-inherit FP fixes

New rule: body-text-viewport-edge flags body paragraphs that render flush
against the left/right viewport edges (no container padding). Tested via
the new tests/fixtures/antipatterns/body-text-viewport-edge.html fixture
(3 flag cases, 5 pass cases) and the test in detect-antipatterns-browser.

False-positive class fixes — all jsdom-mode only (real browsers resolve
the cascade correctly so these gates stay inert there). Five related
gaps that compounded into ~14× spurious contrast findings on Tailwind v4
pages with OKLCH color tokens:

  • OKLCH parser. jsdom returns the literal "oklch(...)" string from
    getComputedStyle; the detector now converts to sRGB via Björn
    Ottosson's matrices. Handles Tailwind v4's compact minified form
    "oklch(21.5%.02 50)" (no space after %).
  • var() resolution. resolveBackground + checkElementColors now
    accept the existing customPropMap and parse `var(--color-paper)`
    etc. as proper RGB via the new parseColorResolved helper.
  • bg-color before bg-image. The old order bailed on any gradient
    ancestor before checking for a solid background-color underneath,
    causing the body's decorative paper-grain gradient to be measured
    against instead of the page's actual `bg-paper` cream.
  • body/html-level gradient → white fallback. When the only opaque
    ancestor we can read is body/html with a gradient overlay (and
    jsdom can't decompose `background: var(--paper) gradient` to
    extract the solid color), return white instead of falling through
    to resolveGradientStops — which was picking up paper-grain noise
    colors and using them as the bg.
  • Anchor-inherit workaround for jsdom :link UA specificity.
    Tailwind v4's preflight declares `a { color: inherit }` (0,0,1).
    jsdom's UA stylesheet has `:link { color: blue }` at (0,1,1) and
    wins the cascade. Real Chrome wraps :link in :where() (0,0,0) so
    the page rule wins. When the page declares the inherit rule AND
    we see jsdom's default `rgb(0,0,238)` on an anchor, walk to the
    nearest non-anchor ancestor and use its color.
  • Alpha-fallback safety gate. When text has alpha<1 AND we couldn't
    find an opaque ancestor (effectiveBg null), skip the contrast
    finding. Covers any remaining FP class the deeper fixes miss.

Verified end-to-end against an Opus iter-1 artifact on Tailwind v4 with
14 cream/cream FPs + 2 blue-link UA FPs before; 0 findings after, while
the color.html fixture's 12 real low-contrast cases continue to flag
(verified via direct detectHtml calls).

cli/engine/detect-antipatterns-browser.js is the generated browser
distribution — regenerated from .mjs via scripts/build-browser-detector.js
(no manual edits to the generated file).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* craft.md: tighten verbose passages, de-codex Step 6, cut redundancies

Cumulative reduction: 218 → 155 lines (-29%).

Step 0: drop the "Why this matters" paragraph at the end. The body of
Step 0 already makes the framework-pick point; the paragraph just
re-explains it with extra rhetoric.

Step 1: replace the 4-sentence "you must end your response" block with a
single line. The original said the same thing three different ways.

Step 3: trim the conditional / defensive scaffolding (Purpose subsection,
"do not skip because the eventual UI is semantic..." paragraph,
duplicated approval-loop guidance). Mock fidelity inventory preserved.

Step 4: drop the "keep UI text semantic" sentence; it duplicates Step 5's
"Semantic first" rule. The rasterized-vs-semantic decision rule stays.

Step 5: tighten each production-bar bullet to bold-lead + specifics
format. All 15 rules preserved (real content, mock ingredients, semantic
first, spacing/alignment, typography, state coverage, interaction quality,
icon set, build pipeline, image URL verification, optimized imagery,
premium motion, maintainability, technical cleanliness, ask-when-uncertain).

Step 6: rewrite around "look at what you built like a designer would —
your eyes are whatever the harness gives you." Drops Codex-specific
"In Codex, use browser-use" bias. Drops the verbose 3-step Read pattern
(condensed to one sentence). Drops the 1-8 numbered checklist (replaced
by a tight paragraph). Keeps the load-bearing rules: read the PNG,
don't fabricate iteration, mock fidelity reference, exit bar = studio
defensibility.

Step 7: drop the closing "Iterate based on feedback. Good design is
rarely right on the first pass" preachy filler.

All em-dashes converted to semicolons / colons / periods to satisfy
the skill prose validator.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* build: native subagent pipeline + Codex-only asset producer

Adds an agent cross-compile pipeline alongside the existing skill
pipeline. Sources live at skill/agents/*.md; providers that declare
agentFormat (codex-toml, claude-md) emit native subagent files. An
optional providers: <list> field on an agent gates which harnesses
get a copy; default (no field) ships everywhere.

The impeccable-asset-producer agent is opt-in to Codex only. It's
useful for Codex's native image generation path and is untested
elsewhere; Claude has no native image gen anyway.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* brand: inverse-test + cultural-symbol palette guardrail

Two additions to the brand register reference:

- Inverse slop test: describe the page the way a competitor would
  describe theirs. If that sentence fits the modal landing page in
  the category, restart.
- Palette guardrail: when a cultural-symbol palette is the obvious
  pull, reach past it. Let cultural reading come from typography,
  imagery, and copy.

Harness mirrors regenerated; some also catch up to the image-
verification paragraph from e3ad2ef that hadn't been re-synced.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* PRODUCT.md: widen audience beyond developers

Designers, product managers, and engineers all use AI coding tools
and want better design output. Keeping the audience narrow to
"frontend and full-stack developers" understates who the skill is
actually for. Also retitles "developer" to "user/builder" in the
purpose statement.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* site + build: bump rule count to 29, strip changelog from detector check

Two changes:
- site/pages/index.astro: three live mentions of "28 rules / checks"
  bumped to 29 after the body-text-viewport-edge rule landed in
  b9bf496.
- scripts/build.js: the detection-count validator was reading the
  unstripped content, so historical counts inside changelog entries
  (e.g. "28 rules" from an older release note) were flagging against
  the current detector total. The command-count check already strips
  the changelog ul; the detection check now does the same.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* test: align hero-eyebrow-chip fixture with relaxed rule gates

b9bf496 intentionally relaxed two gates in checkHeroEyebrow:
- removed the heading-size ≥ 48px anchor (modern hero h1s use
  clamp/vw/var that jsdom can't resolve)
- raised the eyebrow text ceiling from 30 to 60 chars

Two fixture cases that satisfied the negative side of the old gates
now match the rule:

- "Body-Sized Heading Below Eyebrow" — 24px h1 with tracked-caps
  label above. Per the rule's stated intent ("a tiny tan label
  directly above any h1 is the antipattern regardless of how big
  the h1 ends up"), this is a flag.
- "Long Uppercase Sentence Above Hero" — 46-char tracked-caps label
  is under the new 60-char ceiling, so still eyebrow-shaped.

Both cases moved from the should-pass column to should-flag, with
case descriptions rewritten to explain the gate they exercise.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Paul Bakaus <paulbakaus@pauls-mbp-3.lan>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 23:11:18 -07:00
Paul Bakaus 3d3cc156c5 Remove tracked .codex skill tree from repository
Made-with: Cursor
2026-04-17 17:32:37 -07:00
Paul Bakaus 59bb3d35a5 Stop syncing repo-local Codex skill 2026-04-13 14:15:34 -07:00
Paul BakausandClaude Opus 4.6 4092ee5f22 Move PID file to project root (.impeccable-live.json)
os.tmpdir() returns /var/folders/.../T/ on macOS, not /tmp/. The skill
reference was telling the agent to cat /tmp/impeccable-live.json which
didn't exist. Moving the PID file to the project root makes it
predictable across platforms and project-scoped (multiple projects can
run independent live sessions).

Changed in: live-server.mjs, live-poll.mjs, live.md reference.
Added .impeccable-live.json to .gitignore.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 12:32:42 -07:00
Paul BakausandClaude Opus 4.6 4b52756edd Fix live server startup: read port/token from PID file after background start
The server is started with & (backgrounded), so its stdout output isn't
captured by the agent's Bash tool. The skill reference now tells the
agent to sleep 2s then cat the PID file (/tmp/impeccable-live.json) to
get the port and token. The PID file is written by the server as soon
as it starts listening.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 10:37:45 -07:00
Paul BakausandClaude Opus 4.6 0a1e5614e9 Add global floating bar with detect/pick toggles
Compact floating pill at the bottom center of the viewport, always
visible during live mode. Matches the action bar's light, translucent
aesthetic with brand-tinted active states.

Controls:
- "Impeccable" brand mark (capitalized, brand magenta)
- Detect toggle: eye icon, loads anti-pattern scanner in extension mode,
  waits for impeccable-ready before first scan, shows issue count badge
  inside the button. Toggle off removes overlays.
- Pick toggle: crosshair icon, enables/disables element picker. Active
  by default. When pick is active, detect overlays get pointer-events:
  none so the picker sees through them.
- Exit button: sends exit event and tears down all UI.

Detect + pick coexistence fixes:
- Picker highlight z-index raised above detect overlays (100001 vs 99999)
  so the selection outline and element path are always visible.
- Removed layout-property transitions (top/left/width/height) from the
  highlight to avoid triggering the anti-pattern detector and to give
  instant cursor tracking.
- First-click-on-detect fix: script loads async, scan command is queued
  until the impeccable-ready postMessage arrives.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 10:35:48 -07:00
Paul BakausandClaude Opus 4.6 52b050bb7e Fix 5 bugs from real-world live mode testing
1. Skill reference: poll should run as background task with no timeout.
   Changed "blocking poll loop" to "background task, no timeout" so the
   agent keeps the main conversation free for other work.

2. Resume restores selectedAction from localStorage: the bar was showing
   "Freeform" after page reload even when the user picked "Bolder". Also
   improved selectedElement targeting to prefer the visible variant's
   content over the wrapper parent.

3. Discard no longer shows "Applying variant...": accept shows the
   saving→confirmed flow, but discard now dismisses immediately and
   cleans up the DOM. Different intent, different UX.

4. Picker works after discard: cleanup() now removes the variant wrapper
   from the live DOM and restores the original element. Previously the
   stale wrapper with data-impeccable-variant attributes confused the
   picker's isPickable/own checks.

5. Stop live mode: added "Stopping Live Mode" section to the skill
   reference. The user can say "stop live mode" in the conversation, and
   the agent proceeds to cleanup (remove script tag, stop server).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 10:04:31 -07:00
Paul BakausandClaude Opus 4.6 e4d1d96926 Auto-generate argument hint with all commands grouped by category
The static "[command] [target]" hint didn't help users discover available
commands. The build now reads command-metadata.json and groups commands
by category (from SKILL_CATEGORIES) with middle-dot separators for
natural line-breaking in the prompt bar.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 09:22:09 -07:00
Paul BakausandClaude Opus 4.6 455fe39155 Add 41 tests for live-wrap and live-server, add auto-execute guards
Tests:
- tests/live-wrap.test.mjs (26 tests): unit tests for buildSearchQueries,
  findElement, findClosingLine, detectCommentSyntax (20 pure function
  tests) + integration tests for the full wrapCli on HTML and JSX
  fixtures with temp dirs (6 tests covering wrapping, ID/class lookup,
  error handling, content preservation).

- tests/live-server.test.mjs (15 tests): integration tests that start a
  real server on port 8499, then test /health, /live.js, /detect.js,
  /poll (timeout + auth), /events POST (validation + auth), browser→agent
  event flow (POST event → poll receives it), agent→browser SSE flow
  (POST reply → SSE stream delivers it), /source (read, path traversal
  rejection, auth, 404).

Also:
- Added auto-execute guards to live-wrap.mjs and live-poll.mjs so they
  work when run directly with `node live-wrap.mjs ...` (needed for both
  skill instructions and integration tests).
- Exported buildSearchQueries, findElement, findClosingLine,
  detectCommentSyntax from live-wrap.mjs for unit testing.
- Updated package.json test script to include the new test files.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 19:35:26 -07:00
Paul BakausandClaude Opus 4.6 7011a523e0 Remove live commands from CLI, delete src/live, add server-lost cleanup
1. CLI cleanup: removed live, poll, and wrap commands from bin/cli.js
   and the liveCli export from detect-antipatterns.mjs. These now live
   exclusively in the skill scripts (node scripts_path/live-server.mjs).

2. Deleted src/live/: server.mjs, poll.mjs, wrap.mjs, browser.js,
   protocol.mjs. The source of truth is now source/skills/impeccable/
   scripts/live-*.

3. Graceful server-lost handling: the browser tracks SSE reconnection
   attempts (max 5). After exhausting retries, it cleans up the UI:
   hides the bar, highlight, and cycler, shows a "Live server
   disconnected" toast, resets state to IDLE. This handles agent
   crashes, server kills, and network issues without leaving the
   browser stuck in a "Generating..." state.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 19:25:29 -07:00
Paul BakausandClaude Opus 4.6 5bad08723d Replace WebSocket with SSE, move live scripts into skill (self-contained)
Two architectural changes that make the live variant mode self-contained:

1. SSE replaces WebSocket: the server now uses Server-Sent Events for
   server→browser push and regular fetch POST for browser→server
   events. This eliminates the ws npm dependency entirely. The live
   server is now zero-dependency pure Node.js (http, crypto, fs, net).

   Browser: EventSource replaces WebSocket. sendEvent() uses fetch POST.
   Server: GET /events returns SSE stream, POST /events receives browser
   events. All other endpoints (poll, source, health, stop) unchanged.

2. Scripts moved to source/skills/impeccable/scripts/: live-server.mjs,
   live-poll.mjs, live-wrap.mjs, live-browser.js are now part of the
   skill itself. Users who install the skill via npx skills get the live
   mode without needing npm install impeccable separately.

   The skill reference uses {{scripts_path}}/live-server.mjs etc.
   The CLI (bin/cli.js) delegates to the skill scripts as a convenience.

   Removed ws from package.json dependencies.

The old src/live/ files remain as the development copy. The build system
syncs source/skills/ to all harness dirs (11 providers).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 19:19:36 -07:00
Paul BakausandClaude Opus 4.6 4535525f8e Add wrap CLI helper and optimize agent generation loop
Three optimizations to cut the generate loop from ~40s to ~15-20s:

1. wrap CLI helper (src/live/wrap.mjs): finds an element in source
   by ID, class names, or tag+class combo, wraps it in the variant
   container with original snapshot, and returns the file path + insert
   line. Replaces 3-4 agent tool calls (grep + read + edit) with one.

   Supports --element-id, --classes (comma-separated), --tag, --query
   (fallback). Searches in priority order: ID > class combo > single
   class > raw text. Auto-detects comment syntax (HTML vs JSX).

2. Batch variant writes: skill reference updated to instruct the agent
   to write ALL variants in a single file edit instead of one per
   variant. Saves N-1 tool call round-trips (~3-5s each).

3. Page URL in generate event: browser now includes location.pathname
   so the agent can map URL to source file directly (/ = index.html,
   /about = about.tsx, etc.) without grepping.

Net effect: agent flow is now 4 tool calls (wrap + edit + read-variant
+ poll-reply) instead of 8+ (grep + read + create-wrapper + N edits
+ poll-reply).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 18:32:51 -07:00
Paul BakausandClaude Opus 4.6 bb94dadda0 Add live variant mode: element picker, action panel, poll/reply bridge (22 commands)
New feature: /impeccable live starts an interactive visual iteration server.
Users select elements in the browser, pick a design action (bolder, quieter,
etc.), and the agent generates HTML+CSS variants written directly to source.
The dev server's HMR hot-swaps them in, and MutationObserver progressively
reveals each variant in a cycler UI as it arrives.

Architecture:
- src/live/server.mjs: HTTP + WebSocket server with session token auth,
  long-poll /poll endpoint for the agent, WebSocket for the browser
- src/live/poll.mjs: CLI client (npx impeccable poll / poll --reply)
- src/live/browser.js: element picker with keyboard nav (arrows=siblings,
  shift+arrows=parent/child), action panel (12 commands, freeform input,
  variant count), variant cycler with progressive reveal via MutationObserver
- src/live/protocol.mjs: shared message types and event validation
- source/skills/impeccable/reference/live.md: agent loop instructions
  (inject script, poll loop, generate variants, accept/discard, cleanup)

CLI changes:
- bin/cli.js: added "poll" top-level command
- src/detect-antipatterns.mjs: liveCli() now delegates to src/live/server.mjs
- package.json: added ws dependency

Registered /impeccable live as command #22 across all standard locations.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 17:13:53 -07:00
Paul BakausandClaude Opus 4.6 e58cbc432f Split /onboard back out as its own command (21 commands total)
Pre-3.0, onboard was folded into /harden when we were trying to reduce
namespace pollution. In the single-skill model that tradeoff is gone,
so the weakest of the old merges is the first to undo.

Harden and onboard live in different mental modes. Harden is defensive
(edge cases, i18n, overflow, errors). Onboard is activation (first-run
flows, empty states as CTAs, progressive disclosure). A user thinking
"design the onboarding flow" was never going to type /impeccable harden.

Changes:
- New reference file at source/skills/impeccable/reference/onboard.md,
  restored from the pre-merge version in git history rather than the
  condensed 33-line summary that was in harden.md.
- Removed the "Onboarding & First-Run Experience" section from
  source/skills/impeccable/reference/harden.md.
- Updated harden description/editorial/process-steps to drop onboarding
  keywords; split commandProcessSteps so harden stays focused on
  production resilience and onboard gets its own phases.
- Registered onboard in: SKILL.md description + command menu + router
  table, command-metadata.json, IMPECCABLE_SUB_COMMANDS, pin.mjs
  VALID_COMMANDS, SKILL_CATEGORIES, COMMAND_RELATIONSHIPS, data.js
  commandCategories + commandProcessSteps + commandRelationships,
  framework-viz commandSymbols + commandNumbers.
- Reused the existing content/site/skills/onboard.md editorial wrapper
  (it was orphaned by the merge but never deleted), updating it to use
  /impeccable onboard.
- Bumped all user-facing count references 20 -> 21: public/index.html,
  CLAUDE.md, README.md, NOTICE.md, plugin.json, marketplace.json,
  sitemap.xml, build-sub-pages.js.
- Harness dir audit.md and critique.md changes are the
  {{available_commands}} placeholder expanding to include onboard.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 19:21:45 -07:00
Paul BakausandClaude Opus 4.6 2233d82f3a Bump skills to 3.0, remove prefixed bundle, redesign install section
- Bump skills plugin version 2.1.1 -> 3.0.0 (plugin.json, marketplace.json,
  harness SKILL.md files). CLI and Chrome extension unchanged.
- Remove prefixed universal zip bundle and all related code:
  factory.js prefix/outputSuffix options, zip.js variant pass, utils.js
  prefixSkillReferences, the "universal-prefixed" entry in
  download-providers.js, and the matching test suite in utils.test.js.
- Redesign Get Started step 1 "Install the skill and CLI": two terminal
  rows (npx skills + npm i -g impeccable) with paired notes, drop the
  Recommended badge.
- Collapse "Other install methods" back into a <details> element so the
  primary install path is the first thing users see.
- Simplify step 3 to "Add the Chrome extension": remove the CLI tool
  block (now in step 1), use standard .btn .btn-primary for the CTA so
  it matches other primary buttons (square corners, accent slide-up
  hover), and lay out the preview screenshot next to the button instead
  of stacked so the screenshot no longer dominates vertical space.
- CLAUDE.md: rewrite with v3.0 architecture, the "no em dash also means
  no --" rule, the harness-dirs-are-tracked gotcha, the named-export
  test-spy warning, and the evals inline-skill.ts sync note.
- AGENTS.md, DEVELOP.md: drop prefixed variant references.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 20:28:07 -07:00
Paul BakausandClaude Opus 4.6 b0f44f83c6 Consolidate 18 skills into 1 /impeccable skill with 20 commands
Biggest change in a while. Users previously had 18 standalone skill
entries cluttering their /menu; now they have one entry (/impeccable)
that routes to 20 specialized commands via argument dispatch. The pin
mechanism (/impeccable pin audit) restores standalone shortcuts on
demand for commands users hit all the time.

## Architecture

- Single /impeccable skill with command router section in SKILL.md
- 20 commands served via reference files under source/skills/impeccable/reference/
- /impeccable pin <command> creates a lightweight redirect shim so users
  who prefer /audit, /polish, etc. can still have them
- Context gathering (teach) auto-runs on first use
- command-metadata.json is the single source of truth for command
  descriptions, argument hints, and relationships

## Site rewrite

- Docs URL: /skills renamed to /docs (with /skills permanent redirects)
- Homepage hero frames Impeccable as "one skill with 20 commands"
- "Get Started" split into 50/50 install + how-to-use with editorial
  numbered steps, /impeccable shown as the home command with three modes
- New /docs overview: home command hero card + dense category rows
  matching the old cheatsheet density, with leads-to/pairs-with/
  combines-with relationship metadata served from a shared source
- Cheatsheet merged into /docs, /cheatsheet redirects
- Magazine spread and mobile cards show /impeccable as a stacked
  namespace label above the command name at full display size
- Periodic table updated with craft/teach/extract as first-class cells
- Skill detail pages generate from reference files, with an editorial
  wrapper per command for tagline + body
- Tutorials and anti-patterns pages updated to use /impeccable <cmd>

## Build system

- Dead code removed (scripts/lib/transformers/shared.js)
- Build log wording fixed ("1 skill" not "1 skills (1 user-invocable)")
- generateApiData fallback branch removed (throws loudly if metadata
  missing instead of silently degrading)
- Commands API includes editorial tagline alongside the long description;
  UI surfaces prefer tagline for human display, description for auto-
  trigger keyword matching

## Gitignore

- Added .claude/scheduled_tasks.lock, .claude/settings.local.json to
  ignore list (local Claude Code state that should not be tracked).
- Harness skill directories (.claude/skills/, .agents/skills/, etc.)
  remain tracked by design: npx skills reads them from this repo at
  install time and they enable clean submodule use.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 19:45:17 -07:00
Paul BakausandClaude Opus 4.6 7670d1325a Show actual skills version, not CLI version; normalize version for hash
- Build system now injects skills version (from plugin.json) into
  every SKILL.md frontmatter as a version field
- CLI reads the version from the local impeccable SKILL.md and
  displays it in check/update output
- Hash comparison normalizes the version field (so a version bump
  alone doesn't trigger a full re-download)
- Removed misleading CLI version display from skills commands

CLI bumped to v2.1.5.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 11:18:06 -07:00
Paul BakausandClaude Opus 4.6 45b92bf9fe Improve cleanup UX: explain to user why files are being deleted
The post-update-cleanup section now instructs the AI to tell the user
what's happening and why before running the script, so file deletions
don't feel unexpected.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 09:49:50 -07:00
Paul BakausandClaude Opus 4.6 c2b72b9d44 Fix: factory transformer was not copying skill scripts to dist
The refactored factory.js transformer dropped script file support that
existed in the old shared.js version. Scripts were read from source
but never written to dist/, so npx skills installed skills without the
cleanup-deprecated.mjs script, causing errors on first load.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 09:43:50 -07:00
Paul BakausandClaude Opus 4.6 f30475cdf4 Remove deprecated source stubs, update FAQ and install copy, add CLI cleanup
- Delete source/skills/ directories for deprecated skills (arrange,
  normalize, onboard, extract, frontend-design, teach-impeccable).
  The cleanup script handles migration; stubs are no longer needed.
- Add "npx skills update" command to the Stay Updated install section
- Rewrite FAQ update answer: lead with npx skills update, add
  troubleshooting for failed updates (re-install + run /impeccable)
- Run cleanup script in `npx impeccable skills update` before
  delegating to npx skills update, preventing failures from
  deprecated entries in skills-lock.json
- Run cleanup script after `npx impeccable skills install` to remove
  leftover files from previous versions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 09:34:38 -07:00
Paul BakausandClaude Opus 4.6 22b7adf56f Strip deprecated skill stubs from local harness dirs after build sync
The build still generates deprecated stubs in dist/ (so the cleanup
script can redirect users), but now removes them from the repo's own
harness directories so they don't clutter the local skill list.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 09:19:53 -07:00
Paul BakausandClaude Opus 4.6 a5db82143c Refactor impeccable skill to reduce monoculture from negative prescriptions
The skill's "don't use Inter / don't use dark / don't center" negatives
were creating new attractors (the model picks Fraunces / light / grid
instead, every time). Inline always-applicable principles into SKILL.md,
add a font selection anti-attractor procedure that forces the model to
enumerate AND reject its reflex defaults, switch high-stakes blocks to
XML structure, tighten side-tab and gradient-text bans to specific CSS
patterns, ban Syne explicitly, and strip named font/color prescriptions
from the references. Validated against the internal eval framework on
Qwen 3.6 Plus across 7 niches: Fraunces dropped from 92% to 0% on kids
reading, side-tabs from 76% to 20% on vintage moto, no theme regressions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 11:38:52 -07:00
Paul BakausandClaude Opus 4.6 e1032b7285 Add icon-tile-stack rule and cross-validate engine against skill
A new icon-tile-stack detection (the canonical AI feature-card with a
small rounded-square icon container above a heading), backed by a
two-column TDD fixture, plus a single-source-of-truth design that ties
the engine to the impeccable skill so they can no longer drift silently.

Detection
- New icon-tile-stack rule (slop): heading's previousElementSibling is
  a 32–128px rounded-square element with a non-transparent background
  or border, contains an svg/icon-i child, and sits above (not next to)
  the heading. Excludes round avatars, wide thumbnails, side-by-side
  layouts, tiny icons, and hero images.
- Two-column fixture convention: a single icon-tile-stack.html with a
  flag column (4 cases) and pass column (6 cases), with snippet-text
  matching used by the fixture test.

Single source of truth
- Each ANTIPATTERNS entry can now declare skillSection + skillGuideline.
  18 of 25 rules carry these fields; the build's new
  validateAntipatternRules() in scripts/build.js fails if any declared
  skillGuideline isn't found verbatim in the right SKILL.md section.
- scripts/build-extension.js now includes the description field in
  extension/detector/antipatterns.json (it was previously dropped).
- The existing count validator was promoted from warn to error so
  command count drift fails the build the same way detection drift does.

Impeccable skill DON'Ts
- Added 4 new top-level DON'Ts that target real default AI behavior:
  single-font, flat-type-hierarchy, all-caps-body, line-length.
- Cut 7 new DON'Ts I had drafted (tight-leading, tiny-text, wide-tracking,
  justified-text, low-contrast, cramped-padding, skipped-heading) because
  they teach things every model already knows from CSS/a11y basics. The
  detector still catches all of them.

Stale count cleanup
- 22 commands → 21 across 17 references in HTML, README, NOTICE, AGENTS,
  plugin.json, marketplace.json (left over from the validate skill removal).
- Dropped the hand-coded "212 design guidelines" marketing copy on the
  homepage, which never mapped to any real count.

Sub-agent
- New private .claude/agents/anti-patterns.md captures the full TDD
  recipe, schema, plug-in points, jsdom constraints, and pre-commit
  checklist so future sessions can add rules end-to-end without
  re-investigating the wiring.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 22:58:13 -07:00
Paul BakausandClaude Opus 4.6 bb4de8ed9b Sync built skill outputs after validate skill removal
Updates the per-provider built skill files (.agents/, .claude/, .codex/,
.cursor/, .gemini/, .kiro/, .opencode/, .pi/, .rovodev/, .trae-cn/, .trae/)
to reflect the source removal of the /validate skill: deletes the
validate/SKILL.md output across all providers, drops /validate from the
command lists in audit and critique, and updates the impeccable craft
reference.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 21:34:37 -07:00
Paul BakausandClaude Opus 4.6 8531503f2c Rename /craft to /shape, add /impeccable craft, remove "--" pattern
- Rename /craft skill to /shape and make it planning-only (no code output)
- Add /impeccable craft sub-command that calls /shape, loads references,
  builds with visual iteration until delightful
- Replace all " -- " (em dash substitutes) with proper punctuation across
  all skill files and index.html
- Move v1.6 changelog entry to "View older releases" section

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 20:07:02 -07:00
Paul BakausandClaude Opus 4.6 d8d5b8acd8 Move CLI to separate repo, make this skills-only (Apache 2.0)
The CLI and detection engine now live in pbakaus/impeccable-detect
(published as 'impeccable' on npm, BSL-1.1). This repo is purely
Apache 2.0: skills, prompts, website, and build system.

- Remove bin/ (CLI moved to CLI repo)
- Remove README.npm.md (moved to CLI repo)
- Remove @impeccable/detect dependency, add impeccable dependency
- Set package.json to private (no longer published to npm)
- Update all references from @impeccable/detect to impeccable
- Update CLAUDE.md, NOTICE.md, FAQ, and changelog
- Rebuild all provider skill distributions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 18:59:19 -07:00
Paul BakausandClaude Opus 4.6 3974789903 Remove detection engine files, now in @impeccable/detect package
Remove all detection engine source, tests, fixtures, and build scripts
that have been extracted to the @impeccable/detect package (BSL-1.1).

- Delete source/skills/critique/scripts/ (detect-antipatterns.mjs, browser.js)
- Delete scripts/build-browser-detector.js
- Delete tests/detect-antipatterns*.test.* and tests/fixtures/antipatterns/
- Delete .claude/skills/critique/scripts/detect-antipatterns-browser.js
- Update scripts/build.js to read detection count from npm package
- Update server/index.js to serve browser script from npm package
- Update CLAUDE.md to reference @impeccable/detect
- Update package.json test script (detection tests removed)
- Update .gitignore (remove obsolete browser script entry)
- Rebuild all provider skill distributions with updated critique skill

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 16:32:57 -07:00
Paul BakausandClaude Opus 4.6 99bc9d48ad Revert critique sub-agent over-engineering, add Codex spawning guidance
Reverts Codex's overly bureaucratic sub-agent delegation changes (permission
prompts, "not fully compliant" disclaimers) back to clear, practical language.
Uses RFC-style SHOULD for sub-agent delegation with named examples for both
Claude Code (Agent tool) and Codex (natural language spawning).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 20:29:18 -07:00
Paul BakausandClaude Opus 4.6 3f7b5fd8bf Redesign Antidote section: card stack gallery, tabbed patterns, new skills
Replace the sliding accordion with a 3D card stack for Gallery of Shame
(bottom-right deck offset with scroll/button nav). Patterns now use clean
pill tabs with single-column Don't/Do layout in a white container.

Also scaffolds two new skills: /validate (fast visual validation after UI
changes) and /craft (guided feature design through user interview).

Fixes detection count from 25 to 24, changes badge from "Deterministic"
to "New!".

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 09:59:11 -07:00
Paul BakausandClaude Opus 4.6 bdc23f02c7 Redesign Antidote section: horizontal disclosure, gallery sidebar, detection callout
- Replace tabbed pattern viewer with animated horizontal disclosure
  (inspired by jh3y/XJWNMOO): CSS Grid column transitions, hover to
  expand, rotated vertical labels, icon anchored at bottom
- Don't/Do toggle in each panel (defaults to Don't)
- Gallery of Shame as 2-column thumbnail sidebar beside the disclosure
- Detection callout as horizontal strip below
- Responsive: stacks at 1060px, gallery becomes 3-col grid
- Remove all em dashes from anti-pattern text (AI slop tell)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 16:52:11 -07:00
Paul BakausandClaude Opus 4.6 f683f413c8 Rename frontend-design to impeccable, fold teach-impeccable into teach mode
Major skill consolidation for v2.0:

- Rename source/skills/frontend-design/ to source/skills/impeccable/
  with user-invocable: true and argument-hint: "[teach]"
- Fold teach-impeccable body into impeccable as "Teach Mode" section,
  activated via /impeccable teach
- Create deprecation shims:
  - frontend-design: redirects to /impeccable
  - teach-impeccable: redirects to /impeccable teach
- Update all 16 skill cross-references from {{command_prefix}}frontend-design
  to {{command_prefix}}impeccable and {{command_prefix}}teach-impeccable to
  {{command_prefix}}impeccable teach
- Update CLI sentinel detection to use 'impeccable' (with teach-impeccable
  as legacy fallback)
- Update build system readPatterns() path and EXCLUDED_FROM_SUGGESTIONS
- Update all public files (data.js, cheatsheet, index, viz, demos)
- Update all documentation (README, NOTICE, AGENTS, plugin.json)
- Update all test expectations

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 14:04:54 -07:00
Paul BakausandClaude Opus 4.6 3f86b72c88 Isolate browser tabs for critique sub-agents to prevent interference
Each assessment now creates its own tab and labels it ([LLM] or [Human])
so parallel sub-agents don't fight over the same page state.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 22:30:00 -07:00
Paul BakausandClaude Opus 4.6 efcfd5dadd Merge main into v2.0: consolidate critique skill with scoring, personas, and detection
Merges 54 commits from main including factory-based build system, Trae support,
improved skill descriptions, and security hardening. Consolidates the critique
skill to combine v2.0's sub-agent architecture and automated anti-pattern
detection with main's Nielsen heuristics scoring, cognitive load assessment,
persona-based testing, and structured follow-up workflow. Fixes browser detector
build to create target directory after skill sync.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 22:20:04 -07:00
Paul BakausandClaude Opus 4.6 a9bf70f1ab Refine critique and audit skills based on review feedback
- Collapse inline cognitive load section into reference pointer
- Differentiate audit (technical, code-level) from critique (UX, holistic)
- Add MANDATORY PREPARATION block to audit for context gathering
- Rename Riley persona to "Deliberate Stress Tester", remove pricing focus
- Restore stripped checklist items, persona examples, and emotional journey detail
- Restore "Don't soften criticism" and IMPORTANT/NEVER lines in audit
- Restore constraints question in Phase 3
- Fix em dash formatting (use proper — not --)
- Shorten descriptions while preserving key trigger terms

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 16:57:47 -07:00
Paul BakausandClaude Opus 4.6 85e6d99fde Merge main and resolve frontmatter conflicts
Combine PR's enhanced descriptions (scoring, personas, cognitive load)
with main's argument-hint format. Rebuild all providers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 16:07:38 -07:00