Skip to main content
Glama

memory_harvest

Extract decisions, bugs, conventions, learnings, and context from Claude Code session transcripts to build tagged memories; preview candidates with dry_run before storing.

Instructions

Extract learnings from Claude Code session transcripts.

USE THIS WHEN:

  • End of session — auto-capture decisions, bugs, conventions, learnings

  • User asks to "harvest" or "extract learnings" from sessions

  • Building knowledge base from past sessions

MODES:

  • dry_run=true (DEFAULT): Preview candidates without storing

  • dry_run=false: Store candidates as tagged memories

MEMORY TYPES EXTRACTED:

  • decision: Architectural choices, tool selections

  • bug: Issues encountered and root causes

  • convention: Patterns/rules established

  • learning: Insights, mistakes learned from

  • context: Session state for continuity

LLM CLASSIFICATION (Phase 2):

  • use_llm=true: Validate candidates with Groq LLM (higher precision, ~$0.001/candidate)

  • Filters conversation fragments, deduplicates, refines content

  • Requires GROQ_API_KEY environment variable

Examples: {"sessions": 1, "dry_run": true} {"sessions": 3, "types": ["decision", "bug"]} {"session_ids": ["abc123"], "dry_run": false} {"min_confidence": 0.7, "sessions": 1} {"sessions": 1, "use_llm": true, "dry_run": true}

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "memory_harvest"
  }
}

Input Schema

NameRequiredDescriptionDefault
typesNoFilter by memory types (default: all)
dry_runNoPreview candidates without storing (default: true)
use_llmNoUse LLM to validate and refine candidates (requires GROQ_API_KEY)
agent_idNoAgent ID for auto_commit attribution (default: MCP_AGENT_ID env or 'unknown')
sessionsNoNumber of recent sessions to harvest
auto_commitNoBridge harvested candidates to commit_session_legacy (feeds bootstrap profile)
session_idsNoSpecific session IDs to harvest
project_pathNoOverride Claude Code project directory path
min_confidenceNoMinimum confidence threshold (0.0-1.0)
force_reharvestNoRe-harvest sessions already recorded in the harvest tracker (bypasses the tracker filter). Use to re-process sessions whose prior run stored nothing.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.0.1

TDQS

A4.3/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations only declare destructiveHint=false, so the description carries the rest and does so well: it discloses that dry_run defaults to true and stores nothing, that dry_run=false persists memories, that use_llm incurs roughly $0.001 per candidate and requires GROQ_API_KEY, and that force_reharvest bypasses the harvest tracker. The disclosed write path is additive, consistent with destructiveHint=false.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded purpose followed by scannable labeled sections and five compact JSON examples; every block maps to a decision the caller must make. A few lines restate schema defaults (dry_run default true appears in both the MODES block and the example set), which is mild redundancy but not noise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a ten-parameter, zero-required tool with no output schema, the description covers the decision surface an agent needs: default safety mode, type taxonomy, LLM validation cost and credential requirement, and example invocations. Only the auto_commit bridging to commit_session_legacy is left to the schema, which is a minor omission rather than a blocking gap.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is already 100%, so the baseline is 3; the description adds genuine meaning on top by explaining what the types enum values mean, the cost and environment prerequisite behind use_llm, and how min_confidence and sessions behave in practice via worked examples. It leaves auto_commit, agent_id, and project_path to the schema alone.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The opening line names a specific verb and resource ("Extract learnings from Claude Code session transcripts") and the MEMORY TYPES section enumerates exactly what it produces (decision, bug, convention, learning, context). Usage examples make the unit of work unambiguous. It stops short of a 5 because it never contrasts itself with adjacent tools like memory_ingest or memory_store_session.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

An explicit "USE THIS WHEN" block gives three concrete triggers (end of session, user says "harvest", building a knowledge base), and the MODES section clarifies the preview-vs-store distinction. There is no explicit "do not use when" or named alternative tool, which is the only thing separating it from a top score.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.