Set up Stacks contract monitoring from a terminal: from a contract id to a test alert. Node 22 or newer.
npm i -g @secondlayer/sentinelOr run it without installing: npx -y @secondlayer/sentinel <command>.
sentinel loginOpen the link it prints and confirm the code. In a terminal it waits for you; from an agent's shell it exits, and sentinel login --wait finishes it. No browser on the machine? sentinel login --email takes your email and a 6-digit code. A first login creates your Sentinel account on the Free tier.
npx skills add https://runsentinel.appOptional: the CLI and MCP work without it. It installs into the project (.claude/skills/sentinel/ and the folders of the other agents it finds), so it is committed with the repo and a teammate's agent has it too; -g installs it for you everywhere instead. The skill teaches the loop: look, preview, show the person the cost, wait for a yes. It also says how to read an alert and what a watch can't see. The same file ships in the npm package (skills/sentinel/SKILL.md). To let an agent run the reads without asking, see Let an agent run it.
One line: the trigger, the contract, what on it. --dry-run adds nothing: you get its line, what it would have triggered in the last 90 days and what it costs.
sentinel when transfer SP000000000000000000002Q6VF78.example-vault sBTC --out --over 2 --dry-run
# or in a sentence: sentinel describe "alert if more than 2 sBTC leaves example-vault"Not sure what a contract has? sentinel show SP000000000000000000002Q6VF78.example-vault lists its functions, its tokens, its @admin, @value and @control functions and the events it prints. It reads the code (a free plan) and turns nothing on.
Not deployed yet? Import the Clarinet project and arm it for its deployer: sentinel import . --deployer SP…. Each when on its contracts then goes live once they deploy. See Import a repo.
sentinel when transfer SP000000000000000000002Q6VF78.example-vault sBTC --out --over 2 --waitThe contract joins your account and its monitoring turns on. Alerts go to your email. --wait returns once the watch is live. It counts toward your tier once it is live; events are never billed. From now on the contract's name works: example-vault.
sentinel connect slack
$ sentinel destinations add slack '#oncall' --defaultDestinations are yours, not a contract's: a default gets every watch that names none, and your own address always works. A destination that never had an alert from you gets one test alert the first time a watch to it goes live. To send one watch elsewhere, add --to slack:#oncall to its line.
sentinel test-alert example-vault --yesThe newest real match of the contract's watches in the last 90 days goes to every place its alerts go, marked a test and dated (a sample if there is none), and each reports ok or failed. On Free this works for a mainnet watch that is saved and waiting.
sentinel list
$ sentinel logs example-vault -fEach watch has an id (w_…): show, logs, mute and off take it. off pauses it and nothing is deleted; on turns it back on.
A free write happens at once; --dry-run (CLI) or dry_run: true (MCP) previews it. A check or a contract over your tier's count shows its cost first, and so do off, remove and test-alert: they happen with --yes (CLI) or confirm: true (MCP).
Next: Authentication, Watches & alerts.