Skip to content

About

Hybrid local/cloud coding workflow: your cloud model plans and reviews, a local model implements in an isolated git worktree. Cut token spend on mechanical work without lowering the bar.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

code-local

Your cloud model plans and reviews. Your local model types.

code-local is a hybrid local/cloud coding workflow. The big model you already pay for stays where it earns its keep — architecture, judgement, code review — and hands the mechanical work to a model running on your own hardware. The local worker writes the code in an isolated git worktree. Your reviewer reads the real diff and decides.

You get the same quality bar, and the typing costs you nothing.

Cloud model thinks.   Local model implements.   Git isolates.
Tests validate.       Cloud model reviews.      Local model repairs.

Why you'd want this

Most coding work isn't thinking — it's typing. Writing the fifth test case, renaming an internal API across thirty call sites, working through a backlog of type errors. That work still needs doing well, but it doesn't need a frontier model, and it burns real tokens when you send it to one.

code-local splits the job along that seam:

  • Cut token spend on mechanical work. Implementation passes, test suites and repetitive refactors run entirely on your own hardware. Your cloud budget goes to decisions rather than keystrokes.
  • Keep the quality bar. The local model never decides anything. It receives a specification your cloud model wrote and returns a diff your cloud model reads.
  • Your code stays on your machine. The worker runs against a local endpoint. Nothing leaves the box.
  • Run several at once. Independent tasks fan out across parallel workers, each in its own worktree.
  • Nothing lands unreviewed. The worker commits to its own branch. Merging is always a human decision.

The idea that makes it trustworthy

A worker's summary is navigation assistance. Git is the evidence.

A model saying "all tests pass" is a claim. What the repository actually contains is a fact. Every result code-local produces keeps those apart:

{
  "worker_claim": { "files_changed": ["parser.py"] },
  "verified":     { "files_changed": ["parser.py", "config.py"],
                    "claim_vs_git_discrepancies": ["config.py: changed but not claimed"] }
}

worker_claim is what the model said. verified is recomputed from git diff <base>...<head>. They are never merged, and a worker that misreports its own work gets caught rather than believed.

The same idea drives review_flags — "made no commits", "touched files outside scope", "tests were deleted" — which tell your reviewer where to look first. They never replace looking.


Install

Requires Python 3.9+, git, one agent runtime, and a local model server.

git clone https://github.com/localaiguyy/code-local-skill.git
cd code-local-skill
./install.sh          # puts `code-local` on your PATH
code-local doctor     # verifies the whole chain

Supported agent runtimes

Runtime Isolation it can enforce
pi extensions disabled, explicit tool allowlist, scrubbed env
codex OS-level sandbox (read-only / workspace-write), scrubbed env

code-local autodetects whichever is installed. Force one with --runtime pi or --runtime codex.

⚠️ The two are not equivalent, and doctor tells you exactly how. Pi can remove tools outright; Codex has no tool allowlist and keeps built-in web access even with user config ignored. Codex, in exchange, offers a real OS sandbox that Pi does not. Read doctor output rather than assuming — an overstated guarantee is worse than a documented gap.

Supported model servers

Anything OpenAI-compatible. These are found automatically:

Server Port probed
vLLM / generic OpenAI-compatible 8000
Ollama 11434
LM Studio 1234
llama.cpp 8080
text-generation-webui 5000
LocalAI 8081

Non-standard setup? export LOCALFORGE_BASE_URL=http://host:port/v1. The model ID is read live from /v1/models, so there is nothing to keep in sync.


Use it

The intended way is through your coding agent: drop skill/ in as a skill and say "delegate this". Your agent writes the spec, delegates, reviews the diff and reports back.

Driving it by hand:

code-local start --repo . --spec spec.md      # implement (blocks ~1-3 min)
code-local review <task-id> --diff            # diff + flags
code-local audit  <task-id>                   # optional adversarial review
code-local continue <task-id> --spec fix.md   # correction pass, same session
git merge --no-ff codelocal/<task-id>         # you decide

Run independent work in parallel:

code-local start --repo . --spec a.md --detach
code-local start --repo . --spec b.md --detach
code-local wait --all

Every command prints JSON.


The adversarial auditor

code-local audit <task-id> sends a second, independent worker at the first one's diff. It gets its own worktree, is read-only (it may run tests, never edit them), and is asked to falsify the work — above all to answer the question that matters most about a test suite:

Would this test fail if the implementation were wrong?

Read-only is the point. An auditor that could edit might quietly fix a defect and destroy the evidence it ever existed.

It returns findings with severity, file, line, a concrete failure scenario and a confidence level. Its findings are claims too — verify before acting.


Safety

  • The worker only ever runs in its own git worktree, on its own branch, from a recorded base commit. Your working tree is never touched — a dirty tree is fine, since the worker branches from a commit and simply cannot see it.
  • Credential-shaped environment variables are stripped before launch.
  • The worker cannot push, open pull requests, or deploy.
  • cleanup refuses to discard uncommitted work or delete an unintegrated branch without an explicit --force.
  • Isolation is enforced by command-line flags, not prompt text. A worker asked politely not to touch something is not a worker that cannot.

Configuration

Zero config is the intended path. Everything below is optional.

Variable Meaning
LOCALFORGE_BASE_URL endpoint (default: autodetect)
LOCALFORGE_MODEL model id (default: whatever the server serves)
LOCALFORGE_RUNTIME pi | codex (default: autodetect)
LOCALFORGE_MAX_PASSES correction-loop ceiling (default 5)
LOCALFORGE_TIMEOUT seconds per pass (default 3600)

Or drop a .localforge.toml in your repo:

base_url = "http://localhost:8000/v1"
runtime  = "pi"
max_passes = 5

When not to use it

Delegation costs a worktree, a spec and a review cycle. Do it yourself when:

  • it's a typo, a rename, or a one-line change you already know how to make
  • writing the spec would cost more than writing the code
  • it's architecture, security, migrations, or dependency choices — those are yours by definition, however large

The test is: have I already made every decision that matters, so what's left is competent typing? If yes, delegate. If deciding is still happening, keep it.


License

MIT

About

Hybrid local/cloud coding workflow: your cloud model plans and reviews, a local model implements in an isolated git worktree. Cut token spend on mechanical work without lowering the bar.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages