This prompt is for agent developers and infrastructure engineers who need a deterministic, explainable scoring layer between agent observation and memory persistence. The core job-to-be-done is ranking memory entries by importance before storing them in a shared memory store or before evicting entries when context windows are full. It scores each memory entry across three dimensions—task relevance, recency, and uniqueness—and produces a ranked list with scores and rationale. The output is used to decide what to keep, what to compress, and what to discard, making it a critical component in any multi-agent system where shared state consistency and context budget management are operational concerns.
Prompt
Agent Memory Importance Scoring Prompt

When to Use This Prompt
Understand the job-to-be-done, ideal user, required context, and when not to use the Agent Memory Importance Scoring Prompt.
Use this prompt when you are building a memory write pipeline and need to assign importance scores before committing entries to a persistent or shared store. It is also appropriate as a pre-eviction scoring step when context windows are full and you need to decide which entries to drop or summarize. The prompt expects structured input: a list of memory entries, each with a timestamp, content, and optional source agent identifier. You should also provide the current task context so the model can assess task relevance accurately. The output is a JSON array of scored entries, each with a composite importance score and a breakdown of the three dimension scores plus a short rationale string. This structure makes the output machine-readable for downstream automation, such as threshold-based filtering or weighted insertion into a vector store.
Do not use this prompt for real-time retrieval ranking. That is a different problem with different latency and scoring requirements; use the Agent Memory Read with Recency and Relevance Scoring prompt instead. Also avoid this prompt when the memory entries require subjective or ethical judgment beyond task utility—importance scoring here is operational, not normative. If your system operates in a regulated domain where retention or deletion decisions have compliance implications, always add a human review step after scoring and before any destructive action. Finally, do not use this prompt as a substitute for proper context window budget allocation; pair it with the Agent Context Window Budget Allocation Prompt for a complete memory management strategy.
Use Case Fit
Where the Agent Memory Importance Scoring Prompt works and where it introduces risk. Use these cards to decide if this prompt fits your architecture before wiring it into a production agent loop.
Good Fit: Context Window Budgeting
Use when: You need to evict low-value entries from agent working memory to stay within token limits. Guardrail: Pair the importance score with a hard eviction policy in application code; never rely on the model alone to decide what to drop.
Good Fit: Long-Term Memory Consolidation
Use when: Selecting which episodic memories to persist beyond the current session. Guardrail: Require a minimum importance threshold before any entry is written to long-term storage, and log all promotion decisions for audit.
Bad Fit: Sole Arbiter of Factual Truth
Avoid when: The score is used to discard memories that might later become critical evidence. Risk: Importance scoring is a heuristic, not a truth oracle. A low-scored fact today may be the key to resolving a contradiction tomorrow.
Required Inputs: Structured Memory Payloads
Risk: Scoring quality collapses when memory entries lack timestamps, source provenance, or task context. Guardrail: Validate that every memory entry passed to the scorer includes timestamp, source_agent_id, and task_id fields before invocation.
Operational Risk: Scoring Drift Over Sessions
Risk: The model's importance criteria can shift subtly across sessions, causing inconsistent retention policies. Guardrail: Run a weekly eval of scoring consistency against a fixed golden set of memory entries and alert on distribution drift.
Operational Risk: Recency Bias Overwhelming Relevance
Risk: The prompt may overweight recency and starve older, high-relevance memories needed for long-running tasks. Guardrail: Apply a configurable recency decay weight in application logic after scoring, rather than baking it into the prompt alone.
Copy-Ready Prompt Template
A reusable prompt for scoring agent memory entries by importance, ready to copy into your agent's memory management step.
This prompt template is designed to be inserted into your agent's memory scoring pipeline. It takes a batch of memory entries and ranks them by importance across three dimensions: task relevance, recency, and uniqueness. The output is a structured JSON array with scores and justifications, enabling your agent to decide what to retain, what to evict, and what to prioritize during retrieval. Copy the template below and replace the square-bracket placeholders with your application's specific values.
textYou are a memory importance scorer for an autonomous agent system. Your job is to evaluate a set of memory entries and assign each an importance score based on three dimensions: task relevance, recency, and uniqueness. You must return a structured JSON array with scores and brief justifications for each entry. ## INPUT Memory entries to score: [MEMORY_ENTRIES] Current agent task or goal: [CURRENT_TASK] Active session context (optional): [SESSION_CONTEXT] ## SCORING DIMENSIONS For each memory entry, assign a score from 0.0 to 1.0 on each dimension: 1. **Task Relevance**: How directly does this memory support the current task? 1.0 means essential for task completion; 0.0 means completely unrelated. 2. **Recency**: How recently was this memory created or last accessed? 1.0 means within the current session; 0.0 means older than [RECENCY_THRESHOLD_HOURS] hours. 3. **Uniqueness**: How distinct is this memory from other entries? 1.0 means contains information not found elsewhere; 0.0 means fully redundant with other entries. ## OUTPUT SCHEMA Return a JSON object with a single key "scored_entries" containing an array of objects: { "scored_entries": [ { "entry_id": "string", "task_relevance_score": 0.0, "recency_score": 0.0, "uniqueness_score": 0.0, "composite_score": 0.0, "importance_rationale": "Brief explanation of why this score was assigned, max 2 sentences.", "retention_recommendation": "keep" | "evict" | "archive" } ] } ## COMPOSITE SCORE CALCULATION composite_score = (task_relevance_score * [TASK_WEIGHT]) + (recency_score * [RECENCY_WEIGHT]) + (uniqueness_score * [UNIQUENESS_WEIGHT]) Weights must sum to 1.0. Default weights: task=0.5, recency=0.3, uniqueness=0.2. ## RETENTION RULES - "keep": composite_score >= [KEEP_THRESHOLD] - "archive": composite_score >= [ARCHIVE_THRESHOLD] AND composite_score < [KEEP_THRESHOLD] - "evict": composite_score < [ARCHIVE_THRESHOLD] ## CONSTRAINTS - Do not invent information not present in the memory entries. - If [SESSION_CONTEXT] is empty, rely only on [CURRENT_TASK] for relevance. - If two entries are near-duplicates, assign the lower uniqueness score to the older entry. - Return ONLY valid JSON. No markdown fences, no commentary outside the JSON object. - If [MEMORY_ENTRIES] is empty, return {"scored_entries": []}.
To adapt this prompt for your system, replace the placeholders with concrete values. [MEMORY_ENTRIES] should be a JSON array of memory objects, each with at least an entry_id, content, and timestamp. [CURRENT_TASK] is a string describing the agent's active goal. [SESSION_CONTEXT] can be an empty object if unavailable. The weight parameters [TASK_WEIGHT], [RECENCY_WEIGHT], and [UNIQUENESS_WEIGHT] let you tune the scoring for your domain—for example, a research agent might weight uniqueness higher, while a customer support agent might prioritize recency. The thresholds [KEEP_THRESHOLD] and [ARCHIVE_THRESHOLD] control retention decisions; start with 0.6 and 0.3 respectively and adjust based on your memory budget and observed retrieval quality.
Before deploying, validate the output against the schema. A common failure mode is the model returning a flat list instead of the scored_entries wrapper object—add a post-processing check that rejects outputs missing this key. Another failure mode is inconsistent composite scores that don't match the stated formula; consider adding a validation step that recomputes the composite and flags entries where the model's math deviates by more than 0.05. For high-stakes memory systems where eviction is irreversible, route entries scored near the threshold boundary to a human review queue or a secondary LLM judge before deletion.
Prompt Variables
Required inputs for the Agent Memory Importance Scoring Prompt. Each placeholder must be populated before the prompt is assembled and sent to the model. Validation notes describe how to check the input at runtime before scoring begins.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[MEMORY_ENTRIES] | Array of memory objects to score. Each entry must include an id, content, timestamp, and optional source agent. | [{"id":"mem-42","content":"User prefers dark mode","timestamp":"2025-01-15T14:30:00Z","source":"ui-agent"}] | Validate array length > 0. Each object must have id (string), content (non-empty string), timestamp (ISO 8601). Reject if any entry is missing required keys. |
[CURRENT_TASK] | Description of the active task or goal the agent is pursuing. Used to compute task relevance dimension. | "Refactor authentication module to support OAuth2 flows" | Must be a non-empty string. If null or empty, task relevance scoring dimension should be skipped or weighted to zero. Log warning if missing. |
[RECENCY_WINDOW_HOURS] | Time window in hours that defines recency boundary. Entries within this window receive higher recency scores. | 24 | Must be a positive integer or float. Default to 24 if not provided. Reject values <= 0. Cap at 8760 (1 year) to prevent unbounded recency windows. |
[UNIQUENESS_THRESHOLD] | Cosine similarity threshold above which two entries are considered semantically duplicate for uniqueness scoring. | 0.85 | Must be a float between 0.0 and 1.0. Default to 0.85 if not provided. Values below 0.5 produce noisy uniqueness signals; log warning. |
[SCORING_DIMENSIONS] | Ordered list of dimensions to score: task_relevance, recency, uniqueness. Controls which scores appear in output. | ["task_relevance","recency","uniqueness"] | Must be a non-empty array of strings from allowed set: task_relevance, recency, uniqueness. Reject unknown dimension names. If task_relevance is included, [CURRENT_TASK] must be non-empty. |
[OUTPUT_SCHEMA] | JSON schema the scored output must conform to. Defines required fields, types, and score ranges. | {"type":"object","properties":{"entry_id":{"type":"string"},"scores":{"type":"object"},"rationale":{"type":"string"}},"required":["entry_id","scores","rationale"]} | Must be a valid JSON Schema object. Parse and validate schema before prompt assembly. Reject if schema is malformed or missing required field definitions. |
[MAX_ENTRIES_PER_BATCH] | Maximum number of memory entries to score in a single model call. Controls batch size for cost and latency. | 50 | Must be a positive integer. Default to 50. Reject values > 500 to prevent context window overflow. If [MEMORY_ENTRIES] length exceeds this, split into multiple batches. |
Implementation Harness Notes
How to wire the importance scoring prompt into an agent memory pipeline with validation, retries, and observability.
The importance scoring prompt is not a standalone utility—it is a pipeline component that runs every time a new memory entry is written or an existing entry is re-evaluated. In a production multi-agent system, this prompt should be triggered automatically by the memory write path: when an agent calls write_memory or the blackboard system records a new observation, the entry is queued for scoring before it receives a retention priority and TTL. The scoring output determines where the entry lands in the retrieval index, whether it displaces lower-scored entries under budget pressure, and how aggressively it is consolidated during long-term memory compaction runs.
Wire the prompt into an async scoring worker that pulls unscored entries from a queue, calls the model with the prompt template, and writes the scored result back to the memory store. The worker must enforce a schema contract: the model output must parse into a JSON object with importance_score (0.0–1.0 float), dimensions (an object with task_relevance, recency, and uniqueness sub-scores), and rationale (a short string). Use a strict JSON mode or structured output API if available. If the model returns unparseable output, apply a repair prompt that feeds the raw output and the expected schema back to the model for correction. After two repair attempts, log the failure, assign a default low score (0.1), and flag the entry for human review if the memory store is in a regulated or high-stakes domain.
Validation checks should run post-parse: confirm that importance_score is a weighted combination of the dimension sub-scores (within a 0.1 tolerance), that no sub-score exceeds 1.0, and that the rationale is non-empty and references the actual memory content rather than a generic template. For evaluation, maintain a golden set of 50–100 memory entries with human-annotated importance scores across your three dimensions. Run the prompt against this set on every prompt version change and flag regressions where the mean absolute error exceeds 0.15 or where task-relevant entries are scored below 0.3. Log every scoring call with the memory entry ID, model version, prompt version, raw score, and validation pass/fail status to your observability pipeline. This trace data is essential for debugging retrieval failures—when an agent misses critical context, you can check whether the entry was scored too low and adjust the prompt or dimension weights accordingly.
Model choice matters for this workload. The prompt requires consistent numeric judgment across diverse memory types (facts, observations, plans, user preferences), so prefer models with strong instruction-following and calibration. Smaller models often drift toward mid-range scores (0.4–0.6) for everything, which defeats the purpose of importance-based retention. If you observe score compression, add few-shot examples to the prompt that demonstrate clear score separation across the full 0.0–1.0 range. For high-throughput systems, consider batching unscored entries into a single call with a structured array output to reduce API overhead, but keep batch sizes under 20 entries to avoid attention dilution. Do not use this prompt for real-time retrieval scoring—that requires a separate, lighter-weight relevance prompt optimized for latency, not the multi-dimensional importance analysis this prompt provides.
Expected Output Contract
Define the exact fields, types, and validation rules the prompt must return. Use this contract to build a parser, write eval assertions, and detect malformed outputs before they enter the agent memory store.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
memory_id | string (UUID) | Must match the input [MEMORY_ID] exactly; reject if missing or altered | |
importance_score | number (0.0–1.0) | Must be a float within [0.0, 1.0]; reject if out of range or non-numeric | |
score_dimensions | object | Must contain keys: task_relevance, recency, uniqueness; each value must be a float in [0.0, 1.0] | |
importance_rationale | string (≤280 chars) | Must be non-empty and ≤280 characters; reject if blank or exceeds limit | |
retention_priority | string (enum) | Must be one of: critical, high, medium, low, ephemeral; reject unknown values | |
ttl_seconds | integer or null | If present, must be a positive integer ≥60; null allowed for persistent entries | |
conflicting_memory_ids | array of strings | If present, each element must be a valid UUID string; empty array allowed | |
source_attribution | object | Must contain agent_id (string) and timestamp (ISO 8601); reject if either is missing or malformed |
Common Failure Modes
Agent memory importance scoring fails in predictable ways. These cards cover the most common failure modes, why they happen, and how to guard against them before they reach production.
Recency Bias Overwhelms Relevance
What to watch: The scorer assigns high importance to recent but trivial entries while ignoring older, task-critical context. This happens when recency weights dominate the scoring formula or when the prompt lacks explicit trade-off instructions. Guardrail: Include explicit weighting guidance in the prompt (e.g., 'Task relevance should outweigh recency when the older entry is directly referenced in the current goal'). Validate with test cases that pair a recent irrelevant entry against an older critical one.
Uniform Scoring Collapse
What to watch: All memory entries receive similar importance scores, making the ranking useless for retention or retrieval prioritization. This often occurs when the prompt lacks discrimination criteria or when the model defaults to safe, middling scores. Guardrail: Require the prompt to produce a spread of scores with explicit differentiation rules. Add a post-processing check that rejects outputs where score variance falls below a threshold. Include few-shot examples showing clear score separation with justification.
Task Misalignment Drift
What to watch: The scorer evaluates memory importance against a generic or outdated understanding of the agent's task rather than the current goal. Scores become irrelevant when the task context shifts mid-session. Guardrail: Always inject the current task description and active goal into the scoring prompt as a required [CURRENT_TASK] variable. Validate scoring consistency by running the same memory set against different task contexts and confirming score changes align with task relevance.
Uniqueness Dimension Underweighted
What to watch: Redundant or near-duplicate memory entries all receive high scores because each individually appears relevant. The scorer fails to discount entries that add no new information. Guardrail: Add explicit uniqueness criteria to the prompt: 'If multiple entries convey the same fact, score only the most complete or authoritative version highly; discount duplicates.' Include deduplication test cases where identical facts appear in different entries and verify score suppression.
Rationale Hallucination
What to watch: The scorer produces plausible-sounding but factually incorrect justifications for importance scores, citing relationships or task connections that don't exist in the provided context. Guardrail: Require that every rationale sentence be traceable to either the memory entry content or the task description. Add an eval step that extracts rationale claims and checks them against the source material. Flag scores where the rationale references entities or events not present in the input.
Score Inconsistency Across Batches
What to watch: The same memory entry receives different importance scores when scored in different batches or alongside different neighboring entries. This breaks downstream systems that rely on stable scores for retention decisions. Guardrail: Implement score calibration by including anchor examples with known expected scores in each batch. Test by scoring the same entry in isolation and within varied batches, measuring score stability. Add a consistency threshold that triggers re-scoring or human review when variance exceeds acceptable limits.
Evaluation Rubric
Use this rubric to evaluate the quality and consistency of scored memory entries before integrating the prompt into a production agent loop. Each criterion targets a specific failure mode observed in importance scoring prompts.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Score Range Compliance | Every entry has an importance_score between 0.0 and 1.0 inclusive | Scores outside 0.0-1.0 range or non-numeric values present | Parse output and assert all scores are floats within [0.0, 1.0] |
Dimension Completeness | Every scored entry includes task_relevance, recency, and uniqueness sub-scores | Missing one or more dimension sub-scores in any entry | Schema validation: check for required keys in each entry object |
Rationale Presence | Every entry includes a non-empty importance_rationale string of at least 20 characters | Empty, null, or placeholder rationale strings like 'N/A' or 'important' | String length check and regex for placeholder patterns |
Task Alignment Consistency | Entries directly related to the current task goal receive higher task_relevance scores than unrelated entries | Unrelated entries scored higher than clearly task-relevant entries | Golden dataset test: provide 5 entries with known task relevance and verify score ordering |
Recency Weighting Logic | More recent entries receive higher recency scores than older entries with similar content | Older entries scored higher than newer entries with comparable relevance | Temporal ordering test: provide timestamped entries and verify recency score monotonicity |
Uniqueness Differentiation | Entries with distinct content receive higher uniqueness scores than near-duplicate entries | Near-duplicate entries scored identically to unique entries on uniqueness dimension | Duplicate pair test: insert two semantically similar entries and verify uniqueness score gap exceeds 0.3 |
Output Schema Integrity | Output is valid JSON matching the expected array-of-objects schema with all required fields | Malformed JSON, missing array wrapper, or extra unexpected fields | JSON.parse validation followed by JSON Schema assertion against expected output contract |
Scoring Consistency Across Runs | Same input produces scores within 0.15 variance across 3 repeated runs | Score variance exceeds 0.15 for the same entry across runs | Repeatability test: run prompt 3 times with identical input and measure max score deviation per entry |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Start with the base prompt and a simple JSON schema for the output. Use a frontier model (GPT-4o, Claude 3.5 Sonnet) with temperature 0.2. Skip the multi-pass validation and just check that you get valid JSON with the required fields (memory_id, importance_score, rationale). Run 10-20 diverse memories through it and spot-check the scores.
Prompt modification
Add to the end of the base prompt: Return ONLY a JSON array of objects with keys: memory_id, importance_score (0.0-1.0), rationale (string).
Watch for
- Scores clustering at 0.7-0.9 without meaningful differentiation
- Rationale that repeats the memory content instead of explaining the score
- Missing
recencyoruniquenessdimensions in the rationale when they clearly apply

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us