Skip to content
Development
Command

/save

Save current session. Writes a session log with what was done, decisions made, and what's pending. Optional: commit & push.

From plugin
7044 skills69 agents44 commands
shell
$ npx -y skills add avelikiy/great_cto --agent claude-code

Ships with great-cto. Installing the plugin gets this command.

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/save

Context preview

What this command does when you run it.

Save current session. Writes a session log with what was done, decisions made, and what's pending. Optional: commit & push.

Command definition

save.md
description: "Save current session. Writes a session log with what was done, decisions made, and what's pending. Optional: commit & push."
argument-hint: "[description] — e.g. 'implemented auth flow' (auto-inferred if omitted)"
user-invocable: true
allowed-tools: Read, Write, Bash, Glob, Grep
model: haiku

You are the great_cto `/save` command. Your job is to create a compact, useful session log that makes `/resume` fast next time. Write, don't ask — infer everything from the conversation and git.

Step 1 — Gather session data (run all in parallel)

# What changed in git during this session
git diff --stat HEAD 2>/dev/null | head -20
git log --oneline --since="8 hours ago" 2>/dev/null | head -10

# Current open tasks
cat .great_cto/tasks.md 2>/dev/null | grep -E "^\- \[.\]" | head -20

# Existing logs (to auto-number)
ls .great_cto/logs/session-*.md 2>/dev/null | wc -l

# Project name + phase
grep -E "^# |^phase:|^primary:" .great_cto/PROJECT.md 2>/dev/null | head -3

Step 2 — Infer session description

If the user provided `$ARGUMENTS` — use that as the session description.

Otherwise infer from: 1. Git commits made during this session (last 8 hours) 2. What was discussed/built in this conversation 3. File changes visible in `git diff --stat`

Keep the description to 3–5 words: `"implemented auth flow"`, `"fixed streaming archetype"`, `"added regulated auto-detect"`.

Step 3 — Write session log

mkdir -p .great_cto/logs
DATE=$(date +%Y-%m-%d)
TIME=$(date +%H:%M)
SLUG=$(echo "<session-description>" | tr ' ' '-' | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9-]//g' | cut -c1-40)
LOG_FILE=".great_cto/logs/session-${DATE}-${SLUG}.md"

Write `$LOG_FILE`:

---
date: <YYYY-MM-DD>
time: <HH:MM>
duration: <estimated from conversation length — "~30 min" / "~2 h">
concepts: [<keyword1>, <keyword2>, <keyword3>]
---

# Session: <description>

## Done

- <bullet: what was actually implemented / fixed / decided>
- <bullet: second thing>
- <bullet: third thing if applicable>

## Decisions

- <any explicit decisions made — e.g. "decided to use X over Y because Z">
  *(none)* — if nothing was explicitly decided

## Pending

- <what was left unfinished or is the clear next step>
- <second pending item if any>

## Files changed

<output of git diff --stat HEAD or "no git changes">

## Commits

<git log --oneline --since="8 hours ago" output, or "no commits this session">

**Concepts field rules** (enables `/recall` search):

  • Extract 3–6 lowercased keywords that best describe what was worked on
  • Prefer specific terms over generic: `"quota-check"` not `"monitoring"`, `"side-panel"` not `"ui"`
  • Include: main feature slug, key library/tool names, archetype if relevant
  • Examples: `[quota, oauth, board, side-panel]` · `[orchestrator, toml, 3-state-completion]` · `[substantiveness, explicit-gate, ai-security-reviewer]`
  • These are the only index entries for `/recall` — choose them to be findable in 6 months

Step 3b — Update brain.md tiers (optional, 60 seconds)

After writing the session log, optionally promote insights to `.great_cto/brain.md`:

**EPISODIC tier** — always update with a 1-2 sentence session summary:

### <YYYY-MM-DD> — <slug>
<1-2 sentence outcome>
Key decisions: <brief>

Rotate: keep only the 5 most recent episodic entries. Drop the oldest when adding the 6th.

**SEMANTIC tier** — promote if a fact was confirmed for the 2nd time this session:

  • Architectural fact stated the same way in 2+ sessions → append to `## SEMANTIC → Architecture`
  • Tech choice made explicitly → append to `## SEMANTIC → Tech Choices`
  • New constraint confirmed → append to `## SEMANTIC → Constraints`

**PROCEDURAL tier** — promote if a workflow was repeated (not first time):

  • Release procedure used again → verify entry exists, update if steps changed
  • Debug pattern used 2nd time → add named procedure entry

**WORKING tier** — always overwrite with current state:

Active task: <current task or "—">
Current focus: <what you're doing>
Blockers: <known blockers or "—">

Skip brain.md update if the session was trivial (< 30 min, no architectural decisions).

Step 4 — Update tasks.md (if open tasks changed)

If tasks were completed during this session, mark them done:

# Mark completed tasks
sed -i 's/^- \[ \] <completed-task>/- [x] <completed-task>/' .great_cto/tasks.md 2>/dev/null || true

Only modify tasks that were explicitly completed — don't guess.

Step 5 — Confirm and optionally commit

Show the CTO:

✅ Session saved → .great_cto/logs/session-<date>-<slug>.md

  Done:    <N> items
  Pending: <N> items
  Commits: <N> this session

Commit & push? (y/n)

If user says **yes** (or `/save commit`):

git add .great_cto/logs/
git commit -m "chore: session log <date> — <description>"
git push

If user says **no** — done. Log stays local (that's fine).

Step 6 — Remind about next session

Always end with:

Next session: run `/resume` to restore this context instantly.

---

Notes

  • Keep bullets **concrete** — "added streaming archetype with kafka/flink signals" not "worked on archetypes"
  • Pending should always have **at least one item** — if everything is done, the pending item is "ship / merge / deploy"
  • Do NOT dump raw code or long diffs — just the summary
  • Tone: crisp, factual, no fluff

---

Context compression protocol

Long sessions accumulate noise. Apply compression at three levels before writing the session log:

Level 1 — Micro-compact (tool outputs)

After each tool call, compress the raw output to a single insight line. Do not paste full Bash output into the session log.

  • ❌ `"git log output: abc123 feat: add streaming abc456 fix: null check..."`
  • ✅ `"2 commits: streaming archetype + null-check fix"`

Level 2 — Phase summary (completed work stage)

When a pipeline phase completes (architect done, QA done, devops done), compress that phase to ≤3 bullets in the session log:

Read more
Read it on GitHub ↗

Showing the first part of this file.

Ships withgreat-cto

Don't buy software. Get the work done. GreatCTO ships AI autopilots that run a whole business function — medical coding, legal docs, procurement, accounting, IT, tax — from intake to outcome. A qualified human signs only the judgment calls. Live connectors, built-in compliance.

Get the whole plugin, auto-invoked
Stats
70
Stars
0
Views
12
Forks
Active
Maintenance
JavaScript
Language
MIT
License
54m ago
Last commit
4mo ago
Created

Repo: avelikiy/great_cto