Discover MCPs & agents
Loading MCPs and agents…
Loading MCPs and agents…
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.
Jump to setup instructionsFetched from the repository for this visit.
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 plain text documents for easy review and documentation.
npm install -g ai-cli-log
Wrap any command with ai-cli-log to start a logging session. The core structure is:
ai-cli-log [global-options] run <command-to-log> [args...]
Examples:
Basic Logging: Record a session with Google's Gemini CLI.
ai-cli-log run gemini
Logs are saved to the .ai-cli-log/ directory.
AI-Powered Filenames: Use an AI summary for the log's filename. The options must come before the run command.
# Enable summary with the default summarizer
ai-cli-log -s run gemini
# or
ai-cli-log --with-summary run gemini
# Enable summary and specify a summarizer
ai-cli-log --by gemini-pro run gemini
# or
ai-cli-log --summarizer gemini-pro run gemini
This will use your default (or specified) summarizer to generate a descriptive filename like gemini-20250713-153000-fix-database-connection-error.txt.
For even faster access, you can create shell aliases. This allows you to start a logged session with a short command. Add these to your shell's configuration file (e.g., ~/.bashrc, ~/.zshrc).
# Start a logged Gemini session with an AI-generated summary
alias ag='ai-cli-log -s run gemini'
# Start a logged Claude session with an AI-generated summary
alias ac='ai-cli-log -s run claude'
# You can also omit the -s flag for basic logging
alias ag-log='ai-cli-log run gemini'
Now, you can simply run ag to start a recorded Gemini session.
ai-cli-log loads configuration from config.json files. It prioritizes a local (project-specific) configuration over the global one.
Loading Order:
.ai-cli-log/config.json in the current directory first.~/.config/ai-cli-log/config.json.You can create these files manually or by using the interactive setup command.
init)The init command helps you create a configuration file. It will scan for available AI tools, guide you through creating summarizer profiles, and set a default.
To create a global configuration:
ai-cli-log init
This saves the configuration to ~/.config/ai-cli-log/config.json.
To create a local (project-specific) configuration:
ai-cli-log init --local
This saves the configuration to .ai-cli-log/config.json in the current directory.
Here is an example of a manual config.json:
{
"summarizer": {
"default": "gemini-pro",
"summarizers": [
{
"name": "gemini-pro",
"tool": "gemini",
"prompt": "You are a log summarizer. Your response MUST be a valid JSON object with one key: \"summary\" (a 3-5 word, lowercase, filename-friendly phrase). Example: {\"summary\": \"refactor-database-schema\"}. The session content is:",
"maxLines": 100
},
{
"name": "ollama",
"tool": "ollama",
"model": "llama3",
"prompt": "You are a log summarizer. Your response MUST be a valid JSON object with one key: \"summary\" (a 3-5 word, lowercase, filename-friendly phrase). Example: {\"summary\": \"refactor-database-schema\"}. The session content is:",
"maxLines": 50
},
{
"name": "sgpt",
"tool": "custom",
"prompt": "You are a log summarizer. Your response MUST be a valid JSON object with one key: \"summary\" (a 3-5 word, lowercase, filename-friendly phrase). Example: {\"summary\": \"refactor-database-schema\"}. The session content is:",
"command": ["sgpt", "--chat", "session-summary", "\"{{prompt}}\""],
"maxLines": 50
}
]
}
}
@xterm/headless to interpret ANSI escape codes, ensuring the log accurately reflects the final terminal state (spinners, progress bars, etc.).gemini, sgpt, ollama, etc.) for generating summaries.This project was generated with the assistance of Google Gemini. You can review the detailed development process and interactions in the .ai-cli-log directory of the project's GitHub repository: https://github.com/alingse/ai-cli-log/tree/main/.ai-cli-log. The development prompts are primarily in Chinese.
Special thanks to Gemini for its invaluable help in the development of this tool!
无缝记录您与 AI 进行的编程对话。本命令行工具 (CLI) 能捕获您在终端中与 Gemini、Claude 等 AI 模型的交互过程,并将整个会话保存为清晰的纯文本文档,便于后续查阅和归档。
npm install -g ai-cli-log
使用 ai-cli-log 命令来包装任何您想记录的命令。核心结构是:
ai-cli-log [全局选项] run <要记录的命令> [参数...]
示例:
基本日志记录: 记录与 Google Gemini CLI 的会话。
ai-cli-log run gemini
日志将保存到 .ai-cli-log/ 目录中。
AI 驱动的文件名: 使用 AI 摘要作为日志文件名。选项必须在 run 命令之前。
# 使用默认摘要器启用摘要
ai-cli-log -s run gemini
# 或
ai-cli-log --with-summary run gemini
# 启用摘要并指定一个摘要器
ai-cli-log --by gemini-pro run gemini
# 或
ai-cli-log --summarizer gemini-pro run gemini
这将使用您默认(或指定)的摘要器生成一个描述性的文件名,例如 gemini-20250713-153000-fix-database-connection-error.txt。
为了更快捷地启动,您可以创建 shell 别名。这样,您可以用一个简短的命令开始一个带日志记录的会话。将以下内容添加到您的 shell 配置文件中(例如 ~/.bashrc, ~/.zshrc)。
# 启动一个带 AI 摘要的 Gemini 会话
alias ag='ai-cli-log -s run gemini'
# 启动一个带 AI 摘要的 Claude 会话
alias ac='ai-cli-log -s run claude'
# 您也可以省略 -s 标志以进行基本日志记录
alias ag-log='ai-cli-log run gemini'
现在,您只需运行 ag 即可启动一个被记录的 Gemini 会话。
ai-cli-log 从 config.json 文件中加载配置。它会优先使用本地(项目特定)的配置,其次是全局配置。
加载顺序:
.ai-cli-log/config.json。~/.config/ai-cli-log/config.json。您可以通过手动或使用交互式设置命令来创建这些文件。
init)init 命令可以帮助您创建配置文件。它会扫描可用的 AI 工具,引导您完成摘要器配置的创建,并设置一个默认值。
创建全局配置文件:
ai-cli-log init
这会将配置保存到 ~/.config/ai-cli-log/config.json。
创建本地(项目特定)配置文件:
ai-cli-log init --local
这会将配置保存到当前目录的 .ai-cli-log/config.json 中。
这是一个手动创建 config.json 的示例:
{
"summarizer": {
"default": "gemini-pro",
"summarizers": [
{
"name": "gemini-pro",
"tool": "gemini",
"prompt": "你是一个日志摘要器。你的响应必须是一个有效的 JSON 对象,其中包含一个键:\"summary\"(一个 3-5 个单词的、小写的、文件名友好的短语)。示例:{\"summary\": \"refactor-database-schema\"}。会话内容是:",
"maxLines": 100
},
{
"name": "ollama",
"tool": "ollama",
"model": "llama3",
"prompt": "你是一个日志摘要器。你的响应必须是一个有效的 JSON 对象,其中包含一个键:\"summary\"(一个 3-5 个单词的、小写的、文件名友好的短语)。示例:{\"summary\": \"refactor-database-schema\"}。会话内容是:",
"maxLines": 50
},
{
"name": "sgpt",
"tool": "custom",
"command": ["sgpt", "--chat", "session-summary", "\"{{prompt}}\""],
"prompt": "你是一个日志摘要器。你的响应必须是一个有效的 JSON 对象,其中包含一个键\"summary\"(一个 3-5 个单词的、小写的、文件名友好的短语)。示例:{\"summary\": \"refactor-database-schema\"}。会话内容是:",
"maxLines": 50
},
{
"name": "my-custom-summarizer",
"tool": "custom",
"command": ["my-summarizer-script", "--prompt", "{{prompt}}"],
"prompt": "You are a log summarizer. Your response MUST be a valid JSON object with one key: \"summary\" (a 3-5 word, lowercase, filename-friendly phrase). Example: {\"summary\": \"refactor-database-schema\"}. The session content is:",
"maxLines": 200
}
]
}
}
字段说明:
summarizer.default (可选): 默认使用的摘要器配置名称。summarizer.summarizers: 包含不同摘要器配置的数组。
name: 您为摘要器配置指定的唯一名称 (例如, gemini-pro, ollama, claude-opus, my-custom-summarizer)。tool: 指定摘要器使用的工具类型。
gemini: 使用 gemini CLI 工具。ollama: 使用 ollama CLI 工具。claude: 使用 claude CLI 工具。custom: 使用自定义命令。model (可选): 对于 ollama 工具,指定要使用的模型名称 (例如, llama3)。prompt: 传递给摘要器命令的提示。会话内容将作为标准输入传递。maxLines (可选): 限制传递给摘要器的会话内容行数。如果会话内容超过此限制,将只采样开头和结尾的行。command (可选): 对于 custom 工具,指定要执行的命令数组。会话内容会通过管道传递给该命令的 stdin。{{prompt}} 占位符将被实际的提示字符串替换。例如: ["my-summarizer-script", "--prompt", "{{prompt}}"]。summary 的键(例如,{"summary": "fix-login-bug"})。@xterm/headless 解释 ANSI 转义码,确保日志准确反映最终的终端状态(如加载动画、进度条等)。gemini、sgpt、ollama 等)用于生成摘要。本项目是在 Google Gemini 的协助下生成的。您可以在本项目的 GitHub 仓库中查看详细的开发过程和交互记录,所有开发记录(中文 Prompt)都保存在 .ai-cli-log 目录中:https://github.com/alingse/ai-cli-log/tree/main/.ai-cli-log。
特别感谢 Gemini 在本项目开发过程中提供的宝贵帮助!
GitHub checked 63h ago - refresh overdue. Recently viewed repositories target hourly refresh.
Find a documented setup for your client. No sign-in, installation, or tool execution.
If this MCP is also published on mcpchannel.ai, you can subscribe from Browse and use the gateway config there instead.