eleticle

Core No. 18Logged 23 Nov 2026Code & data →

How can a local agent find the right tag among 50,000?

Real hourly flotation and plant records · generated tags and records inside each hour · 50,594 tags · 60 test questions · no language model in this test

We built a stand-in for a plant historian with 50,594 tags on real hourly records, a crawler that turns its asset tree into a searchable catalogue, and an MCP server a local agent calls. Then we tested the search on 60 questions written from a description of the plant.

What we found

  • Right tag in the top 10On the 44 questions that have a real tag, the catalogue search put 0.915 of the right tags in its top 10 on average (a group counted in part), plain keyword search 0.71: better on 14 questions, worse on 2.
  • Reading the placeMost of the gain is reading the site and concentrator named in the question: keyword search given the same place filter reached 0.938, a little above the catalogue search.
  • The list does not fitThe whole tag list is 2,162,399 tokens, 13 times the local model’s 165,000-token window; one search answer is about 1,800.
  • Faults flaggedThe nightly crawl, 14.5 seconds against the stand-in, marked 2,602 tags as stale, empty, broken or bad quality, so the agent is told before it reads them.
  1. Method
  2. 01The build
  3. 02Real hours, generated seconds
  4. 03What the crawl found
  5. 04Why search
  6. 05The search test
  7. 06Question by question
  8. 07At your site
  9. Sources

Method

A stand-in historian on real records, searched before anything is read

  • RealHourly recordsMost flotation readings and the SAG feed follow Zyfra’s gold flotation record (22,716 hours, 2016 to 2018, cited, not republished); the mill powers, cyclone densities, frother and leach readings follow a private plant’s hourly records (the method is published, not the data); the rest are generated.
  • GeneratedThe plant and the seconds31 sites × 5 concentrators in one asset tree, four tag-naming styles, faults planted on purpose, and a scan every 5 seconds or analyser cycle whose hourly mean is the real hour’s value.
  • BuiltSix partsA stand-in for the PI System’s web API (ours, the same request and response shapes, no vendor code), a read-only connector, a nightly crawler, a catalogue in SQLite, an MCP server with 8 tools, a skill for the agent.
  • Tested60 questions, scored onceWritten by Codex from a description of the plant, without the code; the right tags taken from the plant generator and checked a second time; the search code frozen first. Compared with plain keyword search on the raw tag paths, point names and descriptions.

Limits: a stand-in, not a vendor server, so crawl time does not carry over; one shared key, so no rights per user and no user in the log; one question set; every question names a site and 58 of 60 a concentrator, which a person may not; no language model here (No. 19 runs one); a development round before this one was set aside because its questions borrowed our words. Code, configuration, questions, key and every result: the article’s public repository.

01 · The build

Read the tree at night, search it when asked

The agent never sees the tag list. Each night a crawler reads the historian’s asset tree through a read-only connector and writes a catalogue; when someone asks, the agent searches the catalogue and reads only the tags it chose.

The parts, two pathsread-only throughout
Every read of the historian goes through a read-only connector. Each night the crawler reads the asset tree through it and writes the catalogue. When someone asks, the agent calls the MCP server, which searches the catalogue and reads only the chosen tags, through the same connector.

Every read of the historian, the crawler’s and the agent’s, goes through one read-only connector, which refuses anything but reads. The MCP server reads at most ten tags a call, puts long results in a file and says where every number came from.

02 · Real hours, generated seconds

Each real hour, filled with records

A historian keeps records as they arrive, not only hourly averages. Inside every real hour the stand-in scans the way the instrument would, every 5 seconds or analyser cycle, and keeps the records a historian would; the scans average back to that hour’s real value.

Site A · Concentrator 1 · four hours2,696 records · 4 real hourly averages
Rougher cell 1 air flow, Site A, Concentrator 1, four hours: 2,696 generated records (thin line) and the four real hourly averages they keep (thick bars): 1200.8, 1200.2, 1203.6, 1198.8 m3/h.

Rougher cell 1 air flow: 2,696 records kept in four hours, a new one whenever the value moves past its deadband; the 5-second scans behind them average to each hour’s real value (the red bars).

03 · What the crawl found

2,602 tags an agent should not trust

Real tag lists are messy, so the stand-in is too: references to deleted points, tags that stopped updating, tags that never had data, bad-quality readings. The crawler marks each one, and every search result carries its mark.

50,594 tags · one square per 1002,602 flagged
One square per 100 tags, 50,594 tags: readable 47,992, stale 1,259, no data 805, broken reference 343, bad quality 195. Also 3,225 points not in the asset tree, and 5,212 checked, calculated or alarm copies of a reading.

