update-codemaps

update-codemaps is a command for coding agents from hmj1026/dhpk. It costs 34 tokens per session (1,374 once invoked), scanned A, original, MIT.

A command that scans a codebase and creates or updates architecture maps in the docs/CODEMAPS directory. These maps summarize the project structure for an AI agent, including common layouts such as a monorepo, where several related projects live in one repository.

In plain words
What is it for?
Use it after adding, moving, or renaming modules, directories, or public services, or when you want to refresh the project's architecture maps.
Why use it?
It keeps architecture documentation aligned with structural changes, so an agent can load a concise view of the project instead of inspecting every file first.

Command

Installs and runs on its own, but its text points at files inside its plugin — anything it tells you to read at a ${CLAUDE_PLUGIN_ROOT} path is only there once the plugin is installed. Installing the plugin gets both.

Part of the dhpk plugin — 65 skills, 31 commands, 40 agents, 4 hooks 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 commands/hmj1026/dhpk/update-codemaps
Clone the repo
git clone --depth 1 https://github.com/hmj1026/dhpk

Or install dhpk, the plugin that ships this one along with the rest of its 65 skills, 31 commands, 40 agents, 4 hooks.

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 update-codemaps

README.md
[![agentmods](https://agentmods.dev/badge/commands/hmj1026/dhpk/update-codemaps.svg)](https://agentmods.dev/commands/hmj1026/dhpk/update-codemaps)
Your own site
<a href="https://agentmods.dev/commands/hmj1026/dhpk/update-codemaps"><img src="https://agentmods.dev/badge/commands/hmj1026/dhpk/update-codemaps.svg" alt="Measured on agentmods" height="20"></a>
Per session 34 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,374 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.00034 $0.01374
Opus 5 $0.00017 $0.00687
Sonnet 5 $0.00007 $0.00275
Haiku 4.5 $0.00003 $0.00137

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

Security

Grade A, and why

update-codemaps 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 today.

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.

commands/update-codemaps.md · 112 lines

How it starts

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

Update Codemaps

Contract

Use after a structural change or for an explicit codemap refresh; not for rewriting application source. See the command contract. Stop when scanning or generation fails; completion reports changed codemap paths, diff percentage, and any confirmation still required.

Analyze the codebase structure and generate token-lean architecture documentation.

Proactive orchestration: after structural changes (new module / renamed dir / new public service) the doc-updater agent runs this command (and /update-docs) — see the back-stop in ${CLAUDE_PLUGIN_ROOT}/rules/execution-policy.md. Invoke /update-codemaps directly for a one-off manual refresh.

Step 1: Scan Project Structure

  1. 偵測專案架構(框架、是否分層、是否單體 / monorepo)。常見模式:
    • 單體 MVC(Yii / Laravel / Rails / Django 等)
    • 分層 DDD(Domain / Application / Infrastructure)
    • Modular monolith / monorepo(每個模組獨立目錄)
    • Frontend SPA + Backend API
  2. 掃描主要目錄。下列為典型框架/分層慣例路徑,依專案實際結構增刪:
    • <controllers-dir> — Controller 層(HTTP 入口)
    • <models-dir> — Domain Model / ORM Entity
    • <views-dir> — View / Template
    • <commands-dir> — Console / Worker 命令
    • <services-dir> — Application / Domain Service
    • <repositories-dir> — Repository / Data Access
    • <frontend-dir> — 前端 JS/CSS(含或不含 build step)
  3. 標示進入點:例如 index.phppublic/index.phpsrc/main.tsmanage.pyconfig/application.rb 等專案實際的入口檔。

Step 2: Generate Codemaps

docs/CODEMAPS/ 不存在,先建立目錄(mkdir -p docs/CODEMAPS)。

docs/CODEMAPS/ 建立或更新以下文件:

文件 內容
architecture.md 高階系統圖、分層結構、Controller → Service → Repository(或專案實際呼叫鏈)路徑
backend.md Controller actions、Service 方法、Repository 對應、Console / Worker commands
frontend.md 前端目錄結構、全域 API / namespace、View 與 JS 的關聯
data.md 主要資料表、ORM model 對應、關聯(relations / associations)
dependencies.md 外部 API 整合、第三方服務、framework extensions、套件管理檔依賴

Codemap Format

每份 codemap 應精簡 — 針對 AI context 消耗最佳化:

Read the full file on GitHub · 112 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. today First seen · 112 lines · 34 tokens per session scan A 6298254c85a4

Subscribe to this mod's changes

update-codemaps is a command published in the GitHub repository hmj1026/dhpk (2 stars, last pushed today), licensed MIT. It adds 34 tokens to every session and 1,374 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-09-05.