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
description: Configuration, env vars, secrets, and service URLs each have one source per runtime; never invent env vars or hardcode hosts. globs: alwaysApply: true
Configuration and service URLs
Config has exactly one source per runtime. Do not add a second one "just in case", read a plain env var as a fallback, or hardcode a host. A missing value fails startup loudly.
Rust services
- CS-14 Read config only through
macro_config::MacroConfigfields and themacro_env_varmacros:env_vars!for required,maybe_env_vars!for optional.std::env::varis banned by clippy. Usemacro_aws_configandmacro_entrypointfor AWS and tracing setup. - CS-15 Load config once at startup (
ConfigLoader::load), never inside handlers. - CS-16 Don't add
.context()to env-var macro errors; they already name the var. - CS-17 Doppler key names equal the env var names in code, exactly.
- CS-18 Every new value goes into Doppler: the service project's
devandprdconfigs (CI'sdoppler_configcheck fails otherwise) andlocal/lcl_personal, plus aBootStubEnvplaceholder inxtask_localso--no-dopplerstill boots. - In ECS the whole Doppler config arrives as
APP_SECRETS_JSON, andMacroConfigreads only that JSON when it is present. A Pulumi containerenvironment:entry is invisible toMacroConfig; a value that comes from infra must be written into Doppler (seeinfra/stacks/agent-harness-service).
Service URLs
- Stable service URLs and public OAuth/callback/app origins are typed in
crates/macro_service_urls(service_url!withlocal/dev/prod), chosen byENVIRONMENT. CallXServiceUrl::new(). Never declare aFOO_SERVICE_URLenv var or match onEnvironmentto build a URL. Queue names follow the same pattern incrates/macro_queues. - The only override is
OVERRIDE_<SNAKE_NAME>, read from the process environment, not from Doppler. Local in-network overrides live inxtask_local'slocal_env.rs;localdefaults are host ports and do not work inside Docker. - The URL table is hand-copied. A new or changed service URL updates every copy:
macro_service_urlsandinfra/packages/shared/src/service_urls.ts, plus each consuming runtime (apps/web/src/lib/core/constant/servers.ts,packages/sdk/src/config.ts, and worker[env.*.vars]). Do not add unused public OAuth identities to API transport maps. - Keep registered public OAuth identities separate from internal gateway API routes. Do not store stable URLs in Doppler; reserve it for secrets and infrastructure-generated addresses (such as preview DNS and SSH hosts).
- When removing required Doppler URL fields, retain their existing values until the deployed rollback baseline no longer requires them; migrate consumers to typed URLs before deleting compatibility resources.
Other runtimes
- Web app: service hosts come from
SERVER_HOSTSinservers.ts; app origin fromgetWebOrigin. Feature switches usedefineFlag(see thefeature-flagsskill), not rawVITE_ENABLE_*reads. Declare newVITE_*vars insrc/vite-env.d.ts. - Cloudflare workers: non-secret config goes in every
[env.*.vars]block ofwrangler.toml/.jsonc(named envs don't inherit) andwrangler.docker.toml; secrets viawrangler secret put; type them in the worker's env module.
Details: new service guide, infrastructure guide.