Commit Graph

64 Commits

Author SHA1 Message Date
John Lindquist 8e3350454c feat: prompt scoring improvements, compaction re-injection, validation dedup, strip droppedByCap from context; bump to 0.18.0
- Add dominant-topic suppression (top score >= 600 filters scores < 50)
- Add project-context boost (+3 for VERCEL_PLUGIN_LIKELY_SKILLS skills)
- Add lexical fallback floor (reject raw score < 20)
- Add compaction re-injection for priority >= 7 skills (VERCEL_PLUGIN_CONTEXT_COMPACTED)
- Add validation rule dedup tracking (ruleId + filePath on violations)
- Strip droppedByCap from injected HTML comments (kept in debug logs)
- Fix ncc/SKILL.md and next-forge/SKILL.md YAML frontmatter
- Add startup diagnostic for broken skill frontmatter
2026-03-11 19:01:59 -06:00
John Lindquist b7e9b1b053 feat: merge upstream telemetry + Cursor compat, fix tests and dedup migration; bump to 0.17.0 2026-03-11 16:12:55 -06:00
John Lindquist 8e24d0694a feat: add chainTo skill chaining, prompt signals, validation upgrades, and dedup reset on context clear
Add a chainTo frontmatter field to skills that triggers follow-up skill injection
when PostToolUse file contents match regex patterns. Add upgradeToSkill/upgradeWhy
fields to validation rules so validate errors can recommend loading a specific skill.
Register posttooluse-bash-chain.mjs in hooks.json. Add ChainToRule interface to
patterns.mts and skill-map-frontmatter.mts, with parseChainToRules() parser. Add
duplicate-key detection to the YAML parser. Reset dedup claim dir and session file
on clear/compact events in session-start-seen-skills so skills re-inject into fresh
context windows.

Add chainTo rules to: agent-browser-verify, agent-browser, ai-elements, ai-gateway,
ai-generation-persistence, ai-sdk, auth, bootstrap, chat-sdk, cms, cron-jobs,
deployments-cicd, email, env-vars, geist, investigation-mode, json-render,
marketplace, micro, ncc, next-forge, nextjs, observability, payments,
react-best-practices, routing-middleware, runtime-cache, satori, shadcn,
sign-in-with-vercel, swr, turbopack, turborepo, v0-dev, vercel-agent, vercel-api,
vercel-cli, vercel-firewall, vercel-flags, vercel-functions, vercel-queues,
vercel-sandbox, vercel-storage, verification, workflow. Add upgradeToSkill to
ai-elements and ai-sdk validate rules. Expand ai-sdk validate messages with
Run Skill() hints. Update nextjs, vercel-storage, runtime-cache, workflow, turborepo
skill bodies.

Add new skills: geistdocs (Geist design system docs), zzz-test-meta-name-mask
(test fixture). Add skills/_chain-audit.md chain coverage audit doc.

Delete .claude-plugin/marketplace.json, .claude-plugin/plugin.json (deprecated),
skills/edge-runtime/SKILL.md (consolidated into vercel-functions).

Add tests: posttooluse-chain.test.ts (4699 lines, chain injection e2e),
ai-sdk-companion.test.ts (181 lines). Expand build-skill-map.test.ts (+335 lines),
validate-rules.test.ts (+936 lines), session-start-seen-skills.test.ts (+74 lines),
skill-map-frontmatter.test.ts (+50 lines), verification-skill.test.ts (+20 lines).