Every planted fault was flagged (two under another category), along with 114 other tags. Also in the list: 3,225 points outside the asset tree, and 5,212 checked, calculated or alarm copies of a reading, which the search ranks lower unless asked for.

04 · Why search

The list is 13 windows long

Pasting the tag list into the agent’s context is not an option: one line per tag (path, point name, unit) is over two million tokens. A search answer of ten tags, each with its unit, health and why it matched, is a sliver.

Tokens, counted by the 27B model’s own tokenizer2,162,399 against about 1,800
One square per 10,000 tokens. The whole tag list, 2,162,399 tokens, fills 216 squares; the model's window, 165,000 tokens, is 16.5 of them (dark); one search answer, about 1,814 tokens, is a sliver of one square (red).

The answer size is the mean of three ten-result search lists for test questions, as the catalogue returns them before the server formats them.

06 · Question by question

Six questions, both searches

The first five results of each search, with the right tags ticked, and the catalogue’s reason for each match. Three the catalogue search gets right, one it half finds, two it misses.

Test questions · as written6 of the 60
  • Question 09 · Place and reading · one right tag

    “Can I see the dissolved oxygen trend for leach tank 3 at Site W, Concentrator 4 over night shift?”

    Catalogue search · top 5 of 10 · in the top 10: 1.00
    1. Site W › Concentrator 4 › Leach › Leach Tank 3 · Dissolved OxygenSITEW.CONC4.LCH.LT3.DOmatched: dissolved, do, leach, oxygen, tank; "tank 3"; Site W; Concentrator 4; quantity composition (a right tag)
    2. Site W › Concentrator 4 › Leach › Leach Tank 3 · Dissolved Oxygen CalcSITEW.CONC4.LCH.LT3.DO.CALCmatched: dissolved, do, leach, oxygen, tank; "tank 3"; Site W; Concentrator 4; quantity composition; calc variant, ranked down
    3. Site W › Concentrator 4 › Leach › Leach Tank 1 · Dissolved OxygenSITEW.CONC4.LCH.LT1.DOmatched: dissolved, do, leach, oxygen, tank; Site W; Concentrator 4; quantity composition
    4. Site W › Concentrator 4 › Leach › Leach Tank 2 · Dissolved OxygenSITEW.CONC4.LCH.LT2.DOmatched: dissolved, do, leach, oxygen, tank; Site W; Concentrator 4; quantity composition
    5. Site W › Concentrator 4 › Leach › Leach Tank 4 · Dissolved OxygenSITEW.CONC4.LCH.LT4.DOmatched: dissolved, do, leach, oxygen, tank; Site W; Concentrator 4; quantity composition
    Plain keyword · top 5 of 10 · in the top 10: 0.00
    1. Site I › Concentrator 3 › Leach › Leach Tank 4 · Dissolved OxygenSI-C3-AT-4014
    2. Site I › Concentrator 4 › Leach › Leach Tank 3 · Dissolved OxygenSI-C4-AT-4010
    3. Site I › Concentrator 4 › Leach › Leach Tank 4 · Dissolved OxygenSI-C4-AT-4014
    4. Site I › Concentrator 3 › Leach › Leach Tank 3 · Dissolved OxygenSI-C3-AT-4010
    5. Site I › Concentrator 1 › Leach › Leach Tank 4 · Dissolved OxygenSI-C1-AT-4014

    The keyword search finds the right reading at the wrong sites: it does not read “Site W, Concentrator 4” as a place.

  • Question 01 · Place and reading · one right tag

    “What was the primary crusher's closed side setting at 6 am at Site A, Concentrator 2?”

    Catalogue search · top 5 of 10 · in the top 10: 1.00
    1. Site A › Concentrator 2 › Crushing › Primary Crusher · Closed Side SettingSA-C2-ZT-1003_OLDmatched: closed, crusher, primary, setting, side; Site A; Concentrator 2; health: broken_ref (a right tag)
    2. Site A › Concentrator 2 › Crushing › Primary Crusher · Motor PowerSA-C2-JT-1001matched: crusher, primary; Site A; Concentrator 2
    3. Site A › Concentrator 2 › Crushing › Primary Crusher · Motor CurrentSA-C2-IT-1002matched: crusher, primary; Site A; Concentrator 2
    4. Site A › Concentrator 2 › Crushing › Primary Crusher · Run StatusSA-C2-XS-1004matched: crusher, primary; Site A; Concentrator 2
    5. Site A › Concentrator 2 › Crushing › Primary Crusher · Motor Current CalcSA-C2-IT-1002.CALCmatched: crusher, primary; Site A; Concentrator 2; calc variant, ranked down
    Plain keyword · top 5 of 10 · in the top 10: 0.00
    1. Site E › Concentrator 2 › Crushing › Primary Crusher · Closed Side SettingSE-C2-ZT-1003
    2. Site I › Concentrator 2 › Crushing › Primary Crusher · Closed Side SettingSI-C2-ZT-1003
    3. Site M › Concentrator 2 › Crushing › Primary Crusher · Closed Side SettingSM-C2-ZT-1003
    4. Site Q › Concentrator 2 › Crushing › Primary Crusher · Closed Side SettingSQ-C2-ZT-1003
    5. Site U › Concentrator 2 › Crushing › Primary Crusher · Closed Side SettingSU-C2-ZT-1003

    The keyword search drops the single letter “A” as a stop word, so it cannot read Site A as a place: its Site A results come late and at the wrong concentrator. The catalogue’s right tag is a broken reference with no readings, so an agent should report it as dead.

  • Question 45 · Several tags · a group of 4

    “Can you put the tonnes per hour for CV-101 through CV-104 on one trend for Site C, Concentrator 1 so I can see which belt dropped off first?”

    Catalogue search · top 5 of 10 · in the top 10: 0.50
    1. Site C › Concentrator 1 › Crushing › CV-101 · Belt SpeedSITEC.CONC1.CRU.CV1.SPDmatched: 101, belt, cv; Site C; Concentrator 1
    2. Site C › Concentrator 1 › Crushing › CV-104 · Belt SpeedSITEC.CONC1.CRU.CV4.SPDmatched: 104, belt, cv; Site C; Concentrator 1
    3. Site C › Concentrator 1 › Crushing › CV-101 · Belt Weigher RateSITEC.CONC1.CRU.CV1.RATEmatched: 101, belt, cv; Site C; Concentrator 1 (a right tag)
    4. Site C › Concentrator 1 › Crushing › CV-104 · Belt Weigher RateSITEC.CONC1.CRU.CV4.RATEmatched: 104, belt, cv; Site C; Concentrator 1 (a right tag)
    5. Site C › Concentrator 1 › Crushing › CV-101 · Motor CurrentSITEC.CONC1.CRU.CV1.AMPmatched: 101, cv; Site C; Concentrator 1
    Plain keyword · top 5 of 10 · in the top 10: 0.00
    1. Site I › Concentrator 1 › Crushing › CV-101 · Belt SpeedSI-C1-ST-1006
    2. Site I › Concentrator 1 › Crushing › CV-104 · Belt SpeedSI-C1-ST-1018
    3. Site I › Concentrator 1 › Crushing › CV-101 · Belt Weigher RateSI-C1-WT-1005
    4. Site I › Concentrator 1 › Crushing › CV-104 · Belt Weigher RateSI-C1-WT-1017
    5. Site I › Concentrator 2 › Crushing › CV-101 · Belt SpeedSI-C2-ST-1006

    “Tonnes per hour” ranks belt speed above two of the four belt weighers: half the group in the top 10.

  • Question 37 · Could mean several · 4 valid readings

    “What's the mill pulling at Site A, Concentrator 3?”

    Catalogue search · top 5 of 10 · in the top 10: 1.00
    1. Site A › Concentrator 3 › Grinding › SAG Mill · Fresh Feed RateSA-C3-WT-2001matched: mill, sag; Site A; Concentrator 3; golden tag: throughput
    2. Site A › Concentrator 3 › Grinding › SAG Mill · Mill SpeedSA-C3-ST-2004matched: mill, sag; Site A; Concentrator 3
    3. Site A › Concentrator 3 › Grinding › SAG Mill · Motor PowerSA-C3-JT-2002matched: mill, sag; Site A; Concentrator 3 (a right tag)
    4. Site A › Concentrator 3 › Grinding › SAG Mill · Bearing PressureSA-C3-PT-2003matched: mill, sag; Site A; Concentrator 3
    5. Site A › Concentrator 3 › Grinding › SAG Mill · Run HoursSA-C3-KQ-2007matched: mill, sag; Site A; Concentrator 3
    Plain keyword · top 5 of 10 · in the top 10: 0.00
    1. Site A › Concentrator 3 › Grinding › SAG Mill · Mill SpeedSA-C3-ST-2004
    2. Site E › Concentrator 3 › Grinding › SAG Mill · Mill SpeedSE-C3-ST-2004
    3. Site I › Concentrator 3 › Grinding › SAG Mill · Mill SpeedSI-C3-ST-2004
    4. Site M › Concentrator 3 › Grinding › SAG Mill · Mill SpeedSM-C3-ST-2004
    5. Site Q › Concentrator 3 › Grinding › SAG Mill · Mill SpeedSQ-C3-ST-2004

    “The mill” could be the SAG, either ball mill or the whole grinding supply; the catalogue search puts the SAG’s power third, the keyword search none.

  • Question 17 · Site words · one right tag

    “How tight were we running the primary crusher on days yesterday at Site B, Concentrator 3?”

    Catalogue search · top 5 of 10 · in the top 10: 0.00
    1. Site B › Concentrator 3 › Crushing › Primary Crusher · Run StatusSBC3_CR1_RUNmatched: crusher, primary, run, status; Site B; Concentrator 3; quantity status
    2. Site B › Concentrator 3 › Crushing › CV-101 · Run StatusSBC3_CV1_RUNmatched: run, status; Site B; Concentrator 3; quantity status
    3. Site B › Concentrator 3 › Crushing › CV-102 · Run StatusSBC3_CV2_RUNmatched: run, status; Site B; Concentrator 3; quantity status
    4. Site B › Concentrator 3 › Crushing › CV-103 · Run StatusSBC3_CV3_RUNmatched: run, status; Site B; Concentrator 3; quantity status
    5. Site B › Concentrator 3 › Crushing › CV-104 · Run StatusSBC3_CV4_RUNmatched: run, status; Site B; Concentrator 3; quantity status
    Plain keyword · top 5 of 10 · in the top 10: 1.00
    1. Site B › Concentrator 3 › Crushing › Primary Crusher · Motor PowerSBC3_CR1_PWR
    2. Site B › Concentrator 3 › Crushing › Primary Crusher · Motor CurrentSBC3_CR1_AMP
    3. Site B › Concentrator 3 › Crushing › Primary Crusher · Run StatusSBC3_CR1_RUN
    4. Site B › Concentrator 3 › Crushing › Primary Crusher · Closed Side SettingSBC3_CR1_CSS (a right tag)
    5. Site A › Concentrator 3 › Crushing › Primary Crusher · Motor PowerSA-C3-JT-1001

    No rule maps “tight” to the crusher’s closed side setting, and “running” is read as a run status: a miss the keyword search does not make.

  • Question 28 · Site words · one right tag

    “How many megawatts was the whole plant pulling at noon at Site Q, Concentrator 3?”

    Catalogue search · top 5 of 10 · in the top 10: 0.00
    1. No results
    Plain keyword · top 5 of 10 · in the top 10: 0.00
    1. Site Q › Concentrator 3 › Utilities › Plant Air Compressor 1 · Discharge PressureSQ-C3-PT-9016
    2. Site Q › Concentrator 3 › Utilities › Plant Air Compressor 1 · Motor PowerSQ-C3-JT-9017
    3. Site Q › Concentrator 3 › Utilities › Plant Air Compressor 1 · Run StatusSQ-C3-XS-9018
    4. Site Q › Concentrator 3 › Utilities › Plant Air Compressor 1 · Run HoursSQ-C3-KQ-9019
    5. Site Q › Concentrator 3 › Utilities › Plant Air Compressor 2 · Discharge PressureSQ-C3-PT-9020

    “Plant” is read as a place word and none of the words left matches a tag at that place: the catalogue search returns nothing.

