From fac3285ca787bdf3aa97bc0a93ddaf9b7b5f45ef Mon Sep 17 00:00:00 2001 From: Jeffery Date: Mon, 24 Aug 2026 11:36:45 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat(learn):=20=E6=96=B0=E5=A2=9E=E6=8A=80?= =?UTF-8?q?=E8=83=BD=E6=95=99=E8=A8=93=E7=B4=80=E9=8C=84=E8=88=87=E6=9F=A5?= =?UTF-8?q?=E9=96=B1=E6=8A=80=E8=83=BD=E5=8F=8A=20LEARN=20wiki=20=E9=A0=81?= =?UTF-8?q?=E7=AF=84=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit What:新增 skills/learn/SKILL.md(record/consult 兩種模式)與 templates/learn-page.md、templates/learn-contents.md 兩份 wiki 頁範本。 Why:參考 oh-my-pi 的 learn 工具,讓技能執行後能把教訓沉澱下來、執行前能先查閱套用,避免同樣的問題重複發生。 How:教訓以六欄表格(日期、技能、CLI、情境、教訓、下次做法)逐列附加到 LEARN_{HASH},並同步更新 LEARN_CONTENTS 目錄;HASH 依共用 8 碼 wiki hash 規則(含 H 前綴退回),wiki 位置依 JSC_WIKI_REPO_LEARN → JSC_WIKI_REPO 解析,讀寫皆透過 jsc-gitea:wiki。 Who:jsc-log domain 的 learn 技能(教訓紀錄與查閱功能)。 Co-Authored-By: Claude Fable 5 --- skills/learn/SKILL.md | 44 +++++++++++++++++++++++++++++++++++++ templates/learn-contents.md | 7 ++++++ templates/learn-page.md | 7 ++++++ 3 files changed, 58 insertions(+) create mode 100644 skills/learn/SKILL.md create mode 100644 templates/learn-contents.md create mode 100644 templates/learn-page.md diff --git a/skills/learn/SKILL.md b/skills/learn/SKILL.md new file mode 100644 index 0000000..a0e3610 --- /dev/null +++ b/skills/learn/SKILL.md @@ -0,0 +1,44 @@ +--- +name: learn +description: Record a lesson learned after a skill run to wiki LEARN_{HASH} plus LEARN_CONTENTS, or consult past lessons before a skill run. Each entry is one table row with date, skill, CLI, situation, lesson, and next-time approach. HASH follows the shared 8-char rule with the H-prefix fallback. Use when a skill run produced a reusable lesson, or before running a skill to consult past lessons; not for work-time logs (see worklog). +--- + +# learn — lessons learned + +Close the loop on skill runs: record what a run taught you, consult it before the next run. Two modes — `record` and `consult`. Page content is chart-first Traditional Chinese (STE100): markdown table entries, prose as the last resort. + +## Target pages + +- Directory page: `LEARN_CONTENTS`. Content page: `LEARN_{HASH}`, one page per repository. +- Compute `{HASH}` from `{owner}/{repo}` with `jsc-gitea/tools/hash-id` (shared wiki hash rule: first 8 uppercase SHA-1 hex chars; `H` plus the first 7 chars when the raw hash starts with `0-9`, `A`, `B`, or `C`). +- Wiki repo resolution: `JSC_WIKI_REPO_LEARN` first, then `JSC_WIKI_REPO`. Inspect the inherited shell environment variables first; ask the user per the `jsc-ask:ask` rules only when neither resolves. Never borrow another type's `JSC_WIKI_REPO_{TYPE}`. +- All wiki reads and writes go through `jsc-gitea:wiki`. + +## Mode: record + +Run after a skill run that produced a reusable lesson. + +1. Collect the six facts below. Done when every field has a value. + + | # | Field (page column) | Source | + | --- | --- | --- | + | 1 | 日期 | Today, `yyyy-MM-dd` | + | 2 | 技能 | The skill that ran, as `jsc-{domain}:{name}` | + | 3 | CLI | One of claude / codex / copilot / antigravity / kiro | + | 4 | 情境 | What was happening when the lesson appeared, one sentence | + | 5 | 教訓 | What the run taught, one sentence | + | 6 | 下次做法 | How to apply it on the next run, one sentence | + +2. Resolve `{owner}/{repo}` from `git remote get-url origin` and compute `{HASH}` with `jsc-gitea/tools/hash-id`. Done when the page name `LEARN_{HASH}` is known. +3. Write the entry. This step MUST run as a sub agent; the main agent only confirms the write succeeded. + - Read `LEARN_{HASH}` via `jsc-gitea:wiki`. If it does not exist, create it from `templates/learn-page.md`; otherwise APPEND the new row at the end of the table. Never overwrite existing rows. + - Update `LEARN_CONTENTS` in the same pass (apply `templates/learn-contents.md`; add the repo row if missing, otherwise refresh its 最後更新時間). + - Done when the sub agent reports both pages written and the main agent has confirmed the row exists on `LEARN_{HASH}`. + +## Mode: consult + +Run before a skill run, to apply past lessons. + +1. Resolve `{owner}/{repo}` and compute `{HASH}` as in record mode. Done when `LEARN_{HASH}` is known. +2. Read `LEARN_CONTENTS` and the repo's `LEARN_{HASH}` via `jsc-gitea:wiki`. When either page is missing (exit 4), report 「無教訓紀錄」 and let the caller proceed. Done when both pages are read or reported missing. +3. Surface every row whose 技能 matches the skill about to run, and summarize each matched 下次做法 for the caller to apply. Done when the matched rows (or 「無相符教訓」) are reported. diff --git a/templates/learn-contents.md b/templates/learn-contents.md new file mode 100644 index 0000000..3b84991 --- /dev/null +++ b/templates/learn-contents.md @@ -0,0 +1,7 @@ +# 教訓目錄 + +> 由 `jsc-log:learn` 維護。這是教訓目錄頁 `LEARN_CONTENTS`。每個存取庫一列;`LEARN_{HASH}` 的 `{HASH}` 依共用 wiki hash 規則產生:先取 `{owner}/{repo}` 的 SHA-1 前 8 碼並轉成大寫;首碼若是 `0-9`、`A`、`B`、`C`,改用 `H` 加上原前 7 碼,總長維持 8 碼。 + +| 存取庫名稱 | 教訓紀錄 | 最後更新時間 | +| --- | --- | --- | +| {owner}/{repo} | [[LEARN_{HASH}]] | {yyyy-MM-dd HH:mm} | diff --git a/templates/learn-page.md b/templates/learn-page.md new file mode 100644 index 0000000..4b603b0 --- /dev/null +++ b/templates/learn-page.md @@ -0,0 +1,7 @@ +# 教訓紀錄 — {owner}/{repo} + +> 由 `jsc-log:learn` 維護。這是教訓紀錄頁 `LEARN_{HASH}`;`HASH` 依共用 wiki hash 規則產生。新教訓**附加**一列在表尾,不覆蓋舊列。執行技能前先查這頁,套用「下次做法」。 + +| 日期 | 技能 | CLI | 情境 | 教訓 | 下次做法 | +| --- | --- | --- | --- | --- | --- | +| {yyyy-MM-dd} | {jsc-domain:name} | {claude、codex、copilot、antigravity、kiro 五選一} | {當時發生什麼事} | {這次學到什麼} | {下次怎麼做} | -- 2.53.0 From 1b0d4595c1165c82e7b10996ee3d6f37805c6686 Mon Sep 17 00:00:00 2001 From: Jeffery Date: Mon, 24 Aug 2026 11:36:59 +0800 Subject: [PATCH 2/3] =?UTF-8?q?docs(readme):=20=E8=AA=AA=E6=98=8E=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E8=A3=9C=E4=B8=8A=20learn=20=E6=8A=80=E8=83=BD?= =?UTF-8?q?=E8=88=87=20LEARN=20=E9=A0=81=E8=B3=87=E8=A8=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit What:README.md 補上 learn 技能介紹、範本表新增 learn-page.md 與 learn-contents.md 兩列、環境變數一節加入 JSC_WIKI_REPO_LEARN 解析順序;AGENTS.md 的 domain 描述同步加入教訓紀錄與 LEARN_{HASH}。 Why:新技能加入後,安裝者與 AI 助理讀到的文件必須與實際技能清單一致,否則無從得知教訓紀錄功能的存在與 wiki 位置解析規則。 How:沿用既有文件結構,於技能清單、範本表、環境變數與 domain 簡介處逐段補述,並註明先讀 shell 繼承的環境變數、缺值才詢問。 Who:jsc-log domain 的說明文件(learn 教訓紀錄功能)。 Co-Authored-By: Claude Fable 5 --- AGENTS.md | 2 +- README.md | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 2b45841..d0d76cc 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,6 +1,6 @@ # jsc-log — 給 AI 助理的指引 -本 repo 是 jsc 技能組的 `log` domain(工作日誌與技能使用統計,寫入 `LOG_{HASH}` wiki 頁),Claude Code / Codex / Copilot / Antigravity / Kiro 都能安裝使用。 +本 repo 是 jsc 技能組的 `log` domain(工作日誌、技能使用統計與教訓紀錄,寫入 `LOG_{HASH}`、`LEARN_{HASH}` wiki 頁),Claude Code / Codex / Copilot / Antigravity / Kiro 都能安裝使用。 ## 規則 diff --git a/README.md b/README.md index 2020976..10e11a6 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # jsc-log — 工作日誌與統計 -jsc 技能組的 log domain:工作完成後把十項資訊寫入 wiki 日誌頁(`LOG_{HASH}`,`HASH` 依共享規則計算;首碼若是數字或 `A`/`B`/`C`,改成 `H` 加上原前 7 碼;頁內仍按工作週週五整理),並統計技能使用次數與呼叫鏈次數。 +jsc 技能組的 log domain:工作完成後把十項資訊寫入 wiki 日誌頁(`LOG_{HASH}`,`HASH` 依共享規則計算;首碼若是數字或 `A`/`B`/`C`,改成 `H` 加上原前 7 碼;頁內仍按工作週週五整理),統計技能使用次數與呼叫鏈次數,並把技能執行的教訓記到 `LEARN_{HASH}`,供下次執行前查閱。 ## 安裝、更新、移除 @@ -37,6 +37,10 @@ Marketplace 統一為 `jsc`(https://gitea.jsc.idv.tw/plugins/jsc.git),安 統計本技能組各技能的使用次數與呼叫鏈使用次數,資料來源為 jsc-hooks 記錄的 `skills.jsonl` 與 `chains.jsonl`。 +### `learn` + +技能執行後把教訓(日期、技能、CLI、情境、教訓、下次做法)附加到 `LEARN_{HASH}` 並更新 `LEARN_CONTENTS`;技能執行前查閱同兩頁,套用相符的「下次做法」。 + ## 範本 @@ -45,10 +49,12 @@ Marketplace 統一為 `jsc`(https://gitea.jsc.idv.tw/plugins/jsc.git),安 | --- | --- | | `templates/log-entry.md` | 單筆工作日誌(十欄位) | | `templates/log-contents.md` | 日誌目錄 `LOG_CONTENTS` | +| `templates/learn-page.md` | 教訓紀錄頁 `LEARN_{HASH}`(六欄表格,逐列附加) | +| `templates/learn-contents.md` | 教訓目錄 `LEARN_CONTENTS` | ## 環境變數 -Wiki 位置:`JSC_WIKI_REPO_LOG`,未設定退回 `JSC_WIKI_REPO`,再未設定就詢問(見 `jsc-gitea`)。 +Wiki 位置:日誌頁用 `JSC_WIKI_REPO_LOG`、教訓頁用 `JSC_WIKI_REPO_LEARN`,未設定退回 `JSC_WIKI_REPO`,再未設定就詢問(見 `jsc-gitea`)。先讀目前 shell 繼承的環境變數,缺值才詢問。 ## 相關 domain -- 2.53.0 From bc4f2c6f25295e4d77ba2c3b21bc67a7d39d436c Mon Sep 17 00:00:00 2001 From: Jeffery Date: Mon, 24 Aug 2026 11:37:13 +0800 Subject: [PATCH 3/3] =?UTF-8?q?chore(manifest):=20=E4=B8=89=E4=BB=BD=20plu?= =?UTF-8?q?gin=20=E8=B3=87=E8=A8=8A=E6=B8=85=E5=96=AE=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8D=87=E8=87=B3=200.0.3=20=E4=B8=A6=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit What:plugin.json、.claude-plugin/plugin.json、.codex-plugin/plugin.json 版本由 0.0.2 升至 0.0.3,描述加入教訓紀錄(LEARN_{HASH} wiki 頁)。 Why:本次新增 learn 技能屬功能擴充,三份資訊清單須同步升版並反映新功能,安裝端才能辨識更新。 How:三份檔案的 version 與 description 欄位一致修改,維持各 CLI 入口內容同步。 Who:jsc-log plugin 的資訊清單(learn 教訓紀錄功能)。 Co-Authored-By: Claude Fable 5 --- .claude-plugin/plugin.json | 4 ++-- .codex-plugin/plugin.json | 4 ++-- plugin.json | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index d8f0f52..b4c54fe 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "jsc-log", - "version": "0.0.2", - "description": "工作日誌(LOG_{HASH} wiki 頁)與技能使用統計", + "version": "0.0.3", + "description": "工作日誌(LOG_{HASH} wiki 頁)、技能使用統計與教訓紀錄(LEARN_{HASH} wiki 頁)", "skills": "./skills", "author": { "name": "JSC" diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.json index 7b7c716..a5ed236 100644 --- a/.codex-plugin/plugin.json +++ b/.codex-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "jsc-log", - "version": "0.0.2", - "description": "工作日誌(LOG_{HASH} wiki 頁)與技能使用統計", + "version": "0.0.3", + "description": "工作日誌(LOG_{HASH} wiki 頁)、技能使用統計與教訓紀錄(LEARN_{HASH} wiki 頁)", "skills": "./skills" } diff --git a/plugin.json b/plugin.json index f6ed7ea..e46824f 100644 --- a/plugin.json +++ b/plugin.json @@ -1,6 +1,6 @@ { "name": "jsc-log", - "version": "0.0.2", - "description": "工作日誌(LOG_{HASH} wiki 頁)與技能使用統計", + "version": "0.0.3", + "description": "工作日誌(LOG_{HASH} wiki 頁)、技能使用統計與教訓紀錄(LEARN_{HASH} wiki 頁)", "skills": "./skills/" } -- 2.53.0