Update build-manifest.ts to emit chainTo rules and upgradeToSkill fields. Rebuild
generated/skill-manifest.json, generated/skill-catalog.md, generated/build-from-skills.manifest.json.
Rebuild all compiled hooks/*.mjs. Update CLAUDE.md lexical prompt default to on.
Update vercel.md ecosystem graph, docs, and cli-reference.
2026-03-11 15:18:35 -06:00
John Lindquist f438cb7313 fix(skills): normalize manifest regex escaping
Regenerate the skill manifest so the new micro and deployments-cicd validate rules use the canonical escaping emitted by build:manifest.
The prior shared-index commit captured non-canonical escaping in generated/skill-manifest.json.

Verified: bun run build:manifest
Verified: git diff --cached -- generated/skill-manifest.json shows only the 2 regex escaping normalizations
Swarm-Agent: codex-rules-wave2b
2026-03-11 15:16:21 -06:00
John Lindquist 875a9e7d20 test(upgrade-rules): cover skill upgrade validate fixtures
Add focused fixture tests for each current upgradeToSkill validate rule.
Each case asserts the positive trigger and the skipIfFileContains path so future SKILL.md changes do not silently break upgrade guidance.

Verified: bun test tests/upgrade-rules.test.ts
How to test: bun test tests/upgrade-rules.test.ts
Swarm-Agent: codex-test-fixtures
2026-03-11 15:16:21 -06:00
John Lindquist a6077bb0c8 feat(skills): add validate upgrades to three skills
Add top-level validate blocks to react-best-practices, auth, and routing-middleware so the manifest can recommend SWR, Sign in with Vercel, and Vercel Firewall/WAF when legacy patterns are detected.

Verified: bun run build:manifest
Verified: git diff -- generated/skill-manifest.json shows only these three skills gained validate entries
Swarm-Agent: codex-rules-wave2a
2026-03-11 15:16:21 -06:00
John Lindquist ca89a80912 feat(nextjs): add upgrade validate rules for auth, functions, and caching
Add three Next.js validate rules that recommend upgrading legacy auth, Pages Router API routes, and in-memory caches to dedicated Vercel skills.
Regenerate the static skill manifest so the new upgrade metadata is available at runtime; this also syncs a few pre-existing source-of-truth manifest entries that were stale in the generated file.

Verified: bun run build:manifest (isolated clean checkout based on HEAD + skills/nextjs/SKILL.md)
Verified: git diff --cached --check
Swarm-Agent: codex-commit-nextjs
2026-03-11 15:16:21 -06:00
John Lindquist 7a124e6561 Add sitemap field to skill metadata: parse metadata.sitemap in skill-map-frontmatter.mts, add sitemap to SkillConfig interface and KNOWN_KEYS, render sitemap URLs in buildDocsBlock() alongside doc links, include sitemap in generated manifest, and add sitemap URLs to 35 SKILL.md files for domains that have sitemap.xml. Also fix 15 broken doc URLs across 14 skills (vercel.com/docs path changes, anthropic docs, stripe, descope, flags-sdk, ai-sdk). Bump to 0.16.1. 2026-03-10 14:31:40 -06:00
John Lindquist 17be9898ea Add sitemap field to SkillConfig and inject sitemap URLs alongside doc links in the docs warning block. For each skill, find the sitemap.xml URL for its primary documentation domain and add it as metadata.sitemap in SKILL.md frontmatter. Update buildDocsBlock() in patterns.mts to render sitemap URLs parenthetically after doc links. Parse and validate the new field in skill-map-frontmatter.mts, include it in the generated manifest via build-manifest.ts, and propagate the type through pretooluse and user-prompt-submit hooks. 35 of 46 skills now have sitemaps (8 skipped: domains without sitemaps). Rebuild hooks and manifest. 2026-03-10 14:29:36 -06:00
John Lindquist 5dffded3d5 Replace skill body injection with Skill tool invocation; bump to 0.16.0
Instead of injecting full SKILL.md bodies as additionalContext, hooks now
inject "You must run the Skill(<name>) tool." — leveraging the conventional
Skill tool mechanism for context loading.
2026-03-10 12:46:54 -06:00
John Lindquist d5b5ef47f7 Replace skill body injection with Skill tool invocation instructions
Instead of injecting the full SKILL.md body as additionalContext, inject
"You must run the Skill(<name>) tool." — a more conventional way of
telling the agent to use the Skill tool for context loading.
2026-03-10 12:46:11 -06:00
John Lindquist ad4127d120 In the ai-sdk and ai-elements skills, make AI Elements mandatory for ALL AI-generated text displayed in browser UIs — remove every escape hatch that lets agents skip it. Specifically: remove the "Without AI Elements (Manual)" section from ai-sdk that teaches raw {text} rendering, scope toTextStreamResponse() guidance to non-browser clients only with explicit warnings against using it to skip AI Elements, strengthen the rendering mandate to say "no exceptions — even for simple prose" because AI SDK models always produce markdown, update the ai-elements "When to Use" table to replace "Optional — may be overkill" with "Yes — models always produce markdown", and add streaming panels/perspectives/summaries to the examples list. Rebuild the manifest. 2026-03-10 12:46:00 -06:00
John Lindquist 5948eb1497 Scan every skills/*/SKILL.md file for documentation URLs, HTTP-check each one for 404s, and replace broken links with verified live alternatives. Broken URLs found: vercel.com/docs/marketplace → /docs/integrations, vercel.com/docs/marketplace/sign-in-with-vercel → /docs/sign-in-with-vercel, vercel.com/docs/functions/middleware → /docs/routing-middleware, vercel.com/docs/getting-started → /docs/getting-started-with-vercel, vercel.com/docs/infrastructure/runtime-cache → /docs/runtime-cache, vercel.com/docs/content → /docs/solutions/cms, vercel.com/docs/queues/api-reference → /docs/queues/api, vercel.com/docs/security/secure-backend-access/oidc-federation → /docs/oidc, vercel.com/docs/workflow/flags → /docs/feature-flags, flags-sdk.dev/docs/upgrade-guide → github.com/vercel/flags upgrade-to-v4.md, ai-sdk.dev/docs/reference/types/ui-message → /docs/reference/ai-sdk-core/ui-message, docs.anthropic.com/en/docs/claude-code/agent-tool-use → /sub-agents, docs.descope.com/sdks/nextjs → /getting-started/nextjs, docs.stripe.com/libraries/node → /sdks, vercel.com/blog/ncc → github.com/vercel/ncc. Rebuild manifest. Bump to 0.15.1. 2026-03-10 12:32:09 -06:00
John Lindquist 905ffba7fa feat: add lexical stemmer, prompt signal scoring, docs, and plugin metadata
- Add stemmer and shared contractions modules for lexical prompt matching
- Enhance lexical index and prompt patterns with stemming support
- Add promptSignals metadata to all 43 skill frontmatter files
- Add comprehensive documentation site (docs/)
- Add .claude-plugin marketplace and plugin metadata
- Add benchmark scenarios script
- Update skill manifest with prompt signal data
- Add lexical-index and stemmer tests, expand prompt-patterns tests
2026-03-10 03:24:38 -06:00
John Lindquist 525258f2d3 feat: add @vercel/sandbox dep and benchmark-sandbox spike
Add @vercel/sandbox as a dev dependency for sandbox benchmarking.
Include initial spike scripts and regenerated manifests.
2026-03-09 18:58:11 -06:00
John Lindquist b8b233995c feat(skills): broaden trigger patterns for 7 under-injected skills based on eval findings; add next-forge skill; bump to 0.15.0
Eval analysis of 9 real sessions showed 10 skills never triggering despite being
requested. Root causes: pathPatterns too narrow (agents write to lib/email-template.tsx
not emails/), promptSignals containing regex instead of plain text (vercel-sandbox),
and missing promptSignals entirely (v0-dev, vercel-firewall).

