Space Agent maintains an automatic local Git repository for every writable layer owner root — eachDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/agent0ai/space-agent/llms.txt
Use this file to discover all available pages before exploring further.
L1/<group>/ and L2/<user>/ directory. Changes are committed automatically after a period of write quietness (10 seconds by default). The Git History API gives you programmatic access to that history: you can browse commits, inspect diffs, preview what a rollback or revert would change, and then execute the operation.
Availability and Configuration
Git history requiresCUSTOMWARE_GIT_HISTORY=true (the default). When the flag is disabled, all history endpoints return errors. Use file_list or file_paths with gitRepositories: true and access: "write" to discover which owner roots have history before calling these endpoints.
Commit Schedule
The server debounces write activity before committing:| Sustained write activity | Commit delay |
|---|---|
| < 1 minute | 10 seconds after last write |
| 1–5 minutes | 5 seconds after last write |
| 5–10 minutes | 1 second after last write |
| > 10 minutes | Immediate commit |
Protected Files
L2 history repos automatically ignoremeta/password.json, meta/logins.json, and meta/user_crypto.json. Rollback and revert operations preserve those files rather than restoring old auth state.
Path Parameter
All history endpoints accept apath that identifies the owner root whose Git history to query. Accepted forms:
| Value | Meaning |
|---|---|
~/ | Current user’s L2 root |
L2/<username>/ | Explicit user layer root |
L1/<group-id>/ | Group layer root |
GET or POST /api/git_history_list
Lists commits for an owner root, newest first. Returns commit metadata and per-commit file action lists without loading patch bodies. Supports pagination and optional filtering by changed file path. Accepts bothGET (with query params) and POST (with a JSON body).
Request
Logical path to the owner root, e.g.
~/, L1/team/, or L2/alice/.Maximum number of commits to return per page.
Number of commits to skip from the start of the list (for pagination).
Free-text filter applied as an open-ended substring match against changed file paths or filenames. Also accepted as
filter.Response
Ordered list of commit records (newest first).
The current HEAD commit hash for this owner root.
Whether there are additional commits beyond this page.
Total commit count, or
null when hasMore is already known without a full scan.GET or POST /api/git_history_diff
Returns the unified diff patch for a single file within a specific commit. Requires read permission on the owner root. This endpoint is read-only and does not modify any state. Accepts bothGET (with query params) and POST (with a JSON body).
Request
Owner root path.
The Git commit hash to diff. Also accepted as
commit or hash.The path of the file within the commit to diff. Also accepted as
file or pathWithinCommit.Response
Unified diff patch for the requested file in the requested commit.
The resolved file path.
The commit hash diffed.
GET or POST /api/git_history_preview
Previews the impact of a rollback ("travel") or revert operation before committing to it. Returns the list of files that would be affected. When filePath is supplied, also returns the operation-specific diff patch for that file. Requires write permission on the owner root. Accepts both GET (with query params) and POST (with a JSON body).
Use this endpoint to populate a confirmation UI before calling git_history_rollback or git_history_revert.
Request
Owner root path.
The commit hash to preview. Also accepted as
commit or hash.Either
"travel" (preview a rollback to this commit) or "revert" (preview an inverse commit).If provided, includes the operation-specific diff patch for this file in the response.
Response
Files that would be modified, added, or deleted by the operation.
Operation-specific diff patch for
filePath (only present when filePath was supplied).The operation that was previewed.
The commit hash previewed.
POST /api/git_history_rollback
Moves the owner root’s HEAD to a specific past commit (hard reset). This is a destructive operation — the working tree is overwritten to match the target commit. The server preserves the previous HEAD as a forward-travel ref so the Time Travel UI can still navigate to future commits after going back. Protected auth files (meta/password.json, meta/logins.json, meta/user_crypto.json) are always preserved in their current state and not reset. Requires write permission on the owner root.
Request
Owner root path.
The target commit hash to roll back to. Also accepted as
commit or hash.Response
Always
"rolled_back".The owner root path.
The commit hash that HEAD was set to.
The previous HEAD hash, preserved as a forward-travel ref.
POST /api/git_history_revert
Creates a new commit that undoes the changes introduced by a specific past commit. Unlike rollback, revert does not move HEAD backwards — it adds a new forward commit with the inverse changes. This preserves the full commit history. The server uses Git-like reverse-merge semantics so later non-overlapping edits can still revert cleanly. If conflicting changes in the current worktree prevent a clean inverse apply, the endpoint returns409 Conflict with information about the blocking file.
Requires write permission on the owner root. Protected auth files are preserved.
Request
Owner root path.
The commit hash whose changes should be undone. Also accepted as
commit or hash.Response (success)
Always
"reverted".The owner root path.
The new commit hash created by the revert.
The original commit hash that was reverted.
Response (conflict — HTTP 409)
Human-readable conflict description.
The logical path of the file that caused the conflict.
Current file content (when available).
The content the revert expected to find (when available).