Blog · Guide · 25 November 2026

Nightly Dependency Upgrades With a Scheduled Factory

Dependency upgrades are the recurring chore most teams would hand to an agent first. The work is small and repetitive: bump a version, read the changelog, fix what broke, run the tests. Bots have opened version-bump pull requests for years. What they do not do is fix the code that the new version breaks. An agent can.

This guide designs a nightly job for that: a Forkit factory that runs every morning at 06:30 UTC, gives one agent to each outdated package, and leaves a branch per upgrade for a person to read with their coffee. Over a few weeks, its pass rate tells you whether the job is worth keeping.

This is a design built from features Forkit has. Forkit has not recorded a scheduled run of any factory yet, and has not run this workflow end to end. Each step below uses a documented feature, and the closest recorded runs are named where they apply.

In this article, "factory" means a Forkit factory: a saved fan-out with a prompt template, a size, a repository and budgets, run on request, by webhook or on a schedule. It does not mean the company Factory.

What others have built

Scheduled agents became common this year.

Cognition, "Devin can now Schedule Devins" (20 Mar 2026). "Starting today, Devin can schedule its own sessions to take care of work like this." Devin keeps its own notes across sessions, so each scheduled run picks up where the last one left off.

GitHub, "Automate repository tasks with GitHub Agentic Workflows" (Don Syme and Peli de Halleux, 13 Feb 2026). Workflows are written in Markdown and run as GitHub Actions, for example on schedule: daily. "Workflows run with read-only permissions by default," and writes go through "safe outputs": pre-approved, reviewable operations such as opening a pull request.

Linear, "Five principles for working with Loops" (13 Oct 2026). Loops are recurring jobs for Linear's agent, run on a schedule or in response to an event. Two of the five principles fit here: be incremental in your approach, and keep your team in the loop.

What these share: a fixed job, a trigger, and output a person reviews. The design below adds three things a nightly job needs once it uses many agents at once: one agent per package with its own fork, budgets that stop the whole run, and a record of how often the run was any good.

The design

1. The factory

forkit factory create --name deps --prompt-file deps.md \
  --push --agents 8 --max-cost 15 --max-tool-calls 4000 --ttl 3600 \
  --schedule "daily 06:30" --shadow
  • --schedule "daily 06:30" asks for a run every day at 06:30 UTC. Forkit's once-a-minute sweep asks once per slot. If a slot is missed, it is run once, not once for every slot missed. Schedules can also be every 15m, hourly or weekly mon 09:00.
  • --agents 8 is how many agents a scheduled run gets (see step 2).
  • --push means the runner pushes your checkout as the starting repository, so a private repository works and Forkit holds no repository token.
  • --max-cost 15 stops the run at about $15 by Forkit's estimate, with a warning at 80%. --max-tool-calls 4000 stops it at 4,000 tool calls. Use both, since an agent that reports no usage is invisible to the dollar budget.
  • --shadow makes the first runs rehearsals (step 4).

Schedules need the Pro or Team plan. Free allows one factory, without a schedule.

2. Giving each agent its packages

A scheduled run carries no input of its own, so the prompt decides how the work is split. The template is filled once per agent, and {{n}} and {{total}} give each agent its place:

You are agent {{n}} of {{total}} upgrading dependencies.
Run `npm outdated --json`, sort the package names, and take every
{{total}}th package starting at position {{n}}. For each one:
upgrade it alone, read its changelog, fix what breaks, run `npm test`,
and commit with the package name in the message.
Claim the files you edit before editing them.
Skip any major version bump that needs a design decision; hand off a note instead.

If you would sooner have exactly one agent per outdated package, use a webhook instead of a schedule. A nightly job in your own CI runs npm outdated --json, turns the result into items, and POSTs them to the factory's webhook address. An input with items gives one agent per item, and the prompt uses {{item.name}}, {{item.current}} and {{item.latest}}. The webhook address can only ask for a run. It starts nothing and reads nothing. On 21 Nov 2026, on staging, a run was asked for this way with twelve items and started twelve agents (the CO2 model comparison, one run).

3. The runner, on your own CI

Forkit never runs agents. A runner your team operates picks up the waiting run and starts the agents. The reference runner is part of the CLI:

forkit factory work deps --once --repo-from . --exec "$PWD/agent.sh"

