Skip to content

Coding agent knowledge

How to Give Codex a Source-Backed Project Knowledge Base

Keep repository rules, source-of-truth documents, and maintained project knowledge separate so Codex can retrieve evidence without loading everything.

Qi-Xuan LuUpdated 5 min read

Article packet

01

Workflows

02

Developers who want Codex or another coding agent to reuse trustworthy project knowledge

03

5 min read

01

Keep AGENTS.md or CLAUDE.md short and reserve it for instructions the agent must load every time.

02

Keep code, tests, specifications, and maintained documents as the source of truth.

03

Retrieve only the relevant cited page, then verify the conclusion against the repository and tests.

01

Quick answer

Use AGENTS.md or CLAUDE.md for short operating instructions, keep repository files as the source of truth for current facts, and use a source-backed knowledge base for decisions and explanations that must remain cited, reviewable, and reusable across sessions.

Wenlan keeps Sources, atomic knowledge, and maintained Pages separate. Codex can connect to the local daemon, retrieve a relevant Page, inspect its citations, and share the same reviewed project knowledge with Claude Code or another MCP client.

02

When this problem appears

A giant instruction file consumes context and becomes stale, while raw repository search repeatedly rediscovers the same architecture decisions and external constraints. A coding agent needs a small always-loaded contract plus an on-demand, source-backed project knowledge layer.

03

Use AGENTS.md and the knowledge base for different jobs

Start with one bounded project topic and one inspectable document set. The slash commands below require the Wenlan Codex plugin: install it and run /setup once. The wenlan connect codex command configures the MCP connection only; MCP-only clients should use the equivalent Wenlan tools instead of slash commands. Then prove the complete read, cite, verify, and refresh loop before adding more material.

  • Put build commands, repository boundaries, and non-obvious rules in AGENTS.md or CLAUDE.md.
  • Keep code, tests, specifications, and first-party docs authoritative; do not copy facts the agent can read directly.
  • Add only supported Markdown, text, text-extractable PDF, or Obsidian sources to the maintained knowledge layer.
  • Distill one repeated question into a Page, then check that important claims return to a source or repository fact.
  • Run lint and review before trusting a refreshed answer, especially after source files change.

One bounded Codex knowledge workflow

wenlan status
wenlan connect codex
wenlan sources add ~/project/docs
/distill <project topic>
/pages <project topic>
/lint
/curate

04

What to check next

Do not turn the knowledge base into a second copy of the repository. If the answer is already clear in current code or tests, link to that source; maintain only the reasoning, external constraint, or cross-file conclusion that is expensive to reconstruct.

Give Codex one project topic it can verify

Connect Codex, add one inspectable source set, and prove that the resulting Page stays cited, reviewable, and subordinate to the repository.

FAQ

Should AGENTS.md contain the whole project knowledge base?+
No. Keep it short and always relevant. Put longer explanations in maintained documents or on-demand knowledge pages so they do not crowd out the task and current code.
Can the knowledge base override the repository?+
No. Current code, tests, specifications, and approved first-party documents remain authoritative. A knowledge page should expose citations and become stale or reviewable when those sources change.