Purpose: Extract knowledge from AI summaries → permanent context, then clean workspace
Last Updated: 2026-01-06
AI agents create summary files (OVERVIEW.md, SESSION-*.md, SUMMARY.md) that contain valuable knowledge but clutter the workspace. These files "plague" the codebase.
Solution: Harvest the knowledge → permanent context, then delete the summaries.
Harvest automatically detects these patterns:
Filename patterns:
Location patterns:
Action: Find all summary files in workspace
Process:
Output: List of candidate files
Example:
Found 3 summary documents:
1. CONTEXT-SYSTEM-OVERVIEW.md (4.2 KB, modified 1 hour ago)
2. SESSION-auth-work.md (1.8 KB, modified today)
3. .tmp/IMPLEMENTATION-NOTES.md (800 bytes, modified today)
Action: Categorize content by function
Mapping Rules:
| Content Type | Target Folder | How to Identify |
|--------------|---------------|-----------------|
| Design decisions | concepts/ | "We decided to...", "Architecture", "Pattern" |
| Solutions/patterns | examples/ | Code snippets, "Here's how we..." |
| Workflows | guides/ | Numbered steps, "How to...", "Setup" |
| Errors encountered | errors/ | Error messages, "Fixed issue", "Gotcha" |
| Reference data | lookup/ | Tables, lists, paths, commands |
Process:
Output: Categorized items with letter IDs
Action: Present approval UI with letter-based selection
ALWAYS show approval UI before extracting/deleting. NEVER auto-harvest without user confirmation.
Format:
### CONTEXT-SYSTEM-OVERVIEW.md (4.2 KB)
✓ [A] Design: Function-based context organization
→ Would add to: core/concepts/context-organization.md
Preview: "Organize by function (concepts/, examples/...)..."
✓ [B] Pattern: Minimal Viable Information
→ Would add to: core/concepts/mvi-principle.md
Preview: "Extract core only (1-3 sentences), 3-5 key points..."
✓ [C] Workflow: Harvesting summary documents
→ Would create: core/guides/harvesting.md
Preview: "Scan for summaries → Extract → Approve → Delete"
✗ [D] Skip: Planning discussion notes (temporary knowledge)
---
### SESSION-auth-work.md (1.8 KB)
✓ [E] Error: JWT token expiration not handled
→ Would add to: development/errors/auth-errors.md
Preview: "Symptom: 401 after 1 hour. Cause: No refresh flow..."
✓ [F] Example: JWT refresh token implementation
→ Would create: development/examples/jwt-refresh.md
Preview: "Store refresh token → Check expiry → Request new..."
---
### .tmp/IMPLEMENTATION-NOTES.md (800 bytes)
✗ [G] Skip: Duplicate info (already in development/concepts/api-design.md)
---
**Quick options**:
- Type 'A B C E F' - Approve specific items
- Type 'all' - Approve all ✓ items (A B C E F)
- Type 'none' - Skip harvesting, delete files anyway
- Type 'cancel' - Keep files, don't harvest
Validation:
Output: List of approved items
Action: Extract and minimize approved items
Apply MVI to all extracted content:
Process:
Output: List of created/updated files
Action: Archive or delete source summary files
Default Strategy: Archive (safe)
.tmp/archive/harvested/{date}/Alternative: Delete (if user specified)
ONLY cleanup files that had content successfully harvested. If extraction failed, keep the original file.
Output: Cleanup report
Action: Show comprehensive results summary
Format:
✅ Harvested 5 items into permanent context:
- Added to core/concepts/context-organization.md
- Added to core/concepts/mvi-principle.md
- Created core/guides/harvesting.md
- Added to development/errors/auth-errors.md
- Created development/examples/jwt-refresh.md
🗑️ Cleaned up workspace:
- Archived: CONTEXT-SYSTEM-OVERVIEW.md → .tmp/archive/harvested/2026-01-06/
- Archived: SESSION-auth-work.md → .tmp/archive/harvested/2026-01-06/
- Deleted: .tmp/IMPLEMENTATION-NOTES.md (no valuable content)
📊 Updated navigation maps:
- .opencode/context/core/navigation.md
- .opencode/context/development/navigation.md
💾 Disk space freed: 6.8 KB
/context harvest
/context harvest .tmp/
/context harvest docs/sessions/
/context harvest OVERVIEW.md
/context harvest SESSION-2026-01-06.md
After harvest operation: