Agent rules: details moved out of AGENTS.md / CLAUDE.md
Instructions for agents (English). AGENTS.md +
CLAUDE.md must stay <= 8192 bytes together
(bin/dev/cc-size budget fails above it). Long lists and
per-tool details live here; the constraints themselves (Cyrillic,
licenses, personal data, hsx, size limits) stay in
AGENTS.md.
Agent tools (use these, don't reinvent)
The name is Lagrange everywhere; "Polaris" is an old codename, never write it.
Before every nontrivial task and every new authorized agent/AI CLI
run, read plugins/lagrange-core/skills/model-route/SKILL.md
and run local cc-routing plan with a bounded task and
explicit class. Preserve exact overrides and all eligibility guards.
Apply a supported candidate only to a new authorized run; a running
model cannot self-switch. Do not run model benchmarks; published results
are dated priors, not measured subscription savings. Missing
executor/eligible candidates must be reported.
- Layout:
bin/= user commands,bin/dev/= kit-development tools,bin/hooks/= Claude Code hook entry points; every moved script keeps a relative symlink atbin/<name>for one release (new code and settings use the real path). - Plan:
bin/cc-roadmap status|next [--json](what's open), aBacklog: TASK-Ncommit trailer; status only viabacklog task edit. - Fast loop:
tests/run.sh --unit(~50 s, no Hammerspoon; =ci-fast.sh) while iterating;bin/dev/cc-docsync --coveragelists modules no test mentions. - Tokens:
bin/dev/cc-logtail(digest of a long log),bin/dev/cc-run-bg <name> -- <cmd>(one PASS/FAIL line, full log on disk), PreToolUse hookbin/hooks/cc-bg-steer(soft advice only); seedocs/dev/token-economy.md. Optional pluginlagrange-tokens(moduletokens, hooksbin/hooks/cc-tokens-*: logtail rewrite of noisy commands, Read/git/grep advice, syntax check after edits;CC_TOKENS_REWRITE=0/CC_TOKENS_OFF=1). - Waiting: no
sleep≥ 20 s and nountil …; do sleeppolling in the foreground — run long jobs withrun_in_background/bin/dev/cc-run-bgand keep working; you are notified on exit (hookcc-bg-steerreminds). - Waves:
bin/dev/cc-wave run <tasks.md> [--parallel 3] [--dry-run],cc-wave status,cc-wave merge(green branches only); skillwave; task templatedocs/templates/agent-task.md. Agent tools (WAVE_TOOLS) are project-scoped: git without push/reset,tests/*,bin/*, read-only shell helpers; never barebash:*/python3:*/./*(checked intests/parts/terminal-devtools.sh). - Worktrees:
bin/dev/cc-wt new <name> --preflight [--files …]checks that the task files are free before an agent starts. - History:
cchist recall|searchbefore digging,cchist learn [--days N](rule candidates from failed sessions),cchist usage --quality,--window 5h|7d(pace/ETA to the limit). - Providers:
claude/providers.tsvis the one AI-CLI manifest (id, bin, login, env, session globs, parser, resume, caps, license, module); consumers read it viabin/cc_accounts.py manifest()/cc-accounts providers, never a hardcoded list; a new CLI = a row + a module row +deps.tsv(subscription/free login only, OSI license);provider:<id>inmodules.offhides one;bin/cc-provider state|plan|apply|rollbackedits only manifest-declared (configcolumn) CLI settings, Settings sectionsettings_providers.luahas no provider names. Seedocs/dev/providers.md. - Accounts:
bin/cc-accounts [--json]|add|remove|rename|default|env|login|launch|hint|providers— accounts of every manifest provider + 5h/7d windows from local CLI files only (~/.config/claude-cowork/accounts.json);cwin --account IDstarts a session under one. - Extras/plugins:
bin/cc-extras health,validate --lint,sync --check,apply,ai(config~/.config/claude-cowork/extras.json). - Native repair:
bin/cc-suite-repair plan PROVIDER [--profile ID]; explicit reviewed operation IDs for apply, exact config/cache rollback, no automatic trust. Existing matching installs are no-ops; never use working profiles as test fixtures. Details:docs/dev/suite-repair.md. - Portable packages: root
plugins/lagrange-*/plugin.jsonplus Claude compatibility manifests;lagrange-coreowns setup/health and the existing local MCP bridge (extras module). Skills and runtime are shared. Codex hook activation is a separate reviewed integration; never auto-trust hooks. - Suite selection:
cc-suite catalog|state|plan|apply --yes|rollback IDusesclaude/suite-presets.json, marketplace and provider manifests. CLI and Settings sharecc_suite.py; onlysuite.jsonis saved, native installation is a separate adapters plan. Input needs are declared assuite:selection; the Suite card owns this form, not generic on/off actions. Require the plan hash before saving; never overwrite later edits during rollback. - Suite runtime:
cc-suite adapters health|plan|apply --yes|rollback IDowns native Claude/Codex plugins and manifest-declared Gemini/Qwen shared skills/MCP. Native hook trust remains manual; never replace foreign plugins.cc-doctoris read-only metadata/inventory, not a release gate;migratedelegates tocc-extras ai. Canonical presets: Core/Developer/Mac-UI/All/Custom; Essential/Full are compatible aliases. - Active context and onboarding:
U.context/ legacyU.ws,cc-context,cc-project doctor --first-run; seedocs/dev/navigation-context.mdanddocs/dev/project-onboarding.md. Context is metadata only.cc-routingoverrides one invocation; local paired benchmarks must exist before claiming superiority or savings. - Task sessions:
cwin --plan DIR TASK-N,cc-task-sessions list DIR TASK-N|rollback SESSION; only a real trusted SessionStart event creates the owner-only local link. Seedocs/dev/session-task-links.md. - Space filtering:
cc-space-scope list --json --space ID,cc-stats --json --space ID; exact native session metadata only. Unknown sessions are excluded; global sections stay explicitly labeled. Seedocs/dev/navigation-context.md. - Plugins in use:
docs/dev/plugins.md(per-plugin table + manual steps).rtk gain= savings of the RTK hook; LSP (lua-lsp,pyright-lsp) for definitions/references instead of Grep/Read;/revise-claude-mdat wrap-up when a rule changed;cc-extras healthprintsmanual:lines for pending steps. - Modules:
install/modules.tsvis the module manifest;install.sh --modules=a,b|--with=x|--without=x|--remove-module=x; a new optional feature = a row there (+ itsdeps.tsvcomponent id), never a hardcoded install step. - Connections:
bin/cc-connect list|plan|apply|rollback ID on|off --json(modules, MCP, Brief connectors, skills, plugins, tweaks; via the owning tools); a new switchable thing with user input = aneedsentry inclaude/connect.schema.json(cc-connect validate), secrets only to Keychain; extra Settings sections register viaM.sectionRenderers/sectionOpen/actionHandlers(seesettings_connect.lua). - Other tools:
cc-accounts,cc-provider,cc-extras,cc-layers,cc-docsync; pluginsdocs/dev/plugins.md. Optional modules:cc-spaces,cc-chrome-spaces,cc-ask,cc-passwords; config~/.config/claude-cowork/spaces.json+spaces.d/*.json. - Roadmap/tasks:
backlog/(Backlog.md 1.x) is the task source;bin/cc-roadmap status|next|scheme|write|open [--json]reads the task files directly (no backlog process);cc-wave run --task TASK-N; aBacklog: TASK-Ncommit trailer makescc-agent-mergemark the task Done; optional MCPcc-connect mcp:backlog on; moduleroadmap(dev preset only). Model and rules:docs/dev/roadmap.md. - Global board:
cc-roadmap board --all --json [--profile P] [--type type:T]aggregates that same bounded registry read-only; identity is canonical project path plus task ID. Never write foreign boards from the aggregate. - Layers:
bin/dev/cc-layers [--json|--strict]— dependency layers report (Luarequiregraph, cycles, upward requires; report-only). - Safety: hookify templates in
claude/hookify/*.local.md(prod-destructive, prod-require-zone, no-print-secrets);bin/dev/cc-merge-checkbefore a merge.
Feature module directories
hammerspoon/{core,panel,projects,settings,live,stats,wide,timemachine,chat,brief,assistant,links,macos,nav,sessions,scheduler,power}/
— linked flat into ~/.hammerspoon, require
names unchanged; manifest hammerspoon/load-order.txt.
Тяжёлые прогоны и авто-обновление
tests/panel.sh,voice.sh,install.sh, полныйtests/run.shиcc-benchберут общий для Mac замокbin/dev/cc-heavy(~/.cache/claude-cowork/heavy.lock). Выход 75 иBUSY— прогон уже идёт в другой сессии: повторить позже, не крутить цикл.CC_HEAVY_LOCK=0— обойти.- Страница workspace включает авто-обновление через
M.onShow(): вызывается при повторном показе и каждыеworkspace.AUTO_S= 60 с, пока видна. Держать дешёвым, перерисовывать только при изменениях.
Workspace chrome
Sidebar --workspace-side-w 236px, rail 44px, toolbar
40px. Keep chrome mounted on refresh; Docs: inner frame; Settings keeps
the focused search field.
Quiet UI tests (CC_TEST_QUIET)
tests/run.sh --quiet (or
CC_TEST_QUIET=1 bash tests/panel.sh) runs live suites
without stealing focus. hsx prepends
_G.ccQuiet=os.time()+120 to each call (the flag is a
deadline, so it expires by itself and never leaves the real panel
quiet). U.quiet() (core/core_ui.lua) guards every
focus/activate site: U.raise, palette, panel, workspace,
sessions. Windows are shown at alpha 0 (frames stay real). New
focus-taking code must use the same guard. voice.sh steps 6/8/13/17 and
the panel-features idle-CPU gate print SKIP(quiet).