User management

From agent0ai/space-agent · View interactive version

User management is an AI agent skill from the GitHub repository agent0ai/space-agent. Create, update, and remove users and memberships

How to use this skill

Skill file

Use this skill when the user asks to create a user, remove a user, change a user's full name, reset a password, revoke sessions, or explain how user account files are organized.

Canonical User Tree

There is no separate user registry file. The watched user index is derived from the files under L2/<username>/.

File API Rules

Common Operations

List users

Use await space.api.fileList("L2/", false). Each direct child directory is one user root.

Create a user

Use a single path-safe username segment such as alice or qa_bot. Then:

const username = "alice";
const fullName = "Alice Example";
const password = "replace-me";
const verifier = await space.api.call("password_generate", {
  method: "POST",
  body: { password }
});

return await space.api.fileWrite({
  files: [
    { path: `L2/${username}/` },
    { path: `L2/${username}/mod/` },
    {
      path: `L2/${username}/user.yaml`,
      content: space.utils.yaml.stringify({ full_name: fullName })
    },
    {
      path: `L2/${username}/meta/password.json`,
      content: `${JSON.stringify(verifier, null, 2)}\n`
    },
    {
      path: `L2/${username}/meta/logins.json`,
      content: "{}\n"
    }
  ]
});

Change full name

Read L2/<username>/user.yaml, parse it, update full_name, and write it back.

const path = "L2/alice/user.yaml";
const current = await space.api.fileRead(path);
const config = space.utils.yaml.parse(current.content || "");
config.full_name = "Alice Example";
return await space.api.fileWrite(path, space.utils.yaml.stringify(config));

Reset password

Write a new sealed verifier record to L2/<username>/meta/password.json.

const username = "alice";
const verifier = await space.api.call("password_generate", {
  method: "POST",
  body: { password: "new-password" }
});

return await space.api.fileWrite(
  `L2/${username}/meta/password.json`,
  `${JSON.stringify(verifier, null, 2)}\n`
);

If the user also wants to sign the user out everywhere, overwrite L2/<username>/meta/logins.json with {} in the same batch write. Do not attempt to write individual session entries yourself.

Remove a user

Deleting L2/<username>/ removes the local account files:

return await space.api.fileDelete("L2/alice/");

If the user also wants membership cleanup, inspect writable L1/*/group.yaml files and remove that username from:

Those group files are the canonical membership and manager records. Deleting only the user folder does not rewrite group configs automatically.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.