create-atomic-context-provider
What it does
It explains how to write a context provider that adds a titled block to an agent's system prompt on each run. It is for developers who want their agent to know current or retrieved information.
When to use it
- βWhen a developer wants the agent to know the current time or user identity on each call.
- βWhen a developer wants retrieved documents injected into the agent's prompt.
- βWhen two agents need to share the same session information.
Skill link
https://github.com/Eigenwise/atomic-agents/blob/main/claude-plugin/atomic-agents/skills/create-atomic-context-provider/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βAdd a context provider that gives my agent the current user's name and their saved preferences.β
5 new skills a week. 1 minute to read.
How it works
The skill asks where the data comes from and how fresh it must be, then writes a provider class that returns a titled block and registers it with the agent.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
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".
frameworkskill: questions about Atomic Agents in general, or about something other than authoring a provider.
Phase 1 β Clarify
Bundle into one message:
- What goes into the prompt? One sentence. Defines the provider's job.
- Where does the data come from? In-memory state mutated by your code? A vector DB lookup? A REST call? A clock?
- How fresh must it be? Per-
run()(default), every N seconds (cache), or refreshed externally before each call (async data). - 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, orawait refresh()for async sources.
Phase 3 β Implement
Skeleton
from atomic_agents.context import BaseDynamicContextProvider
class UserCtx(BaseDynamicContextProvider):
def __init__(self):
super().__init__(title="User Context")
self.name: str = ""
self.role: str = ""
def get_info(self) -> str:
if not self.name:
return "No user is logged in."
return f"User: {self.name} (role: {self.role})"
get_info() is synchronous and runs on every agent.run() β keep it cheap. No HTTP, no DB queries, no file I/O. Cache slow sources (see "Cached" pattern below). For async data sources, await provider.refresh() from your loop before calling the agent.
Common patterns
Time β read-only, no state mutation needed:
from datetime import datetime, timezone
class TimeCtx(BaseDynamicContextProvider):
def __init__(self):
super().__init__(title="Current Time")
def get_info(self) -> str:
return datetime.now(timezone.utc).isoformat()
RAG / retrieved docs β set externally, read inside get_info():
class RAGCtx(BaseDynamicContextProvider):
def __init__(self):
super().__init__(title="Retrieved Documents")
self.docs: list[dict] = []
def set(self, docs: list[dict]) -> None:
self.docs = docs
def get_info(self) -> str:
if not self.docs:
return "No relevant documents retrieved."
return "\n\n".join(f"[{d['source']}] {d['content']}" for d in self.docs)
# In the calling code, just before agent.run():
rag.set(vector_db.search(query, k=4))
agent.run(query_input)
Session β mutable key/value state shared across agents:
class SessionCtx(BaseDynamicContextProvider):
def __init__(self):
super().__init__(title="Session")
self._data: dict[str, str] = {}
def set(self, key: str, value: str) -> None:
self._data[key] = value
def get_info(self) -> str:
if not self._data:
return "No session state."
return "\n".join(f"- {k}: {v}" for k, v in self._data.items())
Cached β for slow sources (DB schema, expensive computation):
import time
class DBSchemaCtx(BaseDynamicContextProvider):
def __init__(self, conn, ttl_seconds: int = 300):
super().__init__(title="Database Schema")
self._conn = conn
self._ttl = ttl_seconds
self._cached: str = ""
self._at: float = 0.0
def get_info(self) -> str:
now = time.time()
if not self._cached or now - self._at > self._ttl:
self._cached = render_schema(self._conn)
self._at = now
return self._cached
Async source β refresh outside, read sync inside:
clas
FAQ
What is a context provider?
It is a piece of code that adds a named section to the agent's system prompt when it runs.
Does it change the base prompt?
No. The base prompt stays the same, and only the injected context changes between calls.
Can one provider serve several agents?
Yes. The skill covers sharing a provider across agents.
Details
Original description by the author
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`.
repo: Eigenwise/atomic-agents
Popularity
- GitHub stars
- 6.3k
- Ranking position
- #14238
- License
- MIT
- Updated
- 10/29/2026
Comments
- β¦
More skills from this repository
create-atomic-agent
6.3kHelps your agent build a new Atomic Agents agent with typed input and output, a system prompt, and a chosen AI provider.
create-atomic-schema
6.3kHelps your agent design typed input and output schemas for Atomic Agents agents and tools, with clear field descriptions.
create-atomic-tool
6.3kHelps your agent build a typed tool for an Atomic Agents app, such as an API wrapper or calculator that an agent can call.
framework
6.3kHelps your agent work correctly with the Atomic Agents Python framework, covering schemas, agents, tools, prompts and provider setup.
Similar skills
add-model-provider
394kLets your agent connect a new AI model provider to OpenClaw using safe setup commands, keep API keys out of plain text, and run a live test.
acp-router
394kHelps your agent send a task to a coding assistant such as Claude Code or Cursor through OpenClaw, so the work runs in that tool.
browser-automation
394kTeaches your agent to control web pages step by step, including logins, tabs, and recovery when a page stops responding.