diff --git a/plugins/semantic-anchors/hooks/hooks.json b/plugins/semantic-anchors/hooks/hooks.json deleted file mode 100644 index 842d257..0000000 --- a/plugins/semantic-anchors/hooks/hooks.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "description": "Semantic anchor onboarding prompt", - "hooks": { - "SessionStart": [ - { - "matcher": "startup|resume", - "hooks": [ - { - "type": "command", - "command": "${CLAUDE_PLUGIN_ROOT}/scripts/prompt-onboarding.sh" - } - ] - } - ] - } -} diff --git a/plugins/semantic-anchors/plugin.json b/plugins/semantic-anchors/plugin.json index 574db8e..5df48b8 100644 --- a/plugins/semantic-anchors/plugin.json +++ b/plugins/semantic-anchors/plugin.json @@ -1,7 +1,7 @@ { "name": "semantic-anchors", "version": "0.1.0", - "description": "Semantic anchor skills for translating terminology, prompting first-run Claude onboarding, and installing persistent anchor context into coding agents.", + "description": "Semantic anchor skills for translating terminology and installing persistent anchor context into coding agents.", "author": { "name": "LLM Coding", "url": "https://github.com/LLM-Coding" diff --git a/plugins/semantic-anchors/scripts/prompt-onboarding.sh b/plugins/semantic-anchors/scripts/prompt-onboarding.sh deleted file mode 100755 index a8ecdae..0000000 --- a/plugins/semantic-anchors/scripts/prompt-onboarding.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/bin/sh -# Claude SessionStart hook that prompts for semantic-anchor onboarding -# when no managed anchor block is present yet. - -set -eu - -command -v python3 >/dev/null 2>&1 || { echo "Error: python3 is required but not found" >&2; exit 1; } - -PROJECT_DIR="${CLAUDE_PROJECT_DIR:-$PWD}" -CODEX_HOME_DIR="${CODEX_HOME:-$HOME/.codex}" -STATE_DIR="$HOME/.claude/semantic-anchor-onboarding" -STATE_FILE="$STATE_DIR/state.json" -MARKER_START="" -MARKER_END="" -COOLDOWN_HOURS=24 - -has_marker() { - local file - for file in "$@"; do - if [ -f "$file" ] && - grep -qF "$MARKER_START" "$file" && - grep -qF "$MARKER_END" "$file"; then - return 0 - fi - done - return 1 -} - -if has_marker \ - "$PROJECT_DIR/AGENTS.md" \ - "$PROJECT_DIR/CLAUDE.md" \ - "$PROJECT_DIR/GEMINI.md" \ - "$PROJECT_DIR/.github/copilot-instructions.md" \ - "$PROJECT_DIR/.claude/AGENTS.md" \ - "$HOME/.claude/CLAUDE.md" \ - "$CODEX_HOME_DIR/AGENTS.md" \ - "$HOME/.gemini/GEMINI.md"; then - exit 0 -fi - -mkdir -p "$STATE_DIR" 2>/dev/null || true - -python3 - "$STATE_FILE" "$PROJECT_DIR" "$COOLDOWN_HOURS" <<'PY' -import json -import os -import sys -import tempfile -from datetime import datetime, timedelta, timezone - -state_path, project_dir, cooldown_hours = sys.argv[1], sys.argv[2], int(sys.argv[3]) -now = datetime.now(timezone.utc) - -try: - with open(state_path, "r", encoding="utf-8") as handle: - state = json.load(handle) -except (FileNotFoundError, json.JSONDecodeError, OSError): - state = {} - -projects = state.setdefault("projects", {}) -entry = projects.setdefault(project_dir, {}) -last_prompt_raw = entry.get("last_prompt") - -if last_prompt_raw: - try: - last_prompt = datetime.fromisoformat(last_prompt_raw.replace("Z", "+00:00")) - except (ValueError, TypeError): - last_prompt = None - if last_prompt and now - last_prompt < timedelta(hours=cooldown_hours): - raise SystemExit(0) - -entry["last_prompt"] = now.isoformat().replace("+00:00", "Z") - -tmp_path = None -try: - state_dir = os.path.dirname(state_path) - fd, tmp_path = tempfile.mkstemp(dir=state_dir, suffix=".tmp") - with os.fdopen(fd, "w", encoding="utf-8") as handle: - json.dump(state, handle, indent=2) - handle.write("\n") - os.replace(tmp_path, state_path) -except OSError: - # Best-effort: if write fails, skip silently rather than breaking the hook - if tmp_path and os.path.exists(tmp_path): - os.unlink(tmp_path) - -message = ( - "Semantic anchors are not configured for this workspace. " - "On your next response, ask one short onboarding question: " - "whether the user wants to onboard semantic anchors now for this project " - "or for their home directory. If they agree and the semantic-anchor-onboarding " - "skill is available, use it; otherwise guide them to the installation instructions " - "in the repository README." -) - -payload = { - "hookSpecificOutput": { - "hookEventName": "SessionStart", - "additionalContext": message, - } -} -print(json.dumps(payload)) -PY diff --git a/plugins/semantic-anchors/skills/semantic-anchor-onboarding/SKILL.md b/plugins/semantic-anchors/skills/semantic-anchor-onboarding/SKILL.md index 5369781..4599930 100644 --- a/plugins/semantic-anchors/skills/semantic-anchor-onboarding/SKILL.md +++ b/plugins/semantic-anchors/skills/semantic-anchor-onboarding/SKILL.md @@ -34,7 +34,6 @@ Install a small, stable set of semantic anchors so coding agents start each sess 5. Add native behavior only where needed. - For Claude Code, add `--claude-hook` if the user wants a SessionStart hook that re-injects the selected block at the beginning of each session. -- The Claude marketplace plugin can also ship a separate first-start `SessionStart` hook that asks whether onboarding should run when no semantic-anchor block exists yet. - For Gemini CLI, either rely on the shared file chosen by the installer or mirror the same block into `GEMINI.md` if the team wants native Gemini memory. - For GitHub Copilot, mirror the same block into `.github/copilot-instructions.md` only when chat or review workflows also need it. - For Cursor, the shared file is usually enough; use `.cursor/rules` only when path-scoped behavior is required. diff --git a/skill/semantic-anchor-onboarding/SKILL.md b/skill/semantic-anchor-onboarding/SKILL.md index 5369781..4599930 100644 --- a/skill/semantic-anchor-onboarding/SKILL.md +++ b/skill/semantic-anchor-onboarding/SKILL.md @@ -34,7 +34,6 @@ Install a small, stable set of semantic anchors so coding agents start each sess 5. Add native behavior only where needed. - For Claude Code, add `--claude-hook` if the user wants a SessionStart hook that re-injects the selected block at the beginning of each session. -- The Claude marketplace plugin can also ship a separate first-start `SessionStart` hook that asks whether onboarding should run when no semantic-anchor block exists yet. - For Gemini CLI, either rely on the shared file chosen by the installer or mirror the same block into `GEMINI.md` if the team wants native Gemini memory. - For GitHub Copilot, mirror the same block into `.github/copilot-instructions.md` only when chat or review workflows also need it. - For Cursor, the shared file is usually enough; use `.cursor/rules` only when path-scoped behavior is required.