deepwork-drift-sweep
Enumerate ALL workstreams in the current deepwork session and diff each artifact against its source-of-truth. Produces drift-report.vN.md listing potential drift items across every workstream, not only those flagged by the drift agent.
What this skill does
# Deepwork Drift Sweep
Addresses drift class (g) from proposals/v3-final.md (session `<id>`): partial / cluster-scoped drift sweeps miss items outside the scope the drift agent identified. This skill enumerates ALL workstreams so a secondary pass catches what the primary drift agent omitted.
## When to use
Run at SYNTHESIZE step 1 before consolidating the proposal. Also run on demand whenever the orchestrator wants to verify no workstream has silently drifted from its source-of-truth.
## Steps
1. **Locate the active instance.** Glob `${CLAUDE_PROJECT_DIR:-$(pwd -P)}/.claude/deepwork/*/state.json` and pick the one whose `session_id` matches the current `$CLAUDE_CODE_SESSION_ID`, or (if unavailable) the most-recently-updated. Call its directory `INSTANCE_DIR`.
2. **Enumerate workstreams.** Read these sources in order:
- `coverage.mapper.md` (if present) — each plan_section row names a workstream.
- All `findings.*.md` and `mechanism.*.md` in `INSTANCE_DIR` — each is an artifact produced by some workstream.
- `reframe.*.md` and any `empirical_results.E*.md`.
- `state.json.source_of_truth[]` — the upstream files every workstream depends on.
- `state.json.role_definitions[]` — each role has an `output_artifact` field.
Build a list: `[{workstream, artifact_path, source_of_truth_paths[]}]`. One entry per artifact; a workstream spanning multiple artifacts becomes multiple entries.
3. **Diff each workstream.** For every `(artifact, source)` pair:
- Read the artifact.
- Read the source-of-truth file.
- Look for claims in the artifact that reference specific line numbers, file contents, or quoted strings in the source. If any such claim no longer matches the source (line moved, text changed, file deleted), record a drift item: `{workstream, artifact, source, claim, current_source_state, severity}`.
- Severity heuristic: `high` if the artifact quotes text verbatim and the quote is gone; `medium` if it cites a file:line where the content changed; `low` if the citation is now off by ±10 lines.
4. **Compare to prior sweeps.** If a `drift-report.v<N-1>.md` exists, parse its items. For the new report:
- Mark items present in both as `existing` (carried over).
- Items only in new sweep: `new`.
- Items only in prior: `resolved`.
5. **Write `drift-report.v<N>.md`** in the INSTANCE_DIR with the shape:
```markdown
---
generated_at: <ISO8601>
workstreams_scanned: <N>
items_total: <M>
items_new: <X>
items_resolved: <Y>
sweep_version: v<N>
---
# Drift sweep v<N>
## Summary
<one-line summary>
## Per-workstream items
### <workstream_name>
- [severity] <claim> ([artifact](artifact_path):L<N>) vs [source](source_path):L<M> — <current source state>
- ...
```
6. **Emit the final summary line** (stdout, plain text — the orchestrator reads it):
```
N items found across M workstreams. Previous sweep found X items. Delta: N-X new, Y resolved.
```
## Secondary-pass protocol
After the sweep completes, the orchestrator MUST do a secondary pass:
For each workstream in the enumerated list NOT mentioned in the sweep report, manually confirm it is either (a) not yet started, or (b) has no open source-of-truth dependency. Sign off in `log.md`:
```
Secondary pass complete: N workstreams checked, M had no drift items.
```
Without this secondary pass, the sweep is still only as exhaustive as the sweep agent's output. The PROFILE.md SYNTHESIZE step references this discipline.
## Invariants preserved
- **Inv1 (structural adversarialism)**: sweep reports gaps, does NOT resolve them. Debate over resolution stays in the team.
- **Inv6 (backward compat)**: skill is opt-in (invoked by orchestrator). Sessions not using it are unaffected.
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.