chore: remove AI session save/resume helpers

Drop the save-session/resume system entirely:

- functions/save_claude_session.fish, save_antigravity_session.fish
  (session-start hook scripts)
- functions/claude-resume.fish, antigravity-resume.fish, code-resume.fish
  (consumers of the .claude_session/.antigravity_session files)

Also updates docs/fish-config.md (removes the three function sections,
drops the session-helper mention from the python3 dependency note) and
docs/fish-config.index (removes the orphaned keyword entries). Generated
html/wiki/man are rebuilt by build-docs.yml on merge.

External hook registrations were removed from ~/.claude/settings.json and
~/.gemini/settings.json (the latter pointed at an already-deleted
save_gemini_session.fish); those files live outside this repo.
This commit is contained in:
2026-06-17 16:21:25 -04:00
parent 0c7f7df4ec
commit a9190cf7ec
7 changed files with 4 additions and 245 deletions
-36
View File
@@ -1,36 +0,0 @@
# Copyright (C) 2026 Rootiest
# SPDX-License-Identifier: AGPL-3.0-or-later
# SYNOPSIS
# antigravity-resume
#
# DESCRIPTION
# Resumes an Antigravity (agy) AI session using the session ID saved in
# .antigravity_session in the current directory. Falls back to the interactive
# session browser if no local session file exists.
#
# RETURNS
# 0 Session resumed or interactive picker opened
# 1 Required binaries (agy or save_antigravity_session) are not found
#
# EXAMPLE
# antigravity-resume
function antigravity-resume --description 'Execute antigravity-resume'
if not type -q agy
echo "Error: The 'agy' command is not installed or not in PATH." >&2
return 1
end
if not type -q save_antigravity_session
echo "Error: The companion function 'save_antigravity_session' is missing." >&2
return 1
end
if test -f .antigravity_session
set -l sid (cat .antigravity_session)
# Use --resume (or -r) to jump back in
agy --resume $sid
else
# Fallback to the interactive session browser
agy --resume
end
end
-35
View File
@@ -1,35 +0,0 @@
# Copyright (C) 2026 Rootiest
# SPDX-License-Identifier: AGPL-3.0-or-later
# SYNOPSIS
# claude-resume
#
# DESCRIPTION
# Resumes a Claude Code session using the ID saved in .claude_session in the
# current directory. Falls back to the interactive session picker if no file
# exists.
#
# RETURNS
# 0 Session resumed or interactive picker opened
# 1 Required binaries (claude or save_claude_session) are not found
#
# EXAMPLE
# claude-resume
function claude-resume --description 'Execute claude-resume'
if not type -q claude
echo "Error: The 'claude' command is not installed or not in PATH." >&2
return 1
end
if not type -q save_claude_session
echo "Error: The companion function 'save_claude_session' is missing." >&2
return 1
end
if test -f .claude_session
set -l sid (cat .claude_session)
claude --resume $sid
else
echo "No saved session found in this directory."
claude --resume # Fallback to the interactive picker
end
end
-27
View File
@@ -1,27 +0,0 @@
# Copyright (C) 2026 Rootiest
# SPDX-License-Identifier: AGPL-3.0-or-later
# SYNOPSIS
# code-resume
#
# DESCRIPTION
# Resumes the most recent AI coding session in the current directory. Prefers
# Claude Code (.claude_session), then Antigravity (.antigravity_session),
# falling back to the Claude interactive session picker.
#
# EXAMPLE
# code-resume
function code-resume --description 'Execute code-resume'
if test -f .claude_session
set -l sid (cat .claude_session)
echo "Resuming Claude session: $sid"
claude --resume $sid
else if test -f .antigravity_session
set -l sid (cat .antigravity_session)
echo "Resuming antigravity-cli session: $sid"
agy --resume $sid
else
echo "No local AI session found. Opening picker..."
claude --resume # Default to Claude picker
end
end
-60
View File
@@ -1,60 +0,0 @@
#!/usr/bin/env fish
# Copyright (C) 2026 Rootiest
# SPDX-License-Identifier: AGPL-3.0-or-later
# SYNOPSIS
# Invoked as an Antigravity session hook; reads JSON from stdin.
#
# DESCRIPTION
# Hook script called by the Antigravity CLI (agy) on session start.
# Reads a JSON payload from stdin, extracts the session_id field, and
# writes it to .antigravity_session in the current directory. Ensures
# that file is excluded via .gitignore. Sets the universal variable
# LAST_ANTIGRAVITY_SESSION for cross-terminal access. Falls back to a
# no-op (emitting "{}") when python3 is unavailable (Convention §6).
#
# ARGUMENTS
# stdin JSON payload from the Antigravity CLI containing a "session_id" key
#
# RETURNS
# 0 Always; emits "{}" to stdout as required by the hook contract
#
# EXAMPLE
# echo '{"session_id":"abc123"}' | fish save_antigravity_session.fish
# cat .antigravity_session # → abc123
# echo $LAST_ANTIGRAVITY_SESSION # → abc123
# 1. Read the JSON from stdin
set -l input (cat)
# 2. Extract session_id using Python
# If python3 is unavailable, emit valid empty JSON and skip session
# tracking rather than erroring (see AGENTS.md Convention §6).
if not type -q python3
echo '{}'
exit 0
end
set -l sid (echo $input | python3 -c "import sys,json; print(json.load(sys.stdin).get('session_id', ''))")
set -l session_file ".antigravity_session"
if test -n "$sid"
# 3. Save the session ID locally
echo "$sid" >$session_file
# 4. Smart .gitignore check
# We only attempt this if we are inside a Git repository
if git rev-parse --is-inside-work-tree >/dev/null 2>&1
# If 'git check-ignore' fails, it means the file is NOT currently ignored
if not git check-ignore -q $session_file
# Append a labeled entry to .gitignore
echo -e "\n# AI Session IDs\n$session_file" >>.gitignore
end
end
# 5. Update universal variable for cross-terminal access
set -U LAST_ANTIGRAVITY_SESSION "$sid"
end
# MANDATORY: Every hook must output valid JSON or an empty object
echo '{}'
-60
View File
@@ -1,60 +0,0 @@
#!/usr/bin/env fish
# Copyright (C) 2026 Rootiest
# SPDX-License-Identifier: AGPL-3.0-or-later
# SYNOPSIS
# Invoked as a Claude Code session hook; reads JSON from stdin.
#
# DESCRIPTION
# Hook script called by Claude Code on session start. Reads a JSON payload
# from stdin, extracts the session_id field, and writes it to .claude_session
# in the current directory. Ensures that file is excluded via .gitignore.
# Sets the universal variable LAST_CLAUDE_SESSION for cross-terminal access.
# Falls back to a no-op (emitting "{}") when python3 is unavailable
# (Convention §6).
#
# ARGUMENTS
# stdin JSON payload from Claude Code containing a "session_id" key
#
# RETURNS
# 0 Always; emits "{}" to stdout as required by the hook contract
#
# EXAMPLE
# echo '{"session_id":"abc123"}' | fish save_claude_session.fish
# cat .claude_session # → abc123
# echo $LAST_CLAUDE_SESSION # → abc123
# 1. Read input and extract session ID
# python3 parses the session_id out of the hook's JSON payload. If it is
# unavailable we emit valid empty JSON and skip session tracking rather
# than erroring (see AGENTS.md Convention §6).
set -l input (cat)
if not type -q python3
echo '{}'
exit 0
end
set -l sid (echo $input | python3 -c "import sys,json; print(json.load(sys.stdin).get('session_id', ''))")
set -l session_file ".claude_session"
if test -n "$sid"
# 2. Save the session ID locally
echo "$sid" >$session_file
# 3. Smart .gitignore check
# We check if git even knows about this file.
# If 'git check-ignore' returns 1, it means the file is NOT ignored.
if git rev-parse --is-inside-work-tree >/dev/null 2>&1
if not git check-ignore -q $session_file
# Append the filename to .gitignore
echo -e "\n# AI Session IDs\n$session_file" >>.gitignore
echo "Added $session_file to .gitignore"
end
end
# 4. Update universal variable
set -U LAST_CLAUDE_SESSION "$sid"
end
# MANDATORY: Every hook must output valid JSON
echo '{}'