agentleFS
SonghongleiSonghonglei/better-agent-skills/skills/rename-session/SKILL.md

rename-session

Skill4 starsChanged 5 months agoMITView on GitHub

Rename or auto-generate a friendly label for an OpenClaw-style session by editing sessions.json directly. Supports random labels (zh/en with locale auto-detect), multi-agent auto-detection, listing sessions, retry with verification, and XDG-compliant history storage. 适用场景:在 OpenClaw / 任何兼容的 session 管理体系中给会话起名/改名/换花名/重命名 session/给会话加 label。

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    All randomized output uses standard Python random (no external deps).

    line 100

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

rename-session

Minimal, zero-dependency tool to rename a session label in <agents-root>/<agent>/sessions/sessions.json (OpenClaw-style layout).

Quick start

# List all sessions under the only agent under ~/.openclaw/agents/
python3 scripts/rename_session.py --list

# Rename a session with a literal label
python3 scripts/rename_session.py agent:main:main "My new session name" --agent main

# Auto-generate a random label (auto-detects language from $LANG)
python3 scripts/rename_session.py agent:main:main --random --agent-name Ashley

# Force Chinese label
python3 scripts/rename_session.py agent:main:main --random --lang zh --agent-name Ashley

# Force English label
python3 scripts/rename_session.py agent:main:main --random --lang en --agent-name Ashley

CLI

FlagDescriptionDefault
session_keySession key, e.g. agent:main:mainrequired (unless --list)
new_labelNew literal labelrequired unless --random
--randomAuto-generate a random labelfalse
--listList all session keys under the agent and exitfalse
--lang zh|enLanguage for --random vocabularyauto-detect from $LC_ALL/$LC_MESSAGES/$LANG, fall back to en
--agent-name <name>Agent display name used in random labelAshley
--agent <id>Agent ID. Auto-detected when only one existsauto
--root <path>Agents root$RENAME_SESSION_ROOT or ~/.openclaw/agents

Configuration via environment

Env varPurposeDefault
RENAME_SESSION_ROOTOverride agents root~/.openclaw/agents
XDG_DATA_HOMEWhere history is stored~/.local/share

History file: $XDG_DATA_HOME/rename-session/history.json (keeps last 10 labels to avoid immediate repeats when using --random).

Random label format

<scene><agent-name><mood-emoji><state-word><state-emoji>

Example outputs:

  • zh: 春光明媚Ashley🌸元气满满💻
  • en: March Breeze Ashley🌸 Energized💻

70% of the time the scene is month-aware (e.g. March produces spring words).

Exit codes

CodeMeaning
0Success (rename verified or list completed)
1Failure (3 retries exhausted, missing session, or file errors)
2Bad CLI arguments

Failure reasons

OutputExplanation
sessions.json not found at ...Agent does not exist or has no sessions yet
session key '...' not foundThe specified session key does not exist
File permission issuesCannot write to sessions.json
Disk is full or read-onlyFilesystem write blocked
Another process is continuously modifying sessions.jsonConcurrent writers; retry later

Notes

  • Changes take effect immediately in the file; refresh the session list in your client to see the new label.
  • Multi-agent: when more than one agent is detected under the root, --agent <id> is required.
  • All randomized output uses standard Python random (no external deps).

See references/TESTING.md for the test plan.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.