Post
Creating Hierarchical AI Assistant Contexts: Global vs. Project-Specific Configurations
Introduction
This was designed with two goals in mind from the start. I wanted an AI assistant that could behave correctly inside a specific project, and I wanted the architecture behind it to make future projects easier to set up without rebuilding the whole system every time.
That is where hierarchical context starts to matter.
The point was not just to solve one local need and move on. The point was to create a strong base layer that could carry forward, then let each project inherit from that base and add only what was unique to that repo. That way the architecture solves the immediate project-specific requirement and improves the setup for every project after it.
Without a hierarchy, every project becomes a fresh reinvention. You end up rebuilding the same identity, the same workflow expectations, the same operating rules, and the same project memory over and over again. Even if the assistant works, the setup does not compound very well.
The architecture is base first, project second:
The base layer holds what should stay stable across everything: safety constraints, core operating behavior, tone guardrails, and general identity.
Then the project layer adds what only makes sense inside that specific repo: role, workflow expectations, coding norms, memory, and local rules.
That structure is what makes the system reusable. You are not creating a new assistant each time. You are extending a system that already has a strong foundation.
In practice, that means a small, consistent file set such as:
- `IDENTITY.md` for role definition and communication style
- `MEMORY.md` for current project state, decisions already made, and work still in progress
- `AGENTS.md` for workflow rules, mode expectations, and local operating behavior
The exact filenames matter less than the consistency. The point is to create a structure that can be reused across projects without losing local specificity.
The hierarchy is what makes the architecture usable:
Once you have a base layer and a project layer, you also need clear precedence. Otherwise the assistant still has to guess which rules matter more.
The version that works is straightforward:
- Project rules win for development behavior, naming conventions, and workflow
- Global rules win for safety, privacy, and higher-order constraints
- Identity resolves locally first, then broadens outward
That is what turns the setup from a loose collection of notes into a real system. The assistant is not just reading files. It is operating inside a defined order of authority.
That matters most when global and project assumptions pull in different directions. A global configuration might prefer conservative error handling, while a specific project might deliberately use aggressive retry logic because the architecture demands it. The project rule should win there, because it reflects the actual needs of that system. If hierarchy is not defined, the assistant falls back to guesswork.
Why this scales well:
The real value is that every future project starts from something better.
You can carry a proven base identity forward, preserve the operating rules that should remain stable, and then layer in only what is unique to the project at hand. That makes new project setup faster, more consistent, and easier to trust.
It also opens the door to templating in a much more practical way. Instead of creating context from scratch every time, you can reuse a strong base, specialize it, and keep refining the pattern as you go. The setup itself compounds.
What this changes:
A lot of people approach AI context as something they re-explain every session or rebuild every project. A hierarchical setup treats it more like infrastructure.
The assistant starts with a foundation, inherits the rules that should always apply, and then picks up the local project layer when it needs to. That makes the whole system more reusable, more scalable, and more consistent over time.
That is the part I find most interesting. The architecture was meant to do both from the beginning: support project-specific behavior now, and make the next project easier to stand up after that.
**Contact me if you want a working starter template for this setup or help configuring your own agents.**