07 · At your site

Before an agent reads your historian

  1. Give it a catalogue, not the listCrawl the asset tree on a schedule into a searchable table with units and health, and let the agent search it.
  2. Read the place firstSite, area and unit named in a question narrow 50,000 tags to a few hundred; most of the gain came from that.
  3. Write down the site’s words“Tight”, “DO” and “the whole plant” missed here. A short list of what people say, kept by the people who say it, is the cheapest fix.
  4. Flag faults before readingMark broken, stale and empty tags in the catalogue, so a dead tag is reported as dead, not as zero.
  5. Read-only, small answersA read-only service account, at most ten tags a call, long results in a file: less load on the historian, less in the agent’s context.

Sources

  1. Zyfra, gold recovery data from a gold flotation plant: hourly, 15 Jan 2016 to 18 Aug 2018, 22,716 hours. The copy used: a course-project repository, 5hraddha/zyfra-gold-recovery-prediction, commit 629470d8, file datasets/gold_recovery_full.csv (SHA-256 d477aa4d…). github.com/5hraddha/zyfra-gold-recovery-prediction. Not republished here.
  2. AVEVA PI Web API reference (request and response shapes the stand-in follows). docs.aveva.com/bundle/pi-web-api-reference.
  3. Model Context Protocol specification. modelcontextprotocol.io/specification.
  4. SQLite FTS5 full-text search. sqlite.org/fts5.html.