← 返回
未分类 中文

Batch File Processor

Parallel batch processing of large file sets using sub-agents (summarize, analyze, extract, transform). Use when performing the same operation across many fi...
利用子代理(总结、分析、提取、转换)对大型文件集进行并行批处理。在对多个文件执行相同操作时使用。
ddpie ddpie 来源
未分类 clawhub v1.0.0 1 版本 99823.3 Key: 无需
★ 0
Stars
📥 565
下载
💾 42
安装
1
版本
#latest

概述

Batch File Processor

Process large numbers of files in parallel using sub-agents, avoiding main agent context overflow.

Workflow

1. List files

find <directory> -type f -name "*.md" | sort

2. Group

Split into batches of 2-4 files each (3 is optimal).

3. Dispatch sub-agents

One sub-agent per batch. Task template:

Read the following files completely and generate a brief summary (under 50 words) for each.
1. /path/to/file1.md
2. /path/to/file2.md
3. /path/to/file3.md
Return ONLY a JSON array:
[{"file": "relative/path/file1.md", "summary": "..."},...]

Key parameters:

  • mode: "run" (one-shot task)
  • runTimeoutSeconds: 120 (increase to 180 for large files)
  • label: descriptive label, e.g. idx-project-batch1

4. Collect results

Sub-agents push results on completion. Use sessions_yield to wait and collect incrementally.

5. Compile output

Once all results are in, the main agent compiles the final deliverable (index file, report, etc.).

Rules

  • 2-4 files per sub-agent — never let one sub-agent process an entire directory sequentially
  • Read full file content — no head/tail truncation; partial reads produce incomplete summaries
  • Standardize output format — JSON makes it easy for the main agent to parse and merge
  • One spawn per turn — system limitation; use multiple spawn + yield cycles

Anti-patterns

MistakeConsequence
----------------------
head -20 to skim file headersPoor summary quality, key information missed
One sub-agent processes entire directoryContext overflow, timeout failure
Main agent reads all files sequentiallyContext window exhausted, later files unreadable
One sub-agent per large directoryLarge directories timeout, small ones waste capacity

Benchmarks

70 files → 25 sub-agents (3 files each) → parallel execution → completed in 5 minutes → high accuracy summaries

Task Template Variants

File summarization (default)

Generate a brief summary (under 50 words) for each file.

Information extraction

Extract the following fields from each file: project name, budget, key contacts, risks.
Return JSON: [{"file": "...", "project": "...", "budget": "...", "contacts": [...], "risks": [...]}]

Content classification

Classify each file by checking for these topics: security, compliance, migration.
Return JSON: [{"file": "...", "has_security": true/false, "has_compliance": true/false, "has_migration": true/false}]

Code analysis

Analyze each source file: count lines, list imports/dependencies, identify main functions.
Return JSON: [{"file": "...", "lines": N, "imports": [...], "main_functions": [...]}]

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-30 23:20 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-agent

Skill Vetter

spclaudehome
AI智能体技能安全预审工具。安装ClawdHub、GitHub等来源技能前,检查风险信号、权限范围及可疑模式。
★ 1,233 📥 268,632
ai-agent

self-improving agent

pskoett
捕获经验教训、错误及修正内容,以实现持续改进。适用于以下场景:(1)命令或操作意外失败;(2)用户纠正Claude(如“不,那不对……”“实际上……”);(3)用户请求的功能不存在;(4)外部API或工具出现故障;(5)Claude发现自身
★ 4,090 📥 817,792
office-efficiency

SVG PPT Generator

ddpie
基于SVG的PPT生成器,拥有9种主题、8种布局、30+图表及600+图标
★ 1 📥 446