/flowforge:session:end
/flowforge:session:end is the closing ceremony for a FlowForge work session. It stops the timer, finalizes the session manifest, writes a session summary, optionally creates a closing commit, and prepares the workspace for the next /flowforge:session:start.
Synopsis
Section titled “Synopsis”/flowforge:session:end [message]From outside Claude Code:
flowforge run flowforge:session:end [message]Description
Section titled “Description”Run this command when you are done for the day, finished with a ticket, or otherwise want to formally close the session. Unlike /flowforge:session:pause, end is terminal: the session manifest is archived, time entries are sealed, and the next session will be a new session.
The command is deliberately forgiving. It uses set -u (rather than set -euo pipefail) and an error trap that logs non-fatal failures and continues, on the principle that ending a session must succeed even when a side effect (issue update, push, summary write) fails. The error trap re-emits the line number and exit code without aborting.
To prevent two parallel session:end invocations from corrupting state, the command uses three directory-based locks: a billing lock at .flowforge/billing/.lock-<INSTANCE_HASH> (15-second acquire timeout), a provider lock at .flowforge/provider/.lock (10-second timeout), and a team lock at .flowforge/team/.lock (20-second timeout). INSTANCE_HASH is the 8-character md5 prefix of INSTANCE_ID, so concurrent invocations from different shells get separate billing locks. Each acquire_lock call also sweeps a stale lock older than 60 seconds out of the way before retrying, so a crashed process does not block the next session indefinitely.
If you supply a message, it becomes the closing commit message. If omitted, the command synthesizes a closing commit summarizing the session.
Arguments
Section titled “Arguments”| Position | Name | Required | Description |
|---|---|---|---|
| 1 | message | no | Closing commit message. When omitted, the command synthesizes one from session metadata. The literal values ? and help print an in-terminal usage block and exit 0. |
Options
Section titled “Options”None.
Environment variables
Section titled “Environment variables”| Variable | Direction | Purpose |
|---|---|---|
ARGUMENTS | read | Receives the closing commit message. |
DEBUG | read | When set to 1, enables set -x tracing. |
INSTANCE_ID | read | Optional identifier written into the lock owner record for debugging concurrent invocations. |
Examples
Section titled “Examples”End the current session with an auto-generated commit message:
/flowforge:session:endEnd with an explicit closing message:
/flowforge:session:end "Closes #123 — CLI reference page complete"End with debug tracing:
DEBUG=1 /flowforge:session:endPrint in-terminal help:
/flowforge:session:end ?A successful close produces output along these lines (the 🔒 Lock acquired: debug line only prints when DEBUG=1, and the trailing hex in .lock-a1b2c3d4 is the INSTANCE_HASH — your output will differ):
🏁 Ending work session...🔒 Lock acquired: .flowforge/billing/.lock-a1b2c3d4⏱️ Stopping time tracking for task #123...📋 Updating task status...🔐 Implementing dual-path data archival...✅ Privacy-preserving team summary createdExit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
0 | Session ended, timer stopped, manifest archived. Non-fatal errors during side effects (lock contention, push failures, provider updates) are logged and do not change the exit code — the command runs set -u only and traps ERR to keep going. |
1 | A precondition failed before the main body could run — for example, jq is not installed on the host. The command prints an actionable error and exits. |
Related commands
Section titled “Related commands”/flowforge:session:start— start the next session./flowforge:session:pause— pause without closing./flowforge:dev:status— confirm timer state before ending.- Sessions — the lifecycle this command terminates.