Feature Request: Auto-documentation on CLI session exit

Resolved 💬 5 comments Opened Jul 12, 2025 by ghost Closed Dec 30, 2025

Problem

When using Claude Code in terminal/CLI mode, sessions contain valuable insights about server configurations, troubleshooting steps, and system changes. This knowledge is lost when the terminal session ends,
requiring users to manually update their CLAUDE.md files.

Proposed Solution

Add an optional auto-documentation feature for CLI sessions that:

  1. Triggers on CLI session termination (Ctrl+C, exit command, or terminal close)
  2. Analyzes the terminal session history using AI to identify:
  • System configuration changes made during the session
  • Security improvements discovered/implemented
  • Troubleshooting discoveries and solutions
  • Service configurations modified
  1. Prompts user in terminal with suggested CLAUDE.md updates
  2. Auto-updates CLAUDE.md if user confirms

### Example CLI Flow
```bash
$ claude-code
[... session work ...]
^C
claude-code: Terminal session ending. Found 3 potential documentation updates:

  • Mail system configuration (root → postmaster@mydomain.com routing)
  • Security: Blocked malicious IP 139.162.173.2xx
  • Fail2ban status: SSH (10 banned), Postfix (14 banned)

Update CLAUDE.md? [y/N]: y
CLAUDE.md updated successfully.
$

  ### Alternative Approach
  Alternatively, it could offer a simple exit prompt asking whether the session learnings should be reviewed for documentation. If the user confirms, show a preview of what would be added before updating CLAUDE.md.

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