Imported from jgarbarino3/Iris (
AGENTS.md). Install upstream withnpx skills add jgarbarino3/Iris. Copyright stays with the author.
AGENTS Guidelines for This Repository
This repository contains Ageaf, a Chrome extension (Manifest V3) plus a small local host process:
- Extension (root): TypeScript + Preact content scripts that inject a right-side panel into Overleaf and talk to a local host via HTTP + SSE.
- Host (
host/): Fastify server that runs the Claude runtime via Claude Code CLI / Claude Agent SDK.
Follow the guidelines below when working interactively with an agent (e.g. Codex CLI) to keep iteration fast and avoid breaking the local dev loop.
1. Prefer the Dev Loops (watch / dev)
Extension (root)
- Prefer
npm run watchwhile iterating. It rebuilds the extension bundles and writes tobuild/. - Use
npm run buildwhen you explicitly want a production build (slower, but fine).
Host (host/)
- Use
npm run dev(tsx watch) while iterating on the host. - Bind to localhost only (default
127.0.0.1:3210). Do not change this to0.0.0.0without an explicit security plan.
2. Chrome “Load unpacked” + Reload Workflow
- In Chrome, load unpacked from
build/. - After changes:
- Ensure the extension has rebuilt (
npm run watchoutput looks healthy). - Go to
chrome://extensionsand click Reload on Ageaf. - Refresh the Overleaf tab so the updated content script runs.
- Ensure the extension has rebuilt (
3. Keep Dependencies in Sync (Two Node Projects)
This repo has two separate dependency trees:
- Root
package.json/package-lock.json(extension build + tests) host/package.json/host/package-lock.json(host server + runtime)
If you add/update dependencies, update the correct lockfile and restart the relevant
dev process (npm run watch and/or cd host && npm run dev).
4. Testing
- Extension tests:
npm test - Host tests:
cd host && npm test
For quick end-to-end verification:
- Start host:
cd host && npm run dev - Load/reload extension from
build/ - Open Overleaf and send a message; confirm
/v1/jobsand/v1/jobs/:id/eventssucceed (no CORS errors).
5. Coding Conventions
- Prefer TypeScript (
.ts/.tsx) and small, explicit functions. - Follow existing Preact patterns in
src/iso/panel/andsrc/main/editorBridge/. - Do not use
import { lazy, Suspense } from 'preact/compat';in Ageaf. This breaks the extension UX and makes the panel unusable in practice. - Avoid adding a separate
options.htmlpage unless explicitly required; prefer the in-panel settings UI. - Keep host endpoints compatible with browser fetch (CORS + preflight + SSE headers).
- For deeper React/Preact patterns and performance, consult
.claude/skills/react-best-practices/SKILL.md(Vercel Engineering — 40+ optimization rules across 8 categories) before refactoring components or addressing perf issues.
6. Useful Commands Recap
| Command | Where | Purpose |
|---|---|---|
npm run watch |
repo root | Rebuild extension to build/ while iterating |
npm run build |
repo root | Production extension build |
npm test |
repo root | Run extension unit tests |
npm run dev |
host/ |
Start host server with hot reload |
npm test |
host/ |
Run host unit tests |