Memory (CLAUDE.md)
Persistent context loaded at the start of every conversation.
Memory is a markdown file that provides persistent context to your agent. The contents of CLAUDE.md are automatically loaded at the start of every conversation, giving your agent knowledge about your project.
How It Works
When your agent starts a conversation, it reads CLAUDE.md and includes its contents in the system prompt. This means the agent always has access to:
- Project structure and architecture
- Coding standards and conventions
- Security boundaries and restrictions
- Build and deployment procedures
- Team-specific guidelines
File Location
Memory is stored at the root of your project:
my-agent/
├── CLAUDE.md # ← Memory file
├── package.json
└── src/
└── ...Structure
A typical CLAUDE.md file contains several sections:
1# Project Context
2
3This is a Node.js CLI application that processes financial documents.
4The agent helps users extract data from invoices, receipts, and statements.
5
6## Codebase Structure
7
8- `src/` - Main source code
9 - `cli.ts` - Entry point and command handling
10 - `agent.ts` - Core agent logic
11 - `extractors/` - Document extraction modules
12- `data/` - Sample documents for testing
13- `output/` - Generated reports and exports
14
15## Team Standards
16
17- Use TypeScript strict mode
18- Follow ESLint configuration
19- Write JSDoc comments for public functions
20- Use semantic commit messages
21
22## Security Policy
23
24**Restricted areas:**
25- Never modify files in `/etc` or system directories
26- Do not access credentials outside `.env`
27- Do not make external API calls without user confirmation
28
29**Data handling:**
30- Treat all financial data as sensitive
31- Do not log PII to console
32- Sanitize output before display
33
34## Build & Deployment
35
36```bash
37# Development
38npm run dev
39
40# Production build
41npm run build
42
43# Run tests
44npm test
45```Sections Explained
Project Context
High-level description of what the project is and what the agent should help with. This sets the overall tone and focus for the agent.
Codebase Structure
Map of important directories and files. Helps the agent navigate the project and understand where different types of code live.
Team Standards
Coding conventions, style guides, and practices the agent should follow. This ensures generated code matches your team's expectations.
Security Policy
Boundaries and restrictions. Define what the agent should never do and how it should handle sensitive data.
Security boundaries
Security policies in CLAUDE.md are guidelines, not hard enforcement. For strict security, use permission levels and hooks.
Build & Deployment
Common commands and procedures. The agent can reference these when helping with builds, tests, or deployments.
Best Practices
Keep It Focused
Memory is loaded every conversation. Keep content relevant and concise. Don't include documentation that belongs elsewhere.
Use Clear Headings
Well-structured markdown helps the agent find relevant information quickly. Use consistent heading levels.
Update Regularly
Keep CLAUDE.md in sync with your project. Outdated information can mislead the agent.
Be Specific About Restrictions
Vague security policies are easy to misinterpret. Be explicit about what the agent should and shouldn't do.
Configuration in Agent Workshop
In the Levers Configuration step, the Memory tab lets you configure:
- Enable/disable - Toggle memory on or off
- Predefined sections - Project Context, Codebase Structure, Team Standards, Security Policy
- Custom sections - Add your own sections with custom titles and content
Example: Development Agent
1# Project Context
2
3Full-stack web application using Next.js, TypeScript, and PostgreSQL.
4Agent assists with feature development, bug fixes, and code review.
5
6## Codebase Structure
7
8- `app/` - Next.js app router pages
9- `components/` - React components
10- `lib/` - Utilities and helpers
11- `prisma/` - Database schema and migrations
12- `tests/` - Jest test files
13
14## Team Standards
15
16- Components use TypeScript FC pattern
17- State management via React Query
18- Tailwind CSS for styling
19- Zod for runtime validation
20
21## Security Policy
22
23- Validate all user input with Zod
24- Use parameterized queries (Prisma handles this)
25- Never expose API keys in client code
26- Sanitize HTML output to prevent XSSExample: Research Agent
1# Project Context
2
3Research assistant for academic literature review.
4Helps synthesize papers, track citations, and generate summaries.
5
6## Research Standards
7
8- Always cite sources with author, year, and page
9- Use APA citation format
10- Distinguish between primary and secondary sources
11- Note confidence level for claims
12
13## Output Formats
14
15- Literature summaries: 200-300 words with key findings
16- Citation lists: Alphabetical by author
17- Synthesis reports: Structured with methodology, findings, implications
18
19## Quality Guidelines
20
21- Cross-reference claims across multiple sources
22- Flag contradictory findings
23- Note limitations and gaps in literature
24- Avoid over-generalizing from limited sources