FIELD GUIDE / 01

Get a clearer view.
Start locally.

Run a synthetic demo first. Then connect a supported agent, review its hooks, and verify what reaches your event stream.

01 / DOWNLOAD & EXTRACT

Ready for your platform.

Download the ZIP for your OS and architecture. The command remainsagent-lens for compatibility. Extract the whole package; the executable needs its adjacent engine library.

Using Cowork? Download the Cowork plugin ZIP and follow the upload instructions.

Unsigned portable packages. Keep the executable beside its engine library. Intel Macs and other architectures: build from source.

Verify your download · SHA-256

Download SHA256SUMS and compare your ZIP's hash with the entry for that exact filename. They must match before you extract and run it.

Windows · PowerShell
Get-FileHash "$HOME\Downloads\agent-lens-0.3.1-windows-x86_64.zip" -Algorithm SHA256
Linux · shell
sha256sum "$HOME/Downloads/agent-lens-0.3.1-linux-x86_64.zip"
macOS · shell
shasum -a 256 "$HOME/Downloads/agent-lens-0.3.1-macos-aarch64.zip"
Windows · extract with PowerShell
PowerShell · after downloading
Expand-Archive "$HOME\Downloads\agent-lens-0.3.1-windows-x86_64.zip" -DestinationPath "$HOME\AI-Lens"
cd "$HOME\AI-Lens\agent-lens-0.3.1-windows-x86_64"
Linux x64 · extract in a shell
Linux x64 · after downloading
package="$HOME/Downloads/agent-lens-0.3.1-linux-x86_64.zip"
mkdir -p "$HOME/AI-Lens"
unzip "$package" -d "$HOME/AI-Lens"
cd "$HOME/AI-Lens/$(basename "$package" .zip)"
chmod +x ./agent-lens
macOS Apple Silicon · extract in a shell
macOS Apple Silicon · after downloading
package="$HOME/Downloads/agent-lens-0.3.1-macos-aarch64.zip"
mkdir -p "$HOME/AI-Lens"
unzip "$package" -d "$HOME/AI-Lens"
cd "$HOME/AI-Lens/$(basename "$package" .zip)"
chmod +x ./agent-lens

The macOS package is unsigned and not notarized. If macOS blocks it, review Apple's downloaded-app approval guidancein System Settings → Privacy & Security. Approve only a download you trust.

Seven native adapters. Eleven telemetry sources.

Claude Code, Codex, Hermes, Gemini CLI, Cursor, Copilot CLI and Cowork use native hooks. Review client setup and limits. OTLP and provider audit ingestion are observation-only. Antigravity is unsupported.

Packages contain an executable and adjacent engine library:agent_lens_engine.dll on Windows,libagent_lens_engine.so on Linux, andlibagent_lens_engine.dylib on macOS. Keep the bundled examples/ folder for the demo and default rules.

Windows x64 builds require the latest Microsoft Visual C++ v14 x64 Redistributable. The ZIP does not bundle it. A missing VCRUNTIME140.dllprevents Lens from starting and returning hook decisions.

02 / NO AGENT ACCOUNT NEEDED

Make the first event synthetic.

From the extracted package folder, validate the default policy and run the demo. It appends five synthetic events; it does not install hooks or execute the illustrated tool operations.

Windows · PowerShell
PowerShell · extracted package
.\agent-lens.exe rules-check --rules .\examples\rules\default.yaml
.\agent-lens.exe demo --output .\demo.jsonl
Get-Content .\demo.jsonl
Linux & macOS · POSIX shell
Shell · extracted package
./agent-lens rules-check --rules ./examples/rules/default.yaml
./agent-lens demo --output ./demo.jsonl
cat ./demo.jsonl

Demo events include synthetic: true and redacted sample content. Normal collection omits raw prompts and tool content by default. Reusing the output file appends another five records.

03 / MANUAL CONFIGURATION

Connect an agent deliberately.

Use one absolute state path in both management commands and generated hooks. Output and rule paths below resolve from the extracted package folder; the output parent must already exist.