Run it from your CI on its own schedule a few minutes after the slot, for example a CI cron at 06:35 UTC. With --once it starts the oldest waiting run and exits, or says nothing is waiting. It can also run continuously without --once, checking every five seconds. For each agent it runs agent.sh in an empty folder with FORKIT_API_KEY, FORKIT_PROMPT, FORKIT_TITLE and FORKIT_AGENT set, so agent.sh can be as short as claude -p "$FORKIT_PROMPT". Give --exec the script's full path, because each agent starts in an empty folder.

If the runner is down for a day, the run waits. At most 25 runs wait per factory.

Each agent's sandbox needs the hooks: forkit init --sandbox installs them without asking anything and makes an unanswered permission request a denial, because nobody is awake at 06:30 to answer it.

4. A week of shadow runs first

With --shadow, agents work in their forks as usual and allow rules still answer, but anything that would have reached a person is refused at once and kept. After each run:

forkit factory asks <fanout-id>

lists those requests, grouped, with how many agents asked and the rule that would allow it. Expect npm install and npm test on the list. Turn the ones you are happy with into allow rules. Requests about production, secrets or money are never answered by a rule and always reach a person, so a dependency job that reaches for a deploy key will wait rather than proceed.

The closest recorded run: on 21 Nov 2026, on staging, a shadow run of a factory with two items started two real Claude Code agents, the command that needed a person was refused for both and listed as one line, and the run finished in 47 s at about $0.21. One run, and not a dependency job.

When the list is short and understood, make the factory again without --shadow. Factories cannot be edited yet: delete and make it again.

5. Lockfiles and the merge

Every upgrade edits package.json and the lockfile. Eight agents' changes to the same lockfile will conflict when merged together, and Forkit's merge check, which compares each agent's change with its peers' before it finishes, would hold every agent on it.

Keep each upgrade separate instead:

  • Exclude the lockfile from the merge check by setting FORKIT_MERGE_EXCLUDE=package-lock.json (a comma-separated list) in each agent's environment, so agents are held only for real conflicts in source files.
  • Collect without merging: forkit fanout collect <fanout-id> ./deps fetches each agent's pushed work as its own branch, agent/<name>.
  • Open one pull request per branch from your CI, so each upgrade is reviewed, tested and merged on its own and the lockfile is regenerated on each.

Two agents that both need to change the same source file still meet a claim: a file has one owner at a time, and the second agent's edit is refused with the holder's name.

6. Verdicts each morning

The run finishes when its agents end, and the runner reports how many finished and what the run cost. A person then reads the branches and marks the run:

forkit factory verdict <run-id> good --note "5 of 6 upgrades mergeable"
forkit factory verdict <run-id> bad --note "every agent broke the build on the same peer dependency"

Decide what "good" means before the first run, for example "most upgrades mergeable without edits". Then:

forkit factory show deps

gives the number of runs, the share judged good among runs someone judged, the cost in all and per run, and seconds per run. After two or three weeks, that pass rate answers the question that matters: is this factory saving more time than its review costs? If it is not, change the prompt, or delete the factory.

What can go wrong

  • A bad prompt runs every day. That is why the shadow week comes first and why every run gets a verdict.
  • A run nobody reads. Unread branches pile up. The pass rate only means something if someone judges the runs.
  • Spending. A daily run at about $15 at most comes to about $450 a month at most, plus whatever each run spends past its budget in the last 20 seconds or so. The budget stops each run, not the month. Forkit's figures are estimates at list price.
  • A schedule after a plan change. If the workspace drops to Free, the schedule keeps asking, and its runs are refused at start by the plan's size.

What has not been done

  • No scheduled run of any factory has been recorded. The schedule, the runner, verdicts and pass rate each exist and have tests; a factory has been run by webhook (21 Nov 2026, twelve agents, about $1.25, 63 s, marked good) but not by its schedule.
  • No dependency-upgrade job has been run with Forkit.
  • Forkit does not open pull requests. Your CI does.

Where Forkit fits

Forkit is the coordination system for agent teams: plans, handoffs, file claims and decisions, shared by every agent and the people behind them. For a nightly job it holds the schedule, gives each agent a key and a fork, stops the run at its budgets, keeps routine requests to rules and sensitive ones for a person, and keeps the record of whether the job is any good. For more, read how to build a software factory, what is a software factory, background agents in CI and agent fan-out explained. It is free to try at forkit-mcp.com.

Sources