Commit Graph

122 Commits

Author SHA1 Message Date
melkeydev 6205e61949 removing bash 2026-04-09 12:28:14 -07:00
melkeydev 969eae3f41 removing telemetry 2026-04-09 11:26:28 -07:00
melkeydev fbbead58af changing telemetry gating 2026-04-09 11:23:16 -07:00
melkeydev e33feea0c6 fixing pr comments 2026-04-06 10:59:10 -07:00
melkeydev 3df45a85e9 adding a kill switch for telemetry 2026-04-06 08:37:28 -07:00
melkeydev 35bf7ef55f making telemetry fully opt-out 2026-04-06 08:13:43 -07:00
melkeydev 396181d588 PR comments 2026-04-02 09:39:08 -07:00
melkeydev 8449a2a561 reduce-vercel-injection-at-start 2026-04-01 15:57:07 -07:00
melkeydev ee0df43c53 Adding proper gate for lexical injection 2026-04-01 10:41:36 -07:00
melkeydev 77a65a9918 removing observability, turborepo and more skills 2026-03-29 18:26:07 -07:00
melkeydev 7a73b56791 removing 12 skills 2026-03-29 17:52:10 -07:00
melkeydev 2148556d27 adding new skill 2026-03-23 10:51:57 -07:00
melkeydev abd9ed613a fixing for telemetry 2026-03-18 09:57:56 -07:00
melkeydev 87b8d0f6bb updating prompt telemetry 2026-03-16 12:33:36 -07:00
melkeydev a2cbc8e45e fixing and making telemetry more stable 2026-03-15 21:15:20 -07:00
Andrey Buzin e7a631ee76 Add vercel-services skill
Wire in vercel-services
2026-03-13 12:49:50 -07:00
melkeydev f5120ae69a removing debug lines 2026-03-12 20:16:20 -07:00
melkeydev 616645b399 quick fix for telemetry 2026-03-12 20:00:31 -07:00
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 ed7c3eb8ad fix(skill-frontmatter): warn on broken startup skills
Normalize fragile SKILL.md frontmatter in ncc and next-forge so the custom
frontmatter parser keeps their regex and nested prompt signal data intact.
Add a session-start summary log for broken skill frontmatter and keep
telemetry env export non-fatal when the env file is missing.

Verified: bun test tests/skill-map-frontmatter.test.ts tests/session-start-profiler.test.ts

Swarm-Agent: codex-skill-reliability
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 3348f2a5bc fix(tsup): externalize sibling hook imports to prevent double-JSON output, enable lexical prompt matching by default
In hooks/tsup.config.ts, add an esbuild plugin (externalize-sibling-hooks) that marks sibling ./*.mjs imports as external before tsup's noExternal catch-all runs. The previous config used noExternal: [/.*/] which overrode the external array, causing sibling hooks to be inlined with their side-effecting isMainModule() guards — producing invalid concatenated JSON output like "{}{}". The fix uses build.onResolve to intercept ./foo.mjs imports matching the hookExternalSet and return { external: true }. npm dependencies (minisearch, etc.) remain bundled inline.

In hooks/src/user-prompt-submit-skill-inject.mts line 581, change the lexical check from process.env.VERCEL_PLUGIN_LEXICAL_PROMPT === "1" to !== "0" so lexical stemmer fallback is on by default. Update the CLAUDE.md env var table to show default as "on" with "0" to disable.

Rebuild all compiled hooks via bun run build:hooks.
2026-03-11 15:18:35 -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 089b5aefa4 fix(benchmark-sandbox): extend sandbox before snapshot
Move the timeout extension ahead of the snapshot call so long builds do not
expire before the restore point is created.
Also double the sandbox creation lifetime and only apply a post-snapshot
extension when keep-alive is enabled.

Verified: bun test tests/run-eval-build-polling.test.ts
Swarm-Agent: codex-snapshot-timing
2026-03-11 15:18:19 -06:00
John Lindquist 4c00fc0a00 fix(prompt-submit): drop seen-skills env merge
UserPromptSubmit no longer merges or rewrites seen-skill state through VERCEL_PLUGIN_SEEN_SKILLS when file-backed dedup state exists.
The helper now keeps session-file state authoritative and only forwards the dedup flag into injectSkills inline.

Verified: bun run build:hooks
Verified: bun test hooks/user-prompt-submit-skill-inject.test.ts tests/user-prompt-submit-skill-inject.test.ts
Swarm-Agent: codex-prompt-drop-env-v2
2026-03-11 15:18:19 -06:00
John Lindquist 9bec068d63 fix(posttool): drop seen-skills env merge from validate and bash-chain hooks
Both posttool hooks now consult the persisted session-backed seen-skills state instead of merging in VERCEL_PLUGIN_SEEN_SKILLS. This keeps dedup behavior consistent across subagents and avoids env leakage into hook chaining decisions.

Verified: bun run build:hooks
Verified: tsc -p hooks/tsconfig.json --noEmit
Verified: bun test tests/posttooluse-validate.test.ts
Verified: bun test hooks/platform-hook-compat.test.ts
Verified: bun -e '...runChainInjection smoke for session-file-only seen-skills...'
Verified: bun -e '...runBashChainInjection smoke for session-file-only seen-skills...'
Swarm-Agent: codex-posttool-commit
2026-03-11 15:18:19 -06:00
John Lindquist e048cbc9bd fix(pretooluse): drop seen env merge writes
The pretool hook no longer folds VERCEL_PLUGIN_SEEN_SKILLS into
session-file dedup state or writes claim-sync results back into
process.env. File-backed dedup still claims and syncs session state,
while env-only dedup remains a fallback when no session scope exists.

Verified: bun run build:hooks
Verified: bun test tests/hook-sync.test.ts
Verified: bun test tests/pretooluse-skill-inject.test.ts --test-name-pattern "file-based dedup persists across invocations with same session_id|debug mode logs dedup strategy for file, memory-only, and disabled"
Verified: node --input-type=module <<'EOF' ... fresh cursor Write payload asserts no VERCEL_PLUGIN_SEEN_SKILLS env update and TSX counter update EOF
Verified: node --input-type=module <<'EOF' ... env-only Read payload without session_id returns {} when VERCEL_PLUGIN_SEEN_SKILLS=nextjs EOF
Swarm-Agent: codex-pretool-drop-env-merge
2026-03-11 15:18:19 -06:00
John Lindquist a80ac3581c fix(session-start-profiler): store profiler state in session files
Claude session-start-profiler no longer requires CLAUDE_ENV_FILE to persist likely skills or greenfield state.
Those values now come from the hook input session ID and are written to session files,
while Claude env exports remain only for the other profiler vars.

Verified: bun run build:hooks
Verified: bun test tests/session-start-profiler.test.ts
Swarm-Agent: codex-profiler-env-cleanup
2026-03-11 15:18:19 -06:00
John Lindquist 7566bed4d4 fix(session-start): noop Claude seen-skills init
Claude session-start no longer appends VERCEL_PLUGIN_SEEN_SKILLS to
CLAUDE_ENV_FILE now that claim-dir/session initialization handles dedup.
Cursor still emits the empty env var payload on stdout.

Verified: bun run build:hooks
Verified: bun test tests/session-start-seen-skills.test.ts
Verified: bun test tests/session-timeline-subagent.test.ts
Verified: bun test hooks/session-hooks-platform-compat.test.ts
Swarm-Agent: codex-seen-skills-init-cleanup
2026-03-11 15:18:19 -06:00
John Lindquist 8e7c146c73 fix(prompt-submit): drop seen-skills env appends
UserPromptSubmit no longer appends VERCEL_PLUGIN_SEEN_SKILLS into CLAUDE_ENV_FILE.
Session claims/files remain the persistence path, while Cursor keeps its existing output-env fallback when no env file is present.

