# close-session

Adopt this skill: https://proskills.md/skills/other/awrshift-agent-memory-kit-plugins-memory-kit-skills-close-session

Page: https://proskills.md/skills/other/awrshift-agent-memory-kit-plugins-memory-kit-skills-close-session
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: plugins/memory-kit/skills/close-session/SKILL.md
size: 4320
upstream: https://github.com/awrshift/agent-memory-kit/blob/main/plugins/memory-kit/skills/close-session/SKILL.md

```text
---
name: close-session
description: End-of-session ritual — audit today's patterns against accumulated memory, propose promotions, refresh MEMORY.md, and write the session handoff. Use when the user says "/memory-kit:close-session", "закрой сессию", "закрываем", "we're done for today", "wrap up".
allowed-tools: Read, Write, Edit, Grep, Glob, Bash
---

# /close-session — the end-of-session ritual

You close the session in four steps. Don't just dump — **audit**. Everything you write, you
announce briefly; anything promoted to rules/concepts needs the user's verbal "yes" first.

## Step 1 — Capture what's new
Scan this session for observations worth keeping. Append each to `.claude/memory/MEMORY.md`
as a ONE-LINE `[YYYY-MM-DD]`-prefixed entry. Short, scannable, no essays (long rationale
belongs in a concept article, step 2).
- **File each line under a TOPIC heading** of the patterns section (engineering, process,
  infra, the domain…) — create the topic if none fits. Never open a heading named after the
  session or the date (`### s66 (2026-09-25)`, `## Session 65 wrap`): the date lives in each
  line's prefix, the session narrative lives in the handoff (step 4). The SessionStart hook
  flags such headings.
- **Don't capture what the always-loaded layer already says** (`CLAUDE.md`, rules without
  `paths:`) or a number whose source of truth lives elsewhere (a price table, a config) —
  point at the source instead of copying the value.

## Step 2 — Audit & promote (the valuable part)
Read the date-tagged entries in MEMORY.md. Look for repetition: **did this pattern appear on
3+ different dates?** Surface 2-4 candidates, be specific: "noticed [date], [date], [date] you
said X — codify as a rule or a concept article?"
- User says yes → write `knowledge/concepts/<topic>.md` (facts + rationale; frontmatter per
  `knowledge/index.md` spec) or `.claude/rules/<name>.md` (mechanical always/never constraint;
  only for patterns stable 6+ months). Update `knowledge/index.md` (one line per concept).
- Promoted or long-absorbed entries get PRUNED from MEMORY.md — that's how it stays under its
  caps (180 lines / 32 KB / 3000 chars per line).
- Writing a fact into a second place? `reference/doc-governance.md` — one SSOT per fact, and when
  a fact changes you grep its restatements in the same pass. A product or architecture decision
  goes to the ledger instead — `projects/<name>/decisions-log.md`, format in
  `reference/decisions-log.md`. A plan, a spec, a research finding or a QA record is NOT memory:
  it belongs in that project's folder, per the map in its `README.md`.

## Step 3 — Refresh the MEMORY.md header
The header (everything above the first `---`) is «current state of work», 2-3 sentences,
**REPLACED** every close — never a chronicle of past sessions. Per-session detail lives in the
handoff, not stacked in the header.

## Step 4 — Write the handoff
Copy `context/handoffs/HANDOFF-TEMPLATE.md` → `context/handoffs/<topic>-<YYYY-MM-DD>.md` and
fill its five sections (what was done · where things stand · memory updates · next steps ·
opening note). The SessionStart hook injects the newest handoff next time — this file IS the
"remember where we left off" mechanism.

## Also check (30 seconds)
- **Experiment hygiene:** any `experiments/*-YYYYMMDD/` older than 30 days → ask: still active
  or close (distill → delete)?
- **Backlogs:** `projects/*/BACKLOG.md` task statuses reflect today's reality — a `DONE`
  nobody verified is still `IN PROGRESS`.
