# Create Atomic Context Provider

Build a `BaseDynamicContextProvider` that injects a named, titled block into an agent's...

- Repository: https://github.com/Eigenwise/atomic-agents (6314 stars)
- Category: AI and agents
- License: MIT
- Last updated: 2026-10-29
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add Eigenwise/atomic-agents --skill create-atomic-context-provider -g -a claude-code -y`
Codex: `npx skills add Eigenwise/atomic-agents --skill create-atomic-context-provider -g -a codex -y`
Cursor: `npx skills add Eigenwise/atomic-agents --skill create-atomic-context-provider -g -a cursor -y`
Gemini CLI: `npx skills add Eigenwise/atomic-agents --skill create-atomic-context-provider -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add Eigenwise/atomic-agents`

## Description

Build a `BaseDynamicContextProvider` that injects a named, titled block into an agent's system prompt at every `run()`, current time, user identity, retrieved RAG docs, session state, cached DB schema. Use when the user asks to "add a context provider", "inject X into the prompt", "give the agent dynamic context", "wire up RAG", "make a `BaseDynamicContextProvider`", or runs `/atomic-agents:create-atomic-context-provider`.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Create an Atomic Agents Context Provider

A context provider injects a named, titled block into the agent's system prompt at every `run()`. The base prompt stays static; the context is what changes between calls.

For deep material (caching strategies, async data sources, multi-agent sharing patterns), the authority is `../framework/references/context-providers.md`. This skill is the action-oriented path: clarify → write → register.

## When this fires vs the umbrella `framework` skill

- **This skill**: the user wants to add a provider, "inject the user's name", "make the agent see the current time", "feed retrieved docs into the prompt", "share session state across two agents".
- **`framework` skill**: questions about Atomic Agents in general, or about something other than authoring a provider.

## Phase 1, Clarify

Bundle into one message:

1. **What goes into the prompt?** One sentence. Defines the provider's job.
2. **Where does the data come from?** In-memory state mutated by your code? A vector DB lookup? A REST call? A clock?
3. **How fresh must it be?** Per-`run()` (default), every N seconds (cache), or refreshed externally before each call (async data).
4. **Which agent(s)?** One agent, or shared across multiple agents?

Skip what's already obvious from context.

## Phase 2, Plan

Confirm in one short block:

- File: `<project>/context_providers.py` (or alongside the agent that owns it).
- Class: `<Topic>Ctx(BaseDynamicContextProvider)`.
- Title (rendered as the section header in the prompt), must be unique across providers on the same agent.
- Update mechanism: mutate fields between `run()` calls (most common), set via a method, or `await refresh()` for async sources.

## Phase 3, Implement

### Skeleton

```python
from atomic_agents.context import BaseDynamicContextProvider


class UserCtx(BaseDynamicContextProvider):
    def __init__(self):
        super().__init__(title="User Context")
        self.name: str = ""
        self.role: str = ""

The rest: https://github.com/Eigenwise/atomic-agents/blob/HEAD/claude-plugin/atomic-agents/skills/create-atomic-context-provider/SKILL.md
