adding-knowledge

A procedure for adding documents such as PDFs or reference files to an Agent2 agent's searchable knowledge. The documents are indexed so the agent can look up rules and other information while it runs.

In plain words
What is it for?
Use it to create a knowledge collection, register its documents, ingest them, connect the search service, and configure which agents or tenants can use it.
Why use it?
It replaces hardcoded reference tables and keeps domain material in documents that can be updated and searched. It also supports separate knowledge collections for different clients or contexts.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/artesiana/agent2/adding-knowledge
Any agent
npx skills add Artesiana/agent2 --skill adding-knowledge
Clone the repo
git clone --depth 1 https://github.com/Artesiana/agent2

Made for: Claude Code, Codex.

Per session 44 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,064 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00044 $0.01064
Opus 5 $0.00022 $0.00532
Sonnet 5 $0.00009 $0.00213
Haiku 4.5 $0.00004 $0.00106

Measured 2d ago against content hash c877462101da, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

adding-knowledge scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/adding-knowledge/SKILL.md · 149 lines

How it starts

The opening of the file, as written. The whole thing — 149 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Adding Knowledge to Agents

Overview

Agent2 agents access knowledge through R2R (hybrid search) via Knowledge MCP. You add PDFs or documents to a collection, the agent searches them at runtime. No hardcoding of domain rules — the agent learns from books.

When to Activate

  • Agent needs to look up rules, standards, or reference material
  • User says "add knowledge", "add books", "ingest documents", "RAG"
  • Agent needs different knowledge per client/tenant/context
  • User wants to replace hardcoded lookup tables with searchable knowledge

Architecture

PDFs / Documents
  → R2R ingestion (chunking, embedding, indexing)
  → Searchable collection
  → Knowledge MCP server (FastMCP wrapper)
  → Agent calls search() and get_passage() via toolsets=

Step-by-Step

1. Create Collection Directory

mkdir -p knowledge/books/my-collection/
# Place PDFs, markdown, or text files here

2. Register in collections.yaml

# knowledge/collections.yaml
collections:
  my-collection:
    description: "What these documents contain"
    books_dir: books/my-collection/
    agents:
      - my-agent

3. Ingest Documents

# Start the full stack (includes R2R)
docker compose --profile full up -d

# Ingest all collections
python -m shared.ingest --all

# Or a specific collection
python -m shared.ingest --collection my-collection --dir knowledge/books/my-collection/

4. Wire Agent to Knowledge MCP

# agents/my-agent/agent.py
from pydantic_ai.mcp import MCPServerStreamableHTTP

knowledge_mcp_url = os.environ.get("KNOWLEDGE_MCP_URL", "http://localhost:9090/mcp")
knowledge_server = MCPServerStreamableHTTP(knowledge_mcp_url)

agent = create_agent(
    name="my-agent",
    output_type=MySchema,
    instructions="... Use search() to look up relevant information ...",
    toolsets=[knowledge_server],
)

For concurrent or request-scoped agents, create fresh MCPServerStreamableHTTP instances in before_run() and return them as _toolsets; Agent2 passes them to Agent.run(toolsets=...).

Read the full file on GitHub · 149 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 149 lines · 44 tokens per session scan A c877462101da

Subscribe to this mod's changes

adding-knowledge is a skill published in the GitHub repository Artesiana/agent2 (36 stars, last pushed 3mo ago), licensed MIT. It adds 44 tokens to every session and 1,064 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

fastapi-modern-patterns

Curated Knowledge API for AI Agents — 68 MCP tools, 200+ skill packs, 46K chunks, semantic search over 670K vectors, 5-layer validation pipeline. Works with Claude Code, Cursor, Cline, Windsurf.

MidOSresearch/midos · 5 tokens

fastapi-microservices-development

Comprehensive guide for building production-ready microservices with FastAPI including REST API patterns, async operations, dependency injection, and deployment strategies.

manutej/luxor-claude-marketplace · 33 tokens

datamodel-code-generator

Use this skill when the user wants Python data models, Pydantic models, dataclasses, TypedDicts, msgspec structs, or type-safe Python classes generated from OpenAPI, AsyncAPI, JSON Schema, GraphQL, JSON/YAML/CSV sample data, MCP tool schemas, Protocol Buffers, XML Schema, Apache Avro, or existing Python model objects.…

koxudaxi/datamodel-code-generator · 147 tokens

openai-docs

Use when the user asks how to build with OpenAI products or APIs and needs up-to-date official documentation with citations (for example: Codex, Responses API, Chat Completions, Apps SDK, Agents SDK, Realtime, model capabilities or limits); prioritize OpenAI docs MCP tools and restrict any fallback browsing to…

Soju06/codex-lb · 74 tokens

training-llms-megatron

Trains large language models (2B-462B parameters) using NVIDIA Megatron-Core with advanced parallelism strategies. Use when training models >1B parameters, need maximum GPU efficiency (47% MFU on H100), or require tensor/pipeline/sequence/context/expert parallelism. Production-ready framework used for Nemotron, LLaMA…

Orchestra-Research/AI-Research-SKILLs · 82 tokens

environment-discovery

Systematic exploration of unknown environments before starting work.

vstorm-co/pydantic-deepagents · 13 tokens