Seamlessly log your AI-powered coding conversations. This command-line interface (CLI) tool captures your terminal interactions with AI models like Gemini and Claude, saving entire sessions as clean Markdown documents for easy review and documentation.
Wrap any command with ai-cli-log to start a logging session. The session will be saved to a Markdown file in the .ai-cli-logs directory.
For example, to log a session with Google's Gemini CLI (gemini):
Or to log a session with another tool, like claude:
The recorded session will be saved to a file like .ai-cli-logs/session-YYYYMMDD-HH:mm:ss.md.
- Interactive Session Capture: Acts as a wrapper for other CLI tools, capturing full interactive sessions, including user input and the "rendered" output (what you actually see on the terminal after backspaces, cursor movements, etc.).
- Accurate Logging: Utilizes node-pty for pseudo-terminal emulation and @xterm/headless to parse ANSI escape codes, ensuring the captured log accurately reflects the final state of the terminal screen.
- Markdown Output: Saves recorded sessions as clean Markdown files for easy readability and documentation.
- TypeScript Implementation: Built with Node.js and TypeScript, leveraging a robust ecosystem for CLI development and type safety.
This project was generated with the assistance of Google Gemini. You can review the detailed development process and interactions in the .ai-cli-logs directory, specifically starting with 0001.md and subsequent log files.
Special thanks to Gemini for its invaluable help in the development of this tool!
无缝记录您与 AI 进行的编程对话。本命令行工具 (CLI) 能捕获您在终端中与 Gemini、Claude 等 AI 模型的交互过程,并将整个会话保存为清晰的 Markdown 文档,便于后续查阅和归档。
使用 ai-cli-log 命令来包装任何您想记录的命令。会话日志将被保存到当前目录下的 .ai-cli-logs 文件夹中。
例如,记录与 Google Gemini CLI (gemini) 的会话:
或者记录与其他工具(如 claude)的会话:
记录的会话将保存为类似 .ai-cli-logs/session-YYYYMMDD-HH:mm:ss.md 的文件。
为了简化您的工作流程,您可以为常用命令创建 shell 别名。例如,快速记录您的 Gemini CLI 会话:
然后,您只需运行:
- 交互式会话捕获: 作为其他 CLI 工具的包装器,能够捕获完整的交互式会话,包括用户输入和最终“渲染”在屏幕上的输出(即处理了退格、光标移动等控制字符后的真实显示内容)。
- 精确日志记录: 利用 node-pty 进行伪终端模拟,并结合 @xterm/headless 解析 ANSI 转义码,确保日志精确还原终端的最终显示状态。
- Markdown 输出: 将会话保存为干净、易读的 Markdown 文件,方便查阅和整理。
- TypeScript 实现: 基于 Node.js 和 TypeScript 构建,确保了代码的健壮性和类型安全。
本项目是在 Google Gemini 的协助下生成的。您可以在 .ai-cli-logs 目录中查看详细的开发过程和交互记录,特别是从 0001.md 开始的日志文件。
特别感谢 Gemini 在本项目开发过程中提供的宝贵帮助!
.png)


