
What You Are Making
A Codex CLI prompt that reads yesterday's screen time data from ScreenTimerAI and generates a short daily productivity report in your terminal.
No browser. No GUI. Just a prompt and a result.
Why Codex CLI
Codex CLI is OpenAI's open-source command-line agent. It runs in your terminal, reads your codebase, and executes tasks using GPT models — no browser or desktop app required. Developers use it when they want OpenAI's models embedded in a terminal-based agent workflow for coding, refactoring, and automation.
Connecting screen time tracking to Codex CLI makes sense because it already handles MCP servers natively through its TOML config. Adding ScreenTimerAI is just another server entry. Once connected, you get productivity insights in the same terminal where you already write code, run builds, and manage your projects — no context switching to a separate dashboard.
Step 1: Connect ScreenTimerAI To Codex CLI
There are two ways to add the MCP server:
Run this in your terminal:
codex mcp add screentimerai-activities -- /Applications/ScreenTimerAI.app/Contents/MacOS/activity-mcp-server
If you want to test that Step 1 worked, start a Codex CLI session and try one of these prompts:
| MCP function | Test prompt |
|---|---|
get_current_activity | What am I doing right now? |
get_activity_logs | Get my raw activity logs for yesterday. |
show_activity_timeline | Show me an activity timeline for yesterday. |
summarize_activity_range | Summarize my activity for yesterday. |
analyze_focus_segments | Analyze my focus segments for yesterday afternoon. |
show_focus_score_timeline | Show me a focus score timeline for today. |
show_focus_score_trends | Show me my focus score last week. |
Step 2: Generate Your Daily Report
Start a Codex CLI session and paste this prompt:
Generate a daily productivity text report based on yesterday's Screen Time AI data.
Follow these steps:
1. Fetch yesterday's activity data from Screen Time AI.
2. Write a short productivity report (~150 words) from the perspective of a dark, witty productivity coach reacting to the data.
Rules:
- Focus more on failures than successes
- Use short, punchy sentences
- Be dark and witty, commanding not polished
- Swearing is allowed sparingly for impact
- Return only the final report text, nothing else
Return the report as plain text directly in the chat.Codex CLI will discover the ScreenTimerAI tools automatically and call them to fetch your data. Approve the tool calls and the report appears in your terminal.
Other Prompts To Try
Once the MCP connection is working, you are not limited to the daily report prompt above. Here are a few more prompts that work well from Codex CLI:
- Top apps breakdown: "Show me my top 5 apps by time spent yesterday." This gives you a quick ranked list of where your hours went, useful for spotting time sinks you did not notice.
- Context switch count: "How many context switches did I have yesterday afternoon?" Context switches are one of the biggest focus killers. Tracking them helps you design longer uninterrupted blocks.
- Weekly comparison: "Compare my screen time this week vs last week." A week-over-week view shows whether changes you made to your routine are actually working.
- Productive hours analysis: "Analyze my focus segments for yesterday and identify my most productive hours." This helps you learn when your deep work windows naturally occur so you can protect them.
Each prompt uses a different combination of MCP tools behind the scenes. Codex CLI handles the tool selection and chaining automatically.
Troubleshooting
If something is not working after setup, check these common issues:
- Server not connecting? Verify the binary path in
~/.codex/config.tomlis correct and that the file is executable. Runls -la /Applications/ScreenTimerAI.app/Contents/MacOS/activity-mcp-serverto confirm it exists and has execute permissions. - Tool calls timing out? Increase
tool_timeout_secin the TOML config. The default is 60 seconds, which should be enough for most queries, but large date ranges may need more time. - Tools not appearing? Make sure
enabled = trueis set in the server config block and restart Codex CLI. The tool list is loaded at session startup, so config changes require a fresh session.
What Happens Next
Every time you run the prompt, Codex CLI pulls your latest screen time data through the MCP connection and generates a fresh report.
Use it as a quick morning check-in from your terminal.