portable-agent-layer 0.20.0 → 0.22.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.
Files changed (38) hide show
  1. package/README.md +4 -3
  2. package/assets/agents/gemini-researcher.md +73 -0
  3. package/assets/agents/grok-researcher.md +10 -1
  4. package/assets/agents/perplexity-researcher.md +67 -0
  5. package/assets/skills/analyze-youtube/SKILL.md +1 -1
  6. package/assets/skills/analyze-youtube/tools/youtube-analyze.ts +3 -3
  7. package/assets/skills/create-pdf/SKILL.md +53 -76
  8. package/assets/skills/fyzz-chat-api/SKILL.md +3 -3
  9. package/assets/skills/fyzz-chat-api/tools/fyzz-api.ts +4 -4
  10. package/assets/skills/research/SKILL.md +9 -9
  11. package/assets/skills/research/tools/gemini-search.ts +186 -0
  12. package/assets/skills/research/tools/grok-search.ts +3 -3
  13. package/assets/skills/research/tools/perplexity-search.ts +150 -0
  14. package/assets/templates/PAL/ALGORITHM.md +71 -9
  15. package/assets/templates/PAL/WORK_TRACKING.md +2 -9
  16. package/package.json +1 -1
  17. package/src/cli/index.ts +18 -6
  18. package/src/hooks/handlers/rating.ts +1 -1
  19. package/src/hooks/handlers/relationship.ts +2 -2
  20. package/src/hooks/handlers/session-name.ts +1 -1
  21. package/src/hooks/handlers/work-learning.ts +9 -0
  22. package/src/hooks/lib/claude-md.ts +17 -5
  23. package/src/hooks/lib/context.ts +35 -55
  24. package/src/hooks/lib/export.ts +3 -2
  25. package/src/hooks/lib/graduation.ts +1 -1
  26. package/src/hooks/lib/inference.ts +1 -1
  27. package/src/hooks/lib/paths.ts +1 -0
  28. package/src/hooks/lib/readme-sync.ts +6 -6
  29. package/src/hooks/lib/security.ts +5 -1
  30. package/src/hooks/lib/work-tracking.ts +29 -42
  31. package/src/targets/claude/install.ts +2 -0
  32. package/src/targets/cursor/install.ts +2 -0
  33. package/src/targets/lib.ts +93 -0
  34. package/src/targets/opencode/install.ts +2 -0
  35. package/src/tools/agent/algorithm-reflect.ts +120 -0
  36. package/src/tools/agent/wisdom-frame.ts +0 -2
  37. package/assets/agents/claude-researcher.md +0 -43
  38. package/assets/agents/investigative-researcher.md +0 -44
package/README.md CHANGED
@@ -111,14 +111,15 @@ pal cli install # all available (default)
111
111
 
112
112
  | Variable | Description |
113
113
  |----------|-------------|
114
- | `ANTHROPIC_API_KEY` | Required for PAL's hook inference (sentiment analysis, session naming). Uses Haiku for low-cost background calls. |
114
+ | `PAL_ANTHROPIC_API_KEY` | Required for PAL's hook inference (sentiment analysis, session naming). Uses Haiku for low-cost background calls. |
115
115
 
116
116
  ### Optional
117
117
 
118
118
  | Variable | Description |
119
119
  |----------|-------------|
120
- | `GEMINI_API_KEY` | For YouTube video analysis skill |
121
- | `XAI_API_KEY` | For Grok real-time research skill (X/web search) |
120
+ | `PAL_GEMINI_API_KEY` | For YouTube video analysis and web search skill |
121
+ | `PAL_XAI_API_KEY` | For Grok real-time research skill (X/web search) |
122
+ | `PAL_PERPLEXITY_API_KEY` | For Perplexity deep research skill |
122
123
  | `PAL_HOME` | Override user state directory (default: `~/.pal` or repo root) |
123
124
  | `PAL_PKG` | Override package root |
124
125
  | `PAL_CLAUDE_DIR` | Override Claude config dir (default: `~/.claude`) |
@@ -0,0 +1,73 @@
1
+ ---
2
+ name: gemini-researcher
3
+ description: Deep research with academic rigor — Gemini-grounded search with scholarly focus, query decomposition, multi-source synthesis. Falls back to WebSearch if no API key.
4
+ tools: Bash, WebSearch, WebFetch, Read, Grep, Glob
5
+ model: sonnet
6
+ ---
7
+
8
+ You are a research specialist focused on **depth and academic rigor**.
9
+
10
+ ## Tool Selection
11
+
12
+ **Always start with Gemini Search.** Use the grounded search tool for your first sub-question:
13
+ ```bash
14
+ bun ~/.agents/skills/research/tools/gemini-search.ts -- "<query>"
15
+ ```
16
+
17
+ - If it returns results → **continue using Gemini Search** for remaining queries
18
+ - If it errors about `PAL_GEMINI_API_KEY` → **fall back to WebSearch/WebFetch** for all queries using the fallback methodology below
19
+
20
+ The tool has a built-in academic system prompt that prioritizes scholarly sources, but you should still craft queries to target academic content:
21
+ - Include author names, paper titles, or venue names when known
22
+ - Use precise technical terminology
23
+ - Add "peer-reviewed", "systematic review", or venue names to narrow results
24
+
25
+ ## Fallback Mode (WebSearch/WebFetch)
26
+
27
+ When Gemini Search is unavailable, use WebSearch with academic focus:
28
+
29
+ 1. **Decompose** the query into 2-3 sub-questions targeting the core of the topic
30
+ 2. **Search** each sub-question using WebSearch — craft queries that target academic sources:
31
+ - Prefix with `site:arxiv.org`, `site:scholar.google.com`, `site:pubmed.ncbi.nlm.nih.gov` where relevant
32
+ - Include technical terms, author names, conference/journal names
33
+ - Add year ranges to find recent work
34
+ 3. **Read** the most promising results with WebFetch to extract detail
35
+ 4. **Synthesize** findings into a structured analysis
36
+
37
+ ## Guidelines (Both Modes)
38
+
39
+ - Prioritize peer-reviewed sources over blog posts and summaries
40
+ - Distinguish between established findings, preprints, and speculation
41
+ - Note methodology limitations, sample sizes, and confidence intervals when citing research
42
+ - Include author names, publication year, and venue for all cited work
43
+ - If a claim has no strong source, say so — do not fabricate citations
44
+ - Keep findings concise but substantive
45
+
46
+ ## Output Format
47
+
48
+ ```markdown
49
+ ## Findings
50
+
51
+ [Numbered list of key discoveries, each with a brief explanation and citation]
52
+
53
+ ## Sources
54
+
55
+ [Verified URLs with one-line descriptions — only include URLs you actually visited or that were returned by grounding]
56
+
57
+ ## Confidence
58
+
59
+ [High/Medium/Low rating per finding, with brief justification]
60
+
61
+ ## Gaps
62
+
63
+ [What couldn't be answered or needs further investigation]
64
+ ```
65
+
66
+ ## Fallback Footnote (MANDATORY when using WebSearch fallback)
67
+
68
+ If you fell back to WebSearch because the Gemini API was unavailable, you MUST append this footnote at the very end of your output:
69
+
70
+ ```markdown
71
+ ---
72
+ > **Note:** This research used WebSearch fallback instead of Gemini Search. The `PAL_GEMINI_API_KEY` environment variable is not set. To enable Gemini-grounded search, set the key: `export PAL_GEMINI_API_KEY=...` (get one at https://aistudio.google.com/apikey)
73
+ ```
@@ -33,7 +33,7 @@ The tool outputs findings as markdown with a `## Sources` section listing URLs a
33
33
 
34
34
  ## Fallback Path — WebSearch
35
35
 
36
- If the grok-search tool fails (missing `XAI_API_KEY` or API error), fall back to WebSearch and WebFetch with a **recency focus**:
36
+ If the grok-search tool fails (missing `PAL_XAI_API_KEY` or API error), fall back to WebSearch and WebFetch with a **recency focus**:
37
37
 
38
38
  1. **Search** using WebSearch with time-sensitive queries — prepend "2026" or "latest" or "today" to queries
39
39
  2. **Prioritize** news sources, social media aggregators, and live blogs
@@ -84,3 +84,12 @@ If the grok-search tool fails (missing `XAI_API_KEY` or API error), fall back to
84
84
 
85
85
  [What couldn't be confirmed or needs monitoring as the situation develops]
86
86
  ```
87
+
88
+ ## Fallback Footnote (MANDATORY when using WebSearch fallback)
89
+
90
+ If you fell back to WebSearch because the Grok API was unavailable, you MUST append this footnote at the very end of your output:
91
+
92
+ ```markdown
93
+ ---
94
+ > **Note:** This research used WebSearch fallback instead of Grok Search. The `PAL_XAI_API_KEY` environment variable is not set. To enable Grok real-time search, set the key: `export PAL_XAI_API_KEY=...` (get one at https://console.x.ai/)
95
+ ```
@@ -0,0 +1,67 @@
1
+ ---
2
+ name: perplexity-researcher
3
+ description: Investigative research with verification rigor — Perplexity-grounded search with source cross-referencing, credibility assessment, and evidence chains. Falls back to WebSearch if no API key.
4
+ tools: Bash, WebSearch, WebFetch, Read, Grep, Glob
5
+ model: sonnet
6
+ ---
7
+
8
+ You are a research specialist focused on **investigative rigor and source verification**.
9
+
10
+ ## Tool Selection
11
+
12
+ **Always start with Perplexity Search.** Use the grounded search tool for your first sub-question:
13
+ ```bash
14
+ bun ~/.agents/skills/research/tools/perplexity-search.ts -- "<query>"
15
+ ```
16
+
17
+ - If it returns results → **continue using Perplexity Search** for remaining queries
18
+ - If it errors about `PAL_PERPLEXITY_API_KEY` → **fall back to WebSearch/WebFetch** for all queries using the fallback methodology below, and **set a flag** to include the fallback footnote in your output
19
+
20
+ ## Fallback Mode (WebSearch/WebFetch)
21
+
22
+ When Perplexity Search is unavailable, use WebSearch with investigative focus:
23
+
24
+ 1. **Search** the topic broadly using WebSearch to map the information landscape
25
+ 2. **Verify** key claims by finding 2+ independent sources for each
26
+ 3. **Assess** source credibility — check publication date, author expertise, potential bias
27
+ 4. **Cross-reference** findings to identify contradictions or unsupported claims
28
+ 5. **Report** with clear evidence chains
29
+
30
+ ## Guidelines (Both Modes)
31
+
32
+ - Every factual claim should have at least 2 independent sources
33
+ - Note when a claim is single-sourced or comes from a potentially biased source
34
+ - Check publication dates — flag stale information
35
+ - Distinguish between verified facts, likely true (single credible source), and unverified claims
36
+ - Include source names, publication dates, and direct quotes when available
37
+ - Flag contradictions between sources
38
+ - If a claim has no strong source, say so — do not fabricate citations
39
+
40
+ ## Output Format
41
+
42
+ ```markdown
43
+ ## Findings
44
+
45
+ [Numbered list of verified findings, each tagged: verified (2+ sources) | ~ likely (1 credible source) | ? unverified]
46
+
47
+ ## Sources
48
+
49
+ [Verified URLs with one-line descriptions — only include URLs you actually visited or that were returned by Perplexity]
50
+
51
+ ## Confidence
52
+
53
+ [High/Medium/Low rating per finding, with evidence chain summary]
54
+
55
+ ## Flags
56
+
57
+ [Contradictions found, stale information, potential bias in sources]
58
+ ```
59
+
60
+ ## Fallback Footnote (MANDATORY when using WebSearch fallback)
61
+
62
+ If you fell back to WebSearch because the Perplexity API was unavailable, you MUST append this footnote at the very end of your output:
63
+
64
+ ```markdown
65
+ ---
66
+ > **Note:** This research used WebSearch fallback instead of Perplexity Search. The `PAL_PERPLEXITY_API_KEY` environment variable is not set. To enable Perplexity-grounded search, set the key: `export PAL_PERPLEXITY_API_KEY=pplx-...` (get one at https://www.perplexity.ai/settings/api)
67
+ ```
@@ -32,4 +32,4 @@ Follow the user's request. Common tasks:
32
32
  - For long videos, consider asking a focused question via `--prompt` rather than a full analysis
33
33
  - Gemini sees both visuals and audio — mention on-screen content (slides, code, diagrams) when relevant
34
34
  - Quote speakers verbatim when the user asks about specific statements
35
- - If the tool reports a missing API key, tell the user to get one at https://aistudio.google.com/apikey and set `GEMINI_API_KEY` in their shell profile or PAL settings
35
+ - If the tool reports a missing API key, tell the user to get one at https://aistudio.google.com/apikey and set `PAL_GEMINI_API_KEY` in their shell profile or PAL settings
@@ -4,7 +4,7 @@
4
4
  * YouTube Analyze — Sends a YouTube URL + prompt to Gemini for video analysis.
5
5
  *
6
6
  * Gemini can natively process YouTube videos (visual + audio).
7
- * Requires GEMINI_API_KEY environment variable.
7
+ * Requires PAL_GEMINI_API_KEY environment variable.
8
8
  *
9
9
  * Usage:
10
10
  * bun youtube-analyze.ts -- <youtube-url> [--prompt "your question"]
@@ -25,9 +25,9 @@ const DEFAULT_PROMPT = `Analyze this video and provide:
25
25
  const MODEL = "gemini-3.1-flash-lite-preview";
26
26
 
27
27
  function loadApiKey(): string {
28
- const key = process.env.GEMINI_API_KEY;
28
+ const key = process.env.PAL_GEMINI_API_KEY;
29
29
  if (!key) {
30
- console.error("Error: GEMINI_API_KEY environment variable is not set.");
30
+ console.error("Error: PAL_GEMINI_API_KEY environment variable is not set.");
31
31
  console.error("Get a free key at https://aistudio.google.com/apikey");
32
32
  process.exit(1);
33
33
  }
@@ -1,89 +1,54 @@
1
1
  ---
2
2
  name: create-pdf
3
- description: Generate a structured PDF report from a topic or content using parallel research/writing agents and md-to-pdf. Use when creating a report, generating a PDF, writing a document, or producing a structured multi-section PDF.
4
- argument-hint: <topic, outline, or content description>
3
+ description: Convert markdown files into a styled PDF report using md-to-pdf. Use when creating a PDF from existing markdown files, combining markdown into a report, or converting .md to .pdf.
4
+ argument-hint: <file paths, glob pattern, or directory containing .md files>
5
5
  ---
6
6
 
7
7
  ## Overview
8
8
 
9
- Create professional PDF reports by orchestrating parallel subagents for content generation, writing results as structured markdown files, then converting to PDF via `bunx md-to-pdf`.
9
+ Combine one or more markdown files into a single styled PDF using `bunx --bun md-to-pdf`. This skill handles concatenation, page breaks, styling, and conversion. It does NOT generate content — use the `research` skill or other content-generation workflows first, then pipe the resulting markdown files into this skill.
10
10
 
11
- ## Workflow
12
-
13
- ### Phase 1: Plan the Report Structure
14
-
15
- Based on the user's request, determine:
16
-
17
- 1. **Report topic and scope**
18
- 2. **Section breakdown** — identify 5-15 discrete sections/chapters
19
- 3. **Output directory** — ask the user or default to `~/Documents/<kebab-case-topic>/`
20
- 4. **Language** — detect from the user's request or ask
21
- 5. **File naming** — each section: `YYYYMMDD_snake_case_title.md` (use today's date if no specific date applies)
22
-
23
- Present the outline to the user for approval before proceeding.
24
-
25
- ### Phase 2: Parallel Content Generation
26
-
27
- Spawn **parallel subagents** to write sections simultaneously. Batch sections across agents — each agent handles 2-4 sections depending on total count.
28
-
29
- **Agent spawning rules:**
30
- - All agent spawns for a batch MUST be in a **single message** for true parallel execution
31
- - Each agent gets a clear, self-contained prompt with: section title, scope, key points to cover, tone/style, and the output file path
32
- - Agents write their sections directly as markdown files
33
- - For research-heavy reports: use `investigative-researcher`, `multi-perspective-researcher`, and `claude-researcher` agent types to get different perspectives
34
- - For content-heavy reports: use `general-purpose` agents with detailed writing instructions
11
+ ## Input
35
12
 
36
- **Prompt template for each agent:**
37
- ```
38
- Read [any reference files if applicable].
39
- Write a detailed markdown file at [output path] covering:
40
- - Section title: [title]
41
- - Scope: [what to cover]
42
- - Key points: [specific items to include]
43
- - Tone: [objective/persuasive/technical/casual]
44
- - Structure: Use ## for main headings, ### for sub-sections
45
- - Include sources with full URLs where applicable
46
- ```
13
+ The user provides one of:
14
+ - **Explicit file paths**: `/path/to/file1.md /path/to/file2.md ...`
15
+ - **A glob pattern**: `/path/to/report/*.md`
16
+ - **A directory**: `/path/to/report/` (all `.md` files inside, sorted alphabetically)
47
17
 
48
- **Batch sizing guide:**
18
+ If no output filename is specified, derive it from the directory name or first file: `<name>.pdf` in the same directory as the input files.
49
19
 
50
- | Total sections | Agents | Sections per agent |
51
- |----------------|--------|--------------------|
52
- | 3-6 | 2-3 | 2 each |
53
- | 7-12 | 3-4 | 2-3 each |
54
- | 13+ | 5 | 3-4 each |
55
-
56
- ### Phase 3: Overview File
20
+ ## Workflow
57
21
 
58
- After all agents complete, write a `00_overview.md` file containing:
59
- - Report title and date
60
- - Methodology description
61
- - Table of contents linking to each section
62
- - Executive summary synthesizing key findings from all sections
22
+ ### Step 1: Resolve Input Files
63
23
 
64
- ### Phase 4: Combine and Convert to PDF
24
+ Determine the list of markdown files and their order:
25
+ - If explicit paths: use as given
26
+ - If glob/directory: list and sort alphabetically (files prefixed with `00_` come first naturally)
27
+ - Confirm the file list and order with the user if more than 5 files
65
28
 
66
- **Step 1: Combine all markdown files into one.**
29
+ ### Step 2: Combine with Page Breaks
67
30
 
68
- Concatenate files in order with page break dividers between sections:
31
+ Concatenate all files with page break dividers between them:
69
32
 
70
33
  ```bash
71
34
  cat \
72
- 00_overview.md \
35
+ first_file.md \
73
36
  <(echo -e '\n\n<div style="page-break-before: always"></div>\n\n---\n\n') \
74
- YYYYMMDD_section_one.md \
37
+ second_file.md \
75
38
  <(echo -e '\n\n<div style="page-break-before: always"></div>\n\n---\n\n') \
76
- YYYYMMDD_section_two.md \
39
+ third_file.md \
77
40
  ... \
78
41
  > /tmp/combined_raw.md
79
42
  ```
80
43
 
81
- **Step 2: Add PDF frontmatter.**
44
+ For many files, generate the cat command dynamically rather than typing each one.
45
+
46
+ ### Step 3: Add PDF Frontmatter
82
47
 
83
48
  Prepend YAML frontmatter with styling, then append the combined content:
84
49
 
85
50
  ```bash
86
- cat > <report_name>.md << 'FRONTMATTER'
51
+ cat > <output_name>.md << 'FRONTMATTER'
87
52
  ---
88
53
  pdf_options:
89
54
  format: A4
@@ -105,38 +70,50 @@ css: |-
105
70
  ---
106
71
 
107
72
  FRONTMATTER
108
- cat /tmp/combined_raw.md >> <report_name>.md
73
+ cat /tmp/combined_raw.md >> <output_name>.md
109
74
  ```
110
75
 
111
- **Step 3: Generate the PDF.**
76
+ The user may request custom styling (font size, margins, colors). Override the defaults above accordingly.
77
+
78
+ ### Step 4: Generate PDF
112
79
 
113
80
  ```bash
114
- bunx --bun md-to-pdf <report_name>.md
81
+ bunx --bun md-to-pdf <output_name>.md
115
82
  ```
116
83
 
117
- **Step 4: Verify.**
84
+ ### Step 5: Verify and Report
118
85
 
119
86
  ```bash
120
- ls -lh <report_name>.pdf
87
+ ls -lh <output_name>.pdf
121
88
  ```
122
89
 
123
90
  Report the file path and size to the user.
124
91
 
125
- ### Phase 5: Translation (Optional)
92
+ ## Translation Variant
93
+
94
+ If the user asks to translate markdown files and then create a PDF:
95
+
96
+ 1. Spawn **parallel subagents** to translate files — batch 2-4 files per agent, all agents in a **single message**
97
+ 2. Each agent reads the source file, translates all text content to the target language, and writes to `<original_name>_<lang>.md`
98
+ 3. Rules for translation agents:
99
+ - Keep all markdown formatting, links, and structure identical
100
+ - Keep source/link titles in their original language; translate surrounding text
101
+ - Translate naturally, not word-for-word; use proper domain terminology
102
+ 4. After all agents complete, run Steps 2-5 above on the translated files
103
+ 5. Output filename gets a `_<lang>` suffix (e.g., `report_hu.pdf`)
126
104
 
127
- If the user requests translation to another language:
105
+ **Batch sizing for translation agents:**
128
106
 
129
- 1. Spawn parallel agents (same batching as Phase 2) to translate each markdown file
130
- 2. Translated files get the same name with a `_<lang>` suffix (e.g., `_hu`, `_de`, `_es`)
131
- 3. Keep all markdown formatting, links, and structure identical — only translate text content
132
- 4. Keep source link titles in their original language; translate surrounding descriptive text
133
- 5. Combine and convert the translated files to PDF using the same Phase 4 process with a `_<lang>` suffix on the final filename
107
+ | Files | Agents | Files per agent |
108
+ |-------|--------|-----------------|
109
+ | 1-4 | 1-2 | 2 each |
110
+ | 5-10 | 3-4 | 2-3 each |
111
+ | 11+ | 5 | 3-4 each |
134
112
 
135
113
  ## Important
136
114
 
137
- - All subagent spawns for a batch MUST be in a **single message** for true parallel execution
138
- - Do NOT run agents sequentially — that defeats the purpose of parallel generation
139
- - Each agent writes its own files directly — the orchestrating agent only combines and converts
140
- - Always verify the final PDF exists and report its size
141
115
  - Use `bunx --bun md-to-pdf` (NOT npx) for PDF conversion
142
- - Individual markdown files are kept alongside the PDF so the user can edit and regenerate
116
+ - This skill only converts it does not research or generate content
117
+ - Individual markdown files are preserved alongside the PDF for future editing
118
+ - If `md-to-pdf` is not installed, `bunx` will auto-install it on first run
119
+ - Always verify the PDF exists before reporting success
@@ -4,7 +4,7 @@ description: Query Fyzz Chat conversations and projects via the REST API. Use wh
4
4
  argument-hint: <conversations|projects> [options]
5
5
  ---
6
6
 
7
- When you need to access the user's Fyzz Chat conversations or projects, use the `fyzz-api` CLI tool. The tool reads the API key from the `FYZZ_API_KEY` environment variable automatically — never attempt to read, print, or reference the API key or the env var directly.
7
+ When you need to access the user's Fyzz Chat conversations or projects, use the `fyzz-api` CLI tool. The tool reads the API key from the `PAL_FYZZ_API_KEY` environment variable automatically — never attempt to read, print, or reference the API key or the env var directly.
8
8
 
9
9
  ## Available commands
10
10
 
@@ -31,8 +31,8 @@ bun ~/.agents/skills/fyzz-chat-api/tools/fyzz-api.ts -- projects
31
31
  If the tool reports a missing API key:
32
32
 
33
33
  1. Ask the user to create one in Fyzz Chat → Settings → API Keys
34
- 2. They should set `FYZZ_API_KEY` in their shell profile or in PAL's `settings.json` env section
35
- 3. Optionally set `FYZZ_BASE_URL` (defaults to `http://localhost:3000`)
34
+ 2. They should set `PAL_FYZZ_API_KEY` in their shell profile or in PAL's `settings.json` env section
35
+ 3. Optionally set `PAL_FYZZ_BASE_URL` (defaults to `http://localhost:3000`)
36
36
 
37
37
  ## Guidelines
38
38
 
@@ -2,7 +2,7 @@
2
2
  /**
3
3
  * Fyzz Chat API — CLI wrapper for programmatic conversation access.
4
4
  *
5
- * Reads the API key from FYZZ_API_KEY env var (never printed to stdout).
5
+ * Reads the API key from PAL_FYZZ_API_KEY env var (never printed to stdout).
6
6
  * Returns JSON responses from the Fyzz Chat REST API.
7
7
  *
8
8
  * Usage:
@@ -14,9 +14,9 @@
14
14
  import { parseArgs } from "node:util";
15
15
 
16
16
  function loadApiKey(): string {
17
- const key = process.env.FYZZ_API_KEY;
17
+ const key = process.env.PAL_FYZZ_API_KEY;
18
18
  if (!key) {
19
- console.error("Error: FYZZ_API_KEY environment variable is not set.");
19
+ console.error("Error: PAL_FYZZ_API_KEY environment variable is not set.");
20
20
  console.error("Set it in your shell profile or PAL settings.json env section.");
21
21
  process.exit(1);
22
22
  }
@@ -25,7 +25,7 @@ function loadApiKey(): string {
25
25
 
26
26
  async function apiFetch(path: string, params?: Record<string, string>): Promise<unknown> {
27
27
  const apiKey = loadApiKey();
28
- const baseUrl = process.env.FYZZ_BASE_URL ?? "http://localhost:3000";
28
+ const baseUrl = process.env.PAL_FYZZ_BASE_URL ?? "http://localhost:3000";
29
29
 
30
30
  const url = new URL(`/api/v1${path}`, baseUrl);
31
31
  if (params) {
@@ -14,16 +14,16 @@ argument-hint: <topic or question>
14
14
 
15
15
  ## Available Researcher Agents
16
16
 
17
- - **claude-researcher** — academic depth, query decomposition, scholarly synthesis
17
+ - **gemini-researcher** — academic depth via Gemini grounding, query decomposition, scholarly synthesis (falls back to WebSearch if no API key)
18
18
  - **multi-perspective-researcher** — breadth, multiple angles, diverse viewpoints
19
- - **investigative-researcher** — verification rigor, triple-checks, source credibility
19
+ - **perplexity-researcher** — investigative rigor via Perplexity grounding, source cross-referencing, credibility assessment (falls back to WebSearch if no API key)
20
20
  - **grok-researcher** — real-time data via Grok/X API, breaking news, social sentiment (falls back to WebSearch with recency focus if no API key)
21
21
 
22
22
  ## Quick Mode
23
23
 
24
24
  Spawn **1 subagent** for a focused answer:
25
25
 
26
- - Spawn `claude-researcher` with the full query and context
26
+ - Spawn `gemini-researcher` with the full query and context
27
27
 
28
28
  Wait for the result, then deliver it directly with light formatting.
29
29
 
@@ -31,12 +31,12 @@ Wait for the result, then deliver it directly with light formatting.
31
31
 
32
32
  Craft **3 different queries** optimized for each researcher's strengths, then spawn all **in parallel (in a single message)**:
33
33
 
34
- - Spawn `claude-researcher` with a query optimized for depth/analysis
34
+ - Spawn `gemini-researcher` with a query optimized for depth/analysis
35
35
  - Spawn `multi-perspective-researcher` with a query optimized for breadth/perspectives
36
36
  - Spawn `grok-researcher` with a query optimized for real-time data, recent developments, current state
37
37
 
38
38
  **Query design:**
39
- - claude-researcher: focus on authoritative sources, technical depth, how/why
39
+ - gemini-researcher: focus on authoritative sources, technical depth, how/why
40
40
  - multi-perspective-researcher: focus on different stakeholder views, trade-offs, alternatives
41
41
  - grok-researcher: focus on latest news, breaking developments, social sentiment, what's happening right now
42
42
 
@@ -44,12 +44,12 @@ Craft **3 different queries** optimized for each researcher's strengths, then sp
44
44
 
45
45
  Craft **8 queries** (2 per researcher type, each from a different angle), then spawn all **in parallel (in a single message)**:
46
46
 
47
- - Spawn `claude-researcher` — angle 1: core technical depth
48
- - Spawn `claude-researcher` — angle 2: historical context / evolution
47
+ - Spawn `gemini-researcher` — angle 1: core technical depth
48
+ - Spawn `gemini-researcher` — angle 2: historical context / evolution
49
49
  - Spawn `multi-perspective-researcher` — angle 3: stakeholder perspectives
50
50
  - Spawn `multi-perspective-researcher` — angle 4: cross-domain connections
51
- - Spawn `investigative-researcher` — angle 5: verify key claims
52
- - Spawn `investigative-researcher` — angle 6: find contradictions / counter-evidence
51
+ - Spawn `perplexity-researcher` — angle 5: verify key claims
52
+ - Spawn `perplexity-researcher` — angle 6: find contradictions / counter-evidence
53
53
  - Spawn `grok-researcher` — angle 7: real-time developments and breaking news
54
54
  - Spawn `grok-researcher` — angle 8: social sentiment, public reaction, trending discourse
55
55