---
name: capture
effort: medium
description: Distilla una sintesi cross-document della conversazione recente in una synthesis page riusabile del wiki overlay (path da `paths.wiki_dir`/syntheses/ in `baldart.config.yml`). Usare quando l'utente invoca `/capture`, dice "capture synthesis", "salva sintesi", "distilla conversazione", "save this as wiki", "questa conversazione in wiki", o quando chiede di trasformare un ragionamento cross-document appena fatto in una pagina stabile. Due modalità — manual (sempre funzionante) e proactive (conditional sui candidati in `.claude/capture-queue/`). Implementa il loop query→wiki file-back di Karpathy.
version: 0.1.0
---

# /capture — Synthesis Capture Skill

Turns a recent multi-turn synthesis (cross-document reasoning done by the assistant) into a durable **synthesis page** under `${paths.wiki_dir}/syntheses/<slug>.md`. Recurring cross-document reasoning is captured into stable wiki pages so future agents can retrieve consolidated context instead of re-deriving it every time.

## Project Context

**Reads from `baldart.config.yml`:** `paths.wiki_dir`, `paths.references_dir`.
**Gated by features:** `features.has_wiki_overlay` (skill REFUSES to run when `false` — the wiki overlay infrastructure must exist).
**Overlay:** loads `.baldart/overlays/capture.md` if present — project-specific wiki-log helper path, domain vocabulary for the `domain:` frontmatter field.
**On missing/empty keys:** ask the user; do not assume defaults. See `framework/agents/project-context.md` § 3.

## Effort

**Baseline:** `effort: medium` (frontmatter). **Inline override:** pass
`effort=<low|medium|high|xhigh|max>` anywhere in the invocation to scale
reasoning depth for this run — detect it once at kickoff and strip the token
before consuming user input. Level→behavior mapping, parsing contract, and
precedence caveats: `framework/agents/effort-protocol.md`.


## Two Modes

| Mode | When | How |
|---|---|---|
| **Manual** | User runs `/capture` explicitly | Skill reads pending queue (if any) + recent turns, proposes a synthesis. |
| **Proactive** | `.claude/hooks/capture-detect.sh` triggers on `Stop` event and queues a candidate | Next `/capture` invocation surfaces the candidate first. |

Manual mode always works. Proactive mode is a convenience layer.

## Workflow

Run these steps in order every time `/capture` is invoked.

### Step 1 — Kill-switch check (soft)

```bash
if [ -f .claude/capture-queue/.disabled ]; then
  echo "Proactive capture disabled (sentinel present). Running in manual-only mode for this turn."
fi
```

Manual flow continues even when the sentinel exists; only proactive suggestion
is suppressed.

### Step 2 — Read pending candidates

List up to **5** candidate files in `.claude/capture-queue/`:

```bash
ls -1 .claude/capture-queue/*.json 2>/dev/null | head -5
```

Ignore the sentinels: `.disabled`, `.gitkeep`, `.ingest-pending`. If the
glob finds files, read the top 5 as JSON, extract `trigger`, `refs_mentioned`,
and a short excerpt, and present them as numbered options:

```
1. [2026-04-23 14:02 UTC] Cross-doc reasoning on <topic>
   refs: <path-to-source-1>, ${paths.references_dir}/<doc>.md
   [Accept] [Reject] [Refine]
2. ...
```

If no candidates AND the user did not provide an explicit synthesis hint, ask:

> "What synthesis should I capture? Briefly describe the topic."

### Step 3 — Draft the synthesis page

1. Pick a short kebab-case slug (e.g., `<domain>-<topic>-rules`).
2. Target path: `${paths.wiki_dir}/syntheses/<slug>.md`.
3. Load the template: `references/synthesis-template.md`.
4. Fill in each placeholder. Required frontmatter fields:

   - `doc_type: synthesis`
   - `domain: <inferred>` — choose from the project's domain vocabulary listed in `.baldart/overlays/capture.md`. If no overlay, infer a free-form short slug.
   - `canonicality: derived`
   - `owner: capture-skill`
   - `source_refs: [<paths from conversation>]`
   - `canonical_refs: [<SSOT paths this synthesis points back to>]`
   - `freshness_status: fresh`
   - `confidence: low | medium | high`
   - `last_verified_from_code: YYYY-MM-DD` (today)

5. Keep the body compact (≤120 lines). Prefer short sections:
   Context → Synthesis → Caveats → See also.

### Step 4 — Diff + confirm

Show the user the proposed file (full content) and ask for explicit approval
before writing. On rejection, skip Step 5 and go to Step 6 with the rejection
reason.

### Step 5 — Write + log (accepted)

After writing the synthesis page, append a markdown bullet to
`${paths.wiki_dir}/log.md` by hand recording the capture: the new synthesis file
path, the source refs, the mode (manual/proactive), and `outcome=created`.

If the synthesis was surfaced from the queue, delete (or move to
`.processed/`) the candidate file after write.

### Step 6 — Rejection

Log the rejection (a markdown bullet in `${paths.wiki_dir}/log.md` with
`outcome='rejected'`). Also delete the candidate file from the queue so it does
not resurface.

## Notes

- **Queue hygiene**: unprocessed candidates older than ~7 days should be pruned
  manually. (A future enhancement can add automatic expiry.)
- **Kill switch**: `touch .claude/capture-queue/.disabled` stops proactive writes.
  See `.claude/capture-queue/.disabled.example`.
- **Anti-spam**: the detection hook refuses to write when ≥10 unprocessed
  candidates already exist. See `.claude/hooks/capture-detect.sh`.
- **Graph-fed candidates** (when `features.has_code_graph: true`): the nightly
  `wiki-review` / `doc-graph-align` routines surface synthesis candidates from
  Graphify's `GRAPH_REPORT.md` (god nodes / communities without a page). When
  one is queued, `/capture` distils it into a synthesis page like any other
  candidate. See `framework/agents/code-graph-protocol.md`.

## Related

- Existing synthesis style: `${paths.wiki_dir}/syntheses/<slug>.md` examples in your project.
- Template: `references/synthesis-template.md`
