Skip to content

docs: add the generated codebase-understanding tree - #1

Merged
laithalsaadoon merged 3 commits into
mainfrom
docs/codebase-understanding-tree
Aug 13, 2026
Merged

laithalsaadoon merged 3 commits into
mainfrom
docs/codebase-understanding-tree

Conversation

@laithalsaadoon

Copy link
Copy Markdown
Contributor

What this adds

Sixteen cross-linked Markdown pages under docs/, plus a landing docs/README.md, documenting the codebase for a reader who has never opened it. The tree was generated by a fleet of parallel documentation agents, one per page, and then mechanically verified.

Two facts frame every page:

  1. The primary consumer of memhtml is a coding agent. The pages judge the CLI, MCP server, and library by how an agent consumes them: JSON envelopes, exit codes, memhtml manifest discovery, generated AGENTS.md.
  2. This repository stores no memory. It is the software that manages an external memhtml root ($MEMHTML_ROOT), which memhtml manages with git: the root's tree is the system of record, .memhtml/index.db is a rebuildable projection.

apps/docs (the Astro site) is deliberately out of scope.

Contents

Tier Pages
Architecture system overview, module map, data flow
Reference CLI (36 subcommands), RPC tools (14 MCP tools + 2 resources), public API (top-30 symbols)
Behavior 8 processes, 3 state machines
Diagrams components, dependency graph, sequences (all parse under Mermaid 11)
Insights impact analysis, debugging guide, contract map, business logic, tech debt

The analysis/ tier (ownership, risk hotspots, dead code) is intentionally omitted: four days of single-author history carries no signal, and no dead-code tool is configured.

Verification

  • All 1,722 path:LOC citations were extracted and checked mechanically: every cited file exists and every line number is in range.
  • See-also footers were added deterministically to the 15 pages sharing two or more source citations; every link resolves.
  • Zero emojis, zero YAML frontmatter on outputs; em dashes appear only inside verbatim code quotes.

Drift found in existing docs while generating (not fixed in this PR)

  • apps/cli/src/run.ts:178-179 says "thirty-one commands" and apps/cli/src/commands.ts:1031 says "33"; the table and the live binary both report 36.
  • docs/backlog.md:50-53, ROADMAP.md:579-580, and spec requirement DOCSYNC-1 agree on "16 of 31 response types"; RESPONSE_TYPES now holds 32 members.
  • RUNBOOK.md:243 cites operations.ts:1415 for the trace links refusal; it now lives at apps/cli/src/operations.ts:1681-1685.
  • ERR_INDEX_STALE is declared in ERROR_CODES with no producer anywhere (consistent with the append-only policy, flagged for awareness).

Sixteen cross-linked pages under docs/ documenting the codebase for a
reader who has never opened it: architecture (overview, module map,
data flow), reference (36 CLI subcommands, 14 MCP tools + 2 resources,
top-30 library symbols), behavior (8 processes, 3 state machines),
diagrams (components, dependencies, sequences), and five insights
pages (impact analysis, debugging guide, contract map, business logic,
tech debt). docs/README.md is the landing page.

Every page frames memhtml as software an agent operates on an external
$MEMHTML_ROOT; the repo itself stores no memory. All 1,722 path:LOC
citations were mechanically verified to resolve in range. The
analysis/ tier (ownership, hotspots, dead code) is intentionally
omitted: four days of single-author history carries no signal.

apps/docs (Astro site) is out of scope for this tree.
A prose-only pass over all 17 pages. Aphorisms, dramatic-reveal
colons, 'not X, it's Y' contrasts, moralized failure phrasing, and
announced-importance adverbs are rewritten as plain statements of
what the code does. No fact, table row, code fence, Mermaid block,
or citation changed: the citation set of every page is byte-identical
to the pre-edit snapshot, and the remaining em dashes sit inside
verbatim source quotes.
Comment-only edits across 130 files in apps/cli, apps/mcp,
apps/consolidator, and the nine packages. Every file keeps its exact
line count, so every path:LOC citation in the docs tree and in other
comments stays valid. String literals are untouched, including tool
descriptions, prompts, and guide topics. Verified: zero non-comment
lines in the diff, typecheck 27/27, lint clean, agents-doc --check
passes.
@laithalsaadoon
laithalsaadoon merged commit 9376f56 into main Aug 13, 2026
4 of 5 checks passed
@laithalsaadoon
laithalsaadoon deleted the docs/codebase-understanding-tree branch August 13, 2026 18:43
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