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
favorites
What it is
Backs favoriting/pinning across Macro surfaces (sidebar, Home/Soup): user- and team-scoped ordered collections of entities, following the hexagonal architecture pattern.
Start here
src/domain/service.rs+src/domain/mutation_service.rs: the service and its mutation (reorder/add/remove) logic.src/domain/ports.rs: the repository port, implemented inoutbound.src/inbound/axum_router.rs,src/inbound/toolset.rs: HTTP router and AI toolset adapter.src/outbound/pg_favorites_repo.rs: the Postgres adapter.
Scope
- Owns: favoriting/ordering for any entity type, behind
ports,inbound,outbound,ai_toolsfeature flags. - Not here: the GraphQL favorites surface →
crates/graphql_favorite.
Boundaries
- Depends on:
entity_access(ports),macro_authorization(inbound),model-entity,cowlike. - Used by:
graphql_favorite,ai_tools,complete_graph,soup,document_storage_service,authentication_service.
Recipes
- Add a favoritable entity type:
validate_favoritableinsrc/domain/mutation_service.rs→list_favoritesinsrc/outbound/pg_favorites_repo.rsif the kind can be deleted → caller's feature wiring. - Add an AI tool action:
src/inbound/toolset.rs→src/domain/mutation_service.rs.
Tool contracts
- The AI adapter omits legacy chat targets; only advertise entity types supported by the domain mutation service.
ExternalChatentities are favoritable through the generic entity reference.
Checks
cargo test -p favorites --all-features(SQLX_OFFLINEunset).
Gotchas
- Authorize adds with
ports::FavoriteView, notViewAccessLevel: channels resolve to channel roles, whichViewAccessLevelnever accepts.
Related
- Rules:
.agents/rules/rust/architecture.md,.agents/rules/rust/db.md