Skip to content

feat: global agent definitions at ~/.multiclaude/agents/#374

Open
kiambogo wants to merge 1 commit into
dlorenc:mainfrom
kiambogo:work/clever-fox
Open

feat: global agent definitions at ~/.multiclaude/agents/#374
kiambogo wants to merge 1 commit into
dlorenc:mainfrom
kiambogo:work/clever-fox

Conversation

@kiambogo
Copy link
Copy Markdown

Summary

Implements issue #373 — adds ~/.multiclaude/agents/ as a global base layer for agent definitions.

  • New resolution order: ~/.multiclaude/agents/~/.multiclaude/repos/<repo>/agents/<repo>/.multiclaude/agents/
  • Global definitions are the lowest-priority base; local and repo layers stack on top using the same append-merge semantics already in place
  • ~/.multiclaude/agents/ is created by EnsureDirectories so it exists out of the box

Changes

  • pkg/config: Added GlobalAgentsDir string to Paths (~/.multiclaude/agents/); updated DefaultPaths, NewTestPaths, EnsureDirectories (skips empty paths for compat with hand-constructed Paths in tests)
  • internal/agents: Added SourceGlobal constant, globalAgentsDir field, ReadGlobalDefinitions() method; NewReader signature extended to NewReader(globalAgentsDir, localAgentsDir, repoPath); ReadAllDefinitions now calls MergeDefinitions twice: global+local first, then repo on top
  • All call sites updated: internal/cli/cli.go (2 sites), internal/daemon/daemon.go (1 site), test/agents_test.go (2 sites)
  • New tests: TestReadGlobalDefinitions, TestReadAllDefinitionsThreeLayers, TestEmptyGlobalDir

Test plan

  • go build ./... — clean
  • go test ./internal/agents/... ./pkg/config/... — all pass
  • go test ./test/... — all pass
  • Pre-existing failures in internal/cli and internal/fork verified to exist on main before this change

Notes for continuation

The EnsureDirectories empty-path guard is a minimal backward-compat shim for tests that construct Paths manually without all fields. It could be removed if all test construction switches to NewTestPaths.

🤖 Generated with Claude Code

…#373)

Add a global base layer to agent resolution order:
~/.multiclaude/agents/ → ~/.multiclaude/repos/<repo>/agents/ → <repo>/.multiclaude/agents/

- Add GlobalAgentsDir field to config.Paths (DefaultPaths, NewTestPaths, EnsureDirectories)
- Add SourceGlobal constant and globalAgentsDir field to agents.Reader
- Change NewReader signature: NewReader(globalAgentsDir, localAgentsDir, repoPath)
- Add ReadGlobalDefinitions method; ReadAllDefinitions now layers global→local→repo
- EnsureDirectories skips empty paths for backwards compat with hand-constructed Paths
- Update all NewReader call sites (cli.go, daemon.go, test/agents_test.go)
- Add TestReadGlobalDefinitions, TestReadAllDefinitionsThreeLayers, TestEmptyGlobalDir tests

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant