Repository navigation
Description
Summary
infer init currently writes the full config set into a project's ./.infer/, so every repo duplicates config that is
really the same across all of a user's projects (keybindings, prompts, gateway/model defaults, ...).
Flip to a userspace-first model:
infer initseeds the global baseline in~/.infer/by default.- A project's
./.infer/carries only the settings it overrides — forconfig.yamlthat is a sparse file merged on top
of the home one, key by key. - Files that are inherently personal, machine-, or secret-scoped live only in
~/.infer/and are never seeded into a
project.
Net effect: set up once in ~/.infer/, reuse everywhere; a project commits only its genuine overrides.
Behavior change
| Today | Proposed | |
|---|---|---|
infer init target |
project ./.infer/ (full set) |
home ~/.infer/ (full baseline) |
| Project scope | (the default) | infer init --project (overrides only) |
--userspace flag |
opt in to home | removed (home is the default) |
config.yaml resolution |
project file replaces home | project file merges onto home (per key) |
config set default target |
project (full file) | home; --project writes a sparse override |
Per-file classification
Each config file gets a scope label. infer init seeds userspace-only files to ~/.infer/ regardless of --project.
| File | Scope | Rationale |
|---|---|---|
config.yaml |
project-overridable | gateway / model / tools / storage; sparse overlay on home |
prompts.yaml |
project-overridable | a project may ship custom agent instructions / tool docs |
agents.yaml |
project-overridable | A2A integrations the project depends on |
mcp.yaml |
project-overridable | MCP servers the project depends on |
hooks.yaml |
project-overridable | project build / test / lint hooks |
shortcuts/ |
project-overridable | project chat commands (committed) |
skills/ |
project-overridable | project skills (committed) |
keybindings.yaml |
userspace-only | personal keyboard preferences |
computer_use.yaml |
userspace-only | machine / display settings |
heartbeat.yaml |
userspace-only | personal wake-up schedule |
reminders.yaml |
userspace-only | personal workflow nudges |
channels.yaml |
userspace-only | holds bot tokens / secrets |
memory (memory.yaml + store) |
userspace-only | already global today |
Approach
infer initscope (cmd/init.go) — drop--userspace, add--project. Default seeds the full baseline to~/.infer/;
--projectseeds only the project-overridable files (a minimal/empty override scaffold) into./.infer/. Userspace-only
files always go to~/.infer/(asmemoryalready does). The one-time legacy migration forchannels/computer_use
(aconfig.yamlblock → its own file) should target~/.infer/.- Sparse merge (
cmd/root.goinitConfig) — load~/.infer/config.yamlas the base, thenMergeInConfigthe project
./.infer/config.yamlon top (precedence: defaults < home < project < flags < env). This makes the
mergeGlobalSandboxDirs/MergeSandboxDirectoriesworkaround (cmd/config.go) obsolete — remove it. Re-check the
logDirfallback, which keys offV.ConfigFileUsed(). - Write target (
cmd/config_getset.go,GetUserspaceFlagincmd/config.go) — flip the default soconfig setwrites to
home;--projectwrites a sparse project override (reuse the existing fresh-viper sparse-write logic, pointed at the project
path). Remove--userspacefromconfig,keybindings,mcp,agents. - Callers —
internal/web/pty_manager.goandinternal/web/remote_installer.gocallinfer init --userspace; switch to
plaininfer init. - Docs — rewrite
docs/directory-structure.md("The Two Layers", seeded-files list, commit guidance) and update
README.md(Configuration Layers + the--userspaceexamples),docs/commands-reference.md,docs/configuration-reference.md.
Add the classification table. - Tests — update
cmd/init_test.go(default-home +--project; assert userspace-only files never land in the project) and
cmd/channels_overlay_test.go; add aconfig.yamlhome+project merge test and aconfig set --projectsparse-write test.
Acceptance criteria
-
infer initdefaults to~/.infer/;infer init --projectwrites a project override layer;--userspaceis gone. - Userspace-only files (keybindings, computer_use, heartbeat, reminders, channels, memory) are only ever seeded to
~/.infer/. - A project
config.yamlmerges onto the home one key-by-key (sparse overrides work);config set --projectwrites only the
changed key. - Every config file has a documented scope label (table above).
-
--userspaceremoved from all commands (init, config, keybindings, mcp, agents) and from the web auto-init callers. - Docs and tests updated.
Out of scope
- Per-key merge for the split-out files — they override at file granularity (omit the file to inherit home). Only
config.yamlmerges per key. - Backward compatibility for
--userspace— the flag is simply removed.
Metadata
Metadata
Assignees
Type
Projects
- StatusShow more project fieldsDone
Activity
[-][TASK] Move userspace configs to home directory[/-][+][TASK] Move project-space configs to home directory[/+][-][TASK] Move project-space configs to home directory[/-][+][TASK] Make config userspace-first: infer init defaults to home, projects hold only overrides[/+]edenreich commentedon Jun 28, 2026
@infer /model ollama_cloud/glm-5.2 Can you work on this? use skills from .agents/skills directory to ensure you follow best practices. use /go /cobra-viper
inference-gateway-maintainer commentedon Jun 28, 2026
View Job
Todos
Pull Request
#682
The agent hit the job's time limit before finishing, so it was stopped to salvage its work. Its committed changes were pushed; the draft pull request is linked above.
Let me read all the key files mentioned in the issue to understand the full scope.
Model:
ollama_cloud/glm-5.2· Exit Code:0· Duration: -Tokens: 8,050,826 in · 71,299 out · 8,122,125 total (107 requests)
Tool calls: 237 total · 98% success rate
Possible matches found:
Near line 15:
var initCmd = &cobra.Command{
Use: "init",
Short: "Initialize a new project with Inference Gateway CLI",
Long: `Initialize a new project directory with Inference Gateway CLI configuration.
This creates the .infer directory with configuration file and additional setup files like .gitignore.
To generate an AGENTS.md file, use the /init shortcut in interactive chat mode,
which allows you to see the agent's analysis in real-time.
This is the recommended command to start working with Inference Gateway CLI in a new project.`,
RunE: func(cmd *cobra.Command, args []string) error {
return initializeProject(cmd)
},
}
func init() {
initCmd.Flags().Bool("overwrite", false, "Overwrite existing files if they already exist")
initCmd.Flags().Bool("userspace", false, "Initialize configuration in user home directory (~/.infer/)")
initCmd.Flags().Bool("skip-migrations", false, "Skip running database migrations")
rootCmd.AddCommand(initCmd)
}
func initializeProject(cmd *cobra.Command) error { //nolint:funlen,gocyclo,cyclop
overwrite, _ := cmd.Flags().GetBool("overwrite")
userspace, _ := cmd.Flags().GetBool("userspace")
skipMigrations, _ := cmd.Flags().GetBool("skip-migrations")
Hint: Ensure exact whitespace and indentation match. Use the Read tool to see the current file content.
Possible matches found:
Near line 15:
var initCmd = &cobra.Command{
Use: "init",
Short: "Initialize Inference Gateway CLI configuration",
Long: `Initialize Inference Gateway CLI configuration in the user home directory (~/.infer/).
By default, this seeds the full baseline configuration to ~/.infer/ so it is shared
across all of your projects. Pass --project to create a project-level override layer
in ./.infer/ instead — only project-overridable files are seeded there as a sparse
scaffold; personal, machine-, or secret-scoped files always live in ~/.infer/.
To generate an AGENTS.md file, use the /init shortcut in interactive chat mode,
which allows you to see the agent's analysis in real-time.
This is the recommended command to start working with Inference Gateway CLI.`,
RunE: func(cmd *cobra.Command, args []string) error {
return initializeProject(cmd)
},
}
func init() {
initCmd.Flags().Bool("overwrite", false, "Overwrite existing files if they already exist")
Hint: Ensure exact whitespace and indentation match. Use the Read tool to see the current file content.
Triggered by edenreich · Infer Action
chore(release): 0.126.0 [skip ci]
inference-gateway-releaser commentedon Jun 30, 2026
🎉 This issue has been resolved in version 0.126.0 🎉
The release is available on:
Your semantic-release bot 📦🚀