arch

A project-structure scan that creates Mermaid diagrams, a text-based diagram format, and navigation files under .pm/architecture/.

In plain words
What is it for?
Use it to document modules, important files, capabilities, hotspots, layers, system context, dependencies, request flow, and deployment flow while skipping generated and excluded folders.
Why use it?
It makes the relationships between project parts easier to understand and provides a map for later governance checks.

Command

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/wei63w/pm-manager/arch
Clone the repo
git clone --depth 1 https://github.com/wei63w/pm-manager
Per session 17 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 930 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin 100% copy Near-identical to another mod 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.00017 $0.00930
Opus 5 $0.00009 $0.00465
Sonnet 5 $0.00003 $0.00186
Haiku 4.5 $0.00002 $0.00093

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

Security

Grade A, and why

arch 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 2d 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.

Origin

This is a copy

100% identical to pm-arch — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

skills/pm-manager/templates/commands/arch.md · 56 lines

How it starts

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

User Input

$ARGUMENTS

Outline

  1. Require .pm/ initialized; else recommend /pm-init.
  2. 若已有 map.json,先读它。定位文件用 pm map <关键词>,禁止无过滤全库递归。
  3. Run pm arch from the project root (preferred). This writes:
    • .pm/architecture/map.json — 导航地图(modules / key_files / capabilities / hotspots / lookup)
    • .pm/architecture/tree.md — 带注解目录树
    • .pm/architecture/overview.md — 中文总览 + Mermaid
    • .pm/architecture/layer.mmd — 分层架构
    • .pm/architecture/system-context.mmd / service-dependencies.mmd / request-flow.mmd / deploy-flow.mmd
    • .pm/architecture/scan.json
  4. If a valid map.json already exists and nothing changed, CLI reuses the map (timestamp only). Skip node_modules, build, logs, and scan.exclude_dirs.
  5. If CLI is unavailable, generate the same files yourself by scanning (still skip ignore dirs; isolate per-file read failures). If the repo is Vue (vue/nuxt in package.json deps): include .vue files; draw Browser → Vue Router → Page → Component → API (not API Gateway); layer by pages/views, components, composables/stores, api. Non-Vue repos keep the existing heuristics.
  6. Review diagrams: fix wrong edges, rename nodes, add missing externals. Prefer editing the .mmd files then refreshing the Mermaid blocks in overview.md.
  7. Optional charter compare: mark out-of-scope services or missing in-scope capabilities in architecture/findings.md (with confidence) only if charter is approved.
  8. Default: write only under .pm/architecture/. If the user asks to land diagrams in the application tree, show the draft and wait for confirm.
  9. Closing: _closing.md 完整档;只列已生成的架构文件。中文摘要。

Done When

  • map.json has path-based key_files and non-empty module paths; layer.mmd exists
  • Diagrams reflect this repo (not generic placeholders)
  • Ignore dirs were skipped; no secrets in diagram labels or findings

Shared Workflow (all /pm-* commands)

Follow this order when the command mutates .pm/ state:

Read the full file on GitHub · 56 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. 2d ago First seen · 56 lines · 17 tokens per session scan A 4834c881de17

Subscribe to this mod's changes

arch is a command published in the GitHub repository wei63w/pm-manager (96 stars, last pushed 2d ago), licensed MIT. It adds 17 tokens to every session and 930 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to pm-arch, differing in 0 lines, and is treated as a copy.