@spences10/pi-omnisearch 0.0.1

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/CHANGELOG.md ADDED
@@ -0,0 +1,8 @@
1
+ # @spences10/pi-omnisearch
2
+
3
+ ## 0.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 3ef8d39: Add Omnisearch and SQLite prompt shims; refine destructive
8
+ confirmation for session-created files.
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 ADDED
@@ -0,0 +1,86 @@
1
+ # @spences10/pi-omnisearch
2
+
3
+ Pi extension that reminds the model to use `mcp-omnisearch` for
4
+ verified web research instead of relying on stale model memory or
5
+ search snippets.
6
+
7
+ This package does **not** start the MCP server and does **not**
8
+ duplicate its tools. `mcp-omnisearch` remains the source of truth;
9
+ this extension only injects workflow guidance when Omnisearch MCP
10
+ tools are available.
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ pi install npm:@spences10/pi-omnisearch
16
+ ```
17
+
18
+ Local development from this monorepo:
19
+
20
+ ```bash
21
+ pnpm --filter @spences10/pi-omnisearch run build
22
+ pi install ./packages/pi-omnisearch
23
+ # or for one run only
24
+ pi -e ./packages/pi-omnisearch
25
+ ```
26
+
27
+ ## What it does
28
+
29
+ The extension injects a system reminder telling the model to use
30
+ `mcp-omnisearch` when the user asks to:
31
+
32
+ - research current information
33
+ - verify facts or citations
34
+ - inspect documentation
35
+ - compare packages, APIs, or tools
36
+ - extract and summarize web content
37
+
38
+ It encourages the verified research workflow from Scott's ecosystem
39
+ skill:
40
+
41
+ - use `web_search` for discovery
42
+ - use `web_extract` to read actual source content before making claims
43
+ - use `ai_search` for synthesized answers with sources
44
+ - prefer official docs, repositories, release notes, and source files
45
+ - report partial failures, conflicts, and uncertainty
46
+
47
+ It adds no slash commands and no custom tools.
48
+
49
+ ## Example MCP config
50
+
51
+ `mcp-omnisearch` must be configured separately, for example in
52
+ `~/.pi/agent/mcp.json`:
53
+
54
+ ```json
55
+ {
56
+ "mcpServers": {
57
+ "mcp-omnisearch": {
58
+ "command": "npx",
59
+ "args": ["-y", "mcp-omnisearch"]
60
+ }
61
+ }
62
+ }
63
+ ```
64
+
65
+ ## Using from a custom harness
66
+
67
+ ```ts
68
+ import omnisearch from '@spences10/pi-omnisearch';
69
+
70
+ // pass `omnisearch` as an ExtensionFactory to your Pi runtime
71
+ ```
72
+
73
+ `my-pi` imports this package directly and enables it as the built-in
74
+ Omnisearch reminder.
75
+
76
+ ## Development
77
+
78
+ ```bash
79
+ pnpm --filter @spences10/pi-omnisearch run check
80
+ pnpm --filter @spences10/pi-omnisearch run test
81
+ pnpm --filter @spences10/pi-omnisearch run build
82
+ ```
83
+
84
+ ## License
85
+
86
+ MIT
@@ -0,0 +1,3 @@
1
+ import type { BeforeAgentStartEvent, ExtensionAPI } from '@mariozechner/pi-coding-agent';
2
+ export declare function should_inject_omnisearch_prompt(event: Pick<BeforeAgentStartEvent, 'systemPromptOptions'>): boolean;
3
+ export default function omnisearch(pi: ExtensionAPI): Promise<void>;
package/dist/index.js ADDED
@@ -0,0 +1,42 @@
1
+ const MCP_OMNISEARCH_TOOL_PREFIX = 'mcp__mcp-omnisearch__';
2
+ const MCP_OMNISEARCH_TOOLS = new Set([
3
+ 'web_search',
4
+ 'ai_search',
5
+ 'web_extract',
6
+ ]);
7
+ function is_mcp_omnisearch_tool(tool_name) {
8
+ if (tool_name.startsWith(MCP_OMNISEARCH_TOOL_PREFIX))
9
+ return true;
10
+ const [, server_name, tool] = tool_name.split('__');
11
+ if (!server_name?.includes('omnisearch') || !tool)
12
+ return false;
13
+ return MCP_OMNISEARCH_TOOLS.has(tool);
14
+ }
15
+ export function should_inject_omnisearch_prompt(event) {
16
+ const selected_tools = event.systemPromptOptions?.selectedTools;
17
+ return (!selected_tools || selected_tools.some(is_mcp_omnisearch_tool));
18
+ }
19
+ export default async function omnisearch(pi) {
20
+ pi.on('before_agent_start', async (event) => {
21
+ if (!should_inject_omnisearch_prompt(event))
22
+ return {};
23
+ return {
24
+ systemPrompt: event.systemPrompt +
25
+ `
26
+
27
+ ## Web research via mcp-omnisearch
28
+
29
+ You have access to \`mcp-omnisearch\`, a unified MCP server for web search, AI answers, and content extraction. Use it when the user asks to research, verify current information, inspect documentation, compare tools, find sources, or cite external facts.
30
+
31
+ Preferred workflow:
32
+ - Use \`mcp__mcp-omnisearch__web_search\` for discovery. Pick providers intentionally: Tavily for factual/cited search, Brave or Kagi for operators like \`site:\` and \`filetype:\`, Exa for semantic discovery.
33
+ - Use \`mcp__mcp-omnisearch__web_extract\` to read actual source content before presenting claims. Do not rely on search snippets alone.
34
+ - Use \`mcp__mcp-omnisearch__ai_search\` when a synthesized answer with sources is more useful than raw results.
35
+ - For docs or packages, prefer official docs, repos, release notes, and source files; verify before summarizing.
36
+ - Report partial failures, source conflicts, or uncertainty instead of silently guessing.
37
+
38
+ Do not rely only on stale model memory for current web facts when mcp-omnisearch is available.`,
39
+ };
40
+ });
41
+ }
42
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,MAAM,0BAA0B,GAAG,uBAAuB,CAAC;AAE3D,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC;IACpC,YAAY;IACZ,WAAW;IACX,aAAa;CACb,CAAC,CAAC;AAEH,SAAS,sBAAsB,CAAC,SAAiB;IAChD,IAAI,SAAS,CAAC,UAAU,CAAC,0BAA0B,CAAC;QAAE,OAAO,IAAI,CAAC;IAElE,MAAM,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACpD,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC;IAChE,OAAO,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,+BAA+B,CAC9C,KAAyD;IAEzD,MAAM,cAAc,GAAG,KAAK,CAAC,mBAAmB,EAAE,aAAa,CAAC;IAChE,OAAO,CACN,CAAC,cAAc,IAAI,cAAc,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAC9D,CAAC;AACH,CAAC;AAED,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,UAAU,CAAC,EAAgB;IACxD,EAAE,CAAC,EAAE,CACJ,oBAAoB,EACpB,KAAK,EAAE,KAA4B,EAAE,EAAE;QACtC,IAAI,CAAC,+BAA+B,CAAC,KAAK,CAAC;YAAE,OAAO,EAAE,CAAC;QACvD,OAAO;YACN,YAAY,EACX,KAAK,CAAC,YAAY;gBAClB;;;;;;;;;;;;;+FAa0F;SAC3F,CAAC;IACH,CAAC,CACD,CAAC;AACH,CAAC"}
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@spences10/pi-omnisearch",
3
+ "version": "0.0.1",
4
+ "description": "Pi extension that reminds the model to use mcp-omnisearch for verified web research",
5
+ "keywords": [
6
+ "mcp",
7
+ "omnisearch",
8
+ "pi",
9
+ "pi-package",
10
+ "research",
11
+ "search",
12
+ "web"
13
+ ],
14
+ "license": "MIT",
15
+ "author": "Scott Spence <me@scottspence.com>",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/spences10/my-pi.git",
19
+ "directory": "packages/pi-omnisearch"
20
+ },
21
+ "files": [
22
+ "dist",
23
+ "README.md",
24
+ "CHANGELOG.md"
25
+ ],
26
+ "type": "module",
27
+ "exports": {
28
+ ".": {
29
+ "types": "./dist/index.d.ts",
30
+ "default": "./dist/index.js"
31
+ }
32
+ },
33
+ "dependencies": {
34
+ "@mariozechner/pi-coding-agent": "^0.70.2"
35
+ },
36
+ "devDependencies": {
37
+ "@types/node": "^25.6.0",
38
+ "typescript": "^6.0.0",
39
+ "vitest": "^4.1.5"
40
+ },
41
+ "engines": {
42
+ "node": ">=22.0.0"
43
+ },
44
+ "pi": {
45
+ "extensions": [
46
+ "./dist/index.js"
47
+ ]
48
+ },
49
+ "scripts": {
50
+ "build": "tsc -p tsconfig.build.json",
51
+ "check": "tsc --noEmit -p tsconfig.json",
52
+ "test": "vitest run"
53
+ }
54
+ }