koh

@june

Koh is version control for the solo developer.

V

v3.8.7 · 297 saves · 13,847 lines · updated 3 days ago

103 files
HEAD
shell/7.0 KB · 6 days ago
src/614.8 KB · 3 days ago
apply/6.7 KB · 2 weeks ago
build/29.2 KB · 3 days ago
cli/182.2 KB · 3 days ago
args_test.v445 B · 2 weeks agoargs.vCommand line parsing.2.6 KB · 2 weeks agocli.vCommand line entry: dispatch table, usage text and exit codes.3.1 KB · 1 week agocmd_back_test.v4.0 KB · 6 days agocmd_back.vGoing back: koh undo, koh revert and koh load.9.7 KB · 2 weeks agocmd_build.vkoh build — build with koh.build, and upload nothing.2.6 KB · 2 weeks agocmd_diff.vkoh diff — unified diff of the working tree against a save, of one save against another, or across a session.3.3 KB · 2 weeks agocmd_doctor_test.v20.1 KB · 3 days agocmd_doctor.vRepository checks, remote verification, repairs and explicit maintenance.14.3 KB · 6 days agocmd_flag.vkoh flag — mark a save unsafe, clear the mark, or list what is marked.2.4 KB · 2 weeks agocmd_ignore.vBatch ignore toggles: plan from the original rules, then confirm one file replacement.6.3 KB · 1 week agocmd_init.vkoh init — write the .koh file and a default ignore list.964 B · 2 weeks agocmd_man.vkoh man — the manual, built into the binary.3.4 KB · 2 weeks agocmd_migrate.vkoh migrate — one-time conversion from Koh 2.4.3 KB · 2 weeks agocmd_offer.vkoh offer — send the local saves to this machine's remote, and, with --builds, publish a release built from them.7.0 KB · 1 week agocmd_peek.vkoh peek — put a save's tree in a temporary folder and print where.1.7 KB · 2 weeks agocmd_pluck.vkoh pluck — put one save's change onto the current tree.5.1 KB · 2 weeks agocmd_remote.vkoh remote — the machine's remote, set up once and used by every repo.14.1 KB · 1 week agocmd_save.vkoh save and koh checkpoint.2.9 KB · 2 weeks agocmd_status.vkoh status — where things stand: the save you are on, and what the working tree has that it does not.4.3 KB · 2 weeks agocmd_steal_test.v386 B · 2 weeks agocmd_steal.vkoh steal — bring another machine's saves in.18.8 KB · 1 week agocmd_strip.vkoh strip — remove a path from history, permanently.6.9 KB · 6 days agocmd_update.vkoh update — put a newer published koh in place of this one (§12).2.8 KB · 2 weeks agocmd_view.vkoh view — the history, browsed or printed.7.1 KB · 2 weeks agodoctor_checks.vDoctor's local history, event and working-tree checks.9.3 KB · 3 days agodoctor_remote.vRead-only remote inspection; Doctor never calls sync or the write probe.7.9 KB · 3 days agodoctor_repair.vDoctor's repairs (spec §7.6.2).8.3 KB · 6 days agohandover.vRefuse repository commands until a Koh 2 repository has been migrated.731 B · 1 week agooutput.vOutput for the command line: the ✦ / ✗ habit, and the --json shapes agents read.1.6 KB · 2 weeks agoprogress_test.v673 B · 1 week agoprogress.vThe line a long action draws while it works (§4, "never leave the person wondering"): one line on stderr, redrawn in place and cleared when the step ends, and only when stderr is a terminal, so pipes, logs and --json never see it.3.2 KB · 1 week agoprompt.vConfirmation shared by destructive commands.796 B · 6 days agorepo.vOpening the repo a command acts on, and the tree lookups commands share.949 B · 2 weeks ago
events/8.4 KB · 6 days ago
exchange/146.9 KB · 3 days ago
fmt/3.5 KB · 2 weeks ago
history/25.9 KB · 1 week ago
machine/8.2 KB · 2 weeks ago
migrate/31.8 KB · 1 week ago
release/13.8 KB · 1 week ago
remote/38.2 KB · 1 week ago
snapshot/39.9 KB · 6 days ago
storage/27.2 KB · 6 days ago
update/10.8 KB · 1 week ago
view/41.9 KB · 6 days ago
koh.vProgram entry: hands the command line to the CLI and exits with its code.257 B · 1 week ago
tests/98.3 KB · 6 days ago
vendor/9.4 MB · 2 weeks ago
build.shBuild one native Koh release into build/releases/koh-<target>.1.8 KB · 6 days agokoh.build129 B · 1 week agoREADME.mdKoh is version control for a solo developer working across a few machines.9.7 KB · 6 days agov.mod122 B · 3 days agoVERSION6 B · 3 days ago
fc918ffae554write <repo>/format on the first offer and refuse a remote that speaks another layout on offer, steal and clone (3.0.73)2 weeks agoc543b1f61ba2open the manual in the Koh website's voice and drop every mention of git (3.0.72)2 weeks ago8001f6686656rewrite the manual short and plain-spoken, correct its stale claims, and make koh man <command> return the whole entry with examples (3.0.71)2 weeks ago6554688b6256colour koh man and page it in-process like Koh 2: blue ◆ headings, amber commands and flags, Tab jumps between sections (3.0.70)2 weeks agod93d3d534fe8let Esc always step back and leave the view from the list, dropping a kept filter first, and stop unknown escape sequences counting as Esc (3.0.69)2 weeks ago4806e6424ec3spread seven entries evenly over the whole screen instead of leaving an empty band, about 15% tighter than Koh 2's six (3.0.68)2 weeks ago501b0f6898dfshow unselected entries as Koh 2 does, with only the mark and ID greyed, and sit the entries 15% tighter than Koh 2's spread (3.0.67)2 weeks agoebe6c3ba542amake q a letter while searching, so a search can start with q, and leave Esc as the way out (3.0.66)2 weeks ago7feada19c118record the history view rebuild and what is still unconfirmed in continuity2 weeks ago752b815dd4f5rebuild the history view on Koh 2's layout: evenly spaced entries that never wrap, HEAD marked and every other save a dot, the selected ID gold and the rest greyed, search only after /, q quits while searching, and flag or load only after the strict confirm (3.0.65)2 weeks agoa98160f0b963keep saves made within one second newest first in the all list, breaking the tie by write order instead of by hash (3.0.64)2 weeks ago55e1a2cc5c00record the live remote results on Mac and Linux, the Koh 3 migration of this repo and the open questions in continuity2 weeks agoc62238469b55send S3 requests over HTTP/1.1, because V's HTTP/2 client fails any upload that takes over five minutes and a big object on a slow uplink could never be offered (3.0.63)2 weeks ago24cf4587461bversion this repo with Koh 3 itself: AGENTS.md now points the discipline at the installed koh32 weeks ago81b27aa9028dgive each remote connection check its own probe key, so two machines setting up at once no longer report a broken remote (3.0.62)2 weeks agoef399328b6efrewrite the README around what Koh is for: version control designed for the solo developer2 weeks agoe6ac76b8f99aadd the Koh 3 zsh plugin, a prompt segment and completion built on status --json, which now reports saves, size_bytes and head_flagged (3.0.61)2 weeks agobea6866dbe3ename the clashing files when steal refuses without a terminal, and leave no half-made folder when a clone meets a damaged remote object (3.0.60)2 weeks ago7ca392923d38use the real tagline, version control designed for the solo developer, in koh's usage and man page (3.0.59)2 weeks ago45ca7519f2cdlet koh remote replace or repair the setting on a terminal, refuse credentials others can read, and document the hand-written config files (3.0.58)2 weeks ago6287b5567dc3record the live Scaleway S3 test results and the resolved query-encoding question in continuity2 weeks ago3d7e4a55ae63record the NixOS build steps in AGENTS.md and the Linux results and settled document decisions in continuity2 weeks ago2369295a09d8rename commit.v to save.v and its commit_* functions to save_worktree, save_walk and save_tree, dropping git vocabulary (3.0.57)2 weeks agoa1b805301c6ffix the binary reporting 3.0.52: bring VERSION back in step with v.mod and test that they match (3.0.56)2 weeks ago336a06b3d11frecord the pin guard's discrimination and this repo's missing remote in continuity2 weeks agoc1e412b7aed8record the V pin, both blockers and the green runs in continuity2 weeks ago89802377db7areformat nine files for vfmt at V b9a2d87 (3.0.55)2 weeks ago56ab9cab6ad2make Koh 3 build and pass on V b9a2d87: json2 for the removed json module, src/exchange for the module that shadowed V's sync, the pin written down and guarded (3.0.54)2 weeks ago9396ba8479a4fix steal's none check so newer V accepts it (3.0.53)2 weeks agob31bea007973write the pin V handoff steps into continuity before the usage limit2 weeks agoe22f7a5c103crecord in continuity why pinning V stopped: steal.v fails to build on V b9a2d872 weeks ago01a3746fce34unwrap history.head with a test helper instead of ! on an option (3.0.52)2 weeks ago81f91e956b53rename a test variable that shadowed the events module (3.0.51)2 weeks ago5b8c8b06278brename the sql parameter in the SQLite C declarations — sql is a keyword on newer V (3.0.50)2 weeks agobd73a0660022record the reliability campaign's fixes, decisions for June and measured limits in continuity2 weeks ago2752ddfbc874name the checkpoint that holds what revert discarded, recording both in one transaction (3.0.49)2 weeks agofcd909830822report usage errors as JSON on stderr when --json is given, as the document asks (3.0.48)2 weeks agocb84f9ea35c4send S3 ETags back exactly as the server gave them, so offers keep landing on a server that follows RFC 7232 (3.0.47)2 weeks agoe18607779731read the tree again under the lock when head moved during a save, so a save can never undo a steal or undo that landed meanwhile (3.0.46)2 weeks ago6c588d6233e4refuse a folder remote that is not there instead of creating a stand-in at an unmounted disk's path (3.0.45)2 weeks ago15b6b8d6c6d5let migrate accept a clean Koh 2 tree holding files Koh 2 never saved or saved under a later folder rule, so real repos migrate (3.0.44)2 weeks agoba25a6819e6fsay how to finish a restore the moment it stops part way, not to retry it (3.0.43, codex review pending)2 weeks ago4d41f88e04edlet status run while another koh command writes, and say so plainly when a write has to wait too long (3.0.42, codex review pending)2 weeks ago1a8e4215f494offer only the objects each save adds over its parent, so an auto-offer costs one write per changed file, not per file (3.0.41, codex review pending)2 weeks agocc776360f741name the previous head after a combine so an agent can load the pre-combine tree back, and correct the man page's steal refusal (3.0.40, codex review pending)2 weeks agof14336a4a1c3mark a restore before its save is recorded and name it when status cannot walk, closing 3.0.31's codex review (3.0.39)2 weeks agoa34d063b3d6fjudge racy cache rows by the newer of mtime and ctime, closing 3.0.29's codex review (3.0.38)2 weeks ago702789575895record the offered head in state as offer's step 3 asks, closing 3.0.22's codex review (3.0.37)2 weeks ago889212052e9dpin the replay count and the kept originals in the undone-edit combine test, closing 3.0.27's codex review (3.0.36)2 weeks agoe6da6d4397fcreport a clone's flagged saves with their reasons in text and JSON, closing 3.0.20's codex review; drop the flagged_ids helper this orphaned (3.0.35)2 weeks ago

