@justestif/pk 0.1.7 → 0.1.9

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 +60 -44
  2. package/dist/index.js +36669 -4420
  3. package/package.json +5 -2
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,38 +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]
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]
42
65
  pk search <query> [--context] [--limit 5] [--type] [--status] [--tag]
66
+ pk synthesize [query] [--all]
43
67
  pk vocab [--json]
44
- pk synthesize [query] [--all] [--session-start]
45
- pk index
68
+ pk rebuild
46
69
  pk lint
47
70
  pk instructions <command>
71
+ pk config
48
72
  ```
49
73
 
50
74
  ### Note types
@@ -60,43 +84,35 @@ pk instructions <command>
60
84
  ### Example
61
85
 
62
86
  ```bash
87
+ pk init acme --harness claude
63
88
  pk new decision "Use SQLite for search index" --tags search,architecture
64
89
  pk new question "Should we support multi-project mode?" --tags scope
65
- pk index
90
+ pk rebuild
66
91
  pk search "sqlite"
67
- pk synthesize --session-start
92
+ pk synthesize
68
93
  ```
69
94
 
70
95
  ## Knowledge structure
71
96
 
72
- Notes live in `knowledge/` as plain markdown files — human-editable,
97
+ Notes live in `~/.pk/<name>/` as plain markdown files — human-editable,
73
98
  git-diffable, readable without any tool.
74
99
 
75
100
  ```
76
- knowledge/
77
- notes/
78
- decisions/
79
- questions/
80
- sources/
81
- indexes/ ← generated by pk index
82
- .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
83
109
  ```
84
110
 
85
111
  Search is powered by SQLite FTS5 with BM25 ranking and porter stemming.
86
112
  Partial word matching works — `pk search migr` matches "migration", "migrate", etc.
87
- Matching body context is shown under each result.
88
- The index is a derived artifact — delete it and run `pk index` to rebuild.
89
-
90
- `pk vocab` lists all tags in the knowledge base by frequency. Useful for orienting
91
- an agent before searching, without loading full note content.
92
-
93
- ## Agent hook
94
-
95
- `pk init` installs `.claude/hooks/pk-user-prompt-submit.ts` and registers it
96
- in `.claude/settings.json`. The hook calls `pk synthesize --session-start`
97
- on every prompt and injects the result as additional context.
98
113
 
99
- 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.
100
116
 
101
117
  ## License
102
118