knowy-cli 0.1.2

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.
package/README.md ADDED
@@ -0,0 +1,138 @@
1
+ # Knowy
2
+
3
+ [繁體中文](README.zh-TW.md)
4
+
5
+ **Give your AI a structured project brain.**
6
+
7
+ Your AI assistant sees your code — but does it understand *why* you built it this way? What principles you won't compromise on? What you already tried and learned from?
8
+
9
+ Knowy gives your project three structured knowledge files that any AI tool can read, turning scattered context into a shared understanding.
10
+
11
+ ## Quick Start
12
+
13
+ ```bash
14
+ npx knowy-cli init
15
+ ```
16
+
17
+ This creates a `.knowledge/` directory in your project and connects it to your AI tools. Then, in your AI tool (e.g., Claude Code):
18
+
19
+ ```
20
+ /knowy init
21
+ ```
22
+
23
+ This starts an interactive conversation to help you fill in your knowledge files.
24
+
25
+ ## What It Creates
26
+
27
+ ```
28
+ .knowledge/
29
+ principles.md ← Core beliefs and rules (rarely changes)
30
+ vision.md ← Goals, architecture, roadmap (evolves)
31
+ experience.md ← Distilled lessons (grows over time)
32
+ research/ ← Exploratory notes → may become principles
33
+ design/ ← Detailed designs → inform vision
34
+ history/ ← Event records → distilled into experience
35
+ .templates/ ← Reference templates (managed by Knowy)
36
+ ```
37
+
38
+ ## How It Works
39
+
40
+ Every project has knowledge that lives in people's heads — why certain decisions were made, what failed before, where things are headed. Knowy makes that knowledge explicit and structured:
41
+
42
+ - **Principles** answer "what rules guide us?" — your non-negotiable beliefs and the rules derived from them.
43
+ - **Vision** answers "where are we going?" — the problem you're solving, current state, and roadmap.
44
+ - **Experience** answers "what have we learned?" — patterns from development, especially where expectations met reality.
45
+
46
+ Your AI tools read these files automatically, so their suggestions align with your project's actual context — not just the code.
47
+
48
+ ## Skills
49
+
50
+ Knowy installs four skills for Claude Code (under the `/knowy` namespace):
51
+
52
+ | Skill | What it does |
53
+ |-------|-------------|
54
+ | `/knowy init` | Interactive conversation to create or populate knowledge files |
55
+ | `/knowy update` | Check knowledge file structure against latest templates |
56
+ | `/knowy judge` | Cross-check the three files for consistency and coherence |
57
+ | `/knowy next` | Plan the next step based on your principles, vision, and experience |
58
+
59
+ ### `/knowy judge` — Knowledge Health Check
60
+
61
+ Runs 17 checks across your knowledge files:
62
+
63
+ - **Self-consistency** (3): Are derivation chains intact? Is the structure sound?
64
+ - **Internal coherence** (3): Are there contradictions within each file?
65
+ - **Cross-references** (6): Do the files agree with each other? Checks all six directions (e.g., "Does experience support the vision?" is different from "Does vision address what experience found?")
66
+ - **Project alignment** (3): Do the files match the actual project state (code, dependencies, git history)?
67
+ - **Overall** (1): Synthesis — where should you focus?
68
+ - **Beyond scope** (1): Is there content that belongs elsewhere?
69
+
70
+ Results use traffic light indicators: 🟢 healthy (one-line summary), 🟡 tension (expanded with details), 🔴 conflict (expanded with suggested action).
71
+
72
+ ## Supported Tools
73
+
74
+ Knowy detects and connects to 25+ AI and spec tools:
75
+
76
+ | Category | Tools |
77
+ |----------|-------|
78
+ | **AI Coding** | Claude Code, Cursor, Windsurf, GitHub Copilot, Codex CLI, Gemini CLI, Kiro, Amazon Q, Cline, Roo Code, Kilo Code, Aider, Continue.dev, Augment Code, Amp, Devin, Warp, Zed, OpenCode, Qodo, JetBrains AI, Tabnine, Replit Agent, Bolt.new |
79
+ | **Spec Tools** | Speckit, OpenSpec, Kiro Specs |
80
+ | **Standard** | AGENTS.md (cross-tool standard) |
81
+
82
+ `knowy init` auto-detects which tools you have and injects a reference to your `.knowledge/` files. `knowy update` catches tools added later.
83
+
84
+ ## MCP Server
85
+
86
+ Knowy also works as an MCP (Model Context Protocol) server, so your AI tool can use Knowy directly without the CLI:
87
+
88
+ ```bash
89
+ npx knowy-cli setup-mcp
90
+ ```
91
+
92
+ This configures the MCP server for your AI tool (Claude Code, Claude Desktop, Cursor, etc.). Once set up, your AI can call `knowy_init`, `knowy_update`, `knowy_judge`, and `knowy_next` as native tools.
93
+
94
+ You can also configure it manually. Add to your AI tool's MCP settings:
95
+
96
+ ```json
97
+ {
98
+ "mcpServers": {
99
+ "knowy": {
100
+ "command": "npx",
101
+ "args": ["-y", "knowy-cli", "--", "knowy-mcp"]
102
+ }
103
+ }
104
+ }
105
+ ```
106
+
107
+ ## Updating
108
+
109
+ When Knowy releases a new version with improved skills or templates:
110
+
111
+ ```bash
112
+ npx knowy-cli update
113
+ ```
114
+
115
+ This updates skills and templates (managed files) without touching your knowledge files. It also detects any new AI tools you've added since the last run.
116
+
117
+ ## Design Principles
118
+
119
+ - **Tool-agnostic**: `.knowledge/` is plain Markdown — works with any tool, or none.
120
+ - **Zero dependencies**: No runtime, no server. Three Markdown files and a few skills.
121
+ - **No lock-in**: Knowy doesn't own your workflow. It connects to your existing tools, not the other way around.
122
+ - **Progressive adoption**: Use just the files, or add the skills, or both.
123
+
124
+ ## The Theory (for the curious)
125
+
126
+ The three-file structure isn't arbitrary. It maps to the structure of a *judgment* — the minimal unit of knowledge:
127
+
128
+ - **Principles** = what is correct (the standard)
129
+ - **Vision** = what is being built (the construction)
130
+ - **Experience** = what context we're in (the situation)
131
+
132
+ These three perspectives are inseparable — each one only makes sense in relation to the other two. `/knowy judge` verifies that they're still in alignment, and `/knowy next` uses all three to plan coherent next steps.
133
+
134
+ This framework draws from [triperspectivalism](https://en.wikipedia.org/wiki/Triperspectivalism) and type-theoretic judgments (Γ ⊢ t : A). If you're curious, the research papers behind Knowy's design are in the project's `.knowledge/research/` directory.
135
+
136
+ ## License
137
+
138
+ MIT
@@ -0,0 +1,138 @@
1
+ # Knowy
2
+
3
+ [English](README.md)
4
+
5
+ **給你的 AI 一個結構化的專案大腦。**
6
+
7
+ 你的 AI 助手看得到你的程式碼——但它理解你*為什麼*這樣設計嗎?哪些原則是你不會妥協的?哪些你已經試過、從中學到教訓了?
8
+
9
+ Knowy 為你的專案建立三份結構化的知識文件,讓任何 AI 工具都能讀取,把散落的脈絡變成共享的理解。
10
+
11
+ ## 快速開始
12
+
13
+ ```bash
14
+ npx knowy-cli init
15
+ ```
16
+
17
+ 這會在你的專案中建立 `.knowledge/` 目錄並連結你的 AI 工具。接著,在你的 AI 工具中(例如 Claude Code):
18
+
19
+ ```
20
+ /knowy init
21
+ ```
22
+
23
+ 這會啟動一段互動式對話,幫助你填寫知識文件。
24
+
25
+ ## 建立的結構
26
+
27
+ ```
28
+ .knowledge/
29
+ principles.md ← 核心信念和規則(很少變動)
30
+ vision.md ← 目標、架構、路線圖(持續演進)
31
+ experience.md ← 蒸餾出的教訓(逐漸成長)
32
+ research/ ← 探索性筆記 → 可能成為原則
33
+ design/ ← 詳細設計 → 反映到願景
34
+ history/ ← 事件記錄 → 蒸餾成經驗
35
+ .templates/ ← 參考模板(由 Knowy 管理)
36
+ ```
37
+
38
+ ## 運作方式
39
+
40
+ 每個專案都有活在人們腦中的知識——為什麼做出某些決定、什麼曾經失敗、接下來要往哪裡走。Knowy 把這些知識變得明確且結構化:
41
+
42
+ - **原則(Principles)** 回答「什麼規則引導我們?」——你不可妥協的信念,以及從中推導出的規則。
43
+ - **願景(Vision)** 回答「我們要往哪裡走?」——要解決的問題、現狀和路線圖。
44
+ - **經驗(Experience)** 回答「我們學到了什麼?」——開發中的模式,特別是預期和現實有落差的地方。
45
+
46
+ 你的 AI 工具會自動讀取這些文件,讓它的建議能符合專案的實際脈絡——而不只是程式碼。
47
+
48
+ ## Skills
49
+
50
+ Knowy 為 Claude Code 安裝四個 skill(在 `/knowy` 命名空間下):
51
+
52
+ | Skill | 功能 |
53
+ |-------|------|
54
+ | `/knowy init` | 互動式對話,建立或填寫知識文件 |
55
+ | `/knowy update` | 檢查知識文件結構是否符合最新模板 |
56
+ | `/knowy judge` | 交叉檢查三份文件的一致性和連貫性 |
57
+ | `/knowy next` | 根據原則、願景和經驗規劃下一步 |
58
+
59
+ ### `/knowy judge` — 知識健康檢查
60
+
61
+ 對你的知識文件執行 17 項檢查:
62
+
63
+ - **自洽性**(3):推導鏈是否完整?結構是否健全?
64
+ - **內部一致**(3):各文件內部是否有矛盾?
65
+ - **交叉引用**(6):三份文件之間是否一致?檢查所有六個方向(例如「經驗是否支持願景?」和「願景是否回應了經驗的發現?」是不同的問題)
66
+ - **專案對齊**(3):文件是否與專案實際狀態一致(程式碼、依賴、git 歷史)?
67
+ - **總體**(1):綜合歸納——應該先關注哪裡?
68
+ - **超出範圍**(1):有沒有不屬於這個專案的內容?
69
+
70
+ 結果使用交通燈指示:🟢 健康(一行摘要)、🟡 張力(展開細節)、🔴 衝突(展開並建議行動)。
71
+
72
+ ## 支援的工具
73
+
74
+ Knowy 偵測並連結 25+ 種 AI 和規格工具:
75
+
76
+ | 類別 | 工具 |
77
+ |------|------|
78
+ | **AI 編碼** | Claude Code、Cursor、Windsurf、GitHub Copilot、Codex CLI、Gemini CLI、Kiro、Amazon Q、Cline、Roo Code、Kilo Code、Aider、Continue.dev、Augment Code、Amp、Devin、Warp、Zed、OpenCode、Qodo、JetBrains AI、Tabnine、Replit Agent、Bolt.new |
79
+ | **規格工具** | Speckit、OpenSpec、Kiro Specs |
80
+ | **標準** | AGENTS.md(跨工具標準) |
81
+
82
+ `knowy init` 自動偵測你安裝了哪些工具,並注入指向 `.knowledge/` 的引用。`knowy update` 會補上之後新增的工具。
83
+
84
+ ## MCP Server
85
+
86
+ Knowy 也可以作為 MCP(Model Context Protocol)server 運作,讓你的 AI 工具直接使用 Knowy,不需要 CLI:
87
+
88
+ ```bash
89
+ npx knowy-cli setup-mcp
90
+ ```
91
+
92
+ 這會為你的 AI 工具(Claude Code、Claude Desktop、Cursor 等)設定 MCP server。設定完成後,你的 AI 可以直接呼叫 `knowy_init`、`knowy_update`、`knowy_judge` 和 `knowy_next`。
93
+
94
+ 也可以手動設定。在你的 AI 工具的 MCP 設定中加入:
95
+
96
+ ```json
97
+ {
98
+ "mcpServers": {
99
+ "knowy": {
100
+ "command": "npx",
101
+ "args": ["-y", "knowy-cli", "--", "knowy-mcp"]
102
+ }
103
+ }
104
+ }
105
+ ```
106
+
107
+ ## 更新
108
+
109
+ 當 Knowy 發布新版本(改進的 skills 或模板):
110
+
111
+ ```bash
112
+ npx knowy-cli update
113
+ ```
114
+
115
+ 這會更新 skills 和模板(受管理的文件),不會動到你的知識文件。它也會偵測你在上次執行後新增的 AI 工具。
116
+
117
+ ## 設計原則
118
+
119
+ - **工具無關**:`.knowledge/` 是純 Markdown——任何工具都能用,或不用工具也行。
120
+ - **零依賴**:不需要 runtime,不需要 server。三份 Markdown 文件和幾個 skills。
121
+ - **不鎖定**:Knowy 不擁有你的工作流程。它連結到你現有的工具,而不是反過來。
122
+ - **漸進採用**:只用文件,或加上 skills,或兩者都用。
123
+
124
+ ## 理論基礎(給好奇的人)
125
+
126
+ 三份文件的結構不是隨意的。它對應到 *判斷(judgment)* 的結構——知識的最小單位:
127
+
128
+ - **原則** = 什麼是正確的(規範)
129
+ - **願景** = 正在建造什麼(構造)
130
+ - **經驗** = 我們所處的脈絡(處境)
131
+
132
+ 這三個視角不可分割——每一個都只有在與另外兩個的關係中才有意義。`/knowy judge` 驗證它們是否仍然對齊,`/knowy next` 利用三者來規劃連貫的下一步。
133
+
134
+ 這個框架源自[三視角主義(triperspectivalism)](https://en.wikipedia.org/wiki/Triperspectivalism)和型別論中的判斷(Γ ⊢ t : A)。如果你有興趣,Knowy 設計背後的研究文件在專案的 `.knowledge/research/` 目錄中。
135
+
136
+ ## 授權
137
+
138
+ MIT
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import { startMcpServer } from '../src/mcp-server.js';
3
+ startMcpServer();
package/bin/knowy.js ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import { run } from '../src/cli.js';
3
+ run(process.argv.slice(2));
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "knowy-cli",
3
+ "version": "0.1.2",
4
+ "description": "Give your AI a structured project brain",
5
+ "type": "module",
6
+ "bin": {
7
+ "knowy": "./bin/knowy.js",
8
+ "knowy-mcp": "./bin/knowy-mcp.js"
9
+ },
10
+ "files": [
11
+ "bin/",
12
+ "src/",
13
+ "templates/",
14
+ "skills/",
15
+ "snippets/"
16
+ ],
17
+ "engines": {
18
+ "node": ">=18.0.0"
19
+ },
20
+ "keywords": [
21
+ "ai",
22
+ "knowledge",
23
+ "development",
24
+ "methodology",
25
+ "claude",
26
+ "cursor",
27
+ "copilot",
28
+ "agents"
29
+ ],
30
+ "license": "MIT",
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "https://github.com/timcsy/knowy"
34
+ }
35
+ }
@@ -0,0 +1,134 @@
1
+ ---
2
+ name: knowy-init
3
+ description: AI-guided creation of project knowledge files (.knowledge/)
4
+ user-invokable: true
5
+ argument-hint: "[topic or file to focus on]"
6
+ ---
7
+
8
+ # Knowy Init
9
+
10
+ Help the user create or populate their project knowledge files through layered, progressive conversation.
11
+
12
+ ## User Input
13
+
14
+ ```text
15
+ $ARGUMENTS
16
+ ```
17
+
18
+ ## Governance Principles
19
+
20
+ - **Principles are the highest authority.** When helping write principles, push the user to find the *root* — the one belief everything else derives from. Don't settle for surface-level rules.
21
+ - **Vision evolves with understanding.** It's OK if vision is incomplete at first. Help the user capture what they know now.
22
+ - **Experience is distilled, not accumulated.** Guide the user to extract patterns, not dump event logs.
23
+ - **Knowledge files are indexes, not encyclopedias.** Keep core files short. Point to subdirectories for details.
24
+ - **Never write files without explicit user confirmation.** Always show the draft first.
25
+
26
+ ## Workflow
27
+
28
+ ### 1. Read current state
29
+
30
+ - Read `.knowledge/principles.md`, `.knowledge/vision.md`, `.knowledge/experience.md`
31
+ - Read `.knowledge/.templates/` to understand suggested structure
32
+ - Read project structure, package.json/Cargo.toml/etc. to understand the tech context
33
+ - Identify which files are empty or still contain only template comments
34
+
35
+ ### 2. Determine scope
36
+
37
+ - If `$ARGUMENTS` specifies a file (e.g., "principles"): focus on that file
38
+ - If `$ARGUMENTS` specifies a subdirectory file (e.g., "design/auth-system"): help create that file
39
+ - If `$ARGUMENTS` is empty: assess all three core files and start with whichever needs the most work
40
+
41
+ ### 3. Progressive conversation
42
+
43
+ Use layered questioning — start broad, then drill deeper. Don't ask all questions at once.
44
+
45
+ **For principles.md — Layer by layer:**
46
+
47
+ Layer 1 (Root):
48
+ - "What problem does this project exist to solve?"
49
+ - "If you could only keep one rule about how this project works, what would it be?"
50
+ - "What would you *never* compromise on, even under deadline pressure?"
51
+
52
+ Layer 2 (Derive):
53
+ - "Why is that true? What deeper belief makes you hold that rule?"
54
+ - "If that's your root axiom, what follows from it? What rules does it imply?"
55
+ - "Can you think of a time this principle was tested? What happened?"
56
+
57
+ Layer 3 (Structure):
58
+ - "Let's trace the derivation chain: [root axiom] → [principle 1] → [specific rule]. Does this chain make sense?"
59
+ - "Are there principles that reinforce each other? How do they connect?"
60
+ - "Is there anything you believe that *doesn't* derive from your root axiom? That might be a second axiom, or it might derive from the first in a way we haven't found yet."
61
+
62
+ **For vision.md — Layer by layer:**
63
+
64
+ Layer 1 (Problem):
65
+ - "Who has the problem this project solves? What do they do today without your project?"
66
+ - "What's the core idea — in one or two sentences?"
67
+
68
+ Layer 2 (State):
69
+ - "What works right now? What's broken or missing?"
70
+ - "What are the key technical decisions you've made, and why?"
71
+
72
+ Layer 3 (Direction):
73
+ - "What are the next 2-3 milestones? What does each one deliver?"
74
+ - "For each milestone: what must be done before it? How will you know it's done?"
75
+ - "Is there anything in the roadmap you're uncertain about? Let's mark that explicitly."
76
+
77
+ **For experience.md — Layer by layer:**
78
+
79
+ Layer 1 (Surface):
80
+ - "What surprised you during development?"
81
+ - "What took longer than expected? Why?"
82
+ - "What would you warn your past self about?"
83
+
84
+ Layer 2 (Pattern):
85
+ - "Is there a pattern behind those surprises? Something that might happen again?"
86
+ - "What did you expect would happen vs what actually happened?"
87
+ - "How did you solve it? Would you solve it the same way again?"
88
+
89
+ Layer 3 (Distill):
90
+ - "Let's turn that into a lesson: what's the one-sentence pattern?"
91
+ - "What theory or assumption was wrong? What's the corrected understanding?"
92
+ - "Where in the codebase can we see the evidence of this lesson?"
93
+
94
+ **For subdirectory files (research/, design/, history/):**
95
+ - Read existing core files for context
96
+ - Ask about the specific topic
97
+ - Suggest a filename following the directory's purpose
98
+ - After creating: suggest how the content might eventually distill into the parent core file
99
+
100
+ ### 4. Draft content
101
+
102
+ Based on the conversation:
103
+ - Draft the content in the user's language
104
+ - Follow the structure from the templates but use real content
105
+ - For principles: show explicit derivation chains (Root Axiom → Principle → What it means in practice)
106
+ - For vision: be concrete about current state, include success criteria for milestones
107
+ - For experience: use the four-part format (Theory said X → Actually happened Y → We solved it by Z → Lesson: W)
108
+
109
+ ### 5. Self-check before proposing
110
+
111
+ Before showing the draft to the user, verify:
112
+ - **Self-consistency**: Does the draft contradict itself?
113
+ - **Cross-consistency**: Does the draft conflict with the other two knowledge files?
114
+ - **Project alignment**: Does the draft match the actual project state?
115
+
116
+ If you find issues, revise the draft or flag them to the user.
117
+
118
+ ### 6. Confirm and write
119
+
120
+ - Present the draft to the user
121
+ - Highlight any concerns from the self-check
122
+ - Ask for feedback and iterate if needed
123
+ - Only write to files after explicit user confirmation
124
+ - Never overwrite existing content without showing a diff of what will change
125
+
126
+ ## Guidelines
127
+
128
+ - **Language**: Read `.knowy.json` → `language` field (e.g., `"zh-TW"`). Use that language for ALL output — questions, drafts, suggestions, everything. If `.knowy.json` is missing or has no language field, detect from conversation context or default to English.
129
+ - **Layer your questions** — don't dump all questions at once. Ask 2-3, listen, then go deeper.
130
+ - Keep language practical and clear — avoid academic jargon
131
+ - Reference existing content in other knowledge files when relevant
132
+ - If the user seems unsure, offer concrete examples from common project types
133
+ - For subdirectory files, suggest how content might eventually be distilled into core files
134
+ - Push for specificity — "write clean code" is not a principle; "every function has exactly one responsibility because [root axiom]" is