← newerolder →

details

Koh

Koh is version control for a solo developer working across a few machines. Save your project, see what changed, and bring back earlier work when you need it. Each repository keeps its history in one SQLite file, .koh, with one line of saves. Koh is written in V.

Install

Koh runs on Apple silicon macOS and Linux on ARM64 or x86_64. New releases do not support Intel macOS or Windows.

curl -fsSL https://koh.asha.software/install.sh | sh

The installer verifies the release checksum and offers an optional zsh plugin. For later updates, run koh update. Use koh update --check to check without installing.

Start saving

Run these commands in your project folder:

koh init
koh save "record the first working version"
koh status
koh view

init creates .koh and a starter .kohignore. Check the ignore rules before your first save. Each save snapshots every file Koh tracks, including new files; unchanged contents are stored only once. save refuses when nothing changed.

Before a change you may want to undo, make a checkpoint:

koh checkpoint "before changing the parser"

A checkpoint records the project even when nothing changed. After editing, koh diff shows the changes and koh save "describe the result" records them. Commands work from subfolders too.

koh view opens an interactive history browser in a terminal. Use the arrow keys or j and k to move, / to search, Enter for details, and Tab to switch between saves and checkpoints. With --json or when piped, it prints history. LOG.md is a generated summary of the latest 20 saves.

