Skip to content

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

Terminal window
/flowforge:session:end [message]

From outside Claude Code:

Terminal window
flowforge run flowforge:session:end [message]

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.

PositionNameRequiredDescription
1messagenoClosing 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.

None.

VariableDirectionPurpose
ARGUMENTSreadReceives the closing commit message.
DEBUGreadWhen set to 1, enables set -x tracing.
INSTANCE_IDreadOptional identifier written into the lock owner record for debugging concurrent invocations.

End the current session with an auto-generated commit message:

Terminal window
/flowforge:session:end

End with an explicit closing message:

Terminal window
/flowforge:session:end "Closes #123 — CLI reference page complete"

End with debug tracing:

Terminal window
DEBUG=1 /flowforge:session:end

Print in-terminal help:

Terminal window
/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 created
CodeMeaning
0Session 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.
1A 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.