Before you begin
You need organization administrator access in Forge, permission to update the provider’s image or team setup, and permission to configure provider secrets. The hosted computer needs Python 3, an outbound HTTPS connection to your Forge API, a verified Linux Forge hook runtime, and private persistent storage. In the provider setup dialog, select Download Linux runtime to obtain the selectedx86_64-unknown-linux-gnu release artifact. For other architectures, ask your deployment administrator for a qualified artifact. Verify its target, version, SHA-256 and authenticated release manifest before installing it as /opt/forge/bin/forge-hook. Do not substitute a laptop executable or download an unpinned executable in each callback. If your release has no qualified Linux artifact for this image, complete credential/configuration setup and ask your deployment administrator for the artifact before enabling collection.
Create the collector credential
- Open Settings > Cloud hooks in Forge.
- Under Cloud agent hooks, select Set up Cursor Cloud Agents or Set up Grok Bot.
- For Cursor Cloud, enter a repository scope such as
owner/repository. This scope comes from the credential, never from callback JSON. - Select Create collector credential. Copy the credential and save its key ID. Forge shows the secret only during this setup. Credentials expire after 30 days.
- Download the native configuration and the cloud hook installer.
Set up Cursor Cloud Agents
- Install the verified runtime in the provider image.
- Add
FORGE_CLOUD_HOOK_TOKENto the provider’s secure setup environment. Set it to the copied credential. Do not commit the token to the repository or print it in setup logs. - Place
install-cloud-hooks.pyandforge-cursor_cloud-hooks.jsonin the setup workspace. - Run the following command as the user whose agent executes the hooks, from the repository root.
~/.forge/cloud-hooks/cursor_cloud.token with owner-only permissions. Native hooks can read it even when setup secrets are absent from the hook process environment. The native configuration contains the collector URL and command, without the credential.
Keep ~/.forge/cloud-hooks/cursor_cloud/state private, writable and persistent across restarts. The generated command uses this location by default. If your provider requires a persistent volume at another path, set FORGE_HOOK_STATE_DIR in the hook process environment. Do not share the directory between unrelated users or collector families.
Start a fresh cloud agent after changing the image or configuration. Hooks begin after the environment becomes writable, so initial prompts and earlier read-only activity may be absent. Dedicated MCP callbacks are unavailable in cloud agents. Generic tool callbacks can expose HTTP MCP tool names with redacted results; do not interpret a redacted result as inspected content.
Set up Grok Bot
- Install the verified runtime and installer in Enterprise Team Setup or your provider image.
- Add
FORGE_GROK_BOT_HOOK_TOKENas a secure setup secret for the member computer. Do not embed it in a team manifest. - Distribute
forge-grok_bot-hooks.jsonas non-secret configuration. - Run the following command as the hosted computer user during setup.
~/.cursor/hooks.json and writes the private credential to ~/.forge/cloud-hooks/grok_bot.token. This is the hosted Bot configuration, separate from local Grok CLI configuration under ~/.grok. Keep ~/.forge/cloud-hooks/grok_bot/state private and persistent. Team setup secrets can be unavailable directly to hook commands; the private file bridges that boundary.
Create a fresh Bot for each pilot member after setup. Registered callbacks do not prove that the runtime emits them. The independently documented Grok pilot covers preToolUse, postToolUse and postToolUseFailure. Other registered callbacks require your own provider validation. Do not use a shared computer ID as a replacement for a missing Bot or conversation ID.
Verify delivery in Forge
- From a fresh hosted agent, run a harmless tool action with a distinctive value, such as
printf 'forge-hook-pilot-<your-value>\n'. - Open Live > Sessions in Forge and select the corresponding product. Check the timestamp, repository or member scope, native tool name, call and result. When the provider emits a conversation ID, check that the messages share that conversation. A Grok activity without that ID remains tool-scoped.
- If the provider emits prompt and response callbacks with a generation ID, check their links to the observed prompt. Missing callbacks remain coverage gaps.
- Open the message’s governance details. A completed evaluation and its linked outcome prove governance processing. An intervention request alone does not prove an action ran. A violation appears only when the policy/evaluation writer produces an applicable violation.
- Restart the executor without deleting its state directory, then run another tool call. Check delivery again. During an approved pilot outage, retain the same credential and state directory, restore connectivity, drain retained events, and verify that replay does not duplicate messages or outcomes.
Retry and recovery
Native callbacks always allow the provider action to proceed. Collection failures retain eligible events in the shared bounded spool. Successful queue admission precedes asynchronous evidence and governance persistence. Keep the private state directory through restarts and recover connectivity within its configured retention window. To explicitly retry retained callbacks, run the same verified executable as the hook user, with the same token file, collector URL and state directory.cursor_cloud and its state directory. The runtime binds retained callbacks to the credential fingerprint. A replacement credential cannot relabel old retained events. If a key expires or is revoked before its backlog drains, preserve the state and contact your administrator; do not edit the spool or fabricate a new source identity.
Rotate or revoke a credential
Before expiry, drain retained events using the old key. For Grok, rotate between tool calls because the credential scopes tool-only identity. Create a replacement in Forge, update the provider setup secret, and rerun the installer with--token-env. Start a fresh agent and verify delivery before revoking the old key.
To revoke, open the provider setup in Settings > Cloud hooks, enter the saved chk_... key ID and select Revoke credential. Revocation stops new admission immediately. Already admitted encrypted queue items can finish persistence. Remove revoked secrets from the provider secret store and hosted computer.