architecture-memory
Skill9 starsChanged 31 days agoMITView on GitHub
Maintain docs/ARCHI.md — a persistent, tool-agnostic architecture memory of the repository. Use when the user asks to create, update, or compact an architecture overview / ARCHI.md, or when repeated Explore passes keep re-mapping the same codebase. Covers creation, the update discipline, the token budget (~10-20k tokens), and the compaction procedure with a bundled token-count script.
In this repository16 other files it gives its agents.
- agent-invocationSkill
- brainstormingSkill
- codex-invocationSkill
- dev-orchestratorSkill
- dispatching-parallel-agentsSkill
- executing-plansSkill
- finishing-a-development-branchSkill
- receiving-code-reviewSkill
- requesting-code-reviewSkill
- systematic-debuggingSkill
- test-driven-developmentSkill
- using-git-worktreesSkill
- verification-before-completionSkill
- writing-plansSkill
- writing-skillsSkill
- zcode-invocationSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 19
Keep: what exists and why it is shaped that way.
- Very specific: line 34
No implementation walk-throughs: useTranscription: orchestrates transcription fetching and state — nothing about its useState internals.
- Very specific: line 58
If you find ARCHI.md contradicting the source, fix ARCHI.md immediately (separate docs: commit) — stale sections poison every downstream …
- Distinctive: line 62
When the file exceeds ~20k tokens, compact.
- Very specific: line 70
After compaction: re-run the token count, spot-check 3–5 claims against the source (compaction must not change meaning), commit as docs: …
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Architecture Memory (ARCHI.md)
Manual-only pipeline skill (superpowers-strigov-ver). It starts only from the user (
/dev,/superpowers-strigov-ver:<skill>), from another skill of this plugin, or when resuming an in-progress plan — never on your own initiative. The Skill tool refuses it by design, so this plugin's pipeline skills are loaded withRead, never through the Skill tool. This file:${CLAUDE_SKILL_DIR}/SKILL.md(if the variable shows unexpanded, it is the path you just read). Another skill named below (writing-plans,codex-invocation,zcode-invocation,dev-orchestrator, …) is../<name>/SKILL.mdrelative to this skill's directory —Readit there. After a context compaction, re-Readthis file before your next step.
docs/ARCHI.md is a curated, always-current snapshot of the repository's architecture — the agent's long-term memory of the codebase. Concept borrowed from TRIP-workflow (MIT).
Why: without it, every session re-derives the architecture through glob/grep/read passes — slow, token-hungry, and prone to guessing ("there's probably a utils folder…"). With it, one read gives the full picture. Unlike CLAUDE.md, ARCHI.md is purely about architecture and tool-agnostic — any agent (Claude, Codex, other) can consume it; reference it from CLAUDE.md if you want it in every conversation.
It is optional infrastructure: nothing in this plugin requires it. But when it exists, the dev-orchestrator prompts already exploit it — the Opus plan writer and the implementers read it first, and Explore passes start from it instead of from zero.
What goes in (and what doesn't)
Keep: what exists and why it is shaped that way. Remove: how (implementation specifics that belong in the code).
Recommended H2 skeleton — adapt to the project:
## Overview— what the system is, 3–5 sentences.## Stack— languages, frameworks, key deps, versions that matter.## Module map— directories/modules with one-line responsibilities. Summarize file groups (src/auth/ — auth UI components (Login, Logout, Register)), never exhaustive file listings.## Data flow / control flow— how a request/event travels. A mermaid diagram beats prose.## Contracts— public API surface, event/schema shapes, invariants other modules rely on.## Conventions— error handling, logging, naming, test layout; the things reviewers enforce.## Decisions— short ADR-style log: choice, why, date. Append-only.
Density rules (these keep the file useful):
- Tables and bullet fragments over paragraphs;
codefor every path/command/type. - One concept explained once — cross-reference, don't repeat.
- No implementation walk-throughs:
useTranscription: orchestrates transcription fetching and state— nothing about its useState internals.
Token budget
Target 10–20k tokens (roughly ≤10% of a working context). Measure with the bundled script:
bash <plugin-root>/skills/architecture-memory/count-tokens.sh docs/ARCHI.md(±5% on markdown. First Read ../codex-invocation/SKILL.md (manual-only — never through the Skill tool), then resolve <plugin-root> using the same marketplace-cache or local-dev-tree method.)
Creating it
Dispatch exploration, don't skim by hand: an Explore/general-purpose subagent maps the codebase (structure, stack, patterns, contracts), then a writing pass fills the skeleton above. Verify claims against source before writing — ARCHI.md that guesses is worse than no ARCHI.md, because it is trusted. Commit as docs: add ARCHI.md architecture memory.
Update discipline
ARCHI.md is only valuable while it is TRUE. The maintenance loop is built into dev-orchestrator:
- The Opus plan writer must add "update
docs/ARCHI.mdsection<X>" as an explicit step to any phase that changes something ARCHI.md describes. - The implementer executes that step like any other; the diff review then covers the ARCHI.md edit too.
- Outside the orchestrator: whenever you land an architectural change (new module, moved responsibility, changed contract), update the affected section in the same commit.
If you find ARCHI.md contradicting the source, fix ARCHI.md immediately (separate docs: commit) — stale sections poison every downstream plan.
Compaction
When the file exceeds ~20k tokens, compact. Confirm with the user first (show the measured count and the top bloat sources), then apply in order:
- Deduplicate — merge repeated/overlapping explanations; restructure instead of "see above".
- Densify — prose → tables/bullets; flows → mermaid; keep the facts, drop the narration.
- Collapse implementation detail — anything explaining how code works gets cut to a one-line what/why.
- Summarize file listings — directory-level lines with the member names in parentheses.
- Archive dead weight — sections about removed subsystems go to
docs/ARCHI-archive.md(never deleted silently).
After compaction: re-run the token count, spot-check 3–5 claims against the source (compaction must not change meaning), commit as docs: compact ARCHI.md (<before> → <after> tokens).
Boundaries
- dev-orchestrator main thread never reads ARCHI.md — it is architecture content, i.e. research (Rule 2). The orchestrator only passes its path to subagents.
- ARCHI.md is not a changelog, not a roadmap, not API reference docs — link to those instead of absorbing them.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