Skills updated: email, vercel-queues, edge-runtime, vercel-firewall, chat-sdk,
v0-dev, vercel-sandbox. New skill: next-forge (bootstrap detection).
2026-03-09 17:56:23 -06:00
John Lindquist 0c49abc547 fix(skills): quote YAML validate patterns ending with colon to fix js-yaml parse errors; bump to 0.14.1 2026-03-09 16:38:11 -06:00
John Lindquist 92dbe3ae02 feat(hooks): add SubagentStart/SubagentStop hooks for subagent skill injection; bump to 0.14.0
- SubagentStart bootstrap hook injects project context (likely skills, summaries) into spawned subagents
  with budget scaling by agent type (minimal for Explore/Plan, standard for general-purpose)
- SubagentStop sync hook writes agent metadata to a session-scoped JSONL ledger for observability
- SessionEnd cleanup extended to remove subagent ledger files
- Updated ai-elements/nextjs skills, benchmark-agents and eval skill definitions
2026-03-09 15:52:56 -06:00
John Lindquist f15a7d6889 feat(eval): ai-elements validate rules, broader workflow promptSignals, wider chat pathPatterns; bump to 0.13.0
- ai-elements: add PostToolUse validate rules catching raw part.text rendering,
  react-markdown, and dangerouslySetInnerHTML — guides agent to use MessageResponse
- ai-elements: add *chat* and *message* wildcard pathPatterns (catches flight-chat.tsx etc.)
- workflow: add 8 phrases for reliability language ("individually reliable",
  "retry on transient", "transient failures", etc.)
- workflow: add 7 allOf pairs ([retry, transient], [reliable, retry], [sandbox, reliable], etc.)
2026-03-09 15:17:38 -06:00
John Lindquist 5d548e5be8 fix(security): address audit findings — path traversal, brace expansion, injection escaping, profiler hardening; bump to 0.12.0
- Validate sessionId in dedupClaimDirPath() to prevent path traversal (HIGH)
- Add brace expansion pre-pass in globToRegex for {ts,js,mjs} patterns (HIGH)
- Escape --> sequences in HTML comment metadata blocks (MEDIUM)
- Harden checkVercelCli/checkAgentBrowser with 3s timeouts, suggest latest version (MEDIUM)
- Replace silent catch {} blocks with debug logging (LOW)
- Add semver-aware version comparison (LOW)
- Update golden snapshots and fix invocationId sharing
2026-03-09 14:18:43 -06:00
John Lindquist f035d9afb3 fix(inject): strip YAML frontmatter from skill bodies before injection; bump to 0.11.1
Skill frontmatter (pathPatterns, bashPatterns, promptSignals, etc.)
was being injected alongside the skill body, wasting token budget on
metadata only useful for hook matching. Now uses extractFrontmatter()
to emit only the markdown body.
2026-03-09 13:43:45 -06:00
John Lindquist 4ac3929ef0 fix(manifest): rebuild brace-expanded regex sources
The PreToolUse hook restores path regexes from generated/skill-manifest.json when a v2 manifest is present, so the brace-expansion fix also needs regenerated pathRegexSources. This refresh updates the affected extension-list patterns from literal brace matches to alternations.

Verified: bun run build:manifest
Verified: bun test tests/pretooluse-skill-inject.test.ts -t "matches src/middleware\.(mjs|mts) to routing-middleware skill"
Swarm-Agent: codex-brace-expand
2026-03-09 13:41:28 -06:00
John Lindquist 7ac8edfb8f feat(skills): aggressive prompt signals for workflow/sandbox, "check the docs" directives across 8 skills; bump to 0.11.0
- workflow: add ~60 new promptSignal phrases for reliability language
  (survive page reload, fault-tolerant, retry on failure, session
  persistence, reconnect, durable chat/agent), human-in-the-loop
  patterns (approval, pause until, wait for), and pipeline vocabulary.
  Add ~25 new allOf pairs and 12 new anyOf terms.

- vercel-sandbox: add promptSignals from scratch (had none). 33 phrases
  covering isolated execution, sandbox environments, code safety,
  FFmpeg/media processing, code playgrounds, and tutor patterns.
  27 allOf pairs, 8 anyOf terms, noneOf excludes iframe/codesandbox.

- Add "CRITICAL — your training data is outdated" blockquote at the top
  of 8 fast-moving skill bodies (workflow, ai-sdk, vercel-sandbox,
  ai-gateway, chat-sdk, vercel-flags, vercel-queues, ai-elements)
  directing agents to fetch docs before writing code.

Eval results that motivated these changes:
- content-pipeline: 9/10 (workflow triggered, correct WDK patterns)
- customer-support: 3/10 → workflow never injected (now scores 50)
- code-sandbox-tutor: 1/10 → sandbox never injected (now scores 80)
2026-03-09 13:16:16 -06:00
John Lindquist 300488ebf3 fix(workflow): add explicit --no-src-dir guidance for create-next-app, update golden fixtures; bump to 0.10.1 2026-03-09 12:55:59 -06:00
John Lindquist 5ce557a33e feat(skills): add ai-generation-persistence and verification skills; bump to 0.10.0
New ai-generation-persistence skill (priority 6) injects guidance for treating
AI generations as first-class persistent resources — unique IDs, addressable
URLs, database/Blob storage, cost tracking, and generate-then-redirect UX
patterns. Triggers on AI SDK imports and broad prompt signals.

New verification skill added. Updated ecosystem graph, catalog, manifest,
fixtures, and snapshots.
2026-03-09 12:23:19 -06:00
John Lindquist ff965cc377 fix(skills): remove styled-jsx, regenerate catalog, add investigation-mode skill, build-from-skills templates; bump to 0.9.10 2026-03-09 11:38:08 -06:00
John Lindquist 2cbc3d45de fix(skills): remove styled-jsx skill in favor of shadcn/tailwind
styled-jsx is no longer recommended — all CSS-in-JS guidance should
point to shadcn/tailwind and existing solutions instead.
2026-03-09 11:08:23 -06:00
John Lindquist 81a6da32f7 fix(ai-sdk): add validate rules for direct openai() model bypass, dall-e-3, and experimental_generateImage; bump to 0.9.9 2026-03-09 08:10:50 -06:00
John Lindquist a43cb60a64 fix(skills): stronger outdated model warnings with "your knowledge is outdated" language, make AI Elements mandatory for AI text rendering; bump to 0.9.8 2026-03-09 07:59:56 -06:00
John Lindquist 2ca648a62f fix(ai-sdk): add PostToolUse validate rules for outdated image models, placeholder images, and removed generateObject; bump to 0.9.7 2026-03-09 00:41:53 -06:00
John Lindquist 60168d8c0a fix(skills): update image generation to use AI Gateway with gemini-3.1-flash-image-preview default, remove incorrect "gateway doesn't support image gen" guidance; bump to 0.9.6 2026-03-09 00:36:41 -06:00
John Lindquist dbb91611fb fix(skills): broaden workflow promptSignals for natural language (pipeline/stream/multi-step), add image gen capabilities table to ai-sdk; bump to 0.9.5 2026-03-09 00:17:14 -06:00
John Lindquist 38c01a85b1 fix(skills): update image generation to use AI Gateway with gemini-3.1-flash-image-preview default, remove incorrect "gateway doesn't support image gen" guidance; bump to 0.9.4 2026-03-08 23:49:54 -06:00
John Lindquist 569bfcb0ab fix(skills): complete defineHook 3-piece pattern with token emission and resume route, warn against removed generateObject; bump to 0.9.3 2026-03-08 23:33:46 -06:00
John Lindquist 9741bdfd6f fix(skills): add MessageResponse as universal markdown renderer for AI text in ai-elements, ai-sdk, and workflow skills; bump to 0.9.2 2026-03-08 22:31:09 -06:00
John Lindquist 0e29e4caea fix(workflow): add mandatory env setup for AI Gateway OIDC, document getStepMetadata retryCount undefined on first attempt; bump to 0.9.1 2026-03-08 21:27:52 -06:00
John Lindquist 62f6718d31 feat(skills): remove streamdown skill, expand ai-elements, update profiler and pretool hook, update tests; bump to 0.9.0 2026-03-08 19:50:24 -06:00
John Lindquist 43fec91f36 fix(workflow): document canonical project structure for src/ vs no-src, fix @/workflows import path guidance; bump to 0.8.3 2026-03-08 19:46:35 -06:00
John Lindquist c8e1da3760 fix(ai-sdk): refine markdown rendering guidance to focus on AI Elements Message component; bump to 0.8.2 2026-03-08 18:33:30 -06:00
John Lindquist 6e9a0640d3 fix(skills): strengthen skills from eval feedback — markdown rendering warning in ai-sdk, sandbox/withWorkflow/peer-deps in workflow, mandatory browser verify language; bump to 0.8.1 2026-03-08 18:04:42 -06:00
John Lindquist 2d53cbe2bf feat(hooks): bump skill cap from 3 to 5, add shadcn create-next-app nudge; bump to 0.8.0 2026-03-08 17:26:11 -06:00
John Lindquist 5110bb6529 fix(skills): add flags importPatterns, model slug callout in ai-sdk; bump to 0.7.3 2026-03-08 14:17:05 -06:00
John Lindquist a449bd36c2 fix(skills): rewrite workflow SKILL.md with real WDK API, tighten shadcn patterns; bump to 0.7.2 2026-03-08 14:08:39 -06:00
John Lindquist 77f3f2c4eb fix(workflow): update golden snapshots for broadened workflow patterns; bump to 0.7.1 2026-03-08 10:38:58 -06:00
John Lindquist 2809b81206 fix(workflow): broaden skill injection triggers
Workflow skill frontmatter now covers workflow-named paths, @vercel/workflow and related package installs/imports, and prompt signals for durable execution or step-based route work. The priority was also raised so Workflow-specific contexts inject the specialized skill before generic route guidance exhausts the budget.

Verified: bun test hooks/skill-map-frontmatter.test.ts
Verified: node -e "const { spawnSync } = require('node:child_process'); const payload = JSON.stringify({ prompt: 'Add Vercel Workflow durable execution to this API route using use workflow and step functions', session_id: 'workflow-prompt-2', cwd: process.cwd(), hook_event_name: 'UserPromptSubmit' }); const res = spawnSync('node', ['hooks/user-prompt-submit-skill-inject.mjs'], { input: payload, encoding: 'utf8', env: { ...process.env, VERCEL_PLUGIN_SEEN_SKILLS: '' } }); if (res.status !== 0) process.exit(res.status ?? 1); const out = JSON.parse(res.stdout || '{}'); const ctx = out.hookSpecificOutput?.additionalContext || ''; if (!ctx.includes('skill:workflow')) process.exit(1);"
Verified: node -e "const { spawnSync } = require('node:child_process'); const payload = JSON.stringify({ tool_name: 'Read', tool_input: { file_path: '/Users/me/project/app/api/workflows/process-order/route.ts' }, session_id: 'workflow-read-2', cwd: process.cwd() }); const res = spawnSync('node', ['hooks/pretooluse-skill-inject.mjs'], { input: payload, encoding: 'utf8', env: { ...process.env, VERCEL_PLUGIN_SEEN_SKILLS: '' } }); if (res.status !== 0) process.exit(res.status ?? 1); const out = JSON.parse(res.stdout || '{}'); const ctx = out.hookSpecificOutput?.additionalContext || ''; if (!ctx.includes('skill:workflow')) process.exit(1);"
Verified: node -e "const { spawnSync } = require('node:child_process'); const payload = JSON.stringify({ tool_name: 'Bash', tool_input: { command: 'pnpm add @vercel/workflow' }, session_id: 'workflow-bash-2', cwd: process.cwd() }); const res = spawnSync('node', ['hooks/pretooluse-skill-inject.mjs'], { input: payload, encoding: 'utf8', env: { ...process.env, VERCEL_PLUGIN_SEEN_SKILLS: '' } }); if (res.status !== 0) process.exit(res.status ?? 1); const out = JSON.parse(res.stdout || '{}'); const ctx = out.hookSpecificOutput?.additionalContext || ''; if (!ctx.includes('skill:workflow')) process.exit(1);"
Verified: node -e "const { spawnSync } = require('node:child_process'); const payload = JSON.stringify({ tool_name: 'Write', tool_input: { file_path: '/Users/me/project/app/api/orders/route.ts', content: "import { workflow } from '@vercel/workflow';\nexport const POST = async () => { return Response.json({ ok: true }); };" }, session_id: 'workflow-write-2', cwd: process.cwd() }); const res = spawnSync('node', ['hooks/pretooluse-skill-inject.mjs'], { input: payload, encoding: 'utf8', env: { ...process.env, VERCEL_PLUGIN_SEEN_SKILLS: '' } }); if (res.status !== 0) process.exit(res.status ?? 1); const out = JSON.parse(res.stdout || '{}'); const ctx = out.hookSpecificOutput?.additionalContext || ''; if (!ctx.includes('skill:workflow')) process.exit(1);"
Swarm-Agent: codex-workflow-patterns
2026-03-08 10:18:08 -06:00
John Lindquist 004137663e feat(skills): update 29 skill docs, add eval skill, update validate tests; bump to 0.7.0
Refine SKILL.md content across 29 skills based on live eval findings from 16
benchmark sessions. Add .claude/skills/vercel-plugin-eval/ for running real-world
plugin eval sessions with debug log monitoring. Update posttooluse-validate and
validate-rules tests to match refined skill content.
2026-03-08 09:30:36 -06:00
John Lindquist 08ee18d51d feat(hooks): atomic per-skill claim dedup, fix race condition and UserPromptSubmit sharing; bump to 0.6.0
Parallel PreToolUse hooks were racing on the same seen-skills file, causing 2-6x
duplicate injections. UserPromptSubmit hook didn't share dedup state at all.

Fix by implementing atomic per-skill claim files (Oracle session: fix-dedup-race-condition-plan):

1. In hooks/src/hook-env.mts, add tryClaimSessionKey(sessionId, kind, key) using
   openSync(path, 'wx') for atomic exclusive create. Add listSessionKeys() to read
   claim dir, syncSessionFileFromClaims() to derive the txt snapshot, and
   removeSessionClaimDir() for cleanup. Claim files live in
   <tmpdir>/vercel-plugin-<sessionId>-seen-skills.d/<skill-name>.

2. In hooks/src/patterns.mts, add mergeSeenSkillStates(...values) to union env var,
   session file, and claim dir state. Add serializeSeenSkills(set) helper.

3. In hooks/src/pretooluse-skill-inject.mts, load merged state from env+file+claims.
   Before injecting each skill, call tryClaimSessionKey — first process wins, others
   get EEXIST and skip. Use same claim path for once-only keys (agent-browser warning,
   vercel-env-help). Pass sessionId through InjectOptions.

4. In hooks/src/user-prompt-submit-skill-inject.mts, preserve sessionId from parsed
   input, load merged seen state, pass sessionId to injection flow so it uses the
   shared claim backend. Skills injected via promptSignals now visible to PreToolUse.

5. In hooks/src/session-end-cleanup.mts, add rmSync deletion of claim directories.

6. Update CLAUDE.md dedup contract to document atomic claim mechanism.
7. Bump .plugin/plugin.json to 0.6.0, rebuild.
2026-03-07 17:19:25 -07:00
John Lindquist 23e6a56461 feat(hooks): add SessionEnd cleanup hook, update docs and version; bump to 0.5.6
Add session-end-cleanup.mts that deletes temp dedup files when session ends:
1. Create hooks/src/session-end-cleanup.mts — reads session_id from stdin JSON,
   deletes tmpdir/vercel-plugin-<sessionId>-seen-skills.txt and validated-files.txt
