Back to Skills

claude-agent-sdk-context-management

verified

Use when managing agent context, memory, and conversation state in Claude AI agents using the Agent SDK.

View on GitHub

Marketplace

han

TheBushidoCollective/han

Plugin

jutsu-claude-agent-sdk

Technique

Repository

TheBushidoCollective/han
60stars

jutsu/jutsu-claude-agent-sdk/skills/context-management/SKILL.md

Last Verified

January 24, 2026

Install Skill

Select agents to install to:

Scope:
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-management

Installation paths:

Claude
.claude/skills/claude-agent-sdk-context-management/
Powered by add-skill CLI

Instructions

# 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);
``

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
7434 chars

Issues Found:

  • name_directory_mismatch