

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
1# Agent Guidelines for Blockscout23## Separate API / Indexer Mode Architecture45Blockscout supports running as a single combined application or as separate API and indexer instances via the `APPLICATION_MODE` environment variable.67### Mode Configuration89`APPLICATION_MODE` environment variable (defined in `config/config_helper.exs`):10- `all` (default) — both API and indexer run together11- `api` — API-only instance, no indexing12- `indexer` — indexer-only instance, no API serving1314The current mode is accessible via `Explorer.mode()` (defined in `apps/explorer/lib/explorer.ex`), which returns `:all`, `:api`, `:indexer`, or `:media_worker`.1516`:media_worker` is a special standalone mode for NFT media processing. It is not set via `APPLICATION_MODE` — it activates when `nft_media_handler[:standalone_media_worker?]` is true, overriding the configured mode. In this mode, `Explorer.Application` starts only libcluster — no base_children or configurable_children. The process mode filtering rules below do not apply to `:media_worker`.1718Related environment variables:19- `DISABLE_INDEXER` — forces indexer off (auto-set when `APPLICATION_MODE=api`)20- `DISABLE_API` — forces API off (compile-time, controls `BlockScoutWeb.Endpoint`)2122### Rules for Assigning Processes to Modes2324When adding or modifying processes started by `Explorer.Application`, `Indexer.Application`, or `BlockScoutWeb.Application`, follow these rules:2526**Start in `:indexer` mode only:**27- Active periodic updaters — GenServers that periodically query the DB and write results to `last_fetched_counters` table (e.g., `ContractsCount`, `NewPendingTransactionsCount`, `Transactions24hCount`). The API side reads directly from the DB table without needing a local process.28- Data migrators (`Explorer.Migrator.*`) — one-time or ongoing data transformations.29- Catalogers and tag importers (`AddressTag.Cataloger`, `CertifiedSmartContractCataloger`).30- Block gap scanning (`MinMissingBlockNumber`).31- Indexer-specific caches that are written and read by indexer only (`LatestL1BlockNumber`).3233**Start in `:api` mode only:**34- Passive on-demand ETS/in-memory caches — GenServers that manage an ETS table and populate it on API request (e.g., `AddressTransactionsCount`, `TokenHoldersCount`, `BlockBurntFeeCount`, `AverageBlockTime`). ETS is local to the process, so these must run on the instance serving requests.35- On-demand fetchers triggered by API requests (`CheckBytecodeMatchingOnDemand`, `FetchValidatorInfoOnDemand`, `LookUpSmartContractSourcesOnDemand`).36- API access control (`AddressesBlacklist`).37- Contract verification tooling (`SolcDownloader`, `VyperDownloader`).38- Read-only DB replicas (`Explorer.Repo.Replica1`).39- API-only caches (`OptimismFinalizationPeriod`, `CeloEpochs`, `Rootstock.LockedBTCCount`).4041**Start in both modes (`:all`, `:api`, `:indexer`):**42- Core infrastructure: main `Explorer.Repo`, `Explorer.Vault`, `Registry.ChainEvents`, `Redix`.43- Event system: `Explorer.Chain.Events.Listener` (mode-controlled via its own `:enabled` config).44- Cluster discovery (`libcluster`) — needed for node communication in separate mode.4546### Helper Functions in Explorer.Application4748- `configure(process)` — starts if `Application.get_env(:explorer, process)[:enabled] == true`. No mode check.49- `configure_mode_dependent_process(process, mode)` — starts if `:enabled` is true AND `Explorer.mode()` matches. Use for processes that have `:enabled` config in `runtime.exs`.50- `only_in_mode(process, mode)` — starts if `Explorer.mode()` matches. No `:enabled` check. Use for processes without `:enabled` config (e.g., repos, downloaders, unconditional entries).51- `configure_chain_type_dependent_process(process, chain_type)` — starts if chain type matches. Can be piped with mode filters.5253Piping pattern for combined restrictions:54```elixir55SomeProcess56|> configure_mode_dependent_process(:indexer)57|> configure_chain_type_dependent_process(:optimism)58```5960### Cache Pattern Reference6162How to distinguish active updaters from passive caches when deciding the mode:63- **Active periodic updater**: has `schedule_next_consolidation()`, `handle_info(:consolidate)`, writes to `last_fetched_counters` via `LastFetchedCounter.upsert()` -> `:indexer`64- **Passive on-demand ETS cache**: has `fetch()` with cache expiry check, stores in ETS via `Helper.put_into_ets_cache()`, may update model columns -> `:api`65- **MapCache (ConCache)**: uses `use Explorer.Chain.MapCache`, implements `handle_fallback` -> `:api`66
One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| blockscout/blockscoutapps/explorer/lib/explorer/market/AGENTS.md · 4.6k | AGENTS.md | no sections | 31/100 | 14 days ago | |
| blockscout/blockscoutapps/explorer/test/AGENTS.md · 4.6k | AGENTS.md | teststyle | 39/100 | 14 days ago |
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| react/react-nativepackages/react-native-compatibility-check/AGENTS.md · 126k | AGENTS.md | testlint-formatstylearch+4 | 99/100 | 14 days ago | |
| carrot-foundation/middle-earthAGENTS.md · 0 | AGENTS.md | setupbuildtestlint-format+7 | 97/100 | 14 days ago | |
| strapi/strapiAGENTS.md · 73k | AGENTS.md | setupbuildtestlint-format+12 | 96/100 | 8 days ago | |
| serverless/serverlessAGENTS.md · 47k | AGENTS.md | setupbuildtestlint-format+9 | 96/100 | today | |
| dotnet/aspnetcoresrc/Components/AGENTS.md · 38k | AGENTS.md | buildteststylearch+3 | 96/100 | today | |
| dotCMS/corecore-web/apps/dotcms-ui/AGENTS.md · 949 | AGENTS.md | buildteststyledependencies+3 | 94/100 | 14 days ago | |
| pnpm/pnpmpnpr/AGENTS.md · 36k | AGENTS.md | lint-formatstylearchgit+2 | 94/100 | 13 days ago | |
| joabgonzalez/ai-agents-skillsAGENTS.md · 7 | AGENTS.md | setupbuildteststyle+7 | 91/100 | 14 days ago |
A badge carrying the measured quality of the strongest agent config file in this repository, out of 100. It reads from this index every time somebody loads your page, so it changes when the measurement changes and there is nothing to keep up to date. Free, no account, and the value is not something you or we can set by hand.
[](https://rulestack.kynth.studio/configs/blockscout-blockscout-agents)Would rather not hotlink us? Every badge is also served in shields.io’s endpoint schema, so shields renders the image and your readers never talk to our domain:
Published by Toolproof, the masthead over this index and eight others. The method behind the number is at toolproof.kynth.studio/methodology, and the whole thing is readable as JSON with no key at /api.