Skip to content

docs: split the monolithic usage.md (3,403 lines) into per-topic files #174

Description

@JAORMX

The problem

docs/usage.md is 3,403 lines in a single file. It is the sole operator-facing reference for building, running, configuring, and troubleshooting the entire harness — flags, gRPC API, HTTP/SSE API, permissions, hooks, guardrails, model routing, workspace trust, posture, skills, ACP, mecatequi CI integration, e2e, and FAQ — all in one monolithic document.

This is impractical to traverse:

  • An operator looking for "how do I configure guardrails" or "what does the HTTP SSE stream look like" has to scroll or search through 3,400 lines of unrelated content.
  • The table of contents (12 top-level sections, each with deep sub-section nesting) is too large to hold in working memory — you lose your place.
  • The file mixes quickstart-level material (the 60-second demo, section 2) with dense reference material (the gRPC event envelope, section 4; the CI composite action, section 10) that serve entirely different reader intents.
  • Any single edit (like the guardrails docs touch in guardrails: document the per-rule prompt override field (+ update docs for #168-#172) #173) touches a tiny slice of a massive file, making diffs noisy and review harder.

Current structure (12 sections, 3,403 lines)

Section Lines (approx) Topic
1. Prerequisites & install 22-164 build, library consumption, supply-chain hygiene
2. The 60-second demo 165-231 mecademo
3. Running the server (mecated) 232-1968 flags, MCP, security, observability, env, providers, permissions config, guardrails, posture, per-slot models, router, trust, skills, soul, user model, shutdown, mecak8s
4. The gRPC API 1970-2232 Converse flow, events, client snippet, mecatui
5. The HTTP / SSE API 2233-2411 endpoints, sessions, runs, approvals, ACP
6. Configuration 2413-2712 settings, workspace, models, stores, leases, remote drivers, limits
7. Permissions 2714-2780 decision resolution, default ruleset, plan mode, bash safety
8. Hooks 2781-2855 phases, stdin/exit contracts, example
9. OpenAI & compatible endpoints 2857-2901 provider config, limitations
10. Running mecatequi from GitHub Actions 2903-3281 composite action, reusable workflow, templates, injection safety
11. Live e2e suite 3282-3325 OPENROUTER_API_KEY, task e2e
12. Troubleshooting / FAQ 3326-3397 debugging, snapshots, event timeline
See also 3398-3403 links

Section 3 alone is ~1,700 lines — half the document — and covers flags, guardrails, posture, model routing, workspace trust, skills, soul, user model, and mecak8s, all stuffed under "Running the server."

Proposed change

Split docs/usage.md into focused per-topic documents under docs/usage/ (or docs/operator/), each addressing one reader intent. A top-level docs/usage.md (or docs/usage/README.md) becomes a short landing page with a table of contents linking to the split docs. Suggested split:

docs/usage.md                         → short landing page + TOC (links below)
docs/usage/install.md                  ← section 1 (prerequisites, build, library)
docs/usage/quickstart.md              ← section 2 (the 60-second demo)
docs/usage/mecated.md                  ← section 3 flags + env + provider selection + observability
docs/usage/guardrails.md               ← section 3 guardrails subsection
docs/usage/model-routing.md            ← section 3 per-slot models + router + aliases
docs/usage/workspace-trust.md          ← section 3 trust + posture + untrusted withholding
docs/usage/permissions-config.md       ← section 3 file-based perm config + section 7 permissions
docs/usage/hooks.md                    ← section 8 (hooks)
docs/usage/skills-soul-usermodel.md    ← section 3 skills + soul + user model + SkillDraft
docs/usage/mecak8s.md                  ← section 3 mecak8s subsection
docs/usage/grpc-api.md                 ← section 4
docs/usage/http-sse-api.md             ← section 5
docs/usage/configuration.md            ← section 6 (settings, stores, leases, remote drivers, limits)
docs/usage/openai-compatible.md        ← section 9
docs/usage/mecatequi-ci.md             ← section 10 (the CI integration — large enough to be its own doc)
docs/usage/e2e.md                      ← section 11
docs/usage/troubleshooting.md          ← section 12

Principles for the split

  • One reader intent per file. "I want to configure guardrails" → one file. "I want to wire the CI" → one file. Not "scroll to section 3, sub-section guardrails, inside the 1,700-line flags mega-section."
  • Keep the top-level landing page thin. A one-screen TOC linking to the split docs, plus the 60-second quickstart inline (or linked). The current 12-section TOC is the navigation; it should stay, just pointing at separate files.
  • Preserve anchors. The task docs:check strict link gate (matlatl check . --strict) will catch broken cross-links. External references (ADR cross-links, README links to docs/usage.md#section) must be updated — the link gate enforces this.
  • No content rewrites in the split. This is a mechanical move: cut each section into its own file, fix cross-references, regenerate llms.txt (task docs:llms). The split itself is the deliverable; prose improvements are separate.
  • llms.txt regeneration is mandatory. task generate / task docs after the split — the CI docs job will fail on a stale llms.txt.

Interaction with #173 (guardrails docs)

#173 touches the guardrails section of docs/usage.md. If this split lands first, #173's changes target docs/usage/guardrails.md instead of the monolith. If #173 lands first, this split carries the already-updated guardrails content into the new file. Either order works — they're independent.

Scope

  • Split docs/usage.md into per-topic files under docs/usage/.
  • Thin landing page (docs/usage.md or docs/usage/README.md) with the TOC linking to the split docs.
  • Fix all cross-references (the task docs:check link gate enforces this).
  • Regenerate llms.txt (task docs:llms).
  • Update any ADR / README / AGENTS.md references that point at docs/usage.md#<section> anchors.

Out of scope

  • Prose improvements / rewrites (separate effort; the split is mechanical).
  • Splitting other large docs (docs/architecture.md, docs/design/IMPLEMENTATION-NOTES.md) — this issue is scoped to docs/usage.md only, though the pattern could be repeated later.

Ref: #173 (guardrails docs — touches the section that would move).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions