@xynogen/pix-skills 0.4.2 → 0.4.3

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 (2) hide show
  1. package/package.json +1 -1
  2. package/skills/notion.md +117 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xynogen/pix-skills",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
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,117 @@
1
+ ---
2
+ name: notion
3
+ description: Efficient Notion workspace retrieval. Use when user asks to fetch, search, or read data from Notion — pages, databases, or project lists.
4
+ disable-model-invocation: true
5
+ ---
6
+ # Notion Retrieval Directive
7
+
8
+ ## Core Rule
9
+
10
+ **Data already in context → answer immediately. Zero extra tool calls.**
11
+ If a previous fetch/search already returned the rows, filter/reason over them inline.
12
+ Only call MCP tools when data is genuinely absent from context.
13
+
14
+ ## Tool Map
15
+
16
+ | Goal | Tool | Notes |
17
+ |---|---|---|
18
+ | Find a database/page by name | `notion_notion-search` | filter `{"value":"database"}` for DBs |
19
+ | Get schema + views of a DB | `notion_notion-fetch` with DB UUID | returns schema, SQLite DDL, view configs |
20
+ | Get all rows with properties | batch `notion_notion-fetch` per page UUID | fetch all pages concurrently in ONE message |
21
+ | Search within a data source | `notion_notion-search` with `data_source_url` | semantic; `filters.created_date_range` = creation date only, NOT schedule |
22
+
23
+ ## Retrieval Protocol
24
+
25
+ ### Step 1 — Locate (1 call)
26
+
27
+ Search for the database:
28
+
29
+ ```
30
+ notion_notion-search(query="<name>", filter={value:"database"})
31
+ ```
32
+
33
+ Note the DB `id` and `data-source` collection URL from results.
34
+
35
+ ### Step 2 — Schema (1 call, optional)
36
+
37
+ Only if you need field names / option values:
38
+
39
+ ```
40
+ notion_notion-fetch(id="<db-uuid>")
41
+ ```
42
+
43
+ The response contains full schema + SQLite DDL — read it, don't re-fetch.
44
+
45
+ ### Step 3 — Rows (1 batch)
46
+
47
+ Fetch all known page UUIDs **concurrently in a single message** (parallel tool calls).
48
+ Each call returns full `<properties>` block — Status, Category, Schedule, Stack, etc.
49
+
50
+ **Never re-fetch a page whose properties are already in context.**
51
+
52
+ ## Date / Schedule Filtering
53
+
54
+ - `filters.created_date_range` in `notion_notion-search` = **page creation date**, not schedule field.
55
+ - To filter by schedule/deadline: fetch all rows (Step 3), then filter in-context by `date:📅 Schedule:end` or `date:📅 Schedule:start`.
56
+ - Pattern: `end = "YYYY-MM-30"` or range overlap check — do this mentally/inline, no extra calls.
57
+
58
+ ## Answer Pattern
59
+
60
+ Once rows are in context:
61
+
62
+ ```
63
+ Filter rows where Schedule.end overlaps target month → present table directly.
64
+ ```
65
+
66
+ No re-search, no re-fetch, no confirmation calls.
67
+
68
+ ## Efficiency Rules
69
+
70
+ 1. **Batch parallel**: all page fetches go in one message, not sequential calls.
71
+ 2. **Schema once**: read the DDL from the DB fetch — never fetch schema twice.
72
+ 3. **Search is fuzzy**: `notion_notion-search` is semantic. Use a representative keyword, not empty string (min length 1).
73
+ 4. **Collection URL**: data source URL format is `collection://UUID` — use for `data_source_url` param in search.
74
+ 5. **No re-fetch loop**: if a batch already ran and data is present, stop. Answer from context.
75
+
76
+ ## Common Pitfalls
77
+
78
+ - `notion_notion-search` with `query=""` → error (min 1 char). Use `"project"` or topic keyword.
79
+ - `notion_notion-fetch` requires `id` param (UUID or collection:// URL), not `url`.
80
+ - `filters.created_date_range` ≠ schedule filter — don't use it to find deadline-based rows.
81
+ - Relying on `notion_notion-search` filters for any field-level filtering — internal search is broken, always dump + script.
82
+ - Fetching the database again after already having rows in context = wasted call.
83
+ - Running searches sequentially when they can be parallel = wasted turns.
84
+
85
+ ## Default: Always Dump to File
86
+
87
+ **Notion's internal search is unreliable** — date filters, keyword filters, and empty queries all behave inconsistently. Do not rely on search for filtering. Always:
88
+
89
+ 1. **Fetch all rows** — batch all page UUIDs in one parallel message
90
+ 2. **Dump to `/tmp/notion-<db-name>.json`** — write full properties as JSON array
91
+ 3. **Query with Python/jq** — filter, sort, aggregate locally
92
+ 4. **Answer from script output** — never re-fetch, never re-search
93
+
94
+ ```python
95
+ import json
96
+ rows = json.load(open("/tmp/notion-projects.json"))
97
+
98
+ # filter by deadline month
99
+ june = [r for r in rows if r.get("date:📅 Schedule:end", "").startswith("2026-06")]
100
+ for r in june:
101
+ print(r["Name"], r["Status"], r["date:📅 Schedule:end"])
102
+ ```
103
+
104
+ **Write once, query many** — follow-up questions on same DB: reuse `/tmp/` file, run new script. Zero re-fetches.
105
+
106
+ If `/tmp/notion-<db>.json` already exists from this session → skip fetch entirely, go straight to script.
107
+
108
+ ## Minimal Call Budget
109
+
110
+ | Task | Calls |
111
+ |---|---|
112
+ | List all projects | 2 (search DB → batch fetch → dump `/tmp/`) |
113
+ | Filter by any field | 2 (fetch all → dump) + 1 (python script) |
114
+ | Follow-up on same DB | 0 fetches (reuse `/tmp/`) + 1 (new script) |
115
+ | Get one page's properties | 1 |
116
+ | Get one page's properties | 1 |
117
+ | Check schema only | 1 |