# How to give an agent only the folders it needs in a huge repo with git-ai

Repo: [feder-cr/git-ai](https://github.com/feder-cr/git-ai) | Difficulty: Intermediate | Time: 45 minutes | Basis: From the README

Use graft sparse and graft clone to materialize just the paths a short task touches instead of a full clone.

**Who it is for:** Platform engineer whose agents each edit a few files in a large monorepo and waste time on full clones

**The problem:** Cloning the whole repository for a task that touches three files makes each agent slow to start.

**The outcome:** The agent fetches only the requested paths and can still land its change through the server.

## Steps

1. Build with: make build
2. Run ./_build/bin/graft to list the CLI commands
3. Use graft sparse or graft clone with the paths <paths> the task needs
4. Land the resulting change and confirm it appears in the changeset log

## Prompt to paste into your agent

```text
Using feder-cr/git-ai, run ./_build/bin/graft to find the sparse and clone commands, then materialize only <paths> from <repo> and land one edit. Verify that unrelated directories were not downloaded.
```

## Caveat

The README names graft clone and graft sparse but not their flags, so read the CLI help or docs before running them.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/feder-cr-git-ai/sparse-checkout-for-short-lived-agent-tasks/
