Codex setup guide

Give Codex durable implementation memory across repositories

AGENTS.md can keep the rules that apply to most tasks. Moresq Corpus handles the larger, searchable layer: reviewed patterns, decisions, tests and proof metadata that Codex should retrieve only when the current change needs them.

Codex retrieving one proof-backed implementation before changing a repository.
The agent receives compact metadata first and full code only after the retrieval gate. Open image.

Repository guidance

Keep the durable rule in AGENTS.md.

Define the retrieval gate beside your repository rules: metadata first, no automatic reuse below your match threshold, explicit provenance and a final test requirement.

Connection status

Supported now: scoped HTTP API key. Use a local tool or your own MCP adapter; no one-click public Codex package is claimed here.

Setup

A retrieval-first connection in five steps.

  1. 01

    Create a personal Moresq API key and keep it outside source control.

  2. 02

    Provide corpus.search and corpus.retrieve through a local command or MCP adapter available to Codex.

  3. 03

    Document the search-before-generation rule in AGENTS.md.

  4. 04

    Inspect the compact result card before spending credits or context on full code.

  5. 05

    Adapt the artifact, run its proof pack and record the retrieval outcome.

moresq-corpus.http
export MORESQ_API_KEY="md_..."
export MORESQ_PROJECT="6de3..."

curl -X POST https://data.moresq.com/data/v1/functions/corpus.search \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $MORESQ_API_KEY" \
  -H "X-Project: $MORESQ_PROJECT" \
  -d '{"q":"retry with exponential backoff","limit":5}'

Frequently asked questions

Does Codex need all corpus content in its context?

No. It should receive compact search metadata first and retrieve one relevant artifact only when the fit and evidence are clear.

Where should the API key be stored?

Use an environment variable or a local secret manager. Never place a Moresq key in AGENTS.md, source code, logs or a corpus deposit.

Can the same corpus be used across projects?

Yes, subject to tenant scope, provenance, license and each repository’s security policy. Private artifacts should remain workspace-scoped.

Create a scoped key, then let Codex search before it generates.

Create an agent key