An Agent Skill that gives AI agents offline access to the full Factorio Lua API — 4,195 indexed entries (classes, methods, attributes, events, concepts, defines) with BM25-ranked search. No network needed at query time.
runtime-api.json → SQLite FTS5 Index → BM25 Search → Agent Context
(one-time fetch) (build_index.py) (search.py)
Queries hit the local docs.db (1.7 MB, pre-built). Network is only used when you explicitly run update.py to check for a new Factorio version.
# Full-text search (BM25, porter stemming)
python3 scripts/search.py "inventory insert"
# Filter by kind: class · method · attribute · event · concept · define
python3 scripts/search.py --kind event "player built"
python3 scripts/search.py --kind method "fluid temperature"
# Exact name lookup (case-insensitive)
python3 scripts/search.py --exact LuaEntity
python3 scripts/search.py --exact on_built_entity
# All members of a class
python3 scripts/search.py --parent LuaEntity --kind method
# More results / full body
python3 scripts/search.py --top 30 --verbose "circuit network signal"The pre-built index covers Factorio 2.0.76 / API v6. To update after a game version bump:
python3 scripts/update.py # fetches only if remote version changed| Script | Purpose |
|---|---|
scripts/search.py |
Query the local index (offline) |
scripts/build_index.py |
Build references/docs.db from JSON |
scripts/fetch_api.py |
Download runtime-api.json |
scripts/update.py |
Version-aware update (fetch + rebuild if changed) |
| Kind | Count |
|---|---|
| classes + methods + attributes | 3,411 |
| events | 219 |
| concepts | 418 |
| defines | 147 |
| total | 4,195 |
python3 -m pytest tests/test_e2e.py -v # 31 E2E tests, ~1s