/ documentation

CLI local state

Private CLI files in ~/.maleta: credentials, managed state, the watch lock, safe removal, and the effects of logout and detach.

The CLI keeps this computer's state in <home>/.maleta. <home> is MALETA_CLI_HOME when the variable is set to a non-empty value; otherwise, it is the home directory reported by the operating system. A relative value is resolved to an absolute path against the current directory.

#Files in .maleta

Private files kept by the CLI
FileContentsLifecycle
credentials.jsonDevice credentials in version 1 format.Created by login and removed by maleta logout.
state.jsonManaged state using schema 1: binding, resources, and per-file ownership proof.Updated atomically by device commands.
state.corrupt-<timestamp>.jsonQuarantined copy of an invalid or unrecognized state.json.Created when the CLI can move invalid state out of the active path.
local-state.jsonLocal install record (localStateVersion: 1): documents[] of documentPath, targetTool, and resources[] with per-file sha256, bytes, and origin.Written by install and sync for each absolute document path; re-read by prune.
watch.lockJSON containing pid, startedAt, hostname, and the holding command (watch or prune). A payload written before that field existed is read as watch.Exists while a watch or prune --yes holds the lock; a lock from a stopped process is reclaimed on the next acquisition.
tray.pidJSON containing the running tray's pid.Exists while a tray instance holds the singleton lock; a pid file whose process is dead is reclaimed by the next tray.

#Device credentials

version
1required

Literal version of the credentials format.

apiOrigin
stringrequired

API origin associated with the credentials.

deviceId
stringrequired

Non-empty identifier for this device.

token
stringrequired

Non-empty token used to authenticate the device.

MALETA_DEVICE_TOKEN overrides the file in CI or on headless machines, and MALETA_API_ORIGIN can set the API origin. The environment credential's real identity is learned from the session endpoint and never persisted: the env placeholder is a source marker that must not reach state.json or the screen. A token whose identity differs from the recorded one is refused with exit 3, leaving the record untouched.

#state.json schema

stateVersion
1required

Literal version of the state schema.

deviceId
string | nullrequired

Device this history belongs to; null after logout or before the first binding.

binding
ManagedBinding | nullrequired

Cloud Maleta followed on this computer and the last applied revision; null when there is no binding.

resources
ManagedResource[]required

Resources from the bound Maleta that the CLI currently manages.

pendingRemoval
ManagedResource[]required

Resources no longer listed by the account that await maleta prune; watch does not remove them.

orphaned
ManagedResource[]required

Resources left on disk after detach, logout, or an identity change; they also await maleta prune.

#Managed resources and files

ManagedResource and ManagedFile fields
ObjectFieldType and meaning
ManagedResourcelabelstring: label of the plan that produced the resource.
ManagedResourcenamestring: destination directory name and part of the resource identity.
ManagedResourceskillIdstring | null: skill identifier, when present.
ManagedResourcedestinationstring: resolved destination directory.
ManagedResourcefilesManagedFile[]: per-file ownership records.
ManagedFilepathstring: path relative to the destination, using POSIX separators.
ManagedFilesha256string: 64-character lowercase hexadecimal SHA-256 hash of the recorded bytes.
ManagedFilebytesinteger >= 0: recorded file size.
ManagedFileorigin"written" | "adopted": the CLI wrote the file or found the same bytes already present.

#local-state.json schema

localStateVersion
1required

Literal version of the local install record.

documents
LocalDocumentRecord[]required

One entry per absolute maleta.json path a local install or sync wrote.

documents[].documentPath
stringrequired

Absolute path of the recorded document; a relative or non-normalized path makes the record corrupt.

documents[].targetTool
"all" | "claude" | "codex" | "agents"required

The tool target that run used, used to recompute the plan at prune time.

documents[].resources
ManagedResource[]required

Cumulative ownership for that document, in the same shape as the state record.

#Binding record

cloudMaletaId
stringrequired

Non-empty identifier of the bound Cloud Maleta.

documentId
stringrequired

Non-empty identifier of the materialized document.

name
stringrequired

Display name of the bound Maleta.

appliedRevision
integer >= 0required

Materialized revision; 0 means nothing has been applied yet.

appliedStatus
"applied" | "conflict"required

conflict makes the next watch fetch and retry the revision.

appliedAt
stringrequired

Recorded timestamp for the application state.

#Proof before removal

Ownership is tracked per file. origin: "written" proves that the CLI created or updated the file; it is removed only if it is still a regular file, remains inside the destination, and its SHA-256 still matches sha256.

  • origin: "adopted" marks bytes that already existed and matched; the CLI never removes that file.
  • A modified file, symlink, unsafe path, or unrecorded entry blocks removal of the resource.
  • Directories are removed only when empty; user-added contents remain.
  • maleta watch only records candidates in pendingRemoval; only maleta prune --yes removes them.

#Missing or invalid state

A missing or unreadable state.json is not treated as empty history: state becomes untrusted and all removal is disabled. Invalid JSON or an unrecognized schema is moved, when possible, to state.corrupt-<timestamp>.json.

#Logout and detach

Local state changes
CommandCredentials and bindingResources
maleta logoutAttempts to revoke the session, removes credentials.json, and sets deviceId and binding to null.Moves resources and pendingRemoval to orphaned; it does not remove destination files.
maleta detachAlways contacts the server, then sets binding to null and keeps the credentials and deviceId.Moves resources and pendingRemoval to orphaned; it does not remove destination files.

Privacy preferences

Choose what this origin may measure. You can change it here at any time.

Essential storage

This browser always keeps your theme, the Maletas you save here and this choice so the site works. They stay on this origin.

Optional analytics

Maleta.dev measures aggregate traffic and real-user performance only after you allow it.

Current choice: not made yet, so measurement stays off.

Privacy policy