pi-agentic-search 0.1.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 ADDED
@@ -0,0 +1,136 @@
1
+ # pi-agentic-search
2
+
3
+ A [pi](https://pi.dev) extension that provides a deep research agent that autonomously searches, fetches, and synthesizes web information.
4
+
5
+ Unlike the primitive `search` and `fetch` tools — which return raw results — this agent reasons across multiple sources, follows leads, resolves conflicts, and returns a structured Research Summary. Use when the topic requires depth, cross-referencing, or synthesis beyond a single query.
6
+
7
+ ## Prerequisites
8
+
9
+ This extension requires [`pi-search-tool`](https://github.com/jandrikus/pi-search-tool) which provides the `search` and `fetch` tools. The extension loads it automatically at runtime, but you need the underlying [`search-headless`](https://github.com/jandrikus/search-headless) installed on your machine.
10
+
11
+ ### Install search-headless
12
+
13
+ ```bash
14
+ # Clone and install
15
+ git clone git@github.com:jandrikus/search-headless.git ~/dev/search-headless
16
+ cd ~/dev/search-headless
17
+ ./install.sh
18
+ ```
19
+
20
+ Verify it works:
21
+
22
+ ```bash
23
+ search-web "test query" --limit 3
24
+ fetch-content https://example.com --max-chars 500
25
+ ```
26
+
27
+ ## Installation
28
+
29
+ ```bash
30
+ pi install npm:pi-agentic-search
31
+ ```
32
+
33
+ This installs the extension and adds it to your settings automatically.
34
+
35
+ ## Usage
36
+
37
+ The research agent is automatically available after installation. Use it for complex topics requiring synthesis:
38
+
39
+ ```
40
+ Research the current best practices for rate limiting in distributed APIs
41
+ ```
42
+
43
+ ```
44
+ Compare the approaches of different database migration tools
45
+ ```
46
+
47
+ Or with parameters directly:
48
+
49
+ | Parameter | Required | Description |
50
+ |-----------|----------|-------------|
51
+ | `goal` | Yes | The research question — be specific and outcome-oriented |
52
+ | `context` | Yes | Background that helps focus: what's known, what angle matters, what to prioritize |
53
+
54
+ ## When to Use
55
+
56
+ | Use `agentic_search` | Use `search` + `fetch` directly |
57
+ |----------------------|--------------------------------|
58
+ | Comparing technologies or approaches | Simple factual lookup |
59
+ | Understanding trends across sources | Looking up a specific URL |
60
+ | Resolving conflicting information | Checking documentation |
61
+ | Producing a structured summary | Quick reference check |
62
+ | Following chains of references | Single-source answer |
63
+
64
+ ## How It Works
65
+
66
+ 1. Research agent spawns a **background pi process** with `search` and `fetch` tools (from `pi-search-tool`)
67
+ 2. A **live progress widget** shows real-time search queries, fetched URLs, and cost
68
+ 3. When finished, a **comprehensive Research Summary** is delivered as a follow-up message
69
+
70
+ The agent uses a cheap model to minimize cost — run it freely for any non-trivial research.
71
+
72
+ ## Features
73
+
74
+ - **Autonomous research** — Searches, fetches, reads full sources, and synthesizes
75
+ - **Live progress widget** — See queries, fetches, token usage, and cost in real time
76
+ - **Agent control panel** — `Ctrl+Shift+2` to stop, cancel, or retry running agents
77
+ - **Auto-retry on transient errors** — Transparently retries on 429, 5xx, and network errors
78
+ - **Customizable system prompt** — Edit via config files that survive updates
79
+ - **Activity timeout** — Detects stuck processes (2 min) and marks as "probably failed"
80
+
81
+ ## Agent Control Panel
82
+
83
+ Press `Ctrl+Shift+2` to open the control panel. From there you can:
84
+
85
+ | Key | Action | Effect |
86
+ |-----|--------|--------|
87
+ | `S` | Stop | Pauses agent, keeps widget visible, no LLM feedback |
88
+ | `C` | Cancel | Kills agent, sends "canceled by user" to LLM, removes widget |
89
+ | `R` | Retry | Restarts agent fresh, reuses same widget |
90
+ | `A` | Stop All | Stops all running agents |
91
+ | `Esc` | Close | Closes the control panel |
92
+
93
+ ## Configuration
94
+
95
+ ### Settings
96
+
97
+ Extension settings live in `settings.json`:
98
+
99
+ - **Global**: `~/.pi/config/pi-agentic-search/settings.json`
100
+
101
+ ```json
102
+ {
103
+ "model": "xiaomi-token-plan-ams/mimo-v2.5",
104
+ "keybinding": 2
105
+ }
106
+ ```
107
+
108
+ | Setting | Default | Description |
109
+ |---------|---------|-------------|
110
+ | `model` | *(empty)* | Model to use (empty = pi's default) |
111
+ | `keybinding` | `2` | Number key for control panel (`Ctrl+Shift+N`) |
112
+
113
+ ### System Prompt Customization
114
+
115
+ Three files in the config directory let you customize the research agent's behavior:
116
+
117
+ | File | Purpose | Survives Updates |
118
+ |------|---------|------------------|
119
+ | `prepend-system-prompt.md` | Added before the default prompt | ✅ |
120
+ | `append-system-prompt.md` | Added after the default prompt | ✅ |
121
+ | `replace-system-prompt.md` | Replaces the default prompt entirely | ✅ |
122
+
123
+ Lines starting with `#` are treated as comments and ignored.
124
+
125
+ **Priority**: If `replace-system-prompt.md` has non-comment content, it is used entirely. Otherwise, prepend + default + append are combined.
126
+
127
+ ## Security
128
+
129
+ - Research agent is **read-only** by design — it can only search and fetch
130
+ - It only has access to: `search`, `fetch`
131
+ - Uses `--no-skills` to prevent skill interference
132
+ - Runs with `--no-session` so it doesn't persist state
133
+
134
+ ## License
135
+
136
+ Apache-2.0
@@ -0,0 +1,46 @@
1
+ You are a read-only internet research agent. Your purpose is to investigate any
2
+ topic with depth and precision — searching, reading full source content, and
3
+ synthesizing findings into a reliable, structured summary.
4
+
5
+ You do not skim. You do not guess. You read primary sources.
6
+
7
+ ## Research Process
8
+
9
+ 1. Start broad — 2-3 different search queries to map the landscape
10
+ 2. Identify key sources — authoritative, recent, diverse perspectives
11
+ 3. Fetch and read — follow promising links, read full articles not snippets
12
+ 4. Cross-reference — verify claims across multiple sources
13
+ 5. Follow leads — if a source mentions something interesting, search for it
14
+ 6. Iterate — refine queries based on what you learn
15
+
16
+ ## Search Strategy
17
+
18
+ - Use specific, targeted queries rather than vague keywords
19
+ - Try variations: synonyms, different phrasings, technical vs colloquial
20
+ - Site-specific searches when good sources exist (e.g., "site:arxiv.org", "site:github.com")
21
+ - Include date terms when freshness matters
22
+ - Search for counterpoints and criticisms, not just confirmations
23
+
24
+ ## What to Fetch
25
+
26
+ - Official documentation, primary sources, authoritative references
27
+ - Technical discussions, forum threads, GitHub issues for real-world perspectives
28
+ - Academic papers when relevant
29
+ - Skip: marketing pages, thin content, outdated information, clickbait
30
+
31
+ ## Output Format
32
+
33
+ Produce a single, comprehensive summary with:
34
+
35
+ Query · Sources (url + credibility note) · Key Findings · Conflicts or Gaps
36
+
37
+ ## Rules
38
+
39
+ - Prefer primary sources over aggregators
40
+ - Every claim cites its source URL
41
+ - Mark inferences [inferred], direct content [source]
42
+ - Distinguish facts from opinions
43
+ - If a source is inaccessible, note it and compensate with alternatives
44
+ - Quality over quantity — a few well-read sources beat many skimmed ones
45
+ - No partial output — deliver the complete summary at the end
46
+ - No clarifying questions mid-task — make reasonable assumptions and note them