contextd: Agent for Claude Code

.claude/agents/contextd-context-selector.md

contextd-context-selector is an agent for Claude Code from philngt/contextd. It costs 43 tokens per session (422 once invoked), scanned A, original, MIT.

A context-reading adapter that loads the JSON record produced for the current coding task and summarizes its selected documents, rules, warnings, and missing information. The JSON record is authoritative; the Markdown version is only a readable rendering.

In plain words
What is it for?
Use it to read the current task context, verify its required structure, inspect referenced documents, and decide whether a task has enough guidance to proceed.
Why use it?
It gives older agent workflows a consistent way to use the newer context system without inventing their own document-selection rules. It can block work when required project knowledge is missing.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter; mentions subagents.

This is philngt/contextd's own configuration. It tells Claude Code how to work on contextd itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything contextd configures →

Reuse

Borrowing it

Nothing to install: this file belongs to philngt/contextd. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/philngt/contextd/main/.claude/agents/contextd-context-selector.md
Clone the repo
git clone --depth 1 https://github.com/philngt/contextd

Made for: Claude Code.

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 contextd-context-selector

README.md
[![agentmods](https://agentmods.dev/badge/agents/philngt/contextd/contextd-context-selector/github.svg)](https://agentmods.dev/agents/philngt/contextd/contextd-context-selector)
Your own site
<a href="https://agentmods.dev/agents/philngt/contextd/contextd-context-selector"><img src="https://agentmods.dev/badge/agents/philngt/contextd/contextd-context-selector/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for contextd-context-selector

Your own site · 80×15
<a href="https://agentmods.dev/agents/philngt/contextd/contextd-context-selector"><img src="https://agentmods.dev/badge/agents/philngt/contextd/contextd-context-selector.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 43 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 422 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00043 $0.00422
Opus 5.5 $0.00017 $0.00169
Sonnet 5.5 $0.00009 $0.00084
Haiku 4.5 $0.00004 $0.00042

Measured 1mo ago against content hash 9f98a52b0a35, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

contextd-context-selector 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 1mo 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.

.claude/agents/contextd-context-selector.md · 49 lines

What it actually says

Role

Bạn là adapter cho migration từ pipeline subagent cũ sang contextd CLI.

Canonical engine đã nằm trong:

contextd context "{user_task}" --format json

Command này tự resolve workspace, classify intent, retrieve/slice deterministic context, validate refs, emit JSON, render markdown, và materialize static context pack.

Inputs

Field Mô tả
project_dir Project root hiện tại
user_task Task gốc
artifact_path Optional, default {project_dir}/.contextd/context/current-task.json

Process

  1. Nếu artifact chưa tồn tại, yêu cầu caller chạy contextd context "{user_task}" --format json.
  2. Đọc .contextd/context/current-task.json.
  3. Verify shape tối thiểu:
    • artifact_type == "contextd_task_context.v1"
    • có workspace, intent, referenced_docs, gaps, warnings, contextPack, retrieval_policy, source_hashes
  4. Nếu cần markdown cho người đọc, dùng .contextd/context/current-task.md đã render từ JSON. Không patch tay vào markdown.
  5. Emit verdict:
    • BLOCK nếu artifact có blocking gaps về contract/pattern/domain workflow.
    • APPROVED nếu không có blocking gap.

Hard Rules

  • KHÔNG tự đọc workspace khác.
  • KHÔNG override referenced_docs bằng kết quả fuzzy search/RAG.
  • KHÔNG tạo context source of truth mới ngoài JSON artifact.

Compatibility

  • KHÔNG ghi .claude/context/current-task.md; legacy path đã deprecated.
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. 1mo ago First seen · 49 lines · 43 tokens per session scan A 9f98a52b0a35

Subscribe to this mod's changes

contextd-context-selector is an agent published in the GitHub repository philngt/contextd (29 stars, last pushed 2mo ago), licensed MIT. It adds 43 tokens to every session and 422 once invoked, about $0.0002 per session on Opus 5.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

gsd-mempalace-curator

Ship-time MemPalace curation — writes the session diary, proposes/creates cross-project tunnels, mirrors extract-learnings into the temporal KG, and runs wing-scoped drawer pruning. Spawned at ship:post by the mempalace capability.

open-gsd/gsd-core · 59 tokens

Plugin Tester

End-to-end plugin testing agent for OpenWebUI. Deploys plugins via scripts, tests them interactively via the VS Code built-in browser tools (Playwright-based), captures results, and self-learns from each session. Use when verifying plugin behavior, debugging UI output, or running regression checks.

Fu-Jie/openwebui-extensions · 63 tokens

Release Prep

Finalizes version bumps, creates standalone version docs, and drafts bilingual commit messages. Only triggered by Orchestrator or Coordinator when user says "发布" / "release" / "commit". Never commits or pushes without explicit approval.

Fu-Jie/openwebui-extensions · 49 tokens

Doc Writer

Handles all documentation for plugin changes in parallel with code implementation. Updates README, READMECN, docs mirrors, and standalone version files.

Fu-Jie/openwebui-extensions · 29 tokens

Plugin Implementer

Implement plugin code changes in parallel with Doc Writer. Follows the approved plan with strict project standards. No sequential handoffs.

Fu-Jie/openwebui-extensions · 29 tokens

context-curator

Curates a minimal deterministic CIGAR context bundle and explains why each included source is relevant.

hashgraph-online/hol-cigar · 23 tokens