AGENTS.md · diff

git:20261115.efbb2ee to git:20261118.8b457d9

3 added, 0 removed. Audit A to A.

What this update changes in the checks

No check changed: every fixed check gives the same answer before and after this update.

A tripped check is a label, not a verdict: read the matched text and the lines below. This week's updates that newly trip a check.

# AGENTS.md — LitGravity
LitGravity is the LitFamily package for Google's Antigravity CLI (`agy`). This repo is independent: its own git history, npm package `@litfamily/litgravity`, version and tests. It shares ideas with its siblings and no files; re-express any family feature in agy's own plugin idiom.
## Layout
- `plugin/` — the agy plugin that gets installed. `plugin/plugin.json` is the manifest. `plugin/hooks.json` sits at the plugin ROOT (agy never reads `hooks/hooks.json`). `plugin/hooks/*.mjs` are the hook scripts and `plugin/hooks/lib/` holds the shared code (routes, re-entry, transcript reader, policy, prose guards, continuation holds). `plugin/rules/AGENTS.md` is the always-on contract. `plugin/agents/*.md` are subagents. `plugin/skills/<id>/` are the skills; nine of them are pointer stubs for skills that moved to wjgoarxiv-skills (see Moved skills below). `plugin/hud/statusline.mjs` is the opt-in status line script and `plugin/hud/render.mjs` builds its line.
- `lib/` + `bin/litgravity.mjs` — the dependency-free installer, doctor, list, models, uninstall and `extensions` (`lib/extension-manager.mjs`).
- `test/` — `node --test`; `test/fixtures/fake-agy.mjs` stands in for the host so tests never touch the real `~/.gemini`. Transcript fixtures are in `test/fixtures/transcripts/`.
- `scripts/` — version lockstep, legacy-token scan, `validate-plugin.mjs` (wraps `agy plugin validate`), and `sync-lock.mjs` (writes `skills.lock.json`, see below).
## Gates
```bash
npm test
npm run check:version
npm run scan:legacy-tokens
npm run validate # agy plugin validate --json --strict: 0 errors, 0 warnings (free, offline)
npm pack --dry-run --json --ignore-scripts # read [0].files; the `pack` list in skills.lock.json pins it
npm run sync:lock # after skills or package files change; read the diff
npx litgravity list # every skill with its route words; moved ones name their family
```
A fresh-clone check (copy the tracked-to-be set to a temp folder and run `npm test` there) proves nothing pinned depends on untracked state.
`skills.lock.json` (repo root, tracked, not packed) is the one pin for what ships. `policy` (family floor, the 24,000-byte body cap, the runtime list, the three exemption lists and their reasons, and `movedStubs`, the moved ids that skip the family floor) and `budgets` (per skill: the floors `minSkillBytes`, `minBodyBytes`, `minFiles`, `minTotalBytes`, and the ceilings `maxFiles`, `maxTotalBytes`) are hand-owned: `npm run sync:lock` copies them through unchanged. It generates `skills` (per skill: SKILL.md bytes, body bytes and hash, file count, folder bytes, one hash over every file) and `pack` (the sorted `npm pack --dry-run --json --ignore-scripts` list). Only files git tracks are measured, so `git add` a new file first; a stray local file never makes the lock stale. While any skill is outside its budget, sync:lock prints each violation, writes nothing and exits 1. A new skill or a removed one is a violation too, until it is named: `npm run sync:lock -- --accept-new <id>` seeds a budget from today's size, `npm run sync:lock -- --drop <id>` removes an orphan one. Raise a floor by hand when a skill grows on purpose; never lower one to pass.
## Host facts (probed on agy 1.4.3, 2026-10-20; re-probe on a new build)
- **hooks.json shape is strict.** `{ "<name>": { "<Event>": [...] } }`. SessionStart, PreInvocation, PostInvocation and Stop take a FLAT list of handlers; PreToolUse and PostToolUse take `{matcher, hooks:[...]}` groups. One wrong group makes agy skip the whole file while `/hooks` still lists it, so `test/hooks.test.mjs` asserts the shape and `agy plugin validate --json --strict` must report nothing. Handlers run with the plugin folder as cwd, so commands are `node ./hooks/<name>.mjs`.
- **No `UserPromptSubmit`.** The prompt is not in the hook payload. Bare `lit` is `PreInvocation` with `invocationNum` 0: read the newest `USER_INPUT` step from `transcriptPath` (its `<USER_REQUEST>` block) and answer `injectSteps`. It fires for every turn, including resumed conversations. `SessionStart` fires once per new conversation, never on resume.
- **Hook payloads are camelCase** (`conversationId`, `workspacePaths`, `transcriptPath`, `toolCall: {name, args}`, `terminationReason`). Tool names differ between builds and surfaces. A headless run of 1.4.3 called `read_file` (`Path`), `write_file` (`Path`, `Content`, `Overwrite`), `run_command` (`CommandLine`, `WaitMsBeforeAsync`), `invoke_subagent` (`TypeName`, `Prompt`, `Role`, `Model`) and `ask_question` (`questions[]`); older conversations used `view_file`, `write_to_file`, `replace_file_content`, `multi_replace_file_content`, `list_dir`, `grep_search`, `find_by_name`. The hook payload names a tool by its step type, which this repo has not captured for file tools, so write detection is by name pattern or by path plus content arguments, never by one fixed name.
- **PreToolUse cannot abstain.** Every answer needs a `decision` (`allow`, `deny`, `ask`, `force_ask`, `deny_unless_prior_grant`). An empty object `{}` is read as a denial with an empty reason: on 1.4.3 it blocked `read_file`, `write_file`, `run_command` and `ask_question` of a whole lit-plan turn (live run, 2026-10-20). `ask` prompts the user (soft-denied in print mode) and `allow` may lift the user's own approval prompts (probe run2 suggests it does not override the print-mode denial of `run_command`; interactive behavior is UNCONFIRMED). So `hooks.json` keeps the PreToolUse matcher on `invoke_subagent|define_subagent`, which never prompt, and file writes, shell commands and prose are checked after the fact by `lib/boundary.mjs` (a workspace snapshot at the start of the lit turn, compared in PostInvocation and Stop). `hooks/pre-tool-use.mjs` still carries the full policy; widening the matcher to `.*` turns it on, but only after someone proves in an interactive session that `allow` leaves the approval prompt in place.
- **Headless `-p` auto-denies `run_command` and `write_file`** unless agy was started in a permissive mode, with `permissions.allow` rules or with `--dangerously-skip-permissions`. The denial ends the run: `response` is empty, the JSON lists `denied_actions`, stderr says `jetski: no output produced`. `read_file` inside the workspace is allowed. A plugin that is a symlink to a folder OUTSIDE the workspace was denied its skill `read_file` (W2 probe, 2026-10-20); a project-scope copy inside the workspace was read. User scope (`~/.gemini/config/plugins`) was not probed headless (the build rule keeps `~/.gemini` read-only), so UNCONFIRMED. The router's activation note therefore tells the model to read first and to report BLOCKED with the permission it needs.
- **Live proofs on 1.4.3 (2026-10-20, 12 model calls in all):** bare `lit` ignites (`LIT IGNITED · lit-loop`, then one question); after `lit plan …` a resumed bare `lit` (`agy -p … --conversation <id>`) was routed as a continue (the hook ledger says `"how":"continue"`), though that reply was empty because a write was denied; with lit-loop active a resumed bare `lit` answered `LIT CONTINUES · lit-loop` without reading the skill again; `lit new` ignites again; `lit brainstorm …` makes the model read `skills/lit-brainstorm/SKILL.md`; `PostInvocation`, `PostToolUse` and `Stop` fire (`LITGRAVITY_HOOK_TRACE=<file>` logs one line per hook call: SessionStart once, PreInvocation and PostInvocation per invocation, Stop with `NO_TOOL_CALL`); **the model reads a PNG through `read_file`** (it answered a word nobody had typed). The PostToolUse payload carries `toolCall` and `error` but no command output. A resumed conversation keeps the workspace and plugin copy it started in, whatever the current folder is.
- **Still UNCONFIRMED:** interactive `allow` from PreToolUse, status-line stdin fields, child agents spawned for real (`lit-team`, reviewer lanes), `browser_subagent` and `generate_image` argument shapes, `command_status`, whether user-scope skill files are readable headless.
- **A SKILL.md loads only its first 24,000 bytes** (the validator warns above that). Rules files are capped at 24,000 bytes too. Depth beyond the cap goes into `references/`, which is why each budget in `skills.lock.json` also holds the folder's file count and total bytes.
- **Starter Quota.** The user's account has a small model quota. Real `agy -p` calls are rationed (a build uses at most 15 in total); everything else uses `agy plugin validate --json` and `agy -p "/hooks"`, `"/skills"`, `"/agents"`, which cost nothing.
- Plugin names share one global namespace and the first one found wins silently, so doctor warns when both scopes hold a copy.
- The status line is user-level only (`~/.gemini/antigravity-cli/settings.json`, key `statusLine`; `ANTIGRAVITY_GEMINI_DIR` does not move it, so a live stdin capture needs the user's own settings). The installer touches it only with `--status-line`, backs the file up first, and refuses a status line it did not write unless `--replace-status-line` is given, which saves the old value to `$XDG_DATA_HOME/litgravity/backups/statusline-replaced.json` for `uninstall` to restore. agy disables a status line after repeated failures, so `hud/statusline.mjs` always exits 0. Only `model.display_name` (read as `Gemini 3.8 Flash (Medium)`) and `context_window` (`used_percentage`, and a `context_window_size` that rounds to 1049k) were seen live, through the predecessor line on 2026-10-21; `quota`, `cost`, `vcs`, `agent_state`, `task_count` and `conversation_title` are read defensively from the binary's field names and the changelog, and their shapes are UNCONFIRMED.
- **Status-line looks** (`plugin/hud/looks.mjs`): the rewind rainbow for lit-adhd, YOUR TURN in amber, the five review-work lanes, and a DONE mark for 20 s after a plan or goal finishes. A look follows the route id, so every entry (route word, skill id, slash, alias, skill load through PostToolUse) selects it. The repaint cadence of agy's status line is UNCONFIRMED, so every look is static apart from the rainbow's 10-second step. That means no breathing, no burst animation and no clearing at the keystroke: YOUR TURN clears at the next PreInvocation. A published release is invisible to the hooks, so it shows no DONE mark. The waiting reason comes from the Stop hook's reading of the turn's tail (ask_question, a BLOCKED line, a typed approval, a closing question), a goal record's status, or `agent_state`.
+ - **agy 1.5.10 (2026-11-18):** `run_workflow` is in the default tool list (Python `agent(prompt, schema, role, type_name, workspace inherit|branch|share, model flash_lite|flash|pro|inherit)`, `parallel`, `pipeline`; one failure cancels its `parallel()` group; agents cannot ask the user). `/goal` exists only in the interactive TUI and no hook can type it, so plan goals are checked by `plugin/hooks/lib/goal.mjs` from Stop (advisory, 7 s). `ultra-brainstorm` and the rewritten `lit-team` use `run_workflow`; lit-adhd's verdict card is `plugin/hooks/lib/rewind/verdict.mjs` and `lit-recap` is now its recap view (`lit adhd recap [session]`).
+
## Gotchas
- **Route state is outside the workspace** (`$XDG_STATE_HOME/litgravity/sessions/<workspace hash>/<conversationId>.json` plus a `.journal`), so a planning-turn tool call cannot lift its own limit. PreToolUse denies writes there on every route.
- **Liveness records** (`plugin/hooks/lib/liveness.mjs`) sit beside the route state as `<conversationId>.live.json`: PostToolUse writes `alive` and an unheld Stop writes `idle`, for every conversation, at most once per 30 s for the same state. agy has no session-end event, so `ended` is read from staleness (10 min alive, 2 h idle). Any new reader of the route-state folder must skip `.live`, `.stack`, `.snapshot`, `.motion` and `.lanes` files.
- **Auto handoff and the shown record** (`plugin/hooks/lib/auto-handoff.mjs`, `lib/shown.mjs`): agy has no compaction event, so Stop writes `.litgravity/handoff/auto.md` at every turn end of a conversation a lit route touched (route, ledger or open goal), unless the note differs only in its timestamp; SessionStart carries the newest of `latest.md` and `auto.md` whole (6,000 characters, inside an untrusted-notes fence) for three days. SessionStart fires once per new conversation, never after an in-conversation compaction, so only a fresh conversation gets the note. `LITGRAVITY_AUTO_HANDOFF=0` is the one off switch and restores the pointer-only behavior. `.litgravity/shown/notices.jsonl` is append-only (hash + time per update notice, extensions notice and `lit adhd` nudge, plus one `run-end` line per unheld Stop of a start-work, lit-loop or litgoal turn: `waiting`, `nothing` or `sent`); a corrupt or missing file means today's behavior. Hooks never write either folder through a link.
- **The boundary scan is bounded**: `lib/boundary.mjs` walks at most 20,000 files or 1.5 s per call (PreInvocation snapshot, then each PostInvocation and Stop), skips `.git`, `node_modules`, `.agents`, `.litgravity`, build output and caches, keeps up to 200 small prose files in memory, and marks the snapshot `partial` past the limits (a partial snapshot reports no deletions). It runs only while a lit route is active, never in plain conversations.
- **Do not name sibling products or their tools** anywhere under `plugin/`. `test/depth.test.mjs` fails on sibling product names, host names and the tool names of other hosts, and `npm run scan:legacy-tokens` repeats part of that.
- **Skill folders must not contain `evidence/`, `plans/` or `.litgravity/` directories**: `.gitignore` ignores them and the pack test fails.
- **Work from this repo's own root.** Another agent's hooks may write their state folder into whatever directory a shell sits in; `.gitignore` keeps every `.lit*/` folder out of the repo, and the pack allowlist keeps it out of the package.
- **Moved skills.** Five content families left for the separate wjgoarxiv-skills repository: decks (`lit-pptx`), documents (`lit-docx`), figures (`lit-diagram-drawer`, `lit-schematic`, `lit-scientific-visualization`), design (`frontend-ui-ux`, `visual-qa`) and video-covers (`lit-typographic-motion`, `readme-studio`). Each id keeps its route words, its slash form and a same-name SKILL.md stub that looks for the installed copy (`~/.gemini/config/skills/<id>/SKILL.md`, then `.agents/skills/<id>/SKILL.md`) and otherwise gives four install lines from `extensionSteps(id, scope)` in `plugin/hooks/lib/routes.mjs`: a read-only `find` for every same-name skill in the four folders agy 1.5.6 loads bare skills from (`.agents/skills`, `_agents/skills`, `~/.gemini/config/skills`, `~/.gemini/skills`; agy keeps one same-name skill silently), a move of an existing copy whole into `~/.gemini/extension-backups/<stamp>/<id>` (outside every scanned folder; never a `<id>.bak` sibling, which agy loads and may prefer), a `cp -R` into the emptied `<dest>/<id>`, and a receipt at `<dest>/<id>/.litfamily-extension.json`. Update is the same four lines; remove is the second alone; nothing deletes. The stubs, both reference pages (`docs/reference.md`, `docs/reference_ko-KR.md`), the notice, the router note, `list`, doctor and the autoresearch figure guide all print those lines, and `test/extension-lines.test.mjs` runs them in bash and zsh. The agy copy of each skill is its own folder there, installed as a standalone skill. The installer never writes `~/.gemini/config/skills/`, so a LitGravity upgrade leaves those copies alone, and the copy's bare `<id>` never clashes with the stub's `litgravity:<id>`. `MOVED_SKILLS` in `plugin/hooks/lib/routes.mjs` is the one table: the activation note, `litgravity list` and doctor read it. The engines (`office`, `diagram`, `readme`, `sciviz`, `motion`), `litgravity runtime`, the Python picker and the motion done gate left with the bodies, so no LitGravity hook holds a film turn any more; `test/moved-skills.test.mjs` guards all of this. Stubs keep the placeholder path and name no host but agy. `litgravity extensions list|check|install|update|remove|prune-backups` (`lib/extension-manager.mjs`) does the same four steps in code: a dry run unless `--yes`, `--project` for `.agents/skills`, `--from <clone>` or its own shallow sparse clone of `variants/litgravity` in `$XDG_CACHE_HOME/litgravity/extensions-src` (`LITGRAVITY_EXTENSIONS_REPO` overrides the URL in tests). It stops on a same-name skill in any of the four folders unless `--allow-shadow`, fails closed on a link, refuses to remove a folder without its receipt, and deletes only inside `~/.gemini/extension-backups/` with `prune-backups --yes`. Its receipt adds `scope`, `hash` (sha256 over the folder, the receipt left out), `files`, `source_commit` and `installed_by` to the four keys of the hand lines; `update` hashes the installed copy when a hand-written receipt has no hash. `install` runs the read-only `check` and puts a one-line pointer in the extensions notice when it finds something; doctor shows a one-line `extensions` row. `test/extension-manager.test.mjs` covers each verb in a sandbox HOME.
- Old route-state folders on a user's machine may still hold `<conversation>.motion.json` files from earlier releases; readers keep skipping them.
- **Depth fixtures name each exemption.** `closureExempt`, `hostNameExempt` and `illustrativeRefs` list single files, each with a reason in `exemptionReasons`, and `test/depth.test.mjs` scans every byte of every bundle file (text, binaries, the XML inside docx and pptx) for sibling product names. Vendored third-party files stay verbatim and hash-pinned.
+ - **Goal never-list and the skill plan.** `GOAL_NEVER` in `plugin/hooks/lib/routes.mjs` lists the routes that may never arm a goal (frontmatter takes only name and description). `plugin/hooks/lib/skill-plan.mjs` caps the plan at three skills; `test/skill-plan.test.mjs` pins it.
- Bump versions only with the user's approval, in `package.json`, `plugin/plugin.json` and `CHANGELOG.md` together.
- No publish, tag or push without explicit approval. Re-check Google's brand terms for "Antigravity" before the first publish.
- Local state stays untracked: `.litgravity/` and other `.lit*/` folders, `HANDOFF.md`, `evidence/`, `plans/`.