> Agent-ready spec from Diff of the Day (2026-11-28, From the big ones 1). Based on Uber's context graph, as described by Uday Kiran Medisetty. Give this file to your coding agent and review its plan before it changes anything.

# Spec: A context map your coding agents read first

## Problem Statement
Agents waste turns and tokens finding out which service owns what, where its data lives and who to ask. Uber built a context graph that joins its services, apps, data lake, design docs, tickets and incidents, so its agents ground themselves in one place instead of 20 to 30 systems. A small team does not need a graph database: a generated, version-controlled map of its own systems gives agents the same head start.

## Goals
- One generated file set, `context/`, that lists every service with its owner, repo, data stores, dependencies, docs and recent incidents.
- Agents read the map before they search the code, through the agent instruction file.
- Fewer turns to the first correct file on three real tasks, measured before and after.

## Non-Goals
- A graph database or a query service: plain files first.
- Hand-written prose about each service: generate from sources that already exist.
- Covering every system on day one: start with the services one team owns.

## User Stories
- As a developer who works with coding agents, I want the agent to know which repo and data store a feature lives in so that it stops searching blindly.
- As the team lead, I want the map generated from real sources so that it does not go stale like a wiki.
- As a developer, I want each entry to link to docs and recent incidents so that the agent sees known risks.
- Edge case: as a developer, I want missing facts shown as unknown, never guessed.

## Requirements
### P0 (must have)
1. **Generator** that builds `context/services.yaml` from sources you already have: repo list, CODEOWNERS, deployment manifests, connection strings by name (never values), and the docs folder.
   - [ ] Each service entry has name, repo, owner, data stores, dependencies and doc links; unknown fields say unknown.
2. **Edges**: service to service, service to data store, service to doc, from manifests and config.
3. **Agent wiring**: one line in the agent instruction file that tells the agent to read `context/` first.
4. **Measurement** `results.md`: three tasks, turns and tokens to the first correct file, with and without the map.

### P1 (nice to have)
- Recent incidents and tickets per service from your tracker's API.
- A CI job that regenerates the map weekly and opens a PR when it changes.

### P2 (future)
- A tiny MCP server that answers "who owns X" and "what reads table Y" from the map.

## Success Metrics
- Leading: the map covers all services of one team; no secret values appear in it.
- Lagging: turns to the first correct file drop on the three measured tasks (target: 30% fewer).

## Open Questions
- Which sources exist for owners and dependencies in your setup? (you)
- Which three tasks to measure? (you)

## Timeline
Two days: day one for the generator and edges, day two for wiring and measurement.

## Agent Instructions
- **Suggested stack**: Python 3.12 or TypeScript on Node 22; YAML output; no database.
- **Build order**: list sources → generator for services → edges → tests that fail on secret-looking values → agent wiring → measurement.
- **Safety**: read config by key names only and never copy secret values into the map; keep tokens in environment variables.
- **Done when**: `context/` is committed, the agent reads it first, and results.md has before and after numbers.

## Sources
- Uber's AI infra from the inside (The Pragmatic Engineer): https://newsletter.pragmaticengineer.com/p/ubers-ai-infra-from-the-inside
- Agentic SDLC at Uber (AI Engineer talk): https://ai.engineer/talks/agentic-sdlc-at-uber-building-blocks-for-uber-s-software-factory
