mom: turn-based context, timestamp fixes, system prompt improvements (#68)

Breaking Changes:
- Timestamps now use Slack format - run migrate-timestamps.ts for existing logs

Added:
- Channel/user ID mappings in system prompt
- Skills documentation in system prompt
- Debug last_prompt.txt output
- Bash working directory info
- Token-efficient log queries filtering tool calls

Changed:
- Turn-based message context (groups consecutive bot messages as one turn)
- Messages sorted by Slack timestamp
- Condensed system prompt (~5k → ~2.7k chars)
- Simplified user prompt
- Selective logging (skip UI status labels)

Fixed:
- Duplicate message logging from app_mention handler
- Username obfuscation in thread messages
This commit is contained in:
Mario Zechner
2025-11-27 23:45:25 +01:00
parent 330e044b55
commit 9ebee631be
6 changed files with 619 additions and 239 deletions

View File

@@ -2,6 +2,48 @@
## [Unreleased]
### 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