# Enterprise context

> An agent does good work when it knows the code, past decisions, the rules and the dependencies, the way an experienced engineer does. Supplying that context with the right permissions underpins everything else.

Context starts in the repository. An instructions file of about one page is read at the start of every session: commands, conventions, architecture, mistakes to avoid. You add to it each time the agent repeats a mistake. House rules that every team needs become skills, versioned and approved by their owner. A rule that allows no exception also gets a hook or a PR check (see Governance and guardrails).

Beyond the repository, the agent needs a map of the company: services, their owners, their dependencies, what runs in production, tickets and documentation. Without it, the agent guesses the architecture and can pick the wrong service. The map takes several forms: a service catalog, a code graph, a graph that links code to tickets and decisions, an ontology of business concepts, maintained domain by domain. Agents often connect to it through MCP.

Permissions depend on what starts the agent. A background agent is started by a developer from their own session, on their machine or after handing that session off to the cloud. It works on that developer’s behalf, with their access and permissions, and its actions are attributed to them. An ambient agent starts outside any developer’s session: from an alert, a schedule, a webhook, a ticket assigned to it or a message in a channel such as Slack. It has its own identity and its own access, never those of the person whose message or ticket set it off. Its access is scoped to its task and reviewed like code. It never runs on a shared account, and a message or a comment is not enough to widen what it can do. Either way, permissions apply at the data level and every action is traced.

The software factory produces context too: agent memory, traces of past runs, artifacts. Each session feeds the ones that follow. That data contains code and sensitive information. It should be able to stay on your infrastructure and must not be used to train models.

**When**: From the first agent, and especially when code is spread across several services and teams.

**Trade-offs**: Keeping every session in one place lets you learn from the past, but where it is stored becomes a compliance question. Context that is too broad clutters every session and costs tokens.

## Where to start

- Write the repository instructions file
- Turn a poorly followed rule into a skill
- Connect tickets, docs and the service catalog through MCP
- Give ambient agents their own identity; agents started from a developer’s session use that developer’s permissions
- Name one source of truth for each document type

## Common mistakes

- Letting the instructions file grow long or go stale until it clutters every session
- Running an ambient agent with the permissions of the person whose message or ticket set it off, or on a shared account
- Letting each team keep its context to itself
- Letting context data be used to train a model

## Metrics

- Repeated mistakes the instructions file should have prevented
- Time to a new hire’s first merged PR
- Tokens used per task

## Sources

- [Atlassian, The AI SDLC transformation playbook](https://www.atlassian.com/blog/ai-at-work/ai-sdlc-transformation-playbook)
- [Port, AI SDLC: a practical guide to SDLC AI agents](https://www.port.io/blog/ai-sdlc)
- [Anthropic, The AI-native SDLC playbook](https://claude.com/fr/resources/articles/the-ai-native-sdlc-playbook)
- [Warp, The Factory Stack](https://www.warp.dev/blog/the-factory-stack)
- [Potpie, vendor site (layered agent architecture)](https://potpie.ai/)
- [Andrew Eacott, Access without trust (Miro)](https://www.adventuresintech.org/what-it-takes-to-build-a-software-factory-part-2-access-without-trust/)
