Set up monitoring with Claude Code
Ask Claude Code to add error and uptime monitoring to your app: it installs the package, keeps the token in .env, sends a test event and checks it arrived.
Claude Code can add monitoring to your app in one session: it installs the package, puts the token in .env, sends a test event and checks that it arrived. You stay in charge of three things: which environment it touches, where the secrets go, and who owns the account at the end.
This guide sets up Lampwick, where Claude Code can also create the workspace itself and hand you a link to claim it. The preparation and the checks apply to any monitoring tool.
Before you start
- Start on dev or staging. A monitoring tool receives exception messages, request URLs and log lines. Point the first setup at an environment without customer data, and move to production once you have read the terms and the data processing agreement.
- Keep
.envout of git. Check that.gitignorelists it:git check-ignore .envprints.envwhen it does. - Keep secrets out of the conversation. Everything Claude Code reads goes into its context. Deny it reading
.envin.claude/settings.json; it can still append to the file with a shell command, which you approve:
{
"permissions": {
"deny": ["Read(./.env)", "Read(./.env.*)"]
}
}
The deny rules are in the Claude Code settings docs.
1. Give it the prompt
Start claude in the repository and paste:
Set up Lampwick monitoring for this app. Read https://lampwick.dev/docs/agents.md and follow it. Keep the tokens out of the chat, use a dev or staging environment, and give me the claim link when the first event has arrived.
The agent setup page is written for agents: exact requests, fields and errors. Pointing Claude Code at it beats describing the steps yourself, because it follows the same page every time.
2. Approve the requests
Claude Code asks before each command. Expect these, in this order:
- A line that adds
.lampwick-workspace.jsonto.gitignore. Claude Code runs every command in a fresh shell, so the setup passes values on through that file and.env. - One long command:
curlto/api/v1/workspaces/challenge, a one-linepython3command that solves a proof-of-work (a few seconds), andcurl -X POSTto/api/v1/workspaceswith your team and project name and"agent":"Claude Code". It saves the answer, with a workspace token (lws_…), an ingest token and a claim link, to.lampwick-workspace.jsonand prints only the workspace's name. - A command that appends
LAMPWICK_WORKSPACE_TOKENandLAMPWICK_TOKENto.env, after adding a final newline if the file lacks one. composer require lampwick/laravelandphp artisan lampwick:test, or acurlto/ingestfor other apps.lampwick:testexits 1 while the ingest daemon isn't running; its test record still counts. Then it starts the ingest daemon (php artisan lampwick:agent) in this environment and loads a page, so real requests arrive.- Optionally
curl -X POSTto/api/v1/projects/…/monitorsfor an uptime check of your staging URL. curlto/api/v1/setup-status, until it says"ready_to_hand_off": true.
Say no when a command prints a token to the terminal, or writes one anywhere but .env and .lampwick-workspace.json. Ask it to redo the step.
3. Check its work
Don't take "done" on trust. getSetupStatus answers with what Lampwick actually received:
{
"ready_to_hand_off": true,
"blocking": [],
"next_action": "Give your human the claim link with the text of handoff_message.",
"projects": [{ "id": 3, "name": "acme-web", "first_event_at": "2026-11-09T17:40:47.648610Z", "last_deploy_at": null }]
}
Run on 9 Nov 2026 against a Lampwick server. first_event_at is set only when a record arrived. Until then blocking says no events yet from acme-web, and Claude Code should fix that before it hands off.
4. Claim the workspace
Claude Code ends with a message like this one, from handoff_message:
Lampwick is set up for Acme. Open this link to put it in your name: https://app.lampwick.dev/claim/lwc_… — claim it before Thu 12 Nov, 17:40 UTC, or it stops and is deleted.
- Open the link. It shows who set the workspace up, what it holds and when it is deleted. Claim it only if you asked for it.
- Log in or create an account, then click Claim workspace.
- Choose Read-only (recommended) or Read & write, click Show code for the agent, and paste the code into Claude Code. It sends it with
confirmWorkspaceAccess.
Read-only is the safer choice for an agent that reads production errors: those messages can contain text meant to steer it. The agent keeps the access you chose for 30 days, then connects by signing in. No code within 15 minutes means it loses access, and Lampwick replaces the ingest tokens.
5. Go to production
Once the workspace is yours:
- Run the ingest daemon under a process manager:
php artisan lampwick:agent(Laravel docs). - Set
LAMPWICK_TOKENin production's environment, not in a committed file. - Record each deploy from CI with
php artisan lampwick:deploy(it uses the sameLAMPWICK_TOKEN), so every issue shows the deploy that brought it. - Turn on alerts. An agent can't do that for you: alert channels, status pages and billing stay with people.
Next step
Now let Claude Code read what breaks: debug Laravel production errors with Claude Code.