Skip to main content

Module init

Module init 

Source

Structs§

WorkspaceInit
What init --workspace bound.

Enums§

ClaudeSettingsTarget
Which Claude Code settings file to install hooks into.

Constants§

AMP_PLUGIN_INDEX
Visdom Amp plugin source, embedded from the checked-in assets and written verbatim by install_amp_plugin.
POST_COMMIT_MARKER
Marks the block init writes into .git/hooks/post-commit.
PRE_PUSH_MARKER
Marks the block init writes into .git/hooks/pre-push.

Functions§

amp_headless_notice
What init --agent amp prints after installing the plugin: headless runs need a flag, or Amp may start the turn before the plugin is ready and skip its agent.start / agent.end hooks; and the injected policies are stored in the thread, where whoever can read the thread sees them.
cleanup_stale_gsd_registration
Best-effort cleanup of the extension registration left behind by an OLDER version of this installer: the tracevault-tracker directory (an earlier, incorrect Codex-clone hooks.json shim that impersonated this extension under the wrong name) and any registry entries for tracevault-tracker or tracevault — both are inert now that gsd install manages registration.
codex_hook_trust_notice
Codex CLI hook set, mirroring tracevault_hooks() but with Codex commands. What to tell the user after Codex hooks are installed.
codex_hooks
Capture hooks carry --agent codex; the injection hooks (session-start / user-prompt) are agent-agnostic. Matchers are "" (all tools).
has_marker
Whether content holds the block marker starts, under either spelling of the marker.
has_tracevault_hooks
Whether the hook file at path (Claude Code settings or Codex hooks.json) holds any Visdom hook. A missing file holds none; one that cannot be read or parsed is an error (it may hold some).
init_in_directory
Set up Visdom in project_root. An existing .visdom/tracing.toml is kept and only overridden where this run says so: server_url and user_context (None = no flag given) replace the stored values; every other field, and any field not overridden, survives (VIS-1046).
init_workspace
tracevault init --workspace --project <name> (VIS-1256): bind every session started under dir to one project, with no per-session step.
install_amp_plugin
Install the Visdom Amp plugin as tracevault/index.ts in an Amp plugins directory: <project_root>/.amp/plugins/ for a repo, or with None the user-level one Amp loads for every session, $XDG_CONFIG_HOME/amp/plugins/ or ~/.config/amp/plugins/. Amp uses that XDG path on every platform, so this does not use dirs::config_dir (which is ~/Library/Application Support on macOS). Returns the path written. Fails loudly, like the other agents’ installers: a swallowed error would report success with no plugin in place.
install_codex_hooks
Deep-merge the Codex hook set into <project_root>/.codex/hooks.json, creating it if absent (idempotent, never clobbers existing hooks/keys, atomic write). Repo-local counterpart of install_global_codex_hooks.
install_global_codex_hooks
Install Visdom’s Codex hooks into <codex_dir>/hooks.json and append a workspace-mode instruction block to <codex_dir>/AGENTS.md (idempotent, atomic), mirroring the Claude global install’s settings.json + CLAUDE.md. Intended for tracevault init --global --agent codex. Codex reads AGENTS.md for agent instructions, so the workspace-mode block reaches detached Codex sessions the same way the CLAUDE.md block reaches Claude ones.
install_global_hooks
Install Visdom’s Claude Code hooks into claude_dir/settings.json (deep-merged, never clobbering existing hooks/keys) and append a workspace-mode instruction block to claude_dir/CLAUDE.md (idempotent, guarded by a marker comment). Intended for tracevault init --global, installing once for all Claude Code sessions rather than per-repo.
install_gsd_extension
Install the Visdom pi/GSD extension and register it with GSD so it actually loads.
install_opencode_plugin
Install the Visdom OpenCode plugin. project_root = Some(dir) installs project-local at <dir>/.opencode/plugins/tracevault.ts; None installs global at ~/.config/opencode/plugins/tracevault.ts (using the same config-dir resolution as gsd_extension_source_dir above). OpenCode auto-loads *.ts modules from that directory — no separate “install” command. Returns an error on failure (unresolvable config dir, or a write error) so the caller aborts init loudly, consistent with the Codex/GSD arms — a swallowed failure would make init report success while no plugin was written, silently disabling capture.
marker_for_visdom
marker (one of the marker constants, which are the tracevault spellings) as visdom writes it: # visdom:enforce.
migrate_cwd_config
init --global’s step of the default_project migration (VIS-1256: it runs in init in any mode). A global install has no project config of its own, so it migrates the config the hooks would read from the current directory (resolve_project_root), if that config still carries a legacy default_project. Runs before anything is installed: an unknown or ambiguous name is an error; no login or an unreachable server is a warning (the legacy key stays for a later sync).
not_logged_in_message
The error init fails with when no credential resolves: what went wrong, that nothing was installed, and the exact commands that fix it. url is the server URL already known (--server-url, TRACEVAULT_SERVER_URL or the project config), filled into the login command when present.
plugin_source
A plugin’s source running the command of the binary chosen by visdom.
tracevault_hooks
validate_init_flags
Validate init flag combinations against the selected agent. --claude-settings selects between .claude/settings.json and settings.local.json, so it only applies to the Claude Code agent — --agent codex always writes .codex/hooks.json. Returns a human-readable error for an incompatible combo so the CLI rejects it instead of silently ignoring the flag.
write_global_user_config_in
Write the user-level config.toml (under config_root) carrying the user-context setting. An EXISTING user config is preserved (this mirrors the “don’t clobber” contract of the global-hooks install): requested overrides the user_context when a flag was given; otherwise an existing value is kept, and only a first-time setup (no existing config) defaults to enabled. When the resulting layer is enabled, the referenced context file is seeded (empty) if absent — a custom --user-context <path> seeds THAT file, a disabled layer seeds nothing. Returns the active context file path (the file the hook will read), or None when the layer is disabled. Used by init --global.