Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
task_dedup
What it is
Part of the Projects/Tasks feature — detects duplicate tasks by embedding a task, searching a pgvector corpus, and judging candidate duplicates with an LLM.
Start here
src/lib.rs:TaskDedupService<Embedder, VectorDb, Judge>and the productionTaskDeduptype alias (OpenAI embeddings + Postgres/pgvector + Cohere reranker).src/domain/service.rs: the duplicate-detection workflow, generic over the embedding, vector-db, and judge ports.src/outbound/{cohere,connection_gateway,judge,postgres}.rs: concrete adapters for each port.src/eval/corpus.rs: labeled-corpus loading for the semantic eval.
Scope
- Owns: the embed → search → rerank → judge pipeline and its Postgres/pgvector storage.
- Not here: the embedding provider implementation itself →
embeddingcrate; task domain logic →crates/documents/wherever tasks are modeled.
Boundaries
- Depends on:
agent,embedding,lexical_client;backfill-feature-gatedmacro_entrypoint,macro_aws_config,secretsmanager_client. - Used by:
services/document_storage_service,crates/documents.
Recipes
- Add a judge or embedding provider: implement the matching port in
src/domain/ports.rs→ newsrc/outbound/<provider>.rs→ wire into theTaskDedupalias insrc/lib.rs. - Add an eval case: drop a file under
tests/eval/cases/(auto-discovered bytests/eval/main.rs) →just crates/task_dedup/eval [name].
Checks
cargo test -p task_dedup(SQLX_OFFLINEunset).just crates/task_dedup/eval— real OpenAI/Anthropic/Cohere calls against the labeled corpus; needs local MacroDB plusOPENAI_API_KEY,ANTHROPIC_API_KEY,CEREBRAS_API_KEY. Costs money and is noisy; read before running (seejustfile).
Related
- Rules:
.agents/rules/rust/architecture.md