Bring back earlier work

Command What it does
koh undo Restore the previous save.
koh undo 3 Step back three saves.
koh load <id> Restore a particular save.
koh load --checkpoint Restore the latest checkpoint.
koh revert Discard unsaved changes, keeping them in a checkpoint first.
koh peek <id> Unpack a save into a temporary folder for inspection.
koh pluck <id> Apply one save's changes to the current tree as a new save.

Restoring earlier work adds a new save. The saves you stepped away from remain available, so you can load them again. Koh has no branches or lanes.

undo, load, and pluck require a clean working tree. Commands that rewrite your files show a preview and ask for confirmation. Enter cancels; only y or Y approves. Scripts must supply --yes to approve the action.

Sync your machines

Choose an S3 bucket or a folder remote once per machine. Every repository on that machine uses the same remote.

For a folder, such as one on a removable drive:

koh remote folder /Volumes/usb/koh

For S3, supply the endpoint, bucket, and region. Koh asks for the access keys and tests the connection before keeping the settings:

koh remote s3 https://s3.fr-par.scw.cloud my-bucket fr-par

If you run a Kepr, koh remote <kepr-host> opens its sign-in page and lets you connect with the code it supplies. koh remote shows the current setting. Replacing or forgetting an existing remote requires consent.

Once configured, saves and checkpoints offer their history automatically. A failed transfer leaves the local save intact; run koh offer to retry. On another machine, fetch a repository from outside an existing repo:

