docs/tools/memory/productivity-context-pruner
AgenticMemoryProductivity

Context Pruner

CLI Tool Name: context_pruner

Scores each context item (like file paths or retrieved data sets) by calculating keyword overlap with your active task description. Operates using purely CPU compute without any file reads or network overhead to preserve your agent's context limits cleanly. Items with zero overlap are universally dropped.

Parameters

ParameterTypeRequiredDescription
task_descriptionstringyesThe current goal to check against.
itemsstring[]yesArray of file paths or text blocks to be scored.
keep_top_nnumbernoLimit the 'keep' array output length. (Default 10)
verbosebooleannoExposes per-item scores and matched keywords inside the result when true.

Example output

json
{
  "recommendations": {
    "keep": [
      { "item": "src/features/auth/login.tsx", "score": 8, "matched_keywords": ["auth", "login"] }
    ],
    "drop": [
      { "item": "src/utils/math.ts", "score": 0, "matched_keywords": [] }
    ]
  },
  "metrics": {
    "total_evaluated": 2,
    "kept_count": 1,
    "dropped_count": 1
  }
}

How to use it

example prompt

Filter this list of 50 files based on my current task: "Migrate the database ORM schema to Drizzle". Keep the top 5.