@xynogen/pix-skills 0.4.0 → 0.4.2

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 CHANGED
@@ -6,15 +6,18 @@ Pi coding agent extension — skill loader tool + skills bundle.
6
6
 
7
7
  | Resource | Type | Description |
8
8
  |---|---|---|
9
- | `read_skill` | tool | Load a bundled skill's full instructions by name. `name="list"` lists all skills with descriptions. |
10
- | `skills/` | skills | 21 bundled skills (auto-loaded by pi at startup — names + descriptions in system prompt) |
9
+ | `read_skills` | tool | Browse and load bundled skills. No args → list all. `name` only → description. `name + full=true` → full instructions. |
10
+ | `skills/` | skills | 23 bundled skills (auto-loaded by pi at startup — names + descriptions in system prompt) |
11
11
 
12
12
  ## How it works
13
13
 
14
14
  Pi loads skill *descriptions* into the system prompt at startup (progressive disclosure). Full content
15
- only enters context when the agent calls `read_skill(name=<skill>)` — or reads the file via the `read` tool.
15
+ only enters context when the agent calls `read_skills(name=<skill>, full=true)` — or reads the file via the `read` tool.
16
+
17
+ Skills are also discovered from `~/.pi/agent/skills/` (user-level). Bundled skills take precedence on name collision.
18
+
19
+ `read_skills` is the safe version of "agent prompts itself":
16
20
 
17
- `read_skill` is the safe version of "agent prompts itself":
18
21
  - Agent calls tool explicitly — no autonomous injection
19
22
  - Orchestrator (user or system prompt) decides when skill loading is appropriate
20
23
  - Auditable: tool call is visible in the conversation
@@ -31,6 +34,7 @@ only enters context when the agent calls `read_skill(name=<skill>)` — or reads
31
34
  | `debug` | auto — bug / error / doesn't work |
32
35
  | `explain` | auto — explain / how does |
33
36
  | `finish` | manual |
37
+ | `graphify` | auto — codebase question / architecture |
34
38
  | `handoff` | manual |
35
39
  | `plan` | auto — plan / design / architect |
36
40
  | `readme` | manual |
@@ -48,20 +52,20 @@ only enters context when the agent calls `read_skill(name=<skill>)` — or reads
48
52
  ## Usage
49
53
 
50
54
  ```
51
- # Agent lists available skills
52
- read_skill(name="list")
55
+ # Agent lists available skills (no args)
56
+ read_skills()
53
57
 
54
- # Agent loads full commit procedure before committing
55
- read_skill(name="commit")
58
+ # Agent reads description of a specific skill
59
+ read_skills(name="commit")
56
60
 
57
- # User explicitly triggers a skill
58
- /skill:commit
61
+ # Agent loads full commit procedure
62
+ read_skills(name="commit", full=true)
59
63
  ```
60
64
 
61
65
  ## Install
62
66
 
63
67
  ```bash
64
- pi install git:github.com/xynogen/pix-mono#packages/pix-skills
68
+ pi install npm:@xynogen/pix-skills
65
69
  ```
66
70
 
67
71
  Or from the monorepo:
@@ -70,6 +74,14 @@ Or from the monorepo:
70
74
  pi install ./packages/pix-skills
71
75
  ```
72
76
 
77
+ ## Full distro
78
+
79
+ To install the complete pix suite (all packages + Pi itself):
80
+
81
+ ```bash
82
+ curl -fsSL https://raw.githubusercontent.com/xynogen/pix-mono/main/scripts/install.sh | sh
83
+ ```
84
+
73
85
  ## License
74
86
 
75
87
  MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xynogen/pix-skills",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "Pi extension — agent skill loader (skill tool + skills bundle)",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -0,0 +1,48 @@
1
+ ---
2
+ name: ask-user
3
+ description: "MUST use before high-stakes/irreversible decisions or when requirements are ambiguous. Gather context, present 2-5 options via ask_user, get explicit choice, then proceed."
4
+ metadata:
5
+ short-description: Decision gate for ambiguity and high-stakes choices
6
+ ---
7
+
8
+ # ask_user decision gate
9
+
10
+ Decision control, not chit-chat.
11
+
12
+ ## Gate (call ask_user before proceeding if ANY true)
13
+ - changes architecture/schema/API/deploy/security
14
+ - costly to undo (big refactor, migration, destructive edit, prod behavior)
15
+ - requirements unclear/conflicting/missing
16
+ - multiple valid options, trade-off is preference-dependent
17
+ - about to assume something that changes implementation
18
+
19
+ Skip only if user already gave an explicit decision for THIS exact trade-off.
20
+
21
+ ## Handshake
22
+ 1. classify step: high_stakes | ambiguous | both | clear. clear → no gate.
23
+ 2. gather evidence first (read/bash/web/ref). don't ask blind.
24
+ 3. synthesize: 3-7 bullets — state, constraints, trade-offs, recommendation.
25
+ 4. ask ONE focused question: `question`, `context`(summary), `options`(2-5),
26
+ `allowMultiple:false` unless truly independent, `allowFreeform:true`.
27
+ `inline` displayMode when the preceding summary must stay visible.
28
+ 5. commit: restate decision, say next step, proceed.
29
+ 6. re-ask only on materially new ambiguity. no confirm loops.
30
+
31
+ ## Budget (anti-overasking)
32
+ - max 1 call per boundary normally; max 2 if first is unclear/cancelled.
33
+ - never re-ask same trade-off without new evidence.
34
+ - attempt 2 = narrower question: [Proceed w/ recommended] [Choose other (freeform)] [Stop].
35
+ - after attempt 2: high_stakes/both → STOP, mark blocked.
36
+ ambiguous-only + user says "your call" → take most reversible default, state assumptions.
37
+
38
+ ## Quality
39
+ - question: concrete decision boundary, one decision only.
40
+ - options: short, outcome-oriented, explicit trade-offs; add description when non-obvious.
41
+
42
+ ## Anti-patterns
43
+ asking without context · trivial formatting choices · forcing options when freeform fits ·
44
+ repeat questions w/o new info · proceeding high-stakes after unclear/cancelled answer.
45
+
46
+ ## On cancel / unclear
47
+ Pause, explain what's blocked. At most one narrower follow-up.
48
+ Then: high-stakes → stay blocked until explicit decision; ambiguity-only → proceed only if user delegated.
package/src/index.ts CHANGED
@@ -16,6 +16,7 @@ import { fileURLToPath } from "node:url";
16
16
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
17
17
  import { Text } from "@earendil-works/pi-tui";
18
18
  import { Type } from "typebox";
19
+ import { once } from "./once.ts";
19
20
 
20
21
  // ─── Skill resolution ─────────────────────────────────────────────────────────
21
22
 
@@ -141,7 +142,7 @@ const ParamsSchema = Type.Object({
141
142
  ),
142
143
  });
143
144
 
144
- export default function registerSkillLoader(pi: ExtensionAPI): void {
145
+ function registerSkillLoader(pi: ExtensionAPI): void {
145
146
  pi.registerTool({
146
147
  name: "read_skills",
147
148
  label: "Read Skills",
@@ -244,3 +245,7 @@ export default function registerSkillLoader(pi: ExtensionAPI): void {
244
245
  },
245
246
  });
246
247
  }
248
+
249
+ export default function (pi: ExtensionAPI): void {
250
+ once("pix-skills", () => registerSkillLoader(pi));
251
+ }
package/src/once.ts ADDED
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Idempotency guard for extension activation.
3
+ *
4
+ * pix-core (the meta-package) invokes this package's factory in addition to a
5
+ * possible direct install. Pi's loader uses jiti with `moduleCache: false`, so
6
+ * each load pass re-evaluates modules — a plain module-level flag would not be
7
+ * shared. The dedupe key therefore lives on `globalThis`, which persists for
8
+ * the lifetime of the process across all load passes.
9
+ */
10
+ export function once(key: string, fn: () => void): void {
11
+ const g = globalThis as { __pixLoaded?: Set<string> };
12
+ const loaded = (g.__pixLoaded ??= new Set<string>());
13
+ if (loaded.has(key)) return;
14
+ loaded.add(key);
15
+ fn();
16
+ }