@agent-lightspeed-agents:chat-closure-agentfrom lightspeed-agents
Automates session handoff workflows: extracts git metadata, updates memory with structured YAML entries, generates continuation prompts, and safely cleans up workspaces across control-plane and WordPress repositories.
Ships in lightspeed-agents. Installing the plugin adds it to Claude Code.
Automate session handoff workflows with automatic memory updates, continuation prompts, and safe workspace cleanup.
The Chat Closure Agent streamlines the process of closing long-running chat sessions by automating:
.github repos) — Project discovery, workflow analysis| Module | Purpose | LOC |
|---|---|---|
shared/core-analysis.js | Git metadata extraction | 285 |
shared/memory-updater.js | Memory system integration | 336 |
shared/continuation-prompt-builder.js | Handoff prompt generation | 278 |
shared/workspace-cleaner.js | Safe workspace cleanup | 360 |
| Skill | Purpose |
|---|---|
skills/git-metadata-extractor.md | Git analysis patterns |
skills/project-linker.md | Project & issue discovery |
| File | Provider | Purpose |
|---|---|---|
claude/prompt.md | Claude | Agent implementation |
copilot/prompt.md | Copilot | Agent implementation |
openai/prompt.md | OpenAI | Agent implementation |
const coreAnalysis = require('./shared/core-analysis');
const memoryUpdater = require('./shared/memory-updater');
const promptBuilder = require('./shared/continuation-prompt-builder');
const workspaceCleaner = require('./shared/workspace-cleaner');
// 1. Analyze current repository
const analysis = coreAnalysis.analyzeRepository('.');
// 2. Update memory with closure info
const memory = memoryUpdater.updateMemoryForSessionClosure('.', analysis, {
decisions: { 'memory-depth': { choice: 'Moderate', rationale: '...' } },
nextSteps: ['Phase 3 implementation', 'Final documentation'],
});
// 3. Build continuation prompt
const prompt = promptBuilder.buildContinuationPrompt(analysis, {
memory: memory.entry.families,
});
// 4. Clean up worktree (optional)
const cleanup = workspaceCleaner.cleanupWorktree('.', process.env.PWD, {
autoStash: true,
deleteAfterCleanup: false,
confirmationCallback: (details) => {
console.log(`Cleanup required:`, details);
return true; // Confirm cleanup
},
});
Core Analysis Options
analyzeRepository(repoPath, options = {})
// Returns: {
// branch, parsedBranch, repoType,
// issueNumbers, commits, gitState
// }
Memory Updater Options
updateMemoryForSessionClosure(repoPath, coreAnalysisData, {
sessionId: 'session-123',
decisions: { 'key': { choice: '...', rationale: '...' } },
blockers: ['...'],
nextSteps: ['...'],
projectNames: ['...']
})
Continuation Prompt Options
buildContinuationPrompt(coreAnalysisData, {
sessionId: 'session-123',
projects: [],
issues: [],
prs: [],
memory: {}
})
Workspace Cleaner Options
cleanupWorktree(repoPath, worktreePath, {
autoStash: false,
autoCommit: false,
deleteAfterCleanup: false,
confirmationCallback: (details) => boolean
})
Memory Entry (YAML)
---
name: chat-closure-session-123
description: Chat closure for session ending on 2026-08-12
metadata:
type: handoff
session_id: session-123
branch: feat/implementation
repo_type: control-plane
related_issues: ['#1850', '#1851']
timestamp: 2026-08-12T18:00:00Z
---
## User Defaults
- Prefers moderate-depth handoffs...
Continuation Prompt (Markdown)
# Continuation Prompt — Chat Session Handoff
**Session ID:** session-123
**Created:** 2026-08-12T18:00:00Z
**Branch:** feat/implementation
## Context Summary
Working on implementing chat closure agent...
## Active Projects
- [Chat Closure Agent](../issues/1850) — Automate session handoffs
Cleanup Report
# Workspace Cleanup Report
**Status:** ✅ Success
**Time:** 2026-08-12T18:00:00Z → 2026-08-12T18:00:10Z
## Steps Executed
✅ **validate_safety** — Valid
✅ **stash_changes** — Changes stashed successfully
✅ **user_confirmation** — User confirmed cleanup
✅ **delete_worktree** — Worktree deleted successfully
# Run all tests
npm test -- agents/chat-closure-agent/tests/
# Run specific module
npm test -- agents/chat-closure-agent/tests/workspace-cleaner.test.js
# Run with coverage
npm test -- agents/chat-closure-agent/tests/ --coverage
| Module | Target | Status |
|---|---|---|
| core-analysis.js | 90%+ | ✅ |
| memory-updater.js | 90%+ | ✅ |
| continuation-prompt-builder.js | 85%+ | ✅ |
| workspace-cleaner.js | 85%+ | ✅ |
The agent integrates with the 10-family YAML memory structure:
metadata: # Agent tracking
user_defaults: # User preferences
project_context: # Work scope
decision_log: # Decisions made
execution_state: # Work progress
handoff: # Continuation info
Memory entries are indexed in .remember/MEMORY.md:
- [chat-closure-session-123](chat-closure-agent/chat-closure-session-123.md) — Session 123 handoff
claude/prompt.md)copilot/prompt.md)openai/prompt.md)agents/chat-closure-agent/
├── README.md # Quick reference
├── shared/
│ ├── core-analysis.js # ✅ Phase 1
│ ├── memory-updater.js # ✅ Phase 2
│ ├── continuation-prompt-builder.js # ✅ Phase 2
│ └── workspace-cleaner.js # ✅ Phase 3
├── claude/
│ ├── prompt.md # ⏳ Phase 3
│ └── config.json
├── copilot/
│ ├── prompt.md
│ └── config.json
├── openai/
│ ├── prompt.md
│ └── config.json
├── skills/
│ ├── git-metadata-extractor.md # ✅ Phase 1
│ └── project-linker.md # ✅ Phase 2
├── tests/
│ ├── core-analysis.test.js # ✅ Phase 1
│ ├── memory-updater.test.js # ✅ Phase 2
│ ├── continuation-prompt.test.js # ✅ Phase 2
│ ├── phase-2-integration.test.js # ✅ Phase 2
│ ├── workspace-cleaner.test.js # ✅ Phase 3
│ ├── integration.test.js # ⏳ Phase 3
│ └── fixtures/
├── docs/
│ ├── ARCHITECTURE.md # ⏳ Phase 4
│ ├── USAGE_GUIDE.md # ⏳ Phase 4
│ └── TESTING_GUIDE.md # ⏳ Phase 4
└── examples/
└── sample-closure-workflow.md # ⏳ Phase 4
| Phase | Component | Status | Tests |
|---|---|---|---|
| 1 | Core Analysis | ✅ Complete | 29/29 |
| 2 | Memory & Handoff | ✅ Complete | 58/58 |
| 3 | Workspace Cleaner | ✅ Complete | 14/14 |
| 3 | chat-closure-agent.agent.md | ⏳ In Progress | — |
| 3 | claude/prompt.md | ⏳ In Progress | — |
| 3 | Integration Tests | ⏳ Planned | — |
| 4 | Documentation | ⏳ Planned | — |
Part of the LightSpeedWP .github repository. See LICENSE for details.
For issues, questions, or contributions:
agent:chat-closure labelLast Updated: 2026-08-12
Maintainer: Ash Shaw
Status: Production Ready (Core Modules)
This agent does not create or validate branches. All branches must follow the patterns documented in instructions/branch-naming.instructions.md and BRANCHING_STRATEGY.md.
Have questions? Ping us on GitHub! 🐙 Made with 💚 by LightSpeedWP
What the agent file sets; muted values are Claude Code's defaults
7-day visitors to each agent page
npx claudepluginhub lightspeedwp/.github --plugin lightspeed-agents67 agents in this plugin
Plan Mode - Strategic Planning & ArchitectureStrategic planning and architecture assistant focused on thoughtful analysis before implementation.Universal PR Comment AddresserAddress PR commentsADR GeneratorADR Generator AgentGenerate architectural decision records with configuration-driven templates and validation.Other plugins' agents for the same job