fix(trust): start no agent CLI in a repository you haven't trusted

Merged
KI
18d ago
+1169-47

Problem

vigent runs each agent CLI headless in a worktree of the repository, and headless CLIs skip their own "trust this folder?" prompt. So a repository's own agent config ran as soon as an agent started, with no :trust:

  • Claude Code: a committed .claude/settings.json SessionStart hook ran on agent start (confirmed). The same file can set env, permissions.allow and MCP servers.
  • pi: a committed .pi/extensions/*.ts ran on agent start, and also on pi --list-models, which vigent runs from the repository root for :model, its Tab completion and :race --models (confirmed).
  • OpenCode and Gemini: probably load project config the same way.

Change

  • vigent starts no agent CLI in a repository you haven't trusted, and runs no command that loads its project config there. That covers :new, the start screen, :race, templates, forks, and restoring agents after a restart.
  • A clear message names the agent configs the repository carries (.claude/, .pi/, …) and points to :trust.
  • :trust and vigent trust now also trust the repository itself. Model lists run from outside the repository, so :model keeps working.

Details follow as the commits land.

Status

Draft. In progress; the full checks run before this leaves draft.

Verification

To be filled in: tests in both languages, plus a pty test on both builds in which a repository's .claude/settings.json and a fake CLI prove nothing runs before :trust.

Follow-ups

The untrusted-actions fix (:new/:race/:merge/:pr from untrusted mappings, and model/effort flag validation) follows in its own PR.


Generated by Claude Code


Summary by cubic

Stops agent CLIs from running in a repository you haven't trusted. vigent launches each agent CLI headless in a worktree, and headless CLIs skip their own trust prompt, so a committed .claude/settings.json SessionStart hook or .pi/extensions ran on agent start with no :trust.

  • :trust and vigent trust now also trust the repository itself (keyed by its path in the same store), even one with no .vigent.toml; outside a git repository, the folder vigent was started in counts, and your home and config folders are always trusted.
  • Until it's trusted, starting an agent (:new, :race, forks, templates, engine switching) starts nothing and names the agent configs the repository carries; :race says so before it reads its arguments. Agents reopened or reattached after a restart are shown but held, and their queued prompts go once trusted.
  • The engines' own commands (sign-in checks, model lists) run from a neutral folder until then, so :model still works; demo mode is unchanged.
  • vigent trust --list shows what's trusted, and --revoke [folder] forgets a repository's trust along with its .vigent.toml's.