User:Ilmari Karonen/Bot policy

Keeping Wikipedia running can sometimes be tedious. There are many tasks, from maintaining interwiki links to archiving talk pages, that require lots of repetitive editing that could be done just as well by a machine. Many Wikipedians have done just that, writing programs — known in wikijargon as bots — that completely or partially automate these boring and tiresome tasks.

Such programs can be extremely useful, but a malfunctioning, misguided or actively malicious bot can also quickly cause a lot of trouble, both for its operator and everyone else. This page exists to document various rules and guidelines which prospective bot operators should follow to ensure their bot will not cause more difficulties than it solves. None of these rules are mandatory, but if you break them you'll be doing so at your own risk.

Before setting up a new bot, it is considered a good idea to have it reviewed at Bots/Requests for approval. This also allows you to request the bot flag for your bot. If you have a task that could be done by a bot, but don't want to do it yourself, you may ask for assistance from experienced bot operators at Bot requests.

Bots and Wikipedia policy
A fundamental rule on Wikipedia is that everyone is responsible for their own edits. Running a bot does not exempt you from this responsibility, and you can and will be held responsible for you bot's actions just as if you had made them directly yourself.

Unless explicitly stated otherwise, all Wikipedia policies and guidelines apply to bots and their operators just as they apply to all other editors. This includes rules on working with others, such as the requirements to be civil, not to engage in edit wars and not to bite newbies. Obviously, a bot cannot be expected to meaningfully discuss its actions or seek consensus on controversial issues — but its operator can be, and it is the operator's responsibility to keep the bot in check while such disputes are resolved.

Bot accounts
It is strongly recommended to register a separate user account for running your bot. This provides a number of advantages:


 * The bot's edits will not clutter your contribution history.
 * Your ordinary edits cannot be confused with those made by the bot.
 * If the bot needs to be blocked for any reason, your main user account is not affected.
 * The bot does not need to know your main account's password, which reduces the risk that a malicious hacker might be able to obtain it.
 * You don't need to remember your bot account's password, so you can make it very hard to guess (e.g. 50 random alphanumeric characters).
 * The bot account may be given the bot flag, which provides a number of useful extra abilities.

Bot accounts should be clearly marked as such, e.g. by placing the template on the account's user page. To make bot edits easier to identify, it is also recommended that the account name include the word "Bot". Avoid using your bot account for any other edits. If you are running multiple automated tasks, it may be advisable to register separate accounts for each, both to minimize confusion and so that any malfunctioning task may be blocked without interfering with the others.

Bots should not normally edit without being logged in, and should take care to ensure that they will not accidentally do so even if they get unexpectedly logged out while editing.

The bot flag
MediaWiki allows specific user accounts to be flagged as bots. This is done by including them in the "bot" user group. Accounts thus flagged have access to a number of extra features:


 * Their edits will not show up in recent changes or on the watchlist by default.
 * Their edits are automatically marked as patrolled.
 * They may make minor edits to user talk pages without triggering the "You have new messages" notification.
 * They may optionally move pages without leaving a redirect at the old title.
 * They have higher limits on the number and scope of the MediaWiki API queries they can make.

Currently, only bureaucrats can grant or revoke the bot flag. (Author's note: I would like to see this ability given to all administrators, based on personal discretion, as was done with the "rollback" feature.) Bureaucrats are highly unlikely to grant the bot flag to an account unless it has been approved by the Bot Approvals Group or clear community consensus for it has been otherwise demonstrated. To apply for the bot flag, please list your bot on Bots/Requests for approval.

Stopping bots
Any account or IP address that appears to be making harmful or questionable edits unattended or at high speed may be temporarily blocked from editing to prevent further disruption until the issue has been properly discussed. This applies particularly when the edits in question could be difficult to undo later. Similarly, administrators who appear to be performing automated administrative actions inappropriately may have their administrative right summarily revoked to stop further harm. Use of automated editing tools for actively malicious purposes is considered an aggravated form of vandalism and is grounds for immediate blocking.

It is strongly recommended that bots, particularly those running unattended, provide a way to stop them without having to block the account. A common way to do this is to take advantage of MediaWiki's talk page notification feature to make the bot stop whenever anyone edits its talk page.

Bots and civility
As bots cannot themselves respond to questions, it is of particular importance that they provide clear and meaningful edit summaries that explain what the bot is doing, why it is doing it and who to contact if there are problems or disagreements. Where the space of a single edit summary (up to 255 bytes) is not long enough to fully accomplish this, it's a good idea to include a link to a page providing a more detailed explanation of the bot's operation.

Bots should not engage in edit wars, at least not without an extremely good reason. If someone reverts your bot, whatever the reason and however unlikely or unreasonable it might seem, make sure the bot will not repeat the edit without human confirmation. This is particularly important for bots that edit in user space and especially on users' talk pages. Also avoid "spamming" user talk pages with multiple automated notices in a short span of time, even if the notices refer to distinct issues.

Where applicable, bots should allow specific pages to be excluded from their editing. The recommended way to do this is to parse the page source for instances of Template:Bots.

Bots should take care not to bite the newbies, who may not realize they are dealing with an automated program rather than a human being. In particular, any automated messages left on user pages should be both courteous and clearly written, and should make clear that they have been left by an automated program, with clear instructions for contacting the person responsible. Please remember that not all users are familiar with Wikipedia jargon, nor even necessarily have English as their first language. Keep it simple.

Other guidelines
It is considered good form to open the source code to your bot. This allows others to check your bot for potential bugs even before they occur, to suggest improvements and to potentially adapt the code for other uses. It also allows someone else to continue running the code even if you some day suddenly find yourself unable to continue running it. If there are aspects of your bot's operation that should be kept confidential (e.g. passwords or specific vandalism detection rules), they should be stored in a separate configuration file which, in the published version, may be replaced by a "stub" version with dummy placeholder values substituted for the real confidential data.

Users trusted with administrative tools should exercise particular caution if they intend to automate the use of said tools. Everything that has been said above about ordinary bots applies even more strongly to adminbots. It is generally not a good idea to carry out automated edits using an account with administrator privileges unless absolutely necessary.

(Author's note: I'm sure there's a lot more useful advice that could be given, but I'll stop here for now.)