Skip to content
collect logo

/collect - Result Aggregation Agent

collect

Result Aggregation Agent - Aggregates worker results, verifies completion, detects blockers, and generates collection report. Pipeline Position: After /worker, Before /synthesis Handoff: /synthesis for traceability validation

SKILL.md

Full skill instructions

/​collect - Result Aggregation Agent

Version: 4.0.0 | Model: opus Pipeline: /​worker -> [/​collect] -> /​synthesis EFL: P1-P6 Complete


1. Purpose

Result Aggregation Agent that:

  1. Aggregates worker outputs from all terminals
  2. Verifies task completion status via TaskList
  3. Validates completion manifests (SHA256 integrity)
  4. Detects blockers and incomplete work
  5. Generates collection report for /​synthesis

2. Task API Integration

Collection Pattern

// Get all tasks for workload
const allTasks = TaskList()

// Categorize by status
const completed = allTasks.filter(t => t.status === "completed")
const inProgress = allTasks.filter(t => t.status === "in_progress")
const pending = allTasks.filter(t => t.status === "pending")
const blocked = allTasks.filter(t => t.blockedBy?.length > 0)

// Verify each completed task has outputs
for (const task of completed) {
  const outputs = await collectTaskOutputs(task)
  verifyIntegrity(outputs)
}

Multi-Source Collection

// Source 1: Task System
const taskResults = collectFromTasks()

// Source 2: Output Files
const fileResults = collectFromFiles(workloadSlug)

// Source 3: Git Commits (optional)
const gitResults = collectFromGit()

// Source 4: Session State
const sessionResults = collectFromSession()

// Merge and deduplicate
const allResults = mergeResults([taskResults, fileResults, gitResults, sessionResults])

3. Invocation

# Collect all results
/​collect

# Collect specific phase
/​collect --phase phase1

# Collect from specific sources
/​collect --from-session
/​collect --from-git

# Full collection with all sources
/​collect --all

4. Execution Protocol

Phase 1: Source Discovery

// Determine collection sources
const sources = {
  tasks: true,           // Always check TaskList
  files: true,           // Always check output files
  git: args.includes('--from-git'),
  session: args.includes('--from-session')
}

// Get active workload
const workloadSlug = getActiveWorkloadSlug()
const outputDir = `.agent/​prompts/​${workloadSlug}/​outputs`

Phase 2: Task Collection

// Collect from Native Task System
const tasks = TaskList()

for (const task of tasks) {
  const detail = TaskGet({taskId: task.id})

  taskResults.push({
    taskId: task.id,
    subject: task.subject,
    status: task.status,
    owner: task.owner,
    completedAt: detail.metadata?.completedAt,
    outputs: detail.metadata?.outputs || []
  })
}

Phase 3: File Collection

// Collect from output directories
const terminals = ['terminal-b', 'terminal-c', 'terminal-d']

for (const terminal of terminals) {
  const terminalDir = `${outputDir}/​${terminal}`
  const files = Glob(`${terminalDir}/​*.md`)

  for (const file of files) {
    const content = Read(file)
    fileResults.push({
      terminal: terminal,
      file: file,
      type: detectOutputType(file), // l1, l2, l3, manifest
      content: extractSummary(content)
    })
  }
}

Phase 4: Integrity Verification

// Verify completion manifests
for (const result of completedResults) {
  const manifestPath = `${outputDir}/​${result.terminal}/​task-${result.taskId}-manifest.yaml`

  if (fileExists(manifestPath)) {
    const manifest = parseYAML(Read(manifestPath))

    // Verify SHA256 hashes
    for (const output of manifest.outputs) {
      const actualHash = computeSHA256(Read(output.path))
      if (actualHash !== output.hash) {
        integrityErrors.push({
          task: result.taskId,
          file: output.path,
          expected: output.hash,
          actual: actualHash
        })
      }
    }
  }
}

Phase 5: Gap Detection

// Detect missing deliverables
const gaps = []

