# How to teach Claude Code your knowledge

Put project instructions in a `CLAUDE.md` file, and use auto memory for learnings that should carry across conversations. [Claude Code also reads `AGENTS.md` as project instructions](https://code.claude.com/docs/en/memory). KnowMan’s local [MCP server](https://www.knowman.io/guides/mcp-server-knowledge-base) includes tools to search and read [saved articles](https://www.knowman.io/guides/how-to-save-articles) and save new URLs. See the KnowMan MCP guide.

## Write instructions Claude Code can use

A `CLAUDE.md` file holds instructions and rules you write. Claude Code reads it at the start of each session, but treats its contents as context rather than enforced configuration. [Claude Code memory documentation](https://code.claude.com/docs/en/memory) recommends instructions concrete enough to verify.

For a project, place the file at `./CLAUDE.md` or `./.claude/CLAUDE.md`. Claude Code can also use `AGENTS.md` as project instructions, so a repository configured for another [coding agent](https://www.knowman.io/guides/knowledge-base-for-ai-agents) can work without adding `CLAUDE.md`. [See the Claude Code documentation](https://code.claude.com/docs/en/memory).

## Keep rules focused and easy to check

Aim for fewer than 200 lines in each `CLAUDE.md`; longer files use more context and may reduce adherence. Put rules that apply only to part of the codebase in path-scoped rules under `.claude/rules/`. [Claude Code documents both approaches](https://code.claude.com/docs/en/memory).

You can import reference files with `@path/to/import`. Imported content loads alongside the `CLAUDE.md` that references it, and nested imports can go up to four hops. Wrap a path in backticks when you want to mention it without importing it. [Read the import guidance](https://code.claude.com/docs/en/memory).

## Use auto memory for learnings

Claude Code starts each session with a fresh context window. Auto memory is enabled by default in local sessions and can retain learnings and patterns across conversations, while `CLAUDE.md` is for instructions and rules you write. [Claude Code explains the difference](https://code.claude.com/docs/en/memory).

Auto memory stores a `MEMORY.md` index and separate topic files. The first 200 lines or 25KB of `MEMORY.md`, whichever comes first, load at conversation start. Topic files load on demand. Use `/memory` to browse or edit memory files. [See the memory file details](https://code.claude.com/docs/en/memory).

## Check what loaded

Run `/context all` and look under Memory files to confirm a `CLAUDE.md` file loaded. Run `/init` to generate a starting file from the codebase; if one already exists, `/init` suggests improvements instead of overwriting it. [These checks are documented by Claude Code](https://code.claude.com/docs/en/memory).

If instructions may be outdated or conflict, `/doctor prompt-audit` reports findings and proposed edits without changing files. [Claude Code documentation describes the audit](https://code.claude.com/docs/en/memory).

## Connect KnowMan for saved articles

KnowMan's MCP server runs locally with `npx -y @knowman/mcp` and as a hosted server at https://api.knowman.io/mcp with OAuth sign-in or an API key. Its tools include `kb_search` for finding saved items, `kb_get_item` for reading one item, `kb_ask` for answers with citations, and `kb_save` for saving a URL with an optional note. Learn how a knowledge base MCP server works.

For [Claude Code setup](https://www.knowman.io/integrations/claude-code), see the [Claude Code knowledge base guide](https://www.knowman.io/guides/claude-code-knowledge-base). The server uses `@knowman/mcp`; its documented setup requires Node 22 or newer and a KnowMan API key. Read the KnowMan MCP guide. [Explore ways to give an AI your context](https://www.knowman.io/guides/give-your-ai-context).

## Where KnowMan fits

Use `CLAUDE.md` for project rules, auto memory for learnings, and KnowMan for articles and links you save. KnowMan can answer questions with citations and keep saved claims, decisions, and playbooks. [See the Claude knowledge base guide](https://www.knowman.io/guides/claude-knowledge-base).

KnowMan's MCP server runs locally with `npx -y @knowman/mcp` and as a hosted server at https://api.knowman.io/mcp, so Claude Code can use the [local server](https://www.knowman.io/guides/what-is-an-mcp-server) or connect to the hosted one with OAuth sign-in or an API key. Read the KnowMan MCP guide.

## Use the hosted KnowMan server in Claude Code

KnowMan also runs as a hosted remote MCP server at https://api.knowman.io/mcp. Add that URL in Claude Code and [sign in](https://www.knowman.io/guides/personal-knowledge-base) with OAuth: Claude Code opens the KnowMan consent page, where you approve the knowman.read scope for search, read, and ask, and the knowman.write scope for saving links. Access tokens last one hour and refresh automatically.

You can also connect with an API key created in KnowMan settings, sent as an Authorization: Bearer header. Run: `claude mcp add --transport http knowman https://api.knowman.io/mcp --header "Authorization: Bearer <key>"`. Then ask Claude Code to search or save, for example "search my KnowMan for ..." or "save this URL".

To disconnect Claude Code later, delete its "OAuth: Claude Code" entry in your KnowMan API-keys list. The open-source local client at [knowman-mcp](https://github.com/Essatt/knowman-mcp) is still there if you prefer to run `npx -y @knowman/mcp` yourself.

## Questions

### Does Claude Code remember instructions between sessions?

Claude Code reads `CLAUDE.md` files at the start of every session, and auto memory can carry learnings across conversations. Each session begins with a fresh context window. [Claude Code documents both memory types](https://code.claude.com/docs/en/memory).

### Where should I put project instructions?

A project `CLAUDE.md` can go at `./CLAUDE.md` or `./.claude/CLAUDE.md`. Claude Code can also read `AGENTS.md` as project instructions. [See the Claude Code documentation](https://code.claude.com/docs/en/memory).

### Can Claude Code read my saved articles with KnowMan?

The KnowMan MCP package includes `kb_search` and `kb_get_item` for searching saved items and reading one item. It also includes `kb_ask` for answers with citations. Read the KnowMan MCP guide.

### Can I make a CLAUDE.md rule impossible to ignore?

No. Claude Code treats `CLAUDE.md` instructions as context, not enforced configuration. For an action that must be blocked regardless of Claude’s decision, Claude Code documentation recommends a PreToolUse hook. [See the memory documentation](https://code.claude.com/docs/en/memory).

## Related guides

- [Give Claude Code a knowledge base built from your reading](https://www.knowman.io/guides/claude-code-knowledge-base)

- [How to Build a Claude Knowledge Base](https://www.knowman.io/guides/claude-knowledge-base)

- [How to Give Your AI Context from What You Read](https://www.knowman.io/guides/give-your-ai-context)

- [Connect your knowledge base through KnowMan's MCP server](https://www.knowman.io/guides/mcp-server-knowledge-base)

- [What is a personal knowledge base, and how do you build one?](https://www.knowman.io/guides/personal-knowledge-base)

## More in this topic

- [How to teach Codex your knowledge](https://www.knowman.io/guides/teach-codex-your-knowledge)
- [How to teach Claude Desktop your knowledge](https://www.knowman.io/guides/teach-claude-desktop-your-knowledge)
- [How to teach Cline your knowledge](https://www.knowman.io/guides/teach-cline-your-knowledge)

## More for Claude Code

- [Connect KnowMan to Claude Code](https://www.knowman.io/integrations/claude-code)
- [How memory works in Claude Code](https://www.knowman.io/guides/claude-code-memory)

## Keep your knowledge close

Try KnowMan Pro for 14 days with no credit card. [Create your account](https://app.knowman.io/signup)

[Start free](https://app.knowman.io/signup)

Every new account starts with 14 days of Pro. No credit card.

Source: https://www.knowman.io/guides/teach-claude-code-your-knowledge
