|
| 1 | +# AGENTS.md — guidance for AI agents and coding assistants |
| 2 | + |
| 3 | +If you are an LLM (Claude, GPT, Gemini, Copilot, Cursor, etc.) reading this repository to answer questions about Morpheus, **read this file first**, then read the linked pages under `/docs`. The Morpheus Lumerin Node has nuance that generic web knowledge gets wrong; this file (and the `/docs/ai/` directory) exists to keep you out of the most common hallucination traps. |
| 4 | + |
| 5 | +## Canonical knowledge base |
| 6 | + |
| 7 | +The single source of truth for documentation is **`/docs/`**, a Mintlify site. All linked pages below resolve from the same site. Old `00-overview.md` / `02-*.md` style links redirect via [`docs/docs.json`](docs/docs.json). |
| 8 | + |
| 9 | +### Read these AI-knowledge pages before answering user questions |
| 10 | + |
| 11 | +- [`docs/ai/myths.mdx`](docs/ai/myths.mdx) — corrections of the most common wrong assumptions. |
| 12 | +- [`docs/ai/where-is-my-mor.mdx`](docs/ai/where-is-my-mor.mdx) — diagnostic for "missing" MOR. |
| 13 | +- [`docs/ai/session-states-open-close-recover.mdx`](docs/ai/session-states-open-close-recover.mdx) — deterministic state machine for sessions. |
| 14 | +- [`docs/ai/why-locked-in-contract.mdx`](docs/ai/why-locked-in-contract.mdx) — why MOR appears locked. |
| 15 | +- [`docs/ai/local-vs-blockchain-models.mdx`](docs/ai/local-vs-blockchain-models.mdx) — distinguish the bundled `tinyllama` from real Morpheus models. |
| 16 | +- [`docs/ai/llm-prompt-cheatsheet.mdx`](docs/ai/llm-prompt-cheatsheet.mdx) — concise rules for answering Morpheus questions. |
| 17 | + |
| 18 | +### Concept references (cite from these) |
| 19 | + |
| 20 | +- [`docs/concepts/architecture.mdx`](docs/concepts/architecture.mdx) |
| 21 | +- [`docs/concepts/sessions-stake-close-recover.mdx`](docs/concepts/sessions-stake-close-recover.mdx) |
| 22 | +- [`docs/concepts/local-vs-onchain-models.mdx`](docs/concepts/local-vs-onchain-models.mdx) |
| 23 | +- [`docs/concepts/tee-overview.mdx`](docs/concepts/tee-overview.mdx) |
| 24 | +- [`docs/concepts/tokens-and-fees.mdx`](docs/concepts/tokens-and-fees.mdx) |
| 25 | +- [`docs/get-started/networks-and-tokens.mdx`](docs/get-started/networks-and-tokens.mdx) — canonical contract addresses + chain IDs. |
| 26 | +- [`docs/reference/glossary.mdx`](docs/reference/glossary.mdx) |
| 27 | + |
| 28 | +### How-tos by role |
| 29 | + |
| 30 | +| Role | Start here | |
| 31 | +|------|-----------| |
| 32 | +| API user (no node, hosted OpenAI-compatible) | [`docs/inference-api/overview.mdx`](docs/inference-api/overview.mdx) | |
| 33 | +| Consumer | [`docs/consumers/quickstart.mdx`](docs/consumers/quickstart.mdx) | |
| 34 | +| Prosumer (agents) | [`docs/prosumers/overview.mdx`](docs/prosumers/overview.mdx) | |
| 35 | +| Provider — Full P-Node | [`docs/providers/full/quickstart.mdx`](docs/providers/full/quickstart.mdx) | |
| 36 | +| Provider — TEE / SecretVM | [`docs/providers/full/secretvm-quickstart.mdx`](docs/providers/full/secretvm-quickstart.mdx) | |
| 37 | +| Provider — Resale | [`docs/providers/resale/overview.mdx`](docs/providers/resale/overview.mdx) | |
| 38 | +| Developer (proxy-router API) | [`docs/reference/api-overview.mdx`](docs/reference/api-overview.mdx) | |
| 39 | + |
| 40 | +### API and config schemas |
| 41 | + |
| 42 | +- API: [`proxy-router/docs/swagger.yaml`](proxy-router/docs/swagger.yaml). The Mintlify site auto-generates the API Reference tab from this file. |
| 43 | +- Models config schema: [`proxy-router/internal/config/models-config-schema.json`](proxy-router/internal/config/models-config-schema.json). |
| 44 | +- Rating config schema: [`proxy-router/internal/rating/rating-config-schema.json`](proxy-router/internal/rating/rating-config-schema.json). |
| 45 | + |
| 46 | +## Hard rules — never break these |
| 47 | + |
| 48 | +0. **Never confuse the proxy-router HTTP API with the hosted Morpheus Inference API.** The proxy-router API is documented locally at `http://localhost:8082/swagger/index.html` and in [`proxy-router/docs/swagger.yaml`](proxy-router/docs/swagger.yaml). The hosted Morpheus Inference API is a **different product** at [apidocs.mor.org](https://apidocs.mor.org) (base URL `https://api.mor.org/api/v1`) — described in [`docs/inference-api/overview.mdx`](docs/inference-api/overview.mdx). |
| 49 | +1. **Never invent contract addresses, chain IDs, or token addresses.** Use only what's in [`docs/get-started/networks-and-tokens.mdx`](docs/get-started/networks-and-tokens.mdx) or release notes. |
| 50 | +2. **Never invent live values** (active model count, current bid prices, network status). Link out to `https://active.mor.org` instead. |
| 51 | +3. **Never claim Morpheus runs the inference itself.** Independent providers do; Morpheus is a marketplace coordinated by the Diamond contract on BASE. |
| 52 | +4. **Always disambiguate the local `tinyllama` demo from real Morpheus models.** They are not comparable. |
| 53 | +5. **Never describe "open a session" as "spending MOR."** The MOR is escrowed; unused stake returns on close. |
| 54 | +6. **Never tell users to call a `recover` RPC.** It does not exist. Closing the session is the recovery path. |
| 55 | +7. **For TEE questions, distinguish Phase 1 (consumer → P-Node) from Phase 2 (P-Node → backend).** Phase 2 runs *inside* the v7+ provider's P-Node — a v6+ consumer benefits transparently with no client-side upgrade. |
| 56 | +8. **The proxy-router's `:8082` admin port should not be public** — only `:3333` (TCP) is public, and only on provider nodes. |
| 57 | +9. **MorpheusUI mnemonic-recover only works for tier-1 (index 0) addresses.** Don't suggest it for derived addresses; suggest private-key import instead. |
| 58 | +10. **When uncertain, cite a docs page or say so.** Don't guess. |
| 59 | + |
| 60 | +## Common-question quick lookup |
| 61 | + |
| 62 | +| User says | Cite | |
| 63 | +|-----------|------| |
| 64 | +| "How do I use Morpheus without running a node?" | [`docs/inference-api/overview.mdx`](docs/inference-api/overview.mdx) (the hosted Inference API) or [app.mor.org](https://app.mor.org) | |
| 65 | +| "Where is my MOR?" | [`docs/ai/where-is-my-mor.mdx`](docs/ai/where-is-my-mor.mdx) | |
| 66 | +| "Why is MOR locked in the contract?" | [`docs/ai/why-locked-in-contract.mdx`](docs/ai/why-locked-in-contract.mdx) | |
| 67 | +| "What does open/close/recover mean?" | [`docs/ai/session-states-open-close-recover.mdx`](docs/ai/session-states-open-close-recover.mdx) | |
| 68 | +| "Is the local model real Morpheus?" | [`docs/ai/local-vs-blockchain-models.mdx`](docs/ai/local-vs-blockchain-models.mdx) | |
| 69 | +| "How do I install as a consumer?" | [`docs/consumers/quickstart.mdx`](docs/consumers/quickstart.mdx) | |
| 70 | +| "How do I become a provider?" | [`docs/get-started/quickstart-provider.mdx`](docs/get-started/quickstart-provider.mdx) | |
| 71 | +| "How do I run TEE?" | [`docs/providers/full/secretvm-quickstart.mdx`](docs/providers/full/secretvm-quickstart.mdx) | |
| 72 | +| "What contract address?" | [`docs/get-started/networks-and-tokens.mdx`](docs/get-started/networks-and-tokens.mdx) | |
| 73 | +| "Where can I see live status?" | https://active.mor.org | |
| 74 | + |
| 75 | +## When unsure / out-of-corpus questions |
| 76 | + |
| 77 | +If the user's question doesn't match anything on this site or in the repo: |
| 78 | + |
| 79 | +1. Search [`/docs`](docs/) first. |
| 80 | +2. Search [`proxy-router/docs/swagger.yaml`](proxy-router/docs/swagger.yaml) for endpoint shape. |
| 81 | +3. Search the codebase under `proxy-router/`. |
| 82 | +4. **Dynamic query the broader Morpheus docs hub.** [gitbook.mor.org](https://gitbook.mor.org) supports an `?ask=<question>` HTTP query that returns a natural-language answer plus sources. Example: |
| 83 | + ``` |
| 84 | + GET https://gitbook.mor.org/morpheus-inference-marketplace.md?ask=<question> |
| 85 | + ``` |
| 86 | + Cite the returned URLs back to the user so they can verify. |
| 87 | +5. If you still don't have a confident answer, **say so** and link to the closest matching page rather than guessing. |
| 88 | + |
| 89 | +## When asked to write code that talks to the proxy-router |
| 90 | + |
| 91 | +- Use the API documented in `proxy-router/docs/swagger.yaml`. |
| 92 | +- Auth is **HTTP Basic Auth** — see [`docs/reference/api-auth.mdx`](docs/reference/api-auth.mdx). |
| 93 | +- Set the `session_id` header on `/v1/*` calls when targeting a remote (Morpheus) model. Omit it for the local model. |
| 94 | +- Don't hard-code contract addresses — read them from the proxy-router's environment. |
| 95 | + |
| 96 | +## When asked to modify the docs |
| 97 | + |
| 98 | +- The site lives under `/docs` and is built with [Mintlify](https://mintlify.com). |
| 99 | +- Pages are MDX with frontmatter (`title`, `description`, `audience`, `product`, `last_verified`, optional `source_url` for mirrored content). |
| 100 | +- Navigation is in [`docs/docs.json`](docs/docs.json). Add new pages there. |
| 101 | +- Run `mint dev` from `/docs` to preview locally. |
| 102 | + |
| 103 | +## Repository sub-projects |
| 104 | + |
| 105 | +- `proxy-router/` — Go service: the consumer/provider router. Hosts the HTTP API. |
| 106 | +- `MorpheusUI/` — Electron consumer GUI. |
| 107 | +- `cli/` — Go CLI client. |
| 108 | +- `smart-contracts/` — Solidity contracts (Diamond marketplace). |
| 109 | +- `agents/` — agent reference implementations. |
| 110 | +- `docs/` — Mintlify documentation site (this is the doc system). |
0 commit comments