Verified: bun run build:hooks
Verified: bun test tests/user-prompt-submit.test.ts -t "cursor payload returns flat output with continue and env patch"
Verified: bun test tests/user-prompt-submit.test.ts -t "does not append seen skills to CLAUDE_ENV_FILE when available"
Swarm-Agent: codex-prompt-submit-env-cleanup
2026-03-11 15:18:19 -06:00
John Lindquist 95176e59dc fix(pretooluse): move hook counters off Claude env file
PreToolUse now persists TSX review and dev-server verify counters via session files,
and it no longer appends runtime env exports to CLAUDE_ENV_FILE for Claude.
This keeps seen-skills dedup on the claim/session-file path and avoids shell-init
side effects during hook execution.

Verified: bun run build:hooks
Verified: bun test tests/pretooluse-skill-inject.test.ts -t "file-based dedup persists across invocations with same session_id"
Verified: bun test tests/pretooluse-skill-inject.test.ts -t "empty VERCEL_PLUGIN_SEEN_SKILLS env var dedups across invocations"
Verified: custom node smoke test (tsx-migration-check) — CLAUDE_ENV_FILE unchanged, tsx-edit-count reset in session file, seen-skills persisted
Verified: custom node smoke test (dev-migration-check) — CLAUDE_ENV_FILE unchanged, dev-verify-count persisted in session file
Swarm-Agent: codex-pretooluse-env-cleanup
2026-03-11 15:18:18 -06:00
John Lindquist b9fcf22191 feat(hooks): add Cursor compat to pretooluse-skill-inject
Detect platform via conversation_id/workspace_roots/cursor_version
fields in stdin JSON. Normalize sessionId, cwd, and output format:
- Cursor: flat { additional_context, env } output
- Claude Code: nested { hookSpecificOutput } output (unchanged)

Env var updates use JSON env field for Cursor instead of
CLAUDE_ENV_FILE. Includes platform-hook-compat test suite.
2026-03-11 15:18:18 -06:00
John Lindquist 92b69b6ee7 fix(hooks): support Cursor session-start profiler output
Finish the session-start profiler Cursor path without touching the profiling logic.
Platform detection now keys off hook input and CLAUDE_ENV_FILE, project root lookup falls back to CURSOR_PROJECT_DIR, and Cursor receives env plus additional_context JSON on stdout.

Verified: bun test hooks/session-start-profiler-platform.test.ts
Verified: bun test hooks/session-hooks-platform-compat.test.ts
Verified: zsh -lc 'tmpdir=/var/folders/c3/r013q3_93_s4zycmx0mdnt2h0000gn/T/tmp.p6JmjuMjls; printf "{\"conversation_id\":\"conv-123\",\"cursor_version\":\"1.0.0\"}" | env -u CLAUDE_ENV_FILE -u CLAUDE_PROJECT_ROOT CURSOR_PROJECT_DIR="" bun hooks/src/session-start-profiler.mts'
Swarm-Agent: codex-profiler-v2
2026-03-11 15:18:18 -06:00
John Lindquist a78ac86798 fix(hooks): add Cursor support for session hooks
Session start hooks now detect Cursor payloads from stdin and emit Cursor-compatible JSON while keeping Claude Code env-file behavior intact.
Session end cleanup now falls back to conversation_id so Cursor sessions clean up the same temp artifacts.

