@lebronj/pi-suite 0.1.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 (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +86 -0
  3. package/extensions/pet.ts +1033 -0
  4. package/extensions/prompt-url-widget.ts +158 -0
  5. package/extensions/redraws.ts +24 -0
  6. package/extensions/snake.ts +343 -0
  7. package/extensions/tps.ts +47 -0
  8. package/package.json +69 -0
  9. package/prompts/cl.md +54 -0
  10. package/prompts/is.md +25 -0
  11. package/prompts/pr.md +37 -0
  12. package/prompts/wr.md +35 -0
  13. package/scripts/bootstrap.sh +95 -0
  14. package/skills/add-llm-provider.md +57 -0
  15. package/skills/image-to-editable-ppt-slide/SKILL.md +113 -0
  16. package/skills/image-to-editable-ppt-slide/scripts/generate_spec_template.py +91 -0
  17. package/skills/image-to-editable-ppt-slide/scripts/pptx_rebuilder.py +181 -0
  18. package/skills/leetcode-array/SKILL.md +40 -0
  19. package/skills/leetcode-array/problems/best_time_to_buy_and_sell_stock.py +19 -0
  20. package/skills/leetcode-array/problems/product_of_array_except_self.py +22 -0
  21. package/skills/leetcode-array/problems/two_sum.py +19 -0
  22. package/skills/pi-skill/SKILL.md +154 -0
  23. package/skills/weather.md +49 -0
  24. package/vendor/pi-memory/LICENSE +21 -0
  25. package/vendor/pi-memory/README.md +223 -0
  26. package/vendor/pi-memory/index.ts +2367 -0
  27. package/vendor/pi-memory/package.json +68 -0
  28. package/vendor/pi-memory/scripts/postinstall.cjs +44 -0
  29. package/vendor/pi-memory/src/cli.ts +79 -0
  30. package/vendor/pi-memory/src/curator-core/audit.ts +45 -0
  31. package/vendor/pi-memory/src/curator-core/curate.ts +90 -0
  32. package/vendor/pi-memory/src/curator-core/metadata.ts +55 -0
  33. package/vendor/pi-memory/src/curator-core/patch.ts +24 -0
  34. package/vendor/pi-memory/src/curator-core/policy.ts +77 -0
  35. package/vendor/pi-memory/src/curator-store/file-store.ts +51 -0
  36. package/vendor/pi-memory/src/curator-store/types.ts +21 -0
  37. package/vendor/pi-memory/src/index.ts +35 -0
  38. package/vendor/pi-memory/src/learning/candidates.ts +205 -0
  39. package/vendor/pi-memory/src/learning/memory.ts +144 -0
  40. package/vendor/pi-memory/src/learning/skills.ts +200 -0
  41. package/vendor/pi-memory/src/service-controller.ts +248 -0
  42. package/vendor/pi-memory/test/curate.test.ts +68 -0
  43. package/vendor/pi-memory/test/learning-candidates.test.ts +107 -0
  44. package/vendor/pi-memory/test/memory-promotions.test.ts +44 -0
  45. package/vendor/pi-memory/test/metadata.test.ts +17 -0
  46. package/vendor/pi-memory/test/skill-drafts.test.ts +57 -0
  47. package/vendor/pi-memory/test/transition-handoff.test.ts +86 -0
@@ -0,0 +1,19 @@
1
+ from __future__ import annotations
2
+
3
+
4
+ def max_profit(prices: list[int]) -> int:
5
+ min_price = float("inf")
6
+ best = 0
7
+
8
+ for price in prices:
9
+ if price < min_price:
10
+ min_price = price
11
+ continue
12
+ best = max(best, price - min_price)
13
+
14
+ return best
15
+
16
+
17
+ if __name__ == "__main__":
18
+ sample_prices = [7, 1, 5, 3, 6, 4]
19
+ print(max_profit(sample_prices))
@@ -0,0 +1,22 @@
1
+ from __future__ import annotations
2
+
3
+
4
+ def product_except_self(nums: list[int]) -> list[int]:
5
+ result = [1] * len(nums)
6
+
7
+ prefix = 1
8
+ for index, value in enumerate(nums):
9
+ result[index] = prefix
10
+ prefix *= value
11
+
12
+ suffix = 1
13
+ for index in range(len(nums) - 1, -1, -1):
14
+ result[index] *= suffix
15
+ suffix *= nums[index]
16
+
17
+ return result
18
+
19
+
20
+ if __name__ == "__main__":
21
+ sample_nums = [1, 2, 3, 4]
22
+ print(product_except_self(sample_nums))
@@ -0,0 +1,19 @@
1
+ from __future__ import annotations
2
+
3
+
4
+ def two_sum(nums: list[int], target: int) -> list[int]:
5
+ seen: dict[int, int] = {}
6
+
7
+ for index, value in enumerate(nums):
8
+ complement = target - value
9
+ if complement in seen:
10
+ return [seen[complement], index]
11
+ seen[value] = index
12
+
13
+ return []
14
+
15
+
16
+ if __name__ == "__main__":
17
+ sample_nums = [2, 7, 11, 15]
18
+ sample_target = 9
19
+ print(two_sum(sample_nums, sample_target))
@@ -0,0 +1,154 @@
1
+ ---
2
+ name: pi-skill
3
+ description: Reference for this pi agent's installed capabilities, tools, memory system, skills, subagents, web/code search, MCP, and code-intelligence workflows. Use when asked what pi can do, how to use current capabilities, or when changing pi features so this skill stays updated.
4
+ ---
5
+
6
+ # Pi Skill
7
+
8
+ This skill is the local capability index for this pi setup. Use it to answer "what can you do?", choose the right tool/workflow, and keep user-facing capability docs synchronized when features change.
9
+
10
+ ## Maintenance Rule
11
+
12
+ When adding, removing, renaming, or materially changing any pi capability in this workspace, update this skill in the same change. This includes tools, packages, extensions, memory behavior, skills, subagents, MCP servers, web/search integrations, and code-intelligence workflows.
13
+
14
+ ## Core Coding Tools
15
+
16
+ - `read`: read text files and images; use this instead of `cat` for file inspection.
17
+ - `bash`: run shell commands; prefer `rg`/`rg --files` for search.
18
+ - `edit`: precise exact-text replacements in one file.
19
+ - `write`: create or overwrite files.
20
+ - `lsp_diagnostics` / `lsp_navigation`: primary code-intelligence path for diagnostics, definitions, references, hover, symbols, call hierarchy, rename, and workspace diagnostics.
21
+ - `ast_grep_search` / `ast_grep_replace` / `ast_dump`: semantic AST-aware code search and replacement; prefer over raw text search for code patterns.
22
+ - `lens_diagnostics`: inspect pi-lens warnings/errors for files touched this session.
23
+
24
+ ## Memory
25
+
26
+ Installed memory package: `@jhp/pi-memory` from `.pi/packages/pi-memory`.
27
+
28
+ Memory files live under `~/.pi/agent/memory/`:
29
+
30
+ - `MEMORY.md`: durable facts, decisions, and preferences.
31
+ - `USER.md`: structured user profile and stable preferences.
32
+ - `STATE.md`: current dated state, events, temporary facts, and quotas.
33
+ - `REVIEW.md`: review queue for stale or merge-candidate memories.
34
+ - `SCRATCHPAD.md`: checklist for open items.
35
+ - `daily/YYYY-MM-DD.md`: daily append-only logs.
36
+ - `.curator-state.json`: last curator run state.
37
+ - `audit/curator.jsonl`: curator audit trail.
38
+
39
+ Memory tools:
40
+
41
+ - `memory_write`: write long-term, daily, user, state, or review memory. Use `target="state"` with metadata for time-sensitive entries.
42
+ - `memory_read`: read long-term, scratchpad, daily, list, user, state, review, or all memory.
43
+ - `memory_edit`: read/add/replace/remove/replace_all/compact structured entries in `MEMORY.md`, `USER.md`, `STATE.md`, and `REVIEW.md`.
44
+ - `scratchpad`: add/done/undo/clear/list checklist items.
45
+ - `memory_search`: qmd-backed keyword, semantic, or deep search across memory files.
46
+ - `memory_curate`: manually run curator lifecycle rules.
47
+ - `memory_curator_enable`: enable external daily curator service using systemd user timer or cron fallback.
48
+ - `memory_curator_disable`: disable and uninstall the external daily curator service.
49
+ - `memory_curator_status`: show service backend, schedule, and state.
50
+
51
+ Structured metadata example:
52
+
53
+ ```md
54
+ [type:event status:planned date:2026-06-10]
55
+ User plans to watch the NBA Finals.
56
+ ```
57
+
58
+ Curator behavior:
59
+
60
+ - Exact dedupe.
61
+ - Event status transitions: `planned -> today -> past`.
62
+ - Expired temporary memories go to `REVIEW.md`, not automatic deletion.
63
+ - Quotas reset when month/reset rolls over.
64
+ - Mutations are audited to `audit/curator.jsonl`.
65
+ - External service control lives in `@jhp/pi-memory`: `jhp-pi-memory-curator enable|disable|status|run-once`.
66
+ - The external curator service is independent of the pi process. It uses a systemd user timer when available, with cron fallback, so scheduled curation can run even when pi is closed.
67
+ - Users can ask pi to enable, disable, or inspect the service via `memory_curator_enable`, `memory_curator_disable`, and `memory_curator_status`.
68
+ - Before uninstalling `@jhp/pi-memory`, run `memory_curator_disable` or `jhp-pi-memory-curator disable` so any systemd timer or cron entry is removed.
69
+ - `.pi/extensions/memory-curator.ts` is deprecated and only warns users to use `@jhp/pi-memory` service tools.
70
+
71
+ ## Web And Research
72
+
73
+ - `web_search`: broad web research. Prefer `queries` with 2-4 varied angles for comprehensive research.
74
+ - `fetch_content`: fetch readable content from URLs, GitHub repos, YouTube transcripts/video frames, and local videos. For video questions, pass the user's exact question as `prompt`.
75
+ - `get_search_content`: retrieve full content saved by `web_search` or `fetch_content`.
76
+ - `code_search`: search programming examples, docs, APIs, GitHub, and Stack Overflow; use for library/API/debugging questions before implementation.
77
+ - `librarian` skill: use for evidence-backed open-source library internals with exact GitHub source citations.
78
+
79
+ ## Subagents
80
+
81
+ Use the `pi-subagents` skill and `subagent` tool for delegation.
82
+
83
+ Typical uses:
84
+
85
+ - Advisory review of plans or diffs.
86
+ - Parallel investigation across multiple files or hypotheses.
87
+ - Implementation handoff with structured acceptance criteria.
88
+ - Goal-style loops with verification evidence.
89
+
90
+ Rules:
91
+
92
+ - Call `subagent` with `action: "list"` before executing agents.
93
+ - Use acceptance contracts for broad implementation handoffs.
94
+ - Keep one parent agent in control; subagents contribute context, review, or isolated execution.
95
+
96
+ ## MCP
97
+
98
+ Use `mcp` to discover and call Model Context Protocol servers/tools.
99
+
100
+ Common flow:
101
+
102
+ ```text
103
+ mcp({}) # status
104
+ mcp({ server: "name" }) # list tools
105
+ mcp({ search: "query" }) # find tools
106
+ mcp({ describe: "tool_name" }) # inspect schema
107
+ mcp({ tool: "tool_name", args: "{}" })
108
+ ```
109
+
110
+ Do not route built-in pi tools through MCP; call them directly.
111
+
112
+ ## Existing Skills
113
+
114
+ Local project skills currently include:
115
+
116
+ - `add-llm-provider`: checklist for adding providers to `packages/ai`.
117
+ - `image-to-editable-ppt-slide`: rebuild reference images as editable PowerPoint slides.
118
+ - `leetcode-array`: array problem patterns and Python references.
119
+ - `weather`: current weather and forecasts using no-key services.
120
+ - `pi-skill`: this capability index.
121
+
122
+ Package-provided skills currently include:
123
+
124
+ - `librarian`: library internals research with source citations.
125
+ - `pi-subagents`: subagent delegation workflows.
126
+ - `ast-grep`: AST-aware code search/replace guidance.
127
+ - `lsp-navigation`: LSP diagnostics and navigation guidance.
128
+ - `write-ast-grep-rule`: author pi-lens ast-grep rules.
129
+ - `write-tree-sitter-rule`: author pi-lens tree-sitter rules.
130
+
131
+ ## Pi Package And Extension Notes
132
+
133
+ Project package configuration is in `.pi/settings.json` and `.pi/npm/package.json`.
134
+
135
+ Current project packages:
136
+
137
+ - `@jhp/pi-memory`
138
+ - `pi-web-access`
139
+ - `pi-mcp-adapter`
140
+ - `pi-subagents`
141
+ - `pi-lens`
142
+
143
+ Project extensions are in `.pi/extensions/`. Important current extension:
144
+
145
+ - `memory-curator.ts`: deprecated compatibility notice only. The external curator service is managed by `@jhp/pi-memory`.
146
+
147
+ ## Recommended Workflows
148
+
149
+ - For code changes: inspect files, edit, run targeted tests if tests changed, then run `npm run check` for repo code changes.
150
+ - For memory changes: use `memory_write` for new facts and `memory_edit` for updates/removals.
151
+ - For time-sensitive memory: write structured `STATE.md` entries with `type`, `status`, and date/reset metadata.
152
+ - For web facts or current events: use `web_search`; for page/video details, use `fetch_content`.
153
+ - For library internals: use `librarian` or `code_search` with source-backed evidence.
154
+ - For broad or risky tasks: use subagents for investigation/review, then integrate deliberately.
@@ -0,0 +1,49 @@
1
+ ---
2
+ name: weather
3
+ description: Get current weather and forecasts (no API key required).
4
+ homepage: https://wttr.in/:help
5
+ metadata: {"clawdbot":{"emoji":"🌤️","requires":{"bins":["curl"]}}}
6
+ ---
7
+
8
+ # Weather
9
+
10
+ Two free services, no API keys needed.
11
+
12
+ ## wttr.in (primary)
13
+
14
+ Quick one-liner:
15
+ ```bash
16
+ curl -s "wttr.in/London?format=3"
17
+ # Output: London: ⛅️ +8°C
18
+ ```
19
+
20
+ Compact format:
21
+ ```bash
22
+ curl -s "wttr.in/London?format=%l:+%c+%t+%h+%w"
23
+ # Output: London: ⛅️ +8°C 71% ↙5km/h
24
+ ```
25
+
26
+ Full forecast:
27
+ ```bash
28
+ curl -s "wttr.in/London?T"
29
+ ```
30
+
31
+ Format codes: `%c` condition · `%t` temp · `%h` humidity · `%w` wind · `%l` location · `%m` moon
32
+
33
+ Tips:
34
+ - URL-encode spaces: `wttr.in/New+York`
35
+ - Airport codes: `wttr.in/JFK`
36
+ - Units: `?m` (metric) `?u` (USCS)
37
+ - Today only: `?1` · Current only: `?0`
38
+ - PNG: `curl -s "wttr.in/Berlin.png" -o /tmp/weather.png`
39
+
40
+ ## Open-Meteo (fallback, JSON)
41
+
42
+ Free, no key, good for programmatic use:
43
+ ```bash
44
+ curl -s "https://api.open-meteo.com/v1/forecast?latitude=51.5&longitude=-0.12&current_weather=true"
45
+ ```
46
+
47
+ Find coordinates for a city, then query. Returns JSON with temp, windspeed, weathercode.
48
+
49
+ Docs: https://open-meteo.com/en/docs
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jay Zeng
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,223 @@
1
+ # @jhp/pi-memory
2
+
3
+ Structured, time-aware memory extension for pi. It stores memory as plain Markdown, exposes one set of memory tools to the agent, and includes curator rules for lifecycle maintenance.
4
+
5
+ ## Features
6
+
7
+ - Plain Markdown storage under `~/.pi/agent/memory`.
8
+ - Unified tools for memory write/read/edit/search and scratchpad management.
9
+ - Structured `USER.md`, `STATE.md`, and `REVIEW.md` entries with metadata.
10
+ - Optional qmd-powered keyword, semantic, and deep search.
11
+ - KV cache-stable context injection by default.
12
+ - Curator core for exact dedupe, event lifecycle updates, temporary review, quota reset, and audit logs.
13
+ - Review-first learning candidates that can become memory promotions or disabled skill drafts after approval.
14
+ - Optional external curator service via systemd user timer or cron so curation can run even when pi is closed.
15
+
16
+ ## Installation
17
+
18
+ ```bash
19
+ pi install npm:@jhp/pi-memory
20
+ ```
21
+
22
+ Local development:
23
+
24
+ ```bash
25
+ pi install ./pi-memory
26
+ ```
27
+
28
+ Optional search support requires qmd:
29
+
30
+ ```bash
31
+ bun install -g https://github.com/tobi/qmd
32
+ qmd collection add ~/.pi/agent/memory --name pi-memory
33
+ qmd embed
34
+ ```
35
+
36
+ The extension auto-creates the `pi-memory` qmd collection and path contexts on session start when qmd is available.
37
+
38
+ ## File Layout
39
+
40
+ ```text
41
+ ~/.pi/agent/memory/
42
+ MEMORY.md # Durable facts, decisions, and preferences
43
+ USER.md # Structured user profile and stable preferences
44
+ STATE.md # Current dated state, events, temporary facts, quotas
45
+ REVIEW.md # Review queue for stale or merge-candidate memories
46
+ SCRATCHPAD.md # Checklist of open items
47
+ .curator-state.json # Last curator run state
48
+ audit/curator.jsonl # Curator audit trail
49
+ daily/YYYY-MM-DD.md # Daily append-only logs
50
+ ~/.pi/agent/skill-drafts/
51
+ <slug>/SKILL.md # Disabled skill drafts created after approval
52
+ ```
53
+
54
+ Structured entries are separated by `§` and may start with metadata:
55
+
56
+ ```md
57
+ [type:event status:planned date:2026-06-10]
58
+ User plans to watch the NBA Finals.
59
+ ```
60
+
61
+ Metadata keys currently supported by tools and curator rules:
62
+
63
+ - `type`: `fact`, `preference`, `event`, `temporary`, `quota`, `review`
64
+ - `status`: `planned`, `today`, `past`, `active`, `exhausted`, `archived`, etc.
65
+ - `date`: event or temporary memory date, `YYYY-MM-DD`
66
+ - `reset`: quota reset date/time
67
+ - `month`: quota month, `YYYY-MM`
68
+ - `provider`: quota provider
69
+ - `used`, `limit`: quota counters
70
+ - `ttlDays`: temporary memory TTL hint
71
+
72
+ ## Tools
73
+
74
+ | Tool | Purpose |
75
+ | --- | --- |
76
+ | `memory_write` | Write `MEMORY.md`, daily logs, or structured `USER.md` / `STATE.md` / `REVIEW.md` entries |
77
+ | `memory_read` | Read one memory target, all memory files, or daily log lists |
78
+ | `memory_edit` | Read/add/replace/remove/replace_all/compact structured entries |
79
+ | `scratchpad` | Manage checklist items in `SCRATCHPAD.md` |
80
+ | `memory_search` | Search all memory files with qmd |
81
+ | `memory_curate` | Run curator rules immediately |
82
+ | `memory_learning_approve` | Approve one proposed memory or skill promotion by exact id |
83
+ | `memory_learning_reject` | Reject or archive one review item by exact id |
84
+ | `memory_skill_drafts` | List proposed skill drafts |
85
+ | `memory_curator_enable` | Enable the external daily curator service |
86
+ | `memory_curator_disable` | Disable the external daily curator service |
87
+ | `memory_curator_status` | Show service backend, schedule, and state |
88
+
89
+ ### memory_write Targets
90
+
91
+ - `long_term`: append/overwrite `MEMORY.md`
92
+ - `daily`: append today's daily log
93
+ - `user`: append structured `USER.md` entry
94
+ - `state`: append structured `STATE.md` entry
95
+ - `review`: append structured `REVIEW.md` entry
96
+
97
+ For time-sensitive facts, prefer `target="state"` plus metadata:
98
+
99
+ ```json
100
+ {
101
+ "target": "state",
102
+ "type": "event",
103
+ "date": "2026-06-10",
104
+ "content": "User plans to watch the NBA Finals."
105
+ }
106
+ ```
107
+
108
+ ## Context Injection
109
+
110
+ By default, pi-memory injects a stable snapshot into the system prompt. It includes:
111
+
112
+ 1. Open scratchpad items
113
+ 2. Today's daily log
114
+ 3. qmd search results, only in `PI_MEMORY_SNAPSHOT=per-turn` mode
115
+ 4. `USER.md`
116
+ 5. current `STATE.md` entries, excluding `status:past` and `status:archived`
117
+ 6. `MEMORY.md`
118
+ 7. Yesterday's daily log
119
+
120
+ The stable snapshot refreshes on session start, compaction, long-term or structured writes, and day rollover. Use `memory_read` or `memory_search` for the latest authoritative state.
121
+
122
+ ## Curator
123
+
124
+ The curator core is included in this package and can be run with `memory_curate` or by the external curator service. Current rules:
125
+
126
+ - Exact duplicate entries are deduplicated.
127
+ - `type:event` entries move from `planned`/`today` to `past` after their `date` passes.
128
+ - `type:event status:planned` becomes `status:today` on the event date.
129
+ - Expired `type:temporary` entries append a review item to `REVIEW.md` instead of being deleted.
130
+ - `type:quota` entries reset to `active` with `used:0` when their month/reset rolls over.
131
+ - Every applied patch is written to `audit/curator.jsonl`.
132
+
133
+ The curator deliberately avoids semantic auto-delete or semantic auto-merge in this version. Those should first become review entries to avoid losing user memory.
134
+
135
+ ## Review-First Learning
136
+
137
+ Session shutdown may extract conservative learning candidates from the recent conversation text. Candidates are written only to `REVIEW.md`; they are not injected as normal context, not written to long-term memory, and not enabled as skills.
138
+
139
+ Candidate examples:
140
+
141
+ ```md
142
+ [type:review status:candidate id:rev_abc kind:preference confidence:medium seen:2 first_seen:2026-06-10 last_seen:2026-06-12 target_hints:memory]
143
+ Signature: User prefers concise direct answers.
144
+ Summary: User prefers concise direct answers.
145
+ ```
146
+
147
+ ```md
148
+ [type:review status:candidate id:rev_def kind:skill_candidate confidence:medium seen:3 first_seen:2026-06-10 last_seen:2026-06-12 target_hints:skill]
149
+ Signature: fix non erasable TypeScript syntax in pi source
150
+ Summary: Replace enum and parameter properties with erasable syntax.
151
+ ```
152
+
153
+ When candidates repeat, pi-memory updates the existing candidate instead of appending duplicates. It increments `seen`, updates `last_seen`, preserves higher confidence, and appends compact new evidence.
154
+
155
+ `memory_curate` can turn stable candidates into proposals:
156
+
157
+ - `kind:memory_promotion status:proposed` for durable preferences, project facts, or concise lessons.
158
+ - `kind:skill_promotion status:proposed` for repeated skill-worthy methods.
159
+
160
+ Approval is explicit by default:
161
+
162
+ - `memory_learning_approve` on a memory proposal writes `MEMORY.md`, `USER.md`, or `STATE.md` depending on the proposal target.
163
+ - `memory_learning_approve` on a skill proposal writes `~/.pi/agent/skill-drafts/<slug>/SKILL.md` and marks the proposal approved.
164
+ - Skill drafts are disabled. They are not moved into enabled skill directories automatically.
165
+ - `memory_learning_reject` marks a candidate or proposal as `rejected` or `archived` without deleting it.
166
+
167
+ Old candidates are lifecycle-managed without deletion. Low-confidence candidates can become `archived`; others become `needs_review` first. `REVIEW.md` remains the evidence and audit trail, so approved items are marked rather than removed.
168
+
169
+ Current learning extraction is text-based: it reads user/assistant conversation messages and asks the active model for structured candidates. It does not yet inspect structured tool-call graphs directly. Curator patch audit remains in `audit/curator.jsonl`; learning approvals are tracked through `REVIEW.md` proposal metadata and status changes.
170
+
171
+ ## External Curator Service
172
+
173
+ `@jhp/pi-memory` includes a CLI and pi tools for an external daily service. The service is independent of the pi process, so curation can still run when pi is closed.
174
+
175
+ CLI:
176
+
177
+ ```bash
178
+ jhp-pi-memory-curator enable --schedule 03:00
179
+ jhp-pi-memory-curator status
180
+ jhp-pi-memory-curator run-once
181
+ jhp-pi-memory-curator disable
182
+ ```
183
+
184
+ Pi tools and commands:
185
+
186
+ - `memory_curator_enable` / `/memory-curator-enable [HH:MM]`
187
+ - `memory_curator_disable` / `/memory-curator-disable`
188
+ - `memory_curator_status` / `/memory-curator-status`
189
+
190
+ The controller uses a systemd user timer when available and falls back to cron. State is written to `.curator-service.json` in the memory directory. Removing the package disables future pi tools; run disable before uninstalling if your package manager does not run uninstall lifecycle scripts.
191
+
192
+ ## Configuration
193
+
194
+ | Variable | Values | Default | Description |
195
+ | --- | --- | --- | --- |
196
+ | `PI_MEMORY_DIR` | path | `~/.pi/agent/memory` | Override storage directory |
197
+ | `PI_MEMORY_SNAPSHOT` | `stable`, `per-turn` | `stable` | Stable context injection or legacy per-turn rebuild |
198
+ | `PI_MEMORY_QMD_UPDATE` | `background`, `manual`, `off` | `background` | Control qmd update after writes |
199
+ | `PI_MEMORY_NO_SEARCH` | `1` | unset | Disable per-turn search injection |
200
+ | `PI_MEMORY_SUMMARIZE_TRANSITIONS` | `1`, `true`, `yes`, `on` | unset | Also summarize lifecycle transitions |
201
+ | `PI_MEMORY_LEARNING` | `off`, `review`, `auto-review` | `review` | Control session learning candidate extraction |
202
+ | `PI_MEMORY_LEARNING_MIN_CONFIDENCE` | `low`, `medium`, `high` | `medium` | Minimum extractor confidence to keep |
203
+ | `PI_MEMORY_SKILL_DRAFTS` | `off`, `review` | `review` | Allow curator to propose disabled skill drafts |
204
+ | `PI_MEMORY_AUTO_APPROVE_MEMORY` | `1`, `true`, `yes`, `on` | unset | YOLO mode for approving newly created memory proposals |
205
+ | `PI_MEMORY_AUTO_APPROVE_SKILL_DRAFTS` | `1`, `true`, `yes`, `on` | unset | YOLO mode for creating newly proposed disabled skill drafts |
206
+
207
+ ## Development
208
+
209
+ ```bash
210
+ npm install --ignore-scripts
211
+ npm test
212
+ npm run pack:check
213
+ ```
214
+
215
+ This package is a pi package. The pi manifest is in `package.json`:
216
+
217
+ ```json
218
+ {
219
+ "pi": {
220
+ "extensions": ["./index.ts"]
221
+ }
222
+ }
223
+ ```