Building with context For engineers
How to keep AI coding context scoped to one client project
To keep AI coding context per client project, confirm the active client and project before returning project material. Limit the lookup to approved sources the caller can currently access, then check which decisions apply to the task. Ask for clarification if the project is unclear. Leave an individual source out while its ownership or permission is unresolved.
Identify the active client and project
A consultancy engineer may work on several accounts in one day. For a coding task, identify the client and project from the work item and confirm the workspace against an approved project record. Carry those identifiers into the context lookup with the caller's identity. If two projects use the same name or repository nickname, ask which approved project record governs the task.
AWS's guidance on SaaS isolation describes using tenant context to determine which resources are accessible. Apply the same distinction when evaluating a project context workflow. The caller's identity tells you who is asking. The project boundary and source permissions determine which records the lookup can use for that task.
Check which sources can enter the lookup
For an active project, start with the approved sources for that workflow and confirm the caller's current access. Make the authorized set the input to relevance matching. A similarly worded record from another account stays outside that set even if the engineer can open it for that other account. Treat a consultancy playbook as a shared source only when it is approved for use across the projects in question.
Then check whether the eligible record governs the change. A decision can be readable and relevant to the topic but effective only in staging, only until a handover, or only for a particular interface. Record the source reference and effective scope with the rule it supports. An unclear condition goes back to the decision owner before the team applies it.
Walk through a fictional lookup across two projects
The same engineer maintains two billing exports in separate client projects. An Alder staging ticket asks for an update to its validation checks. Alder's approved ticket says empty rows remain allowed in staging until the client signs off on a migration. Birch's export note says to reject empty rows immediately. The engineer has access to both projects for their respective work.
For the Alder task, the lookup can include Alder's approved staging ticket and a separately approved consultancy playbook. The Birch note stays outside the lookup. The staging ticket supports retaining the current validation check in staging while signoff is unconfirmed. The engineer needs a current production source before applying the exception there.
| Source in the example | Lookup decision | Use in the task |
|---|---|---|
| Alder staging ticket | Eligible for the Alder staging task | Continue allowing empty rows in Alder staging while migration signoff is unconfirmed. |
| Birch export note | Outside the active project | Leave the note out of the lookup and the coding brief. |
| Approved consultancy playbook | Eligible for both projects | Use its review checklist. Project behavior still comes from the applicable client record. |
| Export note with unclear project ownership | Hold until the owner confirms scope | Leave the note out while its ownership or permission is unresolved. |
Verify the expected results with sample records
A delivery lead can ask for a verification run using fabricated records that match the four cases above. Keep the query and caller fixed, then compare an explicitly scoped Alder lookup with one whose project is unspecified. For the scoped lookup, expect the Alder ticket and eligible playbook and inspect the returned references and excerpts. Expect the lookup with missing scope to ask for clarification before returning project material.
Record the fixture and configuration used, the expected source set, the actual source references, and whether each expectation held. If a lookup returns a record outside the intended scope, hold use with client data while the owner resolves the boundary. A passing fixture establishes the recorded behavior for those cases. Other paths, permissions, and changes in configuration require their own evidence.
Frequently asked questions
How do I keep AI coding context separate between client projects?
Identify the client and project from the work item and confirm the workspace against an approved project record. Carry those identifiers into the context lookup with the caller's identity. Limit the lookup to approved sources for that project that the caller can currently access, then check which decisions govern the task. Ask which project applies when names or repository nicknames collide.
Can an engineer's access to another client's records leak into a coding task?
It should not. An engineer may legitimately open records for several accounts, but a similarly worded record from another client stays outside the lookup for the active project. Make the authorized set for that project the input to relevance matching. Treat a consultancy playbook as shared only when it is approved for use across the projects in question.
What if a source's project ownership is unclear?
Leave it out of the lookup while its ownership or permission is unresolved, and send the question to the owner. Similarly, if an eligible decision has an unclear effective condition, such as applying only in staging or only until a handover, return it to the decision owner before the team applies it.
How can I test that a context lookup stays within one client project?
Run a small fixture with fabricated records matching each case: the active project's source, another client's source, an approved shared playbook and a source with unclear ownership. Keep the query and caller fixed, then compare a scoped lookup with one whose project is unspecified. Record expected and actual source references. A passing fixture covers those cases only.
Sources and further reading
- AWS SaaS Architecture Fundamentals on tenant isolation and accessible resources
- AWS SaaS Lens on applying tenant context across architecture layers
Prepared with AI assistance and reviewed for source fidelity and practical usefulness. Examples marked fictional are illustrations, not customer results.