# dist0 — update project memory You are an AI agent (Claude Cowork or similar) running with shell access. Your task: read the user's dist0 project memory and apply the changes they asked for. Use the shell and `curl`. Do not ask the user to run commands themselves. ## Setup - The user's key (it looks like `dist0_sk_...`) is usually pasted right in the prompt, or already set in the `DIST0_TOKEN` environment variable. Take whichever you were given and export it so the commands below work: `export DIST0_TOKEN=`. If you have neither, ask the user for their key — they create one at https://dist0.com/dashboard, see https://dist0.com/guides/api/auth. - Base URL: https://dist0.com - Every request sends the key as a bearer token: `-H "Authorization: Bearer $DIST0_TOKEN"` - There is one endpoint: `POST /api/v1/invoke`. The body is always `{ "capability": "", "input": { ... } }`. ## Steps 1. Read the current memory so you edit against what is really there: curl -s https://dist0.com/api/v1/invoke \ -H "Authorization: Bearer $DIST0_TOKEN" -H "Content-Type: application/json" \ -d '{ "capability": "project.memory", "input": {} }' If the user has more than one project, confirm which one first with `{ "capability": "project.list", "input": {} }`, then pass the chosen project on each write as a top-level `"project": ""` field. 2. Work out the exact edits from what the user gave you — their instruction, their positioning doc, competitor list, or any file they pointed you at. Compare it to the current memory. Only change what actually differs. 3. Show the user the list of edits you plan to make and wait for their go-ahead before writing. 4. Apply the edits in one call with the `memory.edit` capability: curl -s https://dist0.com/api/v1/invoke \ -H "Authorization: Bearer $DIST0_TOKEN" -H "Content-Type: application/json" \ -d '{ "capability": "memory.edit", "input": { "edits": [ { "op": "add_competitor", "name": "Linear", "url": "https://linear.app", "description": "Issue tracking for software teams." }, { "op": "remove_competitor", "name": "Obsidian" } ] } }' 5. Report the `applied` list from the response back to the user. ## Edit operations `input.edits` is a list of 1–64 operations. They apply in order; either all commit or none do. Each op is one of: | op | fields | effect | | ------------------ | ----------------------------- | --------------------------------------- | | set_product | text | Replace the product description. | | set_icp | text | Replace the ideal-customer description. | | add_competitor | name, url, description | Add a tracked competitor. | | remove_competitor | name | Remove a competitor by name. | | add_offering | name, description | Add an offering. | | remove_offering | name | Remove an offering by name. | | add_subreddit | name, description | Watch a subreddit (bare handle, no r/). | | remove_subreddit | name | Stop watching a subreddit. | | add_filter_rule | rule | Add a rule for what to skip. | | remove_filter_rule | rule | Remove a filter rule. | ## Rules - A project watches at most 5 subreddits. To add one past the cap, remove one in the same call. An edit that would exceed the cap is rejected. - Edits take effect immediately and shape the next brief. They do not change briefs already sent. - You cannot set the product name, website, or category here — those come from the user's website. Tell the user to use "Refresh from website" in the dashboard for those. ## Response shape Success: { "data": { "applied": ["Added competitor: Linear", "Removed competitor: Obsidian"] } } Error: { "error": { "code": "invalid|forbidden|not_found|limit", "message": "..." } } - invalid — a malformed edit, or one that changes nothing. - forbidden — bad/absent key, or the project isn't the user's. - limit — the edit would exceed the 5-subreddit cap. Full API reference: https://dist0.com/guides/api/http