ワンクリックで
session-management
Manage work sessions with creation, loading, syncing, and archiving capabilities.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Manage work sessions with creation, loading, syncing, and archiving capabilities.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
| name | session-management |
| description | Manage work sessions with creation, loading, syncing, and archiving capabilities. |
Manages work sessions. Session paths must be explicitly provided or known from context.
IMPORTANT: Sessions do NOT have a default location. The session path must be:
start ~/projects/my-project/_sessions/session-name).samocode file under SESSIONS pathIf session path cannot be determined: STOP and ask the user for the session location.
Finding .samocode: Look in current working directory (where the provider CLI was started). Never guess paths - if .samocode not found, ask user.
IMPORTANT: All git operations (fetch, branch creation, worktree management) MUST run from the correct repository directory.
.samocode from CWD — use MAIN_REPO value as the repo directory for all git commands.samocode not found or MAIN_REPO not set: fall back to git rev-parse --show-toplevel from CWDUse $ARGUMENTS to specify action and parameters:
start [session-path/name] - Create new sessioncontinue [session-name-pattern] - Load existing sessionsync - Sync current conversation to active sessionarchive [session-name-pattern] - Archive a sessionCreate a new work session.
Resolve session location:
.samocode from current working directory, use SESSIONS path.samocode not found: STOP and ask user - never guess or create arbitrary foldersParse session name:
Create session folder:
[SESSIONS_DIR]/[YY-MM-DD]-[session-name]/ (use current date for folder name)Create worktree (if .samocode has WORKTREES):
Read MAIN_REPO and WORKTREES from .samocode. If both are set, create a worktree:
# Derive branch name: strip date prefix from session folder name
# e.g., "26-02-05-my-feature" -> "my-feature"
BRANCH_NAME=[session-name] # the name before date-prefixing
# If GIT_BRANCH_PREFIX env var is set, prepend it: [prefix]/[branch-name]
# Fetch and detect default branch
cd [MAIN_REPO]
git fetch origin
DEFAULT_BRANCH=$(git remote show origin | grep 'HEAD branch' | cut -d: -f2 | xargs)
# Create worktree from remote default branch
git worktree add -b [BRANCH_NAME] [WORKTREES]/[YY-MM-DD]-[session-name] origin/$DEFAULT_BRANCH
If worktree creation fails (branch already exists), try attaching to existing branch:
git worktree add [WORKTREES]/[YY-MM-DD]-[session-name] [BRANCH_NAME]
Working Dir = [WORKTREES]/[YY-MM-DD]-[session-name]
Restore gitignored env files in the worktree (git worktree add does not copy gitignored files):
.env (or per-service .env) that lives outside git, copy it from the main repo, or seed it from a secrets store. Path layout is project-specific — check MAIN_REPO's .env* files and the project README.If WORKTREES not set (non-repo project): fall back to MAIN_REPO, or git rev-parse --show-toplevel, or current directory.
Create _overview.md:
# Session: [session-name]
Started: [TIMESTAMP_LOG]
Working Dir: [worktree-path or fallback]
## Status
Phase: investigation
Iteration: 1
Blocked: no
Last Action: Session created
Next: Ready to work
## Flow Log
- [TIMESTAMP_ITERATION] Session created
## Files
(none yet)
## Plans
(none yet)
## Linear Tasks
(none yet)
Commit (if sessions dir is a git repo):
cd [SESSIONS_DIR] && git add . && git commit -m "Start session: [session-name]"Confirm to user:
Session created: [YY-MM-DD]-[session-name]
Path: [full-path]
Working Dir: [worktree-path or fallback]
Branch: [BRANCH_NAME]
IMPORTANT: This is now your active session. Remember this path for subsequent commands.
Ready to work. Use /dive, /task, or /create-plan to continue.
IMPORTANT: After creating the session, keep the session path in your working memory for all subsequent session-aware commands.
Load and continue working in an existing session.
Resolve session location:
.samocode file for SESSIONS pathFind matching sessions:
*$ARGUMENTS* (exclude _archive/)Handle results:
Load session:
_overview.md from the session folder- [TIMESTAMP_ITERATION] Session resumedgit add . && git commit -m "Resume session: [session-name]"Present summary:
Session: [session-name]
Path: [full-path]
Working Dir: [from _overview.md]
Started: [date]
Recent Activity:
[Last 5-10 Flow Log entries]
Files: [count]
[List with brief descriptions]
Plans: [list if any]
Linear Tasks: [list if any]
---
Session loaded. Ready to continue.
IMPORTANT: After loading, keep the session path in your working memory for all subsequent session-aware commands.
Ensure all work from this conversation is recorded in the active session.
Check for active session:
Read current session state:
[SESSION_PATH]/_overview.mdReview conversation for unrecorded work:
Update _overview.md:
Create detail files if warranted:
Commit (if git repo):
cd [SESSION_DIR] && git add . && git commit -m "Sync session: [session-name]"Extract learnings:
Report:
Archive a session (full) or archive work within a session (partial).
archive - Archive entire active session (moves folder to _archive/)archive [session-name] - Archive entire named sessionarchive keep file1.md file2.md - Archive work files within session, keep specified filesarchive [session-path] keep file1.md - Archive work in specific session, keep filesIf arguments after "archive" are empty:
If arguments provided (no "keep"):
*$ARGUMENTS* (exclude _archive/)Get session info:
[SESSION_PATH]/_overview.mdCreate archive folder if needed:
mkdir -p [SESSIONS_DIR]/_archive
Remove worktree (if applicable):
/worktrees/:
MAIN_REPO from .samocode (see "Repository Resolution" section)MAIN_REPO directory:
cd "$MAIN_REPO" && git worktree remove [working_dir_path]
Move session folder:
mv [SESSION_PATH] [SESSIONS_DIR]/_archive/
Commit changes (if git repo):
cd [SESSIONS_DIR] && git add . && git commit -m "Archive session: [session-name]"Clear active session (if archiving active session):
Extract learnings:
Confirm to user:
Session archived: [session-name]
Moved to: [archive-path]
Worktree removed: [path] (branch preserved)
Session closed.
Archives completed work within a session while keeping important deliverables accessible.
Example: archive keep competitor-analysis.md → archive active session, keep competitor-analysis.md
Resolve session:
Get timestamp and slug:
TIMESTAMP_FOLDER=$(date '+%y-%m-%d')
[SESSION_PATH]/_archive/[YY-MM-DD]-[slug]/Create archive subfolder:
mkdir -p [SESSION_PATH]/_archive/[YY-MM-DD]-[slug]
Identify files to archive:
.md files in session root EXCEPT:
_overview.md (always kept - session state)_qa.md (always kept if exists)_signal.json (always kept)[MM-DD-HH:mm]-*.md)Move files to archive:
for file in [files_to_archive]; do
mv "$file" [SESSION_PATH]/_archive/[YY-MM-DD]-[slug]/
done
Update _overview.md:
- [TIMESTAMP_LOG] Archived work to _archive/[YY-MM-DD]-[slug]/, kept: [kept_files]Extract learnings:
Report to user:
Work archived within session.
Archived to: [SESSION_PATH]/_archive/[YY-MM-DD]-[slug]/
Files moved: [count] files
Kept in place: [kept_files]
Investigate GitHub pull request review comments, determine whether each comment is valid, propose fixes, and document the analysis in an active samocode session. Use when the user asks to analyze PR comments, run /prcomments, investigate review feedback, or triage pull request comments.
Run OpenAI Codex CLI as a subagent for second opinions, code reviews, and questions. Use when you want a different AI model's perspective.
Run Anthropic Claude CLI as a subagent for second opinions, code reviews, and questions. Use from a Codex (or other) session when you want Claude's perspective.
Create GitHub PR review comments from review findings. Use after running a code review to post findings as line-bound comments.
Execute implementation tasks with different approaches (single, dual-agent, plan-based).
Create implementation plans with phase management.