Skip to main content

Module surface

Module surface 

Source
Expand description

Per-agent reinjection surface installation.

install-hooks --claude|--codex|--pi installs truth-mirror reinject --agent <agent> into each selected agent’s repo-local configuration surface. Installs are non-clobbering (existing config is merged, not overwritten), idempotent, and reversible: uninstall removes only truth-mirror’s own entries.

Structs§

SurfacePlan

Constants§

ENFORCE_COMMAND
The enforcement subcommand marker. Matched only when the command’s program token is also truth-mirror (see is_own_enforcement_command), so preserved --config/--state-dir variants match but foreign hooks never do.
FILE_SURFACE_AGENTS
Agents whose reinjection surface is a JSON hook file this module manages.
PI_EXTENSION_RELATIVE
Repo-relative path of the project-local Pi extension file.
PI_EXTENSION_SOURCE
The project-local Pi extension. Default-exports a factory (pi) => {} that registers a context handler (fires before every LLM call) and appends the output of truth-mirror reinject --agent pi as a user message, with a dedup guard so findings inject once per change, not once per tool round-trip.

Functions§

agent_slug
install_enforcement
Install a PreToolUse enforcement hook into a nested (Claude/Codex) surface. The hook exits non-zero to block a mutating tool while the ledger has unresolved rejections beyond the configured threshold. global_args preserves the install-time --config/--state-dir so the hook uses the same config.
install_pi_extension
Write the project-local Pi reinjection extension into <repo>/.pi/extensions/.
pi_extension_path
Absolute path of the project-local Pi extension file.
reinject_command
The exact command truth-mirror installs into each surface.
surface_contains
Whether the surface JSON already carries the reinject command for an agent.
surface_relative_path
Repo-relative path of a file-surface agent’s reinjection hook file. Only meaningful for FILE_SURFACE_AGENTS.
uninstall_enforcement
Remove the PreToolUse enforcement hook from a nested surface.
uninstall_pi_extension
Remove the project-local Pi reinjection extension.