# Extract
<!--
ref: @protocol/extract
tags: [extraction, knowledge management, workflow, documentation]
aliases: [harvest-transcripts, harvest transcripts, ingest-transcripts]
triggers: [after completing work, when patterns emerge, end of session, user requests extraction]
trigger_prompt: When the user has finished a significant task and wants to consolidate learnings or when they express a desire to extract insights from their recent work.
category: extract
last_reviewed: 2026-04-30
complements: [@protocol/harvest, @protocol/loop, @protocol/append, @protocol/context-quality]
audience: [agent-author, claude-code-user]
version: 12
updated_at: 2026-07-14T23:23:56.683Z
-->

Extract valuable insights and patterns from completed work sessions.

## REVIEW

Scan the conversation transcript for extractable patterns:

### Corrections
- "No, do it this way instead..."
- "Don't use X, use Y"
- "That's wrong because..."

These are the highest-value extractions — they prevent future mistakes.

### Validated Approaches
- Techniques that worked well (user confirmed or accepted without pushback)
- Non-obvious choices that turned out to be correct
- Workarounds for known issues

### Domain Knowledge
- Business rules, naming conventions, architecture decisions
- "We always do X because of Y"
- Integration patterns, API quirks, deployment procedures

### Workflow Preferences
- How the user likes to work (PR style, commit conventions, testing approach)
- Communication preferences (terse vs detailed, when to ask vs proceed)
- Tool preferences and configurations

---

## EVALUATE

For each candidate extraction, ask:

1. **Is it durable?** Will this be true next month, or is it ephemeral?
2. **Is it actionable?** Can an AI agent use this to do better work?
3. **Is it novel?** Does this already exist in the user's protocols?
4. **Is it general enough?** Or is it too specific to this one task?

Skip extractions that are:
- Specific to a single debugging session with no reuse value
- Already captured in existing protocols (search first: `/search.md?q=<topic>`)
- Obvious from the codebase itself (conventions visible in the code)

---

## FORMAT

Write each extraction as a proper protocol with HTML comment metadata:

```markdown
# [Title — descriptive, not generic]
<!--
ref: @me/[slug]
type: [reference|procedure]
tags: [relevant, tags]
triggers: [when this applies]
-->

[One-line summary of what this captures]

## [Content organized by type]

[For corrections: what to do, what NOT to do, and why]
[For approaches: the technique, when it applies, example]
[For domain knowledge: the fact, its implications, how to apply]
[For workflows: the preference, how to follow it]
```

### Naming Conventions

- **Corrections**: `[area]-guidelines` (e.g., `testing-guidelines`, `api-conventions`)
- **Approaches**: `[technique]-pattern` (e.g., `error-handling-pattern`)
- **Domain knowledge**: `[domain]-reference` (e.g., `deployment-reference`)
- **Workflows**: `[area]-workflow` (e.g., `pr-workflow`, `review-workflow`)

---

## PUBLISH

Publish extracted protocols to the user's private repo:

```bash
# Publish to personal repo
curl -X POST https://api.protocol.supply/repo/@me/import \
  -H "Authorization: Bearer $PROTOCOL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"files":[{"path":"[slug]","content":"[protocol content]"}]}'
```

If the user wants to share with their team:

```bash
# Publish to team repo instead
curl -X POST https://api.protocol.supply/repo/[team-repo]/import \
  -H "Authorization: Bearer $PROTOCOL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"files":[{"path":"[slug]","content":"[protocol content]"}]}'
```

### Before publishing, check for duplicates:

```bash
curl -s "https://api.protocol.supply/search.md?q=[topic]&repos=@me"
```

If a similar protocol exists, **update it** rather than creating a new one. Protocols should evolve, not multiply.

---

## CONFIRM

Present the extracted protocols to the user before publishing:

- Show title, summary, and key content for each
- Ask: "Publish to your private repo?" or "Publish to [team] repo?"
- Let them edit, skip, or redirect to a different repo
- Never publish without confirmation

---

## Example Flow

```
User: "Extract protocols from this session"

→ REVIEW: Scan transcript
  Found 3 candidates:
  1. Correction: "Always use HTML comment metadata, not YAML frontmatter"
  2. Validated approach: "Derive slug from ref field in metadata"
  3. Domain knowledge: "Bootstrap core slugs are in EntryService.BOOTSTRAP_CORE_SLUGS"

→ EVALUATE:
  1. ✓ Durable, actionable, novel → extract
  2. ✓ Durable, actionable, novel → extract
  3. ✗ Visible in codebase, not durable (array changes) → skip

→ FORMAT: Write 2 protocols

→ CONFIRM: Present to user

→ PUBLISH: Push to @me repo
```

---

## Composition

```
extract (review, evaluate, format, publish, confirm)
  └── search (check for existing protocols before publishing)
```

Extract can be triggered standalone or as part of `@protocol/loop` — after a focused loop completes, the audit can suggest running extract to capture what was learned.

---

*Related: `@content/youtube/wes-mcdowell/how-to-use-chatgpt-for-content-creation-itll-sound-like-you` · `@content/youtube/yc-root-access/meet-the-devtool-founders-building-for-ai-agents` · `@content/youtube/aie/the-death-of-developer-advocates-stephanie-jarmak-sourcegraph` · `@content/youtube/tiago-forte/i-trained-ai-to-write-like-me-and-it-actually-worked` · `@protocol/onboarding`*

---

*You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).*

*Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*