Layered product + team working memory (Slice 3)
Generalizes working memory to a scope: ITeamMemory becomes IWorkingMemory with a MemoryScope (Team | Product); MemoryEntry's TeamId becomes ScopeType+ScopeId (data- preserving rename migration). On approval, Governance writes the decision/correction at PRODUCT scope when the team belongs to a product (resolved via IBoardStats), so it is shared by every agent across the product's teams — else at team scope. The assembler recalls product memory (shared) plus team memory (local), merged by relevance, under a "# Shared memory" section. This is the other half of product-centric agents: a decision approved on one team now informs every agent on the product, not just that team. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
namespace TeamUp.SharedKernel.Ai;
|
||||
|
||||
public enum MemoryKind
|
||||
{
|
||||
Decision,
|
||||
Approval,
|
||||
Correction,
|
||||
}
|
||||
|
||||
/// <summary>The scope a memory belongs to: a single team (local, tactical) or a whole product (shared).</summary>
|
||||
public enum MemoryScope
|
||||
{
|
||||
Team,
|
||||
Product,
|
||||
}
|
||||
|
||||
public sealed record MemoryHit(Guid Id, MemoryKind Kind, string Content, DateTimeOffset CreatedAtUtc);
|
||||
|
||||
/// <summary>
|
||||
/// Working memory: written when a human approves (or corrects) agent work, read at prompt assembly
|
||||
/// via pgvector similarity. Scoped to a team (local context) or a product (shared by every agent
|
||||
/// across the product's teams). Implemented by the Memory module.
|
||||
/// </summary>
|
||||
public interface IWorkingMemory
|
||||
{
|
||||
Task WriteAsync(
|
||||
MemoryScope scope,
|
||||
Guid scopeId,
|
||||
MemoryKind kind,
|
||||
string content,
|
||||
Guid? sourceReviewItemId = null,
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
Task<IReadOnlyList<MemoryHit>> SearchAsync(
|
||||
MemoryScope scope,
|
||||
Guid scopeId,
|
||||
string query,
|
||||
int take = 3,
|
||||
CancellationToken cancellationToken = default);
|
||||
}
|
||||
Reference in New Issue
Block a user