Repo-specific rules for every agent working in this repository. Global rules
(minimal code, no unnecessary duplication, etc.) live in
~/.config/agent-rules/GLOBAL.md and apply on top of these — don't repeat them
here.
- This project is a fork. The owner did not write most of it and does not yet fully understand what's here. Assume parts of the UI and code may be unused, non-functional, or unclear in purpose — do not assume existing code works or is needed just because it's present.
- The goal over time is to build a full understanding of the codebase and remove anything unnecessary. When you touch an area, note dead/unused/ unclear code rather than silently working around it, and prefer deleting genuinely unused code over keeping it.
- All edits go to the main project at
/Users/toshonjennings/opal, never a worktree. The dev server runs from the main project.
- No
eval,Function(), or dynamic code execution on user-supplied input. - No shell injection — never interpolate user data into shell commands or child_process calls.
- Keep secrets in env vars; never hardcode API keys, tokens, or credentials in source files.
- Don't log sensitive values (tokens, passwords, full request bodies with PII).
- Sanitize anything rendered as HTML to prevent XSS — prefer frameworks that escape by default.
- Validate and bound all external input at system boundaries (user input, API responses, file reads).
Always design for both light and dark modes. Perci uses CSS custom properties
(--text-primary, --text-secondary, --text-tertiary, --bg-primary, etc.) defined
in src/index.css under :root (light) and :root.dark (dark).
Rules:
- Never hardcode a light or dark color value for text or interactive elements. Always use the theme variables so the color inverts correctly between modes.
- Never place light text on a light background (or dark on dark). If you set a
foreground color, verify it has sufficient contrast against the background in BOTH
modes. When in doubt, use
var(--text-primary)for headings/emphasis andvar(--text-secondary)for body text — they are guaranteed readable on--bg-primaryand--bg-secondaryin both themes. - Hover/focus states must also be mode-aware. A
color: whitehover works in dark mode but becomes illegible in light mode. Usevar(--text-primary)for hover text unless the hover background is guaranteed dark (e.g., a solid accent fill). - Test in both modes before shipping. Toggle
:root.darkin DevTools (or use the app's theme switch) and verify every surface you touched.
- Knowledge graph:
docs/architecture/graphify-out/contains a queryable graph of the renderer codebase (564 nodes, 37 communities). Usegraphify queryto explore structural relationships before diving into source files. Seedocs/architecture/GRAPHIFY.mdfor usage. - Electron main process: The OpenClaw IPC bridge lives in
electron/main.cjsandelectron/preload.cjs— not indexed by graphify. Read source directly. - Eidos integration: Eidos (
~/eidos) is embedded in Perci as a first-class window (EIDOS_WINDOW_ID). Perci manages the Docker/OrbStack lifecycle, dashboard spawning, and health polling viaeidos:*IPC handlers inelectron/main.cjs. The Perci version is the leading development target. The standalone Eidos repo (~/eidos) lags behind — see~/eidos/CLAUDE.mdfor the divergence note. Eidos-related changes should be made in this repo, not in~/eidos. - KeySafe integration: KeySafe (
~/keysafe) is embedded in Perci as a first-class window (KEYSAFE_WINDOW_ID). Perci monitors port 4100 to check if KeySafe is active, renders it inside a<webview>, and can launch its Vite dev server (npm run dev) using Electron'slocalhost:start-nowIPC handler. KeySafe remains a standalone app; updates/changes to KeySafe's source code should be made in~/keysafedirectly. - Apfel Harness integration: Apfel Harness (
~/apfel-harness) is embedded in Perci as a first-class window (APFEL_WINDOW_ID). Perci checkshttp://127.0.0.1:6271/api/healthto monitor if the harness is active, renders it inside a<webview>, and can launch its Node server (node server.js) using Electron'slocalhost:start-nowIPC handler. Note that updates should be made to both the standalone (~/apfel-harness) and Perci versions. - Wiki (second brain):
~/wiki/is a Karpathy-style interlinked markdown wiki serving as the project's queryable knowledge base. Contains decision rationale, architecture explanations, and cross-linked concepts/entities. ReadSCHEMA.mdindex.mdat session start when project context is needed. All agents (Hermes, OpenClaw, Eidos) can access this path for shared knowledge retrieval.