sanook-cli 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/.env.example +23 -0
  2. package/CHANGELOG.md +38 -0
  3. package/LICENSE +201 -0
  4. package/README.md +239 -0
  5. package/dist/agentContext.js +2 -0
  6. package/dist/approval.js +78 -0
  7. package/dist/bin.js +461 -0
  8. package/dist/brain.js +186 -0
  9. package/dist/commands.js +66 -0
  10. package/dist/compaction.js +85 -0
  11. package/dist/config.js +101 -0
  12. package/dist/cost.js +59 -0
  13. package/dist/diff.js +36 -0
  14. package/dist/gateway/auth.js +32 -0
  15. package/dist/gateway/ledger.js +94 -0
  16. package/dist/gateway/lock.js +114 -0
  17. package/dist/gateway/schedule.js +74 -0
  18. package/dist/gateway/scheduler.js +87 -0
  19. package/dist/gateway/serve.js +57 -0
  20. package/dist/gateway/server.js +94 -0
  21. package/dist/gateway/telegram.js +115 -0
  22. package/dist/git.js +55 -0
  23. package/dist/hooks.js +104 -0
  24. package/dist/knowledge.js +68 -0
  25. package/dist/loop.js +169 -0
  26. package/dist/mcp.js +191 -0
  27. package/dist/memory.js +108 -0
  28. package/dist/providers/codex.js +86 -0
  29. package/dist/providers/keys.js +37 -0
  30. package/dist/providers/models.js +55 -0
  31. package/dist/providers/registry.js +241 -0
  32. package/dist/session.js +36 -0
  33. package/dist/skill-install.js +190 -0
  34. package/dist/skills.js +111 -0
  35. package/dist/tools/bash.js +26 -0
  36. package/dist/tools/edit.js +107 -0
  37. package/dist/tools/git.js +68 -0
  38. package/dist/tools/index.js +36 -0
  39. package/dist/tools/list.js +24 -0
  40. package/dist/tools/permission.js +30 -0
  41. package/dist/tools/read.js +18 -0
  42. package/dist/tools/recall.js +12 -0
  43. package/dist/tools/remember.js +14 -0
  44. package/dist/tools/schedule.js +61 -0
  45. package/dist/tools/search.js +54 -0
  46. package/dist/tools/skill.js +65 -0
  47. package/dist/tools/task.js +46 -0
  48. package/dist/tools/util.js +5 -0
  49. package/dist/tools/write.js +27 -0
  50. package/dist/ui/app.js +132 -0
  51. package/dist/ui/banner.js +20 -0
  52. package/dist/ui/brain-wizard.js +29 -0
  53. package/dist/ui/render.js +57 -0
  54. package/dist/ui/setup.js +46 -0
  55. package/package.json +77 -0
  56. package/second-brain/AGENTS.md +18 -0
  57. package/second-brain/CLAUDE.md +96 -0
  58. package/second-brain/Evals/retrieval-eval.md +30 -0
  59. package/second-brain/GEMINI.md +15 -0
  60. package/second-brain/Home.md +33 -0
  61. package/second-brain/README.md +29 -0
  62. package/second-brain/Runbooks/ingest-quarantine.md +27 -0
  63. package/second-brain/Runbooks/sleep-time-consolidation.md +26 -0
  64. package/second-brain/Shared/AI-Context-Index.md +52 -0
  65. package/second-brain/Shared/Core-Facts/protected-facts.md +21 -0
  66. package/second-brain/Shared/Decision-Memory/decision-log.md +24 -0
  67. package/second-brain/Shared/Memory-Inbox/memory-inbox.md +23 -0
  68. package/second-brain/Shared/Operating-State/current-state.md +30 -0
  69. package/second-brain/Shared/Provenance/ingest-log.md +27 -0
  70. package/second-brain/Shared/Rules/context-assembly-policy.md +28 -0
  71. package/second-brain/Shared/Rules/frontmatter-standard.md +33 -0
  72. package/second-brain/Shared/Rules/skills-admission.md +30 -0
  73. package/second-brain/Shared/User-Memory/user-preferences.md +25 -0
  74. package/second-brain/Templates/bug.md +22 -0
  75. package/second-brain/Templates/handoff.md +21 -0
  76. package/second-brain/Templates/project.md +24 -0
  77. package/second-brain/Templates/session.md +26 -0
  78. package/second-brain/USER.md +36 -0
  79. package/second-brain/Vault Structure Map.md +106 -0
  80. package/skills/agent-tool-mcp-builder/SKILL.md +88 -0
  81. package/skills/api-design-review/SKILL.md +70 -0
  82. package/skills/async-concurrency-correctness/SKILL.md +93 -0
  83. package/skills/audit-accessibility-wcag/SKILL.md +59 -0
  84. package/skills/audit-technical-seo/SKILL.md +62 -0
  85. package/skills/auth-jwt-session/SKILL.md +88 -0
  86. package/skills/brainstorm-design/SKILL.md +73 -0
  87. package/skills/build-etl-pipeline/SKILL.md +58 -0
  88. package/skills/build-form-validation/SKILL.md +103 -0
  89. package/skills/build-office-docs/SKILL.md +80 -0
  90. package/skills/build-react-component/SKILL.md +116 -0
  91. package/skills/build-spreadsheet/SKILL.md +106 -0
  92. package/skills/caching-strategy/SKILL.md +75 -0
  93. package/skills/cicd-pipeline-author/SKILL.md +65 -0
  94. package/skills/cloud-cost-optimize/SKILL.md +91 -0
  95. package/skills/code-comments/SKILL.md +52 -0
  96. package/skills/code-review/SKILL.md +61 -0
  97. package/skills/db-migration-safety/SKILL.md +67 -0
  98. package/skills/debug-frontend-browser/SKILL.md +58 -0
  99. package/skills/debug-root-cause/SKILL.md +54 -0
  100. package/skills/dependency-upgrade/SKILL.md +56 -0
  101. package/skills/deploy-release/SKILL.md +64 -0
  102. package/skills/diff-table-parity/SKILL.md +58 -0
  103. package/skills/dockerfile-optimize/SKILL.md +82 -0
  104. package/skills/error-message/SKILL.md +58 -0
  105. package/skills/estimate-work/SKILL.md +54 -0
  106. package/skills/explore-codebase/SKILL.md +73 -0
  107. package/skills/git-commit-pr/SKILL.md +65 -0
  108. package/skills/gitops-deploy-workflow/SKILL.md +97 -0
  109. package/skills/implement-from-design/SKILL.md +69 -0
  110. package/skills/incident-response-sre/SKILL.md +78 -0
  111. package/skills/k8s-debug-workload/SKILL.md +135 -0
  112. package/skills/k8s-manifest-review/SKILL.md +86 -0
  113. package/skills/llm-eval-harness/SKILL.md +63 -0
  114. package/skills/manage-client-server-state/SKILL.md +94 -0
  115. package/skills/mermaid-diagram/SKILL.md +61 -0
  116. package/skills/message-queue-jobs/SKILL.md +139 -0
  117. package/skills/naming-helper/SKILL.md +57 -0
  118. package/skills/observability-instrument/SKILL.md +113 -0
  119. package/skills/optimize-core-web-vitals/SKILL.md +75 -0
  120. package/skills/optimize-sql-query/SKILL.md +67 -0
  121. package/skills/performance-profiling/SKILL.md +65 -0
  122. package/skills/process-pdf/SKILL.md +107 -0
  123. package/skills/profile-dataset/SKILL.md +97 -0
  124. package/skills/prompt-engineering/SKILL.md +70 -0
  125. package/skills/rag-pipeline/SKILL.md +53 -0
  126. package/skills/rate-limiting/SKILL.md +96 -0
  127. package/skills/refactor-cleanup/SKILL.md +54 -0
  128. package/skills/regex-build/SKILL.md +72 -0
  129. package/skills/release-notes/SKILL.md +79 -0
  130. package/skills/rest-graphql-contract/SKILL.md +71 -0
  131. package/skills/scrape-structured-web-data/SKILL.md +61 -0
  132. package/skills/secrets-management/SKILL.md +96 -0
  133. package/skills/security-review/SKILL.md +62 -0
  134. package/skills/shell-script-robust/SKILL.md +71 -0
  135. package/skills/style-responsive-tailwind/SKILL.md +70 -0
  136. package/skills/terraform-plan-review/SKILL.md +95 -0
  137. package/skills/type-safety-strict/SKILL.md +82 -0
  138. package/skills/validate-data-quality/SKILL.md +62 -0
  139. package/skills/wrangle-tabular-data/SKILL.md +75 -0
  140. package/skills/write-adr/SKILL.md +75 -0
  141. package/skills/write-analytical-sql/SKILL.md +71 -0
  142. package/skills/write-data-viz/SKILL.md +58 -0
  143. package/skills/write-docs/SKILL.md +54 -0
  144. package/skills/write-plan/SKILL.md +59 -0
  145. package/skills/write-playwright-e2e/SKILL.md +86 -0
  146. package/skills/write-prd/SKILL.md +65 -0
  147. package/skills/write-rfc/SKILL.md +75 -0
  148. package/skills/write-tests/SKILL.md +50 -0
