my-pi 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.
- package/README.md +104 -97
- package/dist/api-DbuDwth8.js +1930 -0
- package/dist/api-DbuDwth8.js.map +1 -0
- package/dist/api.js +1 -1
- package/dist/index.js +26 -22
- package/dist/index.js.map +1 -1
- package/package.json +15 -10
- package/src/extensions/{hooks-resolution.test.ts → hooks-resolution/index.test.ts} +1 -1
- package/src/extensions/{config.test.ts → manager/config.test.ts} +8 -6
- package/src/extensions/{config.ts → manager/config.ts} +15 -32
- package/src/extensions/{extensions.test.ts → manager/index.test.ts} +1 -1
- package/src/extensions/{prompt-presets.test.ts → prompt-presets/index.test.ts} +72 -1
- package/src/extensions/{prompt-presets.ts → prompt-presets/index.ts} +372 -43
- package/dist/api-DrJVpmLQ.js +0 -5443
- package/dist/api-DrJVpmLQ.js.map +0 -1
- package/dist/telemetry-db-BnenoOSj.js +0 -250
- package/dist/telemetry-db-BnenoOSj.js.map +0 -1
- package/dist/telemetry-schema.sql +0 -68
- package/src/extensions/chain.test.ts +0 -219
- package/src/extensions/chain.ts +0 -575
- package/src/extensions/confirm-destructive.test.ts +0 -157
- package/src/extensions/confirm-destructive.ts +0 -61
- package/src/extensions/filter-output.test.ts +0 -174
- package/src/extensions/filter-output.ts +0 -257
- package/src/extensions/handoff.ts +0 -176
- package/src/extensions/lsp.test.ts +0 -550
- package/src/extensions/lsp.ts +0 -1044
- package/src/extensions/mcp.test.ts +0 -30
- package/src/extensions/mcp.ts +0 -411
- package/src/extensions/recall.test.ts +0 -26
- package/src/extensions/recall.ts +0 -69
- package/src/extensions/skills.ts +0 -564
- package/src/extensions/telemetry-config.test.ts +0 -96
- package/src/extensions/telemetry-config.ts +0 -80
- package/src/extensions/telemetry-db.test.ts +0 -315
- package/src/extensions/telemetry-db.ts +0 -513
- package/src/extensions/telemetry-schema.sql +0 -68
- package/src/extensions/telemetry.test.ts +0 -225
- package/src/extensions/telemetry.ts +0 -885
- package/src/extensions/working-indicator-config.test.ts +0 -68
- package/src/extensions/working-indicator-config.ts +0 -70
- package/src/extensions/working-indicator.test.ts +0 -33
- package/src/extensions/working-indicator.ts +0 -109
- package/src/mcp/client.test.ts +0 -217
- package/src/mcp/client.ts +0 -318
- package/src/mcp/config.test.ts +0 -201
- package/src/mcp/config.ts +0 -129
- package/src/skills/config.test.ts +0 -58
- package/src/skills/config.ts +0 -70
- package/src/skills/importer.test.ts +0 -301
- package/src/skills/importer.ts +0 -221
- package/src/skills/manager.ts +0 -222
- package/src/skills/scanner.ts +0 -275
- /package/src/extensions/{hooks-resolution.ts → hooks-resolution/index.ts} +0 -0
- /package/src/extensions/{extensions.ts → manager/index.ts} +0 -0
- /package/src/extensions/{session-name.ts → session-name/index.ts} +0 -0
package/README.md
CHANGED
|
@@ -7,9 +7,8 @@ Composable [pi](https://pi.dev) coding agent for humans and agents.
|
|
|
7
7
|
|
|
8
8
|
Built on the
|
|
9
9
|
[@mariozechner/pi-coding-agent](https://github.com/badlogic/pi-mono)
|
|
10
|
-
SDK. Adds MCP server support, extension stacking, LSP tools,
|
|
11
|
-
|
|
12
|
-
programmatic API.
|
|
10
|
+
SDK. Adds MCP server support, extension stacking, LSP tools, prompt
|
|
11
|
+
presets, local SQLite telemetry for evals, and a programmatic API.
|
|
13
12
|
|
|
14
13
|
Extension stacking patterns inspired by
|
|
15
14
|
[pi-vs-claude-code](https://github.com/disler/pi-vs-claude-code).
|
|
@@ -22,16 +21,14 @@ Extension stacking patterns inspired by
|
|
|
22
21
|
`mcp.json`, auto-registered as Pi tools.
|
|
23
22
|
- **Built-in LSP tools** — diagnostics, hover, definitions,
|
|
24
23
|
references, and document symbols via language servers.
|
|
25
|
-
- **Agent chains** — sequential scout/plan style workflows defined in
|
|
26
|
-
`.pi/agents/agent-chain.yaml`.
|
|
27
24
|
- **Managed skills** — discover, enable, disable, import, and sync
|
|
28
25
|
Pi-native skills.
|
|
29
26
|
- **Prompt presets** — base presets plus additive prompt layers with
|
|
30
27
|
per-project persistence.
|
|
31
28
|
- **Secret redaction** — redact API keys and other sensitive output
|
|
32
29
|
before the model sees tool results.
|
|
33
|
-
- **
|
|
34
|
-
|
|
30
|
+
- **Recall** — teach the model to use `pirecall` for prior-session
|
|
31
|
+
context.
|
|
35
32
|
- **Local telemetry** — optional SQLite telemetry for evals, tool
|
|
36
33
|
analysis, and operational debugging.
|
|
37
34
|
- **Bundled themes + extension stacking** — ship defaults, then layer
|
|
@@ -85,10 +82,9 @@ Outputs NDJSON events — one JSON object per line — for programmatic
|
|
|
85
82
|
consumption by other agents or scripts.
|
|
86
83
|
|
|
87
84
|
In non-interactive modes (`"prompt"`, `-P`, `--json`), my-pi keeps
|
|
88
|
-
headless-capable built-ins like MCP, LSP,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
working-indicator customization.
|
|
85
|
+
headless-capable built-ins like MCP, LSP, prompt presets, recall,
|
|
86
|
+
hooks, and secret filtering enabled, while skipping UI-only built-ins
|
|
87
|
+
like session auto-naming.
|
|
92
88
|
|
|
93
89
|
### Local telemetry (SQLite)
|
|
94
90
|
|
|
@@ -160,7 +156,7 @@ Query and export helpers:
|
|
|
160
156
|
|
|
161
157
|
Schema notes:
|
|
162
158
|
|
|
163
|
-
- source of truth: `src/
|
|
159
|
+
- source of truth: `packages/pi-telemetry/src/schema.sql`
|
|
164
160
|
- current telemetry schema version: `1`
|
|
165
161
|
- schema version is tracked with `PRAGMA user_version`
|
|
166
162
|
- unversioned local telemetry databases are initialized/upgraded to v1
|
|
@@ -169,7 +165,6 @@ Schema notes:
|
|
|
169
165
|
downgrading
|
|
170
166
|
- opens the database in WAL mode: `PRAGMA journal_mode = WAL`
|
|
171
167
|
- waits up to 5s on lock contention: `PRAGMA busy_timeout = 5000`
|
|
172
|
-
- packaged builds ship the schema as `dist/telemetry-schema.sql`
|
|
173
168
|
|
|
174
169
|
CLI flags `--telemetry` and `--no-telemetry` override only the current
|
|
175
170
|
process. `/telemetry on` and `/telemetry off` update the saved default
|
|
@@ -342,24 +337,29 @@ In interactive mode:
|
|
|
342
337
|
- `/skills sync <key|name>` — sync an imported skill to its upstream
|
|
343
338
|
- `/skills refresh` — rescan skill directories
|
|
344
339
|
- `/skills defaults <all-enabled|all-disabled>` — set default policy
|
|
345
|
-
- `/preset` — open the prompt preset manager (base presets +
|
|
346
|
-
|
|
347
|
-
- `/preset
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
- `/preset
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
- `/preset
|
|
354
|
-
|
|
355
|
-
- `/preset
|
|
356
|
-
|
|
357
|
-
- `/
|
|
340
|
+
- `/prompt-preset` — open the prompt preset manager (base presets +
|
|
341
|
+
layers); `/preset` is a short alias
|
|
342
|
+
- `/prompt-preset help` — show examples and common prompt preset
|
|
343
|
+
commands
|
|
344
|
+
- `/prompt-preset <name>` — activate a base preset or toggle a layer
|
|
345
|
+
- `/prompt-preset base <name>` — activate a base preset directly
|
|
346
|
+
- `/prompt-preset enable <layer>` / `/prompt-preset disable <layer>` —
|
|
347
|
+
toggle a prompt layer directly
|
|
348
|
+
- `/prompt-preset edit <name>` — edit or create a project preset in
|
|
349
|
+
`.pi/presets/<name>.md`
|
|
350
|
+
- `/prompt-preset edit-global <name>` — edit or create a global preset
|
|
351
|
+
in `~/.pi/agent/presets/<name>.md`
|
|
352
|
+
- `/prompt-preset export-defaults` — copy built-in presets to editable
|
|
353
|
+
global Markdown files
|
|
354
|
+
- `/prompt-preset export-defaults project` — copy built-in presets to
|
|
355
|
+
editable project Markdown files
|
|
356
|
+
- `/prompt-preset delete <name>` — delete a project-local preset
|
|
357
|
+
- `/prompt-preset reset <name>` — remove a project-local override and
|
|
358
|
+
fall back to user/built-in if available
|
|
359
|
+
- `/prompt-preset clear` — clear the active base preset and all layers
|
|
358
360
|
- `/lsp status|list|restart` — inspect or restart language server
|
|
359
361
|
state
|
|
360
362
|
- `/redact-stats` — show how many secrets were redacted this session
|
|
361
|
-
- `/handoff <task>` — export current context to a handoff markdown
|
|
362
|
-
file
|
|
363
363
|
- `/telemetry status|stats|query|export|on|off|path` — inspect, query,
|
|
364
364
|
export, or toggle local SQLite telemetry
|
|
365
365
|
|
|
@@ -376,36 +376,6 @@ In interactive mode:
|
|
|
376
376
|
persisted in `~/.config/my-pi/extensions.json`
|
|
377
377
|
8. Cleanup on `session_shutdown`
|
|
378
378
|
|
|
379
|
-
## Agent Chains
|
|
380
|
-
|
|
381
|
-
Define sequential agent pipelines in `.pi/agents/agent-chain.yaml`:
|
|
382
|
-
|
|
383
|
-
```yaml
|
|
384
|
-
scout-plan:
|
|
385
|
-
description: 'Scout the codebase then plan implementation'
|
|
386
|
-
steps:
|
|
387
|
-
- agent: scout
|
|
388
|
-
prompt: 'Explore and analyze: $INPUT'
|
|
389
|
-
- agent: planner
|
|
390
|
-
prompt: 'Based on this analysis, create a plan:\n\n$INPUT'
|
|
391
|
-
```
|
|
392
|
-
|
|
393
|
-
Agent definitions live in `.pi/agents/*.md` with frontmatter:
|
|
394
|
-
|
|
395
|
-
```markdown
|
|
396
|
-
---
|
|
397
|
-
name: scout
|
|
398
|
-
description: Codebase exploration and analysis
|
|
399
|
-
tools: read,grep,find,ls
|
|
400
|
-
---
|
|
401
|
-
|
|
402
|
-
You are a scout agent. Explore the codebase and report findings.
|
|
403
|
-
```
|
|
404
|
-
|
|
405
|
-
The chain extension injects context into the system prompt so the LLM
|
|
406
|
-
knows when and how to use `run_chain`. Use `/chain` to switch active
|
|
407
|
-
chains and `/agents` to list available agents.
|
|
408
|
-
|
|
409
379
|
## Secret Redaction
|
|
410
380
|
|
|
411
381
|
The filter-output extension automatically redacts secrets (API keys,
|
|
@@ -441,11 +411,30 @@ Preset sources are merged in this order:
|
|
|
441
411
|
|
|
442
412
|
1. built-in defaults
|
|
443
413
|
2. `~/.pi/agent/presets.json`
|
|
444
|
-
3.
|
|
414
|
+
3. `~/.pi/agent/presets/*.md`
|
|
415
|
+
4. `.pi/presets.json`
|
|
416
|
+
5. `.pi/presets/*.md`
|
|
445
417
|
|
|
446
418
|
Project presets override global/default presets with the same name.
|
|
447
|
-
Strings are treated as base presets by default. Object entries
|
|
448
|
-
`kind: "base"` or `kind: "layer"`.
|
|
419
|
+
Strings in JSON are treated as base presets by default. Object entries
|
|
420
|
+
may set `kind: "base"` or `kind: "layer"`. Markdown preset files use
|
|
421
|
+
the filename as the preset name and optional frontmatter:
|
|
422
|
+
|
|
423
|
+
```markdown
|
|
424
|
+
---
|
|
425
|
+
kind: base
|
|
426
|
+
description: Short, direct, no fluff
|
|
427
|
+
---
|
|
428
|
+
|
|
429
|
+
Be concise and direct.
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
Use `/prompt-preset export-defaults` to copy built-in presets to
|
|
433
|
+
`~/.pi/agent/presets/*.md` for editing, or
|
|
434
|
+
`/prompt-preset export-defaults project` to write `.pi/presets/*.md`.
|
|
435
|
+
`/prompt-preset edit <name>` writes a project Markdown preset;
|
|
436
|
+
`/prompt-preset edit-global <name>` writes a global one. `/preset` is
|
|
437
|
+
a short alias for `/prompt-preset`.
|
|
449
438
|
|
|
450
439
|
CLI layering is supported too:
|
|
451
440
|
|
|
@@ -502,54 +491,72 @@ clients.
|
|
|
502
491
|
|
|
503
492
|
## Session Recall
|
|
504
493
|
|
|
505
|
-
The recall
|
|
506
|
-
user references prior work or when historical
|
|
507
|
-
help. It also triggers
|
|
508
|
-
start when the local recall database exists.
|
|
494
|
+
The recall package nudges the model to use `pnpx pirecall` or
|
|
495
|
+
`npx pirecall` when the user references prior work or when historical
|
|
496
|
+
project context would help. It also triggers `pirecall sync --json` on
|
|
497
|
+
session start and shutdown when the local recall database exists.
|
|
509
498
|
|
|
510
|
-
##
|
|
499
|
+
## Reusable Pi packages
|
|
511
500
|
|
|
512
|
-
|
|
513
|
-
|
|
501
|
+
This repo is a pnpm workspace. The `my-pi` harness depends on reusable
|
|
502
|
+
Pi packages via `workspace:*`, and those packages can also be
|
|
503
|
+
published and installed into vanilla `pi` independently:
|
|
514
504
|
|
|
515
505
|
```bash
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
506
|
+
pi install npm:@spences10/pi-redact
|
|
507
|
+
pi install npm:@spences10/pi-telemetry
|
|
508
|
+
pi install npm:@spences10/pi-mcp
|
|
509
|
+
pi install npm:@spences10/pi-lsp
|
|
510
|
+
pi install npm:@spences10/pi-confirm-destructive
|
|
511
|
+
pi install npm:@spences10/pi-skills
|
|
512
|
+
pi install npm:@spences10/pi-recall
|
|
513
|
+
pi install npm:@spences10/pi-nopeek
|
|
519
514
|
```
|
|
520
515
|
|
|
516
|
+
- [`@spences10/pi-redact`](./packages/pi-redact/README.md) — output
|
|
517
|
+
redaction and `/redact-stats`
|
|
518
|
+
- [`@spences10/pi-telemetry`](./packages/pi-telemetry/README.md) —
|
|
519
|
+
local SQLite telemetry and `/telemetry`
|
|
520
|
+
- [`@spences10/pi-mcp`](./packages/pi-mcp/README.md) — MCP server
|
|
521
|
+
integration and `/mcp`
|
|
522
|
+
- [`@spences10/pi-lsp`](./packages/pi-lsp/README.md) — LSP-backed
|
|
523
|
+
diagnostics and symbol tools
|
|
524
|
+
- [`@spences10/pi-confirm-destructive`](./packages/pi-confirm-destructive/README.md)
|
|
525
|
+
— destructive action confirmations
|
|
526
|
+
- [`@spences10/pi-skills`](./packages/pi-skills/README.md) — skill
|
|
527
|
+
management, import, and sync
|
|
528
|
+
- [`@spences10/pi-recall`](./packages/pi-recall/README.md) — pirecall
|
|
529
|
+
reminder and background sync
|
|
530
|
+
- [`@spences10/pi-nopeek`](./packages/pi-nopeek/README.md) — nopeek
|
|
531
|
+
reminder for secret-safe environment loading
|
|
532
|
+
|
|
533
|
+
Each package README is the entry point for install instructions,
|
|
534
|
+
commands, runtime behavior, and development notes.
|
|
535
|
+
|
|
521
536
|
## Project Structure
|
|
522
537
|
|
|
523
538
|
```
|
|
524
539
|
src/
|
|
525
|
-
index.ts
|
|
526
|
-
api.ts
|
|
540
|
+
index.ts CLI entry point (citty + pi SDK)
|
|
541
|
+
api.ts Programmatic API (create_my_pi + re-exports)
|
|
527
542
|
extensions/
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
client.ts Minimal MCP stdio client (JSON-RPC 2.0)
|
|
542
|
-
config.ts Loads and merges mcp.json configs
|
|
543
|
-
skills/
|
|
544
|
-
manager.ts Skill enable/disable state management
|
|
545
|
-
scanner.ts Skill discovery across sources
|
|
546
|
-
config.ts Persistent skills config (~/.config/my-pi/)
|
|
543
|
+
manager/ Built-in extension manager and config
|
|
544
|
+
prompt-presets/ Runtime prompt preset selection and editing
|
|
545
|
+
session-name/ Session auto-naming
|
|
546
|
+
hooks-resolution/ Claude-style hook resolution
|
|
547
|
+
packages/
|
|
548
|
+
pi-redact/ Installable Pi package for output redaction
|
|
549
|
+
pi-telemetry/ Installable Pi package for SQLite telemetry
|
|
550
|
+
pi-mcp/ Installable Pi package for MCP integration
|
|
551
|
+
pi-lsp/ Installable Pi package for LSP tools
|
|
552
|
+
pi-confirm-destructive/ Installable Pi package for destructive action confirmations
|
|
553
|
+
pi-skills/ Installable Pi package for skill management
|
|
554
|
+
pi-recall/ Installable Pi package for pirecall reminders
|
|
555
|
+
pi-nopeek/ Installable Pi package for nopeek reminders
|
|
547
556
|
.pi/
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
presets.json Optional project prompt presets
|
|
552
|
-
mcp.json Project MCP server config
|
|
557
|
+
presets.json Optional project prompt presets (JSON)
|
|
558
|
+
presets/*.md Optional project prompt presets (Markdown files)
|
|
559
|
+
mcp.json Project MCP server config
|
|
553
560
|
```
|
|
554
561
|
|
|
555
562
|
## Development
|