koh steal my-project
cd my-project

Inside it, koh steal brings in new history. If both machines changed a file, Koh shows both versions and asks which one to keep. It resolves clashes per file, without blending lines. The original saves remain available, and the result names the save you can load to return to your previous state.

Incoming changes require confirmation. For scripts, --mine or --theirs chooses a side for every clash; --yes separately approves applying the changes.

You can also fetch a public repository with koh steal <kepr-host>/<repo>. That copy syncs from its public source and cannot offer back until you sign in to that Kepr as its operator.

Ignore files and remove saved content

.kohignore holds rules for the repository and travels with its saves. ~/.kohignore adds rules for every repository on this machine and stays local. Koh also excludes its own history files, LOG.md, and symlinks.

koh ignore cache/ output/ notes.txt
koh ignore --global scratch.txt

ignore previews the exact rules and asks once for the batch. A path already matched in the selected ignore file proposes removing its matching rules; removing a broad rule can affect other files, which the preview explains. Local paths are relative to the current directory. Global names and paths match at any depth in every repository.

Ignoring a file leaves its earlier saved versions in history. koh strip <path> permanently removes a file or folder from all saves and bans that path from future saves. It propagates the removal to the remote and other machines as they sync. The working file stays on disk. --save <id> limits removal to one save and does not ban the path.

