AI and systems
How to connect an AI coding tool to an existing codebase
Connecting an AI coding tool to an existing codebase starts when the responsible person marks the directories this task may read and edit, and only after the administrator has checked that list is the tool allowed to propose a diff inside those directories. Secrets, credentials, and unpublished contracts stay outside that scope. A diff waits for the responsible person before it reaches the main branch.
On this page
- 1List the directories that may be read and the ones that are excluded
- 2Secrets and credentials stay out of the tree and out of the chat
- 3The agent picks files, so the exclusion list comes first
- 4Terminal commands wait for a person by default
- 5A local checkpoint is not the repository
- 6The diff passes review before the main branch
- 7Stay on autocomplete until review and the directory list exist
Matching serviceAssessment, prototypes, and integration
List the directories that may be read and the ones that are excluded
Opening the whole disk lets the tool carry anything it can read into a suggestion or a diff. The responsible person lists the directories this task may touch, and the directories it must leave alone, such as credentials, pay files, unpublished contracts, and customer exports. Both lists sit in one section of the project note, and the directories are paths in the repository, not a spoken “that folder”. An intended user pastes that section into the task. The administrator checks that the paths the tool can actually read match the section.
Write that scope into the project note so the next person can see it, including who may change the list and who is told after a change. Whether it is worth connecting to the review and the build you already run is an Assessment, prototypes, and integration question. When it is worth connecting, the scope also names the reviewer, the existing checks that must run, and which branch holds the diff if the build fails. While those three columns are empty, the tool stays on autocomplete inside a single file.
Secrets and credentials stay out of the tree and out of the chat
Keys, connection strings, and personal data do not sit in a directory the tool will read, and they are not pasted into the chat. When a connection is required, inject the secret through the mechanism you already use, so the program reads the environment and the tool never sees the value. The variable name may appear in the note. The value stays in the secret store. If someone pastes a value into the chat, the administrator retires that credential, the responsible person writes the time in the task record, and the intended user runs again with the new variable name. The old value is not pasted a second time.
The responsible-use page for GitHub Copilot inline suggestions says to keep secure-coding practice, including avoiding hard-coded passwords and injection-prone code, and that a suggestion can be syntactically correct and still be insecure. Check a suggestion against those two problems before accepting it. The person checking is the intended user who is typing. After the diff is sent for review, the reviewer uses the same list again. The stretch stays in the diff only after both checks have passed.
The agent picks files, so the exclusion list comes first
The page on agent mode in the IDE says Copilot decides which files to change. You review the changes, and by default you approve terminal commands first. If Agent is missing from the menu, an administrator may have turned the mode off. When it is missing, the intended user stays on autocomplete and asks the administrator whether an organization policy turned it off, rather than opening the mode again under another account. A file that appears in review outside the list sends the whole diff back.
The Cursor Agent page says Agent tools include searching and reading files, applying edits, and running terminal commands, and that there is no limit on tool calls during a task. A task with no cap on tool calls needs the excluded directories written down first. How to choose the product is covered in How to choose between Cursor and GitHub Copilot. Excluded directories are written as paths. The responsible person reads that list before the task starts, and the administrator confirms the tool is configured from the same list. A task with no list is not handed to an agent that searches for files on its own.
Terminal commands wait for a person by default
The Copilot page treats approving commands by default as part of control, and says an administrator or an editor setting may allow some commands to run on their own. Keep that automatic list short, and write for each entry whether a failure changes data and who approved putting it on the list. The list lives in the project note, in the same section as the directory list. If the editor settings are wider than that section, the administrator pulls the settings back to the written list and does not leave the extra commands in a personal setting.
A command that installs a dependency, pushes to a remote, changes a database, or deletes files stays off the automatic list. When a person approves, they see the full command, including the arguments and the target path, not a line that only says the terminal needs to run. The approver is the role the responsible person named, and the name sits beside the command record. A command whose arguments are not visible is sent back so the agent can list the full command again, and only then does the approver decide whether it runs.
A local checkpoint is not the repository
The Cursor Agent page says a checkpoint is created before significant changes, stored locally, and kept separate from Git. Restoring it reverts files and does not delete the conversation. The same page says to use checkpoints only to undo Agent changes, and to use Git for lasting version control. After a restore, the intended user writes a line in the chat about why it was undone, but that line stays in the local conversation. A decision the reviewer must be able to see is written in the commit message or in the review comment.
After the agent finishes, the diff still goes onto the branch and into the review the team already uses. A checkpoint that lives only in the editor disappears when the machine or the person changes, and nobody can see what was undone. Before the commit, the intended user checks that every path in the diff sits inside the directories named in advance. A file outside those directories is deleted before the commit. The checkpoint is not treated as a review that has already happened.
The diff passes review before the main branch
A diff from an agent uses the same review as a diff from a person: who may approve it, which existing checks must run, and which file types need a second owner. The reviewer reads the diff. A line from the agent that says the task is done means the agent stopped this task. It is not an approval. A diff whose checks have not finished stays on the branch, and the reviewer named by the responsible person does not merge it. If the file type is a contract, a permission, or a database structure, a second responsible person leaves their name on the same review.
Send back any file outside the directories you named. A person deletes the extra edits, narrows the scope, and only then allows the next task. The split between autocomplete and an agent is covered in What is the difference between an AI coding agent and autocomplete. The narrower scope is written back into the project note, the administrator changes the tool settings to match it, and the intended user gives the next task inside the new scope. The old diff is not merged before the extra files are deleted.
Stay on autocomplete until review and the directory list exist
If the repository has no branch and no review yet, if secrets are still mixed into the tree, or if nobody has time to read a diff, the agent stays off that tree. Add the review and the directory list first: who the reviewer is, what the main branch is called, and which paths are excluded. Those three items sit in the project note, and the responsible person signs them. Autocomplete can stay inside a single open file, and the person typing still reads a suggestion before accepting it. Until the secret has been moved, even autocomplete does not have a file that contains a credential open in the editor.
A drop in defects, or a faster delivery, is read from the review and build records the responsible person already keeps, with the definition written down, for example whether a defect means a review sent back or a failure after release. Until that record exists, check the connection by three things: whether the scope is written, whether the diff entered review, and whether commands were approved under the rule. When all three happen, the connection is inside the process. The figures wait until the record is long enough to count.
