Skip to content

feat: first-run UX with built-in agent profiles#10

Merged
tito merged 9 commits intomainfrom
mathieu/default-profile
Mar 12, 2026
Merged

feat: first-run UX with built-in agent profiles#10
tito merged 9 commits intomainfrom
mathieu/default-profile

Conversation

@tito
Copy link
Contributor

@tito tito commented Mar 12, 2026

Summary

image
  • Built-in profiles for 14 AI agents and 9 toolchains under internal/profiles/agents/ and internal/profiles/toolchains/, each self-contained (add an agent = add one file)
  • Interactive first-run prompt showing allow/deny paths, with [Y] use, [e] edit in $EDITOR, [s] skip, [n] don't ask again
  • --profile accepts comma-separated names to combine profiles (e.g. --profile claude,python)
  • ANSI colors in terminal, respects NO_COLOR
  • Preferences file at ~/.config/greywall/preferences.json for "don't ask again"
  • AdHocCommands trimmed to basic unix utilities; toolchain commands (npm, uv, cargo, etc.) get their own profiles
  • --auto-profile flag: silently applies the built-in profile without prompting (useful for CI/scripts). In non-interactive mode, hints about --auto-profile when a profile is available.
  • rename templates to profiles, and same in other places

Closes #9

Test plan

  • greywall -- claude with no config prompts, Y saves profile, agent starts
  • Second run auto-loads saved profile, no prompt
  • greywall -- curl https://example.com no prompt (ad-hoc command)
  • echo | greywall -- claude no prompt (not a terminal)
  • n suppresses future prompts
  • e opens $EDITOR, validates on save, re-edit loop on errors
  • --profile claude,python merges both profiles
  • greywall profiles list shows saved + available built-in profiles
  • make test passes

tito added 4 commits March 12, 2026 16:10
When a known agent (claude, opencode, etc.) is run without a template,
prompt the user to apply recommended filesystem defaults. Each agent is
a self-contained file under internal/profiles/agents/ that
self-registers via init(), so adding a new agent requires zero changes
elsewhere.
…lities

Move toolchain commands (npm, uv, cargo, docker, etc.) out of the
ad-hoc command set into their own profiles under internal/profiles/toolchains/.
Each toolchain is a self-contained file with filesystem paths from
the agent-safehouse analysis. Toolchain profiles are not merged with
BaseProfile() since they only need their own config/cache directories.
First-run prompt redesign:
- Explain that the command is being sandboxed and a profile is available
- Show full allow/deny paths with ~/  prefixes for clarity
- Add [e] Edit first option with $EDITOR and re-validate loop
- Use [s] Skip / [n] Don't ask again instead of [n] / [never]
- Add (recommended) and (restrictive) hints on options
- ANSI colors when output is a terminal, respects NO_COLOR

Template composability:
- --template now accepts comma-separated names (e.g. --template claude,python)
- Each name resolves: saved template on disk > built-in profile
- templates list shows combo usage example

README: add Agent profiles section with first-run and --template examples.
Update paths to show ~/ prefix and use current option keys
([s] Skip, [n] Don't ask again, (recommended) hint).
@tito tito self-assigned this Mar 12, 2026
tito added 2 commits March 12, 2026 16:54
When set, silently applies the built-in profile (or saved template) for
known agents without prompting. Useful for CI/scripts where there is no
terminal. In non-interactive mode, a hint about --auto-profile is now
shown when a built-in profile is available but not applied.
…files

Unify terminology: everything is now "profiles" in the CLI and user-facing
messages. The old --template flag and "templates" subcommand are kept as
hidden aliases for backwards compatibility.
Comment on lines +13 to +32
Filesystem: config.FilesystemConfig{
AllowRead: []string{
"~/.claude",
"~/.claude.json",
"~/.claude.json.*",
"~/.config/claude",
"~/.local/share/claude",
"~/.local/state/claude",
"~/.mcp.json",
},
AllowWrite: []string{
"~/.claude",
"~/.claude.json",
"~/.claude.lock",
"~/.cache/claude",
"~/.config/claude",
"~/.local/state/claude",
"~/.local/share/claude",
"~/.mcp.json",
},

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found that Claude makes frequent use of the temp directory, which on osx is /private/tmp/, without it many of the tool calls would fail. Worth adding maybe?
Sidenote: Should default templates be os-specific?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, claude is not the /tmp, but /tmp/claude-xxx no ?
I feel showing the whole /tmp could be dangerous as many application leave some socket in it

I will do another pass for the os-specific - maybe i got them lost during internal refactoring.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elo-siema actually, i wonder if greywall could redirect the TMPDIR env to be local and deleted when done, that would prevent giving wide access. What do you think?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, TMPDIR redirection sounds the cleanest, agreed

Copy link

@elo-siema elo-siema Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/tmp/claude-xxx

yes, but that xxx was unpredictable. Agreed on fishyness of sharing whole tmp

tito added 3 commits March 12, 2026 17:11
Profiles previously only included XDG/Linux paths. On macOS, agents and
toolchains store config, cache, and state under ~/Library/ and /Library/
which were missing entirely.

Add runtime.GOOS == "darwin" checks to conditionally include:
- Base: keychain paths, user preferences
- Agents: Claude Desktop config, Codex plists, Cursor/Cline/Kilo VS Code
  globalStorage, Goose/Gemini Library paths, Pi metadata
- Toolchains: Playwright/Cypress caches (node), JVM paths (java),
  system Ruby, OrbStack/Colima/Rancher Desktop (containers)
@tito tito merged commit 23990b3 into main Mar 12, 2026
4 checks passed
@tito tito deleted the mathieu/default-profile branch March 12, 2026 23:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

greywall -- claude doesn't do anything for me.

2 participants