GUARDS and Antigravity Log and State Map
Use this reference to locate runtime state directories, decode JSONL log records, and join agy-guards events to Antigravity (~/.gemini/) conversation artifacts.
1. Base path resolution
Resolve paths dynamically from environment variables and the target <workspace_root> rather than assuming fixed user directories:
- GUARDS state base (
<state_base>):$XDG_STATE_HOME/agy-guardswhen$XDG_STATE_HOMEis set to an absolute path~/.local/state/agy-guardson Linux when$XDG_STATE_HOMEis unset~/Library/Application Support/agy-guardson macOS when$XDG_STATE_HOMEis unset
- Project slug (
<project_slug>):<owner>__<repo>derived fromgit -C <workspace_root> remote get-url origin. - GUARDS credentials file (never print contents):
$GUARDS_CREDENTIALS_FILE, else$XDG_CONFIG_HOME/agy-guards/credentials, else~/.config/agy-guards/credentials(expected mode0600). Note thatagy-guardsreads persona tokens from this file and ignores tokens exported directly in the shell environment. - Factory state directory (
<factory_dir>):<workspace_parent>/guards-factory/<repo-name>by default, or the custom path passed toagy-guards factory --state-dir <dir>. - Factory workspace locks:
$XDG_DATA_HOME/guards-factory/locks/<sha256_hex>(defaults to~/.local/share/guards-factory/locks/<sha256_hex>on Linux), where<sha256_hex>is the SHA-256 digest of the canonical<workspace_root>path. - Antigravity host directories (
<agy_app_dir>):- Headless and CLI sessions:
~/.gemini/antigravity-cli - Desktop and IDE sessions:
~/.gemini/antigravity(and~/.gemini/antigravity-idewhen present) - ACP provider sessions:
~/.gemini/antigravity-acp - Shared plugin and hook config:
~/.gemini/config
- Headless and CLI sessions:
2. GUARDS state tree (<state_base>/)
<state_base>/
├── hook-callers/
│ └── <conversationId> # Marks an activated GUARDS caller enforced by pre-tool-use
├── logs/
│ ├── server.log # Global events without a resolved project (e.g. reset --factory)
│ ├── error.log # Global WARN/ERROR subset
│ └── audit.log # Global MCP audit calls without a project
└── <owner>__<repo>/
├── guards.sqlite3 # Authoritative GUARDS SQLite store (read via inspect/doctor)
├── artifacts/
│ └── <id>/ # Deliverables (G.2..D.2), .writers sidecar, .run.json manifests
├── investigations/ # Recorded runtime investigation bundles
├── publication-locks/ # GitHub publication coordination locks
├── evidence-execution-<N>.lock # Evidence-work gate locks
└── logs/
├── server.log # Project-wide merged tracing + mirrored audit JSONL
├── error.log # Project-wide WARN/ERROR JSONL
├── audit.log # Project-wide MCP tool boundary JSONL
├── <session_id>/ # Per-session logs (e.g. 42, review-pr-13, wave-*, run-chores-*)
│ ├── .seq # Lockfile issuing monotonic u64 seq across processes
│ ├── server.log # Session tracing + hook decisions + mirrored audit lines
│ ├── error.log # Session WARN/ERROR lines and agy_guards::panic records
│ └── audit.log # Session hub/spoke MCP call lifecycle lines
├── crew/ # Subagent/crew dispatch diagnostics
├── spoke-continuations/ # Hub-to-spoke continuation state and reminders
├── workflow-invocations/ # Skill/workflow invocation traces
├── attended-resumes/ # Interactive resume records
├── feedback-publications/ # PR review/comment publication traces
├── publication-journal/ # Durable GitHub write journal
└── cleanup/ # Spoke worktree lease and gc reaper notes3. GUARDS JSONL schemas and GUARDS_LOG verbosity
Every line in server.log, error.log, and audit.log is a single JSON object.
Common fields (server.log and error.log)
{
"seq": 148,
"ts": "2026-10-30T11:42:09.512Z",
"unix_ms": 1793360529512,
"pid": 41892,
"process": "hub",
"level": "WARN",
"target": "agy_guards",
"session": "42",
"conversation": "8f2c1b40-9e3a-4d1c-8a77-112233445566",
"message": "hook denied command or control-surface access",
"reason": "..."
}
process: identifies which binary entrypoint wrote the record (hub,spoke,hook,gc,approve,reset). Read-only CLI subcommands (doctor,inspect,monitor,tools) leave no log trail.- Panics log at
ERRORundertarget: "agy_guards::panic"in bothserver.loganderror.log. - Fail-open
FileLayercaveat: If a log write fails once (disk full, permission error, or directory unlinked mid-run),agy-guardsemits a single warning tostderrand disables file logging for the rest of that process lifetime. Whenaudit.logstops advancing while the process is still alive, inspect hostcli.logor custom--log-fileoutput forstderr.
MCP audit records (audit.log)
audit.log captures every guards_hub and guards_spoke MCP tool invocation across two (or three) phases sharing one call_id:
phase: "start"- recordstool,process(huborspoke),session, andconversation(attributed vianote_caller).phase: "args"- emitted only whenGUARDS_LOG=debug(or a matchingEnvFilterdirective) is active; contains redacted tool arguments.phase: "end"- recordsok(trueorfalse),duration_ms, and error summary whenokisfalse.
agy-guards automatically redacts keys matching token, secret, password, authorization, and api_key, plus GitHub token prefixes (ghp_, gho_, ghu_, ghs_, ghr_, github_pat_).
Enabling debug argument logging for a reproduction run
GUARDS_LOG=debug agy
GUARDS_LOG accepts standard tracing_subscriber::EnvFilter directives (default info).
4. Antigravity (~/.gemini/) host tree and transcript schemas
~/.gemini/
├── config/
│ ├── import_manifest.json # Must list exactly one guards plugin import
│ ├── hooks.json # Host hook file with projected agy-guards hook entries
│ ├── agy-guards-hooks.receipt.json # Projection receipt verified by --projected hooks
│ ├── agy-guards-installation.receipt.json # Binary + asset provenance receipt for factory runs
│ └── plugins/guards/
│ ├── plugin.json # Plugin manifest
│ ├── hooks.json # Intentionally empty (hooks run from ~/.gemini/config/hooks.json)
│ ├── mcp_config.json # Defines hub MCP server (timeoutSeconds: 3900)
│ └── {agents,rules,skills}/ # Persona definitions (tars, case, doyle, romilly, kipp, brand) and skills
└── antigravity-cli/ # Check ~/.gemini/antigravity/ for Desktop/IDE runs
├── cli.log # Symlink to log/cli-YYYYMMDD_HHMMSS.log (host + MCP stderr)
├── crashes/crash_*.log # Host crash dumps
├── cache/
│ ├── last_conversations.json # Maps workspace path -> most recent conversationId
│ └── conversation_metadata.json # Conversation titles, workspaces, timestamps
├── mcp/
│ ├── guards_hub/*.json # Cached hub MCP tool schemas
│ └── guards_spoke/*.json # Cached spoke MCP tool schemas
├── worktrees/
│ └── <hubConversationId>/
│ └── subagent-* # Branched Git worktrees for write-scoped spokes
└── brain/
└── <conversationId>/
└── .system_generated/
├── logs/
│ ├── transcript.jsonl # Compact step-indexed conversation transcript
│ └── transcript_full.jsonl # Full step-indexed transcript fallback
├── steps/ # Per-step tool inputs and outputs
├── tasks/ # Background command logs (task-*.log)
└── messages/ # Inter-agent send_message queue recordsTranscript tail behavior (transcript.jsonl and transcript_full.jsonl)
agy-guardssearches both~/.gemini/antigravity-cli/brain/<conversationId>and~/.gemini/antigravity/brain/<conversationId>.- Step entries include
USER_INPUT,PLANNER_RESPONSE,TOOL_CALL, andGENERICevents (such asask_questioncompletions). - When reconciling human approvals (
approved/approved <issue_number>) or G.1 / bundleask_questionanswers (decision <id>: ...),agy-guardsreads only the last 128 KiB oftranscript.jsonl(falling back totranscript_full.jsonl). Oversized steps after the user’s answer can push the answer past the 128 KiB tail window.
5. Factory supervisor artifacts (<factory_dir>/)
Unattended /guards-run-factory shifts (agy-guards factory) maintain supervisor state outside <workspace_root>:
FACTORY_LEDGER.ndjson- append-only redacted NDJSON stream ofReceiptobjects (seq,received,channelsuch asconfiguration,checkpoint,turn_result, optionalposition, optionalconversation, andpayload).FACTORY_REPORT.md- terminal shift summary written when the supervisor handles the final directive or stops in--automode.FACTORY_START_FAILURE.md- written when preflight, provenance binding, or workspace lease acquisition fails at shift start.
6. Cross-system join keys
| Key | Where to find it | What it unlocks |
|---|---|---|
<session_id> | Issue number (42), review-pr-<N>, wave-*, run-chores-*, agy-guards inspect <root> | agy-guards doctor <root> <id>, agy-guards monitor <root> <id>, <state_base>/<project_slug>/logs/<id>/, artifacts/<id>/ |
<conversationId> | audit.log (conversation), store PROD_SENT (identity.conversation), FACTORY_LEDGER.ndjson (conversation), cache/last_conversations.json | <agy_app_dir>/brain/<conversationId>/.system_generated/, <state_base>/hook-callers/<conversationId>, worktrees/<hubConversationId>/ |
call_id + seq | audit.log, server.log, doctor open_calls | Pairs start / args / end records, measures duration_ms, and isolates hung in-flight MCP calls |
Spoke worktree | PostToolUse invoke_subagent notes, PROD_SENT (identity.worktree), worktrees/<hubConversationId>/subagent-* | Uncommitted spoke edits (git status, git diff, git log -n 5) before running agy-guards gc |