activememory/ctx/ctx-architecture
Claude Code and agent skill by activememory/ctx
- community
Checking that the SKILL.md file is still in the repository.
Build and maintain architecture maps. Use to create or refresh ARCHITECTURE.md and DETAILED_DESIGN.md. Supports principal mode for deeper analysis: vision, future direction, bottlenecks, implementation alternatives, gaps, upstream proposals, and intervention points.
Install
npx vskill@latest install activememory/ctx/ctx-architectureSKILL.md
Build and maintain two architecture documents incrementally: ARCHITECTURE.md (succinct project map, loaded at session start) and DETAILED_DESIGN.md (deep per-module reference, consulted on-demand). Coverage is tracked in map-tracking.json so each run extends the map rather than re-analyzing everything.
Execution Priority
When time or context budget runs short, execute in this order. Never skip a tier to do a lower one:
- Authoritative truth first: ARCHITECTURE.md + DETAILED_DESIGN.md
must be accurate and honest. Incomplete is fine; wrong is not.
- Surface uncertainty honestly: partial coverage with correct
confidence scores beats inflated scores. Mark what you don't know.
- Offer judgment only where grounded: danger zones, extension
points, improvement ideas only for modules you actually analyzed.
- Prefer fewer sharp insights over many shallow sections: a
CHEAT-SHEETS.md with one excellent cheat sheet beats five thin ones. An ARCHITECTURE-PRINCIPAL.md with three concrete risks beats ten vague ones.
Mode Detection
Read the invocation for a mode keyword:
- No keyword (or
default) → run Default mode (Phases 0-5 below) principal→ run Principal mode (Phases 0-5 + Principal phases P1-P3)
Examples:
When to Use
- First time setting up architecture documentation for a project
- Periodically to refresh stale module coverage after significant
changes
- After major refactors, new package additions, or dependency changes
- When the agent nudges that the map is stale (>30 days, commits
detected)
- When you need deep understanding of a module before working on it
- When you want strategic analysis of the architecture (principal mode)
When NOT to Use
- For minor code changes that don't affect module boundaries or
data flow
- When ARCHITECTURE.md just needs a quick path fix (use
/ctx-drift
instead)
- Repeatedly in the same session without intervening code changes
- When the user has opted out (
opted_out: truein
map-tracking.json)
Default Mode (Phases 0-5)
Phase 0: Check Opt-Out
Read .context/map-tracking.json. If it exists and opted_out: true, say:
Architecture mapping is opted out for this project. Delete.context/map-tracking.jsonto re-enable.
Then stop.
Phase 0.25: Companion Tool Check
Check if a web-search-with-citations MCP is available by attempting a simple query. The canonical implementation is Gemini Search (mcp__gemini-search__search_with_grounding); if your toolchain provides the same capability via a different server (Firecrawl, Exa, Tavily, etc.), use whatever is connected. This capability is for upstream documentation, design rationale, KEPs, peer-project patterns — anything outside the local codebase that helps understand why the code is shaped the way it is.
If available: note it silently. Use it throughout the analysis for upstream lookups. Prefer it over built-in web search.
If not available: silently fall back to built-in web search for upstream lookups. Do not prompt the user to install anything — ctx does not vouch for companion-tool install paths (see DECISIONS.md, 2026-05-23).
Important: this capability is for upstream and external context only. Do not use it to understand the local codebase — read the code directly. The depth of analysis comes from forced reading, not from search shortcuts.
Phase 0.5: Quick Structure Scan + Focus Areas
Before any deep analysis, do a lightweight structural survey to discover what the project actually contains. This takes seconds and makes the focus-area question concrete instead of open-ended.
Scan steps (no file reads - structure only):
Then ask (present the discovered package/module names):
If focus areas are given, carry them forward:
- Phase 2 goes deep on focus packages (target confidence ≥ 0.8)
- Direct dependencies of focus packages get a solid pass (≥ 0.7)
- All other packages are stubbed (0.2) unless they appear as
transitive dependencies
- DETAILED_DESIGN.md sections for focus packages are written first
and in full detail
- Principal mode Phase P2 strategic questions reference the focus
areas explicitly
If "all" or no answer, proceed with standard uniform analysis.
Phase 1: Assess Current State
Determine if this is a first run or subsequent run:
- First run: no
.context/map-tracking.jsonexists - Subsequent run: tracking file exists with coverage data
For subsequent runs, identify the frontier: modules that need analysis:
- Read
map-tracking.jsonfor coverage state - For each covered module, check staleness:
- Frontier = uncovered modules + stale modules (commits after
last_analyzed) + low-confidence modules (confidence < 0.7)
Phase 2: Survey (First Run) or Analyze Frontier (Subsequent Run)
First run: full survey:
- Run
ctx depsto bootstrap the dependency graph:
``bash ctx deps `` Auto-detects the ecosystem (Go, Node.js, Python, Rust) from manifest files. Use this as the starting point for "Package Dependency Graph": verify and enrich with semantic context.
- Read the project manifest for project identity (name, version,
description): ctx deps covers the dependency tree
- Explore directory structure:
``bash ctx status ``
- Read key files in each package: exported types, functions,
imports
- Trace data flow through main entry points
- Identify architectural patterns (dependency injection,
interfaces, registries)
Subsequent run: targeted analysis:
- For each frontier module, read its source files
- Trace data flow and dependencies
- Note changes since last analysis
- Update confidence based on depth of understanding
Phase 3: Update Documents
ARCHITECTURE.md: update ONLY if module boundaries, dependency graph, data flow, or key patterns changed. Internal implementation changes do NOT warrant updates. Target: under 4000 tokens (~16KB) so ARCHITECTURE.md loads within the session-start context budget.
Required sections:
- Overview (design philosophy, key concepts)
- Package Dependency Graph (mermaid
graph TD) - Component Map (tables: package, purpose, depends on)
- Data Flow (mermaid sequence diagrams for key operations)
- Key Architectural Patterns
- File Layout (ASCII tree)
DETAILED_DESIGN.md: update per-module sections using this format:
Caller Scheduler Worker
| --schedule()--> | ||
|---|---|---|
| --dispatch()--> | ||
| <--result------ | ||
| <--done-------- |
[Init] --configure()--> [Ready] --start()--> [Running]
error()---------| |--stop()-->[ Stopped]
[Failed]
Splitting DETAILED_DESIGN.md when it grows large:
When DETAILED_DESIGN.md exceeds ~600 lines or covers 3+ natural domains, split into domain files and keep a shallow index:
DETAILED_DESIGN.md- index only (domain name, file pointer,
module list, one-line domain purpose)
DETAILED_DESIGN-<domain>.md- full module sections for that
domain
Domains are natural groupings, not arbitrary splits. Examples:
- storage, auth, api, reconciler, cli, observability
- If no natural grouping exists, split by: core vs. peripheral
Index format:
Update map-tracking.json to record which domain file each module lives in:
Each section is self-contained. The agent reads specific sections when working on a module, not the entire file.
CHEAT-SHEETS.md: write (or update) short mental models for key lifecycle flows. One cheat sheet per major lifecycle or flow identified in the codebase. Format:
Aim for cheat sheets that fit on one screen. If a flow needs more than ~15 steps, split it. Write cheat sheets for at minimum:
- The main entry-point lifecycle (e.g. controller reconcile loop,
request handler, CLI command dispatch)
- Any policy or rule evaluation flow
- Any significant async or background job lifecycle
Skip if the project has no meaningful lifecycles (e.g. a pure library with no runtime behavior).
GLOSSARY.md: append project-specific terms discovered during analysis. This captures the vocabulary that makes the codebase searchable: type names, internal concepts, abbreviations, and domain jargon that a new reader wouldn't know to search for.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckinginternal/assets/claude/skills/ctx-architecture/SKILL.md
Popularity
- Repository stars
- 69
- Repository forks
- 12
- 7-day trend score
- 21
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/activememory/ctx/ctx-architecture)