A named profile (`--profile`, `OMP_PROFILE`, or the legacy `PI_PROFILE`) owns
`~/.omp/profiles/<name>/agent` and ignores `PI_CODING_AGENT_DIR`, as OMP does;
`install-hooks` wrote the extension into `PI_CODING_AGENT_DIR` instead. Profile
names are normalized and refused like OMP does, `PI_CONFIG_DIR` renames the
`~/.omp` root, and on Linux and macOS sessions move to `$XDG_DATA_HOME/omp`
when that directory exists. `install-mcp`, auto-wire, session import,
`backfill`, `doctor` and the `uninstall` sweep follow the same agent dir.
Refs #820
Add first-party lifecycle capture for the AWS Kiro CLI (#355). The
binary ships two agent engines with incompatible hook surfaces, so each
is selected explicitly and never guessed:
- `install-hooks --agent kiro-cli` merges five flat camelCase entries
(agentSpawn, userPromptSubmit, preToolUse, postToolUse, stop) into
every existing v2 agent config under ~/.kiro/agents/. Entries carry no
matcher key (absent = every tool; empty string matches nothing) and no
type key (the v2 Hook schema has neither), and agentSpawn raises
max_output_size to 64 KiB so an injected handoff + brief is not
truncated. The v2 engine has no global hook surface and the built-in
default agent has no file on disk, so the installer updates existing
configs and bails with guidance when none exist instead of inventing
an agent that would never be active.
- `install-hooks --agent kiro-cli-v3` writes the standalone versioned
hooks file ~/.kiro/hooks/ai-memory.json (PascalCase triggers, command
actions, timeout in seconds) for the early-access v3 engine, never
touching other files in the hooks directory and preserving
non-ai-memory entries inside ours.
Both surfaces honor $KIRO_HOME (verified against kiro-cli 2.16.0),
share one hooks/kiro-cli script bundle, uninstall cleanly, and keep
capture fail-open: hooks always exit 0 and print nothing on capture
paths, because exit code 2 blocks the tool call and session-start /
user-prompt stdout is added to the agent context on both engines. For
the same reason the native `ai-memory hook` command suppresses its `{}`
protocol line for kiro-cli and prints a fetched session-start handoff
raw (no hookSpecificOutput envelope — Kiro documents none).
Kiro tool payloads (tool_name/tool_input, tool_response.success) join
the capture policy with fixture vectors, including fs_read's batched
operations path extraction; fs_read/fs_write/execute_bash join the tool
family map. The v3 stdin payload shape is not publicly documented and
extraction stays verified on the v2 shape only (documented as such).
Also add `?flavor=bedrock` as an alias of the Moonshot root-schema
flattening: Kiro talks to Amazon Bedrock's Converse API, which rejects
root-level anyOf/oneOf/allOf in tool schemas, so a manually configured
~/.kiro/settings/mcp.json can point at …/mcp?flavor=bedrock (#351).
Contracts verified against kiro-cli 2.16.0 (binary surface probed
locally), kiro.dev's v2/v3 hook references, and the shipping HookTrigger
implementation in aws/amazon-q-developer-cli.
Closes#355.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJvj7D7czyZzqk4pDXgLxY
The old wording implied the claude-code path in THIS script also installs
the subagent hooks; the default SCRIPTS array omits them for every agent.
Point at the on-disk bundle (hooks/claude-code/, which ships
subagent-start/stop) as the thing kimi-code mirrors, per PR review.
Antigravity CLI is the successor to Gemini CLI, built in Go with
parallel subagent support. This adds full MCP + lifecycle hook
integration with the correct config format differences:
- MCP config lives in a separate mcp_config.json (not settings.json)
- Uses serverUrl (not httpUrl) for streamable-HTTP endpoints
- Hooks config uses named-groups format with Antigravity-native
events (PreToolUse, PostToolUse, PreInvocation, Stop)
- Mixed shape: nested for tool events, flat for lifecycle events
Closes the gap "do I still need the binary on the host?" The answer
is now: no — docker is sufficient for every task except the one
edge case (hook scripts must live on the host fs so the agent CLI
can exec them), and that case has two solid solutions:
1. `docker cp ai-memory:/usr/local/share/ai-memory/hooks ~/.ai-memory/`
— works on every docker config (rootless, userns-remap, vanilla)
because the daemon mediates the copy.
2. `scripts/install-hooks.sh` from GitHub raw — pure curl, no
docker needed at all. For machines that connect TO an
ai-memory server but don't run one.
## Code changes
- Dockerfile: COPY hooks /usr/local/share/ai-memory/hooks so the
bundled scripts ship in the image (was previously absent; users
had to clone the repo).
- New `setup-agent` subcommand: one-shot bind-mount workflow that
extracts the bundle + renders the JSON in one invocation. Tested
to work on hosts where container UID matches host UID (e.g. the
homelab); has known caveats on rootless docker (documented in
docs/install.md → "Bind mounts vs docker cp").
- install_hooks.rs: extracted `build_claude_code_payload()` as a
pure function so setup-agent can reuse it. Per-script
existence-check downgraded from hard bail to stderr warning —
install-hooks running inside docker against a host path can
legitimately produce JSON without the scripts being on the
container's own filesystem.
- New `scripts/install-hooks.sh`: curl-based hook installer that
pulls each agent's seven .sh files directly from GitHub raw.
Flags: --agent claude-code|codex|opencode, --to <dir>, --ref
<git-ref>. For the no-docker case.
## Docs
- README rewritten end-to-end to a tight "happy path" — Quick start
is one terminal session: generate token → docker run → claude mcp
add + docker cp + install-hooks. Everything else moves to
docs/install.md.
- New docs/install.md: installation cookbook covering all alternative
agent CLIs (Codex, OpenCode, Cursor, Claude Desktop, Gemini CLI,
OpenClaw, pi), the curl installer, building from source, LLM
provider tiers + self-hosted Ollama, full subcommand reference,
and the "operating without auth" loopback-only mode.
- Removed the heavyweight "Configure your agent CLI" tables + the
inline CLI reference from README — both now live in install.md
where they belong.
## Deployed
Pushed akitaonrails/ai-memory:latest (digest sha256:828b47be…).
Homelab pulled + restarted, container running healthy with the
bundled hooks visible at /usr/local/share/ai-memory/hooks/{
claude-code,codex,opencode}.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>