AI Lens does not detect running agents or install settings. You choose the project or user configuration file and merge the printed entries yourself. No Claude or Codex executable path is needed: the agent invokes the absolute AI Lens command printed by config. Review hook approval and workspace trust in your client; generated configuration does not bypass consent.

Windows · PowerShell
PowerShell · start and print configuration
$lensState = Join-Path $PWD 'lens-state'
$lensOutput = Join-Path $PWD 'events.jsonl'
$lensRules = Join-Path $PWD 'examples\rules\default.yaml'
.\agent-lens.exe --state $lensState start --output $lensOutput --rules $lensRules
.\agent-lens.exe --state $lensState config --agent claude --shell powershell
.\agent-lens.exe --state $lensState status
Linux & macOS · POSIX shell
Shell · start and print configuration
lens_state="$PWD/lens-state"
./agent-lens --state "$lens_state" start \
  --output "$PWD/events.jsonl" \
  --rules "$PWD/examples/rules/default.yaml"
./agent-lens --state "$lens_state" config --agent claude
./agent-lens --state "$lens_state" status
config prints. You review and merge.

It does not edit settings, approve trust, or start the agent. Preserve existing hook entries and follow the agent's own reload and consent requirements.

CLAUDE CODE

Merge into the settings hooks.

Use --agent claude. Review the generated hooks object for .claude/settings.json or your user settings. On Windows, the command above requests PowerShell quoting.

CODEX

Review native hooks JSON.

Run the same config command with --agent codex. Merge its entries into .codex/hooks.json or ~/.codex/hooks.json; review the definitions through the client's hook interface.

HERMES

Use native synchronous shell hooks.

Use --agent hermes. Merge the generated mapping into the profile's config.yaml. Hermes uses native argv quoting on each OS, independently of --shell; do not add PowerShell's & operator. Complete Hermes's hook consent normally.

GEMINI CLI

Merge native settings hooks.

Use --agent gemini. Merge the generated hooks into ~/.gemini/settings.json or a trusted project's .gemini/settings.json. Follow theGemini registration steps below.

Claude/Codex prevention covers supported PreToolUse and PermissionRequest events. Hermes uses pre_tool_call; Gemini CLI uses BeforeTool. Verify your installed client/version and the exact tool surface in the adapter coverage notes.

Register hooks where the tools execute. A local hook does not cover a separate cloud runner. Test an allowed call and a denied, harmless side effect through your actual client. status reports local state; it does not probe agent registration or event delivery.

FOURTH ADAPTER / GEMINI CLI

Register Gemini's native hooks.

Download and extract a package, then run these commands from its directory. Keep the executable beside its engine library. You can alsobuild and package the source yourself.

Gemini CLI · Linux & macOS package
lens_state="$PWD/lens-state"
./agent-lens --state "$lens_state" start \
  --output "$PWD/events.jsonl" --rules "$PWD/examples/rules/default.yaml"
./agent-lens --state "$lens_state" config --agent gemini
Gemini CLI · Windows package
$lensState = Join-Path $PWD 'lens-state'
$lensOutput = Join-Path $PWD 'events.jsonl'
$lensRules = Join-Path $PWD 'examples\rules\default.yaml'
.\agent-lens.exe --state $lensState start --output $lensOutput --rules $lensRules
.\agent-lens.exe --state $lensState config --agent gemini
  1. Review and merge the printed hooks.

    Use ~/.gemini/settings.json or the trusted project's.gemini/settings.json. Preserve existing settings and hook entries. Each generated command has a timeout of10000 milliseconds, or ten seconds.

  2. Review the registration in Gemini CLI.

    Open the intended workspace and use /hooks panel. Complete native project-hook review and any workspace trust prompts; changed project hooks may need review again. Agent Lens does not install Gemini, configure it automatically, or change trust and permissions.

  3. Check an allowed and a denied harmless call.

    Inspect both the actual side effect and the JSONL. A printed config or Lens status does not confirm registration. Local replay and offline dispatcher checks do not establish an authenticated Google live-client result.

The inspected Gemini CLI 0.66.0 runtime shell helper selects PowerShell on Windows and bash -c on Unix. This describes runtime components, not verified whole-client compatibility. AI Lens selects native quoting independently of --shell. Its nine events areBeforeTool, AfterTool, BeforeAgent,AfterAgent, BeforeToolSelection,SessionStart, SessionEnd,Notification, and PreCompress.

SessionEnd delivery is best effort: upstream shutdown does not wait for the hook, so its callback may be lost. Configuring all nine events does not guarantee that every event will be observed in a live session.

Only BeforeTool is enforceable: AI Lens replies withdecision: "deny" and a generic reason for a block. Other matches produce would_block and a neutral response; no completed action is undone. BeforeModeland AfterModel are excluded to avoid model-request and response-chunk overhead. Antigravity is not supported.

Whole-client compatibility remains unverified.

The pinned 0.66.0 native check exercises the unmodified vendor runtime/tool seam, including the full HookSystem, with a minimal Config facade and explicitly fired events. It excludes actual CLI settings loading, trust/consent, and provider sessions. The check is configured in CI for Linux, Windows, and macOS; see the verification recordand workflow results for observed outcomes. This is not an authenticated Google live-client claim.

Direct path rules cover native file_path arguments inread_file, write_file, and replace. They do not interpret read_many_files include globs or expand them into file paths; that tool is outside this coverage.

Read the official hook reference,configuration and hook review,workspace trust guidance, and adapter coverage notes.

COWORK

Upload a plugin. Start a task.

Download the Cowork plugin ZIP, then open Customize → Plugins → Add → Upload plugin in Claude Desktop. Enable AI Lens and start a new Cowork task. Follow normal folder permissions.

The plugin includes the Linux executable, engine and default rules for Cowork's cloud runtime. Try creating hello.txt, then a harmless .env file. The first should work; the second should be blocked.

State and metadata logs stay inside the task runtime. See the plugin guidefor finding the log, exporting it, and turning Lens off or back on.

04 / JSONL TO YOUR WORKFLOW

Take the context with you.

Normal events contain the agent, native hook/tool identifiers when present, phase, decision, matched rule IDs, and enforcement support. Configure your existing collector to tail events.jsonl and parse one JSON object per line.

Splunk · after collector field mapping
index=agent_lens sourcetype=agent_lens:jsonl decision=block
| stats count by agent, tool_name

block records the denial AI Lens requested. Confirm actual prevention independently. would_block is observational and never means an action was undone. Exclude synthetic: true demo events from live activity counts.

Keep collection metadata first.

start --capture-content enables content capture after best-effort redaction. Redaction can miss secrets. Even metadata can be sensitive; you own permissions, retention, rotation, and forwarding.

AI Lens provides no network shipper, delivery acknowledgment, or tamper-evident audit trail. Add trusted host identity at the collector and consult the SIEM mapping and query guide.

05 / CLOSE THE LOOP

Stop collection with the same state.

Windows · PowerShell
.\agent-lens.exe --state $lensState stop
Linux & macOS · shell
./agent-lens --state "$PWD/lens-state" stop

This disables collection and enforcement for that state directory. It leaves prior events on disk and manually installed hook settings in place. Remove those entries yourself when uninstalling; stop collection before moving its output file.

ALTERNATIVE / BUILD IT YOURSELF

Build from source.

Use current stable Rust. Python 3.9+ is needed for the repository's checks and packaging, not to run the application. Older Rust toolchains are not validated.

Source build · POSIX shell
git clone https://github.com/magicsword-io/AI-Lens.git
cd AI-Lens
cargo build --locked --workspace --release
python3 scripts/package.py

On Windows, use your Python 3 command in place of python3. The ZIP and manifest appear in dist/. Build both workspace crates so the executable has its adjacent dynamic engine library.

Understand the policy schema