# Workspace Harvest
<!--
ref: @protocol/harvest
tags: [workspace, pattern recognition, continuous improvement, protocol hygiene, groom-op]
aliases: [harvest, workspace-harvest, harvest-workspace, harvest workspace, ingest-workspace]
triggers: [harvest my workspace, find my patterns, periodic review, onboarding new project]
trigger_prompt: When you want to analyze multiple sessions for recurring themes or insights, especially after noticing repeated corrections or during project onboarding.
category: extract
last_reviewed: 2026-09-10
complements: [@protocol/extract, @protocol/loop, @protocol/context-quality, @protocol/append]
audience: [agent-author, claude-code-user]
version: 15
updated_at: 2026-10-24T21:11:40.451Z
-->
Harvest insights and patterns from your entire agent workspace to improve protocols and workflows.
Unlike `@protocol/extract` (single conversation → protocols), workspace-harvest works **across your entire agent workspace** — finding patterns that only emerge when you look at many sessions together.
> You are a librarian walking through someone's house, not a pipeline processing documents. Notice things.
---
## When to Run
- Periodically (weekly/monthly) as protocol hygiene
- After noticing you keep correcting your agents the same way
- When onboarding a new project and want to codify what you know
- When the user says "harvest my workspace" or "find my patterns"
- As part of `@knowledge/continuous-improvement-protocol` Tier 2
---
## Phase 1: SURVEY
Map available sources. Don't read everything — inventory first.
### Source Types
| Source | Location Pattern | Signal Density |
|--------|-----------------|----------------|
| Memory/feedback files | `~/.claude/projects/*/memory/feedback_*.md` | ★★★★★ Already distilled |
| CLAUDE.md / conventions | `**/CLAUDE.md`, `**/CONVENTIONS.md` | ★★★★☆ Encoded rules |
| Guides / playbooks | `<workspace>/guides/*.md` | ★★★★☆ Proto-protocols |
| Claude Code logs | `~/.claude/projects/*/*.jsonl` | ★★★☆☆ Gold buried in noise |
| Session specs | `<workspace>/sessions/**/spec.md` | ★★★☆☆ Decisions & learnings |
| Voice transcripts | `<workspace>/memory/transcripts/*.md` | ★★☆☆☆ Intent-rich but noisy |
| Recurring tasks | `<workspace>/memory/recurring-tasks.md` | ★★☆☆☆ Operational procedures |
### Scope Decision
If total source material exceeds ~200K tokens, propose a scoped harvest:
- **By recency**: "Focus on last 7/30 days?"
- **By project**: "Focus on 3 most active projects?"
- **By source type**: "Start with feedback files and guides only?"
Always get user buy-in on scope before scanning.
---
## Phase 2: SCAN
Read sources and extract **raw signals** — not protocols yet. Observations only.
### Signal Taxonomy
| Signal Type | What It Looks Like | Value |
|------------|-------------------|-------|
| **Correction** | "No, always use X instead of Y" | Highest — prevents future mistakes |
| **Preference** | "I like terse responses" / accepted without pushback | High — shapes behavior |
| **Rule** | "Software protocols go in @<codebase-repo>" | High — routing/governance |
| **Procedure** | Step-by-step instructions for a task | Medium — candidate protocol body |
| **Frustration** | "I keep having to repeat this" | Medium — unmet protocol need |
| **Principle** | "Taxonomy emerges from content" | Medium — philosophical foundation |
| **Contradiction** | Two sources say opposite things | Flag — needs resolution |
| **Surprise** | Something unexpected that doesn't fit | Flag — might be the most important find |
### Source-Specific Strategies
**Claude Code logs** (`.jsonl`):
- Filter user messages for correction language: "no", "don't", "instead", "always", "never", "wrong", "not that"
- Look for repeated tool_use patterns followed by corrections
- Note: high volume, low density. Skim, don't exhaustively parse.
**Memory/feedback files** (`.md`):
- Already signals. Read directly.
- Check: is the pattern project-specific or general? Project-scoped feedback might generalize.
**Voice transcripts** (`.md`):
- Messy by nature. Don't parse every sentence.
- Hunt for: imperatives ("I want X to always..."), frustrations ("it keeps doing..."), vision ("what if we..."), meta-commentary about how work should flow.
**Guides** (`.md`):
- These are proto-protocols. Each one is a candidate for ingestion.
- Many may already exist as protocols. Check before flagging.
**CLAUDE.md / conventions**:
- Each rule line is a signal. High confidence — the user deliberately encoded these.
### As You Scan
Don't wait until scanning is done to notice themes. If "testing" keeps appearing, flag it early so later scans can look for it. Let pattern recognition run in parallel with scanning.
### Output: Signal List
For each signal:
```
- Signal: [the observation, quoted if possible]
- Type: correction | preference | rule | procedure | frustration | principle | contradiction | surprise
- Source: [file path + approximate location]
- Strength: [weak = single mention | moderate = repeated | strong = cross-source]
```
---
## Phase 3: CLUSTER
Group signals into pattern candidates. This is where protocol-ness emerges.
### Clustering Approach
Per `@knowledge/knowledge-summary-protocol`: **taxonomy emerges from content, not the reverse.** Don't pre-define categories. Let the signals tell you what clusters naturally.
1. Signals that correct the **same behavior** → single pattern
2. Signals from **different sources** about the same topic → high-confidence pattern
3. Signals that form a **sequence** → candidate procedure protocol
4. Signals that **contradict** each other → flag, don't force-merge
5. **Lone signals** (specific, unrepeated) → hold. Not enough for a protocol yet.
### Recurrence Threshold
| Count | Verdict |
|-------|---------|
| 1 occurrence | Note it. Not enough signal. |
| 2 occurrences | Interesting. Watch for more evidence. |
| 3+ occurrences | **Pattern.** Candidate for protocol action. |
| 5+ from 2+ source types | **Strong pattern.** Priority candidate. |
### Cross-Source Validation
Confidence rises when a signal appears across source types:
- Same correction in 3 Claude Code sessions → medium
- Same correction in Claude Code + feedback file + guide → **high**
- Principle stated in transcript + encoded in CLAUDE.md → **high**
### Output: Pattern Candidates
For each pattern:
```
## Pattern: [descriptive name]
- Signals: [N signals from M source types]
- Confidence: low | medium | high
- Type: correction pattern | workflow pattern | preference pattern | procedural pattern | principle
- Summary: [1-2 sentence description]
- Evidence: [list of source signals with paths]
```
---
## Phase 4: MATCH
**Groom before create.** Every pattern candidate must be checked against existing protocols.
### Search
For each pattern:
```
/search.md?q=[topic keywords]&repos=@me,@protocol,@<codebase-repo>,@knowledge,@<personal-repo>
```
Also check: could an existing protocol's triggers or tags already cover this?
### Match Outcomes
| Match | Action |
|-------|--------|
| **Exact** — existing protocol says the same thing | **SKIP.** Optionally bump maturity/confidence. |
| **Partial** — existing protocol covers topic but missing this detail | **GROOM** — enrich the existing protocol |
| **Adjacent** — related protocol exists, distinct concern | **CREATE** — new protocol, cross-link to related |
| **No match** — genuinely new pattern | **CREATE** — new protocol |
| **Contradiction** — conflicts with existing protocol | **FLAG** — surface to user |
### Destination Routing
| Pattern Domain | Target Repo |
|---------------|------------|
| Software development, codebase conventions | `@<codebase-repo>` |
| General AI workflow, orchestration | `@protocol` |
| Personal AI infrastructure principles | `@<personal-repo>` |
| Personal operational patterns | `@<personal-repo>` |
| Domain knowledge, facts | `@knowledge` |
| Project-specific rules | Project's own repo |
When unsure, ask the user. Misrouting is worse than asking.
---
## Phase 5: ACT
### Groom (update existing)
For each GROOM match:
- Add new evidence/detail to protocol body
- Update metadata if warranted:
- Bump `maturity` (draft → preliminary → refined) if well-validated
- Bump `confidence` if cross-source confirmed
- Add new `trigger` phrases discovered from transcripts
- Add `tags` discovered from clustering
- Use refine patterns
### Create (new protocol)
For each CREATE candidate:
- Draft per authoring format conventions
- Set `maturity: draft`
- Set `confidence` based on evidence strength
- Include provenance: where the pattern was found, how many signals
- Publish to routed destination repo
### Flag (contradictions / surprises)
For each FLAG:
- Present the contradiction with evidence from both sides
- Ask user to resolve
- If resolved: create/update accordingly
- If unresolved: document both positions, note the tension
### Presentation Scaling
| Action Count | Approach |
|-------------|----------|
| ≤5 | Present each individually, confirm interactively |
| 6–15 | Summary table, batch approve/skip/edit |
| 16+ | Group by repo/domain, iterate per group |
Never publish without confirmation.
---
## Phase 6: REFLECT
After acting, question everything.
### Self-Check
1. **Coverage** — Did I miss obvious sources? Projects I didn't scan?
2. **Quality** — Are patterns genuinely recurring, or did I over-cluster?
3. **Noise** — Did I create protocols that are too narrow or too obvious?
4. **Gaps** — Are there frustrations with NO matching protocol (new or existing)? Those are the most important unmet needs.
5. **Contradictions** — Did I find signals that fight each other? Did I flag them all?
6. **Surprise** — What was the most unexpected thing I found?
> If the answer to "What surprised you?" is "Nothing" — you weren't looking hard enough. Go back to SCAN with fresh eyes.
### Health Report
```
## Harvest Report — [date]
- Sources scanned: [N files across M projects]
- Signals found: [N total] — [breakdown by type]
- Patterns identified: [N at medium+ confidence]
- Actions taken:
- Created: [N new protocols → list with repos]
- Groomed: [N existing protocols updated → list]
- Flagged: [N contradictions/surprises → list]
- Skipped: [N already-covered or too-narrow]
- Surprise finding: [the most unexpected thing]
- Biggest gap: [area with frustrations but no protocols]
- Recommended next harvest: [scoped suggestion for follow-up]
```
### Loop Decision
| Condition | Action |
|-----------|--------|
| Scan was scoped and rich veins unexplored | **Loop** — expand scope, return to SURVEY |
| Guides directory barely touched (common) | **Loop** — focused scan on guides |
| Contradictions need human judgment | **Escalate** — present findings, ask user |
| Good coverage, actions executed | **Done** — present Health Report |
---
## Composition
```
workspace-harvest
├── SURVEY ─── inventory sources, propose scope
├── SCAN ──── extract raw signals (reuses extract's signal taxonomy)
├── CLUSTER ── find patterns (reuses knowledge-summary-protocol's emergent taxonomy)
├── MATCH ──── search existing protocols (check before creating)
├── ACT ────── groom (refine) / create (format) / flag
└── REFLECT ── question results, loop or done
└── can loop back to any earlier phase
```
### Scheduling
- **On-demand**: "Harvest my workspace"
- **Post-session**: After a long work session, suggest: "Want me to harvest insights from this session?" (falls back to `@protocol/extract` if single-session)
- **Periodic**: Weekly or monthly, as part of continuous improvement
- **Triggered**: When the same correction appears 3+ times in recent sessions
---
## Example Flow
```
User: "Harvest my workspace — find my patterns"
→ SURVEY: 14 projects, 6 feedback files, 23 transcripts, 43 guides
"That's a lot. Focus on 3 active projects + last 30 days of transcripts?"
User: "Go for it"
→ SCAN: 47 signals extracted
- 12 corrections (metadata format, testing style, naming conventions)
- 8 preferences (commit style, response verbosity, PR approach)
- 15 rules (from CLAUDE.md files across projects)
- 7 procedures (from guides, partially overlapping)
- 3 frustrations ("I keep re-explaining the deploy process")
- 2 surprises (two projects have contradictory error handling rules)
→ CLUSTER: 11 pattern candidates
- "IDs are ashid, never UUID" — 4 signals, 2 sources, HIGH
- "Publish means push to API" — 3 signals, 2 sources, HIGH
- "Test sad paths, not just happy" — 3 signals, 1 source, MEDIUM
- "Deploy process" — 3 frustration signals, no existing protocol, GAP
...
→ MATCH:
- "IDs are ashid" → partial match with @<codebase-repo>/conventions → GROOM
- "Publish means push" → no match → CREATE in @protocol
- "Test sad paths" → partial match with @<codebase-repo>/testing → GROOM
- "Deploy process" → no match, frustration-driven → CREATE in @<codebase-repo>
- Error handling contradiction → FLAG for user
→ ACT:
Created: 2 new protocols
Groomed: 3 existing protocols (added triggers, bumped confidence)
Flagged: 1 contradiction
→ REFLECT:
Coverage: Good for active projects.
Surprise: Voice transcripts contain vision for "ownership protocol" — no match anywhere.
Gap: 31 of 43 guides haven't been checked against existing protocols.
Recommendation: Next harvest → focused guide-to-protocol ingestion pass.
```
---
*Related: `@protocol/groom-protocols` · `@content/youtube/liam-ottley/how-to-build-a-1-person-business-using-ai` · `@protocol/retro` · `@protocol/impulse-the-recurring-task` · `@protocol/context-tuning`*
---
*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).*