@@ -0,0 +1,26 @@
1
+ ---
2
+ tags: [runbook, consolidation, memory, review]
3
+ note_type: runbook
4
+ created: {{DATE}}
5
+ updated: {{DATE}}
6
+ parent: "[[Runbooks/_Index]]"
7
+ ---
8
+
9
+ # Runbook: Sleep-Time Consolidation (จัดระเบียบความจำตอนว่าง)
10
+
11
+ > งาน offline (เช่น รายวัน/รายสัปดาห์) ที่กลั่น raw → learned แทนที่จะทำกลางบทสนทนา
12
+ > หลักฐาน: Letta sleep-time compute · Mem0 ADD/UPDATE/DELETE/NOOP
13
+
14
+ ## Steps
15
+
16
+ 1. **Route inbox** — เคลียร์ `[[Shared/Memory-Inbox/memory-inbox]]` → promote เข้า durable (User-Memory / Decision-Memory / Entities) หรือ discard · ตัดสิน op: ADD/UPDATE/DELETE/NOOP (Merge, Don't Append)
17
+ 2. **Dedup + merge** — รวมโน้ตซ้อน · เจอ fact ขัดกัน → bi-temporal supersede (ดู [[Shared/Rules/frontmatter-standard]])
18
+ 3. **Stale → Archive** — โน้ตเลย `stale_after` + ไม่ถูกแตะนาน + low-action → **flag → ถามก่อน → ย้ายเข้า `[[Shared/Archive]]`** (ออกจาก retrieval, ไม่ลบ · Core-Facts ยกเว้น)
19
+ 4. **Pattern → promote** — เห็น pattern ≥3 ครั้ง → tactic/heuristic ที่ปรับดีขึ้นเรื่อยๆ → `Playbooks/` · principle ที่กลั่นนิ่งแล้ว → `Distillations/`
20
+ 5. **Retrieval check** — รัน [[Evals/retrieval-eval]] กับงานล่าสุด → failure เข้า failure-taxonomy
21
+
22
+ ## หลักการ
23
+ - step 3 = ปิด decay loop (signal `stale_after` มีอยู่ แต่ต้องมี "action" ย้ายจริง ไม่งั้น stale = distractor)
24
+ - ทุก destructive move ถามก่อน (§10)
25
+
26
+ up:: [[Runbooks/_Index]]
@@ -0,0 +1,52 @@
1
+ ---
2
+ tags: [index, durable-index, ai-context]
3
+ note_type: durable-index
4
+ created: {{DATE}}
5
+ updated: {{DATE}}
6
+ parent: "[[Shared/_Index]]"
7
+ ai_surface: hot
8
+ ---
9
+
10
+ # AI Context Index — Single Retrieval Path
11
+
12
+ > **ไฟล์ที่ AI อ่านก่อนเสมอ** (§1) — ได้ context ครบในไฟล์เดียว แล้วค่อยเดินลิงก์ไปลึก
13
+
14
+ ## Folder Map (ของชนิดนี้เก็บที่ไหน)
15
+
16
+ > **อ่านก่อนสร้าง/ย้ายโน้ตทุกครั้ง** → [[Vault Structure Map]] — แผนที่ครบทุกโฟลเดอร์ (role + ใส่อะไร + ห้ามใส่อะไร)
17
+
18
+ ## Quick Identity
19
+
20
+ - เจ้าของ: **{{OWNER_NAME}}** · AI = {{AI_NAME}} ({{AI_PRONOUN}}) · ภาษา {{LANGUAGE}} · โทน {{TONE}}
21
+ - Autonomy: **{{AUTONOMY}}** — ดู `CLAUDE.md` / `GEMINI.md` / `AGENTS.md`
22
+
23
+ ## Default Retrieval Path (อ่านตามลำดับเท่าที่ต้องการ)
24
+
25
+ 1. [[USER]] — เจ้าของเป็นใคร
26
+ 2. [[Shared/Operating-State/current-state]] — ตอนนี้โฟกัสอะไร
27
+ 3. [[Shared/User-Memory/user-preferences]] — ชอบ/ไม่ชอบอะไร
28
+ 4. [[Shared/Decision-Memory/decision-log]] — ตัดสินใจอะไรไปแล้ว
29
+ 5. งาน project → [[Projects/_Index]] → overview → context → current-state
30
+
31
+ ## Memory Routing (เจออะไร เก็บที่ไหน — §4)
32
+
33
+ | สิ่งที่พบ | → |
34
+ |---|---|
35
+ | preference ใหม่ | [[Shared/User-Memory/user-preferences]] |
36
+ | decision สำคัญ | [[Shared/Decision-Memory/decision-log]] |
37
+ | ยังไม่ชัด/ขัดกัน | [[Shared/Memory-Inbox/memory-inbox]] |
38
+ | invariant truth | [[Shared/Core-Facts/protected-facts]] |
39
+ | entity/person/org page | `Entities/<name>.md` |
40
+ | อื่นๆ / ไม่แน่ใจว่าโฟลเดอร์ไหน | [[Vault Structure Map]] |
41
+
42
+ ## Framework Rules (โหลดตาม task — ดู CLAUDE.md §19)
43
+
44
+ - **ก่อนประกอบ context เสมอ** → [[Shared/Rules/context-assembly-policy]] (head/tail + budget, กัน context-rot)
45
+ - ingest ของนอก → [[Runbooks/ingest-quarantine]] · fact → [[Shared/Rules/frontmatter-standard]] (bi-temporal + `source::`)
46
+ - script ทำซ้ำ → [[Shared/Rules/skills-admission]] (Skills/) · consolidate → [[Runbooks/sleep-time-consolidation]]
47
+
48
+ ## Current Snapshot
49
+
50
+ _(อัปเดตเมื่อ priority เปลี่ยน — ดู [[Shared/Operating-State/current-state]])_
51
+
52
+ up:: [[Shared/_Index]]
@@ -0,0 +1,21 @@
1
+ ---
2
+ tags: [core-facts, protected, invariant]
3
+ note_type: standard-reference
4
+ created: {{DATE}}
5
+ updated: {{DATE}}
6
+ parent: "[[Shared/Core-Facts/_Index]]"
7
+ ---
8
+
9
+ # 🛡️ Protected Facts (invariant — agent read-only)
10
+
11
+ > ความจริงที่ "ห้ามเปลี่ยนเงียบๆ": identity / hard-preference / safety
12
+ > **ก่อนเขียน durable memory ทุกครั้ง → diff กับไฟล์นี้** · ขัด = หยุด + flag เจ้าของ (ห้ามทับ invariant)
13
+
14
+ ## Identity
15
+ - เจ้าของ = **{{OWNER_NAME}}** · AI = **{{AI_NAME}}** ({{AI_PRONOUN}})
16
+ - ภาษา = {{LANGUAGE}}
17
+
18
+ ## Safety (ห้ามงอ)
19
+ - ถามก่อนรัน destructive · ห้ามเขียน secret ลงไฟล์ · ห้ามลบ durable note โดยไม่ถาม
20
+
21
+ up:: [[Shared/Core-Facts/_Index]]
@@ -0,0 +1,24 @@
1
+ ---
2
+ tags: [decision-memory, decision-log]
3
+ note_type: decision-log
4
+ created: {{DATE}}
5
+ updated: {{DATE}}
6
+ parent: "[[Shared/Decision-Memory/_Index]]"
7
+ ---
8
+
9
+ # 🔒 Decision Log
10
+
11
+ > การตัดสินใจสำคัญที่ "lock" แล้ว + เหตุผล (latest-wins · ใช้ `supersedes::` เมื่อล้มของเดิม)
12
+
13
+ ## Active Decisions
14
+
15
+ _(ยังว่าง — รูปแบบ entry:)_
16
+
17
+ <!--
18
+ ### {{DATE}} — <หัวข้อการตัดสินใจ>
19
+ - **เลือก:** ...
20
+ - **เพราะ:** ...
21
+ - **ทางที่ไม่เลือก:** ...
22
+ -->
23
+
24
+ up:: [[Shared/Decision-Memory/_Index]]
@@ -0,0 +1,23 @@
1
+ ---
2
+ tags: [memory-inbox, capture]
3
+ note_type: learning-note
4
+ created: {{DATE}}
5
+ updated: {{DATE}}
6
+ parent: "[[Shared/Memory-Inbox/_Index]]"
7
+ ai_surface: capture
8
+ ---
9
+
10
+ # 📥 Memory Inbox
11
+
12
+ > ที่พัก observation ที่ยังไม่ชัด/ยังไม่ promote — **เคลียร์ทุก weekly** (ไม่เกิน 2 สัปดาห์ ตาม §13)
13
+
14
+ ## New Candidates
15
+ _(ของใหม่ที่ยังไม่รู้จะเก็บที่ไหน)_
16
+
17
+ ## Needs Merge
18
+ _(อาจซ้ำ/ขัดกับ durable memory — รอ resolve)_
19
+
20
+ ## Promoted (history)
21
+ _(ย้ายเข้า durable แล้ว — เก็บ trace)_
22
+
23
+ up:: [[Shared/Memory-Inbox/_Index]]
@@ -0,0 +1,30 @@
1
+ ---
2
+ tags: [operating-state, current-state]
3
+ note_type: operating-state
4
+ created: {{DATE}}
5
+ updated: {{DATE}}
6
+ parent: "[[Shared/Operating-State/_Index]]"
7
+ ai_surface: starter
8
+ ---
9
+
10
+ # 🎯 Current State — {{OWNER_NAME}}
11
+
12
+ > ตอนนี้กำลังโฟกัสอะไร (AI อ่านเพื่อรู้ context "ปัจจุบัน" — อัปเดตเมื่อ priority เปลี่ยน)
13
+
14
+ ## Now
15
+
16
+ _(งาน/โฟกัสหลักตอนนี้ — ยังว่าง)_
17
+
18
+ ## Active Bets
19
+
20
+ _(สิ่งที่กำลังลงแรง/ลงทุน)_
21
+
22
+ ## Blockers
23
+
24
+ _(ติดอะไรอยู่)_
25
+
26
+ ## Next Actions
27
+
28
+ - [ ] _(เริ่มจดงานแรกที่นี่)_
29
+
30
+ up:: [[Shared/Operating-State/_Index]]
@@ -0,0 +1,27 @@
1
+ ---
2
+ tags: [provenance, ledger, ingest]
3
+ note_type: registry
4
+ created: {{DATE}}
5
+ updated: {{DATE}}
6
+ parent: "[[Shared/Provenance/_Index]]"
7
+ ---
8
+
9
+ # Ingest Ledger (lineage — append-only)
10
+
11
+ > บรรทัดเดียวต่อการ ingest — ทำให้ทุก `source::` ใน vault resolve ได้ + ตรวจ verification gate ได้
12
+ > หลักฐาน: Karpathy LLM-Wiki (grep-parseable log + immutable raw layer) · W3C PROV-O
13
+
14
+ ## Format
15
+
16
+ ```
17
+ ## [YYYY-MM-DD] ingest | <title> | tier:A/B/C | <url-or-path> | touched: [[note1]], [[note2]]
18
+ ```
19
+
20
+ - **tier** A=ทางการ/primary · B=secondary น่าเชื่อ · C=blog/unverified
21
+ - ทุก claim note ที่ derived ต้องมี `source::` ที่ชี้มาบรรทัดใน ledger นี้ หรือไฟล์ใน `Intake/Raw Sources/`
22
+
23
+ ## Entries
24
+
25
+ _(append ด้านล่าง — ห้ามแก้/ลบของเก่า)_
26
+
27
+ up:: [[Shared/Provenance/_Index]]
@@ -0,0 +1,28 @@
1
+ ---
2
+ tags: [rule, context, retrieval]
3
+ note_type: rule
4
+ created: {{DATE}}
5
+ updated: {{DATE}}
6
+ parent: "[[Shared/Rules/_Index]]"
7
+ ai_surface: hot
8
+ ai_preload: true
9
+ ---
10
+
11
+ # Context Assembly Policy (กัน context-rot)
12
+
13
+ > โหลด context ยังไง + วางตรงไหน — กฎนี้โหลดก่อน (ai_preload) เพราะกระทบ **correctness** โดยตรง
14
+ > หลักฐาน: Chroma "Context Rot" (2025), "Lost in the Middle" (TACL 2024) — token เยอะ + วางกลาง context = ตอบแย่ลง แม้ยังไม่เต็ม window
15
+
16
+ ## 3 กฎ
17
+
18
+ 1. **Positional placement** — วางของสำคัญที่ **หัว** (invariant: active goal · Core-Facts · task DoD) และ **ท้าย** (state ล่าสุด · next action) **ห้ามฝังกลาง context**
19
+ 2. **Identifiers before bodies** — โหลด path/wikilink/heading ก่อน → expand เนื้อเฉพาะที่ต้องใช้จริง (just-in-time) ไม่ดึงทั้งไฟล์มากอง
20
+ 3. **Token budget** — core pack ~2k tokens · เกินให้ตัด · **"ไม่แน่ใจ = โหลดน้อยกว่า"**
21
+
22
+ ## Self-check ก่อนเริ่มงาน
23
+
24
+ - [ ] ของ load-bearing อยู่หัว/ท้าย ไม่ใช่กลาง?
25
+ - [ ] โหลด identifier ก่อน body แล้ว?
26
+ - [ ] core context ≤ ~2k? ตัด distractor ออกหมดแล้ว?
27
+
28
+ up:: [[Shared/Rules/_Index]]
@@ -0,0 +1,33 @@
1
+ ---
2
+ tags: [rule, frontmatter, standard]
3
+ note_type: rule
4
+ created: {{DATE}}
5
+ updated: {{DATE}}
6
+ parent: "[[Shared/Rules/_Index]]"
7
+ ---
8
+
9
+ # Frontmatter Standard (+ bi-temporal validity + provenance)
10
+
11
+ > field มาตรฐานของทุกโน้ต + 2 ระบบใหม่: **bi-temporal** (รู้ว่า fact ยังจริงไหม) + **provenance** (รู้ว่า fact มาจากไหน)
12
+
13
+ ## Core fields (ทุกโน้ต)
14
+ `tags` · `note_type` · `created` · `updated` · `parent` + ท้ายไฟล์ `up:: [[parent/_Index]]`
15
+
16
+ ## Bi-temporal validity (fact notes: Core-Facts / Decision-Memory / Entities)
17
+
18
+ | field | ความหมาย |
19
+ |---|---|
20
+ | `valid_from:` | YYYY-MM-DD ที่ fact เริ่มจริง |
21
+ | `invalidated_at:` | ว่าง = ยังจริง · มีค่า = เลิกจริงตั้งแต่วันนั้น |
22
+ | `status:` | `active` (ความจริงปัจจุบัน) \| `superseded` |
23
+ | `superseded_by::` | `[[note ใหม่]]` ที่มาแทน |
24
+
25
+ **กฎ (ขยาย DELETE op ของ memory-write):** เจอ fact ขัดกัน → **อย่าทับเงียบ** → stamp อันเก่า `invalidated_at` + `status: superseded` + `superseded_by` แล้วสร้างอันใหม่ที่ใส่ `supersedes:: [[เก่า]]` กลับ → ทำให้แยก "เคยจริง" ออกจาก "ผิดมาตลอด" ได้ (history queryable ผ่าน git ด้วย)
26
+
27
+ ## Provenance (derived/ingested claim notes)
28
+
29
+ - `source::` = wikilink/URL/path ของ **แหล่งจริงต่อ claim** (ต่างจาก `source_quality` ที่เป็นแค่ tier A/B/C)
30
+ - ทุก `source::` ต้อง resolve ไปยังบรรทัดใน `[[Shared/Provenance/ingest-log]]` หรือไฟล์ใน `Intake/Raw Sources/`
31
+ - ไม่มี source resolvable = verification gate (§11) ไม่ผ่าน
32
+
33
+ up:: [[Shared/Rules/_Index]]
@@ -0,0 +1,30 @@
1
+ ---
2
+ tags: [rule, skills, verification]
3
+ note_type: rule
4
+ created: {{DATE}}
5
+ updated: {{DATE}}
6
+ parent: "[[Shared/Rules/_Index]]"
7
+ ---
8
+
9
+ # Skills Admission Gate (verified-only)
10
+
11
+ > `Skills/` = คลังของที่ทำซ้ำได้ (script / command sequence / tool snippet) ที่ **พิสูจน์แล้วว่ารันได้**
12
+ > หลักฐาน: Voyager (arXiv 2305.16291) — skill library ที่ไม่มี verification gate จะสะสม buggy code แล้วพังในที่สุด
13
+
14
+ ## Admission rule (HARD gate)
15
+
16
+ candidate เข้า `Skills/` ได้ **ก็ต่อเมื่อ** รัน verification command แล้ว **ผ่านจริง** — ไม่งั้นค้างที่ `Memory-Inbox/`
17
+
18
+ ## Skill note ต้องมี
19
+
20
+ | field | ความหมาย |
21
+ |---|---|
22
+ | `skill_id` | ชื่อสั้น unique |
23
+ | `signature` | input → output |
24
+ | `verification` | คำสั่งที่ใช้พิสูจน์ + ผลที่คาด |
25
+ | `verified_on` | YYYY-MM-DD ที่ผ่านล่าสุด |
26
+ | `load_when` | trigger ที่ควรหยิบ skill นี้มาใช้ |
27
+
28
+ > ต่างจาก `Runbooks/` (prose how-to) + `Playbooks/` (tactic) — `Skills/` = unit ที่ "รันได้" + ผ่าน test
29
+
30
+ up:: [[Shared/Rules/_Index]]
@@ -0,0 +1,25 @@
1
+ ---
2
+ tags: [user-memory, preferences]
3
+ note_type: user-preferences
4
+ created: {{DATE}}
5
+ updated: {{DATE}}
6
+ parent: "[[Shared/User-Memory/_Index]]"
7
+ ---
8
+
9
+ # 🧭 User Preferences — {{OWNER_NAME}}
10
+
11
+ > สิ่งที่เจ้าของชอบ/ไม่ชอบ (สะสมไปเรื่อยๆ — **Merge, Don't Append**: เจอ entry เดิมให้แก้ ไม่เพิ่มซ้ำ)
12
+
13
+ ## Communication
14
+ - ภาษา: {{LANGUAGE}} · โทน: {{TONE}}
15
+
16
+ ## Execution
17
+ - Autonomy: {{AUTONOMY}}
18
+
19
+ ## Likes
20
+ _(เพิ่มเมื่อเจ้าของบอกว่าชอบอะไรชัดเจน)_
21
+
22
+ ## Dislikes
23
+ _(เพิ่มเมื่อเจ้าของบอกว่าไม่ชอบอะไรชัดเจน)_
24
+
25
+ up:: [[Shared/User-Memory/_Index]]
@@ -0,0 +1,22 @@
1
+ ---
2
+ tags: [bug, bug-report]
3
+ note_type: bug-report
4
+ status: open
5
+ created: YYYY-MM-DD
6
+ updated: YYYY-MM-DD
7
+ parent: "[[Bugs/_Index]]"
8
+ ---
9
+
10
+ # YYYY-MM-DD — <bug>
11
+
12
+ ## อาการ (Symptom)
13
+
14
+ ## Repro (ทำซ้ำยังไง)
15
+
16
+ ## Root Cause
17
+
18
+ ## Fix
19
+
20
+ ## Prevention
21
+
22
+ up:: [[Bugs/_Index]]
@@ -0,0 +1,21 @@
1
+ ---
2
+ tags: [handoff]
3
+ note_type: handoff
4
+ created: YYYY-MM-DD
5
+ updated: YYYY-MM-DD
6
+ parent: "[[Handoffs/_Index]]"
7
+ ---
8
+
9
+ # <project> — Handoff
10
+
11
+ ## Current State
12
+
13
+ ## Done
14
+
15
+ ## In Progress
16
+
17
+ ## Next Steps
18
+
19
+ ## ไฟล์ที่เกี่ยวข้อง
20
+
21
+ up:: [[Handoffs/_Index]]
@@ -0,0 +1,24 @@
1
+ ---
2
+ tags: [project, project-overview]
3
+ note_type: project-overview
4
+ status: active
5
+ created: YYYY-MM-DD
6
+ updated: YYYY-MM-DD
7
+ parent: "[[Projects/_Index]]"
8
+ ---
9
+
10
+ # <Project Name>
11
+
12
+ ## เป้าหมาย (Goal)
13
+
14
+ ## Scope / Non-goals
15
+
16
+ ## Tech / Stack
17
+
18
+ ## Current State
19
+
20
+ > ดู `current-state.md` ในโฟลเดอร์ project นี้
21
+
22
+ ## Related
23
+
24
+ up:: [[Projects/_Index]]
@@ -0,0 +1,26 @@
1
+ ---
2
+ tags: [session, session-log]
3
+ note_type: session-log
4
+ created: YYYY-MM-DD
5
+ updated: YYYY-MM-DD
6
+ parent: "[[Sessions/_Index]]"
7
+ ai_surface: history
8
+ ---
9
+
10
+ # YYYY-MM-DD — <topic>
11
+
12
+ ## Summary
13
+
14
+ ## What Was Tried
15
+
16
+ ## Errors
17
+
18
+ ## Solutions
19
+
20
+ ## Key Decisions
21
+
22
+ ## Files Changed
23
+
24
+ ## Next Steps
25
+
26
+ up:: [[Sessions/_Index]]
@@ -0,0 +1,36 @@
1
+ ---
2
+ tags: [user, identity, durable-index]
3
+ note_type: durable-index
4
+ created: {{DATE}}
5
+ updated: {{DATE}}
6
+ parent: "[[Home]]"
7
+ ai_surface: starter
8
+ ---
9
+
10
+ # USER — {{OWNER_NAME}}
11
+
12
+ > ใครคือเจ้าของ vault นี้ + AI ควรทำงานกับเขายังไง (AI อ่านก่อนเริ่มงานเสมอ — §3)
13
+
14
+ ## Quick Identity
15
+
16
+ - **ชื่อ/เรียกว่า:** {{OWNER_NAME}}
17
+ - **AI เรียกตัวเองว่า:** {{AI_NAME}} (สรรพนาม {{AI_PRONOUN}})
18
+ - **ภาษา:** {{LANGUAGE}}
19
+ - **โทน:** {{TONE}}
20
+ - **Autonomy:** {{AUTONOMY}}
21
+
22
+ ## Core Traits
23
+
24
+ _(เพิ่มเมื่อรู้จักเจ้าของมากขึ้น — ชอบ/ไม่ชอบ, วิธีทำงาน, จังหวะชีวิต)_
25
+
26
+ ## Durable Retrieval Path
27
+
28
+ - preference → [[Shared/User-Memory/user-preferences]]
29
+ - decision → [[Shared/Decision-Memory/decision-log]]
30
+ - state → [[Shared/Operating-State/current-state]]
31
+
32
+ ## Related
33
+
34
+ - [[Home]] · [[Shared/AI-Context-Index]]
35
+
36
+ up:: [[Home]]
@@ -0,0 +1,106 @@
1
+ ---
2
+ tags: [index, durable-index, folder-roles]
3
+ note_type: durable-index
4
+ created: {{DATE}}
5
+ updated: {{DATE}}
6
+ parent: "[[Home]]"
7
+ ai_surface: hot
8
+ ---
9
+ <!-- ⚠ sync กับ src/brain.ts FOLDERS[] — แก้ทั้งสองที่เสมอ (มี test กัน drift) -->
10
+
11
+ # Vault Structure Map — Where Everything Goes
12
+
13
+ > แผนที่โฟลเดอร์ครบทุกอัน: role + ใส่อะไร + **ห้ามใส่อะไร** · **อ่านก่อนสร้าง/ย้ายโน้ตทุกครั้ง** (one artifact = one canonical home)
14
+
15
+ ## §1 Quick Routing (90% fast path)
16
+
17
+ | ฉันมี... | ใส่ที่ | filename |
18
+ |---|---|---|
19
+ | งานจริง/โปรเจค | `Projects/<proj>/` | overview·context·current-state |
20
+ | log งานที่ทำ | `Sessions/` | `YYYY-MM-DD-<topic>.md` |
21
+ | preference ของเจ้าของ | `Shared/User-Memory/` | |
22
+ | การตัดสินใจสำคัญ | `Shared/Decision-Memory/` | |
23
+ | ยังไม่ชัด/ขัดกัน | `Shared/Memory-Inbox/` | |
24
+ | content จากเว็บ/paste | `Intake/_Quarantine/` | (scan ก่อน) |
25
+ | ต้นฉบับดิบ read-only | `Intake/Raw Sources/` | |
26
+ | script ที่ผ่าน test | `Skills/` | |
27
+ | how-to อ่านแล้วทำเอง | `Runbooks/` | |
28
+ | กลยุทธ์ที่ปรับดีขึ้น | `Playbooks/` | |
29
+ | page ของคน/องค์กร/concept | `Entities/` | |
30
+ | bug | `Bugs/` | `YYYY-MM-DD-<bug>.md` |
31
+ | ส่งมอบงานค้าง | `Handoffs/` | |
32
+
33
+ ## §2 Full Reference (ครบทุกโฟลเดอร์ — ใส่อะไร / ห้ามใส่)
34
+
35
+ ### Core
36
+ | Folder | Role | ใส่ที่นี่ | ห้ามใส่ |
37
+ |---|---|---|---|
38
+ | `Projects/` | งานจริง 1 โฟลเดอร์=1 โปรเจค | deliverable, overview/context/current-state ของ project | ความรู้ทั่วไป (→Learning), log (→Sessions) |
39
+ | `Sessions/` | log งานลงวันที่ (flat) | session log 7 หัวข้อ | code/config, subfolder |
40
+ | `Intake/` | จุดรับของใหม่ก่อนกระจาย | task framing, raw input ที่รอจัด | durable knowledge (จัดเข้าปลายทางก่อน) |
41
+ | `Intake/_Quarantine/` | external ที่ยัง untrusted | web clip/paste/email ก่อน scan injection | content ที่ scan ผ่านแล้ว |
42
+ | `Intake/Raw Sources/` | ต้นฉบับ immutable | original หลัง scan (read-only) | โน้ตที่ derived/สรุป |
43
+ | `Skills/` | unit ที่ executable + verified | script/command ที่รัน test ผ่าน | prose how-to (→Runbooks), unverified (→Memory-Inbox) |
44
+ | `Runbooks/` | prose how-to | ขั้นตอน setup/deploy/maintain | runnable unit (→Skills) |
45
+ | `Templates/` | แม่แบบโน้ต | template ไว้ instantiate | โน้ตจริง |
46
+ | `Bugs/` | bug reproducible (global flat) | bug report + link กลับ project | bug ของ project ที่ไม่ reproduce |
47
+ | `Handoffs/` | ส่งมอบงานค้าง (snapshot) | state + next steps ส่งต่อ | live coordination (→Coordination) |
48
+
49
+ ### Direction
50
+ | Folder | Role | ใส่ที่นี่ | ห้ามใส่ |
51
+ |---|---|---|---|
52
+ | `Goals/` | objective finite (มีวันจบ) | north-star + objective รายไตรมาส/ปี | live status (→Operating-State) |
53
+ | `Areas/` | โดเมนต่อเนื่อง (PARA) | brand/trading/content ฯลฯ | งานที่มีวันจบ (→Projects/Goals) |
54
+
55
+ ### Knowledge pipeline
56
+ | Folder | Role | ใส่ที่นี่ | ห้ามใส่ |
57
+ |---|---|---|---|
58
+ | `Research/` | finding อิงแหล่งนอก | สรุปมี `source::` + market scan | ความรู้ที่ตัวเองกลั่น (→Learning) |
59
+ | `Learning/` | กลั่น/deep-dive เอง | topic MOC ที่ไม่มี external source | finding อิงแหล่ง (→Research) |
60
+ | `Distillations/` | หลักการ evergreen | principle ที่นิ่งแล้ว (≥3 ครั้ง) | สิ่งที่ยังเปลี่ยน (→Playbooks) |
61
+ | `Retrospectives/` | reflection (event) | what worked/failed หลังงาน | review ตามรอบ (→Reviews) |
62
+ | `Reviews/` | review (cadence) | weekly/monthly + vault health | reflection รายงาน (→Retrospectives) |
63
+ | `Traces/` | reasoning chain ยาว | การสืบสวนหลายขั้น | คำตอบสั้น (→โน้ตปกติ) |
64
+ | `Prompts/` | prompt text (input ให้ LLM) | prompt/template หยิบมารัน | fixtures (→Acceptance), tactic (→Playbooks) |
65
+ | `Acceptance/` | golden fixtures | input→expected-output ตัดสิน done | gate ticklist (→Checklists), runner (→Evals) |
66
+ | `Checklists/` | preflight/postflight gate | ticklist ก่อน-หลังลงมือ | expected output (→Acceptance) |
67
+
68
+ ### Frontier loops
69
+ | Folder | Role | ใส่ที่นี่ | ห้ามใส่ |
70
+ |---|---|---|---|
71
+ | `Playbooks/` | กลยุทธ์ที่ปรับดีขึ้น (how-to-decide) | tactic/heuristic ที่ดีขึ้นจากผลจริง | prompt text (→Prompts), runnable (→Skills) |
72
+ | `Evals/` | quality loop (runner) | error-analysis + self-eval + retrieval-eval | golden case เอง (→Acceptance) |
73
+ | `Entities/` | page ของ entity (bi-temporal) | คน/องค์กร/concept canonical | event log (→Sessions) |
74
+
75
+ ### Shared — สมองกลาง
76
+ | Folder | Role | ใส่ที่นี่ | ห้ามใส่ |
77
+ |---|---|---|---|
78
+ | `Shared/` | hub: memory+rules+coordination | เข้าผ่าน AI-Context-Index | โน้ตงานทั่วไป |
79
+ | `Shared/Operating-State/` | live status ตอนนี้ | current-state + health/queue | objective (→Goals) |
80
+ | `Shared/User-Memory/` | AI เรียนรู้เรื่องเจ้าของ (mutable) | preference/response-example | identity static (→User-Persona) |
81
+ | `Shared/Decision-Memory/` | decision ที่ AI บันทึก | decision locked + supersedes | ground truth คน (→Core-Facts) |
82
+ | `Shared/Memory-Inbox/` | candidate ยังไม่ชัด | observation รอ promote (clear weekly) | durable ที่ชัดแล้ว (→ปลายทาง) |
83
+ | `Shared/Rules/` | กฎ operating always-on | memory/frontmatter/context-assembly | how-to ทำงาน (→Runbooks) |
84
+ | `Shared/Tech-Standards/` | มาตรฐานเทคนิค | MCP/stack/DoD/verification | |
85
+ | `Shared/Core-Facts/` | ground truth คนเขียน (read-only) | invariant ที่ AI ห้ามแก้ | decision ที่ AI ตัด (→Decision-Memory) |
86
+ | `Shared/Coordination/` | live multi-agent baton | NOW.md + task-board + registry | เอกสารส่งมอบ (→Handoffs) |
87
+ | `Shared/Working-Memory/` | scratchpad 1 task (ลบได้) | ของชั่วคราวระหว่างทำงาน | อะไรที่จะเก็บ (→Memory-Inbox) |
88
+ | `Shared/User-Persona/` | identity static (read-only) | บทบาท/ค่านิยม/ภาษา/timezone | สิ่งที่ AI เรียนรู้ (→User-Memory) |
89
+ | `Shared/Provenance/` | source ledger | บรรทัด ingest ต่อแหล่ง | โน้ต derived (ใส่ `source::` แทน) |
90
+ | `Shared/Archive/` | cold storage (ไม่ลบ) | โน้ต stale/retired ออกจาก retrieval | ของที่ยังใช้ |
91
+
92
+ ## §3 Decision Rules (เคสกำกวม)
93
+
94
+ - **durable vs throwaway:** ลบได้→`Working-Memory` · ยังไม่ชัด→`Memory-Inbox` · ชัด+ถาวร→`Shared/*` ปลายทาง
95
+ - **trusted vs untrusted:** ของนอกเข้า `Intake/_Quarantine` จนกว่าจะ scan ผ่าน
96
+ - **verified vs unverified script:** ผ่าน verification command→`Skills` · ไม่ผ่าน→`Memory-Inbox`
97
+ - **tactic vs principle:** ปรับดีขึ้นเรื่อยๆ→`Playbooks` · นิ่งแล้ว→`Distillations`
98
+ - **sourced vs self-derived:** มี external source→`Research` · กลั่นเอง→`Learning`
99
+ - **finite vs ongoing:** มีวันจบ→`Goals` · ไม่จบ→`Areas`
100
+ - **event vs cadence vs metric:** หลังงาน→`Retrospectives` · ตามรอบ→`Reviews` · วัดคุณภาพ→`Evals`
101
+
102
+ ## §4 Footer
103
+
104
+ > source of truth — sync กับ `src/brain.ts` FOLDERS[] · แก้พร้อมกันเสมอ
105
+
106
+ up:: [[Home]]