Skip to main content

Documentation 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.

Time Travel gives every writable layer in Space Agent a local Git history. Each L1/<group>/ and L2/<user>/ root becomes its own Git repository, and every save quietly schedules a commit in the background. The Time Travel page lets you browse that history, inspect per-file diffs, jump back to an earlier state, or create a new revert commit — all without touching a terminal.

Enabling Time Travel

Time Travel is controlled by the CUSTOMWARE_GIT_HISTORY runtime parameter, which defaults to true. When disabled, the route still renders but the history APIs return { enabled: false }.
# Default — enabled
CUSTOMWARE_GIT_HISTORY=true

# Disable if needed
CUSTOMWARE_GIT_HISTORY=false
The GIT_BACKEND parameter controls which Git implementation the server uses:
ValueBehavior
auto (default)Tries native first, falls back to isomorphic
nativeAlways uses native Git subprocess
isomorphicAlways uses the isomorphic JS backend
The isomorphic backend caches immutable history-entry and tree objects for repeated reads, so Time Travel page loads remain fast even on hosts without a native git binary.

Accessing the Time Travel UI

Navigate to #/time_travel from the app menu or from the dashboard Files panel. The route is served from /mod/_core/time_travel/view.html and is also embedded in the admin area’s Time Travel tab. The page’s Refresh and repository picker controls are injected into the shared shell header bar via x-inject so they stay in shell chrome without becoming persistent shell extensions.

What the UI Covers

1

Pick a repository

The page defaults to the current user’s ~ (L2/<username>/) history. A permission-aware picker lets you switch to any writable L1 or L2 root you manage. The picker is populated by space.api.fileList({ gitRepositories: true, access: 'write' }).
2

Browse and filter commits

Commits are listed in reverse-chronological order with pagination. Use the file filter to narrow the list to commits that touched a specific path or filename. The current HEAD is distinguished from preserved forward-travel refs by the currentHash in the API response.
3

Inspect diffs

Click any commit to see a per-file diff. Diff patches larger than 1 MB show a notice instead of rendering. The diff viewer uses the same /api/git_history_diff endpoint as space.api.gitHistoryDiff(...).
4

Preview before apply

Before rolling back or reverting, the UI calls gitHistoryPreview to show you which files will be affected. Revert conflicts surface a short recommendation first; technical backend details are kept behind an explicit expand action.
5

Rollback or revert

Both operations require explicit confirmation. Rollback moves HEAD to the selected commit; revert creates a new commit that undoes the selected commit without resetting HEAD.

How Commits Are Created

The server schedules a commit after a quiet period following each write:
Time since last writeDebounce interval
< 1 minute10 seconds
1–5 minutes5 seconds
5–10 minutes1 second
> 10 minutesImmediate
Pending commits are flushed during a clean server shutdown. In clustered runtime, workers publish changed logical paths to the primary, which holds the authoritative debounce timer. Operations within one owner root never overlap.

Auth File Protection

The L2 repository .gitignore permanently excludes the three auth-sensitive files:
meta/password.json
meta/logins.json
meta/user_crypto.json
Rolling back a user’s L2 history never restores an old password verifier, old session records, or an old wrapped browser key. Those files are always preserved at their current state. This means:
  • Rollback cannot log a user out.
  • Rollback cannot restore a previous password hash.
  • Rollback cannot silently downgrade the user’s crypto state.

Rollback vs. Revert

Rollback

Moves HEAD to the selected past commit. The server preserves the previous HEAD in a backend-owned ref so the Time Travel page can still show forward-travel options after moving back. Use rollback when you want to fully restore the tree to an earlier point.

Revert

Creates a new commit whose changes are the inverse of the selected commit. HEAD advances rather than moves backward. Use revert when you want to undo a specific change without losing the commits that came after it.
Rollback and revert both require write access to the target repository. Neither operation can be performed on L0 firmware roots.

JavaScript API

All Time Travel operations are exposed through space.api. These helpers map directly to the server endpoints.

space.api.gitHistoryList

space.api.gitHistoryList(
  pathOrOptions?: string | SpaceGitHistoryListOptions,
  limit?: number
): Promise<SpaceGitHistoryListResult>
const result = await space.api.gitHistoryList({ path: '~/', limit: 20, offset: 0 });
const commits = result.commits;
const currentHash = result.currentHash;

// Filter to commits that touched a specific file
const filtered = await space.api.gitHistoryList({
  path: '~/',
  limit: 20,
  fileFilter: 'conf/personality.system.include.md'
});

space.api.gitHistoryDiff

space.api.gitHistoryDiff(
  pathOrOptions: string | SpaceGitHistoryDiffOptions,
  commitHash?: string,
  filePath?: string
): Promise<SpaceGitHistoryDiffResult>
const { patch, file } = await space.api.gitHistoryDiff({
  path: '~/',
  hash: 'abc1234',
  filePath: 'conf/personality.system.include.md'
});
console.log(patch); // unified diff string

space.api.gitHistoryPreview

space.api.gitHistoryPreview(
  pathOrOptions?: string | SpaceGitHistoryPreviewOptions,
  commitHash?: string,
  operation?: 'travel' | 'revert',
  filePath?: string
): Promise<SpaceGitHistoryPreviewResult>
Always call preview before rollback or revert to show the user which files will be affected.
// Preview a rollback
const preview = await space.api.gitHistoryPreview({
  path: '~/',
  hash: 'abc1234',
  operation: 'travel'
});
console.log(preview.files); // affected file list

// Preview a revert with a per-file patch
const preview = await space.api.gitHistoryPreview({
  path: '~/',
  hash: 'abc1234',
  operation: 'revert',
  filePath: 'conf/personality.system.include.md'
});
console.log(preview.patch); // diff for that file

space.api.gitHistoryRollback

space.api.gitHistoryRollback(
  pathOrOptions?: string | SpaceGitHistoryCommitOptions,
  commitHash?: string
): Promise<SpaceGitHistoryMutationResult>
const result = await space.api.gitHistoryRollback({ path: '~/', hash: 'abc1234' });
console.log(result.hash);      // new HEAD hash
console.log(result.shortHash); // short form

space.api.gitHistoryRevert

space.api.gitHistoryRevert(
  pathOrOptions?: string | SpaceGitHistoryCommitOptions,
  commitHash?: string
): Promise<SpaceGitHistoryMutationResult>
const result = await space.api.gitHistoryRevert({ path: '~/', hash: 'abc1234' });
console.log(result.revertedHash); // hash of the commit that was reverted
console.log(result.hash);         // new HEAD (the revert commit)

Server Endpoints

The frontend API helpers map one-to-one to these server routes:
Frontend helperServer endpoint
gitHistoryListPOST /api/git_history_list
gitHistoryDiffPOST /api/git_history_diff
gitHistoryPreviewPOST /api/git_history_preview
gitHistoryRollbackPOST /api/git_history_rollback
gitHistoryRevertPOST /api/git_history_revert
All endpoints require authentication and write access to the target repository. Preview and mutation endpoints are not available when CUSTOMWARE_GIT_HISTORY=false.

Repository Discovery

The Time Travel picker populates itself using fileList with gitRepositories: true:
// All repositories the current user can write
const result = await space.api.fileList({ gitRepositories: true, access: 'write' });
// result.paths → ['L2/alice/', 'L1/mygroup/', ...]
The response contains writable owner roots like L2/<username>/ and L1/<group>/, never .git metadata paths. Read-only repositories are excluded when access: 'write' is set.

Build docs developers (and LLMs) love