@justestif/pk 0.1.6 → 0.1.8

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 (3) hide show
  1. package/README.md +64 -41
  2. package/dist/index.js +40748 -937
  3. package/package.json +38 -33
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # pk
2
2
 
3
- Project knowledge CLI — structured intake, search, and recall over `knowledge/`.
3
+ Project knowledge CLI — structured intake, search, and recall.
4
4
 
5
5
  ## Install
6
6
 
@@ -13,37 +13,62 @@ Requires [Bun](https://bun.sh).
13
13
  ## Setup
14
14
 
15
15
  ```bash
16
- cd your-project
17
- pk init # Claude Code (default)
18
- pk init --harness pi # Pi
19
- pk init --harness omp # Oh My Pi
20
- pk init --harness opencode # OpenCode
21
- pk init --harness cursor # Cursor
22
- pk init --harness codex # Codex CLI
16
+ pk init
23
17
  ```
24
18
 
25
- Creates `knowledge/`, copies the skill to `.agents/skills/pk/`, and installs
26
- the harness adapter. Each harness injects current project context (open questions,
27
- recent decisions, active notes) automatically into every session.
19
+ Interactive: picks a project name and one or more harnesses (space to toggle, enter to confirm).
28
20
 
29
- | Harness | Mechanism | Files generated |
30
- |---|---|---|
31
- | `claude` | `UserPromptSubmit` hook | `.claude/hooks/pk-*.ts` + `settings.json` |
32
- | `pi` | `before_agent_start` extension | `.pi/extensions/pk.ts` |
33
- | `omp` | `before_agent_start` hook | `.omp/extensions/pk.ts` |
34
- | `opencode` | `experimental.chat.system.transform` | `.opencode/plugins/pk.ts` |
35
- | `cursor` | Agent rule | `.cursor/rules/pk.mdc` |
36
- | `codex` | `AGENTS.md` block | `AGENTS.md` |
21
+ Non-interactive:
22
+
23
+ ```bash
24
+ pk init my-project --harness claude
25
+ pk init my-project --harness claude,omp,cursor # multiple harnesses
26
+ ```
27
+
28
+ Available harnesses: `claude`, `claude-desktop`, `omp`, `cursor`, `opencode`, `codex`.
29
+
30
+ `pk init` does three things:
31
+
32
+ 1. Creates `~/.pk/<name>/` as the knowledge home for this project
33
+ 2. Writes an MCP server config so your harness discovers `pk mcp`
34
+ 3. Copies the `pk` skill to the harness skill directory (where supported)
35
+
36
+ | Harness | Config file written |
37
+ |---|---|
38
+ | `claude` | `.mcp.json` (project root) |
39
+ | `claude-desktop` | `~/Library/Application Support/Claude/claude_desktop_config.json` |
40
+ | `cursor` | `.cursor/mcp.json` |
41
+ | `omp` | `.omp/mcp.json` |
42
+ | `opencode` | `opencode.json` |
43
+ | `codex` | `.codex/config.toml` |
44
+
45
+ ## How it works
46
+
47
+ `pk mcp` runs a stdio MCP server that exposes four tools to any connected agent:
48
+
49
+ | Tool | What it does |
50
+ |---|---|
51
+ | `pk_search` | Full-text search over the knowledge base (BM25, porter stemming) |
52
+ | `pk_synthesize` | Summarise notes matching a query or the whole base |
53
+ | `pk_new` | Create a new note (type, title, tags, body) |
54
+ | `pk_lint` | Validate all notes for schema and quality rules |
55
+
56
+ The agent calls these tools directly — no hooks, no shell extensions, no prompt injection.
37
57
 
38
58
  ## Commands
39
59
 
40
60
  ```bash
41
- pk new <type> <title> [--tags tag1,tag2]
42
- pk search <query> [--context] [--limit 5]
43
- pk synthesize [query] [--all] [--session-start]
44
- pk index
61
+ pk init [name] [--harness h1,h2,…] # set up project + MCP config
62
+ pk mcp # start MCP server (stdio)
63
+
64
+ pk new <type> <title> [--tags t1,t2]
65
+ pk search <query> [--context] [--limit 5] [--type] [--status] [--tag]
66
+ pk synthesize [query] [--all]
67
+ pk vocab [--json]
68
+ pk rebuild
45
69
  pk lint
46
70
  pk instructions <command>
71
+ pk config
47
72
  ```
48
73
 
49
74
  ### Note types
@@ -54,42 +79,40 @@ pk instructions <command>
54
79
  | `decision` | Chosen direction with rationale and consequences |
55
80
  | `question` | Unresolved uncertainty that blocks or informs work |
56
81
  | `source` | Raw input preserved for provenance |
82
+ | `index` | Navigation/map-of-content over a topic or tag |
57
83
 
58
84
  ### Example
59
85
 
60
86
  ```bash
87
+ pk init acme --harness claude
61
88
  pk new decision "Use SQLite for search index" --tags search,architecture
62
89
  pk new question "Should we support multi-project mode?" --tags scope
63
- pk index
90
+ pk rebuild
64
91
  pk search "sqlite"
65
- pk synthesize --session-start
92
+ pk synthesize
66
93
  ```
67
94
 
68
95
  ## Knowledge structure
69
96
 
70
- Notes live in `knowledge/` as plain markdown files — human-editable,
97
+ Notes live in `~/.pk/<name>/` as plain markdown files — human-editable,
71
98
  git-diffable, readable without any tool.
72
99
 
73
100
  ```
74
- knowledge/
75
- notes/
76
- decisions/
77
- questions/
78
- sources/
79
- indexes/ ← generated by pk index
80
- .index.db FTS5 search index, gitignored
101
+ ~/.pk/
102
+ <project-name>/
103
+ notes/
104
+ decisions/
105
+ questions/
106
+ sources/
107
+ indexes/ generated by pk rebuild
108
+ .index.db ← FTS5 search index, gitignored
81
109
  ```
82
110
 
83
111
  Search is powered by SQLite FTS5 with BM25 ranking and porter stemming.
84
- The index is a derived artifact delete it and run `pk index` to rebuild.
85
-
86
- ## Agent hook
87
-
88
- `pk init` installs `.claude/hooks/pk-user-prompt-submit.ts` and registers it
89
- in `.claude/settings.json`. The hook calls `pk synthesize --session-start`
90
- on every prompt and injects the result as additional context.
112
+ Partial word matching works`pk search migr` matches "migration", "migrate", etc.
91
113
 
92
- To install for other harnesses, contributions welcome.
114
+ `pk vocab` lists all tags by frequency — useful for orienting an agent before
115
+ searching, without loading full note content.
93
116
 
94
117
  ## License
95
118