From PACT
Discovers, reviews, saves, and cleans up agent HANDOFFs from completed_handoffs.jsonl and TaskList for PACT secretary. Use for post-phase processing, incremental remediation, session consolidation, or handoff recovery.
npx claudepluginhub synaptic-labs-ai/pact-plugin --plugin PACTThis skill uses the workspace's default tool permissions.
This skill provides the complete workflow for discovering, reviewing, and saving agent HANDOFFs as institutional knowledge. It is the single source of truth for HANDOFF processing — the secretary's agent definition describes *what role you play*; this skill describes *how you do the work*.
Implements PACT agent teams protocol for task claiming, teachback verification, inter-agent messaging with SendMessage, blocker reporting, and work handoffs.
Generates next-session.md or phase-handoff.md from cwf-state.yaml, plan.md, lessons.md, and logs to preserve context across agent sessions or phases. Triggers on 'cwf:handoff'.
Generates and validates handoff documents for transferring AI agent session context across pauses, context limits, milestones, or resumes. Captures git state and next steps.
Share bugs, ideas, or general feedback.
This skill provides the complete workflow for discovering, reviewing, and saving agent HANDOFFs as institutional knowledge. It is the single source of truth for HANDOFF processing — the secretary's agent definition describes what role you play; this skill describes how you do the work.
Three workflow variants:
Determine which variant to run from the task subject/description: "harvest" or "process HANDOFFs" → Standard Harvest. "incremental" or "remediation" → Incremental Harvest. "consolidation" → Consolidation Harvest.
When reviewing multiple HANDOFFs, read ALL of them (prefer inline content from completed_handoffs.jsonl, fall back to TaskGet) before saving any memories. This lets you deduplicate and consolidate across HANDOFFs before committing to pact-memory — producing cleaner entries than saving after each individual HANDOFF.
You have two complementary sources for finding completed agent tasks:
completed_handoffs.jsonl (primary): ~/.claude/teams/{team_name}/completed_handoffs.jsonl — appended by the handoff_gate.py hook each time an agent passes completion gates. This is the primary source for both discovery and HANDOFF content. Each line contains at minimum {"task_id": "...", "teammate_name": "...", "timestamp": "..."}. Enriched entries also include "handoff": {...} and "task_subject": "..." inline — these are garbage-collection-proof and survive platform task file cleanup. Deduplicate: extract unique task_ids only (the file may contain duplicates from prior cascade behavior).TaskList (supplementary): Read TaskList for completed tasks owned by agents. Useful as a cross-reference and for catching tasks where the completion hook didn't fire. Note: the platform garbage-collects older task files during long sessions, so TaskList may be incomplete — tasks that completed early in the session may no longer appear.If neither completed_handoffs.jsonl exists nor TaskList has completed agent tasks, report "No pending HANDOFFs to review" and complete — this is normal when HANDOFFs were already processed by an earlier trigger (idempotent).
Read your processed task list from agent memory (~/.claude/agent-memory/pact-secretary/session_processed_tasks.md). Skip any task IDs already processed — only review the delta. This enables incremental passes (e.g., after remediation).
For each discovered task, read the HANDOFF using this priority order:
completed_handoffs.jsonl entry has a handoff key, use it directly — this content was captured at completion time and survives platform task garbage collection.TaskGet fallback (legacy): If the completed_handoffs.jsonl entry has only task_id (old format, no handoff key), fall back to TaskGet(taskId).metadata.handoff. This may fail for garbage-collected tasks — the platform deletes older task files during long sessions.completed_handoffs.jsonl entry so the lead has context.Read all HANDOFFs before proceeding to extraction.
Focus on:
Alongside institutional knowledge, snapshot the current workflow state for session recovery. Read TaskList (TaskList is authoritative for current workflow state; completed_handoffs.jsonl is primary for HANDOFF content) and extract:
Save this state snapshot to pact-memory alongside the institutional knowledge entries. This makes you the organizational note-taker — capturing not just what was learned but where the project stands at each phase boundary.
Before every save call, apply this standard operating procedure:
search --query "{topic}" --limit 5update CLI command) rather than creating a new onesaveThis applies to ALL save operations — HANDOFF review, ad-hoc saves, and consolidation.
Save using the CLI with proper structure:
context: What was being done and whygoal: What was achieveddecisions: Key decisions with rationale and alternatives consideredlessons_learned: Actionable insightsentities: Components, files, services involved (enables graph search)Save the list of all processed task IDs to agent memory (overwrite, not append — this sets the baseline for subsequent incremental passes):
File: ~/.claude/agent-memory/pact-secretary/session_processed_tasks.md
---
name: session_processed_tasks
description: Task IDs processed in current session for dedup on incremental passes
type: reference
---
Processed task IDs: 6, 7, 12, 15
Last processed: {timestamp}
Report to the lead:
SendMessage(to="team-lead",
message="[secretary→lead] HANDOFF review complete. Saved N memories from M HANDOFFs.
- {memory summary 1}
- {memory summary 2}
Gaps: {any HANDOFFs that were thin or missing}",
summary="HANDOFF review complete: N memories from M HANDOFFs")
After processing HANDOFFs, gather calibration metrics for the orchestrator's variety scoring feedback loop:
initial_variety_score (stored during variety assessment). If TaskGet fails (garbage-collected), ask the lead for the variety score instead.TaskList for blocker count (tasks with "BLOCKER:" in subject). Note: TaskList may be incomplete in long sessions due to garbage collection — report what's available.TaskList for phase rerun count (retry/redo phase tasks)SendMessage(to="team-lead",
message="[secretary→lead] Calibration: variety was scored {X}. Blockers: {N}, reruns: {N}. Was actual difficulty higher, lower, or about the same? Any dimensions that surprised you?",
summary="Calibration check: variety {X}")
['orchestration_calibration', '{domain}']Triggered after remediation completes — processes only the delta since the last harvest pass. Fires only when remediation occurred and produced new completed tasks.
~/.claude/agent-memory/pact-secretary/session_processed_tasks.md for already-processed task IDscompleted_handoffs.jsonl (primary) and TaskList (supplementary) for completed tasks not in the processed set — these are new completions from remediation. completed_handoffs.jsonl may contain tasks that TaskList no longer shows (garbage-collected).completed_handoffs.jsonl inline content, fall back to TaskGet(taskId).metadata.handoff for old-format entriescompleted_handoffs.jsonl — it may still be accumulating entries from ongoing workupdate CLI command, not save)Triggered during /PACT:wrap-up or /PACT:pause. This is the deep-clean pass — it extends the standard workflow with memory consolidation and pruning.
Check ~/.claude/teams/{team_name}/completed_handoffs.jsonl for entries not yet in the processed task set. If unprocessed entries exist, run the Standard Harvest workflow above first (earlier harvest triggers may have been missed). Then continue with consolidation.
Review all memories saved during this session by listing recent pact-memory entries.
Sync Working Memory to CLAUDE.md. The auto-sync mechanism handles individual saves, but consolidation may have merged/pruned entries that require a refresh.
Save orchestration retrospective as calibration data (see Standard Harvest Step 10 for CalibrationRecord schema). This captures the session-level view: overall workflow effectiveness, recurring patterns, and calibration for future variety scoring.
Report consolidation results to the lead, including:
| Include | Skip |
|---|---|
| Architectural decisions with rationale | File locations (agent memory handles this) |
| Cross-agent integration points | Framework conventions (agent memory) |
| Stakeholder decisions and constraints | Debugging techniques (agent memory) |
| Patterns established for this project | Implementation details without broader impact |
| Risks, uncertainties, and known issues | Routine changes following existing patterns |
When deciding where knowledge belongs:
Is this knowledge specific to ONE agent's craft/domain?
-> YES -> Agent persistent memory (the agent saves it themselves)
-> NO |
Is this knowledge about the project that other agents/sessions need?
-> YES -> pact-memory (you save via Knowledge Distiller)
-> NO |
Is this a broad session observation or user preference?
-> YES -> Auto-memory (platform handles automatically)
-> NO -> Probably doesn't need saving
HANDOFFs are agent-written summaries — they may omit implicit learnings (failed approaches, nuanced trade-offs). When HANDOFFs are thin, you compensate with investigation.
Direct teammate communication: Message implementing agents directly — not through the lead. The lead does not need to be in the loop for these exchanges.
SendMessage(to="{agent-name}",
message="[secretary→{agent-name}] Your HANDOFF mentions {decision}. What alternatives did you consider and why were they rejected?",
summary="Elaboration request: {topic}")
File and git analysis: Independently examine source materials:
Lead communication: Only when broader context is needed that neither the HANDOFF nor the implementing agent can provide (e.g., "Why was this feature prioritized?").
For direct save requests from the lead outside of workflow HANDOFF review (ad-hoc saves), apply the same institutional knowledge criteria and save-vs-update dedup — save decisions, lessons, and cross-cutting concerns to pact-memory.
This is the Layer 4 fallback for completed handoffs left behind by sessions that ended without wrap-up or where Layer 2 triggers were missed.
completed_handoffs.jsonl in ~/.claude/teams/*/ directories. Exclude the current session's team (available from the session context file at ~/.claude/pact-sessions/{slug}/{session-id}/pact-session-context.json, or the team name provided in your dispatch prompt) — that team's completed handoffs are active, not orphaned.handoff key) can be read directly; for old-format entries, try TaskGet (may fail for garbage-collected tasks — extract what's available from entry metadata)completed_handoffs.jsonl after processing (use python3 -c "from pathlib import Path; Path(...).unlink(missing_ok=True)" — not shell rm, to avoid sensitive-file permission prompts)TaskGet failed)