Git-backed versioning of watched content. The VCS subsystem maintains a forward-only history of file changes in each watch root, with throttled batch commits, AI-generated commit messages, squash retention, and optional remote push.
Git terminology is used throughout, since this is an operator-facing feature.
Each VCS-enabled watch path gets a git repository at its root (the static directory prefix of the glob, e.g. d:/documents for d:/documents/**/*.md), initialized automatically at startup if it does not exist. Several globs with the same root share one repository. This keeps histories isolated: a revert in one root never affects another.
At startup each repository also gets its local git identity (user.name / user.email, from the author setting below) and the always-on .gitignore entries.
File changes are collected into batches rather than committed individually. The commit pipeline uses two controls:
commitThrottleMs (default: 30000): after the first file change, wait this long before committing. New changes during the interval are batched but do not reset the timer.maxBatchSize (default: 1000): if the pending set reaches this size, flush immediately without waiting for the throttle timer. Overflow files roll into the next commit cycle.Commit messages are baseline: batch (<n> files) for commits made during the initial filesystem scan, otherwise an AI-generated message or the template watcher: batch <ISO timestamp> (<n> files).
On shutdown, each root commits its pending files before the service exits.
Reverting a file restores its content from a historical commit via git show, then writes the old content back to disk as a new change. HEAD never moves backward: the restored content becomes a new commit in the forward-only timeline.
VCS receives the same file events as the embedding pipeline: files that match watch.paths, are not excluded by watch.ignored and (with the default watch.respectGitignore: true) are not git-ignored. Events reach VCS before extraction, so a file the watcher cannot embed (e.g. a binary or unsupported format matched by a watch glob) is still versioned. Version history and the vector index keep separate state.
An ignored path never fails a batch. Each batch is split by one tracked check (git ls-files): files git already tracks stage with git add -u, which records their changes even under an ignored folder (#279); new files are filtered by git check-ignore first, so a git-ignored new file is simply not added. Paths always reach git literally, so a[1].md never stands for a1.md.
vcs.maxFileBytes (default 100 MB, under GitHub's 100 MiB file limit; 0 disables) caps what git versions. A new file over the cap is not staged. A tracked file that grows past it is untracked in a commit of its own (watcher: untrack N files over vcs.maxFileBytes), made just before the batch commit: its history ends at its last committed version, and the file stays on disk. A tracked file already over the cap (from an earlier version, or after the cap is lowered) is untracked the same way the next time it is processed, at the latest at the next start, whose walk enqueues every file. Each over-cap path is warned about once per process (again if it drops under the cap and grows back). The value is read at each staging, so a config change applies without a restart.
vcs Block{
"vcs": {
"enabled": true,
"commitThrottleMs": 30000,
"maxBatchSize": 1000,
"branch": "master",
"author": {
"name": "jeeves-watcher",
"email": "watcher@localhost"
},
"commitMessage": {
"enabled": true,
"provider": "anthropic",
"model": "claude-haiku-5-5",
"apiKey": "${ANTHROPIC_API_KEY}"
},
"retention": {
"maxAgeDays": 30,
"maxVersions": 100,
"squashCron": "0 0 * * *"
},
"defaultAccessToken": "${GIT_ACCESS_TOKEN}",
"staleLockThresholdMs": 60000,
"maxConsecutiveFailures": 5,
"circuitBreakerCooldownMs": 300000
}
}
| Field | Type | Default | Description |
|---|---|---|---|
enabled |
boolean |
false |
Enable VCS tracking globally. |
commitThrottleMs |
number |
30000 |
Throttle interval in milliseconds for batching commits (min: 1000). Timer starts on first change and does not reset. |
maxBatchSize |
number |
1000 |
Max files per commit batch (min: 1). Overflow rolls to next cycle. |
maxFileBytes |
number | string |
100000000 |
Size cap for versioned files: bytes, or a string with a k, m or g suffix (binary units, e.g. "50m"). 0 disables. Read at each staging. |
branch |
string |
"master" |
Git branch name for VCS operations. Squash retention and the startup branch check target this branch instead of dynamically detecting the current branch. |
author |
object |
See below | Git commit identity, written to each repository's local git config at startup. |
author.name |
string |
"jeeves-watcher" |
Commit author name. |
author.email |
string |
"watcher@localhost" |
Commit author email. |
commitMessage |
object |
See below | AI commit message generation settings. |
commitMessage.enabled |
boolean |
true |
Enable AI-generated commit messages. Falls back to template on failure. |
commitMessage.provider |
string |
"anthropic" |
LLM provider for commit messages. |
commitMessage.model |
string |
"claude-haiku-5-5" |
Model name. |
commitMessage.apiKey |
string |
undefined |
API key. Supports ${ENV_VAR} substitution. Falls back to the OpenClaw gateway config if omitted (see Auth Resolution). |
retention |
object |
See below | Squash retention settings. |
retention.maxAgeDays |
number |
30 |
Squash commits older than this (min: 1). |
retention.maxVersions |
number |
100 |
Keep at most this many commits on top of the squashed baseline (min: 1). |
retention.squashCron |
string |
"0 0 * * *" |
Cron schedule for squash retention (5-field format, host local time). |
defaultAccessToken |
string |
undefined |
Shared access token for remote push. Supports ${ENV_VAR} substitution. |
staleLockThresholdMs |
number |
60000 |
Age in ms after which an index.lock is considered stale and force-removed (min: 5000). |
maxConsecutiveFailures |
number |
5 |
Circuit breaker: trip after this many consecutive commit failures (min: 1). Pending files are retained. |
circuitBreakerCooldownMs |
number |
300000 |
Cooldown in ms before a tripped breaker makes a single recovery attempt (min: 1000). |
A watch path can be an object with a vcs block that overrides VCS settings for that root and adds root-specific remote and accessToken:
{
"watch": {
"paths": [
{
"path": "d:/documents/**/*.md",
"vcs": {
"enabled": true,
"remote": "https://github.com/org/docs-backup.git",
"accessToken": "${DOCS_GIT_TOKEN}",
"commitThrottleMs": 10000,
"maxBatchSize": 500
}
},
{
"path": "d:/logs/**/*.log",
"vcs": {
"enabled": false
}
},
"d:/notes/**/*.txt"
]
}
}
| Field | Type | Default | Description |
|---|---|---|---|
remote |
string |
undefined |
Git remote URL for this root. |
accessToken |
string |
undefined |
Access token for this root's remote. Overrides defaultAccessToken. Supports ${ENV_VAR} substitution. |
String-only watch paths inherit the root-level vcs config. In an object entry's vcs block, the per-root block is validated with the same schema defaults as the root-level block, so every setting that has a default and is omitted takes that default, not the root-level value:
enabled defaults to false: an object entry must set "enabled": true to be versioned, even when vcs.enabled is true.commitThrottleMs, maxBatchSize, branch, staleLockThresholdMs, maxConsecutiveFailures and circuitBreakerCooldownMs likewise fall back to their defaults, so repeat any root-level value you changed.author, commitMessage and retention have no default: when omitted they are inherited from the root-level block (each replaces the root-level object as a whole when set). accessToken falls back to defaultAccessToken.maxFileBytes has no schema default either: when omitted it is the root-level value, else 100 MB.vcs.enabled must still be true at the root level for any root to be versioned.
Caution:
GET /configreturns thewatchblock as loaded, so a per-rootvcs.accessTokenis visible there (after${ENV_VAR}substitution) to any API caller. The root-levelvcsblock (includingdefaultAccessTokenandcommitMessage.apiKey) is never returned. PreferdefaultAccessTokenand protect the API withapi.apiKey.
String config values support ${ENV_VAR} syntax, resolved at startup. A reference to an unset variable is left as the literal text (only api.apiKey and sources fail the startup on an unresolved reference):
{
"vcs": {
"commitMessage": {
"apiKey": "${ANTHROPIC_API_KEY}"
},
"defaultAccessToken": "${GIT_ACCESS_TOKEN}"
}
}
All VCS endpoints are prefixed with /vcs. See the API Reference for the full endpoint documentation alongside the rest of the HTTP API.
The routes are always registered. When vcs.enabled is false, GET /vcs/status reports enabled: false with no roots and every other route answers 404 WATCHER_NOT_FOUND. When api.apiKey is set they require Authorization: Bearer <key> like every other route except GET /status.
Errors use Fastify's standard error body ({ statusCode, code?, error, message }, v0.22.0+; see Error Handling):
| Status | code |
When |
|---|---|---|
400 |
FST_ERR_VALIDATION |
A required parameter is missing or has the wrong type. |
400 |
WATCHER_INVALID_REQUEST |
/vcs/exclude refused the pattern (The exclude glob is refused: <reason>). |
404 |
WATCHER_NOT_FOUND |
The path or glob is outside every VCS-enabled root; root is not a VCS-enabled root; the file does not exist at the commit (/vcs/show); the pattern to remove is in neither .git/info/exclude nor its 0.20.0 .gitignore (/vcs/exclude). |
503 |
WATCHER_NOT_AVAILABLE |
/vcs/exclude waited 30 s for the root lock (Retry-After: 30; Version control is busy on this root; retry after 30 s.). |
500 |
none | An unexpected failure: the masked body, message: "The server could not complete the request.", the cause logged. |
/vcs/exclude over the 100-file threshold without confirm: true is not an error: it answers 200 { "confirmRequired": true, "untracked": <n> } (v0.22.0+; was 409 confirm_required).
Paths and globs are absolute. A glob is resolved to the root(s) it falls under and passed to git relative to that root as a pathspec, so git's wildcard rules apply: * also matches / (docs/*.md matches nested files too), while docs/**/*.md requires at least one subdirectory.
VCS state for all roots.
curl http://localhost:1936/vcs/status
{
"enabled": true,
"roots": [
{
"path": "d:/documents",
"tracked": 152,
"lastCommit": {
"hash": "a1b2c3d4e5f60718293a4b5c6d7e8f9012345678",
"message": "update project notes and readme",
"timestamp": "2026-06-10T14:30:00+00:00"
},
"remoteUrl": "https://github.com/org/docs-backup.git",
"lastPush": "2026-06-10T14:30:05.000Z",
"pushErrors": [],
"breaker": {
"consecutiveFailures": 0,
"tripped": false,
"trippedAt": null,
"lastError": null,
"pendingCount": 0
}
}
]
}
| Field | Type | Description |
|---|---|---|
enabled |
boolean |
Whether any root is versioned. |
roots |
array |
Per-root VCS state. |
roots[].path |
string |
Watch root path. |
roots[].tracked |
number |
Number of commits on the current branch (git rev-list --count HEAD; 0 before the first commit). |
roots[].lastCommit |
object | null |
Most recent commit (null if no commits yet). |
roots[].lastCommit.hash |
string |
Full commit hash. |
roots[].lastCommit.message |
string |
Commit subject. |
roots[].lastCommit.timestamp |
string |
ISO-8601 author date, with the committer's UTC offset. |
roots[].remoteUrl |
string | null |
Configured remote, else the repository's origin URL, else null. |
roots[].lastPush |
string | null |
ISO-8601 timestamp of the last successful push since startup. |
roots[].pushErrors |
array |
Push failures since startup, oldest first, each { timestamp, message } (token redacted). Not cleared by a later successful push. |
roots[].breaker |
object | null |
Commit circuit breaker state (null if the root has no manager). |
roots[].breaker.consecutiveFailures |
number |
Consecutive commit failures since the last success. |
roots[].breaker.tripped |
boolean |
Whether the breaker is tripped (cooling down). |
roots[].breaker.trippedAt |
string | null |
ISO-8601 timestamp of the current trip. |
roots[].breaker.lastError |
string | null |
Message of the most recent commit failure. |
roots[].breaker.pendingCount |
number |
Files queued or in flight, not yet committed. |
Commit history for files matching a glob.
curl "http://localhost:1936/vcs/history?glob=d:/documents/*.md&limit=10&since=2026-06-01T00:00:00Z"
| Param | Type | Default | Description |
|---|---|---|---|
glob |
string |
Required | Path or glob pattern to filter history. |
since |
string |
undefined |
Lower date bound, passed to git log --since (ISO-8601 or any git date string). |
until |
string |
undefined |
Upper date bound, passed to git log --until. |
limit |
number |
20 |
Max entries to return. |
[
{
"commit": "a1b2c3d4e5f60718293a4b5c6d7e8f9012345678",
"message": "update project notes and readme",
"timestamp": "2026-06-10T14:30:00+00:00",
"files": ["projects/readme.md", "projects/notes.md"]
},
{
"commit": "e4f5a6b7c8d90a1b2c3d4e5f60718293a4b5c6d7",
"message": "add meeting transcript",
"timestamp": "2026-06-09T09:15:00+00:00",
"files": ["meetings/2026-06-09.md"]
}
]
| Field | Type | Description |
|---|---|---|
commit |
string |
Full commit hash. |
message |
string |
Commit subject. |
timestamp |
string |
ISO-8601 author date. |
files |
string[] |
Files changed in this commit that match the glob, relative to the root. |
When the glob covers several roots, their entries are merged, sorted newest first and cut to limit; entries do not name their root. A root whose git log fails (e.g. no commits yet) contributes nothing.
Retrieve file content at a specific commit.
curl "http://localhost:1936/vcs/show?path=d:/documents/readme.md&commit=a1b2c3d"
| Param | Type | Description |
|---|---|---|
path |
string |
Required. Absolute file path. |
commit |
string |
Required. Commit hash (full or abbreviated) or any git revision. |
The file content as text, with a Content-Type chosen from the extension (.txt, .md, .json, .xml, .html, .css, .js, .ts, .yaml/.yml, .csv; anything else is application/octet-stream). The content is decoded as UTF-8, so binary files are not returned byte-for-byte. 404 WATCHER_NOT_FOUND when the file does not exist at that commit (or the commit does not exist).
Unified diff between commits for files matching a glob.
curl "http://localhost:1936/vcs/diff?glob=d:/documents/*.md&commit=a1b2c3d&commitEnd=e4f5a6b"
| Param | Type | Description |
|---|---|---|
glob |
string |
Required. Path or glob pattern to filter files. |
commit |
string |
Required. Start commit. |
commitEnd |
string |
End commit. Defaults to HEAD if omitted. |
Unified diff text (Content-Type: text/plain) of git diff <commit>..<commitEnd>, concatenated across the roots the glob covers. An unknown commit (or a range with no changes) yields an empty 200 body, not an error. A glob outside every root is 404 WATCHER_NOT_FOUND.
Restore files from a historical commit (forward-only: writes old content as new changes).
curl -X POST http://localhost:1936/vcs/revert \
-H "Content-Type: application/json" \
-d '{
"glob": "d:/documents/projects",
"commit": "a1b2c3d",
"existingOnly": true
}'
Body schema:
{
glob: string; // File or directory to revert (absolute)
commit: string; // Commit to restore from
existingOnly?: boolean; // Only restore files that currently exist on disk (default: false)
}
{
"restored": 3,
"files": [
"d:/documents/projects/readme.md",
"d:/documents/projects/notes.md",
"d:/documents/projects/spec.md"
]
}
| Field | Type | Description |
|---|---|---|
restored |
number |
Number of files restored. |
files |
string[] |
Absolute paths of restored files. |
git ls-tree -r --name-only <commit> -- <path>). git ls-tree matches literal paths, not wildcards: pass a file or a directory (everything under it is restored). A wildcard pattern, or an unknown commit, restores nothing (restored: 0).git show.revert: {glob} to {shortCommit} — (the first 7 characters of commit), followed by the AI description or, on the template path, restored <n> files (plus (+ <m> other changes) when other files share the commit).Exclude a path from version history while keeping it in search (VCS-only exclusion, unreleased, spec B4). See the API reference for every error text.
curl -X POST http://localhost:1936/vcs/exclude \
-H "Content-Type: application/json" \
-d '{
"glob": "temp/**/*.tmp",
"root": "d:/documents"
}'
Body schema:
{
glob: string; // One gitignore pattern: absolute under a VCS root, or relative to `root`
root?: string; // VCS root to write under (resolved from the glob if omitted)
remove?: boolean; // Remove the pattern instead of adding it (default: false)
confirm?: boolean; // Required (true) to untrack more than 100 files
}
{
"ok": true,
"file": "d:/documents/.git/info/exclude",
"action": "added",
"untracked": 3
}
| Field | Type | Description |
|---|---|---|
ok |
boolean |
Success indicator. |
file |
string |
The file written: the root's .git/info/exclude, or the .gitignore a removed 0.20.0 pattern was in. |
action |
string |
"added" or "removed". |
untracked |
number |
Paths removed from the index (in HEAD or only staged); 0 for removed. |
See VCS-Only Exclusion. In short: the pattern is written root-anchored to .git/info/exclude, the tracked files it matches are untracked in one commit (pushed when the root has a remote), and the files stay on disk and in search. More than 100 files need confirm: true (else 200 { confirmRequired: true, untracked }, nothing written; v0.22.0+, was 409 confirm_required). The route waits at most 30 s for the root's git lock, then answers 503 WATCHER_NOT_AVAILABLE with Retry-After: 30, nothing written. A newline, a leading ! or #, braces and a pattern matching the whole root are 400; so is a glob outside an explicit root. remove deletes the anchored line from .git/info/exclude, else the line 0.20.0 wrote in its locality .gitignore; untracked files are not re-added.
Check whether git ignores a path, and why.
curl "http://localhost:1936/vcs/check-exclusion?path=d:/documents/temp/scratch.tmp"
| Param | Type | Description |
|---|---|---|
path |
string |
Required. Absolute file path to check. |
{
"excluded": true,
"rule": "/temp/**/*.tmp",
"source": ".git/info/exclude",
"line": 2
}
| Field | Type | Description |
|---|---|---|
excluded |
boolean |
Whether git ignores the path (git check-ignore). A tracked path never is, and a path a negated (!) rule re-includes is not. |
rule |
string? |
The matching pattern (if excluded). |
source |
string? |
The file holding the rule, as git names it: .git/info/exclude for a VCS-only exclusion, or a .gitignore relative to the root. |
line |
number? |
The rule's 1-based line in source (unreleased). |
A git failure other than "not ignored" answers the masked 500 (no code; 0.20.0 answered excluded: false).
The OpenClaw plugin exposes each endpoint as a tool, built from the catalog. Tool errors read HTTP <status>: <body>. The CLI has the same operations as jeeves-watcher vcs status|history|show|diff|revert|check|exclude (see the CLI Reference).
| Tool | Endpoint | Parameters |
|---|---|---|
watcher_get_vcs_status |
GET /vcs/status |
none |
watcher_list_vcs_history |
GET /vcs/history |
glob (required), since, until, limit |
watcher_show_vcs_file |
GET /vcs/show |
path, commit (both required) |
watcher_diff_vcs |
GET /vcs/diff |
glob, commit (both required), commitEnd |
watcher_revert_vcs |
POST /vcs/revert |
glob, commit (both required), existingOnly |
watcher_exclude_vcs_path |
POST /vcs/exclude |
glob (required), root, remove, confirm |
watcher_check_vcs_exclusion |
GET /vcs/check-exclusion |
path (required) |
There are no VCS CLI commands.
When commitMessage.enabled is true (the default) and an API key resolves, the VCS subsystem generates one-line commit messages using an LLM.
{
"vcs": {
"commitMessage": {
"provider": "anthropic",
"model": "claude-haiku-5-5",
"apiKey": "${ANTHROPIC_API_KEY}"
}
}
}
Currently only the "anthropic" provider is supported (Anthropic Messages API). An unsupported provider logs a warning on each commit and falls back to the template.
The API key is resolved once at startup, per root, in order:
commitMessage.apiKey (with ${ENV_VAR} substitution).models.providers.<provider>.apiKey in ~/.openclaw/openclaw.json on the watcher host. The watcher reads the key and calls the provider directly; nothing is routed through the gateway.If neither yields a key, a warning is logged and every commit uses the template message.
AI generation is skipped for baseline commits and for retry attempts of a batch. If the LLM call fails (timeout, non-OK response, unsupported provider, empty reply), the commit uses the template message (watcher: batch <ISO timestamp> (<n> files)). The request sends the changed file paths and the staged diff (--stat plus patch) cut to 4000 characters, with a 15-second timeout; the reply is trimmed to 100 characters.
A non-OK response is logged as a warning on each commit, except HTTP 404: a model the provider has retired (or never had) is reported once per process, as a warning naming the model and the vcs.commitMessage.model key to change, and later 404s log at debug. Set the key to a current model (the default is "claude-haiku-5-5").
Revert commits start with revert: {glob} to {shortCommit} — . The rest is the AI description when one is generated, otherwise restored <n> files (see POST /vcs/revert).
Each root with a remote pushes after every commit that creates a commit (git push <remote> HEAD, i.e. the current branch to the same name on the remote). The URL is used directly; no git remote is configured in the repository.
{
"watch": {
"paths": [
{
"path": "d:/documents/**/*.md",
"vcs": {
"enabled": true,
"remote": "https://github.com/org/docs-backup.git",
"accessToken": "${DOCS_GIT_TOKEN}"
}
}
]
},
"vcs": {
"enabled": true,
"defaultAccessToken": "${GIT_ACCESS_TOKEN}"
}
}
remote: Git remote URL (per-root only).accessToken: Per-root token. Falls back to defaultAccessToken from the root-level vcs block.Authorization header (Basic, user x-access-token, which GitHub accepts) scoped to the remote URL, for that one push only. It is passed through the environment, never on the command line or in the URL, and configured credential helpers are bypassed so the push can never block on an interactive prompt. The token is ignored for non-HTTPS remotes (configured credential helpers stay in effect there, with interactive prompts disabled).pushErrors) are scrubbed of the token in raw, URL-encoded, and base64 forms.Push failures are non-blocking: the commit succeeds locally regardless. Errors are recorded in GET /vcs/status under pushErrors for the affected root. The remote is treated as a backup mirror, not a primary store.
The VCS subsystem periodically squashes old commits to prevent unbounded history growth. Retention defaults apply automatically when vcs.enabled is true, even if the retention block is omitted from config. The defaults are: 30 days max age, 100 versions max, daily midnight cron schedule.
Two retention limits work together, and the tighter constraint wins:
maxAgeDays (default: 30): commits older than this are eligible for squash.maxVersions (default: 100): only the most recent N commits are kept as individual commits.Everything older than the boundary becomes one parentless historical baseline commit with the boundary's tree.
Squash runs on a cron schedule configured via retention.squashCron (default: "0 0 * * *", daily at midnight). The scheduler is watcher-internal: it checks the expression once a minute against the host's local time, so no external cron daemon or task scheduler is needed.
The cron expression uses the 5-field format (minute hour day-of-month month day-of-week) with numbers only, and supports wildcards (*), lists (1,15), ranges (1-5), and steps (*/6). Day-of-week 0 and 7 both mean Sunday. Unlike standard cron, a restricted day-of-month and day-of-week must both match. An expression without exactly five fields never fires (no error is logged).
Squash rewrites history with plumbing only: no checkout, reset or cherry-pick, so it never touches the working tree or the index, and it needs no clean tree.
git rev-list --reverse --first-parent) and compute the retention boundary from author dates; stop if there is nothing to squash.historical baseline commit with the tree of the last commit to squash (commit-tree), then recreate each retained commit on top with its own tree, message bytes, author and committer identities and raw dates (timezones included). Merges along the first-parent chain become single-parent commits with the same tree. A retained commit with an encoding header (a non-UTF-8 commit written by another tool) is instead rebuilt byte for byte with hash-object, only its parent replaced and any signature dropped, so its message, identities and encoding header are unchanged; the watcher's own commits are UTF-8 and take the commit-tree path.vcs.branch) with a compare-and-swap git update-ref -m "jeeves-watcher squash" <branch> <new> <old>. If anyone committed to the branch meanwhile, the swap fails, nothing changes, and the squash runs again at the next cron match.A file untracked by the size cap keeps its newest content on disk through a squash. Squash never takes index.lock, so a lock held by another git process does not block it.
If a remote is configured, the squashed history is force-pushed. This is acceptable because the remote is a backup mirror: no other writers commit to it. A failed force push is logged; the local squash stands.
Each refusal is logged and retried at the next cron match:
.git/sequencer, .git/rebase-merge, .git/rebase-apply, .git/CHERRY_PICK_HEAD, or .git/MERGE_HEAD exists, the squash refuses (error log). The watcher never clears this state itself; resolve it manually (e.g. git cherry-pick --quit, git rebase --abort, git merge --abort). The same condition is reported at startup.At startup each root, under its lock: removes a stale index.lock; sweeps git temp files (tmp_pack_*, tmp_idx_*, tmp_obj_*, tmp_objdir-* under .git/objects) untouched for over an hour (the sweep also runs hourly); finishes or discards an interrupted untrack (see Untracking); and logs a warning, changing nothing, when HEAD is not on the configured branch or a __squash_orphan_* branch left by 0.20.0 exists. Check the root by hand, git checkout <branch>, and delete leftover orphan branches yourself.
Untracking (the size cap and POST /vcs/exclude) builds a commit on a private index (.git/untrack.index) read from HEAD, without the paths HEAD holds, publishes it with a compare-and-swap update-ref (rebuilt once if HEAD moved), then removes the paths from the real index with git update-index --force-remove. Unrelated staged changes are kept; the files stay on disk; with an unborn HEAD nothing is committed. A .git/untrack.pending marker covers the moment between the commit and the index removal: at startup and before each batch, a marker whose commit is in HEAD's history is finished, and any other is discarded with a warning (its .git/info/exclude line, when it wrote one, is removed too). If git cannot answer (a timeout), the marker stays and the batch retries.
When a batch stages nothing (e.g., a file was touched but its content is identical), the pipeline detects it with git diff --cached --quiet and skips git commit. This is a no-op, not a failure: it counts as a success for the circuit breaker, and files are not re-queued. Detection does not parse git's output text, so it is unaffected by untracked files, unstaged changes outside the batch, status.showUntrackedFiles, or git's message wording.
Each batch is split by one tracked check (git --literal-pathspecs ls-files -z -c -- <paths>, in chunks of at most 500 paths or 24 KiB):
git add -u (this works under an ignored folder).git check-ignore; the rest stage with git add.git rm --cached.A missing or ignored path never fails the batch. Path lists reach git through stdin (or in chunks, for ls-files), root-relative and literal, so a large batch never hits the Windows command-line length limit.
The initial filesystem scan only reports files that exist, so deletions that happened while the service was stopped (or unlink events that were missed) are never observed as events. When the initial scan completes, each root lists tracked-but-deleted paths (git ls-files --deleted), keeps those inside the watch scope (watch.paths minus watch.ignored), and adds them to the baseline batch so the deletions are committed.
Each git call that takes a list of paths has a timeout of 30 seconds plus 50 ms per path, at most 10 minutes (1,000 paths: 80 seconds); other calls have 30 seconds, pushes 60 seconds. Every call runs the real git binary (on Windows, the one in git --exec-path, not the cmd\git.exe launcher), so a timed-out call is really killed. After its exit, if the call writes the index (staging, rm --cached, update-index, commit, the untrack helper's private index), an index.lock created during the call is removed; a read or a plumbing call that takes no index lock leaves any lock alone, since another writer holds it. Git temp files it left are deleted in the background once they stop changing.
A staging step that times out is split in halves and retried, down to single paths. The whole batch, bisection included, gets at most three times its first timeout (and never more than 30 minutes), so the root's lock is always released. Paths that could not be staged are re-queued, and the batch counts as one failure for the circuit breaker.
Only transient index.lock contention is retried within a commit attempt (4 attempts, exponential backoff). Any other error fails the attempt immediately with its real message.
Each commit covers at most maxBatchSize files; a flush with a larger backlog commits it in several chunks. When a batch fails, all of its files are re-queued (the pending set holds each path once, so it cannot grow beyond the distinct changed paths) and the throttle timer restarts so they are retried automatically. After maxConsecutiveFailures consecutive failures the per-root circuit breaker trips:
circuitBreakerCooldownMs (default 5 minutes) a single half-open commit attempt runs from a timer; no new file event is needed. Success resets the breaker; failure re-arms the cooldown.GET /vcs/status under breaker, and summarised across roots in GET /status under health.vcs (roots, pending, trippedRoots, oldestTrippedAt).The watcher's own git work on a root (batch commits with their push, squash, untracking, temp-file sweeps) runs one at a time, in arrival order, under an in-process per-root lock. A wait longer than 10 seconds and a hold longer than 5 minutes are logged as warnings. POST /vcs/exclude waits at most 30 seconds, then answers 503 without doing anything. The lock cannot exclude other processes, so everything done under it is also safe without it.
Every git invocation made by the VCS subsystem passes -c core.longpaths=true (paths longer than the Windows MAX_PATH limit work without any git configuration) and -c core.quotePath=false (non-ASCII paths are printed as-is, so /vcs/history and /vcs/diff return them unescaped, #252).
POST /vcs/exclude stops version history for a path without dropping it from search (unreleased, spec B4). It writes the pattern to the root's .git/info/exclude, a per-repository ignore file git honours in add, status and check-ignore but that is not part of the tree; the watcher's indexing filter (watch.respectGitignore) reads only .gitignore files, so the files stay indexed and searchable.
/ plus the glob relative to the root, so /docs (from <root>/docs, or docs with root) names the root's docs folder and everything under it, /*.log matches log files at the root only, and **/*.log matches them at any depth. (0.20.0 wrote un-anchored lines into a .gitignore near the glob, where *.log matched at every depth below that folder.)root the glob is absolute. With root it may be absolute (under the root) or relative to it; a glob starting with / is always a filesystem path, so write docs, not /docs, for the root's folder.Report [draft].docx matches Report d.docx. Escape them to name the file: Report \[draft\].docx ("Report \\[draft\\].docx" in JSON).Untrack <n> files matching <pattern> (see Untracking), which is pushed when the root has a remote. Other staged changes are kept. Their history stops at their last committed version; the files stay on disk. More than 100 files need confirm: true.! or #, braces, and a pattern matching the whole root (*, **, /, /**, **/*, */**, ...)..gitignore covers but git still tracks keeps being versioned, and GET /vcs/check-exclusion answers excluded: false for it (git never reports a tracked path as ignored). Exclude it through POST /vcs/exclude to untrack it..gitignore vs .git/info/exclude vs watch.ignoredThese are separate settings:
.gitignore: controls what git tracks and, with the default watch.respectGitignore: true, what the watcher indexes. Edit it yourself; the API no longer writes it (apart from the always-on entries below)..git/info/exclude: controls only what git tracks. Managed via POST /vcs/exclude.watch.ignored: controls what the watcher monitors at all (for both embedding and versioning). Set in config.With the default watch.respectGitignore: true, the watcher skips .gitignored files entirely, so such a file is neither embedded nor versioned. With respectGitignore: false, .gitignored files are embedded, but see the caution above about versioning them.
The VCS subsystem automatically adds these to every root's .gitignore:
.git/node_modules/.jeeves-watcher/.jeeves-metadata/These entries are re-added on every startup (missing ones are appended) and cannot be removed via the API.
Git is a soft dependency. If git is not found on PATH at startup:
git not found on PATH — VCS disabled for this session and skips repository initialization and the state directory check.breaker.lastError in GET /vcs/status). Set vcs.enabled: false if git will not be installed.When VCS is enabled, the stateDir (default .jeeves-metadata) must not overlap with any watch path's root (same directory, parent or child). The watcher validates this at startup and fails to start if an overlap is detected. This prevents the watcher from versioning and indexing its own state files.
If a watch root contains child git repositories (nested .git/ directories), git does not add their files to the parent root's repository: changes inside a child repository are silently not versioned. The child .git/ directories themselves are excluded via the always-on .gitignore entries. Use separate watch roots, or keep child repositories outside VCS-enabled roots.
Symptom: Commits fail with index.lock errors.
Cause: Another git process (IDE, manual git command) holds the lock, or a crashed process left a stale lock file behind. The watcher's squash never takes index.lock.
Automatic recovery: The VCS subsystem handles lock contention automatically:
staleLockThresholdMs (default: 60 seconds), the lock is force-removed (Removed stale index.lock) and the commit proceeds.maxConsecutiveFailures (default: 5) consecutive commit failures, the breaker trips. Pending files are retained, and a single recovery attempt runs every circuitBreakerCooldownMs (default: 5 minutes) until one succeeds.No manual intervention is needed in most cases. If the circuit breaker trips, check breaker.lastError in GET /vcs/status and resolve the underlying issue. The next recovery attempt picks up the retained files automatically.
Symptom: Logs show Squash refused: in-progress git operation detected (.git/<marker>), Squash refused: HEAD is not on <branch>, or Squash refused: the pending batch failed to commit.
Cause: An abandoned cherry-pick, rebase, or merge in .git/; HEAD detached or on another branch; or a failing commit pipeline.
Resolution: For an in-progress operation, inspect the repo and clear it manually (git cherry-pick --quit, git rebase --abort, or git merge --abort). For a wrong branch, check the root and git checkout <branch>. For a failing pipeline, check GET /vcs/status for a tripped breaker; once commits succeed, the next squash cycle proceeds.
Symptom: First commit after enabling VCS is very large or slow.
Cause: All existing files in the watch root are staged for the initial commit.
Resolution: The maxBatchSize setting naturally chunks large initial commits. With the default of 1000, a root with 5000 files produces 5 sequential commits. Increase maxBatchSize if you prefer fewer, larger commits.
Symptom: GET /vcs/status shows entries in pushErrors.
Common causes:
Resolution: Push failures are non-blocking: local commits are safe. Fix the credential or network issue and the next commit will push successfully (lastPush updates; earlier pushErrors entries remain until restart). Check logs for detailed error messages.
Symptom: Log contains git not found on PATH — VCS disabled for this session; commits fail and the circuit breaker trips.
Resolution: Install git and ensure it is on the system PATH, then restart the watcher. On Windows, the installer typically adds git to PATH automatically. On Linux, install via your package manager (apt install git, yum install git, etc.).
Symptom: Log shows VCS root is not in its expected branch state at startup.
Cause: HEAD is detached or on another branch, or a __squash_orphan_* branch left by a 0.20.0 squash exists.
Resolution: The watcher never switches branches or deletes them. Inspect the root, git checkout <branch> (the configured vcs.branch), and delete leftover __squash_orphan_* branches once you are sure they hold nothing you need. Squash refuses until HEAD is on the configured branch.
Symptom: Log shows timeout errors for git operations.
Cause: A git operation took longer than its timeout (see Timeouts and Bisection).
Resolution: Staging timeouts are bisected and the unstaged paths retried automatically. If timeouts occur regularly, investigate disk I/O, antivirus scanning of the repository, network connectivity (for push), or very large files (lower vcs.maxFileBytes).