Install for Grok Build¶
alr install grok wires OpenALR into the interactive Grok Build, so each turn you
work in Grok leaves one record on your machine. You need the alr command
first: see Quickstart steps 1 and 2.
Requires Grok Build 1.0.53 or later for the interactive hooks. The headless
alr-emit-grok reads the results of Grok Build 1.0.41 or later.
Install¶
alr install grok # prints the install preview; changes nothing
alr install grok --yes # applies it
The preview, --yes, the backup copies, and --home DIR work as on every install: see
How Every Install Works. If GROK_HOME
points somewhere other than Grok Build's default folder, the install preview says so.
Then fetch the latest price book with alr prices update: see
Get the Latest Price Book.
What It Writes¶
Paths below are as on macOS and Linux; on Windows ~ is %USERPROFILE% (see
Where Files Live).
Three files, all its own:
~/.grok/hooks/alr-emit.json: the hook file. It sets five hooks,Stop,SessionEnd,UserPromptSubmit,SubagentStart, andSubagentStop. TheStop,SessionEnd, andSubagentStophooks write records. TheUserPromptSubmithook answers the in-session commands, andSubagentStarthands a subagent its parent's tags.~/.grok/skills/alr-plan/SKILL.md: the/alr-planskill.~/.grok/skills/alr-prices/SKILL.md: the/alr-pricesskill.
Your config.toml is never edited. The hook file lives in Grok Build's global hooks
directory, which Grok always trusts. A file that already has one of these names
and that OpenALR did not write is left alone, and the install preview says so.
The hooks always exit 0, so a broken emitter never breaks your session.
Check It¶
- Start Grok Build and send a prompt.
- Type
/alr-ctl. It answers with one status line. Grok Build 1.0.70 and later shows the answer under your prompt and the session goes on. An earlier Grok Build showed it in a modal: read it, then choose discard. - Send a second prompt, or end the session, then run:
alr summary
alr turns last
alr check
A turn's record is written at the next Stop, because Grok Build writes a turn's usage
just after its Stop fires. SessionEnd completes the session. So /alr-turns
marks the latest turn not yet emitted: on Grok that is normal.
If Grok Build was killed or its terminal was closed before it exited, run alr-emit-grok-tui backfill. It writes
only the sessions whose turns the hook saw and nothing recorded. --session <id>
replays one session, and --since <date> or --all replay more. It never writes
again a record that alr uninstall grok --purge deleted.
Headless Runs¶
The hooks above cover interactive Grok Build. For a headless run, run Grok with JSON
result output, then give the result document to alr-emit-grok, as a file or on
standard input:
alr-emit-grok result.json --agent-id my-agent
Get-Content result.json | alr-emit-grok --agent-id my-agent
alr-emit-grok result.json --agent-id my-agent
alr-emit-grok --agent-id my-agent < result.json
Like the hooks, it always exits 0 and reports what it skipped on standard error.
Uninstall and Purge¶
alr uninstall grok --yes # removes the files the install added
alr uninstall grok --purge --yes # ... and deletes Grok Build's records
Uninstall removes a file it added only while you have not changed it, and
leaves your own files alone. Your records are kept unless you pass --purge.
--purge deletes only the Grok Build records from the shared record file, and the
grades, cost corrections, and tag events that name only those records. Every other
harness's records stay, byte for byte. Without --yes, --purge previews what
it would delete. OpenALR keeps the time of a purge, so that a later backfill never
writes again a record of a turn that ended at or before it.
Why It Works This Way¶
- The install owns one file. Grok Build reads hooks from a file in its global hooks
directory, so OpenALR writes its own file there and never edits your
config.toml. Removing OpenALR is then removing that file. - A turn is recorded at the next
Stop. Grok Build writes the usage of a turn after theStophook has already run, so the record cannot be written any sooner without guessing. - Grok Build's own turn identity is kept. Running the emitter again, or running
backfill, never gives recorded work a second record.
Next: tag your work.