English · 한국어
Agent Context Loader Bench compares how different context loading strategies affect a real LLM agent working from the same instruction corpus.
The benchmark is about agent behavior, not raw database throughput. A useful loader should select the right skill text, avoid irrelevant tokens, keep behavior explainable, and help the agent complete the requested task reliably.
Markdown remains the canonical instruction format:
AGENTS.mdcontains project-wide agent rules and must be read first.skills/**/SKILL.mdcontains reusable task skills with YAML frontmatter.wiki/**/*.mdcontains project knowledge, troubleshooting notes, decisions, and background context.
Runtime indexes under .agentdb/ are derived artifacts. They may help select context, but the final LLM context must contain human-readable instruction text from the Markdown sources.
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install -e ".[dev]"
cp .env.example .envLeave OPENAI_API_KEY empty unless you are explicitly running live LLM comparisons.
File-system loading does not require an index:
python -m agent_loader_bench inspect \
--loader fs_direct \
--request-id req.vllm.benchmark.exactBuild derived indexes before using index-backed loaders:
python -m agent_loader_bench build-manifest
python -m agent_loader_bench build-index --backend allInspect or run a dataset with a specific loader:
python -m agent_loader_bench inspect \
--loader manifest_json \
--request-id req.docs.troubleshooting.multi_skill
python -m agent_loader_bench run \
--loader sqlite_fts_section \
--dataset datasets/requests.ymlCompare loaders across a trace file (deduplicates by run_id, latest wins):
python -m agent_loader_bench compare --trace .agentdb/traces.jsonlThe project compares these strategies against the same model, task dataset, and Markdown corpus:
fs_direct: scanskills/**/SKILL.mdandwiki/**/*.mddirectly.manifest_json: read.agentdb/manifest.json, then load Markdown sources.sqlite_metadata: use SQLite metadata filters, then load Markdown sources.sqlite_fts: use SQLite full-text search over titles, descriptions, and bodies.sqlite_fts_section: use full-text search and assemble only relevant sections.json_document: use structured JSON documents derived from Markdown.vector_search: embed documents and queries, rank by cosine similarity.hybrid: combine simpler strategies after their behavior is tested.
Indexes must be explicitly rebuilt when the Markdown corpus changes.
vector_search uses an embedding provider selected by EMBEDDING_PROVIDER:
openai(default): real embeddings viaEMBEDDING_MODEL(defaulttext-embedding-3-small).build-index --backend vector|alland loading the index requireOPENAI_API_KEY.hashing: offline, deterministic feature-hashing (no network) — use for fully offline runs and reproducible tests.
The index records the provider/model it was built with, and the loader embeds the query with that same model, so rebuild the index after changing the provider.
Normal test and run commands do not call an LLM. Live comparison is opt-in:
OPENAI_API_KEY=... python -m agent_loader_bench run \
--loader manifest_json \
--dataset datasets/requests.yml \
--live-llmUse the same model, temperature, task dataset, and corpus when comparing loaders. Change only the loader strategy.
The provider is inferred from LLM_MODEL: a claude-* model routes to the Anthropic client (ANTHROPIC_API_KEY and the anthropic extra required: pip install -e '.[anthropic]'); anything else uses OpenAI. Set LLM_PROVIDER=openai|anthropic to override. Claude models are called without sampling parameters (Opus 4.8 rejects temperature/top_p).
Run unit tests without live LLM calls:
python3 -m pytestRun tests marked for the opt-in live LLM path only when that path is intentionally under review:
python3 -m pytest -m live_llmSample corpus checks live in tests/test_project_samples.py.