Skip to content

docs: add rendered architecture diagrams (Mermaid)#63

Merged
m1ngshum merged 5 commits into
mainfrom
docs/architecture-diagrams
Jun 8, 2026
Merged

docs: add rendered architecture diagrams (Mermaid)#63
m1ngshum merged 5 commits into
mainfrom
docs/architecture-diagrams

Conversation

@m1ngshum

@m1ngshum m1ngshum commented Jun 8, 2026

Copy link
Copy Markdown
Member

Summary

Adds 4 GitHub-native Mermaid diagrams so the architecture is visible at a glance instead of buried in prose/ASCII. Each was drafted from the actual source, adversarially verified against the code, and render-validated with mermaid-cli (all four produce clean SVGs — no syntax-error fallbacks). No code changes.

What's added / where

Diagram File / section Notes
System overview README.mdHow it works Local-first; the public MCP Registry is the only remote dependency. Shows trust scan → atomic config writes → guard runtime → ~/.mcpm/ state.
Install + trust-gate flow docs/ARCHITECTURE.mdData Flow (replaces ASCII) Makes the min-trust gate and already-installed fail branches explicit; corrected step order (env prompt before entry resolution).
Secrets resolution flow docs/ARCHITECTURE.md → new Secrets resolution data flow Shows the key invariant: plaintext secrets live only in the guarded child's in-memory env, never on disk; placeholder stays literal when unguarded.
Guard runtime relay docs/ARCHITECTURE.mdGuard data flow (replaces ASCII) and docs/GUARD.mdMental model → Full message flow stdio MITM relay as a sequenceDiagram: bidirectional parent→child / child→parent inspection, schema-drift block path, event-log sink. Mirrored into both the contributor-facing (ARCHITECTURE) and user-facing (GUARD) references.

Why

The guard relay, trust pipeline, and secrets resolution are inherently flows — far clearer as a picture than as three paragraphs. Mermaid renders natively on GitHub (no checked-in images, diffable in PRs, contributor-editable).

Verification

  • mermaid-cli rendered all 4 to valid SVG (sizes 28–50 KB), confirmed they contain real node labels (Stdio MITM Relay, resolveEnvPlaceholders, etc.) rather than error text.
  • Diagrams cross-checked against src/commands/install.ts, src/scanner/, src/guard/ (run-inner.ts, relay.ts), and src/store/keychain.ts.

🤖 Generated with Claude Code

m1ngshum added 4 commits June 8, 2026 12:26
Add four GitHub-native Mermaid diagrams, each grounded in source and
render-validated with mermaid-cli:

- README 'How it works': system overview (local-first, only the public
  registry is remote; trust scan + atomic config writes + guard runtime)
- ARCHITECTURE 'Data Flow': install + trust-gate flow (replaces ASCII),
  with the min-trust and already-installed fail branches made explicit
- ARCHITECTURE: new 'Secrets resolution data flow' — shows plaintext
  secrets live only in the guarded child's in-memory env, never on disk
- ARCHITECTURE 'Guard data flow': stdio MITM relay as a sequence diagram
  (replaces ASCII) — bidirectional parent->child / child->parent
  inspection, schema-drift block path, and event-log sink

No code changes.
Adds the same render-validated runtime message-flow sequence diagram to
GUARD.md's 'Mental model' section (as 'Full message flow'), so the
user-facing guard reference shows the bidirectional inspection pipeline
alongside the existing ASCII sketch + detection-layers table. Same
diagram already lives in ARCHITECTURE.md's 'Guard data flow'.
Audit against src/scanner/ found the overview diagram mislabeled the
trust pipeline. Corrected to the real 4-component model from
trust-score.ts:
- Health Check (0-30, health-check.ts: spawn + verify)
- Tier 1: Static Patterns (0-40, tier1.ts: secrets/injection/typosquat/exfil)
- Tier 2: External Scan (0-20, tier2.ts: optional MCP-Scan)
- Registry Metadata (0-10: publisher/age/downloads)

Previously Tier 1/Tier 2 labels were swapped and registry metadata was
folded into Tier 1; trust score 'max 80 (100 with external scan)' now
reflects the dynamic maxPossible. Install + secrets + guard-relay
diagrams audited and confirmed accurate (no change).
Full-repo doc audit (every implementation doc vs src/), each finding
independently confirmed with file:line evidence. Surgical fixes:

README.md
- add 'mcpm why' to the Commands table (was undocumented)
- expand 'mcpm publish' into scaffold / check / submit subcommands
- mcpm serve exposes 8 tools, not 9 (mcpm_up is not registered)

docs/ARCHITECTURE.md
- CI matrix is Node 22/24/26 (was 20/22/24)
- commands/ module: 24 commands, guard 12 subcommands, publish 3
- complete the Commands table (add outdated/why/secrets/publish)

docs/GUARD.md
- wrap transform includes --declared-env and --orig-hash flags
- policy-overrides actions are ignore/warn/block/log_only (+ paused_until)

docs/POLICY.md
- mark signature_overrides as optional (matches Zod schema)

docs/SIGNATURES.md
- inspection model also scans structuredContent + JSON-RPC errors
  (tool_response) and title + full inputSchema (tool_description)

CLAUDE.md
- version v0.8.0, Node >=22.0.0, last-updated 2026-06-03
- local storage: aliases.json (not scans.json, which doesn't exist)
- mcpm serve exposes 8 tools; complete the command list

src/commands/guard.ts
- header comment: all v0.5.0 guard subcommands are implemented
  (was 'land in subsequent build steps')
The earlier doc-drift pass set the MCP tool count to 8 to match main's
then-current code (mcpm_up built but unregistered). PR #64 registers
mcpm_up, so the correct count is 9. Restore mcpm_up to the tool lists in
README and CLAUDE.

Merge order: this should land with/after #64 (which registers the tool);
main's code exposes 9 only once #64 is merged.
@m1ngshum m1ngshum merged commit 769604d into main Jun 8, 2026
7 checks passed
@m1ngshum m1ngshum deleted the docs/architecture-diagrams branch June 8, 2026 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant