Skip to main content
Aurikle
AI and systemsAurikle

How to connect an AI coding tool to an existing codebase

Connect an AI coding tool to an existing codebase by marking which directories it may read and edit, and only then letting it propose a diff. Secrets, credentials, and unpublished contracts stay outside that scope. A diff still waits for the responsible person before it reaches the main branch.

On this page
  1. Mark the directories it may read and edit
  2. Keep secrets and credentials outside
  3. An agent picks files itself
  4. Terminal commands wait for a person by default
  5. A checkpoint does not replace the repository
  6. Review the diff before it reaches the main branch
  7. When to leave the tool unconnected
Matching serviceAssessment, prototypes, and integrationRead this note

Mark the directories it may read and edit

Opening the whole disk lets the tool carry anything it can read into a suggestion or a diff. List the directories this task may touch, and the directories it must leave alone, such as credentials, pay files, unpublished contracts, and customer exports.

Write that scope into the project note so the next person can see it. Whether it is worth connecting to the review and the build you already run is an Assessment, prototypes, and integration question.

Keep secrets and credentials outside

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 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.

An agent picks files itself

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.

The Cursor Agent page says Agent’s 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.

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.

Do not automate a command that installs a dependency, pushes to a remote, changes a database, or deletes files. When a person approves, they see the full command, not a line that only says the terminal needs to run.

A checkpoint does not replace 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 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.

Review the diff before it reaches 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 is not an approval.

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.

When to leave the tool unconnected

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, leave the agent off that tree. Add the review and the directory list first. Autocomplete can stay inside a single open file.

This note does not claim a drop in defects or a faster delivery. Those figures have to come from your own review and build records, with the definition written down. Until that record exists, check the connection by whether the scope is written, whether the diff entered review, and whether commands were approved under the rule.

Related notes