Namaste Ji by Ayushman Dash

Docs / principles.md · mirrored from the repo

First principles

Status: operational reference. The durable principles that recur across every design doc, collected once. Each is a compression of decisions logged in the deep docs (IDs cited). When a new choice conflicts with one of these, that’s a signal to stop and reconsider — or to update the principle deliberately. Companion to SYSTEM-DESIGN.md.

Product

#PrincipleWhySource
P-1Agent-operated product; founder in the loop for strategyCreative + engineering agents run the pipeline; humans review at gates, not every stepARCHITECTURE §1
P-2The content pipeline is itself a product surfaceThe BO/console isn’t scaffolding — it’s a first-class product we design as carefully as the appARCHITECTURE §1
P-3The unit is “a greeting to send,” not a video to watchSuccess = share-intent, not watch-time; optimize time-to-a-good-send, not time-on-appDIST DS-2
P-4Amplify the recipe, never the dishA hit means “make more like this” (production amplification), not “show this to everyone” — we don’t chase viralityDIST DS-4
P-5Novelty + rarity are first-class; diversity is the productUniqueness is the value; a greeting everyone else sent is devalued. Inverts the usual popularity boostDIST DS-4/DS-5
P-6Vernacular-first, English-secondAudience is next-billion, Tier-2/3, 35+, Android; languages hi/en/hi-LatnARCHITECTURE §2
P-7Architect for the low-end deviceCache-first sharing, strict .nomedia, pre-positioned bytes; no on-device MLARCHITECTURE §2, DIST DS-7/DS-8
P-8Privacy-light by designMeasure in-app share-intent only; stop at the OS share-sheet — no recipient graph, no off-platform beaconDIST DS-10

Engineering

#PrincipleWhySource
P-9Everything Cloudflare by defaultOne account/bill/deploy, colocated with data; reach outside only when CF can’t, and document whyARCHITECTURE D1
P-10Control plane and execution plane are separate concernsThe BO is UI + thin control API + authoritative mode state — no agent/business logic (the rule that killed n8n)ARCHITECTURE §3, D2/D4
P-11Single source of truthNo component keeps a private copy of catalog or control state — the catalog spine and the Control DO are authoritativeARCHITECTURE §2/§5, D8
P-12Ports & adapters — provider-agnosticModelPort / EmbedderPort / VectorIndex behind our own interfaces; swapping Ollama→Workers AI→Jina is config, not a refactorBACK-OFFICE BO-2
P-13Contracts between components are versioned Zod schemasThe brief, the Content Strategy, FeedPolicy, OnboardingSignals — a downstream agent consumes one cold; immutable + reproducibleCP-3, FL-2
P-14Isomorphic code across sim and servingOne rank(), one coldStartVector() imported by both the Feed Lab and the serving path — kills playground-vs-reality driftFL-1/FL-10
P-15LLMs are the offline slow brain; the per-request path is cheap vector mathAn LLM call per user per scroll bankrupts a free next-billion app — keep a seam so scale = move LLM work offlineDIST DS-14
P-16Infrastructure as code; CI is the deployerAlchemy owns CF resources; GitHub Actions + Wrangler deploy only what changed — reproducible, no click-opsCI-1/CI-4
P-17Simplicity-first; small, atomic, single-purpose PRsNo overengineering; research scalability + best practice before an architectural choiceAGENTS.md, memory
P-18Secrets never get committedsecrets/, .env*, .dev.vars, .mcp.json gitignored; CI fails on a tracked secret; shared secrets live in the Secrets StoreAGENTS.md, SEC-3

Agents (the Kernel)

#PrincipleWhySource
P-19One agent shape — the Kernel + a manifest“New agent” = write a manifest + prompts, not a runtime; “more capable” = add subagents, never thicken the orchestratorAK-1
P-20Subagent-as-tool with a hard context firewallA subagent may burn a big context internally but returns only a distilled artifact + lineage; the orchestrator stays fast/cheapAK-4, OR-3
P-21Calibrated stop, not a hard budgetStop on marginal-gain / confidence / coverage / soft-cost; max_loops is only a circuit-breaker; every level is boundedAK-5
P-22Control DO gate: ship vs escalateAutonomy is a governed policy (manual/proposes/auto); low confidence or cultural-veto risk always escalatesAK-6, ARCHITECTURE §3
P-23All prompts from Langfuse by name@label, versionedNo prompt strings in code; the resolved version is logged in the trace (reproducible); never auto-promote to productionAK-6, memory
P-24Learn only from verified outcomesConsolidation is offline and grades on real results — an agent never promotes its own ungraded output to a behaviour-changing lessonAK-3, AP-6
P-25Agent artifacts are Markdown (YAML frontmatter for machine fields)Readable artifacts + clean PR diffs without losing machine-readability; config (manifest) + DB rows exceptedAK-7
P-26One observability streamEvery Kernel/subagent yields structured events into agents/observability; localize labels in the BO, never bake English into the streamAK-9, ARCHITECTURE §4

Data & security

#PrincipleWhySource
P-27Two-plane data classificationPublic content plane (shareable, integrity/availability matter) vs the sensitive PII plane (profiles, phone, behaviour)SEC-2, DIST DS-15
P-28The PII plane is region-pinned, minimized, retention-boundedOn-device gave privacy for free; server-side we engineer it (DPDP/GDPR)DIST DS-15
P-29Least-privilege service bindings; every agent action is auditableEach agent gets only the resources its manifest grants; append-only audit + run/step logs from day oneAK-8, SEC-4

How to use this doc

  • Reviewing a design or PR? Skim for a conflicting principle; cite the ID in the review.
  • Adding a principle? It must be durable and cross-cutting (recurs across ≥2 planes) and traceable to a decision — otherwise it belongs in the relevant deep doc, not here.
  • Overriding one? Do it deliberately in the deep doc’s decisions log, then update the row here.