- **Project map:** anything you wrote today into a project folder is a row in that project's
  `README.md` map, and the map's `Last verified` is today's date.
- **Specs vs code:** any spec still `building` after a merge, or any `assumed` spec → run
  `/memory-kit:code-sync` (it reconciles statuses from repo evidence; this ritual does not).
- **Caps:** if MEMORY.md is near any cap, do a deeper prune now, not "next time".

## What NOT to do
- Don't promote without the user's yes. Repetition makes a CANDIDATE, not a rule.
- Don't stack "Prior session" paragraphs in the MEMORY header — replace it.
- Don't group today's lines under a session heading — see Step 1.
- Don't write a handoff longer than ~1 screen. It's a note, not a transcript.
```

## File: README.md
upstream: https://github.com/awrshift/agent-memory-kit/blob/main/README.md

````text
![Multi-Agent Driven Development: you talk to one main session; it sends brief files to three window sessions, each with its own subagents; files and memory underneath](.github/assets/10-team-of-sessions.svg)

# Multi-Agent Driven Development Kit

**You talk to one agent. It runs the team.**

*Formerly Claude Memory Kit — the plugin id `memory-kit` and every command name stay the same for compatibility.*

A plugin and a working method for Claude Code. The scarcest resource in agent-driven work is your attention, so the
method spends it in one place: **you talk to one agent only — the main session.** It holds the whole picture, so you
decide with one counterpart instead of five; it splits the work across the other sessions and their helpers. You
never talk to the windows or the helpers, never relay a brief, never read their raw output: decisions, evidence and
questions reach you from one place.

**The team is two levels deep.** You → main → three windows → their subagents.

- **Main** plans the round, writes the specs, rules on every finding, accepts work on evidence, and is the only one
  that acts outward (a push, a PR, a reply others will see).
- **Three windows are full Claude Code sessions, not subagents** — each opened by you in its own terminal, visible,
  with its own context, tools, hooks and memory, holding one task to its stop points.
- **Each window calls its own subagents** (a builder, a reviewer, a fact-gatherer), each with an explicit model.

**Why sessions, and not only subagents.** A subagent lives inside its caller's session: it works in its own context
and hands back a summary, it cannot ask you a question, and its permission prompts surface in the caller's terminal
(Claude Code docs, [subagents](https://code.claude.com/docs/en/sub-agents)). A window is a session you can watch and
that starts like any session — your `CLAUDE.md`, the hooks, this kit's memory and handoff — so it can hold a task
across several stops and reviews and still survive main being cleared. Claude Code's own
[agent teams](https://code.claude.com/docs/en/agent-teams) also run teammates as full sessions, but let you talk to
any teammate directly; this method keeps you talking to main only.

**What crosses each level is a file.** A brief, a spec, a report, a ruling, an acceptance record — committed to the
repository. Messages only point at files, five lines at most.

**Who decides what.** You: product scope, and money above the cap you set. Main: architecture, acceptance, every
outward action. Windows: build to a spec and report; they never decide.

**Memory is the foundation.** Short dated notes and a handoff, as plain files in your repository, read at every
start — so main, each window, and you after a day away all pick up where the work stopped after a cleared context.
Dangerous commands are stopped before they run: a force push, `reset --hard`, a read of `.env`, an edit that weakens
a test. Nothing becomes a rule without your yes. No database, no service, no API key. An independent project, not
made or endorsed by Anthropic.

**Why the method matters.** In one project, in five of six pieces of work the fix made after a review reached acceptance
with nobody reviewing the fix itself; checked afterwards, two of those five carried a defect serious enough to block. A
small sample from one project — a reason to look at your own fixes, not a proven rate.

[![Version](https://img.shields.io/github/v/release/awrshift/agent-memory-kit?label=version&color=CFEF4A&cacheSeconds=1800)](https://github.com/awrshift/agent-memory-kit/releases)
[![License: MIT](https://img.shields.io/badge/License-MIT-55503E?labelColor=55503E&color=55503E)](LICENSE)
[![Claude Code plugin](https://img.shields.io/badge/Claude_Code-plugin-CFEF4A)](#install)

**On this page:** [How it works](#how-it-works) · [Install](#install) · [The method](#the-method-in-one-screen) ·
[Team of sessions](#working-as-a-team-one-main-session-and-three-windows) · [What is inside](#what-is-inside) · [Reference](#reference--read-on-demand) ·
[What it writes](#what-it-writes-in-your-repository) · [Privacy and cost](#privacy-and-cost) ·
[Proof status](#proof-status)

## How it works

1. **You work as usual.** When something is worth keeping, the agent writes one dated line and tells you.
2. **You close the session.** It looks for patterns across days («you rejected this on four different days — make it
   a rule?»), writes what you approve, and leaves a handoff note.
3. **The next session starts already knowing** — memory, the handoff and the list of knowledge articles are loaded
   by a hook.
4. **When the work outgrows one session,** main runs the team: a spec file first, a brief file per window, a review of
   every diff, a record of what was accepted and why ([below](#working-as-a-team-one-main-session-and-three-windows)).
   Memory works on its own; take the team half when you hand work to helpers or run several sessions at once.

## Install

Inside the repository, in Claude Code:

```shell
/plugin marketplace add awrshift/agent-memory-kit
/plugin install memory-kit@memory-kit
/memory-kit:setup
```

`setup` reads what the repository already has and **proposes before writing anything**; your `CLAUDE.md` stays yours.
Git is optional. To upgrade later: `claude plugin marketplace update memory-kit`, then
`claude plugin update memory-kit@memory-kit` (the full id is needed), and restart the session. Upgrades never touch
your files. In a repository that never ran `setup`, the hooks inject one pointer line and write nothing.

## The method in one screen

![The method: main writes the spec file; windows build with their subagents and leave a report; every diff, fix rounds included, is reviewed by an agent that did not write it; main accepts on evidence with a gate receipt; a report is input, never a fact](.github/assets/12-method.svg)

This is a method the agent follows, not something the hooks enforce. The main session designs, decides and integrates;
helpers build or gather facts from a spec file. The always-loaded invariants live in `templates/rules/orchestration.md`
(a plugin cannot ship rules; `setup` offers to copy it).

| Step | What happens | Open |
|---|---|---|
| 1. Spec file | Goal, non-goals, acceptance `AC-n` written first, value sources, gates; a depth pass, a practice line and a review line before hand-over; a reader who did not write it checks it against the code | `SPEC-TEMPLATE.md` · `reference/spec-depth.md` |
| 2. Build | `executor` (or your own builder) in a worktree, one integrator; several sessions → one main and windows working from brief files | `reference/parallel-development.md` · `reference/window-cycle.md` · `WINDOW-BRIEF-TEMPLATE.md` |
| 3. Review, fix rounds included | Every nontrivial diff, and every fix round's diff, reviewed by an agent that did not write it; findings triaged to the owning layer; a fix round may not redesign | `reference/review-loop.md` §0–§1 · `reference/review-classes.md` · `reference/acceptance.md` |
| 4. Acceptance record | One file per accepted head: spec, rounds, review, gates re-run on that tree, one ruling per finding | `reference/acceptance.md` · `ACCEPTANCE-TEMPLATE.md` · `reference/orchestrator-fact-check.md` |
| 5. Findings registry | Each confirmed finding logged by class and family; a family seen three times is promoted into a check | `reference/review-loop.md` §2 |

## Working as a team: one main session and three windows

The way the maintainer works daily: you talk to ONE session — main — and main runs three more Claude Code sessions
(windows) on the same repository. Work crosses between them as files; messages only point at files.

```
                         you
                          │  talk only here
                   ┌──────┴──────┐
                   │    main     │  plans the round · specs · rulings · acceptance · memory
                   └──┬───┬───┬──┘
       brief file ↓   │   │   │   ↑ report file + message ≤ 5 lines
               ┌──────┘
````
