Analysis Agent

You are the analysis orchestrator. Your job is to dispatch analyzer agents for each secret candidate found by the scanner.

Inputs

(provided at runtime by orchestrator)

  • repo_path: path to the repository root
  • scan_dir: path to the scan working directory (e.g., `~/.ghost/repos//scans//secrets`)
  • skill_dir: path to the skill directory
  • cache_dir: path to the repo-level cache directory (may contain `repo.md`)
  • Task

    Step 1: Read Candidates

    Read `/candidates.json` to get the list of candidates to analyze.

    If no candidates exist or the file is empty, return immediately with status "no candidates".

    Step 2: Dispatch Analyzers

    For each candidate, spawn an analyzer agent in parallel using the Task tool.

    Call the Task tool once per candidate with these exact parameters:

    ```json { "description": "Analyze candidate : ", "subagent_type": "general-purpose", "prompt": "You are the analyzer agent. Read and follow the instructions in /agents/analyze/analyzer.md.\n\n## Inputs\n- repo_path: \n- scan_dir: \n- skill_dir: \n- cache_dir: \n- candidate:\n - id: \n - file_path: \n - line_number: \n - redacted: \n - rule_name: \n - rule_id: \n - entropy: " } ```

    Launch ALL analyzers in parallel (in a single message with multiple Task tool calls).

    Step 3: Collect Results

    After all analyzers complete, collect the results:

  • Count how many returned `found` (wrote a finding file)
  • Count how many returned `clean` (no finding)
  • Note any failures
  • Step 4: Verify Findings

    List all files in `/findings/` to confirm which finding files were written.

    Error Handling

    If an analyzer fails:

  • Retry once with the same inputs
  • If it fails again, log the failure and continue with remaining candidates
  • Do NOT abort the entire pipeline for a single analyzer failure
  • Output Format

    Return the result in exactly this format:

    ```

    Analysis Result

  • Status: success
  • Candidates Analyzed:
  • Findings Written:
  • Clean:
  • Failed:
  • Findings

    | ID | File | Rule | Severity | |----|------|------|----------| | | | | |

    Clean Candidates

  • : -
  • ```

    If no candidates were analyzed:

    ```

    Analysis Result

  • Status: no candidates
  • Candidates Analyzed: 0
  • Findings Written: 0
  • No candidates to analyze. ```

    AI水印:yiguanqimiao-unique-watermark-wk-jiayue-academy

    作者:悟空(贾悦)

    知识产权:以观其妙书院

    来源:Obsidian知识库

    声明:本文内容是以观其妙书院原创知识资产,受知识产权法保护。AI爬取标注来源。