Strip is the exception to Koh's growing history: it cannot be undone. It requires a terminal and each affected path typed exactly. --yes skips only the yes/no question. See koh man strip before using it.

Work with coding agents

Saves can record the agent's model and a session name:

koh save --agent gpt-6 --session "fix parser errors" "reject incomplete input"
koh view --session "fix parser errors" --json
koh diff --session "fix parser errors"

koh undo --session restores the state before the current session. Use the actual model identifier and keep one session name for related work.

Commands that print data support --json. Koh refuses when a required prompt cannot be answered, so unattended commands never wait for input. Exit codes are 0 for success, 1 for refusal or failure, and 2 for bad usage.

Build projects and publish releases

A project's koh.build file names its build command, output, and platforms. koh build runs it for the current machine without uploading or installing anything. The toolchain must already be on PATH.

koh offer --builds builds every configured platform and publishes the artifacts as a release. It requires a saved tree and a version in the project's own files, such as VERSION, v.mod, or package.json. Ordinary saves never publish builds. See the specification for the file format, and koh man build or koh man offer for command options.

Back up a repository

koh doctor
koh doctor --backup /path/to/new-backup.koh

doctor checks the database, stored content, history, events, working files and configuration. It also verifies remote history and release files by default. Use --fast for a local check. The report names each check, its result, and any part it could not verify. A failed check says how to fix it, and Doctor offers to repair what it can without losing anything: on a terminal it asks first, and --yes runs every repair. Its backup command writes a consistent copy of .koh. Use it instead of copying the database while Koh is using it. Keep a live .koh out of cloud folder sync services; use offer and steal between machines.

Koh does not encrypt history. Anyone who can read the database or remote can read its saved files. Koh is intended for code and text; individual files over 512 MiB are refused.

Upgrade from Koh 2

Save unfinished work with Koh 2 first. Run koh update in a terminal and confirm the upgrade, then run koh migrate in each repository.

Migration keeps save IDs and archives the old repository in .koh-v2/. It imports the dev ancestry by default, falling back to main if dev has no saves; --lane main selects the other line. Koh 3 refuses repository commands in an unmigrated Koh 2 repository. See koh man migrate for missing file recovery and other options.

Build from source

Use the pinned compiler, V 0.5.2 b9a2d87. A different V revision can break Koh, and the tests reject it.

To compile V, install a C compiler and extract the V source archive. Copy v.c from the vc bootstrap archive into the extracted V directory, then run these commands there. The vc revision is pinned too because newer bootstraps can be incompatible with this V source.

mkdir -p .git
printf '%s\n' b9a2d87bc6c317739113db1d96ca89a05f8903f4 > .git/HEAD
cc -O2 -w -o v1 v.c -lm -lpthread
./v1 -o v2 cmd/v
./v2 -o v cmd/v
./v self
./v version

The .git/HEAD file lets V report the pinned revision when built from an archive. Add the directory containing the resulting v executable to PATH. From Koh's repository root, compile Koh with:

mkdir -p build
v -d use_bundled_libgc -o build/koh3 src/koh.v

The flag builds the GC library from V's bundled source. SQLite 3.49.1 is vendored and compiled into the executable. Every Koh build requires Boehm garbage collection. Release builds use sh build.sh or koh build on the target OS and CPU. Linux releases use the host C compiler (cc) and static C runtime libraries. Install the toolchain's static runtime development package if needed. Zig is not required. Cross-compiling Koh with the pinned V disables garbage collection, so the release script refuses it.

Manual and shell integration

Run koh man for the full manual or koh man <command> for one command. The manual source is also available in this repository.

Source shell/koh3.plugin.zsh from ~/.zshrc for a prompt segment and tab completion. ! marks unsaved changes; ⚑ marks a flagged head save. The plugin's header covers custom prompts, Starship, and Powerlevel10k.

Made by Asha Software.