# Changelog ## [0.18.4] - 2025-12-11 ### Fixed - Attachment downloads now work correctly - SlackBot now receives store for processing file downloads - Files are downloaded in background and stored in `/attachments/` - Attachment paths passed to agent as absolute paths in execution environment - Backfill also downloads attachments from historical messages ## [0.18.3] - 2025-12-11 ### Changed - Complete rewrite of message handling architecture (#115) - Now uses `AgentSession` from coding-agent for session management - Brings auto-compaction, overflow handling, and proper prompt caching - `log.jsonl` is the source of truth for all channel messages - `context.jsonl` stores LLM context (messages sent to Claude, same format as coding-agent) - Sync mechanism ensures context.jsonl stays in sync with log.jsonl at run start - Session header written immediately on new session creation (not lazily) - Tool results preserved in context.jsonl for multi-turn continuity - Backfill improvements - Only backfills channels that already have a `log.jsonl` file - Strips @mentions from backfilled messages (consistent with live messages) - Uses largest timestamp in log for efficient incremental backfill - Fetches DM channels in addition to public/private channels - Message handling improvements - Channel chatter (messages without @mention) logged but doesn't trigger processing - Messages sent while mom is busy are logged and synced on next run - Pre-startup messages (replayed by Slack on reconnect) logged but not auto-processed - Stop command executes immediately (not queued), can interrupt running tasks - Channel @mentions no longer double-logged (was firing both app_mention and message events) - Usage summary now includes context window usage - Shows current context tokens vs model's context window - Example: `Context: 4.2k / 200k (2.1%)` ### Fixed - Slack API errors (msg_too_long) no longer crash the process - Added try/catch error handling to all Slack API calls in the message queue - Main channel messages truncated at 35K with note to ask for elaboration - Thread messages truncated at 20K - replaceMessage also truncated at 35K - Private channel messages not being logged - Added `message.groups` to required bot events in README - Added `groups:history` and `groups:read` to required scopes in README - Stop command now updates "Stopping..." to "Stopped" instead of posting two messages ### Added - Port truncation logic from coding-agent: bash and read tools now use consistent 2000 lines OR 50KB limits with actionable notices ## [0.10.2] - 2025-11-27 ### Breaking Changes - Timestamps now use Slack format (seconds.microseconds) and messages are sorted by `ts` field - **Migration required**: Run `npx tsx scripts/migrate-timestamps.ts ./data` to fix existing logs - Without migration, message context will be incorrectly ordered ### Added - Channel and user ID mappings in system prompt - Fetches all channels bot is member of and all workspace users at startup - Mom can now reference channels by name and mention users properly - Skills documentation in system prompt - Explains custom CLI tools pattern with SKILL.md files - Encourages mom to create reusable tools for recurring tasks - Debug output: writes `last_prompt.txt` to channel directory with full context - Bash working directory info in system prompt (/ for Docker, cwd for host) - Token-efficient log queries that filter out tool calls/results for summaries ### Changed - Turn-based message context instead of raw line count (#68) - Groups consecutive bot messages (tool calls/results) as single turn - "50 turns" now means ~50 conversation exchanges, not 50 log lines - Prevents tool-heavy runs from pushing out conversation context - Messages sorted by Slack timestamp before building context - Fixes out-of-order issues from async attachment downloads - Added monotonic counter for sub-millisecond ordering - Condensed system prompt from ~5k to ~2.7k chars - More concise workspace layout (tree format) - Clearer log query examples (conversation-only vs full details) - Removed redundant guidelines section - User prompt simplified: removed duplicate "Current message" (already in history) - Tool status labels (`_→ label_`) no longer logged to jsonl - Thread messages and thinking no longer double-logged ### Fixed - Duplicate message logging: removed redundant log from app_mention handler - Username obfuscation in thread messages to prevent unwanted pings - Handles @username, bare username, and <@USERID> formats - Escapes special regex characters in usernames ## [0.10.1] - 2025-11-27 ### Changed - Reduced tool verbosity in main Slack messages (#65) - During execution: show tool labels (with → prefix), thinking, and text - After completion: replace main message with only final assistant response - Full audit trail preserved in thread (tool details, thinking, text) - Added promise queue to ensure message updates execute in correct order ## [0.10.0] - 2025-11-27 ### Added - Working memory system with MEMORY.md files - Global workspace memory (`workspace/MEMORY.md`) shared across all channels - Channel-specific memory (`workspace//MEMORY.md`) for per-channel context - Automatic memory loading into system prompt on each request - Mom can update memory files to remember project details, preferences, and context - ISO 8601 date field in log.jsonl for easy date-based grepping - Format: `"date":"2025-11-26T10:44:00.123Z"` - Enables queries like: `grep '"date":"2025-11-26' log.jsonl` - Centralized logging system (`src/log.ts`) - Structured, colored console output (green for user messages, yellow for mom activity, dim for details) - Consistent format: `[HH:MM:SS] [context] message` - Type-safe logging functions for all event types - Usage tracking and cost reporting - Tracks tokens (input, output, cache read, cache write) and costs per run - Displays summary at end of each agent run in console and Slack thread - Example: `💰 Usage: 12,543 in + 847 out (5,234 cache read, 127 cache write) = $0.0234` - Working indicator in Slack messages - Channel messages show "..." while mom is processing - Automatically removed when work completes - Improved stop command behavior - Separate "Stopping..." message that updates to "Stopped" when abort completes - Original working message continues to show tool results (including abort errors) - Clean separation between status and results ### Changed - Enhanced system prompt with clearer directory structure and path examples - Improved memory file path documentation to prevent confusion - Message history format now includes ISO 8601 date for better searchability - System prompt now includes log.jsonl format documentation with grep examples - System prompt now includes current date and time for date-aware operations - Added efficient log query patterns using jq to prevent context overflow - System prompt emphasizes limiting NUMBER of messages (10-50), not truncating message text - Log queries now show full message text and attachments for better context - Fixed jq patterns to handle null/empty attachments with `(.attachments // [])` - Recent messages in system prompt now formatted as TSV (43% token savings vs raw JSONL) - Enhanced security documentation with prompt injection risk warnings and mitigations - **Moved recent messages from system prompt to user message** for better prompt caching - System prompt is now mostly static (only changes when memory files change) - Enables Anthropic's prompt caching to work effectively - Significantly reduces costs on subsequent requests - Switched from Claude Opus 4.5 to Claude Sonnet 4.5 (~40% cost reduction) - Tool result display now extracts actual text instead of showing JSON wrapper - Slack thread messages now show cleaner tool call formatting with duration and label - All console logging centralized and removed from scattered locations - Agent run now returns `{ stopReason }` instead of throwing exceptions - Clean handling of "aborted", "error", "stop", "length", "toolUse" cases - No more error-based control flow ### Fixed - jq query patterns now properly handle messages without attachments (no more errors on empty arrays) ## [0.9.4] - 2025-11-26 ### Added - Initial release of Mom Slack bot - Slack integration with @mentions and DMs - Docker sandbox mode for isolated execution - Bash tool with full shell access - Read, write, edit file tools - Attach tool for sharing files in Slack - Thread-based tool details (clean main messages, verbose details in threads) - Single accumulated message per agent run - Stop command (`@mom stop`) to abort running tasks - Persistent workspace per channel with scratchpad directory - Streaming console output for monitoring