@justestif/pk 0.2.1 → 0.3.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 (4) hide show
  1. package/README.md +29 -20
  2. package/dist/index.js +1811 -6840
  3. package/package.json +2 -2
  4. package/skill/SKILL.md +67 -32
package/README.md CHANGED
@@ -30,10 +30,12 @@ Non-interactive:
30
30
 
31
31
  ```bash
32
32
  pk init my-project --harness claude
33
- pk init my-project --harness claude,cursor # multiple harnesses
33
+ pk init my-project --harness claude,codex # multiple harnesses
34
34
  ```
35
35
 
36
- Available harnesses: `claude` (Claude Code & Claude Desktop), `cursor` (Cursor), `gemini` (Gemini CLI), `codex` (Codex), `opencode` (OpenCode).
36
+ **Git integration:** `pk init` creates a git repository in `~/.pk/<name>/.git` and tracks all knowledge operations via commits and git notes.
37
+
38
+ Available harnesses: `claude` (Claude Code & Claude Desktop), `codex` (Codex), `opencode` (OpenCode).
37
39
 
38
40
  `pk init` does three things:
39
41
 
@@ -43,25 +45,27 @@ Available harnesses: `claude` (Claude Code & Claude Desktop), `cursor` (Cursor),
43
45
 
44
46
  | Harness | Files written |
45
47
  |---|---|
46
- | `claude` | `.mcp.json`, `CLAUDE.md`, `.claude/hooks/pk-eval.ts`, `.claude/settings.json` | (also works for Claude Desktop) |
47
- | `cursor` | `.cursor/mcp.json`, `.cursor/rules/pk.mdc`, `.cursor/hooks/pk-eval.sh`, `.cursor/hooks.json` |
48
- | `gemini` | `.gemini/settings.json`, `GEMINI.md`, `.gemini/hooks/pk-eval.sh` |
48
+ | `claude` | `.mcp.json`, `CLAUDE.md`, `.claude/hooks/pk-eval.ts`, `.claude/settings.json` |
49
49
  | `codex` | `.codex/config.toml`, `AGENTS.md`, `.codex/hooks/pk-eval.sh`, `.codex/hooks.json` |
50
50
  | `opencode` | `opencode.json`, `AGENTS.md`, `CLAUDE.md`, `.opencode/plugins/pk-eval.ts` |
51
51
 
52
- ## How it works
52
+ ## MCP
53
53
 
54
- `pk mcp` runs a stdio MCP server that exposes five tools to any connected agent:
54
+ `pk mcp` starts an MCP server on stdio. It runs in-process — tools call the same lib functions as the CLI, no subprocess overhead.
55
55
 
56
- | Tool | What it does |
57
- |---|---|
58
- | `pk_search` | Full-text search over the knowledge base (BM25, porter stemming) |
59
- | `pk_synthesize` | Ranked context dump — by query, session start, or all notes |
60
- | `pk_read` | Read the full content of a note by path |
61
- | `pk_new` | Create a new typed note skeleton, returns path to fill in |
62
- | `pk_lint` | Validate all notes for schema and quality rules |
56
+ For Claude Desktop, add to `claude_desktop_config.json`:
63
57
 
64
- The agent calls these tools directly — no hooks, no shell extensions, no prompt injection. Agents should never read or write knowledge files directly.
58
+ ```json
59
+ {
60
+ "mcpServers": {
61
+ "pk": {
62
+ "command": "pk",
63
+ "args": ["mcp"],
64
+ "env": { "PK_KNOWLEDGE_DIR": "/Users/you/.pk/my-project" }
65
+ }
66
+ }
67
+ }
68
+ ```
65
69
 
66
70
  ## Commands
67
71
 
@@ -70,11 +74,15 @@ pk init [name] [--harness h1,h2,…] # set up project + MCP config
70
74
  pk mcp # start MCP server (stdio)
71
75
 
72
76
  pk new <type> <title> [--tags t1,t2]
73
- pk search <query> [--context] [--limit 5] [--type] [--status] [--tag]
77
+ pk edit <path> [--editor <cmd>] # edit existing note
78
+ pk delete <path> [--yes] # delete note with confirmation
79
+ pk search <query> [--limit 5] [--type] [--status] [--tag]
74
80
  pk synthesize [query] [--all]
81
+ pk history [--limit 20] [--type <type>] [--filter-type <type>] [--filter-tag <tag>] [--filter-operation <op>]
82
+ pk read <path> [--json]
75
83
  pk vocab [--json]
76
84
  pk rebuild
77
- pk lint
85
+ pk lint [paths...] [--json]
78
86
  pk instructions <command>
79
87
  pk config
80
88
  ```
@@ -103,7 +111,7 @@ pk synthesize
103
111
  ## Knowledge structure
104
112
 
105
113
  Notes live in `~/.pk/<name>/` as plain markdown files — human-editable and git-diffable.
106
- Agents access them exclusively through the MCP tools; humans can read and edit them directly.
114
+ Agents access them exclusively through MCP tools; humans can read and edit them directly.
107
115
 
108
116
  ```
109
117
  ~/.pk/
@@ -119,8 +127,9 @@ Agents access them exclusively through the MCP tools; humans can read and edit t
119
127
  Search is powered by SQLite FTS5 with BM25 ranking and porter stemming.
120
128
  Partial word matching works — `pk search migr` matches "migration", "migrate", etc.
121
129
 
122
- `pk vocab` lists all tags by frequency — useful for orienting an agent before
123
- searching, without loading full note content.
130
+ `pk vocab` lists all tags by frequency — useful for orienting an agent before searching, without loading full note content.
131
+
132
+ `pk history` shows all knowledge operations (create, update, delete) as git commits and synthesize operations as git notes. Supports filtering by type, tag, and operation.
124
133
 
125
134
  ## License
126
135