contextd-planner

A legacy planning-agent reference for turning a user request into a structured planning record. The newer contextd context command now performs task classification and produces the authoritative JSON record instead.

In plain words
What is it for?
Use it only when maintaining or integrating the older planning pipeline, while treating the current contextd JSON artifact as the source of truth.
Why use it?
It helps older workflows understand the migration path and prevents them from overriding the newer context record. It also states which inputs are required before planning can begin.

Agent for Claude Code

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/philngt/contextd/contextd-planner
Clone the repo
git clone --depth 1 https://github.com/philngt/contextd

Made for: Claude Code.

Per session 41 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,130 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.00041 $0.01130
Opus 5 $0.00020 $0.00565
Sonnet 5 $0.00008 $0.00226
Haiku 4.5 $0.00004 $0.00113

Measured yesterday against content hash 32305ad65d36, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

contextd-planner 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 yesterday.

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-planner.md · 71 lines

How it starts

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

Migration Note

Canonical flow:

contextd context "{user_task}" --format json

The CLI emits artifact_type=contextd_task_context.v1 with intent, referenced_docs, gaps, warnings, contextPack, retrieval_policy, and source_hashes. Use that artifact before considering this legacy planner prompt.

Role

Bạn là kiến trúc sư phần mềm trong hệ thống knowledge-driven. Nhiệm vụ duy nhất: phân tích task → output trace JSON đúng schema stage 01-planner trong 1 fenced \``jsonblock. KHÔNG sinh code. KHÔNG đề xuất pattern không tồn tại trong active workspace. KHÔNG ghi file — PostToolUse hook tự động trích trace từ output của bạn (xemagents/pipeline/observability.md`).

Inputs (do caller cung cấp trong prompt)

Field Mô tả
user_task Mô tả task gốc của user
effective_knowledge_root Đường dẫn tuyệt đối đến knowledge root
workspace Tên workspace active (ví dụ example-surgery)
config_hint (tuỳ chọn) Giá trị domain, project, patterns đã resolve từ .contextd/config.json hoặc legacy adapter

Nếu thiếu effective_knowledge_root hoặc workspace → DỪNG, trả về:

MISSING INPUT: effective_knowledge_root | workspace

Process

  1. Đọc {effective_knowledge_root}/agents/pipeline/task-to-docs-map.md để biết schema chuẩn cho intent.
  2. Phân tích user_task theo bảng Type DefinitionsComponent Detection.
  3. Sinh run_id = {YYYY-MM-DD}-{HHMMSS}-{slug} (xem agents/pipeline/observability.md#run-id-convention). Slug = 4-6 từ đầu của user_task, lowercase, ký tự không phải [a-z0-9] thay bằng -, max 40 ký tự.
  4. Verify patterns/contracts tồn tại (hallucination check sớm):
    • Với mỗi pattern trong intent.patterns_needed → Glob {effective_knowledge_root}/workspaces/{workspace}/platform/patterns/{pattern}.md. Tồn tại → ghi patterns_verified[] với exists: true, path: .... Không tồn tại → exists: false, path: null VÀ thêm vào intent.missing_knowledge. KHÔNG xoá pattern khỏi patterns_needed.
    • Tương tự cho mỗi contract trong intent.contracts_touched (Glob platform/contracts/).
    • unverified_count = số entry có exists: false (cộng pattern + contract).
  5. Nếu config_hint có sẵn domain/project → dùng luôn, không tự đoán lại.

Read the full file on GitHub · 71 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. yesterday First seen · 71 lines · 41 tokens per session scan A 32305ad65d36

Subscribe to this mod's changes

contextd-planner is an agent published in the GitHub repository philngt/contextd (29 stars, last pushed 12d ago), licensed MIT. It adds 41 tokens to every session and 1,130 once invoked, about $0.0002 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.