A backend developer kept an agent loop on a laptop while a large monorepo index rebuilt for the third time that afternoon. The loop needed a fresh file map before it could propose a narrow refactor, and the fan was already loud. A free remo...
A backend developer kept an agent loop on a laptop while a large monorepo index rebuilt for the third time that afternoon. The loop needed a fresh file map before it could propose a narrow refactor, and the fan was already loud. A free remote server could finish that index sooner, yet the working tree still held environment files and a customer fixture. Moving the whole job would save minutes and could also copy material that never belonged on another machine.
The placement problem is a budget, not a slogan
Local-first agent work fails in two opposite ways when a team treats placement as a mood rather than a measurement. A fully local loop protects secrets and survives a dead network, but a heavy index can miss the afternoon budget. A fully remote loop hides that delay and then strands the job when the link drops or a secret rides along. The practical split measures a connect sample, classifies each path, and sends only scaffold work to another machine.
What this draft does and does not claim
MonkeyCode enters the workflow only as an operator-supplied option for free model access and a free server, not as a measured ranking. Disclosure: This article was prepared as part of MonkeyCode's product outreach. The operator also describes the project as open source, while this draft refuses invented model names, token quotas, hardware sizes, and permanence claims. Any current limit should be read from the product documentation on the day an operator configures the placement gate.
Signals the gate is allowed to see
The gate in this draft reads three signals and ignores vanity metrics such as star counts or leaderboard ranks. Connect time is a single TCP sample to a host taken from current documentation, and it is not a throughput test. Path class marks a file as secret, scaffold, ordinary, or unknown before any byte is queued for transfer. Offline state is a boolean lease: when the lease is closed, even a fast server loses to the local loop.
How the columns decide a step
A secret or unknown path never leaves the laptop, even when the index rebuild is the slowest step in the afternoon. An ordinary edit stays local because round-trip delay usually costs more than the small diff the agent wants to inspect. Scaffold files, such as generated maps and lock summaries, may use the free server only when the offline lease is open. That remote choice also requires the local estimate to miss its budget while the connect sample still looks cheaper.
Path class
Offline lease
Local estimate versus budget
Placement
Secret or unknown
Any
Any
Stay on the laptop
Ordinary edit
Any
Any
Stay on the laptop
Scaffold only
Closed
Any
Stay on the laptop
Scaffold only
Open
Estimate within budget
Stay on the laptop
Scaffold only
Open
Estimate over budget and sample cheaper
Free server for that step
The table is a policy sketch for one step, and it should be stored next to the job rather than buried in a chat scroll. A row wins only when every column matches, which stops a fast sample from overriding a secret label. Operators can add rows for their own scaffold suffixes, but they should not add a row that sends unknown paths away. The later code encodes the same rules so a fixture can fail when someone edits one side and forgets the other.
Step 1: Sample reachability without uploading the tree
The first command opens a short TCP connection and prints either a millisecond sample or an offline marker. It does not walk the repository, does not archive the working tree, and does not attach credentials to the socket. Operators should replace the placeholder host with the host named in the current product docs before they trust the number. A failed connect closes the offline lease for that run and forces every later step to remain local.
python - str:
name = Path(path).name.lower()
if name in SECRET_NAMES or any(part in name for part in SECRET_PARTS):
return 'secret'
if name.endswith(SCAFFOLD_SUFFIXES):
return 'scaffold'
if name.startswith('.'):
return 'unknown'
return 'ordinary'
This classifier is proposed example code, and it has not been executed against the account's repositories for this draft. Name matching misses secrets embedded inside ordinary source files, so a positive ordinary label is not a clearance to upload a whole directory. The safe use is a per-step path list that an operator already trimmed down to the files that step will read. A step with mixed classes inherits the strictest class, which keeps one secret file from pulling a large scaffold upload off the laptop.
Step 3: Compare the local estimate with the sample
The local estimate is an operator-entered millisecond budget for the step, taken from a previous local run or a deliberate guess labeled as such. This draft does not publish timings, because no controlled run was supplied with the account history used for context. Remote cost is modeled as two connect samples plus a fixed queue allowance of 150 milliseconds, and that formula is a proposal rather than a benchmark. If the offline lease is closed, the comparison is skipped and the placement remains on the laptop for that step.
QUEUE_ALLOWANCE_MS = 150 # proposed constant, not a measured service level
def remote_cost_ms(connect_ms: int) -> int:
return connect_ms * 2 + QUEUE_ALLOWANCE_MS
def choose_placement(path_class: str, offline: bool, local_ms: int, budget_ms: int, connect_ms: int) -> str:
if path_class in {'secret', 'unknown'} or offline:
return 'local'
if path_class != 'scaffold':
return 'local'
if local_ms None:
for path_class, offline, local_ms, budget_ms, connect_ms, expected in FIXTURE:
got = choose_placement(path_class, offline, local_ms, budget_ms, connect_ms)
if got != expected:
raise SystemExit(f'mismatch:{path_class}:{got}:{expected}')
print('fixture_ok')
if __name__ == '__main__':
assert_fixture()
Saving the earlier snippets together as placement_budget.py checks the policy table with no network access and no home-directory reads. The numbers are illustrative inputs for the proposal, not results from a free server or a local model. Changing the queue allowance will change the second row, which is a reason to keep that constant in one place. Teams that adopt the snippet should replace the fixture with path lists from their own repository before they trust a label.
When the free server is the better room
The free server option wins for disposable scaffold work only when three conditions hold at the same time. The step paths are scaffold only, the offline lease is open, and the local estimate misses a budget that the connect sample can still beat. Typical candidates include generated file maps, lockfile summaries, and public dependency graphs that can be deleted and rebuilt. Interactive edits, secret-bearing fixtures, and any path the classifier cannot name should remain on the laptop even if the fan is loud.
Free model access is a separate dial from placement, and it does not make a secret file safe to attach. An operator can keep files on disk and send only a trimmed prompt to the free model access path. That choice still needs a network for the model call, so a closed offline lease should skip remote model hops as well. Neither dial should be treated as a quota promise, a hardware promise, or a reason to skip the path check.
Limitations and who should skip the remote branch
The classifier is a filename policy, so it will miss secrets pasted into source files, notebooks, or logs with ordinary names. A connect sample says nothing about bandwidth, queue depth, or whether the free server option is still offered that afternoon. The 150 millisecond allowance is a teaching constant, and copying it into production without local measurements would fake a precision this draft does not have. Air-gapped networks, regulated repositories, and any tree where scaffold files may contain customer data should not use the remote branch.
Operators who need a contractual uptime target, a named region, or a guaranteed token allotment will not find those promises in this workflow. The gate also does not solve overlapping edits, host sleep, or schema drift between model hops, which are separate problems with their own checks. A team that cannot review the path list before a hop should keep the agent local until that review exists. Disposable scratch indexes are the intended first trial, not production customer trees and not repositories full of private fixtures.
Keep the budget next to the job
A placement label is useful only when it sits beside the path list, the connect sample, and the offline lease for that run. The afternoon monorepo case becomes a narrow remote index job, while the environment file and the customer fixture never enter the copy set. Readers who want free model access or the free server option should confirm current docs, then run this gate on a scratch repository. The workflow remains a local-first budget even if that product option is removed from the story.