Problem Statement
The Agent Directory Service supports annotation-based search (e.g., `owner.id: alice@example.com`), but there is no way to ask: "give me all agents owned by anyone in Alice's org subtree."
Today a user must:
- Manually query their HR/directory system to enumerate every IC under a given manager
- Issue one search per owner alias, or construct the full owner list themselves
This is impractical at scale — a manager may have hundreds of direct and indirect reports — and it puts the burden of org resolution on the caller.
Proposed Solution
Introduce a pluggable OrgResolver interface in the ADS server that can expand a manager alias into a full list of aliases in their reporting chain. This enables a single query:
```
dirctl search --manager alice@example.com
```
Which internally:
- Calls the configured OrgResolver with `alice@example.com`
- Receives the full subtree: `[alice, bob, carol, dave, ...]`
- Fans out to annotation search: `owner.id IN [alice, bob, carol, dave, ...]`
- Returns all matching agent records
OrgResolver interface (sketch):
```go
type OrgResolver interface {
// Expand returns the manager and all direct/indirect reports under them.
Expand(ctx context.Context, managerAlias string) ([]string, error)
}
```
Resolver implementations (pluggable, configured in server config):
static — file-based mapping (YAML/JSON), useful for testing and air-gapped environments
http — generic REST adapter with configurable endpoint and response mapping, covers Workday, BambooHR, and other HR APIs without hard-coding vendor logic
The resolver is optional — when unconfigured, --manager returns an error and all other search behavior is unaffected.
Annotation convention (recommended, not enforced):
```
annotations:
owner.id: "alice@example.com"
owner.type: "user"
```
Alternatives Considered
Client-side resolution: The CLI could call the HR system directly and pass the expanded owner list to annotation search. Simpler to implement, but leaks org structure to every client, requires every CLI user to have credentials for the HR system, and duplicates resolver logic across clients.
Per-vendor integrations (Workday, BambooHR, LDAP): Tight integrations with specific HR APIs would provide richer data but introduce vendor coupling and maintenance burden. A generic HTTP adapter with configurable field mapping covers the same cases without lock-in.
New first-class schema field: Adding a dedicated owner schema block (Phase 2 of #1445) would be more structured, but adds schema complexity and migration burden. The annotation-based approach delivers immediate value with zero schema changes.
Additional Context
Problem Statement
The Agent Directory Service supports annotation-based search (e.g., `owner.id: alice@example.com`), but there is no way to ask: "give me all agents owned by anyone in Alice's org subtree."
Today a user must:
This is impractical at scale — a manager may have hundreds of direct and indirect reports — and it puts the burden of org resolution on the caller.
Proposed Solution
Introduce a pluggable OrgResolver interface in the ADS server that can expand a manager alias into a full list of aliases in their reporting chain. This enables a single query:
```
dirctl search --manager alice@example.com
```
Which internally:
OrgResolver interface (sketch):
```go
type OrgResolver interface {
// Expand returns the manager and all direct/indirect reports under them.
Expand(ctx context.Context, managerAlias string) ([]string, error)
}
```
Resolver implementations (pluggable, configured in server config):
static— file-based mapping (YAML/JSON), useful for testing and air-gapped environmentshttp— generic REST adapter with configurable endpoint and response mapping, covers Workday, BambooHR, and other HR APIs without hard-coding vendor logicThe resolver is optional — when unconfigured,
--managerreturns an error and all other search behavior is unaffected.Annotation convention (recommended, not enforced):
```
annotations:
owner.id: "alice@example.com"
owner.type: "user"
```
Alternatives Considered
Client-side resolution: The CLI could call the HR system directly and pass the expanded owner list to annotation search. Simpler to implement, but leaks org structure to every client, requires every CLI user to have credentials for the HR system, and duplicates resolver logic across clients.
Per-vendor integrations (Workday, BambooHR, LDAP): Tight integrations with specific HR APIs would provide richer data but introduce vendor coupling and maintenance burden. A generic HTTP adapter with configurable field mapping covers the same cases without lock-in.
New first-class schema field: Adding a dedicated
ownerschema block (Phase 2 of #1445) would be more structured, but adds schema complexity and migration burden. The annotation-based approach delivers immediate value with zero schema changes.Additional Context
staticandhttpresolver implementations; LDAP/IdP resolvers can follow in later PRs