Merge pull request 'feat/learn-skill' (#4) from feat/learn-skill into develop
Reviewed-on: #4 Reviewed-by: 系統管理員 <1+admin@noreply.localhost>
This commit was merged in pull request #4.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "jsc-log",
|
"name": "jsc-log",
|
||||||
"version": "0.0.2",
|
"version": "0.0.3",
|
||||||
"description": "工作日誌(LOG_{HASH} wiki 頁)與技能使用統計",
|
"description": "工作日誌(LOG_{HASH} wiki 頁)、技能使用統計與教訓紀錄(LEARN_{HASH} wiki 頁)",
|
||||||
"skills": "./skills",
|
"skills": "./skills",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "JSC"
|
"name": "JSC"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "jsc-log",
|
"name": "jsc-log",
|
||||||
"version": "0.0.2",
|
"version": "0.0.3",
|
||||||
"description": "工作日誌(LOG_{HASH} wiki 頁)與技能使用統計",
|
"description": "工作日誌(LOG_{HASH} wiki 頁)、技能使用統計與教訓紀錄(LEARN_{HASH} wiki 頁)",
|
||||||
"skills": "./skills"
|
"skills": "./skills"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# jsc-log — 給 AI 助理的指引
|
# 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 都能安裝使用。
|
||||||
|
|
||||||
## 規則
|
## 規則
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# jsc-log — 工作日誌與統計
|
# 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`。
|
統計本技能組各技能的使用次數與呼叫鏈使用次數,資料來源為 jsc-hooks 記錄的 `skills.jsonl` 與 `chains.jsonl`。
|
||||||
|
|
||||||
|
### `learn`
|
||||||
|
|
||||||
|
技能執行後把教訓(日期、技能、CLI、情境、教訓、下次做法)附加到 `LEARN_{HASH}` 並更新 `LEARN_CONTENTS`;技能執行前查閱同兩頁,套用相符的「下次做法」。
|
||||||
|
|
||||||
<!-- JSC-SKILLS:END -->
|
<!-- JSC-SKILLS:END -->
|
||||||
|
|
||||||
## 範本
|
## 範本
|
||||||
@@ -45,10 +49,12 @@ Marketplace 統一為 `jsc`(https://gitea.jsc.idv.tw/plugins/jsc.git),安
|
|||||||
| --- | --- |
|
| --- | --- |
|
||||||
| `templates/log-entry.md` | 單筆工作日誌(十欄位) |
|
| `templates/log-entry.md` | 單筆工作日誌(十欄位) |
|
||||||
| `templates/log-contents.md` | 日誌目錄 `LOG_CONTENTS` |
|
| `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
|
## 相關 domain
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "jsc-log",
|
"name": "jsc-log",
|
||||||
"version": "0.0.2",
|
"version": "0.0.3",
|
||||||
"description": "工作日誌(LOG_{HASH} wiki 頁)與技能使用統計",
|
"description": "工作日誌(LOG_{HASH} wiki 頁)、技能使用統計與教訓紀錄(LEARN_{HASH} wiki 頁)",
|
||||||
"skills": "./skills/"
|
"skills": "./skills/"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.
|
||||||
@@ -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} |
|
||||||
@@ -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 五選一} | {當時發生什麼事} | {這次學到什麼} | {下次怎麼做} |
|
||||||
Reference in New Issue
Block a user