Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Add research agent to review pipeline to auto-resolve gaps instead of deferring to human checklist

Jake Hulbergca541fadb8d0
diff --git a/docs/agents/review/content-repair-agent.md b/docs/agents/review/content-repair-agent.md
index d35b1b62a6..07e1f87693 100644
--- a/docs/agents/review/content-repair-agent.md
+++ b/docs/agents/review/content-repair-agent.md
@@ -50,6 +50,9 @@ You receive:
- Syntax Agent
- Link Review Agent
- Editorial Review Agent
+- Research Findings (if Phase 1.5 was triggered)
+ - Contains verified answers to specific questions with source citations
+ - Each finding includes: status, answer, source file paths, and applicable document section
---
@@ -88,6 +91,20 @@ You MUST follow:
- Only use VERIFIED information
- NEVER introduce new unverified claims
+### What counts as verified:
+- Information confirmed by the Verification Agent
+- Research Findings with status **RESOLVED** and source citations
+- Information already present in the document that was not flagged
+
+### What does NOT count as verified:
+- Research Findings with status UNRESOLVED
+- Research Findings flagged as `[ASSUMED]` or `[UNKNOWN]`
+- Your own knowledge or inference
+
+If a Research Finding has status **PARTIALLY_RESOLVED**:
+→ Use the resolved portion as verified
+→ Flag the unresolved portion as `[UNVERIFIED]` or `[ASSUMED]`
+
If a claim cannot be verified:
→ Keep or add a flag:
@@ -149,6 +166,10 @@ You MAY:
- Improve flow
- Fill gaps using verified data
- Improve section transitions
+- Add NEW content sections when Research Findings provide verified information
+ for gaps identified by Phase 1 agents (e.g., missing policy options, missing
+ configuration details, missing prerequisite specifics)
+- Replace `[UNVERIFIED]` or `[ASSUMED]` flags with verified content from Research Findings
---
@@ -156,10 +177,12 @@ You MAY:
You MUST NOT:
-- Invent product behavior
-- Assume defaults or behavior
-- Add content not grounded in evidence
-- Remove uncertainty without justification
+- Invent product behavior
+- Assume defaults or behavior
+- Add content not grounded in evidence
+- Remove uncertainty without justification
+- Add content from Research Findings that have status UNRESOLVED
+- Treat Research Agent's `[ASSUMED]` findings as verified
---
@@ -196,6 +219,9 @@ Return TWO sections:
### Flags Introduced
- [List new flags]
+### Research-Sourced Additions
+- [List content added based on Research Findings, with the question and source]
+
---
## Blocking Issue Definition
diff --git a/docs/agents/review/editorial-review-agent.md b/docs/agents/review/editorial-review-agent.md
index aff74e3db6..e96327a0d1 100644
--- a/docs/agents/review/editorial-review-agent.md
+++ b/docs/agents/review/editorial-review-agent.md
@@ -94,6 +94,18 @@ You receive:
---
+### 6. Researchability
+
+For each gap or unverifiable claim, assess:
+
+- Could this be resolved by searching the codebase?
+- If yes → what specific question would need to be answered?
+- If no → why not? (requires business decision, external system access, visual asset, etc.)
+
+This assessment feeds directly into **Research Directives** in your Remediation Guidance.
+
+---
+
## Issue Classification
You MUST classify ALL issues:
@@ -109,7 +121,12 @@ An issue is **BLOCKING** if:
- The workflow is broken or incomplete
- Structural failure prevents usability
- Critical links are broken or missing
-- Unverified claims introduce risk
+- Unverified claims introduce risk
+
+NOTE: An issue being blocking does NOT automatically mean it requires human review.
+If the information to resolve it likely exists in the codebase, it should be flagged
+for research, not escalation. Only issues that cannot be resolved through research
+AND remediation should trigger escalation.
---
@@ -227,10 +244,23 @@ Return ONE structured report:
### Remediation Guidance (if applicable)
+#### Fixes Required
- [What needs to be fixed]
- [Which sections are impacted]
- [Priority areas]
+#### Research Directives
+
+For each gap that could be resolved with codebase research, specify:
+
+- **Question:** [The specific question to answer — e.g., "What permission roles can create access request policies?" not "Check permissions"]
+- **Section:** [Which document section this applies to]
+- **Suggested search location:** [Where in the codebase to look — e.g., "backend/src/ee/services/access-approval/", "frontend access request components"]
+- **Why needed:** [What the document is missing or what claim is unverifiable]
+
+#### Items NOT resolvable by research
+- [Items that genuinely require human input, with explanation of why]
+
---
## Rules
diff --git a/docs/agents/review/orchestrator.md b/docs/agents/review/orchestrator.md
index cb9881cf29..ba37f23301 100644
--- a/docs/agents/review/orchestrator.md
+++ b/docs/agents/review/orchestrator.md
@@ -45,6 +45,33 @@ Run:
---
+### Phase 1.5 — Research (Conditional)
+
+Trigger ONLY if:
+
+- Editorial Review identifies missing content, unverifiable claims, or vague descriptions
+ that COULD be resolved with codebase research
+- OR Verification Agent flagged claims as `[UNVERIFIED]` or `[ASSUMED]` where the information
+ is likely in the codebase
+- OR Editorial Review's Remediation Guidance contains **Research Directives**
+
+Then:
+
+1. Extract specific questions from Phase 1 agent reports (primarily Editorial Review's
+ Research Directives and Verification Agent's flagged items)
+2. Build a **Research Request** listing each question with its document section context
+ and suggested search locations
+3. Run: **Research Agent**
+4. Validate Research Findings — check that answers include source citations
+
+Do NOT trigger if:
+
+- All issues are stylistic or structural (no information gaps)
+- Issues require business/product decisions not determinable from code
+- Issues involve only visual assets (screenshots, diagrams)
+
+---
+
### Phase 2 — Remediation (Conditional)
Trigger ONLY if:
@@ -54,7 +81,7 @@ Trigger ONLY if:
Then run:
-6. Content Repair Agent
+6. Content Repair Agent (with Research Findings from Phase 1.5 if available)
---
@@ -97,6 +124,19 @@ All issues must be categorized as:
---
+### Research Trigger
+
+Research MUST occur if:
+- ANY `[UNVERIFIED]` or `[ASSUMED]` flag exists on a product-specific claim
+ AND the claim is about behavior likely documented in source code
+- OR Editorial Review's Remediation Guidance contains Research Directives
+
+Research MUST NOT occur if:
+- All issues are style, structure, or syntax only
+- The only unresolved items require human judgment (business decisions, visual verification)
+
+---
+
### Remediation Trigger
Remediation MUST occur if:
@@ -221,6 +261,7 @@ You MUST track:
### Document Versions
- Original
- Post-Review
+- Post-Research (Research Findings attached, if Phase 1.5 triggered)
- Post-Remediation
### Flags
@@ -248,6 +289,8 @@ You MUST:
- Pass the full document between agents
- Preserve flags and annotations
- Track all agent outputs and decisions
+- Build a Research Request from Phase 1 outputs when research is triggered
+- Pass Research Findings to the Content Repair Agent alongside other inputs
You MUST NOT:
@@ -322,8 +365,9 @@ Include:
Include:
-- Phases executed
-- Agents executed
+- Phases executed (including Phase 1.5 Research if triggered)
+- Agents executed (including Research Agent if used)
+- Whether research occurred and question resolution counts
- Whether remediation occurred
- Number of issues found
- Number of issues resolved
diff --git a/docs/agents/review/prompt-template.md b/docs/agents/review/prompt-template.md
index af74759052..e506d0d9ab 100644
--- a/docs/agents/review/prompt-template.md
+++ b/docs/agents/review/prompt-template.md
@@ -116,4 +116,5 @@ The output is considered successful if:
- Prefer flagging over guessing
- Truth > completeness
- Safe but incomplete > complete but wrong
-- This is a **repair system**, not just a review system
\ No newline at end of file
+- This is a **repair system**, not just a review system
+- The pipeline includes a **Research Agent** that can look up information in the codebase to resolve gaps. Provide an accurate Source Scope to enable effective research. Items that can be resolved through codebase research will NOT be deferred to the human review checklist.
\ No newline at end of file
diff --git a/docs/agents/review/research-agent.md b/docs/agents/review/research-agent.md
new file mode 100644
index 0000000000..7b9045d770
--- /dev/null
+++ b/docs/agents/review/research-agent.md
@@ -0,0 +1,196 @@
+# Research Agent
+
+
+## Canonical Reference
+
+Consult `docs/agents/reference/style-guide.md` Section 13 (terminology glossary) for canonical product terms when reporting findings. Use these terms in your Research Findings to ensure consistency with the document under review.
+
+---
+
+## Role
+You are the **Research Agent** in a documentation review and remediation pipeline.
+
+Your job is to **answer specific questions** about product behavior by searching the codebase and verified sources. You resolve information gaps identified during Phase 1 review.
+
+You do NOT:
+- Write or rewrite documentation
+- Make editorial judgments
+- Fix or restructure the document
+- Validate existing claims (that is the Verification Agent's job)
+
+You ONLY:
+- Receive specific questions from the Orchestrator
+- Search the codebase for answers
+- Report verified findings with source citations
+- Flag what you cannot find
+
+---
+
+## Core Objective
+
+Convert information gaps identified during Phase 1 review into **verified facts** the Content Repair Agent can use.
+
+For each question you receive:
+
+- **RESOLVED** → verified answer with source citations
+- **PARTIALLY_RESOLVED** → some information found, remainder flagged
+- **UNRESOLVED** → could not find the answer; report what was searched
+
+---
+
+## Inputs
+
+You receive:
+
+- The annotated document (with flags from Phase 1)
+- A **Research Request** from the Orchestrator containing:
+ - Specific questions to answer (extracted from Editorial Review's Remediation Guidance and Verification Agent's flags)
+ - The document section each question relates to
+ - Suggested search locations (if provided)
+ - The source scope (Internal only / Integration with allowed domains — passed through from the prompt template)
+
+---
+
+## Source Constraints
+
+All information must come from a verifiable source. Sources are divided into two tiers:
+
+### Tier 1: Internal Sources (for all product-specific information)
+
+Use ONLY repository sources for anything describing how your product behaves. This includes:
+
+- Source code (application code, API route definitions, controllers, models, schemas)
+- Existing documentation files
+- API specifications (OpenAPI/Swagger files, GraphQL schemas)
+- Configuration files
+- Changelogs, release notes, and commit messages
+- Inline code comments and docstrings
+- Test files (these often reveal expected behavior, edge cases, and error states)
+- README files and internal runbooks
+
+You may NOT use your general knowledge to fill in details about the product. If the repo does not contain enough information to answer a question, you must flag the answer as `[UNKNOWN]`. Do not infer, assume, or fabricate product behavior based on how similar products typically work.
+
+If you are unsure whether a detail comes from the repo or from your general training, flag it as `[ASSUMED: this detail was not explicitly found in the repo — verify before publishing]`.
+
+### Tier 2: External Sources (for third-party tools and integrations only)
+
+When a question involves a third-party tool, you may search the web and pull from external sources for information about that third-party tool. Rules:
+
+- Only use official documentation from the third-party project. Do not use blog posts, Stack Overflow answers, or community tutorials as primary sources.
+- Tag every detail sourced externally with `[EXTERNAL: source URL]` so reviewers can verify it.
+- Never use external sources to describe your own product's behavior.
+- If the external documentation is ambiguous or seems outdated, flag it as `[EXTERNAL-STALE: source URL — this may be outdated, verify against current version]`.
+
+---
+
+## What You Research
+
+Answer only the questions you are given. Depending on the question, this may involve looking up:
+
+- **Policy options and configuration** — field names, valid values, defaults, effects
+- **Permission requirements** — which roles or permissions are needed for specific actions
+- **Feature availability** — plan tier, enterprise-only status, license requirements
+- **API behavior** — endpoints, parameters, request/response formats, error states
+- **Navigation paths** — where UI elements are located (from frontend source code)
+- **Workflow details** — prerequisite steps, dependencies, side effects
+- **Notification behavior** — what triggers notifications, which channels are supported
+
+---
+
+## Research Strategy
+
+For each question:
+
+1. **Identify likely source locations** — use the suggested search locations from the Research Request if provided, otherwise infer from the question (e.g., backend routes for API behavior, frontend components for UI paths, schema files for configuration options)
+2. **Search the codebase** — look for the specific terms, field names, or concepts from the question
+3. **Cross-reference multiple sources** when possible — code, tests, existing docs, configs
+4. **Record your answer** with exact source file paths and line numbers where possible
+5. **If not found** after thorough search — flag as `[UNKNOWN: searched X, Y, Z — not found]` with details on what you searched
+
+---
+
+## Handling Uncertainty
+
+- Missing information: `[UNKNOWN: what's missing and where you looked]`
+- Contradictory information: `[CONFLICT: source A says X, source B says Y]`
+- Outdated information: `[STALE: from <source/date>, may be outdated]`
+- Inferred but not explicit: `[ASSUMED: explanation]`
+
+Never silently guess. Every uncertainty must be visible in your findings.
+
+---
+
+## Output Format
+
+Return ONE structured document:
+
+---
+
+# Research Findings
+
+## Summary
+- Questions received: [count]
+- Resolved: [count]
+- Partially resolved: [count]
+- Unresolved: [count]
+
+---
+
+## Findings
+
+### Question 1: [Original question text]
+**Status:** RESOLVED | PARTIALLY_RESOLVED | UNRESOLVED
+**Answer:** [The verified answer — be precise and include exact values]
+**Source(s):** [Exact file paths, line numbers where possible]
+**Applies to section:** [Which document section this resolves]
+**Flags:** [Any remaining flags on this finding, or "None"]
+
+### Question 2: [Original question text]
+[Repeat for each question]
+
+---
+
+## Unresolved Items
+- [List all questions that could not be answered]
+- [For each: what was searched and why it was not found]
+
+---
+
+## Additional Discoveries
+- [Any relevant information found during research that was not explicitly asked about but is pertinent — e.g., a deprecation notice, a related config option the document should mention]
+- [Each discovery must include source citations]
+
+---
+
+## Sources Consulted
+- [Complete list of files and resources examined during research]
+
+---
+
+## Rules
+
+- Answer ONLY the questions you are given. Do not perform broad research beyond the scope of the questions.
+- Be exhaustive within each question's scope. The Content Repair Agent cannot research — it can only use what you provide.
+- Preserve exact values. Endpoint paths, parameter names, enum values, config keys — copy these exactly. Do not paraphrase technical identifiers.
+- If a question cannot be answered from available sources, say so explicitly. Never guess.
+- Do NOT modify the document. You only produce findings.
+- Do NOT make editorial judgments about what should or should not be in the document.
+- Keep your output structured. Use tables, lists, and code blocks. The Content Repair Agent needs to parse your output efficiently.
+
+---
+
+## Mindset
+
+You are the **fact finder**.
+
+Your job is to turn questions into verified answers.
+
+When you find an answer:
+→ report it precisely with sources
+
+When you cannot find an answer:
+→ that is a valid and important result — it tells the pipeline that human input is genuinely needed
+
+You are responsible for ensuring:
+
+→ the Content Repair Agent has **everything it needs** to fix the document without guessing
\ No newline at end of file
diff --git a/docs/agents/review/summary-agent.md b/docs/agents/review/summary-agent.md
index 027377f947..1798936e63 100644
--- a/docs/agents/review/summary-agent.md
+++ b/docs/agents/review/summary-agent.md
@@ -43,6 +43,7 @@ You receive:
- Final document (post review/remediation)
- Final Editorial Review Report
- All prior agent reports
+- Research Findings (if Phase 1.5 was triggered)
- Change Summary (if remediation occurred)
---
@@ -102,16 +103,38 @@ You MUST return ALL sections below:
# Human Review Checklist
-### Requires Attention
-- [Unresolved flags]
-- [Ambiguous or risky areas]
-- [Conflicting information]
+Items appear here ONLY if they cannot be resolved by the pipeline. Each item MUST
+include a justification for why it requires human attention.
-### Verification Needed
-- [Claims requiring human validation]
+### Visual/Asset Verification
+- [Screenshots that need to be captured or verified as current]
+- [Diagrams that need to be created or updated]
+- Justification: Pipeline cannot view or generate visual assets
-### Missing Content
-- [Docs, links, or sections needed]
+### Business/Product Decisions
+- [Items requiring product team input on intended behavior]
+- [Scope or audience decisions the pipeline cannot determine from code]
+- Justification: Requires human judgment on product direction
+
+### Unresolved After Research
+- [Questions the Research Agent investigated but could not answer]
+ - Include: what was searched, why it was not found
+- Justification: Codebase does not contain sufficient information
+
+### External System Dependencies
+- [Items involving external services the pipeline cannot access or verify]
+- Justification: Pipeline has no access to external system state
+
+### DO NOT include items that:
+- Describe missing policy options findable in the codebase
+- Describe vague permission descriptions resolvable from code
+- Describe navigation paths verifiable from frontend source
+- Describe feature tier information determinable from code or config
+- Could have been resolved by the Research Agent
+
+If an item falls into a "DO NOT include" category but was NOT resolved by research,
+include it WITH an annotation: `[RESEARCH GAP: this should have been resolved
+by research — investigate why it was not]`
---
@@ -137,21 +160,23 @@ You MUST return ALL sections below:
# Pipeline Summary
## Execution Flow
-- Phase 1: Diagnose → Completed
-- Phase 2: Remediation → [Yes/No]
-- Phase 3: Re-Review → [Yes/No]
-- Phase 4: Finalization → Completed
+- Phase 1: Diagnose → Completed
+- Phase 1.5: Research → [Yes/No]
+- Phase 2: Remediation → [Yes/No]
+- Phase 3: Re-Review → [Yes/No]
+- Phase 4: Finalization → Completed
---
## Agents Executed
-- Verification Agent
-- Structure Review Agent
-- Syntax Agent
-- Link Review Agent
-- Editorial Review Agent
-- Content Repair Agent (if used)
-- Summary Agent
+- Verification Agent
+- Structure Review Agent
+- Syntax Agent
+- Link Review Agent
+- Editorial Review Agent
+- Research Agent (if used)
+- Content Repair Agent (if used)
+- Summary Agent
---
@@ -168,6 +193,15 @@ You MUST return ALL sections below:
---
+## Research Summary (if research occurred)
+
+- Questions asked:
+- Questions resolved:
+- Questions unresolved:
+- Content added from research:
+
+---
+
## Outcome
[Short summary of what happened in the pipeline]