Agent profiles (AGENTS.md): per-org library, free builtins, versioning, marketplace, persona

Reusable agent definitions authored as AGENTS.md (YAML frontmatter + a Markdown body that becomes
the agent's operating guide). Mirrors the skill library, including its review hardening.

- AgentProfile entity (OrgBoard): org-scoped + versioned by (OrganizationId, ProfileKey, Version),
  NULLS NOT DISTINCT unique index; Origin Builtin|Authored|Installed; ProfileVisibility +
  ProfileStatus with the Public⟹Published invariant enforced in Apply()/SetVisibility(). AGENTS.md
  parser (YamlDotNet). AgentProfileWriter is the single upsert path (insert-only mode for install).
- Free builtins: AgentProfileSeeder seeds Aria (PO), Quill (QA), Edison (backend) on startup via a
  new IStartupSeeder + SeederRunner (runs after migrations). Idempotent, null-org, visible to all.
- Endpoints (/api/orgboard/agent-profiles): upload, list (resolvable-winner order), get versions,
  publish/unpublish, fork, marketplace (per-(key,version) AlreadyInLibrary), install (insert-only →
  clean 409, no clobber). ConfigureAgents to author/manage; ViewBoard to browse; audited.
- Persona: Agent gains Persona; ConfigureAgent stores it; AgentRunContext carries it; PromptAssembler
  injects it as "# Operating guide" (data, not instructions) so an applied profile shapes the run.
- Client: Agent profiles page (library + marketplace tabs, upload editor, publish/unlist/fork/install),
  routed + in the nav.

Verified: ArchitectureTests 8/8, IntegrationTests 55/55 (new AgentProfilesTests: builtins seeded,
upload + validation, publish, cross-org marketplace list→install→private copy, duplicate 409, per-
version flag, Member 403; persona renders as the operating guide), client build green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-06-14 09:18:37 +03:30
parent c5e0e5cfe3
commit 0bcf16e77f
27 changed files with 1872 additions and 5 deletions
@@ -52,7 +52,8 @@ internal sealed record ConfigureAgentRequest(
Guid? FallbackApiConfigId,
List<string> SkillKeys,
List<Guid> McpServerIds,
List<string> Docs);
List<string> Docs,
string? Persona = null);
internal sealed record AgentResponse(
Guid Id,
@@ -64,4 +65,34 @@ internal sealed record AgentResponse(
Guid? FallbackApiConfigId,
List<string> SkillKeys,
List<Guid> McpServerIds,
List<string> Docs);
List<string> Docs,
string? Persona);
// --- Agent profiles (AGENTS.md): a per-org library of reusable agent definitions ---
internal sealed record UploadAgentProfileRequest(Guid OrganizationId, string Content);
internal sealed record PublishAgentProfileRequest(Guid OrganizationId, string Version);
internal sealed record ForkAgentProfileRequest(Guid OrganizationId, string Version, string? Name = null);
internal sealed record InstallAgentProfileRequest(Guid OrganizationId, Guid SourceProfileId);
internal sealed record AgentProfileSummary(
Guid Id,
Guid? OrganizationId,
string Origin,
string ProfileKey,
string Name,
string Version,
string? Summary,
List<string> Roles,
string? Monogram,
string RecommendedAutonomy,
List<string> SkillKeys,
string Visibility,
string Status);
internal sealed record AgentProfileDetail(AgentProfileSummary Profile, string Body);
internal sealed record MarketplaceProfileEntry(AgentProfileSummary Profile, bool AlreadyInLibrary);