2. Register SessionEnd hook in hooks/hooks.json
3. Add entry point to hooks/tsup.config.ts
4. Update CLAUDE.md dedup contract to document file-based persistence + cleanup
5. Bump .plugin/plugin.json to 0.5.6, rebuild manifest
2026-03-07 14:59:22 -07:00
John Lindquist cbf4ed8a3e revert(hooks): remove temp file dedup, restore pure env-var dedup via CLAUDE_ENV_FILE; bump to 0.5.5
The 0.5.4 release added session-scoped temp files for dedup persistence, but this
was wrong — CLAUDE_ENV_FILE env vars ARE propagated to hook subprocesses by Claude
Code. The temp file approach littered tmpdir with hundreds of small files.

Revert to the original env-var-only mechanism:

1. Remove readSessionFile/writeSessionFile/dedupFilePath from hooks/src/hook-env.mts
2. Remove all writeSessionFile calls from pretooluse-skill-inject.mts — revert to
   pure process.env.VERCEL_PLUGIN_SEEN_SKILLS = appendSeenSkill(...) pattern
3. Remove sessionId from InjectOptions and the injectSkills call site
4. Remove sessionId from posttooluse-validate.mts ParsedInput — revert
   isAlreadyValidated/markValidated to pure env-var signatures
5. Revert all test expectations back to "env-var" and "memory-only" strategies
6. Restore CLAUDE.md dedup contract to env-var-only documentation
2026-03-07 14:39:08 -07:00
John Lindquist c107aec73d fix(hooks): persist skill dedup across hook invocations via session-scoped temp files; bump to 0.5.4
Skill dedup is completely broken because CLAUDE_ENV_FILE vars are only available to Bash
tool commands, not hook subprocesses. Each PreToolUse invocation starts a fresh Node.js
process that never sees VERCEL_PLUGIN_SEEN_SKILLS.

To fix this:

1. In hooks/src/hook-env.mts, add readSessionFile(sessionId, kind) and
   writeSessionFile(sessionId, kind, value) helpers that read/write
   /tmp/vercel-plugin-<sessionId>-<kind>.txt for persistent dedup state.

2. In hooks/src/pretooluse-skill-inject.mts, read seen skills from the session file
   at startup using readSessionFile(sessionId, "seen-skills"). Add a persistSeen()
   closure inside injectSkills() that calls both appendSeenSkill and writeSessionFile.
   Replace all process.env.VERCEL_PLUGIN_SEEN_SKILLS = appendSeenSkill(...) calls with
   persistSeen() or inline writeSessionFile calls. Add "file" as the primary dedup
   strategy when session_id is present, falling back to "env-var" then "memory-only".
   Pass sessionId through InjectOptions to injectSkills().

3. In hooks/src/posttooluse-validate.mts, add sessionId to ParsedInput and extract it
   from input.session_id in parseInput(). Pass sessionId to isAlreadyValidated() and
   markValidated(), which should read/write via readSessionFile/writeSessionFile for
   the "validated-files" kind.

4. Update tests: pretooluse-skill-inject.test.ts — rename "no env var" test to expect
   file-based dedup persistence, update strategy assertions from "env-var" to "file",
   use omitSessionId for memory-only test. subagent-fresh-env.test.ts — use a fresh
   session ID for subagent calls, update strategy expectations to "file".
   session-timeline-subagent.test.ts — add sessionId option to runHookEnv, use a
   different session ID for the subagent call.

5. Update CLAUDE.md dedup contract section to document file-based mechanism.

6. Bump .plugin/plugin.json version to 0.5.4, run bun run build.
2026-03-07 14:23:09 -07:00