Skip to content
Miru 3.0 is here — expenses, CLI, dark mode, and 6 report types. Read the announcement →
Engineering AI CLI

How We Track Time with AI Agents and the Miru CLI

A practical guide to automated time tracking for teams using Claude Code, Codex, and other AI coding tools. Real workflows, real scripts, zero browser tabs.

Saeloun Team · · 5 min read

Here’s the dirty secret of every agency running AI coding tools: nobody knows where the time went.

A developer sits down at 9 AM. Opens Claude Code. Fixes a bug on the Acme project. Pivots to Codex for a quick migration on Brightside. Jumps back to Claude for a code review on the internal dashboard. By lunch, they’ve touched three projects and logged zero hours. By Friday, the timesheet is fiction. Educated guesses dressed up as data.

This costs real money. If you’re billing $150/hour and your team under-reports by just 30 minutes a day per developer, that’s $19,500/year per person walking out the door. For a 10-person team, you’re lighting almost $200K on fire annually because nobody remembered to click a button in a browser tab they closed three hours ago.

We know this because we lived it. At Saeloun, our team uses Claude Code and Codex daily. We tried every time tracker. Toggl, Harvest, manual timers, the honor system. They all failed for the same reason: AI coding sessions don’t respect the neat boundaries that traditional time trackers assume.

So we built the Miru CLI and designed workflows around it. Here’s exactly what we do.


The Simplest Version: Log After Each Session

After finishing a focused AI session, you log it. One line. No browser tab.

# After a 2-hour Claude Code session on the Acme project
miru time create --project "Acme Redesign" --duration 2h --date today \
  --note "Claude Code: Migrated auth system from JWT to session-based"

That’s it. The note captures what the AI session produced, which matters for billing transparency and for your future self when a client asks “what did you do in March?”

This works. But developers are lazy (this is a compliment), so we made it faster.


Shell Aliases: Two Seconds to Log

Add this to your .zshrc or .bashrc:

alias track='miru time create --date today'

Now logging is:

track --project "Acme" --duration 1.5h --note "Codex: Fixed N+1 queries in reports API"
track --project "Brightside" --duration 45m --note "Claude Code: Added Stripe webhook retry logic"
track --project "Internal" --duration 30m --note "Cursor: Updated CI config for Ruby 3.3"

No context switch. You’re already in the terminal. You just shipped code with an AI assistant. Log it before you move on. It takes two seconds and saves you 10 minutes of Friday afternoon archaeology.


Git Hook: Never Forget After a Commit

This is the one that changed everything for us. A post-commit hook that asks you to log time right when you commit:

#!/bin/bash
# .git/hooks/post-commit
echo "Log time for this commit? (duration in hours, or skip)"
read -p "> " duration
if [ "$duration" != "skip" ]; then
  project=$(basename $(git rev-parse --show-toplevel))
  msg=$(git log -1 --pretty=%s)
  miru time create --project "$project" --duration "${duration}h" \
    --date today --note "$msg"
  echo "✓ Logged ${duration}h to $project"
fi

You just committed “Fix race condition in invoice PDF generation.” The hook asks how long. You type 1.5. Done. The commit message becomes the time entry note automatically. No extra typing. No separate mental context.

The project name is inferred from the repo directory. If your repo is acme-redesign, the time entry goes to acme-redesign. Rename the project in Miru to match your repo names and the whole thing is zero-config.


Claude Code Hooks: Track AI Activity Automatically

Claude Code has a hook system that lets you run scripts when specific events happen. We use it to log AI session activity:

// .claude/settings.json
{
  "hooks": {
    "PostToolUse": [{
      "matcher": "Bash",
      "command": "echo 'AI session active' >> /tmp/miru-session.log"
    }]
  }
}

Every time Claude Code runs a command, it appends to a session log. At the end of the day, a script reads that log and tells you how much AI-assisted work happened. It’s not a replacement for logging — it’s a safety net that catches what you forgot.


The Daily Summary: Your End-of-Day Ritual

This is the script that ties it all together:

#!/bin/bash
# miru-daily-log.sh — run at end of day
echo "=== Daily Time Summary ==="
echo "Projects worked on today:"
miru time list --from today --to today
echo ""
echo "Unlogged commits:"
git log --since=midnight --oneline

Run this at 5 PM. It shows you what you’ve logged and what you’ve committed but haven’t logged. The gap between those two lists is your lost revenue. Close it before you close your laptop.


Why Traditional Time Tracking Fails with AI Tools

This isn’t about discipline. It’s about physics.

AI sessions blur project boundaries. You might use Claude Code to fix a bug on Acme, then without closing anything, ask it to review a PR on Brightside, then refactor a test on the internal dashboard. One terminal, three projects, forty minutes. A start/stop timer can’t handle this. You need point-in-time logging.

15-minute granularity is wrong. When AI makes you 3x faster, a meaningful unit of work might be 20 minutes, not 2 hours. Traditional timers round up to 15-minute blocks. The Miru CLI lets you log --duration 25m because that’s what actually happened.

Developers are already in the terminal. If you’re using Claude Code, Codex CLI, or even Cursor’s terminal, you’re right there. Asking you to open a browser, navigate to a time tracker, find the right project, and click buttons is asking you to break the flow that AI tools were designed to create. The CLI respects where you already are.


How We Actually Work at Saeloun

Here’s the real daily rhythm for our team:

Morning: Verify yesterday’s entries didn’t get lost.

miru time list --from yesterday --to yesterday

During work: Shell aliases after each AI session. Two-second habit.

End of day: Run the daily summary script. Log anything the git hook missed.

Friday: Weekly review to make sure nothing slipped through.

miru report time --from monday --to friday

This isn’t a perfect system. Perfection isn’t the goal. The goal is close enough to reality that your invoices are honest and your team gets paid for the work they actually did. We went from ~70% time capture accuracy to north of 95% with these workflows. That difference, for a team our size, is six figures annually.


What’s Next

We’re working on deeper AI agent integrations where the Miru CLI can be called directly by AI agents as part of their workflow. Imagine Claude Code automatically logging time entries based on the work it performed, tagged with the project and a summary of what changed. No human in the loop for the logging part — just for the review.

The pieces are all there. The CLI exists. The hooks exist. The AI tools have extensibility APIs. We just need to wire them together.

But honestly? Start with the shell alias. That alone will change your Fridays.

alias track='miru time create --date today'

Add it to your shell config. Right now. Before you forget. Like you forgot to log those two hours yesterday.

Share:
ST

Saeloun Team

The team behind Miru. Ruby on Rails consultancy turned product company. Based in Pune, India.

Try Miru today

Free to start. No credit card required.

Start Tracking Free