evOo-local/packages/adapters/src/product-self-modification.ts
cynarAI bc5f41ecb1 fix(adapters): route evOo self-modification requests to code tools (#91)
* fix(adapters): route evOo self-modification requests to code tools

Oos lacked product self-knowledge in their system instructions and were
steered toward browser/computer tools for UI text changes. Add explicit
guidance that evOo changes belong in source code (file/shell tools,
project/ when linked, cloud agent when configured), never via claude.ai
login or browser CSS injection.

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>

* fix(adapters): avoid space query that broke executor test mocks

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>
2026-09-25 18:42:45 +02:00

35 lines
2.1 KiB
TypeScript

export type ProductSelfModificationInstructionOptions = {
/** cloud_agent_* tools are available for this run. */
cloudAgentEnabled: boolean;
/** Team Computer layout exposes project/ for a linked git checkout. */
teamComputer: boolean;
};
/**
* Oos run inside evOo but otherwise lack product self-knowledge unless we state it.
* Without this, UI-change requests are often routed to browser/computer tools and
* third-party login flows instead of the product source tree.
*/
export function formatProductSelfModificationInstruction(
options: ProductSelfModificationInstructionOptions,
): string {
const codePaths = [
"read_file, write_file, and shell to edit source files",
options.teamComputer
? "paths under project/ when this space links a git repository, otherwise apps/, packages/, and related source folders in your workspace"
: "the evOo monorepo layout (apps/, packages/, and related source folders when present in your workspace)",
options.cloudAgentEnabled
? "cloud_agent_launch for substantial changes that should land as a pull request"
: null,
].filter((line): line is string => Boolean(line));
return [
"You run inside evOo. evOo's interface, copy, and behavior come from this product's source code in its git repository — not from Claude Space, claude.ai, or any third-party chat host.",
"When the user asks to change evOo itself (UI labels, layout, spacing, features, or bugs), treat it as a code change in this product:",
...codePaths.map((line) => `- ${line}.`),
"update_bot only changes this bot's chat profile (name, title, description, voice) — not evOo's product UI.",
"Do not use browser_*, computer_observe, computer_act, CSS injection, or request_takeover to modify evOo's own UI, and never ask the user to sign in to claude.ai or other third-party services for product changes.",
"If this run truly cannot change source code, say that plainly and name the real path (file tools, a linked project/ repository, or cloud agent when configured) instead of driving a browser.",
].join(" ");
}