Guide › Setting up › Install in your app
Do it all with an AI coding assistant
If you have an AI coding assistant and your app’s code on your computer, it can do all eight steps. What to set up, and the one request to paste.
Easiest of all: connect Cognolo to your AI coding assistant and say “Set up Cognolo”. It does this and the steps in the Cognolo dashboard too. See Set up with an AI helper. This page is for an AI coding assistant without the Cognolo connector.
An AI coding assistant is an AI tool that works inside your app’s code on your computer. It can read the code, run commands and make changes, asking you first. If you have one, and your app’s code is on your computer, it can do all eight steps for you. You stay in charge of three things: which actions the assistant may take, your keys, and putting the new version live.
Before you start
- Your app’s code on your computer: the version you use, with nothing half-finished in it.
- The AI coding assistant opened in your app’s folder, the one with a file called
package.jsonin it. - Your Cognolo login, to make keys on the dashboard’s Setup page.
- Optional: the Cognolo connector, so the same AI can also make keys and change settings here for you. See Set up with an AI helper.
What to do
- Open your app’s folder in the AI coding assistant.
- Copy the request below and paste it in. Read what it plans to do before you let it start.
- Answer its questions. It may ask which sign-in your app uses, and it will ask which actions you want the assistant to take. Give the assistant tools helps you choose: start with looking things up.
- Put in your keys yourself. Make a key for Dev on your app’s Setup page, and paste it into the
.env.localfile in your app’s folder, where the AI coding assistant left a space for it. Settings and keys says what each setting is. Don’t paste keys into the chat. - Let it check its work. It starts your app on your computer and checks the assistant opens for someone signed in.
- Have it looked over before it goes live. Ask your developer to review the change, or ask the AI coding assistant to open a pull request for review. Then follow Deploy and check.
The request to paste
Please add Cognolo's assistant to this app, following Cognolo's install steps. Work on a new git branch, and ask me before running anything that changes the database or puts the app live.
1. Install the package: npm install @cognolo/runtime @anthropic-ai/sdk zod (use pnpm or yarn if this app does). It needs Node.js 20 or newer and zod 4. If the app uses zod 3, stop and tell me first.
2. Run npx cognolo init, then show me the checklist it prints.
3. Ask me, then run the database command it lists under "Then run".
4. In lib/cognolo/assistant.ts, make open() use this app's own sign-in check and the signed-in user's id (never their email). If nobody is signed in, it must refuse.
5. Look through the app and suggest tools for the assistant, starting with ones that only look things up. List them and wait for my choice. Write each one with defineTool, calling the app's existing functions with their own permission checks, and give each person only the tools they could already use (toolsFor).
6. Make sure <CognoloAssistantPanel /> is in the layout the signed-in pages share, right after {children}.
7. Add ANTHROPIC_API_KEY, COGNOLO_KEY, COGNOLO_URL, COGNOLO_PUBLIC_KEY and COGNOLO_ENV to .env.local, with empty values, and make sure .env.local is in .gitignore. I'll fill in the values myself. Never ask me to paste a key into this chat.
8. Start the app, check the assistant opens for a signed-in person and refuses someone signed out, run the app's tests, then list every file you changed and why.Everything happens on your computer until the new version is put live. Nobody using your app sees a thing before then.
An AI coding assistant can make mistakes. Read what it changed, above all who the person is (step 4) and the tools (step 5), or have a developer check them before the app goes live.