self-care/context-refiner

self-care/context-refiner is an agent for coding agents from Not-Diamond/self-care. It costs 5 tokens per session (1,606 once invoked), scanned A, original, MIT.

An agent that proposes or applies edits to project files to fix problems found in Self-Care agent traces. It can target system prompts, tool descriptions, and other context documents.

In plain words
What is it for?
Use preview mode to inspect exact proposed changes, then use apply mode to make approved edits for supported cases such as unclear instructions, missing context, or instruction-following problems.
Why use it?
It turns diagnosed agent problems into reviewable file changes and separates previewing proposed edits from applying approved ones.

Agent

Part of the self-care plugin — 12 commands, 2 agents shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/not-diamond/self-care/context-refiner
Clone the repo
git clone --depth 1 https://github.com/Not-Diamond/self-care

Or install self-care, the plugin that ships this one along with the rest of its 12 commands, 2 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for self-care/context-refiner

README.md
[![agentmods](https://agentmods.dev/badge/agents/not-diamond/self-care/context-refiner.svg)](https://agentmods.dev/agents/not-diamond/self-care/context-refiner)
Your own site
<a href="https://agentmods.dev/agents/not-diamond/self-care/context-refiner"><img src="https://agentmods.dev/badge/agents/not-diamond/self-care/context-refiner.svg" alt="Measured on agentmods" height="20"></a>
Per session 5 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,606 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00005 $0.01606
Opus 5 $0.00003 $0.00803
Sonnet 5 $0.00001 $0.00321
Haiku 4.5 $0.00001 $0.00161

Measured 4d ago against content hash 0c4aa9e527df, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

self-care/context-refiner scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agents/context-refiner.md · 190 lines

How it starts

The opening of the file, as written. The whole thing — 190 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Context Refiner

You are a context remediation agent for the Self-Care plugin. Your job is to propose and apply fixes for agent cases by editing project files — system prompts, tool descriptions, and context documents.

Modes

You operate in one of two modes, specified in your input:

Mode: preview

Discover files and compute exact diffs for each event, but do not apply any edits. Return structured JSON with the proposed changes so the user can review them before approval.

Mode: apply

Apply pre-approved diffs that were computed in a previous preview run. The input includes the exact file paths and edit specifications — just apply them.

Input

For preview mode, you receive:

  • Trace file path (for memory logging)
  • List of auto-fixable cases, each with:
    • Type (one of the 14 case types below)
    • Severity (low, medium, high)
    • Description and evidence
    • proposedFix (the recommended fix from analysis)

For apply mode, you receive:

  • Trace file path (for memory logging)
  • List of approved diffs, each with:
    • Event reference (type, severity)
    • file_path
    • old_string
    • new_string

Case Types

Type Description Typical Remediation
grounding Claims without evidence in context, or user-specific data stated before retrieval Add factual context, data sources, verification instructions, or "retrieve before responding" rules
missed-action Failure to act on clear instructions Add explicit action triggers, checklist items
instruction-following Not following explicit instructions Strengthen instruction language, add examples, clarify edge cases
context-utilization Missing available context Add "always check X before Y" instructions, reference patterns
goal-drift Straying from original objectives Add goal anchoring, "stay focused on" reminders, scope boundaries
persona-adherence Breaking expected behavior patterns Clarify persona constraints, add behavior guidelines
reasoning-action-mismatch Inconsistency between stated intent and actions Add "verify action matches intent" checks, alignment instructions
step-repetition Redundant repeated actions Add "track completed steps" instructions, deduplication guidance
tool-failure Unhandled tool errors Add error handling instructions, fallback procedures, retry guidance
premature-termination Agent stops before completing the task Add "complete all steps before responding" instructions, checklist enforcement
contradictory-instructions Instructions conflict with each other Resolve instruction conflicts, add priority rules, clarify precedence
missing-context Context is irrelevant or insufficient Add required context documents, improve retrieval, add "request clarification" rules
ambiguous-instructions Instructions are exploitably underspecified Add specificity to instructions, add edge-case examples, define default behaviors
guardrail-violation Agent violates safety boundaries Strengthen safety constraints, add explicit boundary statements, add policy enforcement rules

Read the full file on GitHub · 190 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 190 lines · 5 tokens per session scan A 0c4aa9e527df

Subscribe to this mod's changes

self-care/context-refiner is an agent published in the GitHub repository Not-Diamond/self-care (28 stars, last pushed 4mo ago), licensed MIT. It adds 5 tokens to every session and 1,606 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other agents, from other repositories

playwright-test-generator

Use this agent to convert a SigNoz E2E test plan into Playwright spec files under tests/e2e/tests/ /. Examples — Context: A test plan exists and needs to be turned into runnable specs. user: 'Generate the dashboards list specs from the plan in tests/e2e/specs/dashboards-list-test-plan.md' assistant: 'Using the…

SigNoz/signoz · 0 tokens

playwright-test-healer

Use this agent to debug and fix failing SigNoz E2E Playwright tests. Examples — Context: A spec is red. user: 'tests/e2e/tests/dashboards/list.spec.ts is failing, fix it' assistant: 'Using the healer agent to debug each failing scenario and adjust the spec.' Context: After a frontend change a previously-green spec…

SigNoz/signoz · 0 tokens

playwright-test-planner

Use this agent to create a comprehensive E2E test plan for a SigNoz frontend feature. Examples — Context: A new feature has shipped and we need test coverage. user: 'Plan E2E tests for the alerts list page' assistant: 'I'll use the planner agent to read the relevant frontend source, navigate the page in a real…

SigNoz/signoz · 0 tokens

docs-architecture-reviewer

Use this agent when you need to review, create, or update technical documentation, architecture decisions, or design patterns for the AgentSight project. Examples: Context: User has just implemented a new eBPF analyzer and wants to ensure the documentation is complete and accurate. user: 'I've added a new HTTP request…

eunomia-bpf/agentsight · 0 tokens

frontend-visualization-expert

Use this agent when working on frontend visualization components, real-time event display systems, timeline interfaces, process tree visualizations, or embedded web server integration. Examples: Context: User is implementing a new timeline component for displaying SSL events. user: 'I need to create a timeline…

eunomia-bpf/agentsight · 0 tokens

integration-testing-orchestrator

Use this agent when you need to coordinate end-to-end testing across multiple components, optimize build systems, validate deployments, or ensure proper integration between eBPF programs, Rust collector, and frontend components. Examples: Context: User has made changes to both eBPF programs and Rust collector and…

eunomia-bpf/agentsight · 0 tokens