@lincoln504/pi-research 0.1.12 → 1.0.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 +1 -1
- package/README.md +64 -115
- package/dist/cli.mjs +23211 -0
- package/dist/prompts/research-knowledge-relevance-triage.md +35 -0
- package/dist/prompts/research-knowledge-search-extractor.md +41 -0
- package/dist/prompts/research-tool-usage.md +92 -0
- package/dist/prompts/researcher.md +89 -0
- package/dist/prompts/system-coordinator.md +75 -0
- package/dist/prompts/system-lead-evaluator.md +118 -0
- package/dist/thread-worker.mjs +2611 -0
- package/dist/webgpu-probe.mjs +80 -0
- package/docs/AGENT-SKILL.md +102 -0
- package/docs/ARCHITECTURE.md +306 -80
- package/docs/CONFIGURATION.md +249 -0
- package/docs/KNOWLEDGE-STORE.md +213 -0
- package/docs/PI-EXTENSION.md +91 -0
- package/docs/SDK.md +113 -0
- package/docs/THIRD-PARTY-NOTICES.md +64 -0
- package/package.json +102 -36
- package/scripts/build.cjs +140 -0
- package/scripts/cleanup.cjs +149 -0
- package/scripts/prepare.cjs +28 -0
- package/scripts/setup.cjs +134 -0
- package/skills/pi-research/README.md +90 -0
- package/skills/pi-research/SKILL.md +102 -0
- package/skills/pi-research/references/configuration.md +77 -0
- package/skills/pi-research/scripts/run.mjs +237 -0
- package/src/cleanup/research-cleanup.ts +140 -0
- package/src/cli.ts +1044 -0
- package/src/config.ts +1036 -147
- package/src/constants.ts +115 -84
- package/src/core/health-check-service.ts +265 -0
- package/src/core/interfaces/health-check-interfaces.ts +50 -0
- package/src/core/interfaces/knowledge-interfaces.ts +190 -0
- package/src/core/interfaces/observer-interfaces.ts +67 -0
- package/src/core/interfaces/orchestration-interfaces.ts +86 -0
- package/src/core/interfaces/planning-interfaces.ts +100 -0
- package/src/core/interfaces/process-interfaces.ts +37 -0
- package/src/core/interfaces/research-plan-types.ts +52 -0
- package/src/core/interfaces/scheduler-interfaces.ts +91 -0
- package/src/core/interfaces/service-names.ts +39 -0
- package/src/core/interfaces/state-manager-interfaces.ts +29 -0
- package/src/core/interfaces/steering-interfaces.ts +31 -0
- package/src/core/llm/agentic-repair.ts +169 -0
- package/src/core/llm/inject-date.ts +52 -0
- package/src/core/llm/llm-timeout.ts +64 -0
- package/src/core/llm/llm-utils.ts +86 -0
- package/src/core/llm/model-registry-factory.ts +287 -0
- package/src/core/llm/pi-ai-completion.ts +29 -0
- package/src/core/llm/prompts.ts +50 -0
- package/src/core/llm/research-model-resolver.ts +91 -0
- package/src/core/planning-constants.ts +13 -0
- package/src/core/planning-service.ts +649 -0
- package/src/core/planning-utils.ts +299 -0
- package/src/core/scheduler-factory.ts +48 -0
- package/src/core/scheduler-service.ts +123 -0
- package/src/core/service-initialization.ts +194 -0
- package/src/core/service-interfaces.ts +48 -0
- package/src/core/service-registry.ts +659 -0
- package/src/healthcheck/index.ts +271 -265
- package/src/healthcheck/registry.ts +130 -0
- package/src/index.ts +639 -50
- package/src/infrastructure/browser/browser-cleanup.ts +309 -0
- package/src/infrastructure/browser/browser-client.ts +199 -0
- package/src/infrastructure/browser/browser-error-utils.ts +160 -0
- package/src/infrastructure/browser/browser-lifecycle.ts +120 -0
- package/src/infrastructure/browser/browser-server.ts +174 -0
- package/src/infrastructure/browser/browser-task-scheduler.ts +461 -0
- package/src/infrastructure/browser/cleanup-utils.ts +155 -0
- package/src/infrastructure/browser/client-agent.ts +31 -0
- package/src/infrastructure/browser/config.ts +288 -0
- package/src/infrastructure/browser/ensure-browser.ts +205 -0
- package/src/infrastructure/browser/index.ts +37 -0
- package/src/infrastructure/browser/priority-task-queue.ts +226 -0
- package/src/infrastructure/browser/scheduler-factory.ts +354 -0
- package/src/infrastructure/browser/task-execution-service.ts +209 -0
- package/src/infrastructure/browser/thread-worker-browser.ts +282 -0
- package/src/infrastructure/browser/thread-worker-lifecycle.ts +323 -0
- package/src/infrastructure/browser/thread-worker-messaging.ts +662 -0
- package/src/infrastructure/browser/thread-worker-types.ts +25 -0
- package/src/infrastructure/browser/thread-worker.mjs +2611 -0
- package/src/infrastructure/browser/thread-worker.ts +168 -0
- package/src/infrastructure/browser/worker-pool-manager.ts +449 -0
- package/src/infrastructure/embedding/embedding-client.ts +205 -0
- package/src/infrastructure/embedding/embedding-factory.ts +324 -0
- package/src/infrastructure/embedding/embedding-server.ts +535 -0
- package/src/infrastructure/file-lock-service.ts +592 -0
- package/src/infrastructure/gpu-resource-service.ts +191 -0
- package/src/infrastructure/knowledge-store-service.ts +475 -0
- package/src/infrastructure/metrics-service.ts +129 -0
- package/src/infrastructure/process-lifecycle-service.ts +253 -0
- package/src/infrastructure/scheduler-factory-service.ts +58 -0
- package/src/infrastructure/service-initialization.ts +292 -0
- package/src/infrastructure/state/state-backup-manager.ts +290 -0
- package/src/infrastructure/state/state-browser-api.ts +62 -0
- package/src/infrastructure/state/state-browser-manager.ts +70 -0
- package/src/infrastructure/state/state-manager-service.ts +264 -0
- package/src/infrastructure/state/state-manager.ts +547 -0
- package/src/infrastructure/state/state-metrics.ts +92 -0
- package/src/infrastructure/state/state-migration.ts +103 -0
- package/src/infrastructure/state/state-path-configuration.ts +119 -0
- package/src/infrastructure/state/state-session-api.ts +94 -0
- package/src/infrastructure/state/state-session-manager.ts +127 -0
- package/src/infrastructure/state/state-validator.ts +93 -0
- package/src/infrastructure/types/state-types.ts +85 -0
- package/src/knowledge/chunker.ts +157 -0
- package/src/knowledge/embedder-init.ts +413 -0
- package/src/knowledge/embedder-utils.ts +296 -0
- package/src/knowledge/embedder.ts +592 -0
- package/src/knowledge/index.ts +126 -0
- package/src/knowledge/lancedb-loader.ts +35 -0
- package/src/knowledge/migration.ts +17 -0
- package/src/knowledge/model-config.ts +132 -0
- package/src/knowledge/onnx-env.ts +48 -0
- package/src/knowledge/store-operations.ts +291 -0
- package/src/knowledge/store-schema.ts +79 -0
- package/src/knowledge/store.ts +1251 -0
- package/src/knowledge/transformers-loader.ts +31 -0
- package/src/knowledge/webgpu-probe.mjs +80 -0
- package/src/knowledge/webgpu-viability.ts +255 -0
- package/src/knowledge/writer-queue.ts +252 -0
- package/src/logger.ts +316 -122
- package/src/observers/research-observer-impl.ts +459 -0
- package/src/orchestration/deep-research-orchestrator.ts +524 -773
- package/src/orchestration/deep-research-types.ts +47 -35
- package/src/orchestration/headless-observer.ts +114 -0
- package/src/orchestration/orchestration-types.ts +33 -0
- package/src/orchestration/quick-research-orchestrator.ts +463 -0
- package/src/orchestration/research-orchestration-service.ts +549 -0
- package/src/orchestration/research-session-service.ts +178 -0
- package/src/orchestration/research-synthesis-service.ts +348 -0
- package/src/orchestration/researcher-executor.ts +394 -0
- package/src/orchestration/researcher.ts +115 -42
- package/src/orchestration/service-initialization.ts +109 -0
- package/src/orchestration/session-context.ts +7 -3
- package/src/orchestration/session-state.ts +672 -0
- package/src/prompts/research-knowledge-relevance-triage.md +35 -0
- package/src/prompts/research-knowledge-search-extractor.md +41 -0
- package/src/prompts/research-tool-usage.md +63 -16
- package/src/prompts/researcher.md +59 -136
- package/src/prompts/system-coordinator.md +64 -13
- package/src/prompts/system-lead-evaluator.md +82 -189
- package/src/research-config.ts +872 -0
- package/src/sdk.ts +847 -0
- package/src/security/cisa-kev.ts +72 -9
- package/src/security/cvss.ts +92 -0
- package/src/security/ecosystem.ts +45 -0
- package/src/security/github-advisories.ts +168 -428
- package/src/security/github-advisory-types.ts +282 -0
- package/src/security/index.ts +63 -177
- package/src/security/nvd-client.ts +550 -0
- package/src/security/nvd-types.ts +179 -0
- package/src/security/osv-client.ts +246 -0
- package/src/security/osv-types.ts +285 -0
- package/src/security/types.ts +67 -53
- package/src/skill-install/skill-installer.ts +519 -0
- package/src/stackexchange/index.ts +81 -27
- package/src/stackexchange/output/compact.ts +7 -6
- package/src/stackexchange/output/table.ts +11 -7
- package/src/stackexchange/queries.ts +0 -10
- package/src/stackexchange/rest-client.ts +141 -66
- package/src/stackexchange/types.ts +0 -17
- package/src/tool.ts +15 -423
- package/src/tools/grep.ts +32 -310
- package/src/tools/health-tool-definition.ts +101 -0
- package/src/tools/index.ts +38 -9
- package/src/tools/research-knowledge-search.ts +974 -0
- package/src/tools/research-knowledge-types.ts +77 -0
- package/src/tools/research-tool-definition.ts +494 -0
- package/src/tools/scrape.ts +286 -388
- package/src/tools/search.ts +98 -153
- package/src/tools/security.ts +107 -80
- package/src/tools/stackexchange.ts +58 -35
- package/src/tools/youtube-transcript.ts +163 -0
- package/src/tui/knowledge-search-panel.ts +86 -0
- package/src/tui/pulse.ts +86 -0
- package/src/tui/research-health.ts +124 -0
- package/src/tui/research-panel-color-utils.ts +340 -0
- package/src/tui/research-panel-format.ts +54 -0
- package/src/tui/research-panel-state.ts +404 -0
- package/src/tui/research-panel-wave.ts +280 -0
- package/src/tui/research-panel.ts +339 -435
- package/src/tui/research-tui-manager.ts +233 -0
- package/src/tui/tui-controller.ts +137 -0
- package/src/types/extension-context.ts +18 -49
- package/src/types/index.ts +61 -0
- package/src/types/llm.ts +68 -29
- package/src/types/research-panel-types.ts +61 -0
- package/src/utils/circuit-breaker.ts +146 -0
- package/src/utils/citation-utils.ts +97 -0
- package/src/utils/disk-space-checker.ts +55 -0
- package/src/utils/error-tracker.ts +265 -0
- package/src/utils/host-config.ts +45 -0
- package/src/utils/input-validation.ts +8 -10
- package/src/utils/json-utils.ts +150 -16
- package/src/utils/llm-usage.ts +54 -0
- package/src/utils/log-rotation.ts +125 -0
- package/src/utils/log-utils.ts +159 -0
- package/src/utils/make-resource-loader.ts +3 -1
- package/src/utils/metrics-summary.ts +459 -0
- package/src/utils/metrics.ts +302 -0
- package/src/utils/research-export.ts +28 -12
- package/src/utils/safe-unref.ts +31 -0
- package/src/utils/shared-links.ts +195 -90
- package/src/utils/shutdown-manager.ts +65 -0
- package/src/utils/stdio-capture.ts +407 -0
- package/src/utils/text-utils.ts +264 -7
- package/src/utils/tool-usage-tracker.ts +83 -16
- package/src/utils/url-utils.ts +255 -0
- package/src/utils/user-agent.ts +28 -0
- package/src/web-research/browser-search.ts +179 -0
- package/src/web-research/retry-utils.ts +173 -77
- package/src/web-research/scraper-types.ts +72 -0
- package/src/web-research/scraper-utils.ts +434 -0
- package/src/web-research/search.ts +78 -218
- package/src/web-research/types.ts +9 -24
- package/src/web-research/utils.ts +2 -143
- package/src/web-research/web-scraper.ts +477 -0
- package/src/youtube/index.ts +154 -0
- package/src/youtube/potoken.ts +259 -0
- package/src/youtube/transcript-client.ts +390 -0
- package/src/youtube/video-id.ts +118 -0
- package/config/searxng/default-settings.yml +0 -189
- package/config/searxng/limiter.toml +0 -34
- package/config/tooling/eslint.config.js +0 -73
- package/config/tooling/vitest.config.integration.ts +0 -17
- package/config/tooling/vitest.config.ts +0 -40
- package/config/tooling/vitest.config.unit.ts +0 -12
- package/docs/assets/README-banner.jpg +0 -0
- package/scripts/setup.js +0 -174
- package/src/infrastructure/searxng-lifecycle.ts +0 -577
- package/src/infrastructure/searxng-manager.ts +0 -1183
- package/src/infrastructure/state-manager.ts +0 -918
- package/src/orchestration/deep-research-reducer.ts +0 -129
- package/src/orchestration/id-utils.ts +0 -63
- package/src/security/nvd.ts +0 -532
- package/src/security/osv.ts +0 -487
- package/src/stackexchange/cache.ts +0 -111
- package/src/stackexchange/output/index.ts +0 -7
- package/src/stackexchange/output/json.ts +0 -21
- package/src/tui/searxng-status.ts +0 -80
- package/src/utils/inject-date.ts +0 -29
- package/src/utils/research-error.ts +0 -205
- package/src/utils/searxng-config.ts +0 -94
- package/src/utils/session-state.ts +0 -295
- package/src/web-research/dependencies.ts +0 -20
- package/src/web-research/scrapers.ts +0 -935
- package/tsconfig.json +0 -40
|
@@ -3,223 +3,116 @@
|
|
|
3
3
|
You orchestrate the next phase of research.
|
|
4
4
|
|
|
5
5
|
## Your Context
|
|
6
|
+
- **ROOT QUERY**: {{root_query}}
|
|
7
|
+
- **Current round**: {{round_number}} / {{max_rounds}}
|
|
8
|
+
- **Complexity Level**: {{complexity_label}}
|
|
9
|
+
{{initial_agenda_section}}
|
|
10
|
+
{{previous_queries_section}}
|
|
11
|
+
{{additional_considerations}}
|
|
6
12
|
|
|
7
|
-
|
|
8
|
-
- **
|
|
9
|
-
- **
|
|
10
|
-
- **Target rounds**: {MAX_ROUNDS}
|
|
13
|
+
## CRITICAL: Steering Compliance Checkpoint
|
|
14
|
+
- **STRICT STEERING**: If there is an "ADDITIONAL USER GUIDANCE" section above, you MUST treat every point in it as a **mandatory rule and instruction** for your decisions, next round goals, and queries. Do not ignore them. They are directional requirements.
|
|
15
|
+
- **STEERING SATISFACTION**: Before deciding to SYNTHESIZE, you MUST explicitly verify that ALL user steering requirements have been satisfied by the existing findings. If ANY steering requirement remains unaddressed or only superficially covered, you MUST DELEGATE — do NOT synthesize. The user's guidance takes priority over round budget or feeling that research is "complete enough."
|
|
11
16
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
### Transition from Researcher to Lead Evaluator
|
|
15
|
-
|
|
16
|
-
You were the final researcher to finish. **Your research task is CLOSED.** Your findings are recorded. Your responsibility is to evaluate ALL findings and determine the next step.
|
|
17
|
+
{{disabled_tools_section}}
|
|
17
18
|
|
|
18
19
|
---
|
|
19
20
|
|
|
20
|
-
## Decision
|
|
21
|
-
|
|
22
|
-
### Step 0: Check for Researcher Errors
|
|
23
|
-
|
|
24
|
-
**Check if any researchers encountered errors:**
|
|
25
|
-
|
|
26
|
-
- Review all researcher reports for those starting with `ERROR:`
|
|
27
|
-
- Identify specific error messages and which researchers failed
|
|
28
|
-
- Determine if this represents a systemic issue (e.g., search service down, network problems)
|
|
29
|
-
|
|
30
|
-
**If ALL researchers failed with errors:**
|
|
21
|
+
## Complexity-Aware Decision Thresholds
|
|
31
22
|
|
|
32
|
-
|
|
23
|
+
{{complexity_guidance}}
|
|
33
24
|
|
|
34
|
-
|
|
25
|
+
{{round_phase_guidance}}
|
|
35
26
|
|
|
36
|
-
|
|
37
|
-
# Research Failed: Critical Errors
|
|
27
|
+
---
|
|
38
28
|
|
|
39
|
-
##
|
|
40
|
-
Research cannot proceed. All researchers encountered errors.
|
|
29
|
+
## Decision Framework
|
|
41
30
|
|
|
42
|
-
|
|
31
|
+
**SYNTHESIZE if:** Research meets the complexity-specific synthesis criteria above.
|
|
32
|
+
**DELEGATE if:** Research meets the complexity-specific delegation criteria above.
|
|
33
|
+
**Note on Guidance**: If the user provides additional guidance mid-research (via Alt+Enter or direct follow-up), those messages will be provided to you. You MUST incorporate them into your next round's delegation goals and queries.
|
|
43
34
|
|
|
44
|
-
|
|
45
|
-
|
|
35
|
+
**STAY IN SCOPE (every delegation):**
|
|
36
|
+
- Going deeper on in-scope material is always welcome. Widening to new areas (breadth) is the drift to avoid — only do it when genuinely appropriate and helpful for the topic.
|
|
37
|
+
- A gap is missing depth on what was asked — not a broader topic next to it. Don't add anything the query didn't ask for, even if it came up in earlier findings.
|
|
38
|
+
- Match the query's scope-bounding constraints exactly — don't broaden them, don't narrow them.
|
|
46
39
|
|
|
47
|
-
|
|
48
|
-
|
|
40
|
+
**COMMON MISTAKES TO AVOID:**
|
|
41
|
+
- Do NOT synthesize early just because you've done "enough" rounds. Synthesis should only occur when you have comprehensive, high-quality findings across all major topics.
|
|
42
|
+
- Do NOT synthesize with gaps remaining, hoping they can be "filled in later". Complete the research first.
|
|
43
|
+
- Do NOT invent a gap outside the query's scope just to keep going or fill the budget. Finish what was asked; don't add what wasn't.
|
|
49
44
|
|
|
50
|
-
|
|
45
|
+
Use unique, targeted queries for any new researchers.
|
|
51
46
|
|
|
52
|
-
|
|
53
|
-
[Analyze if errors indicate a pattern: search service unavailable, network timeout, all engines blocked, etc.]
|
|
47
|
+
**Decision**: Return valid JSON in a code block:
|
|
54
48
|
|
|
55
|
-
|
|
56
|
-
|
|
49
|
+
**If synthesizing**:
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"action": "synthesize",
|
|
53
|
+
"content": "<Plain prose report with [N] citations, organized by topic. No markdown headings, bullets, or bold text. Followed by the mandatory CITED LINKS section.>"
|
|
54
|
+
}
|
|
57
55
|
```
|
|
58
56
|
|
|
59
|
-
**If
|
|
57
|
+
**If delegating**:
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"action": "delegate",
|
|
61
|
+
"researchers": [
|
|
62
|
+
{
|
|
63
|
+
"id": "{{round_number}}.1",
|
|
64
|
+
"name": "<Researcher Specialty>",
|
|
65
|
+
"goal": "<Focused gap or new angle to investigate>",
|
|
66
|
+
"queries": ["<query_1>", "<query_2>", "<query_3>", "..."]
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
"allQueries": ["<flat_list_of_all_queries_from_all_new_researchers>"]
|
|
70
|
+
}
|
|
71
|
+
```
|
|
60
72
|
|
|
61
|
-
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
73
|
+
**DELEGATION REQUIREMENTS**:
|
|
74
|
+
- **CRITICAL — Queries are mandatory**: Every researcher MUST have at least one query. Never plan a researcher without queries. Researchers receive ONLY the search results you delegate to them.
|
|
75
|
+
- **Maximize queries**: For EACH researcher, generate the maximum number of targeted, specific queries within the budget. Do not plan fewer than needed — fill the budget. Queries should target primary sources and authoritative evidence.
|
|
76
|
+
- **YouTube discovery**: For roughly one in {{youtube_query_every_n}} queries, append the word `youtube` to the query text (e.g. `"<topic> analysis youtube"`). DuckDuckGo rarely surfaces YouTube on its own, and YouTube links let researchers read video transcripts. Skip only when the gap is clearly unsuited to video.
|
|
77
|
+
- **Temporal anchoring**: Anchor every new time-sensitive query to the current month and year shown at the top of this prompt. Use that exact year (and month where relevant); never default to an older year such as 2024 or 2025 unless the user explicitly asks about the past.
|
|
78
|
+
- **Flexible coverage**: Use up to {{max_team_size}} researchers to cover distinct angles in parallel. Scale based on research gaps — a single well-targeted researcher is often sufficient for focused gaps.
|
|
79
|
+
- **Source diversity**: Encourage researchers to find multiple authoritative sources per topic area to enable comprehensive citations in the final synthesis.
|
|
65
80
|
|
|
66
81
|
---
|
|
67
82
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
Evaluate cumulative findings against ROOT QUERY and ORIGINAL AGENDA.
|
|
83
|
+
## Quality Standards for Delegation
|
|
71
84
|
|
|
72
|
-
|
|
73
|
-
-
|
|
74
|
-
-
|
|
75
|
-
-
|
|
76
|
-
-
|
|
77
|
-
|
|
78
|
-
**SYNTHESIZE NOW if:**
|
|
79
|
-
- Every agenda item substantively addressed with depth
|
|
80
|
-
- Root query answerable with high confidence
|
|
81
|
-
- Findings corroborated by multiple sources
|
|
82
|
-
- Remaining gaps trivial, academic, or beyond reasonable scope
|
|
83
|
-
- Information high-quality, specific, actionable
|
|
84
|
-
|
|
85
|
-
**DELEGATE FURTHER RESEARCH if:**
|
|
86
|
-
- One or more agenda items missing or barely explored
|
|
87
|
-
- Critical aspects of root query unaddressed
|
|
88
|
-
- Findings superficial, generic, lack specificity
|
|
89
|
-
- Claims lack adequate evidence or corroboration
|
|
90
|
-
- High-value scrape candidates would fill gaps
|
|
91
|
-
- Contradictions exist requiring targeted resolution
|
|
92
|
-
|
|
93
|
-
### Step 2: Consider Depth Budget
|
|
94
|
-
|
|
95
|
-
**If current round < Target rounds**: You have capacity. Prioritize fulfilling all agenda items before synthesizing.
|
|
96
|
-
|
|
97
|
-
**If current round == Target rounds**: At intended depth. Synthesize if the agenda is substantially covered. Only delegate if CRITICAL GAPS remain unexplored — limit to 1-2 high-impact queries.
|
|
98
|
-
|
|
99
|
-
**If current round > Target rounds**: Extended territory (bonus rounds). Synthesize NOW unless a catastrophic coverage failure occurred. Do NOT delegate for minor gaps.
|
|
100
|
-
|
|
101
|
-
### Step 3: Make Strategic Decision
|
|
102
|
-
|
|
103
|
-
**If synthesizing**: Provide comprehensive synthesis. Be exhaustive. Integrate findings from all researchers. Resolve conflicts where possible. Acknowledge limitations.
|
|
104
|
-
|
|
105
|
-
**If delegating**: Formulate targeted queries for remaining gaps. Focus on unaddressed agenda items. Limit to 1-2 high-impact queries.
|
|
85
|
+
When delegating, ensure:
|
|
86
|
+
- **Query Specificity**: Each new query targets distinct, unexplored territory
|
|
87
|
+
- **No Redundancy**: Do not repeat queries from previous rounds
|
|
88
|
+
- **Specialized Focus**: Each new researcher has a clear, distinct angle
|
|
89
|
+
- **Gap-Driven**: Only delegate when gaps cannot be resolved from existing findings
|
|
90
|
+
- **Progressive Depth**: New queries go deeper, or to a new angle still inside the query's scope — never outside it, and never repeating surface-level coverage
|
|
106
91
|
|
|
107
92
|
---
|
|
108
93
|
|
|
109
|
-
##
|
|
110
|
-
|
|
111
|
-
Each researcher followed a context-aware up-to-4-call scrape protocol:
|
|
112
|
-
1. **Handshake**: Check for already-scraped links (no network)
|
|
113
|
-
2. **Batch 1**: Up to 3 URLs — primary broad scraping
|
|
114
|
-
3. **Batch 2**: Up to 2 URLs — targeted follow-up (auto-deduplicated)
|
|
115
|
-
4. **Batch 3**: Up to 3 URLs — deep-dive
|
|
94
|
+
## Synthesis Protocol (action = synthesize)
|
|
116
95
|
|
|
117
|
-
|
|
96
|
+
1. **Organization**: Organize the report logically **BY TOPIC**. Do NOT structure it by researcher or round.
|
|
97
|
+
2. **Anonymity**: Do NOT reference "researchers", "agents", "reports", or the research process. Present the findings as a direct, unified knowledge base.
|
|
98
|
+
3. **Master Links List**: A **Global Source List** has been provided to you. Use these sequential numbers [1], [2], [3], etc., for all inline citations. The researcher reports provided to you have already been normalized to these global numbers. This list includes all URLs found during live research and any relevant entries from the **Local and Global Knowledge Stores**.
|
|
99
|
+
4. **Exhaustive Synthesis**: Use ALL findings from ALL reports. Include every fact, date, name, and statistic verbatim. Longer is better.
|
|
100
|
+
5. **Strict Grounding**: Every sentence must come from a report. Use [N] inline citations. No prior knowledge.
|
|
101
|
+
6. **CRITICAL — Links at Bottom Only**:
|
|
102
|
+
- Write all topic sections first with inline citations [1], [2], etc., using the numbers from the **Global Source List**.
|
|
103
|
+
- Place exactly ONE `CITED LINKS` section at the VERY END of the entire synthesis.
|
|
104
|
+
- This section must contain the complete master list of all unique URLs exactly as provided in the **Global Source List**.
|
|
105
|
+
- Do NOT include any links within topic sections or subsections.
|
|
106
|
+
- Format: `[1] https://url.com [Source: ...] — brief description` on each line.
|
|
118
107
|
|
|
119
|
-
**
|
|
120
|
-
- **Corroborating**: Multiple researchers found similar information — strong confidence
|
|
121
|
-
- **Complementary**: Different researchers covered different aspects — integrate both
|
|
122
|
-
- **Conflicting**: Sources disagree — identify conflict, explain evidence, suggest resolution or acknowledge uncertainty
|
|
108
|
+
> **MANDATORY TERMINATION RULE**: Your synthesis is not complete until it ends with `CITED LINKS`. Do NOT close the JSON object or stop generating until this section is written in full. A synthesis without `CITED LINKS` is a failed output.
|
|
123
109
|
|
|
124
110
|
---
|
|
125
111
|
|
|
126
|
-
##
|
|
127
|
-
|
|
128
|
-
Provide **full breadth, depth, nuance** of information from all sources. This is the final result — be thorough.
|
|
129
|
-
|
|
130
|
-
```markdown
|
|
131
|
-
# Research Synthesis: [Comprehensive Topic Title]
|
|
132
|
-
|
|
133
|
-
## Executive Summary
|
|
134
|
-
[High-level analytical overview. Identify most critical insights, patterns, conclusions. Comprehensive summary that stands alone.]
|
|
135
|
-
|
|
136
|
-
## Detailed Key Findings
|
|
137
|
-
|
|
138
|
-
### [Major Theme/Category 1]
|
|
139
|
-
- **In-Depth Analysis**: [Exhaustive explanation. Incorporate multiple sources and perspectives. Cite researchers where relevant. Provide context.]
|
|
140
|
-
- **Sub-Finding 1**: [Specific detail with citations]
|
|
141
|
-
- **Sub-Finding 2**: [Specific detail with citations]
|
|
142
|
-
- **Context & Implications**: [What do findings mean? Why significant? How relate to broader topic?]
|
|
143
|
-
|
|
144
|
-
### [Major Theme/Category 2]
|
|
145
|
-
- **In-Depth Analysis**: [Continue for all major themes...]
|
|
146
|
-
|
|
147
|
-
## Critical Nuance and Conflicting Perspectives
|
|
148
|
-
|
|
149
|
-
[Identify areas where:
|
|
150
|
-
- Sources provided different or contradictory information
|
|
151
|
-
- Topic inherently complex or ambiguous
|
|
152
|
-
- Findings require interpretation or multiple perspectives
|
|
153
|
-
- Uncertainty or lack of consensus
|
|
154
|
-
|
|
155
|
-
For each: describe conflicting information, explain evidence, provide synthesis or acknowledge ambiguity, suggest resolution or additional research needs]
|
|
156
|
-
|
|
157
|
-
## Coverage & Agenda Assessment
|
|
158
|
-
|
|
159
|
-
[Address specifically:
|
|
160
|
-
- Which initial agenda items fully resolved
|
|
161
|
-
- Which items partially explored or unaddressed
|
|
162
|
-
- Why certain areas incomplete (sources unavailable, complexity, etc.)
|
|
163
|
-
- Overall comprehensiveness relative to original query]
|
|
164
|
-
|
|
165
|
-
## Final Conclusions & Strategic Recommendations
|
|
166
|
-
|
|
167
|
-
[Synthesize key takeaways:
|
|
168
|
-
- Most important conclusions
|
|
169
|
-
- Practical implications
|
|
170
|
-
- Actions/decisions informed by findings
|
|
171
|
-
- Research limitations
|
|
172
|
-
- Most valuable additional information if further research conducted]
|
|
173
|
-
|
|
174
|
-
## CITED LINKS
|
|
175
|
-
|
|
176
|
-
[List every URL cited in synthesis, deduplicated. For each:]
|
|
177
|
-
* [URL] — Brief description of contribution and significance
|
|
178
|
-
|
|
179
|
-
## Research Limitations
|
|
180
|
-
|
|
181
|
-
[Only include if there are material gaps that significantly constrain the findings — omit if coverage is adequate. Do NOT list scrape candidates as raw URLs. Instead describe what remains unknown and why it matters:]
|
|
182
|
-
- [Topic/area] — What is unknown and its relevance to the root query
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
---
|
|
186
|
-
|
|
187
|
-
## Delegation Output Format
|
|
188
|
-
|
|
189
|
-
Provide a JSON object with `action` and `queries` fields:
|
|
190
|
-
|
|
191
|
-
```json
|
|
192
|
-
{"action": "delegate", "queries": ["Targeted research question addressing critical gap", "Another specific research direction for remaining gaps"]}
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
**CRITICAL REQUIREMENTS FOR DELEGATION**:
|
|
196
|
-
- `action` must be exactly the string `"delegate"` (not `delegate` without quotes)
|
|
197
|
-
- `queries` must be an array of strings (not objects, not numbers)
|
|
198
|
-
- Each query string must be non-empty after trimming
|
|
199
|
-
- Do not include nested objects like `{"query": "text"}` — use plain strings only
|
|
200
|
-
|
|
201
|
-
**Delegation Guidance**:
|
|
202
|
-
- Each query addresses specific, high-impact gap
|
|
203
|
-
- Queries distinct and complementary, not overlapping
|
|
204
|
-
- **For unfulfilled agenda items: copy the exact query string from the "Unfulfilled Agenda Items" list** — do not rephrase. This ensures the system can track coverage.
|
|
205
|
-
- For new gaps not in the original agenda, formulate targeted queries
|
|
206
|
-
- Consider what information would most transform understanding
|
|
207
|
-
- Avoid duplicating already-researched topics
|
|
208
|
-
- Ensure queries specific enough to yield actionable results
|
|
209
|
-
|
|
210
|
-
---
|
|
112
|
+
## Output Requirements
|
|
211
113
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
- **
|
|
215
|
-
- **
|
|
216
|
-
- **
|
|
217
|
-
- JSON object `{"action": "delegate", "queries": [...]}` → Delegating additional research
|
|
218
|
-
- Any other output (markdown, prose) → Treated as final synthesis
|
|
219
|
-
- **IMPORTANT**: The JSON must be valid, properly formatted, with string values in the `queries` array
|
|
220
|
-
- **NO DECISION MEMOS**: Never output text explaining decision (e.g., "# Decision: NO"). Provide ONLY synthesis, error report, or JSON array.
|
|
221
|
-
- **BE EXHAUSTIVE IN SYNTHESIS**: Provide full depth and breadth. Do not truncate excessively.
|
|
222
|
-
- **NO SCRAPE CANDIDATE LISTS**: Do not enumerate URLs from researcher SCRAPE CANDIDATES sections — these are internal scaffolding. Mention material gaps in prose under Research Limitations only if they affect the findings.
|
|
223
|
-
- **BE TARGETED IN DELEGATION**: Provide specific, high-impact queries addressing genuine gaps.
|
|
224
|
-
- **USE PLAIN STRINGS IN QUERIES**: Do not use objects like `{"query": "text"}` in the queries array — use plain strings only.
|
|
225
|
-
- **SUBMIT AND STOP**: After providing decision, stop. System handles next steps.
|
|
114
|
+
- **Researcher IDs**: Use Round.Index format (e.g. **{{round_number}}.1**, **{{round_number}}.2**).
|
|
115
|
+
- **Query Budget**: Use the complexity-specific budget ({{query_budget}} per researcher). Fill each researcher's query budget completely.
|
|
116
|
+
- **Team Size**: Scale researcher count to match the gaps. Use up to {{max_team_size}} researchers when delegating, but a single well-targeted researcher is often sufficient for focused gaps. Don't pad the team when fewer researchers will cover the remaining gaps efficiently.
|
|
117
|
+
- **Synthesis Quality**: Logical topic-based structure in plain prose, maximal detail, NO mention of researchers, NO markdown headings or bullets.
|
|
118
|
+
- **Format**: ONLY return valid JSON in a code block.
|