Verified: bun test hooks/session-hooks-platform-compat.test.ts tests/session-start-seen-skills.test.ts tests/session-end-cleanup.test.ts
How to test: run the same bun test command, or pipe Cursor-style JSON into the three hook scripts under hooks/*.mjs.
Swarm-Agent: codex-session-start-v2
2026-03-11 15:17:31 -06:00
John Lindquist 8d8faffe57 fix(hooks): add cursor support to posttool validator
Normalize PostToolUse stdin with compat-based platform detection and Cursor workspace/session fallbacks.
Emit Cursor additional_context/env payloads while preserving Claude output shape and empty-result behavior.

Verified: bun test hooks/platform-hook-compat.test.ts
Verified: bun --eval 'import assert from "node:assert/strict"; import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; import { formatOutput, markValidated } from "./hooks/src/posttooluse-validate.mts"; const tempDir = mkdtempSync(join(tmpdir(), "posttooluse-validate-")); const envFile = join(tempDir, "claude.env"); writeFileSync(envFile, "", "utf-8"); delete process.env.VERCEL_PLUGIN_VALIDATED_FILES; process.env.CLAUDE_ENV_FILE = envFile; const next = markValidated("app/page.tsx", "abc123def456", null); assert.equal(next, "app/page.tsx:abc123def456"); assert.match(readFileSync(envFile, "utf-8"), /VERCEL_PLUGIN_VALIDATED_FILES="app\/page\.tsx:abc123def456"/); const output = JSON.parse(formatOutput([{ skill: "ai-sdk", line: 8, message: "Use streamText for streaming responses.", severity: "recommended", matchedText: "generateText" }], ["ai-sdk"], "app/page.tsx", undefined, "cursor", { VERCEL_PLUGIN_VALIDATED_FILES: next })); assert.equal(output.env.VERCEL_PLUGIN_VALIDATED_FILES, next); rmSync(tempDir, { recursive: true, force: true }); delete process.env.CLAUDE_ENV_FILE; delete process.env.VERCEL_PLUGIN_VALIDATED_FILES;'
Swarm-Agent: codex-posttool-validate-v2
2026-03-11 15:17:02 -06:00
John Lindquist e91067f1aa chore(hooks): drop accidental generated artifacts
Restore generated hook outputs that were accidentally committed when the
repo pre-commit hook rebuilt the entire hooks directory. This follow-up
keeps this agent's change set focused on the UserPromptSubmit source and
tests without touching the in-progress source files owned by other agents.

Verified: bun test hooks/user-prompt-submit-skill-inject.test.ts tests/user-prompt-submit.test.ts
Verified: restored generated outputs to their HEAD~1 content for six unrelated hook artifacts
Swarm-Agent: codex-prompt-hook
2026-03-11 15:17:02 -06:00
John Lindquist 1142c51906 fix(user-prompt-submit): support cursor prompt hook
Normalize UserPromptSubmit input fields across Claude Code and Cursor,
including conversation/session IDs, cwd roots, and prompt/message
fallbacks. Cursor now returns flat beforeSubmitPrompt output with
continue:true and emits seen-skill env patches when no CLAUDE_ENV_FILE is
available, while Claude continues using hookSpecificOutput and appends
seen-skill exports to CLAUDE_ENV_FILE when present.

Verified: bun test hooks/user-prompt-submit-skill-inject.test.ts tests/user-prompt-submit.test.ts
Verified: cursor beforeSubmitPrompt payload returns continue:true + env patch in tests/user-prompt-submit.test.ts
Swarm-Agent: codex-prompt-hook
2026-03-11 15:17:02 -06:00
John Lindquist 0beeedb807 chore(hooks): restore unrelated generated outputs
The local pre-commit hook rebuilt several hooks/*.mjs files from other agents' dirty source changes while I was committing the new compat layer. Restore the unrelated generated artifacts to their previous state so this task only carries the compat-layer files it owns.

Verified: bun test hooks/compat.test.ts
Swarm-Agent: codex-compat-layer
2026-03-11 15:16:27 -06:00
John Lindquist e37004a002 feat(hooks): add compat layer for cursor payloads
Add a shared Claude Code/Cursor compatibility module that normalizes hook input, formats platform-specific output, and persists session env state across both runtimes.

Verified: bun test hooks/compat.test.ts
Verified: bun x tsc --noEmit --module nodenext --moduleResolution nodenext --target es2022 --types node hooks/src/compat.mts
Swarm-Agent: codex-compat-layer
2026-03-11 15:16:27 -06:00
John Lindquist 9fdcc5c8b0 chore(pretooluse-skill-inject): restore generated bundle
The previous commit unintentionally included this compiled hook artifact because the local pre-commit hook rebuilt and auto-staged hook bundles. This restores the generated file to its prior committed state without touching the dirty source file.

Verified: tmp=/var/folders/c3/r013q3_93_s4zycmx0mdnt2h0000gn/T/tmp.2y6bxG5m6P && git show HEAD^:hooks/pretooluse-skill-inject.mjs > "" && cmp -s hooks/pretooluse-skill-inject.mjs "" && rm ""
Swarm-Agent: codex-hook-chain
2026-03-11 15:16:21 -06:00
John Lindquist 994a5431a8 fix(posttooluse-validate): dedupe skill upgrade instructions
formatOutput now emits a single skill-upgrade instruction block per target skill, adds the requested blank line and reason text, and marks hard upgrades as REQUIRED so agents get clearer follow-up actions.

Verified: bun run build:hooks
Verified: bun test tests/posttooluse-validate.test.ts
Verified: bun run typecheck
Swarm-Agent: codex-hook-chain
2026-03-11 15:16:21 -06:00
John Lindquist ab8810509e fix(hooks): drop unrelated generated injector diff
The repo pre-commit hook rebuilt hook outputs and accidentally staged a generated pretooluse injector artifact from another in-progress source change. This commit restores that generated file to its pre-commit content so the skill-upgrade change stays isolated.

Verified: diff -u <(git show HEAD^:hooks/pretooluse-skill-inject.mjs) hooks/pretooluse-skill-inject.mjs
Swarm-Agent: codex-schema
2026-03-11 15:16:21 -06:00
John Lindquist 4525723e15 feat(hooks): add skill upgrade metadata to validate rules
Validate rules can now carry optional skill-upgrade metadata from SKILL.md frontmatter through the post-tool-use validator. When a matching rule requests an upgrade, the hook output now emits both human-readable Skill tool guidance and a machine-readable HTML comment for downstream parsing.

Verified: bun run typecheck
Verified: bun -e 'const mod = await import("./hooks/src/posttooluse-validate.mts"); const violations = mod.runValidation("foo\n", ["source-skill"], new Map([["source-skill", [{ pattern: "foo", message: "needs upgrade", severity: "error", upgradeToSkill: "target-skill", upgradeWhy: "more specific context" }]] ])); const out = JSON.parse(mod.formatOutput(violations, ["source-skill"], "/tmp/test.ts")); console.log(JSON.stringify(violations)); console.log(out.hookSpecificOutput.additionalContext);'
Verified: bun -e 'const mod = await import("./hooks/src/skill-map-frontmatter.mts"); const parsed = mod.parseSkillFrontmatter(`validate:\n  -\n    pattern: foo\n    message: needs upgrade\n    severity: error\n    upgradeToSkill: target-skill\n    upgradeWhy: use the more specific skill\n  -\n    pattern: bar\n    message: hard upgrade\n    severity: warn\n    upgradeToSkill: hard-skill\n    upgradeMode: hard\n`); console.log(JSON.stringify(parsed.validate));'
Swarm-Agent: codex-schema
2026-03-11 15:16:21 -06:00
melkeydev fd61d00d91 removing setup hook that doesnt exist 2026-03-11 14:11:14 -07:00
melkeydev 25c1cae890 fixing telemetry 2026-03-11 12:39:08 -07:00
melkeydev 16db2e9c95 removing timeouts 2026-03-11 12:24:48 -07:00
melkeydev 6258a7e349 adding event bridge and reviewer comments 2026-03-11 12:16:28 -07:00
melkeydev 55eeae089f adding telemetry 2026-03-11 10:46:51 -07:00
melkeydev c7a13ac307 adding telemetry 2026-03-11 09:23:07 -07:00
melkeydev dd67615a1c Stashing for now 2026-03-10 22:41:41 -07:00