Use when managing agent context, memory, and conversation state in Claude AI agents using the Agent SDK.
View on GitHubTheBushidoCollective/han
jutsu-claude-agent-sdk
January 24, 2026
Select agents to install to:
npx add-skill https://github.com/TheBushidoCollective/han/blob/main/jutsu/jutsu-claude-agent-sdk/skills/context-management/SKILL.md -a claude-code --skill claude-agent-sdk-context-managementInstallation paths:
.claude/skills/claude-agent-sdk-context-management/# Claude Agent SDK - Context Management
Managing agent memory, context, and conversation state in the Claude Agent SDK.
## Setting Sources
### Project Memory
```typescript
import { Agent } from '@anthropic-ai/claude-agent-sdk';
// Load project-specific context from .claude/CLAUDE.md
const agent = new Agent({
settingSources: ['project'],
});
```
### User Memory
```typescript
// Load user preferences from ~/.claude/CLAUDE.md
const agent = new Agent({
settingSources: ['user'],
});
```
### Combined Sources
```typescript
// Load both user and project settings
const agent = new Agent({
settingSources: ['user', 'project'],
});
```
## CLAUDE.md Files
### Project Context (.claude/CLAUDE.md)
```markdown
# Project Context
This is a TypeScript web application using React and Next.js.
## Code Style
- Use functional components
- Prefer hooks over class components
- Use TypeScript strict mode
## Architecture
- API routes in /pages/api
- Components in /components
- Utilities in /lib
```
### User Preferences (~/.claude/CLAUDE.md)
```markdown
# User Preferences
## Communication Style
- Be concise
- Show code examples
- Explain reasoning
## Development Environment
- Primary editor: VS Code
- Node version: 20.x
- Package manager: pnpm
```
## System Prompts
### Direct System Prompt
```typescript
const agent = new Agent({
systemPrompt: `You are an expert TypeScript developer.
Follow these guidelines:
- Use strict type checking
- Prefer immutability
- Write comprehensive tests`,
});
```
### Dynamic System Prompt
```typescript
const projectType = detectProjectType();
const agent = new Agent({
systemPrompt: `You are a ${projectType} specialist.
Current project: ${process.cwd()}
Node version: ${process.version}`,
});
```
## Conversation State
### Single-Turn Conversations
```typescript
const agent = new Agent({
settingSources: ['project'],
});
const response = await agent.chat('What is this project about?');
console.log(response);
``Issues Found: