type TriggerPattern = { pattern: string; mode: 'glob' | 'regex' | 'exact'; }; /** Where an agent definition came from: the project's `.claude/agents`, the * user's `~/.claude/agents`, or an extra root (MONOMIND_EXTRA_AGENT_PATHS / * a sibling agency-agents dir). */ export type AgentOrigin = 'project' | 'user' | 'extra'; type AgentRegistryEntry = { slug: string; name: string; version: string; category: string; description: string; /** One-line `when_to_use:` frontmatter — the picker's lead description. */ whenToUse?: string; tags: string[]; /** Optional `vibe:` frontmatter (personality line); stored, never ranked. */ vibe?: string; capabilities: string[]; taskTypes: string[]; tools: string[]; triggers: TriggerPattern[]; deprecated: boolean; deprecatedBy?: string; dependencies: string[]; origin: AgentOrigin; /** Relative to the project, or `~/.claude/agents/...` for a user agent. */ filePath: string; registeredAt: string; lastUpdated: string; }; /** A slug defined more than once: the first file kept, the others dropped. */ export type DuplicateSlug = { slug: string; kept: string; dropped: string[]; }; /** A user agent left out because a project or extra agent has its slug or name. */ export type ShadowedAgent = { slug: string; name: string; filePath: string; }; export type AgentRegistry = { version: string; generatedAt: string; totalAgents: number; /** Indexed agents per origin. */ counts: Record; agents: AgentRegistryEntry[]; /** Duplicate slugs found while building (first root / first file wins). */ duplicates: DuplicateSlug[]; shadowed: ShadowedAgent[]; }; /** One agent-definition directory. `label` replaces the directory in * recorded filePaths (`~/.claude/agents`). */ export type AgentRoot = { dir: string; origin: AgentOrigin; label?: string; }; export type AgentRootOptions = { home?: string; user?: boolean; env?: NodeJS.ProcessEnv; }; interface AgentRegistryModule { USER_LABEL: string; computeAgentRoots(cwd: string, opts?: AgentRootOptions): AgentRoot[]; buildUnifiedRegistry(roots: (string | AgentRoot)[], outputPath?: string, opts?: { base?: string; }): AgentRegistry; writeRegistryFile(file: string, registry: AgentRegistry): boolean; newestAgentMtime(dirs: (string | AgentRoot)[]): number; registryPath(root: string): string; isStale(root: string, opts?: AgentRootOptions): boolean; ensure(root: string, opts?: AgentRootOptions): AgentRegistry | null; findProjectRoot(cwd: string, home?: string): string | null; } /** The shared CommonJS implementation; throws on an install without it. */ export declare function agentRegistryModule(): AgentRegistryModule; /** `~/.claude/agents` — how user agents' filePaths are recorded. */ export declare const USER_AGENTS_LABEL = "~/.claude/agents"; /** * Build the agent registry by scanning `.md` files under `agentsRoot`. * * @param agentsRoot - Root directory to scan. * @param outputPath - Optional path to write the registry JSON file. * @returns The built AgentRegistry object. */ export declare function buildRegistry(agentsRoot: string, outputPath?: string): AgentRegistry; /** * The ordered agent-definition roots for `cwd`: extras (canonical, from * MONOMIND_EXTRA_AGENT_PATHS or a sibling `agency-agents` dir), the project's * `.claude/agents`, then the user's `~/.claude/agents` (`opts.user: false` * leaves it out, `opts.home` overrides the home directory). Shared by CLI * startup, pick and `monomind doctor` so all build the registry the same way. */ export declare function computeAgentRoots(cwd: string, opts?: AgentRootOptions): AgentRoot[]; /** * Build a unified agent registry from multiple roots, deduplicating by slug: * the first root in the array wins (a plain path counts as a project root). * A `user` agent also loses to an earlier agent with the same frontmatter * `name` — Claude Code gives project agents precedence over user agents. * * @param roots - Ordered list of roots to scan (first-wins on slug conflict). * @param outputPath - Optional path to write the merged registry JSON file. * @returns The deduplicated AgentRegistry. */ export declare function buildUnifiedRegistry(roots: (string | AgentRoot)[], outputPath?: string, opts?: { base?: string; }): AgentRegistry; /** * Atomically writes `registry` to `file` — except an empty registry never * replaces a non-empty one (a build from a directory without agent files must * not wipe the project's catalog). Returns whether the file was written. */ export declare function writeRegistryFile(file: string, registry: AgentRegistry): boolean; export {}; //# sourceMappingURL=registry-builder.d.ts.map