What a rule is
Scope: anyone adding or changing a page on developer.mpalo.com.
Rule. A rule states what to do, what not to do, why, an example, an anti-example, and how it is enforced. A page that only describes a subject is not a rule page. A page that records a debate is not a rule page.
The reference is prescriptive. It answers the question a developer has before implementing something: what is the rule, where does it apply, what does it look like when done correctly, what does it look like when done wrongly, and who catches the mistake.
Do: write the rule the doctrine settles.
Do not: label a section as a proposal, a decision still open, a gap, or work that has not landed. If no settled rule exists, omit the section.
The rule template
Nine fields. The order is fixed because a reader checks the same things in the same place.
- Title
- The subject, stated as a noun phrase. One subject per rule. Do not use a question.
- Scope
- The surfaces, files, roles, or decisions the rule binds. State where it applies and where it does not.
- Rule
- The instruction. Use the imperative, or a declarative sentence that has the force of an instruction. One rule per paragraph.
- Do
- The action that satisfies the rule. One concrete behavior, not a list of virtues.
- Do not
- The nearest violation. Name the tempting alternative. A distant abuse does not help the next implementer.
- Why
- The consequence the rule prevents, in one or two sentences. Name the failure that occurred or would occur. No manifesto.
- Example
- A path, command, markup fragment, token, response body, or sentence that can be copied.
- Anti-example
- The same case done wrongly, next to the example. The boundary must be visible without inference.
- Enforcement
- The command, review, owner, or gate that catches a violation. A rule without enforcement is unfinished.
| Field | Content |
|---|---|
| Title | Error envelopes |
| Scope | Every Worker route that returns a failure to a client. |
| Rule | A failure carries its text in error and a real HTTP status code. |
| Do | Return { "error": "The API key has expired. Create a new key to continue." }. |
| Do not | Return { "message": "Something went wrong" } with a 200 status. |
| Why | A consumer that checks .error misses a message-only failure, and a 200 hides the failure from every client. |
| Example | { "error": "The memory space was not found." } with status 404. |
| Anti-example | { "message": "Not found" } with status 200. |
| Enforcement | node scripts/error-envelope-check.mjs and Worker review. |
Writing the rule
Open with the decision, name the term once, define it plainly, show it, state the consequence, and answer the opening.
- Open with the situation. Name the decision the reader is about to make. Do not open with "This section describes" or a summary of the document.
- Name the term once. Use the canonical term and keep it. Do not alternate between a formal term and a casual synonym to vary the prose.
- Define it plainly. One sentence that lets the reader use the term correctly. Separate what the thing is from what it is not.
- Show the operation. Use a path, a command, a code block, or a table the reader can reproduce. Label an illustrative result as illustrative.
- State the consequence. Name the cost, delay, risk, scope, or reversibility. Put it next to the action, not in a note below it.
- Answer the opening. Say what the reader can now decide, then link the next concept. Do not summarize the headings.
Use "you" for the reader and "we" for Mpalo. Use sentence case. Do not use em dashes, emojis, exclamation marks, apology tone, or urgency. Do not write "In conclusion" or "To sum up".
Public and internal documentation
Choose the record before choosing the page.
| Record | Where it lives | What it is for |
|---|---|---|
| Rule page | apps/dev-site/pages/ | A settled rule that a developer implements. It is public and indexed. |
| Institutional canon | internal/doctrine/ | Charter, identity, product, and governance sources. The rule page summarizes; the canon governs. |
| Technical reference | internal/docs/technical/ | Engineering detail and security records that support a rule page. |
| Operations runbook | internal/docs/operations/ | How to perform a database, deploy, incident, or support procedure. |
| Audit | internal/docs/audits/ | A dated review of claims or language. It is not public documentation. |
| Work note | internal/docs/work-notes/ | A record of work, decisions, or cleanup. It is not a rule. |
| Unratified draft | internal/doctrine/ | A draft that binds nobody. Do not cite it as a settled position. |
Rule. A public page never renders an internal document, an audit, a work note, a staff record, a credential, or an unratified draft. The developer builder accepts only pages whose audience is public. That is a publication guard, not an authorization mechanism.
Restricted material, including credentials, personal records, detailed vulnerability information, and sensitive incident detail, belongs in a system with access controls suited to it. It is not copied into this repository's public pages or generated indexes.
| Do | Do not |
|---|---|
| Put a settled implementation rule in the reference. | Put a proposal or an unresolved decision in the reference. |
| Link a public rule to its public source. | Render an internal audit on a public page. |
| Keep an unresolved claim in the owning role's record. | Publish an unresolved legal, pricing, or certification claim as a status. |
| Keep the reference and its generated Markdown, JSON, sitemap, and AI navigation files in sync. | Hand-edit a generated file under public/. |
How to add a rule
A rule lands in one pass: source, page, metadata, route, build, review.
- Find the source. Identify the doctrine, design document, technical record, or operational runbook that settles the rule. If no source settles it, stop. Do not write a proposal in the reference.
- Write the nine fields. Keep the rule to one subject. Put the do and the do not next to each other. Name the enforcement.
- Create the page source. Add an EJS file in
apps/dev-site/pages/using the existing section, table, callout, and code-block classes. Do not add a new visual pattern for one page. - Register the page. Add it to
apps/dev-site/pages.config.jswith its id, path, file, title, heading, summary, icon, group, navigation label, keywords, table of contents, and related pages. Every related id must exist. - Place it in the architecture. Start here, Language, Brand, Design system, Engineering rules, Product rules, Internal platform, Current status, or Contributing. Do not add a new top-level area for one rule.
- Add the Worker route. Add the path to the
developerPageslist inapps/worker/src/stw.js. A page without a route is unreachable in production. - Build and check. Run
npm run build:dev-site, thennpm run check:dev-site. Confirm the table-of-contents targets, cross-page anchors, sitemap references, generated Markdown,llms.txt, andindex.json. - Review. The owning role reviews the rule. The Documentation owner reviews the language and the scope. The Design owner reviews a visual rule. The Engineering owner reviews an engineering rule.
Do not add a page to the navigation before it has content. Do not add a link to a page that does not exist. Do not leave a placeholder in the page registry.
Review requirement
A rule is published only after its owner confirms it.
- The owning role confirms that the rule matches the source and that the enforcement exists.
- The Documentation owner confirms the language, the nine fields, the scope, and the links.
- The Design owner confirms a visual or component rule against the design-system sources.
- The Engineering owner confirms an engineering rule against
AGENTS.md,DATABASE.md, and the technical records. - The Founder confirms an institutional, charter, price, or corporate claim. Counsel confirms a legal claim.
A review is not a copy edit after publication. If the owner has not confirmed the rule, the page does not ship. A page that cites a legal, certification, encryption, deletion, or pricing fact without its owner is removed until the owner confirms it.
Before publication
- One purpose in the title and summary.
- One canonical term, used consistently.
- A status label on every capability claim.
- A do and a do not next to each other.
- An example and an anti-example that differ in one visible way.
- An enforcement line that names a command, review, owner, or gate.
- No em dashes, emojis, apology tone, urgency, or unresolved claim.
- No internal material in the public build.
Enforcement
The documentation method is checked like any other rule.
npm run build:dev-siteregenerates every page, the Markdown edition,llms.txt,llms-full.txt,index.json, and the sitemap.npm run check:dev-sitechecks page inventory, table-of-contents targets, cross-page anchors, Worker routes, and sitemap references.npm run check:linkschecks cross-subdomain links.npm run check:design-ruleschecks the visual rules.- The owning role reviews the rule before it ships. A missing owner is a missing rule.
Owner: the Documentation owner for the reference; the named role for each rule. Review: before publication and on every material change.