for (const task of tasks) {
  if (task.status === "completed") {
    // Check for expected outputs
    const expectedOutputs = getExpectedOutputs(task)
    const actualOutputs = getActualOutputs(task)

    const missing = expectedOutputs.filter(e =>
      !actualOutputs.some(a => a.type === e.type)
    )

    if (missing.length > 0) {
      gaps.push({ taskId: task.id, missing })
    }
  }
}

Phase 6: Report Generation

// Generate collection report
const report = `
# Collection Report

## Summary
- Total Tasks: ${tasks.length}
- Completed: ${completed.length}
- In Progress: ${inProgress.length}
- Pending: ${pending.length}

## Completion Status
${completed.map(t => `- [x] Task #${t.id}: ${t.subject}`).join('\n')}
${inProgress.map(t => `- [ ] Task #${t.id}: ${t.subject} (in progress)`).join('\n')}
${pending.map(t => `- [ ] Task #${t.id}: ${t.subject} (pending)`).join('\n')}

## Deliverables
${deliverables.map(d => `- ${d.file}: ${d.type}`).join('\n')}

## Integrity Check
${integrityErrors.length === 0
  ? '- All manifests verified'
  : integrityErrors.map(e => `- ERROR: ${e.file} hash mismatch`).join('\n')
}

## Gaps Detected
${gaps.length === 0
  ? '- No gaps detected'
  : gaps.map(g => `- Task #${g.taskId}: Missing ${g.missing.join(', ')}`).join('\n')
}

## Next Steps
${getNextSteps(completed, pending, gaps)}
`

Write({
  file_path: `.agent/​prompts/​${workloadSlug}/​collection_report.md`,
  content: report
})

5. Output Files

OutputPath
Collection Report.agent/​prompts/​{slug}/​collection_report.md
L1 SummaryInline in report
L2 DetailsPer-task summaries in report
L3 ReferencesLinks to worker output files

6. Collection Sources

SourceFlagDescription
Tasks(default)Native Task System via TaskList
Files(default)Output files in workload directory
Git--from-gitRecent commits in current branch
Session--from-sessionSession state and context

7. Error Handling

ErrorRecovery
No completed tasksShow pending tasks, suggest wait
Missing outputsFlag as gap, continue collection
Integrity errorLog error, flag in report
Workload not foundUse active workload or prompt

8. Handoff Contract

handoff:
  skill: "collect"
  workload_slug: "{slug}"
  status: "completed"
  report_path: ".agent/​prompts/​{slug}/​collection_report.md"
  next_action:
    skill: "/​synthesis"
    arguments: "--workload {slug}"
    required: true
    reason: "Results collected, ready for traceability validation"

9. Version History

VersionChanges
4.0.0Deduplicated, V2.1.19 frontmatter, Task API patterns
3.0.0Multi-source collection, fallback strategies
2.0.0EFL Pattern P1-P6 implementation
1.0.0Initial result aggregation

End of Skill Documentation

More Other skills

Delegate independent tasks to specialized agents working concurrently with isolated context.

295.4K 206.3K
View

Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.

179.7K 100.1K
View

Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors/fonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.

179.7K 89.5K
View

A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill whenever asked to write some sort of internal communications (status reports, leadership updates, 3P updates, company newsletters, FAQs, incident reports, project updates, etc.).

179.7K 76.1K
View

Fundamental design principles for writing maintainable, testable Python code.

40.2K 21.9K
View

Modern responsive layouts using container queries, fluid typography, CSS Grid, and mobile-first strategies.

40.2K 20K
View

Generate Playwright tests from scenarios using interactive browser exploration and validation.

39.7K 18.2K
View

Modern React state management with Redux Toolkit, Zustand, Jotai, and React Query for every state category.

40.2K 14.7K
View

GDPR-compliant data handling with consent management, data subject rights, and privacy controls.

40.2K 14.3K
View

Python error handling patterns including input validation, exception hierarchies, and partial failure handling. Use when implementing validation logic, designing exception strategies, handling batch processing failures, or building robust APIs.

40.2K 13.5K
View

Detailed multi-file refactor planning with safety checks and rollback guidance.

39.7K 13K
View