---
title: "MGS3018: a directory as a job write path"
description: Fires when a job is forked with a write path that names an existing directory that is not a project root. The fork is refused; declare the files the job will edit, or the root of the project it owns whole.
tags: [MGS3018, jobs, leases, write paths, fork, agents, overlap]
---

# MGS3018: a directory as a job write path

`magus job fork`, the `magus_job` tool and `magus\job.put` refused a job because
one of its write paths names a directory that already exists and is not a
project root:

```text
[MGS3018] job: wave/docs-fix declares a directory as a write path: "internal/job",
  inside project ".". A directory claims every file under it, so the job would
  overlap every job editing anything there. List the files the job will edit, or
  declare the root of the project it owns whole
```

Nothing was written to the job store.

## Why

A write path is a claim. A directory claims every file under it, so a job that
declares one overlaps every other job that edits anything in that directory,
whether or not the two ever touch the same file. The overlap report then fills
with pairs that share no file, and an orchestrator reading it as a queue holds
work back that could have started.

A job's brief names the files it will change. The write paths should name the
same files.

## What passes

- **A file**, existing or not: `internal/job/store.go`.
- **A path that does not exist yet.** The job creates it, so nobody else can be
  editing anything under it.
- **A project root**, meaning a directory holding a `magusfile.buzz`, a
  `magusfiles/` directory or a `magus.yaml`. The job owns that project whole.
  The workspace root, `.`, counts when it is a project.
- **A file pattern**, such as `internal/job/*.go` or `internal/**/*_test.go`.

A glob whose last segments are only wildcards, such as `internal/**`,
`internal/*` or `internal/**/*`, names everything under its directory, so it is
judged as that directory. When the directory part is itself a pattern
(`libs/*/src/**`), each directory it matches is judged.

A directory under `node_modules`, `vendor`, `.git`, `.claude` and the other trees
the workspace load skips is never a project root, even when it holds a
magusfile.

## What to do

List the files the job will edit:

```sh
magus job fork wave/docs-fix --write-paths internal/job/store.go,internal/job/store_test.go
```

If the job really does own a whole project, declare that project's root. The
error names the project the directory sits in. There is no flag that accepts a
plain directory.

## See also

- [Leases](../../../guides/integrations/agents/leases.md): what a write path grants and what the guard enforces.
