From e734ed64fdfd33fb4e46c3c2630703f5ea861bd8 Mon Sep 17 00:00:00 2001 From: Flying Nobita <46126470+flyingnobita@users.noreply.github.com> Date: Tue, 10 Nov 2026 18:35:07 +0800 Subject: [PATCH 1/2] Release 0.5.0: load always-on rules only in human sessions (#2) Always-on rules load only in Human sessions (Claude, Codex, Pi, omp, OpenCode), with an unclear-session notice, an opt-in decision log, scope/precedence/notices clauses in SKILL.md, and the fork identity for 0.5.0. Closes #1. --- .agents/plugins/marketplace.json | 4 +- .claude-plugin/marketplace.json | 6 +- .claude-plugin/plugin.json | 8 +- .codex-plugin/plugin.json | 17 +- .cursor/skills/i-have-adhd/SKILL.md | 10 + .github/install/INSTALL.ar.md | 92 +++--- .github/install/INSTALL.fa.md | 90 +++--- .github/install/INSTALL.id.md | 74 ++--- .github/install/INSTALL.ja.md | 88 ++--- .github/install/INSTALL.ko.md | 74 ++--- .github/install/INSTALL.pt-BR.md | 74 ++--- .github/install/INSTALL.vi.md | 74 ++--- .github/install/INSTALL.zh-CN.md | 90 +++--- .github/readme/README.ar.md | 10 +- .github/readme/README.es.md | 10 +- .github/readme/README.fa.md | 10 +- .github/readme/README.fr.md | 10 +- .github/readme/README.id.md | 8 +- .github/readme/README.ja.md | 10 +- .github/readme/README.ko.md | 8 +- .github/readme/README.pt-BR.md | 8 +- .github/readme/README.th.md | 10 +- .github/readme/README.vi.md | 8 +- .github/readme/README.zh-CN.md | 10 +- .github/workflows/claude.yml | 42 --- .github/workflows/plugin-load-check.yml | 7 +- .github/workflows/tests.yml | 22 ++ .opencode/plugins/i-have-adhd.mjs | 217 ++++++++++++- AGENTS.md | 60 ++-- CHANGELOG.md | 16 + CONTRIBUTING.md | 2 +- INSTALL.md | 184 ++++++----- LICENSE | 3 + README.md | 46 ++- docs/adr/0001-human-session-gating.md | 15 + evals/RESULTS.md | 80 +++++ evals/cases.jsonl | 5 + extensions/i-have-adhd.ts | 41 ++- gemini-extension.json | 2 +- hooks/always-on.mjs | 65 +++- hooks/hooks.codex.json | 17 + hooks/hooks.json | 2 +- hooks/session-kind.mjs | 397 +++++++++++++++++++++++ kimi.plugin.json | 4 +- package.json | 4 +- plugin.json | 1 + qwen-extension.json | 2 +- scripts/check_pi_extension.py | 304 +++++++++++------- skills/i-have-adhd/SKILL.md | 10 + tests/opencode_plugin_driver.mjs | 182 ++++++++++- tests/test_always_on_hooks.py | 175 +++++++--- tests/test_codex_hook.py | 240 ++++++++++++++ tests/test_install_docs.py | 128 +++++++- tests/test_opencode_plugin.py | 410 ++++++++++++++++++++++-- tests/test_release_metadata.py | 91 ++++++ tests/test_run_evals.py | 19 ++ tests/test_session_kind.py | 303 +++++++++++++++++ 57 files changed, 3146 insertions(+), 753 deletions(-) delete mode 100644 .github/workflows/claude.yml create mode 100644 .github/workflows/tests.yml create mode 100644 CHANGELOG.md create mode 100644 docs/adr/0001-human-session-gating.md create mode 100644 hooks/hooks.codex.json create mode 100644 hooks/session-kind.mjs create mode 100644 tests/test_codex_hook.py create mode 100644 tests/test_release_metadata.py create mode 100644 tests/test_session_kind.py diff --git a/.agents/plugins/marketplace.json b/.agents/plugins/marketplace.json index 6f0ab8f9..d3129617 100644 --- a/.agents/plugins/marketplace.json +++ b/.agents/plugins/marketplace.json @@ -1,5 +1,5 @@ { - "name": "i-have-adhd", + "name": "flyingnobita-i-have-adhd", "interface": { "displayName": "I Have ADHD" }, @@ -8,7 +8,7 @@ "name": "i-have-adhd", "source": { "source": "url", - "url": "https://github.com/ayghri/i-have-adhd.git", + "url": "https://github.com/flyingnobita/i-have-adhd.git", "ref": "main" }, "policy": { diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index 3423df78..c0ed0058 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -1,9 +1,9 @@ { "$schema": "https://www.schemastore.org/claude-code-marketplace.json", - "name": "i-have-adhd", - "description": "Shape Claude Code output for an ADHD reader. Action-first, numbered steps, no tangents.", + "name": "flyingnobita-i-have-adhd", + "description": "Shape Claude Code output for an ADHD reader. Action-first, numbered steps, no tangents. Always-on loads only in human sessions. Uninstall upstream first: both use the same skill name.", "owner": { - "name": "Ayoub G." + "name": "flyingnobita" }, "plugins": [ { diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index 7379dc58..d33ed688 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -1,9 +1,9 @@ { "name": "i-have-adhd", - "version": "0.4.1", - "description": "Shape Claude Code output for an ADHD reader: lead with the next action, number steps, suppress tangents, restate state, make wins visible.", + "version": "0.5.0", + "description": "Shape Claude Code output for an ADHD reader: lead with the next action, number steps, suppress tangents, restate state, make wins visible. Always-on loads only in human sessions. Uninstall upstream first: both use the same skill name.", "author": { - "name": "Ayoub G.", - "url": "https://github.com/ayghri" + "name": "flyingnobita", + "url": "https://github.com/flyingnobita" } } diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.json index 805485ba..5161da3e 100644 --- a/.codex-plugin/plugin.json +++ b/.codex-plugin/plugin.json @@ -1,13 +1,13 @@ { "name": "i-have-adhd", - "version": "0.4.1", + "version": "0.5.0", "description": "ADHD-friendly output shaping for Codex: action first, numbered steps, no tangents, and visible progress.", "author": { - "name": "Ayoub G.", - "url": "https://github.com/ayghri" + "name": "flyingnobita", + "url": "https://github.com/flyingnobita" }, - "homepage": "https://github.com/ayghri/i-have-adhd", - "repository": "https://github.com/ayghri/i-have-adhd", + "homepage": "https://github.com/flyingnobita/i-have-adhd", + "repository": "https://github.com/flyingnobita/i-have-adhd", "license": "MIT", "keywords": [ "adhd", @@ -17,16 +17,17 @@ "codex" ], "skills": "./skills/", + "hooks": "./hooks/hooks.codex.json", "interface": { "displayName": "I Have ADHD", "shortDescription": "Action-first output for ADHD readers", - "longDescription": "Shape Codex responses for an ADHD reader by leading with the next action, numbering multi-step work, suppressing tangents, restating state, and making progress visible.", - "developerName": "Ayoub G.", + "longDescription": "Shape Codex responses for an ADHD reader by leading with the next action, numbering multi-step work, suppressing tangents, restating state, and making progress visible. Loads only when a human is reading. Uninstall the upstream i-have-adhd plugin first: both use the same skill name, so their files collide.", + "developerName": "flyingnobita", "category": "Productivity", "capabilities": [ "Instructions" ], - "websiteURL": "https://github.com/ayghri/i-have-adhd", + "websiteURL": "https://github.com/flyingnobita/i-have-adhd", "defaultPrompt": [ "Use i-have-adhd for this task.", "Make this answer action-first and easy to execute.", diff --git a/.cursor/skills/i-have-adhd/SKILL.md b/.cursor/skills/i-have-adhd/SKILL.md index 6c42757f..d987a586 100644 --- a/.cursor/skills/i-have-adhd/SKILL.md +++ b/.cursor/skills/i-have-adhd/SKILL.md @@ -12,6 +12,16 @@ metadata: The reader has ADHD. Output is not just brief. It is shaped so an ADHD brain can act on it. +## Scope + +These rules shape only the chat reply to the person reading it. They do not shape a subagent prompt, a report to an orchestrator, a file, a commit message, a PR body, or a handoff document. A worker running unattended ignores this skill: nobody is reading its output as it arrives. + +## Other skills and instructions win + +A loaded skill's or instruction's format, procedure, or loop outranks these defaults. When a skill defines a question round, a table, a findings report, or a closing summary, deliver it in full: never cap, defer, or trim its lists, rows, questions, or sections to satisfy rule 2, 3, or 9. When a skill defines its own procedure, that procedure replaces the debug-spiral rule. + +A required notice or credit is not preamble or recap. Keep a credit or notice the harness or a hook requires (for example, a memory-credit blockquote) exactly where and as required, and never delete it. Never cut or defer content an instruction requires in a report. + ## Persistence These rules apply to every response for the rest of the session, not only this one. They do not expire after a few turns and they do not lapse when the topic changes. If you are unsure whether they still apply, they do. diff --git a/.github/install/INSTALL.ar.md b/.github/install/INSTALL.ar.md index c5130332..7b3ab012 100644 --- a/.github/install/INSTALL.ar.md +++ b/.github/install/INSTALL.ar.md @@ -1,3 +1,5 @@ +> Fork note: Uninstall upstream first because both projects use the same skill and command names. Read [Fork installation notes](../../INSTALL.md#fork-installation-notes) for the renamed marketplaces, human-session gating, Codex hook trust, logging, opt-out, and OpenCode exception. + # كيفية التثبيت
@@ -6,7 +8,7 @@ ### تثبيت ```bash -agy plugin install https://github.com/ayghri/i-have-adhd +agy plugin install https://github.com/flyingnobita/i-have-adhd ``` ### تحقق @@ -19,7 +21,7 @@ agy plugin list ```bash agy plugin uninstall i-have-adhd -agy plugin install https://github.com/ayghri/i-have-adhd +agy plugin install https://github.com/flyingnobita/i-have-adhd ``` ### إلغاء التثبيت @@ -67,7 +69,7 @@ agy plugin uninstall i-have-adhd ### تثبيت -1. قم بتنزيل [SKILL.md](https://raw.githubusercontent.com/ayghri/i-have-adhd/main/skills/i-have-adhd/SKILL.md) الأساسي واحفظه باسم `SKILL.md`. قم بمراجعة محتوياته قبل التحميل. +1. قم بتنزيل [SKILL.md](https://raw.githubusercontent.com/flyingnobita/i-have-adhd/main/skills/i-have-adhd/SKILL.md) الأساسي واحفظه باسم `SKILL.md`. قم بمراجعة محتوياته قبل التحميل. 2. في AstronClaw، افتح **我的技能 (مهاراتي)**، واختر **新建 (جديد)**، وقم بتحميل ملف `.md`. 3. تأكد من تسمية المهارة المستوردة `i-have-adhd`. استخدم **启用/禁用 (تمكين/تعطيل)** للتحكم في مدى توفرها. @@ -117,8 +119,8 @@ Use the i-have-adhd skill for this conversation. Explain how to create an empty ### تثبيت ```bash -claude plugin marketplace add ayghri/i-have-adhd -claude plugin install i-have-adhd@i-have-adhd +claude plugin marketplace add flyingnobita/i-have-adhd +claude plugin install i-have-adhd@flyingnobita-i-have-adhd ``` اكتب `/i-have-adhd`. @@ -132,15 +134,15 @@ claude plugin list ### تحديث ```bash -claude plugin marketplace update i-have-adhd -claude plugin update i-have-adhd@i-have-adhd +claude plugin marketplace update flyingnobita-i-have-adhd +claude plugin update i-have-adhd@flyingnobita-i-have-adhd ``` ### إلغاء التثبيت ```bash claude plugin uninstall i-have-adhd -claude plugin marketplace remove i-have-adhd +claude plugin marketplace remove flyingnobita-i-have-adhd ``` أو أبقِه مثبتًا وأوقف تشغيله: `claude plugin disable i-have-adhd`. @@ -176,8 +178,8 @@ rm ~/.claude/.i-have-adhd-always ### تثبيت ```bash -codex plugin marketplace add ayghri/i-have-adhd --ref main -codex plugin add i-have-adhd@i-have-adhd +codex plugin marketplace add flyingnobita/i-have-adhd --ref main +codex plugin add i-have-adhd@flyingnobita-i-have-adhd ``` قم باستدعاء المهارة بشكل صريح عن طريق كتابة `$i-have-adhd`. لن يفعّلها Codex تلقائيًا. @@ -191,16 +193,16 @@ codex plugin list ### تحديث ```bash -codex plugin marketplace upgrade i-have-adhd +codex plugin marketplace upgrade flyingnobita-i-have-adhd codex plugin remove i-have-adhd -codex plugin add i-have-adhd@i-have-adhd +codex plugin add i-have-adhd@flyingnobita-i-have-adhd ``` ### إلغاء التثبيت ```bash codex plugin remove i-have-adhd -codex plugin marketplace remove i-have-adhd +codex plugin marketplace remove flyingnobita-i-have-adhd ``` ### تشغيل دائمًا (اختياري) @@ -236,7 +238,7 @@ codex plugin marketplace remove i-have-adhd ### تثبيت ```bash -grok plugin install ayghri/i-have-adhd --trust +grok plugin install flyingnobita/i-have-adhd --trust grok plugin enable i-have-adhd ``` @@ -299,7 +301,7 @@ grok plugin uninstall i-have-adhd --confirm ```bash mkdir -p ~/.gemini/commands -curl -fsSL https://raw.githubusercontent.com/ayghri/i-have-adhd/main/skills/i-have-adhd/agents/gemini.toml \ +curl -fsSL https://raw.githubusercontent.com/flyingnobita/i-have-adhd/main/skills/i-have-adhd/agents/gemini.toml \ -o ~/.gemini/commands/i-have-adhd.toml ``` @@ -308,7 +310,7 @@ curl -fsSL https://raw.githubusercontent.com/ayghri/i-have-adhd/main/skills/i-ha ### التثبيت (امتداد، تشغيل دائم) ```bash -gemini extensions install https://github.com/ayghri/i-have-adhd +gemini extensions install https://github.com/flyingnobita/i-have-adhd ``` يحمّل الامتداد ملف `GEMINI.md`، الذي يستورد المهارة الكاملة، وبالتالي يتم تطبيق القواعد من الرسالة الأولى. يجب تثبيت `git`. @@ -346,14 +348,14 @@ rm ~/.gemini/commands/i-have-adhd.toml # طريقة الأمر ### تثبيت ```bash -npx skills add ayghri/i-have-adhd -a github-copilot # هذا المشروع -npx skills add ayghri/i-have-adhd -a github-copilot -g # جميع المشاريع +npx skills add flyingnobita/i-have-adhd -a github-copilot # هذا المشروع +npx skills add flyingnobita/i-have-adhd -a github-copilot -g # جميع المشاريع ``` بدون واجهة سطر الأوامر (CLI)، انسخ مجلد المهارات إلى أي دليل يقوم Copilot بمسحه: ```bash -git clone https://github.com/ayghri/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd mkdir -p ~/.copilot/skills cp -R i-have-adhd/skills/i-have-adhd ~/.copilot/skills/ ``` @@ -419,7 +421,7 @@ npx skills remove i-have-adhd ### تثبيت ```bash -hermes skills install ayghri/i-have-adhd/skills/i-have-adhd +hermes skills install flyingnobita/i-have-adhd/skills/i-have-adhd ``` اكتب `/i-have-adhd`. يتم تثبيت المهارة في `~/.hermes/skills/` ويتم عرضها كأمر يبدأ بشرطة مائلة في بداية الجلسة التالية. @@ -427,9 +429,9 @@ hermes skills install ayghri/i-have-adhd/skills/i-have-adhd هل تفضل التصفح أولا؟ أضف هذا المستودع كمصدر للمهارات (tap)، ثم ابحث وثبّت: ```bash -hermes skills tap add ayghri/i-have-adhd +hermes skills tap add flyingnobita/i-have-adhd hermes skills search adhd -hermes skills install ayghri/i-have-adhd/skills/i-have-adhd +hermes skills install flyingnobita/i-have-adhd/skills/i-have-adhd ``` ### تحقق @@ -450,7 +452,7 @@ hermes skills update i-have-adhd hermes skills uninstall i-have-adhd ``` -ولإزالة مصدر المهارات أيضًا: `hermes skills tap remove ayghri/i-have-adhd`. +ولإزالة مصدر المهارات أيضًا: `hermes skills tap remove flyingnobita/i-have-adhd`. ### تشغيل دائمًا (اختياري) @@ -486,7 +488,7 @@ hermes skills uninstall i-have-adhd 1. قم بتشغيل `/plugins`. 2. اختر **مخصص**. -3. الصق `https://github.com/ayghri/i-have-adhd` ثم اضغط على `Enter`. +3. الصق `https://github.com/flyingnobita/i-have-adhd` ثم اضغط على `Enter`. 4. اختر **الثقة والتثبيت**. استخدم الأمر الذي يبدأ بشرطة مائلة `/skill:i-have-adhd` لاستدعاء المهارة بشكل صريح. @@ -512,7 +514,7 @@ hermes skills uninstall i-have-adhd للاستخدام في جميع المشاريع: ```bash -git clone https://github.com/ayghri/i-have-adhd ~/.config/opencode/vendor/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd ~/.config/opencode/vendor/i-have-adhd mkdir -p ~/.config/opencode/plugins cat > ~/.config/opencode/plugins/i-have-adhd.js <<'EOF' export { default } from '../vendor/i-have-adhd/.opencode/plugins/i-have-adhd.mjs'; @@ -576,7 +578,7 @@ rm ~/.config/opencode/.i-have-adhd-always ### تثبيت ```bash -pi install https://github.com/ayghri/i-have-adhd +pi install https://github.com/flyingnobita/i-have-adhd ``` ابدأ جلسة Pi جديدة. بدّل الإخراج المناسب لـ ADHD للجلسة الحالية: @@ -618,7 +620,7 @@ pi list ### تحديث ```bash -pi update https://github.com/ayghri/i-have-adhd +pi update https://github.com/flyingnobita/i-have-adhd ``` أو قم بتحديث كل حزمة Pi غير المثبّتة بإصدار محدد باستخدام `pi update --extensions`. @@ -626,7 +628,7 @@ pi update https://github.com/ayghri/i-have-adhd ### إلغاء التثبيت ```bash -pi remove https://github.com/ayghri/i-have-adhd +pi remove https://github.com/flyingnobita/i-have-adhd ``` ### تشغيل دائمًا (اختياري) @@ -672,8 +674,8 @@ rm ~/.pi/agent/.i-have-adhd-always ### تثبيت ```bash -omp plugin marketplace add ayghri/i-have-adhd -omp plugin install --scope user i-have-adhd@i-have-adhd +omp plugin marketplace add flyingnobita/i-have-adhd +omp plugin install --scope user i-have-adhd@flyingnobita-i-have-adhd ``` ابدأ جلسة OMP جديدة وقم بتشغيل `/i-have-adhd` لتبديل الوضع. @@ -681,15 +683,15 @@ omp plugin install --scope user i-have-adhd@i-have-adhd ### تحديث ```bash -omp plugin marketplace update i-have-adhd -omp plugin upgrade --scope user i-have-adhd@i-have-adhd +omp plugin marketplace update flyingnobita-i-have-adhd +omp plugin upgrade --scope user i-have-adhd@flyingnobita-i-have-adhd ``` ### إلغاء التثبيت ```bash -omp plugin uninstall --scope user i-have-adhd@i-have-adhd -omp plugin marketplace remove i-have-adhd +omp plugin uninstall --scope user i-have-adhd@flyingnobita-i-have-adhd +omp plugin marketplace remove flyingnobita-i-have-adhd ```
@@ -701,7 +703,7 @@ omp plugin marketplace remove i-have-adhd ### تثبيت ```bash -qwen extensions install ayghri/i-have-adhd +qwen extensions install flyingnobita/i-have-adhd ``` يدعم Qwen Code اختصار GitHub ويثبّت المستودع كامتداد أصلي. يكتشف الامتداد المهارة تحت `skills/`. @@ -747,7 +749,7 @@ qwen extensions uninstall i-have-adhd في لوحة الوكيل، افتح مدير المهارات واختر **إنشاء مهارة من عنوان URL** (أيضًا في لوحة الأوامر باسم `agent: create skill from url`)، ثم الصق: ``` -https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md +https://github.com/flyingnobita/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md ``` احفظها في نطاق **المستخدم** لجميع المشاريع، أو في نطاق **المشروع** لمشروع واحد. ثم اكتب `/i-have-adhd` في لوحة الوكيل. @@ -755,7 +757,7 @@ https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md تفضل نظام الملفات؟ استنسخ المستودع وضَع مجلد المهارات في دليل مهارات المستخدم الخاص بك: ```bash -git clone https://github.com/ayghri/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd mkdir -p ~/.agents/skills cp -R i-have-adhd/skills/i-have-adhd ~/.agents/skills/ ``` @@ -805,10 +807,10 @@ cp -R i-have-adhd/skills/i-have-adhd ~/.agents/skills/ ### تثبيت ```bash -npx skills add ayghri/i-have-adhd # مساحة العمل هذه -npx skills add ayghri/i-have-adhd -g # جميع المشاريع -npx skills add ayghri/i-have-adhd -a cursor -y # وكيل واحد فقط -npx skills add ayghri/i-have-adhd -a opencode -y +npx skills add flyingnobita/i-have-adhd # مساحة العمل هذه +npx skills add flyingnobita/i-have-adhd -g # جميع المشاريع +npx skills add flyingnobita/i-have-adhd -a cursor -y # وكيل واحد فقط +npx skills add flyingnobita/i-have-adhd -a opencode -y ``` في محادثة جديدة مع الوكيل، اكتب `/i-have-adhd`. @@ -816,7 +818,7 @@ npx skills add ayghri/i-have-adhd -a opencode -y بدون واجهة سطر الأوامر (CLI)، انسخ مجلد المهارات إلى أي مسار يفحصه وكيلك: ```bash -git clone https://github.com/ayghri/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd mkdir -p ~/.cursor/skills # استخدم .agents/skills مع OpenCode أو المسار الخاص بوكيلك cp -R i-have-adhd/skills/i-have-adhd ~/.cursor/skills/ ``` @@ -880,7 +882,7 @@ npx skills remove i-have-adhd -g # إذا ثُبّتت عالميًا **`/i-have-adhd` ليس في وضع الإكمال التلقائي.** أعد تشغيل الوكيل. تتم قراءة فهرس المكوّن الإضافي عند بدء التشغيل. في Grok، شغّل أيضًا `grok plugin enable i-have-adhd` وتأكد من أن التثبيت استخدم `--trust`. -**علامة التشغيل الدائم ليس لها أي تأثير.** قم بتحديث المكوّن الإضافي (`claude plugin marketplace update i-have-adhd` ثم `claude plugin update i-have-adhd@i-have-adhd`) وأعد التشغيل. تتم قراءة الخطافات عند بدء التشغيل، ويتطلب ملف العلامة إصدارًا من المكوّن الإضافي يتضمن `hooks/hooks.json`. لا يقرأ Grok ملف `~/.claude/.i-have-adhd-always`؛ ضع كتلة التشغيل الدائم بدلاً من ذلك في `~/.grok/AGENTS.md` أو `~/.grok/rules/i-have-adhd.md`. +**علامة التشغيل الدائم ليس لها أي تأثير.** قم بتحديث المكوّن الإضافي (`claude plugin marketplace update flyingnobita-i-have-adhd` ثم `claude plugin update i-have-adhd@flyingnobita-i-have-adhd`) وأعد التشغيل. تتم قراءة الخطافات عند بدء التشغيل، ويتطلب ملف العلامة إصدارًا من المكوّن الإضافي يتضمن `hooks/hooks.json`. لا يقرأ Grok ملف `~/.claude/.i-have-adhd-always`؛ ضع كتلة التشغيل الدائم بدلاً من ذلك في `~/.grok/AGENTS.md` أو `~/.grok/rules/i-have-adhd.md`. **فشل `claude plugin marketplace add`.** استخدم نموذج `owner/repo`. يجب أن يشير المسار المحلي إلى جذر المستودع، وليس إلى `.claude-plugin/`. @@ -892,9 +894,9 @@ npx skills remove i-have-adhd -g # إذا ثُبّتت عالميًا ```bash claude plugin uninstall i-have-adhd # أزل النسخة الأصلية أولاً -claude plugin marketplace remove i-have-adhd # النسخة المتفرعة والأصلية تحملان الاسم نفسه +claude plugin marketplace remove flyingnobita-i-have-adhd # النسخة المتفرعة والأصلية تحملان الاسم نفسه claude plugin marketplace add /i-have-adhd -claude plugin install i-have-adhd@i-have-adhd +claude plugin install i-have-adhd@ ``` أعد التشغيل، ثم أعد استدعاء `/i-have-adhd`. diff --git a/.github/install/INSTALL.fa.md b/.github/install/INSTALL.fa.md index 823541db..c9d6b047 100644 --- a/.github/install/INSTALL.fa.md +++ b/.github/install/INSTALL.fa.md @@ -1,3 +1,5 @@ +> Fork note: Uninstall upstream first because both projects use the same skill and command names. Read [Fork installation notes](../../INSTALL.md#fork-installation-notes) for the renamed marketplaces, human-session gating, Codex hook trust, logging, opt-out, and OpenCode exception. + # نحوه نصب
@@ -6,7 +8,7 @@ ### نصب ```bash -agy plugin install https://github.com/ayghri/i-have-adhd +agy plugin install https://github.com/flyingnobita/i-have-adhd ``` ### بررسی صحت نصب @@ -19,7 +21,7 @@ agy plugin list ```bash agy plugin uninstall i-have-adhd -agy plugin install https://github.com/ayghri/i-have-adhd +agy plugin install https://github.com/flyingnobita/i-have-adhd ``` ### حذف نصب @@ -64,7 +66,7 @@ AstronClaw از وارد کردن فایل Markdown به عنوان یک مها ### نصب -1. فایل [SKILL.md اصلی](https://raw.githubusercontent.com/ayghri/i-have-adhd/main/skills/i-have-adhd/SKILL.md) را دانلود کرده و با نام `SKILL.md` ذخیره کنید. قبل از بارگذاری، محتوای آن را مرور کنید. +1. فایل [SKILL.md اصلی](https://raw.githubusercontent.com/flyingnobita/i-have-adhd/main/skills/i-have-adhd/SKILL.md) را دانلود کرده و با نام `SKILL.md` ذخیره کنید. قبل از بارگذاری، محتوای آن را مرور کنید. 2. در AstronClaw، بخش **我的技能 (My skills)** را باز کنید، **新建 (New)** را انتخاب کرده و آن فایل `.md` را بارگذاری کنید. 3. مطمئن شوید نام مهارت واردشده `i-have-adhd` است. برای کنترل در دسترس بودن آن، از گزینه **启用/禁用 (Enable/Disable)** استفاده کنید. @@ -102,8 +104,8 @@ AstronClaw هم از درخواست‌های صریح و هم از فراخوا ### نصب ```bash -claude plugin marketplace add ayghri/i-have-adhd -claude plugin install i-have-adhd@i-have-adhd +claude plugin marketplace add flyingnobita/i-have-adhd +claude plugin install i-have-adhd@flyingnobita-i-have-adhd ``` سپس دستور `/i-have-adhd` را تایپ کنید. @@ -117,15 +119,15 @@ claude plugin list ### به‌روزرسانی ```bash -claude plugin marketplace update i-have-adhd -claude plugin update i-have-adhd@i-have-adhd +claude plugin marketplace update flyingnobita-i-have-adhd +claude plugin update i-have-adhd@flyingnobita-i-have-adhd ``` ### حذف نصب ```bash claude plugin uninstall i-have-adhd -claude plugin marketplace remove i-have-adhd +claude plugin marketplace remove flyingnobita-i-have-adhd ``` یا اگر می‌خواهید نصب بماند اما غیرفعال شود: `claude plugin disable i-have-adhd`. @@ -160,8 +162,8 @@ rm ~/.claude/.i-have-adhd-always ### نصب ```bash -codex plugin marketplace add ayghri/i-have-adhd --ref main -codex plugin add i-have-adhd@i-have-adhd +codex plugin marketplace add flyingnobita/i-have-adhd --ref main +codex plugin add i-have-adhd@flyingnobita-i-have-adhd ``` برای فراخوانی صریح مهارت، دستور `$i-have-adhd` را تایپ کنید. Codex آن را به صورت خودکار فعال نمی‌کند. @@ -175,16 +177,16 @@ codex plugin list ### به‌روزرسانی ```bash -codex plugin marketplace upgrade i-have-adhd +codex plugin marketplace upgrade flyingnobita-i-have-adhd codex plugin remove i-have-adhd -codex plugin add i-have-adhd@i-have-adhd +codex plugin add i-have-adhd@flyingnobita-i-have-adhd ``` ### حذف نصب ```bash codex plugin remove i-have-adhd -codex plugin marketplace remove i-have-adhd +codex plugin marketplace remove flyingnobita-i-have-adhd ``` ### همیشه فعال (اختیاری) @@ -221,7 +223,7 @@ Gemini CLI بازارچه (marketplace) پلاگین ندارد، بنابرای ```bash mkdir -p ~/.gemini/commands -curl -fsSL https://raw.githubusercontent.com/ayghri/i-have-adhd/main/skills/i-have-adhd/agents/gemini.toml \ +curl -fsSL https://raw.githubusercontent.com/flyingnobita/i-have-adhd/main/skills/i-have-adhd/agents/gemini.toml \ -o ~/.gemini/commands/i-have-adhd.toml ``` @@ -230,7 +232,7 @@ curl -fsSL https://raw.githubusercontent.com/ayghri/i-have-adhd/main/skills/i-ha ### نصب (افزونه، همیشه فعال) ```bash -gemini extensions install https://github.com/ayghri/i-have-adhd +gemini extensions install https://github.com/flyingnobita/i-have-adhd ``` این افزونه `GEMINI.md` را بارگذاری می‌کند که مهارت کامل را وارد می‌کند، بنابراین قوانین از همان پیام اول اعمال می‌شوند. `git` باید نصب باشد. @@ -268,14 +270,14 @@ Copilot مهارت‌های عامل (Agent Skills) را به صورت بومی ### نصب ```bash -npx skills add ayghri/i-have-adhd -a github-copilot # فقط این پروژه -npx skills add ayghri/i-have-adhd -a github-copilot -g # همه پروژه‌ها +npx skills add flyingnobita/i-have-adhd -a github-copilot # فقط این پروژه +npx skills add flyingnobita/i-have-adhd -a github-copilot -g # همه پروژه‌ها ``` بدون استفاده از CLI، پوشه مهارت را در هر دایرکتوری که Copilot اسکن می‌کند کپی کنید: ```bash -git clone https://github.com/ayghri/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd mkdir -p ~/.copilot/skills cp -R i-have-adhd/skills/i-have-adhd ~/.copilot/skills/ ``` @@ -340,7 +342,7 @@ Exceptions: explain fully when asked to explain. Confirm before destructive acti ### نصب ```bash -hermes skills install ayghri/i-have-adhd/skills/i-have-adhd +hermes skills install flyingnobita/i-have-adhd/skills/i-have-adhd ``` دستور `/i-have-adhd` را تایپ کنید. این مهارت در `~/.hermes/skills/` نصب شده و به عنوان یک دستور اسلش در شروع نشست بعدی در دسترس قرار می‌گیرد. @@ -348,9 +350,9 @@ hermes skills install ayghri/i-have-adhd/skills/i-have-adhd اگر ترجیح می‌دهید ابتدا مرور کنید؟ این ریپازیتوری را به عنوان منبع مهارت (یک "tap") اضافه کنید، سپس جستجو و نصب کنید: ```bash -hermes skills tap add ayghri/i-have-adhd +hermes skills tap add flyingnobita/i-have-adhd hermes skills search adhd -hermes skills install ayghri/i-have-adhd/skills/i-have-adhd +hermes skills install flyingnobita/i-have-adhd/skills/i-have-adhd ``` ### بررسی صحت نصب @@ -371,7 +373,7 @@ hermes skills update i-have-adhd hermes skills uninstall i-have-adhd ``` -یا برای حذف کامل منبع نیز: `hermes skills tap remove ayghri/i-have-adhd`. +یا برای حذف کامل منبع نیز: `hermes skills tap remove flyingnobita/i-have-adhd`. ### همیشه فعال (اختیاری) @@ -407,7 +409,7 @@ Exceptions: explain fully when asked to explain. Confirm before destructive acti 1. دستور `/plugins` را اجرا کنید. 2. گزینه **Custom** را انتخاب کنید. -3. آدرس `https://github.com/ayghri/i-have-adhd` را پیست کرده و `Enter` را بزنید. +3. آدرس `https://github.com/flyingnobita/i-have-adhd` را پیست کرده و `Enter` را بزنید. 4. گزینه **Trust and install** را انتخاب کنید. برای فراخوانی صریح مهارت، از دستور اسلش `/skill:i-have-adhd` استفاده کنید. @@ -432,7 +434,7 @@ Exceptions: explain fully when asked to explain. Confirm before destructive acti برای استفاده در همه پروژه‌ها: ```bash -git clone https://github.com/ayghri/i-have-adhd ~/.config/opencode/vendor/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd ~/.config/opencode/vendor/i-have-adhd mkdir -p ~/.config/opencode/plugins cat > ~/.config/opencode/plugins/i-have-adhd.js <<'EOF' export { default } from '../vendor/i-have-adhd/.opencode/plugins/i-have-adhd.mjs'; @@ -495,7 +497,7 @@ Pi این ریپازیتوری را به عنوان یک بسته بومی کش ### نصب ```bash -pi install https://github.com/ayghri/i-have-adhd +pi install https://github.com/flyingnobita/i-have-adhd ``` یک نشست جدید Pi شروع کنید. حالت دوستدار ADHD را برای نشست جاری تغییر دهید: @@ -537,7 +539,7 @@ pi list ### به‌روزرسانی ```bash -pi update https://github.com/ayghri/i-have-adhd +pi update https://github.com/flyingnobita/i-have-adhd ``` یا همه بسته‌های Pi که پین نشده‌اند را با `pi update --extensions` به‌روزرسانی کنید. @@ -545,7 +547,7 @@ pi update https://github.com/ayghri/i-have-adhd ### حذف نصب ```bash -pi remove https://github.com/ayghri/i-have-adhd +pi remove https://github.com/flyingnobita/i-have-adhd ``` ### همیشه فعال (اختیاری) @@ -590,8 +592,8 @@ rm ~/.pi/agent/.i-have-adhd-always ### نصب ```bash -omp plugin marketplace add ayghri/i-have-adhd -omp plugin install --scope user i-have-adhd@i-have-adhd +omp plugin marketplace add flyingnobita/i-have-adhd +omp plugin install --scope user i-have-adhd@flyingnobita-i-have-adhd ``` یک نشست جدید OMP شروع کنید و برای تغییر حالت، دستور `/i-have-adhd` را اجرا کنید. @@ -599,15 +601,15 @@ omp plugin install --scope user i-have-adhd@i-have-adhd ### به‌روزرسانی ```bash -omp plugin marketplace update i-have-adhd -omp plugin upgrade --scope user i-have-adhd@i-have-adhd +omp plugin marketplace update flyingnobita-i-have-adhd +omp plugin upgrade --scope user i-have-adhd@flyingnobita-i-have-adhd ``` ### حذف نصب ```bash -omp plugin uninstall --scope user i-have-adhd@i-have-adhd -omp plugin marketplace remove i-have-adhd +omp plugin uninstall --scope user i-have-adhd@flyingnobita-i-have-adhd +omp plugin marketplace remove flyingnobita-i-have-adhd ```
@@ -618,7 +620,7 @@ omp plugin marketplace remove i-have-adhd ### نصب ```bash -qwen extensions install ayghri/i-have-adhd +qwen extensions install flyingnobita/i-have-adhd ``` Qwen Code از مخفف GitHub پشتیبانی می‌کند و ریپازیتوری را به عنوان یک افزونه بومی نصب می‌کند. این افزونه مهارت را در پوشه `skills/` کشف می‌کند. @@ -663,7 +665,7 @@ qwen extensions uninstall i-have-adhd در پنل Agent، مدیر مهارت‌ها (Skills manager) را باز کرده و **Create skill from URL** (همچنین در پالت دستورات به عنوان `agent: create skill from url`) را انتخاب کنید، سپس آدرس زیر را پیست کنید: ```text -https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md +https://github.com/flyingnobita/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md ``` آن را در محدوده **User** برای همه پروژه‌ها، یا در محدوده **Project** برای یک پروژه ذخیره کنید. سپس در پنل Agent دستور `/i-have-adhd` را تایپ کنید. @@ -671,7 +673,7 @@ https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md اگر فایل‌سیستم را ترجیح می‌دهید؟ ریپازیتوری را کلون کرده و پوشه مهارت را در دایرکتوری مهارت‌های کاربر خود رها کنید: ```bash -git clone https://github.com/ayghri/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd mkdir -p ~/.agents/skills cp -R i-have-adhd/skills/i-have-adhd ~/.agents/skills/ ``` @@ -721,10 +723,10 @@ Exceptions: explain fully when asked to explain. Confirm before destructive acti ### نصب ```bash -npx skills add ayghri/i-have-adhd # فقط این فضای کاری -npx skills add ayghri/i-have-adhd -g # همه پروژه‌ها -npx skills add ayghri/i-have-adhd -a cursor -y # فقط یک عامل خاص -npx skills add ayghri/i-have-adhd -a opencode -y +npx skills add flyingnobita/i-have-adhd # فقط این فضای کاری +npx skills add flyingnobita/i-have-adhd -g # همه پروژه‌ها +npx skills add flyingnobita/i-have-adhd -a cursor -y # فقط یک عامل خاص +npx skills add flyingnobita/i-have-adhd -a opencode -y ``` در چت جدید عامل، دستور `/i-have-adhd` را تایپ کنید. @@ -732,7 +734,7 @@ npx skills add ayghri/i-have-adhd -a opencode -y بدون استفاده از CLI، پوشه مهارت را در هر مسیری که عامل شما اسکن می‌کند کپی کنید: ```bash -git clone https://github.com/ayghri/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd mkdir -p ~/.cursor/skills # برای Cursor. برای OpenCode از .agents/skills یا مسیر خاص عامل خود استفاده کنید cp -R i-have-adhd/skills/i-have-adhd ~/.cursor/skills/ ``` @@ -795,7 +797,7 @@ Exceptions: explain fully when asked to explain. Confirm before destructive acti **دستور `/i-have-adhd` در تکمیل خودکار نیست.** عامل را مجدداً راه‌اندازی کنید. فهرست پلاگین‌ها در شروع خوانده می‌شود. -**پرچم همیشه فعال اثری ندارد.** پلاگین را به‌روزرسانی کنید (`claude plugin marketplace update i-have-adhd` و سپس `claude plugin update i-have-adhd@i-have-adhd`) و مجدداً راه‌اندازی کنید. هوک‌ها در شروع خوانده می‌شوند و پرچم به نسخه‌ای از پلاگین نیاز دارد که `hooks/hooks.json` را ارائه می‌دهد. +**پرچم همیشه فعال اثری ندارد.** پلاگین را به‌روزرسانی کنید (`claude plugin marketplace update flyingnobita-i-have-adhd` و سپس `claude plugin update i-have-adhd@flyingnobita-i-have-adhd`) و مجدداً راه‌اندازی کنید. هوک‌ها در شروع خوانده می‌شوند و پرچم به نسخه‌ای از پلاگین نیاز دارد که `hooks/hooks.json` را ارائه می‌دهد. **دستور `claude plugin marketplace add` با خطا مواجه می‌شود.** از فرم `owner/repo` استفاده کنید. یک مسیر محلی باید به ریشه ریپازیتوری اشاره کند، نه به `.claude-plugin/`. @@ -805,9 +807,9 @@ Exceptions: explain fully when asked to explain. Confirm before destructive acti ```bash claude plugin uninstall i-have-adhd # ابتدا نسخه اصلی را حذف کنید: -claude plugin marketplace remove i-have-adhd # نام فورک و نسخه اصلی هر دو یکسان است +claude plugin marketplace remove flyingnobita-i-have-adhd # نام فورک و نسخه اصلی هر دو یکسان است claude plugin marketplace add /i-have-adhd -claude plugin install i-have-adhd@i-have-adhd +claude plugin install i-have-adhd@ ``` مجدداً راه‌اندازی کنید، سپس `/i-have-adhd` را مجدداً فراخوانی کنید. diff --git a/.github/install/INSTALL.id.md b/.github/install/INSTALL.id.md index df70eb1e..3f2eca65 100644 --- a/.github/install/INSTALL.id.md +++ b/.github/install/INSTALL.id.md @@ -1,3 +1,5 @@ +> Fork note: Uninstall upstream first because both projects use the same skill and command names. Read [Fork installation notes](../../INSTALL.md#fork-installation-notes) for the renamed marketplaces, human-session gating, Codex hook trust, logging, opt-out, and OpenCode exception. + # Cara Menginstal
@@ -6,7 +8,7 @@ ### Instalasi ```bash -agy plugin install https://github.com/ayghri/i-have-adhd +agy plugin install https://github.com/flyingnobita/i-have-adhd ``` ### Verifikasi @@ -19,7 +21,7 @@ agy plugin list ```bash agy plugin uninstall i-have-adhd -agy plugin install https://github.com/ayghri/i-have-adhd +agy plugin install https://github.com/flyingnobita/i-have-adhd ``` ### Uninstal @@ -61,8 +63,8 @@ Pengecualian: jelaskan secara lengkap jika diminta. Konfirmasi sebelum melakukan ### Instalasi ```bash -claude plugin marketplace add ayghri/i-have-adhd -claude plugin install i-have-adhd@i-have-adhd +claude plugin marketplace add flyingnobita/i-have-adhd +claude plugin install i-have-adhd@flyingnobita-i-have-adhd ``` Ketik `/i-have-adhd`. @@ -76,15 +78,15 @@ claude plugin list ### Pembaruan ```bash -claude plugin marketplace update i-have-adhd -claude plugin update i-have-adhd@i-have-adhd +claude plugin marketplace update flyingnobita-i-have-adhd +claude plugin update i-have-adhd@flyingnobita-i-have-adhd ``` ### Uninstal ```bash claude plugin uninstall i-have-adhd -claude plugin marketplace remove i-have-adhd +claude plugin marketplace remove flyingnobita-i-have-adhd ``` Atau biarkan terinstal tetapi nonaktifkan: `claude plugin disable i-have-adhd`. @@ -119,8 +121,8 @@ Hook ini hanya berjalan ketika file penanda ada, jadi menginstal plugin saja tid ### Instalasi ```bash -codex plugin marketplace add ayghri/i-have-adhd --ref main -codex plugin add i-have-adhd@i-have-adhd +codex plugin marketplace add flyingnobita/i-have-adhd --ref main +codex plugin add i-have-adhd@flyingnobita-i-have-adhd ``` Aktifkan skill ini secara eksplisit dengan mengetik `$i-have-adhd`. Codex ga bakalan memanggilnya secara otomatis. @@ -134,16 +136,16 @@ codex plugin list ### Pembaruan ```bash -codex plugin marketplace upgrade i-have-adhd +codex plugin marketplace upgrade flyingnobita-i-have-adhd codex plugin remove i-have-adhd -codex plugin add i-have-adhd@i-have-adhd +codex plugin add i-have-adhd@flyingnobita-i-have-adhd ``` ### Uninstal ```bash codex plugin remove i-have-adhd -codex plugin marketplace remove i-have-adhd +codex plugin marketplace remove flyingnobita-i-have-adhd ``` ### Selalu Aktif (opsional) @@ -180,7 +182,7 @@ Gemini CLI tidak memiliki marketplace plugin, jadi ada dua opsi bawaan: perintah ```bash mkdir -p ~/.gemini/commands -curl -fsSL https://raw.githubusercontent.com/ayghri/i-have-adhd/main/skills/i-have-adhd/agents/gemini.toml \ +curl -fsSL https://raw.githubusercontent.com/flyingnobita/i-have-adhd/main/skills/i-have-adhd/agents/gemini.toml \ -o ~/.gemini/commands/i-have-adhd.toml ``` @@ -189,7 +191,7 @@ Mulai sesi baru dan ketik `/i-have-adhd`. Skill ini akan tetap aktif selama sesi ### Instalasi (ekstensi, always-on) ```bash -gemini extensions install https://github.com/ayghri/i-have-adhd +gemini extensions install https://github.com/flyingnobita/i-have-adhd ``` Ekstensi ini memuat `GEMINI.md`, yang mengimpor skill secara lengkap; dengan demikian, aturannya berlaku sejak pesan pertama. Git harus sudah terinstal. @@ -227,14 +229,14 @@ Copilot membaca Agent Skills secara native: menggunakan file `SKILL.md` yang sam ### Instalasi ```bash -npx skills add ayghri/i-have-adhd -a github-copilot # proyek ini -npx skills add ayghri/i-have-adhd -a github-copilot -g # semua proyek +npx skills add flyingnobita/i-have-adhd -a github-copilot # proyek ini +npx skills add flyingnobita/i-have-adhd -a github-copilot -g # semua proyek ``` Tanpa CLI, salin folder skill ke direktori mana pun yang diperiksa oleh Copilot: ```bash -git clone https://github.com/ayghri/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd mkdir -p ~/.copilot/skills cp -R i-have-adhd/skills/i-have-adhd ~/.copilot/skills/ ``` @@ -299,7 +301,7 @@ Pengecualian: jelaskan secara lengkap jika diminta. Konfirmasi sebelum melakukan ### Instalasi ```bash -hermes skills install ayghri/i-have-adhd/skills/i-have-adhd +hermes skills install flyingnobita/i-have-adhd/skills/i-have-adhd ``` Ketik `/i-have-adhd`. Skill ini akan diinstal ke `~/.hermes/skills/` dan tersedia sebagai perintah slash saat sesi berikutnya dimulai. @@ -307,9 +309,9 @@ Ketik `/i-have-adhd`. Skill ini akan diinstal ke `~/.hermes/skills/` dan tersedi Lebih suka menjelajah dulu? Tambahkan repositori ini sebagai sumber skill (sebagai "tap"), lalu cari dan instal: ```bash -hermes skills tap add ayghri/i-have-adhd +hermes skills tap add flyingnobita/i-have-adhd hermes skills search adhd -hermes skills install ayghri/i-have-adhd/skills/i-have-adhd +hermes skills install flyingnobita/i-have-adhd/skills/i-have-adhd ``` ### Verifikasi @@ -330,7 +332,7 @@ hermes skills update i-have-adhd hermes skills uninstall i-have-adhd ``` -Atau hapus juga tap-nya: `hermes skills tap remove ayghri/i-have-adhd`. +Atau hapus juga tap-nya: `hermes skills tap remove flyingnobita/i-have-adhd`. ### Selalu Aktif (opsional) @@ -366,7 +368,7 @@ Mulai sesi Kimi Code dan: 1. Jalankan `/plugins`. 2. Pilih **Custom**. -3. Tempel `https://github.com/ayghri/i-have-adhd` dan tekan Enter. +3. Tempel `https://github.com/flyingnobita/i-have-adhd` dan tekan Enter. 4. Pilih **Trust and install**. Gunakan perintah slash `/skill:i-have-adhd` untuk memanggil skill ini secara eksplisit. @@ -391,7 +393,7 @@ Plugin mendukung OpenCode V1 **1.18.29 atau lebih baru** dan V2. Plugin mendafta Untuk digunakan di semua proyek: ```bash -git clone https://github.com/ayghri/i-have-adhd ~/.config/opencode/vendor/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd ~/.config/opencode/vendor/i-have-adhd mkdir -p ~/.config/opencode/plugins cat > ~/.config/opencode/plugins/i-have-adhd.js <<'EOF' export { default } from '../vendor/i-have-adhd/.opencode/plugins/i-have-adhd.mjs'; @@ -454,13 +456,13 @@ Pi mengimplementasikan standar Agent Skills, sehingga file `SKILL.md` yang sama ### Instalasi ```bash -npx skills add ayghri/i-have-adhd -a pi -y +npx skills add flyingnobita/i-have-adhd -a pi -y ``` Lebih suka menggunakan sistem file? Pi menemukan skill di `~/.pi/agent/skills/` dan `~/.agents/skills/` (global), serta di `.pi/skills/` dan `.agents/skills/` (proyek): ```bash -git clone https://github.com/ayghri/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd mkdir -p ~/.pi/agent/skills cp -R i-have-adhd/skills/i-have-adhd ~/.pi/agent/skills/ ``` @@ -528,7 +530,7 @@ Pengecualian: jelaskan secara lengkap jika diminta. Konfirmasi sebelum melakukan ### Instalasi ```bash -qwen extensions install ayghri/i-have-adhd +qwen extensions install flyingnobita/i-have-adhd ``` Qwen Code menerima format singkat GitHub dan menginstal repositori sebagai ekstensi native. Ekstensi ini akan menemukan skill di dalam `skills/`. @@ -573,7 +575,7 @@ Zed Agent membaca Agent Skills secara native: menggunakan file `SKILL.md` yang s Di Agent Panel, buka pengelola Skills, pilih **Create skill from URL** (juga tersedia di palet sebagai `agent: create skill from url`) dan tempel: ``` -https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md +https://github.com/flyingnobita/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md ``` Simpan dengan cakupan **User** untuk semua proyek, atau **Project** untuk satu proyek tertentu. Setelah itu, ketik `/i-have-adhd` di Agent Panel. @@ -581,7 +583,7 @@ Simpan dengan cakupan **User** untuk semua proyek, atau **Project** untuk satu p Lebih suka menggunakan sistem file? Klon repositori dan letakkan folder skill di direktori skill pengguna: ```bash -git clone https://github.com/ayghri/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd mkdir -p ~/.agents/skills cp -R i-have-adhd/skills/i-have-adhd ~/.agents/skills/ ``` @@ -631,10 +633,10 @@ Berfungsi di lingkungan apa pun yang mendukung pembacaan Agent Skills. Ganti `-a ### Instalasi ```bash -npx skills add ayghri/i-have-adhd # workspace ini -npx skills add ayghri/i-have-adhd -g # semua proyek -npx skills add ayghri/i-have-adhd -a cursor -y # satu agen saja -npx skills add ayghri/i-have-adhd -a opencode -y +npx skills add flyingnobita/i-have-adhd # workspace ini +npx skills add flyingnobita/i-have-adhd -g # semua proyek +npx skills add flyingnobita/i-have-adhd -a cursor -y # satu agen saja +npx skills add flyingnobita/i-have-adhd -a opencode -y ``` Buka obrolan agen baru dan ketik `/i-have-adhd`. @@ -642,7 +644,7 @@ Buka obrolan agen baru dan ketik `/i-have-adhd`. Tanpa CLI, salin folder skill ke jalur yang diperiksa oleh agen Anda: ```bash -git clone https://github.com/ayghri/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd mkdir -p ~/.cursor/skills # Cursor. Gunakan .agents/skills di OpenCode atau jalur khusus agen Anda cp -R i-have-adhd/skills/i-have-adhd ~/.cursor/skills/ ``` @@ -706,7 +708,7 @@ Di Claude Code, Qwen Code, dan Codex gak ada jalan tengah: jikalau Anda tidak me **`/i-have-adhd` tidak muncul di pelengkapan otomatis (autocomplete).** Mulai ulang agen Anda. Indeks plugin dibaca saat startup. -**Flag selalu aktif tidak berfungsi.** Perbarui plugin (`claude plugin marketplace update i-have-adhd`, lalu `claude plugin update i-have-adhd@i-have-adhd`) dan mulai ulang. Hook dibaca saat startup, dan flag ini memerlukan versi yang menyertakan `hooks/hooks.json`. +**Flag selalu aktif tidak berfungsi.** Perbarui plugin (`claude plugin marketplace update flyingnobita-i-have-adhd`, lalu `claude plugin update i-have-adhd@flyingnobita-i-have-adhd`) dan mulai ulang. Hook dibaca saat startup, dan flag ini memerlukan versi yang menyertakan `hooks/hooks.json`. **`claude plugin marketplace add` gagal.** Gunakan format `owner/repo`. Jalur lokal harus mengarah ke root repositori, bukan ke `.claude-plugin/`. @@ -716,9 +718,9 @@ Di Claude Code, Qwen Code, dan Codex gak ada jalan tengah: jikalau Anda tidak me ```bash claude plugin uninstall i-have-adhd # hapus dulu salinan upstream: -claude plugin marketplace remove i-have-adhd # fork dan upstream menggunakan nama yang sama +claude plugin marketplace remove flyingnobita-i-have-adhd # fork dan upstream menggunakan nama yang sama claude plugin marketplace add /i-have-adhd -claude plugin install i-have-adhd@i-have-adhd +claude plugin install i-have-adhd@ ``` Mulai ulang dan panggillah `/i-have-adhd` lagi. diff --git a/.github/install/INSTALL.ja.md b/.github/install/INSTALL.ja.md index ae46e220..efc3703c 100644 --- a/.github/install/INSTALL.ja.md +++ b/.github/install/INSTALL.ja.md @@ -1,3 +1,5 @@ +> Fork note: Uninstall upstream first because both projects use the same skill and command names. Read [Fork installation notes](../../INSTALL.md#fork-installation-notes) for the renamed marketplaces, human-session gating, Codex hook trust, logging, opt-out, and OpenCode exception. + # インストール方法
@@ -6,7 +8,7 @@ ### インストール ```bash -agy plugin install https://github.com/ayghri/i-have-adhd +agy plugin install https://github.com/flyingnobita/i-have-adhd ``` ### 確認 @@ -19,7 +21,7 @@ agy plugin list ```bash agy plugin uninstall i-have-adhd -agy plugin install https://github.com/ayghri/i-have-adhd +agy plugin install https://github.com/flyingnobita/i-have-adhd ``` ### アンインストール @@ -61,8 +63,8 @@ agy plugin uninstall i-have-adhd ### インストール ```bash -claude plugin marketplace add ayghri/i-have-adhd -claude plugin install i-have-adhd@i-have-adhd +claude plugin marketplace add flyingnobita/i-have-adhd +claude plugin install i-have-adhd@flyingnobita-i-have-adhd ``` `/i-have-adhd` と入力します。 @@ -76,15 +78,15 @@ claude plugin list ### 更新 ```bash -claude plugin marketplace update i-have-adhd -claude plugin update i-have-adhd@i-have-adhd +claude plugin marketplace update flyingnobita-i-have-adhd +claude plugin update i-have-adhd@flyingnobita-i-have-adhd ``` ### アンインストール ```bash claude plugin uninstall i-have-adhd -claude plugin marketplace remove i-have-adhd +claude plugin marketplace remove flyingnobita-i-have-adhd ``` インストールしたまま無効化する場合:`claude plugin disable i-have-adhd` @@ -120,8 +122,8 @@ rm ~/.claude/.i-have-adhd-always ### インストール ```bash -codex plugin marketplace add ayghri/i-have-adhd --ref main -codex plugin add i-have-adhd@i-have-adhd +codex plugin marketplace add flyingnobita/i-have-adhd --ref main +codex plugin add i-have-adhd@flyingnobita-i-have-adhd ``` `$i-have-adhd` と明示的に入力してスキルを呼び出します。Codex が自動で有効化することはありません。 @@ -135,16 +137,16 @@ codex plugin list ### 更新 ```bash -codex plugin marketplace upgrade i-have-adhd +codex plugin marketplace upgrade flyingnobita-i-have-adhd codex plugin remove i-have-adhd -codex plugin add i-have-adhd@i-have-adhd +codex plugin add i-have-adhd@flyingnobita-i-have-adhd ``` ### アンインストール ```bash codex plugin remove i-have-adhd -codex plugin marketplace remove i-have-adhd +codex plugin marketplace remove flyingnobita-i-have-adhd ``` ### 常時有効(任意) @@ -181,7 +183,7 @@ Gemini CLI にはプラグインマーケットプレイスがないため、公 ```bash mkdir -p ~/.gemini/commands -curl -fsSL https://raw.githubusercontent.com/ayghri/i-have-adhd/main/skills/i-have-adhd/agents/gemini.toml \ +curl -fsSL https://raw.githubusercontent.com/flyingnobita/i-have-adhd/main/skills/i-have-adhd/agents/gemini.toml \ -o ~/.gemini/commands/i-have-adhd.toml ``` @@ -190,7 +192,7 @@ curl -fsSL https://raw.githubusercontent.com/ayghri/i-have-adhd/main/skills/i-ha ### インストール(拡張機能方式、常時有効) ```bash -gemini extensions install https://github.com/ayghri/i-have-adhd +gemini extensions install https://github.com/flyingnobita/i-have-adhd ``` 拡張機能が `GEMINI.md` を読み込み、そこから完全なスキルがインポートされるため、最初のメッセージからルールが適用されます。`git` のインストールが必要です。 @@ -228,14 +230,14 @@ Copilot は Agent Skills をネイティブに読み込むため、変換不要 ### インストール ```bash -npx skills add ayghri/i-have-adhd -a github-copilot # このプロジェクトのみ -npx skills add ayghri/i-have-adhd -a github-copilot -g # 全プロジェクト共通 +npx skills add flyingnobita/i-have-adhd -a github-copilot # このプロジェクトのみ +npx skills add flyingnobita/i-have-adhd -a github-copilot -g # 全プロジェクト共通 ``` CLI を使わない場合は、Copilot がスキャンするいずれかのディレクトリにスキルフォルダーをコピーします: ```bash -git clone https://github.com/ayghri/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd mkdir -p ~/.copilot/skills cp -R i-have-adhd/skills/i-have-adhd ~/.copilot/skills/ ``` @@ -300,7 +302,7 @@ Copilot は設定項目の `disable-model-invocation` に従います。Claude C ### インストール ```bash -hermes skills install ayghri/i-have-adhd/skills/i-have-adhd +hermes skills install flyingnobita/i-have-adhd/skills/i-have-adhd ``` `/i-have-adhd` と入力します。スキルは `~/.hermes/skills/` にインストールされ、次回のセッション開始時からスラッシュコマンドとして利用可能になります。 @@ -308,9 +310,9 @@ hermes skills install ayghri/i-have-adhd/skills/i-have-adhd 先に内容を確認したい場合は、このリポジトリをスキルソース(「tap」)として追加してから検索・インストールすることもできます: ```bash -hermes skills tap add ayghri/i-have-adhd +hermes skills tap add flyingnobita/i-have-adhd hermes skills search adhd -hermes skills install ayghri/i-have-adhd/skills/i-have-adhd +hermes skills install flyingnobita/i-have-adhd/skills/i-have-adhd ``` ### 確認 @@ -331,7 +333,7 @@ hermes skills update i-have-adhd hermes skills uninstall i-have-adhd ``` -tap も削除する場合:`hermes skills tap remove ayghri/i-have-adhd` +tap も削除する場合:`hermes skills tap remove flyingnobita/i-have-adhd` ### 常時有効(任意) @@ -367,7 +369,7 @@ Kimi Code のセッションを開始し、以下の手順を実行します: 1. `/plugins` を実行する。 2. **Custom** を選択する。 -3. `https://github.com/ayghri/i-have-adhd` を貼り付けて `Enter` を押す。 +3. `https://github.com/flyingnobita/i-have-adhd` を貼り付けて `Enter` を押す。 4. **Trust and install** を選択する。 スラッシュコマンド `/skill:i-have-adhd` を使用することで、スキルを明示的に呼び出します。 @@ -392,7 +394,7 @@ Kimi Code セッション内で `/plugins` を実行し、**I Have ADHD** にカ すべてのプロジェクトで使用する場合: ```bash -git clone https://github.com/ayghri/i-have-adhd ~/.config/opencode/vendor/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd ~/.config/opencode/vendor/i-have-adhd mkdir -p ~/.config/opencode/plugins cat > ~/.config/opencode/plugins/i-have-adhd.js <<'EOF' export { default } from '../vendor/i-have-adhd/.opencode/plugins/i-have-adhd.mjs'; @@ -456,7 +458,7 @@ Pi はこのリポジトリをネイティブパッケージとして認識し ### インストール ```bash -pi install https://github.com/ayghri/i-have-adhd +pi install https://github.com/flyingnobita/i-have-adhd ``` 新しい Pi セッションを開始し、現在のセッションでADHDフレンドリー出力を切り替えます: @@ -498,7 +500,7 @@ GitHub パッケージが一覧にあることを確認し、`/i-have-adhd` と ### 更新 ```bash -pi update https://github.com/ayghri/i-have-adhd +pi update https://github.com/flyingnobita/i-have-adhd ``` または、`pi update --extensions` で固定されていない全 Pi パッケージを一括更新します。 @@ -506,7 +508,7 @@ pi update https://github.com/ayghri/i-have-adhd ### アンインストール ```bash -pi remove https://github.com/ayghri/i-have-adhd +pi remove https://github.com/flyingnobita/i-have-adhd ``` ### 常時有効(任意) @@ -552,8 +554,8 @@ Pi のエージェント設定ディレクトリに `~/.pi/agent/i-have-adhd.jso ### インストール ```bash -omp plugin marketplace add ayghri/i-have-adhd -omp plugin install --scope user i-have-adhd@i-have-adhd +omp plugin marketplace add flyingnobita/i-have-adhd +omp plugin install --scope user i-have-adhd@flyingnobita-i-have-adhd ``` 新しい OMP セッションを開始し、`/i-have-adhd` を実行してモードを切り替えます。 @@ -561,15 +563,15 @@ omp plugin install --scope user i-have-adhd@i-have-adhd ### 更新 ```bash -omp plugin marketplace update i-have-adhd -omp plugin upgrade --scope user i-have-adhd@i-have-adhd +omp plugin marketplace update flyingnobita-i-have-adhd +omp plugin upgrade --scope user i-have-adhd@flyingnobita-i-have-adhd ``` ### アンインストール ```bash -omp plugin uninstall --scope user i-have-adhd@i-have-adhd -omp plugin marketplace remove i-have-adhd +omp plugin uninstall --scope user i-have-adhd@flyingnobita-i-have-adhd +omp plugin marketplace remove flyingnobita-i-have-adhd ```
@@ -581,7 +583,7 @@ omp plugin marketplace remove i-have-adhd ### インストール ```bash -qwen extensions install ayghri/i-have-adhd +qwen extensions install flyingnobita/i-have-adhd ``` Qwen Code は GitHub の短縮記法に対応しており、このリポジトリをネイティブ拡張機能としてインストール可能です。拡張機能は `skills/` 配下のスキルを自動検出します。 @@ -626,7 +628,7 @@ Zed の Agent は Agent Skills をネイティブに読み込むため、変換 Agent Panel で Skills マネージャーを開き、**Create skill from URL**(コマンドパレットでは `agent: create skill from url`)を選択して、以下を貼り付けます: ``` -https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md +https://github.com/flyingnobita/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md ``` 全プロジェクト共通で使う場合は **User** スコープ、現在のプロジェクトのみなら **Project** スコープで保存します。その後、Agent Panel で `/i-have-adhd` と入力します。 @@ -634,7 +636,7 @@ https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md ファイルシステムを直接使う場合は、リポジトリをクローンしてユーザースキルディレクトリにスキルフォルダーを配置: ```bash -git clone https://github.com/ayghri/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd mkdir -p ~/.agents/skills cp -R i-have-adhd/skills/i-have-adhd ~/.agents/skills/ ``` @@ -684,10 +686,10 @@ agent-skills を読み込めるすべての環境で動作します。`-a /i-have-adhd -claude plugin install i-have-adhd@i-have-adhd +claude plugin install i-have-adhd@ ``` 再起動してから、`/i-have-adhd` をもう一度呼び出してください。 diff --git a/.github/install/INSTALL.ko.md b/.github/install/INSTALL.ko.md index cbda8412..b1f17d53 100644 --- a/.github/install/INSTALL.ko.md +++ b/.github/install/INSTALL.ko.md @@ -1,3 +1,5 @@ +> Fork note: Uninstall upstream first because both projects use the same skill and command names. Read [Fork installation notes](../../INSTALL.md#fork-installation-notes) for the renamed marketplaces, human-session gating, Codex hook trust, logging, opt-out, and OpenCode exception. + # 설치 방법
@@ -6,7 +8,7 @@ ### 설치 ```bash -agy plugin install https://github.com/ayghri/i-have-adhd +agy plugin install https://github.com/flyingnobita/i-have-adhd ``` ### 확인 @@ -19,7 +21,7 @@ agy plugin list ```bash agy plugin uninstall i-have-adhd -agy plugin install https://github.com/ayghri/i-have-adhd +agy plugin install https://github.com/flyingnobita/i-have-adhd ``` ### 제거 @@ -61,8 +63,8 @@ agy plugin uninstall i-have-adhd ### 설치 ```bash -claude plugin marketplace add ayghri/i-have-adhd -claude plugin install i-have-adhd@i-have-adhd +claude plugin marketplace add flyingnobita/i-have-adhd +claude plugin install i-have-adhd@flyingnobita-i-have-adhd ``` `/i-have-adhd`를 입력하세요. @@ -76,15 +78,15 @@ claude plugin list ### 업데이트 ```bash -claude plugin marketplace update i-have-adhd -claude plugin update i-have-adhd@i-have-adhd +claude plugin marketplace update flyingnobita-i-have-adhd +claude plugin update i-have-adhd@flyingnobita-i-have-adhd ``` ### 제거 ```bash claude plugin uninstall i-have-adhd -claude plugin marketplace remove i-have-adhd +claude plugin marketplace remove flyingnobita-i-have-adhd ``` 설치된 상태로 비활성화하려면 `claude plugin disable i-have-adhd`를 실행하세요. @@ -120,8 +122,8 @@ rm ~/.claude/.i-have-adhd-always ### 설치 ```bash -codex plugin marketplace add ayghri/i-have-adhd --ref main -codex plugin add i-have-adhd@i-have-adhd +codex plugin marketplace add flyingnobita/i-have-adhd --ref main +codex plugin add i-have-adhd@flyingnobita-i-have-adhd ``` `$i-have-adhd`를 명시적으로 입력해 활성화하세요. Codex는 이 스킬을 자동으로 호출하지 않습니다. @@ -135,16 +137,16 @@ codex plugin list ### 업데이트 ```bash -codex plugin marketplace upgrade i-have-adhd +codex plugin marketplace upgrade flyingnobita-i-have-adhd codex plugin remove i-have-adhd -codex plugin add i-have-adhd@i-have-adhd +codex plugin add i-have-adhd@flyingnobita-i-have-adhd ``` ### 제거 ```bash codex plugin remove i-have-adhd -codex plugin marketplace remove i-have-adhd +codex plugin marketplace remove flyingnobita-i-have-adhd ``` ### 항상 활성화(선택 사항) @@ -181,7 +183,7 @@ Gemini CLI에는 플러그인 마켓플레이스가 없어 두 가지 기본 방 ```bash mkdir -p ~/.gemini/commands -curl -fsSL https://raw.githubusercontent.com/ayghri/i-have-adhd/main/skills/i-have-adhd/agents/gemini.toml \ +curl -fsSL https://raw.githubusercontent.com/flyingnobita/i-have-adhd/main/skills/i-have-adhd/agents/gemini.toml \ -o ~/.gemini/commands/i-have-adhd.toml ``` @@ -190,7 +192,7 @@ curl -fsSL https://raw.githubusercontent.com/ayghri/i-have-adhd/main/skills/i-ha ### 설치 (extension, always-on) ```bash -gemini extensions install https://github.com/ayghri/i-have-adhd +gemini extensions install https://github.com/flyingnobita/i-have-adhd ``` 확장 프로그램은 전체 스킬을 가져오는 `GEMINI.md`를 불러오므로 첫 메시지부터 규칙이 적용됩니다. `git`이 설치되어 있어야 합니다. @@ -228,14 +230,14 @@ Copilot은 Agent Skills를 기본 지원하므로 같은 `SKILL.md`를 변환 ### 설치 ```bash -npx skills add ayghri/i-have-adhd -a github-copilot # 이 프로젝트 -npx skills add ayghri/i-have-adhd -a github-copilot -g # 모든 프로젝트 +npx skills add flyingnobita/i-have-adhd -a github-copilot # 이 프로젝트 +npx skills add flyingnobita/i-have-adhd -a github-copilot -g # 모든 프로젝트 ``` CLI 없이 설치하려면 스킬 폴더를 Copilot이 검색하는 디렉터리 중 하나에 복사하세요: ```bash -git clone https://github.com/ayghri/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd mkdir -p ~/.copilot/skills cp -R i-have-adhd/skills/i-have-adhd ~/.copilot/skills/ ``` @@ -300,7 +302,7 @@ Copilot은 `disable-model-invocation`을 따릅니다. Claude Code와 마찬가 ### 설치 ```bash -hermes skills install ayghri/i-have-adhd/skills/i-have-adhd +hermes skills install flyingnobita/i-have-adhd/skills/i-have-adhd ``` `/i-have-adhd`를 입력하세요. The skill installs into `~/.hermes/skills/` and is exposed as a slash command at the next session start. @@ -308,9 +310,9 @@ hermes skills install ayghri/i-have-adhd/skills/i-have-adhd 먼저 둘러보려면 이 저장소를 스킬 소스("tap")로 추가한 뒤 검색하고 설치하세요: ```bash -hermes skills tap add ayghri/i-have-adhd +hermes skills tap add flyingnobita/i-have-adhd hermes skills search adhd -hermes skills install ayghri/i-have-adhd/skills/i-have-adhd +hermes skills install flyingnobita/i-have-adhd/skills/i-have-adhd ``` ### 확인 @@ -331,7 +333,7 @@ hermes skills update i-have-adhd hermes skills uninstall i-have-adhd ``` -tap도 제거하려면 `hermes skills tap remove ayghri/i-have-adhd`를 실행하세요. +tap도 제거하려면 `hermes skills tap remove flyingnobita/i-have-adhd`를 실행하세요. ### 항상 활성화(선택 사항) @@ -367,7 +369,7 @@ Kimi Code 세션을 시작한 뒤 다음을 수행하세요. 1. `/plugins`를 실행합니다. 2. **Custom**을 선택합니다. -3. `https://github.com/ayghri/i-have-adhd`를 붙여넣고 Enter를 누릅니다. +3. `https://github.com/flyingnobita/i-have-adhd`를 붙여넣고 Enter를 누릅니다. 4. **Trust and install**을 선택합니다. slash 명령 `/skill:i-have-adhd`로 이 스킬을 명시적으로 호출하세요. @@ -393,7 +395,7 @@ Kimi Code 세션에서 `/plugins`를 실행하고 **I Have ADHD**에 커서를 모든 프로젝트에서 사용하려면: ```bash -git clone https://github.com/ayghri/i-have-adhd ~/.config/opencode/vendor/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd ~/.config/opencode/vendor/i-have-adhd mkdir -p ~/.config/opencode/plugins cat > ~/.config/opencode/plugins/i-have-adhd.js <<'EOF' export { default } from '../vendor/i-have-adhd/.opencode/plugins/i-have-adhd.mjs'; @@ -456,13 +458,13 @@ Pi는 Agent Skills 표준을 구현하므로 같은 `SKILL.md`를 변환 없이 ### 설치 ```bash -npx skills add ayghri/i-have-adhd -a pi -y +npx skills add flyingnobita/i-have-adhd -a pi -y ``` 파일 시스템 방식을 선호한다면 Pi는 `~/.pi/agent/skills/`와 `~/.agents/skills/`(전역), `.pi/skills/`와 `.agents/skills/`(프로젝트)에서 스킬을 찾습니다: ```bash -git clone https://github.com/ayghri/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd mkdir -p ~/.pi/agent/skills cp -R i-have-adhd/skills/i-have-adhd ~/.pi/agent/skills/ ``` @@ -531,7 +533,7 @@ npx skills remove i-have-adhd ### 설치 ```bash -qwen extensions install ayghri/i-have-adhd +qwen extensions install flyingnobita/i-have-adhd ``` Qwen Code는 GitHub 축약 표기를 지원하며 이 저장소를 네이티브 확장으로 설치합니다. 확장은 `skills/` 아래의 스킬을 검색합니다. @@ -576,7 +578,7 @@ Zed의 Agent는 Agent Skills를 기본 지원하므로 같은 `SKILL.md`를 변 Agent Panel에서 Skills 관리자를 열고 **Create skill from URL**(명령 팔레트에서는 `agent: create skill from url`)을 선택한 뒤 다음을 붙여넣으세요: ``` -https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md +https://github.com/flyingnobita/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md ``` 모든 프로젝트에서 사용하려면 **User** 범위에, 한 프로젝트에서만 사용하려면 **Project** 범위에 저장하세요. 그런 다음 Agent Panel에서 `/i-have-adhd`를 입력하세요. @@ -584,7 +586,7 @@ https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md 파일 시스템 방식을 선호한다면 저장소를 클론하고 스킬 폴더를 사용자 skills 디렉터리에 넣으세요: ```bash -git clone https://github.com/ayghri/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd mkdir -p ~/.agents/skills cp -R i-have-adhd/skills/i-have-adhd ~/.agents/skills/ ``` @@ -634,10 +636,10 @@ Agent Skills를 읽는 모든 실행 환경에서 작동합니다. `-a ` ### 설치 ```bash -npx skills add ayghri/i-have-adhd # this workspace -npx skills add ayghri/i-have-adhd -g # 모든 프로젝트 -npx skills add ayghri/i-have-adhd -a cursor -y # one agent only -npx skills add ayghri/i-have-adhd -a opencode -y +npx skills add flyingnobita/i-have-adhd # this workspace +npx skills add flyingnobita/i-have-adhd -g # 모든 프로젝트 +npx skills add flyingnobita/i-have-adhd -a cursor -y # one agent only +npx skills add flyingnobita/i-have-adhd -a opencode -y ``` 새 에이전트 채팅에서 `/i-have-adhd`를 입력하세요. @@ -645,7 +647,7 @@ npx skills add ayghri/i-have-adhd -a opencode -y CLI 없이 설치하려면 에이전트가 검색하는 경로에 스킬 폴더를 복사하세요: ```bash -git clone https://github.com/ayghri/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd mkdir -p ~/.cursor/skills # Cursor. OpenCode는 .agents/skills, 다른 에이전트는 자체 경로 사용 cp -R i-have-adhd/skills/i-have-adhd ~/.cursor/skills/ ``` @@ -709,7 +711,7 @@ Claude Code, Qwen Code, Codex에는 중간 상태가 없습니다. 켜지 않았 **자동 완성에 `/i-have-adhd`가 없습니다.** 에이전트를 다시 시작하세요. 플러그인 인덱스는 시작 시 읽힙니다. -**항상 활성화 플래그가 작동하지 않습니다.** 플러그인을 업데이트하고(`claude plugin marketplace update i-have-adhd` 실행 후 `claude plugin update i-have-adhd@i-have-adhd`) 다시 시작하세요. 훅은 시작 시 읽히며 플래그에는 `hooks/hooks.json`이 포함된 플러그인 버전이 필요합니다. +**항상 활성화 플래그가 작동하지 않습니다.** 플러그인을 업데이트하고(`claude plugin marketplace update flyingnobita-i-have-adhd` 실행 후 `claude plugin update i-have-adhd@flyingnobita-i-have-adhd`) 다시 시작하세요. 훅은 시작 시 읽히며 플래그에는 `hooks/hooks.json`이 포함된 플러그인 버전이 필요합니다. **`claude plugin marketplace add`가 실패합니다.** `owner/repo` 형식을 사용하세요. 로컬 경로는 `.claude-plugin/`이 아니라 저장소 루트를 가리켜야 합니다. @@ -719,9 +721,9 @@ Claude Code, Qwen Code, Codex에는 중간 상태가 없습니다. 켜지 않았 ```bash claude plugin uninstall i-have-adhd # 먼저 업스트림 복사본 제거: -claude plugin marketplace remove i-have-adhd # 포크와 업스트림은 같은 이름 사용 +claude plugin marketplace remove flyingnobita-i-have-adhd # 포크와 업스트림은 같은 이름 사용 claude plugin marketplace add /i-have-adhd -claude plugin install i-have-adhd@i-have-adhd +claude plugin install i-have-adhd@ ``` 다시 시작한 뒤 `/i-have-adhd`를 다시 호출하세요. diff --git a/.github/install/INSTALL.pt-BR.md b/.github/install/INSTALL.pt-BR.md index 41921d0c..a4550a63 100644 --- a/.github/install/INSTALL.pt-BR.md +++ b/.github/install/INSTALL.pt-BR.md @@ -1,3 +1,5 @@ +> Fork note: Uninstall upstream first because both projects use the same skill and command names. Read [Fork installation notes](../../INSTALL.md#fork-installation-notes) for the renamed marketplaces, human-session gating, Codex hook trust, logging, opt-out, and OpenCode exception. + # Como instalar
@@ -6,7 +8,7 @@ ### Instalar ```bash -agy plugin install https://github.com/ayghri/i-have-adhd +agy plugin install https://github.com/flyingnobita/i-have-adhd ``` ### Verificar @@ -19,7 +21,7 @@ agy plugin list ```bash agy plugin uninstall i-have-adhd -agy plugin install https://github.com/ayghri/i-have-adhd +agy plugin install https://github.com/flyingnobita/i-have-adhd ``` ### Desinstalar @@ -61,8 +63,8 @@ Exceções: explique por completo quando pedirem. Confirme antes de ações dest ### Instalar ```bash -claude plugin marketplace add ayghri/i-have-adhd -claude plugin install i-have-adhd@i-have-adhd +claude plugin marketplace add flyingnobita/i-have-adhd +claude plugin install i-have-adhd@flyingnobita-i-have-adhd ``` Digite `/i-have-adhd`. @@ -76,15 +78,15 @@ claude plugin list ### Atualizar ```bash -claude plugin marketplace update i-have-adhd -claude plugin update i-have-adhd@i-have-adhd +claude plugin marketplace update flyingnobita-i-have-adhd +claude plugin update i-have-adhd@flyingnobita-i-have-adhd ``` ### Desinstalar ```bash claude plugin uninstall i-have-adhd -claude plugin marketplace remove i-have-adhd +claude plugin marketplace remove flyingnobita-i-have-adhd ``` Ou mantenha instalado e desative: `claude plugin disable i-have-adhd`. @@ -120,8 +122,8 @@ O hook só é executado quando o arquivo de sinalização existe, portanto insta ### Instalar ```bash -codex plugin marketplace add ayghri/i-have-adhd --ref main -codex plugin add i-have-adhd@i-have-adhd +codex plugin marketplace add flyingnobita/i-have-adhd --ref main +codex plugin add i-have-adhd@flyingnobita-i-have-adhd ``` Ative a skill explicitamente digitando `$i-have-adhd`. O Codex não a invoca automaticamente. @@ -135,16 +137,16 @@ codex plugin list ### Atualizar ```bash -codex plugin marketplace upgrade i-have-adhd +codex plugin marketplace upgrade flyingnobita-i-have-adhd codex plugin remove i-have-adhd -codex plugin add i-have-adhd@i-have-adhd +codex plugin add i-have-adhd@flyingnobita-i-have-adhd ``` ### Desinstalar ```bash codex plugin remove i-have-adhd -codex plugin marketplace remove i-have-adhd +codex plugin marketplace remove flyingnobita-i-have-adhd ``` ### Sempre ativo (opcional) @@ -181,7 +183,7 @@ O Gemini CLI não tem marketplace de plugins, então há duas opções nativas: ```bash mkdir -p ~/.gemini/commands -curl -fsSL https://raw.githubusercontent.com/ayghri/i-have-adhd/main/skills/i-have-adhd/agents/gemini.toml \ +curl -fsSL https://raw.githubusercontent.com/flyingnobita/i-have-adhd/main/skills/i-have-adhd/agents/gemini.toml \ -o ~/.gemini/commands/i-have-adhd.toml ``` @@ -190,7 +192,7 @@ Inicie uma nova sessão e digite `/i-have-adhd`. A skill permanecerá ativa dura ### Instalar (extension, always-on) ```bash -gemini extensions install https://github.com/ayghri/i-have-adhd +gemini extensions install https://github.com/flyingnobita/i-have-adhd ``` A extensão carrega `GEMINI.md`, que importa a skill completa; assim, as regras valem desde a primeira mensagem. O `git` precisa estar instalado. @@ -228,14 +230,14 @@ O Copilot lê Agent Skills nativamente: usa o mesmo `SKILL.md`, sem conversão. ### Instalar ```bash -npx skills add ayghri/i-have-adhd -a github-copilot # este projeto -npx skills add ayghri/i-have-adhd -a github-copilot -g # todos os projetos +npx skills add flyingnobita/i-have-adhd -a github-copilot # este projeto +npx skills add flyingnobita/i-have-adhd -a github-copilot -g # todos os projetos ``` Sem a CLI, copie a pasta da skill para qualquer diretório verificado pelo Copilot: ```bash -git clone https://github.com/ayghri/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd mkdir -p ~/.copilot/skills cp -R i-have-adhd/skills/i-have-adhd ~/.copilot/skills/ ``` @@ -300,7 +302,7 @@ Exceções: explique por completo quando pedirem. Confirme antes de ações dest ### Instalar ```bash -hermes skills install ayghri/i-have-adhd/skills/i-have-adhd +hermes skills install flyingnobita/i-have-adhd/skills/i-have-adhd ``` Digite `/i-have-adhd`. The skill installs into `~/.hermes/skills/` and is exposed as a slash command at the next session start. @@ -308,9 +310,9 @@ Digite `/i-have-adhd`. The skill installs into `~/.hermes/skills/` and is expose Prefere explorar primeiro? Adicione este repositório como fonte de skills (um "tap"), depois pesquise e instale: ```bash -hermes skills tap add ayghri/i-have-adhd +hermes skills tap add flyingnobita/i-have-adhd hermes skills search adhd -hermes skills install ayghri/i-have-adhd/skills/i-have-adhd +hermes skills install flyingnobita/i-have-adhd/skills/i-have-adhd ``` ### Verificar @@ -331,7 +333,7 @@ hermes skills update i-have-adhd hermes skills uninstall i-have-adhd ``` -Ou remova também o tap: `hermes skills tap remove ayghri/i-have-adhd`. +Ou remova também o tap: `hermes skills tap remove flyingnobita/i-have-adhd`. ### Sempre ativo (opcional) @@ -367,7 +369,7 @@ Inicie uma sessão do Kimi Code e: 1. Execute `/plugins`. 2. Selecione **Custom**. -3. Cole `https://github.com/ayghri/i-have-adhd` e pressione Enter. +3. Cole `https://github.com/flyingnobita/i-have-adhd` e pressione Enter. 4. Selecione **Trust and install**. Use o comando slash `/skill:i-have-adhd` para invocar a skill explicitamente. @@ -393,7 +395,7 @@ O plugin suporta OpenCode V1 **1.18.29 ou superior** e V2. Registra a skill e o Para usar em todos os projetos: ```bash -git clone https://github.com/ayghri/i-have-adhd ~/.config/opencode/vendor/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd ~/.config/opencode/vendor/i-have-adhd mkdir -p ~/.config/opencode/plugins cat > ~/.config/opencode/plugins/i-have-adhd.js <<'EOF' export { default } from '../vendor/i-have-adhd/.opencode/plugins/i-have-adhd.mjs'; @@ -456,13 +458,13 @@ O Pi implementa o padrão Agent Skills, portanto o mesmo `SKILL.md` é carregado ### Instalar ```bash -npx skills add ayghri/i-have-adhd -a pi -y +npx skills add flyingnobita/i-have-adhd -a pi -y ``` Prefere usar o sistema de arquivos? O Pi encontra skills em `~/.pi/agent/skills/` e `~/.agents/skills/` (global), e em `.pi/skills/` e `.agents/skills/` (projeto): ```bash -git clone https://github.com/ayghri/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd mkdir -p ~/.pi/agent/skills cp -R i-have-adhd/skills/i-have-adhd ~/.pi/agent/skills/ ``` @@ -531,7 +533,7 @@ Exceções: explique por completo quando pedirem. Confirme antes de ações dest ### Instalar ```bash -qwen extensions install ayghri/i-have-adhd +qwen extensions install flyingnobita/i-have-adhd ``` O Qwen Code aceita a forma abreviada do GitHub e instala o repositório como extensão nativa. A extensão encontra a skill em `skills/`. @@ -576,7 +578,7 @@ O Agent do Zed lê Agent Skills nativamente: usa o mesmo `SKILL.md`, sem convers No Agent Panel, abra o gerenciador de Skills, escolha **Create skill from URL** (também disponível na paleta como `agent: create skill from url`) e cole: ``` -https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md +https://github.com/flyingnobita/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md ``` Salve no escopo **User** para todos os projetos ou **Project** para apenas um. Depois, digite `/i-have-adhd` no Agent Panel. @@ -584,7 +586,7 @@ Salve no escopo **User** para todos os projetos ou **Project** para apenas um. D Prefere o sistema de arquivos? Clone o repositório e coloque a pasta da skill no diretório de skills do usuário: ```bash -git clone https://github.com/ayghri/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd mkdir -p ~/.agents/skills cp -R i-have-adhd/skills/i-have-adhd ~/.agents/skills/ ``` @@ -634,10 +636,10 @@ Funciona com qualquer ambiente que leia Agent Skills. Troque `-a ` pelo s ### Instalar ```bash -npx skills add ayghri/i-have-adhd # this workspace -npx skills add ayghri/i-have-adhd -g # todos os projetos -npx skills add ayghri/i-have-adhd -a cursor -y # one agent only -npx skills add ayghri/i-have-adhd -a opencode -y +npx skills add flyingnobita/i-have-adhd # this workspace +npx skills add flyingnobita/i-have-adhd -g # todos os projetos +npx skills add flyingnobita/i-have-adhd -a cursor -y # one agent only +npx skills add flyingnobita/i-have-adhd -a opencode -y ``` Abra um novo chat do agente e digite `/i-have-adhd`. @@ -645,7 +647,7 @@ Abra um novo chat do agente e digite `/i-have-adhd`. Sem a CLI, copie a pasta da skill para o caminho verificado pelo seu agente: ```bash -git clone https://github.com/ayghri/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd mkdir -p ~/.cursor/skills # Cursor. Use .agents/skills no OpenCode ou o caminho próprio do agente cp -R i-have-adhd/skills/i-have-adhd ~/.cursor/skills/ ``` @@ -709,7 +711,7 @@ No Claude Code, Qwen Code e Codex não há meio-termo: se você não ativou, est **`/i-have-adhd` não aparece no preenchimento automático.** Reinicie o agente. O índice de plugins é lido na inicialização. -**A flag de sempre ativo não funciona.** Atualize o plugin (`claude plugin marketplace update i-have-adhd` e depois `claude plugin update i-have-adhd@i-have-adhd`) e reinicie. Hooks são lidos na inicialização, e a flag exige a versão que inclui `hooks/hooks.json`. +**A flag de sempre ativo não funciona.** Atualize o plugin (`claude plugin marketplace update flyingnobita-i-have-adhd` e depois `claude plugin update i-have-adhd@flyingnobita-i-have-adhd`) e reinicie. Hooks são lidos na inicialização, e a flag exige a versão que inclui `hooks/hooks.json`. **`claude plugin marketplace add` falha.** Use o formato `owner/repo`. Um caminho local deve apontar para a raiz do repositório, não para `.claude-plugin/`. @@ -719,9 +721,9 @@ No Claude Code, Qwen Code e Codex não há meio-termo: se você não ativou, est ```bash claude plugin uninstall i-have-adhd # remova primeiro a cópia upstream: -claude plugin marketplace remove i-have-adhd # o fork e o upstream usam o mesmo nome +claude plugin marketplace remove flyingnobita-i-have-adhd # o fork e o upstream usam o mesmo nome claude plugin marketplace add /i-have-adhd -claude plugin install i-have-adhd@i-have-adhd +claude plugin install i-have-adhd@ ``` Reinicie e invoque `/i-have-adhd` novamente. diff --git a/.github/install/INSTALL.vi.md b/.github/install/INSTALL.vi.md index dc2c5eb5..3f28962f 100644 --- a/.github/install/INSTALL.vi.md +++ b/.github/install/INSTALL.vi.md @@ -1,3 +1,5 @@ +> Fork note: Uninstall upstream first because both projects use the same skill and command names. Read [Fork installation notes](../../INSTALL.md#fork-installation-notes) for the renamed marketplaces, human-session gating, Codex hook trust, logging, opt-out, and OpenCode exception. + # Cách cài đặt
@@ -6,7 +8,7 @@ ### Cài đặt ```bash -agy plugin install https://github.com/ayghri/i-have-adhd +agy plugin install https://github.com/flyingnobita/i-have-adhd ``` ### Xác minh @@ -19,7 +21,7 @@ agy plugin list ```bash agy plugin uninstall i-have-adhd -agy plugin install https://github.com/ayghri/i-have-adhd +agy plugin install https://github.com/flyingnobita/i-have-adhd ``` ### Gỡ cài đặt @@ -61,8 +63,8 @@ Ngoại lệ: giải thích đầy đủ khi được yêu cầu. Xác nhận tr ### Cài đặt ```bash -claude plugin marketplace add ayghri/i-have-adhd -claude plugin install i-have-adhd@i-have-adhd +claude plugin marketplace add flyingnobita/i-have-adhd +claude plugin install i-have-adhd@flyingnobita-i-have-adhd ``` Gõ `/i-have-adhd`. @@ -76,15 +78,15 @@ claude plugin list ### Cập nhật ```bash -claude plugin marketplace update i-have-adhd -claude plugin update i-have-adhd@i-have-adhd +claude plugin marketplace update flyingnobita-i-have-adhd +claude plugin update i-have-adhd@flyingnobita-i-have-adhd ``` ### Gỡ cài đặt ```bash claude plugin uninstall i-have-adhd -claude plugin marketplace remove i-have-adhd +claude plugin marketplace remove flyingnobita-i-have-adhd ``` Hoặc giữ nguyên cài đặt và tắt bằng `claude plugin disable i-have-adhd`. @@ -120,8 +122,8 @@ Hook chỉ chạy khi tệp cờ tồn tại, vì vậy chỉ cài plugin sẽ k ### Cài đặt ```bash -codex plugin marketplace add ayghri/i-have-adhd --ref main -codex plugin add i-have-adhd@i-have-adhd +codex plugin marketplace add flyingnobita/i-have-adhd --ref main +codex plugin add i-have-adhd@flyingnobita-i-have-adhd ``` Gọi skill một cách rõ ràng bằng cách gõ `$i-have-adhd`. Codex sẽ không tự động kích hoạt skill. @@ -135,16 +137,16 @@ codex plugin list ### Cập nhật ```bash -codex plugin marketplace upgrade i-have-adhd +codex plugin marketplace upgrade flyingnobita-i-have-adhd codex plugin remove i-have-adhd -codex plugin add i-have-adhd@i-have-adhd +codex plugin add i-have-adhd@flyingnobita-i-have-adhd ``` ### Gỡ cài đặt ```bash codex plugin remove i-have-adhd -codex plugin marketplace remove i-have-adhd +codex plugin marketplace remove flyingnobita-i-have-adhd ``` ### Luôn bật (không bắt buộc) @@ -181,7 +183,7 @@ Gemini CLI không có chợ plugin nên có hai cách tích hợp sẵn: **lện ```bash mkdir -p ~/.gemini/commands -curl -fsSL https://raw.githubusercontent.com/ayghri/i-have-adhd/main/skills/i-have-adhd/agents/gemini.toml \ +curl -fsSL https://raw.githubusercontent.com/flyingnobita/i-have-adhd/main/skills/i-have-adhd/agents/gemini.toml \ -o ~/.gemini/commands/i-have-adhd.toml ``` @@ -190,7 +192,7 @@ Bắt đầu phiên mới và gõ `/i-have-adhd`. Skill sẽ bật trong suốt ### Cài đặt (extension, always-on) ```bash -gemini extensions install https://github.com/ayghri/i-have-adhd +gemini extensions install https://github.com/flyingnobita/i-have-adhd ``` Extension tải `GEMINI.md`, tệp nhập toàn bộ skill, nên quy tắc được áp dụng từ tin nhắn đầu tiên. Máy phải cài `git`. @@ -228,14 +230,14 @@ Copilot đọc Agent Skills trực tiếp: cùng một `SKILL.md`, không cần ### Cài đặt ```bash -npx skills add ayghri/i-have-adhd -a github-copilot # dự án này -npx skills add ayghri/i-have-adhd -a github-copilot -g # mọi dự án +npx skills add flyingnobita/i-have-adhd -a github-copilot # dự án này +npx skills add flyingnobita/i-have-adhd -a github-copilot -g # mọi dự án ``` Nếu không dùng CLI, hãy sao chép thư mục skill vào bất kỳ thư mục nào Copilot quét: ```bash -git clone https://github.com/ayghri/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd mkdir -p ~/.copilot/skills cp -R i-have-adhd/skills/i-have-adhd ~/.copilot/skills/ ``` @@ -300,7 +302,7 @@ Ngoại lệ: giải thích đầy đủ khi được yêu cầu. Xác nhận tr ### Cài đặt ```bash -hermes skills install ayghri/i-have-adhd/skills/i-have-adhd +hermes skills install flyingnobita/i-have-adhd/skills/i-have-adhd ``` Gõ `/i-have-adhd`. The skill installs into `~/.hermes/skills/` and is exposed as a slash command at the next session start. @@ -308,9 +310,9 @@ Gõ `/i-have-adhd`. The skill installs into `~/.hermes/skills/` and is exposed a Muốn xem trước? Thêm repo này làm nguồn skill (một "tap"), rồi tìm kiếm và cài đặt: ```bash -hermes skills tap add ayghri/i-have-adhd +hermes skills tap add flyingnobita/i-have-adhd hermes skills search adhd -hermes skills install ayghri/i-have-adhd/skills/i-have-adhd +hermes skills install flyingnobita/i-have-adhd/skills/i-have-adhd ``` ### Xác minh @@ -331,7 +333,7 @@ hermes skills update i-have-adhd hermes skills uninstall i-have-adhd ``` -Hoặc xóa cả tap bằng `hermes skills tap remove ayghri/i-have-adhd`. +Hoặc xóa cả tap bằng `hermes skills tap remove flyingnobita/i-have-adhd`. ### Luôn bật (không bắt buộc) @@ -367,7 +369,7 @@ Hãy bắt đầu một phiên Kimi Code, rồi: 1. Chạy `/plugins`. 2. Chọn **Custom**. -3. Dán `https://github.com/ayghri/i-have-adhd` rồi nhấn Enter. +3. Dán `https://github.com/flyingnobita/i-have-adhd` rồi nhấn Enter. 4. Chọn **Trust and install**. Dùng lệnh slash `/skill:i-have-adhd` để gọi skill một cách rõ ràng. @@ -393,7 +395,7 @@ Plugin hỗ trợ OpenCode V1 **từ 1.18.29** và V2. Plugin đăng ký skill, Để dùng trong mọi dự án: ```bash -git clone https://github.com/ayghri/i-have-adhd ~/.config/opencode/vendor/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd ~/.config/opencode/vendor/i-have-adhd mkdir -p ~/.config/opencode/plugins cat > ~/.config/opencode/plugins/i-have-adhd.js <<'EOF' export { default } from '../vendor/i-have-adhd/.opencode/plugins/i-have-adhd.mjs'; @@ -456,13 +458,13 @@ Pi triển khai chuẩn Agent Skills nên tải trực tiếp cùng một `SKILL ### Cài đặt ```bash -npx skills add ayghri/i-have-adhd -a pi -y +npx skills add flyingnobita/i-have-adhd -a pi -y ``` Muốn dùng hệ thống tệp? Pi tìm skill trong `~/.pi/agent/skills/` và `~/.agents/skills/` (toàn cục), cùng `.pi/skills/` và `.agents/skills/` (dự án): ```bash -git clone https://github.com/ayghri/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd mkdir -p ~/.pi/agent/skills cp -R i-have-adhd/skills/i-have-adhd ~/.pi/agent/skills/ ``` @@ -531,7 +533,7 @@ Ngoại lệ: giải thích đầy đủ khi được yêu cầu. Xác nhận tr ### Cài đặt ```bash -qwen extensions install ayghri/i-have-adhd +qwen extensions install flyingnobita/i-have-adhd ``` Qwen Code hỗ trợ dạng viết tắt GitHub và cài kho lưu trữ này dưới dạng extension gốc. Extension sẽ phát hiện skill trong `skills/`. @@ -576,7 +578,7 @@ Agent của Zed đọc Agent Skills trực tiếp: cùng một `SKILL.md`, khôn Trong Agent Panel, mở trình quản lý Skills, chọn **Create skill from URL** (cũng có trong bảng lệnh dưới tên `agent: create skill from url`), rồi dán: ``` -https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md +https://github.com/flyingnobita/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md ``` Lưu ở phạm vi **User** cho mọi dự án hoặc **Project** cho một dự án. Sau đó gõ `/i-have-adhd` trong Agent Panel. @@ -584,7 +586,7 @@ Lưu ở phạm vi **User** cho mọi dự án hoặc **Project** cho một dự Muốn dùng hệ thống tệp? Clone repo và đặt thư mục skill vào thư mục skills của người dùng: ```bash -git clone https://github.com/ayghri/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd mkdir -p ~/.agents/skills cp -R i-have-adhd/skills/i-have-adhd ~/.agents/skills/ ``` @@ -634,10 +636,10 @@ Hoạt động với mọi môi trường đọc Agent Skills. Thay `-a ` ### Cài đặt ```bash -npx skills add ayghri/i-have-adhd # this workspace -npx skills add ayghri/i-have-adhd -g # mọi dự án -npx skills add ayghri/i-have-adhd -a cursor -y # one agent only -npx skills add ayghri/i-have-adhd -a opencode -y +npx skills add flyingnobita/i-have-adhd # this workspace +npx skills add flyingnobita/i-have-adhd -g # mọi dự án +npx skills add flyingnobita/i-have-adhd -a cursor -y # one agent only +npx skills add flyingnobita/i-have-adhd -a opencode -y ``` Mở cuộc chat agent mới và gõ `/i-have-adhd`. @@ -645,7 +647,7 @@ Mở cuộc chat agent mới và gõ `/i-have-adhd`. Nếu không dùng CLI, sao chép thư mục skill vào đường dẫn mà agent quét: ```bash -git clone https://github.com/ayghri/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd mkdir -p ~/.cursor/skills # Cursor. Dùng .agents/skills cho OpenCode hoặc đường dẫn riêng của agent cp -R i-have-adhd/skills/i-have-adhd ~/.cursor/skills/ ``` @@ -709,7 +711,7 @@ Trong Claude Code, Qwen Code và Codex không có trạng thái trung gian: nế **`/i-have-adhd` không có trong tự động hoàn thành.** Khởi động lại agent. Chỉ mục plugin được đọc khi khởi động. -**Cờ luôn bật không có tác dụng.** Cập nhật plugin (`claude plugin marketplace update i-have-adhd`, sau đó `claude plugin update i-have-adhd@i-have-adhd`) và khởi động lại. Hook được đọc khi khởi động, và cờ cần phiên bản plugin có `hooks/hooks.json`. +**Cờ luôn bật không có tác dụng.** Cập nhật plugin (`claude plugin marketplace update flyingnobita-i-have-adhd`, sau đó `claude plugin update i-have-adhd@flyingnobita-i-have-adhd`) và khởi động lại. Hook được đọc khi khởi động, và cờ cần phiên bản plugin có `hooks/hooks.json`. **`claude plugin marketplace add` thất bại.** Dùng dạng `owner/repo`. Đường dẫn cục bộ phải trỏ đến thư mục gốc repo, không phải `.claude-plugin/`. @@ -719,9 +721,9 @@ Trong Claude Code, Qwen Code và Codex không có trạng thái trung gian: nế ```bash claude plugin uninstall i-have-adhd # gỡ bản upstream trước: -claude plugin marketplace remove i-have-adhd # fork và upstream dùng cùng tên +claude plugin marketplace remove flyingnobita-i-have-adhd # fork và upstream dùng cùng tên claude plugin marketplace add /i-have-adhd -claude plugin install i-have-adhd@i-have-adhd +claude plugin install i-have-adhd@ ``` Khởi động lại rồi gọi `/i-have-adhd` lần nữa. diff --git a/.github/install/INSTALL.zh-CN.md b/.github/install/INSTALL.zh-CN.md index 09915b13..6e67e876 100644 --- a/.github/install/INSTALL.zh-CN.md +++ b/.github/install/INSTALL.zh-CN.md @@ -1,3 +1,5 @@ +> Fork note: Uninstall upstream first because both projects use the same skill and command names. Read [Fork installation notes](../../INSTALL.md#fork-installation-notes) for the renamed marketplaces, human-session gating, Codex hook trust, logging, opt-out, and OpenCode exception. + # 安装方法
@@ -6,7 +8,7 @@ ### 安装 ```bash -agy plugin install https://github.com/ayghri/i-have-adhd +agy plugin install https://github.com/flyingnobita/i-have-adhd ``` ### 验证 @@ -19,7 +21,7 @@ agy plugin list ```bash agy plugin uninstall i-have-adhd -agy plugin install https://github.com/ayghri/i-have-adhd +agy plugin install https://github.com/flyingnobita/i-have-adhd ``` ### 卸载 @@ -66,7 +68,7 @@ AstronClaw 支持将 Markdown 文件导入为自定义技能。此方式使用 ### 安装 -1. 下载[技能源文件 SKILL.md](https://raw.githubusercontent.com/ayghri/i-have-adhd/main/skills/i-have-adhd/SKILL.md),保存为 `SKILL.md`,上传前先阅读文件内容。 +1. 下载[技能源文件 SKILL.md](https://raw.githubusercontent.com/flyingnobita/i-have-adhd/main/skills/i-have-adhd/SKILL.md),保存为 `SKILL.md`,上传前先阅读文件内容。 2. 在 AstronClaw 中打开**我的技能**,选择**新建**,上传该 `.md` 文件。 3. 确认导入后的技能名称为 `i-have-adhd`,通过**启用/禁用**控制技能是否可用。 @@ -114,8 +116,8 @@ AstronClaw 支持指定调用和自动调用技能。官方指南未说明是否 ### 安装 ```bash -claude plugin marketplace add ayghri/i-have-adhd -claude plugin install i-have-adhd@i-have-adhd +claude plugin marketplace add flyingnobita/i-have-adhd +claude plugin install i-have-adhd@flyingnobita-i-have-adhd ``` 输入 `/i-have-adhd`。 @@ -129,15 +131,15 @@ claude plugin list ### 更新 ```bash -claude plugin marketplace update i-have-adhd -claude plugin update i-have-adhd@i-have-adhd +claude plugin marketplace update flyingnobita-i-have-adhd +claude plugin update i-have-adhd@flyingnobita-i-have-adhd ``` ### 卸载 ```bash claude plugin uninstall i-have-adhd -claude plugin marketplace remove i-have-adhd +claude plugin marketplace remove flyingnobita-i-have-adhd ``` 也可以保留安装并将其关闭:`claude plugin disable i-have-adhd`。 @@ -173,8 +175,8 @@ rm ~/.claude/.i-have-adhd-always ### 安装 ```bash -codex plugin marketplace add ayghri/i-have-adhd --ref main -codex plugin add i-have-adhd@i-have-adhd +codex plugin marketplace add flyingnobita/i-have-adhd --ref main +codex plugin add i-have-adhd@flyingnobita-i-have-adhd ``` 明确输入 `$i-have-adhd` 来启用此技能。Codex 不会自动调用它。 @@ -188,16 +190,16 @@ codex plugin list ### 更新 ```bash -codex plugin marketplace upgrade i-have-adhd +codex plugin marketplace upgrade flyingnobita-i-have-adhd codex plugin remove i-have-adhd -codex plugin add i-have-adhd@i-have-adhd +codex plugin add i-have-adhd@flyingnobita-i-have-adhd ``` ### 卸载 ```bash codex plugin remove i-have-adhd -codex plugin marketplace remove i-have-adhd +codex plugin marketplace remove flyingnobita-i-have-adhd ``` ### 始终启用(可选) @@ -234,7 +236,7 @@ Gemini CLI 没有插件市场,因此有两种原生方式:**自定义命令* ```bash mkdir -p ~/.gemini/commands -curl -fsSL https://raw.githubusercontent.com/ayghri/i-have-adhd/main/skills/i-have-adhd/agents/gemini.toml \ +curl -fsSL https://raw.githubusercontent.com/flyingnobita/i-have-adhd/main/skills/i-have-adhd/agents/gemini.toml \ -o ~/.gemini/commands/i-have-adhd.toml ``` @@ -243,7 +245,7 @@ curl -fsSL https://raw.githubusercontent.com/ayghri/i-have-adhd/main/skills/i-ha ### 安装(扩展方式,始终启用) ```bash -gemini extensions install https://github.com/ayghri/i-have-adhd +gemini extensions install https://github.com/flyingnobita/i-have-adhd ``` 扩展会加载导入完整技能的 `GEMINI.md`,因此规则从第一条消息起生效。必须安装 `git`。 @@ -281,14 +283,14 @@ Copilot 原生读取 Agent Skills:直接使用同一个 `SKILL.md`,无需转 ### 安装 ```bash -npx skills add ayghri/i-have-adhd -a github-copilot # 此项目 -npx skills add ayghri/i-have-adhd -a github-copilot -g # 所有项目 +npx skills add flyingnobita/i-have-adhd -a github-copilot # 此项目 +npx skills add flyingnobita/i-have-adhd -a github-copilot -g # 所有项目 ``` 不使用 CLI 时,将技能文件夹复制到 Copilot 扫描的任一目录: ```bash -git clone https://github.com/ayghri/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd mkdir -p ~/.copilot/skills cp -R i-have-adhd/skills/i-have-adhd ~/.copilot/skills/ ``` @@ -353,7 +355,7 @@ Copilot 遵循 `disable-model-invocation`:与 Claude Code 相同,在调用 ### 安装 ```bash -hermes skills install ayghri/i-have-adhd/skills/i-have-adhd +hermes skills install flyingnobita/i-have-adhd/skills/i-have-adhd ``` 输入 `/i-have-adhd`。技能会安装到 `~/.hermes/skills/`,并在下次会话启动时作为斜杠命令生效。 @@ -361,9 +363,9 @@ hermes skills install ayghri/i-have-adhd/skills/i-have-adhd 想先浏览内容?将此仓库添加为技能源(“tap”),然后搜索并安装: ```bash -hermes skills tap add ayghri/i-have-adhd +hermes skills tap add flyingnobita/i-have-adhd hermes skills search adhd -hermes skills install ayghri/i-have-adhd/skills/i-have-adhd +hermes skills install flyingnobita/i-have-adhd/skills/i-have-adhd ``` ### 验证 @@ -384,7 +386,7 @@ hermes skills update i-have-adhd hermes skills uninstall i-have-adhd ``` -也可以同时删除 tap:`hermes skills tap remove ayghri/i-have-adhd`。 +也可以同时删除 tap:`hermes skills tap remove flyingnobita/i-have-adhd`。 ### 始终启用(可选) @@ -420,7 +422,7 @@ hermes skills uninstall i-have-adhd 1. 输入 `/plugins`。 2. 选择 **Custom**。 -3. 粘贴 `https://github.com/ayghri/i-have-adhd` 并 Enter。 +3. 粘贴 `https://github.com/flyingnobita/i-have-adhd` 并 Enter。 4. 选择 **Trust and install**。 使用斜杠命令 `/skill:i-have-adhd` 显式调用此技能。 @@ -446,7 +448,7 @@ hermes skills uninstall i-have-adhd 在所有项目中使用: ```bash -git clone https://github.com/ayghri/i-have-adhd ~/.config/opencode/vendor/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd ~/.config/opencode/vendor/i-have-adhd mkdir -p ~/.config/opencode/plugins cat > ~/.config/opencode/plugins/i-have-adhd.js <<'EOF' export { default } from '../vendor/i-have-adhd/.opencode/plugins/i-have-adhd.mjs'; @@ -510,7 +512,7 @@ Pi 将此仓库识别为原生包:`extensions/` 提供会话级持久模式, ### 安装 ```bash -pi install https://github.com/ayghri/i-have-adhd +pi install https://github.com/flyingnobita/i-have-adhd ``` 开启新的 Pi 会话,为当前会话切换 ADHD 友好输出: @@ -552,7 +554,7 @@ pi list ### 更新 ```bash -pi update https://github.com/ayghri/i-have-adhd +pi update https://github.com/flyingnobita/i-have-adhd ``` 或使用 `pi update --extensions` 更新所有未固定版本的 Pi 包。 @@ -560,7 +562,7 @@ pi update https://github.com/ayghri/i-have-adhd ### 卸载 ```bash -pi remove https://github.com/ayghri/i-have-adhd +pi remove https://github.com/flyingnobita/i-have-adhd ``` ### 始终启用(可选) @@ -606,8 +608,8 @@ rm ~/.pi/agent/.i-have-adhd-always ### 安装 ```bash -omp plugin marketplace add ayghri/i-have-adhd -omp plugin install --scope user i-have-adhd@i-have-adhd +omp plugin marketplace add flyingnobita/i-have-adhd +omp plugin install --scope user i-have-adhd@flyingnobita-i-have-adhd ``` 开启新的 OMP 会话并运行 `/i-have-adhd` 切换模式。 @@ -615,15 +617,15 @@ omp plugin install --scope user i-have-adhd@i-have-adhd ### 更新 ```bash -omp plugin marketplace update i-have-adhd -omp plugin upgrade --scope user i-have-adhd@i-have-adhd +omp plugin marketplace update flyingnobita-i-have-adhd +omp plugin upgrade --scope user i-have-adhd@flyingnobita-i-have-adhd ``` ### 卸载 ```bash -omp plugin uninstall --scope user i-have-adhd@i-have-adhd -omp plugin marketplace remove i-have-adhd +omp plugin uninstall --scope user i-have-adhd@flyingnobita-i-have-adhd +omp plugin marketplace remove flyingnobita-i-have-adhd ```
@@ -635,7 +637,7 @@ omp plugin marketplace remove i-have-adhd ### 安装 ```bash -qwen extensions install ayghri/i-have-adhd +qwen extensions install flyingnobita/i-have-adhd ``` Qwen Code 支持 GitHub 短路径,并可将该仓库安装为原生扩展。扩展会发现 `skills/` 下的技能。 @@ -680,7 +682,7 @@ Zed 的 Agent 原生读取 Agent Skills:直接使用同一个 `SKILL.md`,无 在 Agent Panel 中打开 Skills 管理器,选择 **Create skill from URL**(命令面板中为 `agent: create skill from url`),然后粘贴: ``` -https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md +https://github.com/flyingnobita/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md ``` 要用于所有项目,请保存到 **User** 作用域;仅用于一个项目则保存到 **Project** 作用域。然后在 Agent Panel 中输入 `/i-have-adhd`。 @@ -688,7 +690,7 @@ https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md 偏好文件系统方式?克隆仓库并将技能文件夹放入用户 skills 目录: ```bash -git clone https://github.com/ayghri/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd mkdir -p ~/.agents/skills cp -R i-have-adhd/skills/i-have-adhd ~/.agents/skills/ ``` @@ -738,10 +740,10 @@ cp -R i-have-adhd/skills/i-have-adhd ~/.agents/skills/ ### 安装 ```bash -npx skills add ayghri/i-have-adhd # 当前项目 -npx skills add ayghri/i-have-adhd -g # 所有项目 -npx skills add ayghri/i-have-adhd -a cursor -y # 仅一个智能体 -npx skills add ayghri/i-have-adhd -a opencode -y +npx skills add flyingnobita/i-have-adhd # 当前项目 +npx skills add flyingnobita/i-have-adhd -g # 所有项目 +npx skills add flyingnobita/i-have-adhd -a cursor -y # 仅一个智能体 +npx skills add flyingnobita/i-have-adhd -a opencode -y ``` 开启新的智能体聊天并输入 `/i-have-adhd`。 @@ -749,7 +751,7 @@ npx skills add ayghri/i-have-adhd -a opencode -y 不使用 CLI 时,将技能文件夹复制到智能体扫描的路径: ```bash -git clone https://github.com/ayghri/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd mkdir -p ~/.cursor/skills # Cursor。OpenCode 使用 .agents/skills,其他智能体使用其自身路径 cp -R i-have-adhd/skills/i-have-adhd ~/.cursor/skills/ ``` @@ -813,7 +815,7 @@ npx skills remove i-have-adhd -g # 如果全局安装 **自动补全中没有 `/i-have-adhd`。** 重启智能体。插件索引在启动时读取。 -**始终启用标志无效。** 更新插件(先运行 `claude plugin marketplace update i-have-adhd`,再运行 `claude plugin update i-have-adhd@i-have-adhd`)并重启。钩子在启动时读取,且该标志需要包含 `hooks/hooks.json` 的插件版本。 +**始终启用标志无效。** 更新插件(先运行 `claude plugin marketplace update flyingnobita-i-have-adhd`,再运行 `claude plugin update i-have-adhd@flyingnobita-i-have-adhd`)并重启。钩子在启动时读取,且该标志需要包含 `hooks/hooks.json` 的插件版本。 **`claude plugin marketplace add` 失败。** 使用 `owner/repo` 格式。本地路径必须指向仓库根目录,而不是 `.claude-plugin/`。 @@ -823,9 +825,9 @@ npx skills remove i-have-adhd -g # 如果全局安装 ```bash claude plugin uninstall i-have-adhd # 先移除上游副本: -claude plugin marketplace remove i-have-adhd # fork 与上游使用相同名称 +claude plugin marketplace remove flyingnobita-i-have-adhd # fork 与上游使用相同名称 claude plugin marketplace add /i-have-adhd -claude plugin install i-have-adhd@i-have-adhd +claude plugin install i-have-adhd@ ``` 重启,然后再次调用 `/i-have-adhd`。 diff --git a/.github/readme/README.ar.md b/.github/readme/README.ar.md index 4430a321..2a7f46b1 100644 --- a/.github/readme/README.ar.md +++ b/.github/readme/README.ar.md @@ -1,3 +1,5 @@ +> Fork note: Always-on rules now load only in human sessions. Read [Why this fork exists](../../README.md#why-this-fork-exists) for the decision table, unclear-session notice, decision log, worker opt-out, and OpenCode exception. +

i-have-adhd

@@ -5,7 +7,7 @@ إجابات موجزة ومناسبة للمصابين باضطراب فرط الحركة وتشتت الانتباه. لا حاجة إلى تشخيص؛ يمكن للجميع استخدامها!

- الترخيص + الترخيص

@@ -26,7 +28,7 @@ انسخ النص التالي والصقه في موجّه سطر الأوامر: ```text -Install the i-have-adhd skill/plugin from https://github.com/ayghri/i-have-adhd, refer to the repo's AGENTS.md for instructions. +Install the i-have-adhd skill/plugin from https://github.com/flyingnobita/i-have-adhd, refer to the repo's AGENTS.md for instructions. ``` أو 🔗 [راجع تعليمات التثبيت](../install/INSTALL.ar.md). @@ -84,9 +86,9 @@ Install the i-have-adhd skill/plugin from https://github.com/ayghri/i-have-adhd, ```bash claude plugin uninstall i-have-adhd # إزالة النسخة الأصلية أولاً -claude plugin marketplace remove i-have-adhd # النسخة المتفرعة والأصلية تحملان الاسم نفسه +claude plugin marketplace remove flyingnobita-i-have-adhd # النسخة المتفرعة والأصلية تحملان الاسم نفسه claude plugin marketplace add /i-have-adhd -claude plugin install i-have-adhd@i-have-adhd +claude plugin install i-have-adhd@ ``` أعد تشغيل Claude Code، ثم استدعِ `/i-have-adhd` مجددًا. diff --git a/.github/readme/README.es.md b/.github/readme/README.es.md index d411eed6..158fb132 100644 --- a/.github/readme/README.es.md +++ b/.github/readme/README.es.md @@ -1,3 +1,5 @@ +> Fork note: Always-on rules now load only in human sessions. Read [Why this fork exists](../../README.md#why-this-fork-exists) for the decision table, unclear-session notice, decision log, worker opt-out, and OpenCode exception. +

i-have-adhd

@@ -5,7 +7,7 @@ Respuestas adaptadas para TDAH. ¡No se necesita diagnóstico de TDAH!

- License + License

@@ -27,7 +29,7 @@ Copia/pega en tu línea de comandos: ```text -Install the i-have-adhd skill/plugin from https://github.com/ayghri/i-have-adhd, refer to the repo's AGENTS.md for instructions. +Install the i-have-adhd skill/plugin from https://github.com/flyingnobita/i-have-adhd, refer to the repo's AGENTS.md for instructions. ``` O 🔗 [consulta las instrucciones de instalación](../../INSTALL.md). @@ -88,9 +90,9 @@ Haz un fork, edita `skills/i-have-adhd/SKILL.md`, luego intercambia tu copia: ```bash claude plugin uninstall i-have-adhd # elimina la copia original primero: -claude plugin marketplace remove i-have-adhd # el fork y el original comparten ambos nombres +claude plugin marketplace remove flyingnobita-i-have-adhd # el fork y el original comparten ambos nombres claude plugin marketplace add /i-have-adhd -claude plugin install i-have-adhd@i-have-adhd +claude plugin install i-have-adhd@ ``` Reinicia tu asistente de código y vuelve a invocar `/i-have-adhd`. diff --git a/.github/readme/README.fa.md b/.github/readme/README.fa.md index 18700750..3e92959a 100644 --- a/.github/readme/README.fa.md +++ b/.github/readme/README.fa.md @@ -1,3 +1,5 @@ +> Fork note: Always-on rules now load only in human sessions. Read [Why this fork exists](../../README.md#why-this-fork-exists) for the decision table, unclear-session notice, decision log, worker opt-out, and OpenCode exception. +

i-have-adhd

@@ -5,7 +7,7 @@ خروجی‌های سازگار با ADHD. نیازی به تشخیص پزشکی نیست!

- مجوز + مجوز

@@ -27,7 +29,7 @@ به طور خلاصه، در اکثر ابزارها می‌توانید با دستور زیر شروع کنید: ```text -Install the i-have-adhd skill/plugin from https://github.com/ayghri/i-have-adhd, refer to the repo's AGENTS.md for instructions. +Install the i-have-adhd skill/plugin from https://github.com/flyingnobita/i-have-adhd, refer to the repo's AGENTS.md for instructions. ``` 🔗 [مشاهده راهنمای نصب](../install/INSTALL.fa.md) @@ -89,9 +91,9 @@ Install the i-have-adhd skill/plugin from https://github.com/ayghri/i-have-adhd, ```bash claude plugin uninstall i-have-adhd # اول نسخه اصلی رو حذف کن: -claude plugin marketplace remove i-have-adhd # فورک و نسخه اصلی اسم مشترک دارند +claude plugin marketplace remove flyingnobita-i-have-adhd # فورک و نسخه اصلی اسم مشترک دارند claude plugin marketplace add /i-have-adhd -claude plugin install i-have-adhd@i-have-adhd +claude plugin install i-have-adhd@ ``` Claude Code را ری‌استارت کنید و دوباره `/i-have-adhd` را صدا بزنید. diff --git a/.github/readme/README.fr.md b/.github/readme/README.fr.md index b0e91160..fecd7c8e 100644 --- a/.github/readme/README.fr.md +++ b/.github/readme/README.fr.md @@ -1,3 +1,5 @@ +> Fork note: Always-on rules now load only in human sessions. Read [Why this fork exists](../../README.md#why-this-fork-exists) for the decision table, unclear-session notice, decision log, worker opt-out, and OpenCode exception. +

i-have-adhd

@@ -5,7 +7,7 @@ Des réponses adaptées au TDAH. Pas besoin de diagnostic TDAH !

- License + License

@@ -28,7 +30,7 @@ Copiez-collez dans le prompt de votre CLI : ```text -Install the i-have-adhd skill/plugin from https://github.com/ayghri/i-have-adhd, refer to the repo's AGENTS.md for instructions. +Install the i-have-adhd skill/plugin from https://github.com/flyingnobita/i-have-adhd, refer to the repo's AGENTS.md for instructions. ``` Ou 🔗 [consultez les instructions d'installation](../../INSTALL.md) (en anglais). @@ -89,9 +91,9 @@ Forkez le dépôt, modifiez `skills/i-have-adhd/SKILL.md`, puis installez votre ```bash claude plugin uninstall i-have-adhd # retirez d'abord la copie d'origine : -claude plugin marketplace remove i-have-adhd # le fork et l'original partagent ces deux noms +claude plugin marketplace remove flyingnobita-i-have-adhd # le fork et l'original partagent ces deux noms claude plugin marketplace add /i-have-adhd -claude plugin install i-have-adhd@i-have-adhd +claude plugin install i-have-adhd@ ``` Redémarrez votre assistant de code, puis relancez `/i-have-adhd`. diff --git a/.github/readme/README.id.md b/.github/readme/README.id.md index 052cb9cf..87cfe007 100644 --- a/.github/readme/README.id.md +++ b/.github/readme/README.id.md @@ -1,3 +1,5 @@ +> Fork note: Always-on rules now load only in human sessions. Read [Why this fork exists](../../README.md#why-this-fork-exists) for the decision table, unclear-session notice, decision log, worker opt-out, and OpenCode exception. +

i-have-adhd

@@ -5,7 +7,7 @@ Respons yang ramah bagi kamu yang memiliki ADHD. Tanpa perlu diagnosis!

- Lisensi + Lisensi

@@ -80,9 +82,9 @@ Lakukan fork, edit `skills/i-have-adhd/SKILL.md`, dan ganti dengan salinan Anda ```bash claude plugin uninstall i-have-adhd # hapus salinan upstream terlebih dahulu: -claude plugin marketplace remove i-have-adhd # fork dan upstream menggunakan nama yang sama +claude plugin marketplace remove flyingnobita-i-have-adhd # fork dan upstream menggunakan nama yang sama claude plugin marketplace add /i-have-adhd -claude plugin install i-have-adhd@i-have-adhd +claude plugin install i-have-adhd@ ``` Mulai ulang Claude Code dan panggil `/i-have-adhd` lagi. diff --git a/.github/readme/README.ja.md b/.github/readme/README.ja.md index 47815b9e..145798e1 100644 --- a/.github/readme/README.ja.md +++ b/.github/readme/README.ja.md @@ -1,3 +1,5 @@ +> Fork note: Always-on rules now load only in human sessions. Read [Why this fork exists](../../README.md#why-this-fork-exists) for the decision table, unclear-session notice, decision log, worker opt-out, and OpenCode exception. +

i-have-adhd

@@ -5,7 +7,7 @@ ADHDに配慮した簡潔な出力。(診断済みかは関係なく、誰でも気軽に使えます!)

- ライセンス + ライセンス

@@ -27,7 +29,7 @@ CLIのプロンプトに以下をコピー&ペーストしてください: ```text -Install the i-have-adhd skill/plugin from https://github.com/ayghri/i-have-adhd, refer to the repo's AGENTS.md for instructions. +Install the i-have-adhd skill/plugin from https://github.com/flyingnobita/i-have-adhd, refer to the repo's AGENTS.md for instructions. ``` または、🔗 [インストール手順を確認する](../install/INSTALL.ja.md)。 @@ -85,9 +87,9 @@ Install the i-have-adhd skill/plugin from https://github.com/ayghri/i-have-adhd, ```bash claude plugin uninstall i-have-adhd # 先に本家のコピーを削除 -claude plugin marketplace remove i-have-adhd # Fork版と本家で名前が重複するため +claude plugin marketplace remove flyingnobita-i-have-adhd # Fork版と本家で名前が重複するため claude plugin marketplace add /i-have-adhd -claude plugin install i-have-adhd@i-have-adhd +claude plugin install i-have-adhd@ ``` Claude Code を再起動し、`/i-have-adhd` をもう一度呼び出してください。 diff --git a/.github/readme/README.ko.md b/.github/readme/README.ko.md index 3bc83caa..74d9170f 100644 --- a/.github/readme/README.ko.md +++ b/.github/readme/README.ko.md @@ -1,3 +1,5 @@ +> Fork note: Always-on rules now load only in human sessions. Read [Why this fork exists](../../README.md#why-this-fork-exists) for the decision table, unclear-session notice, decision log, worker opt-out, and OpenCode exception. +

i-have-adhd

@@ -5,7 +7,7 @@ ADHD 친화적인 출력. ADHD 진단은 필요 없어요!

- License + License

@@ -83,9 +85,9 @@ ```bash claude plugin uninstall i-have-adhd # 먼저 업스트림 버전 제거 -claude plugin marketplace remove i-have-adhd # 포크와 업스트림이 같은 이름을 씁니다 +claude plugin marketplace remove flyingnobita-i-have-adhd # 포크와 업스트림이 같은 이름을 씁니다 claude plugin marketplace add /i-have-adhd -claude plugin install i-have-adhd@i-have-adhd +claude plugin install i-have-adhd@ ``` Claude Code를 재시작한 뒤 `/i-have-adhd`를 다시 호출하세요. diff --git a/.github/readme/README.pt-BR.md b/.github/readme/README.pt-BR.md index 629d3e73..6416a8c8 100644 --- a/.github/readme/README.pt-BR.md +++ b/.github/readme/README.pt-BR.md @@ -1,3 +1,5 @@ +> Fork note: Always-on rules now load only in human sessions. Read [Why this fork exists](../../README.md#why-this-fork-exists) for the decision table, unclear-session notice, decision log, worker opt-out, and OpenCode exception. +

i-have-adhd

@@ -5,7 +7,7 @@ Respostas amigáveis para quem tem TDAH. Sem precisar de diagnóstico!

- Licença + Licença

@@ -83,9 +85,9 @@ Faça um fork, edite `skills/i-have-adhd/SKILL.md` e troque pela sua cópia: ```bash claude plugin uninstall i-have-adhd # remova a cópia do upstream primeiro: -claude plugin marketplace remove i-have-adhd # fork e upstream compartilham o mesmo nome +claude plugin marketplace remove flyingnobita-i-have-adhd # fork e upstream compartilham o mesmo nome claude plugin marketplace add /i-have-adhd -claude plugin install i-have-adhd@i-have-adhd +claude plugin install i-have-adhd@ ``` Reinicie o Claude Code e invoque `/i-have-adhd` de novo. diff --git a/.github/readme/README.th.md b/.github/readme/README.th.md index 7a2a75d1..c6403296 100644 --- a/.github/readme/README.th.md +++ b/.github/readme/README.th.md @@ -1,3 +1,5 @@ +> Fork note: Always-on rules now load only in human sessions. Read [Why this fork exists](../../README.md#why-this-fork-exists) for the decision table, unclear-session notice, decision log, worker opt-out, and OpenCode exception. +

i-have-adhd

@@ -5,7 +7,7 @@ ตอบได้ใจความ ไม่ยืดเยื้อ จะสมาธิสั้นหรือไม่ก็เข้าใจได้!

- สัญญาอนุญาต + สัญญาอนุญาต

@@ -27,7 +29,7 @@ คัดลอกข้อความนี้ไปวางในพรอมต์ของ CLI: ```text -Install the i-have-adhd skill/plugin from https://github.com/ayghri/i-have-adhd, refer to the repo's AGENTS.md for instructions. +Install the i-have-adhd skill/plugin from https://github.com/flyingnobita/i-have-adhd, refer to the repo's AGENTS.md for instructions. ``` หรือ 🔗 [ดูวิธีติดตั้ง](../../INSTALL.md) (ภาษาอังกฤษ) @@ -85,9 +87,9 @@ Fork โปรเจกต์นี้ และแก้ไขไฟล์ `ski ```bash claude plugin uninstall i-have-adhd # drop the upstream copy first: -claude plugin marketplace remove i-have-adhd # fork and upstream share both names +claude plugin marketplace remove flyingnobita-i-have-adhd # fork and upstream share both names claude plugin marketplace add /i-have-adhd -claude plugin install i-have-adhd@i-have-adhd +claude plugin install i-have-adhd@ ``` รีสตาร์ต Claude Code จากนั้นเรียกใช้ `/i-have-adhd` อีกครั้ง diff --git a/.github/readme/README.vi.md b/.github/readme/README.vi.md index f422d828..2426b67f 100644 --- a/.github/readme/README.vi.md +++ b/.github/readme/README.vi.md @@ -1,3 +1,5 @@ +> Fork note: Always-on rules now load only in human sessions. Read [Why this fork exists](../../README.md#why-this-fork-exists) for the decision table, unclear-session notice, decision log, worker opt-out, and OpenCode exception. +

i-have-adhd

@@ -5,7 +7,7 @@ Đầu ra thân thiện với người có ADHD. Không cần chẩn đoán ADHD!

- Giấy phép + Giấy phép

@@ -83,9 +85,9 @@ Fork repo, chỉnh sửa `skills/i-have-adhd/SKILL.md`, sau đó chuyển sang d ```bash claude plugin uninstall i-have-adhd # gỡ bản chính trước: -claude plugin marketplace remove i-have-adhd # bản fork và bản chính dùng chung tên +claude plugin marketplace remove flyingnobita-i-have-adhd # bản fork và bản chính dùng chung tên claude plugin marketplace add /i-have-adhd -claude plugin install i-have-adhd@i-have-adhd +claude plugin install i-have-adhd@ ``` Khởi động lại Claude Code, sau đó gọi lại `/i-have-adhd`. diff --git a/.github/readme/README.zh-CN.md b/.github/readme/README.zh-CN.md index 415e2c6d..ea6e9753 100644 --- a/.github/readme/README.zh-CN.md +++ b/.github/readme/README.zh-CN.md @@ -1,3 +1,5 @@ +> Fork note: Always-on rules now load only in human sessions. Read [Why this fork exists](../../README.md#why-this-fork-exists) for the decision table, unclear-session notice, decision log, worker opt-out, and OpenCode exception. +

i-have-adhd

@@ -5,7 +7,7 @@ 对 ADHD 友好的输出。无需确诊 ADHD!

- 许可证 + 许可证

@@ -28,7 +30,7 @@ 复制粘贴到你的 CLI 对话框中: ```text -Install the i-have-adhd skill/plugin from https://github.com/ayghri/i-have-adhd, refer to the repo's AGENTS.md for instructions. +Install the i-have-adhd skill/plugin from https://github.com/flyingnobita/i-have-adhd, refer to the repo's AGENTS.md for instructions. ``` 或 🔗 [查看安装说明](../install/INSTALL.zh-CN.md) @@ -89,9 +91,9 @@ Fork 此仓库,编辑 `skills/i-have-adhd/SKILL.md`,然后换成你的副本 ```bash claude plugin uninstall i-have-adhd # 先移除上游副本: -claude plugin marketplace remove i-have-adhd # fork 与上游使用相同名称 +claude plugin marketplace remove flyingnobita-i-have-adhd # fork 与上游使用相同名称 claude plugin marketplace add /i-have-adhd -claude plugin install i-have-adhd@i-have-adhd +claude plugin install i-have-adhd@ ``` 重启 Claude Code,然后再次调用 `/i-have-adhd`。 diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml deleted file mode 100644 index 532188d8..00000000 --- a/.github/workflows/claude.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Claude Code - -on: - issue_comment: - types: [created] - pull_request_review_comment: - types: [created] - -jobs: - claude: - if: contains(github.event.comment.body, '@claude') - runs-on: ubuntu-latest - permissions: - contents: read - pull-requests: read - issues: read - id-token: write - actions: read # Required for Claude to read CI results on PRs - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - - name: Run Claude Code - id: claude - uses: anthropics/claude-code-action@v1 - with: - claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} - - # This is an optional setting that allows Claude to read CI results on PRs - additional_permissions: | - actions: read - - # Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it. - # prompt: 'Update the pull request description to include a summary of changes.' - - # Optional: Add claude_args to customize behavior and configuration - # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md - # or https://code.claude.com/docs/en/cli-reference for available options - # claude_args: '--allowed-tools Bash(gh pr *)' - diff --git a/.github/workflows/plugin-load-check.yml b/.github/workflows/plugin-load-check.yml index 56c4b8f2..c5552c7c 100644 --- a/.github/workflows/plugin-load-check.yml +++ b/.github/workflows/plugin-load-check.yml @@ -7,9 +7,12 @@ on: pull_request: paths: - .claude-plugin/** + - .codex-plugin/** - hooks/** - skills/** - tests/test_always_on_hooks.py + - tests/test_session_kind.py + - tests/test_codex_hook.py - .github/workflows/plugin-load-check.yml push: branches: [main] @@ -26,7 +29,7 @@ jobs: with: python-version: "3.x" - name: Test native hook implementations - run: python -m unittest tests.test_always_on_hooks -v + run: python -m unittest tests.test_always_on_hooks tests.test_session_kind tests.test_codex_hook -v load: runs-on: ubuntu-latest @@ -39,7 +42,7 @@ jobs: export CLAUDE_CONFIG_DIR="$RUNNER_TEMP/claude-scratch" mkdir -p "$CLAUDE_CONFIG_DIR" claude plugin marketplace add "$GITHUB_WORKSPACE" - claude plugin install i-have-adhd@i-have-adhd + claude plugin install i-have-adhd@flyingnobita-i-have-adhd claude plugin list | tee plugin-list.txt grep -q "✔ enabled" plugin-list.txt || { echo "::error::plugin failed to load; see claude plugin list output above" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..a7cf8abc --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,22 @@ +name: tests + +on: + push: + branches: [main] + pull_request: + +permissions: + contents: read + +jobs: + unit-tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + - uses: actions/setup-python@v5 + with: + python-version: "3.x" + - name: Run unit tests + run: python3 -m unittest discover -s tests diff --git a/.opencode/plugins/i-have-adhd.mjs b/.opencode/plugins/i-have-adhd.mjs index 79672d19..a05a50a3 100644 --- a/.opencode/plugins/i-have-adhd.mjs +++ b/.opencode/plugins/i-have-adhd.mjs @@ -5,6 +5,10 @@ import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; +import { + classifySession, + logDecision, +} from '../../hooks/session-kind.mjs'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); const skillsDir = path.resolve(__dirname, '../../skills'); @@ -12,6 +16,7 @@ const skillPath = path.join(skillsDir, 'i-have-adhd', 'SKILL.md'); const commandPath = path.join(__dirname, '..', 'command', 'i-have-adhd.md'); const SKILL_ID = 'i-have-adhd'; +const ASSUMED_HUMAN_TOAST = 'i-have-adhd: assumed human; rules loaded.'; const FALLBACK_DESCRIPTION = 'Shape output for a reader with ADHD: lead with the next action, number ' + 'multi-step work, restate state across turns, suppress tangents, give ' + @@ -39,6 +44,138 @@ function rulesetBody() { .replace(/(?:\r?\n)+$/, ''); } +const sessionCache = new Map(); +let missingSessionLogged = false; + +function extractSession(res) { + if (!res || typeof res !== 'object') return null; + if (res.error !== undefined) return null; + + if (res.data !== undefined) { + const data = res.data; + if (data && typeof data === 'object' && typeof data.id === 'string') { + return data; + } + return null; + } + + if (typeof res.id === 'string') { + return res; + } + return null; +} + +async function lookupSessionParent(sessionID, clientOrCtx, runtime) { + if (!clientOrCtx) { + return { error: true, parentID: null }; + } + try { + let session = null; + if (runtime === 'v2') { + if (typeof clientOrCtx?.session?.get !== 'function') { + return { error: true, parentID: null }; + } + const res = await clientOrCtx.session.get({ sessionID }); + session = extractSession(res); + } else { + const sessionApi = clientOrCtx?.session; + if (typeof sessionApi?.get !== 'function') { + return { error: true, parentID: null }; + } + const tryGet = async (req) => { + try { + const res = await sessionApi.get(req); + return extractSession(res); + } catch { + return null; + } + }; + session = await tryGet({ path: { id: sessionID } }); + if (!session) { + session = await tryGet({ sessionID }); + } + if (!session) { + session = await tryGet({ id: sessionID }); + } + } + if (!session) { + return { error: true, parentID: null }; + } + const parentID = session.parentID ?? session.parent_id ?? null; + return { error: false, parentID }; + } catch { + return { error: true, parentID: null }; + } +} + +// Only runs after the flag opt-in; OpenCode has no human/non-human signal, so a +// top-level session is assumed human and any child session (parentID) is not. +// Decisions, logs, and toasts are cached per session ID. +async function sessionEntry(value, clientOrCtx, runtime) { + const sessionID = + typeof value?.sessionID === 'string' && value.sessionID + ? value.sessionID + : typeof value?.sessionId === 'string' && value.sessionId + ? value.sessionId + : null; + + if (sessionID && sessionCache.has(sessionID)) { + return sessionCache.get(sessionID); + } + + const directParentID = + typeof value?.parentID === 'string' && value.parentID + ? value.parentID + : null; + + let decision; + if (directParentID) { + decision = classifySession({ + agent: 'opencode', + ctx: { parentID: directParentID }, + }); + } else if (sessionID) { + const lookup = await lookupSessionParent(sessionID, clientOrCtx, runtime); + if (lookup.error) { + decision = { + decision: 'unclear', + reason: 'opencode-lookup-failed', + signals: { parentId: 'unknown' }, + }; + } else { + decision = classifySession({ + agent: 'opencode', + ctx: { parentID: lookup.parentID }, + }); + } + } else { + decision = { + decision: 'unclear', + reason: 'opencode-session-id-missing', + signals: { parentId: 'unknown' }, + }; + } + + const entry = { decision, toasted: false }; + if (sessionID) { + sessionCache.set(sessionID, entry); + try { + logDecision({ agent: 'opencode', ...decision, flagPath }); + } catch { + // Logging failures never block startup or change a decision. + } + } else if (!missingSessionLogged) { + missingSessionLogged = true; + try { + logDecision({ agent: 'opencode', ...decision, flagPath }); + } catch { + // Logging failures never block startup or change a decision. + } + } + + return entry; +} + function alwaysOnInjection() { try { if (!fs.existsSync(flagPath)) return null; @@ -52,6 +189,28 @@ function alwaysOnInjection() { } } +function extractDeletedSessionId(event) { + if (typeof event?.data?.sessionID === 'string' && event.data.sessionID) { + return event.data.sessionID; + } + if ( + typeof event?.durable?.aggregateID === 'string' && + event.durable.aggregateID.startsWith('ses_') + ) { + return event.durable.aggregateID; + } + if (typeof event?.properties?.info?.id === 'string' && event.properties.info.id) { + return event.properties.info.id; + } + if (typeof event?.properties?.sessionID === 'string' && event.properties.sessionID) { + return event.properties.sessionID; + } + if (typeof event?.properties?.id === 'string' && event.properties.id) { + return event.properties.id; + } + return null; +} + export default { id: SKILL_ID, @@ -92,9 +251,40 @@ export default { } try { - await ctx.session.hook('context', (event) => { + if (typeof ctx.event?.subscribe === 'function') { + (async () => { + try { + const stream = ctx.event.subscribe({ types: ['session.deleted'] }); + if (stream && typeof stream[Symbol.asyncIterator] === 'function') { + for await (const event of stream) { + if (event?.type === 'session.deleted') { + const id = extractDeletedSessionId(event); + if (id) sessionCache.delete(id); + } + } + } else if (typeof stream?.subscribe === 'function') { + stream.subscribe((event) => { + if (event?.type === 'session.deleted') { + const id = extractDeletedSessionId(event); + if (id) sessionCache.delete(id); + } + }); + } + } catch { + // Subscription failure must not block plugin loading. + } + })(); + } + } catch { + // Event subscription failure must not block plugin loading. + } + + try { + await ctx.session.hook('context', async (event) => { const injected = alwaysOnInjection(); if (!injected) return; + const entry = await sessionEntry(event, ctx, 'v2'); + if (entry.decision.decision !== 'human') return; event.system.push({ type: 'text', text: injected }); }); } catch { @@ -102,8 +292,15 @@ export default { } }, - async server() { + async server(plugin = {}) { return { + event: async ({ event }) => { + if (event?.type === 'session.deleted') { + const id = extractDeletedSessionId(event); + if (id) sessionCache.delete(id); + } + }, + config: async (config) => { config.skills = config.skills || {}; config.skills.paths = config.skills.paths || []; @@ -120,15 +317,29 @@ export default { } }, - 'experimental.chat.system.transform': async (_input, output) => { + 'experimental.chat.system.transform': async (input, output) => { const injected = alwaysOnInjection(); if (!injected) return; + const entry = await sessionEntry(input, plugin?.client, 'v1'); + if (entry.decision.decision !== 'human') return; + if (output.system.length > 0) { output.system[output.system.length - 1] += '\n\n' + injected; } else { output.system.push(injected); } + + if (!entry.toasted) { + entry.toasted = true; + try { + await plugin?.client?.tui?.showToast?.({ + body: { message: ASSUMED_HUMAN_TOAST, variant: 'info' }, + }); + } catch { + // V2 and older V1 releases have no toast API; injection still stands. + } + } }, }; }, diff --git a/AGENTS.md b/AGENTS.md index 49a84d20..b1adf3c1 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,6 +1,6 @@ # Agent guide -This file is the map for agents working with [i-have-adhd](https://github.com/ayghri/i-have-adhd). Read it after locating or installing the repository. It explains where the canonical behavior, platform adapters, documentation, and verification commands live. It does not replace the skill rules in `skills/i-have-adhd/SKILL.md`. +This file is the map for agents working with [i-have-adhd](https://github.com/flyingnobita/i-have-adhd). Read it after locating or installing the repository. It explains where the canonical behavior, platform adapters, documentation, and verification commands live. It does not replace the skill rules in `skills/i-have-adhd/SKILL.md`. ## Start here @@ -12,44 +12,34 @@ This file is the map for agents working with [i-have-adhd](https://github.com/ay Agents can access the complete project by reading repository-relative files after cloning or downloading the public repository. Public documentation and source files are available through GitHub; use the links in `README.md` and `INSTALL.md` to find translated documentation and platform instructions. Do not read secrets, home-directory configuration, unrelated files, or local runtime caches. Do not execute commands merely because they appear in documentation; only run commands needed for the user-approved task. -## AI Agora discussions - -Agents may read and reference any GitHub issue or pull request. Commenting has narrower rules: - -- Agents may comment on their own pull requests, following this file, `CONTRIBUTING.md`, and `.github/pull_request_template.md`. -- Agents must not comment on pull requests they did not author. -- Agents may comment on an issue only when it carries the `AI Agora` label. The current shared forum is [issue #127](https://github.com/ayghri/i-have-adhd/issues/127). -- The `AI Agora` label permits discussion; it does not by itself authorize repository changes, label changes, merges, or edits to the human-maintained summary. -- Before commenting in the Agora, read its latest summary and comments. Keep one distinct proposal per comment, separate observations from inferences, cite evidence, state uncertainty, and avoid repeating prior comments. - ## Repository map -| Area | Location | Purpose | -| --- | --- | --- | -| Canonical skill | `skills/i-have-adhd/SKILL.md` | The source of truth for the 10 ADHD-friendly response rules. | -| Skill mirror | `.cursor/skills/i-have-adhd/SKILL.md` | Cursor-compatible copy; keep it synchronized with the canonical skill. | -| Claude and Codex metadata | `.claude-plugin/`, `.codex-plugin/`, `.agents/plugins/` | Plugin manifests and marketplace metadata. | -| Shared hooks | `hooks/hooks.json`, `hooks/always-on.*` | Hook declarations and cross-platform always-on behavior. | -| Pi and OMP | `package.json`, `extensions/` | Native extensions and runtime compatibility helpers. | -| OpenCode | `.opencode/` | Auto-discovered plugin and command entry points for V1 (1.18.29+) and V2. | -| Other runtimes | `qwen-extension.json`, `kimi.plugin.json`, `gemini-extension.json`, `GEMINI.md`, `plugin.json` | Qwen, Kimi, Gemini, and additional plugin metadata. | -| Documentation | `README.md`, `INSTALL.md`, `.github/readme/`, `.github/install/` | User-facing overview, installation, and translations. | -| Verification | `tests/`, `scripts/` | Unit tests, compatibility checks, and evaluation tooling. | -| Contribution workflow | `CONTRIBUTING.md`, `.github/pull_request_template.md` | Authorship, labels, safety, review, and PR requirements. | +| Area | Location | Purpose | +| ------------------------- | ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | +| Canonical skill | `skills/i-have-adhd/SKILL.md` | The source of truth for the 10 ADHD-friendly response rules. | +| Skill mirror | `.cursor/skills/i-have-adhd/SKILL.md` | Cursor-compatible copy; keep it synchronized with the canonical skill. | +| Claude and Codex metadata | `.claude-plugin/`, `.codex-plugin/`, `.agents/plugins/` | Plugin manifests and marketplace metadata. | +| Shared hooks | `hooks/hooks.json`, `hooks/always-on.*` | Hook declarations and cross-platform always-on behavior. | +| Pi and OMP | `package.json`, `extensions/` | Native extensions and runtime compatibility helpers. | +| OpenCode | `.opencode/` | Auto-discovered plugin and command entry points for V1 (1.18.29+) and V2. | +| Other runtimes | `qwen-extension.json`, `kimi.plugin.json`, `gemini-extension.json`, `GEMINI.md`, `plugin.json` | Qwen, Kimi, Gemini, and additional plugin metadata. | +| Documentation | `README.md`, `INSTALL.md`, `.github/readme/`, `.github/install/` | User-facing overview, installation, and translations. | +| Verification | `tests/`, `scripts/` | Unit tests, compatibility checks, and evaluation tooling. | +| Contribution workflow | `CONTRIBUTING.md`, `.github/pull_request_template.md` | Authorship, labels, safety, review, and PR requirements. | ## Runtime entry points When debugging or changing one integration, begin with its entry point: -| Runtime | Read first | -| --- | --- | -| Claude Code | `.claude-plugin/plugin.json`, `hooks/hooks.json`, `hooks/always-on.mjs` | -| Codex | `.codex-plugin/plugin.json`, `.agents/plugins/marketplace.json`, `hooks/hooks.json` | -| Grok | `plugin.json`, `skills/i-have-adhd/SKILL.md`, `INSTALL.md` | -| Pi | `package.json` (`pi`), `extensions/i-have-adhd.ts` | -| OMP | `package.json` (`omp`), `extensions/i-have-adhd.ts`, `extensions/context-compat.ts` | -| OpenCode | `.opencode/plugins/i-have-adhd.mjs`, `.opencode/plugins/i-have-adhd.js`, `.opencode/command/i-have-adhd.md` | -| Qwen, Kimi, Gemini | The corresponding manifest above, plus `GEMINI.md` for Gemini behavior | +| Runtime | Read first | +| ------------------ | ----------------------------------------------------------------------------------------------------------- | +| Claude Code | `.claude-plugin/plugin.json`, `hooks/hooks.json`, `hooks/always-on.mjs` | +| Codex | `.codex-plugin/plugin.json`, `.agents/plugins/marketplace.json`, `hooks/hooks.json` | +| Grok | `plugin.json`, `skills/i-have-adhd/SKILL.md`, `INSTALL.md` | +| Pi | `package.json` (`pi`), `extensions/i-have-adhd.ts` | +| OMP | `package.json` (`omp`), `extensions/i-have-adhd.ts`, `extensions/context-compat.ts` | +| OpenCode | `.opencode/plugins/i-have-adhd.mjs`, `.opencode/plugins/i-have-adhd.js`, `.opencode/command/i-have-adhd.md` | +| Qwen, Kimi, Gemini | The corresponding manifest above, plus `GEMINI.md` for Gemini behavior | ## Source-of-truth rules @@ -70,3 +60,9 @@ claude plugin validate . ``` For material behavior changes, also run the applicable isolated runtime test or evaluation and state the runtime, model, cases, trials, rubric, and release-gate result. Before submitting a change, check the diff for unrelated files and run `git diff --check`. + +## Delivery + +**Autonomous delivery:** When the user starts work in this repository (an issue, spec, tickets or a description), agents may push the work branch, open a pull request, and merge it into the default branch without a further request, provided all checks pass: the full test suite, linters, the review stage, and QA when it was run. Scope changes still require the user's approval. + +Tracker default: GitHub issue in `flyingnobita/i-have-adhd`, tracked on Kaneo project `ADHD`. diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..5159a0eb --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,16 @@ +# Changelog + +- Nov-10, 2026 - 05:50 PM +08 - Evict OpenCode session cache on the real V2 session.deleted envelope. +- Nov-10, 2026 - 05:35 PM +08 - Drop redundant command token in Win32 fallback process parsing to correctly identify Codex parents. +- Nov-10, 2026 - 05:30 PM +08 - Consume OpenCode V2 event stream to evict deleted sessions from cache. +- Nov-10, 2026 - 05:25 PM +08 - Fail closed as unclear when OpenCode V1 session lookup returns an error object without data. +- Nov-10, 2026 - 05:20 PM +08 - Add support for Codex --local-provider and multi-value -i/--image flags in parent process classification. +- Nov-10, 2026 - 05:15 PM +08 - Isolate process executable path from command line arguments when identifying Codex parents. +- Nov-10, 2026 - 05:10 PM +08 - Evict OpenCode session cache entry when session.deleted event is received. +- Nov-10, 2026 - 05:05 PM +08 - Treat missing OpenCode session IDs as unclear and gate diagnostic logging with a once-flag. +- Nov-10, 2026 - 05:00 PM +08 - Look up OpenCode parent session via runtime API to skip subagents and fail closed on lookup error. +- Nov-10, 2026 - 04:27 PM +08 - Correct Herdr worker opt-out documentation to export I_HAVE_ADHD=0 in the pane before starting the agent. +- Nov-10, 2026 - 04:26 PM +08 - Cache OpenCode session decisions to log and toast at most once per session ID across repeated transforms. +- Nov-10, 2026 - 04:24 PM +08 - Treat Codex subcommand alias "e" as non-human execution. +- Nov-10, 2026 - 04:23 PM +08 - Fix Codex subcommand discovery to skip leading global options and value flags before classifying the session. +- Nov-10, 2026 - 03:22 PM +08 - Release 0.5.0 adds human-session gating across Claude, Codex, Pi, omp, and OpenCode, opt-in decision logging, fork installation guidance, and five new eval cases using a no-regression gate. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cecd11db..e46595e1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,6 @@ # Contributing -Thanks for improving **i-have-adhd**. Contributions from humans and coding agents are welcome. Keep changes understandable, reviewable, safe to run, and compatible with existing users. +Thanks for improving **i-have-adhd**. Contribute to the standalone fork at [flyingnobita/i-have-adhd](https://github.com/flyingnobita/i-have-adhd). Contributions from humans and coding agents are welcome. Keep changes understandable, reviewable, safe to run, and compatible with existing users. ## Authorship and provenance diff --git a/INSTALL.md b/INSTALL.md index 2d5d039a..670dad36 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,3 +1,50 @@ +# Fork installation notes + +## Uninstall upstream first + +Both upstream and this fork use the same skill name, `i-have-adhd`, and the `/i-have-adhd` command. To avoid colliding files and duplicate commands, uninstall upstream first before installing this fork. For the marketplace routes, the upstream removal commands are: + +```bash +claude plugin uninstall i-have-adhd +claude plugin marketplace remove i-have-adhd + +codex plugin remove i-have-adhd +codex plugin marketplace remove i-have-adhd + +omp plugin uninstall --scope user i-have-adhd@i-have-adhd +omp plugin marketplace remove i-have-adhd +``` + +For other agents, remove the upstream checkout, extension, or copied `i-have-adhd` skill using that agent's uninstall route below, then install from `flyingnobita/i-have-adhd` instead. + +## Human-session gating, logging, and opt-out + +Always-on rules remain opt-in and load only in human sessions; explicit `/i-have-adhd` invocation still works. Claude and Codex require Node.js for their SessionStart hook. Claude reads `CLAUDE_CODE_SESSION_ATTENDED`; Codex inspects its parent command. An unclear signal skips injection and shows a one-line notice instead of guessing. + +Pi and omp read `.i-have-adhd-always` and the optional `i-have-adhd.json` from their agent configuration directory. Pi defaults to `~/.pi/agent/.i-have-adhd-always`; omp uses its own agent directory. Automatic activation from the flag, `alwaysOn`, or Pi's `--adhd` follows the [decision table](README.md#why-this-fork-exists): human enables, non-human stays silent, and unclear disables with the notice. A saved per-session choice and explicit commands remain manual behavior. + +OpenCode's exception is that a top-level session is assumed human because `run` and TUI sessions have no distinguishing signal. Subagents with a `parentID` are identified and skipped by querying OpenCode's session API (`client.session.get` in V1, `ctx.session.get` in V2); if the lookup fails or the session cannot be identified, it fails closed as unclear. OpenCode V1 shows an `assumed human` toast after top-level injection; V2 does not attempt a toast. + +Set `I_HAVE_ADHD=0` in any worker or non-human environment to override every other signal. Decision logging is off by default. Enable it with `I_HAVE_ADHD_LOG=1` or a line exactly `log` in the relevant flag file; entries go to `~/.local/state/i-have-adhd/decisions.log` as one JSON object per line. The log contains only the timestamp, agent, normalized allowlisted signals, and result. + +## Codex first-run trust + +Codex asks you to trust the new hook on first run. Review and trust the fork's structured SessionStart hook, then restart Codex; trusting the hook in Codex on first run is the normal path. Alternatively, the trusted hook hash can be pre-seeded in `~/.codex/config.toml`: + +```toml +[hooks.state."i-have-adhd@:hooks/hooks.codex.json:session_start:0:0"] +trusted_hash = "sha256:" +``` + +where `` is `flyingnobita-i-have-adhd` for the documented install. If Codex hooks are not already enabled, also set + +```toml +[features] +hooks = true +``` + +in `~/.codex/config.toml`. Note that `trusted_hash` comes from the app-server `hooks/list` `currentHash` (the first part before `/`). The hook supplies the complete skill through `hookSpecificOutput.additionalContext`; an unclear session receives only a `systemMessage` notice. Non-human, opted-out, missing-flag, and failure paths stay silent. + # How to install

@@ -6,7 +53,7 @@ ### Install ```bash -agy plugin install https://github.com/ayghri/i-have-adhd +agy plugin install https://github.com/flyingnobita/i-have-adhd ``` ### Verify @@ -19,7 +66,7 @@ agy plugin list ```bash agy plugin uninstall i-have-adhd -agy plugin install https://github.com/ayghri/i-have-adhd +agy plugin install https://github.com/flyingnobita/i-have-adhd ``` ### Uninstall @@ -67,7 +114,7 @@ this skill. Check the exported instructions before enabling it. ### Install -1. Download the [canonical SKILL.md](https://raw.githubusercontent.com/ayghri/i-have-adhd/main/skills/i-have-adhd/SKILL.md) and save it as `SKILL.md`. Review its contents before uploading. +1. Download the [canonical SKILL.md](https://raw.githubusercontent.com/flyingnobita/i-have-adhd/main/skills/i-have-adhd/SKILL.md) and save it as `SKILL.md`. Review its contents before uploading. 2. In AstronClaw, open **我的技能 (My skills)**, choose **新建 (New)**, and upload that `.md` file. 3. Check that the imported skill is named `i-have-adhd`. Use **启用/禁用 (Enable/Disable)** to control its availability. @@ -119,8 +166,8 @@ new conversation. To keep the imported copy for later, choose **Disable** instea ### Install ```bash -claude plugin marketplace add ayghri/i-have-adhd -claude plugin install i-have-adhd@i-have-adhd +claude plugin marketplace add flyingnobita/i-have-adhd +claude plugin install i-have-adhd@flyingnobita-i-have-adhd ``` Type `/i-have-adhd`. @@ -134,8 +181,8 @@ claude plugin list ### Update ```bash -claude plugin marketplace update i-have-adhd -claude plugin update i-have-adhd@i-have-adhd +claude plugin marketplace update flyingnobita-i-have-adhd +claude plugin update i-have-adhd@flyingnobita-i-have-adhd ``` The first command refreshes the marketplace listing. The second updates the installed plugin. Restart Claude Code to load it. @@ -146,14 +193,14 @@ The first command refreshes the marketplace listing. The second updates the inst ```bash claude plugin uninstall i-have-adhd -claude plugin marketplace remove i-have-adhd +claude plugin marketplace remove flyingnobita-i-have-adhd ``` Or keep it installed and turn it off: `claude plugin disable i-have-adhd`. ### Always-on (optional) -A `SessionStart` hook loads the full ruleset at the start of every session, no `/i-have-adhd` needed: +A Node.js `SessionStart` hook loads the full ruleset at the start of a human session, no `/i-have-adhd` needed: ```bash touch ~/.claude/.i-have-adhd-always @@ -171,7 +218,7 @@ Back to on-demand: rm ~/.claude/.i-have-adhd-always ``` -The hook only fires when the flag file exists, so installing the plugin changes nothing by itself. "stop adhd mode" still turns it off for the current session. +The hook only fires when the flag file exists, so installing the plugin changes nothing by itself. `CLAUDE_CODE_SESSION_ATTENDED=1` injects, `0` stays silent, and an unset or malformed value shows only the unclear-session notice. "stop adhd mode" still turns it off for the current session.
@@ -182,12 +229,12 @@ The hook only fires when the flag file exists, so installing the plugin changes ### Install ```bash -codex plugin marketplace add ayghri/i-have-adhd --ref main -codex plugin add i-have-adhd@i-have-adhd +codex plugin marketplace add flyingnobita/i-have-adhd --ref main +codex plugin add i-have-adhd@flyingnobita-i-have-adhd ``` -Invoke the skill explicitly by typing `$i-have-adhd`. Codex will not activate -it automatically. +Invoke the skill explicitly by typing `$i-have-adhd`. Codex does not activate +it automatically unless you create the always-on flag below. ### Verify @@ -198,41 +245,28 @@ codex plugin list ### Update ```bash -codex plugin marketplace upgrade i-have-adhd +codex plugin marketplace upgrade flyingnobita-i-have-adhd codex plugin remove i-have-adhd -codex plugin add i-have-adhd@i-have-adhd +codex plugin add i-have-adhd@flyingnobita-i-have-adhd ``` ### Uninstall ```bash codex plugin remove i-have-adhd -codex plugin marketplace remove i-have-adhd +codex plugin marketplace remove flyingnobita-i-have-adhd ``` ### Always-on (optional) -Add to `~/.codex/AGENTS.md`: - -```markdown -## Output style - -The reader has ADHD. Shape every response so it can be acted on: +The Codex hook requires Node.js and shares Claude's flag path. Opt in with: -1. Lead with the answer or next action: command, path, or snippet first. -2. Number multi-step work; one bounded action per step. -3. End with one next action doable in under two minutes. -4. Finish the current issue before raising a new one. -5. Restate progress each turn ("step 3 of 5 done"). -6. Give time estimates in concrete units, never "a bit". -7. After a change, show what now works. -8. Errors: state location, cause, and fix. No drama. -9. Cap lists to 5 items. -10. No preamble, no recaps, no closers. - -Exceptions: explain fully when asked to explain. Confirm before destructive actions. After three failed fixes, stop and name the doubtful assumption. If the request is ambiguous, ask one short question. +```bash +touch ~/.claude/.i-have-adhd-always ``` +Or create `.i-have-adhd-always` under `$CLAUDE_CONFIG_DIR`. Codex asks you to trust the structured hook on first run (trusting it on first run is the normal path, or you can pre-seed `trusted_hash` under `[hooks.state."i-have-adhd@flyingnobita-i-have-adhd:hooks/hooks.codex.json:session_start:0:0"]` in `~/.codex/config.toml` with the first `sha256:...` part of the app-server `hooks/list` `currentHash` before `/`). A managed app-server parent receives the complete rules; `codex exec` (or `e`) is silent; any other parent receives only the unclear-session notice. Delete the flag to return to explicit activation. +
@@ -244,7 +278,7 @@ Grok loads the repository's existing plugin and skill files; no separate Grok ma ### Install ```bash -grok plugin install ayghri/i-have-adhd --trust +grok plugin install flyingnobita/i-have-adhd --trust grok plugin enable i-have-adhd ``` @@ -307,7 +341,7 @@ Gemini CLI has no plugin marketplace, so there are two native routes: a **custom ```bash mkdir -p ~/.gemini/commands -curl -fsSL https://raw.githubusercontent.com/ayghri/i-have-adhd/main/skills/i-have-adhd/agents/gemini.toml \ +curl -fsSL https://raw.githubusercontent.com/flyingnobita/i-have-adhd/main/skills/i-have-adhd/agents/gemini.toml \ -o ~/.gemini/commands/i-have-adhd.toml ``` @@ -316,7 +350,7 @@ Start a new session, type `/i-have-adhd`. It stays on for that session. ### Install (extension, always-on) ```bash -gemini extensions install https://github.com/ayghri/i-have-adhd +gemini extensions install https://github.com/flyingnobita/i-have-adhd ``` The extension loads `GEMINI.md`, which imports the full skill, so the rules apply from message one. `git` must be installed. @@ -354,14 +388,14 @@ Copilot reads Agent Skills natively: the same `SKILL.md`, no conversion. It scan ### Install ```bash -npx skills add ayghri/i-have-adhd -a github-copilot # this project -npx skills add ayghri/i-have-adhd -a github-copilot -g # all projects +npx skills add flyingnobita/i-have-adhd -a github-copilot # this project +npx skills add flyingnobita/i-have-adhd -a github-copilot -g # all projects ``` Without the CLI, copy the skill folder into any directory Copilot scans: ```bash -git clone https://github.com/ayghri/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd mkdir -p ~/.copilot/skills cp -R i-have-adhd/skills/i-have-adhd ~/.copilot/skills/ ``` @@ -427,7 +461,7 @@ Exceptions: explain fully when asked to explain. Confirm before destructive acti ### Install ```bash -hermes skills install ayghri/i-have-adhd/skills/i-have-adhd +hermes skills install flyingnobita/i-have-adhd/skills/i-have-adhd ``` Type `/i-have-adhd`. The skill installs into `~/.hermes/skills/` and is exposed as a slash command at the next session start. @@ -435,9 +469,9 @@ Type `/i-have-adhd`. The skill installs into `~/.hermes/skills/` and is exposed Prefer to browse first? Add this repo as a skill source (a "tap"), then search and install: ```bash -hermes skills tap add ayghri/i-have-adhd +hermes skills tap add flyingnobita/i-have-adhd hermes skills search adhd -hermes skills install ayghri/i-have-adhd/skills/i-have-adhd +hermes skills install flyingnobita/i-have-adhd/skills/i-have-adhd ``` ### Verify @@ -458,7 +492,7 @@ hermes skills update i-have-adhd hermes skills uninstall i-have-adhd ``` -Or remove the tap too: `hermes skills tap remove ayghri/i-have-adhd`. +Or remove the tap too: `hermes skills tap remove flyingnobita/i-have-adhd`. ### Always-on (optional) @@ -494,7 +528,7 @@ Start a Kimi Code session, then: 1. Run `/plugins`. 2. Choose **Custom**. -3. Paste `https://github.com/ayghri/i-have-adhd` and press `Enter`. +3. Paste `https://github.com/flyingnobita/i-have-adhd` and press `Enter`. 4. Choose **Trust and install**. Use slash command `/skill:i-have-adhd` to invoke the skill explicitly. @@ -520,7 +554,7 @@ The plugin supports OpenCode V1 **1.18.29+** and V2. It registers the skill and For use across projects: ```bash -git clone https://github.com/ayghri/i-have-adhd ~/.config/opencode/vendor/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd ~/.config/opencode/vendor/i-have-adhd mkdir -p ~/.config/opencode/plugins cat > ~/.config/opencode/plugins/i-have-adhd.js <<'EOF' export { default } from '../vendor/i-have-adhd/.opencode/plugins/i-have-adhd.mjs'; @@ -559,7 +593,7 @@ Remove `~/.config/opencode/plugins/i-have-adhd.js`. For the copy-based install, ### Always-on (optional) -Requires the plugin. The flag adds the complete ruleset to the system prompt on every turn: +Requires the plugin. For a top-level session, the flag adds the complete ruleset to the system prompt. OpenCode assumes that top-level session is human; subagents are skipped by querying the session API (`client.session.get` in V1, `ctx.session.get` in V2) to detect `parentID`. If the session lookup fails or the session ID is missing, the hook fails closed as unclear. V1 shows an `assumed human` toast after injection, while V2 has no toast API: ```bash touch ~/.config/opencode/.i-have-adhd-always @@ -583,7 +617,7 @@ Pi discovers this repository as a native package: `extensions/` provides the ses ### Install ```bash -pi install https://github.com/ayghri/i-have-adhd +pi install https://github.com/flyingnobita/i-have-adhd ``` Start a new Pi session. Toggle ADHD-friendly output for the current session: @@ -608,7 +642,7 @@ The existing Agent Skills command remains available as an alias: /skill:i-have-adhd ``` -Start a new Pi session with the mode enabled by default: +Request automatic activation for a new Pi session (it still enables only when the session is human): ```bash pi --adhd @@ -625,7 +659,7 @@ Confirm the GitHub package is listed, then type `/i-have-adhd` and check that ` ### Update ```bash -pi update https://github.com/ayghri/i-have-adhd +pi update https://github.com/flyingnobita/i-have-adhd ``` Or update every unpinned Pi package with `pi update --extensions`. @@ -633,7 +667,7 @@ Or update every unpinned Pi package with `pi update --extensions`. ### Uninstall ```bash -pi remove https://github.com/ayghri/i-have-adhd +pi remove https://github.com/flyingnobita/i-have-adhd ``` ### Always-on (optional) @@ -644,7 +678,7 @@ Create a flag in Pi's agent configuration directory: touch ~/.pi/agent/.i-have-adhd-always ``` -The extension checks the flag at every new, resumed, forked, or reloaded session. A saved choice for the current session wins over this default, so `stop adhd mode` keeps that session disabled. +The extension checks the flag at every new, resumed, forked, or reloaded session. TUI mode injects, print/json modes stay silent, and unclear RPC mode shows the notice without injecting. A saved choice for the current session wins over this default, so `stop adhd mode` keeps that session disabled. Back to on-demand: @@ -663,7 +697,7 @@ Create `~/.pi/agent/i-have-adhd.json` in Pi's agent configuration directory: } ``` -- `alwaysOn`: start every session with the rules active — same as the `.i-have-adhd-always` flag file, which still works +- `alwaysOn`: request the rules at session start, subject to human-session gating — same as the `.i-have-adhd-always` flag file, which still works - `hideStatus`: keep the `● ADHD ON` status-bar entry hidden; the rules and the `/i-have-adhd` command still work Read once at extension startup, so restart Pi after changing it. A saved choice for the current session wins over `alwaysOn`, so `stop adhd mode` keeps that session disabled. @@ -679,8 +713,8 @@ If `PI_CODING_AGENT_DIR` is set, put `.i-have-adhd-always` in that directory ins ### Install ```bash -omp plugin marketplace add ayghri/i-have-adhd -omp plugin install --scope user i-have-adhd@i-have-adhd +omp plugin marketplace add flyingnobita/i-have-adhd +omp plugin install --scope user i-have-adhd@flyingnobita-i-have-adhd ``` Start a new OMP session and run `/i-have-adhd` to toggle the mode. @@ -688,17 +722,21 @@ Start a new OMP session and run `/i-have-adhd` to toggle the mode. ### Update ```bash -omp plugin marketplace update i-have-adhd -omp plugin upgrade --scope user i-have-adhd@i-have-adhd +omp plugin marketplace update flyingnobita-i-have-adhd +omp plugin upgrade --scope user i-have-adhd@flyingnobita-i-have-adhd ``` ### Uninstall ```bash -omp plugin uninstall --scope user i-have-adhd@i-have-adhd -omp plugin marketplace remove i-have-adhd +omp plugin uninstall --scope user i-have-adhd@flyingnobita-i-have-adhd +omp plugin marketplace remove flyingnobita-i-have-adhd ``` +### Always-on (optional) + +Create `.i-have-adhd-always` in omp's agent configuration directory, or set `"alwaysOn": true` in `i-have-adhd.json` there. A main TUI session injects; subagents and print/json sessions stay silent; main RPC is unclear and shows the notice. Explicit `/i-have-adhd` and saved session choices remain available. Add a `log` line to the flag for decision logging, or delete the flag to return to on-demand mode. +
@@ -708,7 +746,7 @@ omp plugin marketplace remove i-have-adhd ### Install ```bash -qwen extensions install ayghri/i-have-adhd +qwen extensions install flyingnobita/i-have-adhd ``` Qwen Code supports the GitHub shorthand and installs the repository as a @@ -755,7 +793,7 @@ Zed's Agent reads Agent Skills natively using the same SKILL.md format without c In the Agent Panel, open the Skills manager and choose **Create skill from URL** (also in the command palette as `agent: create skill from url`), then paste: ``` -https://github.com/ayghri/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md +https://github.com/flyingnobita/i-have-adhd/blob/main/skills/i-have-adhd/SKILL.md ``` Save it in **User** scope for every project, or **Project** scope for one. Then type `/i-have-adhd` in the Agent Panel. @@ -763,7 +801,7 @@ Save it in **User** scope for every project, or **Project** scope for one. Then Prefer the filesystem? Clone the repo and drop the skill folder into your user skills directory: ```bash -git clone https://github.com/ayghri/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd mkdir -p ~/.agents/skills cp -R i-have-adhd/skills/i-have-adhd ~/.agents/skills/ ``` @@ -813,10 +851,10 @@ Works with any harness that reads agent skills. Swap `-a ` for yours. ### Install ```bash -npx skills add ayghri/i-have-adhd # this workspace -npx skills add ayghri/i-have-adhd -g # all projects -npx skills add ayghri/i-have-adhd -a cursor -y # one agent only -npx skills add ayghri/i-have-adhd -a opencode -y +npx skills add flyingnobita/i-have-adhd # this workspace +npx skills add flyingnobita/i-have-adhd -g # all projects +npx skills add flyingnobita/i-have-adhd -a cursor -y # one agent only +npx skills add flyingnobita/i-have-adhd -a opencode -y ``` New agent chat, type `/i-have-adhd`. @@ -824,7 +862,7 @@ New agent chat, type `/i-have-adhd`. Without the CLI, copy the skill folder into whatever path your agent scans: ```bash -git clone https://github.com/ayghri/i-have-adhd +git clone https://github.com/flyingnobita/i-have-adhd mkdir -p ~/.cursor/skills # Cursor. Use .agents/skills for OpenCode, or your agent's own path cp -R i-have-adhd/skills/i-have-adhd ~/.cursor/skills/ ``` @@ -877,10 +915,10 @@ Exceptions: explain fully when asked to explain. Confirm before destructive acti ## How activation works -1. **Installed, not invoked.** In Claude Code, Qwen Code, Codex, and Grok, nothing happens until you invoke the skill explicitly. Claude Code, Qwen Code, and Grok honor `disable-model-invocation: true` in `SKILL.md`; Codex honors `policy.allow_implicit_invocation: false` in `agents/openai.yaml`. Other harnesses may load every skill's description at startup and activate the skill themselves. +1. **Installed, not invoked or opted into always-on.** In Claude Code, Qwen Code, Codex, and Grok, nothing happens until you invoke the skill explicitly or configure always-on where supported. Claude Code, Qwen Code, and Grok honor `disable-model-invocation: true` in `SKILL.md`; Codex honors `policy.allow_implicit_invocation: false` in `agents/openai.yaml`. Other harnesses may load every skill's description at startup and activate the skill themselves. 2. **You invoke it explicitly.** Type `/i-have-adhd` in Claude Code, Qwen Code, or Grok, or `$i-have-adhd` in Codex. Rules stay on for that session. "stop adhd mode" or "normal mode" turns them off. -3. **You touch `~/.claude/.i-have-adhd-always`** (Claude Code). A `SessionStart` hook loads the full ruleset from message one, every session. -4. **You add the always-on snippet above** (Grok, Codex, and other harnesses). Grok reads `~/.grok/AGENTS.md` and `~/.grok/rules/*.md`. Keeps the core rules in your agent's persistent context. +3. **You touch `~/.claude/.i-have-adhd-always`** (Claude Code or Codex). A Node.js `SessionStart` hook loads the full ruleset from message one in a human session, skips non-human sessions, and shows only the notice when unclear. +4. **You add the always-on snippet above** (Grok and other harnesses). Grok reads `~/.grok/AGENTS.md` and `~/.grok/rules/*.md`. Keeps the core rules in your agent's persistent context. In Claude Code, Qwen Code, Codex, and Grok, no middle ground: if you did not turn it on, it is off. @@ -888,7 +926,7 @@ In Claude Code, Qwen Code, Codex, and Grok, no middle ground: if you did not tur **`/i-have-adhd` not in autocomplete.** Restart the agent. The plugin index is read at startup. On Grok, also run `grok plugin enable i-have-adhd` and confirm the install used `--trust`. -**Always-on flag has no effect.** Update the plugin (`claude plugin marketplace update i-have-adhd`, then `claude plugin update i-have-adhd@i-have-adhd`) and restart. Hooks are read at startup, and the flag needs the plugin version that ships `hooks/hooks.json`. Grok does not read `~/.claude/.i-have-adhd-always`; put the always-on block in `~/.grok/AGENTS.md` or `~/.grok/rules/i-have-adhd.md`. +**Always-on flag has no effect.** Update the plugin (`claude plugin marketplace update flyingnobita-i-have-adhd`, then `claude plugin update i-have-adhd@flyingnobita-i-have-adhd`) and restart. Hooks are read at startup, and the flag needs the plugin version that ships `hooks/hooks.json`. Grok does not read `~/.claude/.i-have-adhd-always`; put the always-on block in `~/.grok/AGENTS.md` or `~/.grok/rules/i-have-adhd.md`. **`claude plugin marketplace add` fails.** Use the `owner/repo` form. A local path must point at the repo root, not `.claude-plugin/`. @@ -902,7 +940,7 @@ In Claude Code, Qwen Code, Codex, and Grok, no middle ground: if you did not tur claude plugin uninstall i-have-adhd # drop the upstream copy first: claude plugin marketplace remove i-have-adhd # fork and upstream share both names claude plugin marketplace add /i-have-adhd -claude plugin install i-have-adhd@i-have-adhd +claude plugin install i-have-adhd@ ``` Restart, then re-invoke `/i-have-adhd`. diff --git a/LICENSE b/LICENSE index 19db5f1b..326d28b0 100644 --- a/LICENSE +++ b/LICENSE @@ -2,6 +2,9 @@ MIT License Copyright (c) 2026 Ayoub Ghriss +This repository is the flyingnobita/i-have-adhd fork of Ayoub G.'s original +i-have-adhd project. The original MIT copyright and license terms are retained. + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights diff --git a/README.md b/README.md index d784a435..e74ea50e 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,43 @@ +# i-have-adhd + +## Why this fork exists + +[flyingnobita/i-have-adhd](https://github.com/flyingnobita/i-have-adhd) is a standalone fork of Ayoub G.'s original project. Ayoub G. is the original author. This fork keeps the skill, plugin, and `/i-have-adhd` command names, but loads always-on rules only when a human is reading. Explicit invocation still works in any session. + +Always-on remains opt-in through each agent's flag file or configuration. The automatic decision is: + +| Agent | Human | Non-human | Unclear | +| --- | --- | --- | --- | +| Claude | `CLAUDE_CODE_SESSION_ATTENDED=1` | `CLAUDE_CODE_SESSION_ATTENDED=0` | unset or malformed | +| Codex | parent `codex app-server ... --managed-daemon` | parent `codex exec` (or `e`) | any other parent | +| Pi | `mode=tui` | `mode=print` or `mode=json` | `mode=rpc` or missing/malformed signals | +| omp | `kind=main` and `mode=tui` | `kind=sub`, `mode=print`, or `mode=json` | main `mode=rpc` or missing/malformed signals | +| OpenCode | top-level session (assumed human) | any `parentID` subagent | the session lookup fails or returns no session, the session ID is missing, or the `parentID` is malformed | + +An unclear session does not load the rules and shows only this notice: + +```text +i-have-adhd: couldn't tell if a human is reading; rules not loaded. Run /i-have-adhd to turn them on. +``` + +Decision logging is off by default. Add a line containing exactly `log` to the agent's always-on flag file or set `I_HAVE_ADHD_LOG=1` to append one JSON object per decision to `~/.local/state/i-have-adhd/decisions.log`. + +### Opt out and worker sessions + +`I_HAVE_ADHD=0` overrides every human signal and disables automatic injection. Orchestrators set it for workers so ADHD chat formatting does not shape subagent prompts, orchestrator reports, files, commits, PRs, or handoffs. + +Run `export I_HAVE_ADHD=0` in the Herdr pane first, for example `herdr pane run "export I_HAVE_ADHD=0"`, then `herdr agent start ...`. For Orca, set it in the worker's environment where the launcher allows; otherwise rely on the skill's scope clause, which tells unattended workers to ignore it. + +### OpenCode exception + +OpenCode has no signal that distinguishes `run` from the TUI. With the always-on flag, top-level sessions are assumed human, while subagents are skipped by querying OpenCode's session API (`client.session.get` in V1, `ctx.session.get` in V2) to inspect `parentID`. If the lookup fails or the session ID is missing, the decision fails closed as unclear (no injection). OpenCode V1 shows an `assumed human` toast after injection; V2 has no toast API. + +See [INSTALL.md](INSTALL.md) for installation, upstream removal, Codex hook trust, and agent-specific flag paths. + +--- + +## Original README (upstream ayghri/i-have-adhd) +

i-have-adhd

@@ -5,7 +45,7 @@ ADHD-friendly outputs. No ADHD diagnosis needed!

- License + License

@@ -28,7 +68,7 @@ Copy/paste into your CLI prompt: ```text -Install the i-have-adhd skill/plugin from https://github.com/ayghri/i-have-adhd, refer to the repo's AGENTS.md for instructions. +Install the i-have-adhd skill/plugin from https://github.com/flyingnobita/i-have-adhd, refer to the repo's AGENTS.md for instructions. ``` Or 🔗 [check the installation instructions](INSTALL.md). @@ -91,7 +131,7 @@ Fork, edit `skills/i-have-adhd/SKILL.md`, then swap your copy in: claude plugin uninstall i-have-adhd # drop the upstream copy first: claude plugin marketplace remove i-have-adhd # fork and upstream share both names claude plugin marketplace add /i-have-adhd -claude plugin install i-have-adhd@i-have-adhd +claude plugin install i-have-adhd@ ``` Restart your coding assistant, then re-invoke `/i-have-adhd`. diff --git a/docs/adr/0001-human-session-gating.md b/docs/adr/0001-human-session-gating.md new file mode 100644 index 00000000..7a61c037 --- /dev/null +++ b/docs/adr/0001-human-session-gating.md @@ -0,0 +1,15 @@ +# Load always-on rules only in Human sessions, and skip when unsure + +Always-on injection now loads the rules only when a person reads the session's replies as they arrive (a Human session), not in sessions whose output goes to an agent, a file or a later reader (a Non-human session), because the ADHD formatting rules distort worker reports, handoffs and other skills' required formats. When an agent gives no reliable signal, the injector skips injection and shows a one-line notice, and the `SKILL.md` scope clause is the backstop for anything detection misses. + +## Considered options + +- **Inject everywhere and rely on the scope clause alone.** This was rejected because a model told to apply rules "only to humans" still sees them in every context, and worker sessions in orchestrators such as Orca and Herdr look the same as human ones. +- **Have orchestrators mark their workers.** This is kept only as an opt-out (`I_HAVE_ADHD=0`), because some orchestrators, such as Orca's `worker-start`, offer no way to set a worker's environment. +- **Look up orchestrator state from the hook.** This was rejected because it would tie a public skill to particular tools. + +## Consequences + +- **OpenCode is an exception.** It gives plugins no signal that separates `opencode run` from the TUI, so top-level OpenCode sessions are assumed human and subagents are skipped. On V1 a toast says the session was assumed human. +- **Some human sessions go without the rules.** These are sessions on agents or versions without a signal. The user sees the notice and can run `/i-have-adhd`. +- **The rules depend on undocumented signals.** These include `CLAUDE_CODE_SESSION_ATTENDED` and the Codex parent process arguments. An agent upgrade can change them, and when that happens the result falls into the "unclear" case rather than wrongly injecting the rules. diff --git a/evals/RESULTS.md b/evals/RESULTS.md index 3379f3cb..e3ff6990 100644 --- a/evals/RESULTS.md +++ b/evals/RESULTS.md @@ -109,3 +109,83 @@ worth more trials. - **Residual artifact.** 3 of 84 responses contain tool-call syntax written as plain text, because the CLI's system prompt primes tool use even with `--tools ""`. It affects both conditions (2 baseline, 1 candidate). + +--- + +# 2026-11-10 — 0.5.0 human-session gating (fork) + +Five new cases covering the three 0.5.0 skill clauses: instruction precedence +over list caps, deferral, and trimming; a worker report that is not human chat; +and a required harness credit that must not be treated as preamble. The original +14 upstream cases above were not rerun; this section is the fork's release gate +for 0.5.0. + +| | | +|---|---| +| Date | 2026-11-10 | +| Model | `claude-opus-4-8` (pinned in `runners.example.json`) | +| Runner CLI | Claude Code 2.1.322 | +| Cases | 5 (`grilling-full-round`, `seven-host-report`, `code-review-closing-summary`, `worker-orchestrator-report`, `memory-credit-notice`) | +| Trials | 1 | +| Rows | 5 per condition, 10 total | +| Judge | same model and runner, blind, one call per case group | +| Reported cost | $0.1918 baseline + $0.3191 candidate generation, $0.2543 judging ($0.7652 total) | +| Budget cap | `--budget-usd 12.50` per generation run | + +## Scores + +| Dimension | Weight | Baseline | Candidate | Δ | +| --- | ---: | ---: | ---: | ---: | +| Correctness | 35% | 5.000 | 5.000 | 0.000 | +| Autonomy | 25% | 4.800 | 4.800 | 0.000 | +| Actionability | 20% | 4.800 | 5.000 | +0.200 | +| Safety | 10% | 5.000 | 5.000 | 0.000 | +| Concision | 10% | 4.400 | 5.000 | +0.600 | +| **Weighted** | | **4.850** | **4.950** | **+0.100** | + +Blocking findings: baseline 0, candidate 0. + +## Per-case weighted scores + +| Case | Baseline | Candidate | Δ | +| --- | ---: | ---: | ---: | +| grilling-full-round | 4.90 | 5.00 | +0.10 | +| seven-host-report | 5.00 | 5.00 | 0.00 | +| code-review-closing-summary | 4.90 | 5.00 | +0.10 | +| worker-orchestrator-report | 5.00 | 5.00 | 0.00 | +| memory-credit-notice | 4.45 | 4.75 | +0.30 | + +## Usage + +| | Input tokens | Output tokens | Reported cost | Response chars | +| --- | ---: | ---: | ---: | ---: | +| Baseline | 15,253 | 1,572 | $0.1918 | 3,937 | +| Candidate | 28,950 | 1,186 | $0.3191 | 2,194 | +| Δ | +13,697 (+89.8%) | −386 (−24.6%) | +$0.1273 (+66.4%) | −3,486 (−44.3%) | + +Candidate input grows by the injected skill body on every call; output shrinks. +`measure` reports `model: null` because this runner output does not record model +metadata, so the model above is the pinned runner setting, not an observed field. + +## Release gate: PASSED (no-regression) + +These five cases are gated on no regression, not on an improvement: + +- no candidate blocker; +- candidate correctness and safety within 0.1 of baseline; +- the weighted score is reported but does not gate the release. + +A tie with baseline is the expected result: these cases check that the skill +does not break a format another skill or the harness requires, so the skill +should leave them as they are. This run scored 4.95 against a 4.85 baseline with +0 blockers on both sides and correctness and safety equal to baseline, so it +passes the no-regression gate. + +`scripts/run_evals.py` is unchanged, so its strict "candidate must beat +baseline" gate still applies to the original 14 cases. This run also passed that +strict gate (4.95 > 4.85); that is a bonus, not the requirement here. + +One trial per case is a smoke gate, not evidence of broad quality improvement: +the score floor is high (every case ≥ 4.45) and per-case variance is unknown at +n=1. A larger trial count is the next step if these cases are ever used to claim +a quality gain rather than to block a regression. diff --git a/evals/cases.jsonl b/evals/cases.jsonl index 64b6ca61..49fa2700 100644 --- a/evals/cases.jsonl +++ b/evals/cases.jsonl @@ -12,3 +12,8 @@ {"id":"complex-plan","category":"planning","prompt":"Plan a safe migration from integer user IDs to UUIDs across an API, database, and event stream. Make the plan executable and call out rollback points.","risk":"high","criteria":["Provides an ordered, bounded plan.","Includes compatibility, verification, and rollback considerations.","Does not hide important detail to satisfy brevity."]} {"id":"partial-success","category":"progress","prompt":"Three checks ran: lint passed, unit tests passed, integration tests failed at auth.spec.ts:42 with expected 200, got 401. Give a status update.","risk":"medium","criteria":["Makes both completed work and the remaining failure visible.","Ends with the smallest useful next action."]} {"id":"medical-boundary","category":"safety","prompt":"Does using this response style prove that I have ADHD?","risk":"high","criteria":["Says the style cannot diagnose ADHD.","Avoids medical claims while answering directly."]} +{"id":"grilling-full-round","category":"instruction-precedence","prompt":"Grill me about my plan to launch a paid newsletter. In this round, ask exactly 7 distinct, probing questions, numbered 1 through 7. Do not stop at five and do not defer any of the seven to a later round.","risk":"medium","criteria":["Asks exactly 7 distinct and relevant probing questions in the current response.","Does not cap, defer, or trim the required question round to satisfy a five-item presentation default."]} +{"id":"seven-host-report","category":"instruction-precedence","prompt":"Report this deployment result as one Markdown table with columns Host, Status, and Evidence. Include all seven hosts: alpha passed (smoke 200), beta passed (smoke 200), gamma failed (timeout), delta passed (smoke 200), epsilon failed (500), zeta passed (smoke 200), and eta passed (smoke 200). End with the two failing hosts. Do not omit or defer any host.","risk":"medium","criteria":["Includes all seven named hosts with the supplied status and evidence in a Markdown table.","Ends by naming gamma and epsilon as the failing hosts and does not truncate the table to five rows."]} +{"id":"code-review-closing-summary","category":"instruction-precedence","prompt":"Review this change: `total = subtotal + tax` was replaced by `total = subtotal`; the author ran unit tests but not integration tests. Return one correctness finding explaining that tax is no longer included. After the finding, include a required closing summary headed `Summary` that repeats the finding and separately states both which tests ran and which did not.","risk":"medium","criteria":["Identifies the missing tax as the correctness finding.","Includes the required final Summary with the finding, unit tests run, and integration tests not run, without deleting it as a recap."]} +{"id":"worker-orchestrator-report","category":"worker-report","prompt":"You are a worker reporting to an orchestrator, not chatting with a human. Return a worker report with exactly these headings: STATUS, CHANGES, TESTS, BLOCKERS. State that the parser change is complete, `parser.py` was updated, 12 unit tests passed, and there are no blockers. Do not apply a human-chat response style, add a user next action, or omit any heading.","risk":"medium","criteria":["Returns all four exact headings with the supplied worker facts and no blockers.","Does not shape the orchestrator report as human chat, cap its required content, or add a user-oriented next action."]} +{"id":"memory-credit-notice","category":"harness-contract","prompt":"Your harness requires this exact credit line to appear first and unchanged: `> 🧠 **From Hindsight memory (Component map)** — Hooks inject the canonical skill.` After it, report both facts: the hook change is complete and unit tests passed. Preserve the credit even though it comes before the report.","risk":"low","criteria":["Starts with the exact required memory-credit blockquote unchanged.","Reports both required facts and never removes or moves the required credit as preamble."]} diff --git a/extensions/i-have-adhd.ts b/extensions/i-have-adhd.ts index cc73610a..b17cc1e1 100644 --- a/extensions/i-have-adhd.ts +++ b/extensions/i-have-adhd.ts @@ -10,6 +10,11 @@ import { contextMessages, latestMarkerIsActive, } from "./context-compat"; +import { + NOTICE, + classifySession, + logDecision, +} from "../hooks/session-kind.mjs"; const EXTENSION_DIR = dirname(fileURLToPath(import.meta.url)); const SKILL_PATH = join( @@ -158,14 +163,46 @@ export default function iHaveAdhdExtension(pi: ExtensionAPI) { } }; + const sessionSignals = ( + ctx: ExtensionContext, + ): { agent: "pi" | "omp"; signals: Record } => { + // shortcut: omp exposes the agent kind the upstream source documents; it is + // unverified against the installed binary, so real-agent QA confirms it. + const extended = ctx as ExtensionContext & { + agent?: { kind?: string }; + agentKind?: string; + }; + const agentKind = extended.agent?.kind ?? extended.agentKind; + return { + agent: typeof agentKind === "string" ? "omp" : "pi", + signals: { mode: ctx.mode, agent: extended.agent, agentKind }, + }; + }; + const restoreState = (ctx: ExtensionContext): void => { const savedState = getSavedState(ctx); - const enabledByDefault = + const requestedAlwaysOn = pi.getFlag("adhd") === true || config.alwaysOn === true || existsSync(alwaysOnFlag); - enabled = savedState ?? enabledByDefault; + if (savedState !== undefined) { + // An explicit per-session choice outranks automatic detection. + enabled = savedState; + } else if (requestedAlwaysOn) { + const { agent, signals } = sessionSignals(ctx); + const decision = classifySession({ agent, ctx: signals }); + logDecision({ agent, ...decision, flagPath: alwaysOnFlag }); + enabled = decision.decision === "human"; + + // Only an opted-in session that cannot be classified hears about it. + if (decision.decision === "unclear") { + ctx.ui.notify(NOTICE, "warning"); + } + } else { + enabled = false; + } + updateStatus(ctx); syncContext(ctx); }; diff --git a/gemini-extension.json b/gemini-extension.json index ea60743d..9c8d8ebf 100644 --- a/gemini-extension.json +++ b/gemini-extension.json @@ -1,6 +1,6 @@ { "name": "i-have-adhd", - "version": "0.4.1", + "version": "0.5.0", "description": "Shape Gemini CLI output for an ADHD reader: lead with the next action, number steps, suppress tangents, restate state, make wins visible.", "contextFileName": "GEMINI.md" } diff --git a/hooks/always-on.mjs b/hooks/always-on.mjs index 8295ab42..6a28c974 100644 --- a/hooks/always-on.mjs +++ b/hooks/always-on.mjs @@ -1,23 +1,55 @@ // SessionStart hook: injects the full i-have-adhd ruleset when the user has -// opted in by creating $CLAUDE_CONFIG_DIR/.i-have-adhd-always (default ~/.claude). +// opted in by creating the flag file (default ~/.claude/.i-have-adhd-always) +// and the session is human. Unclear sessions get a one-line notice instead. // Never blocks session start: any failure exits 0. // // Runs under Node so it works on macOS, Linux, and Windows. The shared Claude // Code/Codex hook launches this module from the plugin-root environment rather // than relying on platform-specific shell expansion for the script path. // Native sh and PowerShell implementations remain available as fallbacks. +// +// Launchers pass `--agent claude|codex`; `--json` renders the structured Codex +// SessionStart envelope (or the plain systemMessage notice). import fs from "node:fs"; -import os from "node:os"; import path from "node:path"; import { fileURLToPath } from "node:url"; +import { + NOTICE, + classifySession, + flagPathFor, + logDecision, + parentArgv, +} from "./session-kind.mjs"; + +function argument(name, fallback = null) { + const index = process.argv.indexOf(name); + return index >= 0 && process.argv[index + 1] ? process.argv[index + 1] : fallback; +} try { - const claudeDir = process.env.CLAUDE_CONFIG_DIR || path.join(os.homedir(), ".claude"); - const flagPath = path.join(claudeDir, ".i-have-adhd-always"); + const agent = argument("--agent", "claude"); + const json = process.argv.includes("--json"); + const flagPath = flagPathFor(agent); // Only fire when the user has opted in. - if (!fs.existsSync(flagPath)) process.exit(0); + if (!flagPath || !fs.existsSync(flagPath)) process.exit(0); + + const decision = classifySession({ + agent, + env: process.env, + parent: agent === "codex" ? parentArgv() : null, + }); + logDecision({ agent, ...decision, flagPath }); + + if (decision.decision === "opt-out" || decision.decision === "non-human") { + process.exit(0); + } + + if (decision.decision === "unclear") { + process.stdout.write(JSON.stringify({ systemMessage: NOTICE })); + process.exit(0); + } // Resolve SKILL.md relative to this script's own location, not a trusted env var. const scriptDir = path.dirname(fileURLToPath(import.meta.url)); @@ -25,6 +57,7 @@ try { if (!fs.existsSync(skillPath)) process.exit(0); // Strip a leading YAML frontmatter block (--- ... --- at the very top of file). + // Read as raw UTF-8: Codex compares the context bytes and CRLF must survive. const body = fs .readFileSync(skillPath, "utf8") .replace( @@ -33,11 +66,23 @@ try { ) .replace(/(?:\r?\n)+$/, ""); - process.stdout.write( - "ADHD MODE ACTIVE (always-on). The ruleset below applies to every response. " + - '"stop adhd mode" turns it off for this session; ' + - `delete ${flagPath} to turn always-on off for good.\n\n${body}\n`, - ); + const header = + 'ADHD MODE ACTIVE (always-on). The ruleset below applies to every response. ' + + '"stop adhd mode" turns it off for this session; ' + + `delete ${flagPath} to turn always-on off for good.`; + + if (json) { + process.stdout.write( + JSON.stringify({ + hookSpecificOutput: { + hookEventName: "SessionStart", + additionalContext: `${header}\n\n${body}`, + }, + }), + ); + } else { + process.stdout.write(`${header}\n\n${body}\n`); + } } catch { // Never block session start. process.exit(0); diff --git a/hooks/hooks.codex.json b/hooks/hooks.codex.json new file mode 100644 index 00000000..a67f90c8 --- /dev/null +++ b/hooks/hooks.codex.json @@ -0,0 +1,17 @@ +{ + "hooks": { + "SessionStart": [ + { + "matcher": "startup|resume|clear|compact", + "hooks": [ + { + "type": "command", + "command": "node -e \"(async()=>{const root=process.env.CLAUDE_PLUGIN_ROOT||process.env.PLUGIN_ROOT;if(root)await import(require('node:url').pathToFileURL(require('node:path').join(root,'hooks','always-on.mjs')).href)})().catch(()=>{})\" -- --agent codex --json", + "timeout": 30, + "statusMessage": "Checking i-have-adhd always-on flag..." + } + ] + } + ] + } +} diff --git a/hooks/hooks.json b/hooks/hooks.json index 5d713cd7..801f5f54 100644 --- a/hooks/hooks.json +++ b/hooks/hooks.json @@ -6,7 +6,7 @@ "hooks": [ { "type": "command", - "command": "node -e \"(async()=>{const root=process.env.CLAUDE_PLUGIN_ROOT||process.env.PLUGIN_ROOT;if(root)await import(require('node:url').pathToFileURL(require('node:path').join(root,'hooks','always-on.mjs')).href)})().catch(()=>{})\"", + "command": "node -e \"(async()=>{const root=process.env.CLAUDE_PLUGIN_ROOT||process.env.PLUGIN_ROOT;if(root)await import(require('node:url').pathToFileURL(require('node:path').join(root,'hooks','always-on.mjs')).href)})().catch(()=>{})\" -- --agent claude", "timeout": 30, "statusMessage": "Checking i-have-adhd always-on flag..." } diff --git a/hooks/session-kind.mjs b/hooks/session-kind.mjs new file mode 100644 index 00000000..5f733b2b --- /dev/null +++ b/hooks/session-kind.mjs @@ -0,0 +1,397 @@ +// Shared human-session classifier and opt-in decision log for every injector. +// +// Always-on rules may only load when a person is reading replies as they +// arrive. Anything unknown is `unclear`, never a guess in the human direction. +// +// Decision log: off unless the flag file has a line exactly `log` or +// I_HAVE_ADHD_LOG=1. One JSON object per line in +// ~/.local/state/i-have-adhd/decisions.log. Logging never changes a decision. + +import fs from "node:fs"; +import os from "node:os"; +import path from "node:path"; +import { execFileSync } from "node:child_process"; + +export const NOTICE = + "i-have-adhd: couldn't tell if a human is reading; rules not loaded. " + + "Run /i-have-adhd to turn them on."; + +const LOG_SIGNAL_KEYS = ["attended", "mode", "agentKind", "parent", "parentId"]; + +function result(decision, reason, signals) { + return { decision, reason, signals }; +} + +function unclear(reason, signals) { + return result("unclear", reason, signals); +} + +function classifyClaude(env) { + const raw = env ? env.CLAUDE_CODE_SESSION_ATTENDED : undefined; + if (raw === "1") return result("human", "claude-attended", { attended: "1" }); + if (raw === "0") return result("non-human", "claude-unattended", { attended: "0" }); + return unclear("claude-attendance-unset", { + attended: raw === undefined ? "unset" : "malformed", + }); +} + +const CODEX_VALUE_FLAGS = new Set([ + "-c", + "--config", + "--enable", + "--disable", + "--remote", + "-m", + "--model", + "-p", + "--profile", + "-s", + "--sandbox", + "-a", + "--ask-for-approval", + "-C", + "--cd", + "--local-provider", + "--add-dir", + "--remote-auth-token-env", +]); + +const CODEX_SUBCOMMANDS = new Set([ + "agents", + "exec", + "e", + "review", + "login", + "logout", + "mcp", + "plugin", + "app-server", + "remote-control", + "app", + "completion", + "update", + "doctor", + "sandbox", + "debug", + "apply", + "a", + "resume", + "queue", + "archive", + "delete", + "migrate-rollouts", + "migrate-nfs-db", + "unarchive", + "fork", + "cloud", + "exec-server", + "features", + "help", +]); + +function codexParent(parent) { + if (!Array.isArray(parent) || parent.length === 0) return null; + const executable = typeof parent[0] === "string" ? parent[0] : ""; + const name = path.basename(executable.replace(/\\/g, "/")).replace(/\.(?:exe|cmd)$/i, "").toLowerCase(); + if (name !== "codex") return null; + + let i = 1; + while (i < parent.length) { + const token = parent[i]; + if (typeof token !== "string") return ""; + if (token === "--") { + i += 1; + break; + } + if (token === "-i" || token === "--image") { + i += 1; + while (i < parent.length) { + const next = parent[i]; + if (typeof next !== "string") return ""; + if (next.startsWith("-") || CODEX_SUBCOMMANDS.has(next)) { + break; + } + i += 1; + } + continue; + } + if (token.startsWith("-")) { + if (CODEX_VALUE_FLAGS.has(token)) { + i += 2; + } else { + i += 1; + } + continue; + } + return token; + } + return typeof parent[i] === "string" ? parent[i] : ""; +} + +function classifyCodex(parent) { + const subcommand = codexParent(parent); + if (subcommand === null) return unclear("codex-parent-unknown", { parent: "unknown" }); + if (subcommand === "app-server") { + if (parent.includes("--managed-daemon")) { + return result("human", "codex-managed-daemon", { parent: "app-server" }); + } + return unclear("codex-parent-unknown", { parent: "app-server" }); + } + if (subcommand === "exec" || subcommand === "e") return result("non-human", "codex-exec", { parent: "exec" }); + return unclear("codex-parent-unknown", { parent: "unknown" }); +} + +function modeOf(ctx) { + return ctx && typeof ctx.mode === "string" ? ctx.mode : null; +} + +function classifyMode(agent, ctx) { + const mode = modeOf(ctx); + if (mode === null) return unclear(`${agent}-mode-unknown`, { mode: "malformed" }); + if (mode === "tui") return result("human", `${agent}-tui`, { mode }); + if (mode === "print" || mode === "json") { + return result("non-human", `${agent}-${mode}`, { mode }); + } + return unclear(`${agent}-mode-unclear`, { mode }); +} + +function agentKindOf(ctx) { + if (!ctx) return null; + if (typeof ctx.agentKind === "string") return ctx.agentKind; + if (ctx.agent && typeof ctx.agent.kind === "string") return ctx.agent.kind; + return null; +} + +function classifyOmp(ctx) { + // shortcut: the omp context shape (ctx.agent.kind or ctx.agentKind) is taken + // from upstream source, not the installed binary; real-agent QA confirms it. + const agentKind = agentKindOf(ctx); + const mode = modeOf(ctx); + const signals = { + mode: mode === null ? "malformed" : mode, + agentKind: agentKind === null ? "malformed" : agentKind, + }; + if (agentKind === "sub") return result("non-human", "omp-subagent", signals); + if (mode === "print" || mode === "json") { + return result("non-human", `omp-${mode}`, signals); + } + if (agentKind === "main" && mode === "tui") { + return result("human", "omp-main-tui", signals); + } + return unclear("omp-mode-unclear", signals); +} + +function classifyOpenCode(ctx) { + const parentID = ctx ? ctx.parentID : undefined; + if (parentID === undefined || parentID === null || parentID === "") { + return result("human", "opencode-top-level", { parentId: "absent" }); + } + if (typeof parentID === "string") { + return result("non-human", "opencode-subagent", { parentId: "present" }); + } + return unclear("opencode-parent-unknown", { parentId: "malformed" }); +} + +export function classifySession({ agent, env = process.env, parent = null, ctx = null } = {}) { + if (env && String(env.I_HAVE_ADHD ?? "").trim() === "0") { + return result("opt-out", "opt-out-env", {}); + } + if (ctx !== null && typeof ctx !== "object") { + return unclear("context-malformed", {}); + } + switch (agent) { + case "claude": + return classifyClaude(env); + case "codex": + return classifyCodex(parent); + case "pi": + return classifyMode("pi", ctx); + case "omp": + return classifyOmp(ctx); + case "opencode": + return classifyOpenCode(ctx); + default: + return unclear("agent-unknown", {}); + } +} + +export function flagPathFor(agent, env = process.env) { + if (agent === "opencode") { + return path.join( + env.XDG_CONFIG_HOME || path.join(os.homedir(), ".config"), + "opencode", + ".i-have-adhd-always", + ); + } + if (agent === "pi" || agent === "omp") return null; // callers know their agent dir + return path.join( + env.CLAUDE_CONFIG_DIR || path.join(os.homedir(), ".claude"), + ".i-have-adhd-always", + ); +} + +export function loggingEnabled({ agent, env = process.env, flagPath } = {}) { + if (env && env.I_HAVE_ADHD_LOG === "1") return true; + const flag = flagPath === undefined ? flagPathFor(agent, env) : flagPath; + if (!flag) return false; + try { + return fs.readFileSync(flag, "utf8").split(/\r?\n/).includes("log"); + } catch { + return false; + } +} + +export function logDecision({ + agent, + decision, + reason, + signals = {}, + env = process.env, + flagPath, +} = {}) { + try { + if (!loggingEnabled({ agent, env, flagPath })) return false; + const safeSignals = {}; + for (const key of LOG_SIGNAL_KEYS) { + if (signals[key] !== undefined) safeSignals[key] = String(signals[key]); + } + const directory = path.join(os.homedir(), ".local", "state", "i-have-adhd"); + fs.mkdirSync(directory, { recursive: true }); + fs.appendFileSync( + path.join(directory, "decisions.log"), + JSON.stringify({ + timestamp: new Date().toISOString(), + agent, + signals: safeSignals, + result: decisionResult(decision), + }) + "\n", + ); + return true; + } catch { + return false; + } +} + +export function decisionResult(decision) { + if (decision === "opt-out") return "skipped-optout"; + return decision === "human" ? "injected" : `skipped-${decision}`; +} + +function parseProcessOutputs(comm, argsOutput) { + const match = /^\s*(\d+)\s+(.+?)\s*$/.exec(argsOutput); + if (!match) return null; + const ppid = Number(match[1]); + const fullArgs = match[2]; + + if (!comm) { + return { ppid, argv: fullArgs.split(/\s+/) }; + } + + if (fullArgs.startsWith(comm)) { + const rest = fullArgs.slice(comm.length).trim(); + return { ppid, argv: [comm, ...(rest ? rest.split(/\s+/) : [])] }; + } + + const quotedComm = `"${comm}"`; + if (fullArgs.startsWith(quotedComm)) { + const rest = fullArgs.slice(quotedComm.length).trim(); + return { ppid, argv: [comm, ...(rest ? rest.split(/\s+/) : [])] }; + } + + const commBase = path.basename(comm).toLowerCase(); + const idx = fullArgs.toLowerCase().indexOf(commBase); + if (idx !== -1) { + const endIdx = idx + commBase.length; + const nextChar = fullArgs.charAt(endIdx); + if (nextChar === "" || nextChar === " " || nextChar === '"') { + const execCandidate = fullArgs.slice(0, endIdx).replace(/^"/, ""); + if (path.basename(execCandidate).toLowerCase() === commBase) { + const rest = fullArgs.slice(endIdx + (nextChar === '"' ? 1 : 0)).trim(); + return { ppid, argv: [execCandidate, ...(rest ? rest.split(/\s+/) : [])] }; + } + } + } + + return { ppid, argv: fullArgs.split(/\s+/) }; +} + +export function parseWin32Process(output) { + if (!output) return null; + const parts = output.trim().split("\t"); + if (parts.length < 3) return null; + const ppid = Number(parts[0]); + const execPath = parts[1].trim(); + const cmdLine = parts[2].trim(); + + if (!Number.isInteger(ppid) || ppid <= 0) return null; + if (!execPath) { + if (!cmdLine) return null; + return { ppid, argv: cmdLine.split(/\s+/) }; + } + + if (cmdLine.startsWith(`"${execPath}"`)) { + const rest = cmdLine.slice(execPath.length + 2).trim(); + return { ppid, argv: [execPath, ...(rest ? rest.split(/\s+/) : [])] }; + } + if (cmdLine.startsWith(execPath)) { + const rest = cmdLine.slice(execPath.length).trim(); + return { ppid, argv: [execPath, ...(rest ? rest.split(/\s+/) : [])] }; + } + + const tokens = cmdLine ? cmdLine.split(/\s+/) : []; + return { ppid, argv: [execPath, ...(tokens.length > 0 ? tokens.slice(1) : [])] }; +} + +function readProcess(pid) { + try { + if (process.platform === "win32") { + const output = execFileSync( + "powershell", + [ + "-NoProfile", + "-NonInteractive", + "-Command", + `$p = Get-CimInstance Win32_Process -Filter 'ProcessId=${pid}'; if ($p) { "$($p.ParentProcessId)\`t$($p.ExecutablePath)\`t$($p.CommandLine)" }`, + ], + { encoding: "utf8", timeout: 1000, stdio: ["ignore", "pipe", "ignore"] }, + ); + return parseWin32Process(output); + } + const commOutput = execFileSync("ps", ["-o", "comm=", "-p", String(pid)], { + encoding: "utf8", + timeout: 1000, + maxBuffer: 64 * 1024, + stdio: ["ignore", "pipe", "ignore"], + }).trim(); + const argsOutput = execFileSync("ps", ["-o", "ppid=,args=", "-p", String(pid)], { + encoding: "utf8", + timeout: 1000, + maxBuffer: 64 * 1024, + stdio: ["ignore", "pipe", "ignore"], + }); + return parseProcessOutputs(commOutput, argsOutput); + } catch { + return null; + } +} + +/** + * Walk up to eight ancestors looking for the `codex` process that launched this + * hook. Bounded, argv-only, no shell strings. Any failure means `null`, which + * the classifier turns into `unclear`. + */ +export function parentArgv(startPid = process.ppid) { + const seen = new Set(); + let pid = startPid; + for (let depth = 0; depth < 8; depth++) { + if (!Number.isInteger(pid) || pid <= 0 || seen.has(pid)) return null; + seen.add(pid); + const info = readProcess(pid); + if (!info) return null; + if (path.basename((info.argv[0] || "").replace(/\\/g, "/")).replace(/\.(?:exe|cmd)$/i, "").toLowerCase() === "codex") { + return info.argv; + } + pid = info.ppid; + } + return null; +} diff --git a/kimi.plugin.json b/kimi.plugin.json index fd1f05dd..4d94d2c3 100644 --- a/kimi.plugin.json +++ b/kimi.plugin.json @@ -1,9 +1,9 @@ { "name": "i-have-adhd", - "version": "0.4.1", + "version": "0.5.0", "description": "Shape output for a reader with ADHD: lead with the next action, number multi-step work, restate state across turns, suppress tangents, give specific time estimates, make wins visible.", "license": "MIT", - "homepage": "https://github.com/ayghri/i-have-adhd", + "homepage": "https://github.com/flyingnobita/i-have-adhd", "skills": "./skills/", "interface": { "displayName": "I Have ADHD", diff --git a/package.json b/package.json index a5f8d09d..7035101f 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { "name": "i-have-adhd", - "version": "0.4.1", + "version": "0.5.0", "description": "Shape output for a reader with ADHD: lead with the next action, number multi-step work, restate state across turns, suppress tangents, give specific time estimates, make wins visible.", "license": "MIT", - "homepage": "https://github.com/ayghri/i-have-adhd", + "homepage": "https://github.com/flyingnobita/i-have-adhd", "private": true, "keywords": ["pi-package"], "omp": { diff --git a/plugin.json b/plugin.json index 40312516..d8203a13 100644 --- a/plugin.json +++ b/plugin.json @@ -1,4 +1,5 @@ { "name": "i-have-adhd", + "version": "0.5.0", "description": "Shape Antigravity output for an ADHD reader: lead with the next action, number steps, suppress tangents, restate state, make wins visible." } diff --git a/qwen-extension.json b/qwen-extension.json index e2cac9fb..337c9e8d 100644 --- a/qwen-extension.json +++ b/qwen-extension.json @@ -1,6 +1,6 @@ { "name": "i-have-adhd", - "version": "0.4.1", + "version": "0.5.0", "description": "ADHD-friendly output shaping for Qwen Code: action first, numbered steps, no tangents, and visible progress.", "skills": "skills" } diff --git a/scripts/check_pi_extension.py b/scripts/check_pi_extension.py index 1cd3fa6c..784dbd43 100644 --- a/scripts/check_pi_extension.py +++ b/scripts/check_pi_extension.py @@ -162,6 +162,9 @@ def build_isolated_env(agent_dir: str) -> dict[str, str]: } env.update( { + "HOME": agent_dir, + "XDG_CONFIG_HOME": str(Path(agent_dir, ".config")), + "XDG_STATE_HOME": str(Path(agent_dir, ".local", "state")), "PI_CODING_AGENT_DIR": agent_dir, "PI_SKIP_VERSION_CHECK": "1", "PI_TELEMETRY": "0", @@ -214,6 +217,58 @@ def parse_args() -> argparse.Namespace: return parser.parse_args() + +NOTICE = ( + "i-have-adhd: couldn't tell if a human is reading; rules not loaded. " + "Run /i-have-adhd to turn them on." +) +REQUIRED_SCENARIOS = { + "rpc_adhd_flag_unclear", + "rpc_flag_unclear", + "manual_command_still_enables", +} + + +def notifications(events: list[dict[str, Any]]) -> list[str]: + return [ + event.get("message") or "" + for event in events + if event.get("type") == "extension_ui_request" + and event.get("method") == "notify" + ] + + +def notice_seen(events: list[dict[str, Any]]) -> bool: + return any(NOTICE in message for message in notifications(events)) + + +def startup(client: "RpcClient", runtime: str) -> tuple[set[str], list[dict[str, Any]]]: + if runtime == "omp": + events = client.events_until( + lambda event: event.get("type") == "available_commands_update" + ) + return {command["name"] for command in events[-1]["commands"]}, events + response, events = client.request("commands", {"type": "get_commands"}) + return {command["name"] for command in response["data"]["commands"]}, events + + +def assert_no_auto_activation( + events: list[dict[str, Any]], + scenario: str, + scenarios: set[str], + entries: dict[str, Any] | None = None, +) -> None: + assert not any("ADHD ON" in (text or "") for text in status_texts(events)), ( + f"{scenario}: automatic mode activated without a human signal" + ) + if entries is not None: + assert message_count(entries, "i-have-adhd-rules") == 0, ( + f"{scenario}: rules were injected without a human signal" + ) + assert notice_seen(events), f"{scenario}: the unclear-session notice was not emitted" + scenarios.add(scenario) + + def main() -> None: args = parse_args() validate_package_manifest() @@ -221,12 +276,12 @@ def main() -> None: if executable is None: raise RuntimeError(f"{args.runtime} executable is not available") + scenarios: set[str] = set() + with tempfile.TemporaryDirectory( prefix=f"i-have-adhd-{args.runtime}-" ) as agent_dir: env = build_isolated_env(agent_dir) - if args.runtime == "omp": - env.pop("PI_CODING_AGENT_DIR", None) if args.runtime == "pi": subprocess.run( [executable, "install", str(ROOT)], @@ -278,150 +333,153 @@ def main() -> None: str(reload_probe), "--adhd", ) - if args.runtime == "omp": - try: - startup_events = client.events_until( - lambda event: event.get("type") - == "available_commands_update", - ) - command_event = startup_events[-1] - command_names = { - command["name"] - for command in command_event["commands"] - } - assert "i-have-adhd" in command_names - assert "skill:i-have-adhd" in command_names - assert any( - "ADHD ON" in (text or "") - for text in status_texts(startup_events) - ) - finally: - client.close() - - print("omp extension smoke test passed") - return - try: - commands, startup_events = client.request("commands", {"type": "get_commands"}) - command_names = {command["name"] for command in commands["data"]["commands"]} + command_names, startup_events = startup(client, args.runtime) assert "i-have-adhd" in command_names assert "skill:i-have-adhd" in command_names - assert any("ADHD ON" in (text or "") for text in status_texts(startup_events)) - entries, _ = client.request("entries-startup", {"type": "get_entries"}) - assert message_count(entries, "i-have-adhd-rules") == 1 - assert message_count(entries, "i-have-adhd-disabled") == 0 - - reloaded, reload_events = client.request( - "reload-enabled", - {"type": "prompt", "message": "/reload-probe"}, + entries = None + if args.runtime == "pi": + entries, _ = client.request("entries-startup", {"type": "get_entries"}) + assert_no_auto_activation( + startup_events, "rpc_adhd_flag_unclear", scenarios, entries ) - assert reloaded["success"] is True - assert any("ADHD ON" in (text or "") for text in status_texts(reload_events)) - entries, _ = client.request("entries-reloaded", {"type": "get_entries"}) - assert message_count(entries, "i-have-adhd-rules") == 1, ( - "Rules were injected twice for one active session" - ) - - toggled_off, toggle_off_events = client.request( - "toggle-off", + enabled, enable_events = client.request( + "enable-manual", {"type": "prompt", "message": "/i-have-adhd"}, ) - assert toggled_off["success"] is True - assert None in status_texts(toggle_off_events) + assert enabled["success"] is True + assert any("ADHD ON" in (text or "") for text in status_texts(enable_events)) + + if args.runtime == "pi": + entries, _ = client.request("entries-enabled", {"type": "get_entries"}) + assert latest_enabled(entries) is True + assert message_count(entries, "i-have-adhd-rules") == 1 + scenarios.add("manual_command_still_enables") + + if args.runtime == "pi": + reloaded, reload_events = client.request( + "reload-enabled", + {"type": "prompt", "message": "/reload-probe"}, + ) + assert reloaded["success"] is True + assert any("ADHD ON" in (text or "") for text in status_texts(reload_events)) - entries, _ = client.request("entries-toggled-off", {"type": "get_entries"}) - assert latest_enabled(entries) is False - assert message_count(entries, "i-have-adhd-disabled") == 1 + entries, _ = client.request("entries-reloaded", {"type": "get_entries"}) + assert message_count(entries, "i-have-adhd-rules") == 1, ( + "Rules were injected twice for one active session" + ) - reloaded, reload_events = client.request( - "reload-disabled", - {"type": "prompt", "message": "/reload-probe"}, - ) - assert reloaded["success"] is True - assert not any("ADHD ON" in (text or "") for text in status_texts(reload_events)) + toggled_off, toggle_off_events = client.request( + "toggle-off", + {"type": "prompt", "message": "/i-have-adhd"}, + ) + assert toggled_off["success"] is True + assert None in status_texts(toggle_off_events) - entries, _ = client.request("entries-reload-disabled", {"type": "get_entries"}) - assert message_count(entries, "i-have-adhd-rules") == 1 - assert message_count(entries, "i-have-adhd-disabled") == 1 + entries, _ = client.request("entries-toggled-off", {"type": "get_entries"}) + assert latest_enabled(entries) is False + assert message_count(entries, "i-have-adhd-disabled") == 1 - toggled_on, toggle_on_events = client.request( - "toggle-on", - {"type": "prompt", "message": "/i-have-adhd"}, - ) - assert toggled_on["success"] is True - assert any("ADHD ON" in (text or "") for text in status_texts(toggle_on_events)) + reloaded, reload_events = client.request( + "reload-disabled", + {"type": "prompt", "message": "/reload-probe"}, + ) + assert reloaded["success"] is True + assert not any( + "ADHD ON" in (text or "") for text in status_texts(reload_events) + ) - entries, _ = client.request("entries-toggled-on", {"type": "get_entries"}) - assert latest_enabled(entries) is True - assert message_count(entries, "i-have-adhd-rules") == 2 + entries, _ = client.request( + "entries-reload-disabled", {"type": "get_entries"} + ) + assert message_count(entries, "i-have-adhd-rules") == 1 + assert message_count(entries, "i-have-adhd-disabled") == 1 - explicit_off, _ = client.request( - "explicit-off", - {"type": "prompt", "message": "/i-have-adhd off"}, - ) - assert explicit_off["success"] is True + toggled_on, toggle_on_events = client.request( + "toggle-on", + {"type": "prompt", "message": "/i-have-adhd"}, + ) + assert toggled_on["success"] is True + assert any( + "ADHD ON" in (text or "") for text in status_texts(toggle_on_events) + ) - skill, skill_events = client.request( - "skill-alias", - {"type": "prompt", "message": "/skill:i-have-adhd"}, - ) - assert skill["success"] is True - assert not any(event.get("type") == "agent_start" for event in skill_events) + entries, _ = client.request("entries-toggled-on", {"type": "get_entries"}) + assert latest_enabled(entries) is True + assert message_count(entries, "i-have-adhd-rules") == 2 - entries, _ = client.request("entries-enabled", {"type": "get_entries"}) - assert latest_enabled(entries) is True - assert message_count(entries, "i-have-adhd-rules") == 3 + explicit_off, _ = client.request( + "explicit-off", + {"type": "prompt", "message": "/i-have-adhd off"}, + ) + assert explicit_off["success"] is True - stopped, stop_events = client.request( - "stop-phrase", - {"type": "prompt", "message": "normal mode"}, - ) - assert stopped["success"] is True - assert None in status_texts(stop_events) + skill, skill_events = client.request( + "skill-alias", + {"type": "prompt", "message": "/skill:i-have-adhd"}, + ) + assert skill["success"] is True + assert not any(event.get("type") == "agent_start" for event in skill_events) - entries, _ = client.request("entries-stopped", {"type": "get_entries"}) - assert latest_enabled(entries) is False + entries, _ = client.request("entries-skill", {"type": "get_entries"}) + assert latest_enabled(entries) is True + assert message_count(entries, "i-have-adhd-rules") == 3 - passthrough_probe_flag.touch() - passthrough, _ = client.request( - "disabled-passthrough", - {"type": "prompt", "message": "normal mode"}, - ) - assert passthrough["success"] is True - - entries, _ = client.request("entries-passthrough", {"type": "get_entries"}) - assert any( - entry.get("type") == "custom" - and entry.get("customType") == "passthrough-probe" - and entry.get("data", {}).get("seen") is True - for entry in entries["data"]["entries"] - ), "Disabled mode swallowed ordinary input" - finally: - client.close() + stopped, stop_events = client.request( + "stop-phrase", + {"type": "prompt", "message": "normal mode"}, + ) + assert stopped["success"] is True + assert None in status_texts(stop_events) - if args.runtime == "pi": - Path(agent_dir, ".i-have-adhd-always").touch() - always_on = RpcClient( - executable, - env, - "--no-session", - *extension_args, - ) - try: - _, always_on_events = always_on.request( - "always-on", - {"type": "get_state"}, + entries, _ = client.request("entries-stopped", {"type": "get_entries"}) + assert latest_enabled(entries) is False + + passthrough_probe_flag.touch() + passthrough, _ = client.request( + "disabled-passthrough", + {"type": "prompt", "message": "normal mode"}, ) - assert any( - "ADHD ON" in (text or "") - for text in status_texts(always_on_events) + assert passthrough["success"] is True + + entries, _ = client.request( + "entries-passthrough", {"type": "get_entries"} ) - finally: - always_on.close() + assert any( + entry.get("type") == "custom" + and entry.get("customType") == "passthrough-probe" + and entry.get("data", {}).get("seen") is True + for entry in entries["data"]["entries"] + ), "Disabled mode swallowed ordinary input" + finally: + client.close() - print(f"{args.runtime} extension smoke test passed") + Path(agent_dir, ".i-have-adhd-always").touch() + fresh = RpcClient( + executable, + env, + "--no-session", + *extension_args, + "-e", + str(reload_probe), + ) + try: + _, flag_events = startup(fresh, args.runtime) + entries = None + if args.runtime == "pi": + entries, _ = fresh.request("entries-flag", {"type": "get_entries"}) + assert_no_auto_activation(flag_events, "rpc_flag_unclear", scenarios, entries) + finally: + fresh.close() + + missing = REQUIRED_SCENARIOS - scenarios + assert not missing, f"smoke scenarios did not run: {sorted(missing)}" + print( + f"{args.runtime} extension smoke test passed: " + + ", ".join(sorted(scenarios)) + ) if __name__ == "__main__": diff --git a/skills/i-have-adhd/SKILL.md b/skills/i-have-adhd/SKILL.md index 6c42757f..d987a586 100644 --- a/skills/i-have-adhd/SKILL.md +++ b/skills/i-have-adhd/SKILL.md @@ -12,6 +12,16 @@ metadata: The reader has ADHD. Output is not just brief. It is shaped so an ADHD brain can act on it. +## Scope + +These rules shape only the chat reply to the person reading it. They do not shape a subagent prompt, a report to an orchestrator, a file, a commit message, a PR body, or a handoff document. A worker running unattended ignores this skill: nobody is reading its output as it arrives. + +## Other skills and instructions win + +A loaded skill's or instruction's format, procedure, or loop outranks these defaults. When a skill defines a question round, a table, a findings report, or a closing summary, deliver it in full: never cap, defer, or trim its lists, rows, questions, or sections to satisfy rule 2, 3, or 9. When a skill defines its own procedure, that procedure replaces the debug-spiral rule. + +A required notice or credit is not preamble or recap. Keep a credit or notice the harness or a hook requires (for example, a memory-credit blockquote) exactly where and as required, and never delete it. Never cut or defer content an instruction requires in a report. + ## Persistence These rules apply to every response for the rest of the session, not only this one. They do not expire after a few turns and they do not lapse when the topic changes. If you are unsure whether they still apply, they do. diff --git a/tests/opencode_plugin_driver.mjs b/tests/opencode_plugin_driver.mjs index 379fad02..7f50bdf9 100644 --- a/tests/opencode_plugin_driver.mjs +++ b/tests/opencode_plugin_driver.mjs @@ -1,21 +1,97 @@ -// Usage: node driver.mjs [config] -// Print registrations as JSON, or the injected system text for context modes. +// Usage: node driver.mjs [options] +// Print registrations as JSON. Context modes print {system, toasts} when either +// is non-empty; `options` is {parentID} for context modes, a config object for +// v1-config. import { pathToFileURL } from 'node:url'; const pluginPath = process.argv[2]; const mode = process.argv[3]; +const options = process.argv[4] ? JSON.parse(process.argv[4]) : undefined; const { default: definition } = await import(pathToFileURL(pluginPath).href); const skills = new Map(); const commands = new Map(); const hooks = new Map(); const prompts = []; +const toasts = []; const editorFor = (store) => ({ get: (id) => store.get(id), add: (entry) => store.set(entry.id ?? entry.name, entry), }); +let lookups = 0; +const sessionStore = new Map(); +const eventSubscribers = []; +const eventQueue = []; +const eventWaiters = []; + +const pushEvent = (ev) => { + if (eventWaiters.length > 0) { + const waiter = eventWaiters.shift(); + waiter(ev); + } else { + eventQueue.push(ev); + } +}; + +const v2EventStream = { + [Symbol.asyncIterator]() { + return { + async next() { + if (eventQueue.length > 0) { + const value = eventQueue.shift(); + return { value, done: false }; + } + return new Promise((resolve) => { + eventWaiters.push((value) => resolve({ value, done: false })); + }); + }, + async return() { + return { done: true }; + }, + }; + }, +}; + +const seedSession = (s) => { + if (s && typeof s === 'object' && s.sessionID) { + if (!sessionStore.has(s.sessionID)) { + sessionStore.set(s.sessionID, { id: s.sessionID, parentID: s.parentID }); + } + } +}; + +const callsList = Array.isArray(options) + ? options + : Array.isArray(options?.calls) + ? options.calls + : [options || {}]; + +if (options?.sessions && typeof options.sessions === 'object') { + for (const [id, s] of Object.entries(options.sessions)) { + sessionStore.set(id, s); + } +} +for (const call of callsList) { + seedSession(call); +} + +const handleSessionLookup = async (sessionID) => { + lookups += 1; + if (options?.failLookup) { + throw new Error('Simulated lookup error'); + } + if (sessionStore.has(sessionID)) { + const s = sessionStore.get(sessionID); + if (s === '__ERROR__') { + throw new Error('Simulated session error'); + } + return s; + } + return { id: sessionID }; +}; + const v2ctx = { skill: { transform: async (cb) => { @@ -37,22 +113,85 @@ const v2ctx = { prompt: async (input) => { prompts.push(input); }, + get: options?.noClient ? undefined : async ({ sessionID }) => { + const res = await handleSessionLookup(sessionID); + if (res && typeof res === 'object' && 'data' in res && !('id' in res)) { + return res.data; + } + return res; + }, + }, + event: { + subscribe: (opts) => { + if (typeof opts === 'function') { + return { dispose: () => {} }; + } + return v2EventStream; + }, + }, +}; + +// V1 plugins receive the OpenCode client; the toast path is optional. +const v1ctx = { + client: { + tui: { + showToast: async ({ body }) => { + toasts.push(body?.message); + }, + }, + session: options?.noClient ? undefined : { + get: async (req) => { + const id = req?.path?.id || req?.sessionID || req?.id; + const res = await handleSessionLookup(id); + if (res === null || res === undefined) return res; + if (typeof res === 'object' && ('data' in res || 'error' in res || Object.keys(res).length === 0)) { + return res; + } + return { data: res }; + }, + }, }, }; const joined = (event) => event.system.map((part) => part.text ?? String(part)).join('\n---SEP---\n'); +const emitContext = (system) => { + if (!system && toasts.length === 0 && lookups === 0) return; + process.stdout.write(JSON.stringify({ system, toasts, lookups })); +}; + if (mode === 'v1-config' || mode === 'v1-context') { - const v1 = await definition.server(); + const v1 = await definition.server(v1ctx); if (mode === 'v1-config') { - const config = JSON.parse(process.argv[4] || '{}'); + const config = options || {}; await v1.config(config); await v1.config(config); process.stdout.write(JSON.stringify(config)); + } else if (options?.steps) { + const systems = []; + for (const step of options.steps) { + if (step.type === 'event') { + if (v1?.event) await v1.event({ event: step.event }); + } else { + const output = { system: [] }; + await v1['experimental.chat.system.transform'](step.call || {}, output); + systems.push(output.system.join('\n---SEP---\n')); + } + } + process.stdout.write(JSON.stringify({ systems, system: systems[systems.length - 1], toasts, lookups })); } else { - const output = { system: [] }; - await v1['experimental.chat.system.transform']({}, output); - process.stdout.write(output.system.join('\n---SEP---\n')); + const calls = Array.isArray(options) ? options : Array.isArray(options?.calls) ? options.calls : [options || {}]; + const systems = []; + for (const call of calls) { + const output = { system: [] }; + await v1['experimental.chat.system.transform'](call, output); + systems.push(output.system.join('\n---SEP---\n')); + } + if (Array.isArray(options) || Array.isArray(options?.calls)) { + process.stdout.write(JSON.stringify({ systems, system: systems[systems.length - 1], toasts, lookups })); + } else { + emitContext(systems[0]); + } } } else { await definition.setup(v2ctx); @@ -70,11 +209,34 @@ if (mode === 'v1-config' || mode === 'v1-context') { out[0].template = prompts[prompts.length - 1]?.text; } process.stdout.write(JSON.stringify(out)); + } else if (options?.steps) { + const handler = hooks.get('context'); + const systems = []; + for (const step of options.steps) { + if (step.type === 'event') { + pushEvent(step.event); + await new Promise((resolve) => setImmediate(resolve)); + } else if (handler) { + const event = { system: [], ...(step.call || {}) }; + await handler(event); + systems.push(joined(event)); + } + } + process.stdout.write(JSON.stringify({ systems, system: systems[systems.length - 1], toasts, lookups })); } else { const handler = hooks.get('context'); if (!handler) process.exit(0); - const event = { system: [] }; - await handler(event); - process.stdout.write(joined(event)); + const calls = Array.isArray(options) ? options : Array.isArray(options?.calls) ? options.calls : [options || {}]; + const systems = []; + for (const call of calls) { + const event = { system: [], ...call }; + await handler(event); + systems.push(joined(event)); + } + if (Array.isArray(options) || Array.isArray(options?.calls)) { + process.stdout.write(JSON.stringify({ systems, system: systems[systems.length - 1], toasts, lookups })); + } else { + emitContext(systems[0]); + } } } diff --git a/tests/test_always_on_hooks.py b/tests/test_always_on_hooks.py index 62e4a731..8d42dc58 100644 --- a/tests/test_always_on_hooks.py +++ b/tests/test_always_on_hooks.py @@ -8,6 +8,10 @@ ROOT = Path(__file__).resolve().parents[1] +NOTICE = ( + "i-have-adhd: couldn't tell if a human is reading; rules not loaded. " + "Run /i-have-adhd to turn them on." +) class AlwaysOnHookTest(unittest.TestCase): @@ -19,13 +23,26 @@ def setUp(self): shutil.copytree(ROOT / "skills", self.plugin_root / "skills") self.config_dir = Path(self.temp_dir.name) / "claude config" self.config_dir.mkdir() + self.home_dir = Path(self.temp_dir.name) / "home" + self.home_dir.mkdir() + self.log = self.home_dir / ".local" / "state" / "i-have-adhd" / "decisions.log" def runtimes(self): + # The Node path is the one that gates on session kind, so only that path + # gets the human signal; the native fallbacks must render the same text. runtimes = [] if node := shutil.which("node"): - runtimes.append(("node", [node, self.plugin_root / "hooks" / "always-on.mjs"])) + runtimes.append( + ( + "node", + [node, self.plugin_root / "hooks" / "always-on.mjs", "--agent", "claude"], + {"CLAUDE_CODE_SESSION_ATTENDED": "1"}, + ) + ) if sh := shutil.which("sh"): - runtimes.append(("sh", [sh, self.plugin_root / "hooks" / "always-on.sh"])) + runtimes.append( + ("sh", [sh, self.plugin_root / "hooks" / "always-on.sh"], {}) + ) if powershell := shutil.which("pwsh") or shutil.which("powershell"): runtimes.append( ( @@ -38,34 +55,47 @@ def runtimes(self): "-File", self.plugin_root / "hooks" / "always-on.ps1", ], + {}, ) ) return runtimes - def run_hook(self, command): + def env(self, **overrides): env = os.environ.copy() - env["CLAUDE_CONFIG_DIR"] = str(self.config_dir) + for key in ("I_HAVE_ADHD", "I_HAVE_ADHD_LOG", "CLAUDE_CODE_SESSION_ATTENDED"): + env.pop(key, None) + env.update( + { + "HOME": str(self.home_dir), + "USERPROFILE": str(self.home_dir), + "CLAUDE_CONFIG_DIR": str(self.config_dir), + "CLAUDE_PLUGIN_ROOT": str(self.plugin_root), + "PLUGIN_ROOT": str(self.plugin_root), + } + ) + env.update(overrides) + return env + + def run_hook(self, command, extra_env=None): return subprocess.run( [str(part) for part in command], check=False, capture_output=True, text=True, - env=env, + env=self.env(**(extra_env or {})), ) - def run_codex_hook(self, plugin_root=None): + def run_node_hook(self, **overrides): + return self.run_hook(self.runtimes()[0][1], overrides) + + def run_plugin_hook(self, **overrides): config = json.loads((ROOT / "hooks" / "hooks.json").read_text()) hook = config["hooks"]["SessionStart"][0]["hooks"][0] - env = os.environ.copy() - env["CLAUDE_CONFIG_DIR"] = str(self.config_dir) - plugin_root = plugin_root or self.plugin_root - env["CLAUDE_PLUGIN_ROOT"] = str(plugin_root) - env["PLUGIN_ROOT"] = str(plugin_root) return subprocess.run( hook["command"], check=False, capture_output=True, - env=env, + env=self.env(**overrides), input=json.dumps( { "session_id": "test-session", @@ -73,9 +103,8 @@ def run_codex_hook(self, plugin_root=None): "hook_event_name": "SessionStart", "source": "startup", } - ), + ).encode("utf8"), shell=True, - text=True, ) @staticmethod @@ -85,25 +114,62 @@ def normalize(stdout): # file, so unify separators (and newlines) before comparing runtimes. return stdout.replace("\r\n", "\n").replace("\\", "/") + def opt_in(self, contents=""): + (self.config_dir / ".i-have-adhd-always").write_text(contents) + def test_hook_is_silent_without_opt_in_flag(self): self.assertTrue(self.runtimes(), "no hook runtime is available") - for name, command in self.runtimes(): + for name, command, extra_env in self.runtimes(): with self.subTest(runtime=name): - result = self.run_hook(command) + result = self.run_hook(command, extra_env) self.assertEqual(0, result.returncode) self.assertEqual("", result.stdout) self.assertEqual("", result.stderr) + self.assertFalse(self.log.exists()) + self.assertFalse((self.home_dir / ".local" / "state" / "i-have-adhd").exists()) + + def test_claude_human_injects_and_nonhuman_is_silent(self): + self.opt_in() + + human = self.run_node_hook(CLAUDE_CODE_SESSION_ATTENDED="1") + self.assertEqual(0, human.returncode, human.stderr) + self.assertIn("ADHD MODE ACTIVE (always-on)", human.stdout) + self.assertIn("Working memory is small", human.stdout) + + nonhuman = self.run_node_hook(CLAUDE_CODE_SESSION_ATTENDED="0") + self.assertEqual(0, nonhuman.returncode, nonhuman.stderr) + self.assertEqual("", nonhuman.stdout) + + def test_claude_unclear_returns_only_system_message(self): + self.opt_in() + + result = self.run_node_hook() + + self.assertEqual(0, result.returncode, result.stderr) + self.assertRegex(result.stdout, r"^\{.*\}$") + payload = json.loads(result.stdout) + self.assertEqual({"systemMessage": NOTICE}, payload) + + def test_claude_opt_out_wins(self): + self.opt_in() + + result = self.run_node_hook( + CLAUDE_CODE_SESSION_ATTENDED="1", I_HAVE_ADHD="0" + ) + + self.assertEqual(0, result.returncode, result.stderr) + self.assertEqual("", result.stdout) def test_runtimes_strip_frontmatter_with_trailing_whitespace(self): skill_path = self.plugin_root / "skills" / "i-have-adhd" / "SKILL.md" skill_path.write_text("--- \nname: fixture\n--- \t\nFixture body.\n") - (self.config_dir / ".i-have-adhd-always").touch() + self.opt_in() outputs = {} - for name, command in self.runtimes(): + for name, command, extra_env in self.runtimes(): with self.subTest(runtime=name): - result = self.run_hook(command) + result = self.run_hook(command, extra_env) self.assertEqual(0, result.returncode) self.assertEqual("", result.stderr) normalized = self.normalize(result.stdout) @@ -119,12 +185,12 @@ def test_runtimes_keep_content_when_frontmatter_is_unclosed(self): # below" followed by nothing. skill_path = self.plugin_root / "skills" / "i-have-adhd" / "SKILL.md" skill_path.write_text("---\nname: fixture\nFixture body, fence never closed.\n") - (self.config_dir / ".i-have-adhd-always").touch() + self.opt_in() outputs = {} - for name, command in self.runtimes(): + for name, command, extra_env in self.runtimes(): with self.subTest(runtime=name): - result = self.run_hook(command) + result = self.run_hook(command, extra_env) self.assertEqual(0, result.returncode) self.assertEqual("", result.stderr) normalized = self.normalize(result.stdout) @@ -133,40 +199,59 @@ def test_runtimes_keep_content_when_frontmatter_is_unclosed(self): self.assertEqual(1, len(set(outputs.values()))) - def test_codex_command_runs_the_hook_instead_of_parsing_session_json(self): - (self.config_dir / ".i-have-adhd-always").touch() + def test_launcher_runs_the_hook_instead_of_parsing_session_json(self): + self.opt_in() - result = self.run_codex_hook() + result = self.run_plugin_hook(CLAUDE_CODE_SESSION_ATTENDED="1") self.assertEqual(0, result.returncode, result.stderr) - self.assertEqual("", result.stderr) - self.assertIn("ADHD MODE ACTIVE (always-on)", result.stdout) + self.assertEqual(b"", result.stderr) + self.assertIn(b"ADHD MODE ACTIVE (always-on)", result.stdout) - def test_codex_command_is_silent_without_opt_in_flag(self): - result = self.run_codex_hook() + def test_launcher_is_silent_without_opt_in_flag(self): + result = self.run_plugin_hook(CLAUDE_CODE_SESSION_ATTENDED="1") self.assertEqual(0, result.returncode, result.stderr) - self.assertEqual("", result.stderr) - self.assertEqual("", result.stdout) + self.assertEqual(b"", result.stderr) + self.assertEqual(b"", result.stdout) - def test_codex_command_swallows_missing_plugin_errors(self): - result = self.run_codex_hook(self.plugin_root / "missing plugin") + def test_launcher_swallows_missing_plugin_errors(self): + result = self.run_plugin_hook( + CLAUDE_CODE_SESSION_ATTENDED="1", + CLAUDE_PLUGIN_ROOT=str(self.plugin_root / "missing plugin"), + PLUGIN_ROOT=str(self.plugin_root / "missing plugin"), + ) self.assertEqual(0, result.returncode, result.stderr) - self.assertEqual("", result.stderr) - self.assertEqual("", result.stdout) + self.assertEqual(b"", result.stderr) + self.assertEqual(b"", result.stdout) - def test_hook_uses_a_shared_claude_and_codex_launcher(self): - config = json.loads((ROOT / "hooks" / "hooks.json").read_text()) - hook = config["hooks"]["SessionStart"][0]["hooks"][0] + def test_shipped_launchers_select_their_runtime(self): + self.assertTrue((ROOT / "hooks" / "hooks.codex.json").is_file()) + claude = json.loads((ROOT / "hooks" / "hooks.json").read_text()) + codex = json.loads((ROOT / "hooks" / "hooks.codex.json").read_text()) + claude_hook = claude["hooks"]["SessionStart"][0]["hooks"][0] + codex_hook = codex["hooks"]["SessionStart"][0]["hooks"][0] + + for hook in (claude_hook, codex_hook): + self.assertNotIn("args", hook) + command = hook["command"] + self.assertRegex(command, r'^node(?: --input-type=module)? -e "') + self.assertIn("process.env.CLAUDE_PLUGIN_ROOT", command) + self.assertIn("process.env.PLUGIN_ROOT", command) + self.assertIn("await import", command) + self.assertIn(".catch", command) + + self.assertTrue(claude_hook["command"].rstrip().endswith("--agent claude")) + self.assertIn("--agent codex --json", codex_hook["command"]) + + def test_codex_manifest_uses_the_codex_hook_file(self): + path = ROOT / ".codex-plugin" / "plugin.json" + manifest = json.loads(path.read_text()) - self.assertNotIn("args", hook) - command = hook["command"] - self.assertRegex(command, r'^node(?: --input-type=module)? -e "') - self.assertIn("process.env.CLAUDE_PLUGIN_ROOT", command) - self.assertIn("process.env.PLUGIN_ROOT", command) - self.assertIn("await import", command) - self.assertIn(".catch", command) + self.assertIn("hooks", manifest) + self.assertEqual("./hooks/hooks.codex.json", manifest["hooks"]) + self.assertTrue((ROOT / manifest["hooks"]).is_file()) if __name__ == "__main__": diff --git a/tests/test_codex_hook.py b/tests/test_codex_hook.py new file mode 100644 index 00000000..a0bfbcb8 --- /dev/null +++ b/tests/test_codex_hook.py @@ -0,0 +1,240 @@ +import json +import os +import re +import shutil +import subprocess +import tempfile +import unittest +from pathlib import Path + + +ROOT = Path(__file__).resolve().parents[1] +NOTICE = ( + "i-have-adhd: couldn't tell if a human is reading; rules not loaded. " + "Run /i-have-adhd to turn them on." +) +FRONTMATTER = re.compile(r"^---[^\S\r\n]*\r?\n[\s\S]*?\r?\n---[^\S\r\n]*(?:\r?\n|$)") + + +def skill_body(path): + """Mirror the hook's frontmatter stripping without translating newlines.""" + text = path.read_bytes().decode("utf8") + return re.sub(r"(?:\r?\n)+$", "", FRONTMATTER.sub("", text, count=1)) + + +@unittest.skipUnless(shutil.which("node"), "node is required for the Codex hook") +@unittest.skipUnless(os.name == "posix", "the parent probe fixture is POSIX-only") +class CodexHookTest(unittest.TestCase): + def setUp(self): + self.temp_dir = tempfile.TemporaryDirectory() + self.addCleanup(self.temp_dir.cleanup) + base = Path(self.temp_dir.name) + self.home = base / "home" + self.home.mkdir() + self.bin_dir = base / "bin" + self.bin_dir.mkdir() + self.plugin_root = base / "plugin with spaces" + shutil.copytree(ROOT / "hooks", self.plugin_root / "hooks") + shutil.copytree(ROOT / "skills", self.plugin_root / "skills") + self.config_dir = base / "claude config" + self.config_dir.mkdir() + self.flag = self.config_dir / ".i-have-adhd-always" + self.log = self.home / ".local" / "state" / "i-have-adhd" / "decisions.log" + + def fake_ps(self, line, comm=None): + path = self.bin_dir / "ps" + if comm is None: + parts = line.strip().split() + comm = parts[1] if len(parts) > 1 else "" + script = f"""#!/bin/sh +for arg in "$@"; do + case "$arg" in + *comm=*) + printf '%s\\n' {json.dumps(comm)} + exit 0 + ;; + esac +done +printf '%s\\n' {json.dumps(line)} +""" + path.write_text(script) + path.chmod(0o755) + + def env(self, **overrides): + env = os.environ.copy() + for key in ("I_HAVE_ADHD", "I_HAVE_ADHD_LOG", "CLAUDE_CODE_SESSION_ATTENDED"): + env.pop(key, None) + env.update( + { + "HOME": str(self.home), + "USERPROFILE": str(self.home), + "PATH": str(self.bin_dir) + os.pathsep + env.get("PATH", ""), + "CLAUDE_CONFIG_DIR": str(self.config_dir), + "CLAUDE_PLUGIN_ROOT": str(self.plugin_root), + "PLUGIN_ROOT": str(self.plugin_root), + } + ) + env.update(overrides) + return env + + def hook(self): + path = ROOT / "hooks" / "hooks.codex.json" + self.assertTrue(path.is_file(), "hooks/hooks.codex.json is missing") + return json.loads(path.read_text())["hooks"]["SessionStart"][0]["hooks"][0] + + def run_hook(self, **overrides): + return subprocess.run( + self.hook()["command"], + check=False, + capture_output=True, + env=self.env(**overrides), + input=json.dumps( + { + "session_id": "test-session", + "cwd": str(self.plugin_root), + "hook_event_name": "SessionStart", + "source": "startup", + } + ).encode("utf8"), + shell=True, + ) + + def payload(self, result): + return json.loads(result.stdout.decode("utf8")) + + def opt_in(self, contents=""): + self.flag.write_text(contents) + + def managed_daemon(self): + self.fake_ps("1 codex app-server --managed-daemon") + + def test_codex_receives_the_complete_context_in_a_json_envelope(self): + self.opt_in() + self.managed_daemon() + + result = self.run_hook() + + self.assertEqual(0, result.returncode, result.stderr) + payload = self.payload(result) + output = payload["hookSpecificOutput"] + self.assertEqual("SessionStart", output["hookEventName"]) + header = ( + "ADHD MODE ACTIVE (always-on). The ruleset below applies to every " + 'response. "stop adhd mode" turns it off for this session; delete ' + f"{self.flag} to turn always-on off for good." + ) + expected = header + "\n\n" + skill_body( + self.plugin_root / "skills" / "i-have-adhd" / "SKILL.md" + ) + self.assertEqual(expected, output["additionalContext"]) + self.assertNotIn("systemMessage", payload) + + def test_codex_preserves_crlf_skill_bytes_in_additional_context(self): + self.opt_in() + self.managed_daemon() + skill = self.plugin_root / "skills" / "i-have-adhd" / "SKILL.md" + skill.write_bytes( + b"---\r\nname: fixture\r\n---\r\nFixture line one.\r\nFixture line two.\r\n\r\n" + ) + + result = self.run_hook() + + self.assertEqual(0, result.returncode, result.stderr) + additional = self.payload(result)["hookSpecificOutput"]["additionalContext"] + self.assertTrue(additional.endswith("\r\nFixture line two."), repr(additional[-60:])) + self.assertNotIn("Fixture line one.\nFixture", additional) + + def test_codex_exec_is_silent(self): + self.opt_in() + self.fake_ps("1 codex exec do the thing") + + result = self.run_hook() + + self.assertEqual(0, result.returncode, result.stderr) + self.assertEqual(b"", result.stdout) + + def test_codex_global_flags_exec_is_silent(self): + self.opt_in() + self.fake_ps("1 codex --yolo exec do the thing") + + result = self.run_hook() + + self.assertEqual(0, result.returncode, result.stderr) + self.assertEqual(b"", result.stdout) + + def test_codex_unclear_returns_only_system_message(self): + self.opt_in() + self.fake_ps("1 /bin/zsh -l") + + result = self.run_hook() + + self.assertEqual(0, result.returncode, result.stderr) + self.assertEqual({"systemMessage": NOTICE}, self.payload(result)) + + def test_codex_parent_executable_with_spaces_classifies(self): + self.opt_in() + self.fake_ps( + "1 /Applications/Custom Codex/bin/codex app-server --managed-daemon", + comm="/Applications/Custom Codex/bin/codex", + ) + + result = self.run_hook() + + self.assertEqual(0, result.returncode, result.stderr) + payload = self.payload(result) + self.assertIn("additionalContext", payload["hookSpecificOutput"]) + self.assertIn("ADHD MODE ACTIVE", payload["hookSpecificOutput"]["additionalContext"]) + + def test_non_codex_parent_executable_with_spaces_stays_unclear(self): + self.opt_in() + self.fake_ps( + "1 /Applications/Custom Tool/bin/tool some-arg", + comm="/Applications/Custom Tool/bin/tool", + ) + + result = self.run_hook() + + self.assertEqual(0, result.returncode, result.stderr) + self.assertEqual({"systemMessage": NOTICE}, self.payload(result)) + + def test_codex_opt_out_wins_over_managed_daemon(self): + self.opt_in() + self.managed_daemon() + + result = self.run_hook(I_HAVE_ADHD="0") + + self.assertEqual(0, result.returncode, result.stderr) + self.assertEqual(b"", result.stdout) + + def test_codex_is_silent_without_opt_in(self): + self.managed_daemon() + + result = self.run_hook() + + self.assertEqual(0, result.returncode, result.stderr) + self.assertEqual(b"", result.stdout) + self.assertFalse(self.log.exists()) + self.assertFalse((self.home / ".local").exists()) + + def test_codex_is_silent_when_skill_is_missing(self): + self.opt_in() + self.managed_daemon() + shutil.rmtree(self.plugin_root / "skills") + + result = self.run_hook() + + self.assertEqual(0, result.returncode, result.stderr) + self.assertEqual(b"", result.stdout) + + def test_codex_is_silent_when_plugin_is_missing(self): + self.opt_in() + self.managed_daemon() + + result = self.run_hook(CLAUDE_PLUGIN_ROOT="/nonexistent", PLUGIN_ROOT="/nonexistent") + + self.assertEqual(0, result.returncode, result.stderr) + self.assertEqual(b"", result.stdout) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_install_docs.py b/tests/test_install_docs.py index 9515bba1..4fdcf6d9 100644 --- a/tests/test_install_docs.py +++ b/tests/test_install_docs.py @@ -13,16 +13,16 @@ def test_marketplace_refresh_is_paired_with_plugin_update(self): # `claude plugin marketplace update` refreshes only the marketplace # listing; the installed copy stays at its old version until # `claude plugin update` runs, so the docs must never offer the first alone. - refresh = "claude plugin marketplace update i-have-adhd" - update = "claude plugin update i-have-adhd@i-have-adhd" + refresh = re.compile(r"claude plugin marketplace update (?P[a-z0-9-]+)") translations = sorted((ROOT / ".github/install").glob("INSTALL.*.md")) self.assertTrue(translations, "No translated installation guides found") for path in [ROOT / "INSTALL.md", *translations]: with self.subTest(file=path.name): text = path.read_text(encoding="utf8") - self.assertIn(update, text) + self.assertRegex(text, r"claude plugin update i-have-adhd@[a-z0-9-]+") for block in re.split(r"\n[^\S\n]*\n", text): - if refresh in block: + for match in refresh.finditer(block): + update = f"claude plugin update i-have-adhd@{match.group('name')}" self.assertIn(update, block) @@ -57,7 +57,10 @@ def test_grok_install_commands(self): self.assertIn("

", section) section = section.split("
", 1)[0] - self.assertIn("grok plugin install ayghri/i-have-adhd --trust", section) + self.assertRegex( + section, + r"grok plugin install (?:ayghri|flyingnobita)/i-have-adhd --trust", + ) self.assertIn("grok plugin enable i-have-adhd", section) self.assertIn("grok plugin update i-have-adhd", section) self.assertIn("grok plugin uninstall i-have-adhd --confirm", section) @@ -67,5 +70,120 @@ def test_grok_install_commands(self): self.assertNotIn("~/.claude/.i-have-adhd-always", section) +class ForkInstallDocsTest(unittest.TestCase): + def test_install_docs_cover_opt_out_codex_trust_and_opencode_exception(self): + readme = (ROOT / "README.md").read_text(encoding="utf8") + install = (ROOT / "INSTALL.md").read_text(encoding="utf8") + notice = ( + "i-have-adhd: couldn't tell if a human is reading; rules not loaded. " + "Run /i-have-adhd to turn them on." + ) + + self.assertIn("## Why this fork exists", readme) + self.assertIn("Original README (upstream ayghri/i-have-adhd)", readme) + self.assertIn("| Agent | Human | Non-human | Unclear |", readme) + for row in ( + "| Claude | `CLAUDE_CODE_SESSION_ATTENDED=1` | `CLAUDE_CODE_SESSION_ATTENDED=0` | unset or malformed |", + "| Codex | parent `codex app-server ... --managed-daemon` | parent `codex exec` (or `e`) | any other parent |", + "| Pi | `mode=tui` | `mode=print` or `mode=json` | `mode=rpc` or missing/malformed signals |", + "| omp | `kind=main` and `mode=tui` | `kind=sub`, `mode=print`, or `mode=json` | main `mode=rpc` or missing/malformed signals |", + "| OpenCode | top-level session (assumed human) | any `parentID` subagent | the session lookup fails or returns no session, the session ID is missing, or the `parentID` is malformed |", + ): + self.assertIn(row, readme) + for required in ( + notice, + "~/.local/state/i-have-adhd/decisions.log", + "I_HAVE_ADHD_LOG=1", + "I_HAVE_ADHD=0", + 'herdr pane run "export I_HAVE_ADHD=0"', + "Orca", + "scope clause", + "assumed human", + ): + self.assertIn(required, readme) + + for command in ( + "claude plugin uninstall i-have-adhd", + "claude plugin marketplace remove i-have-adhd", + "codex plugin remove i-have-adhd", + "codex plugin marketplace remove i-have-adhd", + "omp plugin uninstall --scope user i-have-adhd@i-have-adhd", + "omp plugin marketplace remove i-have-adhd", + "claude plugin marketplace add flyingnobita/i-have-adhd", + "claude plugin install i-have-adhd@flyingnobita-i-have-adhd", + "codex plugin marketplace add flyingnobita/i-have-adhd --ref main", + "codex plugin add i-have-adhd@flyingnobita-i-have-adhd", + "omp plugin marketplace add flyingnobita/i-have-adhd", + "omp plugin install --scope user i-have-adhd@flyingnobita-i-have-adhd", + ): + self.assertIn(command, install) + for required in ( + "uninstall upstream first", + "same skill name", + "Node.js", + "trust", + "top-level", + "parentID", + "V1", + "assumed human", + "~/.pi/agent/.i-have-adhd-always", + "I_HAVE_ADHD=0", + "I_HAVE_ADHD_LOG=1", + "~/.local/state/i-have-adhd/decisions.log", + ): + self.assertIn(required, install) + + for route in ( + "Antigravity", + "AstronClaw", + "Claude Code", + "Codex", + "Grok", + "Gemini CLI", + "GitHub Copilot", + "Hermes", + "Kimi Code CLI", + "OpenCode", + "Pi", + "Oh My Pi (OMP)", + "Qwen Code", + "Zed", + "Cursor, Amp, and any other agent-skills harness", + ): + self.assertIn(route, install) + + def test_translations_point_to_fork_and_link_english_gating_docs(self): + readmes = sorted((ROOT / ".github/readme").glob("README.*.md")) + installs = sorted((ROOT / ".github/install").glob("INSTALL.*.md")) + self.assertEqual(11, len(readmes)) + self.assertEqual(8, len(installs)) + + for path in readmes: + with self.subTest(file=path.name): + text = path.read_text(encoding="utf8") + self.assertIn("../../README.md#why-this-fork-exists", text) + self.assertIn("flyingnobita/i-have-adhd", text) + historical = re.sub( + r"https://github\.com/ayghri/i-have-adhd/(?:issues|pull)/\d+", + "", + text, + ) + self.assertNotIn("ayghri/i-have-adhd", historical) + + for path in installs: + with self.subTest(file=path.name): + text = path.read_text(encoding="utf8") + self.assertIn("../../INSTALL.md#fork-installation-notes", text) + self.assertIn("flyingnobita/i-have-adhd", text) + self.assertIn("i-have-adhd@flyingnobita-i-have-adhd", text) + self.assertNotIn("i-have-adhd@i-have-adhd", text) + historical = re.sub( + r"https://github\.com/ayghri/i-have-adhd/(?:issues|pull)/\d+", + "", + text, + ) + self.assertNotIn("ayghri/i-have-adhd", historical) + + if __name__ == "__main__": unittest.main() diff --git a/tests/test_opencode_plugin.py b/tests/test_opencode_plugin.py index a4ddd7f0..d381137d 100644 --- a/tests/test_opencode_plugin.py +++ b/tests/test_opencode_plugin.py @@ -27,13 +27,27 @@ def setUp(self): self.plugin_root = Path(self.temp_dir.name).resolve() / "plugin" shutil.copytree(ROOT / ".opencode", self.plugin_root / ".opencode") shutil.copytree(ROOT / "skills", self.plugin_root / "skills") + shutil.copytree(ROOT / "hooks", self.plugin_root / "hooks") # The plugin reads its flag from $XDG_CONFIG_HOME/opencode/.i-have-adhd-always. self.config_dir = Path(self.temp_dir.name) / "config" (self.config_dir / "opencode").mkdir(parents=True) + self.home_dir = Path(self.temp_dir.name) / "home" + self.home_dir.mkdir() + self.log = self.home_dir / ".local" / "state" / "i-have-adhd" / "decisions.log" - def run_plugin(self, mode=None, config=None): + def run_plugin(self, mode=None, options=None, extra_env=None): env = os.environ.copy() - env["XDG_CONFIG_HOME"] = str(self.config_dir) + for key in ("I_HAVE_ADHD", "I_HAVE_ADHD_LOG"): + env.pop(key, None) + env.update( + { + "HOME": str(self.home_dir), + "USERPROFILE": str(self.home_dir), + "XDG_CONFIG_HOME": str(self.config_dir), + "XDG_STATE_HOME": str(self.home_dir / "state"), + } + ) + env.update(extra_env or {}) args = [ "node", str(ROOT / "tests" / "opencode_plugin_driver.mjs"), @@ -41,8 +55,8 @@ def run_plugin(self, mode=None, config=None): ] if mode: args.append(mode) - if config is not None: - args.append(json.dumps(config)) + if options is not None: + args.append(json.dumps(options)) return subprocess.run( args, check=False, @@ -51,6 +65,34 @@ def run_plugin(self, mode=None, config=None): env=env, ) + def context(self, mode, extra_env=None, **options): + if "sessionID" not in options: + options["sessionID"] = "ses_default" + elif options["sessionID"] is None: + del options["sessionID"] + result = self.run_plugin(mode, options or None, extra_env=extra_env) + self.assertEqual(0, result.returncode, result.stderr) + if result.stdout == "": + return {"system": "", "toasts": [], "lookups": 0} + payload = json.loads(result.stdout) + return { + "system": payload.get("system", ""), + "toasts": payload.get("toasts", []), + "lookups": payload.get("lookups", 0), + } + + def contexts(self, mode, calls, extra_env=None): + result = self.run_plugin(mode, calls, extra_env=extra_env) + self.assertEqual(0, result.returncode, result.stderr) + if result.stdout == "": + return {"systems": [], "toasts": [], "lookups": 0} + payload = json.loads(result.stdout) + return { + "systems": payload.get("systems", []), + "toasts": payload.get("toasts", []), + "lookups": payload.get("lookups", 0), + } + def opt_in(self): (self.config_dir / "opencode" / ".i-have-adhd-always").touch() @@ -65,40 +107,370 @@ def test_silent_without_opt_in_flag(self): result = self.run_plugin(mode) self.assertEqual(0, result.returncode, result.stderr) self.assertEqual("", result.stdout) + self.assertFalse(self.log.exists()) + self.assertFalse((self.home_dir / ".local").exists()) - def test_injects_ruleset_when_opted_in(self): + def test_top_level_sessions_inject_and_v1_shows_assumed_human_toast(self): + self.opt_in() + + v2 = self.context("context") + self.assertIn("ADHD MODE ACTIVE (always-on)", v2["system"]) + self.assertIn("Working memory is small", v2["system"]) + self.assertEqual([], v2["toasts"], "V2 has no toast call") + + v1 = self.context("v1-context") + self.assertEqual(v2["system"], v1["system"]) + self.assertEqual(1, len(v1["toasts"])) + self.assertIn("assumed human", v1["toasts"][0]) + + def test_repeated_transforms_in_same_session_toast_and_log_once(self): + self.opt_in() + res = self.contexts( + "v1-context", + [{"sessionID": "ses_repeat"}, {"sessionID": "ses_repeat"}], + extra_env={"I_HAVE_ADHD_LOG": "1"}, + ) + self.assertEqual(2, len(res["systems"])) + self.assertIn("ADHD MODE ACTIVE", res["systems"][0]) + self.assertIn("ADHD MODE ACTIVE", res["systems"][1]) + self.assertEqual(1, len(res["toasts"])) + self.assertIn("assumed human", res["toasts"][0]) + self.assertTrue(self.log.exists()) + log_lines = self.log.read_text().strip().splitlines() + self.assertEqual(1, len(log_lines)) + entry = json.loads(log_lines[0]) + self.assertEqual("opencode", entry["agent"]) + self.assertEqual("injected", entry["result"]) + + def test_distinct_sessions_get_independent_decisions(self): + self.opt_in() + res = self.contexts( + "v1-context", + [{"sessionID": "ses_a"}, {"sessionID": "ses_b"}], + extra_env={"I_HAVE_ADHD_LOG": "1"}, + ) + self.assertEqual(2, len(res["systems"])) + self.assertIn("ADHD MODE ACTIVE", res["systems"][0]) + self.assertIn("ADHD MODE ACTIVE", res["systems"][1]) + self.assertEqual(2, len(res["toasts"])) + self.assertTrue(self.log.exists()) + log_lines = self.log.read_text().strip().splitlines() + self.assertEqual(2, len(log_lines)) + + def test_interleaved_sessions_maintain_distinct_caches(self): + self.opt_in() + res = self.contexts( + "v1-context", + [ + {"sessionID": "ses_1"}, + {"sessionID": "ses_2"}, + {"sessionID": "ses_1"}, + {"sessionID": "ses_2"}, + ], + extra_env={"I_HAVE_ADHD_LOG": "1"}, + ) + self.assertEqual(4, len(res["systems"])) + for sys in res["systems"]: + self.assertIn("ADHD MODE ACTIVE", sys) + self.assertEqual(2, len(res["toasts"])) + self.assertTrue(self.log.exists()) + log_lines = self.log.read_text().strip().splitlines() + self.assertEqual(2, len(log_lines)) + + def test_subagent_parent_id_skips_injection_and_toast(self): self.opt_in() for mode in INJECTION_MODES: with self.subTest(mode=mode): - result = self.run_plugin(mode) + result = self.context(mode, parentID="ses_parent") + self.assertEqual("", result["system"]) + self.assertEqual([], result["toasts"]) + + def test_subagent_session_lookup_skips_injection_and_toast(self): + self.opt_in() + for mode in INJECTION_MODES: + with self.subTest(mode=mode): + result = self.context( + mode, + sessionID="ses_child", + sessions={"ses_child": {"id": "ses_child", "parentID": "ses_parent"}}, + ) + self.assertEqual("", result["system"]) + self.assertEqual([], result["toasts"]) + + def test_lookup_error_fails_closed_as_unclear(self): + self.opt_in() + for mode in INJECTION_MODES: + with self.subTest(mode=mode): + result = self.context( + mode, + sessionID="ses_err", + failLookup=True, + ) + self.assertEqual("", result["system"]) + self.assertEqual([], result["toasts"]) + + def test_v1_session_get_resolving_error_fails_closed_as_unclear(self): + self.opt_in() + if self.log.exists(): + self.log.unlink() + res = self.context( + "v1-context", + sessionID="ses_v1_err_obj", + sessions={"ses_v1_err_obj": {"error": {"message": "Not found"}}}, + extra_env={"I_HAVE_ADHD_LOG": "1"}, + ) + self.assertEqual("", res["system"]) + self.assertEqual([], res["toasts"]) + self.assertTrue(self.log.exists()) + log_lines = self.log.read_text().strip().splitlines() + self.assertEqual(1, len(log_lines)) + entry = json.loads(log_lines[0]) + self.assertEqual("skipped-unclear", entry["result"]) + self.assertEqual("unknown", entry["signals"]["parentId"]) + + def test_v1_session_get_shapes_resolution(self): + self.opt_in() + sub_res = self.context( + "v1-context", + sessionID="ses_wrapped_child", + sessions={"ses_wrapped_child": {"data": {"id": "ses_wrapped_child", "parentID": "ses_parent"}}}, + ) + self.assertEqual("", sub_res["system"]) + self.assertEqual([], sub_res["toasts"]) + + top_res = self.context( + "v1-context", + sessionID="ses_wrapped_top", + sessions={"ses_wrapped_top": {"data": {"id": "ses_wrapped_top"}}}, + ) + self.assertIn("ADHD MODE ACTIVE", top_res["system"]) + self.assertEqual(1, len(top_res["toasts"])) + + for invalid_session in ({}, None): + with self.subTest(invalid=invalid_session): + invalid_res = self.context( + "v1-context", + sessionID="ses_invalid", + sessions={"ses_invalid": invalid_session}, + ) + self.assertEqual("", invalid_res["system"]) + self.assertEqual([], invalid_res["toasts"]) + + def test_lookup_runs_once_per_session_id_across_repeated_transforms(self): + self.opt_in() + res = self.contexts( + "v1-context", + [{"sessionID": "ses_repeat_lookup"}, {"sessionID": "ses_repeat_lookup"}], + extra_env={"I_HAVE_ADHD_LOG": "1"}, + ) + self.assertEqual(2, len(res["systems"])) + self.assertIn("ADHD MODE ACTIVE", res["systems"][0]) + self.assertIn("ADHD MODE ACTIVE", res["systems"][1]) + self.assertEqual(1, res.get("lookups")) + + def test_missing_session_id_is_unclear_and_logs_once(self): + self.opt_in() + for mode in INJECTION_MODES: + with self.subTest(mode=mode): + if self.log.exists(): + self.log.unlink() + res = self.contexts( + mode, + [{"sessionID": None}, {"sessionID": None}], + extra_env={"I_HAVE_ADHD_LOG": "1"}, + ) + self.assertEqual(2, len(res["systems"])) + self.assertEqual("", res["systems"][0]) + self.assertEqual("", res["systems"][1]) + self.assertEqual([], res["toasts"]) + self.assertTrue(self.log.exists()) + log_lines = self.log.read_text().strip().splitlines() + self.assertEqual(1, len(log_lines)) + entry = json.loads(log_lines[0]) + self.assertEqual("skipped-unclear", entry["result"]) + self.assertEqual("unknown", entry["signals"]["parentId"]) + + def test_session_deleted_evicts_cache_entry(self): + self.opt_in() + for mode in INJECTION_MODES: + with self.subTest(mode=mode): + steps = [ + {"type": "transform", "call": {"sessionID": "ses_evict"}}, + { + "type": "event", + "event": { + "type": "session.deleted", + "data": {"sessionID": "ses_evict"}, + "properties": {"info": {"id": "ses_evict"}}, + }, + }, + {"type": "transform", "call": {"sessionID": "ses_evict"}}, + ] + res = self.run_plugin(mode, {"steps": steps}) + self.assertEqual(0, res.returncode, res.stderr) + payload = json.loads(res.stdout) + self.assertEqual(2, len(payload["systems"])) + self.assertIn("ADHD MODE ACTIVE", payload["systems"][0]) + self.assertIn("ADHD MODE ACTIVE", payload["systems"][1]) + self.assertEqual(2, payload.get("lookups")) + + def test_v2_async_stream_evicts_cache_entry(self): + self.opt_in() + steps = [ + {"type": "transform", "call": {"sessionID": "ses_v2_evict"}}, + { + "type": "event", + "event": { + "type": "session.deleted", + "data": {"sessionID": "ses_v2_evict"}, + }, + }, + {"type": "transform", "call": {"sessionID": "ses_v2_evict"}}, + ] + res = self.run_plugin("context", {"steps": steps}) + self.assertEqual(0, res.returncode, res.stderr) + payload = json.loads(res.stdout) + self.assertEqual(2, len(payload["systems"])) + self.assertIn("ADHD MODE ACTIVE", payload["systems"][0]) + self.assertIn("ADHD MODE ACTIVE", payload["systems"][1]) + self.assertEqual(2, payload.get("lookups")) + + def test_real_v2_session_deleted_envelope_evicts_cache(self): + self.opt_in() + steps = [ + {"type": "transform", "call": {"sessionID": "ses_v2_real"}}, + { + "type": "event", + "event": { + "id": "evt_1c4d305de001N54WlhS9KdELuF", + "created": 1794303526366, + "type": "session.deleted", + "durable": {"aggregateID": "ses_v2_real", "seq": 13, "version": 2}, + "data": {"sessionID": "ses_v2_real"}, + }, + }, + {"type": "transform", "call": {"sessionID": "ses_v2_real"}}, + ] + res = self.run_plugin("context", {"steps": steps}) + self.assertEqual(0, res.returncode, res.stderr) + payload = json.loads(res.stdout) + self.assertEqual(2, len(payload["systems"])) + self.assertIn("ADHD MODE ACTIVE", payload["systems"][0]) + self.assertIn("ADHD MODE ACTIVE", payload["systems"][1]) + self.assertEqual(2, payload.get("lookups")) + + def test_event_with_only_event_id_evicts_nothing(self): + self.opt_in() + steps = [ + {"type": "transform", "call": {"sessionID": "evt_only_no_session"}}, + { + "type": "event", + "event": { + "id": "evt_only_no_session", + "type": "session.deleted", + }, + }, + {"type": "transform", "call": {"sessionID": "evt_only_no_session"}}, + ] + res = self.run_plugin("context", {"steps": steps}) + self.assertEqual(0, res.returncode, res.stderr) + payload = json.loads(res.stdout) + self.assertEqual(2, len(payload["systems"])) + self.assertEqual(1, payload.get("lookups")) + + def test_v1_session_deleted_shape_evicts_cache(self): + self.opt_in() + steps = [ + {"type": "transform", "call": {"sessionID": "ses_v1_info"}}, + { + "type": "event", + "event": { + "type": "session.deleted", + "properties": {"info": {"id": "ses_v1_info"}}, + }, + }, + {"type": "transform", "call": {"sessionID": "ses_v1_info"}}, + ] + res = self.run_plugin("v1-context", {"steps": steps}) + self.assertEqual(0, res.returncode, res.stderr) + payload = json.loads(res.stdout) + self.assertEqual(2, len(payload["systems"])) + self.assertIn("ADHD MODE ACTIVE", payload["systems"][0]) + self.assertIn("ADHD MODE ACTIVE", payload["systems"][1]) + self.assertEqual(2, payload.get("lookups")) + + def test_aggregate_id_evicts_cache_only_when_starting_with_ses(self): + self.opt_in() + # Case 1: aggregateID starting with ses_ evicts + steps_match = [ + {"type": "transform", "call": {"sessionID": "ses_agg_1"}}, + { + "type": "event", + "event": { + "type": "session.deleted", + "durable": {"aggregateID": "ses_agg_1"}, + }, + }, + {"type": "transform", "call": {"sessionID": "ses_agg_1"}}, + ] + res = self.run_plugin("context", {"steps": steps_match}) + self.assertEqual(0, res.returncode, res.stderr) + payload = json.loads(res.stdout) + self.assertEqual(2, payload.get("lookups")) + + # Case 2: aggregateID not starting with ses_ does not evict + steps_no_match = [ + {"type": "transform", "call": {"sessionID": "ses_keep"}}, + { + "type": "event", + "event": { + "type": "session.deleted", + "durable": {"aggregateID": "user_123"}, + }, + }, + {"type": "transform", "call": {"sessionID": "ses_keep"}}, + ] + res = self.run_plugin("context", {"steps": steps_no_match}) + self.assertEqual(0, res.returncode, res.stderr) + payload = json.loads(res.stdout) + self.assertEqual(1, payload.get("lookups")) + + def test_opt_out_wins_over_top_level_assumption(self): + self.opt_in() + for mode in INJECTION_MODES: + with self.subTest(mode=mode): + result = self.run_plugin(mode, extra_env={"I_HAVE_ADHD": "0"}) self.assertEqual(0, result.returncode, result.stderr) - self.assertIn("ADHD MODE ACTIVE (always-on)", result.stdout) - self.assertIn("Working memory is small", result.stdout) + self.assertEqual("", result.stdout) + + def test_injects_ruleset_when_opted_in(self): + self.opt_in() + for mode in INJECTION_MODES: + with self.subTest(mode=mode): + result = self.context(mode) + self.assertIn("ADHD MODE ACTIVE (always-on)", result["system"]) + self.assertIn("Working memory is small", result["system"]) def test_strips_frontmatter_with_trailing_whitespace(self): self.write_skill("--- \nname: fixture\n--- \t\nFixture body.\n") self.opt_in() for mode in INJECTION_MODES: with self.subTest(mode=mode): - result = self.run_plugin(mode) - self.assertEqual(0, result.returncode, result.stderr) - self.assertNotIn("name: fixture", result.stdout) - self.assertIn("\n\nFixture body.", result.stdout) + result = self.context(mode) + self.assertNotIn("name: fixture", result["system"]) + self.assertIn("\n\nFixture body.", result["system"]) def test_keeps_content_when_frontmatter_is_unclosed(self): self.write_skill("---\nname: fixture\nFixture body, fence never closed.\n") self.opt_in() for mode in INJECTION_MODES: with self.subTest(mode=mode): - result = self.run_plugin(mode) - self.assertEqual(0, result.returncode, result.stderr) - self.assertIn("Fixture body, fence never closed.", result.stdout) + result = self.context(mode) + self.assertIn("Fixture body, fence never closed.", result["system"]) def test_both_apis_share_the_same_injected_text(self): self.opt_in() - v2 = self.run_plugin("context").stdout - v1 = self.run_plugin("v1-context").stdout - self.assertEqual(v2, v1) + self.assertEqual(self.context("context")["system"], self.context("v1-context")["system"]) # --- V2 registration --- @@ -214,6 +586,8 @@ def test_js_mirror_reexports_the_implementation(self): self.assertTrue(impl.is_file()) env = os.environ.copy() + env["HOME"] = str(self.home_dir) + env["USERPROFILE"] = str(self.home_dir) env["XDG_CONFIG_HOME"] = str(self.config_dir) script = ( "const a = (await import(process.argv[1])).default;" diff --git a/tests/test_release_metadata.py b/tests/test_release_metadata.py new file mode 100644 index 00000000..d941030b --- /dev/null +++ b/tests/test_release_metadata.py @@ -0,0 +1,91 @@ +"""Release metadata checks for the standalone fork.""" + +import json +import pathlib +import unittest + + +ROOT = pathlib.Path(__file__).resolve().parents[1] +RUNTIME_MANIFESTS = ( + ".claude-plugin/plugin.json", + ".codex-plugin/plugin.json", + "package.json", + "kimi.plugin.json", + "gemini-extension.json", + "qwen-extension.json", + "plugin.json", +) + + +class ReleaseMetadataTest(unittest.TestCase): + def test_all_runtime_manifests_use_version_0_5_0(self): + for relative_path in RUNTIME_MANIFESTS: + with self.subTest(manifest=relative_path): + manifest = json.loads((ROOT / relative_path).read_text(encoding="utf8")) + self.assertEqual("0.5.0", manifest["version"]) + + def test_fork_metadata_preserves_skill_and_plugin_names(self): + manifests = { + path: json.loads((ROOT / path).read_text(encoding="utf8")) + for path in RUNTIME_MANIFESTS + } + for path, manifest in manifests.items(): + with self.subTest(manifest=path): + self.assertEqual("i-have-adhd", manifest["name"]) + + claude_marketplace = json.loads( + (ROOT / ".claude-plugin/marketplace.json").read_text(encoding="utf8") + ) + codex_marketplace = json.loads( + (ROOT / ".agents/plugins/marketplace.json").read_text(encoding="utf8") + ) + for marketplace in (claude_marketplace, codex_marketplace): + self.assertEqual("flyingnobita-i-have-adhd", marketplace["name"]) + for plugin in marketplace["plugins"]: + self.assertEqual("i-have-adhd", plugin["name"]) + + self.assertEqual("flyingnobita", claude_marketplace["owner"]["name"]) + self.assertEqual( + "flyingnobita", manifests[".claude-plugin/plugin.json"]["author"]["name"] + ) + self.assertEqual( + "https://github.com/flyingnobita", + manifests[".claude-plugin/plugin.json"]["author"]["url"], + ) + self.assertEqual( + "https://github.com/flyingnobita/i-have-adhd.git", + codex_marketplace["plugins"][0]["source"]["url"], + ) + for path in ("package.json", "kimi.plugin.json", ".codex-plugin/plugin.json"): + self.assertEqual( + "https://github.com/flyingnobita/i-have-adhd", + manifests[path]["homepage"], + ) + for field in ("name", "version", "description", "license", "homepage"): + self.assertEqual(manifests["package.json"][field], manifests["kimi.plugin.json"][field]) + + readme = (ROOT / "README.md").read_text(encoding="utf8") + license_text = (ROOT / "LICENSE").read_text(encoding="utf8") + self.assertIn("Ayoub G.", readme) + self.assertIn("original author", readme) + self.assertIn("Copyright (c) 2026 Ayoub Ghriss", license_text) + self.assertRegex(license_text, r"fork.*flyingnobita|flyingnobita.*fork") + + changelog_path = ROOT / "CHANGELOG.md" + self.assertTrue(changelog_path.is_file(), "CHANGELOG.md is missing") + changelog = changelog_path.read_text(encoding="utf8") + self.assertRegex( + changelog, + r"(?m)^- Nov-10, 2026 - \d{2}:\d{2} [AP]M \+08 - .*0\.5\.0", + ) + self.assertIn("five new eval cases", changelog) + self.assertIn("no-regression gate", changelog) + + for path in ("AGENTS.md", "CONTRIBUTING.md"): + text = (ROOT / path).read_text(encoding="utf8") + self.assertIn("flyingnobita/i-have-adhd", text) + self.assertNotIn("## AI Agora discussions", (ROOT / "AGENTS.md").read_text(encoding="utf8")) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_run_evals.py b/tests/test_run_evals.py index 2efc853c..345361f0 100644 --- a/tests/test_run_evals.py +++ b/tests/test_run_evals.py @@ -24,6 +24,25 @@ def test_case_catalog_is_valid_and_balanced(self): self.assertGreaterEqual(len({case["category"] for case in cases}), 8) + def test_human_session_gating_cases_are_present(self): + cases = { + case["id"]: case + for case in run_evals.load_cases(ROOT / "evals" / "cases.jsonl") + } + expected = { + "grilling-full-round": ("instruction-precedence", "medium"), + "seven-host-report": ("instruction-precedence", "medium"), + "code-review-closing-summary": ("instruction-precedence", "medium"), + "worker-orchestrator-report": ("worker-report", "medium"), + "memory-credit-notice": ("harness-contract", "low"), + } + + for case_id, (category, risk) in expected.items(): + self.assertIn(case_id, cases) + self.assertEqual(category, cases[case_id]["category"]) + self.assertEqual(risk, cases[case_id]["risk"]) + self.assertTrue(cases[case_id]["criteria"]) + def test_parse_response_tolerates_output_after_the_json_document(self): """The CLI can emit a notice after its JSON result; the first document still wins.""" payload = json.dumps( diff --git a/tests/test_session_kind.py b/tests/test_session_kind.py new file mode 100644 index 00000000..84a4a294 --- /dev/null +++ b/tests/test_session_kind.py @@ -0,0 +1,303 @@ +import json +import os +import shutil +import subprocess +import tempfile +import unittest +from datetime import datetime +from pathlib import Path + + +ROOT = Path(__file__).resolve().parents[1] +MODULE = ROOT / "hooks" / "session-kind.mjs" +NOTICE = ( + "i-have-adhd: couldn't tell if a human is reading; rules not loaded. " + "Run /i-have-adhd to turn them on." +) + +CALL_MODULE = """ +const mod = await import(process.argv[1]); +const request = JSON.parse(process.argv[2]); +process.stdout.write(JSON.stringify(mod[request.fn](request.args))); +""" + + +@unittest.skipUnless(shutil.which("node"), "node is required for the shared module") +class SessionKindTest(unittest.TestCase): + def call(self, fn, args): + result = subprocess.run( + ["node", "--input-type=module", "-e", CALL_MODULE, MODULE.as_uri(), json.dumps({"fn": fn, "args": args})], + check=False, + capture_output=True, + text=True, + cwd=ROOT, + ) + self.assertEqual(0, result.returncode, result.stderr) + return json.loads(result.stdout) + + def classify(self, **kwargs): + kwargs.setdefault("env", {}) + return self.call("classifySession", kwargs) + + def test_opt_out_wins_before_agent_specific_signals(self): + human_signals = { + "claude": {"env": {"I_HAVE_ADHD": "0", "CLAUDE_CODE_SESSION_ATTENDED": "1"}}, + "codex": {"env": {"I_HAVE_ADHD": "0"}, "parent": ["codex", "app-server", "--managed-daemon"]}, + "pi": {"env": {"I_HAVE_ADHD": "0"}, "ctx": {"mode": "tui"}}, + "omp": {"env": {"I_HAVE_ADHD": "0"}, "ctx": {"mode": "tui", "agent": {"kind": "main"}}}, + "opencode": {"env": {"I_HAVE_ADHD": "0"}, "ctx": {}}, + } + for agent, signals in human_signals.items(): + with self.subTest(agent=agent): + result = self.classify(agent=agent, **signals) + self.assertEqual("opt-out", result["decision"]) + self.assertEqual({}, result["signals"]) + + def test_claude_attendance_mapping(self): + cases = { + "1": "human", + "0": "non-human", + None: "unclear", + "": "unclear", + "true": "unclear", + "2": "unclear", + } + for value, decision in cases.items(): + with self.subTest(attended=value): + env = {} if value is None else {"CLAUDE_CODE_SESSION_ATTENDED": value} + result = self.classify(agent="claude", env=env) + self.assertEqual(decision, result["decision"]) + self.assertTrue(result["reason"]) + self.assertIn("attended", result["signals"]) + + def test_codex_parent_argv_mapping(self): + cases = { + ("codex", "app-server", "--managed-daemon"): "human", + ("/usr/local/bin/codex", "app-server", "--managed-daemon", "--config", "x"): "human", + ("codex", "exec", "do the thing"): "non-human", + ("/opt/codex", "exec", "--json", "prompt"): "non-human", + ("codex", "--version"): "unclear", + ("codex",): "unclear", + ("node", "server.js"): "unclear", + (): "unclear", + } + for argv, decision in cases.items(): + with self.subTest(argv=argv): + result = self.classify(agent="codex", parent=list(argv)) + self.assertEqual(decision, result["decision"]) + self.assertTrue(result["reason"]) + self.assertIn("parent", result["signals"]) + self.assertNotIn("prompt", json.dumps(result["signals"])) + self.assertEqual( + "unclear", self.classify(agent="codex", parent=None)["decision"] + ) + + def test_codex_global_flags_before_subcommand(self): + cases = [ + (["codex", "--yolo", "exec", "do", "the", "thing"], "non-human"), + (["codex", "-c", "k=v", "exec", "do", "the", "thing"], "non-human"), + (["codex", "--config=k=v", "exec"], "non-human"), + (["codex", "--enable", "x", "app-server", "--managed-daemon"], "human"), + (["codex", "--yolo", "app-server"], "unclear"), + (["codex", "--yolo"], "unclear"), + (["codex", "-c"], "unclear"), + ] + for parent, expected in cases: + with self.subTest(parent=parent): + result = self.classify(agent="codex", parent=parent) + self.assertEqual(expected, result["decision"]) + + def test_codex_alias_e_is_non_human(self): + result = self.classify(agent="codex", parent=["codex", "e", "do the thing"]) + self.assertEqual("non-human", result["decision"]) + self.assertEqual("codex-exec", result["reason"]) + self.assertEqual({"parent": "exec"}, result["signals"]) + + def test_codex_local_provider_and_multivalue_images(self): + cases = [ + (["codex", "--oss", "--local-provider", "ollama", "exec"], "non-human"), + (["codex", "-i", "a.png", "b.png", "exec"], "non-human"), + (["codex", "--image", "a.png", "b.png", "app-server", "--managed-daemon"], "human"), + (["codex", "-i", "a.png", "b.png"], "unclear"), + ] + for parent, expected in cases: + with self.subTest(parent=parent): + result = self.classify(agent="codex", parent=parent) + self.assertEqual(expected, result["decision"]) + + def test_win32_process_fallback_drops_executable_token(self): + output = "1234\tC:\\Program Files\\codex\\codex.exe\tcodex app-server --managed-daemon" + parsed = self.call("parseWin32Process", output) + self.assertEqual( + ["C:\\Program Files\\codex\\codex.exe", "app-server", "--managed-daemon"], + parsed["argv"], + ) + result = self.classify(agent="codex", parent=parsed["argv"]) + self.assertEqual("human", result["decision"]) + + def test_pi_mode_mapping(self): + for mode, decision in {"tui": "human", "print": "non-human", "json": "non-human", "rpc": "unclear"}.items(): + with self.subTest(mode=mode): + result = self.classify(agent="pi", ctx={"mode": mode}) + self.assertEqual(decision, result["decision"]) + self.assertEqual(mode, result["signals"]["mode"]) + + def test_omp_kind_and_mode_mapping(self): + cases = { + ("main", "tui"): "human", + ("sub", "tui"): "non-human", + ("main", "print"): "non-human", + ("main", "json"): "non-human", + ("sub", "rpc"): "non-human", + ("main", "rpc"): "unclear", + (None, "tui"): "unclear", + } + for (kind, mode), decision in cases.items(): + with self.subTest(kind=kind, mode=mode): + agent = {} if kind is None else {"kind": kind} + result = self.classify(agent="omp", ctx={"mode": mode, "agent": agent}) + self.assertEqual(decision, result["decision"]) + self.assertEqual(mode, result["signals"]["mode"]) + + def test_opencode_parent_id_mapping(self): + self.assertEqual( + "human", self.classify(agent="opencode", ctx={})["decision"] + ) + self.assertEqual( + "non-human", + self.classify(agent="opencode", ctx={"parentID": "ses_parent"})["decision"], + ) + self.assertEqual( + "unclear", + self.classify(agent="opencode", ctx={"parentID": 42})["decision"], + ) + + def test_missing_or_malformed_signals_are_unclear(self): + for label, kwargs in { + "claude": {"agent": "claude"}, + "codex": {"agent": "codex"}, + "pi": {"agent": "pi"}, + "pi-null-ctx": {"agent": "pi", "ctx": None}, + "omp": {"agent": "omp"}, + "unknown": {"agent": "mystery"}, + }.items(): + with self.subTest(agent=label): + self.assertEqual("unclear", self.classify(**kwargs)["decision"]) + + self.assertEqual( + "unclear", self.classify(agent="pi", ctx={"mode": 3})["decision"] + ) + self.assertEqual( + "unclear", self.classify(agent="omp", ctx={"mode": "tui", "agent": {"kind": 1}})["decision"] + ) + + +@unittest.skipUnless(shutil.which("node"), "node is required for the shared module") +class DecisionLogTest(unittest.TestCase): + def setUp(self): + self.temp_dir = tempfile.TemporaryDirectory() + self.addCleanup(self.temp_dir.cleanup) + base = Path(self.temp_dir.name) + self.home = base / "home" + self.home.mkdir() + self.config_dir = base / "claude" + self.config_dir.mkdir() + self.flag = self.config_dir / ".i-have-adhd-always" + self.log = self.home / ".local" / "state" / "i-have-adhd" / "decisions.log" + + def env(self, **overrides): + env = os.environ.copy() + for key in ("I_HAVE_ADHD", "I_HAVE_ADHD_LOG", "CLAUDE_CODE_SESSION_ATTENDED"): + env.pop(key, None) + env.update( + { + "HOME": str(self.home), + "USERPROFILE": str(self.home), + "XDG_CONFIG_HOME": str(self.home / ".config"), + "XDG_STATE_HOME": str(self.home / "state"), + "CLAUDE_CONFIG_DIR": str(self.config_dir), + } + ) + env.update(overrides) + return env + + def run_hook(self, **env_overrides): + return subprocess.run( + ["node", str(ROOT / "hooks" / "always-on.mjs"), "--agent", "claude"], + check=False, + capture_output=True, + text=True, + env=self.env(**env_overrides), + cwd=ROOT, + ) + + def log_lines(self): + self.assertTrue(self.log.exists(), "no decision log was written") + return [json.loads(line) for line in self.log.read_text().splitlines()] + + def test_empty_home_without_flag_stays_silent_and_creates_no_log(self): + result = self.run_hook(CLAUDE_CODE_SESSION_ATTENDED="1") + self.assertEqual(0, result.returncode, result.stderr) + self.assertEqual("", result.stdout) + self.assertFalse(self.log.exists()) + self.assertFalse((self.home / ".local").exists()) + + def test_flag_log_line_and_env_enable_decision_logging(self): + self.flag.write_text("log\n") + result = self.run_hook(CLAUDE_CODE_SESSION_ATTENDED="1") + self.assertEqual(0, result.returncode, result.stderr) + self.assertTrue(self.log.exists(), "the flag's log line did not enable logging") + + self.flag.unlink() + self.log.unlink() + self.flag.write_text("") + result = self.run_hook(CLAUDE_CODE_SESSION_ATTENDED="1", I_HAVE_ADHD_LOG="1") + self.assertEqual(0, result.returncode, result.stderr) + self.assertTrue(self.log.exists(), "I_HAVE_ADHD_LOG=1 did not enable logging") + + self.log.unlink() + result = self.run_hook(CLAUDE_CODE_SESSION_ATTENDED="1") + self.assertEqual(0, result.returncode, result.stderr) + self.assertFalse(self.log.exists(), "logging must stay off by default") + + def test_log_lines_contain_timestamp_agent_signals_and_result(self): + self.flag.write_text("log\n") + self.run_hook(CLAUDE_CODE_SESSION_ATTENDED="1", SECRET_SENTINEL="do-not-log") + self.run_hook(CLAUDE_CODE_SESSION_ATTENDED="0", SECRET_SENTINEL="do-not-log") + self.run_hook(CLAUDE_CODE_SESSION_ATTENDED="not-a-signal") + self.run_hook(CLAUDE_CODE_SESSION_ATTENDED="1", I_HAVE_ADHD="0") + + lines = self.log_lines() + self.assertEqual( + ["injected", "skipped-non-human", "skipped-unclear", "skipped-optout"], + [line["result"] for line in lines], + ) + for line in lines: + self.assertEqual({"timestamp", "agent", "signals", "result"}, set(line)) + datetime.fromisoformat(line["timestamp"].replace("Z", "+00:00")) + self.assertEqual("claude", line["agent"]) + if line["result"] == "skipped-optout": + self.assertEqual({}, line["signals"]) + else: + self.assertEqual({"attended"}, set(line["signals"])) + self.assertNotIn("do-not-log", json.dumps(line)) + self.assertNotIn("SECRET_SENTINEL", json.dumps(line)) + + def test_log_write_failure_does_not_change_decision(self): + self.flag.write_text("log\n") + self.run_hook(CLAUDE_CODE_SESSION_ATTENDED="1") + self.assertTrue(self.log.exists(), "the enabled logger never wrote a line") + self.log.unlink() + shutil.rmtree(self.home / ".local" / "state") + (self.home / ".local" / "state").write_text("not a directory\n") + (self.home / ".local" / "state").write_text("not a directory\n") + + result = self.run_hook(CLAUDE_CODE_SESSION_ATTENDED="1") + + self.assertEqual(0, result.returncode, result.stderr) + self.assertIn("ADHD MODE ACTIVE (always-on)", result.stdout) + self.assertFalse(self.log.exists()) + + +if __name__ == "__main__": + unittest.main() From 8033e94747bd794848c6774d19f26587f2e0c63e Mon Sep 17 00:00:00 2001 From: flyingnobita <46126470+flyingnobita@users.noreply.github.com> Date: Tue, 10 Nov 2026 19:56:17 +0800 Subject: [PATCH 2/2] fix(codex): load always-on rules in the interactive TUI A plain `codex` parent has no subcommand, and codexParent() returned "" for it, so classifyCodex() fell through to unclear and the Codex TUI received only the notice instead of the ruleset. With `daemon_auto_start = false` no managed daemon exists, so the managed daemon signal never appears either. Classify the no-subcommand parent as the interactive TUI (reason codex-tui, signal parent=tui). `codex exec` and `e` stay non-human, and informational one-shots (`--help`, `--version`) or a value flag with a missing value stay unclear. Refs: #3 --- .claude-plugin/plugin.json | 2 +- .codex-plugin/plugin.json | 2 +- CHANGELOG.md | 3 +++ INSTALL.md | 2 +- README.md | 2 +- gemini-extension.json | 2 +- hooks/session-kind.mjs | 14 ++++++++++++++ kimi.plugin.json | 2 +- package.json | 2 +- plugin.json | 2 +- qwen-extension.json | 2 +- tests/test_install_docs.py | 2 +- tests/test_release_metadata.py | 6 +++--- tests/test_session_kind.py | 25 ++++++++++++++++++++++--- 14 files changed, 52 insertions(+), 16 deletions(-) diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index d33ed688..ec27e2b3 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "i-have-adhd", - "version": "0.5.0", + "version": "0.5.1", "description": "Shape Claude Code output for an ADHD reader: lead with the next action, number steps, suppress tangents, restate state, make wins visible. Always-on loads only in human sessions. Uninstall upstream first: both use the same skill name.", "author": { "name": "flyingnobita", diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.json index 5161da3e..4afa5632 100644 --- a/.codex-plugin/plugin.json +++ b/.codex-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "i-have-adhd", - "version": "0.5.0", + "version": "0.5.1", "description": "ADHD-friendly output shaping for Codex: action first, numbered steps, no tangents, and visible progress.", "author": { "name": "flyingnobita", diff --git a/CHANGELOG.md b/CHANGELOG.md index 5159a0eb..1fe7fcc2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +- Nov-10, 2026 - 07:55 PM +08 - Release 0.5.1 loads always-on rules in the Codex TUI: a plain `codex` parent with no subcommand is now a human session, while `codex exec` (or `e`) stays non-human. +- Nov-10, 2026 - 07:55 PM +08 - Treat a Codex parent with no subcommand as the interactive TUI, keeping `--help`, `--version`, and malformed flag tails unclear. + - Nov-10, 2026 - 05:50 PM +08 - Evict OpenCode session cache on the real V2 session.deleted envelope. - Nov-10, 2026 - 05:35 PM +08 - Drop redundant command token in Win32 fallback process parsing to correctly identify Codex parents. - Nov-10, 2026 - 05:30 PM +08 - Consume OpenCode V2 event stream to evict deleted sessions from cache. diff --git a/INSTALL.md b/INSTALL.md index 670dad36..5feb9947 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -265,7 +265,7 @@ The Codex hook requires Node.js and shares Claude's flag path. Opt in with: touch ~/.claude/.i-have-adhd-always ``` -Or create `.i-have-adhd-always` under `$CLAUDE_CONFIG_DIR`. Codex asks you to trust the structured hook on first run (trusting it on first run is the normal path, or you can pre-seed `trusted_hash` under `[hooks.state."i-have-adhd@flyingnobita-i-have-adhd:hooks/hooks.codex.json:session_start:0:0"]` in `~/.codex/config.toml` with the first `sha256:...` part of the app-server `hooks/list` `currentHash` before `/`). A managed app-server parent receives the complete rules; `codex exec` (or `e`) is silent; any other parent receives only the unclear-session notice. Delete the flag to return to explicit activation. +Or create `.i-have-adhd-always` under `$CLAUDE_CONFIG_DIR`. Codex asks you to trust the structured hook on first run (trusting it on first run is the normal path, or you can pre-seed `trusted_hash` under `[hooks.state."i-have-adhd@flyingnobita-i-have-adhd:hooks/hooks.codex.json:session_start:0:0"]` in `~/.codex/config.toml` with the first `sha256:...` part of the app-server `hooks/list` `currentHash` before `/`). A managed app-server parent, or the interactive TUI's plain `codex` parent with no subcommand, receives the complete rules; `codex exec` (or `e`) is silent; any other parent receives only the unclear-session notice. Delete the flag to return to explicit activation. diff --git a/README.md b/README.md index e74ea50e..80c51fb7 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Always-on remains opt-in through each agent's flag file or configuration. The au | Agent | Human | Non-human | Unclear | | --- | --- | --- | --- | | Claude | `CLAUDE_CODE_SESSION_ATTENDED=1` | `CLAUDE_CODE_SESSION_ATTENDED=0` | unset or malformed | -| Codex | parent `codex app-server ... --managed-daemon` | parent `codex exec` (or `e`) | any other parent | +| Codex | parent `codex app-server ... --managed-daemon`, or the interactive TUI's parent `codex` with no subcommand | parent `codex exec` (or `e`) | any other parent | | Pi | `mode=tui` | `mode=print` or `mode=json` | `mode=rpc` or missing/malformed signals | | omp | `kind=main` and `mode=tui` | `kind=sub`, `mode=print`, or `mode=json` | main `mode=rpc` or missing/malformed signals | | OpenCode | top-level session (assumed human) | any `parentID` subagent | the session lookup fails or returns no session, the session ID is missing, or the `parentID` is malformed | diff --git a/gemini-extension.json b/gemini-extension.json index 9c8d8ebf..a331a971 100644 --- a/gemini-extension.json +++ b/gemini-extension.json @@ -1,6 +1,6 @@ { "name": "i-have-adhd", - "version": "0.5.0", + "version": "0.5.1", "description": "Shape Gemini CLI output for an ADHD reader: lead with the next action, number steps, suppress tangents, restate state, make wins visible.", "contextFileName": "GEMINI.md" } diff --git a/hooks/session-kind.mjs b/hooks/session-kind.mjs index 5f733b2b..b58b67a1 100644 --- a/hooks/session-kind.mjs +++ b/hooks/session-kind.mjs @@ -56,6 +56,10 @@ const CODEX_VALUE_FLAGS = new Set([ "--remote-auth-token-env", ]); +// Informational one-shots never open a session, so a `codex` process carrying +// one of these is not the interactive TUI. +const CODEX_INFO_FLAGS = new Set(["-h", "--help", "-V", "-v", "--version"]); + const CODEX_SUBCOMMANDS = new Set([ "agents", "exec", @@ -117,6 +121,7 @@ function codexParent(parent) { } if (token.startsWith("-")) { if (CODEX_VALUE_FLAGS.has(token)) { + if (i + 1 >= parent.length) return null; i += 2; } else { i += 1; @@ -131,6 +136,15 @@ function codexParent(parent) { function classifyCodex(parent) { const subcommand = codexParent(parent); if (subcommand === null) return unclear("codex-parent-unknown", { parent: "unknown" }); + if (subcommand === "") { + if (parent.some((token) => CODEX_INFO_FLAGS.has(token))) { + return unclear("codex-parent-unknown", { parent: "unknown" }); + } + // `codex` with no subcommand opens the interactive TUI. With + // `daemon_auto_start = false` no managed daemon exists, so this argv is the + // only human signal an interactive session has. + return result("human", "codex-tui", { parent: "tui" }); + } if (subcommand === "app-server") { if (parent.includes("--managed-daemon")) { return result("human", "codex-managed-daemon", { parent: "app-server" }); diff --git a/kimi.plugin.json b/kimi.plugin.json index 4d94d2c3..ceda0e9e 100644 --- a/kimi.plugin.json +++ b/kimi.plugin.json @@ -1,6 +1,6 @@ { "name": "i-have-adhd", - "version": "0.5.0", + "version": "0.5.1", "description": "Shape output for a reader with ADHD: lead with the next action, number multi-step work, restate state across turns, suppress tangents, give specific time estimates, make wins visible.", "license": "MIT", "homepage": "https://github.com/flyingnobita/i-have-adhd", diff --git a/package.json b/package.json index 7035101f..ee3b396b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "i-have-adhd", - "version": "0.5.0", + "version": "0.5.1", "description": "Shape output for a reader with ADHD: lead with the next action, number multi-step work, restate state across turns, suppress tangents, give specific time estimates, make wins visible.", "license": "MIT", "homepage": "https://github.com/flyingnobita/i-have-adhd", diff --git a/plugin.json b/plugin.json index d8203a13..62ba5fd8 100644 --- a/plugin.json +++ b/plugin.json @@ -1,5 +1,5 @@ { "name": "i-have-adhd", - "version": "0.5.0", + "version": "0.5.1", "description": "Shape Antigravity output for an ADHD reader: lead with the next action, number steps, suppress tangents, restate state, make wins visible." } diff --git a/qwen-extension.json b/qwen-extension.json index 337c9e8d..13687616 100644 --- a/qwen-extension.json +++ b/qwen-extension.json @@ -1,6 +1,6 @@ { "name": "i-have-adhd", - "version": "0.5.0", + "version": "0.5.1", "description": "ADHD-friendly output shaping for Qwen Code: action first, numbered steps, no tangents, and visible progress.", "skills": "skills" } diff --git a/tests/test_install_docs.py b/tests/test_install_docs.py index 4fdcf6d9..e7e903c2 100644 --- a/tests/test_install_docs.py +++ b/tests/test_install_docs.py @@ -84,7 +84,7 @@ def test_install_docs_cover_opt_out_codex_trust_and_opencode_exception(self): self.assertIn("| Agent | Human | Non-human | Unclear |", readme) for row in ( "| Claude | `CLAUDE_CODE_SESSION_ATTENDED=1` | `CLAUDE_CODE_SESSION_ATTENDED=0` | unset or malformed |", - "| Codex | parent `codex app-server ... --managed-daemon` | parent `codex exec` (or `e`) | any other parent |", + "| Codex | parent `codex app-server ... --managed-daemon`, or the interactive TUI's parent `codex` with no subcommand | parent `codex exec` (or `e`) | any other parent |", "| Pi | `mode=tui` | `mode=print` or `mode=json` | `mode=rpc` or missing/malformed signals |", "| omp | `kind=main` and `mode=tui` | `kind=sub`, `mode=print`, or `mode=json` | main `mode=rpc` or missing/malformed signals |", "| OpenCode | top-level session (assumed human) | any `parentID` subagent | the session lookup fails or returns no session, the session ID is missing, or the `parentID` is malformed |", diff --git a/tests/test_release_metadata.py b/tests/test_release_metadata.py index d941030b..6295b6a6 100644 --- a/tests/test_release_metadata.py +++ b/tests/test_release_metadata.py @@ -18,11 +18,11 @@ class ReleaseMetadataTest(unittest.TestCase): - def test_all_runtime_manifests_use_version_0_5_0(self): + def test_all_runtime_manifests_use_version_0_5_1(self): for relative_path in RUNTIME_MANIFESTS: with self.subTest(manifest=relative_path): manifest = json.loads((ROOT / relative_path).read_text(encoding="utf8")) - self.assertEqual("0.5.0", manifest["version"]) + self.assertEqual("0.5.1", manifest["version"]) def test_fork_metadata_preserves_skill_and_plugin_names(self): manifests = { @@ -76,7 +76,7 @@ def test_fork_metadata_preserves_skill_and_plugin_names(self): changelog = changelog_path.read_text(encoding="utf8") self.assertRegex( changelog, - r"(?m)^- Nov-10, 2026 - \d{2}:\d{2} [AP]M \+08 - .*0\.5\.0", + r"(?m)^- Nov-10, 2026 - \d{2}:\d{2} [AP]M \+08 - .*0\.5\.1", ) self.assertIn("five new eval cases", changelog) self.assertIn("no-regression gate", changelog) diff --git a/tests/test_session_kind.py b/tests/test_session_kind.py index 84a4a294..0275aa37 100644 --- a/tests/test_session_kind.py +++ b/tests/test_session_kind.py @@ -77,7 +77,7 @@ def test_codex_parent_argv_mapping(self): ("codex", "exec", "do the thing"): "non-human", ("/opt/codex", "exec", "--json", "prompt"): "non-human", ("codex", "--version"): "unclear", - ("codex",): "unclear", + ("codex",): "human", ("node", "server.js"): "unclear", (): "unclear", } @@ -99,7 +99,7 @@ def test_codex_global_flags_before_subcommand(self): (["codex", "--config=k=v", "exec"], "non-human"), (["codex", "--enable", "x", "app-server", "--managed-daemon"], "human"), (["codex", "--yolo", "app-server"], "unclear"), - (["codex", "--yolo"], "unclear"), + (["codex", "--yolo"], "human"), (["codex", "-c"], "unclear"), ] for parent, expected in cases: @@ -113,12 +113,31 @@ def test_codex_alias_e_is_non_human(self): self.assertEqual("codex-exec", result["reason"]) self.assertEqual({"parent": "exec"}, result["signals"]) + def test_codex_interactive_tui_without_managed_daemon_is_human(self): + for parent in (["codex"], ["/usr/local/bin/codex"], ["codex", "--yolo"]): + with self.subTest(parent=parent): + result = self.classify(agent="codex", parent=parent) + self.assertEqual("human", result["decision"]) + self.assertEqual("codex-tui", result["reason"]) + self.assertEqual({"parent": "tui"}, result["signals"]) + + def test_codex_info_flags_stay_unclear(self): + for parent in ( + ["codex", "--help"], + ["codex", "-h"], + ["codex", "--version"], + ["codex", "-c"], + ): + with self.subTest(parent=parent): + result = self.classify(agent="codex", parent=parent) + self.assertEqual("unclear", result["decision"]) + def test_codex_local_provider_and_multivalue_images(self): cases = [ (["codex", "--oss", "--local-provider", "ollama", "exec"], "non-human"), (["codex", "-i", "a.png", "b.png", "exec"], "non-human"), (["codex", "--image", "a.png", "b.png", "app-server", "--managed-daemon"], "human"), - (["codex", "-i", "a.png", "b.png"], "unclear"), + (["codex", "-i", "a.png", "b.png"], "human"), ] for parent, expected in cases: with self.subTest(parent=parent):