@spences10/pi-tool-guidance 0.0.0-stage → 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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Scott Spence
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.
package/README.md CHANGED
@@ -1,3 +1,86 @@
1
- # Temporary Holding Version
1
+ # @spences10/pi-tool-guidance
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ <!-- package-readme:header:start -->
4
+
5
+ [![built with Vite+](https://img.shields.io/badge/built%20with-Vite+-646CFF?logo=vite&logoColor=white)](https://viteplus.dev)
6
+ [![tested with Vitest](https://img.shields.io/badge/tested%20with-Vitest-6E9F18?logo=vitest&logoColor=white)](https://vitest.dev)
7
+ [![npm version](https://img.shields.io/npm/v/@spences10/pi-tool-guidance?color=CB3837&logo=npm&logoColor=white)](https://www.npmjs.com/package/@spences10/pi-tool-guidance)
8
+ [![license](https://img.shields.io/npm/l/@spences10/pi-tool-guidance)](https://www.npmjs.com/package/@spences10/pi-tool-guidance)
9
+
10
+ ![my-pi package preview](https://raw.githubusercontent.com/spences10/my-pi/main/assets/pi-package-preview.png)
11
+
12
+ <!-- package-readme:header:end -->
13
+
14
+ ## Tool workflow guidance
15
+
16
+ Distributes native Pi skills and concise system-prompt reminders for
17
+ nopeek, Omnisearch, and SQLite. It does not depend on the maintainer's
18
+ local files.
19
+
20
+ ## What ships
21
+
22
+ - `my-pi-nopeek`: one-shot credential loading, explicit key
23
+ allowlists, separate-shell limitations, and output disclosure
24
+ precautions.
25
+ - `my-pi-omnisearch`: tool discovery, source extraction, and verified
26
+ research.
27
+ - `my-pi-sqlite`: schema inspection, bounded queries, backups,
28
+ transactions, and respecting database safety gates.
29
+
30
+ Pi advertises these native skills and loads their full contents on
31
+ demand. Invoke `/skill:my-pi-nopeek`, `/skill:my-pi-omnisearch`, or
32
+ `/skill:my-pi-sqlite` to request one explicitly.
33
+
34
+ Essential reminders are contributed through a named structured prompt
35
+ section. Secret guidance is active with shell access; MCP guidance is
36
+ conditional on reachable tools or Pi's configured indirect-server
37
+ listing. Both codemode and tool-search exposure work without requiring
38
+ direct tool declarations.
39
+
40
+ ## User configuration remains yours
41
+
42
+ The package does not install the nopeek CLI, start MCP servers, set
43
+ provider credentials, or modify `SYSTEM.md`, `APPEND_SYSTEM.md`, or
44
+ `mcp.json`. Configure the required tools through Pi's normal
45
+ mechanisms. Native prompt files coexist with the package's section;
46
+ disabling this extension removes its bundled resources on reload in
47
+ my-pi.
48
+
49
+ Instructions are guidance, not a security boundary. Child processes
50
+ can still print secrets; redaction and database permission enforcement
51
+ remain separate. Third-party extensions that force a complete prompt
52
+ can hide later structured sections; prefer Pi's structured prompt API.
53
+
54
+ Bundled into my-pi as `tool-guidance`. Use
55
+ `/extensions disable tool-guidance` to remove its reminders and
56
+ bundled skills on reload. The package manifest exposes the same skills
57
+ in standalone Pi.
58
+
59
+ ## Install
60
+
61
+ <!-- package-readme:install:start -->
62
+
63
+ ```bash
64
+ pi install npm:@spences10/pi-tool-guidance
65
+ ```
66
+
67
+ <!-- package-readme:install:end -->
68
+
69
+ ## Development
70
+
71
+ <!-- package-readme:development:start commands="check,test,build" -->
72
+
73
+ Package scripts build transitive workspace dependencies first, then
74
+ run local tools through Vite+ with `vp exec`.
75
+
76
+ ```bash
77
+ pnpm --filter @spences10/pi-tool-guidance run check
78
+ pnpm --filter @spences10/pi-tool-guidance run test
79
+ pnpm --filter @spences10/pi-tool-guidance run build
80
+ ```
81
+
82
+ <!-- package-readme:development:end -->
83
+
84
+ ## License
85
+
86
+ MIT
@@ -0,0 +1,5 @@
1
+ import type { BuildSystemPromptOptions, ExtensionAPI } from '@earendil-works/pi-coding-agent';
2
+ type Tool = Pick<ReturnType<ExtensionAPI['getAllTools']>[number], 'name' | 'exposure' | 'namespace'>;
3
+ export declare function tool_guidance(options: BuildSystemPromptOptions, tools: readonly Tool[]): string;
4
+ export default function tool_guidance_extension(pi: ExtensionAPI): void;
5
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,51 @@
1
+ const NOPEEK_GUIDANCE = `## Secret-safe commands
2
+ Never read secret files or print credential values into model context. Read the bundled my-pi-nopeek skill before credential-dependent commands. Use one-shot nopeek run with only the required keys; separate Pi shells do not share loaded environment changes. Child-process output can still leak secrets; redaction is best-effort, not a guarantee.`;
3
+ const OMNISEARCH_GUIDANCE = `## Web research
4
+ For research and current external facts, prefer the configured Omnisearch MCP server. Read the bundled my-pi-omnisearch skill. Discover its actual tools with tool search or codemode, and read source content before presenting claims; snippets alone are not verification.`;
5
+ const SQLITE_GUIDANCE = `## SQLite databases
6
+ Prefer the configured SQLite MCP tools over ad-hoc shell SQL. Read the bundled my-pi-sqlite skill; inspect schema before querying, keep result limits small, and prefer a backup plus an explicit transaction before authorized writes. Do not bypass safety gates to make destructive operations easier.`;
7
+ export function tool_guidance(options, tools) {
8
+ const selected = options.selectedTools ?? [
9
+ 'read',
10
+ 'bash',
11
+ 'edit',
12
+ 'write',
13
+ ];
14
+ const indirect = selected.includes('codemode') || selected.includes('tool_search');
15
+ const reachable = tools.filter((tool) => tool.exposure !== 'hidden' &&
16
+ (selected.includes(tool.name) ||
17
+ (indirect &&
18
+ ['codemode', 'deferred'].includes(tool.exposure))));
19
+ const names = reachable
20
+ .flatMap((tool) => [
21
+ tool.name,
22
+ tool.namespace?.name ?? '',
23
+ ...(tool.namespace?.aliases ?? []),
24
+ ])
25
+ .join('\n');
26
+ // Pi lists configured indirect servers before their background connections complete.
27
+ const servers = indirect
28
+ ? (options.sections?.mcp_servers ?? '')
29
+ : '';
30
+ const available = `${names}\n${servers}`.toLowerCase();
31
+ const shell = selected.some((name) => ['bash', 'powershell'].includes(name)) ||
32
+ reachable.some((tool) => ['bash', 'powershell'].includes(tool.name));
33
+ return [
34
+ shell ? NOPEEK_GUIDANCE : '',
35
+ available.includes('omnisearch') ? OMNISEARCH_GUIDANCE : '',
36
+ available.includes('sqlite') ? SQLITE_GUIDANCE : '',
37
+ ]
38
+ .filter(Boolean)
39
+ .join('\n\n');
40
+ }
41
+ export default function tool_guidance_extension(pi) {
42
+ pi.on('before_agent_start', (event) => {
43
+ const guidance = tool_guidance(event.systemPromptOptions, pi.getAllTools());
44
+ if (guidance)
45
+ event.systemPromptOptions.sections.my_pi_tool_guidance =
46
+ guidance;
47
+ else
48
+ delete event.systemPromptOptions.sections.my_pi_tool_guidance;
49
+ });
50
+ }
51
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA,MAAM,eAAe,GAAG;0VACkU,CAAC;AAE3V,MAAM,mBAAmB,GAAG;8QACkP,CAAC;AAE/Q,MAAM,eAAe,GAAG;0SACkR,CAAC;AAE3S,MAAM,UAAU,aAAa,CAC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vB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAC1C,CAAC;IACH,OAAO;QACN,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE;QAC5B,SAAS,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE;QAC3D,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE;KACnD;SACC,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,MAAM,CAAC,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAC9C,EAAgB;IAEhB,EAAE,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,KAAK,EAAE,EAAE;QACrC,MAAM,QAAQ,GAAG,aAAa,CAC7B,KAAK,CAAC,mBAAmB,EACzB,EAAE,CAAC,WAAW,EAAE,CAChB,CAAC;QACF,IAAI,QAAQ;YACX,KAAK,CAAC,mBAAmB,CAAC,QAAQ,CAAC,mBAAmB;gBACrD,QAAQ,CAAC;;YAEV,OAAO,KAAK,CAAC,mBAAmB,CAAC,QAAQ,CAAC,mBAAmB,CAAC;IAChE,CAAC,CAAC,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,65 @@
1
1
  {
2
2
  "name": "@spences10/pi-tool-guidance",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "Packaged nopeek, Omnisearch and SQLite workflow guidance for Pi",
5
+ "keywords": [
6
+ "pi",
7
+ "pi-package"
8
+ ],
9
+ "homepage": "https://github.com/spences10/my-pi/tree/main/packages/pi-tool-guidance#readme",
10
+ "license": "MIT",
11
+ "author": "Scott Spence <me@scottspence.com>",
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/spences10/my-pi.git",
15
+ "directory": "packages/pi-tool-guidance"
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "README.md",
20
+ "skills"
21
+ ],
22
+ "type": "module",
23
+ "main": "./dist/index.js",
24
+ "types": "./dist/index.d.ts",
25
+ "exports": {
26
+ ".": {
27
+ "types": "./dist/index.d.ts",
28
+ "default": "./dist/index.js"
29
+ }
30
+ },
31
+ "publishConfig": {
32
+ "access": "public"
33
+ },
34
+ "devDependencies": {
35
+ "@earendil-works/pi-coding-agent": "1.4.0",
36
+ "@types/node": "^26.0.0",
37
+ "typescript": "^7.0.0",
38
+ "vite-plus": "1.4.0"
39
+ },
40
+ "peerDependencies": {
41
+ "@earendil-works/pi-coding-agent": ">=1.4.0"
42
+ },
43
+ "engines": {
44
+ "node": ">=24.15.0"
45
+ },
46
+ "pi": {
47
+ "extensions": [
48
+ "./dist/index.js"
49
+ ],
50
+ "image": "https://raw.githubusercontent.com/spences10/my-pi/main/assets/pi-package-preview.png",
51
+ "skills": [
52
+ "./skills"
53
+ ]
54
+ },
55
+ "scripts": {
56
+ "build": "pnpm --filter \"$npm_package_name^...\" run build:self && pnpm run build:self",
57
+ "build:self": "vp exec tsc -p tsconfig.build.json",
58
+ "check": "pnpm --filter \"$npm_package_name^...\" run build:self && pnpm run check:self",
59
+ "check:self": "vp exec tsc --noEmit -p tsconfig.json",
60
+ "test": "pnpm --filter \"$npm_package_name^...\" run build:self && pnpm run test:self",
61
+ "test:self": "vp test run",
62
+ "coverage:self": "vp test run --coverage",
63
+ "coverage": "pnpm --filter \"$npm_package_name^...\" run build:self && pnpm run coverage:self"
64
+ }
6
65
  }
@@ -0,0 +1,41 @@
1
+ ---
2
+ name: my-pi-nopeek
3
+ # prettier-ignore
4
+ description: Use when loading .env credentials, running authenticated commands, or keeping secret values out of Pi context.
5
+ compatibility: Requires Pi with shell access and the nopeek CLI.
6
+ ---
7
+
8
+ # Credential-dependent commands
9
+
10
+ Use the nopeek CLI to reduce accidental disclosure. This skill does
11
+ not install hooks, load credentials automatically, or guarantee safe
12
+ output.
13
+
14
+ 1. Inspect key names with `pnpx nopeek list` or `pnpx nopeek status`;
15
+ never read secret files into model context.
16
+ 2. In pnpm projects use `pnpx nopeek`; otherwise use `npx nopeek`.
17
+ 3. Prefer one-shot execution with an explicit key allowlist:
18
+
19
+ ```bash
20
+ pnpx nopeek run .env --only DATABASE_URL -- sh -c 'psql "$DATABASE_URL" -c "select 1"'
21
+ ```
22
+
23
+ 4. Keep variable expansion inside the child shell. Do not print keys,
24
+ run `env`/`printenv`, enable tracing, or place secret values in
25
+ arguments.
26
+ 5. Review what the child command prints: nopeek cannot prevent
27
+ arbitrary applications from leaking credentials through stdout or
28
+ stderr.
29
+ 6. Use `nopeek load` only with confirmed persistent harness injection,
30
+ or when loading and execution happen in the same trusted shell. A
31
+ source-file result does not persist into another Pi tool call.
32
+ 7. Use `pnpx nopeek audit` for exposure and gitignore checks.
33
+
34
+ Pi's redaction extension is a separate best-effort safety net, not a
35
+ security boundary. If secret output is unavoidable, stop and agree on
36
+ a safer workflow rather than exposing it.
37
+
38
+ The CLI must be available through the user's package runner or
39
+ installed locally. Do not change their credential storage or
40
+ configuration implicitly. See
41
+ [nopeek's threat model](https://github.com/spences10/nopeek#threat-model-and-non-goals).
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: my-pi-omnisearch
3
+ # prettier-ignore
4
+ description: Use when researching current facts, verifying documentation, or finding sources with a configured Omnisearch MCP server.
5
+ compatibility: Requires Pi with a configured Omnisearch MCP server.
6
+ ---
7
+
8
+ # Verified web research
9
+
10
+ This skill supplies guidance, not an MCP server or provider
11
+ credentials. Use the user's configured integration; do not install or
12
+ configure one without authorization.
13
+
14
+ 1. Discover the actual namespace and tool names. In codemode use
15
+ `searchTools("web search")`, `describeNamespace(namespace)`, and
16
+ `describeTool(name)`; use tool search when that is the available
17
+ route. Never assume hyphenated server names are valid JavaScript
18
+ identifiers.
19
+ 2. Use `web_search` for discovery. Choose providers deliberately:
20
+ Tavily for factual/cited searches, Brave or Kagi for operators, and
21
+ Exa for semantic discovery, when those providers are available.
22
+ 3. Use `web_extract` to read actual source content before making
23
+ claims. Search snippets alone are not verified evidence.
24
+ 4. Use `ai_search` when a synthesis with sources helps; verify
25
+ important claims against those sources.
26
+ 5. Prefer official documentation, repositories, release notes, and
27
+ source. State source conflicts, uncertainty, and partial tool
28
+ failures.
29
+ 6. In codemode inspect MCP `isError` results, not just promise
30
+ resolution.
31
+
32
+ If the server is unavailable, say so and use an available research
33
+ tool without claiming Omnisearch verified the result. Never invent
34
+ sources.
@@ -0,0 +1,35 @@
1
+ ---
2
+ name: my-pi-sqlite
3
+ # prettier-ignore
4
+ description: Use when inspecting, querying, or modifying SQLite databases through a configured SQLite MCP server.
5
+ compatibility: Requires Pi with a configured SQLite MCP server.
6
+ ---
7
+
8
+ # SQLite workflow
9
+
10
+ This skill does not install an MCP server, open databases
11
+ automatically, or authorize writes. Keep the user's server
12
+ configuration and permissions.
13
+
14
+ 1. Discover actual tool names with codemode `searchTools("SQLite")`,
15
+ `describeNamespace(namespace)`, and `describeTool(name)`, or tool
16
+ search.
17
+ 2. Use `open_database` for existing files. Use `create_database` only
18
+ when creating a database is explicitly intended.
19
+ 3. Inspect with `database_info`, `list_tables`, `describe_table`, or
20
+ `export_schema` before constructing queries.
21
+ 4. Use `execute_read_query` for SELECT, PRAGMA, and EXPLAIN. Keep
22
+ limits small, avoid selecting credential columns, and bound
23
+ model-visible output.
24
+ 5. Before authorized writes or schema changes, prefer
25
+ `backup_database` and an explicit transaction. Use
26
+ `execute_write_query` or `execute_schema_query` only when the
27
+ intent and affected data are clear.
28
+ 6. Commit only on success; roll back failed transactions. Close
29
+ databases with `close_database` when finished.
30
+ 7. In codemode inspect MCP `isError` results before continuing.
31
+
32
+ Prefer MCP over raw sqlite3 or one-off Python SQL scripts. Use a shell
33
+ fallback only when MCP is unavailable or the user explicitly requests
34
+ it, and retain the same backup, transaction, and approval precautions.
35
+ Never bypass MCP safety gates merely to make destructive SQL easier.